@tamagui/web 2.3.3 → 2.4.0
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/createComponent.native.js +1 -1
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +5 -0
- package/dist/cjs/helpers/getSplitStyles.native.js +9 -0
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/pointerEvents.native.js +26 -20
- package/dist/cjs/helpers/pointerEvents.native.js.map +1 -1
- package/dist/cjs/hooks/useComponentState.cjs +25 -1
- package/dist/cjs/hooks/useComponentState.native.js +25 -1
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
- package/dist/cjs/hooks/useMedia.cjs +107 -42
- package/dist/cjs/hooks/useMedia.native.js +149 -60
- package/dist/cjs/hooks/useMedia.native.js.map +1 -1
- package/dist/cjs/hooks/useTheme.cjs +17 -4
- package/dist/cjs/hooks/useTheme.native.js +18 -4
- package/dist/cjs/hooks/useTheme.native.js.map +1 -1
- package/dist/cjs/hooks/useThemeState.cjs +132 -67
- package/dist/cjs/hooks/useThemeState.native.js +144 -70
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.native.js +2 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/views/Theme.cjs +1 -1
- package/dist/cjs/views/Theme.native.js +1 -1
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/esm/createComponent.native.js +2 -2
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +5 -0
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +9 -0
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/pointerEvents.native.js +26 -20
- package/dist/esm/helpers/pointerEvents.native.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +26 -2
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +26 -2
- package/dist/esm/hooks/useComponentState.native.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +108 -43
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +150 -61
- package/dist/esm/hooks/useMedia.native.js.map +1 -1
- package/dist/esm/hooks/useTheme.mjs +17 -4
- package/dist/esm/hooks/useTheme.mjs.map +1 -1
- package/dist/esm/hooks/useTheme.native.js +18 -4
- package/dist/esm/hooks/useTheme.native.js.map +1 -1
- package/dist/esm/hooks/useThemeState.mjs +133 -68
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +145 -71
- package/dist/esm/hooks/useThemeState.native.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/views/Theme.mjs +1 -1
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +1 -1
- package/dist/esm/views/Theme.native.js.map +1 -1
- package/package.json +13 -13
- package/src/createComponent.tsx +8 -2
- package/src/helpers/getSplitStyles.tsx +33 -0
- package/src/helpers/pointerEvents.native.ts +26 -19
- package/src/hooks/useComponentState.ts +39 -2
- package/src/hooks/useMedia.tsx +147 -42
- package/src/hooks/useTheme.tsx +27 -5
- package/src/hooks/useThemeState.ts +263 -137
- package/src/index.ts +7 -1
- package/src/types.tsx +53 -5
- package/src/views/Theme.tsx +4 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/pointerEvents.native.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts +1 -1
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/hooks/useThemeState.d.ts +1 -1
- package/types/hooks/useThemeState.d.ts.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +3 -1
- package/types/types.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { supportsDynamicColorIOS, useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
2
2
|
import {
|
|
3
3
|
createContext,
|
|
4
|
-
useCallback,
|
|
5
4
|
useContext,
|
|
5
|
+
useEffect,
|
|
6
6
|
useId,
|
|
7
|
-
|
|
7
|
+
useReducer,
|
|
8
|
+
useRef,
|
|
8
9
|
type MutableRefObject,
|
|
9
10
|
} from 'react'
|
|
10
11
|
import { getConfig, getSetting } from '../config'
|
|
@@ -54,11 +55,22 @@ export const getRootThemeState = () => rootThemeState
|
|
|
54
55
|
// extracts base name without scheme: "light_red_surface1" -> "red_surface1"
|
|
55
56
|
const getThemeBaseName = (name: string) => name.replace(/^(light|dark)_/, '')
|
|
56
57
|
|
|
58
|
+
// useReducer-based force-update; cheaper than useSyncExternalStore's internal
|
|
59
|
+
// useState+useLayoutEffect+useEffect+useDebugValue chain on Hermes.
|
|
60
|
+
const incReducer = (c: number): number => c + 1
|
|
61
|
+
|
|
57
62
|
export const useThemeState = (
|
|
58
63
|
props: UseThemeWithStateProps,
|
|
59
64
|
isRoot = false,
|
|
60
65
|
keys: MutableRefObject<Set<string> | null>,
|
|
61
|
-
schemeKeys?: MutableRefObject<Set<string> | null
|
|
66
|
+
schemeKeys?: MutableRefObject<Set<string> | null>,
|
|
67
|
+
// when true, install the propsKey-watching useIsomorphicLayoutEffect that
|
|
68
|
+
// schedules descendant updates via listenersByParent[id]. Only <Theme>
|
|
69
|
+
// providers actually push their themeState.id into ThemeStateContext, so
|
|
70
|
+
// only they can have descendants subscribed under their id. Leaf styled
|
|
71
|
+
// components pass false (the default) and save one hook slot per mount.
|
|
72
|
+
// Stable per call-site (rule of hooks satisfied).
|
|
73
|
+
cascadeOnChange = false
|
|
62
74
|
): ThemeState => {
|
|
63
75
|
'use no memo'
|
|
64
76
|
|
|
@@ -86,148 +98,257 @@ Looked for theme${props.name ? ` "${props.name}"` : ''}${props.componentName ? `
|
|
|
86
98
|
)
|
|
87
99
|
}
|
|
88
100
|
|
|
101
|
+
// useId keeps theme-provider ids tied to the React tree. A process-wide
|
|
102
|
+
// counter can let children observe a provider context id whose matching
|
|
103
|
+
// states Map entry was never populated in multi-root/native surfaces.
|
|
89
104
|
const id = useId()
|
|
90
|
-
const subscribe = useCallback(
|
|
91
|
-
(cb: Function) => {
|
|
92
|
-
listenersByParent[parentId] = listenersByParent[parentId] || new Set()
|
|
93
|
-
listenersByParent[parentId].add(id)
|
|
94
|
-
allListeners.set(id, () => {
|
|
95
|
-
PendingUpdate.set(id, shouldForce ? 'force' : true)
|
|
96
|
-
cb()
|
|
97
|
-
})
|
|
98
|
-
return () => {
|
|
99
|
-
allListeners.delete(id)
|
|
100
|
-
listenersByParent[parentId].delete(id)
|
|
101
|
-
localStates.delete(id)
|
|
102
|
-
states.delete(id)
|
|
103
|
-
PendingUpdate.delete(id)
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
[id, parentId]
|
|
107
|
-
)
|
|
108
|
-
|
|
109
105
|
const propsKey = getPropsKey(props)
|
|
110
106
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
parentState &&
|
|
119
|
-
(local as any)._parentName === parentState.name &&
|
|
120
|
-
(local as any)._propsKey === propsKey
|
|
121
|
-
) {
|
|
122
|
-
return local
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// check if this is a scheme-only change (light↔dark) where DynamicColorIOS handles it
|
|
127
|
-
const isSchemeOnlyChange =
|
|
128
|
-
process.env.TAMAGUI_TARGET === 'native' &&
|
|
129
|
-
supportsDynamicColorIOS &&
|
|
130
|
-
getSetting('fastSchemeChange') &&
|
|
131
|
-
local &&
|
|
132
|
-
parentState &&
|
|
133
|
-
local.scheme !== parentState.scheme &&
|
|
134
|
-
getThemeBaseName(local.name) === getThemeBaseName(parentState.name)
|
|
135
|
-
|
|
136
|
-
// all tracked keys are scheme-optimized = can skip re-render for scheme changes
|
|
137
|
-
const keysSize = keys?.current?.size ?? 0
|
|
138
|
-
const schemeKeysSize = schemeKeys?.current?.size ?? 0
|
|
139
|
-
const allKeysSchemeOptimized = schemeKeysSize === keysSize && keysSize > 0
|
|
140
|
-
|
|
141
|
-
const canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized
|
|
142
|
-
|
|
143
|
-
const needsUpdate = props.passThrough
|
|
144
|
-
? false
|
|
145
|
-
: isRoot || props.name === 'light' || props.name === 'dark' || props.name === null
|
|
146
|
-
? true
|
|
147
|
-
: !HasRenderedOnce.get(keys)
|
|
148
|
-
? true
|
|
149
|
-
: canSkipForSchemeChange
|
|
150
|
-
? false // skip re-render for scheme-only changes with DynamicColorIOS
|
|
151
|
-
: keys?.current?.size
|
|
152
|
-
? true
|
|
153
|
-
: props.needsUpdate?.()
|
|
154
|
-
|
|
155
|
-
const [rerender, next] = getNextState(
|
|
156
|
-
local,
|
|
107
|
+
// stable ref-bag for render inputs and the optional subscription cleanup.
|
|
108
|
+
// lastSnap caches the last getSnapshot result for the subscription bailout.
|
|
109
|
+
const ref = useRef<ThemeStateRef>(null as any)
|
|
110
|
+
if (!ref.current) {
|
|
111
|
+
ref.current = {
|
|
112
|
+
id,
|
|
113
|
+
parentId,
|
|
157
114
|
props,
|
|
158
115
|
propsKey,
|
|
159
116
|
isRoot,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
117
|
+
keys,
|
|
118
|
+
schemeKeys,
|
|
119
|
+
renderVersion: 0,
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
// refresh latest values for the stable closures to read
|
|
123
|
+
ref.current.props = props
|
|
124
|
+
ref.current.propsKey = propsKey
|
|
125
|
+
ref.current.isRoot = isRoot
|
|
126
|
+
ref.current.keys = keys
|
|
127
|
+
ref.current.schemeKeys = schemeKeys
|
|
128
|
+
ref.current.parentId = parentId
|
|
129
|
+
}
|
|
130
|
+
ref.current.renderVersion++
|
|
165
131
|
|
|
166
|
-
|
|
132
|
+
if (process.env.NODE_ENV === 'development' && globalThis.time)
|
|
133
|
+
globalThis.time`theme-prep-uses`
|
|
167
134
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
135
|
+
// manual subscription replaces useSyncExternalStore: same granular bailout
|
|
136
|
+
// (getSnapshot returning the same ref → React doesn't re-render), fewer
|
|
137
|
+
// React-internal hook slots on Hermes. We don't need tearing prevention
|
|
138
|
+
// here: theme/media updates are event-driven, not transition-driven, and
|
|
139
|
+
// useReducer in normal mode already gives same-tick batching.
|
|
140
|
+
const [, forceUpdate] = useReducer(incReducer, 0)
|
|
141
|
+
const state = getSnapshotImpl(ref.current)
|
|
142
|
+
ref.current.lastSnap = state
|
|
143
|
+
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
const r = ref.current
|
|
146
|
+
const renderVersion = r.renderVersion
|
|
147
|
+
|
|
148
|
+
if (r.unsubscribe && r.subscribedParentId !== r.parentId) {
|
|
149
|
+
cleanupThemeSubscription(r)
|
|
175
150
|
}
|
|
176
151
|
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
152
|
+
if (shouldSubscribeToTheme(r, cascadeOnChange)) {
|
|
153
|
+
if (!r.unsubscribe) {
|
|
154
|
+
const pid = r.parentId
|
|
155
|
+
const sid = r.id
|
|
156
|
+
const cb = () => {
|
|
157
|
+
const next = getSnapshotImpl(r)
|
|
158
|
+
if (next !== r.lastSnap) {
|
|
159
|
+
r.lastSnap = next
|
|
160
|
+
forceUpdate()
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
listenersByParent[pid] = listenersByParent[pid] || new Set()
|
|
165
|
+
listenersByParent[pid].add(sid)
|
|
166
|
+
allListeners.set(sid, () => {
|
|
167
|
+
PendingUpdate.set(sid, shouldForce ? 'force' : true)
|
|
168
|
+
cb()
|
|
169
|
+
})
|
|
170
|
+
r.subscribedParentId = pid
|
|
171
|
+
r.unsubscribe = () => {
|
|
172
|
+
allListeners.delete(sid)
|
|
173
|
+
listenersByParent[pid]?.delete(sid)
|
|
174
|
+
localStates.delete(sid)
|
|
175
|
+
states.delete(sid)
|
|
176
|
+
PendingUpdate.delete(sid)
|
|
177
|
+
r.unsubscribe = undefined
|
|
178
|
+
r.subscribedParentId = undefined
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} else if (r.unsubscribe) {
|
|
182
|
+
cleanupThemeSubscription(r)
|
|
192
183
|
}
|
|
193
184
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
185
|
+
return () => {
|
|
186
|
+
// react runs passive cleanup before the next effect as well as on unmount.
|
|
187
|
+
// a newer render bumps renderVersion before that cleanup, so equality here
|
|
188
|
+
// means this is the final unmount cleanup.
|
|
189
|
+
if (r.renderVersion === renderVersion) {
|
|
190
|
+
cleanupThemeState(r)
|
|
191
|
+
}
|
|
197
192
|
}
|
|
198
|
-
|
|
199
|
-
;(local as any)._propsKey = propsKey
|
|
200
|
-
states.set(id, next)
|
|
193
|
+
})
|
|
201
194
|
|
|
202
|
-
|
|
195
|
+
if (cascadeOnChange) {
|
|
196
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
197
|
+
useIsomorphicLayoutEffect(() => {
|
|
198
|
+
if (!HasRenderedOnce.get(keys)) {
|
|
199
|
+
HasRenderedOnce.set(keys, true)
|
|
200
|
+
return
|
|
201
|
+
}
|
|
202
|
+
if (!propsKey) {
|
|
203
|
+
if (HadTheme.get(keys)) {
|
|
204
|
+
// we're removing the last theme, make sure to notify
|
|
205
|
+
scheduleUpdate(id)
|
|
206
|
+
}
|
|
207
|
+
HadTheme.set(keys, false)
|
|
208
|
+
return
|
|
209
|
+
}
|
|
210
|
+
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
211
|
+
console.warn(` · useTheme(${id}) scheduleUpdate`, propsKey, states.get(id)?.name)
|
|
212
|
+
}
|
|
213
|
+
scheduleUpdate(id)
|
|
214
|
+
HadTheme.set(keys, true)
|
|
215
|
+
}, [keys, propsKey])
|
|
203
216
|
}
|
|
204
217
|
|
|
205
|
-
|
|
206
|
-
|
|
218
|
+
return state
|
|
219
|
+
}
|
|
207
220
|
|
|
208
|
-
|
|
221
|
+
type SnapshotRef = {
|
|
222
|
+
id: string
|
|
223
|
+
parentId: string
|
|
224
|
+
props: UseThemeWithStateProps
|
|
225
|
+
propsKey: string
|
|
226
|
+
isRoot: boolean
|
|
227
|
+
keys: MutableRefObject<Set<string> | null>
|
|
228
|
+
schemeKeys?: MutableRefObject<Set<string> | null>
|
|
229
|
+
}
|
|
209
230
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
231
|
+
type ThemeStateRef = SnapshotRef & {
|
|
232
|
+
renderVersion: number
|
|
233
|
+
unsubscribe?: () => void
|
|
234
|
+
subscribedParentId?: string
|
|
235
|
+
lastSnap?: ThemeState
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const shouldSubscribeToTheme = (r: ThemeStateRef, cascadeOnChange: boolean): boolean =>
|
|
239
|
+
r.isRoot ||
|
|
240
|
+
cascadeOnChange ||
|
|
241
|
+
hasThemeUpdatingProps(r.props) ||
|
|
242
|
+
!!r.keys.current?.size ||
|
|
243
|
+
!!r.props.needsUpdate?.()
|
|
244
|
+
|
|
245
|
+
function cleanupThemeSubscription(r: ThemeStateRef) {
|
|
246
|
+
r.unsubscribe?.()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function cleanupThemeState(r: ThemeStateRef) {
|
|
250
|
+
if (r.unsubscribe) {
|
|
251
|
+
cleanupThemeSubscription(r)
|
|
252
|
+
} else {
|
|
253
|
+
localStates.delete(r.id)
|
|
254
|
+
states.delete(r.id)
|
|
255
|
+
PendingUpdate.delete(r.id)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const getSnapshotImpl = (r: SnapshotRef): ThemeState => {
|
|
260
|
+
const { id, parentId, props, propsKey, isRoot, keys, schemeKeys } = r
|
|
261
|
+
let local = localStates.get(id)
|
|
262
|
+
const parentState = states.get(parentId)
|
|
263
|
+
|
|
264
|
+
// fast path: nothing changed since last snapshot
|
|
265
|
+
if (local && !PendingUpdate.has(id)) {
|
|
266
|
+
if (
|
|
267
|
+
parentState &&
|
|
268
|
+
(local as any)._parentName === parentState.name &&
|
|
269
|
+
(local as any)._propsKey === propsKey
|
|
270
|
+
) {
|
|
271
|
+
return local
|
|
225
272
|
}
|
|
226
|
-
|
|
227
|
-
HadTheme.set(keys, true)
|
|
228
|
-
}, [keys, propsKey])
|
|
273
|
+
}
|
|
229
274
|
|
|
230
|
-
|
|
275
|
+
// check if this is a scheme-only change (light↔dark) where DynamicColorIOS handles it
|
|
276
|
+
const isSchemeOnlyChange =
|
|
277
|
+
process.env.TAMAGUI_TARGET === 'native' &&
|
|
278
|
+
supportsDynamicColorIOS &&
|
|
279
|
+
getSetting('fastSchemeChange') &&
|
|
280
|
+
local &&
|
|
281
|
+
parentState &&
|
|
282
|
+
local.scheme !== parentState.scheme &&
|
|
283
|
+
getThemeBaseName(local.name) === getThemeBaseName(parentState.name)
|
|
284
|
+
|
|
285
|
+
// all tracked keys are scheme-optimized = can skip re-render for scheme changes
|
|
286
|
+
const keysSize = keys?.current?.size ?? 0
|
|
287
|
+
const schemeKeysSize = schemeKeys?.current?.size ?? 0
|
|
288
|
+
const allKeysSchemeOptimized = schemeKeysSize === keysSize && keysSize > 0
|
|
289
|
+
|
|
290
|
+
const canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized
|
|
291
|
+
|
|
292
|
+
const needsUpdate = props.passThrough
|
|
293
|
+
? false
|
|
294
|
+
: isRoot || props.name === 'light' || props.name === 'dark' || props.name === null
|
|
295
|
+
? true
|
|
296
|
+
: !HasRenderedOnce.get(keys)
|
|
297
|
+
? true
|
|
298
|
+
: canSkipForSchemeChange
|
|
299
|
+
? false // skip re-render for scheme-only changes with DynamicColorIOS
|
|
300
|
+
: keys?.current?.size
|
|
301
|
+
? true
|
|
302
|
+
: props.needsUpdate?.()
|
|
303
|
+
|
|
304
|
+
const [rerender, next] = getNextState(
|
|
305
|
+
local,
|
|
306
|
+
props,
|
|
307
|
+
propsKey,
|
|
308
|
+
isRoot,
|
|
309
|
+
id,
|
|
310
|
+
parentId,
|
|
311
|
+
needsUpdate,
|
|
312
|
+
PendingUpdate.get(id)
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
PendingUpdate.delete(id)
|
|
316
|
+
|
|
317
|
+
// we always create a new localState for every component
|
|
318
|
+
// that way we can use it to de-opt and avoid renders granularly
|
|
319
|
+
// we always return the localState object in each component
|
|
320
|
+
// the global state (states) should always be up to date with the latest
|
|
321
|
+
if (!local || rerender) {
|
|
322
|
+
local = { ...next }
|
|
323
|
+
localStates.set(id, local)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
327
|
+
console.groupCollapsed(` ${id} getSnapshot ${rerender}`, local.name, '>', next.name)
|
|
328
|
+
console.info({
|
|
329
|
+
props,
|
|
330
|
+
propsKey,
|
|
331
|
+
isRoot,
|
|
332
|
+
parentId,
|
|
333
|
+
local,
|
|
334
|
+
next,
|
|
335
|
+
needsUpdate,
|
|
336
|
+
isSchemeOnlyChange,
|
|
337
|
+
allKeysSchemeOptimized,
|
|
338
|
+
canSkipForSchemeChange,
|
|
339
|
+
})
|
|
340
|
+
console.groupEnd()
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (next !== local) {
|
|
344
|
+
Object.assign(local, next)
|
|
345
|
+
local.id = id
|
|
346
|
+
}
|
|
347
|
+
;(local as any)._parentName = parentState?.name
|
|
348
|
+
;(local as any)._propsKey = propsKey
|
|
349
|
+
states.set(id, next)
|
|
350
|
+
|
|
351
|
+
return local
|
|
231
352
|
}
|
|
232
353
|
|
|
233
354
|
const getNextState = (
|
|
@@ -284,20 +405,25 @@ const getNextState = (
|
|
|
284
405
|
}
|
|
285
406
|
|
|
286
407
|
if (!name) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
408
|
+
// parentState can be transiently missing when a consumer renders in a
|
|
409
|
+
// separate sync flush (a portal/Toast viewport, or a native multi-root
|
|
410
|
+
// surface) before its provider has populated the module-level `states` map.
|
|
411
|
+
// that's recoverable — the next render resolves it — so fall back to the
|
|
412
|
+
// root theme (or a light stub) instead of throwing. the "no parent context"
|
|
413
|
+
// throw above still catches a genuinely missing provider. going back to
|
|
414
|
+
// useSyncExternalStore would avoid the race but force every themed node out
|
|
415
|
+
// of concurrent rendering, so we keep the manual store and tolerate the
|
|
416
|
+
// ordering here.
|
|
417
|
+
const next = lastState ??
|
|
418
|
+
parentState ??
|
|
419
|
+
rootThemeState ?? {
|
|
420
|
+
id,
|
|
421
|
+
name: 'light',
|
|
422
|
+
theme: getConfig().themes.light,
|
|
423
|
+
}
|
|
298
424
|
|
|
299
425
|
if (shouldRerender) {
|
|
300
|
-
const updated = { ...(parentState || lastState)! }
|
|
426
|
+
const updated = { ...(parentState || lastState || next)! }
|
|
301
427
|
return [true, updated]
|
|
302
428
|
}
|
|
303
429
|
|
package/src/index.ts
CHANGED
|
@@ -77,10 +77,16 @@ export {
|
|
|
77
77
|
_disableMediaTouch,
|
|
78
78
|
configureMedia,
|
|
79
79
|
mediaKeyMatch,
|
|
80
|
+
updateMediaListeners,
|
|
80
81
|
useMedia,
|
|
81
82
|
} from './hooks/useMedia'
|
|
82
83
|
export { mediaObjectToString } from './helpers/mediaObjectToString'
|
|
83
|
-
export {
|
|
84
|
+
export {
|
|
85
|
+
getMedia,
|
|
86
|
+
mediaQueryConfig,
|
|
87
|
+
mediaState,
|
|
88
|
+
setMediaState,
|
|
89
|
+
} from './helpers/mediaState'
|
|
84
90
|
export * from './hooks/useProps'
|
|
85
91
|
export * from './hooks/useTheme'
|
|
86
92
|
export * from './hooks/useThemeName'
|
package/src/types.tsx
CHANGED
|
@@ -600,6 +600,10 @@ export type TamaguiComponentStateRef = {
|
|
|
600
600
|
isListeningToTheme?: boolean
|
|
601
601
|
unPress?: Function
|
|
602
602
|
setStateShallow?: ComponentSetStateShallow
|
|
603
|
+
// hoisted base shallow-setter that always calls the real React setState.
|
|
604
|
+
// kept on its own field so the avoidReRenders wrapper (which overwrites
|
|
605
|
+
// `setStateShallow`) can capture this as its real-re-render escape hatch.
|
|
606
|
+
baseSetStateShallow?: ComponentSetStateShallow
|
|
603
607
|
useStyleListener?: UseStyleListener
|
|
604
608
|
updateStyleListener?: () => void
|
|
605
609
|
|
|
@@ -1884,12 +1888,56 @@ export type GetThemeValueForKey<K extends string | symbol | number> =
|
|
|
1884
1888
|
: never
|
|
1885
1889
|
: never)
|
|
1886
1890
|
|
|
1891
|
+
// keys that accept the first-class "safe" value (-> env(safe-area-inset-*) on
|
|
1892
|
+
// web, numeric insets on native). must mirror propEdges in resolveSafeArea.ts.
|
|
1893
|
+
// only the longhands are listed; shorthands (pt, mt, ...) inherit via WithShorthands.
|
|
1894
|
+
export type SafeAreaValueKeys =
|
|
1895
|
+
| 'padding'
|
|
1896
|
+
| 'paddingTop'
|
|
1897
|
+
| 'paddingBottom'
|
|
1898
|
+
| 'paddingLeft'
|
|
1899
|
+
| 'paddingRight'
|
|
1900
|
+
| 'paddingHorizontal'
|
|
1901
|
+
| 'paddingVertical'
|
|
1902
|
+
| 'paddingStart'
|
|
1903
|
+
| 'paddingEnd'
|
|
1904
|
+
| 'paddingBlock'
|
|
1905
|
+
| 'paddingInline'
|
|
1906
|
+
| 'paddingBlockStart'
|
|
1907
|
+
| 'paddingBlockEnd'
|
|
1908
|
+
| 'paddingInlineStart'
|
|
1909
|
+
| 'paddingInlineEnd'
|
|
1910
|
+
| 'margin'
|
|
1911
|
+
| 'marginTop'
|
|
1912
|
+
| 'marginBottom'
|
|
1913
|
+
| 'marginLeft'
|
|
1914
|
+
| 'marginRight'
|
|
1915
|
+
| 'marginHorizontal'
|
|
1916
|
+
| 'marginVertical'
|
|
1917
|
+
| 'marginStart'
|
|
1918
|
+
| 'marginEnd'
|
|
1919
|
+
| 'marginBlock'
|
|
1920
|
+
| 'marginInline'
|
|
1921
|
+
| 'marginBlockStart'
|
|
1922
|
+
| 'marginBlockEnd'
|
|
1923
|
+
| 'marginInlineStart'
|
|
1924
|
+
| 'marginInlineEnd'
|
|
1925
|
+
| 'inset'
|
|
1926
|
+
| 'top'
|
|
1927
|
+
| 'bottom'
|
|
1928
|
+
| 'left'
|
|
1929
|
+
| 'right'
|
|
1930
|
+
| 'start'
|
|
1931
|
+
| 'end'
|
|
1932
|
+
|
|
1887
1933
|
export type WithThemeValues<T extends object> = {
|
|
1888
|
-
[K in keyof T]:
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1934
|
+
[K in keyof T]:
|
|
1935
|
+
| (ThemeValueGet<K> extends never
|
|
1936
|
+
? K extends keyof ExtraBaseProps
|
|
1937
|
+
? T[K]
|
|
1938
|
+
: T[K] | 'unset'
|
|
1939
|
+
: GetThemeValueForKey<K> | Exclude<T[K], string> | 'unset')
|
|
1940
|
+
| (K extends SafeAreaValueKeys ? 'safe' : never)
|
|
1893
1941
|
}
|
|
1894
1942
|
|
|
1895
1943
|
export type NarrowShorthands = Narrow<Shorthands>
|
package/src/views/Theme.tsx
CHANGED
|
@@ -26,7 +26,10 @@ export const Theme = forwardRef(function Theme(props: ThemeComponentPropsOnly, r
|
|
|
26
26
|
|
|
27
27
|
const isRoot = !!props['_isRoot']
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// pass forThemeView=true so the descendant-cascade effect is installed —
|
|
30
|
+
// <Theme> pushes themeState.id into ThemeStateContext, so children subscribe
|
|
31
|
+
// under this id and need to be notified when our propsKey changes.
|
|
32
|
+
const [_, themeState] = useThemeWithState(props, isRoot, true)
|
|
30
33
|
|
|
31
34
|
const disableDirectChildTheme = props['disable-child-theme']
|
|
32
35
|
|
|
@@ -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":"AAaA,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;AAwK9D,wBAAgB,eAAe,CAC7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EACf,sBAAsB,OAAO,KAC5B,SA6HF,CAAA;AAQD,eAAO,MAAM,cAAc,EAAE,aAc5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointerEvents.native.d.ts","sourceRoot":"","sources":["../../src/helpers/pointerEvents.native.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"pointerEvents.native.d.ts","sourceRoot":"","sources":["../../src/helpers/pointerEvents.native.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,QA4I1D"}
|
|
@@ -13,7 +13,7 @@ export declare const useComponentState: (props: ViewProps | TextProps | Record<s
|
|
|
13
13
|
presence: import("../types").UsePresenceResult | null;
|
|
14
14
|
presenceState: import("../types").PresenceContextProps | null | undefined;
|
|
15
15
|
setState: import("react").Dispatch<import("react").SetStateAction<TamaguiComponentState>>;
|
|
16
|
-
setStateShallow: import("
|
|
16
|
+
setStateShallow: import("../types").ComponentSetStateShallow;
|
|
17
17
|
noClass: boolean;
|
|
18
18
|
state: TamaguiComponentState;
|
|
19
19
|
stateRef: import("react").RefObject<TamaguiComponentStateRef>;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;CAmR9B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../src/hooks/useMedia.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,WAAW,EAEX,qBAAqB,EACrB,aAAa,EACb,WAAW,EACZ,MAAM,UAAU,CAAA;AAKjB,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,OAKxC,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,WAMzC,CAAA;AAOD,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,WAShD,CAAA;AAMD,eAAO,MAAM,cAAc,GAAI,QAAQ,qBAAqB,
|
|
1
|
+
{"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../src/hooks/useMedia.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,WAAW,EAEX,qBAAqB,EACrB,aAAa,EACb,WAAW,EACZ,MAAM,UA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tracks update keys
|
|
7
7
|
*/
|
|
8
|
-
export declare const useThemeWithState: (props: UseThemeWithStateProps, isRoot?: boolean) => ThemeWithState;
|
|
8
|
+
export declare const useThemeWithState: (props: UseThemeWithStateProps, isRoot?: boolean, forThemeView?: boolean) => ThemeWithState;
|
|
9
9
|
//# sourceMappingURL=useTheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAUtE,eAAO,MAAM,QAAQ,QAKL,YACf,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,sBAAsB,EAC7B,gBAAc,EAQd,sBAAoB,KACnB,cAiCF,CAAA"}
|
|
@@ -5,7 +5,7 @@ export declare const ThemeStateContext: import("react").Context<string>;
|
|
|
5
5
|
export declare const forceUpdateThemes: () => void;
|
|
6
6
|
export declare const getThemeState: (id: ID) => ThemeState | undefined;
|
|
7
7
|
export declare const getRootThemeState: () => ThemeState | null;
|
|
8
|
-
export declare const useThemeState: (props: UseThemeWithStateProps, isRoot: boolean | undefined, keys: MutableRefObject<Set<string> | null>, schemeKeys?: MutableRefObject<Set<string> | null
|
|
8
|
+
export declare const useThemeState: (props: UseThemeWithStateProps, isRoot: boolean | undefined, keys: MutableRefObject<Set<string> | null>, schemeKeys?: MutableRefObject<Set<string> | null>, cascadeOnChange?: boolean) => ThemeState;
|
|
9
9
|
export declare const hasThemeUpdatingProps: (props: ThemeProps) => boolean;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=useThemeState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeState.d.ts","sourceRoot":"","sources":["../../src/hooks/useThemeState.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useThemeState.d.ts","sourceRoot":"","sources":["../../src/hooks/useThemeState.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,OAAO,CAAA;AAGd,OAAO,KAAK,EAEV,UAAU,EACV,UAAU,EACV,sBAAsB,EACvB,MAAM,UAAU,CAAA;AAEjB,KAAK,EAAE,GAAG,MAAM,CAAA;AAEhB,eAAO,MAAM,iBAAiB,iCAAwB,CAAA;AAatD,eAAO,MAAM,iBAAiB,YAK7B,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,IAAI,EAAE,2BAAmB,CAAA;AAWvD,eAAO,MAAM,iBAAiB,yBAAuB,CAAA;AASrD,eAAO,MAAM,aAAa,GACxB,OAAO,sBAAsB,EAC7B,2BAAc,EACd,MAAM,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,EAC1C,aAAa,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,EAOjD,yBAAuB,KACtB,UAiJF,CAAA;AAgdD,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,YACW,CAAA"}
|
package/types/index.d.ts
CHANGED
|
@@ -52,9 +52,9 @@ export { getConfig, getSetting, getStyleCompat, getThemes, getToken, getTokens,
|
|
|
52
52
|
export { setNonce } from './helpers/insertStyleRule';
|
|
53
53
|
export * from './constants/constants';
|
|
54
54
|
export * from './hooks/useIsTouchDevice';
|
|
55
|
-
export { _disableMediaTouch, configureMedia, mediaKeyMatch, useMedia, } from './hooks/useMedia';
|
|
55
|
+
export { _disableMediaTouch, configureMedia, mediaKeyMatch, updateMediaListeners, useMedia, } from './hooks/useMedia';
|
|
56
56
|
export { mediaObjectToString } from './helpers/mediaObjectToString';
|
|
57
|
-
export { getMedia, mediaQueryConfig, mediaState } from './helpers/mediaState';
|
|
57
|
+
export { getMedia, mediaQueryConfig, mediaState, setMediaState, } from './helpers/mediaState';
|
|
58
58
|
export * from './hooks/useProps';
|
|
59
59
|
export * from './hooks/useTheme';
|
|
60
60
|
export * from './hooks/useThemeName';
|