@tamagui/core 1.0.1-beta.180 → 1.0.1-beta.182

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.
@@ -10,16 +10,14 @@ import { isWeb } from './constants/platform'
10
10
 
11
11
  const IS_VAR = '__isVar__'
12
12
 
13
- export type VariableValue = string | number
14
-
15
- type VariableIn<A extends VariableValue = VariableValue> = {
13
+ type VariableIn<A = any> = {
16
14
  val: A
17
15
  name: string
18
16
  key: string
19
17
  isFloating?: boolean
20
18
  }
21
19
 
22
- export type Variable<A extends VariableValue = VariableValue> = VariableIn<A> & {
20
+ export type Variable<A = any> = VariableIn<A> & {
23
21
  [IS_VAR]?: true
24
22
  variable?: string
25
23
  }
@@ -1,4 +1,4 @@
1
- import { Variable, VariableValue, createCSSVariable } from '../createVariable'
1
+ import { Variable, createCSSVariable } from '../createVariable'
2
2
 
3
3
  export const registerCSSVariable = (v: Variable) => {
4
4
  tokensValueToVariable.set(v.val, v)
@@ -8,4 +8,4 @@ export const variableToCSS = (v: Variable) => {
8
8
  return `--${createCSSVariable(v.name, false)}:${typeof v.val === 'number' ? `${v.val}px` : v.val}`
9
9
  }
10
10
 
11
- export const tokensValueToVariable = new Map<VariableValue, any>()
11
+ export const tokensValueToVariable = new Map<any, any>()
package/src/types.tsx CHANGED
@@ -239,7 +239,7 @@ export type GenericTamaguiConfig = CreateTamaguiConfig<
239
239
  export type ThemeDefinition = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]
240
240
  export type ThemeKeys = keyof ThemeDefinition
241
241
  export type ThemeParsed = {
242
- [key in ThemeKeys]: Variable
242
+ [key in ThemeKeys]: Variable<any>
243
243
  }
244
244
  export type Tokens = TamaguiConfig['tokens']
245
245
  export type Shorthands = TamaguiConfig['shorthands']
@@ -1215,6 +1215,7 @@ export type TamaguiComponentState = {
1215
1215
  focus: boolean
1216
1216
  mounted: boolean
1217
1217
  mediaState?: null | Record<string, boolean>
1218
+ hasAnimation?: boolean
1218
1219
  animation?: null | {
1219
1220
  style?: any
1220
1221
  avoidClasses?: boolean
package/types/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfigListener, TamaguiInternalConfig } from './types';
1
+ import { ConfigListener, TamaguiInternalConfig, Tokens } from './types';
2
2
  export declare const setConfig: (next: TamaguiInternalConfig) => void;
3
3
  export declare const setConfigFont: (name: string, font: any, fontParsed: any) => void;
4
4
  export declare const getHasConfigured: () => boolean;
@@ -15,26 +15,30 @@ export declare const getConfig: () => TamaguiInternalConfig<import("./types").Cr
15
15
  [key: string]: any;
16
16
  };
17
17
  }, import("./types").GenericFonts>;
18
- export declare const getTokens: () => import("./types").CreateTokens<import("./createVariable").Variable<import("./createVariable").VariableValue>>;
18
+ export declare const getTokens: () => Tokens;
19
+ /**
20
+ * Note: this is the same as `getTokens`
21
+ */
22
+ export declare const useTokens: () => Tokens;
19
23
  export declare const getThemes: () => {
20
24
  [x: string]: {
21
- [x: string]: import("./createVariable").Variable<import("./createVariable").VariableValue>;
22
- background?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
23
- backgroundHover?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
24
- backgroundPress?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
25
- backgroundFocus?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
26
- color?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
27
- colorHover?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
28
- colorPress?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
29
- colorFocus?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
30
- borderColor?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
31
- borderColorHover?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
32
- borderColorPress?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
33
- borderColorFocus?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
34
- shadowColor?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
35
- shadowColorHover?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
36
- shadowColorPress?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
37
- shadowColorFocus?: import("./createVariable").Variable<import("./createVariable").VariableValue> | undefined;
25
+ [x: string]: import("./createVariable").Variable<any>;
26
+ background?: import("./createVariable").Variable<any> | undefined;
27
+ backgroundHover?: import("./createVariable").Variable<any> | undefined;
28
+ backgroundPress?: import("./createVariable").Variable<any> | undefined;
29
+ backgroundFocus?: import("./createVariable").Variable<any> | undefined;
30
+ color?: import("./createVariable").Variable<any> | undefined;
31
+ colorHover?: import("./createVariable").Variable<any> | undefined;
32
+ colorPress?: import("./createVariable").Variable<any> | undefined;
33
+ colorFocus?: import("./createVariable").Variable<any> | undefined;
34
+ borderColor?: import("./createVariable").Variable<any> | undefined;
35
+ borderColorHover?: import("./createVariable").Variable<any> | undefined;
36
+ borderColorPress?: import("./createVariable").Variable<any> | undefined;
37
+ borderColorFocus?: import("./createVariable").Variable<any> | undefined;
38
+ shadowColor?: import("./createVariable").Variable<any> | undefined;
39
+ shadowColorHover?: import("./createVariable").Variable<any> | undefined;
40
+ shadowColorPress?: import("./createVariable").Variable<any> | undefined;
41
+ shadowColorFocus?: import("./createVariable").Variable<any> | undefined;
38
42
  };
39
43
  };
40
44
  export declare const configListeners: Set<ConfigListener>;
@@ -2,6 +2,6 @@ import { Variable } from './createVariable';
2
2
  declare type GenericTheme = {
3
3
  [key: string]: string | Variable;
4
4
  };
5
- export declare const createTheme: <Theme extends GenericTheme>(theme: Theme) => { [K in keyof Theme]: string | Variable<import("./createVariable").VariableValue> | Theme[K]; };
5
+ export declare const createTheme: <Theme extends GenericTheme>(theme: Theme) => { [K in keyof Theme]: string | Variable<any> | Theme[K]; };
6
6
  export {};
7
7
  //# sourceMappingURL=createTheme.d.ts.map
@@ -9,19 +9,19 @@ declare type MakeTokens<T> = T extends {
9
9
  zIndex: infer J;
10
10
  } ? {
11
11
  color: {
12
- [key in keyof E]: Variable;
12
+ [Key in keyof E]: E[Key] extends Variable ? E[Key] : Variable<E[Key]>;
13
13
  };
14
14
  space: {
15
- [key in keyof F]: Variable;
15
+ [Key in keyof F]: F[Key] extends Variable ? F[Key] : Variable<F[Key]>;
16
16
  };
17
17
  size: {
18
- [key in keyof G]: Variable;
18
+ [Key in keyof G]: G[Key] extends Variable ? G[Key] : Variable<G[Key]>;
19
19
  };
20
20
  radius: {
21
- [key in keyof H]: Variable;
21
+ [Key in keyof H]: H[Key] extends Variable ? H[Key] : Variable<H[Key]>;
22
22
  };
23
23
  zIndex: {
24
- [key in keyof J]: Variable;
24
+ [Key in keyof J]: J[Key] extends Variable ? J[Key] : Variable<J[Key]>;
25
25
  };
26
26
  } : never;
27
27
  export {};
@@ -3,14 +3,13 @@
3
3
  * Moving to objects for React Server Components support
4
4
  */
5
5
  declare const IS_VAR = "__isVar__";
6
- export declare type VariableValue = string | number;
7
- declare type VariableIn<A extends VariableValue = VariableValue> = {
6
+ declare type VariableIn<A = any> = {
8
7
  val: A;
9
8
  name: string;
10
9
  key: string;
11
10
  isFloating?: boolean;
12
11
  };
13
- export declare type Variable<A extends VariableValue = VariableValue> = VariableIn<A> & {
12
+ export declare type Variable<A = any> = VariableIn<A> & {
14
13
  [IS_VAR]?: true;
15
14
  variable?: string;
16
15
  };
@@ -26,7 +26,7 @@ export declare class ThemeManager {
26
26
  get didChangeTheme(): boolean | null;
27
27
  get parentName(): string | null;
28
28
  get fullName(): string;
29
- getValue(key: string): import("..").Variable<import("..").VariableValue> | undefined;
29
+ getValue(key: string): import("..").Variable<any> | undefined;
30
30
  isTracking(uuid: Object): boolean;
31
31
  update({ name, theme, className }?: SetActiveThemeProps, force?: boolean, notify?: boolean): boolean;
32
32
  getNextTheme(props?: GetNextThemeProps, debug?: any): {
@@ -1,5 +1,5 @@
1
- import { Variable, VariableValue } from '../createVariable';
1
+ import { Variable } from '../createVariable';
2
2
  export declare const registerCSSVariable: (v: Variable) => void;
3
3
  export declare const variableToCSS: (v: Variable) => string;
4
- export declare const tokensValueToVariable: Map<VariableValue, any>;
4
+ export declare const tokensValueToVariable: Map<any, any>;
5
5
  //# sourceMappingURL=registerCSSVariable.d.ts.map
package/types/types.d.ts CHANGED
@@ -136,7 +136,7 @@ export declare type GenericTamaguiConfig = CreateTamaguiConfig<GenericTokens, Ge
136
136
  export declare type ThemeDefinition = TamaguiConfig['themes'][keyof TamaguiConfig['themes']];
137
137
  export declare type ThemeKeys = keyof ThemeDefinition;
138
138
  export declare type ThemeParsed = {
139
- [key in ThemeKeys]: Variable;
139
+ [key in ThemeKeys]: Variable<any>;
140
140
  };
141
141
  export declare type Tokens = TamaguiConfig['tokens'];
142
142
  export declare type Shorthands = TamaguiConfig['shorthands'];
@@ -552,6 +552,7 @@ export declare type TamaguiComponentState = {
552
552
  focus: boolean;
553
553
  mounted: boolean;
554
554
  mediaState?: null | Record<string, boolean>;
555
+ hasAnimation?: boolean;
555
556
  animation?: null | {
556
557
  style?: any;
557
558
  avoidClasses?: boolean;