@tamagui/core 1.0.1-beta.167 → 1.0.1-beta.169

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 (94) hide show
  1. package/dist/cjs/addTheme.js.map +1 -1
  2. package/dist/cjs/config.js.map +1 -1
  3. package/dist/cjs/constants/platform.js +4 -4
  4. package/dist/cjs/constants/platform.js.map +2 -2
  5. package/dist/cjs/constants/platform.native.js +3 -3
  6. package/dist/cjs/constants/platform.native.js.map +2 -2
  7. package/dist/cjs/createComponent.js +39 -17
  8. package/dist/cjs/createComponent.js.map +2 -2
  9. package/dist/cjs/createTamagui.js +1 -4
  10. package/dist/cjs/createTamagui.js.map +2 -2
  11. package/dist/cjs/helpers/ThemeManager.js.map +1 -1
  12. package/dist/cjs/helpers/getSplitStyles.js +18 -10
  13. package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
  14. package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
  15. package/dist/cjs/hooks/useIsSSR.js +11 -7
  16. package/dist/cjs/hooks/useIsSSR.js.map +2 -2
  17. package/dist/cjs/hooks/useIsTouchDevice.js +1 -1
  18. package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
  19. package/dist/cjs/hooks/useMedia.js +51 -29
  20. package/dist/cjs/hooks/useMedia.js.map +2 -2
  21. package/dist/cjs/hooks/useTheme.js +1 -1
  22. package/dist/cjs/hooks/useTheme.js.map +2 -2
  23. package/dist/cjs/styled.js +11 -8
  24. package/dist/cjs/styled.js.map +2 -2
  25. package/dist/cjs/types.js.map +1 -1
  26. package/dist/cjs/updateTheme.js.map +2 -2
  27. package/dist/cjs/views/TamaguiProvider.js +2 -2
  28. package/dist/cjs/views/TamaguiProvider.js.map +2 -2
  29. package/dist/esm/addTheme.js.map +1 -1
  30. package/dist/esm/config.js.map +1 -1
  31. package/dist/esm/constants/platform.js +3 -3
  32. package/dist/esm/constants/platform.js.map +2 -2
  33. package/dist/esm/constants/platform.native.js +2 -2
  34. package/dist/esm/constants/platform.native.js.map +2 -2
  35. package/dist/esm/createComponent.js +43 -18
  36. package/dist/esm/createComponent.js.map +2 -2
  37. package/dist/esm/createTamagui.js +1 -4
  38. package/dist/esm/createTamagui.js.map +2 -2
  39. package/dist/esm/helpers/ThemeManager.js.map +1 -1
  40. package/dist/esm/helpers/getSplitStyles.js +18 -10
  41. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  42. package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
  43. package/dist/esm/hooks/useIsSSR.js +12 -8
  44. package/dist/esm/hooks/useIsSSR.js.map +2 -2
  45. package/dist/esm/hooks/useIsTouchDevice.js +2 -2
  46. package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
  47. package/dist/esm/hooks/useMedia.js +51 -30
  48. package/dist/esm/hooks/useMedia.js.map +2 -2
  49. package/dist/esm/hooks/useTheme.js +2 -2
  50. package/dist/esm/hooks/useTheme.js.map +2 -2
  51. package/dist/esm/styled.js +11 -8
  52. package/dist/esm/styled.js.map +2 -2
  53. package/dist/esm/updateTheme.js.map +2 -2
  54. package/dist/esm/views/TamaguiProvider.js +3 -3
  55. package/dist/esm/views/TamaguiProvider.js.map +2 -2
  56. package/package.json +10 -10
  57. package/src/addTheme.ts +3 -3
  58. package/src/config.ts +1 -1
  59. package/src/constants/platform.native.ts +1 -1
  60. package/src/constants/platform.ts +2 -2
  61. package/src/createComponent.tsx +51 -23
  62. package/src/createTamagui.ts +7 -10
  63. package/src/helpers/ThemeManager.tsx +4 -4
  64. package/src/helpers/getSplitStyles.tsx +27 -13
  65. package/src/helpers/getThemeCSSRules.ts +2 -2
  66. package/src/hooks/useIsSSR.tsx +13 -8
  67. package/src/hooks/useIsTouchDevice.tsx +2 -2
  68. package/src/hooks/useMedia.tsx +72 -39
  69. package/src/hooks/useTheme.tsx +6 -7
  70. package/src/styled.tsx +14 -8
  71. package/src/types.tsx +41 -12
  72. package/src/updateTheme.ts +2 -2
  73. package/src/views/TamaguiProvider.tsx +3 -4
  74. package/types/addTheme.d.ts +2 -2
  75. package/types/config.d.ts +18 -2
  76. package/types/constants/platform.d.ts +1 -1
  77. package/types/constants/platform.native.d.ts +1 -1
  78. package/types/createVariable.d.ts +4 -0
  79. package/types/helpers/ThemeManager.d.ts +5 -5
  80. package/types/helpers/calc.d.ts +5 -0
  81. package/types/helpers/expandStyle.d.ts +4 -0
  82. package/types/helpers/expandStyles.d.ts +7 -0
  83. package/types/helpers/getSplitStyles.d.ts +3 -3
  84. package/types/helpers/getStylesAtomic.d.ts +4 -0
  85. package/types/helpers/getThemeCSSRules.d.ts +2 -2
  86. package/types/helpers/mergeProps.d.ts +13 -0
  87. package/types/helpers/normalizeValueWithProperty.d.ts +4 -0
  88. package/types/hooks/useIsSSR.d.ts +3 -1
  89. package/types/hooks/useMedia.d.ts +8 -5
  90. package/types/hooks/useTheme.d.ts +4 -4
  91. package/types/insertFont.d.ts +3 -0
  92. package/types/styled.d.ts +1 -0
  93. package/types/types.d.ts +111 -11
  94. package/types/updateTheme.d.ts +2 -2
package/types/config.d.ts CHANGED
@@ -17,8 +17,24 @@ export declare const getConfig: () => TamaguiInternalConfig<import("./types").Cr
17
17
  }, import("./types").GenericFonts>;
18
18
  export declare const getTokens: () => import("./types").CreateTokens<import("./createVariable").Variable<import("./createVariable").VariableValue>>;
19
19
  export declare const getThemes: () => {
20
- [key: string]: Partial<import("./types").TamaguiBaseTheme> & {
21
- [key: string]: import("./types").VariableVal;
20
+ [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;
22
38
  };
23
39
  };
24
40
  export declare const configListeners: Set<ConfigListener>;
@@ -3,7 +3,7 @@ export declare const isAndroid: boolean;
3
3
  export declare const isIOS: boolean;
4
4
  export declare const isWeb: boolean;
5
5
  export declare const isWindowDefined: boolean;
6
- export declare const isSSR: boolean;
6
+ export declare const isServer: boolean;
7
7
  export declare const isClient: boolean;
8
8
  export declare const isRSC: any;
9
9
  export declare const useIsomorphicLayoutEffect: typeof useEffect;
@@ -3,7 +3,7 @@ export declare const isAndroid: boolean;
3
3
  export declare const isIOS: boolean;
4
4
  export declare const isWeb = false;
5
5
  export declare const isWindowDefined = false;
6
- export declare const isSSR = false;
6
+ export declare const isServer = false;
7
7
  export declare const isClient = false;
8
8
  export declare const isRSC = false;
9
9
  export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Should rename this to Token
3
+ * Moving to objects for React Server Components support
4
+ */
1
5
  declare const IS_VAR = "__isVar__";
2
6
  export declare type VariableValue = string | number;
3
7
  declare type VariableIn<A extends VariableValue = VariableValue> = {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ThemeObject, Themes } from '../types';
2
+ import { ThemeParsed, Themes } from '../types';
3
3
  declare type ThemeListener = (name: string | null, themeManager: ThemeManager) => void;
4
4
  export declare type SetActiveThemeProps = {
5
5
  className?: string;
@@ -16,22 +16,22 @@ export declare type GetNextThemeProps = {
16
16
  export declare class ThemeManager {
17
17
  name: string;
18
18
  className: string;
19
- theme: ThemeObject | null;
19
+ theme: ThemeParsed | null;
20
20
  parentManager: ThemeManager | null;
21
21
  reset: boolean;
22
22
  keys: Map<any, Set<string>>;
23
23
  listeners: Map<any, Function>;
24
24
  themeListeners: Set<ThemeListener>;
25
- constructor(name?: string, className?: string, theme?: ThemeObject | null, parentManager?: ThemeManager | null, reset?: boolean);
25
+ constructor(name?: string, className?: string, theme?: ThemeParsed | null, parentManager?: ThemeManager | null, reset?: boolean);
26
26
  get didChangeTheme(): boolean | null;
27
27
  get parentName(): string | null;
28
28
  get fullName(): string;
29
- getValue(key: string): import("../types").VariableVal | undefined;
29
+ getValue(key: string): import("..").Variable<import("..").VariableValue> | undefined;
30
30
  isTracking(uuid: Object): boolean;
31
31
  update({ name, theme, className }?: SetActiveThemeProps, force?: boolean): boolean;
32
32
  getNextTheme(props?: GetNextThemeProps, debug?: any): {
33
33
  name: string;
34
- theme: ThemeObject | null;
34
+ theme: ThemeParsed | null;
35
35
  className: string | undefined;
36
36
  };
37
37
  getClassName(name: string): string;
@@ -1,4 +1,9 @@
1
1
  import { FontLineHeightTokens, FontSizeTokens, SizeTokens, SpaceTokens } from '../types';
2
+ /**
3
+ * Simple calc() that handles native + web
4
+ * on web: outputs a calc() string
5
+ * on native: outputs a plain number
6
+ */
2
7
  export declare type CalcVal = string | number | SizeTokens | SpaceTokens | FontSizeTokens | FontLineHeightTokens;
3
8
  declare const operators: {
4
9
  '+': (a: number, b: number) => number;
@@ -1,2 +1,6 @@
1
+ /**
2
+ * Some parts adapted from react-native-web
3
+ * Copyright (c) Nicolas Gallagher licensed under the MIT license.
4
+ */
1
5
  export declare function expandStyle(key: string, value: any): any[][] | undefined;
2
6
  //# sourceMappingURL=expandStyle.d.ts.map
@@ -2,6 +2,13 @@ export declare const defaultOffset: {
2
2
  height: number;
3
3
  width: number;
4
4
  };
5
+ /**
6
+ * This is what you want to run before Object.assign() a style onto another.
7
+ * It does the following:
8
+ * 1. Turns user shorthands into longhands, ie px = paddingHorizontal
9
+ * 2. Normalizes various inconsistent styles to be more consistent
10
+ * 3. Expands react-native shorthands, ie paddingHorizontal => paddingLeft, paddingRight
11
+ */
5
12
  export declare function expandStyles(style: Record<string, any>, config?: import("..").TamaguiInternalConfig<import("..").CreateTokens<import("..").VariableVal>, {
6
13
  [key: string]: Partial<import("..").TamaguiBaseTheme> & {
7
14
  [key: string]: import("..").VariableVal;
@@ -1,5 +1,5 @@
1
1
  import type { ViewStyle } from 'react-native';
2
- import type { DebugProp, MediaQueryKey, PseudoStyles, SplitStyleState, StackProps, StaticConfigParsed, TamaguiInternalConfig, ThemeObject } from '../types';
2
+ import type { DebugProp, MediaQueryKey, PseudoStyles, SplitStyleState, StackProps, StaticConfigParsed, TamaguiInternalConfig, ThemeParsed } from '../types';
3
3
  import { FontLanguageProps, LanguageContextType } from '../views/FontLanguage.types';
4
4
  import { RulesToInsert } from './insertStyleRule';
5
5
  export declare type SplitStyles = ReturnType<typeof getSplitStyles>;
@@ -7,7 +7,7 @@ export declare type ClassNamesObject = Record<string, string>;
7
7
  export declare type SplitStyleResult = ReturnType<typeof getSplitStyles>;
8
8
  declare type StyleSplitter = (props: {
9
9
  [key: string]: any;
10
- }, staticConfig: StaticConfigParsed, theme: ThemeObject, state: SplitStyleState, defaultClassNames?: any, languageContext?: LanguageContextType, debug?: DebugProp) => {
10
+ }, staticConfig: StaticConfigParsed, theme: ThemeParsed, state: SplitStyleState, defaultClassNames?: any, languageContext?: LanguageContextType, debug?: DebugProp) => {
11
11
  pseudos: PseudoStyles;
12
12
  medias: Record<MediaQueryKey, ViewStyle>;
13
13
  style: ViewStyle;
@@ -24,7 +24,7 @@ export declare const pseudoCNInverse: {
24
24
  press: string;
25
25
  };
26
26
  export declare const getSplitStyles: StyleSplitter;
27
- export declare const getSubStyle: (subKey: string, styleIn: Object, staticConfig: StaticConfigParsed, theme: ThemeObject, props: any, state: SplitStyleState, conf: TamaguiInternalConfig, languageContext?: FontLanguageProps, avoidDefaultProps?: boolean) => ViewStyle;
27
+ export declare const getSubStyle: (subKey: string, styleIn: Object, staticConfig: StaticConfigParsed, theme: ThemeParsed, props: any, state: SplitStyleState, conf: TamaguiInternalConfig, languageContext?: FontLanguageProps, avoidDefaultProps?: boolean) => ViewStyle;
28
28
  export declare const insertSplitStyles: StyleSplitter;
29
29
  export declare const useSplitStyles: StyleSplitter;
30
30
  export {};
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Some parts adapted from react-native-web
3
+ * Copyright (c) Nicolas Gallagher licensed under the MIT license.
4
+ */
1
5
  import { StyleObject } from '@tamagui/helpers';
2
6
  import type { TextStyle, ViewStyle } from 'react-native';
3
7
  import { PseudoDescriptor } from './pseudoDescriptors';
@@ -1,8 +1,8 @@
1
- import { CreateTamaguiProps, ThemeObject } from '../types';
1
+ import { CreateTamaguiProps, ThemeParsed } from '../types';
2
2
  export declare function getThemeCSSRules({ config, themeName, theme, names, }: {
3
3
  config: CreateTamaguiProps;
4
4
  themeName: string;
5
- theme: ThemeObject;
5
+ theme: ThemeParsed;
6
6
  names: string[];
7
7
  }): string[];
8
8
  //# sourceMappingURL=getThemeCSSRules.d.ts.map
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Preserves prop ordering, so that the order most closely matches the last spread objects
3
+ * Useful for having { ...defaultProps, ...props } that ensure props ordering is always kept
4
+ *
5
+ * Given:
6
+ * mergeProps({ a: 1, b: 2 }, { b: 1, a: 2 })
7
+ * The final key order will be:
8
+ * b, a
9
+ *
10
+ * Handles a couple special tamagui cases
11
+ * - classNames can be extracted out separately
12
+ * - shorthands can be expanded before merging
13
+ */
1
14
  declare type StringRecord = Record<string, string>;
2
15
  export declare const mergeProps: (a: Object, b: Object, leaveOutClassNames?: boolean, inverseShorthands?: StringRecord) => readonly [StringRecord, StringRecord];
3
16
  export {};
@@ -1,2 +1,6 @@
1
+ /**
2
+ * Some parts adapted from react-native-web
3
+ * Copyright (c) Nicolas Gallagher licensed under the MIT license.
4
+ */
1
5
  export declare function normalizeValueWithProperty(value: any, property?: string): any;
2
6
  //# sourceMappingURL=normalizeValueWithProperty.d.ts.map
@@ -1,2 +1,4 @@
1
- export declare const useIsSSR: () => boolean;
1
+ export declare const useIsSSR: (props?: {
2
+ immediate?: boolean;
3
+ }) => boolean;
2
4
  //# sourceMappingURL=useIsSSR.d.ts.map
@@ -1,13 +1,16 @@
1
- import { ConfigureMediaQueryOptions, MediaQueries, MediaQueryKey, MediaQueryObject, MediaQueryState } from '../types';
1
+ import { MediaQueries, MediaQueryKey, MediaQueryObject, MediaQueryState, TamaguiInternalConfig } from '../types';
2
2
  export declare const mediaState: MediaQueryState;
3
- export declare function addMediaQueryListener(key: MediaQueryKey, cb: any): () => void;
4
- export declare function removeMediaQueryListener(key: MediaQueryKey, cb: any): void;
3
+ declare type MediaListener = (next: boolean) => void;
4
+ export declare function addMediaQueryListener(key: MediaQueryKey, cb: MediaListener): () => void;
5
+ export declare function removeMediaQueryListener(key: MediaQueryKey, cb: MediaListener): void;
5
6
  export declare const mediaQueryConfig: MediaQueries;
6
7
  export declare const getMedia: () => MediaQueryState;
7
- export declare const configureMedia: ({ queries, defaultActive, }?: ConfigureMediaQueryOptions) => void;
8
- export declare function useMediaQueryListeners(): void;
8
+ export declare const configureMedia: (config: TamaguiInternalConfig) => void;
9
+ export declare const getInitialMediaState: () => MediaQueryState | null;
10
+ export declare function useMediaQueryListeners(config: TamaguiInternalConfig): void;
9
11
  export declare function useMedia(): {
10
12
  [key in MediaQueryKey]: boolean;
11
13
  };
12
14
  export declare function mediaObjectToString(query: string | MediaQueryObject): string;
15
+ export {};
13
16
  //# sourceMappingURL=useMedia.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { ThemeManager } from '../helpers/ThemeManager';
2
- import { ThemeName, ThemeObject } from '../types';
2
+ import { ThemeName, ThemeParsed } from '../types';
3
3
  export interface ThemeProps {
4
4
  className?: string;
5
5
  disableThemeClass?: boolean;
@@ -9,7 +9,7 @@ export interface ThemeProps {
9
9
  reset?: boolean;
10
10
  debug?: boolean | 'verbose';
11
11
  }
12
- export declare const useTheme: (themeName?: string | null, componentName?: string, props?: ThemeProps, forceUpdate?: any) => ThemeObject;
12
+ export declare const useTheme: (themeName?: string | null, componentName?: string, props?: ThemeProps, forceUpdate?: any) => ThemeParsed;
13
13
  export declare const getThemeManager: (theme: any) => ThemeManager | undefined;
14
14
  export declare const useThemeName: (opts?: {
15
15
  parent?: true;
@@ -17,10 +17,10 @@ export declare const useThemeName: (opts?: {
17
17
  export declare const useDefaultThemeName: () => ThemeName | undefined;
18
18
  export declare const activeThemeManagers: Set<ThemeManager>;
19
19
  export declare const useChangeThemeEffect: (name?: string | null, componentName?: string, props?: ThemeProps, forceUpdateProp?: any, uuid?: Object) => {
20
- themes: Record<string, ThemeObject>;
20
+ themes: Record<string, ThemeParsed>;
21
21
  themeManager: ThemeManager | null;
22
22
  name: string;
23
- theme: ThemeObject | null;
23
+ theme: ThemeParsed | null;
24
24
  className?: string | undefined;
25
25
  };
26
26
  //# sourceMappingURL=useTheme.d.ts.map
@@ -1,5 +1,8 @@
1
1
  import { DeepVariableObject } from './createVariables';
2
2
  import { GenericFont } from './types';
3
+ /**
4
+ * Runtime dynamic insert font
5
+ */
3
6
  export declare function insertFont<A extends GenericFont>(name: string, fontIn: A): DeepVariableObject<A>;
4
7
  export declare function parseFont<A extends GenericFont>(definition: A): DeepVariableObject<A>;
5
8
  export declare function registerFontVariables(parsedFont: any): string[];
package/types/styled.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare function styled<ParentComponent extends StylableComponent, Varian
14
14
  defaultVariants?: {
15
15
  [key: string]: any;
16
16
  };
17
+ acceptsClassName?: boolean;
17
18
  }, staticExtractionOptions?: Partial<StaticConfig>): TamaguiComponent<Variants extends void ? GetProps<ParentComponent> : GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; }) & MediaProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>> & PseudoProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>>, TamaguiElement, GetBaseProps<ParentComponent>, GetVariantProps<ParentComponent> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>;
18
19
  export {};
19
20
  //# sourceMappingURL=styled.d.ts.map
package/types/types.d.ts CHANGED
@@ -108,7 +108,11 @@ export declare type CreateTamaguiConfig<A extends GenericTokens, B extends Gener
108
108
  fonts: RemoveLanguagePostfixes<F>;
109
109
  fontLanguages: GetLanguagePostfixes<F> extends never ? string[] : GetLanguagePostfixes<F>[];
110
110
  tokens: A;
111
- themes: B;
111
+ themes: {
112
+ [Name in keyof B]: {
113
+ [Key in keyof B[Name]]: Variable;
114
+ };
115
+ };
112
116
  shorthands: C;
113
117
  media: D;
114
118
  animations: AnimationDriver<E>;
@@ -129,13 +133,16 @@ declare type ConfProps<A extends GenericTokens, B extends GenericThemes, C exten
129
133
  };
130
134
  export declare type InferTamaguiConfig<Conf> = Conf extends ConfProps<infer A, infer B, infer C, infer D, infer E, infer F> ? TamaguiInternalConfig<A, B, C, D, E, F> : unknown;
131
135
  export declare type GenericTamaguiConfig = CreateTamaguiConfig<GenericTokens, GenericThemes, GenericShorthands, GenericMedia, GenericAnimations, GenericFonts>;
132
- export declare type ThemeObject = TamaguiConfig['themes'][keyof TamaguiConfig['themes']];
136
+ export declare type ThemeDefinition = TamaguiConfig['themes'][keyof TamaguiConfig['themes']];
137
+ export declare type ThemeKeys = keyof ThemeDefinition;
138
+ export declare type ThemeParsed = {
139
+ [key in ThemeKeys]: Variable;
140
+ };
133
141
  export declare type Tokens = TamaguiConfig['tokens'];
134
142
  export declare type Shorthands = TamaguiConfig['shorthands'];
135
143
  export declare type Media = TamaguiConfig['media'];
136
144
  export declare type Themes = TamaguiConfig['themes'];
137
145
  export declare type ThemeName = GetAltThemeNames<keyof Themes>;
138
- export declare type ThemeKeys = keyof ThemeObject;
139
146
  export declare type ThemeTokens = `$${ThemeKeys}`;
140
147
  export declare type AnimationKeys = Omit<GetAnimationKeys<TamaguiConfig>, number>;
141
148
  export declare type FontLanguages = ArrayIntersection<TamaguiConfig['fontLanguages']>;
@@ -158,6 +165,24 @@ export declare type CreateTamaguiProps = {
158
165
  };
159
166
  };
160
167
  defaultTheme?: string;
168
+ /**
169
+ * *Advanced use case* For all CSS extracted views, this has no effect.
170
+ *
171
+ * For SSR compatibility on the web, Tamagui will render once with the settings
172
+ * from `mediaQueryDefaultActive` set for all media queries. Then, it will render
173
+ * again after the initial render using the proper media query values. This is so that
174
+ * hydration will match perfectly with the server.
175
+ *
176
+ * Setting disableSSR will avoid this second render by setting the media query state
177
+ * to the actual browser dimensions on initial load. This is only useful for client-only
178
+ * apps.
179
+ *
180
+ */
181
+ disableSSR?: boolean;
182
+ /**
183
+ * Disable inserting a theme class in the DOM or context, allowing you to manually place it higher.
184
+ * For custom use cases like integration with next-theme.
185
+ */
161
186
  disableRootThemeClass?: boolean;
162
187
  defaultProps?: Record<string, any> & {
163
188
  Stack?: StackProps;
@@ -177,7 +202,6 @@ export declare type TamaguiInternalConfig<A extends GenericTokens = GenericToken
177
202
  getCSS: () => string;
178
203
  parsed: boolean;
179
204
  inverseShorthands: Record<string, string>;
180
- themeClassNameOnRoot?: boolean;
181
205
  };
182
206
  export declare type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']['animations'];
183
207
  export declare type UnionableString = string & {};
@@ -227,10 +251,6 @@ export declare type MediaProps<A> = {
227
251
  export declare type MediaQueries = {
228
252
  [key in MediaQueryKey]: MediaQueryObject;
229
253
  };
230
- export declare type ConfigureMediaQueryOptions = {
231
- queries?: MediaQueries;
232
- defaultActive?: Record<MediaQueryKey, boolean>;
233
- };
234
254
  export declare type TransformStyleProps = {
235
255
  x?: number;
236
256
  y?: number;
@@ -265,7 +285,7 @@ declare type GetTokenFontKeysFor<A extends 'size' | 'weight' | 'letterSpacing' |
265
285
  declare type GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`;
266
286
  export declare type SizeTokens = GetTokenString<keyof Tokens['size']> | number;
267
287
  export declare type SpaceTokens = GetTokenString<keyof Tokens['space']> | number | boolean;
268
- export declare type ColorTokens = GetTokenString<keyof Tokens['color']> | GetTokenString<keyof ThemeObject> | CSSColorNames;
288
+ export declare type ColorTokens = GetTokenString<keyof Tokens['color']> | GetTokenString<keyof ThemeParsed> | CSSColorNames;
269
289
  export declare type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number;
270
290
  export declare type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number;
271
291
  export declare type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>;
@@ -348,7 +368,7 @@ export declare type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'chi
348
368
  disableInjectCSS?: boolean;
349
369
  children?: React.ReactNode;
350
370
  };
351
- export declare type PropMapper = (key: string, value: any, theme: ThemeObject, props: Record<string, any>, state: Partial<SplitStyleState>, languageContext?: FontLanguageProps, avoidDefaultProps?: boolean, debug?: DebugProp) => undefined | [string, any][];
371
+ export declare type PropMapper = (key: string, value: any, theme: ThemeParsed, props: Record<string, any>, state: Partial<SplitStyleState>, languageContext?: FontLanguageProps, avoidDefaultProps?: boolean, debug?: DebugProp) => undefined | [string, any][];
352
372
  export declare type StaticConfigParsed = StaticConfig & {
353
373
  parsed: true;
354
374
  propMapper: PropMapper;
@@ -368,32 +388,106 @@ export declare type GenericVariantDefinitions = {
368
388
  export declare type StaticConfig = {
369
389
  Component?: React.FunctionComponent<any> & StaticComponentObject;
370
390
  variants?: GenericVariantDefinitions;
391
+ /**
392
+ * Used for applying sub theme style
393
+ */
371
394
  componentName?: string;
395
+ /**
396
+ * (compiler) If you need to pass context or something, prevents from ever
397
+ * flattening. The 'jsx' option means it will never flatten. if you
398
+ * pass JSX as a children (if its purely string, it will still flatten).
399
+ */
372
400
  neverFlatten?: boolean | 'jsx';
401
+ /**
402
+ * Determines ultimate output tag (Text vs View)
403
+ */
373
404
  isText?: boolean;
405
+ /**
406
+ * Attempts to attach focus styles at runtime (useful for native)
407
+ */
374
408
  isInput?: boolean;
409
+ /**
410
+ * React native web images need special handling for className support
411
+ */
375
412
  isImage?: boolean;
413
+ /**
414
+ * Which style keys are allowed to be extracted.
415
+ */
376
416
  validStyles?: {
377
417
  [key: string]: boolean;
378
418
  };
419
+ /**
420
+ * Same as React.defaultProps, be sure to sync
421
+ */
379
422
  defaultProps: Record<string, any>;
423
+ /**
424
+ * (compiler) If these props are encountered, bail on all optimization.
425
+ */
380
426
  deoptProps?: Set<string>;
427
+ /**
428
+ * (compiler) If these props are encountered, leave them un-extracted.
429
+ */
381
430
  inlineProps?: Set<string>;
431
+ /**
432
+ * (compiler) If not flattening, leave this prop as original value.
433
+ * Only applies to style attributes
434
+ */
382
435
  inlineWhenUnflattened?: Set<string>;
436
+ /**
437
+ * (compiler) A bit odd, only for more advanced heirarchies.
438
+ * Indicates that the component will set this prop so the
439
+ * static extraction can ensure it sets them to ={undefined}
440
+ * so they get overriddent. In the future, this can be smarter.
441
+ */
383
442
  ensureOverriddenProp?: {
384
443
  [key: string]: boolean;
385
444
  };
445
+ /**
446
+ * Auto-detected, but can ovverride. Wraps children to space them on top
447
+ */
386
448
  isZStack?: boolean;
449
+ /**
450
+ * Merges into defaultProps later on, used internally yonly
451
+ */
387
452
  defaultVariants?: {
388
453
  [key: string]: any;
389
454
  };
455
+ /**
456
+ * Auto-detect, but can ovverride, passes styles properly to react-native-web
457
+ */
390
458
  isReactNativeWeb?: boolean;
459
+ /**
460
+ * Used internally to keep reference to the original rnw component
461
+ */
391
462
  reactNativeWebComponent?: any;
463
+ /**
464
+ * Memoize the component
465
+ */
392
466
  memo?: boolean;
467
+ /**
468
+ * Auto-detect, but can ovverride, passes styles properly to react-native-web
469
+ */
393
470
  isTamagui?: boolean;
471
+ /**
472
+ * Used internally to handle extractable HoC separate
473
+ */
394
474
  isHOC?: boolean;
475
+ /**
476
+ * Used insternally to attach default props to names
477
+ */
395
478
  parentNames?: string[];
396
- };
479
+ /**
480
+ * By default if styled() doesn't recognize a parent Tamagui compoent or specific react-native views,
481
+ * it will assume the passed in component only accepts style={} for react-native compatibility.
482
+ * Setting `acceptsClassName: true` indicates Tamagui can pass in className props.
483
+ */
484
+ acceptsClassName?: boolean;
485
+ };
486
+ /**
487
+ * --------------------------------------------
488
+ * variants
489
+ * --------------------------------------------
490
+ */
397
491
  export declare type StylableComponent = TamaguiComponent | React.Component | React.ForwardRefExoticComponent<any> | ReactComponentWithRef<any, any> | (new (props: any) => any) | typeof View | typeof Text | typeof TextInput | typeof Image;
398
492
  export declare type GetStyledVariants<A extends TamaguiComponent> = A extends TamaguiComponent<any, any, any, infer Variants> ? Variants : never;
399
493
  export declare type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<any, any, infer BaseProps> ? BaseProps : never;
@@ -442,6 +536,11 @@ export declare type FontTransformVariantSpreadFunction<A extends PropLike> = Var
442
536
  export declare type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ZIndexTokens>;
443
537
  export declare type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, RadiusTokens>;
444
538
  export declare type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ThemeTokens>;
539
+ /**
540
+ * --------------------------------------------
541
+ * end variants
542
+ * --------------------------------------------
543
+ */
445
544
  declare type SizeKeys = 'width' | 'height' | 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight' | 'shadowRadius';
446
545
  declare type ColorKeys = 'color' | 'backgroundColor' | 'borderColor' | 'borderBottomColor' | 'borderTopColor' | 'borderLeftColor' | 'borderRightColor' | 'shadowColor' | 'textShadowColor';
447
546
  declare type SpaceKeys = 'space' | 'padding' | 'paddingHorizontal' | 'paddingVertical' | 'paddingLeft' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'paddingEnd' | 'paddingStart' | 'margin' | 'marginHorizontal' | 'marginVertical' | 'marginLeft' | 'marginTop' | 'marginBottom' | 'marginLeft' | 'marginRight' | 'marginEnd' | 'marginStart' | 'x' | 'y' | 'scale' | 'scaleX' | 'scaleY' | 'borderTopEndRadius' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderTopStartRadius' | 'borderBottomEndRadius' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'borderBottomStartRadius' | 'borderBottomWidth' | 'borderLeftWidth' | 'borderRadius' | 'borderRightWidth' | 'borderTopEndRadius' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderEndWidth' | 'borderStartWidth' | 'borderTopStartRadius' | 'borderTopWidth' | 'borderWidth' | 'left' | 'top' | 'right' | 'bottom' | 'shadowOffset';
@@ -452,6 +551,7 @@ export declare type TamaguiComponentState = {
452
551
  pressIn: boolean;
453
552
  focus: boolean;
454
553
  mounted: boolean;
554
+ mediaState?: null | Record<string, boolean>;
455
555
  animation?: null | {
456
556
  style?: any;
457
557
  avoidClasses?: boolean;
@@ -1,7 +1,7 @@
1
- import { ThemeObject } from './types';
1
+ import { ThemeDefinition } from './types';
2
2
  export declare function updateTheme({ name, theme }: {
3
3
  name: string;
4
- theme: ThemeObject;
4
+ theme: ThemeDefinition;
5
5
  }): {
6
6
  theme: any;
7
7
  cssRules: string[];