grep-components 1.8.2 → 1.9.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/index.js CHANGED
@@ -318,7 +318,7 @@ var Colors = {
318
318
  white: '#fff',
319
319
  };
320
320
 
321
- /*! *****************************************************************************
321
+ /******************************************************************************
322
322
  Copyright (c) Microsoft Corporation.
323
323
 
324
324
  Permission to use, copy, modify, and/or distribute this software for any
@@ -762,7 +762,7 @@ var processStyleValue$1 = function processStyleValue(key, value) {
762
762
  };
763
763
 
764
764
  if (process.env.NODE_ENV !== 'production') {
765
- var contentValuePattern = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
765
+ var contentValuePattern = /(var|attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
766
766
  var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];
767
767
  var oldProcessStyleValue = processStyleValue$1;
768
768
  var msPattern = /^-ms-/;
@@ -1047,7 +1047,7 @@ function getRegisteredStyles(registered, registeredStyles, classNames) {
1047
1047
  });
1048
1048
  return rawClassName;
1049
1049
  }
1050
- var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1050
+ var registerStyles = function registerStyles(cache, serialized, isStringTag) {
1051
1051
  var className = cache.key + "-" + serialized.name;
1052
1052
 
1053
1053
  if ( // we only need to add the styles to the registered cache if the
@@ -1062,6 +1062,10 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1062
1062
  isBrowser$3 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1063
1063
  cache.registered[className] = serialized.styles;
1064
1064
  }
1065
+ };
1066
+ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1067
+ registerStyles(cache, serialized, isStringTag);
1068
+ var className = cache.key + "-" + serialized.name;
1065
1069
 
1066
1070
  if (cache.inserted[serialized.name] === undefined) {
1067
1071
  var stylesForSSR = '';
@@ -1086,7 +1090,8 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1086
1090
  var emotionUtils_esm = /*#__PURE__*/Object.freeze({
1087
1091
  __proto__: null,
1088
1092
  getRegisteredStyles: getRegisteredStyles,
1089
- insertStyles: insertStyles
1093
+ insertStyles: insertStyles,
1094
+ registerStyles: registerStyles
1090
1095
  });
1091
1096
 
1092
1097
  var require$$3$1 = /*@__PURE__*/getAugmentedNamespace(emotionUtils_esm);
@@ -3123,14 +3128,14 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
3123
3128
  var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
3124
3129
  var getPrototypeOf = Object.getPrototypeOf;
3125
3130
  var objectPrototype = Object.prototype;
3126
- function hoistNonReactStatics$1(targetComponent, sourceComponent, blacklist) {
3131
+ function hoistNonReactStatics$2(targetComponent, sourceComponent, blacklist) {
3127
3132
  if (typeof sourceComponent !== 'string') {
3128
3133
  // don't hoist over string (html) components
3129
3134
  if (objectPrototype) {
3130
3135
  var inheritedComponent = getPrototypeOf(sourceComponent);
3131
3136
 
3132
3137
  if (inheritedComponent && inheritedComponent !== objectPrototype) {
3133
- hoistNonReactStatics$1(targetComponent, inheritedComponent, blacklist);
3138
+ hoistNonReactStatics$2(targetComponent, inheritedComponent, blacklist);
3134
3139
  }
3135
3140
  }
3136
3141
 
@@ -3160,7 +3165,7 @@ function hoistNonReactStatics$1(targetComponent, sourceComponent, blacklist) {
3160
3165
  return targetComponent;
3161
3166
  }
3162
3167
 
3163
- var hoistNonReactStatics_cjs = hoistNonReactStatics$1;
3168
+ var hoistNonReactStatics_cjs = hoistNonReactStatics$2;
3164
3169
 
3165
3170
  // this file isolates this package that is not tree-shakeable
3166
3171
  // and if this module doesn't actually contain any logic of its own
@@ -3170,6 +3175,8 @@ var hoistNonReactStatics = (function (targetComponent, sourceComponent) {
3170
3175
  return hoistNonReactStatics_cjs(targetComponent, sourceComponent);
3171
3176
  });
3172
3177
 
3178
+ var hoistNonReactStatics$1 = hoistNonReactStatics;
3179
+
3173
3180
  var isBrowser$1 = typeof document !== 'undefined';
3174
3181
  var hasOwnProperty = {}.hasOwnProperty;
3175
3182
 
@@ -3283,22 +3290,23 @@ function withTheme(Component) {
3283
3290
 
3284
3291
  var WithTheme = /*#__PURE__*/forwardRef(render);
3285
3292
  WithTheme.displayName = "WithTheme(" + componentName + ")";
3286
- return hoistNonReactStatics(WithTheme, Component);
3293
+ return hoistNonReactStatics$1(WithTheme, Component);
3287
3294
  }
3288
3295
 
3296
+ var getLastPart = function getLastPart(functionName) {
3297
+ // The match may be something like 'Object.createEmotionProps' or
3298
+ // 'Loader.prototype.render'
3299
+ var parts = functionName.split('.');
3300
+ return parts[parts.length - 1];
3301
+ };
3302
+
3289
3303
  var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
3290
3304
  // V8
3291
3305
  var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
3292
-
3293
- if (match) {
3294
- // The match may be something like 'Object.createEmotionProps'
3295
- var parts = match[1].split('.');
3296
- return parts[parts.length - 1];
3297
- } // Safari / Firefox
3298
-
3306
+ if (match) return getLastPart(match[1]); // Safari / Firefox
3299
3307
 
3300
3308
  match = /^([A-Za-z0-9$.]+)@/.exec(line);
3301
- if (match) return match[1];
3309
+ if (match) return getLastPart(match[1]);
3302
3310
  return undefined;
3303
3311
  };
3304
3312
 
@@ -3328,6 +3336,18 @@ var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
3328
3336
  return undefined;
3329
3337
  };
3330
3338
 
3339
+ var isBrowser$1$1 = typeof document !== 'undefined';
3340
+ var useInsertionEffect$1 = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
3341
+ create();
3342
+ };
3343
+ function useInsertionEffectMaybe(create) {
3344
+ if (!isBrowser$1$1) {
3345
+ return create();
3346
+ }
3347
+
3348
+ useInsertionEffect$1(create);
3349
+ }
3350
+
3331
3351
  var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
3332
3352
  var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
3333
3353
  var createEmotionProps = function createEmotionProps(type, props) {
@@ -3355,7 +3375,31 @@ var createEmotionProps = function createEmotionProps(type, props) {
3355
3375
  return newProps;
3356
3376
  };
3357
3377
 
3358
- var Noop$1 = function Noop() {
3378
+ var Insertion$1 = function Insertion(_ref) {
3379
+ var cache = _ref.cache,
3380
+ serialized = _ref.serialized,
3381
+ isStringTag = _ref.isStringTag;
3382
+ registerStyles(cache, serialized, isStringTag);
3383
+ var rules = useInsertionEffectMaybe(function () {
3384
+ return insertStyles(cache, serialized, isStringTag);
3385
+ });
3386
+
3387
+ if (!isBrowser$1 && rules !== undefined) {
3388
+ var _ref2;
3389
+
3390
+ var serializedNames = serialized.name;
3391
+ var next = serialized.next;
3392
+
3393
+ while (next !== undefined) {
3394
+ serializedNames += ' ' + next.name;
3395
+ next = next.next;
3396
+ }
3397
+
3398
+ return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
3399
+ __html: rules
3400
+ }, _ref2.nonce = cache.sheet.nonce, _ref2));
3401
+ }
3402
+
3359
3403
  return null;
3360
3404
  };
3361
3405
 
@@ -3368,7 +3412,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
3368
3412
  cssProp = cache.registered[cssProp];
3369
3413
  }
3370
3414
 
3371
- var type = props[typePropName];
3415
+ var WrappedComponent = props[typePropName];
3372
3416
  var registeredStyles = [cssProp];
3373
3417
  var className = '';
3374
3418
 
@@ -3388,7 +3432,6 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
3388
3432
  }
3389
3433
  }
3390
3434
 
3391
- var rules = insertStyles(cache, serialized, typeof type === 'string');
3392
3435
  className += cache.key + "-" + serialized.name;
3393
3436
  var newProps = {};
3394
3437
 
@@ -3400,27 +3443,11 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
3400
3443
 
3401
3444
  newProps.ref = ref;
3402
3445
  newProps.className = className;
3403
- var ele = /*#__PURE__*/createElement(type, newProps);
3404
- var possiblyStyleElement = /*#__PURE__*/createElement(Noop$1, null);
3405
-
3406
- if (!isBrowser$1 && rules !== undefined) {
3407
- var _ref;
3408
-
3409
- var serializedNames = serialized.name;
3410
- var next = serialized.next;
3411
-
3412
- while (next !== undefined) {
3413
- serializedNames += ' ' + next.name;
3414
- next = next.next;
3415
- }
3416
-
3417
- possiblyStyleElement = /*#__PURE__*/createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + " " + serializedNames, _ref.dangerouslySetInnerHTML = {
3418
- __html: rules
3419
- }, _ref.nonce = cache.sheet.nonce, _ref));
3420
- } // Need to return the same number of siblings or else `React.useId` will cause hydration mismatches.
3421
-
3422
-
3423
- return /*#__PURE__*/createElement(Fragment, null, possiblyStyleElement, ele);
3446
+ return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion$1, {
3447
+ cache: cache,
3448
+ serialized: serialized,
3449
+ isStringTag: typeof WrappedComponent === 'string'
3450
+ }), /*#__PURE__*/createElement(WrappedComponent, newProps));
3424
3451
  });
3425
3452
 
3426
3453
  if (process.env.NODE_ENV !== 'production') {
@@ -3429,7 +3456,7 @@ if (process.env.NODE_ENV !== 'production') {
3429
3456
 
3430
3457
  var pkg = {
3431
3458
  name: "@emotion/react",
3432
- version: "11.7.1",
3459
+ version: "11.9.0",
3433
3460
  main: "dist/emotion-react.cjs.js",
3434
3461
  module: "dist/emotion-react.esm.js",
3435
3462
  browser: {
@@ -3449,17 +3476,17 @@ var pkg = {
3449
3476
  "macro.js.flow"
3450
3477
  ],
3451
3478
  sideEffects: false,
3452
- author: "mitchellhamilton <mitchell@mitchellhamilton.me>",
3479
+ author: "Emotion Contributors",
3453
3480
  license: "MIT",
3454
3481
  scripts: {
3455
3482
  "test:typescript": "dtslint types"
3456
3483
  },
3457
3484
  dependencies: {
3458
3485
  "@babel/runtime": "^7.13.10",
3486
+ "@emotion/babel-plugin": "^11.7.1",
3459
3487
  "@emotion/cache": "^11.7.1",
3460
- "@emotion/serialize": "^1.0.2",
3461
- "@emotion/sheet": "^1.1.0",
3462
- "@emotion/utils": "^1.0.0",
3488
+ "@emotion/serialize": "^1.0.3",
3489
+ "@emotion/utils": "^1.1.0",
3463
3490
  "@emotion/weak-memoize": "^0.2.5",
3464
3491
  "hoist-non-react-statics": "^3.3.1"
3465
3492
  },
@@ -3477,15 +3504,16 @@ var pkg = {
3477
3504
  },
3478
3505
  devDependencies: {
3479
3506
  "@babel/core": "^7.13.10",
3480
- "@emotion/css": "11.7.1",
3507
+ "@emotion/css": "11.9.0",
3481
3508
  "@emotion/css-prettifier": "1.0.1",
3482
3509
  "@emotion/server": "11.4.0",
3483
- "@emotion/styled": "11.6.0",
3510
+ "@emotion/styled": "11.8.1",
3484
3511
  "@types/react": "^16.9.11",
3485
- dtslint: "^0.3.0",
3512
+ dtslint: "^4.2.1",
3486
3513
  "html-tag-names": "^1.1.2",
3487
3514
  react: "16.14.0",
3488
- "svg-tag-names": "^1.1.1"
3515
+ "svg-tag-names": "^1.1.1",
3516
+ typescript: "^4.5.5"
3489
3517
  },
3490
3518
  repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
3491
3519
  publishConfig: {
@@ -3524,6 +3552,7 @@ var jsx = function jsx(type, props) {
3524
3552
  return createElement.apply(null, createElementArgArray);
3525
3553
  };
3526
3554
 
3555
+ var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : useLayoutEffect;
3527
3556
  var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
3528
3557
  // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
3529
3558
  // initial client-side render from SSR, use place of hydrating tag
@@ -3574,9 +3603,10 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
3574
3603
 
3575
3604
 
3576
3605
  var sheetRef = useRef();
3577
- useLayoutEffect(function () {
3578
- var key = cache.key + "-global";
3579
- var sheet = new StyleSheet({
3606
+ useInsertionEffect(function () {
3607
+ var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
3608
+
3609
+ var sheet = new cache.sheet.constructor({
3580
3610
  key: key,
3581
3611
  nonce: cache.sheet.nonce,
3582
3612
  container: cache.sheet.container,
@@ -3602,7 +3632,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
3602
3632
  sheet.flush();
3603
3633
  };
3604
3634
  }, [cache]);
3605
- useLayoutEffect(function () {
3635
+ useInsertionEffect(function () {
3606
3636
  var sheetRefCurrent = sheetRef.current;
3607
3637
  var sheet = sheetRefCurrent[0],
3608
3638
  rehydrating = sheetRefCurrent[1];
@@ -3717,14 +3747,41 @@ function merge(registered, css, className) {
3717
3747
  return rawClassName + css(registeredStyles);
3718
3748
  }
3719
3749
 
3720
- var Noop = function Noop() {
3750
+ var Insertion = function Insertion(_ref) {
3751
+ var cache = _ref.cache,
3752
+ serializedArr = _ref.serializedArr;
3753
+ var rules = useInsertionEffectMaybe(function () {
3754
+ var rules = '';
3755
+
3756
+ for (var i = 0; i < serializedArr.length; i++) {
3757
+ var res = insertStyles(cache, serializedArr[i], false);
3758
+
3759
+ if (!isBrowser$1 && res !== undefined) {
3760
+ rules += res;
3761
+ }
3762
+ }
3763
+
3764
+ if (!isBrowser$1) {
3765
+ return rules;
3766
+ }
3767
+ });
3768
+
3769
+ if (!isBrowser$1 && rules.length !== 0) {
3770
+ var _ref2;
3771
+
3772
+ return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
3773
+ return serialized.name;
3774
+ }).join(' '), _ref2.dangerouslySetInnerHTML = {
3775
+ __html: rules
3776
+ }, _ref2.nonce = cache.sheet.nonce, _ref2));
3777
+ }
3778
+
3721
3779
  return null;
3722
3780
  };
3723
3781
 
3724
3782
  var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
3725
- var rules = '';
3726
- var serializedHashes = '';
3727
3783
  var hasRendered = false;
3784
+ var serializedArr = [];
3728
3785
 
3729
3786
  var css = function css() {
3730
3787
  if (hasRendered && process.env.NODE_ENV !== 'production') {
@@ -3736,21 +3793,9 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
3736
3793
  }
3737
3794
 
3738
3795
  var serialized = serializeStyles(args, cache.registered);
3796
+ serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
3739
3797
 
3740
- if (isBrowser$1) {
3741
- insertStyles(cache, serialized, false);
3742
- } else {
3743
- var res = insertStyles(cache, serialized, false);
3744
-
3745
- if (res !== undefined) {
3746
- rules += res;
3747
- }
3748
- }
3749
-
3750
- if (!isBrowser$1) {
3751
- serializedHashes += " " + serialized.name;
3752
- }
3753
-
3798
+ registerStyles(cache, serialized, false);
3754
3799
  return cache.key + "-" + serialized.name;
3755
3800
  };
3756
3801
 
@@ -3773,18 +3818,10 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
3773
3818
  };
3774
3819
  var ele = props.children(content);
3775
3820
  hasRendered = true;
3776
- var possiblyStyleElement = /*#__PURE__*/createElement(Noop, null);
3777
-
3778
- if (!isBrowser$1 && rules.length !== 0) {
3779
- var _ref;
3780
-
3781
- possiblyStyleElement = /*#__PURE__*/createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + " " + serializedHashes.substring(1), _ref.dangerouslySetInnerHTML = {
3782
- __html: rules
3783
- }, _ref.nonce = cache.sheet.nonce, _ref));
3784
- } // Need to return the same number of siblings or else `React.useId` will cause hydration mismatches.
3785
-
3786
-
3787
- return /*#__PURE__*/createElement(Fragment, null, possiblyStyleElement, ele);
3821
+ return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
3822
+ cache: cache,
3823
+ serializedArr: serializedArr
3824
+ }), ele);
3788
3825
  });
3789
3826
 
3790
3827
  if (process.env.NODE_ENV !== 'production') {
@@ -5943,6 +5980,8 @@ var rafSchd = function rafSchd(fn) {
5943
5980
  return wrapperFn;
5944
5981
  };
5945
5982
 
5983
+ var rafSchd$1 = rafSchd;
5984
+
5946
5985
  var isProduction = process.env.NODE_ENV === 'production';
5947
5986
  var spacesAndTabs = /[ \t]{2,}/g;
5948
5987
  var lineStartWithSpaces = /^[ \t]*/gm;
@@ -9271,7 +9310,7 @@ function getScrollListener(_ref) {
9271
9310
  onWindowScroll(getWindowScroll());
9272
9311
  }
9273
9312
 
9274
- var scheduled = rafSchd(updateScroll);
9313
+ var scheduled = rafSchd$1(updateScroll);
9275
9314
  var binding = getWindowScrollBinding(scheduled);
9276
9315
  var unbind = noop;
9277
9316
 
@@ -10617,8 +10656,8 @@ var scroll$1 = (function (_ref) {
10617
10656
  var createFluidScroller = (function (_ref) {
10618
10657
  var scrollWindow = _ref.scrollWindow,
10619
10658
  scrollDroppable = _ref.scrollDroppable;
10620
- var scheduleWindowScroll = rafSchd(scrollWindow);
10621
- var scheduleDroppableScroll = rafSchd(scrollDroppable);
10659
+ var scheduleWindowScroll = rafSchd$1(scrollWindow);
10660
+ var scheduleDroppableScroll = rafSchd$1(scrollDroppable);
10622
10661
  var dragging = null;
10623
10662
 
10624
10663
  var tryScroll = function tryScroll(state) {
@@ -12582,7 +12621,7 @@ function tryStart(_ref3) {
12582
12621
  }
12583
12622
 
12584
12623
  function fluidLift(clientSelection) {
12585
- var move$1 = rafSchd(function (client) {
12624
+ var move$1 = rafSchd$1(function (client) {
12586
12625
  tryDispatchWhenDragging(function () {
12587
12626
  return move({
12588
12627
  client: client
@@ -13216,7 +13255,7 @@ function useDroppablePublisher(args) {
13216
13255
  memoizedUpdateScroll(scroll.x, scroll.y);
13217
13256
  }, [getClosestScroll, memoizedUpdateScroll]);
13218
13257
  var scheduleScrollUpdate = useMemo(function () {
13219
- return rafSchd(updateScroll);
13258
+ return rafSchd$1(updateScroll);
13220
13259
  }, [updateScroll]);
13221
13260
  var onClosestScroll = useCallback(function () {
13222
13261
  var dragging = whileDraggingRef.current;