@tamagui/web 1.88.5 → 1.88.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.js +2 -1
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/createComponent.native.js +2 -1
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +3 -2
- package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js +3 -2
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/createComponent.js +2 -1
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createComponent.native.js +2 -1
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +3 -2
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +3 -2
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/package.json +10 -10
- package/src/createComponent.tsx +6 -4
- package/src/helpers/getSplitStyles.tsx +4 -2
- package/src/types.tsx +105 -64
- package/types/createComponent.d.ts +2 -2
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/types.d.ts +44 -33
- package/types/types.d.ts.map +1 -1
- package/types/views/Stack.d.ts +1 -1
- package/types/views/Stack.d.ts.map +1 -1
- package/types/views/Text.d.ts +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/View.d.ts +1 -1
- package/types/views/View.d.ts.map +1 -1
package/src/types.tsx
CHANGED
|
@@ -21,13 +21,13 @@ import type {
|
|
|
21
21
|
import type { Variable } from './createVariable'
|
|
22
22
|
import { StyledContext } from './helpers/createStyledContext'
|
|
23
23
|
import { CSSColorNames } from './interfaces/CSSColorNames'
|
|
24
|
+
import { ColorKeys, SizeKeys, SpaceKeys } from './interfaces/KeyTypes'
|
|
24
25
|
import { RNOnlyProps } from './interfaces/RNExclusiveTypes'
|
|
25
|
-
import
|
|
26
|
-
import type { ThemeProviderProps } from './views/ThemeProvider'
|
|
26
|
+
import { TamaguiComponentPropsBaseBase } from './interfaces/TamaguiComponentPropsBaseBase'
|
|
27
27
|
import { TamaguiComponentState } from './interfaces/TamaguiComponentState'
|
|
28
28
|
import { WebOnlyPressEvents } from './interfaces/WebOnlyPressEvents'
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
29
|
+
import type { LanguageContextType } from './views/FontLanguage.types'
|
|
30
|
+
import type { ThemeProviderProps } from './views/ThemeProvider'
|
|
31
31
|
|
|
32
32
|
export * from './interfaces/KeyTypes'
|
|
33
33
|
export * from './interfaces/TamaguiComponentState'
|
|
@@ -453,7 +453,7 @@ export interface SpacerStyleProps
|
|
|
453
453
|
extends Omit<StackStyleBase, keyof SpacerUniqueProps>,
|
|
454
454
|
SpacerUniqueProps {}
|
|
455
455
|
|
|
456
|
-
export type SpacerProps = WithThemeShorthandsPseudosMedia<SpacerStyleProps>
|
|
456
|
+
export type SpacerProps = WithThemeShorthandsPseudosMedia<SpacerStyleProps, {}>
|
|
457
457
|
|
|
458
458
|
type AllowedValueSettingBase =
|
|
459
459
|
| boolean
|
|
@@ -1112,10 +1112,23 @@ export type GetThemeValueForKey<K extends string | symbol | number> =
|
|
|
1112
1112
|
: never
|
|
1113
1113
|
: never)
|
|
1114
1114
|
|
|
1115
|
-
export type
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1115
|
+
export type GetThemeValuesFor<
|
|
1116
|
+
T extends Object,
|
|
1117
|
+
K extends keyof T,
|
|
1118
|
+
AddUnset,
|
|
1119
|
+
> = ThemeValueGet<K> extends never
|
|
1120
|
+
? T[K] | (AddUnset extends true ? 'unset' : never)
|
|
1121
|
+
:
|
|
1122
|
+
| GetThemeValueForKey<K>
|
|
1123
|
+
| Exclude<T[K], string>
|
|
1124
|
+
| (AddUnset extends true ? 'unset' : never)
|
|
1125
|
+
|
|
1126
|
+
export type WithThemeValues<T extends Object, Variants extends Object> = {
|
|
1127
|
+
[K in keyof T | keyof Variants]?: K extends keyof Variants
|
|
1128
|
+
? GetThemeValuesFor<Variants, K, false>
|
|
1129
|
+
: K extends keyof T
|
|
1130
|
+
? GetThemeValuesFor<T, K, true>
|
|
1131
|
+
: never
|
|
1119
1132
|
}
|
|
1120
1133
|
|
|
1121
1134
|
export type NarrowShorthands = Narrow<Shorthands>
|
|
@@ -1156,21 +1169,31 @@ export type AllPlatforms = 'web' | 'native' | 'android' | 'ios'
|
|
|
1156
1169
|
//
|
|
1157
1170
|
// add both theme and shorthands
|
|
1158
1171
|
//
|
|
1159
|
-
export type WithThemeAndShorthands<
|
|
1160
|
-
|
|
1161
|
-
|
|
1172
|
+
export type WithThemeAndShorthands<
|
|
1173
|
+
A extends Object,
|
|
1174
|
+
Variants extends Object,
|
|
1175
|
+
> = OnlyAllowShorthands extends true
|
|
1176
|
+
? WithThemeValues<Omit<A, Longhands>, Variants> &
|
|
1177
|
+
WithShorthands<WithThemeValues<A, Variants>>
|
|
1178
|
+
: WithThemeValues<A, Variants> & WithShorthands<WithThemeValues<A, Variants>>
|
|
1162
1179
|
|
|
1163
1180
|
//
|
|
1164
1181
|
// combines all of theme, shorthands, pseudos...
|
|
1165
1182
|
//
|
|
1166
|
-
export type WithThemeShorthandsAndPseudos<
|
|
1167
|
-
|
|
1183
|
+
export type WithThemeShorthandsAndPseudos<
|
|
1184
|
+
A extends Object,
|
|
1185
|
+
Variants extends Object,
|
|
1186
|
+
> = WithThemeAndShorthands<A, Variants> &
|
|
1187
|
+
WithPseudoProps<WithThemeAndShorthands<A, Variants>>
|
|
1168
1188
|
|
|
1169
1189
|
//
|
|
1170
1190
|
// ... media queries and animations
|
|
1171
1191
|
//
|
|
1172
|
-
export type WithThemeShorthandsPseudosMedia<
|
|
1173
|
-
|
|
1192
|
+
export type WithThemeShorthandsPseudosMedia<
|
|
1193
|
+
A extends Object,
|
|
1194
|
+
Variants extends Object,
|
|
1195
|
+
> = WithThemeShorthandsAndPseudos<A, Variants> &
|
|
1196
|
+
WithMediaProps<WithThemeShorthandsAndPseudos<A, Variants>>
|
|
1174
1197
|
|
|
1175
1198
|
/**
|
|
1176
1199
|
* Base style-only props (no media, pseudo):
|
|
@@ -1289,7 +1312,7 @@ export interface StackNonStyleProps
|
|
|
1289
1312
|
style?: StyleProp<LooseCombinedObjects<React.CSSProperties, ViewStyle>>
|
|
1290
1313
|
}
|
|
1291
1314
|
|
|
1292
|
-
export type StackStyle = WithThemeShorthandsPseudosMedia<StackStyleBase>
|
|
1315
|
+
export type StackStyle = WithThemeShorthandsPseudosMedia<StackStyleBase, {}>
|
|
1293
1316
|
|
|
1294
1317
|
export type StackProps = StackNonStyleProps & StackStyle
|
|
1295
1318
|
|
|
@@ -1313,7 +1336,7 @@ export interface TextNonStyleProps
|
|
|
1313
1336
|
style?: StyleProp<LooseCombinedObjects<React.CSSProperties, TextStyle>>
|
|
1314
1337
|
}
|
|
1315
1338
|
|
|
1316
|
-
export type TextStyleProps = WithThemeShorthandsPseudosMedia<TextStylePropsBase>
|
|
1339
|
+
export type TextStyleProps = WithThemeShorthandsPseudosMedia<TextStylePropsBase, {}>
|
|
1317
1340
|
|
|
1318
1341
|
export type TextProps = TextNonStyleProps & TextStyleProps
|
|
1319
1342
|
|
|
@@ -1335,42 +1358,42 @@ export type Styleable<
|
|
|
1335
1358
|
Ref,
|
|
1336
1359
|
NonStyledProps,
|
|
1337
1360
|
BaseStyles extends Object,
|
|
1338
|
-
VariantProps,
|
|
1361
|
+
VariantProps extends Object,
|
|
1339
1362
|
ParentStaticProperties,
|
|
1340
1363
|
> = <
|
|
1341
1364
|
CustomProps extends Object | void = void,
|
|
1342
|
-
|
|
1343
|
-
? Props
|
|
1344
|
-
: Omit<Props, keyof CustomProps> & CustomProps,
|
|
1345
|
-
FunctionDef extends FunctionComponent<MergedProps> = FunctionComponent<MergedProps>,
|
|
1365
|
+
FunctionDef extends FunctionComponent<any> = FunctionComponent<any>,
|
|
1346
1366
|
>(
|
|
1347
1367
|
a: FunctionDef,
|
|
1348
1368
|
options?: StyleableOptions
|
|
1349
1369
|
) => TamaguiComponent<
|
|
1350
|
-
|
|
1370
|
+
Props,
|
|
1351
1371
|
Ref,
|
|
1352
1372
|
NonStyledProps & CustomProps,
|
|
1353
|
-
BaseStyles,
|
|
1373
|
+
Omit<BaseStyles, keyof CustomProps>,
|
|
1354
1374
|
VariantProps,
|
|
1355
1375
|
ParentStaticProperties
|
|
1356
1376
|
>
|
|
1357
1377
|
|
|
1358
|
-
export type GetFinalProps<
|
|
1378
|
+
export type GetFinalProps<
|
|
1359
1379
|
NonStyleProps,
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1380
|
+
StylePropsBase,
|
|
1381
|
+
VariantProps extends Object,
|
|
1382
|
+
> = StylePropsBase extends Object
|
|
1383
|
+
? Omit<NonStyleProps, keyof StylePropsBase> &
|
|
1384
|
+
WithThemeShorthandsPseudosMedia<StylePropsBase, VariantProps>
|
|
1385
|
+
: NonStyleProps
|
|
1363
1386
|
|
|
1364
1387
|
export type TamaguiComponent<
|
|
1365
1388
|
Props = any,
|
|
1366
1389
|
Ref = any,
|
|
1367
1390
|
NonStyledProps = {},
|
|
1368
1391
|
BaseStyles extends Object = {},
|
|
1369
|
-
VariantProps = {},
|
|
1392
|
+
VariantProps extends Object = {},
|
|
1370
1393
|
ParentStaticProperties = {},
|
|
1371
1394
|
> = ForwardRefExoticComponent<
|
|
1372
1395
|
(Props extends TamaDefer
|
|
1373
|
-
? GetFinalProps<NonStyledProps, BaseStyles
|
|
1396
|
+
? GetFinalProps<NonStyledProps, BaseStyles, VariantProps>
|
|
1374
1397
|
: Props) &
|
|
1375
1398
|
RefAttributes<Ref>
|
|
1376
1399
|
> &
|
|
@@ -1388,20 +1411,25 @@ export type TamaguiComponent<
|
|
|
1388
1411
|
|
|
1389
1412
|
export type InferGenericComponentProps<A> = A extends ComponentType<infer Props>
|
|
1390
1413
|
? Props
|
|
1391
|
-
: A extends
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1414
|
+
: A extends ReactComponentWithRef<infer P, any>
|
|
1415
|
+
? P
|
|
1416
|
+
: A extends ForwardRefExoticComponent<infer P>
|
|
1417
|
+
? P
|
|
1418
|
+
: A extends new (
|
|
1419
|
+
props: infer Props
|
|
1420
|
+
) => any
|
|
1421
|
+
? Props
|
|
1422
|
+
: {}
|
|
1423
|
+
|
|
1424
|
+
export type InferStyledProps<A extends StylableComponent, B extends Object> = A extends {
|
|
1401
1425
|
__tama: any
|
|
1402
1426
|
}
|
|
1403
1427
|
? GetProps<A>
|
|
1404
|
-
: GetFinalProps<
|
|
1428
|
+
: GetFinalProps<
|
|
1429
|
+
InferGenericComponentProps<A>,
|
|
1430
|
+
GetBaseStyles<A, B>,
|
|
1431
|
+
GetVariantProps<A, B>
|
|
1432
|
+
>
|
|
1405
1433
|
|
|
1406
1434
|
export type GetProps<A extends StylableComponent> = A extends {
|
|
1407
1435
|
__tama: [
|
|
@@ -1414,7 +1442,9 @@ export type GetProps<A extends StylableComponent> = A extends {
|
|
|
1414
1442
|
]
|
|
1415
1443
|
}
|
|
1416
1444
|
? Props extends TamaDefer
|
|
1417
|
-
?
|
|
1445
|
+
? VariantProps extends Object
|
|
1446
|
+
? GetFinalProps<NonStyledProps, BaseStyles, VariantProps>
|
|
1447
|
+
: never
|
|
1418
1448
|
: Props
|
|
1419
1449
|
: InferGenericComponentProps<A>
|
|
1420
1450
|
|
|
@@ -1424,14 +1454,20 @@ export type GetNonStyledProps<A extends StylableComponent> = A extends {
|
|
|
1424
1454
|
? B
|
|
1425
1455
|
: TamaguiComponentPropsBaseBase & GetProps<A>
|
|
1426
1456
|
|
|
1427
|
-
export type GetBaseStyles<A, B> = A extends {
|
|
1457
|
+
export type GetBaseStyles<A, B extends StaticConfig> = A extends {
|
|
1428
1458
|
__tama: [any, any, any, infer C, any, any]
|
|
1429
1459
|
}
|
|
1430
1460
|
? C
|
|
1431
|
-
: B extends
|
|
1461
|
+
: ShouldHaveTextBaseStyles<B> extends true
|
|
1432
1462
|
? TextStylePropsBase
|
|
1433
1463
|
: StackStyleBase
|
|
1434
1464
|
|
|
1465
|
+
type ShouldHaveTextBaseStyles<SC extends StaticConfig> = SC extends { isText: true }
|
|
1466
|
+
? true
|
|
1467
|
+
: SC extends { isInput: true }
|
|
1468
|
+
? true
|
|
1469
|
+
: false
|
|
1470
|
+
|
|
1435
1471
|
export type GetStyledVariants<A> = A extends {
|
|
1436
1472
|
__tama: [any, any, any, any, infer B, any]
|
|
1437
1473
|
}
|
|
@@ -1449,7 +1485,7 @@ export type StaticComponentObject<
|
|
|
1449
1485
|
Ref,
|
|
1450
1486
|
NonStyledProps,
|
|
1451
1487
|
BaseStyles extends Object,
|
|
1452
|
-
VariantProps,
|
|
1488
|
+
VariantProps extends Object,
|
|
1453
1489
|
ParentStaticProperties,
|
|
1454
1490
|
> = {
|
|
1455
1491
|
staticConfig: StaticConfig
|
|
@@ -1460,9 +1496,7 @@ export type StaticComponentObject<
|
|
|
1460
1496
|
* If you want your HOC of a styled() component to also be able to be styled(), you need this to wrap it.
|
|
1461
1497
|
*/
|
|
1462
1498
|
styleable: Styleable<
|
|
1463
|
-
Props
|
|
1464
|
-
? GetFinalProps<NonStyledProps, BaseStyles & VariantProps>
|
|
1465
|
-
: Props,
|
|
1499
|
+
Props,
|
|
1466
1500
|
Ref,
|
|
1467
1501
|
NonStyledProps,
|
|
1468
1502
|
BaseStyles,
|
|
@@ -1541,10 +1575,15 @@ export type StaticConfigPublic = {
|
|
|
1541
1575
|
neverFlatten?: boolean | 'jsx'
|
|
1542
1576
|
|
|
1543
1577
|
/**
|
|
1544
|
-
* Determines ultimate output tag (Text vs View)
|
|
1578
|
+
* Determines ultimate output tag (Text vs View) and accepted props (text props vs view)
|
|
1545
1579
|
*/
|
|
1546
1580
|
isText?: boolean
|
|
1547
1581
|
|
|
1582
|
+
/**
|
|
1583
|
+
* Adds support for text props and handles focus properly
|
|
1584
|
+
*/
|
|
1585
|
+
isInput?: boolean
|
|
1586
|
+
|
|
1548
1587
|
/**
|
|
1549
1588
|
* Which style keys are allowed to be extracted.
|
|
1550
1589
|
*/
|
|
@@ -1608,11 +1647,6 @@ type StaticConfigBase = StaticConfigPublic & {
|
|
|
1608
1647
|
*/
|
|
1609
1648
|
memo?: boolean
|
|
1610
1649
|
|
|
1611
|
-
/**
|
|
1612
|
-
* Used internally for handling focus
|
|
1613
|
-
*/
|
|
1614
|
-
isInput?: boolean
|
|
1615
|
-
|
|
1616
1650
|
/**
|
|
1617
1651
|
* Used internally for knowing how to handle when a HOC is in-between styled()
|
|
1618
1652
|
*/
|
|
@@ -1664,25 +1698,32 @@ export type SpreadKeys =
|
|
|
1664
1698
|
|
|
1665
1699
|
export type VariantDefinitions<
|
|
1666
1700
|
Parent extends StylableComponent = TamaguiComponent,
|
|
1667
|
-
|
|
1668
|
-
MyProps extends Object = Partial<
|
|
1701
|
+
SC extends StaticConfig = {},
|
|
1702
|
+
MyProps extends Object = Partial<GetVariantProps<Parent, SC>>,
|
|
1669
1703
|
Val = any,
|
|
1670
1704
|
> = VariantDefinitionFromProps<MyProps, Val> & {
|
|
1671
1705
|
_isEmpty?: 1
|
|
1672
1706
|
}
|
|
1673
1707
|
|
|
1674
|
-
export type
|
|
1708
|
+
export type GetVariantProps<
|
|
1675
1709
|
A extends StylableComponent,
|
|
1676
|
-
|
|
1710
|
+
B extends StaticConfigPublic,
|
|
1677
1711
|
> = A extends {
|
|
1678
|
-
__tama: [
|
|
1712
|
+
__tama: [
|
|
1713
|
+
infer Props,
|
|
1714
|
+
any,
|
|
1715
|
+
infer NonStyledProps,
|
|
1716
|
+
infer BaseStyles,
|
|
1717
|
+
infer VariantProps,
|
|
1718
|
+
any,
|
|
1719
|
+
]
|
|
1679
1720
|
}
|
|
1680
1721
|
? Props extends TamaDefer
|
|
1681
|
-
?
|
|
1722
|
+
? VariantProps extends Object
|
|
1723
|
+
? GetFinalProps<NonStyledProps, BaseStyles, VariantProps>
|
|
1724
|
+
: never
|
|
1682
1725
|
: Props
|
|
1683
|
-
:
|
|
1684
|
-
IsText extends true ? TextStylePropsBase : StackStyleBase
|
|
1685
|
-
>
|
|
1726
|
+
: {}
|
|
1686
1727
|
|
|
1687
1728
|
export type VariantDefinitionFromProps<MyProps, Val> = MyProps extends Object
|
|
1688
1729
|
? {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DebugProp, SpaceDirection, SpaceValue, SpacerProps, SpacerStyleProps, StackNonStyleProps, StaticConfig, TamaguiComponent, TamaguiElement } from './types';
|
|
3
3
|
export declare const mouseUps: Set<Function>;
|
|
4
|
-
export declare function createComponent<ComponentPropTypes extends Record<string, any> = {}, Ref extends TamaguiElement = TamaguiElement, BaseProps = never, BaseStyles extends Object = never>(staticConfig: StaticConfig): TamaguiComponent<ComponentPropTypes, Ref, BaseProps, BaseStyles,
|
|
4
|
+
export declare function createComponent<ComponentPropTypes extends Record<string, any> = {}, Ref extends TamaguiElement = TamaguiElement, BaseProps = never, BaseStyles extends Object = never>(staticConfig: StaticConfig): TamaguiComponent<ComponentPropTypes, Ref, BaseProps, BaseStyles, {}>;
|
|
5
5
|
export declare function Unspaced(props: {
|
|
6
6
|
children?: any;
|
|
7
7
|
}): any;
|
|
8
8
|
export declare namespace Unspaced {
|
|
9
9
|
var isUnspaced: boolean;
|
|
10
10
|
}
|
|
11
|
-
export declare const Spacer: TamaguiComponent<SpacerProps, TamaguiElement, StackNonStyleProps, SpacerStyleProps,
|
|
11
|
+
export declare const Spacer: TamaguiComponent<SpacerProps, TamaguiElement, StackNonStyleProps, SpacerStyleProps, {}>;
|
|
12
12
|
export type SpacedChildrenProps = {
|
|
13
13
|
isZStack?: boolean;
|
|
14
14
|
children?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAYN,MAAM,OAAO,CAAA;AAuBd,OAAO,EAEL,SAAS,EAMT,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAElB,YAAY,EAEZ,gBAAgB,EAEhB,cAAc,EAMf,MAAM,SAAS,CAAA;AAiBhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA6D3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACnD,GAAG,SAAS,cAAc,GAAG,cAAc,EAC3C,SAAS,GAAG,KAAK,EACjB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,YAAY,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAYN,MAAM,OAAO,CAAA;AAuBd,OAAO,EAEL,SAAS,EAMT,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAElB,YAAY,EAEZ,gBAAgB,EAEhB,cAAc,EAMf,MAAM,SAAS,CAAA;AAiBhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA6D3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACnD,GAAG,SAAS,cAAc,GAAG,cAAc,EAC3C,SAAS,GAAG,KAAK,EACjB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,YAAY,EAAE,YAAY,wEAmrC3B;AAsBD,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,OAEjD;yBAFe,QAAQ;;;AAkBxB,eAAO,MAAM,MAAM,yFA0CjB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,cAAc,GAAG,OAAO,CAAA;IACpC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,mBAiGxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAEV,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,aAAa,EAOb,eAAe,EACf,YAAY,EAGZ,cAAc,EACd,WAAW,EAEZ,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AA4BhF,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAMhE,KAAK,aAAa,GAAG,CACnB,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC7B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,qBAAqB,EACrC,UAAU,EAAE,eAAe,EAC3B,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,EACzC,OAAO,CAAC,EAAE,iBAAiB,EAE3B,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,SAAS,KACd,cAAc,CAAA;AAEnB,eAAO,MAAM,UAAU,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAEV,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,aAAa,EAOb,eAAe,EACf,YAAY,EAGZ,cAAc,EACd,WAAW,EAEZ,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AA4BhF,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAMhE,KAAK,aAAa,GAAG,CACnB,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC7B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,qBAAqB,EACrC,UAAU,EAAE,eAAe,EAC3B,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,EACzC,OAAO,CAAC,EAAE,iBAAiB,EAE3B,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,SAAS,KACd,cAAc,CAAA;AAEnB,eAAO,MAAM,UAAU,MAAM,CAAA;AAgC7B,eAAO,MAAM,cAAc,EAAE,aAqoC5B,CAAA;AA2DD,eAAO,MAAM,WAAW,eACV,aAAa,UACjB,MAAM,WACL,MAAM,wBACO,OAAO,KAC5B,cA2BF,CAAA;AAqBD,eAAO,MAAM,cAAc,EAAE,aAQ5B,CAAA"}
|
package/types/types.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ import type { Text as RNText, TextProps as ReactTextProps, TextStyle, View, View
|
|
|
5
5
|
import type { Variable } from './createVariable';
|
|
6
6
|
import { StyledContext } from './helpers/createStyledContext';
|
|
7
7
|
import { CSSColorNames } from './interfaces/CSSColorNames';
|
|
8
|
+
import { ColorKeys, SizeKeys, SpaceKeys } from './interfaces/KeyTypes';
|
|
8
9
|
import { RNOnlyProps } from './interfaces/RNExclusiveTypes';
|
|
9
|
-
import
|
|
10
|
-
import type { ThemeProviderProps } from './views/ThemeProvider';
|
|
10
|
+
import { TamaguiComponentPropsBaseBase } from './interfaces/TamaguiComponentPropsBaseBase';
|
|
11
11
|
import { TamaguiComponentState } from './interfaces/TamaguiComponentState';
|
|
12
12
|
import { WebOnlyPressEvents } from './interfaces/WebOnlyPressEvents';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import type { LanguageContextType } from './views/FontLanguage.types';
|
|
14
|
+
import type { ThemeProviderProps } from './views/ThemeProvider';
|
|
15
15
|
export * from './interfaces/KeyTypes';
|
|
16
16
|
export * from './interfaces/TamaguiComponentState';
|
|
17
17
|
export type { MediaStyleObject, StyleObject } from '@tamagui/helpers';
|
|
@@ -270,7 +270,7 @@ export type SpacerUniqueProps = {
|
|
|
270
270
|
};
|
|
271
271
|
export interface SpacerStyleProps extends Omit<StackStyleBase, keyof SpacerUniqueProps>, SpacerUniqueProps {
|
|
272
272
|
}
|
|
273
|
-
export type SpacerProps = WithThemeShorthandsPseudosMedia<SpacerStyleProps>;
|
|
273
|
+
export type SpacerProps = WithThemeShorthandsPseudosMedia<SpacerStyleProps, {}>;
|
|
274
274
|
type AllowedValueSettingBase = boolean | 'strict' | 'somewhat-strict' | 'strict-web' | 'somewhat-strict-web';
|
|
275
275
|
type AllowedStyleValuesSettingSize = AllowedValueSettingBase | 'number' | 'percent';
|
|
276
276
|
type AllowedStyleValuesSettingZIndex = AllowedValueSettingBase | 'number';
|
|
@@ -600,8 +600,9 @@ export type ThemeValueGet<K extends string | number | symbol> = K extends 'theme
|
|
|
600
600
|
export type GetThemeValueForKey<K extends string | symbol | number> = ThemeValueGet<K> | ThemeValueFallback | (TamaguiSettings extends {
|
|
601
601
|
autocompleteSpecificTokens: infer Val;
|
|
602
602
|
} ? Val extends true | undefined ? SpecificTokens : never : never);
|
|
603
|
-
export type
|
|
604
|
-
|
|
603
|
+
export type GetThemeValuesFor<T extends Object, K extends keyof T, AddUnset> = ThemeValueGet<K> extends never ? T[K] | (AddUnset extends true ? 'unset' : never) : GetThemeValueForKey<K> | Exclude<T[K], string> | (AddUnset extends true ? 'unset' : never);
|
|
604
|
+
export type WithThemeValues<T extends Object, Variants extends Object> = {
|
|
605
|
+
[K in keyof T | keyof Variants]?: K extends keyof Variants ? GetThemeValuesFor<Variants, K, false> : K extends keyof T ? GetThemeValuesFor<T, K, true> : never;
|
|
605
606
|
};
|
|
606
607
|
export type NarrowShorthands = Narrow<Shorthands>;
|
|
607
608
|
export type Longhands = NarrowShorthands[keyof NarrowShorthands];
|
|
@@ -625,9 +626,9 @@ export type PseudoStyles = {
|
|
|
625
626
|
exitStyle?: ViewStyle;
|
|
626
627
|
};
|
|
627
628
|
export type AllPlatforms = 'web' | 'native' | 'android' | 'ios';
|
|
628
|
-
export type WithThemeAndShorthands<A extends Object> = OnlyAllowShorthands extends true ? WithThemeValues<Omit<A, Longhands
|
|
629
|
-
export type WithThemeShorthandsAndPseudos<A extends Object> = WithThemeAndShorthands<A> & WithPseudoProps<WithThemeAndShorthands<A>>;
|
|
630
|
-
export type WithThemeShorthandsPseudosMedia<A extends Object> = WithThemeShorthandsAndPseudos<A> & WithMediaProps<WithThemeShorthandsAndPseudos<A>>;
|
|
629
|
+
export type WithThemeAndShorthands<A extends Object, Variants extends Object> = OnlyAllowShorthands extends true ? WithThemeValues<Omit<A, Longhands>, Variants> & WithShorthands<WithThemeValues<A, Variants>> : WithThemeValues<A, Variants> & WithShorthands<WithThemeValues<A, Variants>>;
|
|
630
|
+
export type WithThemeShorthandsAndPseudos<A extends Object, Variants extends Object> = WithThemeAndShorthands<A, Variants> & WithPseudoProps<WithThemeAndShorthands<A, Variants>>;
|
|
631
|
+
export type WithThemeShorthandsPseudosMedia<A extends Object, Variants extends Object> = WithThemeShorthandsAndPseudos<A, Variants> & WithMediaProps<WithThemeShorthandsAndPseudos<A, Variants>>;
|
|
631
632
|
/**
|
|
632
633
|
* Base style-only props (no media, pseudo):
|
|
633
634
|
*/
|
|
@@ -696,12 +697,12 @@ type LooseCombinedObjects<A extends Object, B extends Object> = A | B | (A & B);
|
|
|
696
697
|
export interface StackNonStyleProps extends Omit<ViewProps, 'pointerEvents' | 'display' | 'children' | RNOnlyProps | keyof ExtendBaseStackProps | 'style'>, ExtendBaseStackProps, TamaguiComponentPropsBase {
|
|
697
698
|
style?: StyleProp<LooseCombinedObjects<React.CSSProperties, ViewStyle>>;
|
|
698
699
|
}
|
|
699
|
-
export type StackStyle = WithThemeShorthandsPseudosMedia<StackStyleBase>;
|
|
700
|
+
export type StackStyle = WithThemeShorthandsPseudosMedia<StackStyleBase, {}>;
|
|
700
701
|
export type StackProps = StackNonStyleProps & StackStyle;
|
|
701
702
|
export interface TextNonStyleProps extends Omit<ReactTextProps, 'children' | keyof WebOnlyPressEvents | RNOnlyProps | keyof ExtendBaseTextProps | 'style'>, ExtendBaseTextProps, TamaguiComponentPropsBase {
|
|
702
703
|
style?: StyleProp<LooseCombinedObjects<React.CSSProperties, TextStyle>>;
|
|
703
704
|
}
|
|
704
|
-
export type TextStyleProps = WithThemeShorthandsPseudosMedia<TextStylePropsBase>;
|
|
705
|
+
export type TextStyleProps = WithThemeShorthandsPseudosMedia<TextStylePropsBase, {}>;
|
|
705
706
|
export type TextProps = TextNonStyleProps & TextStyleProps;
|
|
706
707
|
export interface ThemeableProps {
|
|
707
708
|
theme?: ThemeName | null;
|
|
@@ -714,15 +715,15 @@ export type StyleableOptions = {
|
|
|
714
715
|
disableTheme?: boolean;
|
|
715
716
|
staticConfig?: Partial<StaticConfig>;
|
|
716
717
|
};
|
|
717
|
-
export type Styleable<Props, Ref, NonStyledProps, BaseStyles extends Object, VariantProps, ParentStaticProperties> = <CustomProps extends Object | void = void,
|
|
718
|
-
export type GetFinalProps<NonStyleProps, StylePropsBase> = Omit<NonStyleProps, keyof StylePropsBase> &
|
|
719
|
-
export type TamaguiComponent<Props = any, Ref = any, NonStyledProps = {}, BaseStyles extends Object = {}, VariantProps = {}, ParentStaticProperties = {}> = ForwardRefExoticComponent<(Props extends TamaDefer ? GetFinalProps<NonStyledProps, BaseStyles
|
|
718
|
+
export type Styleable<Props, Ref, NonStyledProps, BaseStyles extends Object, VariantProps extends Object, ParentStaticProperties> = <CustomProps extends Object | void = void, FunctionDef extends FunctionComponent<any> = FunctionComponent<any>>(a: FunctionDef, options?: StyleableOptions) => TamaguiComponent<Props, Ref, NonStyledProps & CustomProps, Omit<BaseStyles, keyof CustomProps>, VariantProps, ParentStaticProperties>;
|
|
719
|
+
export type GetFinalProps<NonStyleProps, StylePropsBase, VariantProps extends Object> = StylePropsBase extends Object ? Omit<NonStyleProps, keyof StylePropsBase> & WithThemeShorthandsPseudosMedia<StylePropsBase, VariantProps> : NonStyleProps;
|
|
720
|
+
export type TamaguiComponent<Props = any, Ref = any, NonStyledProps = {}, BaseStyles extends Object = {}, VariantProps extends Object = {}, ParentStaticProperties = {}> = ForwardRefExoticComponent<(Props extends TamaDefer ? GetFinalProps<NonStyledProps, BaseStyles, VariantProps> : Props) & RefAttributes<Ref>> & StaticComponentObject<Props, Ref, NonStyledProps, BaseStyles, VariantProps, ParentStaticProperties> & Omit<ParentStaticProperties, 'staticConfig' | 'extractable' | 'styleable'> & {
|
|
720
721
|
__tama: [Props, Ref, NonStyledProps, BaseStyles, VariantProps, ParentStaticProperties];
|
|
721
722
|
};
|
|
722
|
-
export type InferGenericComponentProps<A> = A extends ComponentType<infer Props> ? Props : A extends new (props: infer Props) => any ? Props : {};
|
|
723
|
-
export type InferStyledProps<A extends StylableComponent, B extends
|
|
723
|
+
export type InferGenericComponentProps<A> = A extends ComponentType<infer Props> ? Props : A extends ReactComponentWithRef<infer P, any> ? P : A extends ForwardRefExoticComponent<infer P> ? P : A extends new (props: infer Props) => any ? Props : {};
|
|
724
|
+
export type InferStyledProps<A extends StylableComponent, B extends Object> = A extends {
|
|
724
725
|
__tama: any;
|
|
725
|
-
} ? GetProps<A> : GetFinalProps<InferGenericComponentProps<A>, GetBaseStyles<
|
|
726
|
+
} ? GetProps<A> : GetFinalProps<InferGenericComponentProps<A>, GetBaseStyles<A, B>, GetVariantProps<A, B>>;
|
|
726
727
|
export type GetProps<A extends StylableComponent> = A extends {
|
|
727
728
|
__tama: [
|
|
728
729
|
infer Props,
|
|
@@ -732,26 +733,29 @@ export type GetProps<A extends StylableComponent> = A extends {
|
|
|
732
733
|
infer VariantProps,
|
|
733
734
|
any
|
|
734
735
|
];
|
|
735
|
-
} ? Props extends TamaDefer ? GetFinalProps<NonStyledProps, BaseStyles
|
|
736
|
+
} ? Props extends TamaDefer ? VariantProps extends Object ? GetFinalProps<NonStyledProps, BaseStyles, VariantProps> : never : Props : InferGenericComponentProps<A>;
|
|
736
737
|
export type GetNonStyledProps<A extends StylableComponent> = A extends {
|
|
737
738
|
__tama: [any, any, infer B, any, any, any];
|
|
738
739
|
} ? B : TamaguiComponentPropsBaseBase & GetProps<A>;
|
|
739
|
-
export type GetBaseStyles<A, B> = A extends {
|
|
740
|
+
export type GetBaseStyles<A, B extends StaticConfig> = A extends {
|
|
740
741
|
__tama: [any, any, any, infer C, any, any];
|
|
741
|
-
} ? C : B extends
|
|
742
|
+
} ? C : ShouldHaveTextBaseStyles<B> extends true ? TextStylePropsBase : StackStyleBase;
|
|
743
|
+
type ShouldHaveTextBaseStyles<SC extends StaticConfig> = SC extends {
|
|
742
744
|
isText: true;
|
|
743
|
-
} ?
|
|
745
|
+
} ? true : SC extends {
|
|
746
|
+
isInput: true;
|
|
747
|
+
} ? true : false;
|
|
744
748
|
export type GetStyledVariants<A> = A extends {
|
|
745
749
|
__tama: [any, any, any, any, infer B, any];
|
|
746
750
|
} ? B : {};
|
|
747
751
|
export type GetStaticConfig<A> = A extends {
|
|
748
752
|
__tama: [any, any, any, any, any, infer B];
|
|
749
753
|
} ? B : A;
|
|
750
|
-
export type StaticComponentObject<Props, Ref, NonStyledProps, BaseStyles extends Object, VariantProps, ParentStaticProperties> = {
|
|
754
|
+
export type StaticComponentObject<Props, Ref, NonStyledProps, BaseStyles extends Object, VariantProps extends Object, ParentStaticProperties> = {
|
|
751
755
|
staticConfig: StaticConfig;
|
|
752
756
|
/** @deprecated use `styleable` instead (same functionality, better name) */
|
|
753
757
|
extractable: <X>(a: X, staticConfig?: Partial<StaticConfig>) => X;
|
|
754
|
-
styleable: Styleable<Props
|
|
758
|
+
styleable: Styleable<Props, Ref, NonStyledProps, BaseStyles, VariantProps, ParentStaticProperties>;
|
|
755
759
|
};
|
|
756
760
|
export type TamaguiComponentExpectingVariants<Props = {}, Variants extends Object = {}> = TamaguiComponent<Props, any, any, any, Variants>;
|
|
757
761
|
export type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {
|
|
@@ -797,9 +801,13 @@ export type StaticConfigPublic = {
|
|
|
797
801
|
*/
|
|
798
802
|
neverFlatten?: boolean | 'jsx';
|
|
799
803
|
/**
|
|
800
|
-
* Determines ultimate output tag (Text vs View)
|
|
804
|
+
* Determines ultimate output tag (Text vs View) and accepted props (text props vs view)
|
|
801
805
|
*/
|
|
802
806
|
isText?: boolean;
|
|
807
|
+
/**
|
|
808
|
+
* Adds support for text props and handles focus properly
|
|
809
|
+
*/
|
|
810
|
+
isInput?: boolean;
|
|
803
811
|
/**
|
|
804
812
|
* Which style keys are allowed to be extracted.
|
|
805
813
|
*/
|
|
@@ -854,10 +862,6 @@ type StaticConfigBase = StaticConfigPublic & {
|
|
|
854
862
|
* Memoize the component
|
|
855
863
|
*/
|
|
856
864
|
memo?: boolean;
|
|
857
|
-
/**
|
|
858
|
-
* Used internally for handling focus
|
|
859
|
-
*/
|
|
860
|
-
isInput?: boolean;
|
|
861
865
|
/**
|
|
862
866
|
* Used internally for knowing how to handle when a HOC is in-between styled()
|
|
863
867
|
*/
|
|
@@ -879,12 +883,19 @@ export type ViewStyleWithPseudos = TextStyleProps | (TextStyleProps & {
|
|
|
879
883
|
*/
|
|
880
884
|
export type StylableComponent = TamaguiComponent | ComponentType<any> | ForwardRefExoticComponent<any> | ReactComponentWithRef<any, any> | (new (props: any) => any);
|
|
881
885
|
export type SpreadKeys = '...fontSize' | '...fontStyle' | '...fontTransform' | '...lineHeight' | '...letterSpacing' | '...size' | '...space' | '...color' | '...zIndex' | '...theme' | '...radius';
|
|
882
|
-
export type VariantDefinitions<Parent extends StylableComponent = TamaguiComponent,
|
|
886
|
+
export type VariantDefinitions<Parent extends StylableComponent = TamaguiComponent, SC extends StaticConfig = {}, MyProps extends Object = Partial<GetVariantProps<Parent, SC>>, Val = any> = VariantDefinitionFromProps<MyProps, Val> & {
|
|
883
887
|
_isEmpty?: 1;
|
|
884
888
|
};
|
|
885
|
-
export type
|
|
886
|
-
__tama: [
|
|
887
|
-
|
|
889
|
+
export type GetVariantProps<A extends StylableComponent, B extends StaticConfigPublic> = A extends {
|
|
890
|
+
__tama: [
|
|
891
|
+
infer Props,
|
|
892
|
+
any,
|
|
893
|
+
infer NonStyledProps,
|
|
894
|
+
infer BaseStyles,
|
|
895
|
+
infer VariantProps,
|
|
896
|
+
any
|
|
897
|
+
];
|
|
898
|
+
} ? Props extends TamaDefer ? VariantProps extends Object ? GetFinalProps<NonStyledProps, BaseStyles, VariantProps> : never : Props : {};
|
|
888
899
|
export type VariantDefinitionFromProps<MyProps, Val> = MyProps extends Object ? {
|
|
889
900
|
[propName: string]: VariantSpreadFunction<MyProps, Val> | ({
|
|
890
901
|
[Key in SpreadKeys]?: Key extends '...fontSize' ? FontSizeVariantSpreadFunction<MyProps> : Key extends '...size' ? SizeVariantSpreadFunction<MyProps> : Key extends '...space' ? SpaceVariantSpreadFunction<MyProps> : Key extends '...color' ? ColorVariantSpreadFunction<MyProps> : Key extends '...lineHeight' ? FontLineHeightVariantSpreadFunction<MyProps> : Key extends '...fontTransform' ? FontTransformVariantSpreadFunction<MyProps> : Key extends '...fontStyle' ? FontStyleVariantSpreadFunction<MyProps> : Key extends '...letterSpacing' ? FontLetterSpacingVariantSpreadFunction<MyProps> : Key extends '...zIndex' ? ZIndexVariantSpreadFunction<MyProps> : Key extends '...radius' ? RadiusVariantSpreadFunction<MyProps> : Key extends '...theme' ? ThemeVariantSpreadFunction<MyProps> : never;
|