@tamagui/web 3.0.0-beta.807.1 → 3.0.0-beta.831.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.
- package/dist/cjs/config.cjs +1 -1
- package/dist/cjs/config.native.cjs +1 -1
- package/dist/cjs/config.native.js +1 -1
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/createComponent.cjs +28 -18
- package/dist/cjs/createComponent.native.cjs +30 -20
- package/dist/cjs/createComponent.native.js +30 -20
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createStyledHOC.cjs +54 -4
- package/dist/cjs/createStyledHOC.native.cjs +55 -4
- package/dist/cjs/createStyledHOC.native.js +55 -4
- package/dist/cjs/createStyledHOC.native.js.map +1 -1
- package/dist/cjs/createTokens.cjs +1 -1
- package/dist/cjs/createTokens.native.cjs +1 -1
- package/dist/cjs/createTokens.native.js +1 -1
- package/dist/cjs/createTokens.native.js.map +1 -1
- package/dist/cjs/dom/html.cjs +147 -99
- package/dist/cjs/dom/htmlRuntime.native.cjs +6 -2
- package/dist/cjs/dom/htmlRuntime.native.js +6 -2
- package/dist/cjs/dom/htmlRuntime.native.js.map +1 -1
- package/dist/cjs/dom/primitives.native.cjs +16 -13
- package/dist/cjs/dom/primitives.native.js +16 -13
- package/dist/cjs/dom/primitives.native.js.map +1 -1
- package/dist/cjs/helpers/componentDisplayName.cjs +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.cjs +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.js +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.js.map +1 -1
- package/dist/cjs/helpers/directStyleCSS.cjs +101 -104
- package/dist/cjs/helpers/formatDiagnostic.cjs +2 -4
- package/dist/cjs/helpers/formatDiagnostic.native.cjs +2 -4
- package/dist/cjs/helpers/formatDiagnostic.native.js +2 -4
- package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +10 -10
- package/dist/cjs/helpers/getSplitStyles.cjs +168 -600
- package/dist/cjs/helpers/getSplitStyles.native.cjs +168 -762
- package/dist/cjs/helpers/getSplitStyles.native.js +168 -762
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/splitStyleProps.cjs +46 -0
- package/dist/cjs/helpers/splitStyleProps.native.cjs +49 -0
- package/dist/cjs/helpers/splitStyleProps.native.js +51 -0
- package/dist/cjs/helpers/splitStyleProps.native.js.map +1 -0
- package/dist/cjs/helpers/styleStaticConfig.cjs +76 -0
- package/dist/cjs/helpers/styleStaticConfig.native.cjs +79 -0
- package/dist/cjs/helpers/styleStaticConfig.native.js +81 -0
- package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -0
- package/dist/cjs/helpers/tokenCategories.cjs +32 -71
- package/dist/cjs/helpers/tokenCategories.native.cjs +34 -73
- package/dist/cjs/helpers/tokenCategories.native.js +34 -73
- package/dist/cjs/helpers/tokenCategories.native.js.map +1 -1
- package/dist/cjs/helpers/variantResolvers.cjs +87 -0
- package/dist/cjs/helpers/variantResolvers.native.cjs +140 -0
- package/dist/cjs/helpers/variantResolvers.native.js +142 -0
- package/dist/cjs/helpers/variantResolvers.native.js.map +1 -0
- package/dist/cjs/hooks/useSplitStyles.cjs +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.cjs +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.js +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.js.map +1 -1
- package/dist/cjs/index.cjs +3 -9
- package/dist/cjs/index.native.cjs +3 -9
- package/dist/cjs/index.native.js +3 -9
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/internal-runtime.cjs +8 -7
- package/dist/cjs/internal-runtime.native.cjs +8 -7
- package/dist/cjs/internal-runtime.native.js +8 -7
- package/dist/cjs/internal-runtime.native.js.map +1 -1
- package/dist/cjs/static-resolve.cjs +6 -5
- package/dist/cjs/static-resolve.native.cjs +6 -5
- package/dist/cjs/static-resolve.native.js +6 -5
- package/dist/cjs/static-resolve.native.js.map +1 -1
- package/dist/cjs/styled.cjs +4 -56
- package/dist/cjs/styled.native.cjs +4 -58
- package/dist/cjs/styled.native.js +4 -58
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/types.cjs +1 -21
- package/dist/cjs/types.native.cjs +1 -21
- package/dist/cjs/types.native.js +1 -21
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/views/Text.cjs +4 -2
- package/dist/cjs/views/Text.native.cjs +4 -2
- package/dist/cjs/views/Text.native.js +4 -2
- package/dist/cjs/views/Text.native.js.map +1 -1
- package/dist/cjs/views/View.cjs +4 -2
- package/dist/cjs/views/View.native.cjs +4 -2
- package/dist/cjs/views/View.native.js +4 -2
- package/dist/cjs/views/View.native.js.map +1 -1
- package/dist/esm/config.mjs +1 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +1 -1
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/createComponent.mjs +29 -19
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +31 -21
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createStyledHOC.mjs +55 -5
- package/dist/esm/createStyledHOC.mjs.map +1 -1
- package/dist/esm/createStyledHOC.native.js +56 -5
- package/dist/esm/createStyledHOC.native.js.map +1 -1
- package/dist/esm/createTokens.mjs +1 -1
- package/dist/esm/createTokens.mjs.map +1 -1
- package/dist/esm/createTokens.native.js +1 -1
- package/dist/esm/createTokens.native.js.map +1 -1
- package/dist/esm/dom/html.mjs +147 -99
- package/dist/esm/dom/html.mjs.map +1 -1
- package/dist/esm/dom/htmlRuntime.native.js +7 -3
- package/dist/esm/dom/htmlRuntime.native.js.map +1 -1
- package/dist/esm/dom/primitives.native.js +16 -13
- package/dist/esm/dom/primitives.native.js.map +1 -1
- package/dist/esm/helpers/componentDisplayName.mjs +1 -8
- package/dist/esm/helpers/componentDisplayName.mjs.map +1 -1
- package/dist/esm/helpers/componentDisplayName.native.js +1 -8
- package/dist/esm/helpers/componentDisplayName.native.js.map +1 -1
- package/dist/esm/helpers/directStyleCSS.mjs +101 -104
- package/dist/esm/helpers/directStyleCSS.mjs.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.mjs +2 -4
- package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.native.js +2 -4
- package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +10 -10
- package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +166 -594
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +166 -757
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/splitStyleProps.mjs +27 -0
- package/dist/esm/helpers/splitStyleProps.mjs.map +1 -0
- package/dist/esm/helpers/splitStyleProps.native.js +28 -0
- package/dist/esm/helpers/splitStyleProps.native.js.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.mjs +57 -0
- package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.native.js +58 -0
- package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -0
- package/dist/esm/helpers/tokenCategories.mjs +33 -72
- package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
- package/dist/esm/helpers/tokenCategories.native.js +35 -74
- package/dist/esm/helpers/tokenCategories.native.js.map +1 -1
- package/dist/esm/helpers/variantResolvers.mjs +65 -0
- package/dist/esm/helpers/variantResolvers.mjs.map +1 -0
- package/dist/esm/helpers/variantResolvers.native.js +116 -0
- package/dist/esm/helpers/variantResolvers.native.js.map +1 -0
- package/dist/esm/hooks/useSplitStyles.mjs +2 -2
- package/dist/esm/hooks/useSplitStyles.mjs.map +1 -1
- package/dist/esm/hooks/useSplitStyles.native.js +2 -2
- package/dist/esm/hooks/useSplitStyles.native.js.map +1 -1
- package/dist/esm/index.js +3 -5
- package/dist/esm/index.mjs +3 -5
- package/dist/esm/index.native.js +3 -5
- package/dist/esm/internal-runtime.mjs +8 -7
- package/dist/esm/internal-runtime.mjs.map +1 -1
- package/dist/esm/internal-runtime.native.js +8 -7
- package/dist/esm/internal-runtime.native.js.map +1 -1
- package/dist/esm/static-resolve.mjs +8 -6
- package/dist/esm/static-resolve.mjs.map +1 -1
- package/dist/esm/static-resolve.native.js +8 -6
- package/dist/esm/static-resolve.native.js.map +1 -1
- package/dist/esm/styled.mjs +6 -57
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +6 -59
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/types.mjs +1 -18
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/types.native.js +1 -18
- package/dist/esm/types.native.js.map +1 -1
- package/dist/esm/views/Text.mjs +4 -2
- package/dist/esm/views/Text.mjs.map +1 -1
- package/dist/esm/views/Text.native.js +4 -2
- package/dist/esm/views/Text.native.js.map +1 -1
- package/dist/esm/views/View.mjs +4 -2
- package/dist/esm/views/View.mjs.map +1 -1
- package/dist/esm/views/View.native.js +4 -2
- package/dist/esm/views/View.native.js.map +1 -1
- package/package.json +15 -15
- package/src/config.ts +1 -1
- package/src/createComponent.tsx +41 -30
- package/src/createStyledHOC.tsx +56 -9
- package/src/createTokens.ts +1 -1
- package/src/dom/html.tsx +778 -877
- package/src/dom/htmlRuntime.native.tsx +7 -3
- package/src/dom/primitives.native.tsx +30 -39
- package/src/helpers/componentDisplayName.ts +0 -11
- package/src/helpers/directStyleCSS.ts +91 -112
- package/src/helpers/formatDiagnostic.ts +2 -4
- package/src/helpers/getCSSStylesAtomic.ts +32 -26
- package/src/helpers/getSplitStyles.tsx +315 -1119
- package/src/helpers/getVariantExtras.tsx +3 -3
- package/src/helpers/splitStyleProps.ts +166 -0
- package/src/helpers/styleFrontend.ts +8 -4
- package/src/helpers/styleStaticConfig.ts +88 -0
- package/src/helpers/tokenCategories.ts +62 -93
- package/src/helpers/variantResolvers.ts +121 -0
- package/src/hooks/useSplitStyles.tsx +17 -2
- package/src/hooks/useTheme.tsx +1 -1
- package/src/index.ts +8 -4
- package/src/internal-runtime.ts +10 -9
- package/src/static-resolve.ts +18 -14
- package/src/styled.tsx +7 -264
- package/src/types.tsx +19 -40
- package/src/views/Text.tsx +6 -7
- package/src/views/View.tsx +6 -7
- package/types/createComponent.d.ts.map +1 -1
- package/types/createStyledHOC.d.ts.map +1 -1
- package/types/dom/html.d.ts.map +1 -1
- package/types/dom/htmlRuntime.native.d.ts.map +1 -1
- package/types/dom/primitives.native.d.ts.map +1 -1
- package/types/helpers/componentDisplayName.d.ts +0 -3
- package/types/helpers/componentDisplayName.d.ts.map +1 -1
- package/types/helpers/directStyleCSS.d.ts.map +1 -1
- package/types/helpers/formatDiagnostic.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.d.ts +17 -15
- package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +6 -6
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/splitStyleProps.d.ts +44 -0
- package/types/helpers/splitStyleProps.d.ts.map +1 -0
- package/types/helpers/styleFrontend.d.ts +4 -4
- package/types/helpers/styleFrontend.d.ts.map +1 -1
- package/types/helpers/styleStaticConfig.d.ts +19 -0
- package/types/helpers/styleStaticConfig.d.ts.map +1 -0
- package/types/helpers/tokenCategories.d.ts +1 -1
- package/types/helpers/tokenCategories.d.ts.map +1 -1
- package/types/helpers/variantResolvers.d.ts +9 -0
- package/types/helpers/variantResolvers.d.ts.map +1 -0
- package/types/hooks/useSplitStyles.d.ts.map +1 -1
- package/types/index.d.ts +2 -4
- package/types/index.d.ts.map +1 -1
- package/types/internal-runtime.d.ts.map +1 -1
- package/types/static-resolve.d.ts +2 -2
- package/types/static-resolve.d.ts.map +1 -1
- package/types/styled.d.ts +3 -39
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +2 -12
- package/types/types.d.ts.map +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/View.d.ts.map +1 -1
- package/dist/cjs/helpers/getDefaultProps.cjs +0 -24
- package/dist/cjs/helpers/getDefaultProps.native.cjs +0 -28
- package/dist/cjs/helpers/getDefaultProps.native.js +0 -30
- package/dist/cjs/helpers/getDefaultProps.native.js.map +0 -1
- package/dist/cjs/helpers/themeable.cjs +0 -92
- package/dist/cjs/helpers/themeable.native.cjs +0 -95
- package/dist/cjs/helpers/themeable.native.js +0 -97
- package/dist/cjs/helpers/themeable.native.js.map +0 -1
- package/dist/cjs/hooks/useProps.cjs +0 -129
- package/dist/cjs/hooks/useProps.native.cjs +0 -135
- package/dist/cjs/hooks/useProps.native.js +0 -137
- package/dist/cjs/hooks/useProps.native.js.map +0 -1
- package/dist/esm/helpers/getDefaultProps.mjs +0 -4
- package/dist/esm/helpers/getDefaultProps.mjs.map +0 -1
- package/dist/esm/helpers/getDefaultProps.native.js +0 -6
- package/dist/esm/helpers/getDefaultProps.native.js.map +0 -1
- package/dist/esm/helpers/themeable.mjs +0 -67
- package/dist/esm/helpers/themeable.mjs.map +0 -1
- package/dist/esm/helpers/themeable.native.js +0 -68
- package/dist/esm/helpers/themeable.native.js.map +0 -1
- package/dist/esm/hooks/useProps.mjs +0 -100
- package/dist/esm/hooks/useProps.mjs.map +0 -1
- package/dist/esm/hooks/useProps.native.js +0 -104
- package/dist/esm/hooks/useProps.native.js.map +0 -1
- package/src/helpers/getDefaultProps.ts +0 -3
- package/src/helpers/themeable.tsx +0 -96
- package/src/hooks/useProps.tsx +0 -186
- package/types/helpers/getDefaultProps.d.ts +0 -3
- package/types/helpers/getDefaultProps.d.ts.map +0 -1
- package/types/helpers/themeable.d.ts +0 -3
- package/types/helpers/themeable.d.ts.map +0 -1
- package/types/hooks/useProps.d.ts +0 -39
- package/types/hooks/useProps.d.ts.map +0 -1
|
@@ -33,9 +33,9 @@ export const getVariantExtras = (styleState: GetStyleState) => {
|
|
|
33
33
|
const found = fonts[this.fontFamily]
|
|
34
34
|
if (found) return found
|
|
35
35
|
|
|
36
|
-
// When
|
|
37
|
-
//
|
|
38
|
-
//
|
|
36
|
+
// When an inner component re-processes already-resolved props, fontFamily
|
|
37
|
+
// arrives as the opaque var(--f-family) reference. The font identity
|
|
38
|
+
// survives in the font_<name> class.
|
|
39
39
|
const className = props.className
|
|
40
40
|
if (typeof className === 'string') {
|
|
41
41
|
let start = 0
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { stylePropsAll } from '@tamagui/helpers'
|
|
2
|
+
|
|
3
|
+
import { getConfig } from '../config'
|
|
4
|
+
import type { Shorthands } from '../types'
|
|
5
|
+
|
|
6
|
+
type StringKey<Props> = Extract<keyof Props, string>
|
|
7
|
+
type Simplify<Value> = { [Key in keyof Value]: Value[Key] }
|
|
8
|
+
|
|
9
|
+
type ExpandedShorthandKey<
|
|
10
|
+
Key extends PropertyKey,
|
|
11
|
+
ShorthandMap extends object = Shorthands,
|
|
12
|
+
> = Key extends keyof ShorthandMap
|
|
13
|
+
? ShorthandMap[Key] extends PropertyKey
|
|
14
|
+
? ShorthandMap[Key]
|
|
15
|
+
: Key
|
|
16
|
+
: Key
|
|
17
|
+
|
|
18
|
+
type ShorthandKeysMatchingFilter<
|
|
19
|
+
Filter extends object,
|
|
20
|
+
ShorthandMap extends object = Shorthands,
|
|
21
|
+
> = {
|
|
22
|
+
[Key in keyof ShorthandMap]-?: ShorthandMap[Key] extends keyof Filter ? Key : never
|
|
23
|
+
}[keyof ShorthandMap]
|
|
24
|
+
|
|
25
|
+
type KeysMatchingFilter<Filter extends object, ShorthandMap extends object = Shorthands> =
|
|
26
|
+
| keyof Filter
|
|
27
|
+
| ShorthandKeysMatchingFilter<Filter, ShorthandMap>
|
|
28
|
+
|
|
29
|
+
type StyleKeys = KeysMatchingFilter<typeof stylePropsAll>
|
|
30
|
+
|
|
31
|
+
type ExpandedProps<
|
|
32
|
+
Props extends object,
|
|
33
|
+
Keys extends keyof Props,
|
|
34
|
+
ShorthandMap extends object,
|
|
35
|
+
> = Simplify<
|
|
36
|
+
{
|
|
37
|
+
[Key in Extract<Keys, keyof ShorthandMap> as ExpandedShorthandKey<
|
|
38
|
+
Key,
|
|
39
|
+
ShorthandMap
|
|
40
|
+
>]: Props[Key]
|
|
41
|
+
} & Omit<Pick<Props, Keys>, keyof ShorthandMap>
|
|
42
|
+
>
|
|
43
|
+
|
|
44
|
+
type SelectedProps<
|
|
45
|
+
Props extends object,
|
|
46
|
+
Keys extends keyof Props,
|
|
47
|
+
ExpandShorthands extends boolean,
|
|
48
|
+
ShorthandMap extends object = Shorthands,
|
|
49
|
+
> = ExpandShorthands extends true
|
|
50
|
+
? ExpandedProps<Props, Keys, ShorthandMap>
|
|
51
|
+
: Pick<Props, Keys>
|
|
52
|
+
|
|
53
|
+
export type SplitStylePropsResult<
|
|
54
|
+
Props extends object,
|
|
55
|
+
Keys extends PropertyKey,
|
|
56
|
+
ExpandShorthands extends boolean = false,
|
|
57
|
+
ShorthandMap extends object = Shorthands,
|
|
58
|
+
> = [
|
|
59
|
+
SelectedProps<Props, Extract<keyof Props, Keys>, ExpandShorthands, ShorthandMap>,
|
|
60
|
+
Omit<Props, Keys>,
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
export type SplitStylePropsFilterCallback<Props extends object> = (
|
|
64
|
+
key: string,
|
|
65
|
+
value: Props[StringKey<Props>],
|
|
66
|
+
originalKey: StringKey<Props>,
|
|
67
|
+
isStyleProp: boolean
|
|
68
|
+
) => boolean
|
|
69
|
+
|
|
70
|
+
export type SplitStylePropsFilter<Props extends object> =
|
|
71
|
+
| Readonly<Record<string, unknown>>
|
|
72
|
+
| SplitStylePropsFilterCallback<Props>
|
|
73
|
+
|
|
74
|
+
export type SplitStylePropsOptions<Props extends object> = {
|
|
75
|
+
expandShorthands?: boolean
|
|
76
|
+
filter?: SplitStylePropsFilter<Props>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** partitions authored props in one pass without resolving style values */
|
|
80
|
+
export function splitStyleProps<
|
|
81
|
+
Props extends object,
|
|
82
|
+
const ExpandShorthands extends boolean = false,
|
|
83
|
+
>(
|
|
84
|
+
props: Props,
|
|
85
|
+
options?: { expandShorthands?: ExpandShorthands }
|
|
86
|
+
): SplitStylePropsResult<Props, StyleKeys, ExpandShorthands>
|
|
87
|
+
|
|
88
|
+
export function splitStyleProps<
|
|
89
|
+
Props extends object,
|
|
90
|
+
const Filter extends Readonly<Record<string, unknown>>,
|
|
91
|
+
const ExpandShorthands extends boolean = false,
|
|
92
|
+
>(
|
|
93
|
+
props: Props,
|
|
94
|
+
options: { expandShorthands?: ExpandShorthands; filter: Filter }
|
|
95
|
+
): SplitStylePropsResult<Props, KeysMatchingFilter<Filter>, ExpandShorthands>
|
|
96
|
+
|
|
97
|
+
export function splitStyleProps<
|
|
98
|
+
Props extends object,
|
|
99
|
+
SelectedKey extends StringKey<Props>,
|
|
100
|
+
const ExpandShorthands extends boolean = false,
|
|
101
|
+
>(
|
|
102
|
+
props: Props,
|
|
103
|
+
options: {
|
|
104
|
+
expandShorthands?: ExpandShorthands
|
|
105
|
+
filter: (
|
|
106
|
+
key: string,
|
|
107
|
+
value: Props[StringKey<Props>],
|
|
108
|
+
originalKey: StringKey<Props>,
|
|
109
|
+
isStyleProp: boolean
|
|
110
|
+
) => originalKey is SelectedKey
|
|
111
|
+
}
|
|
112
|
+
): SplitStylePropsResult<Props, SelectedKey, ExpandShorthands>
|
|
113
|
+
|
|
114
|
+
export function splitStyleProps<
|
|
115
|
+
Props extends object,
|
|
116
|
+
const ExpandShorthands extends boolean = false,
|
|
117
|
+
>(
|
|
118
|
+
props: Props,
|
|
119
|
+
options: {
|
|
120
|
+
expandShorthands?: ExpandShorthands
|
|
121
|
+
filter: SplitStylePropsFilterCallback<Props>
|
|
122
|
+
}
|
|
123
|
+
): [Partial<SelectedProps<Props, keyof Props, ExpandShorthands>>, Partial<Props>]
|
|
124
|
+
|
|
125
|
+
export function splitStyleProps(
|
|
126
|
+
props: object,
|
|
127
|
+
options: {
|
|
128
|
+
expandShorthands?: boolean
|
|
129
|
+
filter?:
|
|
130
|
+
| Readonly<Record<string, unknown>>
|
|
131
|
+
| ((
|
|
132
|
+
key: string,
|
|
133
|
+
value: unknown,
|
|
134
|
+
originalKey: string,
|
|
135
|
+
isStyleProp: boolean
|
|
136
|
+
) => boolean)
|
|
137
|
+
} = {}
|
|
138
|
+
) {
|
|
139
|
+
const styleProps: Record<string, unknown> = {}
|
|
140
|
+
const regularProps: Record<string, unknown> = {}
|
|
141
|
+
const { expandShorthands = false, filter } = options
|
|
142
|
+
const shorthands = getConfig().shorthands
|
|
143
|
+
const filterIsFunction = typeof filter === 'function'
|
|
144
|
+
const propsRecord = props as Record<string, unknown>
|
|
145
|
+
|
|
146
|
+
for (const originalKey in props) {
|
|
147
|
+
if (!Object.hasOwn(props, originalKey)) continue
|
|
148
|
+
|
|
149
|
+
const value = propsRecord[originalKey]
|
|
150
|
+
const key = shorthands[originalKey] || originalKey
|
|
151
|
+
const isStyleProp = key in stylePropsAll
|
|
152
|
+
const selected = filter
|
|
153
|
+
? filterIsFunction
|
|
154
|
+
? filter(key, value, originalKey, isStyleProp)
|
|
155
|
+
: Object.hasOwn(filter, key)
|
|
156
|
+
: isStyleProp
|
|
157
|
+
|
|
158
|
+
if (selected) {
|
|
159
|
+
styleProps[expandShorthands ? key : originalKey] = value
|
|
160
|
+
} else {
|
|
161
|
+
regularProps[originalKey] = value
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return [styleProps, regularProps]
|
|
166
|
+
}
|
|
@@ -30,10 +30,14 @@ export type FrontendStaticConfig = {
|
|
|
30
30
|
*/
|
|
31
31
|
passthroughClassName?: string
|
|
32
32
|
variants?: Record<string, Record<string, any>>
|
|
33
|
-
compoundVariants?: readonly Record<string, any>[]
|
|
34
33
|
styleFrontend?: StyleFrontend
|
|
35
34
|
}
|
|
36
35
|
|
|
36
|
+
export type FrontendStaticConfigNormalization = Pick<
|
|
37
|
+
FrontendStaticConfig,
|
|
38
|
+
'baseStyle' | 'passthroughClassName' | 'variants'
|
|
39
|
+
>
|
|
40
|
+
|
|
37
41
|
/**
|
|
38
42
|
* What the internal View/Text factory and a frontend-bound `styled()` hand back: an
|
|
39
43
|
* opaque component object carrying its static config. Deliberately not core's
|
|
@@ -81,13 +85,13 @@ export type StyleFrontend = {
|
|
|
81
85
|
|
|
82
86
|
/**
|
|
83
87
|
* Resolves frontend-specific static style input (a class-string base, string
|
|
84
|
-
* variant values
|
|
85
|
-
* Called once per (staticConfig, config)
|
|
88
|
+
* variant values) into ordinary style objects.
|
|
89
|
+
* Called once per (staticConfig, config revision) by the shared runtime cache.
|
|
86
90
|
*/
|
|
87
91
|
normalizeStaticConfig?: <Config extends FrontendStaticConfig>(
|
|
88
92
|
staticConfig: Config,
|
|
89
93
|
config: StyleFrontendConfig
|
|
90
|
-
) =>
|
|
94
|
+
) => FrontendStaticConfigNormalization
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
/**
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { stylePropsText, validStyles as validStylesView } from '@tamagui/helpers'
|
|
2
|
+
import type { StaticConfig, TamaguiInternalConfig } from '../types'
|
|
3
|
+
import { getConfigRevisionState } from './grammarConfig'
|
|
4
|
+
|
|
5
|
+
export type StyleStaticConfig = {
|
|
6
|
+
baseStyle: Record<string, any> | undefined
|
|
7
|
+
baseVariantProps: Record<string, any> | undefined
|
|
8
|
+
defaultProps: Record<string, any> | undefined
|
|
9
|
+
styledContextKeys: Set<string> | null
|
|
10
|
+
variants: StaticConfig['variants']
|
|
11
|
+
passthroughClassName: string | undefined
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const styleStaticConfigCache = new WeakMap<
|
|
15
|
+
StaticConfig,
|
|
16
|
+
WeakMap<TamaguiInternalConfig, { revision: number; value: StyleStaticConfig }>
|
|
17
|
+
>()
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* styled() takes styles and props in one options object. The styles belong to the
|
|
21
|
+
* base layer the style pass writes before any prop, so call-site props and
|
|
22
|
+
* variants always land on top of them; everything else stays a prop.
|
|
23
|
+
*
|
|
24
|
+
* Split lazily rather than in styled(), because classifying a key needs
|
|
25
|
+
* `conf.shorthands` and styled() runs at module scope before createTamagui.
|
|
26
|
+
*/
|
|
27
|
+
export function getStyleStaticConfig(
|
|
28
|
+
staticConfig: StaticConfig,
|
|
29
|
+
conf: TamaguiInternalConfig
|
|
30
|
+
): StyleStaticConfig {
|
|
31
|
+
let configCache = styleStaticConfigCache.get(staticConfig)
|
|
32
|
+
const revision = getConfigRevisionState(conf).revision
|
|
33
|
+
const cached = configCache?.get(conf)
|
|
34
|
+
if (cached?.revision === revision) return cached.value
|
|
35
|
+
|
|
36
|
+
const normalized = staticConfig.styleFrontend?.normalizeStaticConfig?.(
|
|
37
|
+
staticConfig,
|
|
38
|
+
conf
|
|
39
|
+
)
|
|
40
|
+
const variants = normalized ? normalized.variants : staticConfig.variants
|
|
41
|
+
const authoredBaseStyle = normalized ? normalized.baseStyle : staticConfig.baseStyle
|
|
42
|
+
const authoredDefaultProps = staticConfig.defaultProps
|
|
43
|
+
let baseStyle: Record<string, any> | undefined
|
|
44
|
+
let baseVariantProps: Record<string, any> | undefined
|
|
45
|
+
let defaultProps: Record<string, any> | undefined
|
|
46
|
+
if (authoredDefaultProps) {
|
|
47
|
+
const validStyles =
|
|
48
|
+
staticConfig.validStyles ||
|
|
49
|
+
(staticConfig.isText || staticConfig.isInput ? stylePropsText : validStylesView)
|
|
50
|
+
for (const key in authoredDefaultProps) {
|
|
51
|
+
const isVariant = Boolean(variants?.[key])
|
|
52
|
+
// transition selects an animation driver preset. It stays a prop even
|
|
53
|
+
// though the web style table recognizes the CSS property spelling.
|
|
54
|
+
const isStyle =
|
|
55
|
+
key !== 'transition' && (key in validStyles || key in conf.shorthands)
|
|
56
|
+
if (isVariant || isStyle) {
|
|
57
|
+
;(baseStyle ||= authoredBaseStyle ? { ...authoredBaseStyle } : {})[key] =
|
|
58
|
+
authoredDefaultProps[key]
|
|
59
|
+
}
|
|
60
|
+
// variants also stay in the merged props for context and HOC forwarding,
|
|
61
|
+
// while their style contribution runs at its authored base position
|
|
62
|
+
if (isVariant || !isStyle) {
|
|
63
|
+
;(defaultProps ||= {})[key] = authoredDefaultProps[key]
|
|
64
|
+
}
|
|
65
|
+
if (isVariant) {
|
|
66
|
+
;(baseVariantProps ||= {})[key] = authoredDefaultProps[key]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const keys = staticConfig.contextProps || staticConfig.context?.propKeys
|
|
71
|
+
const value: StyleStaticConfig = {
|
|
72
|
+
baseStyle: baseStyle || authoredBaseStyle,
|
|
73
|
+
baseVariantProps,
|
|
74
|
+
defaultProps,
|
|
75
|
+
styledContextKeys: keys ? new Set(keys) : null,
|
|
76
|
+
variants,
|
|
77
|
+
passthroughClassName: normalized
|
|
78
|
+
? normalized.passthroughClassName
|
|
79
|
+
: staticConfig.passthroughClassName,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!configCache) {
|
|
83
|
+
configCache = new WeakMap()
|
|
84
|
+
styleStaticConfigCache.set(staticConfig, configCache)
|
|
85
|
+
}
|
|
86
|
+
configCache.set(conf, { revision, value })
|
|
87
|
+
return value
|
|
88
|
+
}
|
|
@@ -1,104 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import {
|
|
2
|
+
getTokenCategoryName,
|
|
3
|
+
propToTokenCategoryCode,
|
|
4
|
+
tokenCategoryColor,
|
|
5
|
+
tokenCategoryFontFamily,
|
|
6
|
+
tokenCategoryFontSize,
|
|
7
|
+
tokenCategoryFontWeight,
|
|
8
|
+
tokenCategoryLetterSpacing,
|
|
9
|
+
tokenCategoryLineHeight,
|
|
10
|
+
tokenCategoryRadius,
|
|
11
|
+
tokenCategorySize,
|
|
12
|
+
tokenCategorySpace,
|
|
13
|
+
tokenCategoryZIndex,
|
|
14
|
+
} from '@tamagui/helpers'
|
|
9
15
|
|
|
10
16
|
export type StyleTokenCategory = 'size' | 'space' | 'radius' | 'zIndex' | 'fontSize'
|
|
17
|
+
export type RuntimeTokenCategory = StyleTokenCategory | 'color' | 'font' | 'fontFamily'
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
...mapTokenCategory(tokenCategories.zIndex, 'zIndex'),
|
|
22
|
-
// the transform family's x/y are lengths from the space scale (v6 decision:
|
|
23
|
-
// `x="4"` resolves like `p="4"`), never the size category
|
|
24
|
-
x: 'space',
|
|
25
|
-
y: 'space',
|
|
26
|
-
fontSize: 'fontSize',
|
|
27
|
-
borderWidth: 'space',
|
|
28
|
-
borderTopWidth: 'space',
|
|
29
|
-
borderRightWidth: 'space',
|
|
30
|
-
borderBottomWidth: 'space',
|
|
31
|
-
borderLeftWidth: 'space',
|
|
32
|
-
borderBlockWidth: 'space',
|
|
33
|
-
borderBlockStartWidth: 'space',
|
|
34
|
-
borderBlockEndWidth: 'space',
|
|
35
|
-
borderInlineWidth: 'space',
|
|
36
|
-
borderInlineStartWidth: 'space',
|
|
37
|
-
borderInlineEndWidth: 'space',
|
|
38
|
-
outlineOffset: 'space',
|
|
39
|
-
outlineWidth: 'space',
|
|
40
|
-
gap: 'space',
|
|
41
|
-
rowGap: 'space',
|
|
42
|
-
columnGap: 'space',
|
|
43
|
-
top: 'space',
|
|
44
|
-
right: 'space',
|
|
45
|
-
bottom: 'space',
|
|
46
|
-
left: 'space',
|
|
47
|
-
inset: 'space',
|
|
48
|
-
insetBlock: 'space',
|
|
49
|
-
insetBlockEnd: 'space',
|
|
50
|
-
insetBlockStart: 'space',
|
|
51
|
-
insetInline: 'space',
|
|
52
|
-
insetInlineEnd: 'space',
|
|
53
|
-
insetInlineStart: 'space',
|
|
54
|
-
margin: 'space',
|
|
55
|
-
marginBlock: 'space',
|
|
56
|
-
marginBlockEnd: 'space',
|
|
57
|
-
marginBlockStart: 'space',
|
|
58
|
-
marginInline: 'space',
|
|
59
|
-
marginInlineEnd: 'space',
|
|
60
|
-
marginInlineStart: 'space',
|
|
61
|
-
marginTop: 'space',
|
|
62
|
-
marginRight: 'space',
|
|
63
|
-
marginBottom: 'space',
|
|
64
|
-
marginEnd: 'space',
|
|
65
|
-
marginLeft: 'space',
|
|
66
|
-
marginHorizontal: 'space',
|
|
67
|
-
marginStart: 'space',
|
|
68
|
-
marginVertical: 'space',
|
|
69
|
-
padding: 'space',
|
|
70
|
-
paddingBlock: 'space',
|
|
71
|
-
paddingBlockEnd: 'space',
|
|
72
|
-
paddingBlockStart: 'space',
|
|
73
|
-
paddingInline: 'space',
|
|
74
|
-
paddingInlineEnd: 'space',
|
|
75
|
-
paddingInlineStart: 'space',
|
|
76
|
-
paddingTop: 'space',
|
|
77
|
-
paddingRight: 'space',
|
|
78
|
-
paddingBottom: 'space',
|
|
79
|
-
paddingEnd: 'space',
|
|
80
|
-
paddingLeft: 'space',
|
|
81
|
-
paddingHorizontal: 'space',
|
|
82
|
-
paddingStart: 'space',
|
|
83
|
-
paddingVertical: 'space',
|
|
19
|
+
const legacyCategory = (property: string): StyleTokenCategory | undefined => {
|
|
20
|
+
const category = getTokenCategoryName(propToTokenCategoryCode[property])
|
|
21
|
+
return category === 'space' ||
|
|
22
|
+
category === 'size' ||
|
|
23
|
+
category === 'radius' ||
|
|
24
|
+
category === 'zIndex' ||
|
|
25
|
+
category === 'fontSize'
|
|
26
|
+
? category
|
|
27
|
+
: undefined
|
|
84
28
|
}
|
|
85
29
|
|
|
86
|
-
|
|
30
|
+
// compatibility view for internal consumers that enumerated the old string map.
|
|
31
|
+
// the proxy keeps the numeric table canonical and only allocates keys on enumeration
|
|
32
|
+
export const tokenCategoryByProperty: Readonly<Record<string, StyleTokenCategory>> =
|
|
33
|
+
/* @__PURE__ */ new Proxy(Object.create(null), {
|
|
34
|
+
get(_, property) {
|
|
35
|
+
return typeof property === 'string' ? legacyCategory(property) : undefined
|
|
36
|
+
},
|
|
37
|
+
has(_, property) {
|
|
38
|
+
return typeof property === 'string' && legacyCategory(property) !== undefined
|
|
39
|
+
},
|
|
40
|
+
ownKeys() {
|
|
41
|
+
return Object.keys(propToTokenCategoryCode).filter(
|
|
42
|
+
(property) => legacyCategory(property) !== undefined
|
|
43
|
+
)
|
|
44
|
+
},
|
|
45
|
+
getOwnPropertyDescriptor(_, property) {
|
|
46
|
+
if (typeof property !== 'string' || legacyCategory(property) === undefined) return
|
|
47
|
+
return { configurable: true, enumerable: true }
|
|
48
|
+
},
|
|
49
|
+
})
|
|
87
50
|
|
|
88
51
|
export function getTokenCategoryForProperty(
|
|
89
52
|
property: string
|
|
90
53
|
): RuntimeTokenCategory | undefined {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
54
|
+
switch (propToTokenCategoryCode[property]) {
|
|
55
|
+
case tokenCategorySpace:
|
|
56
|
+
return 'space'
|
|
57
|
+
case tokenCategorySize:
|
|
58
|
+
return 'size'
|
|
59
|
+
case tokenCategoryRadius:
|
|
60
|
+
return 'radius'
|
|
61
|
+
case tokenCategoryZIndex:
|
|
62
|
+
return 'zIndex'
|
|
63
|
+
case tokenCategoryColor:
|
|
64
|
+
return 'color'
|
|
65
|
+
case tokenCategoryFontFamily:
|
|
66
|
+
return 'fontFamily'
|
|
67
|
+
case tokenCategoryFontSize:
|
|
68
|
+
case tokenCategoryFontWeight:
|
|
69
|
+
case tokenCategoryLineHeight:
|
|
70
|
+
case tokenCategoryLetterSpacing:
|
|
71
|
+
return 'font'
|
|
99
72
|
}
|
|
100
|
-
return (
|
|
101
|
-
tokenCategoryByProperty[property] ||
|
|
102
|
-
(property in tokenCategories.color ? 'color' : undefined)
|
|
103
|
-
)
|
|
104
73
|
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { isVariable } from '../createVariable'
|
|
2
|
+
import type { GetStyleState, TamaguiInternalConfig, VariantResolverName } from '../types'
|
|
3
|
+
|
|
4
|
+
type CompiledVariantResolver = {
|
|
5
|
+
key: string
|
|
6
|
+
parts: VariantResolverName[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const variantResolverCache = new WeakMap<object, readonly CompiledVariantResolver[]>()
|
|
10
|
+
|
|
11
|
+
// a variant key may list several resolvers: `'Size | Space'`. compiled once per
|
|
12
|
+
// variant object on first use, never again on the render path
|
|
13
|
+
export function getCompiledVariantResolvers(variant: object) {
|
|
14
|
+
let compiled = variantResolverCache.get(variant)
|
|
15
|
+
if (!compiled) {
|
|
16
|
+
const next: CompiledVariantResolver[] = []
|
|
17
|
+
for (const key in variant) {
|
|
18
|
+
const parts = parseVariantResolverKey(key)
|
|
19
|
+
if (parts) next.push({ key, parts })
|
|
20
|
+
}
|
|
21
|
+
compiled = next
|
|
22
|
+
variantResolverCache.set(variant, compiled)
|
|
23
|
+
}
|
|
24
|
+
return compiled
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function parseVariantResolverKey(key: string): VariantResolverName[] | null {
|
|
28
|
+
if (!key) return null
|
|
29
|
+
return key.split('|').map((part) => part.trim()) as VariantResolverName[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// goes through specificity finding best matching variant function
|
|
33
|
+
export function getVariantDefinition(
|
|
34
|
+
variant: any,
|
|
35
|
+
value: any,
|
|
36
|
+
conf: TamaguiInternalConfig,
|
|
37
|
+
{ theme }: Partial<GetStyleState>
|
|
38
|
+
): any {
|
|
39
|
+
if (!variant) return
|
|
40
|
+
if (value === undefined) return
|
|
41
|
+
if (typeof variant === 'function') {
|
|
42
|
+
return variant
|
|
43
|
+
}
|
|
44
|
+
if (value in variant) {
|
|
45
|
+
return variant[value]
|
|
46
|
+
}
|
|
47
|
+
for (const { key, parts } of getCompiledVariantResolvers(variant)) {
|
|
48
|
+
for (const part of parts) {
|
|
49
|
+
if (matchesVariantResolver(part, value, conf, theme)) {
|
|
50
|
+
return variant[key]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function matchesVariantResolver(
|
|
57
|
+
resolverName: VariantResolverName,
|
|
58
|
+
value: any,
|
|
59
|
+
conf: TamaguiInternalConfig,
|
|
60
|
+
theme: Partial<GetStyleState>['theme']
|
|
61
|
+
) {
|
|
62
|
+
const string = typeof value === 'string'
|
|
63
|
+
const number = typeof value === 'number'
|
|
64
|
+
const rem =
|
|
65
|
+
string &&
|
|
66
|
+
value.length > 3 &&
|
|
67
|
+
value.endsWith('rem') &&
|
|
68
|
+
Number.isFinite(Number(value.slice(0, -3)))
|
|
69
|
+
|
|
70
|
+
switch (resolverName) {
|
|
71
|
+
case 'Size':
|
|
72
|
+
case 'Space':
|
|
73
|
+
case 'Radius':
|
|
74
|
+
case 'ZIndex':
|
|
75
|
+
// styles are authored by devs and never validated at runtime: any number
|
|
76
|
+
// or string routes to the token variant, which passes unknown values
|
|
77
|
+
// through. Size keeps its historical variable exclusion so variables
|
|
78
|
+
// route to the Space/Radius/ZIndex fallbacks.
|
|
79
|
+
return (
|
|
80
|
+
value === true ||
|
|
81
|
+
number ||
|
|
82
|
+
string ||
|
|
83
|
+
(resolverName !== 'Size' && isVariable(value))
|
|
84
|
+
)
|
|
85
|
+
// a token or theme color, otherwise any string is taken to be a raw CSS
|
|
86
|
+
// color and left for the browser to resolve. checking that against a CSS
|
|
87
|
+
// color-name table costs 2.3KB gzip to reject values that were never valid
|
|
88
|
+
// anyway. `red/50` opacity modifiers stay limited to token and theme
|
|
89
|
+
// colors, which the branches above already covered.
|
|
90
|
+
case 'Color':
|
|
91
|
+
return string
|
|
92
|
+
case 'Theme':
|
|
93
|
+
return string && !!theme && value in theme
|
|
94
|
+
case 'FontSize':
|
|
95
|
+
return value === true || !!conf.fontsParsed.body?.size?.[value] || number || rem
|
|
96
|
+
case 'FontStyle':
|
|
97
|
+
return (
|
|
98
|
+
!!conf.fontsParsed.body?.style?.[value] ||
|
|
99
|
+
value === 'normal' ||
|
|
100
|
+
value === 'italic'
|
|
101
|
+
)
|
|
102
|
+
case 'FontTransform':
|
|
103
|
+
return (
|
|
104
|
+
!!conf.fontsParsed.body?.transform?.[value] ||
|
|
105
|
+
value === 'none' ||
|
|
106
|
+
value === 'capitalize' ||
|
|
107
|
+
value === 'uppercase' ||
|
|
108
|
+
value === 'lowercase'
|
|
109
|
+
)
|
|
110
|
+
case 'FontLineHeight':
|
|
111
|
+
return !!conf.fontsParsed.body?.lineHeight?.[value] || number || rem
|
|
112
|
+
case 'FontLetterSpacing':
|
|
113
|
+
return !!conf.fontsParsed.body?.letterSpacing?.[value] || number || rem
|
|
114
|
+
case 'number':
|
|
115
|
+
case 'string':
|
|
116
|
+
case 'boolean':
|
|
117
|
+
return typeof value === resolverName
|
|
118
|
+
case 'any':
|
|
119
|
+
return true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -9,10 +9,25 @@ const useInsertEffectCompat = isWeb
|
|
|
9
9
|
: () => {}
|
|
10
10
|
|
|
11
11
|
// perf: ...args a bit expensive on native
|
|
12
|
-
export const useSplitStyles: StyleSplitter = (
|
|
12
|
+
export const useSplitStyles: StyleSplitter = (
|
|
13
|
+
a,
|
|
14
|
+
b,
|
|
15
|
+
c,
|
|
16
|
+
d,
|
|
17
|
+
e,
|
|
18
|
+
f,
|
|
19
|
+
g,
|
|
20
|
+
h,
|
|
21
|
+
i,
|
|
22
|
+
j,
|
|
23
|
+
k,
|
|
24
|
+
l,
|
|
25
|
+
m,
|
|
26
|
+
n
|
|
27
|
+
) => {
|
|
13
28
|
'use no memo'
|
|
14
29
|
|
|
15
|
-
const res = getSplitStyles(a, b, c, d, e, f, g, h, i, j, k, l, m)
|
|
30
|
+
const res = getSplitStyles(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
|
|
16
31
|
|
|
17
32
|
if (!process.env.TAMAGUI_DID_OUTPUT_CSS && process.env.TAMAGUI_TARGET !== 'native') {
|
|
18
33
|
useInsertEffectCompat(() => {
|
package/src/hooks/useTheme.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export const useThemeWithState = (
|
|
|
31
31
|
// <Theme> components push their themeState.id into ThemeStateContext,
|
|
32
32
|
// so their descendants subscribe under this id; <Theme> needs to schedule
|
|
33
33
|
// descendant updates when its propsKey changes. Leaf styled components
|
|
34
|
-
// (createComponent,
|
|
34
|
+
// (createComponent, useTheme, animation hooks) do NOT push a
|
|
35
35
|
// context — listenersByParent[componentId] is always empty — so the
|
|
36
36
|
// schedule-update effect is a no-op for them and can be skipped to save
|
|
37
37
|
// one hook slot per styled component on mount. Theme.tsx passes true.
|
package/src/index.ts
CHANGED
|
@@ -11,14 +11,13 @@ export { _withStableStyle } from './_withStableStyle'
|
|
|
11
11
|
export { _withNativeStyle } from './_withNativeStyle'
|
|
12
12
|
export { createComponent } from './createComponent'
|
|
13
13
|
export { createStyledContext } from './helpers/createStyledContext'
|
|
14
|
-
export { getDefaultProps } from './helpers/getDefaultProps'
|
|
15
14
|
export { getCSSStylesAtomic } from './helpers/getCSSStylesAtomic'
|
|
16
15
|
export { getExpandedShorthand } from './helpers/getExpandedShorthands'
|
|
17
16
|
export { formatDiagnostic } from './helpers/formatDiagnostic'
|
|
18
17
|
export {
|
|
18
|
+
getStyleStaticConfig,
|
|
19
19
|
getSplitStyles,
|
|
20
20
|
isValidStyleKey,
|
|
21
|
-
prepareStyleStaticConfig,
|
|
22
21
|
} from './helpers/getSplitStyles'
|
|
23
22
|
export {
|
|
24
23
|
setNativeStyleEngine,
|
|
@@ -42,10 +41,16 @@ export { isTamaguiElement } from './helpers/isTamaguiElement'
|
|
|
42
41
|
export { matchMedia, setupMatchMedia } from './helpers/matchMedia'
|
|
43
42
|
export { mergeProps } from './helpers/mergeProps'
|
|
44
43
|
export { mergeSlotStyleProps } from './helpers/mergeSlotStyleProps'
|
|
44
|
+
export {
|
|
45
|
+
splitStyleProps,
|
|
46
|
+
type SplitStylePropsFilter,
|
|
47
|
+
type SplitStylePropsFilterCallback,
|
|
48
|
+
type SplitStylePropsOptions,
|
|
49
|
+
type SplitStylePropsResult,
|
|
50
|
+
} from './helpers/splitStyleProps'
|
|
45
51
|
export { normalizeColor } from './helpers/normalizeColor'
|
|
46
52
|
export { normalizeStyle } from './helpers/normalizeStyle'
|
|
47
53
|
export { containsThemeRef, themeRefKey } from './helpers/themeRef'
|
|
48
|
-
export { themeable } from './helpers/themeable'
|
|
49
54
|
export { getStyleTags } from './helpers/wrapStyleTags'
|
|
50
55
|
|
|
51
56
|
export { createFont } from './createFont'
|
|
@@ -276,7 +281,6 @@ export {
|
|
|
276
281
|
useAnimatedNumbersStyle,
|
|
277
282
|
useAnimationDriver,
|
|
278
283
|
} from './hooks/useAnimationDriver'
|
|
279
|
-
export { useProps, usePropsAndStyle, useStyle } from './hooks/useProps'
|
|
280
284
|
export { useTheme } from './hooks/useTheme'
|
|
281
285
|
export { usePortalThemeState } from './hooks/usePortalThemeState'
|
|
282
286
|
export { useThemeName } from './hooks/useThemeName'
|