@tamagui/web 1.73.2 → 1.74.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/createComponent.js +6 -3
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/createComponent.native.js +10 -5
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +1 -1
- package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/propMapper.js +14 -2
- package/dist/cjs/helpers/propMapper.js.map +1 -1
- package/dist/cjs/helpers/propMapper.native.js +14 -2
- package/dist/cjs/helpers/propMapper.native.js.map +1 -1
- package/dist/cjs/helpers/themeable.js.map +1 -1
- package/dist/cjs/helpers/themeable.native.js.map +1 -1
- package/dist/cjs/hooks/useTheme.js +17 -11
- package/dist/cjs/hooks/useTheme.js.map +1 -1
- package/dist/cjs/hooks/useTheme.native.js +36 -11
- package/dist/cjs/hooks/useTheme.native.js.map +1 -1
- package/dist/cjs/setupReactNative.js +21 -12
- package/dist/cjs/setupReactNative.js.map +1 -1
- package/dist/cjs/setupReactNative.native.js +21 -12
- package/dist/cjs/setupReactNative.native.js.map +1 -1
- package/dist/cjs/styled.js +1 -1
- package/dist/cjs/styled.js.map +1 -1
- package/dist/cjs/styled.native.js +1 -1
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/views/Theme.js.map +1 -1
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/esm/createComponent.js +6 -3
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +1 -1
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/propMapper.js +15 -3
- package/dist/esm/helpers/propMapper.js.map +1 -1
- package/dist/esm/helpers/themeable.js.map +1 -1
- package/dist/esm/hooks/useTheme.js +18 -12
- package/dist/esm/hooks/useTheme.js.map +1 -1
- package/dist/esm/setupReactNative.js +20 -12
- package/dist/esm/setupReactNative.js.map +1 -1
- package/dist/esm/styled.js +1 -1
- package/dist/esm/styled.js.map +1 -1
- package/dist/esm/views/Theme.js.map +1 -1
- package/package.json +9 -9
- package/src/createComponent.tsx +16 -6
- package/src/helpers/getSplitStyles.tsx +0 -1
- package/src/helpers/propMapper.ts +11 -2
- package/src/helpers/themeable.tsx +1 -1
- package/src/hooks/useTheme.tsx +77 -29
- package/src/setupReactNative.ts +67 -12
- package/src/styled.tsx +5 -5
- package/src/types.tsx +25 -0
- package/src/views/Theme.tsx +1 -0
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/propMapper.d.ts.map +1 -1
- package/types/hooks/useConfiguration.d.ts +1 -0
- package/types/hooks/useConfiguration.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +4 -4
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/setupReactNative.d.ts +6 -1
- package/types/setupReactNative.d.ts.map +1 -1
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +22 -0
- package/types/types.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
package/src/hooks/useTheme.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { isClient, isServer, isWeb } from '@tamagui/constants'
|
|
1
|
+
import { isClient, isIos, isServer } from '@tamagui/constants'
|
|
3
2
|
import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
|
4
3
|
|
|
5
4
|
import { getConfig } from '../config'
|
|
@@ -15,6 +14,7 @@ import type {
|
|
|
15
14
|
DebugProp,
|
|
16
15
|
ThemeParsed,
|
|
17
16
|
ThemeProps,
|
|
17
|
+
UseThemeWithStateProps,
|
|
18
18
|
VariableVal,
|
|
19
19
|
VariableValGeneric,
|
|
20
20
|
} from '../types'
|
|
@@ -33,8 +33,9 @@ let cached: any
|
|
|
33
33
|
function getDefaultThemeProxied() {
|
|
34
34
|
if (cached) return cached
|
|
35
35
|
const config = getConfig()
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const name = config.themes.light ? 'light' : Object.keys(config.themes)[0]
|
|
37
|
+
const defaultTheme = config.themes[name]
|
|
38
|
+
cached = getThemeProxied({ theme: defaultTheme, name })
|
|
38
39
|
return cached
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -61,7 +62,7 @@ export const useTheme = (props: ThemeProps = emptyProps) => {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
export const useThemeWithState = (
|
|
64
|
-
props:
|
|
65
|
+
props: UseThemeWithStateProps
|
|
65
66
|
): [ChangedThemeResponse, ThemeParsed] => {
|
|
66
67
|
const keys = useRef<string[]>([])
|
|
67
68
|
|
|
@@ -73,6 +74,7 @@ export const useThemeWithState = (
|
|
|
73
74
|
? () => {
|
|
74
75
|
const next =
|
|
75
76
|
props.shouldUpdate?.() ?? (keys.current.length > 0 ? true : undefined)
|
|
77
|
+
|
|
76
78
|
if (
|
|
77
79
|
process.env.NODE_ENV === 'development' &&
|
|
78
80
|
props.debug &&
|
|
@@ -104,9 +106,11 @@ export const useThemeWithState = (
|
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
const themeProxied = useMemo(() => {
|
|
107
|
-
if (!themeManager || !state?.theme)
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
if (!themeManager || !state?.theme) {
|
|
110
|
+
return {}
|
|
111
|
+
}
|
|
112
|
+
return getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug)
|
|
113
|
+
}, [state, themeManager, props.deopt, props.debug])
|
|
110
114
|
|
|
111
115
|
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
112
116
|
console.groupCollapsed(' 🔹 useTheme =>', state?.name)
|
|
@@ -119,11 +123,24 @@ export const useThemeWithState = (
|
|
|
119
123
|
}
|
|
120
124
|
|
|
121
125
|
export function getThemeProxied(
|
|
122
|
-
theme:
|
|
126
|
+
{ theme, name }: ThemeManagerState,
|
|
127
|
+
deopt = false,
|
|
123
128
|
themeManager?: ThemeManager,
|
|
124
129
|
keys?: string[],
|
|
125
130
|
debug?: DebugProp
|
|
126
131
|
): UseThemeResult {
|
|
132
|
+
if (!theme) return {}
|
|
133
|
+
|
|
134
|
+
function track(key: string) {
|
|
135
|
+
if (keys && !keys.includes(key)) {
|
|
136
|
+
keys.push(key)
|
|
137
|
+
if (process.env.NODE_ENV === 'development' && debug) {
|
|
138
|
+
// biome-ignore lint/suspicious/noConsoleLog: <explanation>
|
|
139
|
+
console.log(` 🎨 useTheme() tracking new key: ${key}`)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
127
144
|
return createProxy(theme, {
|
|
128
145
|
has(_, key) {
|
|
129
146
|
if (Reflect.has(theme, key)) {
|
|
@@ -138,6 +155,7 @@ export function getThemeProxied(
|
|
|
138
155
|
if (key === GetThemeUnwrapped) {
|
|
139
156
|
return theme
|
|
140
157
|
}
|
|
158
|
+
|
|
141
159
|
if (
|
|
142
160
|
// dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
|
|
143
161
|
// if someone is crazy enough to use "undefined" as a theme key then this not working is on them
|
|
@@ -147,6 +165,7 @@ export function getThemeProxied(
|
|
|
147
165
|
// auto convert variables to plain
|
|
148
166
|
const keyString = key[0] === '$' ? key.slice(1) : key
|
|
149
167
|
const val = theme[keyString]
|
|
168
|
+
|
|
150
169
|
if (val && typeof val === 'object') {
|
|
151
170
|
// TODO this could definitely be done better by at the very minimum
|
|
152
171
|
// proxying it up front and just having a listener here
|
|
@@ -154,22 +173,46 @@ export function getThemeProxied(
|
|
|
154
173
|
// when they touch the actual value we only track it
|
|
155
174
|
// if its a variable (web), its ignored!
|
|
156
175
|
get(_, subkey) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (process.env.
|
|
165
|
-
//
|
|
166
|
-
|
|
176
|
+
if (subkey === 'val') {
|
|
177
|
+
// always track .val
|
|
178
|
+
track(keyString)
|
|
179
|
+
} else if (subkey === 'get') {
|
|
180
|
+
return () => {
|
|
181
|
+
const outVal = getVariable(val)
|
|
182
|
+
|
|
183
|
+
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
184
|
+
// ios can avoid re-rendering in some cases when we are using a root light/dark
|
|
185
|
+
// disabled in cases where we have animations
|
|
186
|
+
if (isIos && !deopt) {
|
|
187
|
+
const isDark = name.startsWith('dark')
|
|
188
|
+
const isLight = !isDark && name.startsWith('light')
|
|
189
|
+
if (isDark || isLight) {
|
|
190
|
+
const oppositeThemeName = name.replace(
|
|
191
|
+
isDark ? 'dark' : 'light',
|
|
192
|
+
isDark ? 'light' : 'dark'
|
|
193
|
+
)
|
|
194
|
+
const oppositeTheme = getConfig().themes[oppositeThemeName]
|
|
195
|
+
const oppositeVal = getVariable(oppositeTheme?.[keyString])
|
|
196
|
+
if (oppositeVal) {
|
|
197
|
+
const dynamicVal = {
|
|
198
|
+
dynamic: {
|
|
199
|
+
dark: isDark ? outVal : oppositeVal,
|
|
200
|
+
light: isLight ? outVal : oppositeVal,
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
return dynamicVal
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// if we dont return early with a dynamic val on native, always track
|
|
209
|
+
track(keyString)
|
|
167
210
|
}
|
|
211
|
+
|
|
212
|
+
return outVal
|
|
168
213
|
}
|
|
169
214
|
}
|
|
170
|
-
|
|
171
|
-
return () => getVariable(val)
|
|
172
|
-
}
|
|
215
|
+
|
|
173
216
|
return Reflect.get(val as any, subkey)
|
|
174
217
|
},
|
|
175
218
|
})
|
|
@@ -184,15 +227,12 @@ export function getThemeProxied(
|
|
|
184
227
|
export const activeThemeManagers = new Set<ThemeManager>()
|
|
185
228
|
|
|
186
229
|
export const useChangeThemeEffect = (
|
|
187
|
-
props:
|
|
230
|
+
props: UseThemeWithStateProps,
|
|
188
231
|
isRoot = false,
|
|
189
232
|
keys?: string[],
|
|
190
233
|
shouldUpdate?: () => boolean | undefined
|
|
191
234
|
): ChangedThemeResponse => {
|
|
192
|
-
const {
|
|
193
|
-
// @ts-expect-error internal use only
|
|
194
|
-
disable,
|
|
195
|
-
} = props
|
|
235
|
+
const { disable } = props
|
|
196
236
|
|
|
197
237
|
const parentManager = useContext(ThemeManagerContext)
|
|
198
238
|
|
|
@@ -267,7 +307,14 @@ export const useChangeThemeEffect = (
|
|
|
267
307
|
})
|
|
268
308
|
|
|
269
309
|
const disposeChangeListener = parentManager?.onChangeTheme((name, manager) => {
|
|
270
|
-
const force =
|
|
310
|
+
const force =
|
|
311
|
+
shouldUpdate?.() ||
|
|
312
|
+
props.deopt ||
|
|
313
|
+
// this fixes themeable() not updating with the new fastSchemeChange setting
|
|
314
|
+
(process.env.TAMAGUI_TARGET === 'native'
|
|
315
|
+
? props['disable-child-theme']
|
|
316
|
+
: undefined)
|
|
317
|
+
|
|
271
318
|
const doUpdate = force ?? Boolean(keys?.length || isNewTheme)
|
|
272
319
|
|
|
273
320
|
if (process.env.NODE_ENV === 'development' && props.debug) {
|
|
@@ -281,6 +328,7 @@ export const useChangeThemeEffect = (
|
|
|
281
328
|
keys,
|
|
282
329
|
})
|
|
283
330
|
}
|
|
331
|
+
|
|
284
332
|
if (doUpdate) {
|
|
285
333
|
setThemeState(createState)
|
|
286
334
|
}
|
|
@@ -367,7 +415,7 @@ export const useChangeThemeEffect = (
|
|
|
367
415
|
if (nextState) {
|
|
368
416
|
state = nextState
|
|
369
417
|
|
|
370
|
-
if (!prev.isNewTheme
|
|
418
|
+
if (!prev.isNewTheme) {
|
|
371
419
|
themeManager = getNewThemeManager()
|
|
372
420
|
} else {
|
|
373
421
|
themeManager.updateState(nextState)
|
package/src/setupReactNative.ts
CHANGED
|
@@ -3,20 +3,75 @@ import { StaticConfig } from './types'
|
|
|
3
3
|
const ReactNativeStaticConfigs = new WeakMap<any, Partial<StaticConfig> | null>()
|
|
4
4
|
|
|
5
5
|
export function getReactNativeConfig(Component: any) {
|
|
6
|
+
if (!Component) return
|
|
7
|
+
|
|
8
|
+
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
9
|
+
if (Component.getSizeWithHeaders) {
|
|
10
|
+
return RNConfigs.Image
|
|
11
|
+
}
|
|
12
|
+
if (Component.propTypes?.textBreakStrategy) {
|
|
13
|
+
return RNConfigs.Text
|
|
14
|
+
}
|
|
15
|
+
if (Component.propTypes?.onTextInput) {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
// can assume everything else is react native on native
|
|
19
|
+
return RNConfigs.default
|
|
20
|
+
} else {
|
|
21
|
+
if (Component.getSize && Component.prefetch) {
|
|
22
|
+
return RNConfigs.Image
|
|
23
|
+
}
|
|
24
|
+
if (Component.displayName === 'Text' && Component.render) {
|
|
25
|
+
return RNConfigs.Text
|
|
26
|
+
}
|
|
27
|
+
if (
|
|
28
|
+
Component.render &&
|
|
29
|
+
(Component.displayName === 'ScrollView' || Component.displayName === 'View')
|
|
30
|
+
) {
|
|
31
|
+
return RNConfigs.default
|
|
32
|
+
}
|
|
33
|
+
if (Component.State?.blurTextInput) {
|
|
34
|
+
return RNConfigs.TextInput
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
6
38
|
return ReactNativeStaticConfigs.get(Component)
|
|
7
39
|
}
|
|
8
40
|
|
|
41
|
+
const RNConfigs = {
|
|
42
|
+
Image: {
|
|
43
|
+
isReactNative: true,
|
|
44
|
+
inlineProps: new Set(['src', 'width', 'height']),
|
|
45
|
+
},
|
|
46
|
+
Text: {
|
|
47
|
+
isReactNative: true,
|
|
48
|
+
isText: true,
|
|
49
|
+
},
|
|
50
|
+
TextInput: {
|
|
51
|
+
isReactNative: true,
|
|
52
|
+
isInput: true,
|
|
53
|
+
isText: true,
|
|
54
|
+
},
|
|
55
|
+
default: {
|
|
56
|
+
isReactNative: true,
|
|
57
|
+
},
|
|
58
|
+
} satisfies Record<string, Partial<StaticConfig>>
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated this is no longer necessary, tamagui auto-detects RN views
|
|
62
|
+
*/
|
|
9
63
|
export function setupReactNative(rnExports: Record<string, any>) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
64
|
+
// no-op
|
|
65
|
+
// for (const key in rnExports) {
|
|
66
|
+
// if (key[0].toLowerCase() === key[0]) continue
|
|
67
|
+
// const val = rnExports[key]
|
|
68
|
+
// if (val && typeof val === 'object') {
|
|
69
|
+
// ReactNativeStaticConfigs.set(val, {
|
|
70
|
+
// isReactNative: true,
|
|
71
|
+
// isText: key === 'Text' || key === 'TextInput',
|
|
72
|
+
// isInput: key === 'TextInput' || key === 'TextArea',
|
|
73
|
+
// inlineProps: key === 'Image' ? new Set(['src', 'width', 'height']) : undefined,
|
|
74
|
+
// })
|
|
75
|
+
// }
|
|
76
|
+
// }
|
|
22
77
|
}
|
package/src/styled.tsx
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { stylePropsAll } from '@tamagui/helpers'
|
|
2
|
-
|
|
3
1
|
import { createComponent } from './createComponent'
|
|
4
2
|
import { StyledContext } from './helpers/createStyledContext'
|
|
5
3
|
import { mergeVariants } from './helpers/mergeVariants'
|
|
@@ -77,12 +75,14 @@ export function styled<
|
|
|
77
75
|
? ComponentIn
|
|
78
76
|
: parentStaticConfig?.Component || ComponentIn
|
|
79
77
|
|
|
80
|
-
const reactNativeConfig =
|
|
78
|
+
const reactNativeConfig = !parentStaticConfig
|
|
79
|
+
? getReactNativeConfig(Component)
|
|
80
|
+
: undefined
|
|
81
|
+
|
|
81
82
|
const isReactNative = Boolean(
|
|
82
83
|
reactNativeConfig ||
|
|
83
84
|
staticExtractionOptions?.isReactNative ||
|
|
84
|
-
parentStaticConfig?.isReactNative
|
|
85
|
-
getReactNativeConfig(parentStaticConfig?.Component)
|
|
85
|
+
parentStaticConfig?.isReactNative
|
|
86
86
|
)
|
|
87
87
|
|
|
88
88
|
const staticConfigProps = (() => {
|
package/src/types.tsx
CHANGED
|
@@ -518,6 +518,12 @@ export interface ThemeProps {
|
|
|
518
518
|
shallow?: boolean
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
+
// more low level
|
|
522
|
+
export type UseThemeWithStateProps = ThemeProps & {
|
|
523
|
+
deopt?: boolean
|
|
524
|
+
disable?: boolean
|
|
525
|
+
}
|
|
526
|
+
|
|
521
527
|
type ArrayIntersection<A extends any[]> = A[keyof A]
|
|
522
528
|
|
|
523
529
|
type GetAltThemeNames<S> =
|
|
@@ -603,6 +609,25 @@ type GenericTamaguiSettings = {
|
|
|
603
609
|
* @default false
|
|
604
610
|
*/
|
|
605
611
|
mediaPropOrder?: boolean
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* On iOS, this enables a mode where Tamagui returns color values using `DynamicColorIOS`
|
|
615
|
+
* This is a React Native built in feature, you can read the docs here:
|
|
616
|
+
* https://reactnative.dev/docs/dynamiccolorios
|
|
617
|
+
*
|
|
618
|
+
* We're working to make this enabled by default without any setting, but Tamagui themes
|
|
619
|
+
* support inversing and/or changing to light/dark at any point in the tree. We haven't implemented
|
|
620
|
+
* support for either of these cases when combined with this feature.
|
|
621
|
+
*
|
|
622
|
+
* So - as long as you:
|
|
623
|
+
*
|
|
624
|
+
* 1. Only use light/dark changes of themes at the root of your app
|
|
625
|
+
* 2. Don't use <Theme inverse> or themeInverse
|
|
626
|
+
* 3. Always change light/dark alongside the Appearance.colorSheme
|
|
627
|
+
*
|
|
628
|
+
* Then this feature is safe to turn on and will significantly speed up dark/light re-renders.
|
|
629
|
+
*/
|
|
630
|
+
fastSchemeChange?: boolean
|
|
606
631
|
}
|
|
607
632
|
|
|
608
633
|
export type TamaguiSettings = TamaguiConfig['settings']
|
package/src/views/Theme.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAaN,MAAM,OAAO,CAAA;AAsBd,OAAO,EAEL,SAAS,EAKT,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,gBAAgB,EAGhB,cAAc,EAEd,SAAS,
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAaN,MAAM,OAAO,CAAA;AAsBd,OAAO,EAEL,SAAS,EAKT,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,gBAAgB,EAGhB,cAAc,EAEd,SAAS,EAMV,MAAM,SAAS,CAAA;AAoBhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA6D3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,UAAU,GAAG,SAAS,GAAG,EAAE,EACtD,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EACjB,YAAY,EAAE,YAAY,4DAgrC3B;AAoBD,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,OAEjD;AAiBD,eAAO,MAAM,MAAM,0DAqCjB,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,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,mBAkGxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAEV,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,aAAa,EAMb,eAAe,EACf,YAAY,EAEZ,qBAAqB,EAErB,cAAc,EACd,WAAW,EAEZ,MAAM,UAAU,CAAA;AA6BjB,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;AAuB7B,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAEV,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,aAAa,EAMb,eAAe,EACf,YAAY,EAEZ,qBAAqB,EAErB,cAAc,EACd,WAAW,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+
{"version":3,"file":"propMapper.d.ts","sourceRoot":"","sources":["../../src/helpers/propMapper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EAGjB,qBAAqB,EAEtB,MAAM,UAAU,CAAA;AAOjB,eAAO,MAAM,UAAU,EAAE,UAqExB,CAAA;AAgGD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,qBAAqB,sBAkBtF;AAMD,eAAO,MAAM,uBAAuB,cAAe,GAAG,QAErD,CAAA;AAuID,eAAO,MAAM,cAAc,QACpB,MAAM,SACJ,MAAM,wDAED,QAAQ,aAAa,CAAC,QAyFnC,CAAA"}
|
|
@@ -66,6 +66,7 @@ export declare const useConfiguration: () => {
|
|
|
66
66
|
}) | undefined;
|
|
67
67
|
autocompleteSpecificTokens?: (boolean | "except-special") | undefined;
|
|
68
68
|
mediaPropOrder?: boolean | undefined;
|
|
69
|
+
fastSchemeChange?: boolean | undefined;
|
|
69
70
|
};
|
|
70
71
|
tokens: Omit<{
|
|
71
72
|
[x: string]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfiguration.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfiguration.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"useConfiguration.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfiguration.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ5B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Variable } from '../createVariable';
|
|
2
2
|
import { ThemeManager, ThemeManagerState } from '../helpers/ThemeManager';
|
|
3
|
-
import type { DebugProp, ThemeParsed, ThemeProps, VariableVal, VariableValGeneric } from '../types';
|
|
3
|
+
import type { DebugProp, ThemeParsed, ThemeProps, UseThemeWithStateProps, VariableVal, VariableValGeneric } from '../types';
|
|
4
4
|
export type ChangedThemeResponse = {
|
|
5
5
|
state?: ThemeManagerState;
|
|
6
6
|
themeManager?: ThemeManager | null;
|
|
@@ -14,8 +14,8 @@ export type UseThemeResult = {
|
|
|
14
14
|
[Key in keyof ThemeParsed]: ThemeGettable<ThemeParsed[Key]>;
|
|
15
15
|
};
|
|
16
16
|
export declare const useTheme: (props?: ThemeProps) => UseThemeResult;
|
|
17
|
-
export declare const useThemeWithState: (props:
|
|
18
|
-
export declare function getThemeProxied(theme:
|
|
17
|
+
export declare const useThemeWithState: (props: UseThemeWithStateProps) => [ChangedThemeResponse, ThemeParsed];
|
|
18
|
+
export declare function getThemeProxied({ theme, name }: ThemeManagerState, deopt?: boolean, themeManager?: ThemeManager, keys?: string[], debug?: DebugProp): UseThemeResult;
|
|
19
19
|
export declare const activeThemeManagers: Set<ThemeManager>;
|
|
20
|
-
export declare const useChangeThemeEffect: (props:
|
|
20
|
+
export declare const useChangeThemeEffect: (props: UseThemeWithStateProps, isRoot?: boolean, keys?: string[], shouldUpdate?: () => boolean | undefined) => ChangedThemeResponse;
|
|
21
21
|
//# sourceMappingURL=useTheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAe,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EACL,YAAY,EACZ,iBAAiB,EAElB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,UA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ticConfig } from './types';
|
|
2
|
-
export declare function getReactNativeConfig(Component: any): Partial<StaticConfig> |
|
|
2
|
+
export declare function getReactNativeConfig(Component: any): Partial<StaticConfig> | {
|
|
3
|
+
isReactNative: true;
|
|
4
|
+
} | null | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated this is no longer necessary, tamagui auto-detects RN views
|
|
7
|
+
*/
|
|
3
8
|
export declare function setupReactNative(rnExports: Record<string, any>): void;
|
|
4
9
|
//# sourceMappingURL=setupReactNative.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupReactNative.d.ts","sourceRoot":"","sources":["../src/setupReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAItC,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,GAAG
|
|
1
|
+
{"version":3,"file":"setupReactNative.d.ts","sourceRoot":"","sources":["../src/setupReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAItC,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,GAAG;;qBAkClD;AAqBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAc9D"}
|
package/types/styled.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,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shouldUpdate?: () => boolean | undefined;
|
|
326
326
|
shallow?: boolean;
|
|
327
327
|
}
|
|
328
|
+
export type UseThemeWithStateProps = ThemeProps & {
|
|
329
|
+
deopt?: boolean;
|
|
330
|
+
disable?: boolean;
|
|
331
|
+
};
|
|
328
332
|
type ArrayIntersection<A extends any[]> = A[keyof A];
|
|
329
333
|
type GetAltThemeNames<S> = (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S) | S;
|
|
330
334
|
type SpacerPropsBase = {
|
|
@@ -385,6 +389,24 @@ type GenericTamaguiSettings = {
|
|
|
385
389
|
* @default false
|
|
386
390
|
*/
|
|
387
391
|
mediaPropOrder?: boolean;
|
|
392
|
+
/**
|
|
393
|
+
* On iOS, this enables a mode where Tamagui returns color values using `DynamicColorIOS`
|
|
394
|
+
* This is a React Native built in feature, you can read the docs here:
|
|
395
|
+
* https://reactnative.dev/docs/dynamiccolorios
|
|
396
|
+
*
|
|
397
|
+
* We're working to make this enabled by default without any setting, but Tamagui themes
|
|
398
|
+
* support inversing and/or changing to light/dark at any point in the tree. We haven't implemented
|
|
399
|
+
* support for either of these cases when combined with this feature.
|
|
400
|
+
*
|
|
401
|
+
* So - as long as you:
|
|
402
|
+
*
|
|
403
|
+
* 1. Only use light/dark changes of themes at the root of your app
|
|
404
|
+
* 2. Don't use <Theme inverse> or themeInverse
|
|
405
|
+
* 3. Always change light/dark alongside the Appearance.colorSheme
|
|
406
|
+
*
|
|
407
|
+
* Then this feature is safe to turn on and will significantly speed up dark/light re-renders.
|
|
408
|
+
*/
|
|
409
|
+
fastSchemeChange?: boolean;
|
|
388
410
|
};
|
|
389
411
|
export type TamaguiSettings = TamaguiConfig['settings'];
|
|
390
412
|
export type CreateTamaguiProps = {
|