@tamagui/web 1.74.19 → 1.74.21

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 (35) hide show
  1. package/dist/cjs/createComponent.js +1 -1
  2. package/dist/cjs/createComponent.js.map +1 -1
  3. package/dist/cjs/createComponent.native.js +1 -1
  4. package/dist/cjs/createComponent.native.js.map +1 -1
  5. package/dist/cjs/helpers/withStaticProperties.js.map +1 -1
  6. package/dist/cjs/helpers/withStaticProperties.native.js.map +1 -1
  7. package/dist/cjs/styled.js.map +1 -1
  8. package/dist/cjs/styled.native.js.map +1 -1
  9. package/dist/esm/createComponent.js +1 -1
  10. package/dist/esm/createComponent.js.map +1 -1
  11. package/dist/esm/createComponent.native.js +1 -1
  12. package/dist/esm/createComponent.native.js.map +1 -1
  13. package/dist/esm/helpers/withStaticProperties.js.map +1 -1
  14. package/dist/esm/helpers/withStaticProperties.native.js.map +1 -1
  15. package/dist/esm/styled.js.map +1 -1
  16. package/dist/esm/styled.native.js.map +1 -1
  17. package/package.json +9 -9
  18. package/src/createComponent.tsx +2 -2
  19. package/src/helpers/withStaticProperties.tsx +3 -1
  20. package/src/styled.tsx +125 -52
  21. package/src/types.tsx +24 -25
  22. package/types/createComponent.d.ts +2 -2
  23. package/types/createComponent.d.ts.map +1 -1
  24. package/types/helpers/withStaticProperties.d.ts +3 -1
  25. package/types/helpers/withStaticProperties.d.ts.map +1 -1
  26. package/types/styled.d.ts +4 -2
  27. package/types/styled.d.ts.map +1 -1
  28. package/types/types.d.ts +5 -9
  29. package/types/types.d.ts.map +1 -1
  30. package/types/views/Stack.d.ts +1 -1
  31. package/types/views/Stack.d.ts.map +1 -1
  32. package/types/views/Text.d.ts +1 -1
  33. package/types/views/Text.d.ts.map +1 -1
  34. package/types/views/View.d.ts +1 -1
  35. package/types/views/View.d.ts.map +1 -1
package/src/styled.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createComponent } from './createComponent'
2
2
  import { StyledContext } from './helpers/createStyledContext'
3
3
  import { mergeVariants } from './helpers/mergeVariants'
4
+ import { withStaticProperties } from './helpers/withStaticProperties'
4
5
  import type { GetRef } from './interfaces/GetRef'
5
6
  import { getReactNativeConfig } from './setupReactNative'
6
7
  import type {
@@ -14,6 +15,8 @@ import type {
14
15
  VariantDefinitions,
15
16
  VariantSpreadFunction,
16
17
  } from './types'
18
+ import { Stack } from './views/Stack'
19
+ import { Text } from './views/Text'
17
20
 
18
21
  type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<
19
22
  any,
@@ -40,9 +43,16 @@ type GetVariantAcceptedValues<V> = V extends Object
40
43
  }
41
44
  : undefined
42
45
 
46
+ type ValueOf<T> = T[keyof T]
47
+ type AreVariantsUndefined<V> = V extends undefined
48
+ ? true
49
+ : ValueOf<V> extends undefined
50
+ ? true
51
+ : false
52
+
43
53
  export function styled<
44
54
  ParentComponent extends StylableComponent,
45
- Variants extends VariantDefinitions<ParentComponent> | void = VariantDefinitions<ParentComponent> | void
55
+ Variants extends VariantDefinitions<ParentComponent> | void
46
56
  >(
47
57
  ComponentIn: ParentComponent,
48
58
  // this should be Partial<GetProps<ParentComponent>> but causes excessively deep type issues
@@ -55,6 +65,69 @@ export function styled<
55
65
  },
56
66
  staticExtractionOptions?: Partial<StaticConfig>
57
67
  ) {
68
+ // do type stuff at top for easier readability
69
+
70
+ // get parent props without pseudos and medias so we can rebuild both with new variants
71
+ // get parent props without pseudos and medias so we can rebuild both with new variants
72
+ type ParentPropsBase = GetBaseProps<ParentComponent>
73
+ type ParentVariants = GetVariantProps<ParentComponent>
74
+
75
+ type OurVariantProps = Variants extends undefined
76
+ ? {}
77
+ : GetVariantAcceptedValues<Variants>
78
+
79
+ type MergedVariants = AreVariantsUndefined<OurVariantProps> extends true
80
+ ? ParentVariants
81
+ : AreVariantsUndefined<ParentVariants> extends true
82
+ ? OurVariantProps
83
+ : {
84
+ [Key in keyof ParentVariants | keyof OurVariantProps]?:
85
+ | (Key extends keyof ParentVariants ? ParentVariants[Key] : undefined)
86
+ | (Key extends keyof OurVariantProps ? OurVariantProps[Key] : undefined)
87
+ }
88
+
89
+ type OurPropsBaseBase = ParentPropsBase & MergedVariants
90
+
91
+ /**
92
+ * de-opting a bit of type niceness because were hitting depth issues too soon
93
+ * before we had:
94
+ *
95
+ * type OurPropsBase = OurPropsBaseBase & PseudoProps<Partial<OurPropsBaseBase>>
96
+ * and then below in type Props you would remove the PseudoProps line
97
+ * that would give you nicely merged pseudo sub-styles but its just too much for TS
98
+ * so now pseudos wont be nicely typed inside media queries, but at least we can nest
99
+ */
100
+ type OurPropsBase = OurPropsBaseBase
101
+
102
+ type Props = Variants extends void
103
+ ? GetProps<ParentComponent>
104
+ : // start with base props
105
+ OurPropsBase &
106
+ // add in pseudo
107
+ PseudoProps<Partial<OurPropsBaseBase>> &
108
+ // add in media
109
+ MediaProps<Partial<OurPropsBase>>
110
+
111
+ type ParentStaticProperties = {
112
+ [Key in Exclude<
113
+ keyof ParentComponent,
114
+ | 'defaultProps'
115
+ | 'propTypes'
116
+ | '$$typeof'
117
+ | 'staticConfig'
118
+ | 'extractable'
119
+ | 'styleable'
120
+ >]: ParentComponent[Key]
121
+ }
122
+
123
+ type StyledComponent = TamaguiComponent<
124
+ Props,
125
+ GetRef<ParentComponent>,
126
+ ParentPropsBase,
127
+ MergedVariants,
128
+ ParentStaticProperties
129
+ >
130
+
58
131
  // validate not using a variant over an existing valid style
59
132
  if (process.env.NODE_ENV !== 'production') {
60
133
  if (!ComponentIn) {
@@ -166,57 +239,6 @@ export function styled<
166
239
 
167
240
  const component = createComponent(staticConfigProps || {})
168
241
 
169
- // get parent props without pseudos and medias so we can rebuild both with new variants
170
- // get parent props without pseudos and medias so we can rebuild both with new variants
171
- type ParentPropsBase = GetBaseProps<ParentComponent>
172
- type ParentVariants = GetVariantProps<ParentComponent>
173
-
174
- type OurVariantProps = Variants extends void ? {} : GetVariantAcceptedValues<Variants>
175
-
176
- type VariantProps = Omit<ParentVariants, keyof OurVariantProps> & OurVariantProps
177
- type OurPropsBaseBase = ParentPropsBase & VariantProps
178
-
179
- /**
180
- * de-opting a bit of type niceness because were hitting depth issues too soon
181
- * before we had:
182
- *
183
- * type OurPropsBase = OurPropsBaseBase & PseudoProps<Partial<OurPropsBaseBase>>
184
- * and then below in type Props you would remove the PseudoProps line
185
- * that would give you nicely merged pseudo sub-styles but its just too much for TS
186
- * so now pseudos wont be nicely typed inside media queries, but at least we can nest
187
- */
188
-
189
- type OurPropsBase = OurPropsBaseBase
190
-
191
- type Props = Variants extends void
192
- ? GetProps<ParentComponent>
193
- : // start with base props
194
- OurPropsBase &
195
- // add in pseudo
196
- PseudoProps<Partial<OurPropsBaseBase>> &
197
- // add in media
198
- MediaProps<Partial<OurPropsBase>>
199
-
200
- type ParentStaticProperties = {
201
- [Key in Exclude<
202
- keyof ParentComponent,
203
- | 'defaultProps'
204
- | 'propTypes'
205
- | '$$typeof'
206
- | 'staticConfig'
207
- | 'extractable'
208
- | 'styleable'
209
- >]: ParentComponent[Key]
210
- }
211
-
212
- type StyledComponent = TamaguiComponent<
213
- Props,
214
- GetRef<ParentComponent>,
215
- ParentPropsBase,
216
- ParentVariants & OurVariantProps,
217
- ParentStaticProperties
218
- >
219
-
220
242
  for (const key in ComponentIn) {
221
243
  if (key in component) continue
222
244
  // @ts-expect-error assigning static properties over
@@ -307,3 +329,54 @@ export function styled<
307
329
 
308
330
  // const y = <Test someting>sadad</Test>
309
331
  // const z = <Test3 someting="$true" ork>sadad</Test3>
332
+
333
+ //
334
+ // merges variant types properly:
335
+
336
+ // const OneVariant = styled(Stack, {
337
+ // variants: {
338
+ // variant: {
339
+ // test: { backgroundColor: 'gray' },
340
+ // },
341
+ // } as const,
342
+ // })
343
+ // const Second = styled(Stack, {
344
+ // variants: {
345
+ // variant: {
346
+ // simple: { backgroundColor: 'gray' },
347
+ // colorful: { backgroundColor: 'violet' },
348
+ // },
349
+ // } as const,
350
+ // })
351
+ // const TwoVariant = styled(OneVariant, {
352
+ // variants: {
353
+ // variant: {
354
+ // simple: { backgroundColor: 'gray' },
355
+ // colorful: { backgroundColor: 'violet' },
356
+ // },
357
+ // } as const,
358
+ // })
359
+
360
+ // type X = typeof OneVariant extends TamaguiComponent<any, any, any, infer V> ? V : any
361
+ // type V = typeof Second extends TamaguiComponent<any, any, any, infer V> ? V : any
362
+
363
+ // type V2 = VariantDefinitions<typeof OneVariant>
364
+
365
+ // type R = typeof TwoVariant extends TamaguiComponent<any, any, any, infer V> ? V : any
366
+
367
+ // type Keys = keyof X | keyof V
368
+ // type Z = {
369
+ // [Key in Keys]: V[Key] | X[Key]
370
+ // }
371
+
372
+ // const a: Z = {
373
+ // variant: 'colorful',
374
+ // }
375
+ // const b: Z = {
376
+ // variant: 'simple',
377
+ // }
378
+ // const c: Z = {
379
+ // variant: 'invalid',
380
+ // }
381
+
382
+ // const y = <TwoVariant variant="colorful" />
package/src/types.tsx CHANGED
@@ -42,7 +42,7 @@ export type DebugProp = boolean | 'break' | 'verbose' | 'visualize' | 'profile'
42
42
 
43
43
  export type TamaguiComponentPropsBaseBase = {
44
44
  target?: string
45
- hitSlop?: PressableProps['hitSlop']
45
+
46
46
  /**
47
47
  * When truthy passes through all props to a single child element, and avoids rendering its own element.
48
48
  * Must pass just one child React element that will receive all the props.
@@ -1354,21 +1354,19 @@ export type StyleableOptions = {
1354
1354
  staticConfig?: Partial<StaticConfig>
1355
1355
  }
1356
1356
 
1357
- export type Styleable<Props, Ref> = <
1358
- CustomProps extends Object,
1359
- X extends FunctionComponent<any> = FunctionComponent<
1360
- ThemeableProps & Props & CustomProps
1361
- >
1357
+ export type Styleable<Props, Ref, BaseProps, VariantProps, ParentStaticProperties> = <
1358
+ CustomProps extends Object | void = void,
1359
+ X extends FunctionComponent<any> = FunctionComponent<any>
1362
1360
  >(
1363
1361
  a: X,
1364
1362
  options?: StyleableOptions
1365
- ) => ReactComponentWithRef<
1366
- CustomProps & Omit<Props & ThemeableProps, keyof CustomProps>,
1367
- Ref
1368
- > & {
1369
- staticConfig: StaticConfig
1370
- styleable: Styleable<Props, Ref>
1371
- }
1363
+ ) => TamaguiComponent<
1364
+ CustomProps extends void ? Props : Omit<Props, keyof CustomProps> & CustomProps,
1365
+ Ref,
1366
+ BaseProps,
1367
+ VariantProps,
1368
+ ParentStaticProperties
1369
+ >
1372
1370
 
1373
1371
  export type TamaguiComponent<
1374
1372
  Props = any,
@@ -1377,22 +1375,23 @@ export type TamaguiComponent<
1377
1375
  VariantProps = {},
1378
1376
  ParentStaticProperties = {}
1379
1377
  > = ReactComponentWithRef<Props, Ref> &
1380
- StaticComponentObject<Props, Ref> &
1378
+ StaticComponentObject<Props, Ref, BaseProps, VariantProps, ParentStaticProperties> &
1381
1379
  ParentStaticProperties & {
1382
1380
  __baseProps: BaseProps
1383
1381
  __variantProps: VariantProps
1384
1382
  }
1385
1383
 
1386
- type StaticComponentObject<Props, Ref> = {
1387
- staticConfig: StaticConfig
1388
-
1389
- /** @deprecated use `styleable` instead (same functionality, better name) */
1390
- extractable: <X>(a: X, staticConfig?: Partial<StaticConfig>) => X
1391
- /*
1392
- * If you want your HOC of a styled() component to also be able to be styled(), you need this to wrap it.
1393
- */
1394
- styleable: Styleable<Props, Ref>
1395
- }
1384
+ type StaticComponentObject<Props, Ref, BaseProps, VariantProps, ParentStaticProperties> =
1385
+ {
1386
+ staticConfig: StaticConfig
1387
+
1388
+ /** @deprecated use `styleable` instead (same functionality, better name) */
1389
+ extractable: <X>(a: X, staticConfig?: Partial<StaticConfig>) => X
1390
+ /*
1391
+ * If you want your HOC of a styled() component to also be able to be styled(), you need this to wrap it.
1392
+ */
1393
+ styleable: Styleable<Props, Ref, BaseProps, VariantProps, ParentStaticProperties>
1394
+ }
1396
1395
 
1397
1396
  export type TamaguiComponentExpectingVariants<
1398
1397
  Props = {},
@@ -1516,7 +1515,7 @@ export type StaticConfigPublic = {
1516
1515
  }
1517
1516
 
1518
1517
  type StaticConfigBase = StaticConfigPublic & {
1519
- Component?: FunctionComponent<any> & StaticComponentObject<any, any>
1518
+ Component?: FunctionComponent<any> & StaticComponentObject<any, any, any, any, any>
1520
1519
 
1521
1520
  variants?: GenericVariantDefinitions
1522
1521
 
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { DebugProp, SpaceDirection, SpaceValue, SpacerProps, StackProps, StaticConfig, TamaguiComponent, TamaguiElement, TextProps } from './types';
3
3
  export declare const mouseUps: Set<Function>;
4
- export declare function createComponent<ComponentPropTypes extends StackProps | TextProps = {}, Ref = TamaguiElement, BaseProps = never>(staticConfig: StaticConfig): TamaguiComponent<ComponentPropTypes, Ref, BaseProps, {}>;
4
+ export declare function createComponent<ComponentPropTypes extends StackProps | TextProps = {}, Ref = TamaguiElement, BaseProps = never>(staticConfig: StaticConfig): TamaguiComponent<ComponentPropTypes, Ref, BaseProps, void>;
5
5
  export declare function Unspaced(props: {
6
6
  children?: any;
7
7
  }): any;
8
- export declare const Spacer: TamaguiComponent<SpacerProps, TamaguiElement, never, {}>;
8
+ export declare const Spacer: TamaguiComponent<SpacerProps, TamaguiElement, never, void>;
9
9
  export type SpacedChildrenProps = {
10
10
  isZStack?: boolean;
11
11
  children?: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAaN,MAAM,OAAO,CAAA;AAsBd,OAAO,EAEL,SAAS,EAKT,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EAEZ,gBAAgB,EAGhB,cAAc,EAEd,SAAS,EAKV,MAAM,SAAS,CAAA;AAoBhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA6D3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,UAAU,GAAG,SAAS,GAAG,EAAE,EACtD,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EACjB,YAAY,EAAE,YAAY,4DAysC3B;AAsBD,wBAAgB,Q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AAC,EAAE,UAAU,CAAA;IAClB,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,mBAiGxD"}
@@ -1,2 +1,4 @@
1
- export declare const withStaticProperties: <A extends Function, B>(component: A, staticProps: B) => A & B;
1
+ type Combined<A, B> = A & B;
2
+ export declare const withStaticProperties: <A extends Function, B>(component: A, staticProps: B) => Combined<A, B>;
3
+ export {};
2
4
  //# sourceMappingURL=withStaticProperties.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withStaticProperties.d.ts","sourceRoot":"","sources":["../../src/helpers/withStaticProperties.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,gEAyBhC,CAAA"}
1
+ {"version":3,"file":"withStaticProperties.d.ts","sourceRoot":"","sources":["../../src/helpers/withStaticProperties.tsx"],"names":[],"mappings":"AAIA,KAAK,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE3B,eAAO,MAAM,oBAAoB,yEAyBhC,CAAA"}
package/types/styled.d.ts CHANGED
@@ -6,12 +6,14 @@ type GetVariantProps<A extends StylableComponent> = A extends TamaguiComponent<a
6
6
  type GetVariantAcceptedValues<V> = V extends Object ? {
7
7
  [Key in keyof V]?: V[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof V[Key]>;
8
8
  } : undefined;
9
- export declare function styled<ParentComponent extends StylableComponent, Variants extends VariantDefinitions<ParentComponent> | void = VariantDefinitions<ParentComponent> | void>(ComponentIn: ParentComponent, options?: GetProps<ParentComponent> & {
9
+ type ValueOf<T> = T[keyof T];
10
+ type AreVariantsUndefined<V> = V extends undefined ? true : ValueOf<V> extends undefined ? true : false;
11
+ export declare function styled<ParentComponent extends StylableComponent, Variants extends VariantDefinitions<ParentComponent> | void>(ComponentIn: ParentComponent, options?: GetProps<ParentComponent> & {
10
12
  name?: string;
11
13
  variants?: Variants | undefined;
12
14
  defaultVariants?: GetVariantAcceptedValues<Variants>;
13
15
  context?: StyledContext;
14
16
  acceptsClassName?: boolean;
15
- }, 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>) & PseudoProps<Partial<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>)>>, GetRef<ParentComponent>, GetBaseProps<ParentComponent>, GetVariantProps<ParentComponent> & (Variants extends void ? {} : GetVariantAcceptedValues<Variants>), { [Key in Exclude<keyof ParentComponent, "defaultProps" | "propTypes" | "staticConfig" | "extractable" | "styleable" | "$$typeof">]: ParentComponent[Key]; }>;
17
+ }, staticExtractionOptions?: Partial<StaticConfig>): TamaguiComponent<Variants extends void ? GetProps<ParentComponent> : GetBaseProps<ParentComponent> & (AreVariantsUndefined<Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>> extends true ? GetVariantProps<ParentComponent> : AreVariantsUndefined<GetVariantProps<ParentComponent>> extends true ? Variants extends undefined ? {} : GetVariantAcceptedValues<Variants> : { [Key in keyof GetVariantProps<ParentComponent> | keyof (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>)]?: (Key extends keyof GetVariantProps<ParentComponent> ? GetVariantProps<ParentComponent>[Key] : undefined) | (Key extends keyof (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>) ? (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>)[Key] : undefined) | undefined; }) & PseudoProps<Partial<GetBaseProps<ParentComponent> & (AreVariantsUndefined<Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>> extends true ? GetVariantProps<ParentComponent> : AreVariantsUndefined<GetVariantProps<ParentComponent>> extends true ? Variants extends undefined ? {} : GetVariantAcceptedValues<Variants> : { [Key in keyof GetVariantProps<ParentComponent> | keyof (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>)]?: (Key extends keyof GetVariantProps<ParentComponent> ? GetVariantProps<ParentComponent>[Key] : undefined) | (Key extends keyof (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>) ? (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>)[Key] : undefined) | undefined; })>> & MediaProps<Partial<GetBaseProps<ParentComponent> & (AreVariantsUndefined<Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>> extends true ? GetVariantProps<ParentComponent> : AreVariantsUndefined<GetVariantProps<ParentComponent>> extends true ? Variants extends undefined ? {} : GetVariantAcceptedValues<Variants> : { [Key in keyof GetVariantProps<ParentComponent> | keyof (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>)]?: (Key extends keyof GetVariantProps<ParentComponent> ? GetVariantProps<ParentComponent>[Key] : undefined) | (Key extends keyof (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>) ? (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>)[Key] : undefined) | undefined; })>>, GetRef<ParentComponent>, GetBaseProps<ParentComponent>, AreVariantsUndefined<Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>> extends true ? GetVariantProps<ParentComponent> : AreVariantsUndefined<GetVariantProps<ParentComponent>> extends true ? Variants extends undefined ? {} : GetVariantAcceptedValues<Variants> : { [Key in keyof GetVariantProps<ParentComponent> | keyof (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>)]?: (Key extends keyof GetVariantProps<ParentComponent> ? GetVariantProps<ParentComponent>[Key] : undefined) | (Key extends keyof (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>) ? (Variants extends undefined ? {} : GetVariantAcceptedValues<Variants>)[Key] : undefined) | undefined; }, { [Key_1 in Exclude<keyof ParentComponent, "defaultProps" | "propTypes" | "staticConfig" | "extractable" | "styleable" | "$$typeof">]: ParentComponent[Key_1]; }>;
16
18
  export {};
17
19
  //# sourceMappingURL=styled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,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,CAAC,GAAG,CA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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,CAAC,GAAG,CAAC,CAAC;CACnC,GACD,SAAS,CAAA;AAEb,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAC5B,KAAK,oBAAoB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAC9C,IAAI,GACJ,OAAO,CAAC,CAAC,CAAC,SAAS,SAAS,GAC5B,IAAI,GACJ,KAAK,CAAA;AAET,wBAAgB,MAAM,CACpB,eAAe,SAAS,iBAAiB,EACzC,QAAQ,SAAS,kBAAkB,CAAC,eAAe,CAAC,GAAG,IAAI,EAE3D,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,yuGAuLhD"}
package/types/types.d.ts CHANGED
@@ -17,7 +17,6 @@ export type TamaguiTextElement = HTMLElement | RNText;
17
17
  export type DebugProp = boolean | 'break' | 'verbose' | 'visualize' | 'profile';
18
18
  export type TamaguiComponentPropsBaseBase = {
19
19
  target?: string;
20
- hitSlop?: PressableProps['hitSlop'];
21
20
  /**
22
21
  * When truthy passes through all props to a single child element, and avoids rendering its own element.
23
22
  * Must pass just one child React element that will receive all the props.
@@ -754,19 +753,16 @@ export type StyleableOptions = {
754
753
  disableTheme?: boolean;
755
754
  staticConfig?: Partial<StaticConfig>;
756
755
  };
757
- export type Styleable<Props, Ref> = <CustomProps extends Object, X extends FunctionComponent<any> = FunctionComponent<ThemeableProps & Props & CustomProps>>(a: X, options?: StyleableOptions) => ReactComponentWithRef<CustomProps & Omit<Props & ThemeableProps, keyof CustomProps>, Ref> & {
758
- staticConfig: StaticConfig;
759
- styleable: Styleable<Props, Ref>;
760
- };
761
- export type TamaguiComponent<Props = any, Ref = any, BaseProps = {}, VariantProps = {}, ParentStaticProperties = {}> = ReactComponentWithRef<Props, Ref> & StaticComponentObject<Props, Ref> & ParentStaticProperties & {
756
+ export type Styleable<Props, Ref, BaseProps, VariantProps, ParentStaticProperties> = <CustomProps extends Object | void = void, X extends FunctionComponent<any> = FunctionComponent<any>>(a: X, options?: StyleableOptions) => TamaguiComponent<CustomProps extends void ? Props : Omit<Props, keyof CustomProps> & CustomProps, Ref, BaseProps, VariantProps, ParentStaticProperties>;
757
+ export type TamaguiComponent<Props = any, Ref = any, BaseProps = {}, VariantProps = {}, ParentStaticProperties = {}> = ReactComponentWithRef<Props, Ref> & StaticComponentObject<Props, Ref, BaseProps, VariantProps, ParentStaticProperties> & ParentStaticProperties & {
762
758
  __baseProps: BaseProps;
763
759
  __variantProps: VariantProps;
764
760
  };
765
- type StaticComponentObject<Props, Ref> = {
761
+ type StaticComponentObject<Props, Ref, BaseProps, VariantProps, ParentStaticProperties> = {
766
762
  staticConfig: StaticConfig;
767
763
  /** @deprecated use `styleable` instead (same functionality, better name) */
768
764
  extractable: <X>(a: X, staticConfig?: Partial<StaticConfig>) => X;
769
- styleable: Styleable<Props, Ref>;
765
+ styleable: Styleable<Props, Ref, BaseProps, VariantProps, ParentStaticProperties>;
770
766
  };
771
767
  export type TamaguiComponentExpectingVariants<Props = {}, Variants = {}> = TamaguiComponent<Props, any, any, Variants>;
772
768
  export type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {
@@ -859,7 +855,7 @@ export type StaticConfigPublic = {
859
855
  acceptsClassName?: boolean;
860
856
  };
861
857
  type StaticConfigBase = StaticConfigPublic & {
862
- Component?: FunctionComponent<any> & StaticComponentObject<any, any>;
858
+ Component?: FunctionComponent<any> & StaticComponentObject<any, any, any, any, any>;
863
859
  variants?: GenericVariantDefinitions;
864
860
  context?: StyledContext;
865
861
  /**