@tamagui/core 1.0.1-beta.93 → 1.0.1-beta.94
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/createComponent.js +39 -49
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +24 -17
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/expandStyle.js +120 -0
- package/dist/cjs/helpers/expandStyle.js.map +7 -0
- package/dist/cjs/helpers/expandStyles.js +126 -0
- package/dist/cjs/helpers/expandStyles.js.map +7 -0
- package/dist/cjs/helpers/extendStaticConfig.js +5 -3
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/{getTextSize.js → getFont.js} +14 -8
- package/dist/cjs/helpers/getFont.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +32 -33
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +165 -4
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/normalizeColor.js +76 -0
- package/dist/cjs/helpers/normalizeColor.js.map +7 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js +90 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/cjs/hooks/useFeatures.js +5 -2
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +1 -1
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/static.js +1 -1
- package/dist/cjs/static.js.map +2 -2
- package/dist/esm/createComponent.js +39 -49
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +22 -15
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/expandStyle.js +99 -0
- package/dist/esm/helpers/expandStyle.js.map +7 -0
- package/dist/esm/helpers/expandStyles.js +103 -0
- package/dist/esm/helpers/expandStyles.js.map +7 -0
- package/dist/esm/helpers/extendStaticConfig.js +5 -3
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/{getTextSize.js → getFont.js} +10 -4
- package/dist/esm/helpers/getFont.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +33 -33
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +158 -2
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/normalizeColor.js +49 -0
- package/dist/esm/helpers/normalizeColor.js.map +7 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js +67 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/esm/hooks/useFeatures.js +5 -2
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +1 -1
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +2 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/static.js +1 -1
- package/dist/esm/static.js.map +1 -1
- package/package.json +7 -7
- package/reset.css +1 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +2 -2
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/expandStyle.d.ts +2 -0
- package/types/helpers/expandStyle.d.ts.map +1 -0
- package/types/helpers/expandStyles.d.ts +7 -0
- package/types/helpers/expandStyles.d.ts.map +1 -0
- package/types/helpers/extendStaticConfig.d.ts.map +1 -1
- package/types/helpers/getFont.d.ts +3 -0
- package/types/helpers/getFont.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +2 -3
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts +6 -0
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/normalizeColor.d.ts +3 -0
- package/types/helpers/normalizeColor.d.ts.map +1 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +2 -0
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -0
- package/types/hooks/useFeatures.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
- package/types/static.d.ts +1 -1
- package/types/static.d.ts.map +1 -1
- package/dist/cjs/helpers/fixNativeShadow.native.js +0 -51
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/cjs/helpers/generateAtomicStyles.js +0 -442
- package/dist/cjs/helpers/generateAtomicStyles.js.map +0 -7
- package/dist/cjs/helpers/getTextSize.js.map +0 -7
- package/dist/esm/helpers/fixNativeShadow.native.js +0 -28
- package/dist/esm/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/esm/helpers/generateAtomicStyles.js +0 -415
- package/dist/esm/helpers/generateAtomicStyles.js.map +0 -7
- package/dist/esm/helpers/getTextSize.js.map +0 -7
- package/types/helpers/fixNativeShadow.native.d.ts +0 -3
- package/types/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/types/helpers/generateAtomicStyles.d.ts +0 -12
- package/types/helpers/generateAtomicStyles.d.ts.map +0 -1
- package/types/helpers/getTextSize.d.ts +0 -3
- package/types/helpers/getTextSize.d.ts.map +0 -1
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { simpleHash } from "@tamagui/helpers";
|
|
18
|
-
import hyphenateStyleName from "hyphenate-style-name";
|
|
19
|
-
import normalizeCSSColor from "normalize-css-color";
|
|
20
|
-
import { getConfig } from "../conf";
|
|
21
|
-
import { isWeb } from "../constants/platform";
|
|
22
|
-
import { reversedShorthands } from "../createTamagui";
|
|
23
|
-
import { pseudoDescriptors } from "./pseudoDescriptors";
|
|
24
|
-
class Cache {
|
|
25
|
-
constructor() {
|
|
26
|
-
this.values = {};
|
|
27
|
-
}
|
|
28
|
-
get(key, valStr) {
|
|
29
|
-
var _a;
|
|
30
|
-
return (_a = this.values[key]) == null ? void 0 : _a[valStr];
|
|
31
|
-
}
|
|
32
|
-
set(key, valStr, object) {
|
|
33
|
-
this.values[key] ??= {};
|
|
34
|
-
this.values[key][valStr] = object;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const cache = new Cache();
|
|
38
|
-
const generateAtomicStyles = (style, pseudo) => {
|
|
39
|
-
const res = expandStyles(style);
|
|
40
|
-
const out = [];
|
|
41
|
-
for (const key in res) {
|
|
42
|
-
const value = res[key];
|
|
43
|
-
if (value != null && value != void 0) {
|
|
44
|
-
const valueString = normalizeValueWithProperty(value, key);
|
|
45
|
-
const uid = key + ((pseudo == null ? void 0 : pseudo.name) || "");
|
|
46
|
-
const cachedResult = cache.get(uid, valueString);
|
|
47
|
-
if (cachedResult != void 0) {
|
|
48
|
-
out.push(cachedResult);
|
|
49
|
-
} else {
|
|
50
|
-
const hash = simpleHash(uid + valueString);
|
|
51
|
-
const pseudoPrefix = pseudo ? `0${pseudo.name}-` : "";
|
|
52
|
-
const shortProp = reversedShorthands[key] || key;
|
|
53
|
-
const identifier = `_${shortProp}-${pseudoPrefix}${hash}`;
|
|
54
|
-
const rules = createAtomicRules(identifier, key, valueString, pseudo);
|
|
55
|
-
const styleObject = {
|
|
56
|
-
property: key,
|
|
57
|
-
pseudo: pseudo == null ? void 0 : pseudo.name,
|
|
58
|
-
value,
|
|
59
|
-
identifier,
|
|
60
|
-
rules
|
|
61
|
-
};
|
|
62
|
-
cache.set(uid, valueString, styleObject);
|
|
63
|
-
out.push(styleObject);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return out;
|
|
68
|
-
};
|
|
69
|
-
const reducedStyleKeys = {
|
|
70
|
-
shadowColor: true,
|
|
71
|
-
shadowOffset: true,
|
|
72
|
-
shadowOpacity: true,
|
|
73
|
-
shadowRadius: true,
|
|
74
|
-
textShadowColor: true,
|
|
75
|
-
textShadowOffset: true,
|
|
76
|
-
textShadowRadius: true
|
|
77
|
-
};
|
|
78
|
-
let shorthands = null;
|
|
79
|
-
function expandStyles(style) {
|
|
80
|
-
const res = {};
|
|
81
|
-
if (process.env.TAMAGUI_TARGET === "web") {
|
|
82
|
-
const { boxShadow, shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style;
|
|
83
|
-
if (shadowRadius !== void 0) {
|
|
84
|
-
const { height, width } = shadowOffset || defaultOffset;
|
|
85
|
-
const offsetX = normalizeValueWithProperty(width || 0);
|
|
86
|
-
const offsetY = normalizeValueWithProperty(height || 0);
|
|
87
|
-
const blurRadius = normalizeValueWithProperty(shadowRadius || 0);
|
|
88
|
-
const color = normalizeColor(String(shadowColor || "black"), shadowOpacity);
|
|
89
|
-
const shadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`;
|
|
90
|
-
res.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow;
|
|
91
|
-
} else if (boxShadow) {
|
|
92
|
-
res.boxShadow = boxShadow;
|
|
93
|
-
}
|
|
94
|
-
const { textShadowColor, textShadowOffset, textShadowRadius } = style;
|
|
95
|
-
if (textShadowColor || textShadowOffset || textShadowRadius) {
|
|
96
|
-
const { height, width } = textShadowOffset || defaultOffset;
|
|
97
|
-
const radius = textShadowRadius || 0;
|
|
98
|
-
const color = normalizeValueWithProperty(textShadowColor, "textShadowColor");
|
|
99
|
-
if (color && (height !== 0 || width !== 0 || radius !== 0)) {
|
|
100
|
-
const blurRadius = normalizeValueWithProperty(radius);
|
|
101
|
-
const offsetX = normalizeValueWithProperty(width);
|
|
102
|
-
const offsetY = normalizeValueWithProperty(height);
|
|
103
|
-
res.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
for (const key in borderDefaults) {
|
|
107
|
-
if (key in style) {
|
|
108
|
-
res[borderDefaults[key]] = style[borderDefaults[key]] || "solid";
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
for (let key in style) {
|
|
113
|
-
shorthands = shorthands || getConfig().shorthands;
|
|
114
|
-
if (shorthands) {
|
|
115
|
-
key = shorthands[key] || key;
|
|
116
|
-
}
|
|
117
|
-
if (reducedStyleKeys[key])
|
|
118
|
-
continue;
|
|
119
|
-
if (key in pseudoDescriptors) {
|
|
120
|
-
res[key] = expandStyles(style[key]);
|
|
121
|
-
} else {
|
|
122
|
-
const val = normalizeValueWithProperty(style[key], key);
|
|
123
|
-
const out = expandStyle(key, val);
|
|
124
|
-
if (out) {
|
|
125
|
-
Object.assign(res, Object.fromEntries(out));
|
|
126
|
-
} else {
|
|
127
|
-
res[key] = val;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return res;
|
|
132
|
-
}
|
|
133
|
-
const borderDefaults = {
|
|
134
|
-
borderWidth: "borderStyle",
|
|
135
|
-
borderBottomWidth: "borderBottomStyle",
|
|
136
|
-
borderTopWidth: "borderTopStyle",
|
|
137
|
-
borderLeftWidth: "borderLeftStyle",
|
|
138
|
-
borderRightWidth: "borderRightStyle"
|
|
139
|
-
};
|
|
140
|
-
function createDeclarationBlock(style, important = false) {
|
|
141
|
-
let declarations = "";
|
|
142
|
-
for (const key in style) {
|
|
143
|
-
const prop = hyphenateStyleName(key);
|
|
144
|
-
const value = style[key];
|
|
145
|
-
declarations += `${prop}:${value}`;
|
|
146
|
-
}
|
|
147
|
-
return `{${declarations}${important ? ` !important` : ""};}`;
|
|
148
|
-
}
|
|
149
|
-
const pseudoSelectorPrefixes = (() => {
|
|
150
|
-
const res = {};
|
|
151
|
-
for (const key in pseudoDescriptors) {
|
|
152
|
-
const pseudo = pseudoDescriptors[key];
|
|
153
|
-
res[pseudo.name] = [...Array(pseudo.priority)].map(() => ":root").join("") + " ";
|
|
154
|
-
}
|
|
155
|
-
return res;
|
|
156
|
-
})();
|
|
157
|
-
function createAtomicRules(identifier, property, value, pseudo) {
|
|
158
|
-
const selector = pseudo ? `${pseudoSelectorPrefixes[pseudo.name]} .${identifier}:${pseudo.name}` : `.${identifier}`;
|
|
159
|
-
const important = !!pseudo;
|
|
160
|
-
let rules = [];
|
|
161
|
-
switch (property) {
|
|
162
|
-
case "placeholderTextColor": {
|
|
163
|
-
const block = createDeclarationBlock({ color: value, opacity: 1 }, important);
|
|
164
|
-
rules.push(`${selector}::placeholder${block}`);
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
case "pointerEvents": {
|
|
168
|
-
let finalValue = value;
|
|
169
|
-
if (value === "auto" || value === "box-only") {
|
|
170
|
-
finalValue = "auto!important";
|
|
171
|
-
if (value === "box-only") {
|
|
172
|
-
const block2 = createDeclarationBlock({ pointerEvents: "none" }, important);
|
|
173
|
-
rules.push(`${selector}>*${block2}`);
|
|
174
|
-
}
|
|
175
|
-
} else if (value === "none" || value === "box-none") {
|
|
176
|
-
finalValue = "none!important";
|
|
177
|
-
if (value === "box-none") {
|
|
178
|
-
const block2 = createDeclarationBlock({ pointerEvents: "auto" }, important);
|
|
179
|
-
rules.push(`${selector}>*${block2}`);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
const block = createDeclarationBlock({ pointerEvents: finalValue }, important);
|
|
183
|
-
rules.push(`${selector}${block}`);
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
case "scrollbarWidth": {
|
|
187
|
-
if (value === "none") {
|
|
188
|
-
rules.push(`${selector}::-webkit-scrollbar{display:none}`);
|
|
189
|
-
}
|
|
190
|
-
const block = createDeclarationBlock({ scrollbarWidth: value }, important);
|
|
191
|
-
rules.push(`${selector}${block}`);
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
default: {
|
|
195
|
-
const block = createDeclarationBlock({ [property]: value }, important);
|
|
196
|
-
rules.push(`${selector}${block}`);
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if ((pseudo == null ? void 0 : pseudo.name) === "hover") {
|
|
201
|
-
rules = rules.map((r) => `@media not all and (hover: none) { ${r} }`);
|
|
202
|
-
}
|
|
203
|
-
return rules;
|
|
204
|
-
}
|
|
205
|
-
function expandStyle(key, value) {
|
|
206
|
-
if (process.env.TAMAGUI_TARGET !== "web") {
|
|
207
|
-
return [[key, value]];
|
|
208
|
-
}
|
|
209
|
-
if (key === "flex") {
|
|
210
|
-
if (value <= -1) {
|
|
211
|
-
return [
|
|
212
|
-
["flexGrow", 0],
|
|
213
|
-
["flexShrink", 1],
|
|
214
|
-
["flexBasis", "auto"]
|
|
215
|
-
];
|
|
216
|
-
}
|
|
217
|
-
if (value >= 0) {
|
|
218
|
-
return [
|
|
219
|
-
["flexGrow", value],
|
|
220
|
-
["flexShrink", 1]
|
|
221
|
-
];
|
|
222
|
-
}
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
switch (key) {
|
|
226
|
-
case "elevation":
|
|
227
|
-
case "overlayColor":
|
|
228
|
-
case "resizeMode":
|
|
229
|
-
case "tintColor": {
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
case "aspectRatio": {
|
|
233
|
-
return [[key, value.toString()]];
|
|
234
|
-
}
|
|
235
|
-
case "backgroundClip": {
|
|
236
|
-
if (value === "text") {
|
|
237
|
-
return [
|
|
238
|
-
["backgroundClip", value],
|
|
239
|
-
["WebkitBackgroundClip", value]
|
|
240
|
-
];
|
|
241
|
-
}
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
case "textAlignVertical": {
|
|
245
|
-
return [["verticalAlign", value === "center" ? "middle" : value]];
|
|
246
|
-
}
|
|
247
|
-
case "textDecorationLine": {
|
|
248
|
-
return [["textDecorationLine", value]];
|
|
249
|
-
}
|
|
250
|
-
case "transform": {
|
|
251
|
-
if (Array.isArray(value)) {
|
|
252
|
-
return [[key, value.map(mapTransform).join(" ")]];
|
|
253
|
-
}
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
case "writingDirection": {
|
|
257
|
-
return [["direction", value]];
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
const longKey = STYLE_SHORT_FORM_EXPANSIONS[key];
|
|
261
|
-
if (longKey) {
|
|
262
|
-
return longKey.map((key2) => {
|
|
263
|
-
return [key2, value];
|
|
264
|
-
});
|
|
265
|
-
} else {
|
|
266
|
-
if (Array.isArray(value)) {
|
|
267
|
-
return [[key, value.join(",")]];
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
const mapTransform = (transform) => {
|
|
272
|
-
const type = Object.keys(transform)[0];
|
|
273
|
-
const value = transform[type];
|
|
274
|
-
if (type === "matrix" || type === "matrix3d") {
|
|
275
|
-
return `${type}(${value.join(",")})`;
|
|
276
|
-
} else {
|
|
277
|
-
const normalizedValue = normalizeValueWithProperty(value, type);
|
|
278
|
-
return `${type}(${normalizedValue})`;
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
const colorProps = {
|
|
282
|
-
backgroundColor: true,
|
|
283
|
-
borderColor: true,
|
|
284
|
-
borderTopColor: true,
|
|
285
|
-
borderRightColor: true,
|
|
286
|
-
borderBottomColor: true,
|
|
287
|
-
borderLeftColor: true,
|
|
288
|
-
color: true,
|
|
289
|
-
shadowColor: true,
|
|
290
|
-
textDecorationColor: true,
|
|
291
|
-
textShadowColor: true
|
|
292
|
-
};
|
|
293
|
-
function normalizeValueWithProperty(value, property) {
|
|
294
|
-
if (process.env.TAMAGUI_TARGET === "web") {
|
|
295
|
-
const shouldCoerceToPx = typeof value === "number" && (property === void 0 || property === null || !unitlessNumbers[property]);
|
|
296
|
-
if (shouldCoerceToPx) {
|
|
297
|
-
return `${value}px`;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if (property && colorProps[property]) {
|
|
301
|
-
return normalizeColor(value);
|
|
302
|
-
}
|
|
303
|
-
return value;
|
|
304
|
-
}
|
|
305
|
-
const normalizeColor = (color, opacity = 1) => {
|
|
306
|
-
if (color == null || color == void 0) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
if (process.env.TAMAGUI_TARGET === "web") {
|
|
310
|
-
if (typeof color === "string" && isWebColor(color)) {
|
|
311
|
-
return color;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
const colorInt = processColor(color);
|
|
315
|
-
if (colorInt != null) {
|
|
316
|
-
const r = colorInt >> 16 & 255;
|
|
317
|
-
const g = colorInt >> 8 & 255;
|
|
318
|
-
const b = colorInt & 255;
|
|
319
|
-
const a = (colorInt >> 24 & 255) / 255;
|
|
320
|
-
const alpha = (a * opacity).toFixed(2);
|
|
321
|
-
return `rgba(${r},${g},${b},${alpha})`;
|
|
322
|
-
}
|
|
323
|
-
return `${color}`;
|
|
324
|
-
};
|
|
325
|
-
const webColors = {
|
|
326
|
-
currentColor: true,
|
|
327
|
-
currentcolor: true,
|
|
328
|
-
transparent: true,
|
|
329
|
-
inherit: true
|
|
330
|
-
};
|
|
331
|
-
const isWebColor = (color) => webColors[color] || color.indexOf("var(") === 0;
|
|
332
|
-
const processColor = (color) => {
|
|
333
|
-
if (color === void 0 || color === null) {
|
|
334
|
-
return color;
|
|
335
|
-
}
|
|
336
|
-
let intColor = normalizeCSSColor(color);
|
|
337
|
-
if (intColor === void 0 || intColor === null) {
|
|
338
|
-
return void 0;
|
|
339
|
-
}
|
|
340
|
-
return (+intColor << 24 | +intColor >>> 8) >>> 0;
|
|
341
|
-
};
|
|
342
|
-
const unitlessNumbers = {
|
|
343
|
-
animationIterationCount: true,
|
|
344
|
-
aspectRatio: true,
|
|
345
|
-
borderImageOutset: true,
|
|
346
|
-
borderImageSlice: true,
|
|
347
|
-
borderImageWidth: true,
|
|
348
|
-
boxFlex: true,
|
|
349
|
-
boxFleGroup: true,
|
|
350
|
-
boxOrdinalGroup: true,
|
|
351
|
-
columnCount: true,
|
|
352
|
-
flex: true,
|
|
353
|
-
flexGrow: true,
|
|
354
|
-
flexOrder: true,
|
|
355
|
-
flexPositive: true,
|
|
356
|
-
flexShrink: true,
|
|
357
|
-
flexNegative: true,
|
|
358
|
-
fontWeight: true,
|
|
359
|
-
gridRow: true,
|
|
360
|
-
gridRowEnd: true,
|
|
361
|
-
gridRowGap: true,
|
|
362
|
-
gridRowStart: true,
|
|
363
|
-
gridColumn: true,
|
|
364
|
-
gridColumnEnd: true,
|
|
365
|
-
gridColumnGap: true,
|
|
366
|
-
gridColumnStart: true,
|
|
367
|
-
lineClamp: true,
|
|
368
|
-
opacity: true,
|
|
369
|
-
order: true,
|
|
370
|
-
orphans: true,
|
|
371
|
-
tabSize: true,
|
|
372
|
-
widows: true,
|
|
373
|
-
zIndex: true,
|
|
374
|
-
zoom: true,
|
|
375
|
-
fillOpacity: true,
|
|
376
|
-
floodOpacity: true,
|
|
377
|
-
stopOpacity: true,
|
|
378
|
-
strokeDasharray: true,
|
|
379
|
-
strokeDashoffset: true,
|
|
380
|
-
strokeMiterlimit: true,
|
|
381
|
-
strokeOpacity: true,
|
|
382
|
-
strokeWidth: true,
|
|
383
|
-
scale: true,
|
|
384
|
-
scaleX: true,
|
|
385
|
-
scaleY: true,
|
|
386
|
-
scaleZ: true,
|
|
387
|
-
shadowOpacity: true
|
|
388
|
-
};
|
|
389
|
-
const defaultOffset = { height: 0, width: 0 };
|
|
390
|
-
const STYLE_SHORT_FORM_EXPANSIONS = __spreadValues({
|
|
391
|
-
borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
|
|
392
|
-
borderRadius: [
|
|
393
|
-
"borderTopLeftRadius",
|
|
394
|
-
"borderTopRightRadius",
|
|
395
|
-
"borderBottomRightRadius",
|
|
396
|
-
"borderBottomLeftRadius"
|
|
397
|
-
],
|
|
398
|
-
borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
|
|
399
|
-
borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
|
|
400
|
-
margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
|
|
401
|
-
marginHorizontal: ["marginRight", "marginLeft"],
|
|
402
|
-
marginVertical: ["marginTop", "marginBottom"],
|
|
403
|
-
overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
|
|
404
|
-
padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
|
|
405
|
-
paddingHorizontal: ["paddingRight", "paddingLeft"],
|
|
406
|
-
paddingVertical: ["paddingTop", "paddingBottom"]
|
|
407
|
-
}, isWeb && {
|
|
408
|
-
overflow: ["overflowX", "overflowY"]
|
|
409
|
-
});
|
|
410
|
-
export {
|
|
411
|
-
expandStyle,
|
|
412
|
-
expandStyles,
|
|
413
|
-
generateAtomicStyles
|
|
414
|
-
};
|
|
415
|
-
//# sourceMappingURL=generateAtomicStyles.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/generateAtomicStyles.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { StyleObject, simpleHash } from '@tamagui/helpers'\nimport hyphenateStyleName from 'hyphenate-style-name'\nimport normalizeCSSColor from 'normalize-css-color'\nimport { TextStyle, ViewStyle } from 'react-native'\n\nimport { getConfig } from '../conf'\nimport { isWeb } from '../constants/platform'\nimport { reversedShorthands } from '../createTamagui'\nimport { PseudoDescriptor, pseudoDescriptors } from './pseudoDescriptors'\n\ntype Value = Object | Array<any> | string | number\nexport type Style = { [key: string]: Value }\n\nclass Cache {\n values: Record<string, any> = {}\n\n get(key: string, valStr: string) {\n return this.values[key]?.[valStr]\n }\n\n set(key: string, valStr: string, object: any) {\n this.values[key] ??= {}\n this.values[key][valStr] = object\n }\n}\n\nconst cache = new Cache()\n\nexport const generateAtomicStyles = (\n style: ViewStyle & TextStyle,\n pseudo?: PseudoDescriptor\n): StyleObject[] => {\n const res = expandStyles(style)\n const out: StyleObject[] = []\n for (const key in res) {\n const value = res[key]\n if (value != null && value != undefined) {\n const valueString = normalizeValueWithProperty(value, key)\n const uid = key + (pseudo?.name || '')\n const cachedResult = cache.get(uid, valueString)\n if (cachedResult != undefined) {\n out.push(cachedResult)\n } else {\n const hash = simpleHash(uid + valueString)\n const pseudoPrefix = pseudo ? `0${pseudo.name}-` : ''\n const shortProp = reversedShorthands[key] || key\n const identifier = `_${shortProp}-${pseudoPrefix}${hash}`\n const rules = createAtomicRules(identifier, key, valueString, pseudo)\n const styleObject: StyleObject = {\n property: key,\n pseudo: pseudo?.name,\n value,\n identifier,\n rules,\n }\n cache.set(uid, valueString, styleObject)\n out.push(styleObject)\n }\n }\n }\n return out\n}\n\nconst reducedStyleKeys = {\n shadowColor: true,\n shadowOffset: true,\n shadowOpacity: true,\n shadowRadius: true,\n textShadowColor: true,\n textShadowOffset: true,\n textShadowRadius: true,\n}\n\nlet shorthands: Record<string, string> | null = null\n\n// can likely remove this and include in other loops\nexport function expandStyles(style: any) {\n const res: Record<string, any> = {}\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n // box-shadow\n const { boxShadow, shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style\n if (shadowRadius !== undefined) {\n const { height, width } = shadowOffset || defaultOffset\n const offsetX = normalizeValueWithProperty(width || 0)\n const offsetY = normalizeValueWithProperty(height || 0)\n const blurRadius = normalizeValueWithProperty(shadowRadius || 0)\n const color = normalizeColor(String(shadowColor || 'black'), shadowOpacity)\n const shadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`\n res.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow\n } else if (boxShadow) {\n res.boxShadow = boxShadow\n }\n\n // text-shadow\n const { textShadowColor, textShadowOffset, textShadowRadius } = style\n if (textShadowColor || textShadowOffset || textShadowRadius) {\n const { height, width } = textShadowOffset || defaultOffset\n const radius = textShadowRadius || 0\n const color = normalizeValueWithProperty(textShadowColor, 'textShadowColor')\n if (color && (height !== 0 || width !== 0 || radius !== 0)) {\n const blurRadius = normalizeValueWithProperty(radius)\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n res.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n }\n\n // ensure border style set by default to solid\n for (const key in borderDefaults) {\n if (key in style) {\n res[borderDefaults[key]] = style[borderDefaults[key]] || 'solid'\n }\n }\n }\n\n for (let key in style) {\n shorthands = shorthands || getConfig().shorthands\n if (shorthands) {\n key = shorthands[key] || key\n }\n if (reducedStyleKeys[key]) continue\n if (key in pseudoDescriptors) {\n res[key] = expandStyles(style[key])\n } else {\n const val = normalizeValueWithProperty(style[key], key)\n const out = expandStyle(key, val)\n if (out) {\n Object.assign(res, Object.fromEntries(out))\n } else {\n res[key] = val\n }\n }\n }\n\n return res\n}\n\nconst borderDefaults = {\n borderWidth: 'borderStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderTopWidth: 'borderTopStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n}\n\nfunction createDeclarationBlock(style: Style, important = false) {\n let declarations = ''\n for (const key in style) {\n const prop = hyphenateStyleName(key)\n const value = style[key]\n declarations += `${prop}:${value}`\n }\n return `{${declarations}${important ? ` !important` : ''};}`\n}\n\nconst pseudoSelectorPrefixes = (() => {\n const res: Record<string, string> = {}\n for (const key in pseudoDescriptors) {\n const pseudo = pseudoDescriptors[key]\n res[pseudo.name] = [...Array(pseudo.priority)].map(() => ':root').join('') + ' '\n }\n return res\n})()\n\nfunction createAtomicRules(\n identifier: string,\n property: string,\n value: any,\n pseudo?: PseudoDescriptor\n): string[] {\n const selector = pseudo\n ? `${pseudoSelectorPrefixes[pseudo.name]} .${identifier}:${pseudo.name}`\n : `.${identifier}`\n const important = !!pseudo\n\n let rules: string[] = []\n\n // Handle non-standard properties and object values that require multiple\n // CSS rules to be created.\n switch (property) {\n // Equivalent to using '::placeholder'\n case 'placeholderTextColor': {\n const block = createDeclarationBlock({ color: value, opacity: 1 }, important)\n rules.push(`${selector}::placeholder${block}`)\n break\n }\n\n // Polyfill for additional 'pointer-events' values\n // See d13f78622b233a0afc0c7a200c0a0792c8ca9e58\n case 'pointerEvents': {\n let finalValue = value\n if (value === 'auto' || value === 'box-only') {\n finalValue = 'auto!important'\n if (value === 'box-only') {\n const block = createDeclarationBlock({ pointerEvents: 'none' }, important)\n rules.push(`${selector}>*${block}`)\n }\n } else if (value === 'none' || value === 'box-none') {\n finalValue = 'none!important'\n if (value === 'box-none') {\n const block = createDeclarationBlock({ pointerEvents: 'auto' }, important)\n rules.push(`${selector}>*${block}`)\n }\n }\n const block = createDeclarationBlock({ pointerEvents: finalValue }, important)\n rules.push(`${selector}${block}`)\n break\n }\n\n // Polyfill for draft spec\n // https://drafts.csswg.org/css-scrollbars-1/\n case 'scrollbarWidth': {\n if (value === 'none') {\n rules.push(`${selector}::-webkit-scrollbar{display:none}`)\n }\n const block = createDeclarationBlock({ scrollbarWidth: value }, important)\n rules.push(`${selector}${block}`)\n break\n }\n\n default: {\n const block = createDeclarationBlock({ [property]: value }, important)\n rules.push(`${selector}${block}`)\n break\n }\n }\n\n // hover styles need to be conditional\n // perhaps this can be generalized but for now lets just shortcut\n // and hardcode for hover styles, if we need to later we can\n // WEIRD SYNTAX, SEE:\n // https://stackoverflow.com/questions/40532204/media-query-for-devices-supporting-hover\n if (pseudo?.name === 'hover') {\n rules = rules.map((r) => `@media not all and (hover: none) { ${r} }`)\n }\n\n return rules\n}\n\nexport function expandStyle(key: string, value: any) {\n if (process.env.TAMAGUI_TARGET !== 'web') {\n return [[key, value]]\n }\n\n if (key === 'flex') {\n // The 'flex' property value in React Native must be a positive integer,\n // 0, or -1.\n if (value <= -1) {\n return [\n ['flexGrow', 0],\n ['flexShrink', 1],\n ['flexBasis', 'auto'],\n ]\n }\n // normalizing to better align with native\n // see spec for flex shorthand https://developer.mozilla.org/en-US/docs/Web/CSS/flex\n if (value >= 0) {\n return [\n ['flexGrow', value],\n ['flexShrink', 1],\n ]\n }\n return\n }\n\n // web only\n switch (key) {\n // Ignore some React Native styles\n case 'elevation':\n case 'overlayColor':\n case 'resizeMode':\n case 'tintColor': {\n break\n }\n\n case 'aspectRatio': {\n return [[key, value.toString()]]\n }\n\n // TODO: remove once this issue is fixed\n // https://github.com/rofrischmann/inline-style-prefixer/issues/159\n case 'backgroundClip': {\n if (value === 'text') {\n return [\n ['backgroundClip', value],\n ['WebkitBackgroundClip', value],\n ]\n }\n break\n }\n\n case 'textAlignVertical': {\n return [['verticalAlign', value === 'center' ? 'middle' : value]]\n }\n\n case 'textDecorationLine': {\n return [['textDecorationLine', value]]\n }\n\n case 'transform': {\n if (Array.isArray(value)) {\n return [[key, value.map(mapTransform).join(' ')]]\n }\n break\n }\n\n case 'writingDirection': {\n return [['direction', value]]\n }\n }\n\n const longKey = STYLE_SHORT_FORM_EXPANSIONS[key]\n if (longKey) {\n return longKey.map((key) => {\n return [key, value]\n })\n } else {\n if (Array.isArray(value)) {\n return [[key, value.join(',')]]\n }\n }\n}\n\n// { scale: 2 } => 'scale(2)'\n// { translateX: 20 } => 'translateX(20px)'\n// { matrix: [1,2,3,4,5,6] } => 'matrix(1,2,3,4,5,6)'\nconst mapTransform = (transform) => {\n const type = Object.keys(transform)[0]\n const value = transform[type]\n if (type === 'matrix' || type === 'matrix3d') {\n return `${type}(${value.join(',')})`\n } else {\n const normalizedValue = normalizeValueWithProperty(value, type)\n return `${type}(${normalizedValue})`\n }\n}\n\nconst colorProps = {\n backgroundColor: true,\n borderColor: true,\n borderTopColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderLeftColor: true,\n color: true,\n shadowColor: true,\n textDecorationColor: true,\n textShadowColor: true,\n}\n\nfunction normalizeValueWithProperty(value: any, property?: string): any {\n if (process.env.TAMAGUI_TARGET === 'web') {\n const shouldCoerceToPx =\n typeof value === 'number' &&\n (property === undefined || property === null || !unitlessNumbers[property])\n if (shouldCoerceToPx) {\n return `${value}px`\n }\n }\n if (property && colorProps[property]) {\n return normalizeColor(value)\n }\n return value\n}\n\nconst normalizeColor = (color?: number | string, opacity = 1): void | string => {\n if (color == null || color == undefined) {\n return\n }\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (typeof color === 'string' && isWebColor(color)) {\n return color\n }\n }\n const colorInt = processColor(color)\n if (colorInt != null) {\n const r = (colorInt >> 16) & 255\n const g = (colorInt >> 8) & 255\n const b = colorInt & 255\n const a = ((colorInt >> 24) & 255) / 255\n const alpha = (a * opacity).toFixed(2)\n return `rgba(${r},${g},${b},${alpha})`\n }\n return `${color}`\n}\n\nconst webColors = {\n currentColor: true,\n currentcolor: true,\n transparent: true,\n inherit: true,\n}\n\nconst isWebColor = (color: string): boolean => webColors[color] || color.indexOf('var(') === 0\n\nconst processColor = (color?: number | string): number | undefined | null => {\n if (color === undefined || color === null) {\n return color\n }\n let intColor = normalizeCSSColor(color)\n if (intColor === undefined || intColor === null) {\n return undefined\n }\n return ((+intColor << 24) | (+intColor >>> 8)) >>> 0\n}\n\nconst unitlessNumbers = {\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n boxFlex: true,\n boxFleGroup: true,\n boxOrdinalGroup: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n fillOpacity: true,\n floodOpacity: true,\n stopOpacity: true,\n strokeDasharray: true,\n strokeDashoffset: true,\n strokeMiterlimit: true,\n strokeOpacity: true,\n strokeWidth: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n\nconst defaultOffset = { height: 0, width: 0 }\n\nconst STYLE_SHORT_FORM_EXPANSIONS = {\n borderColor: ['borderTopColor', 'borderRightColor', 'borderBottomColor', 'borderLeftColor'],\n borderRadius: [\n 'borderTopLeftRadius',\n 'borderTopRightRadius',\n 'borderBottomRightRadius',\n 'borderBottomLeftRadius',\n ],\n borderStyle: ['borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle'],\n borderWidth: ['borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth'],\n margin: ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'],\n marginHorizontal: ['marginRight', 'marginLeft'],\n marginVertical: ['marginTop', 'marginBottom'],\n overscrollBehavior: ['overscrollBehaviorX', 'overscrollBehaviorY'],\n padding: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],\n paddingHorizontal: ['paddingRight', 'paddingLeft'],\n paddingVertical: ['paddingTop', 'paddingBottom'],\n ...(isWeb && {\n // react-native doesn't support X / Y\n overflow: ['overflowX', 'overflowY'],\n }),\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;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QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,eAAe;AACjB;AAEA,MAAM,gBAAgB,EAAE,QAAQ,GAAG,OAAO,EAAE;AAE5C,MAAM,8BAA8B;AAAA,EAClC,aAAa,CAAC,kBAAkB,oBAAoB,qBAAqB,iBAAiB;AAAA,EAC1F,cAAc;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,aAAa,CAAC,kBAAkB,oBAAoB,qBAAqB,iBAAiB;AAAA,EAC1F,aAAa,CAAC,kBAAkB,oBAAoB,qBAAqB,iBAAiB;AAAA,EAC1F,QAAQ,CAAC,aAAa,eAAe,gBAAgB,YAAY;AAAA,EACjE,kBAAkB,CAAC,eAAe,YAAY;AAAA,EAC9C,gBAAgB,CAAC,aAAa,cAAc;AAAA,EAC5C,oBAAoB,CAAC,uBAAuB,qBAAqB;AAAA,EACjE,SAAS,CAAC,cAAc,gBAAgB,iBAAiB,aAAa;AAAA,EACtE,mBAAmB,CAAC,gBAAgB,aAAa;AAAA,EACjD,iBAAiB,CAAC,cAAc,eAAe;AAAA,GAC3C,SAAS;AAAA,EAEX,UAAU,CAAC,aAAa,WAAW;AACrC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/getTextSize.tsx"],
|
|
4
|
-
"sourcesContent": ["import { getVariableValue } from '../createVariable'\nimport { FontSizeTokens, TextProps, VariantSpreadFunction } from '../types'\n\nexport const getTextSize: VariantSpreadFunction<TextProps, FontSizeTokens> = (\n val = '$4',\n { fonts, theme, props }\n) => {\n const family = getVariableValue(props.fontFamily) || '$body'\n const font = fonts[family] || fonts['$body']\n if (!font) {\n console.warn('\u26A0\uFE0F no font found', { family, fontTokens: Object.keys(fonts), val })\n return {} as any\n }\n const fontFamily = font.family\n const fontSize = props.fontSize || font.size[val]\n const lineHeight = props.lineHeight || font.lineHeight[val]\n const fontWeight = props.fontWeight || font.weight[val]\n const letterSpacing = props.letterSpacing || font.letterSpacing[val]\n const fontStyle = props.fontStyle || font.style?.[val]\n const textTransform = props.textTransform || font.transform?.[val]\n const color = props.color || font.color?.[val] || theme.color\n return {\n color,\n fontStyle,\n textTransform,\n fontFamily,\n fontWeight,\n letterSpacing,\n fontSize,\n lineHeight,\n } as any\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAGO,MAAM,cAAgE,CAC3E,MAAM,MACN,EAAE,OAAO,OAAO,YACb;AANL;AAOE,QAAM,SAAS,iBAAiB,MAAM,UAAU,KAAK;AACrD,QAAM,OAAO,MAAM,WAAW,MAAM;AACpC,MAAI,CAAC,MAAM;AACT,YAAQ,KAAK,8BAAoB,EAAE,QAAQ,YAAY,OAAO,KAAK,KAAK,GAAG,IAAI,CAAC;AAChF,WAAO,CAAC;AAAA,EACV;AACA,QAAM,aAAa,KAAK;AACxB,QAAM,WAAW,MAAM,YAAY,KAAK,KAAK;AAC7C,QAAM,aAAa,MAAM,cAAc,KAAK,WAAW;AACvD,QAAM,aAAa,MAAM,cAAc,KAAK,OAAO;AACnD,QAAM,gBAAgB,MAAM,iBAAiB,KAAK,cAAc;AAChE,QAAM,YAAY,MAAM,aAAa,YAAK,UAAL,mBAAa;AAClD,QAAM,gBAAgB,MAAM,iBAAiB,YAAK,cAAL,mBAAiB;AAC9D,QAAM,QAAQ,MAAM,SAAS,YAAK,UAAL,mBAAa,SAAQ,MAAM;AACxD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixNativeShadow.native.d.ts","sourceRoot":"","sources":["../../src/helpers/fixNativeShadow.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,QAwB/C"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StyleObject } from '@tamagui/helpers';
|
|
2
|
-
import { TextStyle, ViewStyle } from 'react-native';
|
|
3
|
-
import { PseudoDescriptor } from './pseudoDescriptors';
|
|
4
|
-
declare type Value = Object | Array<any> | string | number;
|
|
5
|
-
export declare type Style = {
|
|
6
|
-
[key: string]: Value;
|
|
7
|
-
};
|
|
8
|
-
export declare const generateAtomicStyles: (style: ViewStyle & TextStyle, pseudo?: PseudoDescriptor) => StyleObject[];
|
|
9
|
-
export declare function expandStyles(style: any): Record<string, any>;
|
|
10
|
-
export declare function expandStyle(key: string, value: any): any;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=generateAtomicStyles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateAtomicStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/generateAtomicStyles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKnD,OAAO,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAA;AAEzE,aAAK,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;AAClD,oBAAY,KAAK,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAAA;AAiB5C,eAAO,MAAM,oBAAoB,UACxB,SAAS,GAAG,SAAS,WACnB,gBAAgB,KACxB,WAAW,EA8Bb,CAAA;AAeD,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,uBA4DtC;AAwGD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAkFlD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getTextSize.d.ts","sourceRoot":"","sources":["../../src/helpers/getTextSize.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAE3E,eAAO,MAAM,WAAW,EAAE,qBAAqB,CAAC,SAAS,EAAE,cAAc,CA4BxE,CAAA"}
|