@tamagui/helpers 2.7.7 → 3.0.0-beta.1097.1

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 (123) hide show
  1. package/dist/cjs/clamp.cjs +15 -19
  2. package/dist/cjs/clamp.native.cjs +29 -0
  3. package/dist/cjs/clamp.native.js +16 -19
  4. package/dist/cjs/clamp.native.js.map +1 -1
  5. package/dist/cjs/composeEventHandlers.cjs +25 -32
  6. package/dist/cjs/composeEventHandlers.native.cjs +38 -0
  7. package/dist/cjs/composeEventHandlers.native.js +25 -36
  8. package/dist/cjs/composeEventHandlers.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +12 -11
  10. package/dist/cjs/index.native.cjs +30 -0
  11. package/dist/cjs/index.native.js +12 -10
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/reservedThemeProps.cjs +40 -0
  14. package/dist/cjs/reservedThemeProps.native.cjs +42 -0
  15. package/dist/cjs/reservedThemeProps.native.js +44 -0
  16. package/dist/cjs/reservedThemeProps.native.js.map +1 -0
  17. package/dist/cjs/shouldRenderNativePlatform.cjs +37 -37
  18. package/dist/cjs/shouldRenderNativePlatform.native.cjs +70 -0
  19. package/dist/cjs/shouldRenderNativePlatform.native.js +54 -59
  20. package/dist/cjs/shouldRenderNativePlatform.native.js.map +1 -1
  21. package/dist/cjs/themeClassNames.cjs +44 -0
  22. package/dist/cjs/themeClassNames.native.cjs +64 -0
  23. package/dist/cjs/themeClassNames.native.js +66 -0
  24. package/dist/cjs/themeClassNames.native.js.map +1 -0
  25. package/dist/cjs/toStylePropsObject.cjs +33 -0
  26. package/dist/cjs/toStylePropsObject.native.cjs +72 -0
  27. package/dist/cjs/toStylePropsObject.native.js +74 -0
  28. package/dist/cjs/toStylePropsObject.native.js.map +1 -0
  29. package/dist/cjs/tokenCategories.cjs +47 -0
  30. package/dist/cjs/tokenCategories.native.cjs +51 -0
  31. package/dist/cjs/tokenCategories.native.js +53 -0
  32. package/dist/cjs/tokenCategories.native.js.map +1 -0
  33. package/dist/cjs/types.cjs +18 -20
  34. package/dist/cjs/types.native.cjs +36 -0
  35. package/dist/cjs/types.native.js +18 -19
  36. package/dist/cjs/types.native.js.map +1 -1
  37. package/dist/cjs/validStyleProps.cjs +44 -323
  38. package/dist/cjs/validStyleProps.native.cjs +60 -0
  39. package/dist/cjs/validStyleProps.native.js +45 -316
  40. package/dist/cjs/validStyleProps.native.js.map +1 -1
  41. package/dist/cjs/webOnlyStyleProps.cjs +21 -93
  42. package/dist/cjs/webOnlyStyleProps.native.cjs +35 -0
  43. package/dist/cjs/webOnlyStyleProps.native.js +22 -93
  44. package/dist/cjs/webOnlyStyleProps.native.js.map +1 -1
  45. package/dist/cjs/withStaticProperties.cjs +24 -30
  46. package/dist/cjs/withStaticProperties.native.cjs +37 -0
  47. package/dist/cjs/withStaticProperties.native.js +25 -30
  48. package/dist/cjs/withStaticProperties.native.js.map +1 -1
  49. package/dist/esm/clamp.mjs +2 -1
  50. package/dist/esm/clamp.mjs.map +1 -1
  51. package/dist/esm/clamp.native.js +3 -2
  52. package/dist/esm/clamp.native.js.map +1 -1
  53. package/dist/esm/composeEventHandlers.mjs +12 -14
  54. package/dist/esm/composeEventHandlers.mjs.map +1 -1
  55. package/dist/esm/composeEventHandlers.native.js +12 -19
  56. package/dist/esm/composeEventHandlers.native.js.map +1 -1
  57. package/dist/esm/index.js +21 -9
  58. package/dist/esm/index.mjs +21 -9
  59. package/dist/esm/index.native.js +21 -9
  60. package/dist/esm/reservedThemeProps.mjs +20 -0
  61. package/dist/esm/reservedThemeProps.mjs.map +1 -0
  62. package/dist/esm/reservedThemeProps.native.js +20 -0
  63. package/dist/esm/reservedThemeProps.native.js.map +1 -0
  64. package/dist/esm/shouldRenderNativePlatform.mjs +25 -19
  65. package/dist/esm/shouldRenderNativePlatform.mjs.map +1 -1
  66. package/dist/esm/shouldRenderNativePlatform.native.js +42 -42
  67. package/dist/esm/shouldRenderNativePlatform.native.js.map +1 -1
  68. package/dist/esm/themeClassNames.mjs +21 -0
  69. package/dist/esm/themeClassNames.mjs.map +1 -0
  70. package/dist/esm/themeClassNames.native.js +39 -0
  71. package/dist/esm/themeClassNames.native.js.map +1 -0
  72. package/dist/esm/toStylePropsObject.mjs +13 -0
  73. package/dist/esm/toStylePropsObject.mjs.map +1 -0
  74. package/dist/esm/toStylePropsObject.native.js +50 -0
  75. package/dist/esm/toStylePropsObject.native.js.map +1 -0
  76. package/dist/esm/tokenCategories.mjs +28 -0
  77. package/dist/esm/tokenCategories.mjs.map +1 -0
  78. package/dist/esm/tokenCategories.native.js +30 -0
  79. package/dist/esm/tokenCategories.native.js.map +1 -0
  80. package/dist/esm/types.mjs +1 -0
  81. package/dist/esm/types.mjs.map +1 -1
  82. package/dist/esm/types.native.js +1 -0
  83. package/dist/esm/types.native.js.map +1 -1
  84. package/dist/esm/validStyleProps.mjs +21 -297
  85. package/dist/esm/validStyleProps.mjs.map +1 -1
  86. package/dist/esm/validStyleProps.native.js +22 -291
  87. package/dist/esm/validStyleProps.native.js.map +1 -1
  88. package/dist/esm/webOnlyStyleProps.mjs +7 -75
  89. package/dist/esm/webOnlyStyleProps.mjs.map +1 -1
  90. package/dist/esm/webOnlyStyleProps.native.js +7 -75
  91. package/dist/esm/webOnlyStyleProps.native.js.map +1 -1
  92. package/dist/esm/withStaticProperties.mjs +11 -12
  93. package/dist/esm/withStaticProperties.mjs.map +1 -1
  94. package/dist/esm/withStaticProperties.native.js +12 -13
  95. package/dist/esm/withStaticProperties.native.js.map +1 -1
  96. package/package.json +16 -5
  97. package/src/composeEventHandlers.ts +6 -10
  98. package/src/index.ts +3 -0
  99. package/src/reservedThemeProps.ts +26 -0
  100. package/src/themeClassNames.ts +26 -0
  101. package/src/toStylePropsObject.ts +29 -0
  102. package/src/tokenCategories.ts +29 -0
  103. package/src/validStyleProps.ts +89 -349
  104. package/src/webOnlyStyleProps.ts +16 -80
  105. package/types/composeEventHandlers.d.ts.map +1 -1
  106. package/types/index.d.ts +3 -0
  107. package/types/index.d.ts.map +1 -1
  108. package/types/reservedThemeProps.d.ts +11 -0
  109. package/types/reservedThemeProps.d.ts.map +1 -0
  110. package/types/themeClassNames.d.ts +3 -0
  111. package/types/themeClassNames.d.ts.map +1 -0
  112. package/types/toStylePropsObject.d.ts +6 -0
  113. package/types/toStylePropsObject.d.ts.map +1 -0
  114. package/types/tokenCategories.d.ts +4 -0
  115. package/types/tokenCategories.d.ts.map +1 -0
  116. package/types/validStyleProps.d.ts +1533 -1242
  117. package/types/validStyleProps.d.ts.map +1 -1
  118. package/types/webOnlyStyleProps.d.ts +106 -99
  119. package/types/webOnlyStyleProps.d.ts.map +1 -1
  120. package/types/withStaticProperties.d.ts.map +1 -1
  121. package/dist/esm/index.js.map +0 -1
  122. package/dist/esm/index.mjs.map +0 -1
  123. package/dist/esm/index.native.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["Decorated","Symbol","withStaticProperties","component","staticProps","out","Object","assign","bind"],"sources":["../../src/withStaticProperties.tsx"],"sourcesContent":[null],"mappings":"AAAA,IAAAA,SAAM,kBAAYC,MAAA;AAIX,IAAAC,oBAAM,YAAAA,CACXC,SACA,EAAAC,WACmB;EACnB,IAAAC,GAAM,eAAa;IACjB,IAAKF,SAAA,CAAkBH,SAAS,GAAG;MAMjC,OAAO,OAAOG,SAAA,KAAc,aACxBG,MAAA,CAAOC,MAAA,CAAOJ,SAAA,CAAUK,IAAA,CAAK,IAAI,GAAGL,SAAS,IAC7C;QACN,GAAAA;MACA;IACF;IAEA,OAAOA,SAAO;EACd,GAAI;EAEJG,MAAA,CAAOC,MAAA,CAAAF,GAAA,EAAAD,WAAA;EACTC,GAAA,CAAAL,SAAA","ignoreList":[]}
1
+ {"version":3,"file":"withStaticProperties.native.js","names":[],"sources":["esm/withStaticProperties.native.js"],"sourcesContent":["var Decorated = /* @__PURE__ */ Symbol();\nvar withStaticProperties = function(component, staticProps) {\n var out = (function() {\n if (component[Decorated]) {\n return typeof component === \"function\" ? Object.assign(component.bind(null), component) : {\n ...component\n };\n }\n return component;\n })();\n Object.assign(out, staticProps);\n out[Decorated] = true;\n return out;\n};\nexport {\n withStaticProperties\n};\n//# sourceMappingURL=withStaticProperties.js.map\n"],"mappings":";AAAA,IAAI,YAA4B,uBAAO;AACvC,IAAI,uBAAuB,SAAS,WAAW,aAAa;CAC1D,IAAI,OAAO,WAAW;EACpB,IAAI,UAAU,YAAY;GACxB,OAAO,OAAO,cAAc,aAAa,OAAO,OAAO,UAAU,KAAK,IAAI,GAAG,SAAS,IAAI,EACxF,GAAG,UACL;EACF;EACA,OAAO;CACT,EAAC,CAAE;CACH,OAAO,OAAO,KAAK,WAAW;CAC9B,IAAI,aAAa;CACjB,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@tamagui/helpers",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.1097.1",
4
+ "license": "MIT",
4
5
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
6
  "source": "src/index.ts",
6
7
  "files": [
@@ -15,6 +16,15 @@
15
16
  "types": "./types/index.d.ts",
16
17
  "exports": {
17
18
  "./package.json": "./package.json",
19
+ "./tokenCategories": {
20
+ "types": "./types/tokenCategories.d.ts",
21
+ "react-native": "./dist/esm/tokenCategories.mjs",
22
+ "browser": "./dist/esm/tokenCategories.mjs",
23
+ "module": "./dist/esm/tokenCategories.mjs",
24
+ "import": "./dist/esm/tokenCategories.mjs",
25
+ "require": "./dist/cjs/tokenCategories.cjs",
26
+ "default": "./dist/esm/tokenCategories.mjs"
27
+ },
18
28
  ".": {
19
29
  "types": "./types/index.d.ts",
20
30
  "react-native": "./dist/esm/index.native.js",
@@ -35,12 +45,13 @@
35
45
  "clean:build": "tamagui-build clean:build"
36
46
  },
37
47
  "dependencies": {
38
- "@tamagui/constants": "2.7.7",
39
- "@tamagui/simple-hash": "2.7.7"
48
+ "@tamagui/constants": "3.0.0-beta.1097.1",
49
+ "@tamagui/simple-hash": "3.0.0-beta.1097.1",
50
+ "@tamagui/style-grammar": "3.0.0-beta.1097.1"
40
51
  },
41
52
  "devDependencies": {
42
- "@tamagui/build": "2.7.7",
43
- "react": ">=19"
53
+ "@tamagui/build": "3.0.0-beta.1097.1",
54
+ "react": "19.2.3"
44
55
  },
45
56
  "peerDependencies": {
46
57
  "react": ">=19"
@@ -12,16 +12,12 @@ export function composeEventHandlers<E extends Events>(
12
12
  }
13
13
  return (event: E) => {
14
14
  og?.(event)
15
- if (
16
- !event ||
17
- !(
18
- checkDefaultPrevented &&
19
- typeof event === 'object' &&
20
- 'defaultPrevented' in event
21
- ) ||
22
- // @ts-ignore
23
- ('defaultPrevented' in event && !event.defaultPrevented)
24
- ) {
15
+ const isPrevented =
16
+ !!event &&
17
+ typeof event === 'object' &&
18
+ (('defaultPrevented' in event && Boolean(event.defaultPrevented)) ||
19
+ ('isCanceled' in event && Boolean(event.isCanceled)))
20
+ if (!event || !checkDefaultPrevented || !isPrevented) {
25
21
  return next?.(event)
26
22
  }
27
23
  }
package/src/index.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  export * from '@tamagui/simple-hash'
2
2
  export * from './clamp'
3
+ export * from './reservedThemeProps'
4
+ export * from './themeClassNames'
3
5
  export * from './composeEventHandlers'
4
6
  export * from './types'
5
7
  export * from './shouldRenderNativePlatform'
8
+ export * from './tokenCategories'
6
9
  export * from './validStyleProps'
7
10
  export * from './withStaticProperties'
8
11
  export * from './webOnlyStyleProps'
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The props `<Theme>` owns. Inline theme values live on `<ThemeUpdate>`, so an
3
+ * unknown `<Theme>` prop is always invalid.
4
+ *
5
+ * It lives here, in a side-effect-free package, because the compiler classifies
6
+ * static `<Theme>` props with the same table the runtime uses. One table, so a
7
+ * new reserved prop can never mean one thing at build time and another at
8
+ * runtime.
9
+ */
10
+ export const reservedThemeProps: Record<string, true> = {
11
+ _isRoot: true,
12
+ children: true,
13
+ className: true,
14
+ contain: true,
15
+ debug: true,
16
+ deopt: true,
17
+ disable: true,
18
+ 'disable-child-theme': true,
19
+ forceClassName: true,
20
+ _themeUpdate: true,
21
+ name: true,
22
+ nativeUpdate: true,
23
+ needsUpdate: true,
24
+ passThrough: true,
25
+ shallow: true,
26
+ }
@@ -0,0 +1,26 @@
1
+ // read a complete scheme segment so names such as "lightsaber" stay distinct.
2
+ const schemePrefix = /^(light|dark)(?=_|$)/
3
+ export function getThemeScheme(name: string): 'light' | 'dark' | undefined {
4
+ return schemePrefix.exec(name)?.[0] as 'light' | 'dark' | undefined
5
+ }
6
+
7
+ // runtime and zero output share this hierarchy. inherited schemes follow the
8
+ // document class; only authored schemes emit the more specific full-name class.
9
+ export function getThemeClassNames(
10
+ name: string,
11
+ isRoot?: boolean,
12
+ schemeAuthored?: boolean
13
+ ): string {
14
+ const scheme = getThemeScheme(name)
15
+ const relativeName = scheme ? name.slice(scheme.length + 1) : name
16
+ let classes = isRoot ? '' : 't_sub_theme'
17
+ if (relativeName) {
18
+ let prefix = 't'
19
+ for (const part of relativeName.split('_')) {
20
+ prefix += `_${part}`
21
+ classes += ` ${prefix}`
22
+ }
23
+ }
24
+ if (schemeAuthored && scheme) classes += ` t_${name}`
25
+ return classes
26
+ }
@@ -0,0 +1,29 @@
1
+ type StylePropSource = string | Readonly<Record<string, boolean>> | undefined
2
+ type StylePropWords<Value extends string> =
3
+ Value extends `${infer A} ${infer B} ${infer C} ${infer D} ${infer E} ${infer F} ${infer G} ${infer H} ${infer Tail}`
4
+ ? A | B | C | D | E | F | G | H | StylePropWords<Tail>
5
+ : Value extends `${infer Head} ${infer Tail}`
6
+ ? Head | StylePropWords<Tail>
7
+ : Value
8
+ type StylePropKeys<Source> = Source extends string
9
+ ? StylePropWords<Source>
10
+ : Source extends Readonly<Record<string, boolean>>
11
+ ? keyof Source
12
+ : never
13
+
14
+ export const toStylePropsObject = <const Sources extends readonly StylePropSource[]>(
15
+ ...sources: Sources
16
+ ): { [Key in Exclude<Extract<StylePropKeys<Sources[number]>, string>, ''>]: true } => {
17
+ const out: Record<string, boolean> = {}
18
+ for (const source of sources) {
19
+ if (!source) continue
20
+ for (const key of typeof source === 'string'
21
+ ? source.split(' ')
22
+ : Object.keys(source)) {
23
+ if (key) out[key] = true
24
+ }
25
+ }
26
+ return out as {
27
+ [Key in Exclude<Extract<StylePropKeys<Sources[number]>, string>, ''>]: true
28
+ }
29
+ }
@@ -0,0 +1,29 @@
1
+ export * from '@tamagui/style-grammar/token-categories'
2
+
3
+ import {
4
+ propToTokenCategoryCode,
5
+ tokenCategoryNames,
6
+ } from '@tamagui/style-grammar/token-categories'
7
+
8
+ type TokenCategories = Record<
9
+ 'radius' | 'size' | 'zIndex' | 'color',
10
+ Record<string, true>
11
+ >
12
+
13
+ // public compatibility view. each category materializes only when a caller reads it
14
+ export const tokenCategories = {} as TokenCategories
15
+ for (const category of ['radius', 'size', 'zIndex', 'color'] as const) {
16
+ let view: Record<string, true> | undefined
17
+ Object.defineProperty(tokenCategories, category, {
18
+ enumerable: true,
19
+ get() {
20
+ if (view) return view
21
+ view = {}
22
+ const code = tokenCategoryNames.indexOf(category)
23
+ for (const property in propToTokenCategoryCode) {
24
+ if (propToTokenCategoryCode[property] === code) view[property] = true
25
+ }
26
+ return view
27
+ },
28
+ })
29
+ }
@@ -5,354 +5,94 @@ import {
5
5
  webOnlyStylePropsText,
6
6
  webOnlyStylePropsView,
7
7
  } from './webOnlyStyleProps'
8
-
9
- // generally organizing this so we don't duplicate things so its a bit weird
10
-
11
- // longhands of CSS shorthands - used for specificity boosting on web
12
- // so that e.g. borderWidth always beats border in the cascade
13
- export const cssShorthandLonghands = {
14
- // border longhands
15
- borderWidth: true,
16
- borderStyle: true,
17
- borderColor: true,
18
- borderTopWidth: true,
19
- borderTopStyle: true,
20
- borderTopColor: true,
21
- borderRightWidth: true,
22
- borderRightStyle: true,
23
- borderRightColor: true,
24
- borderBottomWidth: true,
25
- borderBottomStyle: true,
26
- borderBottomColor: true,
27
- borderLeftWidth: true,
28
- borderLeftStyle: true,
29
- borderLeftColor: true,
30
- // outline longhands
31
- outlineWidth: true,
32
- outlineStyle: true,
33
- outlineColor: true,
34
- outlineOffset: true,
35
- }
36
-
37
- const textColors = {
38
- color: true,
39
- textDecorationColor: true,
40
- textShadowColor: true,
41
- }
42
-
43
- // used for propMapping to find the right token category
44
- // just specificy the least costly, all else go to `space` (most keys - we can exclude)
45
- export const tokenCategories = {
46
- radius: {
47
- borderRadius: true,
48
- borderTopLeftRadius: true,
49
- borderTopRightRadius: true,
50
- borderBottomLeftRadius: true,
51
- borderBottomRightRadius: true,
52
-
53
- // logical
54
- borderStartStartRadius: true,
55
- borderStartEndRadius: true,
56
- borderEndStartRadius: true,
57
- borderEndEndRadius: true,
58
- },
59
- size: {
60
- width: true,
61
- height: true,
62
- minWidth: true,
63
- minHeight: true,
64
- maxWidth: true,
65
- maxHeight: true,
66
- blockSize: true,
67
- minBlockSize: true,
68
- maxBlockSize: true,
69
- inlineSize: true,
70
- minInlineSize: true,
71
- maxInlineSize: true,
72
- },
73
- zIndex: {
74
- zIndex: true,
75
- },
76
- color: {
77
- backgroundColor: true,
78
- borderColor: true,
79
- borderBlockStartColor: true,
80
- borderBlockEndColor: true,
81
- borderBlockColor: true,
82
- borderBottomColor: true,
83
- borderInlineColor: true,
84
- borderInlineStartColor: true,
85
- borderInlineEndColor: true,
86
- borderTopColor: true,
87
- borderLeftColor: true,
88
- borderRightColor: true,
89
- borderEndColor: true,
90
- borderStartColor: true,
91
- shadowColor: true,
92
- ...textColors,
93
- // outlineColor is supported on RN 0.77+ (New Architecture)
94
- outlineColor: true,
95
- // caretColor is web-only
96
- ...(process.env.TAMAGUI_TARGET === 'web' && {
97
- caretColor: true,
98
- }),
99
- },
100
- }
101
-
102
- // discrete (non-animatable) view style properties - keyword-based, no interpolation
103
- // defined above stylePropsView so it can be spread in without duplication
104
- const nonAnimatableViewProps = {
105
- alignContent: true,
106
- alignItems: true,
107
- alignSelf: true,
108
- backfaceVisibility: true,
109
- borderCurve: true,
110
- borderStyle: true,
111
- borderBlockStyle: true,
112
- borderBlockEndStyle: true,
113
- borderBlockStartStyle: true,
114
- borderInlineStyle: true,
115
- borderInlineEndStyle: true,
116
- borderInlineStartStyle: true,
117
- boxSizing: true,
118
- cursor: true,
119
- direction: true,
120
- display: true,
121
- flexDirection: true,
122
- flexWrap: true,
123
- isolation: true,
124
- justifyContent: true,
125
- mixBlendMode: true,
126
- outlineStyle: true,
127
- overflow: true,
128
- position: true,
129
- }
130
-
131
- // discrete (non-animatable) font properties
132
- const nonAnimatableFontProps = {
133
- fontFamily: true,
134
- fontStyle: true,
135
- fontVariant: true,
136
- textTransform: true,
137
- }
138
-
139
- // discrete (non-animatable) text-only properties
140
- const nonAnimatableTextOnlyProps = {
141
- textAlign: true,
142
- textDecorationLine: true,
143
- textDecorationStyle: true,
144
- userSelect: true,
145
- }
146
-
147
- // discrete (non-animatable) unitless properties
148
- const nonAnimatableUnitlessProps = {
149
- WebkitLineClamp: true,
150
- lineClamp: true,
151
- gridTemplateColumns: true,
152
- gridTemplateAreas: true,
153
- }
154
-
155
- // all non-animatable style props combined, used by getSplitStyles to keep
156
- // these as atomic CSS classNames even for components with animation drivers
157
- export const nonAnimatableStyleProps = {
158
- ...nonAnimatableViewProps,
159
- ...nonAnimatableFontProps,
160
- ...nonAnimatableTextOnlyProps,
161
- ...nonAnimatableUnitlessProps,
162
- // web-only discrete properties (defined in webOnlyStyleProps.ts)
163
- ...(process.env.TAMAGUI_TARGET === 'web' && {
164
- ...nonAnimatableWebViewProps,
165
- ...nonAnimatableWebTextProps,
166
- }),
167
- }
168
-
169
- export const stylePropsUnitless = {
170
- ...nonAnimatableUnitlessProps,
171
- animationIterationCount: true,
172
- aspectRatio: true,
173
- borderImageOutset: true,
174
- borderImageSlice: true,
175
- borderImageWidth: true,
176
- columnCount: true,
177
- flex: true,
178
- flexGrow: true,
179
- flexOrder: true,
180
- flexPositive: true,
181
- flexShrink: true,
182
- flexNegative: true,
183
- fontWeight: true,
184
- gridRow: true,
185
- gridRowEnd: true,
186
- gridRowGap: true,
187
- gridRowStart: true,
188
- gridColumn: true,
189
- gridColumnEnd: true,
190
- gridColumnGap: true,
191
- gridColumnStart: true,
192
- opacity: true,
193
- order: true,
194
- orphans: true,
195
- tabSize: true,
196
- widows: true,
197
- zIndex: true,
198
- zoom: true,
199
- scale: true,
200
- scaleX: true,
201
- scaleY: true,
202
- scaleZ: true,
203
- shadowOpacity: true,
204
- }
205
-
206
- export const stylePropsTransform = {
207
- x: true,
208
- y: true,
209
- scale: true,
210
- perspective: true,
211
- scaleX: true,
212
- scaleY: true,
213
- skewX: true,
214
- skewY: true,
215
- matrix: true,
216
- rotate: true,
217
- rotateY: true,
218
- rotateX: true,
219
- rotateZ: true,
220
- }
221
-
222
- export const stylePropsView = {
223
- ...nonAnimatableViewProps,
224
- borderBottomEndRadius: true,
225
- borderBottomStartRadius: true,
226
- borderBottomWidth: true,
227
- borderLeftWidth: true,
228
- borderRightWidth: true,
229
- borderBlockWidth: true,
230
- borderBlockEndWidth: true,
231
- borderBlockStartWidth: true,
232
- borderInlineWidth: true,
233
- borderInlineEndWidth: true,
234
- borderInlineStartWidth: true,
235
- borderTopEndRadius: true,
236
- borderTopStartRadius: true,
237
- borderTopWidth: true,
238
- borderWidth: true,
239
- transform: true,
240
- transformOrigin: true,
241
- borderEndWidth: true,
242
- borderStartWidth: true,
243
- bottom: true,
244
- end: true,
245
- flexBasis: true,
246
- gap: true,
247
- columnGap: true,
248
- rowGap: true,
249
- left: true,
250
- margin: true,
251
- marginBlock: true,
252
- marginBlockEnd: true,
253
- marginBlockStart: true,
254
- marginInline: true,
255
- marginInlineStart: true,
256
- marginInlineEnd: true,
257
- marginBottom: true,
258
- marginEnd: true,
259
- marginHorizontal: true,
260
- marginLeft: true,
261
- marginRight: true,
262
- marginStart: true,
263
- marginTop: true,
264
- marginVertical: true,
265
- padding: true,
266
- paddingBottom: true,
267
- paddingInline: true,
268
- paddingBlock: true,
269
- paddingBlockStart: true,
270
- paddingInlineEnd: true,
271
- paddingInlineStart: true,
272
- paddingEnd: true,
273
- paddingHorizontal: true,
274
- paddingLeft: true,
275
- paddingRight: true,
276
- paddingStart: true,
277
- paddingTop: true,
278
- paddingVertical: true,
279
- right: true,
280
- start: true,
281
- top: true,
282
- inset: true,
283
- insetBlock: true,
284
- insetBlockEnd: true,
285
- insetBlockStart: true,
286
- insetInline: true,
287
- insetInlineEnd: true,
288
- insetInlineStart: true,
289
- shadowOffset: true,
290
- shadowRadius: true,
291
- ...tokenCategories.color,
292
- ...tokenCategories.radius,
293
- ...tokenCategories.size,
294
- ...stylePropsTransform,
295
- ...stylePropsUnitless,
296
- ...(isAndroid ? { elevationAndroid: true } : {}),
297
-
298
- boxShadow: true,
299
- border: true,
300
- filter: true,
301
- // RN 0.76+ supports linear-gradient via backgroundImage
302
- backgroundImage: true,
303
- // the actual RN 0.76+ prop name (backgroundImage expands to this on native)
304
- experimental_backgroundImage: true,
305
- // RN 0.76/0.77+ style props (New Architecture)
306
- outline: true,
307
- outlineColor: true,
308
- outlineOffset: true,
309
- outlineWidth: true,
310
-
311
- // web-only for convenience - tree-shaken on native
312
- ...(process.env.TAMAGUI_TARGET === 'web' ? webOnlyStylePropsView : {}),
313
- }
314
-
315
- const stylePropsFont = {
316
- ...nonAnimatableFontProps,
317
- fontSize: true,
318
- fontWeight: true,
319
- letterSpacing: true,
320
- lineHeight: true,
321
- }
322
-
323
- export const stylePropsTextOnly = {
324
- ...stylePropsFont,
325
- ...nonAnimatableTextOnlyProps,
326
- ...textColors,
327
- textShadow: true,
328
- textShadowOffset: true,
329
- textShadowRadius: true,
330
- verticalAlign: true,
331
-
332
- // web-only text props - tree-shaken on native
333
- ...(process.env.TAMAGUI_TARGET === 'web' ? webOnlyStylePropsText : {}),
334
- }
335
-
336
- export const stylePropsText = {
337
- ...stylePropsView,
338
- ...stylePropsTextOnly,
339
- }
340
-
341
- export const stylePropsAll = stylePropsText
342
-
343
- export const validPseudoKeys = {
344
- enterStyle: true,
345
- exitStyle: true,
346
- hoverStyle: true,
347
- pressStyle: true,
348
- focusStyle: true,
349
- disabledStyle: true,
350
- focusWithinStyle: true,
351
-
352
- // allow some web only ones
353
- ...(process.env.TAMAGUI_TARGET === 'web' && {
354
- focusVisibleStyle: true,
355
- }),
356
- }
8
+ import { toStylePropsObject as toObj } from './toStylePropsObject'
9
+ export { tokenCategories } from './tokenCategories'
10
+
11
+ export const cssShorthandLonghands = toObj(
12
+ 'borderWidth borderStyle borderColor borderTopWidth borderTopStyle borderTopColor borderRightWidth borderRightStyle borderRightColor borderBottomWidth borderBottomStyle borderBottomColor borderLeftWidth borderLeftStyle borderLeftColor outlineWidth outlineStyle outlineColor outlineOffset'
13
+ )
14
+
15
+ const textColors = toObj('color textDecorationColor textShadowColor')
16
+
17
+ const inputColors = toObj(
18
+ 'placeholderTextColor selectionColor cursorColor selectionHandleColor'
19
+ )
20
+
21
+ const nonAnimatableViewProps = toObj(
22
+ 'alignContent alignItems alignSelf backfaceVisibility borderCurve borderStyle borderBlockStyle borderBlockEndStyle borderBlockStartStyle borderInlineStyle borderInlineEndStyle borderInlineStartStyle boxSizing cursor direction display flexDirection flexWrap isolation justifyContent mixBlendMode outlineStyle overflow pointerEvents position visibility'
23
+ )
24
+
25
+ const nonAnimatableFontProps = toObj('fontFamily fontStyle fontVariant textTransform')
26
+
27
+ const nonAnimatableTextOnlyProps = toObj(
28
+ 'textAlign textDecorationLine textDecorationStyle userSelect writingDirection'
29
+ )
30
+
31
+ const nonAnimatableUnitlessProps = toObj('WebkitLineClamp lineClamp')
32
+
33
+ /**
34
+ * CSS Grid layout props. Web-only by default — Yoga (React Native's layout
35
+ * engine) has no stable CSS Grid support (see facebook/yoga#1865).
36
+ *
37
+ * To enable on native with an experimental Yoga build, set the
38
+ * `TAMAGUI_CSS_GRID` environment variable to `"1"`.
39
+ */
40
+ const cssGridProps = toObj(
41
+ 'gridTemplateColumns gridTemplateAreas gridRow gridRowEnd gridRowGap gridRowStart gridColumn gridColumnEnd gridColumnGap gridColumnStart'
42
+ )
43
+
44
+ const enableCSSGrid =
45
+ process.env.TAMAGUI_TARGET === 'web' || process.env.TAMAGUI_CSS_GRID === '1'
46
+
47
+ export const nonAnimatableStyleProps = toObj(
48
+ nonAnimatableViewProps,
49
+ nonAnimatableFontProps,
50
+ nonAnimatableTextOnlyProps,
51
+ nonAnimatableUnitlessProps,
52
+ enableCSSGrid ? cssGridProps : undefined,
53
+ process.env.TAMAGUI_TARGET === 'web' ? nonAnimatableWebViewProps : undefined,
54
+ process.env.TAMAGUI_TARGET === 'web' ? nonAnimatableWebTextProps : undefined
55
+ )
56
+
57
+ export const stylePropsUnitless = toObj(
58
+ nonAnimatableUnitlessProps,
59
+ enableCSSGrid ? cssGridProps : undefined,
60
+ 'animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth columnCount flex flexGrow flexOrder flexPositive flexShrink flexNegative fontWeight opacity order orphans tabSize widows zIndex zoom scale scaleX scaleY scaleZ shadowOpacity'
61
+ )
62
+
63
+ export const stylePropsTransform = toObj(
64
+ 'x y scale perspective scaleX scaleY skewX skewY matrix rotate rotateY rotateX rotateZ'
65
+ )
66
+
67
+ export const stylePropsView = toObj(
68
+ nonAnimatableViewProps,
69
+ 'borderBottomWidth borderLeftWidth borderRightWidth borderBlockWidth borderBlockEndWidth borderBlockStartWidth borderInlineWidth borderInlineEndWidth borderInlineStartWidth borderTopWidth borderWidth transform transformOrigin borderEndWidth borderStartWidth bottom end flexBasis gap columnGap rowGap left margin marginBlock marginBlockEnd marginBlockStart marginInline marginInlineStart marginInlineEnd marginBottom marginEnd marginHorizontal marginLeft marginRight marginStart marginTop marginVertical padding paddingBottom paddingInline paddingBlock paddingBlockEnd paddingBlockStart paddingInlineEnd paddingInlineStart paddingEnd paddingHorizontal paddingLeft paddingRight paddingStart paddingTop paddingVertical right start top inset insetBlock insetBlockEnd insetBlockStart insetInline insetInlineEnd insetInlineStart shadowOffset backgroundColor borderColor borderBlockStartColor borderBlockEndColor borderBlockColor borderBottomColor borderInlineColor borderInlineStartColor borderInlineEndColor borderTopColor borderLeftColor borderRightColor borderEndColor borderStartColor shadowColor outlineColor',
70
+ process.env.TAMAGUI_TARGET === 'web' ? 'caretColor' : undefined,
71
+ 'borderRadius borderTopLeftRadius borderTopRightRadius borderBottomLeftRadius borderBottomRightRadius borderTopStartRadius borderTopEndRadius borderBottomStartRadius borderBottomEndRadius borderStartStartRadius borderStartEndRadius borderEndStartRadius borderEndEndRadius width height minWidth minHeight maxWidth maxHeight blockSize minBlockSize maxBlockSize inlineSize minInlineSize maxInlineSize shadowRadius',
72
+ stylePropsTransform,
73
+ stylePropsUnitless,
74
+ isAndroid ? { elevationAndroid: true } : undefined,
75
+ 'boxShadow border borderBlock borderInline filter background backgroundImage experimental_backgroundImage outline outlineOffset outlineWidth',
76
+ process.env.TAMAGUI_TARGET === 'web' ? webOnlyStylePropsView : undefined
77
+ )
78
+
79
+ const stylePropsFont = toObj(
80
+ nonAnimatableFontProps,
81
+ 'fontSize fontWeight letterSpacing lineHeight'
82
+ )
83
+
84
+ export const stylePropsTextOnly = toObj(
85
+ stylePropsFont,
86
+ nonAnimatableTextOnlyProps,
87
+ textColors,
88
+ 'textShadow textShadowOffset textShadowRadius textDecoration font verticalAlign',
89
+ process.env.TAMAGUI_TARGET === 'web' ? webOnlyStylePropsText : undefined
90
+ )
91
+
92
+ export const stylePropsText = toObj(stylePropsView, stylePropsTextOnly)
93
+
94
+ export const stylePropsInput = toObj(stylePropsText, inputColors)
95
+
96
+ export const stylePropsAll = stylePropsInput
357
97
 
358
98
  export const validStyles = stylePropsView