@tamagui/web 1.121.12 → 1.122.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/dist/cjs/createComponent.cjs +9 -10
- package/dist/cjs/createComponent.js +7 -16
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/createComponent.native.js +9 -13
- package/dist/cjs/createComponent.native.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.native.js.map +1 -1
- package/dist/cjs/helpers/ThemeManagerContext.cjs +2 -2
- package/dist/cjs/helpers/ThemeManagerContext.js +2 -2
- package/dist/cjs/helpers/ThemeManagerContext.js.map +1 -1
- package/dist/cjs/helpers/ThemeManagerContext.native.js +3 -3
- package/dist/cjs/helpers/ThemeManagerContext.native.js.map +2 -2
- package/dist/cjs/helpers/expandStyle.cjs +3 -3
- package/dist/cjs/helpers/expandStyle.js +2 -2
- package/dist/cjs/helpers/expandStyle.js.map +1 -1
- package/dist/cjs/helpers/expandStyle.native.js +1 -1
- package/dist/cjs/helpers/expandStyle.native.js.map +1 -1
- package/dist/cjs/helpers/expandStyles.js.map +1 -1
- package/dist/cjs/helpers/expandStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +64 -93
- package/dist/cjs/helpers/getSplitStyles.js +60 -86
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.native.js +344 -372
- package/dist/cjs/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/cjs/helpers/getThemeCSSRules.cjs +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +6 -6
- package/dist/cjs/helpers/insertStyleRule.js +6 -11
- package/dist/cjs/helpers/insertStyleRule.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.native.js +17 -16
- package/dist/cjs/helpers/insertStyleRule.native.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/cjs/helpers/propMapper.cjs +21 -15
- package/dist/cjs/helpers/propMapper.js +26 -20
- package/dist/cjs/helpers/propMapper.js.map +2 -2
- package/dist/cjs/helpers/propMapper.native.js +27 -21
- package/dist/cjs/helpers/propMapper.native.js.map +2 -2
- package/dist/cjs/hooks/useTheme.cjs +148 -169
- package/dist/cjs/hooks/useTheme.js +64 -69
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useTheme.native.js +60 -72
- package/dist/cjs/hooks/useTheme.native.js.map +2 -2
- package/dist/cjs/hooks/useThemeName.cjs +4 -5
- package/dist/cjs/hooks/useThemeName.js +2 -2
- package/dist/cjs/hooks/useThemeName.js.map +1 -1
- package/dist/cjs/hooks/useThemeName.native.js +2 -2
- package/dist/cjs/hooks/useThemeName.native.js.map +2 -2
- package/dist/cjs/views/Theme.cjs +3 -4
- package/dist/cjs/views/Theme.js +2 -3
- package/dist/cjs/views/Theme.js.map +1 -1
- package/dist/cjs/views/Theme.native.js +3 -4
- package/dist/cjs/views/Theme.native.js.map +2 -2
- package/dist/esm/createComponent.js +7 -16
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createComponent.mjs +9 -10
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +8 -11
- package/dist/esm/createComponent.native.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.mjs.map +1 -1
- package/dist/esm/helpers/ThemeManager.native.js.map +1 -1
- package/dist/esm/helpers/ThemeManagerContext.js +2 -2
- package/dist/esm/helpers/ThemeManagerContext.js.map +1 -1
- package/dist/esm/helpers/ThemeManagerContext.mjs +2 -2
- package/dist/esm/helpers/ThemeManagerContext.mjs.map +1 -1
- package/dist/esm/helpers/ThemeManagerContext.native.js +2 -2
- package/dist/esm/helpers/ThemeManagerContext.native.js.map +2 -2
- package/dist/esm/helpers/expandStyle.js +2 -2
- package/dist/esm/helpers/expandStyle.js.map +1 -1
- package/dist/esm/helpers/expandStyle.mjs +2 -2
- package/dist/esm/helpers/expandStyle.mjs.map +1 -1
- package/dist/esm/helpers/expandStyle.native.js +1 -1
- package/dist/esm/helpers/expandStyle.native.js.map +1 -1
- package/dist/esm/helpers/expandStyles.js.map +1 -1
- package/dist/esm/helpers/expandStyles.mjs.map +1 -1
- package/dist/esm/helpers/expandStyles.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +61 -92
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +65 -94
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +347 -375
- package/dist/esm/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/esm/helpers/getThemeCSSRules.js +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.mjs +1 -1
- package/dist/esm/helpers/getThemeCSSRules.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js +6 -11
- package/dist/esm/helpers/insertStyleRule.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +6 -6
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +17 -16
- package/dist/esm/helpers/insertStyleRule.native.js.map +2 -2
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/esm/helpers/propMapper.js +26 -20
- package/dist/esm/helpers/propMapper.js.map +2 -2
- package/dist/esm/helpers/propMapper.mjs +22 -15
- package/dist/esm/helpers/propMapper.mjs.map +1 -1
- package/dist/esm/helpers/propMapper.native.js +28 -21
- package/dist/esm/helpers/propMapper.native.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +70 -60
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/hooks/useTheme.mjs +145 -154
- package/dist/esm/hooks/useTheme.mjs.map +1 -1
- package/dist/esm/hooks/useTheme.native.js +59 -62
- package/dist/esm/hooks/useTheme.native.js.map +2 -2
- package/dist/esm/hooks/useThemeName.js +3 -4
- package/dist/esm/hooks/useThemeName.js.map +1 -1
- package/dist/esm/hooks/useThemeName.mjs +3 -4
- package/dist/esm/hooks/useThemeName.mjs.map +1 -1
- package/dist/esm/hooks/useThemeName.native.js +3 -4
- package/dist/esm/hooks/useThemeName.native.js.map +2 -2
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/views/Theme.js +3 -4
- package/dist/esm/views/Theme.js.map +1 -1
- package/dist/esm/views/Theme.mjs +4 -5
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +4 -5
- package/dist/esm/views/Theme.native.js.map +2 -2
- package/package.json +11 -11
- package/src/createComponent.tsx +7 -15
- package/src/helpers/ThemeManager.tsx +1 -0
- package/src/helpers/ThemeManagerContext.tsx +2 -1
- package/src/helpers/expandStyle.ts +3 -3
- package/src/helpers/expandStyles.ts +0 -1
- package/src/helpers/getSplitStyles.tsx +111 -127
- package/src/helpers/getThemeCSSRules.ts +7 -6
- package/src/helpers/insertStyleRule.tsx +9 -16
- package/src/helpers/normalizeValueWithProperty.ts +0 -2
- package/src/helpers/propMapper.ts +28 -36
- package/src/hooks/useTheme.tsx +143 -113
- package/src/hooks/useThemeName.tsx +3 -5
- package/src/setupHooks.ts +1 -7
- package/src/types.tsx +15 -15
- package/src/views/Theme.tsx +5 -5
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/ThemeManager.d.ts.map +1 -1
- package/types/helpers/ThemeManagerContext.d.ts +2 -1
- package/types/helpers/ThemeManagerContext.d.ts.map +1 -1
- package/types/helpers/expandStyle.d.ts.map +1 -1
- package/types/helpers/expandStyles.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getThemeCSSRules.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
- package/types/helpers/propMapper.d.ts +0 -1
- package/types/helpers/propMapper.d.ts.map +1 -1
- package/types/hooks/useConfiguration.d.ts +30 -50
- package/types/hooks/useConfiguration.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +3 -3
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/hooks/useThemeName.d.ts.map +1 -1
- package/types/setupHooks.d.ts +1 -1
- package/types/setupHooks.d.ts.map +1 -1
- package/types/types.d.ts +23 -13
- package/types/types.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
package/src/hooks/useTheme.tsx
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import { isClient, isIos, isServer, isWeb } from '@tamagui/constants'
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
useContext,
|
|
4
|
+
useEffect,
|
|
5
|
+
useLayoutEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
type MutableRefObject,
|
|
10
|
+
} from 'react'
|
|
4
11
|
import { getConfig, getSetting } from '../config'
|
|
5
12
|
import type { Variable } from '../createVariable'
|
|
6
13
|
import { getVariable } from '../createVariable'
|
|
7
14
|
import type { ThemeManagerState } from '../helpers/ThemeManager'
|
|
8
15
|
import { ThemeManager, getHasThemeUpdatingProps } from '../helpers/ThemeManager'
|
|
9
|
-
import {
|
|
16
|
+
import { ThemeManagerContext } from '../helpers/ThemeManagerContext'
|
|
10
17
|
import { isEqualShallow } from '../helpers/createShallowSetState'
|
|
11
18
|
import type {
|
|
12
19
|
DebugProp,
|
|
@@ -32,16 +39,6 @@ export type ChangedThemeResponse = {
|
|
|
32
39
|
|
|
33
40
|
const emptyProps = { name: null }
|
|
34
41
|
|
|
35
|
-
let cached: any
|
|
36
|
-
function getDefaultThemeProxied() {
|
|
37
|
-
if (cached) return cached
|
|
38
|
-
const config = getConfig()
|
|
39
|
-
const name = config.themes.light ? 'light' : Object.keys(config.themes)[0]
|
|
40
|
-
const defaultTheme = config.themes[name]
|
|
41
|
-
cached = getThemeProxied({ theme: defaultTheme, name })
|
|
42
|
-
return cached
|
|
43
|
-
}
|
|
44
|
-
|
|
45
42
|
export type ThemeGettable<Val> = Val & {
|
|
46
43
|
/**
|
|
47
44
|
* Tries to return an optimized value that avoids the need for re-rendering:
|
|
@@ -87,39 +84,19 @@ export type UseThemeResult = {
|
|
|
87
84
|
|
|
88
85
|
export const useTheme = (props: ThemeProps = emptyProps) => {
|
|
89
86
|
const [_, theme] = useThemeWithState(props)
|
|
90
|
-
const res = theme
|
|
87
|
+
const res = theme
|
|
91
88
|
return res as UseThemeResult
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
export const useThemeWithState = (
|
|
95
92
|
props: UseThemeWithStateProps
|
|
96
93
|
): [ChangedThemeResponse, ThemeParsed] => {
|
|
97
|
-
const keys =
|
|
98
|
-
|
|
99
|
-
const changedThemeState = useChangeThemeEffect(
|
|
100
|
-
props,
|
|
101
|
-
false,
|
|
102
|
-
keys.current,
|
|
103
|
-
!isServer
|
|
104
|
-
? () => {
|
|
105
|
-
const next =
|
|
106
|
-
props.shouldUpdate?.() ?? (keys.current.length > 0 ? true : undefined)
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
process.env.NODE_ENV === 'development' &&
|
|
110
|
-
typeof props.debug === 'string' &&
|
|
111
|
-
props.debug !== 'profile'
|
|
112
|
-
) {
|
|
113
|
-
console.info(
|
|
114
|
-
` 🎨 useTheme() shouldUpdate? tracking keys ${keys.current.length} ${props.shouldUpdate?.()}`,
|
|
115
|
-
next
|
|
116
|
-
)
|
|
117
|
-
}
|
|
94
|
+
const keys = useRef<string[] | null>(null)
|
|
118
95
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
)
|
|
96
|
+
const changedThemeState = useChangeThemeEffect(props, false, keys)
|
|
97
|
+
|
|
98
|
+
// @ts-expect-error
|
|
99
|
+
if (process.env.NODE_ENV === 'development' && globalThis.time) time`theme-change-effect`
|
|
123
100
|
|
|
124
101
|
const { themeManager, state } = changedThemeState
|
|
125
102
|
|
|
@@ -135,15 +112,17 @@ export const useThemeWithState = (
|
|
|
135
112
|
}
|
|
136
113
|
}
|
|
137
114
|
|
|
138
|
-
const themeProxied =
|
|
115
|
+
const themeProxied = useMemo(() => {
|
|
139
116
|
// reset keys on new theme
|
|
140
|
-
keys.current
|
|
117
|
+
if (keys.current) {
|
|
118
|
+
keys.current = null
|
|
119
|
+
}
|
|
141
120
|
|
|
142
121
|
if (!themeManager || !state?.theme) {
|
|
143
122
|
return {}
|
|
144
123
|
}
|
|
145
124
|
|
|
146
|
-
return getThemeProxied(state, props.deopt,
|
|
125
|
+
return getThemeProxied(state, props.deopt, keys, themeManager, props.debug)
|
|
147
126
|
}, [state?.theme, themeManager, props.deopt, props.debug])
|
|
148
127
|
|
|
149
128
|
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
@@ -161,11 +140,11 @@ export const useThemeWithState = (
|
|
|
161
140
|
return [changedThemeState, themeProxied]
|
|
162
141
|
}
|
|
163
142
|
|
|
164
|
-
|
|
143
|
+
function getThemeProxied(
|
|
165
144
|
{ theme, name, scheme }: ThemeManagerState,
|
|
166
145
|
deopt = false,
|
|
167
|
-
|
|
168
|
-
|
|
146
|
+
keys: MutableRefObject<string[] | null>,
|
|
147
|
+
themeManager: ThemeManager,
|
|
169
148
|
debug?: DebugProp
|
|
170
149
|
): UseThemeResult {
|
|
171
150
|
if (!theme) return {}
|
|
@@ -173,18 +152,17 @@ export function getThemeProxied(
|
|
|
173
152
|
const config = getConfig()
|
|
174
153
|
|
|
175
154
|
function track(key: string) {
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
// tracking new key for first time, do an update check
|
|
179
|
-
setTimeout(() => {
|
|
180
|
-
themeManager?.selfUpdate()
|
|
181
|
-
})
|
|
182
|
-
}
|
|
155
|
+
if (!keys.current) {
|
|
156
|
+
keys.current = []
|
|
183
157
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
158
|
+
// tracking new key for first time, do an update check
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
themeManager?.selfUpdate()
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
keys.current.push(key)
|
|
164
|
+
if (process.env.NODE_ENV === 'development' && debug) {
|
|
165
|
+
console.info(` 🎨 useTheme() tracking new key: ${key}`)
|
|
188
166
|
}
|
|
189
167
|
}
|
|
190
168
|
|
|
@@ -349,15 +327,41 @@ const preventWarnSetState =
|
|
|
349
327
|
return ogLog(a, ...args)
|
|
350
328
|
}
|
|
351
329
|
|
|
330
|
+
function getShouldUpdateTheme(
|
|
331
|
+
props: UseThemeWithStateProps,
|
|
332
|
+
parentManager: ThemeManager | null,
|
|
333
|
+
keys: MutableRefObject<string[] | null> | undefined,
|
|
334
|
+
themeState: ChangedThemeResponse | undefined,
|
|
335
|
+
nextState?: ThemeManagerState | null,
|
|
336
|
+
forceShouldChange = false
|
|
337
|
+
) {
|
|
338
|
+
if (isServer) return
|
|
339
|
+
if (
|
|
340
|
+
!forceShouldChange &&
|
|
341
|
+
!keys?.current &&
|
|
342
|
+
(!themeState || !themeState.isNewTheme) &&
|
|
343
|
+
!getHasThemeUpdatingProps(props)
|
|
344
|
+
) {
|
|
345
|
+
return
|
|
346
|
+
}
|
|
347
|
+
const next = nextState || themeState?.themeManager?.getState(props, parentManager)
|
|
348
|
+
if (forceShouldChange) {
|
|
349
|
+
return next
|
|
350
|
+
}
|
|
351
|
+
if (!next || next.theme === themeState?.state?.theme) {
|
|
352
|
+
return
|
|
353
|
+
}
|
|
354
|
+
return next
|
|
355
|
+
}
|
|
356
|
+
|
|
352
357
|
export const useChangeThemeEffect = (
|
|
353
358
|
props: UseThemeWithStateProps,
|
|
354
359
|
isRoot = false,
|
|
355
|
-
keys?: string[]
|
|
356
|
-
shouldUpdate?: () => boolean | undefined
|
|
360
|
+
keys?: MutableRefObject<string[] | null>
|
|
357
361
|
): ChangedThemeResponse => {
|
|
358
362
|
const { disable } = props
|
|
359
|
-
const
|
|
360
|
-
const
|
|
363
|
+
const parentManager = useContext(ThemeManagerContext)
|
|
364
|
+
const shouldAlwaysUpdate = props.needsUpdate?.() === true ? true : undefined
|
|
361
365
|
|
|
362
366
|
if ((!isRoot && !parentManager) || disable) {
|
|
363
367
|
return {
|
|
@@ -379,34 +383,23 @@ export const useChangeThemeEffect = (
|
|
|
379
383
|
// }
|
|
380
384
|
// }
|
|
381
385
|
|
|
382
|
-
const [themeState, setThemeState] =
|
|
386
|
+
const [themeState, setThemeState] = useState<ChangedThemeResponse>(createState)
|
|
383
387
|
|
|
384
388
|
const { state, mounted, isNewTheme, themeManager, prevState } = themeState
|
|
385
389
|
const isInversingOnMount = Boolean(!themeState.mounted && props.inverse)
|
|
386
390
|
|
|
387
|
-
function getShouldUpdateTheme(
|
|
388
|
-
manager = themeManager,
|
|
389
|
-
nextState?: ThemeManagerState | null,
|
|
390
|
-
prevState: ThemeManagerState | undefined = state,
|
|
391
|
-
forceShouldChange = false
|
|
392
|
-
) {
|
|
393
|
-
const forceUpdate = shouldUpdate?.()
|
|
394
|
-
if (!manager || (!forceShouldChange && forceUpdate === false)) return
|
|
395
|
-
const next = nextState || manager.getState(props, parentManager)
|
|
396
|
-
if (forceShouldChange) {
|
|
397
|
-
return next
|
|
398
|
-
}
|
|
399
|
-
if (!next) return
|
|
400
|
-
if (forceUpdate !== true && !manager.getStateShouldChange(next, prevState)) {
|
|
401
|
-
return
|
|
402
|
-
}
|
|
403
|
-
return next
|
|
404
|
-
}
|
|
405
|
-
|
|
406
391
|
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
407
392
|
if (themeManager) {
|
|
408
|
-
|
|
409
|
-
|
|
393
|
+
const nextState = getShouldUpdateTheme(
|
|
394
|
+
props,
|
|
395
|
+
parentManager,
|
|
396
|
+
keys,
|
|
397
|
+
themeState,
|
|
398
|
+
undefined,
|
|
399
|
+
shouldAlwaysUpdate
|
|
400
|
+
)
|
|
401
|
+
if (nextState) {
|
|
402
|
+
const next = createState(themeState, undefined, nextState)
|
|
410
403
|
if (next.state?.name !== themeState.state?.name) {
|
|
411
404
|
setThemeState(next)
|
|
412
405
|
console.error = preventWarnSetState
|
|
@@ -418,15 +411,17 @@ export const useChangeThemeEffect = (
|
|
|
418
411
|
}
|
|
419
412
|
|
|
420
413
|
if (!isServer) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
themeManager
|
|
425
|
-
|
|
426
|
-
|
|
414
|
+
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
415
|
+
useLayoutEffect(() => {
|
|
416
|
+
// one homepage breaks on useTheme() in MetaTheme if this isnt set up
|
|
417
|
+
if (themeManager && state && prevState && state !== prevState) {
|
|
418
|
+
themeManager.notify()
|
|
419
|
+
}
|
|
420
|
+
}, [state])
|
|
421
|
+
}
|
|
427
422
|
|
|
428
423
|
// listen for parent change + notify children change
|
|
429
|
-
|
|
424
|
+
useEffect(() => {
|
|
430
425
|
if (!themeManager) return
|
|
431
426
|
|
|
432
427
|
// SSR safe inverse (because server can't know prefers scheme)
|
|
@@ -442,9 +437,27 @@ export const useChangeThemeEffect = (
|
|
|
442
437
|
return
|
|
443
438
|
}
|
|
444
439
|
|
|
445
|
-
if (isNewTheme ||
|
|
440
|
+
if (isNewTheme || isRoot) {
|
|
446
441
|
activeThemeManagers.add(themeManager)
|
|
447
|
-
|
|
442
|
+
|
|
443
|
+
if (process.env.NODE_ENV === 'development') {
|
|
444
|
+
if (isRoot) {
|
|
445
|
+
globalThis['TamaguiRootThemeManager'] ||= themeManager
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const updated = getShouldUpdateTheme(
|
|
451
|
+
props,
|
|
452
|
+
parentManager,
|
|
453
|
+
keys,
|
|
454
|
+
themeState,
|
|
455
|
+
undefined,
|
|
456
|
+
shouldAlwaysUpdate
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
if (updated) {
|
|
460
|
+
setThemeState((prev) => createState(prev, undefined, updated))
|
|
448
461
|
}
|
|
449
462
|
|
|
450
463
|
// for updateTheme/replaceTheme
|
|
@@ -461,14 +474,14 @@ export const useChangeThemeEffect = (
|
|
|
461
474
|
(name, manager, forced) => {
|
|
462
475
|
const force =
|
|
463
476
|
forced ||
|
|
464
|
-
|
|
477
|
+
(!isServer ? (keys?.current ? true : undefined) : undefined) ||
|
|
465
478
|
props.deopt ||
|
|
466
479
|
// this fixes themeable() not updating with the new fastSchemeChange setting
|
|
467
480
|
(process.env.TAMAGUI_TARGET === 'native'
|
|
468
481
|
? props['disable-child-theme']
|
|
469
482
|
: undefined)
|
|
470
483
|
|
|
471
|
-
const shouldTryUpdate = force ?? Boolean(keys?.
|
|
484
|
+
const shouldTryUpdate = force ?? Boolean(keys?.current || isNewTheme)
|
|
472
485
|
|
|
473
486
|
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
474
487
|
// prettier-ignore
|
|
@@ -483,7 +496,9 @@ export const useChangeThemeEffect = (
|
|
|
483
496
|
}
|
|
484
497
|
|
|
485
498
|
if (shouldTryUpdate) {
|
|
486
|
-
setThemeState((prev) =>
|
|
499
|
+
setThemeState((prev) => {
|
|
500
|
+
return createState(prev, true)
|
|
501
|
+
})
|
|
487
502
|
}
|
|
488
503
|
},
|
|
489
504
|
themeManager.id
|
|
@@ -508,7 +523,7 @@ export const useChangeThemeEffect = (
|
|
|
508
523
|
])
|
|
509
524
|
|
|
510
525
|
if (process.env.NODE_ENV === 'development' && props.debug !== 'profile') {
|
|
511
|
-
|
|
526
|
+
useEffect(() => {
|
|
512
527
|
globalThis['TamaguiThemeManagers'] ??= new Set()
|
|
513
528
|
globalThis['TamaguiThemeManagers'].add(themeManager)
|
|
514
529
|
return () => {
|
|
@@ -538,8 +553,12 @@ export const useChangeThemeEffect = (
|
|
|
538
553
|
themeManager,
|
|
539
554
|
}
|
|
540
555
|
|
|
541
|
-
function createState(
|
|
542
|
-
|
|
556
|
+
function createState(
|
|
557
|
+
prev?: ChangedThemeResponse,
|
|
558
|
+
force = false,
|
|
559
|
+
foundNextState?: ThemeManagerState
|
|
560
|
+
): ChangedThemeResponse {
|
|
561
|
+
if (prev && !foundNextState && !keys?.current && !force) {
|
|
543
562
|
return prev
|
|
544
563
|
}
|
|
545
564
|
|
|
@@ -549,10 +568,7 @@ export const useChangeThemeEffect = (
|
|
|
549
568
|
const hasThemeUpdatingProps = getHasThemeUpdatingProps(props)
|
|
550
569
|
|
|
551
570
|
if (hasThemeUpdatingProps) {
|
|
552
|
-
const
|
|
553
|
-
return new ThemeManager(props, isRoot ? 'root' : parentManager)
|
|
554
|
-
}
|
|
555
|
-
|
|
571
|
+
const parentManagerProp = isRoot ? 'root' : parentManager
|
|
556
572
|
if (prev?.themeManager) {
|
|
557
573
|
themeManager = prev.themeManager
|
|
558
574
|
|
|
@@ -562,33 +578,44 @@ export const useChangeThemeEffect = (
|
|
|
562
578
|
// at all anymore. this forces updates onChangeTheme for all dynamic style accessed components
|
|
563
579
|
// which is correct, potentially in the future we can avoid forceChange and just know to
|
|
564
580
|
// update if keys.length is set + onChangeTheme called
|
|
565
|
-
const forceChange =
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
581
|
+
const forceChange =
|
|
582
|
+
force || shouldAlwaysUpdate || (keys?.current ? true : undefined)
|
|
583
|
+
|
|
584
|
+
let nextState: ThemeManagerState | null | undefined = null
|
|
585
|
+
|
|
586
|
+
// avoid some work if we already found it
|
|
587
|
+
if (foundNextState) {
|
|
588
|
+
nextState = foundNextState
|
|
589
|
+
} else {
|
|
590
|
+
const next = themeManager.getState(props, parentManager)
|
|
591
|
+
nextState = getShouldUpdateTheme(
|
|
592
|
+
props,
|
|
593
|
+
parentManager,
|
|
594
|
+
keys,
|
|
595
|
+
prev,
|
|
596
|
+
next,
|
|
597
|
+
forceChange
|
|
598
|
+
)
|
|
599
|
+
}
|
|
573
600
|
|
|
574
601
|
if (nextState) {
|
|
575
602
|
state = nextState
|
|
576
603
|
|
|
577
604
|
if (!prev.isNewTheme && !isRoot) {
|
|
578
|
-
themeManager =
|
|
605
|
+
themeManager = new ThemeManager(props, parentManagerProp)
|
|
579
606
|
} else {
|
|
580
607
|
themeManager.updateState(nextState)
|
|
581
608
|
}
|
|
582
609
|
} else {
|
|
583
610
|
if (prev.isNewTheme) {
|
|
584
611
|
// reset to parent
|
|
585
|
-
if (parentManager && !
|
|
612
|
+
if (parentManager && !nextState) {
|
|
586
613
|
themeManager = parentManager
|
|
587
614
|
}
|
|
588
615
|
}
|
|
589
616
|
}
|
|
590
617
|
} else {
|
|
591
|
-
themeManager =
|
|
618
|
+
themeManager = new ThemeManager(props, parentManagerProp)
|
|
592
619
|
state = { ...themeManager.state }
|
|
593
620
|
}
|
|
594
621
|
}
|
|
@@ -615,7 +642,10 @@ export const useChangeThemeEffect = (
|
|
|
615
642
|
themeManager,
|
|
616
643
|
isNewTheme,
|
|
617
644
|
mounted,
|
|
618
|
-
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
if (props.inverse) {
|
|
648
|
+
response.inversed = true
|
|
619
649
|
}
|
|
620
650
|
|
|
621
651
|
const shouldReturnPrev =
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import { useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
3
|
-
|
|
4
|
-
import {
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { ThemeManagerContext } from '../helpers/ThemeManagerContext'
|
|
5
4
|
import type { ThemeName } from '../types'
|
|
6
|
-
import { getThemeManager } from './useTheme'
|
|
7
5
|
|
|
8
6
|
export function useThemeName(opts?: { parent?: true }): ThemeName {
|
|
9
|
-
const manager =
|
|
7
|
+
const manager = React.useContext(ThemeManagerContext)!
|
|
10
8
|
const [name, setName] = React.useState(manager?.state.name || '')
|
|
11
9
|
|
|
12
10
|
useIsomorphicLayoutEffect(() => {
|
package/src/setupHooks.ts
CHANGED
|
@@ -27,13 +27,7 @@ type InternalHooks = {
|
|
|
27
27
|
staticConfig: StaticConfig
|
|
28
28
|
) => any
|
|
29
29
|
|
|
30
|
-
useChildren?: (
|
|
31
|
-
elementType: any,
|
|
32
|
-
children: any,
|
|
33
|
-
viewProps: Record<string, any>,
|
|
34
|
-
events: TamaguiComponentEvents | null,
|
|
35
|
-
staticConfig: StaticConfig
|
|
36
|
-
) => any
|
|
30
|
+
useChildren?: (elementType: any, children: any, viewProps: Record<string, any>) => any
|
|
37
31
|
|
|
38
32
|
getBaseViews?: () => {
|
|
39
33
|
View: any
|
package/src/types.tsx
CHANGED
|
@@ -159,11 +159,11 @@ export type CreateTokens<Val extends VariableVal = VariableVal> = Record<
|
|
|
159
159
|
string,
|
|
160
160
|
{ [key: GenericKey]: Val }
|
|
161
161
|
> & {
|
|
162
|
-
color
|
|
163
|
-
space
|
|
164
|
-
size
|
|
165
|
-
radius
|
|
166
|
-
zIndex
|
|
162
|
+
color?: { [key: GenericKey]: Val }
|
|
163
|
+
space?: { [key: GenericKey]: Val }
|
|
164
|
+
size?: { [key: GenericKey]: Val }
|
|
165
|
+
radius?: { [key: GenericKey]: Val }
|
|
166
|
+
zIndex?: { [key: GenericKey]: Val }
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
export type TokenCategories = 'color' | 'space' | 'size' | 'radius' | 'zIndex'
|
|
@@ -174,11 +174,11 @@ type Tokenify<A extends GenericTokens> = Omit<
|
|
|
174
174
|
},
|
|
175
175
|
TokenCategories
|
|
176
176
|
> & {
|
|
177
|
-
color: TokenifyRecord<A['color']>
|
|
178
|
-
space: TokenifyRecord<A['space']>
|
|
179
|
-
size: TokenifyRecord<A['size']>
|
|
180
|
-
radius: TokenifyRecord<A['radius']>
|
|
181
|
-
zIndex: TokenifyRecord<A['zIndex']>
|
|
177
|
+
color: TokenifyRecord<A extends { color: any } ? A['color'] : {}>
|
|
178
|
+
space: TokenifyRecord<A extends { space: any } ? A['space'] : {}>
|
|
179
|
+
size: TokenifyRecord<A extends { size: any } ? A['size'] : {}>
|
|
180
|
+
radius: TokenifyRecord<A extends { radius: any } ? A['radius'] : {}>
|
|
181
|
+
zIndex: TokenifyRecord<A extends { zIndex: any } ? A['zIndex'] : {}>
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
type TokenifyRecord<A extends Object> = {
|
|
@@ -394,7 +394,7 @@ export type ThemeParsed = {
|
|
|
394
394
|
export type Tokens = TamaguiConfig['tokens']
|
|
395
395
|
|
|
396
396
|
export type TokensParsed = {
|
|
397
|
-
[Key in keyof Tokens]: TokenPrefixed<Tokens[Key]>
|
|
397
|
+
[Key in keyof Required<Tokens>]: TokenPrefixed<Tokens[Key]>
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
type TokenPrefixed<A extends { [key: string]: any }> = {
|
|
@@ -434,8 +434,6 @@ export interface ThemeProps {
|
|
|
434
434
|
inverse?: boolean
|
|
435
435
|
// on the web, for portals we need to re-insert className
|
|
436
436
|
forceClassName?: boolean
|
|
437
|
-
// allows for forcing the auto-update behavior
|
|
438
|
-
shouldUpdate?: () => boolean | undefined
|
|
439
437
|
|
|
440
438
|
// used internally for shallow themes
|
|
441
439
|
shallow?: boolean
|
|
@@ -445,6 +443,7 @@ export interface ThemeProps {
|
|
|
445
443
|
export type UseThemeWithStateProps = ThemeProps & {
|
|
446
444
|
deopt?: boolean
|
|
447
445
|
disable?: boolean
|
|
446
|
+
needsUpdate?: () => boolean
|
|
448
447
|
}
|
|
449
448
|
|
|
450
449
|
type ArrayIntersection<A extends any[]> = A[keyof A]
|
|
@@ -2150,8 +2149,9 @@ export type PropMapper = (
|
|
|
2150
2149
|
key: string,
|
|
2151
2150
|
value: any,
|
|
2152
2151
|
state: GetStyleState,
|
|
2153
|
-
|
|
2154
|
-
) =>
|
|
2152
|
+
disabled: boolean,
|
|
2153
|
+
map: (key: string, val: any) => void
|
|
2154
|
+
) => void
|
|
2155
2155
|
|
|
2156
2156
|
export type GenericVariantDefinitions = {
|
|
2157
2157
|
[key: string]: {
|
package/src/views/Theme.tsx
CHANGED
|
@@ -2,12 +2,12 @@ import { isWeb } from '@tamagui/constants'
|
|
|
2
2
|
import type { MutableRefObject } from 'react'
|
|
3
3
|
import React, { Children, cloneElement, forwardRef, isValidElement, useRef } from 'react'
|
|
4
4
|
import { variableToString } from '../createVariable'
|
|
5
|
-
import {
|
|
5
|
+
import { log } from '../helpers/log'
|
|
6
|
+
import { ThemeManagerContext } from '../helpers/ThemeManagerContext'
|
|
6
7
|
import type { ChangedThemeResponse } from '../hooks/useTheme'
|
|
7
8
|
import { useChangeThemeEffect } from '../hooks/useTheme'
|
|
8
9
|
import type { ThemeProps } from '../types'
|
|
9
10
|
import { ThemeDebug } from './ThemeDebug'
|
|
10
|
-
import { log } from '../helpers/log'
|
|
11
11
|
|
|
12
12
|
export const Theme = forwardRef(function Theme({ children, ...props }: ThemeProps, ref) {
|
|
13
13
|
// @ts-expect-error only for internal views
|
|
@@ -50,7 +50,7 @@ export const Theme = forwardRef(function Theme({ children, ...props }: ThemeProp
|
|
|
50
50
|
|
|
51
51
|
return getThemedChildren(themeState, finalChildren, props, isRoot, stateRef)
|
|
52
52
|
})
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
Theme['avoidForwardRef'] = true
|
|
55
55
|
|
|
56
56
|
export function getThemedChildren(
|
|
@@ -119,9 +119,9 @@ export function getThemedChildren(
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
const elementsWithContext = (
|
|
122
|
-
<
|
|
122
|
+
<ThemeManagerContext.Provider value={themeManager}>
|
|
123
123
|
{next}
|
|
124
|
-
</
|
|
124
|
+
</ThemeManagerContext.Provider>
|
|
125
125
|
)
|
|
126
126
|
|
|
127
127
|
if (forceClassName === false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAkBzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAG/E,OAAO,KAAK,EAEV,SAAS,EAGT,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAElB,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EAMf,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAkBzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAG/E,OAAO,KAAK,EAEV,SAAS,EAGT,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAElB,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EAMf,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;AAuF9D,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,wEA8kC3B;AAoBD,wBAAgB,QAAQ,C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E,YAAY,UAAO;IAkBrB,UAAU;IAUV,WAAW,CAAC,SAAS,EAAE,iBAAiB,EAAE,YAAY,UAAO;IAgB7D,iBAAiB,CACf,KAAK,aAAa,EAClB,KAAK,GAAE,iBAAiB,GAAG,IAAiB,EAC5C,aAAa,sBAAqB;IAapC,oBAAoB,CAClB,SAAS,EAAE,iBAAiB,GAAG,IAAI,EACnC,KAAK,GAAE,iBAAiB,GAAG,IAAiB;IAQ9C,QAAQ,CAAC,KAAK,aAAa,EAAE,aAAa,sBAAqB;IAO/D,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAO;IACnC,IAAI,OAAO,gBAMV;IAED,MAAM,CAAC,MAAM,UAAQ;IAQrB,aAAa,CAAC,EAAE,aAAa,CAAA;IAE7B,UAAU;IAIV,aAAa,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;CAiBzD;AA6KD,KAAK,iBAAiB,GAAG,YAAY,GAAG,SAAS,CAAA;AAKjD,wBAAgB,WAAW,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,uDAY7D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import type { ThemeManager } from './ThemeManager';
|
|
3
|
+
export declare const ThemeManagerContext: React.Context<ThemeManager | null>;
|
|
3
4
|
//# sourceMappingURL=ThemeManagerContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeManagerContext.d.ts","sourceRoot":"","sources":["../../src/helpers/ThemeManagerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ThemeManagerContext.d.ts","sourceRoot":"","sources":["../../src/helpers/ThemeManagerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,eAAO,MAAM,mBAAmB,oCAAiD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandStyle.d.ts","sourceRoot":"","sources":["../../src/helpers/expandStyle.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"expandStyle.d.ts","sourceRoot":"","sources":["../../src/helpers/expandStyle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAQ/C,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,eAAe,CA+CpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/expandStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expandStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/expandStyles.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QA2BnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAChF,OAAO,KAAK,EAEV,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,aAAa,EAOb,eAAe,EACf,YAAY,EAGZ,SAAS,EACT,WAAW,EAEZ,MAAM,UAAU,CAAA;AA2BjB,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;AA+B7B,eAAO,MAAM,cAAc,EAAE,aA0xC5B,CAAA;AAgED,eAAO,MAAM,WAAW,eACV,aAAa,UACjB,MAAM,WACL,MAAM,wBACO,OAAO,KAC5B,SAkCF,CAAA;AAQD,eAAO,MAAM,cAAc,EAAE,aAa5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getThemeCSSRules.d.ts","sourceRoot":"","sources":["../../src/helpers/getThemeCSSRules.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAQ/D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,MAAM,EAAE,kBAAkB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,
|
|
1
|
+
{"version":3,"file":"getThemeCSSRules.d.ts","sourceRoot":"","sources":["../../src/helpers/getThemeCSSRules.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAQ/D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,MAAM,EAAE,kBAAkB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,YAoKA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertStyleRule.d.ts","sourceRoot":"","sources":["../../src/helpers/insertStyleRule.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,aAAa,EACb,aAAa,EAEb,YAAY,EACb,MAAM,UAAU,CAAA;AAQjB,eAAO,MAAM,kBAAkB,IAAK,CAAA;AAEpC,eAAO,MAAM,eAAe,8BAAqB,CAAA;AACjD,eAAO,MAAM,WAAW,gBAAgC,CAAA;AACxD,eAAO,MAAM,gBAAgB,UAA2B,CAAA;AA8BxD,wBAAgB,qBAAqB,SAkBpC;AAID,wBAAgB,aAAa,CAC3B,aAAa,UAAQ,EACrB,MAAM,CAAC,EAAE,YAAY,GACpB,aAAa,GAAG,SAAS,CA8B3B;
|
|
1
|
+
{"version":3,"file":"insertStyleRule.d.ts","sourceRoot":"","sources":["../../src/helpers/insertStyleRule.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,aAAa,EACb,aAAa,EAEb,YAAY,EACb,MAAM,UAAU,CAAA;AAQjB,eAAO,MAAM,kBAAkB,IAAK,CAAA;AAEpC,eAAO,MAAM,eAAe,8BAAqB,CAAA;AACjD,eAAO,MAAM,WAAW,gBAAgC,CAAA;AACxD,eAAO,MAAM,gBAAgB,UAA2B,CAAA;AA8BxD,wBAAgB,qBAAqB,SAkBpC;AAID,wBAAgB,aAAa,CAC3B,aAAa,UAAQ,EACrB,MAAM,CAAC,EAAE,YAAY,GACpB,aAAa,GAAG,SAAS,CA8B3B;AAiOD,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,uBAW9D;AAGD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,QAEjC;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,QAqC5D;AAUD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,WAuBxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeValueWithProperty.d.ts","sourceRoot":"","sources":["../../src/helpers/normalizeValueWithProperty.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"normalizeValueWithProperty.d.ts","sourceRoot":"","sources":["../../src/helpers/normalizeValueWithProperty.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,SAAK,GAAG,GAAG,CAiBzE;AAKD,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAwCxE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { GetStyleState, PropMapper, ResolveVariableAs, TamaguiInternalConfig } from '../types';
|
|
2
2
|
export declare const propMapper: PropMapper;
|
|
3
3
|
export declare function getFontFamilyFromNameOrVariable(input: any, conf: TamaguiInternalConfig): string | undefined;
|
|
4
|
-
export declare const getPropMappedFontFamily: (expanded?: any) => any;
|
|
5
4
|
export declare const getTokenForKey: (key: string, value: string, resolveAs: ResolveVariableAs | undefined, styleState: Partial<GetStyleState>) => any;
|
|
6
5
|
//# sourceMappingURL=propMapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propMapper.d.ts","sourceRoot":"","sources":["../../src/helpers/propMapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"propMapper.d.ts","sourceRoot":"","sources":["../../src/helpers/propMapper.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EAEjB,qBAAqB,EAEtB,MAAM,UAAU,CAAA;AAQjB,eAAO,MAAM,UAAU,EAAE,UAoExB,CAAA;AAmGD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,qBAAqB,sBAkBtF;AAsJD,eAAO,MAAM,cAAc,QACpB,MAAM,SACJ,MAAM,aACF,iBAAiB,0BAChB,OAAO,CAAC,aAAa,CAAC,QAmGnC,CAAA"}
|