@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
|
@@ -40,24 +40,24 @@ var import_normalizeValueWithProperty = require("./normalizeValueWithProperty");
|
|
|
40
40
|
var import_pseudoDescriptors = require("./pseudoDescriptors");
|
|
41
41
|
let conf;
|
|
42
42
|
const PROP_SPLIT = "-";
|
|
43
|
+
let defaultFontVariable = "";
|
|
43
44
|
const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, languageContext, elementType, debug) => {
|
|
44
|
-
var _a, _b, _c;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
45
46
|
conf = conf || (0, import_config.getConfig)();
|
|
46
47
|
const { shorthands } = conf;
|
|
47
48
|
const { variants, propMapper, isReactNative, inlineProps, inlineWhenUnflattened } = staticConfig;
|
|
48
49
|
const validStyleProps = staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles;
|
|
49
50
|
const viewProps = {};
|
|
50
51
|
let pseudos = null;
|
|
51
|
-
let psuedosUsed = null;
|
|
52
52
|
const mediaState = state.mediaState || import_useMedia.mediaState;
|
|
53
53
|
const usedKeys = {};
|
|
54
54
|
const propKeys = Object.keys(props);
|
|
55
|
+
const numProps = propKeys.length;
|
|
55
56
|
let space = props.space;
|
|
56
57
|
let hasMedia = false;
|
|
57
58
|
const shouldDoClasses = staticConfig.acceptsClassName && (import_constants.isWeb || IS_STATIC) && !state.noClassNames;
|
|
58
59
|
let style = {};
|
|
59
60
|
const flatTransforms = {};
|
|
60
|
-
const len = propKeys.length;
|
|
61
61
|
const rulesToInsert = [];
|
|
62
62
|
const classNames = {};
|
|
63
63
|
let className = "";
|
|
@@ -75,12 +75,12 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
75
75
|
viewProps,
|
|
76
76
|
languageContext
|
|
77
77
|
};
|
|
78
|
-
if (process.env.NODE_ENV === "development" && debug) {
|
|
79
|
-
console.groupCollapsed("getSplitStyles (
|
|
78
|
+
if (process.env.NODE_ENV === "development" && debug && import_constants.isClient) {
|
|
79
|
+
console.groupCollapsed("getSplitStyles (collapsed)");
|
|
80
80
|
console.log({ props, staticConfig, shouldDoClasses, state, IS_STATIC, propKeys, styleState, theme: { ...theme } });
|
|
81
81
|
console.groupEnd();
|
|
82
82
|
}
|
|
83
|
-
if (props.className) {
|
|
83
|
+
if (typeof props.className === "string") {
|
|
84
84
|
for (const cn of props.className.split(" ")) {
|
|
85
85
|
if (cn[0] === "_") {
|
|
86
86
|
const [shorthand, mediaOrPseudo] = cn.slice(1).split("-");
|
|
@@ -103,46 +103,56 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
viewProps[key] = {
|
|
110
|
-
...val,
|
|
111
|
-
...viewProps[key]
|
|
112
|
-
};
|
|
113
|
-
} else {
|
|
114
|
-
usedKeys[key] = 1;
|
|
115
|
-
viewProps[key] = val;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const specialProps = [];
|
|
119
|
-
function processProp(keyInit, valInit, special = false, fontFamilyOverride = null) {
|
|
120
|
-
var _a2, _b2, _c2, _d;
|
|
121
|
-
if (keyInit === "className")
|
|
122
|
-
return;
|
|
106
|
+
for (let i = 0; i < numProps; i++) {
|
|
107
|
+
let keyInit = propKeys[i];
|
|
108
|
+
let valInit = props[keyInit];
|
|
123
109
|
if (keyInit in shorthands) {
|
|
124
110
|
keyInit = shorthands[keyInit];
|
|
125
111
|
}
|
|
126
|
-
if (keyInit === "
|
|
127
|
-
|
|
112
|
+
if (keyInit === "className")
|
|
113
|
+
continue;
|
|
114
|
+
if (keyInit in usedKeys)
|
|
115
|
+
continue;
|
|
116
|
+
if (process.env.TAMAGUI_TARGET === "web") {
|
|
117
|
+
if (typeof valInit === "string" && valInit[0] === "_") {
|
|
118
|
+
if (keyInit in validStyleProps || keyInit.includes("-")) {
|
|
119
|
+
if (process.env.NODE_ENV === "development" && debug) {
|
|
120
|
+
console.log(`Adding compiled style ${keyInit}: ${valInit}`);
|
|
121
|
+
}
|
|
122
|
+
if (shouldDoClasses) {
|
|
123
|
+
classNames[keyInit] = valInit;
|
|
124
|
+
delete style[keyInit];
|
|
125
|
+
} else {
|
|
126
|
+
style[keyInit] = (0, import_normalizeValueWithProperty.reverseMapClassNameToValue)(keyInit, valInit);
|
|
127
|
+
delete className[keyInit];
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
128
132
|
}
|
|
129
133
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
130
134
|
if (!import_constants.isAndroid) {
|
|
131
135
|
if (keyInit === "elevationAndroid")
|
|
132
|
-
|
|
136
|
+
continue;
|
|
133
137
|
}
|
|
134
138
|
if (keyInit === "userSelect") {
|
|
135
139
|
keyInit = "selectable";
|
|
136
140
|
valInit = valInit === "none" ? false : true;
|
|
137
|
-
} else if (keyInit
|
|
141
|
+
} else if (keyInit === "role") {
|
|
142
|
+
if (valInit === "list") {
|
|
143
|
+
viewProps[keyInit] = valInit;
|
|
144
|
+
} else if (import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit]) {
|
|
145
|
+
viewProps["accessibilityRole"] = import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit];
|
|
146
|
+
}
|
|
147
|
+
continue;
|
|
148
|
+
} else if (keyInit.startsWith("aria-")) {
|
|
138
149
|
if (import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit]) {
|
|
139
150
|
const nativeA11yProp = import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit];
|
|
140
151
|
if (keyInit === "aria-hidden") {
|
|
141
152
|
viewProps["aria-hidden"] = valInit;
|
|
142
153
|
}
|
|
143
154
|
viewProps[nativeA11yProp] = valInit;
|
|
144
|
-
|
|
145
|
-
return;
|
|
155
|
+
continue;
|
|
146
156
|
} else if (import_accessibilityDirectMap.nativeAccessibilityValue[keyInit]) {
|
|
147
157
|
let field = import_accessibilityDirectMap.nativeAccessibilityValue[keyInit];
|
|
148
158
|
if (viewProps["accessibilityValue"]) {
|
|
@@ -152,7 +162,6 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
152
162
|
[field]: valInit
|
|
153
163
|
};
|
|
154
164
|
}
|
|
155
|
-
usedKeys[keyInit] = 1;
|
|
156
165
|
} else if (import_accessibilityDirectMap.nativeAccessibilityState[keyInit]) {
|
|
157
166
|
let field = import_accessibilityDirectMap.nativeAccessibilityState[keyInit];
|
|
158
167
|
if (viewProps["accessibilityState"]) {
|
|
@@ -162,56 +171,30 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
162
171
|
[field]: valInit
|
|
163
172
|
};
|
|
164
173
|
}
|
|
165
|
-
usedKeys[keyInit] = 1;
|
|
166
|
-
} else if (keyInit === "role") {
|
|
167
|
-
if (valInit === "list") {
|
|
168
|
-
viewProps[keyInit] = valInit;
|
|
169
|
-
} else if (import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit]) {
|
|
170
|
-
viewProps["accessibilityRole"] = import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit];
|
|
171
|
-
}
|
|
172
|
-
return;
|
|
173
174
|
}
|
|
174
|
-
|
|
175
|
+
continue;
|
|
175
176
|
} else if (keyInit.startsWith("data-")) {
|
|
176
|
-
|
|
177
|
+
continue;
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
|
-
if (process.env.TAMAGUI_TARGET === "web") {
|
|
180
|
-
if (keyInit === "elevationAndroid")
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
180
|
if (!staticConfig.isHOC) {
|
|
184
181
|
if (keyInit in skipProps) {
|
|
185
182
|
if (process.env.NODE_ENV === "development" && debug && keyInit === "debug") {
|
|
186
183
|
} else {
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (keyInit in usedKeys) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
if (typeof valInit === "string" && valInit[0] === "_") {
|
|
195
|
-
if (keyInit in validStyleProps || keyInit.includes("-")) {
|
|
196
|
-
if (shouldDoClasses) {
|
|
197
|
-
classNames[keyInit] = valInit;
|
|
198
|
-
} else {
|
|
199
|
-
style[keyInit] = (0, import_normalizeValueWithProperty.reverseMapClassNameToValue)(keyInit, valInit);
|
|
184
|
+
continue;
|
|
200
185
|
}
|
|
201
|
-
usedKeys[keyInit] = 1;
|
|
202
|
-
return;
|
|
203
186
|
}
|
|
204
187
|
}
|
|
205
188
|
if (keyInit === "dataSet") {
|
|
206
|
-
for (const
|
|
207
|
-
viewProps[`data-${hyphenate(
|
|
189
|
+
for (const keyInit2 in valInit) {
|
|
190
|
+
viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
|
|
208
191
|
}
|
|
209
|
-
|
|
192
|
+
continue;
|
|
210
193
|
}
|
|
211
194
|
const isMainStyle = keyInit === "style";
|
|
212
195
|
if (isMainStyle || keyInit.startsWith("_style")) {
|
|
213
196
|
if (!valInit)
|
|
214
|
-
|
|
197
|
+
continue;
|
|
215
198
|
const styles = [].concat(valInit).flat();
|
|
216
199
|
const styleLen = styles.length;
|
|
217
200
|
for (let j = styleLen; j >= 0; j--) {
|
|
@@ -226,44 +209,41 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
226
209
|
style[key] = cur[key];
|
|
227
210
|
}
|
|
228
211
|
}
|
|
229
|
-
|
|
212
|
+
continue;
|
|
230
213
|
}
|
|
231
214
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
232
215
|
if (keyInit === "disabled" && valInit === true) {
|
|
233
|
-
usedKeys[keyInit] = 1;
|
|
234
216
|
viewProps["aria-disabled"] = true;
|
|
235
217
|
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
236
218
|
viewProps.disabled = true;
|
|
237
219
|
}
|
|
238
220
|
if (!(variants == null ? void 0 : variants.disabled)) {
|
|
239
|
-
|
|
221
|
+
continue;
|
|
240
222
|
}
|
|
241
223
|
}
|
|
242
224
|
if (keyInit === "testID") {
|
|
243
|
-
usedKeys[keyInit] = 1;
|
|
244
225
|
viewProps[isReactNative ? "testId" : "data-testid"] = valInit;
|
|
245
|
-
|
|
226
|
+
continue;
|
|
246
227
|
}
|
|
247
228
|
if (keyInit === "id" || keyInit === "nativeID") {
|
|
248
|
-
usedKeys[keyInit] = 1;
|
|
249
229
|
if (isReactNative) {
|
|
250
230
|
viewProps.nativeID = valInit;
|
|
251
231
|
} else {
|
|
252
232
|
viewProps.id = valInit;
|
|
253
233
|
}
|
|
254
|
-
|
|
234
|
+
continue;
|
|
255
235
|
}
|
|
256
236
|
let didUseKeyInit = false;
|
|
257
237
|
if (isReactNative) {
|
|
258
|
-
if (import_accessibilityDirectMap.accessibilityDirectMap
|
|
238
|
+
if (keyInit in import_accessibilityDirectMap.accessibilityDirectMap || keyInit.startsWith("accessibility")) {
|
|
259
239
|
viewProps[keyInit] = valInit;
|
|
260
|
-
|
|
261
|
-
return;
|
|
240
|
+
continue;
|
|
262
241
|
}
|
|
263
242
|
} else {
|
|
264
243
|
didUseKeyInit = true;
|
|
265
244
|
if (keyInit in import_accessibilityDirectMap.accessibilityDirectMap) {
|
|
266
245
|
viewProps[import_accessibilityDirectMap.accessibilityDirectMap[keyInit]] = valInit;
|
|
246
|
+
continue;
|
|
267
247
|
} else {
|
|
268
248
|
switch (keyInit) {
|
|
269
249
|
case "accessibilityRole": {
|
|
@@ -272,38 +252,38 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
272
252
|
} else {
|
|
273
253
|
viewProps.role = accessibilityRoleToWebRole[valInit] || valInit;
|
|
274
254
|
}
|
|
275
|
-
|
|
255
|
+
continue;
|
|
276
256
|
}
|
|
277
257
|
case "accessibilityLabelledBy":
|
|
278
258
|
case "accessibilityFlowTo":
|
|
279
259
|
case "accessibilityControls":
|
|
280
260
|
case "accessibilityDescribedBy": {
|
|
281
261
|
viewProps[`aria-${keyInit.replace("accessibility", "").toLowerCase()}`] = processIDRefList(valInit);
|
|
282
|
-
|
|
262
|
+
continue;
|
|
283
263
|
}
|
|
284
264
|
case "accessibilityKeyShortcuts": {
|
|
285
265
|
if (Array.isArray(valInit)) {
|
|
286
266
|
viewProps["aria-keyshortcuts"] = valInit.join(" ");
|
|
287
267
|
}
|
|
288
|
-
|
|
268
|
+
continue;
|
|
289
269
|
}
|
|
290
270
|
case "accessibilityLiveRegion": {
|
|
291
271
|
viewProps["aria-live"] = valInit === "none" ? "off" : valInit;
|
|
292
|
-
|
|
272
|
+
continue;
|
|
293
273
|
}
|
|
294
274
|
case "accessibilityReadOnly": {
|
|
295
275
|
viewProps["aria-readonly"] = valInit;
|
|
296
276
|
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
297
277
|
viewProps.readOnly = true;
|
|
298
278
|
}
|
|
299
|
-
|
|
279
|
+
continue;
|
|
300
280
|
}
|
|
301
281
|
case "accessibilityRequired": {
|
|
302
282
|
viewProps["aria-required"] = valInit;
|
|
303
283
|
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
304
284
|
viewProps.required = valInit;
|
|
305
285
|
}
|
|
306
|
-
|
|
286
|
+
continue;
|
|
307
287
|
}
|
|
308
288
|
default: {
|
|
309
289
|
didUseKeyInit = false;
|
|
@@ -312,71 +292,57 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
312
292
|
}
|
|
313
293
|
}
|
|
314
294
|
if (didUseKeyInit) {
|
|
315
|
-
|
|
316
|
-
return;
|
|
295
|
+
continue;
|
|
317
296
|
}
|
|
318
297
|
if (valInit && valInit[0] === "_") {
|
|
319
298
|
const isValidClassName = keyInit in import_helpers.validStyles;
|
|
320
299
|
const isMediaOrPseudo2 = !isValidClassName && keyInit.includes(PROP_SPLIT) && import_helpers.validStyles[keyInit.split(PROP_SPLIT)[0]];
|
|
321
300
|
if (isValidClassName || isMediaOrPseudo2) {
|
|
322
|
-
usedKeys[keyInit] = 1;
|
|
323
301
|
if (process.env.NODE_ENV === "development" && debug) {
|
|
324
302
|
console.log("tamagui classname props", keyInit, valInit);
|
|
325
303
|
}
|
|
326
304
|
mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo2);
|
|
327
|
-
|
|
305
|
+
continue;
|
|
328
306
|
}
|
|
329
307
|
}
|
|
330
308
|
}
|
|
331
309
|
let isMedia = (0, import_useMedia.isMediaKey)(keyInit);
|
|
332
310
|
let isPseudo = keyInit in import_helpers.validPseudoKeys;
|
|
333
311
|
let isMediaOrPseudo = isMedia || isPseudo;
|
|
334
|
-
|
|
312
|
+
let isVariant = variants && keyInit in variants;
|
|
335
313
|
const isStyleProp = isMediaOrPseudo || isVariant || keyInit in validStyleProps || keyInit in shorthands;
|
|
336
314
|
if (isStyleProp && props.asChild === "except-style") {
|
|
337
|
-
|
|
315
|
+
continue;
|
|
338
316
|
}
|
|
339
317
|
const shouldPassProp = !isStyleProp;
|
|
340
|
-
const isHOCShouldPassThrough =
|
|
318
|
+
const isHOCShouldPassThrough = Boolean(
|
|
319
|
+
staticConfig.isHOC && (isMediaOrPseudo || ((_b = (_a = staticConfig.parentStaticConfig) == null ? void 0 : _a.variants) == null ? void 0 : _b[keyInit]) || keyInit in skipProps)
|
|
320
|
+
);
|
|
341
321
|
const shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
|
|
322
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
323
|
+
console.groupCollapsed(
|
|
324
|
+
` \u{1F539} prop ${keyInit} ${shouldPassThrough ? "pass through" : ""}`
|
|
325
|
+
);
|
|
326
|
+
console.log({ valInit, variants, variant: variants == null ? void 0 : variants[keyInit], isVariant, shouldPassProp, isHOCShouldPassThrough });
|
|
327
|
+
console.groupEnd();
|
|
328
|
+
}
|
|
342
329
|
if (shouldPassThrough) {
|
|
343
|
-
|
|
344
|
-
console.groupCollapsed(` \u{1F539} pass through ${keyInit}`);
|
|
345
|
-
console.log({
|
|
346
|
-
valInit,
|
|
347
|
-
variants,
|
|
348
|
-
variant: variants == null ? void 0 : variants[keyInit],
|
|
349
|
-
isVariant,
|
|
350
|
-
shouldPassProp,
|
|
351
|
-
isHOCShouldPassThrough
|
|
352
|
-
});
|
|
353
|
-
console.groupEnd();
|
|
354
|
-
}
|
|
355
|
-
if (isPseudo) {
|
|
356
|
-
const pseudoStyleObject = getSubStyle(
|
|
357
|
-
styleState,
|
|
358
|
-
keyInit,
|
|
359
|
-
valInit,
|
|
360
|
-
true,
|
|
361
|
-
state.noClassNames
|
|
362
|
-
);
|
|
363
|
-
const descriptor = import_pseudoDescriptors.pseudoDescriptors[keyInit];
|
|
364
|
-
for (const key in pseudoStyleObject) {
|
|
365
|
-
const fullKey = `${key}${PROP_SPLIT}${descriptor.name}`;
|
|
366
|
-
usedKeys[fullKey] = 1;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
passDownProp(keyInit, valInit, isMediaOrPseudo);
|
|
330
|
+
passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo);
|
|
370
331
|
if (!isVariant) {
|
|
371
|
-
|
|
332
|
+
continue;
|
|
372
333
|
}
|
|
373
334
|
}
|
|
335
|
+
if (keyInit in skipProps)
|
|
336
|
+
continue;
|
|
337
|
+
defaultFontVariable || (defaultFontVariable = `$${conf.defaultFont}`);
|
|
338
|
+
fontFamily || (fontFamily = props[conf.inverseShorthands.fontFamily] || props.fontFamily || defaultFontVariable);
|
|
374
339
|
const expanded = isMediaOrPseudo ? [[keyInit, valInit]] : propMapper(
|
|
375
340
|
keyInit,
|
|
376
341
|
valInit,
|
|
377
342
|
theme,
|
|
378
|
-
|
|
343
|
+
props,
|
|
379
344
|
state,
|
|
345
|
+
fontFamily,
|
|
380
346
|
languageContext,
|
|
381
347
|
void 0,
|
|
382
348
|
debug
|
|
@@ -385,17 +351,9 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
385
351
|
fontFamily = (0, import_createPropMapper.getPropMappedFontFamily)(expanded);
|
|
386
352
|
}
|
|
387
353
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
388
|
-
console.groupCollapsed(" \u{1F539}
|
|
389
|
-
console.log({
|
|
390
|
-
expanded,
|
|
391
|
-
state,
|
|
392
|
-
isVariant,
|
|
393
|
-
variant: variants == null ? void 0 : variants[keyInit],
|
|
394
|
-
shouldPassProp,
|
|
395
|
-
isHOCShouldPassThrough,
|
|
396
|
-
theme
|
|
397
|
-
});
|
|
354
|
+
console.groupCollapsed(" \u{1F539} expanded", keyInit, valInit);
|
|
398
355
|
if (!import_constants.isServer && import_isDevTools.isDevTools) {
|
|
356
|
+
console.log({ expanded, state: { ...state }, isVariant, variant: variants == null ? void 0 : variants[keyInit], shouldPassProp, isHOCShouldPassThrough, theme, usedKeys: { ...usedKeys } });
|
|
399
357
|
console.log("expanded", expanded, "\nusedKeys", { ...usedKeys }, "\ncurrent", {
|
|
400
358
|
...style
|
|
401
359
|
});
|
|
@@ -403,30 +361,27 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
403
361
|
console.groupEnd();
|
|
404
362
|
}
|
|
405
363
|
if (!expanded)
|
|
406
|
-
|
|
364
|
+
continue;
|
|
407
365
|
for (const [key, val] of expanded) {
|
|
408
|
-
if (val
|
|
366
|
+
if (val == null)
|
|
409
367
|
continue;
|
|
410
|
-
if (key in
|
|
411
|
-
specialProps.push([key, val]);
|
|
368
|
+
if (key in usedKeys)
|
|
412
369
|
continue;
|
|
413
|
-
}
|
|
414
370
|
isMedia = (0, import_useMedia.isMediaKey)(key);
|
|
415
371
|
isPseudo = key in import_helpers.validPseudoKeys;
|
|
416
372
|
isMediaOrPseudo = isMedia || isPseudo;
|
|
417
|
-
if (!isMediaOrPseudo && key in usedKeys) {
|
|
418
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
419
|
-
console.log(`Used media/pseudo ${key}`);
|
|
420
|
-
}
|
|
421
|
-
continue;
|
|
422
|
-
}
|
|
423
373
|
if ((inlineProps == null ? void 0 : inlineProps.has(key)) || (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key))) {
|
|
424
|
-
usedKeys[key] = 1;
|
|
425
374
|
viewProps[key] = props[key] ?? val;
|
|
426
375
|
}
|
|
427
|
-
const isHOCShouldPassThrough2 = staticConfig.isHOC && (isMediaOrPseudo || ((_d = (
|
|
376
|
+
const isHOCShouldPassThrough2 = staticConfig.isHOC && (isMediaOrPseudo || ((_d = (_c = staticConfig.parentStaticConfig) == null ? void 0 : _c.variants) == null ? void 0 : _d[keyInit]));
|
|
428
377
|
if (isHOCShouldPassThrough2) {
|
|
429
|
-
|
|
378
|
+
isVariant = variants && key in variants;
|
|
379
|
+
passDownProp(viewProps, key, val, isMediaOrPseudo);
|
|
380
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
381
|
+
console.groupCollapsed(` - passing down prop ${key}`);
|
|
382
|
+
console.log({ val, after: { ...viewProps[key] } });
|
|
383
|
+
console.groupEnd();
|
|
384
|
+
}
|
|
430
385
|
if (!isVariant) {
|
|
431
386
|
continue;
|
|
432
387
|
}
|
|
@@ -438,6 +393,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
438
393
|
styleState,
|
|
439
394
|
key,
|
|
440
395
|
val,
|
|
396
|
+
fontFamily,
|
|
441
397
|
true,
|
|
442
398
|
state.noClassNames
|
|
443
399
|
);
|
|
@@ -445,68 +401,72 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
445
401
|
const isEnter = descriptor.name === "enter";
|
|
446
402
|
const isExit = descriptor.name === "exit";
|
|
447
403
|
if (!descriptor || isExit && !state.isExiting) {
|
|
404
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
405
|
+
console.log("skip exit");
|
|
406
|
+
}
|
|
448
407
|
continue;
|
|
449
408
|
}
|
|
450
409
|
if (!shouldDoClasses || IS_STATIC) {
|
|
451
410
|
pseudos || (pseudos = {});
|
|
452
411
|
pseudos[key] || (pseudos[key] = {});
|
|
453
|
-
Object.assign(pseudos[key], pseudoStyleObject);
|
|
454
412
|
}
|
|
455
413
|
if (shouldDoClasses && !isEnter && !isExit) {
|
|
456
414
|
const pseudoStyles = (0, import_getStylesAtomic.generateAtomicStyles)(pseudoStyleObject, descriptor);
|
|
415
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
416
|
+
console.groupCollapsed("pseudo (classes)", key);
|
|
417
|
+
console.log({ pseudoStyleObject, pseudoStyles });
|
|
418
|
+
console.groupEnd();
|
|
419
|
+
}
|
|
457
420
|
for (const psuedoStyle of pseudoStyles) {
|
|
458
421
|
const fullKey = `${psuedoStyle.property}${PROP_SPLIT}${descriptor.name}`;
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
isMediaOrPseudo
|
|
468
|
-
);
|
|
469
|
-
}
|
|
422
|
+
addStyleToInsertRules(rulesToInsert, psuedoStyle);
|
|
423
|
+
mergeClassName(
|
|
424
|
+
transforms,
|
|
425
|
+
classNames,
|
|
426
|
+
fullKey,
|
|
427
|
+
psuedoStyle.identifier,
|
|
428
|
+
isMediaOrPseudo
|
|
429
|
+
);
|
|
470
430
|
}
|
|
471
431
|
} else {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
let isDisabled = !state[descriptor.stateKey || descriptor.name];
|
|
432
|
+
const descriptorKey = descriptor.stateKey || descriptor.name;
|
|
433
|
+
const pseudoState = state[descriptorKey];
|
|
434
|
+
let isDisabled = !pseudoState;
|
|
476
435
|
if (import_constants.isWeb && !import_constants.isClient && isEnter) {
|
|
477
436
|
isDisabled = false;
|
|
478
437
|
}
|
|
438
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
439
|
+
console.groupCollapsed("pseudo", key, !isDisabled);
|
|
440
|
+
console.log(pseudoStyleObject, { isDisabled, descriptorKey, descriptor, pseudoState, state: { ...state } });
|
|
441
|
+
console.groupEnd();
|
|
442
|
+
}
|
|
443
|
+
const importance = descriptor.priority;
|
|
479
444
|
if (!isDisabled) {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
usedKeys[
|
|
483
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
484
|
-
console.log(`Setting used ${key}`);
|
|
485
|
-
}
|
|
445
|
+
for (const key2 in val) {
|
|
446
|
+
const k = shorthands[key2] || key2;
|
|
447
|
+
usedKeys[k] = Math.max(importance, usedKeys[k] || 0);
|
|
486
448
|
}
|
|
487
449
|
}
|
|
488
|
-
psuedosUsed || (psuedosUsed = {});
|
|
489
|
-
const importance = descriptor.priority;
|
|
490
450
|
for (const pkey in pseudoStyleObject) {
|
|
491
451
|
const val2 = pseudoStyleObject[pkey];
|
|
492
452
|
if (isDisabled) {
|
|
493
|
-
if (
|
|
453
|
+
if (pkey in animatableDefaults && !(pkey in usedKeys)) {
|
|
494
454
|
const defaultVal = animatableDefaults[pkey];
|
|
495
|
-
mergeStyle(styleState, flatTransforms, pkey, defaultVal
|
|
455
|
+
mergeStyle(styleState, flatTransforms, pkey, defaultVal);
|
|
456
|
+
}
|
|
457
|
+
} else {
|
|
458
|
+
const curImportance = usedKeys[importance] || 0;
|
|
459
|
+
const shouldMerge = importance >= curImportance;
|
|
460
|
+
if (shouldMerge) {
|
|
461
|
+
pseudos || (pseudos = {});
|
|
462
|
+
pseudos[key] || (pseudos[key] = {});
|
|
463
|
+
pseudos[key][pkey] = val2;
|
|
464
|
+
mergeStyle(styleState, flatTransforms, pkey, val2);
|
|
465
|
+
usedKeys[pkey] || (usedKeys[pkey] = 1);
|
|
466
|
+
}
|
|
467
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
468
|
+
console.log(" subKey", pkey, shouldMerge, { importance, curImportance, pkey, val: val2 });
|
|
496
469
|
}
|
|
497
|
-
continue;
|
|
498
|
-
}
|
|
499
|
-
const curImportance = psuedosUsed[importance] || 0;
|
|
500
|
-
const shouldMerge = importance >= curImportance;
|
|
501
|
-
if (shouldMerge) {
|
|
502
|
-
psuedosUsed[pkey] = importance;
|
|
503
|
-
pseudos || (pseudos = {});
|
|
504
|
-
pseudos[key] || (pseudos[key] = {});
|
|
505
|
-
pseudos[key][pkey] = val2;
|
|
506
|
-
mergeStyle(styleState, flatTransforms, pkey, val2);
|
|
507
|
-
}
|
|
508
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
509
|
-
console.log(" merge pseudo?", keyInit, shouldMerge, { importance, curImportance, pkey, val: val2 });
|
|
510
470
|
}
|
|
511
471
|
}
|
|
512
472
|
}
|
|
@@ -520,6 +480,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
520
480
|
styleState,
|
|
521
481
|
key,
|
|
522
482
|
val,
|
|
483
|
+
fontFamily,
|
|
523
484
|
// TODO try true like pseudo
|
|
524
485
|
false
|
|
525
486
|
);
|
|
@@ -558,11 +519,8 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
558
519
|
for (const style2 of mediaStyles) {
|
|
559
520
|
const out = (0, import_createMediaStyle.createMediaStyle)(style2, mediaKeyShort, import_useMedia.mediaQueryConfig);
|
|
560
521
|
const fullKey = `${style2.property}${PROP_SPLIT}${mediaKeyShort}`;
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
addStyleToInsertRules(rulesToInsert, out);
|
|
564
|
-
mergeClassName(transforms, classNames, fullKey, out.identifier, true);
|
|
565
|
-
}
|
|
522
|
+
addStyleToInsertRules(rulesToInsert, out);
|
|
523
|
+
mergeClassName(transforms, classNames, fullKey, out.identifier, true);
|
|
566
524
|
}
|
|
567
525
|
} else if (mediaState[mediaKeyShort]) {
|
|
568
526
|
for (const subKey in mediaStyle) {
|
|
@@ -593,7 +551,6 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
593
551
|
}
|
|
594
552
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
595
553
|
if (key === "pointerEvents") {
|
|
596
|
-
usedKeys[key] = 1;
|
|
597
554
|
viewProps[key] = val;
|
|
598
555
|
continue;
|
|
599
556
|
}
|
|
@@ -604,38 +561,25 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
604
561
|
fontFamily = fam;
|
|
605
562
|
}
|
|
606
563
|
}
|
|
607
|
-
if (key in validStyleProps) {
|
|
608
|
-
mergeStyle(styleState, flatTransforms, key, val);
|
|
609
|
-
continue;
|
|
610
|
-
} else if (process.env.TAMAGUI_TARGET === "native" && import_constants.isAndroid && key === "elevation") {
|
|
564
|
+
if (key in validStyleProps || process.env.TAMAGUI_TARGET === "native" && import_constants.isAndroid && key === "elevation") {
|
|
611
565
|
mergeStyle(styleState, flatTransforms, key, val);
|
|
612
566
|
continue;
|
|
613
567
|
}
|
|
614
|
-
if (!isVariant
|
|
568
|
+
if (!isVariant) {
|
|
615
569
|
viewProps[key] = val;
|
|
616
|
-
usedKeys[key] = 1;
|
|
617
570
|
}
|
|
618
571
|
}
|
|
619
572
|
}
|
|
620
|
-
for (let i = len - 1; i >= 0; i--) {
|
|
621
|
-
const keyInit = propKeys[i];
|
|
622
|
-
const valInit = props[keyInit];
|
|
623
|
-
processProp(keyInit, valInit);
|
|
624
|
-
}
|
|
625
573
|
fontFamily || (fontFamily = conf.defaultFont);
|
|
626
|
-
for (let i = 0; i < specialProps.length; i++) {
|
|
627
|
-
const [key, value] = specialProps[i];
|
|
628
|
-
processProp(key, value, true, fontFamily);
|
|
629
|
-
}
|
|
630
574
|
(0, import_expandStyles.fixStyles)(style);
|
|
631
575
|
if (import_constants.isWeb) {
|
|
632
576
|
(0, import_getStylesAtomic.styleToCSS)(style);
|
|
633
577
|
}
|
|
634
578
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
635
579
|
if ("fontFamily" in style && style.fontFamily) {
|
|
636
|
-
const faceInfo = (
|
|
580
|
+
const faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
|
|
637
581
|
if (faceInfo) {
|
|
638
|
-
const overrideFace = (
|
|
582
|
+
const overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
|
|
639
583
|
if (overrideFace) {
|
|
640
584
|
style.fontFamily = overrideFace;
|
|
641
585
|
fontFamily = overrideFace;
|
|
@@ -655,7 +599,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
655
599
|
}
|
|
656
600
|
}
|
|
657
601
|
if (flatTransforms) {
|
|
658
|
-
|
|
602
|
+
mergeFlatTransforms(style, flatTransforms, true);
|
|
659
603
|
}
|
|
660
604
|
if (parentSplitStyles) {
|
|
661
605
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
@@ -684,7 +628,7 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
684
628
|
const atomic = (0, import_getStylesAtomic.getStylesAtomic)(style);
|
|
685
629
|
for (const atomicStyle of atomic) {
|
|
686
630
|
const key = atomicStyle.property;
|
|
687
|
-
if (props.animateOnly && props.animateOnly.includes(key)) {
|
|
631
|
+
if (state.isAnimated && props.animateOnly && props.animateOnly.includes(key)) {
|
|
688
632
|
retainedStyles[key] = style[key];
|
|
689
633
|
} else {
|
|
690
634
|
addStyleToInsertRules(rulesToInsert, atomicStyle);
|
|
@@ -748,18 +692,11 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
748
692
|
}
|
|
749
693
|
}
|
|
750
694
|
}
|
|
751
|
-
const nextViewProps = {};
|
|
752
|
-
const ks = Object.keys(viewProps);
|
|
753
|
-
const l = ks.length;
|
|
754
|
-
for (let i = l - 1; i >= 0; i--) {
|
|
755
|
-
const key = ks[i];
|
|
756
|
-
nextViewProps[key] = viewProps[key];
|
|
757
|
-
}
|
|
758
695
|
const result = {
|
|
759
696
|
space,
|
|
760
697
|
hasMedia,
|
|
761
698
|
fontFamily,
|
|
762
|
-
viewProps
|
|
699
|
+
viewProps,
|
|
763
700
|
// @ts-expect-error
|
|
764
701
|
style,
|
|
765
702
|
pseudos,
|
|
@@ -771,8 +708,8 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
771
708
|
}
|
|
772
709
|
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
773
710
|
if (import_isDevTools.isDevTools) {
|
|
774
|
-
console.groupCollapsed(" \u{1F539}
|
|
775
|
-
const logs = { ...result, state,
|
|
711
|
+
console.groupCollapsed(" \u{1F539} ===>");
|
|
712
|
+
const logs = { ...result, state, transforms, viewProps, viewPropsOrder: Object.keys(viewProps), rulesToInsert, parentSplitStyles, flatTransforms };
|
|
776
713
|
for (const key in logs) {
|
|
777
714
|
console.log(key, logs[key]);
|
|
778
715
|
}
|
|
@@ -812,12 +749,10 @@ function getSubStyleProps(defaultProps, baseProps, specificProps) {
|
|
|
812
749
|
...specificProps
|
|
813
750
|
};
|
|
814
751
|
}
|
|
815
|
-
function mergeStyle({
|
|
816
|
-
if (
|
|
817
|
-
usedKeys[key] || (usedKeys[key] = 1);
|
|
818
|
-
}
|
|
819
|
-
if (val && val[0] === "_") {
|
|
752
|
+
function mergeStyle({ classNames, viewProps, style, usedKeys }, flatTransforms, key, val) {
|
|
753
|
+
if ((val == null ? void 0 : val[0]) === "_") {
|
|
820
754
|
classNames[key] = val;
|
|
755
|
+
usedKeys[key] || (usedKeys[key] = 1);
|
|
821
756
|
} else if (key in import_helpers.stylePropsTransform) {
|
|
822
757
|
flatTransforms || (flatTransforms = {});
|
|
823
758
|
flatTransforms[key] = val;
|
|
@@ -830,7 +765,7 @@ function mergeStyle({ usedKeys, classNames, viewProps, style }, flatTransforms,
|
|
|
830
765
|
}
|
|
831
766
|
}
|
|
832
767
|
}
|
|
833
|
-
const getSubStyle = (styleState, subKey, styleIn, avoidDefaultProps, avoidMergeTransform) => {
|
|
768
|
+
const getSubStyle = (styleState, subKey, styleIn, fontFamily, avoidDefaultProps, avoidMergeTransform) => {
|
|
834
769
|
const { staticConfig, theme, props, state, conf: conf2, languageContext } = styleState;
|
|
835
770
|
const styleOut = {};
|
|
836
771
|
for (let key in styleIn) {
|
|
@@ -842,16 +777,13 @@ const getSubStyle = (styleState, subKey, styleIn, avoidDefaultProps, avoidMergeT
|
|
|
842
777
|
theme,
|
|
843
778
|
getSubStyleProps(staticConfig.defaultProps, props, props[subKey]),
|
|
844
779
|
state,
|
|
780
|
+
fontFamily,
|
|
845
781
|
languageContext,
|
|
846
782
|
avoidDefaultProps
|
|
847
783
|
);
|
|
848
|
-
if (!staticConfig.isHOC) {
|
|
849
|
-
if (key in skipProps) {
|
|
850
|
-
continue;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
if (!expanded)
|
|
784
|
+
if (!expanded || !staticConfig.isHOC && key in skipProps) {
|
|
854
785
|
continue;
|
|
786
|
+
}
|
|
855
787
|
for (const [skey, sval] of expanded) {
|
|
856
788
|
if (!avoidMergeTransform && skey in import_helpers.stylePropsTransform) {
|
|
857
789
|
mergeTransform(styleOut, skey, sval);
|
|
@@ -891,7 +823,9 @@ const animatableDefaults = {
|
|
|
891
823
|
scale: 1,
|
|
892
824
|
rotate: "0deg",
|
|
893
825
|
rotateY: "0deg",
|
|
894
|
-
rotateX: "0deg"
|
|
826
|
+
rotateX: "0deg",
|
|
827
|
+
x: 0,
|
|
828
|
+
y: 0
|
|
895
829
|
};
|
|
896
830
|
const lowercaseHyphenate = (match) => `-${match.toLowerCase()}`;
|
|
897
831
|
const hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate);
|
|
@@ -901,8 +835,8 @@ const mergeTransform = (obj, key, val, backwards = false) => {
|
|
|
901
835
|
[mapTransformKeys[key] || key]: val
|
|
902
836
|
});
|
|
903
837
|
};
|
|
904
|
-
const
|
|
905
|
-
Object.entries(flatTransforms).forEach(([key, val]) => {
|
|
838
|
+
const mergeFlatTransforms = (obj, flatTransforms, backwards = false) => {
|
|
839
|
+
Object.entries(flatTransforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
|
|
906
840
|
mergeTransform(obj, key, val, backwards);
|
|
907
841
|
});
|
|
908
842
|
};
|
|
@@ -937,6 +871,10 @@ if (process.env.TAMAGUI_TARGET === "native") {
|
|
|
937
871
|
outlineWidth: true,
|
|
938
872
|
outlineColor: true
|
|
939
873
|
});
|
|
874
|
+
} else {
|
|
875
|
+
Object.assign(skipProps, {
|
|
876
|
+
elevationAndroid: true
|
|
877
|
+
});
|
|
940
878
|
}
|
|
941
879
|
const accessibilityRoleToWebRole = {
|
|
942
880
|
adjustable: "slider",
|
|
@@ -946,6 +884,18 @@ const accessibilityRoleToWebRole = {
|
|
|
946
884
|
none: "presentation",
|
|
947
885
|
summary: "region"
|
|
948
886
|
};
|
|
887
|
+
function passDownProp(viewProps, key, val, shouldMergeObject = false) {
|
|
888
|
+
if (shouldMergeObject) {
|
|
889
|
+
const next = {
|
|
890
|
+
...viewProps[key],
|
|
891
|
+
...val
|
|
892
|
+
};
|
|
893
|
+
delete viewProps[key];
|
|
894
|
+
viewProps[key] = next;
|
|
895
|
+
} else {
|
|
896
|
+
viewProps[key] = val;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
949
899
|
// Annotate the CommonJS export names for ESM import in node:
|
|
950
900
|
0 && (module.exports = {
|
|
951
901
|
PROP_SPLIT,
|