@tamagui/core 1.0.1-beta.76 → 1.0.1-beta.79
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/ThemeManager.js +6 -22
- package/dist/cjs/ThemeManager.js.map +2 -2
- package/dist/cjs/constants/rnw.js +5 -7
- package/dist/cjs/constants/rnw.js.map +2 -2
- package/dist/cjs/createComponent.js +4 -3
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +1 -15
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +3 -0
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/validate.js +33 -30
- package/dist/cjs/helpers/validate.js.map +2 -2
- package/dist/cjs/index.js +0 -5
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/insertFont.js +1 -2
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/esm/ThemeManager.js +4 -4
- package/dist/esm/ThemeManager.js.map +2 -2
- package/dist/esm/constants/rnw.js +2 -7
- package/dist/esm/constants/rnw.js.map +2 -2
- package/dist/esm/createComponent.js +4 -3
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +1 -17
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +3 -0
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/validate.js +1 -1
- package/dist/esm/helpers/validate.js.map +2 -2
- package/dist/esm/index.js +0 -3
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/insertFont.js +1 -2
- package/dist/esm/insertFont.js.map +2 -2
- package/package.json +7 -7
- package/types/ThemeManager.d.ts +1 -1
- package/types/ThemeManager.d.ts.map +1 -1
- package/types/constants/rnw.d.ts.map +1 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/createTamaguiProvider.d.ts +1 -0
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/dist/cjs/helpers/pseudos.js +0 -41
- package/dist/cjs/helpers/pseudos.js.map +0 -7
- package/dist/esm/helpers/pseudos.js +0 -18
- package/dist/esm/helpers/pseudos.js.map +0 -7
- package/dist/jsx/Pressability.js +0 -4
- package/dist/jsx/Pressability.native.js +0 -4
- package/dist/jsx/Tamagui.js +0 -38
- package/dist/jsx/ThemeContext.js +0 -5
- package/dist/jsx/ThemeManager.js +0 -194
- package/dist/jsx/conf.js +0 -38
- package/dist/jsx/constants/constants.js +0 -17
- package/dist/jsx/constants/platform.js +0 -25
- package/dist/jsx/constants/rnw.js +0 -10
- package/dist/jsx/contexts/ButtonInsideButtonContext.js +0 -5
- package/dist/jsx/createComponent.js +0 -1036
- package/dist/jsx/createFont.js +0 -25
- package/dist/jsx/createShorthands.js +0 -6
- package/dist/jsx/createTamagui.js +0 -245
- package/dist/jsx/createTheme.js +0 -6
- package/dist/jsx/createTokens.js +0 -11
- package/dist/jsx/createVariable.js +0 -64
- package/dist/jsx/createVariables.js +0 -31
- package/dist/jsx/defaultComponentState.js +0 -0
- package/dist/jsx/helpers/RNComponents.js +0 -11
- package/dist/jsx/helpers/areEqualSets.js +0 -13
- package/dist/jsx/helpers/calc.js +0 -46
- package/dist/jsx/helpers/createMediaStyle.js +0 -29
- package/dist/jsx/helpers/createPropMapper.js +0 -243
- package/dist/jsx/helpers/createShallowUpdate.js +0 -16
- package/dist/jsx/helpers/createTamaguiProvider.js +0 -28
- package/dist/jsx/helpers/extendStaticConfig.js +0 -62
- package/dist/jsx/helpers/fixNativeShadow.js +0 -5
- package/dist/jsx/helpers/fixNativeShadow.native.js +0 -28
- package/dist/jsx/helpers/generateAtomicStyles.js +0 -410
- package/dist/jsx/helpers/getExpandedShorthands.js +0 -15
- package/dist/jsx/helpers/getSize.js +0 -19
- package/dist/jsx/helpers/getSplitStyles.js +0 -380
- package/dist/jsx/helpers/getStackSize.js +0 -15
- package/dist/jsx/helpers/getStylesAtomic.js +0 -61
- package/dist/jsx/helpers/getStylesAtomic.native.js +0 -6
- package/dist/jsx/helpers/getTextSize.js +0 -31
- package/dist/jsx/helpers/getVariantExtras.js +0 -22
- package/dist/jsx/helpers/insertStyleRule.js +0 -91
- package/dist/jsx/helpers/isObj.js +0 -4
- package/dist/jsx/helpers/isTamaguiComponent.js +0 -12
- package/dist/jsx/helpers/isTamaguiElement.js +0 -8
- package/dist/jsx/helpers/matchMedia.js +0 -15
- package/dist/jsx/helpers/matchMedia.native.js +0 -6
- package/dist/jsx/helpers/mergeProps.js +0 -15
- package/dist/jsx/helpers/mergeTransform.js +0 -16
- package/dist/jsx/helpers/nativeGestureHandler.native.js +0 -1
- package/dist/jsx/helpers/proxyThemeVariables.js +0 -14
- package/dist/jsx/helpers/pseudos.js +0 -17
- package/dist/jsx/helpers/registerCSSVariable.js +0 -14
- package/dist/jsx/helpers/themeable.js +0 -22
- package/dist/jsx/helpers/validate.js +0 -73
- package/dist/jsx/helpers/withStaticProperties.js +0 -7
- package/dist/jsx/helpers/wrapThemeManagerContext.js +0 -7
- package/dist/jsx/hooks/useConstant.js +0 -11
- package/dist/jsx/hooks/useFeatures.js +0 -165
- package/dist/jsx/hooks/useId.js +0 -32
- package/dist/jsx/hooks/useIsMounted.js +0 -15
- package/dist/jsx/hooks/useIsTouchDevice.js +0 -14
- package/dist/jsx/hooks/useMedia.js +0 -153
- package/dist/jsx/hooks/usePressable.js +0 -11
- package/dist/jsx/hooks/usePrevious.js +0 -0
- package/dist/jsx/hooks/useTheme.js +0 -164
- package/dist/jsx/hooks/useUnmountEffect.js +0 -7
- package/dist/jsx/index.js +0 -64
- package/dist/jsx/insertFont.js +0 -64
- package/dist/jsx/static.js +0 -18
- package/dist/jsx/styled.js +0 -49
- package/dist/jsx/types-rnw.js +0 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/views/Slot.js +0 -70
- package/dist/jsx/views/Stack.js +0 -12
- package/dist/jsx/views/Text.js +0 -57
- package/dist/jsx/views/TextAncestorContext.js +0 -13
- package/dist/jsx/views/Theme.js +0 -27
- package/dist/jsx/views/ThemeInverse.js +0 -24
- package/dist/jsx/views/ThemeProvider.js +0 -34
- package/dist/jsx/views/ThemeReset.js +0 -32
- package/types/helpers/pseudos.d.ts +0 -16
- package/types/helpers/pseudos.d.ts.map +0 -1
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { getConfig } from "../conf";
|
|
2
|
-
import { isWeb } from "../constants/platform";
|
|
3
|
-
import { isVariable } from "../createVariable";
|
|
4
|
-
import { expandStyle, expandStyles } from "./generateAtomicStyles";
|
|
5
|
-
import { getVariantExtras } from "./getVariantExtras";
|
|
6
|
-
import { isObj } from "./isObj";
|
|
7
|
-
const getReturnVariablesAs = (props, state) => {
|
|
8
|
-
return !!props.animation || state.resolveVariablesAs === "value" ? isWeb ? "non-color-value" : "value" : "auto";
|
|
9
|
-
};
|
|
10
|
-
const createPropMapper = (staticConfig) => {
|
|
11
|
-
const variants = staticConfig.variants || {};
|
|
12
|
-
const defaultProps = staticConfig.defaultProps || {};
|
|
13
|
-
const mapper = (key, value, theme, propsIn, state, avoidDefaultProps = false, debug) => {
|
|
14
|
-
const conf = getConfig();
|
|
15
|
-
if (!conf) {
|
|
16
|
-
console.trace("no conf! err");
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const props = state.fallbackProps || propsIn;
|
|
20
|
-
const returnVariablesAs = getReturnVariablesAs(props, state);
|
|
21
|
-
const fontFamily = props.fontFamily || defaultProps.fontFamily || "$body";
|
|
22
|
-
const variantValue = resolveVariants(key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, "", avoidDefaultProps);
|
|
23
|
-
if (variantValue) {
|
|
24
|
-
return variantValue;
|
|
25
|
-
}
|
|
26
|
-
let shouldReturn = value !== void 0 && value !== null;
|
|
27
|
-
if (conf.shorthands[key]) {
|
|
28
|
-
shouldReturn = true;
|
|
29
|
-
key = conf.shorthands[key];
|
|
30
|
-
}
|
|
31
|
-
if (value) {
|
|
32
|
-
if (value[0] === "$") {
|
|
33
|
-
value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs, debug);
|
|
34
|
-
} else if (isVariable(value)) {
|
|
35
|
-
value = getVariableValue(key, value, returnVariablesAs);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (shouldReturn) {
|
|
39
|
-
return expandStyle(key, value) || [[key, value]];
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
return mapper;
|
|
43
|
-
};
|
|
44
|
-
const resolveVariants = (key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps = false, debug) => {
|
|
45
|
-
var _a;
|
|
46
|
-
const variant = variants && variants[key];
|
|
47
|
-
if (variant && value !== void 0) {
|
|
48
|
-
let variantValue = getVariantDefinition(variant, key, value);
|
|
49
|
-
if (variantValue) {
|
|
50
|
-
if (typeof variantValue === "function") {
|
|
51
|
-
const fn = variantValue;
|
|
52
|
-
variantValue = fn(value, getVariantExtras(props, theme, defaultProps, avoidDefaultProps));
|
|
53
|
-
}
|
|
54
|
-
if (isObj(variantValue)) {
|
|
55
|
-
variantValue = resolveTokensAndVariants(key, variantValue, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps, debug);
|
|
56
|
-
}
|
|
57
|
-
return Object.entries(expandStyles(variantValue));
|
|
58
|
-
} else {
|
|
59
|
-
if (process.env.NODE_ENV === "development") {
|
|
60
|
-
if ((_a = staticConfig.validStyles) == null ? void 0 : _a[key]) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
if (value === false) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
const name = staticConfig.componentName || "[UnnamedComponent]";
|
|
67
|
-
console.warn(`No variant found: ${name} has variant "${key}", but no matching value "${value}"`);
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const resolveTokensAndVariants = (key, value, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, parentVariantKey, avoidDefaultProps, debug) => {
|
|
74
|
-
var _a;
|
|
75
|
-
let res = {};
|
|
76
|
-
for (const rKey in value) {
|
|
77
|
-
const fKey = conf.shorthands[rKey] || rKey;
|
|
78
|
-
const val = value[rKey];
|
|
79
|
-
if (isVariable(val)) {
|
|
80
|
-
res[fKey] = !isWeb || returnVariablesAs === "value" ? val.val : val.variable;
|
|
81
|
-
} else if (variants[fKey]) {
|
|
82
|
-
if (parentVariantKey === key) {
|
|
83
|
-
res[fKey] = val;
|
|
84
|
-
} else {
|
|
85
|
-
res = {
|
|
86
|
-
...res,
|
|
87
|
-
...Object.fromEntries(resolveVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps, debug))
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
} else if (typeof val === "string") {
|
|
91
|
-
const fVal = val[0] === "$" ? getToken(fKey, val, conf, theme, fontFamily, returnVariablesAs, debug) : val;
|
|
92
|
-
res[fKey] = fVal;
|
|
93
|
-
} else {
|
|
94
|
-
if (isObj(val)) {
|
|
95
|
-
res[fKey] = resolveTokensAndVariants(fKey, val, props, defaultProps, theme, variants, fontFamily, conf, returnVariablesAs, staticConfig, key, avoidDefaultProps, debug);
|
|
96
|
-
} else {
|
|
97
|
-
res[fKey] = value[fKey];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (process.env.NODE_ENV === "development") {
|
|
101
|
-
if (((_a = res[fKey]) == null ? void 0 : _a[0]) === "$") {
|
|
102
|
-
console.warn(`\u26A0\uFE0F Missing token in theme ${theme.name}:`, fKey, res[fKey]);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return res;
|
|
107
|
-
};
|
|
108
|
-
function getVariantDefinition(variant, key, value) {
|
|
109
|
-
if (typeof variant === "function") {
|
|
110
|
-
return variant;
|
|
111
|
-
}
|
|
112
|
-
for (const cat in tokenCategories) {
|
|
113
|
-
if (key in tokenCategories[cat]) {
|
|
114
|
-
const spreadVariant = variant[`...${cat}`];
|
|
115
|
-
if (spreadVariant) {
|
|
116
|
-
return spreadVariant;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
let fn;
|
|
121
|
-
if (typeof value === "number") {
|
|
122
|
-
fn = variant[":number"];
|
|
123
|
-
} else if (typeof value === "string") {
|
|
124
|
-
fn = variant[":string"];
|
|
125
|
-
} else if (value === true || value === false) {
|
|
126
|
-
fn = variant[":boolean"];
|
|
127
|
-
}
|
|
128
|
-
fn = fn || variant[value];
|
|
129
|
-
return fn || variant["..."] || variant["...size"];
|
|
130
|
-
}
|
|
131
|
-
const fontShorthand = {
|
|
132
|
-
fontSize: "size",
|
|
133
|
-
fontWeight: "weight"
|
|
134
|
-
};
|
|
135
|
-
const getToken = (key, value, { tokensParsed, fontsParsed }, theme, fontFamily = "$body", resolveAs, debug) => {
|
|
136
|
-
var _a, _b, _c;
|
|
137
|
-
let valOrVar;
|
|
138
|
-
let hasSet = false;
|
|
139
|
-
if (theme[value]) {
|
|
140
|
-
valOrVar = theme[value];
|
|
141
|
-
hasSet = true;
|
|
142
|
-
} else {
|
|
143
|
-
switch (key) {
|
|
144
|
-
case "fontFamily":
|
|
145
|
-
valOrVar = ((_a = fontsParsed[value]) == null ? void 0 : _a.family) || value;
|
|
146
|
-
hasSet = true;
|
|
147
|
-
break;
|
|
148
|
-
case "fontSize":
|
|
149
|
-
case "lineHeight":
|
|
150
|
-
case "letterSpacing":
|
|
151
|
-
case "fontWeight":
|
|
152
|
-
valOrVar = ((_c = (_b = fontsParsed[fontFamily]) == null ? void 0 : _b[fontShorthand[key] || key]) == null ? void 0 : _c[value]) || value;
|
|
153
|
-
hasSet = true;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
for (const cat in tokenCategories) {
|
|
157
|
-
if (key in tokenCategories[cat]) {
|
|
158
|
-
const res = tokensParsed[cat][value];
|
|
159
|
-
if (res) {
|
|
160
|
-
valOrVar = res;
|
|
161
|
-
hasSet = true;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (!hasSet) {
|
|
166
|
-
const spaceVar = tokensParsed.space[value];
|
|
167
|
-
if (spaceVar) {
|
|
168
|
-
valOrVar = spaceVar;
|
|
169
|
-
hasSet = true;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (hasSet) {
|
|
174
|
-
return getVariableValue(key, valOrVar, resolveAs);
|
|
175
|
-
}
|
|
176
|
-
if (process.env.NODE_ENV === "development") {
|
|
177
|
-
if (value && value[0] === "$") {
|
|
178
|
-
console.warn(`\u26A0\uFE0F You've passed the value "${value}" to the style property "${key}", but there's no theme or token with the key "${value}". Using theme "${theme.name}".
|
|
179
|
-
|
|
180
|
-
Set the debug prop to true to see more detailed debug information.`);
|
|
181
|
-
if (debug) {
|
|
182
|
-
if (typeof window !== "undefined") {
|
|
183
|
-
console.log("Looked in:");
|
|
184
|
-
console.log("Theme:", theme);
|
|
185
|
-
console.log("Tokens:", tokensParsed);
|
|
186
|
-
console.log("Fonts:", fontsParsed);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return value;
|
|
193
|
-
};
|
|
194
|
-
function getVariableValue(key, valOrVar, resolveAs = "auto") {
|
|
195
|
-
if (isVariable(valOrVar)) {
|
|
196
|
-
if (resolveAs === "variable") {
|
|
197
|
-
return valOrVar;
|
|
198
|
-
}
|
|
199
|
-
if (resolveAs === "non-color-value") {
|
|
200
|
-
if (isWeb) {
|
|
201
|
-
if (key in tokenCategories.color) {
|
|
202
|
-
return valOrVar.variable;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return valOrVar.val;
|
|
206
|
-
}
|
|
207
|
-
if (!isWeb || resolveAs === "value") {
|
|
208
|
-
return valOrVar.val;
|
|
209
|
-
}
|
|
210
|
-
return valOrVar.variable;
|
|
211
|
-
}
|
|
212
|
-
return valOrVar;
|
|
213
|
-
}
|
|
214
|
-
const tokenCategories = {
|
|
215
|
-
radius: {
|
|
216
|
-
borderRadius: true,
|
|
217
|
-
borderTopLeftRadius: true,
|
|
218
|
-
borderTopRightRadius: true,
|
|
219
|
-
borderBottomLeftRadius: true,
|
|
220
|
-
borderBottomRightRadius: true
|
|
221
|
-
},
|
|
222
|
-
size: {
|
|
223
|
-
width: true,
|
|
224
|
-
height: true,
|
|
225
|
-
minWidth: true,
|
|
226
|
-
minHeight: true,
|
|
227
|
-
maxWidth: true,
|
|
228
|
-
maxHeight: true
|
|
229
|
-
},
|
|
230
|
-
color: {
|
|
231
|
-
color: true,
|
|
232
|
-
backgroundColor: true,
|
|
233
|
-
borderColor: true,
|
|
234
|
-
borderBottomColor: true,
|
|
235
|
-
borderTopColor: true,
|
|
236
|
-
borderLeftColor: true,
|
|
237
|
-
borderRightColor: true
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
export {
|
|
241
|
-
createPropMapper,
|
|
242
|
-
getReturnVariablesAs
|
|
243
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
function createShallowUpdate(setter) {
|
|
3
|
-
return useCallback((next) => {
|
|
4
|
-
setter((prev) => {
|
|
5
|
-
for (const key in next) {
|
|
6
|
-
if (prev[key] !== next[key]) {
|
|
7
|
-
return { ...prev, ...next };
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return prev;
|
|
11
|
-
});
|
|
12
|
-
}, [setter]);
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
createShallowUpdate
|
|
16
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { ButtonInsideButtonContext } from "../contexts/ButtonInsideButtonContext";
|
|
3
|
-
import { TextAncestorProvider } from "../views/TextAncestorContext";
|
|
4
|
-
import { ThemeProvider } from "../views/ThemeProvider";
|
|
5
|
-
function createTamaguiProvider(config) {
|
|
6
|
-
return function TamaguiProvider({
|
|
7
|
-
disableInjectCSS,
|
|
8
|
-
children,
|
|
9
|
-
...themePropsProvider
|
|
10
|
-
}) {
|
|
11
|
-
if (typeof document !== "undefined") {
|
|
12
|
-
React.useLayoutEffect(() => {
|
|
13
|
-
if (disableInjectCSS)
|
|
14
|
-
return;
|
|
15
|
-
const style = document.createElement("style");
|
|
16
|
-
style.appendChild(document.createTextNode(config.getCSS()));
|
|
17
|
-
document.head.appendChild(style);
|
|
18
|
-
return () => {
|
|
19
|
-
document.head.removeChild(style);
|
|
20
|
-
};
|
|
21
|
-
}, [disableInjectCSS]);
|
|
22
|
-
}
|
|
23
|
-
return <ButtonInsideButtonContext.Provider value={false}><TextAncestorProvider><ThemeProvider themes={config.themes} defaultTheme={config.defaultTheme || "light"} themeClassNameOnRoot={config.themeClassNameOnRoot} disableRootThemeClass={config.disableRootThemeClass} {...themePropsProvider}>{children}</ThemeProvider></TextAncestorProvider></ButtonInsideButtonContext.Provider>;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
createTamaguiProvider
|
|
28
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { stylePropsView } from "@tamagui/helpers";
|
|
2
|
-
import { createPropMapper } from "./createPropMapper";
|
|
3
|
-
import { mergeProps } from "./mergeProps";
|
|
4
|
-
function extendStaticConfig(config, parent) {
|
|
5
|
-
var _a;
|
|
6
|
-
if (!parent || !("staticConfig" in parent)) {
|
|
7
|
-
return parseStaticConfig(config);
|
|
8
|
-
}
|
|
9
|
-
const parentStaticConf = parent.staticConfig;
|
|
10
|
-
const variants = {
|
|
11
|
-
...parentStaticConf.variants
|
|
12
|
-
};
|
|
13
|
-
if (config.variants) {
|
|
14
|
-
for (const key in config.variants) {
|
|
15
|
-
if (variants[key]) {
|
|
16
|
-
variants[key] = {
|
|
17
|
-
...variants[key],
|
|
18
|
-
...config.variants[key]
|
|
19
|
-
};
|
|
20
|
-
} else {
|
|
21
|
-
variants[key] = config.variants[key];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const parentNames = [...parentStaticConf.parentNames || []];
|
|
26
|
-
if (parentStaticConf.componentName) {
|
|
27
|
-
parentNames.push(parentStaticConf.componentName);
|
|
28
|
-
}
|
|
29
|
-
return parseStaticConfig({
|
|
30
|
-
...parentStaticConf,
|
|
31
|
-
...config,
|
|
32
|
-
variants,
|
|
33
|
-
parentNames,
|
|
34
|
-
isZStack: config.isZStack || parentStaticConf.isZStack,
|
|
35
|
-
isText: config.isText || parentStaticConf.isText || false,
|
|
36
|
-
isInput: config.isInput || parentStaticConf.isInput || false,
|
|
37
|
-
neverFlatten: config.neverFlatten || parentStaticConf.neverFlatten,
|
|
38
|
-
ensureOverriddenProp: (_a = config.ensureOverriddenProp) != null ? _a : parentStaticConf.ensureOverriddenProp,
|
|
39
|
-
validStyles: config.validStyles ? {
|
|
40
|
-
...parentStaticConf.validStyles,
|
|
41
|
-
...config.validStyles
|
|
42
|
-
} : parentStaticConf.validStyles || stylePropsView,
|
|
43
|
-
defaultProps: mergeProps({
|
|
44
|
-
...parentStaticConf.defaultProps,
|
|
45
|
-
...parentStaticConf.defaultVariants
|
|
46
|
-
}, {
|
|
47
|
-
...config.defaultProps,
|
|
48
|
-
...config.defaultVariants
|
|
49
|
-
})
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const parseStaticConfig = (config) => {
|
|
53
|
-
return {
|
|
54
|
-
...config,
|
|
55
|
-
parsed: true,
|
|
56
|
-
propMapper: createPropMapper(config)
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
export {
|
|
60
|
-
extendStaticConfig,
|
|
61
|
-
parseStaticConfig
|
|
62
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const matchRgbaHsla = /(rgba|hsla)\(\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,})\s*\)$/;
|
|
2
|
-
function fixNativeShadow(props) {
|
|
3
|
-
var _a, _b;
|
|
4
|
-
if (!props.shadowColor || props.shadowColor === "transparent") {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
if (!props.shadowOffset) {
|
|
8
|
-
props.shadowOffset = {
|
|
9
|
-
width: 0,
|
|
10
|
-
height: 0
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const c = String(props.shadowColor);
|
|
14
|
-
if ((c[0] === "r" || c[0] === "h") && c[3] === "a") {
|
|
15
|
-
const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || [];
|
|
16
|
-
if (typeof a !== "string") {
|
|
17
|
-
console.trace("invalid", c, type);
|
|
18
|
-
throw new Error(`invalid style`);
|
|
19
|
-
}
|
|
20
|
-
props.shadowColor = `${type.replace("a", "")}(${_1},${_2},${_3})`;
|
|
21
|
-
props.shadowOpacity = (_a = props.shadowOpacity) != null ? _a : +a;
|
|
22
|
-
} else {
|
|
23
|
-
props.shadowOpacity = (_b = props.shadowOpacity) != null ? _b : 1;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
fixNativeShadow
|
|
28
|
-
};
|