@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.
Files changed (126) hide show
  1. package/dist/cjs/ThemeManager.js +6 -22
  2. package/dist/cjs/ThemeManager.js.map +2 -2
  3. package/dist/cjs/constants/rnw.js +5 -7
  4. package/dist/cjs/constants/rnw.js.map +2 -2
  5. package/dist/cjs/createComponent.js +4 -3
  6. package/dist/cjs/createComponent.js.map +2 -2
  7. package/dist/cjs/helpers/createPropMapper.js +1 -15
  8. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  9. package/dist/cjs/helpers/getSplitStyles.js +3 -0
  10. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  11. package/dist/cjs/helpers/validate.js +33 -30
  12. package/dist/cjs/helpers/validate.js.map +2 -2
  13. package/dist/cjs/index.js +0 -5
  14. package/dist/cjs/index.js.map +2 -2
  15. package/dist/cjs/insertFont.js +1 -2
  16. package/dist/cjs/insertFont.js.map +2 -2
  17. package/dist/esm/ThemeManager.js +4 -4
  18. package/dist/esm/ThemeManager.js.map +2 -2
  19. package/dist/esm/constants/rnw.js +2 -7
  20. package/dist/esm/constants/rnw.js.map +2 -2
  21. package/dist/esm/createComponent.js +4 -3
  22. package/dist/esm/createComponent.js.map +2 -2
  23. package/dist/esm/helpers/createPropMapper.js +1 -17
  24. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  25. package/dist/esm/helpers/getSplitStyles.js +3 -0
  26. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  27. package/dist/esm/helpers/validate.js +1 -1
  28. package/dist/esm/helpers/validate.js.map +2 -2
  29. package/dist/esm/index.js +0 -3
  30. package/dist/esm/index.js.map +2 -2
  31. package/dist/esm/insertFont.js +1 -2
  32. package/dist/esm/insertFont.js.map +2 -2
  33. package/package.json +7 -7
  34. package/types/ThemeManager.d.ts +1 -1
  35. package/types/ThemeManager.d.ts.map +1 -1
  36. package/types/constants/rnw.d.ts.map +1 -1
  37. package/types/createComponent.d.ts.map +1 -1
  38. package/types/helpers/createTamaguiProvider.d.ts +1 -0
  39. package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
  40. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  41. package/types/index.d.ts +1 -1
  42. package/types/index.d.ts.map +1 -1
  43. package/dist/cjs/helpers/pseudos.js +0 -41
  44. package/dist/cjs/helpers/pseudos.js.map +0 -7
  45. package/dist/esm/helpers/pseudos.js +0 -18
  46. package/dist/esm/helpers/pseudos.js.map +0 -7
  47. package/dist/jsx/Pressability.js +0 -4
  48. package/dist/jsx/Pressability.native.js +0 -4
  49. package/dist/jsx/Tamagui.js +0 -38
  50. package/dist/jsx/ThemeContext.js +0 -5
  51. package/dist/jsx/ThemeManager.js +0 -194
  52. package/dist/jsx/conf.js +0 -38
  53. package/dist/jsx/constants/constants.js +0 -17
  54. package/dist/jsx/constants/platform.js +0 -25
  55. package/dist/jsx/constants/rnw.js +0 -10
  56. package/dist/jsx/contexts/ButtonInsideButtonContext.js +0 -5
  57. package/dist/jsx/createComponent.js +0 -1036
  58. package/dist/jsx/createFont.js +0 -25
  59. package/dist/jsx/createShorthands.js +0 -6
  60. package/dist/jsx/createTamagui.js +0 -245
  61. package/dist/jsx/createTheme.js +0 -6
  62. package/dist/jsx/createTokens.js +0 -11
  63. package/dist/jsx/createVariable.js +0 -64
  64. package/dist/jsx/createVariables.js +0 -31
  65. package/dist/jsx/defaultComponentState.js +0 -0
  66. package/dist/jsx/helpers/RNComponents.js +0 -11
  67. package/dist/jsx/helpers/areEqualSets.js +0 -13
  68. package/dist/jsx/helpers/calc.js +0 -46
  69. package/dist/jsx/helpers/createMediaStyle.js +0 -29
  70. package/dist/jsx/helpers/createPropMapper.js +0 -243
  71. package/dist/jsx/helpers/createShallowUpdate.js +0 -16
  72. package/dist/jsx/helpers/createTamaguiProvider.js +0 -28
  73. package/dist/jsx/helpers/extendStaticConfig.js +0 -62
  74. package/dist/jsx/helpers/fixNativeShadow.js +0 -5
  75. package/dist/jsx/helpers/fixNativeShadow.native.js +0 -28
  76. package/dist/jsx/helpers/generateAtomicStyles.js +0 -410
  77. package/dist/jsx/helpers/getExpandedShorthands.js +0 -15
  78. package/dist/jsx/helpers/getSize.js +0 -19
  79. package/dist/jsx/helpers/getSplitStyles.js +0 -380
  80. package/dist/jsx/helpers/getStackSize.js +0 -15
  81. package/dist/jsx/helpers/getStylesAtomic.js +0 -61
  82. package/dist/jsx/helpers/getStylesAtomic.native.js +0 -6
  83. package/dist/jsx/helpers/getTextSize.js +0 -31
  84. package/dist/jsx/helpers/getVariantExtras.js +0 -22
  85. package/dist/jsx/helpers/insertStyleRule.js +0 -91
  86. package/dist/jsx/helpers/isObj.js +0 -4
  87. package/dist/jsx/helpers/isTamaguiComponent.js +0 -12
  88. package/dist/jsx/helpers/isTamaguiElement.js +0 -8
  89. package/dist/jsx/helpers/matchMedia.js +0 -15
  90. package/dist/jsx/helpers/matchMedia.native.js +0 -6
  91. package/dist/jsx/helpers/mergeProps.js +0 -15
  92. package/dist/jsx/helpers/mergeTransform.js +0 -16
  93. package/dist/jsx/helpers/nativeGestureHandler.native.js +0 -1
  94. package/dist/jsx/helpers/proxyThemeVariables.js +0 -14
  95. package/dist/jsx/helpers/pseudos.js +0 -17
  96. package/dist/jsx/helpers/registerCSSVariable.js +0 -14
  97. package/dist/jsx/helpers/themeable.js +0 -22
  98. package/dist/jsx/helpers/validate.js +0 -73
  99. package/dist/jsx/helpers/withStaticProperties.js +0 -7
  100. package/dist/jsx/helpers/wrapThemeManagerContext.js +0 -7
  101. package/dist/jsx/hooks/useConstant.js +0 -11
  102. package/dist/jsx/hooks/useFeatures.js +0 -165
  103. package/dist/jsx/hooks/useId.js +0 -32
  104. package/dist/jsx/hooks/useIsMounted.js +0 -15
  105. package/dist/jsx/hooks/useIsTouchDevice.js +0 -14
  106. package/dist/jsx/hooks/useMedia.js +0 -153
  107. package/dist/jsx/hooks/usePressable.js +0 -11
  108. package/dist/jsx/hooks/usePrevious.js +0 -0
  109. package/dist/jsx/hooks/useTheme.js +0 -164
  110. package/dist/jsx/hooks/useUnmountEffect.js +0 -7
  111. package/dist/jsx/index.js +0 -64
  112. package/dist/jsx/insertFont.js +0 -64
  113. package/dist/jsx/static.js +0 -18
  114. package/dist/jsx/styled.js +0 -49
  115. package/dist/jsx/types-rnw.js +0 -0
  116. package/dist/jsx/types.js +0 -0
  117. package/dist/jsx/views/Slot.js +0 -70
  118. package/dist/jsx/views/Stack.js +0 -12
  119. package/dist/jsx/views/Text.js +0 -57
  120. package/dist/jsx/views/TextAncestorContext.js +0 -13
  121. package/dist/jsx/views/Theme.js +0 -27
  122. package/dist/jsx/views/ThemeInverse.js +0 -24
  123. package/dist/jsx/views/ThemeProvider.js +0 -34
  124. package/dist/jsx/views/ThemeReset.js +0 -32
  125. package/types/helpers/pseudos.d.ts +0 -16
  126. package/types/helpers/pseudos.d.ts.map +0 -1
@@ -1,380 +0,0 @@
1
- import { stylePropsText, stylePropsTransform, validPseudoKeys, validStyles } from "@tamagui/helpers";
2
- import { useInsertionEffect } from "react";
3
- import { getConfig } from "../conf";
4
- import { isClient, isWeb, useIsomorphicLayoutEffect } from "../constants/platform";
5
- import { mediaQueryConfig, mediaState } from "../hooks/useMedia";
6
- import { createMediaStyle } from "./createMediaStyle";
7
- import { fixNativeShadow } from "./fixNativeShadow";
8
- import { getStylesAtomic } from "./getStylesAtomic";
9
- import {
10
- insertStyleRule,
11
- insertedTransforms,
12
- updateInserted,
13
- updateInsertedCache
14
- } from "./insertStyleRule";
15
- import { mergeTransform } from "./mergeTransform";
16
- import { pseudos as pseudoAttrs } from "./pseudos";
17
- const skipProps = {
18
- animation: true,
19
- animateOnly: true,
20
- debug: true,
21
- componentName: true,
22
- ...!isWeb && {
23
- tag: true,
24
- whiteSpace: true,
25
- wordWrap: true,
26
- textOverflow: true,
27
- textDecorationDistance: true,
28
- userSelect: true,
29
- selectable: true,
30
- cursor: true,
31
- contain: true,
32
- boxSizing: true,
33
- boxShadow: true
34
- }
35
- };
36
- let conf;
37
- const pseudoCNInverse = {
38
- hover: "hoverStyle",
39
- focus: "focusStyle",
40
- press: "pressStyle"
41
- };
42
- const getSplitStyles = (props, staticConfig, theme, state, defaultClassNames, debug) => {
43
- var _a, _b;
44
- conf = conf || getConfig();
45
- const validStyleProps = staticConfig.isText ? stylePropsText : validStyles;
46
- const viewProps = {};
47
- const pseudos = {};
48
- const medias = {};
49
- const usedKeys = /* @__PURE__ */ new Set();
50
- let style = {};
51
- if (state.hasTextAncestor) {
52
- style.display = "inline-flex";
53
- }
54
- let classNames = {};
55
- let transforms = null;
56
- const rulesToInsert = [];
57
- function addStyle(prop, rule) {
58
- rulesToInsert.push([prop, rule]);
59
- updateInsertedCache(prop, rule);
60
- }
61
- function mergeClassName(key, val, isMediaOrPseudo = false) {
62
- if (!val)
63
- return;
64
- if (val.startsWith("_transform-")) {
65
- const namespace = isMediaOrPseudo ? key : "transform";
66
- let transform = insertedTransforms[val];
67
- if (isClient) {
68
- if (!transform) {
69
- updateInserted();
70
- transform = insertedTransforms[val];
71
- if (process.env.NODE_ENV === "development") {
72
- if (!transform) {
73
- console.warn("no transform, error", { insertedTransforms, val });
74
- }
75
- }
76
- }
77
- if (!transform) {
78
- if (isWeb && val[0] !== "_") {
79
- transform = val;
80
- }
81
- }
82
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
83
- console.log(" \xBB getSplitStyles mergeClassName transform", { key, val, namespace, transform, insertedTransforms });
84
- }
85
- }
86
- transforms = transforms || {};
87
- transforms[namespace] = transforms[namespace] || ["", ""];
88
- const identifier = val.replace("_transform", "");
89
- transforms[namespace][0] += identifier;
90
- if (transform) {
91
- transforms[namespace][1] += transform;
92
- }
93
- } else {
94
- classNames[key] = val;
95
- }
96
- }
97
- const propKeys = Object.keys(props);
98
- const shouldDoClasses = isWeb && !state.noClassNames;
99
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
100
- console.log("propKeys", propKeys);
101
- }
102
- for (let i = propKeys.length - 1; i >= 0; i--) {
103
- const keyInit = propKeys[i];
104
- if (usedKeys.has(keyInit))
105
- continue;
106
- if (skipProps[keyInit])
107
- continue;
108
- if (!isWeb && keyInit.startsWith("data-"))
109
- continue;
110
- const valInit = props[keyInit];
111
- if (keyInit === "style" || keyInit.startsWith("_style")) {
112
- if (!valInit)
113
- continue;
114
- for (const key in valInit) {
115
- if (usedKeys.has(key))
116
- continue;
117
- if (valInit && typeof valInit === "object") {
118
- for (const skey in valInit) {
119
- if (usedKeys.has(skey))
120
- continue;
121
- usedKeys.add(skey);
122
- style[skey] = valInit[skey];
123
- }
124
- } else {
125
- usedKeys.add(key);
126
- style[key] = valInit;
127
- }
128
- }
129
- continue;
130
- }
131
- if (keyInit === "className") {
132
- let nonTamaguis = "";
133
- if (!valInit) {
134
- continue;
135
- }
136
- for (const cn of valInit.split(" ")) {
137
- if (cn[0] === "_") {
138
- const [shorthand, mediaOrPseudo] = cn.slice(1).split("-");
139
- const isMedia2 = mediaOrPseudo[0] === "_";
140
- const isPseudo2 = mediaOrPseudo[0] === "0";
141
- const isMediaOrPseudo2 = isMedia2 || isPseudo2;
142
- let fullKey = conf.shorthands[shorthand];
143
- if (isMedia2) {
144
- let mediaShortKey = mediaOrPseudo.slice(1);
145
- mediaShortKey = mediaShortKey.slice(0, mediaShortKey.indexOf("_"));
146
- fullKey += `_${mediaShortKey}`;
147
- } else if (isPseudo2) {
148
- const pseudoShortKey = mediaOrPseudo.slice(1);
149
- fullKey += `_${pseudoShortKey}`;
150
- }
151
- usedKeys.add(fullKey);
152
- mergeClassName(fullKey, cn, isMediaOrPseudo2);
153
- } else {
154
- nonTamaguis += " " + cn;
155
- }
156
- }
157
- if (nonTamaguis) {
158
- usedKeys.add(keyInit);
159
- mergeClassName(keyInit, nonTamaguis);
160
- }
161
- continue;
162
- }
163
- if (valInit && valInit[0] === "_") {
164
- usedKeys.add(keyInit);
165
- mergeClassName(keyInit, valInit);
166
- continue;
167
- }
168
- if (state.keepVariantsAsProps && staticConfig.defaultVariants && keyInit in staticConfig.defaultVariants) {
169
- viewProps[keyInit] = valInit;
170
- }
171
- let isMedia = keyInit[0] === "$";
172
- let isPseudo = validPseudoKeys[keyInit];
173
- if (!isMedia && !isPseudo && !((_a = staticConfig.variants) == null ? void 0 : _a[keyInit]) && !validStyleProps[keyInit] && !conf.shorthands[keyInit]) {
174
- usedKeys.add(keyInit);
175
- viewProps[keyInit] = valInit;
176
- continue;
177
- }
178
- const expanded = isMedia || isPseudo ? [[keyInit, valInit]] : staticConfig.propMapper(keyInit, valInit, theme, props, state, void 0, debug);
179
- let isMediaOrPseudo = isMedia || isPseudo;
180
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
181
- console.log(" \xBB getSplitStyles", keyInit, expanded);
182
- }
183
- if (!expanded) {
184
- continue;
185
- }
186
- for (const [key, val] of expanded) {
187
- if (val === void 0)
188
- continue;
189
- if (key !== "target" && val && val[0] === "_") {
190
- usedKeys.add(key);
191
- mergeClassName(key, val, isMediaOrPseudo);
192
- continue;
193
- }
194
- isMedia = key[0] === "$";
195
- isPseudo = validPseudoKeys[key];
196
- isMediaOrPseudo = isMedia || isPseudo;
197
- if (!isMediaOrPseudo) {
198
- if (usedKeys.has(key))
199
- continue;
200
- }
201
- if (staticConfig.deoptProps && staticConfig.deoptProps.has(key) || staticConfig.inlineProps && staticConfig.inlineProps.has(key)) {
202
- usedKeys.add(key);
203
- viewProps[key] = val;
204
- }
205
- if (isPseudo) {
206
- if (!val)
207
- continue;
208
- if (key === "enterStyle" && state.mounted) {
209
- continue;
210
- }
211
- pseudos[key] = pseudos[key] || {};
212
- pseudos[key] = getSubStyle(val, staticConfig, theme, props, state, true);
213
- if (shouldDoClasses) {
214
- const pseudoStyles = getStylesAtomic({ [key]: pseudos[key] });
215
- for (const style2 of pseudoStyles) {
216
- const postfix = ((_b = pseudoAttrs[key]) == null ? void 0 : _b.name) || key;
217
- const fullKey = `${style2.property}_${postfix}`;
218
- if (!usedKeys.has(fullKey)) {
219
- usedKeys.add(fullKey);
220
- addStyle(style2.identifier, style2.rules.join(";"));
221
- mergeClassName(fullKey, style2.identifier, isMediaOrPseudo);
222
- }
223
- }
224
- }
225
- continue;
226
- }
227
- if (isMedia) {
228
- const mediaKey = key;
229
- const mediaKeyShort = mediaKey.slice(1);
230
- if (!mediaQueryConfig[mediaKeyShort]) {
231
- if (!usedKeys.has(key)) {
232
- viewProps[key] = val;
233
- }
234
- continue;
235
- }
236
- const mediaStyle = getSubStyle(val, staticConfig, theme, props, state);
237
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
238
- console.log(" \xBB getSplitStyles mediaStyle", { mediaKey, mediaStyle, props, shouldDoClasses });
239
- }
240
- if (shouldDoClasses) {
241
- const mediaStyles = getStylesAtomic(mediaStyle);
242
- for (const style2 of mediaStyles) {
243
- const out = createMediaStyle(style2, mediaKeyShort, mediaQueryConfig);
244
- const fullKey = `${style2.property}_${mediaKeyShort}`;
245
- if (!usedKeys.has(fullKey)) {
246
- usedKeys.add(fullKey);
247
- addStyle(out.identifier, out.styleRule);
248
- mergeClassName(fullKey, out.identifier, true);
249
- }
250
- }
251
- } else {
252
- if (mediaState[mediaKey]) {
253
- if (process.env.NODE_ENV === "development" && debug) {
254
- console.log("apply media style", mediaKey, mediaState);
255
- }
256
- Object.assign(shouldDoClasses ? medias : style, mediaStyle);
257
- }
258
- }
259
- continue;
260
- }
261
- if (!isWeb && key === "pointerEvents") {
262
- usedKeys.add(key);
263
- viewProps[key] = val;
264
- continue;
265
- }
266
- if (validStyleProps[key]) {
267
- usedKeys.add(key);
268
- if (val && val[0] === "_") {
269
- classNames[key] = val;
270
- } else if (key in stylePropsTransform) {
271
- mergeTransform(style, key, val, true);
272
- } else {
273
- style[key] = val;
274
- }
275
- continue;
276
- }
277
- if (!staticConfig.variants || !(key in staticConfig.variants)) {
278
- if (!skipProps[key]) {
279
- viewProps[key] = val;
280
- usedKeys.add(key);
281
- }
282
- }
283
- }
284
- }
285
- if (defaultClassNames) {
286
- classNames = {
287
- ...defaultClassNames,
288
- ...classNames
289
- };
290
- }
291
- if (shouldDoClasses) {
292
- const atomic = getStylesAtomic(style);
293
- for (const atomicStyle of atomic) {
294
- const key = atomicStyle.property;
295
- if (!state.dynamicStylesInline) {
296
- addStyle(atomicStyle.identifier, atomicStyle.rules.join(";"));
297
- mergeClassName(key, atomicStyle.identifier);
298
- } else {
299
- style[key] = atomicStyle.value;
300
- }
301
- }
302
- }
303
- if (transforms) {
304
- for (const namespace in transforms) {
305
- if (!transforms[namespace]) {
306
- console.warn("Error no transform");
307
- continue;
308
- }
309
- const [hash, val] = transforms[namespace];
310
- const identifier = `_transform${hash}`;
311
- if (isClient) {
312
- if (!insertedTransforms[identifier]) {
313
- const rule = `.${identifier} { transform: ${val}; }`;
314
- addStyle(identifier, rule);
315
- }
316
- }
317
- classNames[namespace] = identifier;
318
- }
319
- }
320
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
321
- if (typeof document !== "undefined") {
322
- console.log(" \xBB getSplitStyles out", { style, pseudos, medias, classNames, viewProps, state });
323
- }
324
- }
325
- return {
326
- viewProps,
327
- style,
328
- medias,
329
- pseudos,
330
- classNames,
331
- rulesToInsert
332
- };
333
- };
334
- const insertSplitStyles = (...args) => {
335
- const res = getSplitStyles(...args);
336
- for (const [prop, rule] of res.rulesToInsert) {
337
- insertStyleRule(prop, rule);
338
- }
339
- return res;
340
- };
341
- const effect = isWeb ? useInsertionEffect || useIsomorphicLayoutEffect : useIsomorphicLayoutEffect;
342
- const useSplitStyles = (...args) => {
343
- const res = getSplitStyles(...args);
344
- effect(() => {
345
- for (const [prop, rule] of res.rulesToInsert) {
346
- insertStyleRule(prop, rule);
347
- }
348
- });
349
- return res;
350
- };
351
- const getSubStyle = (styleIn, staticConfig, theme, props, state, avoidDefaultProps) => {
352
- const styleOut = {};
353
- for (const key in styleIn) {
354
- const val = styleIn[key];
355
- const expanded = staticConfig.propMapper(key, val, theme, props, state, avoidDefaultProps);
356
- if (!expanded)
357
- continue;
358
- for (const [skey, sval] of expanded) {
359
- if (skey in stylePropsTransform) {
360
- mergeTransform(styleOut, skey, sval);
361
- } else {
362
- styleOut[skey] = sval;
363
- }
364
- }
365
- }
366
- return styleOut;
367
- };
368
- function normalizeStyleObject(style) {
369
- if (!isWeb) {
370
- fixNativeShadow(style);
371
- }
372
- }
373
- export {
374
- getSplitStyles,
375
- getSubStyle,
376
- insertSplitStyles,
377
- normalizeStyleObject,
378
- pseudoCNInverse,
379
- useSplitStyles
380
- };
@@ -1,15 +0,0 @@
1
- import { getSize, stepTokenUpOrDown } from "./getSize";
2
- const getButtonSize = (val, { tokens }) => {
3
- var _a;
4
- const ySize = getSize(val, 0);
5
- const xSize = stepTokenUpOrDown(tokens.space, val);
6
- const radiusToken = (_a = tokens.radius[val]) != null ? _a : tokens.radius["$4"];
7
- return {
8
- paddingHorizontal: xSize,
9
- height: ySize,
10
- borderRadius: radiusToken
11
- };
12
- };
13
- export {
14
- getButtonSize
15
- };
@@ -1,61 +0,0 @@
1
- import { stylePropsTransform } from "@tamagui/helpers";
2
- import { isVariable } from "../createVariable";
3
- import { generateAtomicStyles } from "./generateAtomicStyles";
4
- import { invertMapTransformKeys, mergeTransform } from "./mergeTransform";
5
- import { pseudos } from "./pseudos";
6
- const pseudosOrdered = Object.values(pseudos);
7
- function getStylesAtomic(stylesIn, options) {
8
- if (!stylesIn.hoverStyle && !stylesIn.pressStyle && !stylesIn.focusStyle) {
9
- return getAtomicStyle(stylesIn, void 0, options);
10
- }
11
- const { hoverStyle, pressStyle, focusStyle, ...base } = stylesIn;
12
- let res = [];
13
- for (const [index, style] of [hoverStyle, pressStyle, focusStyle, base].entries()) {
14
- if (!style || !Object.keys(style).length) {
15
- continue;
16
- }
17
- const pseudo = pseudosOrdered[index];
18
- for (const skey in style) {
19
- const val = style[skey];
20
- if (isVariable(val)) {
21
- style[skey] = val.toString();
22
- }
23
- if (stylePropsTransform[skey]) {
24
- delete style[skey];
25
- mergeTransform(style, skey, val);
26
- }
27
- }
28
- res = [...res, ...getAtomicStyle(style, pseudo, options)];
29
- }
30
- return res;
31
- }
32
- function getAtomicStyle(style, pseudo, options) {
33
- if (process.env.NODE_ENV === "development") {
34
- if (!style || typeof style !== "object") {
35
- throw new Error(`Wrong style type: "${typeof style}": ${style}`);
36
- }
37
- } else {
38
- if (!style) {
39
- console.warn(`Invalid style`);
40
- return [];
41
- }
42
- }
43
- if (options && options.splitTransforms && style.transform) {
44
- let atomicStyles = [];
45
- let { transform, ...rest } = style;
46
- for (const t of transform) {
47
- const tKey = Object.keys(t)[0];
48
- const transformProperty = invertMapTransformKeys[tKey] || tKey;
49
- const out = generateAtomicStyles({ transform: [t] }, pseudo)[0];
50
- atomicStyles.push({
51
- ...out,
52
- property: transformProperty
53
- });
54
- }
55
- return [...atomicStyles, ...generateAtomicStyles(rest, pseudo)];
56
- }
57
- return generateAtomicStyles(style, pseudo);
58
- }
59
- export {
60
- getStylesAtomic
61
- };
@@ -1,6 +0,0 @@
1
- function getStylesAtomic() {
2
- console.warn("no-op native");
3
- }
4
- export {
5
- getStylesAtomic
6
- };
@@ -1,31 +0,0 @@
1
- import { getVariableValue } from "../createVariable";
2
- const getTextSize = (val = "$4", { fonts, theme, props }) => {
3
- var _a, _b, _c;
4
- const family = getVariableValue(props.fontFamily) || "$body";
5
- const font = fonts[family] || fonts["$body"];
6
- if (!font) {
7
- console.warn("\u26A0\uFE0F no font found", { family, fontTokens: Object.keys(fonts), val });
8
- return {};
9
- }
10
- const fontFamily = font.family;
11
- const fontSize = props.fontSize || font.size[val];
12
- const lineHeight = props.lineHeight || font.lineHeight[val];
13
- const fontWeight = props.fontWeight || font.weight[val];
14
- const letterSpacing = props.letterSpacing || font.letterSpacing[val];
15
- const fontStyle = props.fontStyle || ((_a = font.style) == null ? void 0 : _a[val]);
16
- const textTransform = props.textTransform || ((_b = font.transform) == null ? void 0 : _b[val]);
17
- const color = props.color || ((_c = font.color) == null ? void 0 : _c[val]) || theme.color;
18
- return {
19
- color,
20
- fontStyle,
21
- textTransform,
22
- fontFamily,
23
- fontWeight,
24
- letterSpacing,
25
- fontSize,
26
- lineHeight
27
- };
28
- };
29
- export {
30
- getTextSize
31
- };
@@ -1,22 +0,0 @@
1
- import { getConfig } from "../conf";
2
- function getVariantExtras(props, theme, defaultProps, avoidDefaultProps = false) {
3
- const conf = getConfig();
4
- return {
5
- fonts: conf.fontsParsed,
6
- tokens: conf.tokensParsed,
7
- theme,
8
- props: avoidDefaultProps ? props : new Proxy(props, {
9
- get(target, key) {
10
- if (Reflect.has(target, key)) {
11
- return Reflect.get(target, key);
12
- }
13
- if (defaultProps) {
14
- return Reflect.get(defaultProps, key);
15
- }
16
- }
17
- })
18
- };
19
- }
20
- export {
21
- getVariantExtras
22
- };
@@ -1,91 +0,0 @@
1
- const allSelectors = {};
2
- const insertedSelectors = {};
3
- const insertedTransforms = {};
4
- const getAllSelectors = () => allSelectors;
5
- const getInsertedRules = () => Object.values(insertedSelectors);
6
- const getAllTransforms = () => insertedTransforms;
7
- function addTransform(identifier, css, rule) {
8
- const s = css.indexOf("transform:");
9
- if (s === -1) {
10
- if (process.env.NODE_ENV === "development") {
11
- console.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`);
12
- console.log("rule:", rule);
13
- console.trace();
14
- console.groupEnd();
15
- } else {
16
- console.error(`Missing transform`, identifier, css, rule);
17
- }
18
- return;
19
- }
20
- const startI = s + "transform:".length;
21
- const endI = css.indexOf(";");
22
- const value = css.slice(startI, endI);
23
- insertedTransforms[identifier] = value;
24
- }
25
- const isClient = typeof document !== "undefined";
26
- let hasInsertedSinceUpdate = true;
27
- function updateInserted() {
28
- if (process.env.NODE_ENV === "test")
29
- return;
30
- if (!isClient)
31
- return;
32
- if (!hasInsertedSinceUpdate) {
33
- console.warn("hasnt inserted since");
34
- return;
35
- }
36
- const sheets = document.styleSheets;
37
- if (!sheets)
38
- return;
39
- for (let i = 0; i < sheets.length; i++) {
40
- const rules = sheets[i].cssRules;
41
- const firstRule = rules[0];
42
- if (!(firstRule instanceof CSSStyleRule))
43
- continue;
44
- const firstSelector = firstRule.selectorText;
45
- if (!firstSelector)
46
- continue;
47
- if (firstSelector === ":root" || firstSelector.startsWith("._")) {
48
- for (let i2 = 0; i2 < rules.length; i2++) {
49
- const rule = rules.item(i2);
50
- if (!(rule instanceof CSSStyleRule))
51
- continue;
52
- const identifier = rule.selectorText.slice(1);
53
- if (!allSelectors[identifier]) {
54
- allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule.cssText : true;
55
- if (identifier.startsWith("_transform")) {
56
- addTransform(identifier, rule.cssText, rule);
57
- }
58
- }
59
- }
60
- }
61
- }
62
- hasInsertedSinceUpdate = false;
63
- }
64
- updateInserted();
65
- const sheet = isClient ? document.head.appendChild(document.createElement("style")).sheet : null;
66
- function updateInsertedCache(identifier, rule) {
67
- if (insertedSelectors[identifier])
68
- return;
69
- insertedSelectors[identifier] = rule;
70
- const isTransform = identifier.startsWith("_transform");
71
- if (isTransform) {
72
- addTransform(identifier, rule);
73
- }
74
- }
75
- function insertStyleRule(identifier, rule) {
76
- if (allSelectors[identifier])
77
- return;
78
- hasInsertedSinceUpdate = true;
79
- updateInsertedCache(identifier, rule);
80
- allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
81
- sheet == null ? void 0 : sheet.insertRule(rule, sheet.cssRules.length);
82
- }
83
- export {
84
- getAllSelectors,
85
- getAllTransforms,
86
- getInsertedRules,
87
- insertStyleRule,
88
- insertedTransforms,
89
- updateInserted,
90
- updateInsertedCache
91
- };
@@ -1,4 +0,0 @@
1
- const isObj = (x) => x && !Array.isArray(x) && typeof x === "object";
2
- export {
3
- isObj
4
- };
@@ -1,12 +0,0 @@
1
- function isTamaguiComponent(comp, name) {
2
- const config = comp && comp["staticConfig"];
3
- if (!config || !config.parsed)
4
- return false;
5
- if (name) {
6
- return name === config.componentName;
7
- }
8
- return true;
9
- }
10
- export {
11
- isTamaguiComponent
12
- };
@@ -1,8 +0,0 @@
1
- import { isValidElement } from "react";
2
- import { isTamaguiComponent } from "./isTamaguiComponent";
3
- const isTamaguiElement = (child, name) => {
4
- return isValidElement(child) && isTamaguiComponent(child.type, name);
5
- };
6
- export {
7
- isTamaguiElement
8
- };
@@ -1,15 +0,0 @@
1
- const matchMedia = typeof window !== "undefined" && window.matchMedia || function matchMediaFallback(query) {
2
- return {
3
- addListener() {
4
- if (process.env.NODE_ENV === "development" && !process.env.IS_STATIC && process.env.TAMAGUI_TARGET !== "web") {
5
- console.log("warning: matchMedia not loading! Is native picking up .native.js files?");
6
- }
7
- },
8
- removeListener() {
9
- },
10
- matches: false
11
- };
12
- };
13
- export {
14
- matchMedia
15
- };
@@ -1,6 +0,0 @@
1
- import MediaQueryList from "@expo/match-media/build/MediaQueryList.js";
2
- const matchMedia = (media) => new MediaQueryList(media);
3
- globalThis["matchMedia"] = matchMedia;
4
- export {
5
- matchMedia
6
- };
@@ -1,15 +0,0 @@
1
- const mergeProps = (a, b) => {
2
- const out = {};
3
- for (const key in a) {
4
- if (!(key in b)) {
5
- out[key] = a[key];
6
- }
7
- }
8
- for (const key in b) {
9
- out[key] = b[key];
10
- }
11
- return out;
12
- };
13
- export {
14
- mergeProps
15
- };
@@ -1,16 +0,0 @@
1
- const mergeTransform = (obj, key, val, backwards = false) => {
2
- obj.transform || (obj.transform = []);
3
- obj.transform[backwards ? "unshift" : "push"]({ [mapTransformKeys[key] || key]: val });
4
- };
5
- const mapTransformKeys = {
6
- x: "translateX",
7
- y: "translateY"
8
- };
9
- const invertMapTransformKeys = {
10
- translateX: "x",
11
- translateY: "y"
12
- };
13
- export {
14
- invertMapTransformKeys,
15
- mergeTransform
16
- };