@sinco/react 1.0.14-rc.22 → 1.0.14-rc.24

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 (2) hide show
  1. package/index.js +136 -61
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -146,7 +146,7 @@ var $TypeError$d = TypeError;
146
146
  // `RequireObjectCoercible` abstract operation
147
147
  // https://tc39.es/ecma262/#sec-requireobjectcoercible
148
148
  var requireObjectCoercible$3 = function (it) {
149
- if (isNullOrUndefined$4(it)) throw $TypeError$d("Can't call method on " + it);
149
+ if (isNullOrUndefined$4(it)) throw new $TypeError$d("Can't call method on " + it);
150
150
  return it;
151
151
  };
152
152
 
@@ -295,7 +295,7 @@ var $TypeError$c = TypeError;
295
295
  // `Assert: IsCallable(argument) is true`
296
296
  var aCallable$8 = function (argument) {
297
297
  if (isCallable$h(argument)) return argument;
298
- throw $TypeError$c(tryToString$3(argument) + ' is not a function');
298
+ throw new $TypeError$c(tryToString$3(argument) + ' is not a function');
299
299
  };
300
300
 
301
301
  var aCallable$7 = aCallable$8;
@@ -321,7 +321,7 @@ var ordinaryToPrimitive$1 = function (input, pref) {
321
321
  if (pref === 'string' && isCallable$g(fn = input.toString) && !isObject$7(val = call$f(fn, input))) return val;
322
322
  if (isCallable$g(fn = input.valueOf) && !isObject$7(val = call$f(fn, input))) return val;
323
323
  if (pref !== 'string' && isCallable$g(fn = input.toString) && !isObject$7(val = call$f(fn, input))) return val;
324
- throw $TypeError$b("Can't convert object to primitive value");
324
+ throw new $TypeError$b("Can't convert object to primitive value");
325
325
  };
326
326
 
327
327
  var shared$4 = {exports: {}};
@@ -352,10 +352,10 @@ var store$2 = sharedStore;
352
352
  (shared$4.exports = function (key, value) {
353
353
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
354
354
  })('versions', []).push({
355
- version: '3.32.2',
355
+ version: '3.33.0',
356
356
  mode: 'global',
357
357
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
358
- license: 'https://github.com/zloirock/core-js/blob/v3.32.2/LICENSE',
358
+ license: 'https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE',
359
359
  source: 'https://github.com/zloirock/core-js'
360
360
  });
361
361
 
@@ -430,7 +430,7 @@ var toPrimitive$1 = function (input, pref) {
430
430
  if (pref === undefined) pref = 'default';
431
431
  result = call$e(exoticToPrim, input, pref);
432
432
  if (!isObject$6(result) || isSymbol$1(result)) return result;
433
- throw $TypeError$a("Can't convert object to primitive value");
433
+ throw new $TypeError$a("Can't convert object to primitive value");
434
434
  }
435
435
  if (pref === undefined) pref = 'number';
436
436
  return ordinaryToPrimitive(input, pref);
@@ -515,7 +515,7 @@ var $TypeError$9 = TypeError;
515
515
  // `Assert: Type(argument) is Object`
516
516
  var anObject$d = function (argument) {
517
517
  if (isObject$4(argument)) return argument;
518
- throw $TypeError$9($String$3(argument) + ' is not an object');
518
+ throw new $TypeError$9($String$3(argument) + ' is not an object');
519
519
  };
520
520
 
521
521
  var DESCRIPTORS$7 = descriptors;
@@ -557,7 +557,7 @@ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
557
557
  if (IE8_DOM_DEFINE) try {
558
558
  return $defineProperty(O, P, Attributes);
559
559
  } catch (error) { /* empty */ }
560
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError$8('Accessors not supported');
560
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$8('Accessors not supported');
561
561
  if ('value' in Attributes) O[P] = Attributes.value;
562
562
  return O;
563
563
  };
@@ -648,7 +648,7 @@ var getterFor = function (TYPE) {
648
648
  return function (it) {
649
649
  var state;
650
650
  if (!isObject$3(it) || (state = get(it)).type !== TYPE) {
651
- throw TypeError$2('Incompatible receiver, ' + TYPE + ' required');
651
+ throw new TypeError$2('Incompatible receiver, ' + TYPE + ' required');
652
652
  } return state;
653
653
  };
654
654
  };
@@ -661,7 +661,7 @@ if (NATIVE_WEAK_MAP || shared$1.state) {
661
661
  store.set = store.set;
662
662
  /* eslint-enable no-self-assign -- prototype methods protection */
663
663
  set$1 = function (it, metadata) {
664
- if (store.has(it)) throw TypeError$2(OBJECT_ALREADY_INITIALIZED);
664
+ if (store.has(it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
665
665
  metadata.facade = it;
666
666
  store.set(it, metadata);
667
667
  return metadata;
@@ -676,7 +676,7 @@ if (NATIVE_WEAK_MAP || shared$1.state) {
676
676
  var STATE = sharedKey$2('state');
677
677
  hiddenKeys$3[STATE] = true;
678
678
  set$1 = function (it, metadata) {
679
- if (hasOwn$6(it, STATE)) throw TypeError$2(OBJECT_ALREADY_INITIALIZED);
679
+ if (hasOwn$6(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
680
680
  metadata.facade = it;
681
681
  createNonEnumerableProperty$4(it, STATE, metadata);
682
682
  return metadata;
@@ -2759,7 +2759,11 @@ function deprecatedPropType(validator, reason) {
2759
2759
  }
2760
2760
 
2761
2761
  function isMuiElement(element, muiNames) {
2762
- return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf(element.type.muiName) !== -1;
2762
+ var _muiName, _element$type;
2763
+ return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName
2764
+ // relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
2765
+ // eslint-disable-next-line no-underscore-dangle
2766
+ (_muiName = element.type.muiName) != null ? _muiName : (_element$type = element.type) == null || (_element$type = _element$type._payload) == null || (_element$type = _element$type.value) == null ? void 0 : _element$type.muiName) !== -1;
2763
2767
  }
2764
2768
 
2765
2769
  function ownerDocument(node) {
@@ -2816,6 +2820,13 @@ function setRef(ref, value) {
2816
2820
  }
2817
2821
  }
2818
2822
 
2823
+ /**
2824
+ * A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
2825
+ * This is useful for effects that are only needed for client-side rendering but not for SSR.
2826
+ *
2827
+ * Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
2828
+ * and confirm it doesn't apply to your use-case.
2829
+ */
2819
2830
  const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
2820
2831
  var useEnhancedEffect$1 = useEnhancedEffect;
2821
2832
 
@@ -6188,7 +6199,7 @@ tags.forEach(function (tagName) {
6188
6199
  });
6189
6200
 
6190
6201
  /**
6191
- * @mui/styled-engine v5.14.10
6202
+ * @mui/styled-engine v5.14.12
6192
6203
  *
6193
6204
  * @license MIT
6194
6205
  * This source code is licensed under the MIT license found in the
@@ -7545,40 +7556,48 @@ const getStyleOverrides = (name, theme) => {
7545
7556
  }
7546
7557
  return null;
7547
7558
  };
7559
+ const transformVariants = variants => {
7560
+ const variantsStyles = {};
7561
+ if (variants) {
7562
+ variants.forEach(definition => {
7563
+ const key = propsToClassKey(definition.props);
7564
+ variantsStyles[key] = definition.style;
7565
+ });
7566
+ }
7567
+ return variantsStyles;
7568
+ };
7548
7569
  const getVariantStyles = (name, theme) => {
7549
7570
  let variants = [];
7550
7571
  if (theme && theme.components && theme.components[name] && theme.components[name].variants) {
7551
7572
  variants = theme.components[name].variants;
7552
7573
  }
7553
- const variantsStyles = {};
7554
- variants.forEach(definition => {
7555
- const key = propsToClassKey(definition.props);
7556
- variantsStyles[key] = definition.style;
7557
- });
7558
- return variantsStyles;
7574
+ return transformVariants(variants);
7559
7575
  };
7560
- const variantsResolver = (props, styles, theme, name) => {
7561
- var _theme$components;
7576
+ const variantsResolver = (props, styles, variants) => {
7562
7577
  const {
7563
7578
  ownerState = {}
7564
7579
  } = props;
7565
7580
  const variantsStyles = [];
7566
- const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
7567
- if (themeVariants) {
7568
- themeVariants.forEach(themeVariant => {
7581
+ if (variants) {
7582
+ variants.forEach(variant => {
7569
7583
  let isMatch = true;
7570
- Object.keys(themeVariant.props).forEach(key => {
7571
- if (ownerState[key] !== themeVariant.props[key] && props[key] !== themeVariant.props[key]) {
7584
+ Object.keys(variant.props).forEach(key => {
7585
+ if (ownerState[key] !== variant.props[key] && props[key] !== variant.props[key]) {
7572
7586
  isMatch = false;
7573
7587
  }
7574
7588
  });
7575
7589
  if (isMatch) {
7576
- variantsStyles.push(styles[propsToClassKey(themeVariant.props)]);
7590
+ variantsStyles.push(styles[propsToClassKey(variant.props)]);
7577
7591
  }
7578
7592
  });
7579
7593
  }
7580
7594
  return variantsStyles;
7581
7595
  };
7596
+ const themeVariantsResolver = (props, styles, theme, name) => {
7597
+ var _theme$components;
7598
+ const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
7599
+ return variantsResolver(props, styles, themeVariants);
7600
+ };
7582
7601
 
7583
7602
  // Update /system/styled/#api in case if this changes
7584
7603
  function shouldForwardProp(prop) {
@@ -7604,6 +7623,29 @@ function defaultOverridesResolver(slot) {
7604
7623
  }
7605
7624
  return (props, styles) => styles[slot];
7606
7625
  }
7626
+ const muiStyledFunctionResolver = ({
7627
+ styledArg,
7628
+ props,
7629
+ defaultTheme,
7630
+ themeId
7631
+ }) => {
7632
+ const resolvedStyles = styledArg(_extends$2({}, props, {
7633
+ theme: resolveTheme(_extends$2({}, props, {
7634
+ defaultTheme,
7635
+ themeId
7636
+ }))
7637
+ }));
7638
+ let optionalVariants;
7639
+ if (resolvedStyles && resolvedStyles.variants) {
7640
+ optionalVariants = resolvedStyles.variants;
7641
+ delete resolvedStyles.variants;
7642
+ }
7643
+ if (optionalVariants) {
7644
+ const variantsStyles = variantsResolver(props, transformVariants(optionalVariants), optionalVariants);
7645
+ return [resolvedStyles, ...variantsStyles];
7646
+ }
7647
+ return resolvedStyles;
7648
+ };
7607
7649
  function createStyled(input = {}) {
7608
7650
  const {
7609
7651
  themeId,
@@ -7670,16 +7712,61 @@ function createStyled(input = {}) {
7670
7712
  // On the server Emotion doesn't use React.forwardRef for creating components, so the created
7671
7713
  // component stays as a function. This condition makes sure that we do not interpolate functions
7672
7714
  // which are basically components used as a selectors.
7673
- return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? props => {
7674
- return stylesArg(_extends$2({}, props, {
7675
- theme: resolveTheme(_extends$2({}, props, {
7676
- defaultTheme,
7677
- themeId
7678
- }))
7679
- }));
7680
- } : stylesArg;
7715
+ if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg) {
7716
+ return props => muiStyledFunctionResolver({
7717
+ styledArg: stylesArg,
7718
+ props,
7719
+ defaultTheme,
7720
+ themeId
7721
+ });
7722
+ }
7723
+ if (isPlainObject(stylesArg)) {
7724
+ let transformedStylesArg = stylesArg;
7725
+ let styledArgVariants;
7726
+ if (stylesArg && stylesArg.variants) {
7727
+ styledArgVariants = stylesArg.variants;
7728
+ delete transformedStylesArg.variants;
7729
+ transformedStylesArg = props => {
7730
+ let result = stylesArg;
7731
+ const variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
7732
+ variantStyles.forEach(variantStyle => {
7733
+ result = deepmerge(result, variantStyle);
7734
+ });
7735
+ return result;
7736
+ };
7737
+ }
7738
+ return transformedStylesArg;
7739
+ }
7740
+ return stylesArg;
7681
7741
  }) : [];
7682
7742
  let transformedStyleArg = styleArg;
7743
+ if (isPlainObject(styleArg)) {
7744
+ let styledArgVariants;
7745
+ if (styleArg && styleArg.variants) {
7746
+ styledArgVariants = styleArg.variants;
7747
+ delete transformedStyleArg.variants;
7748
+ transformedStyleArg = props => {
7749
+ let result = styleArg;
7750
+ const variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
7751
+ variantStyles.forEach(variantStyle => {
7752
+ result = deepmerge(result, variantStyle);
7753
+ });
7754
+ return result;
7755
+ };
7756
+ }
7757
+ } else if (typeof styleArg === 'function' &&
7758
+ // On the server Emotion doesn't use React.forwardRef for creating components, so the created
7759
+ // component stays as a function. This condition makes sure that we do not interpolate functions
7760
+ // which are basically components used as a selectors.
7761
+ styleArg.__emotion_real !== styleArg) {
7762
+ // If the type is function, we need to define the default theme.
7763
+ transformedStyleArg = props => muiStyledFunctionResolver({
7764
+ styledArg: styleArg,
7765
+ props,
7766
+ defaultTheme,
7767
+ themeId
7768
+ });
7769
+ }
7683
7770
  if (componentName && overridesResolver) {
7684
7771
  expressionsWithDefaultTheme.push(props => {
7685
7772
  const theme = resolveTheme(_extends$2({}, props, {
@@ -7705,7 +7792,7 @@ function createStyled(input = {}) {
7705
7792
  defaultTheme,
7706
7793
  themeId
7707
7794
  }));
7708
- return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
7795
+ return themeVariantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
7709
7796
  });
7710
7797
  }
7711
7798
  if (!skipSx) {
@@ -7717,18 +7804,6 @@ function createStyled(input = {}) {
7717
7804
  // If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles.
7718
7805
  transformedStyleArg = [...styleArg, ...placeholders];
7719
7806
  transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
7720
- } else if (typeof styleArg === 'function' &&
7721
- // On the server Emotion doesn't use React.forwardRef for creating components, so the created
7722
- // component stays as a function. This condition makes sure that we do not interpolate functions
7723
- // which are basically components used as a selectors.
7724
- styleArg.__emotion_real !== styleArg) {
7725
- // If the type is function, we need to define the default theme.
7726
- transformedStyleArg = props => styleArg(_extends$2({}, props, {
7727
- theme: resolveTheme(_extends$2({}, props, {
7728
- defaultTheme,
7729
- themeId
7730
- }))
7731
- }));
7732
7807
  }
7733
7808
  const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
7734
7809
  if (process.env.NODE_ENV !== 'production') {
@@ -10226,7 +10301,7 @@ var classof$4 = classof$5;
10226
10301
  var $String$1 = String;
10227
10302
 
10228
10303
  var toString$2 = function (argument) {
10229
- if (classof$4(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
10304
+ if (classof$4(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
10230
10305
  return $String$1(argument);
10231
10306
  };
10232
10307
 
@@ -10398,7 +10473,7 @@ var $RegExp$1 = global$9.RegExp;
10398
10473
 
10399
10474
  var regexpUnsupportedDotAll = fails$6(function () {
10400
10475
  var re = $RegExp$1('.', 's');
10401
- return !(re.dotAll && re.exec('\n') && re.flags === 's');
10476
+ return !(re.dotAll && re.test('\n') && re.flags === 's');
10402
10477
  });
10403
10478
 
10404
10479
  var fails$5 = fails$h;
@@ -10652,7 +10727,7 @@ var regexpExecAbstract = function (R, S) {
10652
10727
  return result;
10653
10728
  }
10654
10729
  if (classof$3(R) === 'RegExp') return call$a(regexpExec, R, S);
10655
- throw $TypeError$7('RegExp#exec called on incompatible receiver');
10730
+ throw new $TypeError$7('RegExp#exec called on incompatible receiver');
10656
10731
  };
10657
10732
 
10658
10733
  var call$9 = functionCall;
@@ -17163,7 +17238,7 @@ var $TypeError$6 = TypeError;
17163
17238
 
17164
17239
  var aPossiblePrototype$1 = function (argument) {
17165
17240
  if (typeof argument == 'object' || isCallable$6(argument)) return argument;
17166
- throw $TypeError$6("Can't set " + $String(argument) + ' as a prototype');
17241
+ throw new $TypeError$6("Can't set " + $String(argument) + ' as a prototype');
17167
17242
  };
17168
17243
 
17169
17244
  /* eslint-disable no-proto -- safe */
@@ -17805,7 +17880,7 @@ var $TypeError$5 = TypeError;
17805
17880
 
17806
17881
  var anInstance$1 = function (it, Prototype) {
17807
17882
  if (isPrototypeOf$1(Prototype, it)) return it;
17808
- throw $TypeError$5('Incorrect invocation');
17883
+ throw new $TypeError$5('Incorrect invocation');
17809
17884
  };
17810
17885
 
17811
17886
  var uncurryThis$2 = functionUncurryThis;
@@ -17820,7 +17895,7 @@ var empty = [];
17820
17895
  var construct = getBuiltIn$2('Reflect', 'construct');
17821
17896
  var constructorRegExp = /^\s*(?:class|function)\b/;
17822
17897
  var exec = uncurryThis$2(constructorRegExp.exec);
17823
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
17898
+ var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
17824
17899
 
17825
17900
  var isConstructorModern = function isConstructor(argument) {
17826
17901
  if (!isCallable$4(argument)) return false;
@@ -17869,7 +17944,7 @@ var $TypeError$4 = TypeError;
17869
17944
  // `Assert: IsConstructor(argument) is true`
17870
17945
  var aConstructor$1 = function (argument) {
17871
17946
  if (isConstructor(argument)) return argument;
17872
- throw $TypeError$4(tryToString$2(argument) + ' is not a constructor');
17947
+ throw new $TypeError$4(tryToString$2(argument) + ' is not a constructor');
17873
17948
  };
17874
17949
 
17875
17950
  var anObject$4 = anObject$d;
@@ -17919,7 +17994,7 @@ var arraySlice$1 = uncurryThis([].slice);
17919
17994
  var $TypeError$3 = TypeError;
17920
17995
 
17921
17996
  var validateArgumentsLength$1 = function (passed, required) {
17922
- if (passed < required) throw $TypeError$3('Not enough arguments');
17997
+ if (passed < required) throw new $TypeError$3('Not enough arguments');
17923
17998
  return passed;
17924
17999
  };
17925
18000
 
@@ -18242,7 +18317,7 @@ var $TypeError$2 = TypeError;
18242
18317
  var PromiseCapability = function (C) {
18243
18318
  var resolve, reject;
18244
18319
  this.promise = new C(function ($$resolve, $$reject) {
18245
- if (resolve !== undefined || reject !== undefined) throw $TypeError$2('Bad Promise constructor');
18320
+ if (resolve !== undefined || reject !== undefined) throw new $TypeError$2('Bad Promise constructor');
18246
18321
  resolve = $$resolve;
18247
18322
  reject = $$reject;
18248
18323
  });
@@ -18335,7 +18410,7 @@ var callReaction = function (reaction, state) {
18335
18410
  }
18336
18411
  }
18337
18412
  if (result === reaction.promise) {
18338
- reject(TypeError$1('Promise-chain cycle'));
18413
+ reject(new TypeError$1('Promise-chain cycle'));
18339
18414
  } else if (then = isThenable(result)) {
18340
18415
  call$6(then, result, resolve, reject);
18341
18416
  } else resolve(result);
@@ -18425,7 +18500,7 @@ var internalResolve = function (state, value, unwrap) {
18425
18500
  state.done = true;
18426
18501
  if (unwrap) state = unwrap;
18427
18502
  try {
18428
- if (state.facade === value) throw TypeError$1("Promise can't be resolved itself");
18503
+ if (state.facade === value) throw new TypeError$1("Promise can't be resolved itself");
18429
18504
  var then = isThenable(value);
18430
18505
  if (then) {
18431
18506
  microtask(function () {
@@ -18579,7 +18654,7 @@ var $TypeError$1 = TypeError;
18579
18654
  var getIterator$1 = function (argument, usingIterator) {
18580
18655
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
18581
18656
  if (aCallable$2(iteratorMethod)) return anObject$3(call$5(iteratorMethod, argument));
18582
- throw $TypeError$1(tryToString$1(argument) + ' is not iterable');
18657
+ throw new $TypeError$1(tryToString$1(argument) + ' is not iterable');
18583
18658
  };
18584
18659
 
18585
18660
  var call$4 = functionCall;
@@ -18653,7 +18728,7 @@ var iterate$2 = function (iterable, unboundFunction, options) {
18653
18728
  iterator = iterable;
18654
18729
  } else {
18655
18730
  iterFn = getIteratorMethod(iterable);
18656
- if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
18731
+ if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
18657
18732
  // optimisation for array iterators
18658
18733
  if (isArrayIteratorMethod(iterFn)) {
18659
18734
  for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinco/react",
3
- "version": "1.0.14-rc.22",
3
+ "version": "1.0.14-rc.24",
4
4
  "description": "package for the configuration of mui react sinco",
5
5
  "private": false,
6
6
  "license": "MIT",