@tamagui/core 1.0.1-beta.199 → 1.0.1-beta.200

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "1.0.1-beta.199",
3
+ "version": "1.0.1-beta.200",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -28,23 +28,23 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@expo/match-media": "^0.3.0",
31
- "@tamagui/compose-refs": "^1.0.1-beta.199",
32
- "@tamagui/constants": "^1.0.1-beta.199",
33
- "@tamagui/helpers": "^1.0.1-beta.199",
34
- "@tamagui/normalize-css-color-lite": "^1.0.1-beta.199",
35
- "@tamagui/react-native-use-pressable": "^1.0.1-beta.199",
36
- "@tamagui/react-native-use-responder-events": "^1.0.1-beta.199",
37
- "@tamagui/types-react-native": "^1.0.1-beta.199",
38
- "@tamagui/use-did-finish-ssr": "^1.0.1-beta.199",
39
- "@tamagui/use-event": "^1.0.1-beta.199",
40
- "@tamagui/use-force-update": "^1.0.1-beta.199"
31
+ "@tamagui/compose-refs": "^1.0.1-beta.200",
32
+ "@tamagui/constants": "^1.0.1-beta.200",
33
+ "@tamagui/helpers": "^1.0.1-beta.200",
34
+ "@tamagui/normalize-css-color-lite": "^1.0.1-beta.200",
35
+ "@tamagui/react-native-use-pressable": "^1.0.1-beta.200",
36
+ "@tamagui/react-native-use-responder-events": "^1.0.1-beta.200",
37
+ "@tamagui/types-react-native": "^1.0.1-beta.200",
38
+ "@tamagui/use-did-finish-ssr": "^1.0.1-beta.200",
39
+ "@tamagui/use-event": "^1.0.1-beta.200",
40
+ "@tamagui/use-force-update": "^1.0.1-beta.200"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": "*",
44
44
  "react-dom": "*"
45
45
  },
46
46
  "devDependencies": {
47
- "@tamagui/build": "^1.0.1-beta.199",
47
+ "@tamagui/build": "^1.0.1-beta.200",
48
48
  "@types/node": "^16.11.9",
49
49
  "@types/react": "^18.0.15",
50
50
  "@types/react-native": "^0.69.2",
@@ -61,6 +61,8 @@ import { Slot, mergeEvent } from './views/Slot'
61
61
  import { wrapThemeManagerContext } from './views/Theme'
62
62
 
63
63
  React['keep']
64
+ // this appears to fix expo / babel not picking this up sometimes? really odd
65
+ process.env.TAMAGUI_TARGET
64
66
 
65
67
  /**
66
68
  * All things that need one-time setup after createTamagui is called
@@ -258,7 +260,7 @@ export function createComponent<
258
260
  // eslint-disable-next-line no-console
259
261
  console.groupCollapsed('initial props/state')
260
262
  // eslint-disable-next-line no-console
261
- console.log('props', propsIn)
263
+ console.log('propsIn', propsIn, 'turned into', props, 'order', Object.keys(props))
262
264
  // eslint-disable-next-line no-console
263
265
  console.log('splitStyles', splitStyles)
264
266
  // eslint-disable-next-line no-console
@@ -383,10 +385,10 @@ export function createComponent<
383
385
  if (prev.mediaState![key] !== next) {
384
386
  return {
385
387
  ...prev,
386
- mediaState: {
388
+ mediaState: getMediaStateObject({
387
389
  ...prev.mediaState,
388
390
  [key]: next,
389
- },
391
+ }),
390
392
  }
391
393
  }
392
394
  return prev
@@ -805,8 +807,7 @@ export function createComponent<
805
807
  // find space by media query
806
808
  if (state.mediaState && mediaKeys.length) {
807
809
  for (const key in state.mediaState) {
808
- if (!state.mediaState[key]) continue
809
- if (props[key] && props[key].space !== undefined) {
810
+ if (state.mediaState[key] && props[key] && props[key].space !== undefined) {
810
811
  space = props[key].space
811
812
  }
812
813
  }
@@ -957,7 +958,7 @@ export function createComponent<
957
958
  pressIn: false,
958
959
  focus: false,
959
960
  mounted: false,
960
- mediaState: getInitialMediaState(),
961
+ mediaState: getMediaStateObject(getInitialMediaState()),
961
962
  }
962
963
  defaultComponentStateMounted = {
963
964
  ...defaultComponentState,
@@ -1454,3 +1455,6 @@ const styleDisplayContents = {
1454
1455
  const dontComposePressabilityKeys = {
1455
1456
  onClick: true,
1456
1457
  }
1458
+
1459
+ const getMediaStateObject = (obj: Object) =>
1460
+ Object.fromEntries(Object.entries(obj).flatMap(([k, v]) => (v ? [[`$${k}`, v]] : [])))
@@ -339,7 +339,7 @@ const resolveTokensAndVariants: StyleResolver = (
339
339
  )
340
340
  } else {
341
341
  // nullish values cant be tokens, need no extra parsing
342
- res[fKey] = value[fKey]
342
+ res[fKey] = val
343
343
  }
344
344
  }
345
345
  if (process.env.NODE_ENV === 'development') {
@@ -1,7 +1,6 @@
1
1
  import { isWeb } from '@tamagui/constants'
2
2
 
3
3
  import { getConfig } from '../config'
4
- import { CreateShorthands } from '../types'
5
4
  import { expandStyle } from './expandStyle'
6
5
  import { colorToRGBA, normalizeColor } from './normalizeColor'
7
6
  import { normalizeValueWithProperty } from './normalizeValueWithProperty.js'
@@ -13,7 +13,7 @@ export function normalizeValueWithProperty(value: any, property?: string): any {
13
13
  return value
14
14
  }
15
15
  const cached = cache[value]
16
- if (cached) {
16
+ if (cached !== undefined) {
17
17
  return cached
18
18
  }
19
19
  let res = value
@@ -9,11 +9,11 @@ export declare const defaultOffset: {
9
9
  * 2. Normalizes various inconsistent styles to be more consistent
10
10
  * 3. Expands react-native shorthands, ie paddingHorizontal => paddingLeft, paddingRight
11
11
  */
12
- export declare function expandStyles(style: Record<string, any>, config?: import("../types").TamaguiInternalConfig<import("../types").CreateTokens<import("../types").VariableVal>, {
13
- [key: string]: Partial<import("../types").TamaguiBaseTheme> & {
14
- [key: string]: import("../types").VariableVal;
12
+ export declare function expandStyles(style: Record<string, any>, config?: import("..").TamaguiInternalConfig<import("..").CreateTokens<import("..").VariableVal>, {
13
+ [key: string]: Partial<import("..").TamaguiBaseTheme> & {
14
+ [key: string]: import("..").VariableVal;
15
15
  };
16
- }, import("../types").GenericShorthands, {
16
+ }, import("..").GenericShorthands, {
17
17
  [key: string]: {
18
18
  [key: string]: string | number;
19
19
  };
@@ -21,6 +21,6 @@ export declare function expandStyles(style: Record<string, any>, config?: import
21
21
  [key: string]: string | any[] | {
22
22
  [key: string]: any;
23
23
  };
24
- }, import("../types").GenericFonts>): Record<string, any>;
24
+ }, import("..").GenericFonts>): Record<string, any>;
25
25
  export declare function fixStyles(style: Record<string, any>): void;
26
26
  //# sourceMappingURL=expandStyles.d.ts.map