@tamagui/web 1.82.0 → 1.82.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.js +2 -2
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/createComponent.native.js +2 -2
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.js +12 -8
- package/dist/cjs/helpers/ThemeManager.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.native.js +12 -8
- package/dist/cjs/helpers/ThemeManager.native.js.map +1 -1
- package/dist/cjs/helpers/expandStyles.js +1 -1
- package/dist/cjs/helpers/expandStyles.js.map +1 -1
- package/dist/cjs/helpers/expandStyles.native.js +1 -1
- package/dist/cjs/helpers/expandStyles.native.js.map +1 -1
- package/dist/cjs/helpers/expandStylesAndRemoveNullishValues.js.map +1 -1
- package/dist/cjs/helpers/expandStylesAndRemoveNullishValues.native.js.map +1 -1
- package/dist/cjs/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/cjs/helpers/getExpandedShorthands.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +1 -1
- package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.js +2 -2
- package/dist/cjs/helpers/getVariantExtras.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.native.js +2 -2
- package/dist/cjs/helpers/getVariantExtras.native.js.map +1 -1
- package/dist/cjs/helpers/mergeVariants.js +8 -21
- package/dist/cjs/helpers/mergeVariants.js.map +1 -1
- package/dist/cjs/helpers/mergeVariants.native.js +8 -21
- package/dist/cjs/helpers/mergeVariants.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeColor.js +2 -2
- package/dist/cjs/helpers/normalizeColor.js.map +1 -1
- package/dist/cjs/helpers/normalizeColor.native.js +2 -2
- package/dist/cjs/helpers/normalizeColor.native.js.map +1 -1
- package/dist/cjs/helpers/propMapper.js +2 -2
- package/dist/cjs/helpers/propMapper.js.map +1 -1
- package/dist/cjs/helpers/propMapper.native.js +2 -2
- package/dist/cjs/helpers/propMapper.native.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeToParents.js +5 -9
- package/dist/cjs/helpers/proxyThemeToParents.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeToParents.native.js +5 -9
- package/dist/cjs/helpers/proxyThemeToParents.native.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeVariables.js +1 -2
- package/dist/cjs/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeVariables.native.js +1 -2
- package/dist/cjs/helpers/proxyThemeVariables.native.js.map +1 -1
- package/dist/cjs/helpers/themeable.js +4 -1
- package/dist/cjs/helpers/themeable.js.map +1 -1
- package/dist/cjs/helpers/themeable.native.js +4 -1
- package/dist/cjs/helpers/themeable.native.js.map +1 -1
- package/dist/cjs/helpers/themes.js +5 -5
- package/dist/cjs/helpers/themes.js.map +1 -1
- package/dist/cjs/helpers/themes.native.js +5 -5
- package/dist/cjs/helpers/themes.native.js.map +1 -1
- package/dist/cjs/hooks/useDisableSSR.js +4 -10
- package/dist/cjs/hooks/useDisableSSR.js.map +1 -1
- package/dist/cjs/hooks/useDisableSSR.native.js +4 -10
- package/dist/cjs/hooks/useDisableSSR.native.js.map +1 -1
- package/dist/cjs/hooks/useMedia.js +3 -3
- package/dist/cjs/hooks/useMedia.js.map +1 -1
- package/dist/cjs/hooks/useMedia.native.js +3 -3
- package/dist/cjs/hooks/useMedia.native.js.map +1 -1
- package/dist/cjs/hooks/useTheme.js +3 -5
- package/dist/cjs/hooks/useTheme.js.map +1 -1
- package/dist/cjs/hooks/useTheme.native.js +3 -5
- package/dist/cjs/hooks/useTheme.native.js.map +1 -1
- package/dist/cjs/views/Theme.js +28 -27
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/Theme.native.js +28 -27
- package/dist/cjs/views/Theme.native.js.map +2 -2
- package/dist/cjs/views/ThemeDebug.js +3 -5
- package/dist/cjs/views/ThemeDebug.js.map +1 -1
- package/dist/esm/createComponent.js +3 -3
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createComponent.native.js +3 -3
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.js +12 -8
- package/dist/esm/helpers/ThemeManager.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.native.js +12 -8
- package/dist/esm/helpers/ThemeManager.native.js.map +1 -1
- package/dist/esm/helpers/expandStyles.js +1 -1
- package/dist/esm/helpers/expandStyles.js.map +1 -1
- package/dist/esm/helpers/expandStyles.native.js +1 -1
- package/dist/esm/helpers/expandStyles.native.js.map +1 -1
- package/dist/esm/helpers/expandStylesAndRemoveNullishValues.js.map +1 -1
- package/dist/esm/helpers/expandStylesAndRemoveNullishValues.native.js.map +1 -1
- package/dist/esm/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/esm/helpers/getExpandedShorthands.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +1 -1
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getVariantExtras.js +1 -2
- package/dist/esm/helpers/getVariantExtras.js.map +1 -1
- package/dist/esm/helpers/getVariantExtras.native.js +1 -2
- package/dist/esm/helpers/getVariantExtras.native.js.map +1 -1
- package/dist/esm/helpers/mergeVariants.js +8 -21
- package/dist/esm/helpers/mergeVariants.js.map +1 -1
- package/dist/esm/helpers/mergeVariants.native.js +8 -21
- package/dist/esm/helpers/mergeVariants.native.js.map +1 -1
- package/dist/esm/helpers/normalizeColor.js +1 -2
- package/dist/esm/helpers/normalizeColor.js.map +1 -1
- package/dist/esm/helpers/normalizeColor.native.js +1 -2
- package/dist/esm/helpers/normalizeColor.native.js.map +1 -1
- package/dist/esm/helpers/propMapper.js +2 -2
- package/dist/esm/helpers/propMapper.js.map +1 -1
- package/dist/esm/helpers/propMapper.native.js +2 -2
- package/dist/esm/helpers/propMapper.native.js.map +1 -1
- package/dist/esm/helpers/proxyThemeToParents.js +3 -7
- package/dist/esm/helpers/proxyThemeToParents.js.map +1 -1
- package/dist/esm/helpers/proxyThemeToParents.native.js +3 -7
- package/dist/esm/helpers/proxyThemeToParents.native.js.map +1 -1
- package/dist/esm/helpers/proxyThemeVariables.js +1 -2
- package/dist/esm/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/esm/helpers/proxyThemeVariables.native.js +1 -2
- package/dist/esm/helpers/proxyThemeVariables.native.js.map +1 -1
- package/dist/esm/helpers/themeable.js +4 -1
- package/dist/esm/helpers/themeable.js.map +1 -1
- package/dist/esm/helpers/themeable.native.js +4 -1
- package/dist/esm/helpers/themeable.native.js.map +1 -1
- package/dist/esm/helpers/themes.js +5 -5
- package/dist/esm/helpers/themes.js.map +1 -1
- package/dist/esm/helpers/themes.native.js +5 -5
- package/dist/esm/helpers/themes.native.js.map +1 -1
- package/dist/esm/hooks/useDisableSSR.js +2 -9
- package/dist/esm/hooks/useDisableSSR.js.map +1 -1
- package/dist/esm/hooks/useDisableSSR.native.js +2 -9
- package/dist/esm/hooks/useDisableSSR.native.js.map +1 -1
- package/dist/esm/hooks/useMedia.js +3 -4
- package/dist/esm/hooks/useMedia.js.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +3 -4
- package/dist/esm/hooks/useMedia.native.js.map +1 -1
- package/dist/esm/hooks/useTheme.js +2 -6
- package/dist/esm/hooks/useTheme.js.map +1 -1
- package/dist/esm/hooks/useTheme.native.js +2 -6
- package/dist/esm/hooks/useTheme.native.js.map +1 -1
- package/dist/esm/views/Theme.js +28 -34
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/Theme.native.js +28 -34
- package/dist/esm/views/Theme.native.js.map +2 -2
- package/dist/esm/views/ThemeDebug.js +3 -4
- package/dist/esm/views/ThemeDebug.js.map +1 -1
- package/package.json +10 -10
- package/src/createComponent.tsx +3 -3
- package/src/helpers/ThemeManager.tsx +12 -8
- package/src/helpers/expandStyles.ts +2 -2
- package/src/helpers/expandStylesAndRemoveNullishValues.ts +0 -1
- package/src/helpers/getExpandedShorthands.ts +3 -0
- package/src/helpers/getSplitStyles.tsx +1 -1
- package/src/helpers/getVariantExtras.tsx +1 -2
- package/src/helpers/mergeVariants.ts +13 -32
- package/src/helpers/normalizeColor.ts +1 -5
- package/src/helpers/propMapper.ts +3 -1
- package/src/helpers/proxyThemeToParents.ts +5 -8
- package/src/helpers/proxyThemeVariables.tsx +1 -3
- package/src/helpers/themeable.tsx +5 -3
- package/src/helpers/themes.ts +4 -5
- package/src/hooks/useDisableSSR.tsx +2 -10
- package/src/hooks/useMedia.tsx +4 -5
- package/src/hooks/useTheme.tsx +2 -8
- package/src/views/Theme.tsx +44 -52
- package/src/views/ThemeDebug.tsx +7 -5
- package/types/helpers/ThemeManager.d.ts +1 -1
- package/types/helpers/ThemeManager.d.ts.map +1 -1
- package/types/helpers/expandStylesAndRemoveNullishValues.d.ts.map +1 -1
- package/types/helpers/getExpandedShorthands.d.ts +3 -0
- package/types/helpers/getExpandedShorthands.d.ts.map +1 -1
- package/types/helpers/getVariantExtras.d.ts.map +1 -1
- package/types/helpers/mergeVariants.d.ts +1 -1
- package/types/helpers/mergeVariants.d.ts.map +1 -1
- package/types/helpers/normalizeColor.d.ts.map +1 -1
- package/types/helpers/propMapper.d.ts.map +1 -1
- package/types/helpers/proxyThemeToParents.d.ts +0 -1
- package/types/helpers/proxyThemeToParents.d.ts.map +1 -1
- package/types/helpers/proxyThemeVariables.d.ts.map +1 -1
- package/types/helpers/themeable.d.ts.map +1 -1
- package/types/helpers/themes.d.ts.map +1 -1
- package/types/hooks/useDisableSSR.d.ts +1 -2
- package/types/hooks/useDisableSSR.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/views/Theme.d.ts +1 -1
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeDebug.d.ts.map +1 -1
- package/src/helpers/createChainedWeakCache.tsx +0 -39
- package/src/helpers/createProxy.ts +0 -15
- package/src/hooks/getThemeUnwrapped.tsx +0 -5
- package/src/hooks/useId.tsx +0 -1
- package/src/hooks/useMemoDebug.tsx +0 -18
package/src/helpers/themes.ts
CHANGED
|
@@ -4,19 +4,18 @@ import { createVariable, isVariable } from '../createVariable'
|
|
|
4
4
|
// shared by createTamagui so extracted here
|
|
5
5
|
export function ensureThemeVariable(theme: any, key: string) {
|
|
6
6
|
const val = theme[key]
|
|
7
|
-
const themeKey = key
|
|
8
7
|
if (!isVariable(val)) {
|
|
9
8
|
theme[key] = createVariable({
|
|
10
|
-
key
|
|
11
|
-
name:
|
|
9
|
+
key,
|
|
10
|
+
name: key,
|
|
12
11
|
val,
|
|
13
12
|
})
|
|
14
13
|
} else {
|
|
15
|
-
if (val.name !==
|
|
14
|
+
if (val.name !== key) {
|
|
16
15
|
// rename to theme name
|
|
17
16
|
theme[key] = createVariable({
|
|
18
17
|
key: val.name,
|
|
19
|
-
name:
|
|
18
|
+
name: key,
|
|
20
19
|
val: val.val,
|
|
21
20
|
})
|
|
22
21
|
}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { useContext } from 'react'
|
|
2
|
-
|
|
3
1
|
import { getConfig } from '../config'
|
|
4
|
-
import { ComponentContext } from '../contexts/ComponentContext'
|
|
5
2
|
import { ComponentContextI } from '../types'
|
|
6
3
|
|
|
7
|
-
export function
|
|
8
|
-
|
|
9
|
-
return getDisableSSR(componentContext)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function getDisableSSR(componentContext: ComponentContextI) {
|
|
13
|
-
return componentContext.disableSSR ?? getConfig().disableSSR
|
|
4
|
+
export function getDisableSSR(componentContext?: ComponentContextI) {
|
|
5
|
+
return componentContext?.disableSSR ?? getConfig().disableSSR
|
|
14
6
|
}
|
package/src/hooks/useMedia.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { isServer, isWeb
|
|
1
|
+
import { isServer, isWeb } from '@tamagui/constants'
|
|
2
2
|
import { useRef, useSyncExternalStore } from 'react'
|
|
3
3
|
|
|
4
4
|
import { getConfig } from '../config'
|
|
5
|
-
import { createProxy } from '../helpers/createProxy'
|
|
6
5
|
import { matchMedia } from '../helpers/matchMedia'
|
|
7
6
|
import { pseudoDescriptors } from '../helpers/pseudoDescriptors'
|
|
8
7
|
import type {
|
|
@@ -15,12 +14,12 @@ import type {
|
|
|
15
14
|
TamaguiInternalConfig,
|
|
16
15
|
UseMediaState,
|
|
17
16
|
} from '../types'
|
|
18
|
-
import { getDisableSSR
|
|
17
|
+
import { getDisableSSR } from './useDisableSSR'
|
|
19
18
|
|
|
20
19
|
export let mediaState: MediaQueryState =
|
|
21
20
|
// development only safeguard
|
|
22
21
|
process.env.NODE_ENV === 'development'
|
|
23
|
-
?
|
|
22
|
+
? new Proxy(
|
|
24
23
|
{},
|
|
25
24
|
{
|
|
26
25
|
get(target, key) {
|
|
@@ -191,7 +190,7 @@ function subscribe(subscriber: any) {
|
|
|
191
190
|
export function useMedia(uid?: any, componentContext?: ComponentContextI): UseMediaState {
|
|
192
191
|
const internal = useRef<UseMediaInternalState | undefined>()
|
|
193
192
|
// performance boost to avoid using context twice
|
|
194
|
-
const disableSSR =
|
|
193
|
+
const disableSSR = getDisableSSR(componentContext)
|
|
195
194
|
const initialState = (disableSSR || !isWeb ? mediaState : initState) || {}
|
|
196
195
|
|
|
197
196
|
const state = useSyncExternalStore<MediaQueryState>(
|
package/src/hooks/useTheme.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import { useContext, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
3
3
|
|
|
4
4
|
import { getConfig } from '../config'
|
|
5
5
|
import { Variable, getVariable } from '../createVariable'
|
|
6
|
-
import { createProxy } from '../helpers/createProxy'
|
|
7
6
|
import { isEqualShallow } from '../helpers/createShallowSetState'
|
|
8
7
|
import {
|
|
9
8
|
ThemeManager,
|
|
@@ -19,7 +18,6 @@ import type {
|
|
|
19
18
|
VariableVal,
|
|
20
19
|
VariableValGeneric,
|
|
21
20
|
} from '../types'
|
|
22
|
-
import { GetThemeUnwrapped } from './getThemeUnwrapped'
|
|
23
21
|
|
|
24
22
|
export type ChangedThemeResponse = {
|
|
25
23
|
state?: ThemeManagerState
|
|
@@ -156,7 +154,7 @@ export function getThemeProxied(
|
|
|
156
154
|
}
|
|
157
155
|
}
|
|
158
156
|
|
|
159
|
-
return
|
|
157
|
+
return new Proxy(theme, {
|
|
160
158
|
has(_, key) {
|
|
161
159
|
if (Reflect.has(theme, key)) {
|
|
162
160
|
return true
|
|
@@ -167,10 +165,6 @@ export function getThemeProxied(
|
|
|
167
165
|
}
|
|
168
166
|
},
|
|
169
167
|
get(_, key) {
|
|
170
|
-
if (key === GetThemeUnwrapped) {
|
|
171
|
-
return theme
|
|
172
|
-
}
|
|
173
|
-
|
|
174
168
|
if (
|
|
175
169
|
// dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
|
|
176
170
|
// if someone is crazy enough to use "undefined" as a theme key then this not working is on them
|
|
@@ -499,7 +493,7 @@ export const useChangeThemeEffect = (
|
|
|
499
493
|
|
|
500
494
|
const wasInversed = prev?.inversed
|
|
501
495
|
const nextInversed = isNewTheme && state.scheme !== parentManager?.state.scheme
|
|
502
|
-
const inversed = nextInversed ? true : wasInversed ? false : null
|
|
496
|
+
const inversed = nextInversed ? true : wasInversed != null ? false : null
|
|
503
497
|
|
|
504
498
|
const response: ChangedThemeResponse = {
|
|
505
499
|
themeManager,
|
package/src/views/Theme.tsx
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { isWeb } from '@tamagui/constants'
|
|
2
|
-
import React, {
|
|
3
|
-
Children,
|
|
4
|
-
cloneElement,
|
|
5
|
-
forwardRef,
|
|
6
|
-
isValidElement,
|
|
7
|
-
useMemo,
|
|
8
|
-
useRef,
|
|
9
|
-
} from 'react'
|
|
2
|
+
import React, { Children, cloneElement, forwardRef, isValidElement, useRef } from 'react'
|
|
10
3
|
|
|
11
4
|
import { variableToString } from '../createVariable'
|
|
12
5
|
import { ThemeManagerContext } from '../helpers/ThemeManagerContext'
|
|
@@ -14,66 +7,65 @@ import { ChangedThemeResponse, useChangeThemeEffect } from '../hooks/useTheme'
|
|
|
14
7
|
import type { ThemeProps } from '../types'
|
|
15
8
|
import { ThemeDebug } from './ThemeDebug'
|
|
16
9
|
|
|
17
|
-
export const Theme = forwardRef(function Theme(props: ThemeProps, ref) {
|
|
10
|
+
export const Theme = forwardRef(function Theme({ children, ...props }: ThemeProps, ref) {
|
|
18
11
|
// @ts-expect-error only for internal views
|
|
19
12
|
if (props.disable) {
|
|
20
|
-
return
|
|
13
|
+
return children
|
|
21
14
|
}
|
|
22
15
|
|
|
23
16
|
const isRoot = !!props['_isRoot']
|
|
24
|
-
const disableDirectChildTheme = props['disable-child-theme']
|
|
25
17
|
const themeState = useChangeThemeEffect(props, isRoot)
|
|
18
|
+
const disableDirectChildTheme = props['disable-child-theme']
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
//ok
|
|
40
|
-
}
|
|
20
|
+
let finalChildren = disableDirectChildTheme
|
|
21
|
+
? Children.map(children, (child) =>
|
|
22
|
+
cloneElement(child, { ['data-disable-theme']: true })
|
|
23
|
+
)
|
|
24
|
+
: children
|
|
25
|
+
|
|
26
|
+
if (ref) {
|
|
27
|
+
try {
|
|
28
|
+
React.Children.only(finalChildren)
|
|
29
|
+
finalChildren = cloneElement(finalChildren, { ref })
|
|
30
|
+
} catch {
|
|
31
|
+
//ok
|
|
41
32
|
}
|
|
33
|
+
}
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
35
|
+
if (process.env.NODE_ENV === 'development') {
|
|
36
|
+
if (props.debug === 'visualize') {
|
|
37
|
+
finalChildren = (
|
|
38
|
+
<ThemeDebug themeState={themeState} themeProps={props}>
|
|
39
|
+
{finalChildren}
|
|
40
|
+
</ThemeDebug>
|
|
41
|
+
)
|
|
51
42
|
}
|
|
43
|
+
}
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
}, [props.children, disableDirectChildTheme])
|
|
55
|
-
|
|
56
|
-
return useThemedChildren(themeState, children, props, isRoot)
|
|
45
|
+
return getThemedChildren(themeState, finalChildren, props, isRoot)
|
|
57
46
|
})
|
|
58
47
|
Theme['displayName'] = 'Theme'
|
|
59
48
|
Theme['avoidForwardRef'] = true
|
|
60
49
|
|
|
61
|
-
export function
|
|
50
|
+
export function getThemedChildren(
|
|
62
51
|
themeState: ChangedThemeResponse,
|
|
63
52
|
children: any,
|
|
64
53
|
props: ThemeProps,
|
|
65
|
-
isRoot = false
|
|
66
|
-
avoidWrap = false
|
|
54
|
+
isRoot = false
|
|
67
55
|
) {
|
|
68
56
|
const { themeManager, isNewTheme } = themeState
|
|
57
|
+
|
|
58
|
+
// its always there.. should fix type
|
|
59
|
+
if (!themeManager) throw `❌`
|
|
60
|
+
|
|
69
61
|
const { shallow, forceClassName } = props
|
|
70
62
|
const hasEverThemed = useRef(false)
|
|
71
|
-
if (isNewTheme) {
|
|
72
|
-
hasEverThemed.current = true
|
|
73
|
-
}
|
|
74
63
|
|
|
75
64
|
const shouldRenderChildrenWithTheme =
|
|
76
65
|
isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot
|
|
66
|
+
if (shouldRenderChildrenWithTheme) {
|
|
67
|
+
hasEverThemed.current = true
|
|
68
|
+
}
|
|
77
69
|
|
|
78
70
|
if (!shouldRenderChildrenWithTheme) {
|
|
79
71
|
return children
|
|
@@ -82,7 +74,7 @@ export function useThemedChildren(
|
|
|
82
74
|
let next = children
|
|
83
75
|
|
|
84
76
|
// each children of these children wont get the theme
|
|
85
|
-
if (shallow
|
|
77
|
+
if (shallow) {
|
|
86
78
|
next = Children.toArray(children).map((child) => {
|
|
87
79
|
return isValidElement(child)
|
|
88
80
|
? cloneElement(
|
|
@@ -96,19 +88,17 @@ export function useThemedChildren(
|
|
|
96
88
|
})
|
|
97
89
|
}
|
|
98
90
|
|
|
99
|
-
const elementsWithContext =
|
|
91
|
+
const elementsWithContext = (
|
|
100
92
|
<ThemeManagerContext.Provider value={themeManager}>
|
|
101
93
|
{next}
|
|
102
94
|
</ThemeManagerContext.Provider>
|
|
103
|
-
) : (
|
|
104
|
-
next
|
|
105
95
|
)
|
|
106
96
|
|
|
107
97
|
if (forceClassName === false) {
|
|
108
98
|
return elementsWithContext
|
|
109
99
|
}
|
|
110
100
|
|
|
111
|
-
if (isWeb
|
|
101
|
+
if (isWeb) {
|
|
112
102
|
return wrapThemeElements({
|
|
113
103
|
children: elementsWithContext,
|
|
114
104
|
themeState,
|
|
@@ -138,10 +128,6 @@ function wrapThemeElements({
|
|
|
138
128
|
const inverse = themeState.inversed
|
|
139
129
|
const requiresExtraWrapper = inverse != null || forceClassName
|
|
140
130
|
|
|
141
|
-
if (!themeState.isNewTheme && !requiresExtraWrapper) {
|
|
142
|
-
return <span className="_dsp_contents is_Theme">{children}</span>
|
|
143
|
-
}
|
|
144
|
-
|
|
145
131
|
const { className, style } = getThemeClassNameAndStyle(themeState, isRoot)
|
|
146
132
|
|
|
147
133
|
let themedChildren = (
|
|
@@ -168,7 +154,13 @@ function wrapThemeElements({
|
|
|
168
154
|
return themedChildren
|
|
169
155
|
}
|
|
170
156
|
|
|
157
|
+
const emptyObj = {}
|
|
158
|
+
|
|
171
159
|
function getThemeClassNameAndStyle(themeState: ChangedThemeResponse, isRoot = false) {
|
|
160
|
+
if (!themeState.isNewTheme) {
|
|
161
|
+
return { className: '', style: emptyObj }
|
|
162
|
+
}
|
|
163
|
+
|
|
172
164
|
// in order to provide currentColor, set color by default
|
|
173
165
|
const themeColor =
|
|
174
166
|
themeState.state?.theme && themeState.isNewTheme
|
package/src/views/ThemeDebug.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isServer } from '@tamagui/constants'
|
|
2
|
+
import { useDidFinishSSR } from '@tamagui/use-did-finish-ssr'
|
|
1
3
|
import { useForceUpdate } from '@tamagui/use-force-update'
|
|
2
4
|
import { useEffect, useId, useState } from 'react'
|
|
3
5
|
import { createPortal } from 'react-dom'
|
|
@@ -16,12 +18,8 @@ export function ThemeDebug({
|
|
|
16
18
|
themeProps: ThemeProps
|
|
17
19
|
children: any
|
|
18
20
|
}) {
|
|
19
|
-
// disabled
|
|
20
|
-
if (themeProps['disable-child-theme']) {
|
|
21
|
-
return children
|
|
22
|
-
}
|
|
23
|
-
|
|
24
21
|
if (process.env.NODE_ENV === 'development') {
|
|
22
|
+
const isHydrated = useDidFinishSSR()
|
|
25
23
|
const [onChangeCount, setOnChangeCount] = useState(0)
|
|
26
24
|
const rerender = useForceUpdate()
|
|
27
25
|
const id = useId()
|
|
@@ -60,6 +58,10 @@ export function ThemeDebug({
|
|
|
60
58
|
return () => clearTimeout(tm as any)
|
|
61
59
|
}, [])
|
|
62
60
|
|
|
61
|
+
if (themeProps['disable-child-theme'] || !isHydrated) {
|
|
62
|
+
return children
|
|
63
|
+
}
|
|
64
|
+
|
|
63
65
|
return (
|
|
64
66
|
<>
|
|
65
67
|
{createPortal(
|
|
@@ -15,7 +15,7 @@ export type ThemeManagerState = {
|
|
|
15
15
|
className?: string;
|
|
16
16
|
scheme?: ColorScheme;
|
|
17
17
|
};
|
|
18
|
-
export declare function getHasThemeUpdatingProps(props: ThemeProps):
|
|
18
|
+
export declare function getHasThemeUpdatingProps(props: ThemeProps): boolean;
|
|
19
19
|
export declare class ThemeManager {
|
|
20
20
|
props: ThemeProps;
|
|
21
21
|
id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeManager.d.ts","sourceRoot":"","sources":["../../src/helpers/ThemeManager.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE/D,KAAK,aAAa,GAAG,CACnB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,OAAO,KACZ,IAAI,CAAA;AAET,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AAID,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"ThemeManager.d.ts","sourceRoot":"","sources":["../../src/helpers/ThemeManager.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE/D,KAAK,aAAa,GAAG,CACnB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,OAAO,KACZ,IAAI,CAAA;AAET,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AAID,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,UAAU,WAEzD;AAID,qBAAa,YAAY;IAOd,KAAK,EAAE,UAAU;IAN1B,EAAE,SAAQ;IACV,cAAc,qBAA2B;IACzC,aAAa,EAAE,YAAY,GAAG,IAAI,CAAO;IACzC,KAAK,EAAE,iBAAiB,CAAa;gBAG5B,KAAK,GAAE,UAAe,EAC7B,aAAa,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;IA0B1D,oBAAoB,CAClB,KAAK,GAAE,UAAU,GAAG;QAAE,UAAU,CAAC,EAAE,WAAW,CAAA;KAAqB,EACnE,YAAY,UAAO;IAkBrB,WAAW,CAAC,SAAS,EAAE,iBAAiB,EAAE,YAAY,UAAO;IAoB7D,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;IAIrB,aAAa,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM;CAalD;AAiLD,KAAK,iBAAiB,GAAG,YAAY,GAAG,SAAS,CAAA;AAKjD,wBAAgB,WAAW,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,uDAY7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandStylesAndRemoveNullishValues.d.ts","sourceRoot":"","sources":["../../src/helpers/expandStylesAndRemoveNullishValues.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expandStylesAndRemoveNullishValues.d.ts","sourceRoot":"","sources":["../../src/helpers/expandStylesAndRemoveNullishValues.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,gBAAgB,UAAQ,uBAwBzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExpandedShorthands.d.ts","sourceRoot":"","sources":["../../src/helpers/getExpandedShorthands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,KAAK,EAAE,CAAC,GACP,IAAI,CAAC,CAAC,EAAE,MAAM,UAAU,CAAC,CAS3B"}
|
|
1
|
+
{"version":3,"file":"getExpandedShorthands.d.ts","sourceRoot":"","sources":["../../src/helpers/getExpandedShorthands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,KAAK,EAAE,CAAC,GACP,IAAI,CAAC,CAAC,EAAE,MAAM,UAAU,CAAC,CAS3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVariantExtras.d.ts","sourceRoot":"","sources":["../../src/helpers/getVariantExtras.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"getVariantExtras.d.ts","sourceRoot":"","sources":["../../src/helpers/getVariantExtras.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,OAqCzD;AAID,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,mBAAmB,OAkBrF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { GenericVariantDefinitions } from '../types';
|
|
2
|
-
export declare const mergeVariants: (parentVariants: GenericVariantDefinitions, ourVariants: GenericVariantDefinitions) => {};
|
|
2
|
+
export declare const mergeVariants: (parentVariants: GenericVariantDefinitions, ourVariants: GenericVariantDefinitions, level?: number) => {};
|
|
3
3
|
//# sourceMappingURL=mergeVariants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeVariants.d.ts","sourceRoot":"","sources":["../../src/helpers/mergeVariants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAA;AAKzD,eAAO,MAAM,aAAa,mBACR,yBAAyB,eAC5B,yBAAyB,
|
|
1
|
+
{"version":3,"file":"mergeVariants.d.ts","sourceRoot":"","sources":["../../src/helpers/mergeVariants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAA;AAKzD,eAAO,MAAM,aAAa,mBACR,yBAAyB,eAC5B,yBAAyB,uBAgCvC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeColor.d.ts","sourceRoot":"","sources":["../../src/helpers/normalizeColor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalizeColor.d.ts","sourceRoot":"","sources":["../../src/helpers/normalizeColor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AAEnD,eAAO,MAAM,cAAc,WAAY,MAAM,GAAG,IAAI,YAAY,MAAM,uBAqBrE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propMapper.d.ts","sourceRoot":"","sources":["../../src/helpers/propMapper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EAEjB,qBAAqB,EAEtB,MAAM,UAAU,CAAA;AAOjB,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"propMapper.d.ts","sourceRoot":"","sources":["../../src/helpers/propMapper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EAEjB,qBAAqB,EAEtB,MAAM,UAAU,CAAA;AAOjB,eAAO,MAAM,UAAU,EAAE,UAyFxB,CAAA;AAgGD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,qBAAqB,sBAkBtF;AAMD,eAAO,MAAM,uBAAuB,cAAe,GAAG,QAErD,CAAA;AA6ID,eAAO,MAAM,cAAc,QACpB,MAAM,SACJ,MAAM,wDAED,QAAQ,aAAa,CAAC,QAiGnC,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DedupedThemes, ThemeParsed } from '../types';
|
|
2
|
-
export declare const themesRaw: Record<string, ThemeParsed>;
|
|
3
2
|
export declare function proxyThemesToParents(dedupedThemes: DedupedThemes): Record<string, ThemeParsed>;
|
|
4
3
|
export declare function proxyThemeToParents(themeName: string, theme: ThemeParsed): ThemeParsed;
|
|
5
4
|
//# sourceMappingURL=proxyThemeToParents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxyThemeToParents.d.ts","sourceRoot":"","sources":["../../src/helpers/proxyThemeToParents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxyThemeToParents.d.ts","sourceRoot":"","sources":["../../src/helpers/proxyThemeToParents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAMrD,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,aAAa,GAC3B,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAsB7B;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,eAqCxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxyThemeVariables.d.ts","sourceRoot":"","sources":["../../src/helpers/proxyThemeVariables.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxyThemeVariables.d.ts","sourceRoot":"","sources":["../../src/helpers/proxyThemeVariables.tsx"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAS/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeable.d.ts","sourceRoot":"","sources":["../../src/helpers/themeable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvD,wBAAgB,SAAS,CAAC,aAAa,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,EACjE,SAAS,EAAE,aAAa,EACxB,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"themeable.d.ts","sourceRoot":"","sources":["../../src/helpers/themeable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvD,wBAAgB,SAAS,CAAC,aAAa,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,EACjE,SAAS,EAAE,aAAa,EACxB,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,kIAkCrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/helpers/themes.ts"],"names":[],"mappings":"AAIA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/helpers/themes.ts"],"names":[],"mappings":"AAIA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,QAkB1D"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { ComponentContextI } from '../types';
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function getDisableSSR(componentContext: ComponentContextI): boolean | undefined;
|
|
2
|
+
export declare function getDisableSSR(componentContext?: ComponentContextI): boolean | undefined;
|
|
4
3
|
//# sourceMappingURL=useDisableSSR.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDisableSSR.d.ts","sourceRoot":"","sources":["../../src/hooks/useDisableSSR.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDisableSSR.d.ts","sourceRoot":"","sources":["../../src/hooks/useDisableSSR.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE5C,wBAAgB,aAAa,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,uBAEjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../src/hooks/useMedia.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../src/hooks/useMedia.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACd,MAAM,UAAU,CAAA;AAGjB,eAAO,IAAI,UAAU,EAAE,eAmBN,CAAA;AAEjB,eAAO,MAAM,gBAAgB,EAAE,YAAiB,CAAA;AAEhD,eAAO,MAAM,QAAQ,uBAAmB,CAAA;AAExC,eAAO,MAAM,SAAS,aAAoB,CAAA;AAE1C,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,WAQxC,CAAA;AAUD,eAAO,MAAM,qBAAqB,QAAS,MAAM,WAchD,CAAA;AAMD,eAAO,MAAM,cAAc,WAAY,qBAAqB,SAiB3D,CAAA;AAaD,wBAAgB,mBAAmB,SAiClC;AAsBD,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,aAAa,EAAE,CAAA;CACtB,CAAA;AAID,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,6BAEhE;AAYD,wBAAgB,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAgDvF;AAED,eAAO,MAAM,iCAAiC,aAClC,MAAM,OACX,MAAM,mBACM,OAAO,MAAM,EAAE,MAAM,CAAC,eAC1B,OAAO,kBAQrB,CAAA;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,GAAG,EACV,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,WAAW,EAAE,OAAO,EACpB,cAAc,CAAC,EAAE,MAAM,WAiBxB;AASD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,EAAE,GAAG,CAAC,EAAE,MAAM,UAwBjF;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAE1C;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,WAY9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAe,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAe,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EACL,YAAY,EACZ,iBAAiB,EAElB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,iBAAiB,CAAA;IACzB,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAClC,UAAU,EAAE,OAAO,CAAA;IAGnB,QAAQ,CAAC,EAAE,IAAI,GAAG,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAcD,MAAM,MAAM,aAAa,CAAC,GAAG,IAAI,GAAG,GAAG;IACrC;;;;;;;;;OASG;IACH,GAAG,EAAE,CACH,QAAQ,CAAC,EAAE,KAAK,KAEd,MAAM,GACN,CAAC,GAAG,SAAS,QAAQ,CAAC,MAAM,CAAC,CAAC,GAC1B,CAAC,SAAS,kBAAkB,GAC1B,GAAG,GACH,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,GACtB,GAAG,SAAS,WAAW,GACvB,MAAM,GAAG,MAAM,GACf,OAAO,CAAC,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;KAC1B,GAAG,IAAI,MAAM,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAC5D,CAAA;AAED,eAAO,MAAM,QAAQ,WAAW,UAAU,mBAIzC,CAAA;AAED,eAAO,MAAM,iBAAiB,UACrB,sBAAsB,KAC5B,CAAC,oBAAoB,EAAE,WAAW,CAuDpC,CAAA;AAED,wBAAgB,eAAe,CAC7B,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAC1C,KAAK,UAAQ,EACb,YAAY,CAAC,EAAE,YAAY,EAC3B,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,KAAK,CAAC,EAAE,SAAS,GAChB,cAAc,CA0GhB;AAeD,eAAO,MAAM,mBAAmB,mBAA0B,CAAA;AAE1D,eAAO,MAAM,oBAAoB,UACxB,sBAAsB,2BAEtB,MAAM,EAAE,iBACA,MAAM,OAAO,GAAG,SAAS,KACvC,oBA4QF,CAAA"}
|
package/types/views/Theme.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ChangedThemeResponse } from '../hooks/useTheme';
|
|
3
3
|
import type { ThemeProps } from '../types';
|
|
4
4
|
export declare const Theme: React.ForwardRefExoticComponent<ThemeProps & React.RefAttributes<unknown>>;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function getThemedChildren(themeState: ChangedThemeResponse, children: any, props: ThemeProps, isRoot?: boolean): any;
|
|
6
6
|
//# sourceMappingURL=Theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../src/views/Theme.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../src/views/Theme.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqE,MAAM,OAAO,CAAA;AAIzF,OAAO,EAAE,oBAAoB,EAAwB,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,eAAO,MAAM,KAAK,4EAoChB,CAAA;AAIF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,oBAAoB,EAChC,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE,UAAU,EACjB,MAAM,UAAQ,OAyDf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeDebug.d.ts","sourceRoot":"","sources":["../../src/views/ThemeDebug.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThemeDebug.d.ts","sourceRoot":"","sources":["../../src/views/ThemeDebug.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAIrC,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,GAAG,CAAA;CACd,OAoFA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export const createChainedWeakCache = () => {
|
|
2
|
-
const baseMap = new WeakMap()
|
|
3
|
-
|
|
4
|
-
return {
|
|
5
|
-
get: (args: any[]) => {
|
|
6
|
-
let cur = baseMap
|
|
7
|
-
for (let arg of args) {
|
|
8
|
-
if (cur.has(arg)) {
|
|
9
|
-
cur = cur.get(arg)
|
|
10
|
-
} else {
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return cur
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
set(args: any[], result: any) {
|
|
18
|
-
const len = args.length
|
|
19
|
-
let cur = baseMap
|
|
20
|
-
|
|
21
|
-
for (let i = 0; i < len; i++) {
|
|
22
|
-
const arg = args[i]
|
|
23
|
-
const isLast = i === len - 1
|
|
24
|
-
|
|
25
|
-
if (isLast) {
|
|
26
|
-
cur!.set(arg, result)
|
|
27
|
-
} else {
|
|
28
|
-
if (cur.has(arg)) {
|
|
29
|
-
cur = cur.get(arg)
|
|
30
|
-
} else {
|
|
31
|
-
const next = new WeakMap()
|
|
32
|
-
cur.set(arg, next)
|
|
33
|
-
cur = next
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function createProxy<A extends object>(target: A, handler: ProxyHandler<A>) {
|
|
2
|
-
if (process.env.NODE_ENV === 'development') {
|
|
3
|
-
if (typeof target !== 'object' || !target) {
|
|
4
|
-
console.warn(
|
|
5
|
-
'Invalid object given for proxy:',
|
|
6
|
-
target,
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
This can be due to a missing theme or configuration given to Tamagui.`,
|
|
10
|
-
new Error().stack
|
|
11
|
-
)
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return new Proxy(target || {}, handler)
|
|
15
|
-
}
|
package/src/hooks/useId.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useId } from 'react'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// only for debugging if a useMemo is working
|
|
2
|
-
|
|
3
|
-
import { useMemo } from 'react'
|
|
4
|
-
|
|
5
|
-
export const useMemoDebug: typeof useMemo = (fn, args) => {
|
|
6
|
-
let run = 1
|
|
7
|
-
|
|
8
|
-
const res = useMemo(() => {
|
|
9
|
-
run = 0
|
|
10
|
-
return fn()
|
|
11
|
-
}, args)
|
|
12
|
-
|
|
13
|
-
if (run === 1) {
|
|
14
|
-
console.info('saved a run')
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return res
|
|
18
|
-
}
|