@tamagui/core 1.0.1-beta.206 → 1.0.1-beta.208
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 +5 -3
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +0 -1
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +46 -19
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +4 -4
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +5 -2
- package/dist/cjs/views/TamaguiProvider.js.map +3 -3
- package/dist/esm/createComponent.js +5 -3
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +0 -1
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +45 -18
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +4 -4
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.js +5 -2
- package/dist/esm/views/TamaguiProvider.js.map +3 -3
- package/package.json +12 -12
- package/src/createComponent.tsx +6 -4
- package/src/createTamagui.ts +0 -1
- package/src/helpers/getSplitStyles.tsx +51 -19
- package/src/helpers/themeable.tsx +3 -8
- package/src/hooks/useTheme.tsx +3 -3
- package/src/types.tsx +1 -3
- package/src/views/TamaguiProvider.tsx +6 -2
- package/types/helpers/themeable.d.ts +4 -7
- package/types/hooks/useTheme.d.ts +3 -3
- package/types/types.d.ts +1 -2
package/src/types.tsx
CHANGED
|
@@ -257,7 +257,7 @@ export type Tokens = TamaguiConfig['tokens']
|
|
|
257
257
|
export type Shorthands = TamaguiConfig['shorthands']
|
|
258
258
|
export type Media = TamaguiConfig['media']
|
|
259
259
|
export type Themes = TamaguiConfig['themes']
|
|
260
|
-
export type ThemeName = GetAltThemeNames<keyof Themes>
|
|
260
|
+
export type ThemeName = Exclude<GetAltThemeNames<keyof Themes>, number>
|
|
261
261
|
export type ThemeTokens = `$${ThemeKeys}`
|
|
262
262
|
export type AnimationKeys = TamaguiConfig['animations'] extends AnimationDriver<infer Config>
|
|
263
263
|
? keyof Config
|
|
@@ -294,8 +294,6 @@ export type CreateTamaguiProps = {
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
-
defaultTheme?: string
|
|
298
|
-
|
|
299
297
|
/**
|
|
300
298
|
* *Advanced use case* For all CSS extracted views, this has no effect.
|
|
301
299
|
*
|
|
@@ -6,6 +6,7 @@ import { TextAncestorContext } from '../contexts/TextAncestorContext'
|
|
|
6
6
|
import { useMediaListeners } from '../hooks/useMedia'
|
|
7
7
|
import type { TamaguiProviderProps } from '../types'
|
|
8
8
|
import { ThemeProvider } from './ThemeProvider'
|
|
9
|
+
import { getConfig } from '..'
|
|
9
10
|
|
|
10
11
|
export function TamaguiProvider({
|
|
11
12
|
children,
|
|
@@ -14,8 +15,9 @@ export function TamaguiProvider({
|
|
|
14
15
|
...themePropsProvider
|
|
15
16
|
}: TamaguiProviderProps) {
|
|
16
17
|
if (isRSC) {
|
|
18
|
+
const { themes } = getConfig()
|
|
17
19
|
return (
|
|
18
|
-
<span style={{ display: 'contents' }} className={`t_${
|
|
20
|
+
<span style={{ display: 'contents' }} className={`t_${Object.keys(themes)[0] || 'light'}`}>
|
|
19
21
|
{children}
|
|
20
22
|
</span>
|
|
21
23
|
)
|
|
@@ -39,14 +41,16 @@ export function TamaguiProvider({
|
|
|
39
41
|
}, [config, disableInjectCSS])
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
const { themes } = getConfig()
|
|
45
|
+
|
|
42
46
|
return (
|
|
43
47
|
<ButtonInsideButtonContext.Provider value={false}>
|
|
44
48
|
<TextAncestorContext.Provider value={false}>
|
|
45
49
|
<ThemeProvider
|
|
46
|
-
defaultTheme={config.defaultTheme || 'light'}
|
|
47
50
|
themeClassNameOnRoot={config.themeClassNameOnRoot}
|
|
48
51
|
disableRootThemeClass={config.disableRootThemeClass}
|
|
49
52
|
{...themePropsProvider}
|
|
53
|
+
defaultTheme={themePropsProvider.defaultTheme ?? Object.keys(themes)[0]}
|
|
50
54
|
>
|
|
51
55
|
{children}
|
|
52
56
|
</ThemeProvider>
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { ThemeName } from '../types';
|
|
2
|
-
export
|
|
3
|
-
theme?: ThemeName |
|
|
2
|
+
export interface ThemeableProps {
|
|
3
|
+
theme?: ThemeName | null;
|
|
4
4
|
themeInverse?: boolean;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
export declare function themeable<Component extends (props: any) => any>(component: Component, opts?: {
|
|
7
7
|
componentName?: string;
|
|
8
|
-
}): Component extends (props: infer P) => infer R ? (props: Omit<P, "theme" | "themeInverse"> &
|
|
9
|
-
theme?: ThemeName | null | undefined;
|
|
10
|
-
themeInverse?: boolean | undefined;
|
|
11
|
-
}) => R : unknown;
|
|
8
|
+
}): Component extends (props: infer P) => infer R ? (props: Omit<P, "theme" | "themeInverse"> & ThemeableProps) => R : unknown;
|
|
12
9
|
//# sourceMappingURL=themeable.d.ts.map
|
|
@@ -11,10 +11,10 @@ export interface ThemeProps {
|
|
|
11
11
|
}
|
|
12
12
|
export declare const useTheme: (themeName?: string | null, componentName?: string, props?: ThemeProps, forceUpdate?: any) => ThemeParsed;
|
|
13
13
|
export declare const getThemeManager: (theme: any) => ThemeManager | undefined;
|
|
14
|
-
export declare
|
|
14
|
+
export declare function useThemeName(opts?: {
|
|
15
15
|
parent?: true;
|
|
16
|
-
})
|
|
17
|
-
export declare const useDefaultThemeName: () =>
|
|
16
|
+
}): ThemeName;
|
|
17
|
+
export declare const useDefaultThemeName: () => string | undefined;
|
|
18
18
|
export declare const activeThemeManagers: Set<ThemeManager>;
|
|
19
19
|
export declare const useChangeThemeEffect: (name?: string | null, componentName?: string, props?: ThemeProps, forceUpdateProp?: any, uuid?: Object) => {
|
|
20
20
|
themes: Record<string, ThemeParsed>;
|
package/types/types.d.ts
CHANGED
|
@@ -147,7 +147,7 @@ export declare type Tokens = TamaguiConfig['tokens'];
|
|
|
147
147
|
export declare type Shorthands = TamaguiConfig['shorthands'];
|
|
148
148
|
export declare type Media = TamaguiConfig['media'];
|
|
149
149
|
export declare type Themes = TamaguiConfig['themes'];
|
|
150
|
-
export declare type ThemeName = GetAltThemeNames<keyof Themes>;
|
|
150
|
+
export declare type ThemeName = Exclude<GetAltThemeNames<keyof Themes>, number>;
|
|
151
151
|
export declare type ThemeTokens = `$${ThemeKeys}`;
|
|
152
152
|
export declare type AnimationKeys = TamaguiConfig['animations'] extends AnimationDriver<infer Config> ? keyof Config : string;
|
|
153
153
|
export declare type FontLanguages = ArrayIntersection<TamaguiConfig['fontLanguages']>;
|
|
@@ -172,7 +172,6 @@ export declare type CreateTamaguiProps = {
|
|
|
172
172
|
[key: string]: string | number | Variable;
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
|
-
defaultTheme?: string;
|
|
176
175
|
/**
|
|
177
176
|
* *Advanced use case* For all CSS extracted views, this has no effect.
|
|
178
177
|
*
|