@tamagui/web 1.27.3 → 1.28.0

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 (98) hide show
  1. package/dist/cjs/config.js +13 -26
  2. package/dist/cjs/config.js.map +1 -1
  3. package/dist/cjs/createComponent.js +27 -3
  4. package/dist/cjs/createComponent.js.map +1 -1
  5. package/dist/cjs/createTamagui.js +11 -3
  6. package/dist/cjs/createTamagui.js.map +1 -1
  7. package/dist/cjs/createVariable.js.map +1 -1
  8. package/dist/cjs/createVariables.js +2 -8
  9. package/dist/cjs/createVariables.js.map +1 -1
  10. package/dist/cjs/helpers/createPropMapper.js +13 -17
  11. package/dist/cjs/helpers/createPropMapper.js.map +1 -1
  12. package/dist/cjs/helpers/createStyledContext.js +44 -0
  13. package/dist/cjs/helpers/createStyledContext.js.map +6 -0
  14. package/dist/cjs/helpers/createVariantContext.js +42 -0
  15. package/dist/cjs/helpers/createVariantContext.js.map +6 -0
  16. package/dist/cjs/helpers/createVariantProvider.js +42 -0
  17. package/dist/cjs/helpers/createVariantProvider.js.map +6 -0
  18. package/dist/cjs/helpers/getSplitStyles.js +1 -0
  19. package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
  20. package/dist/cjs/helpers/getVariantExtras.js +7 -0
  21. package/dist/cjs/helpers/getVariantExtras.js.map +1 -1
  22. package/dist/cjs/hooks/useTheme.js +3 -0
  23. package/dist/cjs/hooks/useTheme.js.map +1 -1
  24. package/dist/cjs/index.js +20 -18
  25. package/dist/cjs/index.js.map +1 -1
  26. package/dist/cjs/styled.js +2 -0
  27. package/dist/cjs/styled.js.map +1 -1
  28. package/dist/cjs/views/Text.js +12 -15
  29. package/dist/cjs/views/Text.js.map +1 -1
  30. package/dist/esm/config.js +13 -26
  31. package/dist/esm/config.js.map +1 -1
  32. package/dist/esm/createComponent.js +28 -4
  33. package/dist/esm/createComponent.js.map +1 -1
  34. package/dist/esm/createTamagui.js +12 -4
  35. package/dist/esm/createTamagui.js.map +1 -1
  36. package/dist/esm/createVariable.js.map +1 -1
  37. package/dist/esm/createVariables.js +1 -6
  38. package/dist/esm/createVariables.js.map +1 -1
  39. package/dist/esm/helpers/createPropMapper.js +13 -17
  40. package/dist/esm/helpers/createPropMapper.js.map +1 -1
  41. package/dist/esm/helpers/createStyledContext.js +20 -0
  42. package/dist/esm/helpers/createStyledContext.js.map +6 -0
  43. package/dist/esm/helpers/createVariantContext.js +18 -0
  44. package/dist/esm/helpers/createVariantContext.js.map +6 -0
  45. package/dist/esm/helpers/createVariantProvider.js +18 -0
  46. package/dist/esm/helpers/createVariantProvider.js.map +6 -0
  47. package/dist/esm/helpers/getSplitStyles.js +1 -0
  48. package/dist/esm/helpers/getSplitStyles.js.map +1 -1
  49. package/dist/esm/helpers/getVariantExtras.js +7 -0
  50. package/dist/esm/helpers/getVariantExtras.js.map +1 -1
  51. package/dist/esm/hooks/useTheme.js +3 -0
  52. package/dist/esm/hooks/useTheme.js.map +1 -1
  53. package/dist/esm/index.js +11 -16
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/styled.js +2 -0
  56. package/dist/esm/styled.js.map +1 -1
  57. package/dist/esm/views/Text.js +12 -15
  58. package/dist/esm/views/Text.js.map +1 -1
  59. package/package.json +9 -9
  60. package/src/config.ts +11 -25
  61. package/src/createComponent.tsx +33 -5
  62. package/src/createTamagui.ts +14 -3
  63. package/src/createVariable.ts +1 -1
  64. package/src/createVariables.ts +0 -7
  65. package/src/helpers/createPropMapper.ts +18 -20
  66. package/src/helpers/createStyledContext.tsx +38 -0
  67. package/src/helpers/getSplitStyles.tsx +4 -0
  68. package/src/helpers/getVariantExtras.tsx +10 -0
  69. package/src/hooks/useTheme.tsx +12 -3
  70. package/src/index.ts +11 -16
  71. package/src/styled.tsx +4 -0
  72. package/src/types.tsx +48 -9
  73. package/src/views/Text.tsx +15 -16
  74. package/types/config.d.ts.map +1 -1
  75. package/types/createComponent.d.ts +1 -1
  76. package/types/createComponent.d.ts.map +1 -1
  77. package/types/createTamagui.d.ts.map +1 -1
  78. package/types/createVariable.d.ts +1 -1
  79. package/types/createVariable.d.ts.map +1 -1
  80. package/types/createVariables.d.ts +0 -1
  81. package/types/createVariables.d.ts.map +1 -1
  82. package/types/helpers/createStyledContext.d.ts +9 -0
  83. package/types/helpers/createStyledContext.d.ts.map +1 -0
  84. package/types/helpers/createVariantContext.d.ts +9 -0
  85. package/types/helpers/createVariantContext.d.ts.map +1 -0
  86. package/types/helpers/createVariantProvider.d.ts +9 -0
  87. package/types/helpers/createVariantProvider.d.ts.map +1 -0
  88. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  89. package/types/helpers/getVariantExtras.d.ts.map +1 -1
  90. package/types/hooks/useTheme.d.ts +9 -3
  91. package/types/hooks/useTheme.d.ts.map +1 -1
  92. package/types/index.d.ts +11 -10
  93. package/types/index.d.ts.map +1 -1
  94. package/types/styled.d.ts +3 -1
  95. package/types/styled.d.ts.map +1 -1
  96. package/types/types.d.ts +35 -6
  97. package/types/types.d.ts.map +1 -1
  98. package/types/views/Text.d.ts.map +1 -1
package/src/types.tsx CHANGED
@@ -23,8 +23,8 @@ import type {
23
23
 
24
24
  import type { Variable } from './createVariable'
25
25
  import type { ResolveVariableTypes } from './helpers/createPropMapper'
26
+ import { StyledContext } from './helpers/createStyledContext'
26
27
  import type { FontLanguageProps } from './views/FontLanguage.types'
27
- import { Stack } from './views/Stack'
28
28
  import type { ThemeProviderProps } from './views/ThemeProvider'
29
29
 
30
30
  export type { MediaStyleObject, StyleObject } from '@tamagui/helpers'
@@ -131,7 +131,7 @@ export type Role =
131
131
 
132
132
  type DivAttributes = HTMLAttributes<HTMLDivElement>
133
133
 
134
- export type TamaguiReactElement<P = any> = React.ReactElement<P> & {
134
+ export type TamaguiReactElement<P = {}> = React.ReactElement<P> & {
135
135
  type: TamaguiComponent
136
136
  }
137
137
 
@@ -282,6 +282,7 @@ export interface TamaguiConfig
282
282
  TamaguiCustomConfig {}
283
283
 
284
284
  type OnlyAllowShorthandsSetting = boolean | undefined
285
+ type DefaultFontSetting = string | undefined
285
286
 
286
287
  export type CreateTamaguiConfig<
287
288
  A extends GenericTokens,
@@ -290,7 +291,8 @@ export type CreateTamaguiConfig<
290
291
  D extends GenericMedia = GenericMedia,
291
292
  E extends GenericAnimations = GenericAnimations,
292
293
  F extends GenericFonts = GenericFonts,
293
- G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting
294
+ G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting,
295
+ H extends DefaultFontSetting = DefaultFontSetting
294
296
  > = {
295
297
  fonts: RemoveLanguagePostfixes<F>
296
298
  fontLanguages: GetLanguagePostfixes<F> extends never
@@ -307,6 +309,7 @@ export type CreateTamaguiConfig<
307
309
  media: D
308
310
  animations: AnimationDriver<E>
309
311
  onlyAllowShorthands: G
312
+ defaultFont: H
310
313
  }
311
314
 
312
315
  type GetLanguagePostfix<Set> = Set extends string
@@ -340,7 +343,8 @@ type ConfProps<
340
343
  D extends GenericMedia = GenericMedia,
341
344
  E extends GenericAnimations = GenericAnimations,
342
345
  F extends GenericFonts = GenericFonts,
343
- G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting
346
+ G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting,
347
+ H extends DefaultFontSetting = DefaultFontSetting
344
348
  > = {
345
349
  tokens: A
346
350
  themes: B
@@ -349,6 +353,7 @@ type ConfProps<
349
353
  animations?: AnimationDriver<E>
350
354
  fonts: F
351
355
  onlyAllowShorthands?: G
356
+ defaultFont?: H
352
357
  }
353
358
 
354
359
  export type InferTamaguiConfig<Conf> = Conf extends ConfProps<
@@ -358,9 +363,10 @@ export type InferTamaguiConfig<Conf> = Conf extends ConfProps<
358
363
  infer D,
359
364
  infer E,
360
365
  infer F,
361
- infer G
366
+ infer G,
367
+ infer H
362
368
  >
363
- ? TamaguiInternalConfig<A, B, C, D, E, F, G>
369
+ ? TamaguiInternalConfig<A, B, C, D, E, F, G, H>
364
370
  : unknown
365
371
 
366
372
  // for use in creation functions so it doesnt get overwritten
@@ -475,6 +481,11 @@ export type CreateTamaguiProps = {
475
481
  }
476
482
  }
477
483
 
484
+ /**
485
+ * Define a default font, for better types and default font on Text
486
+ */
487
+ defaultFont?: string
488
+
478
489
  /**
479
490
  * Web-only: define text-selection CSS
480
491
  */
@@ -552,7 +563,8 @@ export type TamaguiInternalConfig<
552
563
  D extends GenericMedia = GenericMedia,
553
564
  E extends GenericAnimations = GenericAnimations,
554
565
  F extends GenericFonts = GenericFonts,
555
- G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting
566
+ G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting,
567
+ H extends DefaultFontSetting = DefaultFontSetting
556
568
  > = Omit<CreateTamaguiProps, keyof GenericTamaguiConfig> &
557
569
  Omit<CreateTamaguiConfig<A, B, C, D, E, F, G>, 'tokens'> & {
558
570
  // TODO need to make it this but this breaks types, revisit
@@ -567,6 +579,8 @@ export type TamaguiInternalConfig<
567
579
  parsed: boolean
568
580
  inverseShorthands: Record<string, string>
569
581
  reactNative?: any
582
+ defaultFont?: H
583
+ fontSizeTokens: Set<string>
570
584
  }
571
585
 
572
586
  export type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']
@@ -575,7 +589,7 @@ export type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animatio
575
589
  export type UnionableString = string & {}
576
590
  export type UnionableNumber = number & {}
577
591
 
578
- export type GenericFont<Key extends number | string = number | string> = {
592
+ export type GenericFont<Key extends string | number = string | number> = {
579
593
  size: { [key in Key]: number | Variable }
580
594
  lineHeight?: Partial<{ [key in Key]: number | Variable }>
581
595
  letterSpacing?: Partial<{ [key in Key]: number | Variable }>
@@ -682,8 +696,15 @@ export type ColorTokens =
682
696
  export type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number
683
697
  export type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number
684
698
 
685
- // font tokens
699
+ // fonts
700
+ type DefaultFont = TamaguiConfig['defaultFont']
701
+
702
+ export type Fonts = DefaultFont extends string
703
+ ? TamaguiConfig['fonts'][DefaultFont]
704
+ : never
705
+ export type Font = ParseFont<Fonts>
686
706
  export type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>
707
+ export type FontFamilyTokens = GetTokenString<GetTokenFontKeysFor<'family'>>
687
708
  export type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number
688
709
  export type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number
689
710
  export type FontWeightSteps = `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`
@@ -695,6 +716,20 @@ export type FontTransformTokens =
695
716
  | `$${GetTokenFontKeysFor<'transform'>}`
696
717
  | TextStyle['textTransform']
697
718
 
719
+ type ParseFont<A extends GenericFont> = {
720
+ size: TokenPrefixed<A['size']>
721
+ lineHeight: TokenPrefixedIfExists<A['lineHeight']>
722
+ letterSpacing: TokenPrefixedIfExists<A['letterSpacing']>
723
+ weight: TokenPrefixedIfExists<A['weight']>
724
+ family: TokenPrefixedIfExists<A['family']>
725
+ style: TokenPrefixedIfExists<A['style']>
726
+ transform: TokenPrefixedIfExists<A['transform']>
727
+ color: TokenPrefixedIfExists<A['color']>
728
+ face: TokenPrefixedIfExists<A['face']>
729
+ }
730
+
731
+ type TokenPrefixedIfExists<A> = A extends Object ? TokenPrefixed<A> : {}
732
+
698
733
  //
699
734
  // adds theme short values to relevant props
700
735
  //
@@ -1040,6 +1075,8 @@ type StaticConfigBase = StaticConfigPublic & {
1040
1075
 
1041
1076
  variants?: GenericVariantDefinitions
1042
1077
 
1078
+ context?: StyledContext
1079
+
1043
1080
  /**
1044
1081
  * Used for applying sub theme style
1045
1082
  */
@@ -1219,6 +1256,8 @@ export type VariantSpreadExtras<Props> = {
1219
1256
  tokens: TamaguiConfig['tokens']
1220
1257
  theme: Themes extends { [key: string]: infer B } ? B : unknown
1221
1258
  props: Props
1259
+ fontFamily?: FontFamilyTokens
1260
+ font?: Font
1222
1261
  }
1223
1262
 
1224
1263
  type PropLike = { [key: string]: any }
@@ -1,4 +1,3 @@
1
- import { isWeb } from '@tamagui/constants'
2
1
  import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'
3
2
 
4
3
  import { createComponent } from '../createComponent'
@@ -16,26 +15,25 @@ export const Text = createComponent<TextProps, React.Component<TextProps>, TextP
16
15
  acceptsClassName: true,
17
16
  isText: true,
18
17
 
19
- defaultProps: {
20
- // @ts-ignore
21
- display: 'flex',
22
- fontFamily: 'System',
23
- ...(isWeb
18
+ defaultProps:
19
+ process.env.TAMAGUI_TARGET === 'web'
24
20
  ? {
21
+ color: '$color',
25
22
  display: 'inline',
26
23
  boxSizing: 'border-box',
27
24
  wordWrap: 'break-word',
28
25
  margin: 0,
29
26
  }
30
27
  : {
28
+ color: '$color',
29
+ display: 'flex',
31
30
  suppressHighlighting: true,
32
- }),
33
- },
31
+ },
34
32
 
35
33
  inlineWhenUnflattened: new Set(['fontFamily']),
36
34
 
37
35
  variants: {
38
- ...(isWeb && {
36
+ ...(process.env.TAMAGUI_TARGET === 'web' && {
39
37
  numberOfLines: {
40
38
  1: ellipseStyle,
41
39
 
@@ -68,16 +66,17 @@ export const Text = createComponent<TextProps, React.Component<TextProps>, TextP
68
66
  },
69
67
 
70
68
  ellipse: {
71
- true: isWeb
72
- ? ellipseStyle
73
- : {
74
- numberOfLines: 1,
75
- lineBreakMode: 'clip',
76
- },
69
+ true:
70
+ process.env.TAMAGUI_TARGET === 'web'
71
+ ? ellipseStyle
72
+ : {
73
+ numberOfLines: 1,
74
+ lineBreakMode: 'clip',
75
+ },
77
76
  },
78
77
  },
79
78
 
80
- deoptProps: new Set(isWeb ? [] : ['ellipse']),
79
+ deoptProps: new Set(process.env.TAMAGUI_TARGET === 'web' ? [] : ['ellipse']),
81
80
 
82
81
  validStyles: {
83
82
  ...validStyles,
@@ -1 +1 @@
1
- {"version":3,"file":"config.d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AAM,YAAY,QAAS,MAAM,SAAS,GAAG,SAGnD,CAAA;AAGD,eAAO,MAAM,OAAO,SAAU,MAAM,mDAQnC,CAAA"}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { DebugProp, SpaceDirection, SpaceTokens, SpacerProps, StaticConfig, StaticConfigParsed, StylableComponent, TamaguiComponent, TamaguiComponentState, TamaguiElement } from './types';
3
3
  export declare const defaultComponentState: TamaguiComponentState;
4
4
  export declare const mouseUps: Set<Function>;
5
- export declare function createComponent<ComponentPropTypes extends Object = {}, Ref = TamaguiElement, BaseProps = never>(configIn: Partial<StaticConfig> | StaticConfigParsed, ParentComponent?: StylableComponent): TamaguiComponent<ComponentPropTypes, Ref, BaseProps>;
5
+ export declare function createComponent<ComponentPropTypes extends Object = {}, Ref = TamaguiElement, BaseProps = never>(staticConfigIn: Partial<StaticConfig> | StaticConfigParsed, ParentComponent?: StylableComponent): TamaguiComponent<ComponentPropTypes, Ref, BaseProps>;
6
6
  export declare const Unspaced: {
7
7
  (props: {
8
8
  children?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AASA,OAAO,KAUN,MAAM,OAAO,CAAA;AAkBd,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAEhB,qBAAqB,EACrB,cAAc,EAIf,MAAM,SAAS,CAAA;AAoBhB,eAAO,MAAM,qBAAqB,EAAE,qBAMnC,CAAA;AAmBD,eAAO,MAAM,QAAQ,eAAsB,CAAA;AAqB3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,GAAG,EAAE,EACtC,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EAEjB,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,EACpD,eAAe,CAAC,EAAE,iBAAiB,wDAq0BpC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M,MAAM,sDA8CjB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,mBAkGxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"createTamagui.d.ts","sourceRoot":"","sources":["../src/createTamagui.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EAGnB,MAAM,SAAS,CAAA;AAKhB,wBAAgB,aAAa,CAAC,IAAI,SAAS,kBAAkB,EAC3D,QAAQ,EAAE,IAAI,GACb,kBAAkB,CAAC,IAAI,CAAC,CAmP1B"}
1
+ {"version":3,"file":"createTamagui.d.ts","sourceRoot":"","sources":["../src/createTamagui.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EAGnB,MAAM,SAAS,CAAA;AAKhB,wBAAgB,aAAa,CAAC,IAAI,SAAS,kBAAkB,EAC3D,QAAQ,EAAE,IAAI,GACb,kBAAkB,CAAC,IAAI,CAAC,CA8P1B"}
@@ -15,7 +15,7 @@ type VariableIn<A = any> = Pick<Variable<A>, 'key' | 'name' | 'val'>;
15
15
  export declare const createVariable: <A extends string | number | Variable<any> = any>(props: VariableIn<A>) => Variable<A>;
16
16
  export declare function variableToString(vrble?: any, getValue?: boolean): string;
17
17
  export declare function isVariable(v: Variable | any): v is Variable;
18
- export declare function getVariable(nameOrVariable: Variable | string): string;
18
+ export declare function getVariable(nameOrVariable: Variable | string | any): string;
19
19
  export declare const setDidGetVariableValue: (val: boolean) => boolean;
20
20
  export declare const didGetVariableValue: () => boolean;
21
21
  export declare function getVariableValue(v: Variable | any): any;
@@ -1 +1 @@
1
- {"version":3,"file":"createVariable.d.ts","sourceRoot":"","sources":["../src/createVariable.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAEH,QAAA,MAAM,MAAM,UAAU,CAAA;AAEtB,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,GAAG;IAC/B,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,CAAC,CAAA;IACN,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAE/E,KAAK,UAAU,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC,CAAA;AACpE,eAAO,MAAM,cAAc,wFAY1B,CAAA;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,UAAQ,UAQ7D;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,QAAQ,GAAG,GAAG,GAAG,CAAC,IAAI,QAAQ,CAE3D;AAED,wBAAgB,WAAW,CAAC,cAAc,EAAE,QAAQ,GAAG,MAAM,UAO5D;AAGD,eAAO,MAAM,sBAAsB,QAAS,OAAO,YAAqB,CAAA;AACxE,eAAO,MAAM,mBAAmB,eAAiB,CAAA;AAEjD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,GAAG,GAAG,OAMjD;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ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C,CAAC,EAAE,QAAQ,GAAG,GAAG,OAGhD;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,QAAQ,GAAG,GAAG,OAGpD;AAGD,eAAO,MAAM,iBAAiB,aAAc,MAAM,8BAQjD,CAAA"}
@@ -5,7 +5,6 @@ type DeepTokenObject<Val extends string | number = any> = {
5
5
  export type DeepVariableObject<A extends DeepTokenObject> = {
6
6
  [Key in keyof A]: A[Key] extends string | number ? Variable<A[Key]> : A[Key] extends DeepTokenObject ? DeepVariableObject<A[Key]> : never;
7
7
  };
8
- export declare const tokensKeysOrdered: WeakMap<object, any>;
9
8
  export declare const createVariables: <A extends DeepTokenObject<any>>(tokens: A, parentPath?: string, isFont?: boolean) => DeepVariableObject<A>;
10
9
  export {};
11
10
  //# sourceMappingURL=createVariables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createVariables.d.ts","sourceRoot":"","sources":["../src/createVariables.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAA8B,MAAM,kBAAkB,CAAA;AAEvE,KAAK,eAAe,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,GAAG,GAAG,IAAI;IACxD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,eAAe,IAAI;KACzD,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,MAAM,GAC5C,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAChB,CAAC,CAAC,GAAG,CAAC,SAAS,eAAe,GAC9B,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAC1B,KAAK;CACV,CAAA;AAED,eAAO,MAAM,iBAAiB,sBAAgB,CAAA;AAE9C,eAAO,MAAM,eAAe,6GAoC3B,CAAA"}
1
+ {"version":3,"file":"createVariables.d.ts","sourceRoot":"","sources":["../src/createVariables.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAA8B,MAAM,kBAAkB,CAAA;AAEvE,KAAK,eAAe,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,GAAG,GAAG,IAAI;IACxD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,eAAe,IAAI;KACzD,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,MAAM,GAC5C,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAChB,CAAC,CAAC,GAAG,CAAC,SAAS,eAAe,GAC9B,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAC1B,KAAK;CACV,CAAA;AAED,eAAO,MAAM,eAAe,6GA+B3B,CAAA"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export type StyledContext<Props extends Object = any> = Omit<React.Context<Props>, 'Provider'> & {
3
+ props: Object;
4
+ Provider: React.ProviderExoticComponent<Partial<Props> & {
5
+ children?: React.ReactNode;
6
+ }>;
7
+ };
8
+ export declare function createStyledContext<VariantProps extends Record<string, any>>(props: VariantProps): StyledContext<VariantProps>;
9
+ //# sourceMappingURL=createStyledContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createStyledContext.d.ts","sourceRoot":"","sources":["../../src/helpers/createStyledContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAA;AAEjE,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,MAAM,GAAG,GAAG,IAAI,IAAI,CAC1D,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EACpB,UAAU,CACX,GAAG;IACF,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,KAAK,CAAC,uBAAuB,CACrC,OAAO,CAAC,KAAK,CAAC,GAAG;QACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;KAC3B,CACF,CAAA;CACF,CAAA;AAED,wBAAgB,mBAAmB,CAAC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1E,KAAK,EAAE,YAAY,GAClB,aAAa,CAAC,YAAY,CAAC,CAqB7B"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export type providerProvider<Props extends Object = any> = React.FunctionComponent<Props & {
3
+ children?: React.ReactNode;
4
+ }> & {
5
+ Context: React.Context<any>;
6
+ variants: Object;
7
+ };
8
+ export declare function createVariantProvider<Variants extends Record<string, any>>(variants: Variants): providerProvider<Variants>;
9
+ //# sourceMappingURL=createVariantContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVariantContext.d.ts","sourceRoot":"","sources":["../../src/helpers/createVariantContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,MAAM,MAAM,gBAAgB,CAAC,KAAK,SAAS,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,iBAAiB,CAChF,KAAK,GAAG;IACN,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CACF,GAAG;IACF,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxE,QAAQ,EAAE,QAAQ,GACjB,gBAAgB,CAAC,QAAQ,CAAC,CAkB5B"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export type VariantProvider<Props extends Object = any> = React.FunctionComponent<Props & {
3
+ children?: React.ReactNode;
4
+ }> & {
5
+ Context: React.Context<any>;
6
+ variants: Object;
7
+ };
8
+ export declare function createVariantProvider<Variants extends Record<string, any>>(variants: Variants): VariantProvider<Variants>;
9
+ //# sourceMappingURL=createVariantProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVariantProvider.d.ts","sourceRoot":"","sources":["../../src/helpers/createVariantProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,iBAAiB,CAC/E,KAAK,GAAG;IACN,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CACF,GAAG;IACF,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxE,QAAQ,EAAE,QAAQ,GACjB,eAAe,CAAC,QAAQ,CAAC,CAkB3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,EAMd,eAAe,EACf,kBAAkB,EAElB,qBAAqB,EACrB,cAAc,EACd,WAAW,EAEZ,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAkBzF,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,cAAc,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,YAAY,EAAE,kBAAkB,CAAA;IAChC,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,SAAS,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BACL,OAAO,KAC5B,cAkCF,CAAA;AAOD,eAAO,MAAM,cAAc,EAAE,aAU5B,CAAA;AA2BD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getVariantExtras.d.ts","sourceRoot":"","sources":["../../src/helpers/getVariantExtras.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAKjE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,EACV,eAAe,CAAC,EAAE,mBAAmB,EACrC,KAAK,CAAC,EAAE,GAAG,EACX,YAAY,CAAC,EAAE,GAAG,EAClB,iBAAiB,UAAQ,OAkD1B;AAID,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,mBAAmB,OAkBrF"}
1
+ {"version":3,"file":"getVariantExtras.d.ts","sourceRoot":"","sources":["../../src/helpers/getVariantExtras.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAKjE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,EACV,eAAe,CAAC,EAAE,mBAAmB,EACrC,KAAK,CAAC,EAAE,GAAG,EACX,YAAY,CAAC,EAAE,GAAG,EAClB,iBAAiB,UAAQ,OA2D1B;AAID,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,mBAAmB,OAkBrF"}
@@ -7,9 +7,14 @@ export type ChangedThemeResponse = {
7
7
  theme?: ThemeParsed | null;
8
8
  className?: string;
9
9
  };
10
- export declare const useTheme: (props?: ThemeProps) => ThemeParsed;
10
+ type UseThemeResult = {
11
+ [key in keyof ThemeParsed]: ThemeParsed[key] & {
12
+ get: () => string | ThemeParsed[key]['val'];
13
+ };
14
+ };
15
+ export declare const useTheme: (props?: ThemeProps) => UseThemeResult;
11
16
  export declare const useThemeWithState: (props: ThemeProps) => {
12
- theme: ThemeParsed;
17
+ theme: UseThemeResult;
13
18
  isNewTheme: boolean;
14
19
  themeManager: ThemeManager | null;
15
20
  name: string;
@@ -17,7 +22,8 @@ export declare const useThemeWithState: (props: ThemeProps) => {
17
22
  } | null;
18
23
  export declare function getThemeProxied({ theme, themeManager, }: Partial<ChangedThemeResponse> & {
19
24
  theme: ThemeParsed;
20
- }, keys?: string[]): ThemeParsed;
25
+ }, keys?: string[]): UseThemeResult;
21
26
  export declare const activeThemeManagers: Set<ThemeManager>;
22
27
  export declare const useChangeThemeEffect: (props: ThemeProps, root?: boolean, keys?: string[], disableUpdate?: () => boolean) => ChangedThemeResponse;
28
+ export {};
23
29
  //# sourceMappingURL=useTheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,YAAY,EAGb,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAIvD,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAoBD,eAAO,MAAM,QAAQ,WAAW,UAAU,KAAgB,WAEzD,CAAA;AAED,eAAO,MAAM,iBAAiB,UAAW,UAAU;;gBA7BrC,OAAO;kBACL,YAAY,GAAG,IAAI;UAC3B,MAAM;;QAoEb,CAAA;AAED,wBAAgB,eAAe,CAC7B,EACE,KAAK,EACL,YAAY,GACb,EAAE,O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MAAM,mBAAmB,mBAA0B,CAAA;AAE1D,eAAO,MAAM,oBAAoB,UACxB,UAAU,yBAEV,MAAM,EAAE,kBACC,MAAM,OAAO,KAC5B,oBAoOF,CAAA"}
package/types/index.d.ts CHANGED
@@ -11,26 +11,27 @@ export * from './insertFont';
11
11
  export * from './styled';
12
12
  export * from './types';
13
13
  export * from './setupReactNative';
14
- export { getConfig, getThemes, getTokens, onConfiguredOnce, updateConfig, } from './config';
14
+ export { getConfig, getThemes, getTokens, onConfiguredOnce, updateConfig } from './config';
15
15
  export * from './constants/constants';
16
- export * from './helpers/useShallowSetState';
17
- export * from './helpers/getVariantExtras';
16
+ export * from './helpers/createStyledContext';
17
+ export * from './helpers/expandStyles';
18
18
  export * from './helpers/getAnimationDriver';
19
19
  export * from './helpers/getExpandedShorthands';
20
20
  export * from './helpers/getSplitStyles';
21
21
  export * from './helpers/getStylesAtomic';
22
- export * from './helpers/pseudoDescriptors';
23
- export * from './helpers/mergeProps';
24
- export * from './helpers/expandStyles';
25
- export * from './helpers/isTamaguiElement';
22
+ export * from './helpers/getThemeCSSRules';
23
+ export * from './helpers/getVariantExtras';
26
24
  export * from './helpers/isTamaguiComponent';
25
+ export * from './helpers/isTamaguiElement';
27
26
  export * from './helpers/matchMedia';
28
- export * from './helpers/themes';
29
- export * from './helpers/getThemeCSSRules';
27
+ export * from './helpers/mergeProps';
28
+ export * from './helpers/normalizeColor';
30
29
  export * from './helpers/proxyThemeVariables';
30
+ export * from './helpers/pseudoDescriptors';
31
31
  export * from './helpers/themeable';
32
+ export * from './helpers/themes';
33
+ export * from './helpers/useShallowSetState';
32
34
  export * from './helpers/withStaticProperties';
33
- export * from './helpers/normalizeColor';
34
35
  export * from './contexts/ButtonNestingContext';
35
36
  export { configureMedia, getMedia, mediaState, useMedia, useMediaPropsActive, mediaObjectToString, mediaQueryConfig, } from './hooks/useMedia';
36
37
  export * from './hooks/useTheme';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"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Ac,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gCAAgC,CAAA;AAE9C,cAAc,iCAAiC,CAAA;AAE/C,OAAO,EACL,cAAc,EACd,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,kBAAkB,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAEhC,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,iCAAiC,CAAA;AAE/C,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAElC,cAAc,cAAc,CAAA"}
package/types/styled.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { StyledContext } from './helpers/createStyledContext';
1
2
  import type { GetProps, GetVariantValues, MediaProps, PseudoProps, StaticConfig, StylableComponent, TamaguiComponent, TamaguiElement, VariantDefinitions, VariantSpreadFunction } from './types';
2
3
  type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<any, any, infer P> ? P : GetProps<A>;
3
4
  type GetVariantProps<A extends StylableComponent> = A extends TamaguiComponent<any, any, any, infer V> ? V : {};
@@ -8,7 +9,8 @@ export declare function styled<ParentComponent extends StylableComponent, Varian
8
9
  name?: string;
9
10
  variants?: Variants | undefined;
10
11
  defaultVariants?: GetVariantAcceptedValues<Variants>;
12
+ context?: StyledContext;
11
13
  acceptsClassName?: boolean;
12
- }, staticExtractionOptions?: Partial<StaticConfig>): TamaguiComponent<Variants extends void ? GetProps<ParentComponent> : GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>) & MediaProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)>> & PseudoProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)>>, TamaguiElement, GetBaseProps<ParentComponent>, GetVariantProps<ParentComponent> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>), { [Key in Exclude<keyof ParentComponent, "defaultProps" | "staticConfig" | "propTypes" | "extractable" | "styleable" | "$$typeof">]: ParentComponent[Key]; }>;
14
+ }, staticExtractionOptions?: Partial<StaticConfig>): TamaguiComponent<Variants extends void ? GetProps<ParentComponent> : GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>) & MediaProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)>> & PseudoProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>)>>, TamaguiElement, GetBaseProps<ParentComponent>, GetVariantProps<ParentComponent> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>), { [Key in Exclude<keyof ParentComponent, "defaultProps" | "propTypes" | "staticConfig" | "extractable" | "styleable" | "$$typeof">]: ParentComponent[Key]; }>;
13
15
  export {};
14
16
  //# sourceMappingURL=styled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,KAAK,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAAI,CAAC,SAAS,gBAAgB,CACzE,GAAG,EACH,GAAG,EACH,MAAM,CAAC,CACR,GACG,CAAC,GACD,QAAQ,CAAC,CAAC,CAAC,CAAA;AAEf,KAAK,eAAe,CAAC,CAAC,SAAS,iBAAiB,IAAI,CAAC,SAAS,gBAAgB,CAC5E,GAAG,EACH,GAAG,EACH,GAAG,EACH,MAAM,CAAC,CACR,GACG,CAAC,GACD,EAAE,CAAA;AAEN,KAAK,wBAAwB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC/C;KACG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GACnE,GAAG,GACH,gBAAgB,CAAC,MAAM,CAAC,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AAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GACnE,GAAG,GACH,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;CACnC,GACD,SAAS,CAAA;AAEb,wBAAgB,MAAM,CACpB,eAAe,SAAS,iBAAiB,EACzC,QAAQ,SAAS,kBAAkB,CAAC,eAAe,CAAC,GAAG,IAAI,GAAG,kBAAkB,CAAC,eAAe,CAAC,GAAG,IAAI,EAExG,WAAW,EAAE,eAAe,EAE5B,OAAO,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC/B,eAAe,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAA;IACpD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,EACD,uBAAuB,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,uiCAyJhD"}
package/types/types.d.ts CHANGED
@@ -4,6 +4,7 @@ import type { ComponentType, ForwardRefExoticComponent, FunctionComponent, HTMLA
4
4
  import type { GestureResponderHandlers, PressableProps, TextProps as ReactTextProps, TextStyle, View, ViewProps, ViewStyle } from 'react-native';
5
5
  import type { Variable } from './createVariable';
6
6
  import type { ResolveVariableTypes } from './helpers/createPropMapper';
7
+ import { StyledContext } from './helpers/createStyledContext';
7
8
  import type { FontLanguageProps } from './views/FontLanguage.types';
8
9
  import type { ThemeProviderProps } from './views/ThemeProvider';
9
10
  export type { MediaStyleObject, StyleObject } from '@tamagui/helpers';
@@ -29,7 +30,7 @@ export type TamaguiProjectInfo = {
29
30
  };
30
31
  export type Role = 'alert' | 'alertdialog' | 'application' | 'article' | 'banner' | 'button' | 'cell' | 'checkbox' | 'columnheader' | 'combobox' | 'complementary' | 'contentinfo' | 'definition' | 'dialog' | 'directory' | 'document' | 'feed' | 'figure' | 'form' | 'grid' | 'group' | 'heading' | 'img' | 'link' | 'list' | 'listitem' | 'log' | 'main' | 'marquee' | 'math' | 'menu' | 'menubar' | 'menuitem' | 'meter' | 'navigation' | 'none' | 'note' | 'option' | 'presentation' | 'progressbar' | 'radio' | 'radiogroup' | 'region' | 'row' | 'rowgroup' | 'rowheader' | 'scrollbar' | 'searchbox' | 'separator' | 'slider' | 'spinbutton' | 'status' | 'summary' | 'switch' | 'tab' | 'table' | 'tablist' | 'tabpanel' | 'term' | 'timer' | 'toolbar' | 'tooltip' | 'tree' | 'treegrid' | 'treeitem';
31
32
  type DivAttributes = HTMLAttributes<HTMLDivElement>;
32
- export type TamaguiReactElement<P = any> = React.ReactElement<P> & {
33
+ export type TamaguiReactElement<P = {}> = React.ReactElement<P> & {
33
34
  type: TamaguiComponent;
34
35
  };
35
36
  export type TamaguiComponentPropsBase = {
@@ -147,7 +148,8 @@ export interface TamaguiCustomConfig {
147
148
  export interface TamaguiConfig extends Omit<GenericTamaguiConfig, keyof TamaguiCustomConfig>, TamaguiCustomConfig {
148
149
  }
149
150
  type OnlyAllowShorthandsSetting = boolean | undefined;
150
- export type CreateTamaguiConfig<A extends GenericTokens, B extends GenericThemes, C extends GenericShorthands = GenericShorthands, D extends GenericMedia = GenericMedia, E extends GenericAnimations = GenericAnimations, F extends GenericFonts = GenericFonts, G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting> = {
151
+ type DefaultFontSetting = string | undefined;
152
+ export type CreateTamaguiConfig<A extends GenericTokens, B extends GenericThemes, C extends GenericShorthands = GenericShorthands, D extends GenericMedia = GenericMedia, E extends GenericAnimations = GenericAnimations, F extends GenericFonts = GenericFonts, G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting, H extends DefaultFontSetting = DefaultFontSetting> = {
151
153
  fonts: RemoveLanguagePostfixes<F>;
152
154
  fontLanguages: GetLanguagePostfixes<F> extends never ? string[] : GetLanguagePostfixes<F>[];
153
155
  tokens: A;
@@ -160,6 +162,7 @@ export type CreateTamaguiConfig<A extends GenericTokens, B extends GenericThemes
160
162
  media: D;
161
163
  animations: AnimationDriver<E>;
162
164
  onlyAllowShorthands: G;
165
+ defaultFont: H;
163
166
  };
164
167
  type GetLanguagePostfix<Set> = Set extends string ? Set extends `${string}_${infer Postfix}` ? Postfix : never : never;
165
168
  type OmitLanguagePostfix<Set> = Set extends string ? Set extends `${infer Prefix}_${string}` ? Prefix : Set : never;
@@ -167,7 +170,7 @@ type RemoveLanguagePostfixes<F extends GenericFonts> = {
167
170
  [Key in OmitLanguagePostfix<keyof F>]: F[Key];
168
171
  };
169
172
  type GetLanguagePostfixes<F extends GenericFonts> = GetLanguagePostfix<keyof F>;
170
- type ConfProps<A extends GenericTokens, B extends GenericThemes, C extends GenericShorthands = GenericShorthands, D extends GenericMedia = GenericMedia, E extends GenericAnimations = GenericAnimations, F extends GenericFonts = GenericFonts, G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting> = {
173
+ type ConfProps<A extends GenericTokens, B extends GenericThemes, C extends GenericShorthands = GenericShorthands, D extends GenericMedia = GenericMedia, E extends GenericAnimations = GenericAnimations, F extends GenericFonts = GenericFonts, G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting, H extends DefaultFontSetting = DefaultFontSetting> = {
171
174
  tokens: A;
172
175
  themes: B;
173
176
  shorthands?: C;
@@ -175,8 +178,9 @@ type ConfProps<A extends GenericTokens, B extends GenericThemes, C extends Gener
175
178
  animations?: AnimationDriver<E>;
176
179
  fonts: F;
177
180
  onlyAllowShorthands?: G;
181
+ defaultFont?: H;
178
182
  };
179
- export type InferTamaguiConfig<Conf> = Conf extends ConfProps<infer A, infer B, infer C, infer D, infer E, infer F, infer G> ? TamaguiInternalConfig<A, B, C, D, E, F, G> : unknown;
183
+ export type InferTamaguiConfig<Conf> = Conf extends ConfProps<infer A, infer B, infer C, infer D, infer E, infer F, infer G, infer H> ? TamaguiInternalConfig<A, B, C, D, E, F, G, H> : unknown;
180
184
  export type GenericTamaguiConfig = CreateTamaguiConfig<GenericTokens, GenericThemes, GenericShorthands, GenericMedia, GenericAnimations, GenericFonts>;
181
185
  type NonSubThemeNames<A extends string | number> = A extends `${string}_${string}` ? never : A;
182
186
  type BaseThemeDefinitions = TamaguiConfig['themes'][NonSubThemeNames<keyof TamaguiConfig['themes']>];
@@ -246,6 +250,10 @@ export type CreateTamaguiProps = {
246
250
  [key: string]: string | number | Variable;
247
251
  };
248
252
  };
253
+ /**
254
+ * Define a default font, for better types and default font on Text
255
+ */
256
+ defaultFont?: string;
249
257
  /**
250
258
  * Web-only: define text-selection CSS
251
259
  */
@@ -292,7 +300,7 @@ export type GetCSS = (opts?: {
292
300
  excludeThemes?: boolean;
293
301
  sinceLastCall?: boolean;
294
302
  }) => string;
295
- export type TamaguiInternalConfig<A extends GenericTokens = GenericTokens, B extends GenericThemes = GenericThemes, C extends GenericShorthands = GenericShorthands, D extends GenericMedia = GenericMedia, E extends GenericAnimations = GenericAnimations, F extends GenericFonts = GenericFonts, G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting> = Omit<CreateTamaguiProps, keyof GenericTamaguiConfig> & Omit<CreateTamaguiConfig<A, B, C, D, E, F, G>, 'tokens'> & {
303
+ export type TamaguiInternalConfig<A extends GenericTokens = GenericTokens, B extends GenericThemes = GenericThemes, C extends GenericShorthands = GenericShorthands, D extends GenericMedia = GenericMedia, E extends GenericAnimations = GenericAnimations, F extends GenericFonts = GenericFonts, G extends OnlyAllowShorthandsSetting = OnlyAllowShorthandsSetting, H extends DefaultFontSetting = DefaultFontSetting> = Omit<CreateTamaguiProps, keyof GenericTamaguiConfig> & Omit<CreateTamaguiConfig<A, B, C, D, E, F, G>, 'tokens'> & {
296
304
  tokens: Tokenify<A>;
297
305
  tokensParsed: Tokenify<A>;
298
306
  themeConfig: any;
@@ -302,11 +310,13 @@ export type TamaguiInternalConfig<A extends GenericTokens = GenericTokens, B ext
302
310
  parsed: boolean;
303
311
  inverseShorthands: Record<string, string>;
304
312
  reactNative?: any;
313
+ defaultFont?: H;
314
+ fontSizeTokens: Set<string>;
305
315
  };
306
316
  export type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations'];
307
317
  export type UnionableString = string & {};
308
318
  export type UnionableNumber = number & {};
309
- export type GenericFont<Key extends number | string = number | string> = {
319
+ export type GenericFont<Key extends string | number = string | number> = {
310
320
  size: {
311
321
  [key in Key]: number | Variable;
312
322
  };
@@ -393,7 +403,11 @@ export type SpaceTokens = GetTokenString<keyof Tokens['space']> | number | boole
393
403
  export type ColorTokens = GetTokenString<keyof Tokens['color']> | GetTokenString<keyof ThemeParsed> | CSSColorNames;
394
404
  export type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number;
395
405
  export type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number;
406
+ type DefaultFont = TamaguiConfig['defaultFont'];
407
+ export type Fonts = DefaultFont extends string ? TamaguiConfig['fonts'][DefaultFont] : never;
408
+ export type Font = ParseFont<Fonts>;
396
409
  export type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>;
410
+ export type FontFamilyTokens = GetTokenString<GetTokenFontKeysFor<'family'>>;
397
411
  export type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number;
398
412
  export type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number;
399
413
  export type FontWeightSteps = `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`;
@@ -402,6 +416,18 @@ export type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number;
402
416
  export type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number;
403
417
  export type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle'];
404
418
  export type FontTransformTokens = `$${GetTokenFontKeysFor<'transform'>}` | TextStyle['textTransform'];
419
+ type ParseFont<A extends GenericFont> = {
420
+ size: TokenPrefixed<A['size']>;
421
+ lineHeight: TokenPrefixedIfExists<A['lineHeight']>;
422
+ letterSpacing: TokenPrefixedIfExists<A['letterSpacing']>;
423
+ weight: TokenPrefixedIfExists<A['weight']>;
424
+ family: TokenPrefixedIfExists<A['family']>;
425
+ style: TokenPrefixedIfExists<A['style']>;
426
+ transform: TokenPrefixedIfExists<A['transform']>;
427
+ color: TokenPrefixedIfExists<A['color']>;
428
+ face: TokenPrefixedIfExists<A['face']>;
429
+ };
430
+ type TokenPrefixedIfExists<A> = A extends Object ? TokenPrefixed<A> : {};
405
431
  export type ThemeValueByCategory<K extends string | number | symbol> = K extends 'theme' ? ThemeTokens : K extends 'size' ? SizeTokens : K extends 'font' ? FontTokens : K extends 'fontSize' ? FontSizeTokens : K extends 'space' ? SpaceTokens : K extends 'color' ? ColorTokens : K extends 'zIndex' ? ZIndexTokens : K extends 'lineHeight' ? FontLineHeightTokens : K extends 'fontWeight' ? FontWeightTokens : K extends 'letterSpacing' ? FontLetterSpacingTokens : {};
406
432
  type FontKeys = 'fontFamily';
407
433
  type FontSizeKeys = 'fontSize';
@@ -572,6 +598,7 @@ export type StaticConfigPublic = {
572
598
  type StaticConfigBase = StaticConfigPublic & {
573
599
  Component?: FunctionComponent<any> & StaticComponentObject<any, any>;
574
600
  variants?: GenericVariantDefinitions;
601
+ context?: StyledContext;
575
602
  /**
576
603
  * Used for applying sub theme style
577
604
  */
@@ -650,6 +677,8 @@ export type VariantSpreadExtras<Props> = {
650
677
  [key: string]: infer B;
651
678
  } ? B : unknown;
652
679
  props: Props;
680
+ fontFamily?: FontFamilyTokens;
681
+ font?: Font;
653
682
  };
654
683
  type PropLike = {
655
684
  [key: string]: any;