styled-components 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/styled-components-macro.cjs.js +1 -1
- package/dist/styled-components-macro.esm.js +1 -1
- package/dist/styled-components.browser.cjs.js +1 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +1 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +1 -1
- package/dist/styled-components.js.map +1 -1
- package/dist/styled-components.min.js +1 -1
- package/dist/styled-components.min.js.map +1 -1
- package/native/dist/styled-components.native.cjs.js +212 -209
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +212 -209
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/package.json +4 -4
- package/primitives/dist/styled-components-primitives.cjs.js +212 -209
- package/primitives/dist/styled-components-primitives.cjs.js.map +1 -1
- package/primitives/dist/styled-components-primitives.esm.js +212 -209
- package/primitives/dist/styled-components-primitives.esm.js.map +1 -1
|
@@ -147,17 +147,14 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
147
147
|
var SC_ATTR = typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || 'data-styled';
|
|
148
148
|
var SC_ATTR_ACTIVE = 'active';
|
|
149
149
|
var SC_ATTR_VERSION = 'data-styled-version';
|
|
150
|
-
var SC_VERSION = "5.
|
|
150
|
+
var SC_VERSION = "5.3.0";
|
|
151
151
|
var SPLITTER = '/*!sc*/\n';
|
|
152
152
|
var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
153
|
-
var DISABLE_SPEEDY = typeof SC_DISABLE_SPEEDY === 'boolean'
|
|
153
|
+
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean' ? SC_DISABLE_SPEEDY : typeof process !== 'undefined' && typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' && process.env.REACT_APP_SC_DISABLE_SPEEDY !== '' ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false' ? false : process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process !== 'undefined' && typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' && process.env.SC_DISABLE_SPEEDY !== '' ? process.env.SC_DISABLE_SPEEDY === 'false' ? false : process.env.SC_DISABLE_SPEEDY : process.env.NODE_ENV !== 'production'); // Shared empty execution context when generating static styles
|
|
154
154
|
|
|
155
155
|
//
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
var getNonce = function getNonce() {
|
|
159
|
-
return typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
|
|
160
|
-
};
|
|
156
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
157
|
+
var EMPTY_OBJECT = Object.freeze({});
|
|
161
158
|
|
|
162
159
|
var errorMap = {
|
|
163
160
|
"1": "Cannot create styled-component for component: %s.\n\n",
|
|
@@ -216,192 +213,6 @@ function throwStyledComponentsError(code) {
|
|
|
216
213
|
}
|
|
217
214
|
}
|
|
218
215
|
|
|
219
|
-
//
|
|
220
|
-
var ELEMENT_TYPE = 1;
|
|
221
|
-
/* Node.ELEMENT_TYPE */
|
|
222
|
-
|
|
223
|
-
/** Find last style element if any inside target */
|
|
224
|
-
|
|
225
|
-
var findLastStyleTag = function findLastStyleTag(target) {
|
|
226
|
-
var childNodes = target.childNodes;
|
|
227
|
-
|
|
228
|
-
for (var i = childNodes.length; i >= 0; i--) {
|
|
229
|
-
var child = childNodes[i];
|
|
230
|
-
|
|
231
|
-
if (child && child.nodeType === ELEMENT_TYPE && child.hasAttribute(SC_ATTR)) {
|
|
232
|
-
return child;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return undefined;
|
|
237
|
-
};
|
|
238
|
-
/** Create a style element inside `target` or <head> after the last */
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
var makeStyleTag = function makeStyleTag(target) {
|
|
242
|
-
var head = document.head;
|
|
243
|
-
var parent = target || head;
|
|
244
|
-
var style = document.createElement('style');
|
|
245
|
-
var prevStyle = findLastStyleTag(parent);
|
|
246
|
-
var nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
|
|
247
|
-
style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);
|
|
248
|
-
style.setAttribute(SC_ATTR_VERSION, SC_VERSION);
|
|
249
|
-
var nonce = getNonce();
|
|
250
|
-
if (nonce) style.setAttribute('nonce', nonce);
|
|
251
|
-
parent.insertBefore(style, nextSibling);
|
|
252
|
-
return style;
|
|
253
|
-
};
|
|
254
|
-
/** Get the CSSStyleSheet instance for a given style element */
|
|
255
|
-
|
|
256
|
-
var getSheet = function getSheet(tag) {
|
|
257
|
-
if (tag.sheet) {
|
|
258
|
-
return tag.sheet;
|
|
259
|
-
} // Avoid Firefox quirk where the style element might not have a sheet property
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
var _document = document,
|
|
263
|
-
styleSheets = _document.styleSheets;
|
|
264
|
-
|
|
265
|
-
for (var i = 0, l = styleSheets.length; i < l; i++) {
|
|
266
|
-
var sheet = styleSheets[i];
|
|
267
|
-
|
|
268
|
-
if (sheet.ownerNode === tag) {
|
|
269
|
-
return sheet;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
throwStyledComponentsError(17);
|
|
274
|
-
return undefined;
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
//
|
|
278
|
-
/** Create a CSSStyleSheet-like tag depending on the environment */
|
|
279
|
-
|
|
280
|
-
var makeTag = function makeTag(_ref) {
|
|
281
|
-
var isServer = _ref.isServer,
|
|
282
|
-
useCSSOMInjection = _ref.useCSSOMInjection,
|
|
283
|
-
target = _ref.target;
|
|
284
|
-
|
|
285
|
-
if (isServer) {
|
|
286
|
-
return new VirtualTag(target);
|
|
287
|
-
} else if (useCSSOMInjection) {
|
|
288
|
-
return new CSSOMTag(target);
|
|
289
|
-
} else {
|
|
290
|
-
return new TextTag(target);
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
var CSSOMTag = /*#__PURE__*/function () {
|
|
294
|
-
function CSSOMTag(target) {
|
|
295
|
-
var element = this.element = makeStyleTag(target); // Avoid Edge bug where empty style elements don't create sheets
|
|
296
|
-
|
|
297
|
-
element.appendChild(document.createTextNode(''));
|
|
298
|
-
this.sheet = getSheet(element);
|
|
299
|
-
this.length = 0;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
var _proto = CSSOMTag.prototype;
|
|
303
|
-
|
|
304
|
-
_proto.insertRule = function insertRule(index, rule) {
|
|
305
|
-
try {
|
|
306
|
-
this.sheet.insertRule(rule, index);
|
|
307
|
-
this.length++;
|
|
308
|
-
return true;
|
|
309
|
-
} catch (_error) {
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
_proto.deleteRule = function deleteRule(index) {
|
|
315
|
-
this.sheet.deleteRule(index);
|
|
316
|
-
this.length--;
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
_proto.getRule = function getRule(index) {
|
|
320
|
-
var rule = this.sheet.cssRules[index]; // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
|
|
321
|
-
|
|
322
|
-
if (rule !== undefined && typeof rule.cssText === 'string') {
|
|
323
|
-
return rule.cssText;
|
|
324
|
-
} else {
|
|
325
|
-
return '';
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
return CSSOMTag;
|
|
330
|
-
}();
|
|
331
|
-
/** A Tag that emulates the CSSStyleSheet API but uses text nodes */
|
|
332
|
-
|
|
333
|
-
var TextTag = /*#__PURE__*/function () {
|
|
334
|
-
function TextTag(target) {
|
|
335
|
-
var element = this.element = makeStyleTag(target);
|
|
336
|
-
this.nodes = element.childNodes;
|
|
337
|
-
this.length = 0;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
var _proto2 = TextTag.prototype;
|
|
341
|
-
|
|
342
|
-
_proto2.insertRule = function insertRule(index, rule) {
|
|
343
|
-
if (index <= this.length && index >= 0) {
|
|
344
|
-
var node = document.createTextNode(rule);
|
|
345
|
-
var refNode = this.nodes[index];
|
|
346
|
-
this.element.insertBefore(node, refNode || null);
|
|
347
|
-
this.length++;
|
|
348
|
-
return true;
|
|
349
|
-
} else {
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
_proto2.deleteRule = function deleteRule(index) {
|
|
355
|
-
this.element.removeChild(this.nodes[index]);
|
|
356
|
-
this.length--;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
_proto2.getRule = function getRule(index) {
|
|
360
|
-
if (index < this.length) {
|
|
361
|
-
return this.nodes[index].textContent;
|
|
362
|
-
} else {
|
|
363
|
-
return '';
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
return TextTag;
|
|
368
|
-
}();
|
|
369
|
-
/** A completely virtual (server-side) Tag that doesn't manipulate the DOM */
|
|
370
|
-
|
|
371
|
-
var VirtualTag = /*#__PURE__*/function () {
|
|
372
|
-
function VirtualTag(_target) {
|
|
373
|
-
this.rules = [];
|
|
374
|
-
this.length = 0;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
var _proto3 = VirtualTag.prototype;
|
|
378
|
-
|
|
379
|
-
_proto3.insertRule = function insertRule(index, rule) {
|
|
380
|
-
if (index <= this.length) {
|
|
381
|
-
this.rules.splice(index, 0, rule);
|
|
382
|
-
this.length++;
|
|
383
|
-
return true;
|
|
384
|
-
} else {
|
|
385
|
-
return false;
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
_proto3.deleteRule = function deleteRule(index) {
|
|
390
|
-
this.rules.splice(index, 1);
|
|
391
|
-
this.length--;
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
_proto3.getRule = function getRule(index) {
|
|
395
|
-
if (index < this.length) {
|
|
396
|
-
return this.rules[index];
|
|
397
|
-
} else {
|
|
398
|
-
return '';
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
return VirtualTag;
|
|
403
|
-
}();
|
|
404
|
-
|
|
405
216
|
//
|
|
406
217
|
/** Create a GroupedTag with an underlying Tag implementation */
|
|
407
218
|
|
|
@@ -506,6 +317,10 @@ var getGroupForId = function getGroupForId(id) {
|
|
|
506
317
|
return groupIDRegister.get(id);
|
|
507
318
|
}
|
|
508
319
|
|
|
320
|
+
while (reverseRegister.has(nextFreeGroup)) {
|
|
321
|
+
nextFreeGroup++;
|
|
322
|
+
}
|
|
323
|
+
|
|
509
324
|
var group = nextFreeGroup++;
|
|
510
325
|
|
|
511
326
|
if (process.env.NODE_ENV !== 'production' && ((group | 0) < 0 || group > MAX_SMI)) {
|
|
@@ -520,10 +335,6 @@ var getIdForGroup = function getIdForGroup(group) {
|
|
|
520
335
|
return reverseRegister.get(group);
|
|
521
336
|
};
|
|
522
337
|
var setGroupForId = function setGroupForId(id, group) {
|
|
523
|
-
if (group >= nextFreeGroup) {
|
|
524
|
-
nextFreeGroup = group + 1;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
338
|
groupIDRegister.set(id, group);
|
|
528
339
|
reverseRegister.set(group, id);
|
|
529
340
|
};
|
|
@@ -618,6 +429,199 @@ var rehydrateSheet = function rehydrateSheet(sheet) {
|
|
|
618
429
|
}
|
|
619
430
|
};
|
|
620
431
|
|
|
432
|
+
//
|
|
433
|
+
|
|
434
|
+
/* eslint-disable camelcase, no-undef */
|
|
435
|
+
var getNonce = function getNonce() {
|
|
436
|
+
return typeof window !== 'undefined' ? typeof window.__webpack_nonce__ !== 'undefined' ? window.__webpack_nonce__ : null : null;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
//
|
|
440
|
+
var ELEMENT_TYPE = 1;
|
|
441
|
+
/* Node.ELEMENT_TYPE */
|
|
442
|
+
|
|
443
|
+
/** Find last style element if any inside target */
|
|
444
|
+
|
|
445
|
+
var findLastStyleTag = function findLastStyleTag(target) {
|
|
446
|
+
var childNodes = target.childNodes;
|
|
447
|
+
|
|
448
|
+
for (var i = childNodes.length; i >= 0; i--) {
|
|
449
|
+
var child = childNodes[i];
|
|
450
|
+
|
|
451
|
+
if (child && child.nodeType === ELEMENT_TYPE && child.hasAttribute(SC_ATTR)) {
|
|
452
|
+
return child;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return undefined;
|
|
457
|
+
};
|
|
458
|
+
/** Create a style element inside `target` or <head> after the last */
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
var makeStyleTag = function makeStyleTag(target) {
|
|
462
|
+
var head = document.head;
|
|
463
|
+
var parent = target || head;
|
|
464
|
+
var style = document.createElement('style');
|
|
465
|
+
var prevStyle = findLastStyleTag(parent);
|
|
466
|
+
var nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
|
|
467
|
+
style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);
|
|
468
|
+
style.setAttribute(SC_ATTR_VERSION, SC_VERSION);
|
|
469
|
+
var nonce = getNonce();
|
|
470
|
+
if (nonce) style.setAttribute('nonce', nonce);
|
|
471
|
+
parent.insertBefore(style, nextSibling);
|
|
472
|
+
return style;
|
|
473
|
+
};
|
|
474
|
+
/** Get the CSSStyleSheet instance for a given style element */
|
|
475
|
+
|
|
476
|
+
var getSheet = function getSheet(tag) {
|
|
477
|
+
if (tag.sheet) {
|
|
478
|
+
return tag.sheet;
|
|
479
|
+
} // Avoid Firefox quirk where the style element might not have a sheet property
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
var _document = document,
|
|
483
|
+
styleSheets = _document.styleSheets;
|
|
484
|
+
|
|
485
|
+
for (var i = 0, l = styleSheets.length; i < l; i++) {
|
|
486
|
+
var sheet = styleSheets[i];
|
|
487
|
+
|
|
488
|
+
if (sheet.ownerNode === tag) {
|
|
489
|
+
return sheet;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
throwStyledComponentsError(17);
|
|
494
|
+
return undefined;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
//
|
|
498
|
+
/** Create a CSSStyleSheet-like tag depending on the environment */
|
|
499
|
+
|
|
500
|
+
var makeTag = function makeTag(_ref) {
|
|
501
|
+
var isServer = _ref.isServer,
|
|
502
|
+
useCSSOMInjection = _ref.useCSSOMInjection,
|
|
503
|
+
target = _ref.target;
|
|
504
|
+
|
|
505
|
+
if (isServer) {
|
|
506
|
+
return new VirtualTag(target);
|
|
507
|
+
} else if (useCSSOMInjection) {
|
|
508
|
+
return new CSSOMTag(target);
|
|
509
|
+
} else {
|
|
510
|
+
return new TextTag(target);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
var CSSOMTag = /*#__PURE__*/function () {
|
|
514
|
+
function CSSOMTag(target) {
|
|
515
|
+
var element = this.element = makeStyleTag(target); // Avoid Edge bug where empty style elements don't create sheets
|
|
516
|
+
|
|
517
|
+
element.appendChild(document.createTextNode(''));
|
|
518
|
+
this.sheet = getSheet(element);
|
|
519
|
+
this.length = 0;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
var _proto = CSSOMTag.prototype;
|
|
523
|
+
|
|
524
|
+
_proto.insertRule = function insertRule(index, rule) {
|
|
525
|
+
try {
|
|
526
|
+
this.sheet.insertRule(rule, index);
|
|
527
|
+
this.length++;
|
|
528
|
+
return true;
|
|
529
|
+
} catch (_error) {
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
_proto.deleteRule = function deleteRule(index) {
|
|
535
|
+
this.sheet.deleteRule(index);
|
|
536
|
+
this.length--;
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
_proto.getRule = function getRule(index) {
|
|
540
|
+
var rule = this.sheet.cssRules[index]; // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
|
|
541
|
+
|
|
542
|
+
if (rule !== undefined && typeof rule.cssText === 'string') {
|
|
543
|
+
return rule.cssText;
|
|
544
|
+
} else {
|
|
545
|
+
return '';
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
return CSSOMTag;
|
|
550
|
+
}();
|
|
551
|
+
/** A Tag that emulates the CSSStyleSheet API but uses text nodes */
|
|
552
|
+
|
|
553
|
+
var TextTag = /*#__PURE__*/function () {
|
|
554
|
+
function TextTag(target) {
|
|
555
|
+
var element = this.element = makeStyleTag(target);
|
|
556
|
+
this.nodes = element.childNodes;
|
|
557
|
+
this.length = 0;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
var _proto2 = TextTag.prototype;
|
|
561
|
+
|
|
562
|
+
_proto2.insertRule = function insertRule(index, rule) {
|
|
563
|
+
if (index <= this.length && index >= 0) {
|
|
564
|
+
var node = document.createTextNode(rule);
|
|
565
|
+
var refNode = this.nodes[index];
|
|
566
|
+
this.element.insertBefore(node, refNode || null);
|
|
567
|
+
this.length++;
|
|
568
|
+
return true;
|
|
569
|
+
} else {
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
_proto2.deleteRule = function deleteRule(index) {
|
|
575
|
+
this.element.removeChild(this.nodes[index]);
|
|
576
|
+
this.length--;
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
_proto2.getRule = function getRule(index) {
|
|
580
|
+
if (index < this.length) {
|
|
581
|
+
return this.nodes[index].textContent;
|
|
582
|
+
} else {
|
|
583
|
+
return '';
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
return TextTag;
|
|
588
|
+
}();
|
|
589
|
+
/** A completely virtual (server-side) Tag that doesn't manipulate the DOM */
|
|
590
|
+
|
|
591
|
+
var VirtualTag = /*#__PURE__*/function () {
|
|
592
|
+
function VirtualTag(_target) {
|
|
593
|
+
this.rules = [];
|
|
594
|
+
this.length = 0;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
var _proto3 = VirtualTag.prototype;
|
|
598
|
+
|
|
599
|
+
_proto3.insertRule = function insertRule(index, rule) {
|
|
600
|
+
if (index <= this.length) {
|
|
601
|
+
this.rules.splice(index, 0, rule);
|
|
602
|
+
this.length++;
|
|
603
|
+
return true;
|
|
604
|
+
} else {
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
_proto3.deleteRule = function deleteRule(index) {
|
|
610
|
+
this.rules.splice(index, 1);
|
|
611
|
+
this.length--;
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
_proto3.getRule = function getRule(index) {
|
|
615
|
+
if (index < this.length) {
|
|
616
|
+
return this.rules[index];
|
|
617
|
+
} else {
|
|
618
|
+
return '';
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
return VirtualTag;
|
|
623
|
+
}();
|
|
624
|
+
|
|
621
625
|
var SHOULD_REHYDRATE = IS_BROWSER;
|
|
622
626
|
var defaultOptions = {
|
|
623
627
|
isServer: !IS_BROWSER,
|
|
@@ -633,7 +637,7 @@ var StyleSheet = /*#__PURE__*/function () {
|
|
|
633
637
|
|
|
634
638
|
function StyleSheet(options, globalStyles, names) {
|
|
635
639
|
if (options === void 0) {
|
|
636
|
-
options =
|
|
640
|
+
options = EMPTY_OBJECT;
|
|
637
641
|
}
|
|
638
642
|
|
|
639
643
|
if (globalStyles === void 0) {
|
|
@@ -729,10 +733,6 @@ var StyleSheet = /*#__PURE__*/function () {
|
|
|
729
733
|
return StyleSheet;
|
|
730
734
|
}();
|
|
731
735
|
|
|
732
|
-
//
|
|
733
|
-
var EMPTY_ARRAY = Object.freeze([]);
|
|
734
|
-
var EMPTY_OBJECT = Object.freeze({});
|
|
735
|
-
|
|
736
736
|
/**
|
|
737
737
|
* MIT License
|
|
738
738
|
*
|
|
@@ -835,7 +835,7 @@ function createStylisInstance(_temp) {
|
|
|
835
835
|
|
|
836
836
|
var selfReferenceReplacer = function selfReferenceReplacer(match, offset, string) {
|
|
837
837
|
if ( // do not replace the first occurrence if it is complex (has a modifier)
|
|
838
|
-
(offset === 0 ?
|
|
838
|
+
(offset === 0 ? COMPLEX_SELECTOR_PREFIX.indexOf(string[_selector.length]) === -1 : true) && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
|
|
839
839
|
!string.match(_consecutiveSelfRefRegExp)) {
|
|
840
840
|
return "." + _componentId;
|
|
841
841
|
}
|
|
@@ -948,7 +948,7 @@ var Keyframes = /*#__PURE__*/function () {
|
|
|
948
948
|
* https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
|
|
949
949
|
*/
|
|
950
950
|
var uppercaseCheck = /([A-Z])/;
|
|
951
|
-
var uppercasePattern =
|
|
951
|
+
var uppercasePattern = /([A-Z])/g;
|
|
952
952
|
var msPattern = /^ms-/;
|
|
953
953
|
|
|
954
954
|
var prefixAndLowerCase = function prefixAndLowerCase(_char) {
|
|
@@ -5870,7 +5870,6 @@ function isTag(target) {
|
|
|
5870
5870
|
|
|
5871
5871
|
//
|
|
5872
5872
|
function generateDisplayName(target) {
|
|
5873
|
-
// $FlowFixMe
|
|
5874
5873
|
return isTag(target) ? "styled." + target : "Styled(" + getComponentName(target) + ")";
|
|
5875
5874
|
}
|
|
5876
5875
|
|
|
@@ -5952,9 +5951,10 @@ var StyledNativeComponent = /*#__PURE__*/function (_Component) {
|
|
|
5952
5951
|
forwardedComponent = _this2$props.forwardedComponent,
|
|
5953
5952
|
forwardedAs = _this2$props.forwardedAs,
|
|
5954
5953
|
forwardedRef = _this2$props.forwardedRef,
|
|
5954
|
+
testID = _this2$props.testID,
|
|
5955
5955
|
_this2$props$style = _this2$props.style,
|
|
5956
5956
|
style = _this2$props$style === void 0 ? [] : _this2$props$style,
|
|
5957
|
-
props = _objectWithoutPropertiesLoose(_this2$props, ["$as", "as", "forwardedComponent", "forwardedAs", "forwardedRef", "style"]);
|
|
5957
|
+
props = _objectWithoutPropertiesLoose(_this2$props, ["$as", "as", "forwardedComponent", "forwardedAs", "forwardedRef", "testID", "style"]);
|
|
5958
5958
|
|
|
5959
5959
|
var defaultProps = forwardedComponent.defaultProps,
|
|
5960
5960
|
target = forwardedComponent.target,
|
|
@@ -5978,7 +5978,10 @@ var StyledNativeComponent = /*#__PURE__*/function (_Component) {
|
|
|
5978
5978
|
}
|
|
5979
5979
|
}
|
|
5980
5980
|
|
|
5981
|
-
propsForElement.style =
|
|
5981
|
+
propsForElement.style = typeof style === 'function' ? function (state) {
|
|
5982
|
+
return [generatedStyles].concat(style(state));
|
|
5983
|
+
} : [generatedStyles].concat(style);
|
|
5984
|
+
propsForElement.testID = testID;
|
|
5982
5985
|
if (forwardedRef) propsForElement.ref = forwardedRef;
|
|
5983
5986
|
if (forwardedAs) propsForElement.as = forwardedAs;
|
|
5984
5987
|
return createElement(elementToBeRendered, propsForElement);
|
|
@@ -6060,9 +6063,9 @@ var _StyledNativeComponent = (function (InlineStyle) {
|
|
|
6060
6063
|
if (isTargetStyledComp && target.shouldForwardProp) {
|
|
6061
6064
|
if (shouldForwardProp) {
|
|
6062
6065
|
// compose nested shouldForwardProp calls
|
|
6063
|
-
shouldForwardProp = function shouldForwardProp(prop, filterFn) {
|
|
6066
|
+
shouldForwardProp = function shouldForwardProp(prop, filterFn, elementToBeCreated) {
|
|
6064
6067
|
return (// $FlowFixMe
|
|
6065
|
-
target.shouldForwardProp(prop, filterFn) && options.shouldForwardProp(prop, filterFn)
|
|
6068
|
+
target.shouldForwardProp(prop, filterFn, elementToBeCreated) && options.shouldForwardProp(prop, filterFn, elementToBeCreated)
|
|
6066
6069
|
);
|
|
6067
6070
|
};
|
|
6068
6071
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled-components.native.esm.js","sources":["../../src/constants.js","../../src/sheet/Tag.js","../../src/sheet/GroupedTag.js","../../src/sheet/GroupIDAllocator.js","../../src/sheet/Sheet.js","../../src/models/Keyframes.js","../../src/models/InlineStyle.js"],"sourcesContent":["// @flow\n\ndeclare var SC_DISABLE_SPEEDY: ?boolean;\ndeclare var __VERSION__: string;\n\nexport const SC_ATTR =\n (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||\n 'data-styled';\n\nexport const SC_ATTR_ACTIVE = 'active';\nexport const SC_ATTR_VERSION = 'data-styled-version';\nexport const SC_VERSION = __VERSION__;\nexport const SPLITTER = '/*!sc*/\\n';\n\nexport const IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;\n\nexport const DISABLE_SPEEDY =\n (typeof SC_DISABLE_SPEEDY === 'boolean' && SC_DISABLE_SPEEDY) ||\n (typeof process !== 'undefined' &&\n (process.env.REACT_APP_SC_DISABLE_SPEEDY || process.env.SC_DISABLE_SPEEDY)) ||\n process.env.NODE_ENV !== 'production';\n\n// Shared empty execution context when generating static styles\nexport const STATIC_EXECUTION_CONTEXT = {};\n","// @flow\n/* eslint-disable no-use-before-define */\n\nimport { makeStyleTag, getSheet } from './dom';\nimport type { SheetOptions, Tag } from './types';\n\n/** Create a CSSStyleSheet-like tag depending on the environment */\nexport const makeTag = ({ isServer, useCSSOMInjection, target }: SheetOptions): Tag => {\n if (isServer) {\n return new VirtualTag(target);\n } else if (useCSSOMInjection) {\n return new CSSOMTag(target);\n } else {\n return new TextTag(target);\n }\n};\n\nexport class CSSOMTag implements Tag {\n element: HTMLStyleElement;\n\n sheet: CSSStyleSheet;\n\n length: number;\n\n constructor(target?: HTMLElement) {\n const element = (this.element = makeStyleTag(target));\n\n // Avoid Edge bug where empty style elements don't create sheets\n element.appendChild(document.createTextNode(''));\n\n this.sheet = getSheet(element);\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n try {\n this.sheet.insertRule(rule, index);\n this.length++;\n return true;\n } catch (_error) {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.sheet.deleteRule(index);\n this.length--;\n }\n\n getRule(index: number): string {\n const rule = this.sheet.cssRules[index];\n // Avoid IE11 quirk where cssText is inaccessible on some invalid rules\n if (rule !== undefined && typeof rule.cssText === 'string') {\n return rule.cssText;\n } else {\n return '';\n }\n }\n}\n\n/** A Tag that emulates the CSSStyleSheet API but uses text nodes */\nexport class TextTag implements Tag {\n element: HTMLStyleElement;\n\n nodes: NodeList<Node>;\n\n length: number;\n\n constructor(target?: HTMLElement) {\n const element = (this.element = makeStyleTag(target));\n this.nodes = element.childNodes;\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n if (index <= this.length && index >= 0) {\n const node = document.createTextNode(rule);\n const refNode = this.nodes[index];\n this.element.insertBefore(node, refNode || null);\n this.length++;\n return true;\n } else {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.element.removeChild(this.nodes[index]);\n this.length--;\n }\n\n getRule(index: number): string {\n if (index < this.length) {\n return this.nodes[index].textContent;\n } else {\n return '';\n }\n }\n}\n\n/** A completely virtual (server-side) Tag that doesn't manipulate the DOM */\nexport class VirtualTag implements Tag {\n rules: string[];\n\n length: number;\n\n constructor(_target?: HTMLElement) {\n this.rules = [];\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n if (index <= this.length) {\n this.rules.splice(index, 0, rule);\n this.length++;\n return true;\n } else {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.rules.splice(index, 1);\n this.length--;\n }\n\n getRule(index: number): string {\n if (index < this.length) {\n return this.rules[index];\n } else {\n return '';\n }\n }\n}\n","// @flow\n/* eslint-disable no-use-before-define */\n\nimport type { GroupedTag, Tag } from './types';\nimport { SPLITTER } from '../constants';\nimport throwStyledError from '../utils/error';\n\n/** Create a GroupedTag with an underlying Tag implementation */\nexport const makeGroupedTag = (tag: Tag): GroupedTag => {\n return new DefaultGroupedTag(tag);\n};\n\nconst BASE_SIZE = 1 << 9;\n\nclass DefaultGroupedTag implements GroupedTag {\n groupSizes: Uint32Array;\n\n length: number;\n\n tag: Tag;\n\n constructor(tag: Tag) {\n this.groupSizes = new Uint32Array(BASE_SIZE);\n this.length = BASE_SIZE;\n this.tag = tag;\n }\n\n indexOfGroup(group: number): number {\n let index = 0;\n for (let i = 0; i < group; i++) {\n index += this.groupSizes[i];\n }\n\n return index;\n }\n\n insertRules(group: number, rules: string[]): void {\n if (group >= this.groupSizes.length) {\n const oldBuffer = this.groupSizes;\n const oldSize = oldBuffer.length;\n\n let newSize = oldSize;\n while (group >= newSize) {\n newSize <<= 1;\n if (newSize < 0) {\n throwStyledError(16, `${group}`);\n }\n }\n\n this.groupSizes = new Uint32Array(newSize);\n this.groupSizes.set(oldBuffer);\n this.length = newSize;\n\n for (let i = oldSize; i < newSize; i++) {\n this.groupSizes[i] = 0;\n }\n }\n\n let ruleIndex = this.indexOfGroup(group + 1);\n for (let i = 0, l = rules.length; i < l; i++) {\n if (this.tag.insertRule(ruleIndex, rules[i])) {\n this.groupSizes[group]++;\n ruleIndex++;\n }\n }\n }\n\n clearGroup(group: number): void {\n if (group < this.length) {\n const length = this.groupSizes[group];\n const startIndex = this.indexOfGroup(group);\n const endIndex = startIndex + length;\n\n this.groupSizes[group] = 0;\n\n for (let i = startIndex; i < endIndex; i++) {\n this.tag.deleteRule(startIndex);\n }\n }\n }\n\n getGroup(group: number): string {\n let css = '';\n if (group >= this.length || this.groupSizes[group] === 0) {\n return css;\n }\n\n const length = this.groupSizes[group];\n const startIndex = this.indexOfGroup(group);\n const endIndex = startIndex + length;\n\n for (let i = startIndex; i < endIndex; i++) {\n css += `${this.tag.getRule(i)}${SPLITTER}`;\n }\n\n return css;\n }\n}\n","// @flow\n\nimport throwStyledError from '../utils/error';\n\nconst MAX_SMI = 1 << 31 - 1;\n\nlet groupIDRegister: Map<string, number> = new Map();\nlet reverseRegister: Map<number, string> = new Map();\nlet nextFreeGroup = 1;\n\nexport const resetGroupIds = () => {\n groupIDRegister = new Map();\n reverseRegister = new Map();\n nextFreeGroup = 1;\n};\n\nexport const getGroupForId = (id: string): number => {\n if (groupIDRegister.has(id)) {\n return (groupIDRegister.get(id): any);\n }\n\n const group = nextFreeGroup++;\n if (\n process.env.NODE_ENV !== 'production' &&\n ((group | 0) < 0 || group > MAX_SMI)\n ) {\n throwStyledError(16, `${group}`);\n }\n\n groupIDRegister.set(id, group);\n reverseRegister.set(group, id);\n return group;\n};\n\nexport const getIdForGroup = (group: number): void | string => {\n return reverseRegister.get(group);\n};\n\nexport const setGroupForId = (id: string, group: number) => {\n if (group >= nextFreeGroup) {\n nextFreeGroup = group + 1;\n }\n\n groupIDRegister.set(id, group);\n reverseRegister.set(group, id);\n};\n","// @flow\nimport { DISABLE_SPEEDY, IS_BROWSER } from '../constants';\nimport type { GroupedTag, Sheet, SheetOptions } from './types';\nimport { makeTag } from './Tag';\nimport { makeGroupedTag } from './GroupedTag';\nimport { getGroupForId } from './GroupIDAllocator';\nimport { outputSheet, rehydrateSheet } from './Rehydration';\n\nlet SHOULD_REHYDRATE = IS_BROWSER;\n\ntype SheetConstructorArgs = {\n isServer?: boolean,\n useCSSOMInjection?: boolean,\n target?: HTMLElement,\n};\n\ntype GlobalStylesAllocationMap = { [key: string]: number };\ntype NamesAllocationMap = Map<string, Set<string>>;\n\nconst defaultOptions = {\n isServer: !IS_BROWSER,\n useCSSOMInjection: !DISABLE_SPEEDY,\n};\n\n/** Contains the main stylesheet logic for stringification and caching */\nexport default class StyleSheet implements Sheet {\n gs: GlobalStylesAllocationMap;\n\n names: NamesAllocationMap;\n\n options: SheetOptions;\n\n tag: void | GroupedTag;\n\n /** Register a group ID to give it an index */\n static registerId(id: string): number {\n return getGroupForId(id);\n }\n\n constructor(\n options: SheetConstructorArgs = defaultOptions,\n globalStyles?: GlobalStylesAllocationMap = {},\n names?: NamesAllocationMap\n ) {\n this.options = {\n ...defaultOptions,\n ...options,\n };\n\n this.gs = globalStyles;\n this.names = new Map(names);\n\n // We rehydrate only once and use the sheet that is created first\n if (!this.options.isServer && IS_BROWSER && SHOULD_REHYDRATE) {\n SHOULD_REHYDRATE = false;\n rehydrateSheet(this);\n }\n }\n\n reconstructWithOptions(options: SheetConstructorArgs, withNames?: boolean = true) {\n return new StyleSheet(\n { ...this.options, ...options },\n this.gs,\n (withNames && this.names) || undefined\n );\n }\n\n allocateGSInstance(id: string) {\n return (this.gs[id] = (this.gs[id] || 0) + 1);\n }\n\n /** Lazily initialises a GroupedTag for when it's actually needed */\n getTag(): GroupedTag {\n return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));\n }\n\n /** Check whether a name is known for caching */\n hasNameForId(id: string, name: string): boolean {\n return this.names.has(id) && (this.names.get(id): any).has(name);\n }\n\n /** Mark a group's name as known for caching */\n registerName(id: string, name: string) {\n getGroupForId(id);\n\n if (!this.names.has(id)) {\n const groupNames = new Set();\n groupNames.add(name);\n this.names.set(id, groupNames);\n } else {\n (this.names.get(id): any).add(name);\n }\n }\n\n /** Insert new rules which also marks the name as known */\n insertRules(id: string, name: string, rules: string[]) {\n this.registerName(id, name);\n this.getTag().insertRules(getGroupForId(id), rules);\n }\n\n /** Clears all cached names for a given group ID */\n clearNames(id: string) {\n if (this.names.has(id)) {\n (this.names.get(id): any).clear();\n }\n }\n\n /** Clears all rules for a given group ID */\n clearRules(id: string) {\n this.getTag().clearGroup(getGroupForId(id));\n this.clearNames(id);\n }\n\n /** Clears the entire tag which deletes all rules but not its names */\n clearTag() {\n // NOTE: This does not clear the names, since it's only used during SSR\n // so that we can continuously output only new rules\n this.tag = undefined;\n }\n\n /** Outputs the current sheet as a CSS string with markers for SSR */\n toString(): string {\n return outputSheet(this);\n }\n}\n","// @flow\nimport StyleSheet from '../sheet';\nimport { type Stringifier } from '../types';\nimport throwStyledError from '../utils/error';\nimport { masterStylis } from './StyleSheetManager';\n\nexport default class Keyframes {\n id: string;\n\n name: string;\n\n rules: string;\n\n constructor(name: string, rules: string) {\n this.name = name;\n this.id = `sc-keyframes-${name}`;\n this.rules = rules;\n }\n\n inject = (styleSheet: StyleSheet, stylisInstance: Stringifier = masterStylis) => {\n const resolvedName = this.name + stylisInstance.hash;\n\n if (!styleSheet.hasNameForId(this.id, resolvedName)) {\n styleSheet.insertRules(\n this.id,\n resolvedName,\n stylisInstance(this.rules, resolvedName, '@keyframes')\n );\n }\n };\n\n toString = () => {\n return throwStyledError(12, String(this.name));\n };\n\n getName(stylisInstance: Stringifier = masterStylis) {\n return this.name + stylisInstance.hash;\n }\n}\n","// @flow\n/* eslint-disable import/no-unresolved */\nimport transformDeclPairs from 'css-to-react-native';\n\nimport generateComponentId from '../utils/generateComponentId';\nimport type { RuleSet, StyleSheet } from '../types';\nimport flatten from '../utils/flatten';\n// $FlowFixMe\nimport parse from '../vendor/postcss-safe-parser/parse';\n\nlet generated = {};\n\nexport const resetStyleCache = () => {\n generated = {};\n};\n\n/*\n InlineStyle takes arbitrary CSS and generates a flat object\n */\nexport default (styleSheet: StyleSheet) => {\n class InlineStyle {\n rules: RuleSet;\n\n constructor(rules: RuleSet) {\n this.rules = rules;\n }\n\n generateStyleObject(executionContext: Object) {\n const flatCSS = flatten(this.rules, executionContext).join('');\n\n const hash = generateComponentId(flatCSS);\n if (!generated[hash]) {\n const root = parse(flatCSS);\n const declPairs = [];\n root.each(node => {\n if (node.type === 'decl') {\n declPairs.push([node.prop, node.value]);\n } else if (process.env.NODE_ENV !== 'production' && node.type !== 'comment') {\n /* eslint-disable no-console */\n console.warn(`Node of type ${node.type} not supported as an inline style`);\n }\n });\n // RN currently does not support differing values for the corner radii of Image\n // components (but does for View). It is almost impossible to tell whether we'll have\n // support, so we'll just disable multiple values here.\n // https://github.com/styled-components/css-to-react-native/issues/11\n const styleObject = transformDeclPairs(declPairs, [\n 'borderRadius',\n 'borderWidth',\n 'borderColor',\n 'borderStyle',\n ]);\n const styles = styleSheet.create({\n generated: styleObject,\n });\n generated[hash] = styles.generated;\n }\n return generated[hash];\n }\n }\n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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"styled-components.native.esm.js","sources":["../../src/utils/isFunction.js","../../src/utils/isStyledComponent.js","../../src/constants.js","../../src/sheet/GroupedTag.js","../../src/sheet/GroupIDAllocator.js","../../src/sheet/Tag.js","../../src/sheet/Sheet.js","../../src/models/Keyframes.js","../../src/models/InlineStyle.js","../../src/utils/generateDisplayName.js"],"sourcesContent":["// @flow\nexport default function isFunction(test: any): boolean %checks {\n return typeof test === 'function';\n}\n","// @flow\nexport default function isStyledComponent(target: any): boolean %checks {\n return target && typeof target.styledComponentId === 'string';\n}\n","// @flow\n\ndeclare var SC_DISABLE_SPEEDY: ?boolean;\ndeclare var __VERSION__: string;\n\nexport const SC_ATTR: string =\n (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||\n 'data-styled';\n\nexport const SC_ATTR_ACTIVE = 'active';\nexport const SC_ATTR_VERSION = 'data-styled-version';\nexport const SC_VERSION = __VERSION__;\nexport const SPLITTER = '/*!sc*/\\n';\n\nexport const IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;\n\nexport const DISABLE_SPEEDY =\n Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'\n ? SC_DISABLE_SPEEDY\n : (typeof process !== 'undefined' && typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' && process.env.REACT_APP_SC_DISABLE_SPEEDY !== ''\n ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false' ? false : process.env.REACT_APP_SC_DISABLE_SPEEDY\n : (typeof process !== 'undefined' && typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' && process.env.SC_DISABLE_SPEEDY !== ''\n ? process.env.SC_DISABLE_SPEEDY === 'false' ? false : process.env.SC_DISABLE_SPEEDY\n : process.env.NODE_ENV !== 'production'\n )\n ));\n\n// Shared empty execution context when generating static styles\nexport const STATIC_EXECUTION_CONTEXT = {};\n","// @flow\n/* eslint-disable no-use-before-define */\n\nimport type { GroupedTag, Tag } from './types';\nimport { SPLITTER } from '../constants';\nimport throwStyledError from '../utils/error';\n\n/** Create a GroupedTag with an underlying Tag implementation */\nexport const makeGroupedTag = (tag: Tag): GroupedTag => {\n return new DefaultGroupedTag(tag);\n};\n\nconst BASE_SIZE = 1 << 9;\n\nclass DefaultGroupedTag implements GroupedTag {\n groupSizes: Uint32Array;\n\n length: number;\n\n tag: Tag;\n\n constructor(tag: Tag) {\n this.groupSizes = new Uint32Array(BASE_SIZE);\n this.length = BASE_SIZE;\n this.tag = tag;\n }\n\n indexOfGroup(group: number): number {\n let index = 0;\n for (let i = 0; i < group; i++) {\n index += this.groupSizes[i];\n }\n\n return index;\n }\n\n insertRules(group: number, rules: string[]): void {\n if (group >= this.groupSizes.length) {\n const oldBuffer = this.groupSizes;\n const oldSize = oldBuffer.length;\n\n let newSize = oldSize;\n while (group >= newSize) {\n newSize <<= 1;\n if (newSize < 0) {\n throwStyledError(16, `${group}`);\n }\n }\n\n this.groupSizes = new Uint32Array(newSize);\n this.groupSizes.set(oldBuffer);\n this.length = newSize;\n\n for (let i = oldSize; i < newSize; i++) {\n this.groupSizes[i] = 0;\n }\n }\n\n let ruleIndex = this.indexOfGroup(group + 1);\n for (let i = 0, l = rules.length; i < l; i++) {\n if (this.tag.insertRule(ruleIndex, rules[i])) {\n this.groupSizes[group]++;\n ruleIndex++;\n }\n }\n }\n\n clearGroup(group: number): void {\n if (group < this.length) {\n const length = this.groupSizes[group];\n const startIndex = this.indexOfGroup(group);\n const endIndex = startIndex + length;\n\n this.groupSizes[group] = 0;\n\n for (let i = startIndex; i < endIndex; i++) {\n this.tag.deleteRule(startIndex);\n }\n }\n }\n\n getGroup(group: number): string {\n let css = '';\n if (group >= this.length || this.groupSizes[group] === 0) {\n return css;\n }\n\n const length = this.groupSizes[group];\n const startIndex = this.indexOfGroup(group);\n const endIndex = startIndex + length;\n\n for (let i = startIndex; i < endIndex; i++) {\n css += `${this.tag.getRule(i)}${SPLITTER}`;\n }\n\n return css;\n }\n}\n","// @flow\n\nimport throwStyledError from '../utils/error';\n\nconst MAX_SMI = 1 << 31 - 1;\n\nlet groupIDRegister: Map<string, number> = new Map();\nlet reverseRegister: Map<number, string> = new Map();\nlet nextFreeGroup = 1;\n\nexport const resetGroupIds = () => {\n groupIDRegister = new Map();\n reverseRegister = new Map();\n nextFreeGroup = 1;\n};\n\nexport const getGroupForId = (id: string): number => {\n if (groupIDRegister.has(id)) {\n return (groupIDRegister.get(id): any);\n }\n\n while (reverseRegister.has(nextFreeGroup)) {\n nextFreeGroup++;\n }\n\n const group = nextFreeGroup++;\n\n if (\n process.env.NODE_ENV !== 'production' &&\n ((group | 0) < 0 || group > MAX_SMI)\n ) {\n throwStyledError(16, `${group}`);\n }\n\n groupIDRegister.set(id, group);\n reverseRegister.set(group, id);\n return group;\n};\n\nexport const getIdForGroup = (group: number): void | string => {\n return reverseRegister.get(group);\n};\n\nexport const setGroupForId = (id: string, group: number) => {\n groupIDRegister.set(id, group);\n reverseRegister.set(group, id);\n};\n","// @flow\n/* eslint-disable no-use-before-define */\n\nimport { makeStyleTag, getSheet } from './dom';\nimport type { SheetOptions, Tag } from './types';\n\n/** Create a CSSStyleSheet-like tag depending on the environment */\nexport const makeTag = ({ isServer, useCSSOMInjection, target }: SheetOptions): Tag => {\n if (isServer) {\n return new VirtualTag(target);\n } else if (useCSSOMInjection) {\n return new CSSOMTag(target);\n } else {\n return new TextTag(target);\n }\n};\n\nexport class CSSOMTag implements Tag {\n element: HTMLStyleElement;\n\n sheet: CSSStyleSheet;\n\n length: number;\n\n constructor(target?: HTMLElement) {\n const element = (this.element = makeStyleTag(target));\n\n // Avoid Edge bug where empty style elements don't create sheets\n element.appendChild(document.createTextNode(''));\n\n this.sheet = getSheet(element);\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n try {\n this.sheet.insertRule(rule, index);\n this.length++;\n return true;\n } catch (_error) {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.sheet.deleteRule(index);\n this.length--;\n }\n\n getRule(index: number): string {\n const rule = this.sheet.cssRules[index];\n // Avoid IE11 quirk where cssText is inaccessible on some invalid rules\n if (rule !== undefined && typeof rule.cssText === 'string') {\n return rule.cssText;\n } else {\n return '';\n }\n }\n}\n\n/** A Tag that emulates the CSSStyleSheet API but uses text nodes */\nexport class TextTag implements Tag {\n element: HTMLStyleElement;\n\n nodes: NodeList<Node>;\n\n length: number;\n\n constructor(target?: HTMLElement) {\n const element = (this.element = makeStyleTag(target));\n this.nodes = element.childNodes;\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n if (index <= this.length && index >= 0) {\n const node = document.createTextNode(rule);\n const refNode = this.nodes[index];\n this.element.insertBefore(node, refNode || null);\n this.length++;\n return true;\n } else {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.element.removeChild(this.nodes[index]);\n this.length--;\n }\n\n getRule(index: number): string {\n if (index < this.length) {\n return this.nodes[index].textContent;\n } else {\n return '';\n }\n }\n}\n\n/** A completely virtual (server-side) Tag that doesn't manipulate the DOM */\nexport class VirtualTag implements Tag {\n rules: string[];\n\n length: number;\n\n constructor(_target?: HTMLElement) {\n this.rules = [];\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n if (index <= this.length) {\n this.rules.splice(index, 0, rule);\n this.length++;\n return true;\n } else {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.rules.splice(index, 1);\n this.length--;\n }\n\n getRule(index: number): string {\n if (index < this.length) {\n return this.rules[index];\n } else {\n return '';\n }\n }\n}\n","// @flow\nimport { DISABLE_SPEEDY, IS_BROWSER } from '../constants';\nimport { EMPTY_OBJECT } from '../utils/empties';\nimport { makeGroupedTag } from './GroupedTag';\nimport { getGroupForId } from './GroupIDAllocator';\nimport { outputSheet, rehydrateSheet } from './Rehydration';\nimport { makeTag } from './Tag';\nimport type { GroupedTag, Sheet, SheetOptions } from './types';\n\nlet SHOULD_REHYDRATE = IS_BROWSER;\n\ntype SheetConstructorArgs = {\n isServer?: boolean,\n useCSSOMInjection?: boolean,\n target?: HTMLElement,\n};\n\ntype GlobalStylesAllocationMap = { [key: string]: number };\ntype NamesAllocationMap = Map<string, Set<string>>;\n\nconst defaultOptions: SheetOptions = {\n isServer: !IS_BROWSER,\n useCSSOMInjection: !DISABLE_SPEEDY,\n};\n\n/** Contains the main stylesheet logic for stringification and caching */\nexport default class StyleSheet implements Sheet {\n gs: GlobalStylesAllocationMap;\n\n names: NamesAllocationMap;\n\n options: SheetOptions;\n\n tag: void | GroupedTag;\n\n /** Register a group ID to give it an index */\n static registerId(id: string): number {\n return getGroupForId(id);\n }\n\n constructor(\n options: SheetConstructorArgs = EMPTY_OBJECT,\n globalStyles?: GlobalStylesAllocationMap = {},\n names?: NamesAllocationMap\n ) {\n this.options = {\n ...defaultOptions,\n ...options,\n };\n\n this.gs = globalStyles;\n this.names = new Map(names);\n\n // We rehydrate only once and use the sheet that is created first\n if (!this.options.isServer && IS_BROWSER && SHOULD_REHYDRATE) {\n SHOULD_REHYDRATE = false;\n rehydrateSheet(this);\n }\n }\n\n reconstructWithOptions(options: SheetConstructorArgs, withNames?: boolean = true) {\n return new StyleSheet(\n { ...this.options, ...options },\n this.gs,\n (withNames && this.names) || undefined\n );\n }\n\n allocateGSInstance(id: string) {\n return (this.gs[id] = (this.gs[id] || 0) + 1);\n }\n\n /** Lazily initialises a GroupedTag for when it's actually needed */\n getTag(): GroupedTag {\n return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));\n }\n\n /** Check whether a name is known for caching */\n hasNameForId(id: string, name: string): boolean {\n return this.names.has(id) && (this.names.get(id): any).has(name);\n }\n\n /** Mark a group's name as known for caching */\n registerName(id: string, name: string) {\n getGroupForId(id);\n\n if (!this.names.has(id)) {\n const groupNames = new Set();\n groupNames.add(name);\n this.names.set(id, groupNames);\n } else {\n (this.names.get(id): any).add(name);\n }\n }\n\n /** Insert new rules which also marks the name as known */\n insertRules(id: string, name: string, rules: string[]) {\n this.registerName(id, name);\n this.getTag().insertRules(getGroupForId(id), rules);\n }\n\n /** Clears all cached names for a given group ID */\n clearNames(id: string) {\n if (this.names.has(id)) {\n (this.names.get(id): any).clear();\n }\n }\n\n /** Clears all rules for a given group ID */\n clearRules(id: string) {\n this.getTag().clearGroup(getGroupForId(id));\n this.clearNames(id);\n }\n\n /** Clears the entire tag which deletes all rules but not its names */\n clearTag() {\n // NOTE: This does not clear the names, since it's only used during SSR\n // so that we can continuously output only new rules\n this.tag = undefined;\n }\n\n /** Outputs the current sheet as a CSS string with markers for SSR */\n toString(): string {\n return outputSheet(this);\n }\n}\n","// @flow\nimport StyleSheet from '../sheet';\nimport { type Stringifier } from '../types';\nimport throwStyledError from '../utils/error';\nimport { masterStylis } from './StyleSheetManager';\n\nexport default class Keyframes {\n id: string;\n\n name: string;\n\n rules: string;\n\n constructor(name: string, rules: string) {\n this.name = name;\n this.id = `sc-keyframes-${name}`;\n this.rules = rules;\n }\n\n inject = (styleSheet: StyleSheet, stylisInstance: Stringifier = masterStylis) => {\n const resolvedName = this.name + stylisInstance.hash;\n\n if (!styleSheet.hasNameForId(this.id, resolvedName)) {\n styleSheet.insertRules(\n this.id,\n resolvedName,\n stylisInstance(this.rules, resolvedName, '@keyframes')\n );\n }\n };\n\n toString = () => {\n return throwStyledError(12, String(this.name));\n };\n\n getName(stylisInstance: Stringifier = masterStylis) {\n return this.name + stylisInstance.hash;\n }\n}\n","// @flow\n/* eslint-disable import/no-unresolved */\nimport transformDeclPairs from 'css-to-react-native';\n\nimport generateComponentId from '../utils/generateComponentId';\nimport type { RuleSet, StyleSheet } from '../types';\nimport flatten from '../utils/flatten';\n// $FlowFixMe\nimport parse from '../vendor/postcss-safe-parser/parse';\n\nlet generated = {};\n\nexport const resetStyleCache = () => {\n generated = {};\n};\n\n/*\n InlineStyle takes arbitrary CSS and generates a flat object\n */\nexport default (styleSheet: StyleSheet) => {\n class InlineStyle {\n rules: RuleSet;\n\n constructor(rules: RuleSet) {\n this.rules = rules;\n }\n\n generateStyleObject(executionContext: Object) {\n const flatCSS = flatten(this.rules, executionContext).join('');\n\n const hash = generateComponentId(flatCSS);\n if (!generated[hash]) {\n const root = parse(flatCSS);\n const declPairs = [];\n root.each(node => {\n if (node.type === 'decl') {\n declPairs.push([node.prop, node.value]);\n } else if (process.env.NODE_ENV !== 'production' && node.type !== 'comment') {\n /* eslint-disable no-console */\n console.warn(`Node of type ${node.type} not supported as an inline style`);\n }\n });\n // RN currently does not support differing values for the corner radii of Image\n // components (but does for View). It is almost impossible to tell whether we'll have\n // support, so we'll just disable multiple values here.\n // https://github.com/styled-components/css-to-react-native/issues/11\n const styleObject = transformDeclPairs(declPairs, [\n 'borderRadius',\n 'borderWidth',\n 'borderColor',\n 'borderStyle',\n ]);\n const styles = styleSheet.create({\n generated: styleObject,\n });\n generated[hash] = styles.generated;\n }\n return generated[hash];\n }\n }\n\n return InlineStyle;\n};\n","// @flow\nimport type { IStyledComponent } from '../types';\nimport getComponentName from './getComponentName';\nimport isTag from './isTag';\n\nexport default function generateDisplayName(\n target: $PropertyType<IStyledComponent, 'target'>\n): string {\n return isTag(target) ? `styled.${target}` : `Styled(${getComponentName(target)})`;\n}\n"],"names":["nodes","insertRule","names","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BACuD;;;;;;;;;;;;;;;mCCAS;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "styled-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress",
|
|
5
5
|
"main": "dist/styled-components.cjs.js",
|
|
6
6
|
"jsnext:main": "dist/styled-components.esm.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@emotion/is-prop-valid": "^0.8.8",
|
|
69
69
|
"@emotion/stylis": "^0.8.4",
|
|
70
70
|
"@emotion/unitless": "^0.7.4",
|
|
71
|
-
"babel-plugin-styled-components": ">= 1",
|
|
71
|
+
"babel-plugin-styled-components": ">= 1.12.0",
|
|
72
72
|
"css-to-react-native": "^3.0.0",
|
|
73
73
|
"hoist-non-react-statics": "^3.0.0",
|
|
74
74
|
"shallowequal": "^1.1.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"eslint-plugin-flowtype": "^5.2.0",
|
|
91
91
|
"eslint-plugin-import": "^2.22.0",
|
|
92
92
|
"eslint-plugin-react": "^7.20.6",
|
|
93
|
-
"flow-bin": "^0.
|
|
93
|
+
"flow-bin": "^0.132.0",
|
|
94
94
|
"jest-serializer-html": "^7.0.0",
|
|
95
95
|
"js-beautify": "^1.13.0",
|
|
96
96
|
"prop-types": "^15.7.2",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"react-dom": "^16.8.6",
|
|
99
99
|
"react-frame-component": "^4.0.2",
|
|
100
100
|
"react-is": "^16.8.6",
|
|
101
|
-
"react-native": "^0.
|
|
101
|
+
"react-native": "^0.63.4",
|
|
102
102
|
"react-primitives": "^0.8.0",
|
|
103
103
|
"react-test-renderer": "^16.8.6",
|
|
104
104
|
"rollup": "^1.13.1",
|