@tamagui/web 1.20.4 → 1.20.6
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 +48 -36
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/helpers/createPropMapper.js +7 -14
- package/dist/cjs/helpers/createPropMapper.js.map +1 -1
- package/dist/cjs/helpers/createProxy.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +11 -0
- package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
- package/dist/cjs/helpers/useShallowSetState.js +8 -20
- package/dist/cjs/helpers/useShallowSetState.js.map +1 -1
- package/dist/cjs/hooks/useTheme.js.map +1 -1
- package/dist/esm/createComponent.js +55 -38
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createComponent.mjs +55 -38
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/helpers/createPropMapper.js +6 -12
- package/dist/esm/helpers/createPropMapper.js.map +1 -1
- package/dist/esm/helpers/createPropMapper.mjs +6 -12
- package/dist/esm/helpers/createPropMapper.mjs.map +1 -1
- package/dist/esm/helpers/createProxy.js.map +1 -1
- package/dist/esm/helpers/createProxy.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +11 -0
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +11 -0
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/useShallowSetState.js +9 -21
- package/dist/esm/helpers/useShallowSetState.js.map +1 -1
- package/dist/esm/helpers/useShallowSetState.mjs +9 -21
- package/dist/esm/helpers/useShallowSetState.mjs.map +1 -1
- package/dist/esm/hooks/useTheme.js.map +1 -1
- package/dist/esm/hooks/useTheme.mjs.map +1 -1
- package/package.json +9 -9
- package/src/createComponent.tsx +82 -44
- package/src/helpers/createPropMapper.ts +4 -12
- package/src/helpers/createProxy.ts +0 -1
- package/src/helpers/getSplitStyles.tsx +13 -0
- package/src/helpers/useShallowSetState.tsx +9 -23
- package/src/hooks/useTheme.tsx +0 -2
- package/src/types.tsx +6 -3
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +1 -2
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/createProxy.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/useShallowSetState.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/types.d.ts.map +1 -1
package/src/createComponent.tsx
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { useComposedRefs } from '@tamagui/compose-refs'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isClient,
|
|
4
|
+
isRSC,
|
|
5
|
+
isServer,
|
|
6
|
+
isWeb,
|
|
7
|
+
useIsomorphicLayoutEffect,
|
|
8
|
+
} from '@tamagui/constants'
|
|
3
9
|
import { stylePropsView, validPseudoKeys, validStyles } from '@tamagui/helpers'
|
|
4
10
|
import React, {
|
|
5
11
|
Children,
|
|
@@ -12,7 +18,6 @@ import React, {
|
|
|
12
18
|
useEffect,
|
|
13
19
|
useId,
|
|
14
20
|
useRef,
|
|
15
|
-
useState,
|
|
16
21
|
} from 'react'
|
|
17
22
|
|
|
18
23
|
import { onConfiguredOnce } from './config.js'
|
|
@@ -49,8 +54,6 @@ import {
|
|
|
49
54
|
UseAnimationProps,
|
|
50
55
|
} from './types'
|
|
51
56
|
import { Slot } from './views/Slot.js'
|
|
52
|
-
import { Stack } from './views/Stack.js'
|
|
53
|
-
import { Text } from './views/Text.js'
|
|
54
57
|
import { useThemedChildren } from './views/Theme.js'
|
|
55
58
|
import { ThemeDebug } from './views/ThemeDebug'
|
|
56
59
|
|
|
@@ -120,6 +123,8 @@ let BaseText: any
|
|
|
120
123
|
let BaseView: any
|
|
121
124
|
let hasSetupBaseViews = false
|
|
122
125
|
|
|
126
|
+
const numRenderedOfType: Record<string, number> = {}
|
|
127
|
+
|
|
123
128
|
export function createComponent<
|
|
124
129
|
ComponentPropTypes extends Object = {},
|
|
125
130
|
Ref = TamaguiElement,
|
|
@@ -195,7 +200,10 @@ export function createComponent<
|
|
|
195
200
|
*/
|
|
196
201
|
const animationsConfig = useAnimationDriver()
|
|
197
202
|
const useAnimations = animationsConfig?.useAnimations as UseAnimationHook | undefined
|
|
198
|
-
|
|
203
|
+
|
|
204
|
+
// after we get states mount we need to turn off isAnimated for server side
|
|
205
|
+
const willBeAnimated = (() => {
|
|
206
|
+
if (isServer) return false
|
|
199
207
|
const next = !!(
|
|
200
208
|
!staticConfig.isHOC &&
|
|
201
209
|
useAnimations &&
|
|
@@ -206,6 +214,47 @@ export function createComponent<
|
|
|
206
214
|
}
|
|
207
215
|
return next || stateRef.current.hasAnimated
|
|
208
216
|
})()
|
|
217
|
+
|
|
218
|
+
const usePresence = animationsConfig?.usePresence
|
|
219
|
+
const presence = !isRSC && willBeAnimated && usePresence ? usePresence() : null
|
|
220
|
+
|
|
221
|
+
const hasEnterStyle = !!props.enterStyle
|
|
222
|
+
const needsMount = Boolean((isWeb ? isClient : true) && willBeAnimated)
|
|
223
|
+
|
|
224
|
+
const states = useServerState<TamaguiComponentState>(
|
|
225
|
+
needsMount ? defaultComponentState! : defaultComponentStateMounted!
|
|
226
|
+
)
|
|
227
|
+
const state = propsIn.forceStyle
|
|
228
|
+
? { ...states[0], [propsIn.forceStyle]: true }
|
|
229
|
+
: states[0]
|
|
230
|
+
const setState = states[1]
|
|
231
|
+
const setStateShallow = useShallowSetState(setState, debugProp, componentName)
|
|
232
|
+
|
|
233
|
+
// cheat code
|
|
234
|
+
let hasHydrated = false
|
|
235
|
+
numRenderedOfType[componentName] ??= 0
|
|
236
|
+
if (willBeAnimated) {
|
|
237
|
+
if (
|
|
238
|
+
++numRenderedOfType[componentName] >
|
|
239
|
+
(process.env.TAMAGUI_ANIMATED_PRESENCE_HYDRATION_CUTOFF
|
|
240
|
+
? +process.env.TAMAGUI_ANIMATED_PRESENCE_HYDRATION_CUTOFF
|
|
241
|
+
: 5)
|
|
242
|
+
) {
|
|
243
|
+
hasHydrated = true
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let isAnimated = willBeAnimated
|
|
248
|
+
|
|
249
|
+
// presence avoids ssr stuff
|
|
250
|
+
if (presence && hasHydrated) {
|
|
251
|
+
// no
|
|
252
|
+
} else {
|
|
253
|
+
if (isAnimated && (isServer || state.unmounted === true)) {
|
|
254
|
+
isAnimated = false
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
209
258
|
const componentClassName = props.asChild
|
|
210
259
|
? ''
|
|
211
260
|
: props.componentName
|
|
@@ -234,22 +283,6 @@ export function createComponent<
|
|
|
234
283
|
: (isAnimated ? AnimatedView : null) || BaseViewComponent
|
|
235
284
|
|
|
236
285
|
const avoidClassesWhileAnimating = animationsConfig?.isReactNative
|
|
237
|
-
const hasEnterStyle = !!props.enterStyle
|
|
238
|
-
const needsMount = Boolean(
|
|
239
|
-
(isWeb ? isClient : true) && (hasEnterStyle || props.animation)
|
|
240
|
-
)
|
|
241
|
-
const states = useServerState<TamaguiComponentState>(
|
|
242
|
-
needsMount ? defaultComponentState! : defaultComponentStateMounted!
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
const state = propsIn.forceStyle
|
|
246
|
-
? { ...states[0], [propsIn.forceStyle]: true }
|
|
247
|
-
: states[0]
|
|
248
|
-
const setState = states[1]
|
|
249
|
-
const setStateShallow = useShallowSetState(setState, debugProp, componentName)
|
|
250
|
-
|
|
251
|
-
const usePresence = animationsConfig?.usePresence
|
|
252
|
-
const presence = !isRSC && isAnimated && usePresence ? usePresence() : null
|
|
253
286
|
|
|
254
287
|
// set enter/exit variants onto our new props object
|
|
255
288
|
if (isAnimated && presence) {
|
|
@@ -269,14 +302,14 @@ export function createComponent<
|
|
|
269
302
|
|
|
270
303
|
const shouldAvoidClasses =
|
|
271
304
|
!isWeb ||
|
|
272
|
-
!!(
|
|
305
|
+
!!(isAnimated && avoidClassesWhileAnimating) ||
|
|
273
306
|
!staticConfig.acceptsClassName
|
|
274
307
|
const shouldForcePseudo = !!propsIn.forceStyle
|
|
275
308
|
const noClassNames = shouldAvoidClasses || shouldForcePseudo
|
|
276
309
|
|
|
277
310
|
// internal use only
|
|
278
311
|
const disableTheme =
|
|
279
|
-
(props['data-disable-theme'] && !
|
|
312
|
+
(props['data-disable-theme'] && !willBeAnimated) || staticConfig.isHOC
|
|
280
313
|
|
|
281
314
|
const themeStateProps = {
|
|
282
315
|
name: props.theme,
|
|
@@ -315,7 +348,10 @@ export function createComponent<
|
|
|
315
348
|
const banner = `${name}${dataIs ? ` ${dataIs}` : ''} ${type} id ${id}`
|
|
316
349
|
const parentsLog = (conf: StaticConfig) =>
|
|
317
350
|
conf.parentNames ? ` (${conf.parentNames?.join(' > ')})` : ''
|
|
318
|
-
console.group(
|
|
351
|
+
console.group(
|
|
352
|
+
`%c ${banner}${parentsLog(staticConfig)} (unmounted: ${state.unmounted})`,
|
|
353
|
+
'background: yellow;'
|
|
354
|
+
)
|
|
319
355
|
if (!isServer) {
|
|
320
356
|
// rome-ignore lint/nursery/noConsoleLog: <explanation>
|
|
321
357
|
console.log({
|
|
@@ -326,6 +362,7 @@ export function createComponent<
|
|
|
326
362
|
themeStateProps,
|
|
327
363
|
themeState,
|
|
328
364
|
})
|
|
365
|
+
console.warn(themeState.name)
|
|
329
366
|
}
|
|
330
367
|
}
|
|
331
368
|
}
|
|
@@ -338,9 +375,8 @@ export function createComponent<
|
|
|
338
375
|
...state,
|
|
339
376
|
mediaState,
|
|
340
377
|
noClassNames,
|
|
341
|
-
dynamicStylesInline: noClassNames,
|
|
342
378
|
hasTextAncestor,
|
|
343
|
-
resolveVariablesAs: 'auto',
|
|
379
|
+
resolveVariablesAs: isAnimated ? 'value' : 'auto',
|
|
344
380
|
isExiting,
|
|
345
381
|
},
|
|
346
382
|
null,
|
|
@@ -408,19 +444,22 @@ export function createComponent<
|
|
|
408
444
|
// once you set animation prop don't remove it, you can set to undefined/false
|
|
409
445
|
// reason is animations are heavy - no way around it, and must be run inline here (🙅 loading as a sub-component)
|
|
410
446
|
let animationStyles: any
|
|
411
|
-
if (!isRSC &&
|
|
447
|
+
if (!isRSC && willBeAnimated && useAnimations && !staticConfig.isHOC) {
|
|
412
448
|
const animations = useAnimations({
|
|
413
449
|
props: propsWithAnimation,
|
|
414
450
|
style: splitStylesStyle,
|
|
415
451
|
presence,
|
|
416
452
|
state,
|
|
453
|
+
theme: themeState.theme,
|
|
417
454
|
pseudos: pseudos || null,
|
|
418
455
|
onDidAnimate: props.onDidAnimate,
|
|
419
456
|
hostRef,
|
|
420
457
|
staticConfig,
|
|
421
458
|
})
|
|
422
|
-
if (
|
|
423
|
-
|
|
459
|
+
if (isAnimated) {
|
|
460
|
+
if (animations) {
|
|
461
|
+
animationStyles = animations.style
|
|
462
|
+
}
|
|
424
463
|
}
|
|
425
464
|
}
|
|
426
465
|
|
|
@@ -462,7 +501,12 @@ export function createComponent<
|
|
|
462
501
|
}
|
|
463
502
|
|
|
464
503
|
// if react-native-web view just pass all props down
|
|
465
|
-
if (
|
|
504
|
+
if (
|
|
505
|
+
process.env.TAMAGUI_TARGET === 'web' &&
|
|
506
|
+
!isReactNative &&
|
|
507
|
+
!willBeAnimated &&
|
|
508
|
+
!asChild
|
|
509
|
+
) {
|
|
466
510
|
viewProps = hooks.usePropsTransform?.(elementType, nonTamaguiProps, hostRef)
|
|
467
511
|
} else {
|
|
468
512
|
viewProps = nonTamaguiProps
|
|
@@ -490,26 +534,20 @@ export function createComponent<
|
|
|
490
534
|
})
|
|
491
535
|
}, [setStateShallow])
|
|
492
536
|
|
|
493
|
-
|
|
494
|
-
|
|
537
|
+
const shouldSetMounted = needsMount && state.unmounted
|
|
538
|
+
|
|
539
|
+
// combinined two effects into one for performance so be careful with logic
|
|
540
|
+
// because no need for mouseUp removal effect if its not even mounted yet
|
|
541
|
+
useIsomorphicLayoutEffect(() => {
|
|
542
|
+
if (!shouldSetMounted) {
|
|
495
543
|
return () => {
|
|
496
544
|
mouseUps.delete(unPress)
|
|
497
545
|
}
|
|
498
|
-
}, [])
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
const shouldSetMounted = needsMount && state.unmounted
|
|
502
|
-
useEffect(() => {
|
|
503
|
-
if (!shouldSetMounted) return
|
|
504
|
-
if (state.unmounted === true && needsMount) {
|
|
505
|
-
setStateShallow({
|
|
506
|
-
unmounted: false,
|
|
507
|
-
})
|
|
508
|
-
return
|
|
509
546
|
}
|
|
510
547
|
|
|
548
|
+
const unmounted = state.unmounted === true && hasEnterStyle ? 'should-enter' : false
|
|
511
549
|
setStateShallow({
|
|
512
|
-
unmounted
|
|
550
|
+
unmounted,
|
|
513
551
|
})
|
|
514
552
|
}, [shouldSetMounted, state.unmounted])
|
|
515
553
|
|
|
@@ -26,10 +26,6 @@ export type ResolveVariableTypes =
|
|
|
26
26
|
| 'both'
|
|
27
27
|
| 'non-color-value'
|
|
28
28
|
|
|
29
|
-
export const getReturnVariablesAs = (props: any, state: Partial<SplitStyleState>) => {
|
|
30
|
-
return !!props.animation || state.resolveVariablesAs === 'value' ? 'value' : 'auto'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
export const createPropMapper = (staticConfig: StaticConfigParsed) => {
|
|
34
30
|
const variants = staticConfig.variants || {}
|
|
35
31
|
|
|
@@ -57,7 +53,7 @@ export const createPropMapper = (staticConfig: StaticConfigParsed) => {
|
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
const props = state.fallbackProps || propsIn
|
|
60
|
-
const returnVariablesAs =
|
|
56
|
+
const returnVariablesAs = state.resolveVariablesAs === 'value' ? 'value' : 'auto'
|
|
61
57
|
|
|
62
58
|
// handled here because we need to resolve this off tokens, its the only one-off like this
|
|
63
59
|
const fontFamily =
|
|
@@ -177,13 +173,9 @@ const resolveVariants: StyleResolver = (
|
|
|
177
173
|
if (!variantValue) {
|
|
178
174
|
// variant at key exists, but no matching variant value, return nothing
|
|
179
175
|
if (process.env.NODE_ENV === 'development') {
|
|
180
|
-
if (staticConfig.validStyles?.[key])
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (typeof value === 'boolean') {
|
|
184
|
-
// don't warn on missing boolean values, common to only one of true/false
|
|
185
|
-
return null
|
|
186
|
-
}
|
|
176
|
+
if (staticConfig.validStyles?.[key]) return
|
|
177
|
+
// don't warn on missing boolean values, common to only one of true/false
|
|
178
|
+
if (typeof value === 'boolean') return
|
|
187
179
|
const name = staticConfig.componentName || '[UnnamedComponent]'
|
|
188
180
|
console.warn(
|
|
189
181
|
`No variant found: ${name} has variant "${key}", but no matching value "${value}"`
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export function createProxy<A extends object>(target: A, handler: ProxyHandler<A>) {
|
|
2
2
|
if (process.env.NODE_ENV === 'development') {
|
|
3
3
|
if (typeof target !== 'object' || !target) {
|
|
4
|
-
// rome-ignore lint/nursery/noConsoleLog: ok
|
|
5
4
|
console.warn(
|
|
6
5
|
'Invalid object given for proxy:',
|
|
7
6
|
target,
|
|
@@ -605,6 +605,19 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
605
605
|
debug
|
|
606
606
|
)
|
|
607
607
|
|
|
608
|
+
if (process.env.NODE_ENV === 'development' && debug === 'verbose') {
|
|
609
|
+
console.groupCollapsed(' 🔹 styles', keyInit, valInit)
|
|
610
|
+
// rome-ignore lint/nursery/noConsoleLog: <explanation>
|
|
611
|
+
console.log({
|
|
612
|
+
expanded,
|
|
613
|
+
state,
|
|
614
|
+
isVariant,
|
|
615
|
+
shouldPassProp,
|
|
616
|
+
isHOCShouldPassThrough,
|
|
617
|
+
parentHasVariant,
|
|
618
|
+
})
|
|
619
|
+
}
|
|
620
|
+
|
|
608
621
|
if (!fontFamily) {
|
|
609
622
|
fontFamily = getPropMappedFontFamily(expanded)
|
|
610
623
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback } from 'react'
|
|
2
2
|
|
|
3
3
|
import { DebugProp, TamaguiComponentState } from '../types.js'
|
|
4
4
|
|
|
@@ -9,32 +9,18 @@ export function useShallowSetState<State extends TamaguiComponentState>(
|
|
|
9
9
|
) {
|
|
10
10
|
return useCallback(
|
|
11
11
|
(next: Partial<State>) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
setter((prev) => {
|
|
18
|
-
for (const key in next) {
|
|
19
|
-
if (prev[key] !== next[key]) {
|
|
20
|
-
if (process.env.NODE_ENV === 'development' && debug === 'verbose') {
|
|
21
|
-
// rome-ignore lint/nursery/noConsoleLog: ok
|
|
22
|
-
console.log(` ▲ setState ${debugName}`, next)
|
|
23
|
-
}
|
|
24
|
-
return { ...prev, ...next }
|
|
12
|
+
setter((prev) => {
|
|
13
|
+
for (const key in next) {
|
|
14
|
+
if (prev[key] !== next[key]) {
|
|
15
|
+
if (process.env.NODE_ENV === 'development' && debug === 'verbose') {
|
|
16
|
+
console.warn(` ▲ setState ${debugName}`, next)
|
|
25
17
|
}
|
|
18
|
+
return { ...prev, ...next }
|
|
26
19
|
}
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
}
|
|
21
|
+
return prev
|
|
29
22
|
})
|
|
30
23
|
},
|
|
31
24
|
[setter]
|
|
32
25
|
)
|
|
33
26
|
}
|
|
34
|
-
|
|
35
|
-
const transitionKeys = new Set<keyof TamaguiComponentState>([
|
|
36
|
-
'press',
|
|
37
|
-
'pressIn',
|
|
38
|
-
'focus',
|
|
39
|
-
'unmounted',
|
|
40
|
-
])
|
package/src/hooks/useTheme.tsx
CHANGED
|
@@ -4,13 +4,11 @@ import { useContext, useEffect, useLayoutEffect, useMemo, useState } from 'react
|
|
|
4
4
|
|
|
5
5
|
import { getConfig } from '../config.js'
|
|
6
6
|
import { isDevTools } from '../constants/isDevTools.js'
|
|
7
|
-
import { isVariable } from '../createVariable.js'
|
|
8
7
|
import { createProxy } from '../helpers/createProxy.js'
|
|
9
8
|
import {
|
|
10
9
|
ThemeManager,
|
|
11
10
|
ThemeManagerState,
|
|
12
11
|
getNonComponentParentManager,
|
|
13
|
-
hasNoThemeUpdatingProps,
|
|
14
12
|
} from '../helpers/ThemeManager.js'
|
|
15
13
|
import { ThemeManagerContext } from '../helpers/ThemeManagerContext.js'
|
|
16
14
|
import type { ThemeParsed, ThemeProps } from '../types.js'
|
package/src/types.tsx
CHANGED
|
@@ -1500,7 +1500,7 @@ export type TamaguiComponentState = {
|
|
|
1500
1500
|
press: boolean
|
|
1501
1501
|
pressIn: boolean
|
|
1502
1502
|
focus: boolean
|
|
1503
|
-
unmounted: boolean
|
|
1503
|
+
unmounted: boolean | 'should-enter'
|
|
1504
1504
|
animation?: null | {
|
|
1505
1505
|
style?: any
|
|
1506
1506
|
avoidClasses?: boolean
|
|
@@ -1510,7 +1510,6 @@ export type TamaguiComponentState = {
|
|
|
1510
1510
|
export type SplitStyleState = TamaguiComponentState & {
|
|
1511
1511
|
mediaState?: Record<string, boolean>
|
|
1512
1512
|
noClassNames?: boolean
|
|
1513
|
-
dynamicStylesInline?: boolean
|
|
1514
1513
|
resolveVariablesAs?: ResolveVariableTypes
|
|
1515
1514
|
fallbackProps?: Record<string, any>
|
|
1516
1515
|
hasTextAncestor?: boolean
|
|
@@ -1602,6 +1601,7 @@ export type UseAnimationHook = (props: {
|
|
|
1602
1601
|
hostRef: RefObject<HTMLElement | View>
|
|
1603
1602
|
staticConfig: StaticConfigParsed
|
|
1604
1603
|
state: SplitStyleState
|
|
1604
|
+
theme: ThemeParsed
|
|
1605
1605
|
pseudos: PseudoProps<ViewStyle> | null
|
|
1606
1606
|
onDidAnimate?: any
|
|
1607
1607
|
delay?: number
|
|
@@ -1676,4 +1676,7 @@ type NarrowRaw<A> =
|
|
|
1676
1676
|
export type Narrow<A extends any> = Try<A, [], NarrowRaw<A>>
|
|
1677
1677
|
|
|
1678
1678
|
export type NativePlatform = 'web' | 'mobile' | 'android' | 'ios'
|
|
1679
|
-
export type NativeValue<Platform extends NativePlatform = NativePlatform> =
|
|
1679
|
+
export type NativeValue<Platform extends NativePlatform = NativePlatform> =
|
|
1680
|
+
| boolean
|
|
1681
|
+
| Platform
|
|
1682
|
+
| Platform[]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AASA,OAAO,KAWN,MAAM,OAAO,CAAA;AAkBd,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAEhB,qBAAqB,EAErB,cAAc,EAIf,MAAM,SAAS,CAAA;AAoBhB,eAAO,MAAM,qBAAqB,EAAE,qBAMnC,CAAA;AAeD,eAAO,MAAM,QAAQ,eAAsB,CAAA;AAgC3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,GAAG,EAAE,EACtC,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EAEjB,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,EACpD,eAAe,CAAC,EAAE,iBAAiB,wDA81BpC;AAGD,eAAO,MAAM,QAAQ;YAAW;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE;;CAAmB,CAAA;AAMrE,eAAO,MAAM,MAAM,sDA8CjB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAAA;IACnC,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,6 +1,5 @@
|
|
|
1
|
-
import type { PropMapper,
|
|
1
|
+
import type { PropMapper, StaticConfigParsed, TamaguiInternalConfig } from '../types.js';
|
|
2
2
|
export type ResolveVariableTypes = 'auto' | 'value' | 'variable' | 'both' | 'non-color-value';
|
|
3
|
-
export declare const getReturnVariablesAs: (props: any, state: Partial<SplitStyleState>) => "auto" | "value";
|
|
4
3
|
export declare const createPropMapper: (staticConfig: StaticConfigParsed) => PropMapper;
|
|
5
4
|
export declare function getFontFamilyFromNameOrVariable(input: any, conf: TamaguiInternalConfig): string | undefined;
|
|
6
5
|
export declare const getPropMappedFontFamily: (expanded?: any) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPropMapper.d.ts","sourceRoot":"","sources":["../../src/helpers/createPropMapper.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAGV,UAAU,
|
|
1
|
+
{"version":3,"file":"createPropMapper.d.ts","sourceRoot":"","sources":["../../src/helpers/createPropMapper.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAGV,UAAU,EAEV,kBAAkB,EAClB,qBAAqB,EAEtB,MAAM,aAAa,CAAA;AAQpB,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,OAAO,GACP,UAAU,GACV,MAAM,GACN,iBAAiB,CAAA;AAErB,eAAO,MAAM,gBAAgB,iBAAkB,kBAAkB,eAsGhE,CAAA;AA0GD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,qBAAqB,sBA2BtF;AAMD,eAAO,MAAM,uBAAuB,cAAe,GAAG,QAErD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createProxy.d.ts","sourceRoot":"","sources":["../../src/helpers/createProxy.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"createProxy.d.ts","sourceRoot":"","sources":["../../src/helpers/createProxy.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,KAchF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,EAMd,eAAe,EACf,kBAAkB,EAElB,qBAAqB,EACrB,cAAc,EACd,WAAW,EAEZ,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gCAAgC,CAAA;AAkBvC,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,cAAc,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,YAAY,EAAE,kBAAkB,CAAA;IAChC,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,KAAK,EAAE,eAAe,CAAA;IACtB,IAAI,EAAE,qBAAqB,CAAA;IAC3B,eAAe,CAAC,EAAE,iBAAiB,CAAA;IACnC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AA0FhE,KAAK,aAAa,GAAG,CACnB,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC7B,YAAY,EAAE,kBAAkB,EAChC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,eAAe,EACtB,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,EACzC,eAAe,CAAC,EAAE,mBAAmB,EAErC,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,SAAS,KACd,cAAc,CAAA;AAEnB,eAAO,MAAM,UAAU,MAAM,CAAA;AAqB7B,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,EAMd,eAAe,EACf,kBAAkB,EAElB,qBAAqB,EACrB,cAAc,EACd,WAAW,EAEZ,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gCAAgC,CAAA;AAkBvC,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,cAAc,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,YAAY,EAAE,kBAAkB,CAAA;IAChC,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,KAAK,EAAE,eAAe,CAAA;IACtB,IAAI,EAAE,qBAAqB,CAAA;IAC3B,eAAe,CAAC,EAAE,iBAAiB,CAAA;IACnC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AA0FhE,KAAK,aAAa,GAAG,CACnB,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC7B,YAAY,EAAE,kBAAkB,EAChC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,eAAe,EACtB,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,EACzC,eAAe,CAAC,EAAE,mBAAmB,EAErC,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,SAAS,KACd,cAAc,CAAA;AAEnB,eAAO,MAAM,UAAU,MAAM,CAAA;AAqB7B,eAAO,MAAM,cAAc,EAAE,aAs1B5B,CAAA;AA0FD,eAAO,MAAM,WAAW,eACV,aAAa,UACjB,MAAM,WACL,MAAM,sBACK,OAAO,wBACL,OAAO,KAC5B,cAkCF,CAAA;AAOD,eAAO,MAAM,cAAc,EAAE,aAU5B,CAAA;AA2BD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShallowSetState.d.ts","sourceRoot":"","sources":["../../src/helpers/useShallowSetState.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useShallowSetState.d.ts","sourceRoot":"","sources":["../../src/helpers/useShallowSetState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE9D,wBAAgB,kBAAkB,CAAC,KAAK,SAAS,qBAAqB,EACpE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EACnD,KAAK,CAAC,EAAE,SAAS,EACjB,SAAS,CAAC,EAAE,MAAM,UAGT,QAAQ,KAAK,CAAC,UAexB"}
|
|
@@ -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":"AAOA,OAAO,EACL,YAAY,EAGb,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAI1D,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAoBD,eAAO,MAAM,QAAQ,WAAW,UAAU,KAAgB,WAEzD,CAAA;AAED,eAAO,MAAM,iBAAiB,UAAW,UAAU;;gBA7BrC,OAAO;kBACL,YAAY,GAAG,IAAI;UAC3B,MAAM;;QAoEb,CAAA;AAED,wBAAgB,eAAe,CAC7B,EACE,KAAK,EACL,YAAY,GACb,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG;IACjC,KAAK,EAAE,WAAW,CAAA;CACnB,EACD,IAAI,CAAC,EAAE,MAAM,EAAE,eA2ChB;AAED,eAAO,MAAM,mBAAmB,mBAA0B,CAAA;AAE1D,eAAO,MAAM,oBAAoB,UACxB,UAAU,yBAEV,MAAM,EAAE,kBACC,MAAM,OAAO,KAC5B,oBA8NF,CAAA"}
|
package/types/types.d.ts
CHANGED
|
@@ -677,7 +677,7 @@ export type TamaguiComponentState = {
|
|
|
677
677
|
press: boolean;
|
|
678
678
|
pressIn: boolean;
|
|
679
679
|
focus: boolean;
|
|
680
|
-
unmounted: boolean;
|
|
680
|
+
unmounted: boolean | 'should-enter';
|
|
681
681
|
animation?: null | {
|
|
682
682
|
style?: any;
|
|
683
683
|
avoidClasses?: boolean;
|
|
@@ -686,7 +686,6 @@ export type TamaguiComponentState = {
|
|
|
686
686
|
export type SplitStyleState = TamaguiComponentState & {
|
|
687
687
|
mediaState?: Record<string, boolean>;
|
|
688
688
|
noClassNames?: boolean;
|
|
689
|
-
dynamicStylesInline?: boolean;
|
|
690
689
|
resolveVariablesAs?: ResolveVariableTypes;
|
|
691
690
|
fallbackProps?: Record<string, any>;
|
|
692
691
|
hasTextAncestor?: boolean;
|
|
@@ -754,6 +753,7 @@ export type UseAnimationHook = (props: {
|
|
|
754
753
|
hostRef: RefObject<HTMLElement | View>;
|
|
755
754
|
staticConfig: StaticConfigParsed;
|
|
756
755
|
state: SplitStyleState;
|
|
756
|
+
theme: ThemeParsed;
|
|
757
757
|
pseudos: PseudoProps<ViewStyle> | null;
|
|
758
758
|
onDidAnimate?: any;
|
|
759
759
|
delay?: number;
|