@tamagui/web 1.36.6 → 1.37.1
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/cjs/constants/accessibilityDirectMap.native.js +3 -0
- package/dist/cjs/constants/accessibilityDirectMap.native.js.map +1 -1
- package/dist/cjs/createComponent.js +29 -25
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/createTamagui.js +8 -9
- package/dist/cjs/createTamagui.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.js +2 -2
- package/dist/cjs/helpers/ThemeManager.js.map +1 -1
- package/dist/cjs/helpers/createPropMapper.js +7 -6
- package/dist/cjs/helpers/createPropMapper.js.map +1 -1
- package/dist/cjs/helpers/extendStaticConfig.js +3 -2
- package/dist/cjs/helpers/extendStaticConfig.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +178 -228
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +1 -1
- package/dist/cjs/helpers/getStylesAtomic.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/cjs/hooks/useMedia.js +3 -2
- package/dist/cjs/hooks/useMedia.js.map +1 -1
- package/dist/cjs/styled.js +10 -6
- package/dist/cjs/styled.js.map +1 -1
- package/dist/esm/constants/accessibilityDirectMap.native.js +2 -0
- package/dist/esm/constants/accessibilityDirectMap.native.js.map +1 -1
- package/dist/esm/createComponent.js +29 -25
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createTamagui.js +8 -9
- package/dist/esm/createTamagui.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.js +2 -2
- package/dist/esm/helpers/ThemeManager.js.map +1 -1
- package/dist/esm/helpers/createPropMapper.js +7 -6
- package/dist/esm/helpers/createPropMapper.js.map +1 -1
- package/dist/esm/helpers/extendStaticConfig.js +3 -2
- package/dist/esm/helpers/extendStaticConfig.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +178 -229
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +1 -1
- package/dist/esm/helpers/getStylesAtomic.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/esm/hooks/useMedia.js +3 -2
- package/dist/esm/hooks/useMedia.js.map +1 -1
- package/dist/esm/styled.js +10 -6
- package/dist/esm/styled.js.map +1 -1
- package/package.json +9 -9
- package/src/constants/accessibilityDirectMap.native.tsx +3 -0
- package/src/createComponent.tsx +37 -25
- package/src/createTamagui.ts +16 -9
- package/src/helpers/ThemeManager.tsx +2 -2
- package/src/helpers/createPropMapper.ts +7 -12
- package/src/helpers/extendStaticConfig.ts +6 -2
- package/src/helpers/getSplitStyles.tsx +268 -281
- package/src/helpers/getStylesAtomic.ts +1 -1
- package/src/helpers/getThemeCSSRules.ts +4 -1
- package/src/hooks/useMedia.tsx +6 -3
- package/src/styled.tsx +8 -4
- package/src/types.tsx +7 -2
- package/types/constants/accessibilityDirectMap.native.d.ts +1 -0
- package/types/helpers/getSplitStyles.d.ts +1 -1
- package/types/types.d.ts +5 -3
- package/types/Tamagui.d.ts.map +0 -1
- package/types/config.d.ts.map +0 -1
- package/types/constants/accessibilityDirectMap.d.ts.map +0 -1
- package/types/constants/accessibilityDirectMap.native.d.ts.map +0 -1
- package/types/constants/constants.d.ts.map +0 -1
- package/types/constants/isDevTools.d.ts.map +0 -1
- package/types/contexts/AnimationDriverContext.d.ts.map +0 -1
- package/types/contexts/ButtonNestingContext.d.ts.map +0 -1
- package/types/contexts/FontLanguageContext.d.ts.map +0 -1
- package/types/contexts/TextAncestorContext.d.ts.map +0 -1
- package/types/createComponent.d.ts.map +0 -1
- package/types/createFont.d.ts.map +0 -1
- package/types/createShorthands.d.ts.map +0 -1
- package/types/createTamagui.d.ts.map +0 -1
- package/types/createTheme.d.ts.map +0 -1
- package/types/createTokens.d.ts.map +0 -1
- package/types/createVariable.d.ts.map +0 -1
- package/types/createVariables.d.ts.map +0 -1
- package/types/helpers/ThemeManager.d.ts.map +0 -1
- package/types/helpers/ThemeManagerContext.d.ts.map +0 -1
- package/types/helpers/createChainedWeakCache.d.ts.map +0 -1
- package/types/helpers/createMediaStyle.d.ts.map +0 -1
- package/types/helpers/createPropMapper.d.ts.map +0 -1
- package/types/helpers/createProxy.d.ts.map +0 -1
- package/types/helpers/createStyledContext.d.ts.map +0 -1
- package/types/helpers/defaultOffset.d.ts.map +0 -1
- package/types/helpers/expandStyle.d.ts.map +0 -1
- package/types/helpers/expandStyles.d.ts.map +0 -1
- package/types/helpers/extendStaticConfig.d.ts.map +0 -1
- package/types/helpers/getAnimationDriver.d.ts.map +0 -1
- package/types/helpers/getExpandedShorthands.d.ts.map +0 -1
- package/types/helpers/getFontLanguage.d.ts.map +0 -1
- package/types/helpers/getSplitStyles.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/types/helpers/getThemeCSSRules.d.ts.map +0 -1
- package/types/helpers/getThemeCSSRules.native.d.ts.map +0 -1
- package/types/helpers/getVariantExtras.d.ts.map +0 -1
- package/types/helpers/insertStyleRule.d.ts.map +0 -1
- package/types/helpers/isObj.d.ts.map +0 -1
- package/types/helpers/isTamaguiComponent.d.ts.map +0 -1
- package/types/helpers/isTamaguiElement.d.ts.map +0 -1
- package/types/helpers/matchMedia.d.ts.map +0 -1
- package/types/helpers/matchMedia.native.d.ts.map +0 -1
- package/types/helpers/mergeProps.d.ts.map +0 -1
- package/types/helpers/normalizeColor.d.ts.map +0 -1
- package/types/helpers/normalizeShadow.d.ts.map +0 -1
- package/types/helpers/normalizeShadow.native.d.ts.map +0 -1
- package/types/helpers/normalizeStylePropKeys.d.ts.map +0 -1
- package/types/helpers/normalizeStylePropKeys.native.d.ts.map +0 -1
- package/types/helpers/normalizeValueWithProperty.d.ts.map +0 -1
- package/types/helpers/objectIdentityKey.d.ts.map +0 -1
- package/types/helpers/proxyThemeVariables.d.ts.map +0 -1
- package/types/helpers/pseudoDescriptors.d.ts.map +0 -1
- package/types/helpers/registerCSSVariable.d.ts.map +0 -1
- package/types/helpers/themeable.d.ts.map +0 -1
- package/types/helpers/themes.d.ts.map +0 -1
- package/types/helpers/timer.d.ts.map +0 -1
- package/types/helpers/useShallowSetState.d.ts.map +0 -1
- package/types/helpers/withStaticProperties.d.ts.map +0 -1
- package/types/hooks/getThemeUnwrapped.d.ts.map +0 -1
- package/types/hooks/useAnimationDriver.d.ts.map +0 -1
- package/types/hooks/useId.d.ts.map +0 -1
- package/types/hooks/useIsTouchDevice.d.ts.map +0 -1
- package/types/hooks/useMedia.d.ts.map +0 -1
- package/types/hooks/useProps.d.ts.map +0 -1
- package/types/hooks/useSafeRef.d.ts.map +0 -1
- package/types/hooks/useServerHooks.d.ts.map +0 -1
- package/types/hooks/useStyle.d.ts.map +0 -1
- package/types/hooks/useTheme.d.ts.map +0 -1
- package/types/hooks/useThemeName.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/inject-styles.d.ts.map +0 -1
- package/types/insertFont.d.ts.map +0 -1
- package/types/setupHooks.d.ts.map +0 -1
- package/types/setupReactNative.d.ts.map +0 -1
- package/types/styled.d.ts.map +0 -1
- package/types/types.d.ts.map +0 -1
- package/types/views/AnimationDriverProvider.d.ts.map +0 -1
- package/types/views/FontLanguage.d.ts.map +0 -1
- package/types/views/FontLanguage.native.d.ts.map +0 -1
- package/types/views/FontLanguage.types.d.ts.map +0 -1
- package/types/views/Slot.d.ts.map +0 -1
- package/types/views/Stack.d.ts.map +0 -1
- package/types/views/TamaguiProvider.d.ts.map +0 -1
- package/types/views/Text.d.ts.map +0 -1
- package/types/views/Theme.d.ts.map +0 -1
- package/types/views/ThemeDebug.d.ts.map +0 -1
- package/types/views/ThemeDebug.native.d.ts.map +0 -1
- package/types/views/ThemeProvider.d.ts.map +0 -1
- package/types/views/View.d.ts.map +0 -1
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useIsomorphicLayoutEffect
|
|
8
8
|
} from "@tamagui/constants";
|
|
9
9
|
import {
|
|
10
|
-
stylePropsFont,
|
|
11
10
|
stylePropsText,
|
|
12
11
|
stylePropsTransform,
|
|
13
12
|
validPseudoKeys,
|
|
@@ -49,24 +48,24 @@ import {
|
|
|
49
48
|
import { pseudoDescriptors } from "./pseudoDescriptors";
|
|
50
49
|
let conf;
|
|
51
50
|
const PROP_SPLIT = "-";
|
|
51
|
+
let defaultFontVariable = "";
|
|
52
52
|
const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, languageContext, elementType, debug) => {
|
|
53
|
-
var _a, _b, _c;
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
54
54
|
conf = conf || getConfig();
|
|
55
55
|
const { shorthands } = conf;
|
|
56
56
|
const { variants, propMapper, isReactNative, inlineProps, inlineWhenUnflattened } = staticConfig;
|
|
57
57
|
const validStyleProps = staticConfig.isText ? stylePropsText : validStyles;
|
|
58
58
|
const viewProps = {};
|
|
59
59
|
let pseudos = null;
|
|
60
|
-
let psuedosUsed = null;
|
|
61
60
|
const mediaState = state.mediaState || globalMediaState;
|
|
62
61
|
const usedKeys = {};
|
|
63
62
|
const propKeys = Object.keys(props);
|
|
63
|
+
const numProps = propKeys.length;
|
|
64
64
|
let space = props.space;
|
|
65
65
|
let hasMedia = false;
|
|
66
66
|
const shouldDoClasses = staticConfig.acceptsClassName && (isWeb || IS_STATIC) && !state.noClassNames;
|
|
67
67
|
let style = {};
|
|
68
68
|
const flatTransforms = {};
|
|
69
|
-
const len = propKeys.length;
|
|
70
69
|
const rulesToInsert = [];
|
|
71
70
|
const classNames = {};
|
|
72
71
|
let className = "";
|
|
@@ -84,12 +83,12 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
84
83
|
viewProps,
|
|
85
84
|
languageContext
|
|
86
85
|
};
|
|
87
|
-
if (process.env.NODE_ENV === "development" && debug) {
|
|
88
|
-
console.groupCollapsed("getSplitStyles (
|
|
86
|
+
if (process.env.NODE_ENV === "development" && debug && isClient) {
|
|
87
|
+
console.groupCollapsed("getSplitStyles (collapsed)");
|
|
89
88
|
console.log({ props, staticConfig, shouldDoClasses, state, IS_STATIC, propKeys, styleState, theme: { ...theme } });
|
|
90
89
|
console.groupEnd();
|
|
91
90
|
}
|
|
92
|
-
if (props.className) {
|
|
91
|
+
if (typeof props.className === "string") {
|
|
93
92
|
for (const cn of props.className.split(" ")) {
|
|
94
93
|
if (cn[0] === "_") {
|
|
95
94
|
const [shorthand, mediaOrPseudo] = cn.slice(1).split("-");
|
|
@@ -112,46 +111,56 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
viewProps[key] = {
|
|
119
|
-
...val,
|
|
120
|
-
...viewProps[key]
|
|
121
|
-
};
|
|
122
|
-
} else {
|
|
123
|
-
usedKeys[key] = 1;
|
|
124
|
-
viewProps[key] = val;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const specialProps = [];
|
|
128
|
-
function processProp(keyInit, valInit, special = false, fontFamilyOverride = null) {
|
|
129
|
-
var _a2, _b2, _c2, _d;
|
|
130
|
-
if (keyInit === "className")
|
|
131
|
-
return;
|
|
114
|
+
for (let i = 0; i < numProps; i++) {
|
|
115
|
+
let keyInit = propKeys[i];
|
|
116
|
+
let valInit = props[keyInit];
|
|
132
117
|
if (keyInit in shorthands) {
|
|
133
118
|
keyInit = shorthands[keyInit];
|
|
134
119
|
}
|
|
135
|
-
if (keyInit === "
|
|
136
|
-
|
|
120
|
+
if (keyInit === "className")
|
|
121
|
+
continue;
|
|
122
|
+
if (keyInit in usedKeys)
|
|
123
|
+
continue;
|
|
124
|
+
if (process.env.TAMAGUI_TARGET === "web") {
|
|
125
|
+
if (typeof valInit === "string" && valInit[0] === "_") {
|
|
126
|
+
if (keyInit in validStyleProps || keyInit.includes("-")) {
|
|
127
|
+
if (process.env.NODE_ENV === "development" && debug) {
|
|
128
|
+
console.log(`Adding compiled style ${keyInit}: ${valInit}`);
|
|
129
|
+
}
|
|
130
|
+
if (shouldDoClasses) {
|
|
131
|
+
classNames[keyInit] = valInit;
|
|
132
|
+
delete style[keyInit];
|
|
133
|
+
} else {
|
|
134
|
+
style[keyInit] = reverseMapClassNameToValue(keyInit, valInit);
|
|
135
|
+
delete className[keyInit];
|
|
136
|
+
}
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
137
140
|
}
|
|
138
141
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
139
142
|
if (!isAndroid) {
|
|
140
143
|
if (keyInit === "elevationAndroid")
|
|
141
|
-
|
|
144
|
+
continue;
|
|
142
145
|
}
|
|
143
146
|
if (keyInit === "userSelect") {
|
|
144
147
|
keyInit = "selectable";
|
|
145
148
|
valInit = valInit === "none" ? false : true;
|
|
146
|
-
} else if (keyInit
|
|
149
|
+
} else if (keyInit === "role") {
|
|
150
|
+
if (valInit === "list") {
|
|
151
|
+
viewProps[keyInit] = valInit;
|
|
152
|
+
} else if (accessibilityWebRoleToNativeRole[valInit]) {
|
|
153
|
+
viewProps["accessibilityRole"] = accessibilityWebRoleToNativeRole[valInit];
|
|
154
|
+
}
|
|
155
|
+
continue;
|
|
156
|
+
} else if (keyInit.startsWith("aria-")) {
|
|
147
157
|
if (webToNativeAccessibilityDirectMap[keyInit]) {
|
|
148
158
|
const nativeA11yProp = webToNativeAccessibilityDirectMap[keyInit];
|
|
149
159
|
if (keyInit === "aria-hidden") {
|
|
150
160
|
viewProps["aria-hidden"] = valInit;
|
|
151
161
|
}
|
|
152
162
|
viewProps[nativeA11yProp] = valInit;
|
|
153
|
-
|
|
154
|
-
return;
|
|
163
|
+
continue;
|
|
155
164
|
} else if (nativeAccessibilityValue[keyInit]) {
|
|
156
165
|
let field = nativeAccessibilityValue[keyInit];
|
|
157
166
|
if (viewProps["accessibilityValue"]) {
|
|
@@ -161,7 +170,6 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
161
170
|
[field]: valInit
|
|
162
171
|
};
|
|
163
172
|
}
|
|
164
|
-
usedKeys[keyInit] = 1;
|
|
165
173
|
} else if (nativeAccessibilityState[keyInit]) {
|
|
166
174
|
let field = nativeAccessibilityState[keyInit];
|
|
167
175
|
if (viewProps["accessibilityState"]) {
|
|
@@ -171,56 +179,30 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
171
179
|
[field]: valInit
|
|
172
180
|
};
|
|
173
181
|
}
|
|
174
|
-
usedKeys[keyInit] = 1;
|
|
175
|
-
} else if (keyInit === "role") {
|
|
176
|
-
if (valInit === "list") {
|
|
177
|
-
viewProps[keyInit] = valInit;
|
|
178
|
-
} else if (accessibilityWebRoleToNativeRole[valInit]) {
|
|
179
|
-
viewProps["accessibilityRole"] = accessibilityWebRoleToNativeRole[valInit];
|
|
180
|
-
}
|
|
181
|
-
return;
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
continue;
|
|
184
184
|
} else if (keyInit.startsWith("data-")) {
|
|
185
|
-
|
|
185
|
+
continue;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
if (process.env.TAMAGUI_TARGET === "web") {
|
|
189
|
-
if (keyInit === "elevationAndroid")
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
188
|
if (!staticConfig.isHOC) {
|
|
193
189
|
if (keyInit in skipProps) {
|
|
194
190
|
if (process.env.NODE_ENV === "development" && debug && keyInit === "debug") {
|
|
195
191
|
} else {
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (keyInit in usedKeys) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (typeof valInit === "string" && valInit[0] === "_") {
|
|
204
|
-
if (keyInit in validStyleProps || keyInit.includes("-")) {
|
|
205
|
-
if (shouldDoClasses) {
|
|
206
|
-
classNames[keyInit] = valInit;
|
|
207
|
-
} else {
|
|
208
|
-
style[keyInit] = reverseMapClassNameToValue(keyInit, valInit);
|
|
192
|
+
continue;
|
|
209
193
|
}
|
|
210
|
-
usedKeys[keyInit] = 1;
|
|
211
|
-
return;
|
|
212
194
|
}
|
|
213
195
|
}
|
|
214
196
|
if (keyInit === "dataSet") {
|
|
215
|
-
for (const
|
|
216
|
-
viewProps[`data-${hyphenate(
|
|
197
|
+
for (const keyInit2 in valInit) {
|
|
198
|
+
viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
|
|
217
199
|
}
|
|
218
|
-
|
|
200
|
+
continue;
|
|
219
201
|
}
|
|
220
202
|
const isMainStyle = keyInit === "style";
|
|
221
203
|
if (isMainStyle || keyInit.startsWith("_style")) {
|
|
222
204
|
if (!valInit)
|
|
223
|
-
|
|
205
|
+
continue;
|
|
224
206
|
const styles = [].concat(valInit).flat();
|
|
225
207
|
const styleLen = styles.length;
|
|
226
208
|
for (let j = styleLen; j >= 0; j--) {
|
|
@@ -235,44 +217,41 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
235
217
|
style[key] = cur[key];
|
|
236
218
|
}
|
|
237
219
|
}
|
|
238
|
-
|
|
220
|
+
continue;
|
|
239
221
|
}
|
|
240
222
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
241
223
|
if (keyInit === "disabled" && valInit === true) {
|
|
242
|
-
usedKeys[keyInit] = 1;
|
|
243
224
|
viewProps["aria-disabled"] = true;
|
|
244
225
|
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
245
226
|
viewProps.disabled = true;
|
|
246
227
|
}
|
|
247
228
|
if (!(variants == null ? void 0 : variants.disabled)) {
|
|
248
|
-
|
|
229
|
+
continue;
|
|
249
230
|
}
|
|
250
231
|
}
|
|
251
232
|
if (keyInit === "testID") {
|
|
252
|
-
usedKeys[keyInit] = 1;
|
|
253
233
|
viewProps[isReactNative ? "testId" : "data-testid"] = valInit;
|
|
254
|
-
|
|
234
|
+
continue;
|
|
255
235
|
}
|
|
256
236
|
if (keyInit === "id" || keyInit === "nativeID") {
|
|
257
|
-
usedKeys[keyInit] = 1;
|
|
258
237
|
if (isReactNative) {
|
|
259
238
|
viewProps.nativeID = valInit;
|
|
260
239
|
} else {
|
|
261
240
|
viewProps.id = valInit;
|
|
262
241
|
}
|
|
263
|
-
|
|
242
|
+
continue;
|
|
264
243
|
}
|
|
265
244
|
let didUseKeyInit = false;
|
|
266
245
|
if (isReactNative) {
|
|
267
|
-
if (
|
|
246
|
+
if (keyInit in accessibilityDirectMap || keyInit.startsWith("accessibility")) {
|
|
268
247
|
viewProps[keyInit] = valInit;
|
|
269
|
-
|
|
270
|
-
return;
|
|
248
|
+
continue;
|
|
271
249
|
}
|
|
272
250
|
} else {
|
|
273
251
|
didUseKeyInit = true;
|
|
274
252
|
if (keyInit in accessibilityDirectMap) {
|
|
275
253
|
viewProps[accessibilityDirectMap[keyInit]] = valInit;
|
|
254
|
+
continue;
|
|
276
255
|
} else {
|
|
277
256
|
switch (keyInit) {
|
|
278
257
|
case "accessibilityRole": {
|
|
@@ -281,38 +260,38 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
281
260
|
} else {
|
|
282
261
|
viewProps.role = accessibilityRoleToWebRole[valInit] || valInit;
|
|
283
262
|
}
|
|
284
|
-
|
|
263
|
+
continue;
|
|
285
264
|
}
|
|
286
265
|
case "accessibilityLabelledBy":
|
|
287
266
|
case "accessibilityFlowTo":
|
|
288
267
|
case "accessibilityControls":
|
|
289
268
|
case "accessibilityDescribedBy": {
|
|
290
269
|
viewProps[`aria-${keyInit.replace("accessibility", "").toLowerCase()}`] = processIDRefList(valInit);
|
|
291
|
-
|
|
270
|
+
continue;
|
|
292
271
|
}
|
|
293
272
|
case "accessibilityKeyShortcuts": {
|
|
294
273
|
if (Array.isArray(valInit)) {
|
|
295
274
|
viewProps["aria-keyshortcuts"] = valInit.join(" ");
|
|
296
275
|
}
|
|
297
|
-
|
|
276
|
+
continue;
|
|
298
277
|
}
|
|
299
278
|
case "accessibilityLiveRegion": {
|
|
300
279
|
viewProps["aria-live"] = valInit === "none" ? "off" : valInit;
|
|
301
|
-
|
|
280
|
+
continue;
|
|
302
281
|
}
|
|
303
282
|
case "accessibilityReadOnly": {
|
|
304
283
|
viewProps["aria-readonly"] = valInit;
|
|
305
284
|
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
306
285
|
viewProps.readOnly = true;
|
|
307
286
|
}
|
|
308
|
-
|
|
287
|
+
continue;
|
|
309
288
|
}
|
|
310
289
|
case "accessibilityRequired": {
|
|
311
290
|
viewProps["aria-required"] = valInit;
|
|
312
291
|
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
313
292
|
viewProps.required = valInit;
|
|
314
293
|
}
|
|
315
|
-
|
|
294
|
+
continue;
|
|
316
295
|
}
|
|
317
296
|
default: {
|
|
318
297
|
didUseKeyInit = false;
|
|
@@ -321,71 +300,57 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
321
300
|
}
|
|
322
301
|
}
|
|
323
302
|
if (didUseKeyInit) {
|
|
324
|
-
|
|
325
|
-
return;
|
|
303
|
+
continue;
|
|
326
304
|
}
|
|
327
305
|
if (valInit && valInit[0] === "_") {
|
|
328
306
|
const isValidClassName = keyInit in validStyles;
|
|
329
307
|
const isMediaOrPseudo2 = !isValidClassName && keyInit.includes(PROP_SPLIT) && validStyles[keyInit.split(PROP_SPLIT)[0]];
|
|
330
308
|
if (isValidClassName || isMediaOrPseudo2) {
|
|
331
|
-
usedKeys[keyInit] = 1;
|
|
332
309
|
if (process.env.NODE_ENV === "development" && debug) {
|
|
333
310
|
console.log("tamagui classname props", keyInit, valInit);
|
|
334
311
|
}
|
|
335
312
|
mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo2);
|
|
336
|
-
|
|
313
|
+
continue;
|
|
337
314
|
}
|
|
338
315
|
}
|
|
339
316
|
}
|
|
340
317
|
let isMedia = isMediaKey(keyInit);
|
|
341
318
|
let isPseudo = keyInit in validPseudoKeys;
|
|
342
319
|
let isMediaOrPseudo = isMedia || isPseudo;
|
|
343
|
-
|
|
320
|
+
let isVariant = variants && keyInit in variants;
|
|
344
321
|
const isStyleProp = isMediaOrPseudo || isVariant || keyInit in validStyleProps || keyInit in shorthands;
|
|
345
322
|
if (isStyleProp && props.asChild === "except-style") {
|
|
346
|
-
|
|
323
|
+
continue;
|
|
347
324
|
}
|
|
348
325
|
const shouldPassProp = !isStyleProp;
|
|
349
|
-
const isHOCShouldPassThrough =
|
|
326
|
+
const isHOCShouldPassThrough = Boolean(
|
|
327
|
+
staticConfig.isHOC && (isMediaOrPseudo || ((_b = (_a = staticConfig.parentStaticConfig) == null ? void 0 : _a.variants) == null ? void 0 : _b[keyInit]) || keyInit in skipProps)
|
|
328
|
+
);
|
|
350
329
|
const shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
|
|
330
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
331
|
+
console.groupCollapsed(
|
|
332
|
+
` \u{1F539} prop ${keyInit} ${shouldPassThrough ? "pass through" : ""}`
|
|
333
|
+
);
|
|
334
|
+
console.log({ valInit, variants, variant: variants == null ? void 0 : variants[keyInit], isVariant, shouldPassProp, isHOCShouldPassThrough });
|
|
335
|
+
console.groupEnd();
|
|
336
|
+
}
|
|
351
337
|
if (shouldPassThrough) {
|
|
352
|
-
|
|
353
|
-
console.groupCollapsed(` \u{1F539} pass through ${keyInit}`);
|
|
354
|
-
console.log({
|
|
355
|
-
valInit,
|
|
356
|
-
variants,
|
|
357
|
-
variant: variants == null ? void 0 : variants[keyInit],
|
|
358
|
-
isVariant,
|
|
359
|
-
shouldPassProp,
|
|
360
|
-
isHOCShouldPassThrough
|
|
361
|
-
});
|
|
362
|
-
console.groupEnd();
|
|
363
|
-
}
|
|
364
|
-
if (isPseudo) {
|
|
365
|
-
const pseudoStyleObject = getSubStyle(
|
|
366
|
-
styleState,
|
|
367
|
-
keyInit,
|
|
368
|
-
valInit,
|
|
369
|
-
true,
|
|
370
|
-
state.noClassNames
|
|
371
|
-
);
|
|
372
|
-
const descriptor = pseudoDescriptors[keyInit];
|
|
373
|
-
for (const key in pseudoStyleObject) {
|
|
374
|
-
const fullKey = `${key}${PROP_SPLIT}${descriptor.name}`;
|
|
375
|
-
usedKeys[fullKey] = 1;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
passDownProp(keyInit, valInit, isMediaOrPseudo);
|
|
338
|
+
passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo);
|
|
379
339
|
if (!isVariant) {
|
|
380
|
-
|
|
340
|
+
continue;
|
|
381
341
|
}
|
|
382
342
|
}
|
|
343
|
+
if (keyInit in skipProps)
|
|
344
|
+
continue;
|
|
345
|
+
defaultFontVariable ||= `$${conf.defaultFont}`;
|
|
346
|
+
fontFamily ||= props[conf.inverseShorthands.fontFamily] || props.fontFamily || defaultFontVariable;
|
|
383
347
|
const expanded = isMediaOrPseudo ? [[keyInit, valInit]] : propMapper(
|
|
384
348
|
keyInit,
|
|
385
349
|
valInit,
|
|
386
350
|
theme,
|
|
387
|
-
|
|
351
|
+
props,
|
|
388
352
|
state,
|
|
353
|
+
fontFamily,
|
|
389
354
|
languageContext,
|
|
390
355
|
void 0,
|
|
391
356
|
debug
|
|
@@ -394,17 +359,9 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
394
359
|
fontFamily = getPropMappedFontFamily(expanded);
|
|
395
360
|
}
|
|
396
361
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
397
|
-
console.groupCollapsed(" \u{1F539}
|
|
398
|
-
console.log({
|
|
399
|
-
expanded,
|
|
400
|
-
state,
|
|
401
|
-
isVariant,
|
|
402
|
-
variant: variants == null ? void 0 : variants[keyInit],
|
|
403
|
-
shouldPassProp,
|
|
404
|
-
isHOCShouldPassThrough,
|
|
405
|
-
theme
|
|
406
|
-
});
|
|
362
|
+
console.groupCollapsed(" \u{1F539} expanded", keyInit, valInit);
|
|
407
363
|
if (!isServer && isDevTools) {
|
|
364
|
+
console.log({ expanded, state: { ...state }, isVariant, variant: variants == null ? void 0 : variants[keyInit], shouldPassProp, isHOCShouldPassThrough, theme, usedKeys: { ...usedKeys } });
|
|
408
365
|
console.log("expanded", expanded, "\nusedKeys", { ...usedKeys }, "\ncurrent", {
|
|
409
366
|
...style
|
|
410
367
|
});
|
|
@@ -412,30 +369,27 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
412
369
|
console.groupEnd();
|
|
413
370
|
}
|
|
414
371
|
if (!expanded)
|
|
415
|
-
|
|
372
|
+
continue;
|
|
416
373
|
for (const [key, val] of expanded) {
|
|
417
|
-
if (val
|
|
374
|
+
if (val == null)
|
|
418
375
|
continue;
|
|
419
|
-
if (key in
|
|
420
|
-
specialProps.push([key, val]);
|
|
376
|
+
if (key in usedKeys)
|
|
421
377
|
continue;
|
|
422
|
-
}
|
|
423
378
|
isMedia = isMediaKey(key);
|
|
424
379
|
isPseudo = key in validPseudoKeys;
|
|
425
380
|
isMediaOrPseudo = isMedia || isPseudo;
|
|
426
|
-
if (!isMediaOrPseudo && key in usedKeys) {
|
|
427
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
428
|
-
console.log(`Used media/pseudo ${key}`);
|
|
429
|
-
}
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
381
|
if ((inlineProps == null ? void 0 : inlineProps.has(key)) || (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key))) {
|
|
433
|
-
usedKeys[key] = 1;
|
|
434
382
|
viewProps[key] = props[key] ?? val;
|
|
435
383
|
}
|
|
436
|
-
const isHOCShouldPassThrough2 = staticConfig.isHOC && (isMediaOrPseudo || ((_d = (
|
|
384
|
+
const isHOCShouldPassThrough2 = staticConfig.isHOC && (isMediaOrPseudo || ((_d = (_c = staticConfig.parentStaticConfig) == null ? void 0 : _c.variants) == null ? void 0 : _d[keyInit]));
|
|
437
385
|
if (isHOCShouldPassThrough2) {
|
|
438
|
-
|
|
386
|
+
isVariant = variants && key in variants;
|
|
387
|
+
passDownProp(viewProps, key, val, isMediaOrPseudo);
|
|
388
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
389
|
+
console.groupCollapsed(` - passing down prop ${key}`);
|
|
390
|
+
console.log({ val, after: { ...viewProps[key] } });
|
|
391
|
+
console.groupEnd();
|
|
392
|
+
}
|
|
439
393
|
if (!isVariant) {
|
|
440
394
|
continue;
|
|
441
395
|
}
|
|
@@ -447,6 +401,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
447
401
|
styleState,
|
|
448
402
|
key,
|
|
449
403
|
val,
|
|
404
|
+
fontFamily,
|
|
450
405
|
true,
|
|
451
406
|
state.noClassNames
|
|
452
407
|
);
|
|
@@ -454,68 +409,72 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
454
409
|
const isEnter = descriptor.name === "enter";
|
|
455
410
|
const isExit = descriptor.name === "exit";
|
|
456
411
|
if (!descriptor || isExit && !state.isExiting) {
|
|
412
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
413
|
+
console.log("skip exit");
|
|
414
|
+
}
|
|
457
415
|
continue;
|
|
458
416
|
}
|
|
459
417
|
if (!shouldDoClasses || IS_STATIC) {
|
|
460
418
|
pseudos ||= {};
|
|
461
419
|
pseudos[key] ||= {};
|
|
462
|
-
Object.assign(pseudos[key], pseudoStyleObject);
|
|
463
420
|
}
|
|
464
421
|
if (shouldDoClasses && !isEnter && !isExit) {
|
|
465
422
|
const pseudoStyles = generateAtomicStyles(pseudoStyleObject, descriptor);
|
|
423
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
424
|
+
console.groupCollapsed("pseudo (classes)", key);
|
|
425
|
+
console.log({ pseudoStyleObject, pseudoStyles });
|
|
426
|
+
console.groupEnd();
|
|
427
|
+
}
|
|
466
428
|
for (const psuedoStyle of pseudoStyles) {
|
|
467
429
|
const fullKey = `${psuedoStyle.property}${PROP_SPLIT}${descriptor.name}`;
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
isMediaOrPseudo
|
|
477
|
-
);
|
|
478
|
-
}
|
|
430
|
+
addStyleToInsertRules(rulesToInsert, psuedoStyle);
|
|
431
|
+
mergeClassName(
|
|
432
|
+
transforms,
|
|
433
|
+
classNames,
|
|
434
|
+
fullKey,
|
|
435
|
+
psuedoStyle.identifier,
|
|
436
|
+
isMediaOrPseudo
|
|
437
|
+
);
|
|
479
438
|
}
|
|
480
439
|
} else {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
let isDisabled = !state[descriptor.stateKey || descriptor.name];
|
|
440
|
+
const descriptorKey = descriptor.stateKey || descriptor.name;
|
|
441
|
+
const pseudoState = state[descriptorKey];
|
|
442
|
+
let isDisabled = !pseudoState;
|
|
485
443
|
if (isWeb && !isClient && isEnter) {
|
|
486
444
|
isDisabled = false;
|
|
487
445
|
}
|
|
446
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
447
|
+
console.groupCollapsed("pseudo", key, !isDisabled);
|
|
448
|
+
console.log(pseudoStyleObject, { isDisabled, descriptorKey, descriptor, pseudoState, state: { ...state } });
|
|
449
|
+
console.groupEnd();
|
|
450
|
+
}
|
|
451
|
+
const importance = descriptor.priority;
|
|
488
452
|
if (!isDisabled) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
usedKeys[
|
|
492
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
493
|
-
console.log(`Setting used ${key}`);
|
|
494
|
-
}
|
|
453
|
+
for (const key2 in val) {
|
|
454
|
+
const k = shorthands[key2] || key2;
|
|
455
|
+
usedKeys[k] = Math.max(importance, usedKeys[k] || 0);
|
|
495
456
|
}
|
|
496
457
|
}
|
|
497
|
-
psuedosUsed ||= {};
|
|
498
|
-
const importance = descriptor.priority;
|
|
499
458
|
for (const pkey in pseudoStyleObject) {
|
|
500
459
|
const val2 = pseudoStyleObject[pkey];
|
|
501
460
|
if (isDisabled) {
|
|
502
|
-
if (
|
|
461
|
+
if (pkey in animatableDefaults && !(pkey in usedKeys)) {
|
|
503
462
|
const defaultVal = animatableDefaults[pkey];
|
|
504
|
-
mergeStyle(styleState, flatTransforms, pkey, defaultVal
|
|
463
|
+
mergeStyle(styleState, flatTransforms, pkey, defaultVal);
|
|
464
|
+
}
|
|
465
|
+
} else {
|
|
466
|
+
const curImportance = usedKeys[importance] || 0;
|
|
467
|
+
const shouldMerge = importance >= curImportance;
|
|
468
|
+
if (shouldMerge) {
|
|
469
|
+
pseudos ||= {};
|
|
470
|
+
pseudos[key] ||= {};
|
|
471
|
+
pseudos[key][pkey] = val2;
|
|
472
|
+
mergeStyle(styleState, flatTransforms, pkey, val2);
|
|
473
|
+
usedKeys[pkey] ||= 1;
|
|
474
|
+
}
|
|
475
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
476
|
+
console.log(" subKey", pkey, shouldMerge, { importance, curImportance, pkey, val: val2 });
|
|
505
477
|
}
|
|
506
|
-
continue;
|
|
507
|
-
}
|
|
508
|
-
const curImportance = psuedosUsed[importance] || 0;
|
|
509
|
-
const shouldMerge = importance >= curImportance;
|
|
510
|
-
if (shouldMerge) {
|
|
511
|
-
psuedosUsed[pkey] = importance;
|
|
512
|
-
pseudos ||= {};
|
|
513
|
-
pseudos[key] ||= {};
|
|
514
|
-
pseudos[key][pkey] = val2;
|
|
515
|
-
mergeStyle(styleState, flatTransforms, pkey, val2);
|
|
516
|
-
}
|
|
517
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
518
|
-
console.log(" merge pseudo?", keyInit, shouldMerge, { importance, curImportance, pkey, val: val2 });
|
|
519
478
|
}
|
|
520
479
|
}
|
|
521
480
|
}
|
|
@@ -529,6 +488,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
529
488
|
styleState,
|
|
530
489
|
key,
|
|
531
490
|
val,
|
|
491
|
+
fontFamily,
|
|
532
492
|
// TODO try true like pseudo
|
|
533
493
|
false
|
|
534
494
|
);
|
|
@@ -567,11 +527,8 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
567
527
|
for (const style2 of mediaStyles) {
|
|
568
528
|
const out = createMediaStyle(style2, mediaKeyShort, mediaQueryConfig);
|
|
569
529
|
const fullKey = `${style2.property}${PROP_SPLIT}${mediaKeyShort}`;
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
addStyleToInsertRules(rulesToInsert, out);
|
|
573
|
-
mergeClassName(transforms, classNames, fullKey, out.identifier, true);
|
|
574
|
-
}
|
|
530
|
+
addStyleToInsertRules(rulesToInsert, out);
|
|
531
|
+
mergeClassName(transforms, classNames, fullKey, out.identifier, true);
|
|
575
532
|
}
|
|
576
533
|
} else if (mediaState[mediaKeyShort]) {
|
|
577
534
|
for (const subKey in mediaStyle) {
|
|
@@ -602,7 +559,6 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
602
559
|
}
|
|
603
560
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
604
561
|
if (key === "pointerEvents") {
|
|
605
|
-
usedKeys[key] = 1;
|
|
606
562
|
viewProps[key] = val;
|
|
607
563
|
continue;
|
|
608
564
|
}
|
|
@@ -613,38 +569,25 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
613
569
|
fontFamily = fam;
|
|
614
570
|
}
|
|
615
571
|
}
|
|
616
|
-
if (key in validStyleProps) {
|
|
617
|
-
mergeStyle(styleState, flatTransforms, key, val);
|
|
618
|
-
continue;
|
|
619
|
-
} else if (process.env.TAMAGUI_TARGET === "native" && isAndroid && key === "elevation") {
|
|
572
|
+
if (key in validStyleProps || process.env.TAMAGUI_TARGET === "native" && isAndroid && key === "elevation") {
|
|
620
573
|
mergeStyle(styleState, flatTransforms, key, val);
|
|
621
574
|
continue;
|
|
622
575
|
}
|
|
623
|
-
if (!isVariant
|
|
576
|
+
if (!isVariant) {
|
|
624
577
|
viewProps[key] = val;
|
|
625
|
-
usedKeys[key] = 1;
|
|
626
578
|
}
|
|
627
579
|
}
|
|
628
580
|
}
|
|
629
|
-
for (let i = len - 1; i >= 0; i--) {
|
|
630
|
-
const keyInit = propKeys[i];
|
|
631
|
-
const valInit = props[keyInit];
|
|
632
|
-
processProp(keyInit, valInit);
|
|
633
|
-
}
|
|
634
581
|
fontFamily ||= conf.defaultFont;
|
|
635
|
-
for (let i = 0; i < specialProps.length; i++) {
|
|
636
|
-
const [key, value] = specialProps[i];
|
|
637
|
-
processProp(key, value, true, fontFamily);
|
|
638
|
-
}
|
|
639
582
|
fixStyles(style);
|
|
640
583
|
if (isWeb) {
|
|
641
584
|
styleToCSS(style);
|
|
642
585
|
}
|
|
643
586
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
644
587
|
if ("fontFamily" in style && style.fontFamily) {
|
|
645
|
-
const faceInfo = (
|
|
588
|
+
const faceInfo = (_e = getFont(style.fontFamily)) == null ? void 0 : _e.face;
|
|
646
589
|
if (faceInfo) {
|
|
647
|
-
const overrideFace = (
|
|
590
|
+
const overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
|
|
648
591
|
if (overrideFace) {
|
|
649
592
|
style.fontFamily = overrideFace;
|
|
650
593
|
fontFamily = overrideFace;
|
|
@@ -664,7 +607,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
664
607
|
}
|
|
665
608
|
}
|
|
666
609
|
if (flatTransforms) {
|
|
667
|
-
|
|
610
|
+
mergeFlatTransforms(style, flatTransforms, true);
|
|
668
611
|
}
|
|
669
612
|
if (parentSplitStyles) {
|
|
670
613
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
@@ -693,7 +636,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
693
636
|
const atomic = getStylesAtomic(style);
|
|
694
637
|
for (const atomicStyle of atomic) {
|
|
695
638
|
const key = atomicStyle.property;
|
|
696
|
-
if (props.animateOnly && props.animateOnly.includes(key)) {
|
|
639
|
+
if (state.isAnimated && props.animateOnly && props.animateOnly.includes(key)) {
|
|
697
640
|
retainedStyles[key] = style[key];
|
|
698
641
|
} else {
|
|
699
642
|
addStyleToInsertRules(rulesToInsert, atomicStyle);
|
|
@@ -757,18 +700,11 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
757
700
|
}
|
|
758
701
|
}
|
|
759
702
|
}
|
|
760
|
-
const nextViewProps = {};
|
|
761
|
-
const ks = Object.keys(viewProps);
|
|
762
|
-
const l = ks.length;
|
|
763
|
-
for (let i = l - 1; i >= 0; i--) {
|
|
764
|
-
const key = ks[i];
|
|
765
|
-
nextViewProps[key] = viewProps[key];
|
|
766
|
-
}
|
|
767
703
|
const result = {
|
|
768
704
|
space,
|
|
769
705
|
hasMedia,
|
|
770
706
|
fontFamily,
|
|
771
|
-
viewProps
|
|
707
|
+
viewProps,
|
|
772
708
|
// @ts-expect-error
|
|
773
709
|
style,
|
|
774
710
|
pseudos,
|
|
@@ -780,8 +716,8 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
780
716
|
}
|
|
781
717
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
782
718
|
if (isDevTools) {
|
|
783
|
-
console.groupCollapsed(" \u{1F539}
|
|
784
|
-
const logs = { ...result, state,
|
|
719
|
+
console.groupCollapsed(" \u{1F539} ===>");
|
|
720
|
+
const logs = { ...result, state, transforms, viewProps, viewPropsOrder: Object.keys(viewProps), rulesToInsert, parentSplitStyles, flatTransforms };
|
|
785
721
|
for (const key in logs) {
|
|
786
722
|
console.log(key, logs[key]);
|
|
787
723
|
}
|
|
@@ -821,12 +757,10 @@ function getSubStyleProps(defaultProps, baseProps, specificProps) {
|
|
|
821
757
|
...specificProps
|
|
822
758
|
};
|
|
823
759
|
}
|
|
824
|
-
function mergeStyle({
|
|
825
|
-
if (
|
|
826
|
-
usedKeys[key] ||= 1;
|
|
827
|
-
}
|
|
828
|
-
if (val && val[0] === "_") {
|
|
760
|
+
function mergeStyle({ classNames, viewProps, style, usedKeys }, flatTransforms, key, val) {
|
|
761
|
+
if ((val == null ? void 0 : val[0]) === "_") {
|
|
829
762
|
classNames[key] = val;
|
|
763
|
+
usedKeys[key] ||= 1;
|
|
830
764
|
} else if (key in stylePropsTransform) {
|
|
831
765
|
flatTransforms ||= {};
|
|
832
766
|
flatTransforms[key] = val;
|
|
@@ -839,7 +773,7 @@ function mergeStyle({ usedKeys, classNames, viewProps, style }, flatTransforms,
|
|
|
839
773
|
}
|
|
840
774
|
}
|
|
841
775
|
}
|
|
842
|
-
const getSubStyle = (styleState, subKey, styleIn, avoidDefaultProps, avoidMergeTransform) => {
|
|
776
|
+
const getSubStyle = (styleState, subKey, styleIn, fontFamily, avoidDefaultProps, avoidMergeTransform) => {
|
|
843
777
|
const { staticConfig, theme, props, state, conf: conf2, languageContext } = styleState;
|
|
844
778
|
const styleOut = {};
|
|
845
779
|
for (let key in styleIn) {
|
|
@@ -851,16 +785,13 @@ const getSubStyle = (styleState, subKey, styleIn, avoidDefaultProps, avoidMergeT
|
|
|
851
785
|
theme,
|
|
852
786
|
getSubStyleProps(staticConfig.defaultProps, props, props[subKey]),
|
|
853
787
|
state,
|
|
788
|
+
fontFamily,
|
|
854
789
|
languageContext,
|
|
855
790
|
avoidDefaultProps
|
|
856
791
|
);
|
|
857
|
-
if (!staticConfig.isHOC) {
|
|
858
|
-
if (key in skipProps) {
|
|
859
|
-
continue;
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
if (!expanded)
|
|
792
|
+
if (!expanded || !staticConfig.isHOC && key in skipProps) {
|
|
863
793
|
continue;
|
|
794
|
+
}
|
|
864
795
|
for (const [skey, sval] of expanded) {
|
|
865
796
|
if (!avoidMergeTransform && skey in stylePropsTransform) {
|
|
866
797
|
mergeTransform(styleOut, skey, sval);
|
|
@@ -900,7 +831,9 @@ const animatableDefaults = {
|
|
|
900
831
|
scale: 1,
|
|
901
832
|
rotate: "0deg",
|
|
902
833
|
rotateY: "0deg",
|
|
903
|
-
rotateX: "0deg"
|
|
834
|
+
rotateX: "0deg",
|
|
835
|
+
x: 0,
|
|
836
|
+
y: 0
|
|
904
837
|
};
|
|
905
838
|
const lowercaseHyphenate = (match) => `-${match.toLowerCase()}`;
|
|
906
839
|
const hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate);
|
|
@@ -910,8 +843,8 @@ const mergeTransform = (obj, key, val, backwards = false) => {
|
|
|
910
843
|
[mapTransformKeys[key] || key]: val
|
|
911
844
|
});
|
|
912
845
|
};
|
|
913
|
-
const
|
|
914
|
-
Object.entries(flatTransforms).forEach(([key, val]) => {
|
|
846
|
+
const mergeFlatTransforms = (obj, flatTransforms, backwards = false) => {
|
|
847
|
+
Object.entries(flatTransforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
|
|
915
848
|
mergeTransform(obj, key, val, backwards);
|
|
916
849
|
});
|
|
917
850
|
};
|
|
@@ -946,6 +879,10 @@ if (process.env.TAMAGUI_TARGET === "native") {
|
|
|
946
879
|
outlineWidth: true,
|
|
947
880
|
outlineColor: true
|
|
948
881
|
});
|
|
882
|
+
} else {
|
|
883
|
+
Object.assign(skipProps, {
|
|
884
|
+
elevationAndroid: true
|
|
885
|
+
});
|
|
949
886
|
}
|
|
950
887
|
const accessibilityRoleToWebRole = {
|
|
951
888
|
adjustable: "slider",
|
|
@@ -955,6 +892,18 @@ const accessibilityRoleToWebRole = {
|
|
|
955
892
|
none: "presentation",
|
|
956
893
|
summary: "region"
|
|
957
894
|
};
|
|
895
|
+
function passDownProp(viewProps, key, val, shouldMergeObject = false) {
|
|
896
|
+
if (shouldMergeObject) {
|
|
897
|
+
const next = {
|
|
898
|
+
...viewProps[key],
|
|
899
|
+
...val
|
|
900
|
+
};
|
|
901
|
+
delete viewProps[key];
|
|
902
|
+
viewProps[key] = next;
|
|
903
|
+
} else {
|
|
904
|
+
viewProps[key] = val;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
958
907
|
export {
|
|
959
908
|
PROP_SPLIT,
|
|
960
909
|
getSplitStyles,
|