@tamagui/web 2.2.0 → 2.3.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/.turbo/turbo-build.log +1 -1
- package/dist/cjs/config.cjs +3 -0
- package/dist/cjs/config.native.js +3 -0
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/createComponent.cjs +26 -5
- package/dist/cjs/createComponent.native.js +30 -5
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/helpers/expandStyle.native.js +3 -3
- package/dist/cjs/helpers/expandStyle.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/isTamaguiElement.native.js.map +1 -1
- package/dist/cjs/helpers/mainThreadPressEvents.native.js +14 -3
- package/dist/cjs/helpers/mainThreadPressEvents.native.js.map +1 -1
- package/dist/cjs/hooks/getThemeProxied.native.js.map +1 -1
- package/dist/cjs/hooks/useComponentState.cjs +4 -2
- package/dist/cjs/hooks/useComponentState.native.js +5 -3
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
- package/dist/cjs/opacityModifier.test-d.cjs +36 -0
- package/dist/cjs/opacityModifier.test-d.native.js +39 -0
- package/dist/cjs/opacityModifier.test-d.native.js.map +1 -0
- package/dist/esm/config.mjs +3 -0
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +3 -0
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/createComponent.mjs +23 -6
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +31 -6
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createVariables.mjs.map +1 -1
- package/dist/esm/createVariables.native.js.map +1 -1
- package/dist/esm/helpers/expandStyle.native.js +3 -3
- package/dist/esm/helpers/expandStyle.native.js.map +1 -1
- package/dist/esm/helpers/mainThreadPressEvents.native.js +14 -3
- package/dist/esm/helpers/mainThreadPressEvents.native.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +5 -3
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +6 -4
- package/dist/esm/hooks/useComponentState.native.js.map +1 -1
- package/dist/esm/opacityModifier.test-d.mjs +37 -0
- package/dist/esm/opacityModifier.test-d.mjs.map +1 -0
- package/dist/esm/opacityModifier.test-d.native.js +37 -0
- package/dist/esm/opacityModifier.test-d.native.js.map +1 -0
- package/dist/esm/views/Slot.mjs.map +1 -1
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/package.json +13 -13
- package/src/config.ts +4 -1
- package/src/createComponent.tsx +67 -5
- package/src/helpers/mainThreadPressEvents.native.ts +20 -2
- package/src/hooks/useComponentState.ts +17 -2
- package/src/opacityModifier.test-d.ts +65 -0
- package/src/types.tsx +19 -3
- package/types/config.d.ts.map +1 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/mainThreadPressEvents.native.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts +1 -0
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/types.d.ts +6 -3
- package/types/types.d.ts.map +1 -1
package/src/createComponent.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { composeRefs } from '@tamagui/compose-refs'
|
|
2
2
|
import {
|
|
3
|
+
getPlatformDriver,
|
|
3
4
|
isClient,
|
|
4
5
|
isNativeDesktop,
|
|
5
6
|
isServer,
|
|
@@ -445,6 +446,7 @@ export function createComponent<
|
|
|
445
446
|
outputStyle,
|
|
446
447
|
willBeAnimated,
|
|
447
448
|
willBeAnimatedClient,
|
|
449
|
+
platformPseudo,
|
|
448
450
|
startedUnhydrated,
|
|
449
451
|
} = componentState
|
|
450
452
|
|
|
@@ -457,6 +459,25 @@ export function createComponent<
|
|
|
457
459
|
// `nextState`, clear it. if they diverge (animated components' fast path never
|
|
458
460
|
// calls into React), flush via componentState.setStateShallow here.
|
|
459
461
|
useIsomorphicLayoutEffect(() => {
|
|
462
|
+
// first: refresh the emitter latch while a self pseudo is active. the driver
|
|
463
|
+
// keeps the last-emitted snapshot latched across re-renders (so an unrelated
|
|
464
|
+
// render doesn't snap a hovered style back to base), but a render can change
|
|
465
|
+
// the styles that FEED the pseudo merge — e.g. a row becoming active removes
|
|
466
|
+
// its hoverStyle while still hovered — and the stale snapshot would keep
|
|
467
|
+
// painting over the new base (hover-beats-active-during-scrub).
|
|
468
|
+
// `updateStyleListener` is rebuilt each render over fresh props/state and
|
|
469
|
+
// reads `nextState || state`, so re-invoking it re-emits the correct merged
|
|
470
|
+
// style: identical values when the render was truly unrelated (no visual
|
|
471
|
+
// change), fresh values when it wasn't. gate on the last-EMITTED pseudo state
|
|
472
|
+
// (prevPseudoState), not React state — React state can lag the emitter by a
|
|
473
|
+
// commit, and a stale-true `state.hover` here would resurrect a hover the
|
|
474
|
+
// emitter already cleared. this must run BEFORE the nextState flush below so
|
|
475
|
+
// the re-emit still sees the freshest pseudo state.
|
|
476
|
+
const emitted = stateRef.current.prevPseudoState
|
|
477
|
+
if (emitted && (emitted.hover || emitted.press || emitted.focus)) {
|
|
478
|
+
stateRef.current.updateStyleListener?.()
|
|
479
|
+
}
|
|
480
|
+
|
|
460
481
|
const pendingState = stateRef.current.nextState
|
|
461
482
|
if (!pendingState) return
|
|
462
483
|
stateRef.current.nextState = undefined
|
|
@@ -466,6 +487,24 @@ export function createComponent<
|
|
|
466
487
|
})
|
|
467
488
|
}
|
|
468
489
|
|
|
490
|
+
// renderer-driven pseudo states (setupPlatformDriver): the platform resolves
|
|
491
|
+
// hover natively per hitbox and pushes flips here, replacing the
|
|
492
|
+
// mouseEnter/mouseLeave lane on such renderers. the flip applies through the
|
|
493
|
+
// same setStateShallow the event handlers use — under the (driver-opened)
|
|
494
|
+
// avoidReRenders gate that's the emitter path: zero React commits, animated
|
|
495
|
+
// per the declared transition or instant by default. press stays on the
|
|
496
|
+
// responder event path (it must fire onPress anyway); the driver only owns
|
|
497
|
+
// the hover trigger for now.
|
|
498
|
+
useIsomorphicLayoutEffect(() => {
|
|
499
|
+
if (!platformPseudo || props.disabled) return
|
|
500
|
+
const pseudoDriver = getPlatformDriver()?.pseudo
|
|
501
|
+
const host = stateRef.current.host
|
|
502
|
+
if (!pseudoDriver || !host) return
|
|
503
|
+
return pseudoDriver.subscribe(host, ({ hovered }) => {
|
|
504
|
+
stateRef.current.setStateShallow?.({ hover: hovered })
|
|
505
|
+
})
|
|
506
|
+
}, [platformPseudo, props.disabled])
|
|
507
|
+
|
|
469
508
|
// create new context with groups, or else sublings will grab the same one
|
|
470
509
|
const allGroupContexts = useMemo((): AllGroupContexts | null => {
|
|
471
510
|
if (!groupName || props.passThrough) {
|
|
@@ -742,7 +781,7 @@ export function createComponent<
|
|
|
742
781
|
|
|
743
782
|
if (
|
|
744
783
|
!isPassthrough &&
|
|
745
|
-
(hasAnimationProp || groupName) &&
|
|
784
|
+
(hasAnimationProp || groupName || platformPseudo) &&
|
|
746
785
|
animationDriver?.avoidReRenders &&
|
|
747
786
|
!hasEnterExitTransition
|
|
748
787
|
) {
|
|
@@ -790,13 +829,30 @@ export function createComponent<
|
|
|
790
829
|
stateRef.current.prevPseudoState,
|
|
791
830
|
updatedState,
|
|
792
831
|
nextStyles?.pseudoTransitions,
|
|
793
|
-
|
|
832
|
+
// platform-pseudo with no declared transition = instant (CSS :hover semantics)
|
|
833
|
+
props.transition ?? (platformPseudo ? '0ms' : undefined)
|
|
794
834
|
)
|
|
795
835
|
|
|
796
836
|
// update prev state for next comparison (includes group states)
|
|
797
837
|
stateRef.current.prevPseudoState = extractPseudoState(updatedState)
|
|
798
838
|
|
|
799
|
-
|
|
839
|
+
// a self pseudo being active means the emitted style is a transient hover/press/focus
|
|
840
|
+
// override (it's not in React state under avoidReRenders), so the worklet must keep it
|
|
841
|
+
// latched across incidental re-renders; when none is active this is the base and renders
|
|
842
|
+
// own it again.
|
|
843
|
+
const hasActivePseudo = Boolean(
|
|
844
|
+
updatedState.hover ||
|
|
845
|
+
updatedState.press ||
|
|
846
|
+
updatedState.pressIn ||
|
|
847
|
+
updatedState.focus ||
|
|
848
|
+
updatedState.focusWithin
|
|
849
|
+
)
|
|
850
|
+
|
|
851
|
+
useStyleListener(
|
|
852
|
+
(nextStyles?.style || {}) as any,
|
|
853
|
+
effectiveTransition,
|
|
854
|
+
hasActivePseudo
|
|
855
|
+
)
|
|
800
856
|
}
|
|
801
857
|
|
|
802
858
|
function updateGroupListeners() {
|
|
@@ -1011,7 +1067,8 @@ export function createComponent<
|
|
|
1011
1067
|
stateRef.current.prevPseudoState,
|
|
1012
1068
|
state,
|
|
1013
1069
|
splitStyles?.pseudoTransitions,
|
|
1014
|
-
|
|
1070
|
+
// platform-pseudo with no declared transition = instant (CSS :hover semantics)
|
|
1071
|
+
props.transition ?? (platformPseudo ? '0ms' : undefined)
|
|
1015
1072
|
)
|
|
1016
1073
|
|
|
1017
1074
|
// add effectiveTransition to splitStyles for drivers to consume
|
|
@@ -1254,7 +1311,12 @@ export function createComponent<
|
|
|
1254
1311
|
)
|
|
1255
1312
|
|
|
1256
1313
|
const runtimeHoverStyle = !disabled && noClass && pseudos?.hoverStyle
|
|
1257
|
-
|
|
1314
|
+
// with a platform pseudo driver the hover STATE is driver-sourced; only keep
|
|
1315
|
+
// the JS hover listeners when something else needs them (dynamic group
|
|
1316
|
+
// children, or the user's own onMouseEnter/Leave handlers below).
|
|
1317
|
+
const needsHoverState = Boolean(
|
|
1318
|
+
hasDynamicGroupChildren || (runtimeHoverStyle && !platformPseudo)
|
|
1319
|
+
)
|
|
1258
1320
|
const attachHover =
|
|
1259
1321
|
(isWeb || isNativeDesktop) &&
|
|
1260
1322
|
!!(hasDynamicGroupChildren || needsHoverState || onMouseEnter || onMouseLeave)
|
|
@@ -80,9 +80,23 @@ export function useMainThreadPressEvents(
|
|
|
80
80
|
ref.current.longPressTimer = null
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
// user-supplied responder props (the View's raw RN gesture API) must keep
|
|
84
|
+
// working: blindly overwriting them here silently killed any press-hold-drag
|
|
85
|
+
// gesture built on onResponderMove/onResponderRelease whenever the element
|
|
86
|
+
// also had hover/press events. compose instead — user handler first, then
|
|
87
|
+
// the press synthesis.
|
|
88
|
+
const userStartShouldSet = viewProps.onStartShouldSetResponder
|
|
89
|
+
const userGrant = viewProps.onResponderGrant
|
|
90
|
+
const userRelease = viewProps.onResponderRelease
|
|
91
|
+
const userTerminate = viewProps.onResponderTerminate
|
|
92
|
+
const userTerminationRequest = viewProps.onResponderTerminationRequest
|
|
93
|
+
const userMove = viewProps.onResponderMove
|
|
94
|
+
|
|
95
|
+
viewProps.onStartShouldSetResponder = (e: any) =>
|
|
96
|
+
Boolean(userStartShouldSet?.(e)) || !events.disabled
|
|
84
97
|
|
|
85
98
|
viewProps.onResponderGrant = (e: any) => {
|
|
99
|
+
userGrant?.(e)
|
|
86
100
|
cleanup()
|
|
87
101
|
ref.current.state = 'pressing'
|
|
88
102
|
|
|
@@ -103,6 +117,7 @@ export function useMainThreadPressEvents(
|
|
|
103
117
|
}
|
|
104
118
|
|
|
105
119
|
viewProps.onResponderRelease = (e: any) => {
|
|
120
|
+
userRelease?.(e)
|
|
106
121
|
const wasLongPressed = ref.current.state === 'longPressed'
|
|
107
122
|
cleanup()
|
|
108
123
|
|
|
@@ -120,6 +135,7 @@ export function useMainThreadPressEvents(
|
|
|
120
135
|
}
|
|
121
136
|
|
|
122
137
|
viewProps.onResponderTerminate = (e: any) => {
|
|
138
|
+
userTerminate?.(e)
|
|
123
139
|
cleanup()
|
|
124
140
|
if (ref.current.state === 'active' || ref.current.state === 'longPressed') {
|
|
125
141
|
deactivate(e)
|
|
@@ -127,11 +143,13 @@ export function useMainThreadPressEvents(
|
|
|
127
143
|
ref.current.state = 'idle'
|
|
128
144
|
}
|
|
129
145
|
|
|
130
|
-
viewProps.onResponderTerminationRequest = () => {
|
|
146
|
+
viewProps.onResponderTerminationRequest = (e: any) => {
|
|
147
|
+
if (userTerminationRequest) return userTerminationRequest(e)
|
|
131
148
|
return events.cancelable !== false
|
|
132
149
|
}
|
|
133
150
|
|
|
134
151
|
viewProps.onResponderMove = (e: any) => {
|
|
152
|
+
userMove?.(e)
|
|
135
153
|
events.onPressMove?.(e)
|
|
136
154
|
}
|
|
137
155
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isServer, isWeb } from '@tamagui/constants'
|
|
1
|
+
import { getPlatformDriver, isServer, isWeb } from '@tamagui/constants'
|
|
2
2
|
import { useCreateShallowSetState } from '@tamagui/is-equal-shallow'
|
|
3
3
|
import { useDidFinishSSR, useIsClientOnly } from '@tamagui/use-did-finish-ssr'
|
|
4
4
|
import { useRef, useState } from 'react'
|
|
@@ -63,8 +63,22 @@ export const useComponentState = (
|
|
|
63
63
|
curStateRef.hasAnimated = true
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
// a renderer platform driver with native pseudo states (react-native-gpui)
|
|
67
|
+
// makes ANY component with runtime pseudo styles ride the animation-driver
|
|
68
|
+
// emitter path — no per-site transition/animation prop required. the flip is
|
|
69
|
+
// driver-sourced (hover) or event-sourced (press/focus) but either way applies
|
|
70
|
+
// through the emitter with zero React commits; with no transition declared it
|
|
71
|
+
// resolves instant (see createComponent's effectiveTransition default).
|
|
72
|
+
const platformPseudo = Boolean(
|
|
73
|
+
!isHOC &&
|
|
74
|
+
useAnimations &&
|
|
75
|
+
animationDriver?.avoidReRenders &&
|
|
76
|
+
getPlatformDriver()?.pseudo &&
|
|
77
|
+
('hoverStyle' in props || 'pressStyle' in props || 'focusStyle' in props)
|
|
78
|
+
)
|
|
79
|
+
|
|
66
80
|
const willBeAnimatedClient = (() => {
|
|
67
|
-
const next = !!(hasAnimationProp && !isHOC && useAnimations)
|
|
81
|
+
const next = !!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations)
|
|
68
82
|
return Boolean(next || curStateRef.hasAnimated)
|
|
69
83
|
})()
|
|
70
84
|
|
|
@@ -247,6 +261,7 @@ export const useComponentState = (
|
|
|
247
261
|
outputStyle,
|
|
248
262
|
willBeAnimated,
|
|
249
263
|
willBeAnimatedClient,
|
|
264
|
+
platformPseudo,
|
|
250
265
|
}
|
|
251
266
|
}
|
|
252
267
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* type tests for the opacity modifier syntax (e.g., $color/50)
|
|
3
|
+
*
|
|
4
|
+
* the runtime already supports this syntax in getTokenForKey, but the types
|
|
5
|
+
* were not accepting it. these tests verify that color tokens with opacity
|
|
6
|
+
* modifiers are now type-safe.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { expectTypeOf, describe, test } from 'vitest'
|
|
10
|
+
import type { ColorTokens, FontColorTokens, GetThemeValueForKey } from './types'
|
|
11
|
+
|
|
12
|
+
type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
|
|
13
|
+
type ColorTokenKey = `color${Digit}${Digit}${Digit}`
|
|
14
|
+
|
|
15
|
+
describe('opacity modifier types', () => {
|
|
16
|
+
test('ColorTokens accepts opacity modifier syntax', () => {
|
|
17
|
+
// should accept token with opacity modifier
|
|
18
|
+
const colorWithOpacity: ColorTokens = '$color/50'
|
|
19
|
+
const colorWithFullOpacity: ColorTokens = '$color/100'
|
|
20
|
+
const colorWithLowOpacity: ColorTokens = '$color/10'
|
|
21
|
+
|
|
22
|
+
// should still accept regular tokens
|
|
23
|
+
const regularToken: ColorTokens = '$color'
|
|
24
|
+
const colorName: ColorTokens = 'red'
|
|
25
|
+
|
|
26
|
+
expectTypeOf(colorWithOpacity).toMatchTypeOf<ColorTokens>()
|
|
27
|
+
expectTypeOf(colorWithFullOpacity).toMatchTypeOf<ColorTokens>()
|
|
28
|
+
expectTypeOf(colorWithLowOpacity).toMatchTypeOf<ColorTokens>()
|
|
29
|
+
expectTypeOf(regularToken).toMatchTypeOf<ColorTokens>()
|
|
30
|
+
expectTypeOf(colorName).toMatchTypeOf<ColorTokens>()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('FontColorTokens accepts opacity modifier syntax', () => {
|
|
34
|
+
const fontColorNumber: FontColorTokens = 42
|
|
35
|
+
const fontColorWithOpacity: FontColorTokens = '$bodyColor/50'
|
|
36
|
+
|
|
37
|
+
expectTypeOf(fontColorNumber).toMatchTypeOf<FontColorTokens>()
|
|
38
|
+
expectTypeOf(fontColorWithOpacity).toMatchTypeOf<FontColorTokens>()
|
|
39
|
+
expectTypeOf<number>().toMatchTypeOf<FontColorTokens>()
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
test('opacity modifier requires token prefix', () => {
|
|
43
|
+
const validOpacity: ColorTokens = '$color/75'
|
|
44
|
+
expectTypeOf(validOpacity).toMatchTypeOf<ColorTokens>()
|
|
45
|
+
|
|
46
|
+
// @ts-expect-error opacity modifiers only apply to token-like values.
|
|
47
|
+
const cssColorWithOpacity: ColorTokens = 'red/75'
|
|
48
|
+
expectTypeOf(cssColorWithOpacity).toMatchTypeOf<ColorTokens>()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('color props accept opacity without expanding large token unions', () => {
|
|
52
|
+
type LargeColorTokens = `$${ColorTokenKey}` | ColorTokens
|
|
53
|
+
|
|
54
|
+
const colorToken: LargeColorTokens = '$color123'
|
|
55
|
+
const colorTokenWithOpacity: LargeColorTokens = '$color123/50'
|
|
56
|
+
const propColorTokenWithOpacity: GetThemeValueForKey<'backgroundColor'> =
|
|
57
|
+
'$color123/50'
|
|
58
|
+
|
|
59
|
+
expectTypeOf(colorToken).toMatchTypeOf<LargeColorTokens>()
|
|
60
|
+
expectTypeOf(colorTokenWithOpacity).toMatchTypeOf<LargeColorTokens>()
|
|
61
|
+
expectTypeOf(propColorTokenWithOpacity).toMatchTypeOf<
|
|
62
|
+
GetThemeValueForKey<'backgroundColor'>
|
|
63
|
+
>()
|
|
64
|
+
})
|
|
65
|
+
})
|
package/src/types.tsx
CHANGED
|
@@ -1699,11 +1699,21 @@ export type SpaceTokens =
|
|
|
1699
1699
|
| GetTokenString<keyof Tokens['space']>
|
|
1700
1700
|
| ThemeValueFallbackSpace
|
|
1701
1701
|
|
|
1702
|
-
|
|
1702
|
+
// base color token strings (before opacity modifier)
|
|
1703
|
+
type ColorTokenBase =
|
|
1703
1704
|
| SpecificTokensSpecial
|
|
1704
1705
|
| GetTokenString<keyof Tokens['color']>
|
|
1705
1706
|
| GetTokenString<keyof ThemeParsed>
|
|
1707
|
+
|
|
1708
|
+
// keep this non-expanded. using `${ColorTokenBase}/${number}` preserves stricter
|
|
1709
|
+
// token names, but large user token/theme unions hit TS2590.
|
|
1710
|
+
type TokenWithOpacity = `$${string}/${number}`
|
|
1711
|
+
|
|
1712
|
+
export type ColorTokens =
|
|
1713
|
+
| ColorTokenBase
|
|
1706
1714
|
| CSSColorNames
|
|
1715
|
+
// opacity modifier: $token/50 → parsed at runtime in getTokenForKey
|
|
1716
|
+
| TokenWithOpacity
|
|
1707
1717
|
|
|
1708
1718
|
export type ZIndexTokens =
|
|
1709
1719
|
| SpecificTokensSpecial
|
|
@@ -1769,7 +1779,9 @@ export type FontWeightValues =
|
|
|
1769
1779
|
| 'bold'
|
|
1770
1780
|
| 'normal'
|
|
1771
1781
|
export type FontWeightTokens = `$${GetTokenFontKeysFor<'weight'>}` | FontWeightValues
|
|
1772
|
-
|
|
1782
|
+
// font color tokens also support the opacity modifier
|
|
1783
|
+
type FontColorTokenBase = `$${GetTokenFontKeysFor<'color'>}`
|
|
1784
|
+
export type FontColorTokens = FontColorTokenBase | number | TokenWithOpacity
|
|
1773
1785
|
export type FontLetterSpacingTokens =
|
|
1774
1786
|
| `$${GetTokenFontKeysFor<'letterSpacing'>}`
|
|
1775
1787
|
| number
|
|
@@ -3253,7 +3265,11 @@ export type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>
|
|
|
3253
3265
|
|
|
3254
3266
|
type UseStyleListener = (
|
|
3255
3267
|
nextStyle: Record<string, unknown>,
|
|
3256
|
-
effectiveTransition?: TransitionProp | null
|
|
3268
|
+
effectiveTransition?: TransitionProp | null,
|
|
3269
|
+
// true while a self pseudo (hover/press/focus) is active. lets avoidReRenders drivers know
|
|
3270
|
+
// the emitted style is a transient pseudo override that a real re-render must not be allowed
|
|
3271
|
+
// to reconcile away, vs the no-pseudo base which renders own again.
|
|
3272
|
+
pseudoActive?: boolean
|
|
3257
3273
|
) => void
|
|
3258
3274
|
export type UseStyleEmitter = (cb: UseStyleListener) => void
|
|
3259
3275
|
|
package/types/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EAEf,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,EACL,MAAM,EACN,YAAY,EACb,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,cAAc,GAAG,KAAK,CAAA;AAoD3D,eAAO,MAAM,UAAU,GAAI,GAAG,SAAS,MAAM,sBAAsB,EACjE,KAAK,GAAG,KACP,sBAAsB,CAAC,GAAG,CAU5B,CAAA;AAED,wBAAgB,cAAc,IAAI,WAAW,CAG5C;AAED,eAAO,MAAM,SAAS,GAAI,MAAM,qBAAqB,SAIpD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,MAAM,GAAG,EAAE,YAAY,GAAG,SAOrE,CAAA;AAED,eAAO,MAAM,SAAS,6BAUrB,CAAA;AAED,eAAO,MAAM,cAAc,oCAE1B,CAAA;AAGD,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,QAExC;AAED,eAAO,MAAM,SAAS,GAAI,gBAEvB;IACD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACd,KAAG,YASR,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,MAAM,oCAUhE,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,MAAM,EAAE,qBAAmB,QAG/E,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,KAAK,GAAG,OAAO,GAAG,MAAM,EAAE,QAAQ,MAAM,MAAM,QAGlF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,mBAzCnB;IACD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,KAAQ,YAoCyB,CAAA;AAElC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CAA6C,CAAA;AAEnE,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,EAAE,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EAEf,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,EACL,MAAM,EACN,YAAY,EACb,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,cAAc,GAAG,KAAK,CAAA;AAoD3D,eAAO,MAAM,UAAU,GAAI,GAAG,SAAS,MAAM,sBAAsB,EACjE,KAAK,GAAG,KACP,sBAAsB,CAAC,GAAG,CAU5B,CAAA;AAED,wBAAgB,cAAc,IAAI,WAAW,CAG5C;AAED,eAAO,MAAM,SAAS,GAAI,MAAM,qBAAqB,SAIpD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,MAAM,GAAG,EAAE,YAAY,GAAG,SAOrE,CAAA;AAED,eAAO,MAAM,SAAS,6BAUrB,CAAA;AAED,eAAO,MAAM,cAAc,oCAE1B,CAAA;AAGD,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,QAExC;AAED,eAAO,MAAM,SAAS,GAAI,gBAEvB;IACD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACd,KAAG,YASR,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,MAAM,oCAUhE,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,MAAM,EAAE,qBAAmB,QAG/E,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,KAAK,GAAG,OAAO,GAAG,MAAM,EAAE,QAAQ,MAAM,MAAM,QAGlF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,mBAzCnB;IACD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,KAAQ,YAoCyB,CAAA;AAElC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CAA6C,CAAA;AAEnE,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,EAAE,OAAO,GAAG,SAOnD,CAAA;AAGD,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,4DAQnC,CAAA;AAED,KAAK,SAAS,GAAG;IACf,UAAU,CAAC,EACP,OAAO,GACP;QACE,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACN,CAAA;AAED,eAAO,IAAI,SAAS,EAAE,SAAS,GAAG,SAAS,CAAA;AAE3C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,QAIvC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,QAyBxE"}
|
|
@@ -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":"AAYA,OAAO,KAA2C,MAAM,OAAO,CAAA;AA6B/D,OAAO,KAAK,EAQV,YAAY,EAEZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EAOf,MAAM,SAAS,CAAA;AAahB,KAAK,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAEpF,eAAO,MAAM,kBAAkB,wBAA+B,CAAA;AA8J9D,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACnD,GAAG,SAAS,cAAc,GAAG,cAAc,EAC3C,SAAS,GAAG,KAAK,EACjB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,YAAY,EAAE,YAAY,wEA+lD3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mainThreadPressEvents.native.d.ts","sourceRoot":"","sources":["../../src/helpers/mainThreadPressEvents.native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,GAAG,EACX,SAAS,EAAE,GAAG,EACd,OAAO,UAAO,EACd,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"mainThreadPressEvents.native.d.ts","sourceRoot":"","sources":["../../src/helpers/mainThreadPressEvents.native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,GAAG,EACX,SAAS,EAAE,GAAG,EACd,OAAO,UAAO,EACd,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,QA2H1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComponentState.d.ts","sourceRoot":"","sources":["../../src/hooks/useComponentState.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,SAAS,EAEV,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,eAAO,MAAM,iBAAiB,GAC5B,OAAO,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClD,iBAAiB,iBAAiB,CAAC,iBAAiB,CAAC,EACrD,cAAc,YAAY,EAC1B,QAAQ,qBAAqB
|
|
1
|
+
{"version":3,"file":"useComponentState.d.ts","sourceRoot":"","sources":["../../src/hooks/useComponentState.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,SAAS,EAEV,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,eAAO,MAAM,iBAAiB,GAC5B,OAAO,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClD,iBAAiB,iBAAiB,CAAC,iBAAiB,CAAC,EACrD,cAAc,YAAY,EAC1B,QAAQ,qBAAqB;;;;;;;;;;;;;;;;;;;;;;CA8O9B,CAAA"}
|
package/types/types.d.ts
CHANGED
|
@@ -983,7 +983,9 @@ export type SpecificTokensSpecial = TamaguiSettings extends {
|
|
|
983
983
|
} ? Val extends 'except-special' | undefined ? never : SpecificTokens : SpecificTokens;
|
|
984
984
|
export type SizeTokens = SpecificTokensSpecial | ThemeValueFallbackSize | GetTokenString<keyof Tokens['size']>;
|
|
985
985
|
export type SpaceTokens = SpecificTokensSpecial | GetTokenString<keyof Tokens['space']> | ThemeValueFallbackSpace;
|
|
986
|
-
|
|
986
|
+
type ColorTokenBase = SpecificTokensSpecial | GetTokenString<keyof Tokens['color']> | GetTokenString<keyof ThemeParsed>;
|
|
987
|
+
type TokenWithOpacity = `$${string}/${number}`;
|
|
988
|
+
export type ColorTokens = ColorTokenBase | CSSColorNames | TokenWithOpacity;
|
|
987
989
|
export type ZIndexTokens = SpecificTokensSpecial | GetTokenString<keyof Tokens['zIndex']> | ThemeValueFallbackZIndex | number;
|
|
988
990
|
export type RadiusTokens = SpecificTokensSpecial | GetTokenString<keyof Tokens['radius']> | ThemeValueFallbackRadius | number | RemString;
|
|
989
991
|
export type NonSpecificTokens = GetTokenString<keyof Tokens['radius']> | GetTokenString<keyof Tokens['zIndex']> | GetTokenString<keyof Tokens['color']> | GetTokenString<keyof Tokens['space']> | GetTokenString<keyof Tokens['size']>;
|
|
@@ -1001,7 +1003,8 @@ export type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | numbe
|
|
|
1001
1003
|
export type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number | RemString;
|
|
1002
1004
|
export type FontWeightValues = `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00` | 'bold' | 'normal';
|
|
1003
1005
|
export type FontWeightTokens = `$${GetTokenFontKeysFor<'weight'>}` | FontWeightValues;
|
|
1004
|
-
|
|
1006
|
+
type FontColorTokenBase = `$${GetTokenFontKeysFor<'color'>}`;
|
|
1007
|
+
export type FontColorTokens = FontColorTokenBase | number | TokenWithOpacity;
|
|
1005
1008
|
export type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number | RemString;
|
|
1006
1009
|
export type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | RNTextStyle['fontStyle'];
|
|
1007
1010
|
export type FontTransformTokens = `$${GetTokenFontKeysFor<'transform'>}` | RNTextStyle['textTransform'];
|
|
@@ -1850,7 +1853,7 @@ export type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {
|
|
|
1850
1853
|
Text?: any;
|
|
1851
1854
|
};
|
|
1852
1855
|
export type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>;
|
|
1853
|
-
type UseStyleListener = (nextStyle: Record<string, unknown>, effectiveTransition?: TransitionProp | null) => void;
|
|
1856
|
+
type UseStyleListener = (nextStyle: Record<string, unknown>, effectiveTransition?: TransitionProp | null, pseudoActive?: boolean) => void;
|
|
1854
1857
|
export type UseStyleEmitter = (cb: UseStyleListener) => void;
|
|
1855
1858
|
export type UseAnimationHook = (props: {
|
|
1856
1859
|
style: Record<string, any>;
|