@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.
- package/dist/cjs/config.js +5 -2
- package/dist/cjs/config.js.map +2 -2
- package/dist/cjs/createComponent.js +6 -2
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTokens.js.map +1 -1
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/registerCSSVariable.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/config.js +3 -1
- package/dist/esm/config.js.map +2 -2
- package/dist/esm/createComponent.js +6 -2
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js.map +1 -1
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/helpers/registerCSSVariable.js.map +2 -2
- package/package.json +10 -10
- package/src/config.ts +6 -2
- package/src/createComponent.tsx +9 -3
- package/src/createTamagui.ts +1 -2
- package/src/createTokens.ts +5 -5
- package/src/createVariable.ts +2 -4
- package/src/helpers/registerCSSVariable.ts +2 -2
- package/src/types.tsx +2 -1
- package/types/config.d.ts +23 -19
- package/types/createTheme.d.ts +1 -1
- package/types/createTokens.d.ts +5 -5
- package/types/createVariable.d.ts +2 -3
- package/types/helpers/ThemeManager.d.ts +1 -1
- package/types/helpers/registerCSSVariable.d.ts +2 -2
- package/types/types.d.ts +2 -1
package/src/createVariable.ts
CHANGED
|
@@ -10,16 +10,14 @@ import { isWeb } from './constants/platform'
|
|
|
10
10
|
|
|
11
11
|
const IS_VAR = '__isVar__'
|
|
12
12
|
|
|
13
|
-
|
|
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
|
|
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,
|
|
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<
|
|
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: () =>
|
|
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<
|
|
22
|
-
background?: import("./createVariable").Variable<
|
|
23
|
-
backgroundHover?: import("./createVariable").Variable<
|
|
24
|
-
backgroundPress?: import("./createVariable").Variable<
|
|
25
|
-
backgroundFocus?: import("./createVariable").Variable<
|
|
26
|
-
color?: import("./createVariable").Variable<
|
|
27
|
-
colorHover?: import("./createVariable").Variable<
|
|
28
|
-
colorPress?: import("./createVariable").Variable<
|
|
29
|
-
colorFocus?: import("./createVariable").Variable<
|
|
30
|
-
borderColor?: import("./createVariable").Variable<
|
|
31
|
-
borderColorHover?: import("./createVariable").Variable<
|
|
32
|
-
borderColorPress?: import("./createVariable").Variable<
|
|
33
|
-
borderColorFocus?: import("./createVariable").Variable<
|
|
34
|
-
shadowColor?: import("./createVariable").Variable<
|
|
35
|
-
shadowColorHover?: import("./createVariable").Variable<
|
|
36
|
-
shadowColorPress?: import("./createVariable").Variable<
|
|
37
|
-
shadowColorFocus?: import("./createVariable").Variable<
|
|
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>;
|
package/types/createTheme.d.ts
CHANGED
|
@@ -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<
|
|
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
|
package/types/createTokens.d.ts
CHANGED
|
@@ -9,19 +9,19 @@ declare type MakeTokens<T> = T extends {
|
|
|
9
9
|
zIndex: infer J;
|
|
10
10
|
} ? {
|
|
11
11
|
color: {
|
|
12
|
-
[
|
|
12
|
+
[Key in keyof E]: E[Key] extends Variable ? E[Key] : Variable<E[Key]>;
|
|
13
13
|
};
|
|
14
14
|
space: {
|
|
15
|
-
[
|
|
15
|
+
[Key in keyof F]: F[Key] extends Variable ? F[Key] : Variable<F[Key]>;
|
|
16
16
|
};
|
|
17
17
|
size: {
|
|
18
|
-
[
|
|
18
|
+
[Key in keyof G]: G[Key] extends Variable ? G[Key] : Variable<G[Key]>;
|
|
19
19
|
};
|
|
20
20
|
radius: {
|
|
21
|
-
[
|
|
21
|
+
[Key in keyof H]: H[Key] extends Variable ? H[Key] : Variable<H[Key]>;
|
|
22
22
|
};
|
|
23
23
|
zIndex: {
|
|
24
|
-
[
|
|
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
|
-
|
|
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
|
|
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<
|
|
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
|
|
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<
|
|
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;
|