@tamagui/core 1.0.1-beta.214 → 1.0.1-beta.216

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 (49) hide show
  1. package/dist/cjs/constants/isDevTools.js +9 -1
  2. package/dist/cjs/constants/isDevTools.js.map +2 -2
  3. package/dist/cjs/createComponent.js +82 -156
  4. package/dist/cjs/createComponent.js.map +3 -3
  5. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  6. package/dist/cjs/helpers/getSplitStyles.js +74 -47
  7. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  8. package/dist/cjs/helpers/getStylesAtomic.js +5 -1
  9. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  10. package/dist/cjs/helpers/normalizeValueWithProperty.js +9 -5
  11. package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
  12. package/dist/cjs/helpers/pseudoDescriptors.js +10 -0
  13. package/dist/cjs/helpers/pseudoDescriptors.js.map +2 -2
  14. package/dist/cjs/helpers/useShallowSetState.js +1 -1
  15. package/dist/cjs/helpers/useShallowSetState.js.map +2 -2
  16. package/dist/cjs/types.js.map +1 -1
  17. package/dist/cjs/views/TamaguiProvider.js +2 -5
  18. package/dist/cjs/views/TamaguiProvider.js.map +3 -3
  19. package/dist/esm/constants/isDevTools.js +9 -1
  20. package/dist/esm/constants/isDevTools.js.map +2 -2
  21. package/dist/esm/createComponent.js +83 -156
  22. package/dist/esm/createComponent.js.map +3 -3
  23. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  24. package/dist/esm/helpers/getSplitStyles.js +75 -48
  25. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  26. package/dist/esm/helpers/getStylesAtomic.js +5 -1
  27. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  28. package/dist/esm/helpers/normalizeValueWithProperty.js +9 -5
  29. package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
  30. package/dist/esm/helpers/pseudoDescriptors.js +10 -0
  31. package/dist/esm/helpers/pseudoDescriptors.js.map +2 -2
  32. package/dist/esm/helpers/useShallowSetState.js +1 -1
  33. package/dist/esm/helpers/useShallowSetState.js.map +2 -2
  34. package/dist/esm/views/TamaguiProvider.js +2 -5
  35. package/dist/esm/views/TamaguiProvider.js.map +3 -3
  36. package/package.json +12 -12
  37. package/src/constants/isDevTools.ts +10 -4
  38. package/src/createComponent.tsx +101 -208
  39. package/src/helpers/createPropMapper.ts +1 -0
  40. package/src/helpers/getSplitStyles.tsx +91 -57
  41. package/src/helpers/getStylesAtomic.ts +7 -2
  42. package/src/helpers/normalizeValueWithProperty.ts +11 -5
  43. package/src/helpers/pseudoDescriptors.ts +24 -3
  44. package/src/helpers/useShallowSetState.tsx +1 -1
  45. package/src/types.tsx +1 -1
  46. package/src/views/TamaguiProvider.tsx +5 -6
  47. package/types/helpers/getSplitStyles.d.ts +1 -1
  48. package/types/helpers/pseudoDescriptors.d.ts +8 -14
  49. package/types/types.d.ts +1 -1
@@ -3,6 +3,7 @@ import { useComposedRefs } from "@tamagui/compose-refs";
3
3
  import { isClient, isRSC, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
4
4
  import {
5
5
  composeEventHandlers,
6
+ stylePropsTransform,
6
7
  stylePropsView,
7
8
  validPseudoKeys,
8
9
  validStyles
@@ -32,7 +33,9 @@ import {
32
33
  } from "./helpers/getSplitStyles";
33
34
  import { getAllSelectors } from "./helpers/insertStyleRule";
34
35
  import { mergeProps } from "./helpers/mergeProps";
36
+ import { mergeTransform } from "./helpers/mergeTransform";
35
37
  import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
38
+ import { pseudoDescriptors } from "./helpers/pseudoDescriptors";
36
39
  import { useShallowSetState } from "./helpers/useShallowSetState";
37
40
  import { getRect, measureLayout, useElementLayout } from "./hooks/useElementLayout";
38
41
  import { addMediaQueryListener, getInitialMediaState } from "./hooks/useMedia";
@@ -98,11 +101,6 @@ function createComponent(configIn, ParentComponent) {
98
101
  const { Component, isText, isZStack } = staticConfig;
99
102
  const componentName = props.componentName || staticConfig.componentName;
100
103
  const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
101
- if (debugProp) {
102
- console.log(`render ${componentName}`);
103
- }
104
- const forceUpdate = useForceUpdate();
105
- const theme = useTheme(props.theme, componentName, props, forceUpdate);
106
104
  const hasEnterStyle = !!props.enterStyle;
107
105
  const needsMount = Boolean((isWeb ? isClient : true) && (hasEnterStyle || props.animation));
108
106
  const states = useServerState(
@@ -111,42 +109,47 @@ function createComponent(configIn, ParentComponent) {
111
109
  const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
112
110
  const setState = states[1];
113
111
  const setStateShallow = useShallowSetState(setState, debugProp, componentName);
114
- const shouldSetMounted = needsMount && !state.mounted;
112
+ const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
113
+ const hasEverAnimated = useRef(false);
114
+ const isAnimated = (() => {
115
+ const next = !!(useAnimations && props.animation);
116
+ if (next && !hasEverAnimated.current) {
117
+ hasEverAnimated.current = true;
118
+ }
119
+ return next || hasEverAnimated.current;
120
+ })();
121
+ const isReactNative = Boolean(
122
+ staticConfig.isReactNative || isAnimated && tamaguiConfig.animations.isReactNative
123
+ );
124
+ if (process.env.NODE_ENV === "development") {
125
+ if (props["debug"]) {
126
+ const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
127
+ const type = isReactNative ? "(rnw)" : "";
128
+ const dataIs = propsIn["data-is"] || "";
129
+ const banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
130
+ console.group(`%c ${banner}`, "background: yellow;");
131
+ console.log(`state`, state);
132
+ }
133
+ }
134
+ const forceUpdate = useForceUpdate();
135
+ const theme = useTheme(props.theme, componentName, props, forceUpdate);
136
+ const shouldSetMounted = needsMount && state.unmounted;
115
137
  const setMounted = shouldSetMounted ? () => {
116
138
  setTimeout(
117
139
  () => {
118
140
  setStateShallow({
119
- mounted: true
141
+ unmounted: false
120
142
  });
121
143
  },
122
144
  isWeb ? 10 : 0
123
145
  );
124
146
  } : void 0;
125
- const shouldAvoidClasses = !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
147
+ const shouldAvoidClasses = !isWeb || !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
126
148
  const shouldForcePseudo = !!propsIn.forceStyle;
127
149
  const hasTextAncestor = !!(isWeb && isText ? useContext(TextAncestorContext) : false);
128
- const splitStyleState = !shouldAvoidClasses && !shouldForcePseudo ? {
129
- ...state,
130
- hasTextAncestor,
131
- dynamicStylesInline: true
132
- } : {
133
- ...state,
134
- noClassNames: true,
135
- dynamicStylesInline: true,
136
- hasTextAncestor,
137
- resolveVariablesAs: "value"
138
- };
150
+ const noClassNames = shouldAvoidClasses || shouldForcePseudo;
139
151
  const languageContext = isRSC ? null : useContext(FontLanguageContext);
140
- const isDisabled = props.disabled ?? ((_a = props.accessibilityState) == null ? void 0 : _a.disabled);
141
- const useAnimations = (_b = tamaguiConfig.animations) == null ? void 0 : _b.useAnimations;
142
- const hasEverAnimated = useRef(false);
143
- const isAnimated = (() => {
144
- const next = !!(useAnimations && props.animation);
145
- if (next && !hasEverAnimated.current) {
146
- hasEverAnimated.current = true;
147
- }
148
- return next || hasEverAnimated.current;
149
- })();
152
+ const isDisabled = props.disabled ?? ((_b = props.accessibilityState) == null ? void 0 : _b.disabled);
150
153
  const isTaggable = !Component || typeof Component === "string";
151
154
  const element = isWeb ? isTaggable ? props.tag || defaultTag || Component : Component : Component;
152
155
  const BaseTextComponent = BaseText || element || "span";
@@ -154,6 +157,13 @@ function createComponent(configIn, ParentComponent) {
154
157
  let elementType = isText ? (isAnimated ? AnimatedText : null) || BaseTextComponent : (isAnimated ? AnimatedView : null) || BaseViewComponent;
155
158
  elementType = Component || elementType;
156
159
  const isStringElement = typeof elementType === "string";
160
+ const splitStyleState = {
161
+ ...state,
162
+ noClassNames,
163
+ dynamicStylesInline: noClassNames,
164
+ hasTextAncestor,
165
+ resolveVariablesAs: "value"
166
+ };
157
167
  const splitStyles = useSplitStyles(
158
168
  props,
159
169
  staticConfig,
@@ -165,24 +175,17 @@ function createComponent(configIn, ParentComponent) {
165
175
  debugProp
166
176
  );
167
177
  const hostRef = useServerRef(null);
168
- const isReactNative = Boolean(
169
- staticConfig.isReactNative || isAnimated && tamaguiConfig.animations.isReactNative
170
- );
171
178
  const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating;
172
179
  if (process.env.NODE_ENV === "development") {
173
180
  if (!process.env.TAMAGUI_TARGET) {
174
181
  console.error(`No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".`);
175
182
  }
176
183
  if (debugProp) {
177
- const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
178
- const type = isReactNative ? "rnw" : "tamagui";
179
- const banner = `${name} ${propsIn["data-is"] || ""} ${type}`;
180
- console.group(`%c \u{1F41B} ${banner}`, "background: yellow;");
181
- console.groupCollapsed("initial props/state");
182
- console.log("propsIn", propsIn, "turned into", props, "order", Object.keys(props));
184
+ console.groupCollapsed("props");
185
+ console.log("props in", propsIn, "mapped to", props, "in order", Object.keys(props));
183
186
  console.log("splitStyles", splitStyles);
184
187
  console.log("className", Object.values(splitStyles.classNames));
185
- if (typeof window !== "undefined") {
188
+ if (isClient) {
186
189
  console.log("ref", hostRef, "(click to view)");
187
190
  }
188
191
  console.groupEnd();
@@ -199,7 +202,6 @@ function createComponent(configIn, ParentComponent) {
199
202
  classNames,
200
203
  mediaKeys
201
204
  } = splitStyles;
202
- const animationFeatureStylesIn = props.animation ? { ...defaultNativeStyle, ...splitStylesStyle } : null;
203
205
  const propsWithAnimation = props;
204
206
  let animationStyles;
205
207
  if (!isRSC && isAnimated && useAnimations) {
@@ -211,7 +213,7 @@ function createComponent(configIn, ParentComponent) {
211
213
  staticConfig,
212
214
  getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {
213
215
  var _a2, _b2, _c2, _d2;
214
- const style = animationFeatureStylesIn;
216
+ const animationStyle = { ...defaultNativeStyle, ...splitStylesStyle };
215
217
  const enterStyle = isEntering ? enterVariant && ((_a2 = staticConfig.variants) == null ? void 0 : _a2[enterVariant]["true"]) ? getSubStyle(
216
218
  "",
217
219
  (_b2 = staticConfig.variants) == null ? void 0 : _b2[enterVariant]["true"],
@@ -220,7 +222,7 @@ function createComponent(configIn, ParentComponent) {
220
222
  props,
221
223
  state,
222
224
  tamaguiConfig
223
- ) || pseudos.enterStyle : pseudos.enterStyle : null;
225
+ ) : null : null;
224
226
  const exitStyle = isExiting ? exitVariant && ((_c2 = staticConfig.variants) == null ? void 0 : _c2[exitVariant]["true"]) ? getSubStyle(
225
227
  "",
226
228
  (_d2 = staticConfig.variants) == null ? void 0 : _d2[exitVariant]["true"],
@@ -229,24 +231,14 @@ function createComponent(configIn, ParentComponent) {
229
231
  props,
230
232
  state,
231
233
  tamaguiConfig
232
- ) || pseudos.exitStyle : pseudos.exitStyle : null;
233
- ensureBaseHasDefaults(
234
- style,
235
- pseudos.hoverStyle,
236
- pseudos.focusStyle,
237
- pseudos.pressStyle
238
- );
239
- enterStyle && isEntering && merge(style, enterStyle);
240
- state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle);
241
- state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle);
242
- state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle);
243
- exitStyle && isExiting && merge(style, exitStyle);
244
- if (process.env.NODE_ENV === "development") {
245
- if (debugProp === "verbose") {
246
- console.log("animation style", style);
247
- }
234
+ ) : pseudos.exitStyle : null;
235
+ if (isEntering && enterStyle) {
236
+ merge(animationStyle, enterStyle);
237
+ }
238
+ if (isExiting && exitStyle) {
239
+ merge(animationStyle, exitStyle);
248
240
  }
249
- return style;
241
+ return animationStyle;
250
242
  }
251
243
  });
252
244
  if (animations) {
@@ -418,13 +410,6 @@ function createComponent(configIn, ParentComponent) {
418
410
  };
419
411
  } else {
420
412
  styles = [isWeb ? null : defaultNativeStyle, animationStyles ?? splitStylesStyle, medias];
421
- if (!animationStyles && initialSplitStyles) {
422
- const initPseudos = initialSplitStyles.pseudos;
423
- !state.mounted && addPseudoToStyles(styles, initPseudos, pseudos, "enterStyle");
424
- state.hover && addPseudoToStyles(styles, initPseudos, pseudos, "hoverStyle", shouldForcePseudo);
425
- state.focus && addPseudoToStyles(styles, initPseudos, pseudos, "focusStyle", shouldForcePseudo);
426
- state.press && addPseudoToStyles(styles, initPseudos, pseudos, "pressStyle", shouldForcePseudo);
427
- }
428
413
  if (shouldForcePseudo) {
429
414
  const next = {};
430
415
  for (const style of styles) {
@@ -498,9 +483,11 @@ function createComponent(configIn, ParentComponent) {
498
483
  viewProps.style = styles;
499
484
  }
500
485
  const initialPseudos = initialSplitStyles == null ? void 0 : initialSplitStyles.pseudos;
501
- const attachPress = !!((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle) || onPress || onPressOut || onPressIn || onClick);
486
+ const runtimePressStyle = noClassNames && ((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle));
487
+ const attachPress = !!(runtimePressStyle || onPress || onPressOut || onPressIn || onClick);
502
488
  const isHoverable = isWeb;
503
- const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
489
+ const runtimeHoverStyle = noClassNames && ((pseudos == null ? void 0 : pseudos.hoverStyle) || initialPseudos.hoverStyle);
490
+ const attachHover = isHoverable && !!(runtimeHoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
504
491
  const handlesPressEvents = !isWeb && !asChild;
505
492
  const shouldAttach = asChild ? false : Boolean(
506
493
  attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props)
@@ -511,7 +498,7 @@ function createComponent(configIn, ParentComponent) {
511
498
  onPressOut == null ? void 0 : onPressOut(e);
512
499
  onMouseUp == null ? void 0 : onMouseUp(e);
513
500
  } : void 0,
514
- ...isHoverable && {
501
+ ...attachHover && {
515
502
  onMouseEnter: attachHover ? (e) => {
516
503
  const next = {};
517
504
  if (attachHover) {
@@ -606,7 +593,7 @@ function createComponent(configIn, ParentComponent) {
606
593
  };
607
594
  }
608
595
  if (process.env.TAMAGUI_TARGET === "native") {
609
- const attachFocus = !!(pseudos && pseudos.focusStyle || initialPseudos && initialPseudos.focusStyle);
596
+ const attachFocus = !!(pseudos.focusStyle || initialPseudos && initialPseudos.focusStyle);
610
597
  if (attachFocus) {
611
598
  viewProps.onFocus = mergeEvent(viewProps.onFocus, () => {
612
599
  setStateShallow({ focus: true });
@@ -615,11 +602,8 @@ function createComponent(configIn, ParentComponent) {
615
602
  setStateShallow({ focus: false });
616
603
  });
617
604
  }
618
- const pressability = usePressability(events);
605
+ const pressability = usePressability(events ? { ...events, hitSlop } : {});
619
606
  if (attachPress && events) {
620
- if (hitSlop) {
621
- viewProps.hitSlop = hitSlop;
622
- }
623
607
  for (const key in pressability) {
624
608
  const og = props[key];
625
609
  const val = pressability[key];
@@ -674,12 +658,12 @@ function createComponent(configIn, ParentComponent) {
674
658
  press: false,
675
659
  pressIn: false,
676
660
  focus: false,
677
- mounted: false,
661
+ unmounted: true,
678
662
  mediaState: getMediaStateObject(getInitialMediaState())
679
663
  };
680
664
  defaultComponentStateMounted = {
681
665
  ...defaultComponentState,
682
- mounted: true
666
+ unmounted: false
683
667
  };
684
668
  }
685
669
  if (tamaguiConfig.animations) {
@@ -719,22 +703,21 @@ function createComponent(configIn, ParentComponent) {
719
703
  staticConfig,
720
704
  initialTheme,
721
705
  {
722
- mounted: true,
706
+ unmounted: false,
723
707
  hover: false,
724
708
  press: false,
725
709
  pressIn: false,
726
710
  focus: false,
727
711
  resolveVariablesAs: "both",
728
- noClassNames,
729
- keepVariantsAsProps: true
712
+ noClassNames
730
713
  },
731
714
  void 0,
732
715
  void 0,
733
716
  debug
734
717
  );
735
- const [defaults2, defaultsClassnames] = mergeProps(
718
+ const [defaults, defaultsClassnames] = mergeProps(
736
719
  component.defaultProps,
737
- initialSplitStyles.viewProps,
720
+ isWeb ? { ...initialSplitStyles.pseudos, ...initialSplitStyles.viewProps } : initialSplitStyles.viewProps,
738
721
  true
739
722
  );
740
723
  initialSplitStyles.classNames = {
@@ -750,14 +733,22 @@ function createComponent(configIn, ParentComponent) {
750
733
  if (validPseudoKeys[key])
751
734
  continue;
752
735
  if (typeof val === "string" && val[0] === "$" || !validStyles2[key]) {
753
- defaults2[key] = val;
736
+ defaults[key] = val;
754
737
  } else {
755
738
  defaultNativeStyle[key] = val;
756
739
  }
757
740
  }
758
741
  }
759
- if (Object.keys(defaults2).length) {
760
- tamaguiDefaultProps = defaults2;
742
+ if (Object.keys(defaults).length) {
743
+ tamaguiDefaultProps = defaults;
744
+ if (!isWeb) {
745
+ Object.keys(pseudoDescriptors).forEach((k) => {
746
+ if (ourProps[k]) {
747
+ initialSplitStyles.pseudos[k] = null;
748
+ tamaguiDefaultProps[k] = ourProps[k];
749
+ }
750
+ });
751
+ }
761
752
  }
762
753
  if (process.env.NODE_ENV === "development" && debug) {
763
754
  if (process.env.IS_STATIC !== "is_static") {
@@ -766,7 +757,7 @@ function createComponent(configIn, ParentComponent) {
766
757
  initialSplitStyles,
767
758
  tamaguiDefaultProps,
768
759
  defaultNativeStyle,
769
- defaults: defaults2,
760
+ defaults,
770
761
  defaultPropsIn,
771
762
  defaultPropsKeyOrder: Object.keys(staticConfig.defaultProps),
772
763
  defaultPropsInKeyOrder: Object.keys(defaultPropsIn).map((k) => [k, defaultPropsIn[k]]),
@@ -880,12 +871,10 @@ function spacedChildren({
880
871
  }, index)
881
872
  );
882
873
  }
883
- if (isUnspaced(child) && index === 0) {
874
+ if (isUnspaced(child) && index === 0)
884
875
  continue;
885
- }
886
- if (isZStack) {
876
+ if (isZStack)
887
877
  continue;
888
- }
889
878
  const next = childrenList[index + 1];
890
879
  if (next && !isUnspaced(next)) {
891
880
  if (separator) {
@@ -939,15 +928,6 @@ function isUnspaced(child) {
939
928
  var _a, _b;
940
929
  return ((_a = child == null ? void 0 : child["type"]) == null ? void 0 : _a["isVisuallyHidden"]) || ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isUnspaced"]);
941
930
  }
942
- function addPseudoToStyles(styles, initialPseudos, pseudos, name, force = false) {
943
- const pseudoStyle = pseudos[name];
944
- const shouldNestObject = isWeb && name !== "enterStyle" && name !== "exitStyle";
945
- const defaultPseudoStyle = initialPseudos[name];
946
- const style = defaultPseudoStyle ? { ...defaultPseudoStyle, ...pseudoStyle } : pseudoStyle;
947
- if (style) {
948
- styles.push(shouldNestObject && !force ? { [name]: style } : style);
949
- }
950
- }
951
931
  const DefaultProps = /* @__PURE__ */ new Map();
952
932
  function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf) {
953
933
  const len = parentNames.length;
@@ -976,66 +956,13 @@ function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf)
976
956
  }
977
957
  return props;
978
958
  }
979
- const defaults = {
980
- left: 0,
981
- right: 0,
982
- top: 0,
983
- bottom: 0,
984
- opacity: 1,
985
- translateX: 0,
986
- translateY: 0,
987
- skew: 0,
988
- skewX: 0,
989
- skewY: 0,
990
- scale: 1,
991
- rotate: "0deg",
992
- rotateY: "0deg",
993
- rotateX: "0deg"
994
- };
995
- function ensureBaseHasDefaults(base, ...pseudos) {
996
- for (const pseudo of pseudos) {
997
- if (!pseudo)
998
- continue;
999
- for (const key in pseudo) {
1000
- const val = pseudo[key];
1001
- if (key === "transform") {
1002
- if (typeof val === "string") {
1003
- continue;
1004
- }
1005
- for (const t of val) {
1006
- const tkey = Object.keys(t)[0];
1007
- const defaultVal = defaults[tkey];
1008
- const tDefaultVal = { [tkey]: defaultVal };
1009
- if (!base.transform) {
1010
- base.transform = [tDefaultVal];
1011
- } else {
1012
- if (!base.transform.find((x) => x[tkey])) {
1013
- base.transform.push(tDefaultVal);
1014
- }
1015
- }
1016
- }
1017
- } else {
1018
- if (!(key in base)) {
1019
- base[key] = defaults[key];
1020
- }
1021
- }
1022
- }
1023
- }
1024
- }
1025
959
  function merge(base, next) {
1026
- if (!next.transform || !base.transform) {
1027
- Object.assign(base, next);
1028
- return;
1029
- }
1030
- const { transform, ...rest } = next;
1031
- Object.assign(base, rest);
1032
- for (const t of transform) {
1033
- const key = Object.keys(t)[0];
1034
- const existing = base.transform.find((x) => key in x);
1035
- if (existing) {
1036
- existing[key] = t[key];
960
+ for (const key in next) {
961
+ const val = next[key];
962
+ if (key in stylePropsTransform) {
963
+ mergeTransform(base, key, val, true);
1037
964
  } else {
1038
- base.transform.push(t);
965
+ base[key] = val;
1039
966
  }
1040
967
  }
1041
968
  }