@tamagui/core 1.0.1-beta.193 → 1.0.1-beta.194
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/Tamagui.js +4 -2
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/config.js +1 -2
- package/dist/cjs/config.js.map +2 -2
- package/dist/cjs/constants/constants.js +13 -8
- package/dist/cjs/constants/constants.js.map +2 -2
- package/dist/cjs/contexts/TextAncestorContext.js +3 -16
- package/dist/cjs/contexts/TextAncestorContext.js.map +3 -3
- package/dist/cjs/createComponent.js +194 -289
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +15 -16
- package/dist/cjs/createTamagui.js.map +3 -3
- package/dist/cjs/createVariable.js +1 -2
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +7 -14
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/{createShallowUpdate.js → cache.js} +20 -21
- package/dist/cjs/helpers/cache.js.map +7 -0
- package/dist/cjs/helpers/createMediaStyle.js +14 -8
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +0 -1
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +212 -93
- package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
- package/dist/cjs/helpers/getStylesAtomic.js +16 -36
- package/dist/cjs/helpers/getStylesAtomic.js.map +3 -3
- package/dist/cjs/helpers/insertStyleRule.js +14 -6
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.js.map +2 -2
- package/dist/cjs/helpers/mergeTransform.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.js +32 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/cjs/helpers/useShallowSetState.js.map +2 -2
- package/dist/cjs/hooks/getThemeUnwrapped.js +1 -3
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/cjs/hooks/useElementLayout.js +92 -0
- package/dist/cjs/hooks/useElementLayout.js.map +7 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +2 -10
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +77 -84
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/useMedia.test.js +2 -0
- package/dist/cjs/{helpers/validate.js.map → hooks/useMedia.test.js.map} +0 -0
- package/dist/cjs/hooks/usePressablePressResponder.js +370 -0
- package/dist/cjs/hooks/usePressablePressResponder.js.map +7 -0
- package/dist/cjs/hooks/useSafeRef.js +13 -15
- package/dist/cjs/hooks/useSafeRef.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +3 -4
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +1 -17
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/static.js +0 -20
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/styled.js +4 -22
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/{hooks/useIsSSR.js → views/AbsoluteFill.js} +18 -23
- package/dist/cjs/views/AbsoluteFill.js.map +7 -0
- package/dist/cjs/views/AbsoluteFill.native.js +45 -0
- package/dist/cjs/views/AbsoluteFill.native.js.map +7 -0
- package/dist/cjs/views/FontLanguage.native.js.map +2 -2
- package/dist/cjs/views/Stack.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +3 -2
- package/dist/cjs/views/TamaguiProvider.js.map +2 -2
- package/dist/cjs/views/Text.js.map +1 -1
- package/dist/cjs/views/ThemeReset.js +10 -10
- package/dist/cjs/views/ThemeReset.js.map +2 -2
- package/dist/esm/Tamagui.js +4 -2
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/config.js +1 -2
- package/dist/esm/config.js.map +2 -2
- package/dist/esm/constants/constants.js +11 -7
- package/dist/esm/constants/constants.js.map +2 -2
- package/dist/esm/contexts/TextAncestorContext.js +2 -13
- package/dist/esm/contexts/TextAncestorContext.js.map +2 -2
- package/dist/esm/createComponent.js +193 -291
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +15 -16
- package/dist/esm/createTamagui.js.map +3 -3
- package/dist/esm/createVariable.js +1 -2
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +7 -14
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/cache.js +18 -0
- package/dist/esm/helpers/cache.js.map +7 -0
- package/dist/esm/helpers/createMediaStyle.js +14 -8
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +0 -1
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +221 -94
- package/dist/esm/helpers/getSplitStyles.js.map +3 -3
- package/dist/esm/helpers/getStylesAtomic.js +13 -26
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +14 -6
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/matchMedia.js.map +2 -2
- package/dist/esm/helpers/mergeTransform.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js +30 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/esm/helpers/useShallowSetState.js.map +2 -2
- package/dist/esm/hooks/getThemeUnwrapped.js +1 -3
- package/dist/esm/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/esm/hooks/useElementLayout.js +66 -0
- package/dist/esm/hooks/useElementLayout.js.map +7 -0
- package/dist/esm/hooks/useIsTouchDevice.js +3 -11
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +74 -83
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useMedia.test.js +1 -0
- package/dist/esm/{helpers/validate.js.map → hooks/useMedia.test.js.map} +0 -0
- package/dist/esm/hooks/usePressablePressResponder.js +346 -0
- package/dist/esm/hooks/usePressablePressResponder.js.map +7 -0
- package/dist/esm/hooks/useSafeRef.js +13 -15
- package/dist/esm/hooks/useSafeRef.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +3 -4
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +1 -14
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/static.js +0 -14
- package/dist/esm/static.js.map +2 -2
- package/dist/esm/styled.js +4 -22
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/AbsoluteFill.js +17 -0
- package/dist/esm/views/AbsoluteFill.js.map +7 -0
- package/dist/esm/views/AbsoluteFill.native.js +21 -0
- package/dist/esm/views/AbsoluteFill.native.js.map +7 -0
- package/dist/esm/views/FontLanguage.native.js.map +2 -2
- package/dist/esm/views/Stack.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.js +5 -4
- package/dist/esm/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/views/Text.js.map +1 -1
- package/dist/esm/views/ThemeReset.js +10 -10
- package/dist/esm/views/ThemeReset.js.map +2 -2
- package/package.json +14 -14
- package/src/Tamagui.ts +7 -3
- package/src/config.ts +2 -3
- package/src/constants/constants.ts +10 -6
- package/src/contexts/TextAncestorContext.tsx +1 -8
- package/src/createComponent.tsx +248 -418
- package/src/createTamagui.ts +16 -19
- package/src/createVariable.ts +1 -3
- package/src/helpers/ThemeManager.tsx +7 -15
- package/src/helpers/cache.ts +18 -0
- package/src/helpers/createMediaStyle.ts +16 -9
- package/src/helpers/extendStaticConfig.ts +0 -1
- package/src/helpers/getSplitStyles.tsx +257 -151
- package/src/helpers/getStylesAtomic.ts +14 -34
- package/src/helpers/insertStyleRule.tsx +16 -8
- package/src/helpers/matchMedia.ts +1 -0
- package/src/helpers/mergeTransform.ts +1 -1
- package/src/helpers/normalizeValueWithProperty.ts +30 -0
- package/src/helpers/useShallowSetState.tsx +0 -1
- package/src/hooks/getThemeUnwrapped.tsx +1 -2
- package/src/hooks/useElementLayout.tsx +90 -0
- package/src/hooks/useIsTouchDevice.tsx +3 -17
- package/src/hooks/useMedia.tsx +80 -87
- package/src/hooks/useSafeRef.ts +17 -18
- package/src/hooks/useTheme.tsx +4 -4
- package/src/index.ts +1 -11
- package/src/static.ts +0 -10
- package/src/styled.tsx +15 -33
- package/src/types.tsx +58 -55
- package/src/views/FontLanguage.native.tsx +1 -0
- package/src/views/Stack.tsx +1 -1
- package/src/views/TamaguiProvider.tsx +5 -5
- package/src/views/Text.tsx +1 -1
- package/src/views/ThemeReset.tsx +11 -11
- package/types/Tamagui.d.ts +6 -4
- package/types/constants/constants.d.ts +14 -3
- package/types/contexts/TextAncestorContext.d.ts +1 -3
- package/types/createComponent.d.ts +0 -15
- package/types/helpers/ThemeManager.d.ts +2 -3
- package/types/helpers/cache.d.ts +12 -0
- package/types/helpers/calc.d.ts +0 -16
- package/types/helpers/createMediaStyle.d.ts +1 -1
- package/types/helpers/getSplitStyles.d.ts +6 -10
- package/types/helpers/getStylesAtomic.d.ts +1 -5
- package/types/helpers/insertStyleRule.d.ts +2 -2
- package/types/helpers/mergeTransform.d.ts +1 -1
- package/types/helpers/normalizeValueWithProperty.d.ts +1 -0
- package/types/hooks/useElementLayout.d.ts +27 -0
- package/types/hooks/useMedia.d.ts +3 -1
- package/types/hooks/useMedia.test.d.ts +1 -0
- package/types/hooks/usePressablePressResponder.d.ts +84 -0
- package/types/index.d.ts +1 -11
- package/types/static.d.ts +0 -1
- package/types/types.d.ts +42 -44
- package/types/views/AbsoluteFill.d.ts +5 -0
- package/types/views/AbsoluteFill.native.d.ts +3 -0
- package/types/views/Stack.d.ts +1 -1
- package/types/views/Text.d.ts +1 -1
- package/dist/cjs/constants/platform.js +0 -74
- package/dist/cjs/constants/platform.js.map +0 -7
- package/dist/cjs/constants/platform.native.js +0 -62
- package/dist/cjs/constants/platform.native.js.map +0 -7
- package/dist/cjs/helpers/createShallowUpdate.js.map +0 -7
- package/dist/cjs/helpers/validate.js +0 -2
- package/dist/cjs/hooks/useDidFinishSSR.js +0 -60
- package/dist/cjs/hooks/useDidFinishSSR.js.map +0 -7
- package/dist/cjs/hooks/useIsSSR.js.map +0 -7
- package/dist/esm/constants/platform.js +0 -39
- package/dist/esm/constants/platform.js.map +0 -7
- package/dist/esm/constants/platform.native.js +0 -28
- package/dist/esm/constants/platform.native.js.map +0 -7
- package/dist/esm/helpers/createShallowUpdate.js +0 -20
- package/dist/esm/helpers/createShallowUpdate.js.map +0 -7
- package/dist/esm/helpers/validate.js +0 -1
- package/dist/esm/hooks/useDidFinishSSR.js +0 -35
- package/dist/esm/hooks/useDidFinishSSR.js.map +0 -7
- package/dist/esm/hooks/useIsSSR.js +0 -22
- package/dist/esm/hooks/useIsSSR.js.map +0 -7
- package/src/helpers/assignNativePropsToWeb.tsx +0 -178
- package/src/helpers/calc.ts +0 -68
- package/src/helpers/getFont.tsx +0 -43
- package/src/helpers/getStackSize.ts +0 -22
- package/src/helpers/startTransition.ts +0 -4
- package/src/hooks/useConstant.tsx +0 -19
- package/src/hooks/useIsMounted.ts +0 -16
- package/src/hooks/usePressable.tsx +0 -9
- package/src/hooks/useUnmountEffect.ts +0 -5
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
import type { ViewStyle } from 'react-native';
|
|
1
|
+
import type { ViewStyle } from '@tamagui/types-react-native';
|
|
2
2
|
import type { DebugProp, MediaQueryKey, PseudoStyles, SplitStyleState, StackProps, StaticConfigParsed, TamaguiInternalConfig, ThemeParsed } from '../types';
|
|
3
3
|
import { FontLanguageProps, LanguageContextType } from '../views/FontLanguage.types';
|
|
4
4
|
import { RulesToInsert } from './insertStyleRule';
|
|
5
5
|
export declare type SplitStyles = ReturnType<typeof getSplitStyles>;
|
|
6
6
|
export declare type ClassNamesObject = Record<string, string>;
|
|
7
7
|
export declare type SplitStyleResult = ReturnType<typeof getSplitStyles>;
|
|
8
|
-
declare type
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}, staticConfig: StaticConfigParsed, theme: ThemeParsed, state: SplitStyleState, defaultClassNames?: any, languageContext?: LanguageContextType, debug?: DebugProp) => {
|
|
8
|
+
declare type SplitStylesAndProps = {
|
|
11
9
|
pseudos: PseudoStyles;
|
|
12
10
|
medias: Record<MediaQueryKey, ViewStyle>;
|
|
13
11
|
style: ViewStyle;
|
|
14
12
|
classNames: ClassNamesObject;
|
|
15
13
|
rulesToInsert: RulesToInsert;
|
|
16
|
-
viewProps: StackProps
|
|
14
|
+
viewProps: StackProps & Record<string, any>;
|
|
17
15
|
fontFamily: string | undefined;
|
|
18
16
|
mediaKeys: string[];
|
|
19
17
|
};
|
|
18
|
+
declare type StyleSplitter = (props: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}, staticConfig: StaticConfigParsed, theme: ThemeParsed, state: SplitStyleState, parentSplitStyles?: SplitStylesAndProps | null, languageContext?: LanguageContextType, elementType?: string, debug?: DebugProp) => SplitStylesAndProps;
|
|
20
21
|
export declare const PROP_SPLIT = "-";
|
|
21
|
-
export declare const pseudoCNInverse: {
|
|
22
|
-
hover: string;
|
|
23
|
-
focus: string;
|
|
24
|
-
press: string;
|
|
25
|
-
};
|
|
26
22
|
export declare const getSplitStyles: StyleSplitter;
|
|
27
23
|
export declare const getSubStyle: (subKey: string, styleIn: Object, staticConfig: StaticConfigParsed, theme: ThemeParsed, props: any, state: SplitStyleState, conf: TamaguiInternalConfig, languageContext?: FontLanguageProps, avoidDefaultProps?: boolean) => ViewStyle;
|
|
28
24
|
export declare const insertSplitStyles: StyleSplitter;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) Nicolas Gallagher licensed under the MIT license.
|
|
4
4
|
*/
|
|
5
5
|
import { StyleObject } from '@tamagui/helpers';
|
|
6
|
-
import type { TextStyle, ViewStyle } from 'react-native';
|
|
6
|
+
import type { TextStyle, ViewStyle } from '@tamagui/types-react-native';
|
|
7
7
|
import { PseudoDescriptor } from './pseudoDescriptors';
|
|
8
8
|
declare type ViewOrTextStyle = ViewStyle | TextStyle;
|
|
9
9
|
export declare type ViewStyleWithPseudos = ViewOrTextStyle & {
|
|
@@ -14,9 +14,5 @@ export declare type ViewStyleWithPseudos = ViewOrTextStyle & {
|
|
|
14
14
|
export declare function getStylesAtomic(stylesIn: ViewStyleWithPseudos): StyleObject[];
|
|
15
15
|
export declare function getAtomicStyle(style: ViewOrTextStyle, pseudo?: PseudoDescriptor): StyleObject[];
|
|
16
16
|
export declare function styleToCSS(style: Record<string, any>): void;
|
|
17
|
-
declare type Value = Object | Array<any> | string | number;
|
|
18
|
-
export declare type Style = {
|
|
19
|
-
[key: string]: Value;
|
|
20
|
-
};
|
|
21
17
|
export {};
|
|
22
18
|
//# sourceMappingURL=getStylesAtomic.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StyleObject } from '@tamagui/helpers';
|
|
2
2
|
export declare const insertedTransforms: {};
|
|
3
|
-
export declare const getAllSelectors: () =>
|
|
4
|
-
export declare const getAllRules: () =>
|
|
3
|
+
export declare const getAllSelectors: () => Record<string, string>;
|
|
4
|
+
export declare const getAllRules: () => (boolean | string[])[];
|
|
5
5
|
export declare const getAllTransforms: () => {};
|
|
6
6
|
export declare function updateInserted(): void;
|
|
7
7
|
export declare function updateRules(identifier: string, rules: string[]): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ViewStyle } from 'react-native';
|
|
1
|
+
import type { ViewStyle } from '@tamagui/types-react-native';
|
|
2
2
|
export declare const mergeTransform: (obj: ViewStyle, key: string, val: any, backwards?: boolean) => void;
|
|
3
3
|
export declare const invertMapTransformKeys: {
|
|
4
4
|
translateX: string;
|
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
* Copyright (c) Nicolas Gallagher licensed under the MIT license.
|
|
4
4
|
*/
|
|
5
5
|
export declare function normalizeValueWithProperty(value: any, property?: string): any;
|
|
6
|
+
export declare function reverseMapClassNameToValue(key: string, className: string): any;
|
|
6
7
|
//# sourceMappingURL=normalizeValueWithProperty.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export declare type LayoutValue = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
};
|
|
10
|
+
export declare type LayoutEvent = {
|
|
11
|
+
nativeEvent: {
|
|
12
|
+
layout: LayoutValue;
|
|
13
|
+
target: any;
|
|
14
|
+
};
|
|
15
|
+
timeStamp: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const getRect: (node: HTMLElement) => {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
top: number;
|
|
23
|
+
left: number;
|
|
24
|
+
} | undefined;
|
|
25
|
+
export declare const measureLayout: (node: HTMLElement, relativeTo: HTMLElement | null, callback: Function) => void;
|
|
26
|
+
export declare function useElementLayout(ref: RefObject<Element>, onLayout?: ((e: LayoutEvent) => void) | null): void;
|
|
27
|
+
//# sourceMappingURL=useElementLayout.d.ts.map
|
|
@@ -6,8 +6,9 @@ export declare function removeMediaQueryListener(key: MediaQueryKey, cb: MediaLi
|
|
|
6
6
|
export declare const mediaQueryConfig: MediaQueries;
|
|
7
7
|
export declare const getMedia: () => MediaQueryState;
|
|
8
8
|
export declare const getInitialMediaState: () => MediaQueryState;
|
|
9
|
+
export declare const getMediaKeyImportance: (key: string) => number;
|
|
9
10
|
export declare const configureMedia: (config: TamaguiInternalConfig) => void;
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function useMediaListeners(config: TamaguiInternalConfig): void;
|
|
11
12
|
export declare function useMedia(): {
|
|
12
13
|
[key in MediaQueryKey]: boolean;
|
|
13
14
|
};
|
|
@@ -21,6 +22,7 @@ export declare function useMedia(): {
|
|
|
21
22
|
export declare function useMediaPropsActive<A extends Object>(props: A): {
|
|
22
23
|
[Key in keyof A extends `$${string}` ? never : keyof A]?: A[Key];
|
|
23
24
|
};
|
|
25
|
+
export declare function mergeMediaByImportance(onto: Record<string, any>, key: string, value: any, importancesUsed: Record<string, number>): boolean;
|
|
24
26
|
export declare function mediaObjectToString(query: string | MediaQueryObject): string;
|
|
25
27
|
export {};
|
|
26
28
|
//# sourceMappingURL=useMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=useMedia.test.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
/// <reference types="node" />
|
|
11
|
+
declare type ClickEvent = any;
|
|
12
|
+
declare type KeyboardEvent = any;
|
|
13
|
+
declare type ResponderEvent = any;
|
|
14
|
+
export declare type PressResponderConfig = {
|
|
15
|
+
cancelable?: boolean | null;
|
|
16
|
+
disabled?: boolean | null;
|
|
17
|
+
delayLongPress?: number | null;
|
|
18
|
+
delayPressStart?: number | null;
|
|
19
|
+
delayPressEnd?: number | null;
|
|
20
|
+
onLongPress?: ((event: ResponderEvent) => void) | null;
|
|
21
|
+
onPress?: ((event: ClickEvent) => void) | null;
|
|
22
|
+
onPressChange?: ((event: ResponderEvent) => void) | null;
|
|
23
|
+
onPressStart?: ((event: ResponderEvent) => void) | null;
|
|
24
|
+
onPressMove?: ((event: ResponderEvent) => void) | null;
|
|
25
|
+
onPressEnd?: ((event: ResponderEvent) => void) | null;
|
|
26
|
+
};
|
|
27
|
+
export declare type EventHandlers = {
|
|
28
|
+
onClick: (event: ClickEvent) => void;
|
|
29
|
+
onContextMenu: (event: ClickEvent) => void;
|
|
30
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
31
|
+
onResponderGrant: (event: ResponderEvent) => void;
|
|
32
|
+
onResponderMove: (event: ResponderEvent) => void;
|
|
33
|
+
onResponderRelease: (event: ResponderEvent) => void;
|
|
34
|
+
onResponderTerminate: (event: ResponderEvent) => void;
|
|
35
|
+
onResponderTerminationRequest: (event: ResponderEvent) => boolean;
|
|
36
|
+
onStartShouldSetResponder: (event: ResponderEvent) => boolean;
|
|
37
|
+
};
|
|
38
|
+
declare type TouchState = 'NOT_RESPONDER' | 'RESPONDER_INACTIVE_PRESS_START' | 'RESPONDER_ACTIVE_PRESS_START' | 'RESPONDER_ACTIVE_LONG_PRESS_START' | 'ERROR';
|
|
39
|
+
declare type TouchSignal = 'DELAY' | 'RESPONDER_GRANT' | 'RESPONDER_RELEASE' | 'RESPONDER_TERMINATED' | 'LONG_PRESS_DETECTED';
|
|
40
|
+
declare type TimeoutID = NodeJS.Timer | null;
|
|
41
|
+
export declare class PressResponder {
|
|
42
|
+
_config: PressResponderConfig;
|
|
43
|
+
_eventHandlers?: EventHandlers | null;
|
|
44
|
+
_isPointerTouch?: boolean;
|
|
45
|
+
_longPressDelayTimeout?: TimeoutID;
|
|
46
|
+
_longPressDispatched?: boolean;
|
|
47
|
+
_pressDelayTimeout?: TimeoutID;
|
|
48
|
+
_pressOutDelayTimeout?: TimeoutID;
|
|
49
|
+
_selectionTerminated?: boolean;
|
|
50
|
+
_touchActivatePosition?: {
|
|
51
|
+
pageX: number;
|
|
52
|
+
pageY: number;
|
|
53
|
+
} | null;
|
|
54
|
+
_touchState: TouchState;
|
|
55
|
+
constructor(config: PressResponderConfig);
|
|
56
|
+
configure(config: PressResponderConfig): void;
|
|
57
|
+
/**
|
|
58
|
+
* Resets any pending timers. This should be called on unmount.
|
|
59
|
+
*/
|
|
60
|
+
reset(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Returns a set of props to spread into the interactive element.
|
|
63
|
+
*/
|
|
64
|
+
getEventHandlers(): EventHandlers;
|
|
65
|
+
_createEventHandlers(): EventHandlers;
|
|
66
|
+
/**
|
|
67
|
+
* Receives a state machine signal, performs side effects of the transition
|
|
68
|
+
* and stores the new state. Validates the transition as well.
|
|
69
|
+
*/
|
|
70
|
+
_receiveSignal(signal: TouchSignal, event: ResponderEvent): void;
|
|
71
|
+
/**
|
|
72
|
+
* Performs a transition between touchable states and identify any activations
|
|
73
|
+
* or deactivations (and callback invocations).
|
|
74
|
+
*/
|
|
75
|
+
_performTransitionSideEffects(prevState: TouchState, nextState: TouchState, signal: TouchSignal, event: ResponderEvent): void;
|
|
76
|
+
_activate(event: ResponderEvent): void;
|
|
77
|
+
_deactivate(event: ResponderEvent): void;
|
|
78
|
+
_handleLongPress(event: ResponderEvent): void;
|
|
79
|
+
_cancelLongPressDelayTimeout(): void;
|
|
80
|
+
_cancelPressDelayTimeout(): void;
|
|
81
|
+
_cancelPressOutDelayTimeout(): void;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=usePressablePressResponder.d.ts.map
|
package/types/index.d.ts
CHANGED
|
@@ -15,10 +15,7 @@ export * from './types';
|
|
|
15
15
|
export type { RNWTextProps, RNWViewProps } from './types-rnw';
|
|
16
16
|
export { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './config';
|
|
17
17
|
export * from './constants/constants';
|
|
18
|
-
export { createDOMProps } from '@tamagui/rnw';
|
|
19
|
-
export * from './helpers/calc';
|
|
20
18
|
export * from './helpers/useShallowSetState';
|
|
21
|
-
export * from './helpers/getStackSize';
|
|
22
19
|
export * from './helpers/getVariantExtras';
|
|
23
20
|
export * from './helpers/getAnimationDriver';
|
|
24
21
|
export * from './helpers/getExpandedShorthands';
|
|
@@ -28,28 +25,21 @@ export * from './helpers/getStylesAtomic';
|
|
|
28
25
|
export * from './helpers/pseudoDescriptors';
|
|
29
26
|
export * from './helpers/mergeProps';
|
|
30
27
|
export * from './helpers/expandStyles';
|
|
31
|
-
export * from './helpers/getFont';
|
|
32
|
-
export * from './helpers/isObj';
|
|
33
28
|
export * from './helpers/isTamaguiElement';
|
|
34
29
|
export * from './helpers/isTamaguiComponent';
|
|
35
30
|
export * from './helpers/matchMedia';
|
|
36
|
-
export * from './helpers/startTransition';
|
|
37
31
|
export * from './helpers/themeable';
|
|
38
32
|
export * from './helpers/withStaticProperties';
|
|
39
33
|
export * from './contexts/ButtonInsideButtonContext';
|
|
40
|
-
export * from './hooks/useConstant';
|
|
41
34
|
export * from './hooks/useId';
|
|
42
|
-
export * from './hooks/useIsMounted';
|
|
43
35
|
export * from './hooks/useIsTouchDevice';
|
|
44
36
|
export { configureMedia, getMedia, mediaState, useMedia, useMediaPropsActive, mediaObjectToString, addMediaQueryListener, removeMediaQueryListener, mediaQueryConfig, } from './hooks/useMedia';
|
|
45
|
-
export * from './hooks/usePressable';
|
|
46
37
|
export * from './hooks/useTheme';
|
|
47
|
-
export * from './hooks/useUnmountEffect';
|
|
48
38
|
export * from './hooks/useSafeRef';
|
|
49
39
|
export * from './views/Slot';
|
|
50
40
|
export * from './views/Stack';
|
|
51
41
|
export * from './views/Text';
|
|
52
|
-
export
|
|
42
|
+
export * from './contexts/TextAncestorContext';
|
|
53
43
|
export * from './views/Theme';
|
|
54
44
|
export * from './views/ThemeInverse';
|
|
55
45
|
export * from './views/ThemeProvider';
|
package/types/static.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { Variable } from './createVariable';
|
|
5
|
-
import { ResolveVariableTypes } from './helpers/createPropMapper';
|
|
6
|
-
import { TamaguiReactElement } from './static';
|
|
7
|
-
import { RNWTextProps, RNWViewProps } from './types-rnw';
|
|
8
|
-
import { FontLanguageProps } from './views/FontLanguage.types';
|
|
9
|
-
import { ThemeProviderProps } from './views/ThemeProvider';
|
|
1
|
+
import type { GestureResponderEvent, Image, PressableProps, TextProps as ReactTextProps, Text, TextInput, TextStyle, View, ViewProps, ViewStyle } from '@tamagui/types-react-native';
|
|
2
|
+
import type { Properties } from 'csstype';
|
|
3
|
+
import type { Component, ForwardRefExoticComponent, FunctionComponent, ReactNode, RefAttributes, RefObject } from 'react';
|
|
4
|
+
import type { Variable } from './createVariable';
|
|
5
|
+
import type { ResolveVariableTypes } from './helpers/createPropMapper';
|
|
6
|
+
import type { TamaguiReactElement } from './static';
|
|
7
|
+
import type { RNWTextProps, RNWViewProps } from './types-rnw';
|
|
8
|
+
import type { FontLanguageProps } from './views/FontLanguage.types';
|
|
9
|
+
import type { ThemeProviderProps } from './views/ThemeProvider';
|
|
10
10
|
export declare type SpaceDirection = 'vertical' | 'horizontal' | 'both';
|
|
11
11
|
export declare type TamaguiElement = HTMLElement | View;
|
|
12
12
|
export declare type DebugProp = boolean | 'break' | 'verbose';
|
|
@@ -15,7 +15,7 @@ export declare type TamaguiComponentPropsBase = {
|
|
|
15
15
|
asChild?: boolean;
|
|
16
16
|
space?: SpaceTokens | null;
|
|
17
17
|
spaceDirection?: SpaceDirection;
|
|
18
|
-
separator?:
|
|
18
|
+
separator?: ReactNode;
|
|
19
19
|
dangerouslySetInnerHTML?: {
|
|
20
20
|
__html: string;
|
|
21
21
|
};
|
|
@@ -43,7 +43,7 @@ export declare type TamaguiComponentPropsBase = {
|
|
|
43
43
|
onMouseLeave?: (e: MouseEvent) => any;
|
|
44
44
|
onMouseDown?: (e: MouseEvent) => any;
|
|
45
45
|
};
|
|
46
|
-
export declare type ReactComponentWithRef<Props, Ref> =
|
|
46
|
+
export declare type ReactComponentWithRef<Props, Ref> = ForwardRefExoticComponent<Props & RefAttributes<Ref>>;
|
|
47
47
|
export declare type ConfigListener = (conf: TamaguiInternalConfig) => void;
|
|
48
48
|
export declare type VariableVal = number | string | Variable;
|
|
49
49
|
export declare type VariableColorVal = string | Variable;
|
|
@@ -161,6 +161,7 @@ declare type SpacerPropsBase = {
|
|
|
161
161
|
declare type SpacerOwnProps = SpacerPropsBase & WithThemeShorthandsPseudosMediaAnimation<SpacerPropsBase>;
|
|
162
162
|
export declare type SpacerProps = Omit<StackProps, 'flex' | 'direction' | 'size'> & SpacerOwnProps;
|
|
163
163
|
export declare type CreateTamaguiProps = {
|
|
164
|
+
reactNative?: any;
|
|
164
165
|
shorthands?: CreateShorthands;
|
|
165
166
|
media?: GenericTamaguiConfig['media'];
|
|
166
167
|
animations?: AnimationDriver<any>;
|
|
@@ -209,11 +210,12 @@ export declare type TamaguiInternalConfig<A extends GenericTokens = GenericToken
|
|
|
209
210
|
getCSS: () => string;
|
|
210
211
|
parsed: boolean;
|
|
211
212
|
inverseShorthands: Record<string, string>;
|
|
213
|
+
reactNative?: any;
|
|
212
214
|
};
|
|
213
215
|
export declare type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations'];
|
|
214
216
|
export declare type UnionableString = string & {};
|
|
215
217
|
export declare type UnionableNumber = number & {};
|
|
216
|
-
export declare type PropTypes<A extends TamaguiComponent> = A extends
|
|
218
|
+
export declare type PropTypes<A extends TamaguiComponent> = A extends FunctionComponent<infer Props> ? Props : unknown;
|
|
217
219
|
export declare type GenericFont<Key extends number | string = number | string> = {
|
|
218
220
|
size: {
|
|
219
221
|
[key in Key]: number | Variable;
|
|
@@ -376,7 +378,7 @@ declare type StaticComponentObject = {
|
|
|
376
378
|
export declare type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {
|
|
377
379
|
config: TamaguiInternalConfig;
|
|
378
380
|
disableInjectCSS?: boolean;
|
|
379
|
-
children?:
|
|
381
|
+
children?: ReactNode;
|
|
380
382
|
};
|
|
381
383
|
export declare type PropMapper = (key: string, value: any, theme: ThemeParsed, props: Record<string, any>, state: Partial<SplitStyleState>, languageContext?: FontLanguageProps, avoidDefaultProps?: boolean, debug?: DebugProp) => undefined | [string, any][];
|
|
382
384
|
export declare type StaticConfigParsed = StaticConfig & {
|
|
@@ -395,13 +397,7 @@ export declare type GenericVariantDefinitions = {
|
|
|
395
397
|
};
|
|
396
398
|
};
|
|
397
399
|
};
|
|
398
|
-
export declare type
|
|
399
|
-
Component?: React.FunctionComponent<any> & StaticComponentObject;
|
|
400
|
-
variants?: GenericVariantDefinitions;
|
|
401
|
-
/**
|
|
402
|
-
* Used for applying sub theme style
|
|
403
|
-
*/
|
|
404
|
-
componentName?: string;
|
|
400
|
+
export declare type StaticConfigPublic = {
|
|
405
401
|
/**
|
|
406
402
|
* (compiler) If you need to pass context or something, prevents from ever
|
|
407
403
|
* flattening. The 'jsx' option means it will never flatten. if you
|
|
@@ -412,24 +408,12 @@ export declare type StaticConfig = {
|
|
|
412
408
|
* Determines ultimate output tag (Text vs View)
|
|
413
409
|
*/
|
|
414
410
|
isText?: boolean;
|
|
415
|
-
/**
|
|
416
|
-
* Attempts to attach focus styles at runtime (useful for native)
|
|
417
|
-
*/
|
|
418
|
-
isInput?: boolean;
|
|
419
|
-
/**
|
|
420
|
-
* React native web images need special handling for className support
|
|
421
|
-
*/
|
|
422
|
-
isImage?: boolean;
|
|
423
411
|
/**
|
|
424
412
|
* Which style keys are allowed to be extracted.
|
|
425
413
|
*/
|
|
426
414
|
validStyles?: {
|
|
427
415
|
[key: string]: boolean;
|
|
428
416
|
};
|
|
429
|
-
/**
|
|
430
|
-
* Same as React.defaultProps, be sure to sync
|
|
431
|
-
*/
|
|
432
|
-
defaultProps: Record<string, any>;
|
|
433
417
|
/**
|
|
434
418
|
* (compiler) If these props are encountered, bail on all optimization.
|
|
435
419
|
*/
|
|
@@ -456,16 +440,34 @@ export declare type StaticConfig = {
|
|
|
456
440
|
* Auto-detected, but can ovverride. Wraps children to space them on top
|
|
457
441
|
*/
|
|
458
442
|
isZStack?: boolean;
|
|
443
|
+
/**
|
|
444
|
+
* Auto-detect, but can override, passes styles properly to react-native-web
|
|
445
|
+
*/
|
|
446
|
+
isReactNativeWeb?: boolean;
|
|
447
|
+
/**
|
|
448
|
+
* By default if styled() doesn't recognize a parent Tamagui compoent or specific react-native views,
|
|
449
|
+
* it will assume the passed in component only accepts style={} for react-native compatibility.
|
|
450
|
+
* Setting `acceptsClassName: true` indicates Tamagui can pass in className props.
|
|
451
|
+
*/
|
|
452
|
+
acceptsClassName?: boolean;
|
|
453
|
+
};
|
|
454
|
+
export declare type StaticConfig = StaticConfigPublic & {
|
|
455
|
+
Component?: FunctionComponent<any> & StaticComponentObject;
|
|
456
|
+
variants?: GenericVariantDefinitions;
|
|
457
|
+
/**
|
|
458
|
+
* Used for applying sub theme style
|
|
459
|
+
*/
|
|
460
|
+
componentName?: string;
|
|
461
|
+
/**
|
|
462
|
+
* Same as React.defaultProps, be sure to sync
|
|
463
|
+
*/
|
|
464
|
+
defaultProps: Record<string, any>;
|
|
459
465
|
/**
|
|
460
466
|
* Merges into defaultProps later on, used internally yonly
|
|
461
467
|
*/
|
|
462
468
|
defaultVariants?: {
|
|
463
469
|
[key: string]: any;
|
|
464
470
|
};
|
|
465
|
-
/**
|
|
466
|
-
* Auto-detect, but can ovverride, passes styles properly to react-native-web
|
|
467
|
-
*/
|
|
468
|
-
isReactNativeWeb?: boolean;
|
|
469
471
|
/**
|
|
470
472
|
* Used internally to keep reference to the original rnw component
|
|
471
473
|
*/
|
|
@@ -474,10 +476,6 @@ export declare type StaticConfig = {
|
|
|
474
476
|
* Memoize the component
|
|
475
477
|
*/
|
|
476
478
|
memo?: boolean;
|
|
477
|
-
/**
|
|
478
|
-
* Auto-detect, but can ovverride, passes styles properly to react-native-web
|
|
479
|
-
*/
|
|
480
|
-
isTamagui?: boolean;
|
|
481
479
|
/**
|
|
482
480
|
* Used internally to handle extractable HoC separate
|
|
483
481
|
*/
|
|
@@ -498,10 +496,10 @@ export declare type StaticConfig = {
|
|
|
498
496
|
* variants
|
|
499
497
|
* --------------------------------------------
|
|
500
498
|
*/
|
|
501
|
-
export declare type StylableComponent = TamaguiComponent |
|
|
499
|
+
export declare type StylableComponent = TamaguiComponent | Component | ForwardRefExoticComponent<any> | ReactComponentWithRef<any, any> | (new (props: any) => any) | typeof View | typeof Text | typeof TextInput | typeof Image;
|
|
502
500
|
export declare type GetStyledVariants<A extends TamaguiComponent> = A extends TamaguiComponent<any, any, any, infer Variants> ? Variants : never;
|
|
503
501
|
export declare type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<any, any, infer BaseProps> ? BaseProps : never;
|
|
504
|
-
export declare type GetProps<A extends StylableComponent> = A extends TamaguiComponent<infer Props> ? Props : A extends TamaguiReactElement<infer Props> ? Props : A extends
|
|
502
|
+
export declare type GetProps<A extends StylableComponent> = A extends TamaguiComponent<infer Props> ? Props : A extends TamaguiReactElement<infer Props> ? Props : A extends Component<infer Props> ? GetGenericComponentTamaguiProps<Props> : A extends new (props: infer Props) => any ? GetGenericComponentTamaguiProps<Props> : {};
|
|
505
503
|
declare type GetGenericComponentTamaguiProps<P> = P & Omit<'textAlign' extends keyof P ? TextProps : StackProps, keyof P>;
|
|
506
504
|
export declare type SpreadKeys = '...fontSize' | '...fontStyle' | '...fontTransform' | '...lineHeight' | '...letterSpacing' | '...size' | '...space' | '...color' | '...zIndex' | '...theme' | '...radius';
|
|
507
505
|
export declare type VariantDefinitions<Parent extends StylableComponent = TamaguiComponent, MyProps extends Object = GetProps<Parent>, Val = any> = VariantDefinitionFromProps<MyProps, Val>;
|
|
@@ -600,10 +598,10 @@ export declare type UniversalAnimatedNumber<A> = {
|
|
|
600
598
|
stop(): void;
|
|
601
599
|
};
|
|
602
600
|
export declare type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {
|
|
603
|
-
|
|
601
|
+
isReactNativeWeb?: boolean;
|
|
604
602
|
useAnimations: UseAnimationHook;
|
|
605
603
|
useAnimatedNumber: (initial: number) => UniversalAnimatedNumber<any>;
|
|
606
|
-
useAnimatedNumberStyle: <V extends UniversalAnimatedNumber<any>>(val: V, getStyle: (current: any) => any) =>
|
|
604
|
+
useAnimatedNumberStyle: <V extends UniversalAnimatedNumber<any>>(val: V, getStyle: (current: any) => any) => any;
|
|
607
605
|
useAnimatedNumberReaction: (val: UniversalAnimatedNumber<any>, onValue: (current: number) => void) => void;
|
|
608
606
|
animations: A;
|
|
609
607
|
View?: any;
|
package/types/views/Stack.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
1
|
+
import type { View } from '@tamagui/types-react-native';
|
|
2
2
|
import { StackProps, StackPropsBase } from '../types';
|
|
3
3
|
export declare const Stack: import("../types").TamaguiComponent<StackProps, View, StackPropsBase, {}>;
|
|
4
4
|
//# sourceMappingURL=Stack.d.ts.map
|
package/types/views/Text.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text as TextView } from 'react-native';
|
|
1
|
+
import type { Text as TextView } from '@tamagui/types-react-native';
|
|
2
2
|
import { TextProps, TextPropsBase } from '../types';
|
|
3
3
|
export declare const Text: import("../types").TamaguiComponent<TextProps, TextView, TextPropsBase, {}>;
|
|
4
4
|
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var platform_exports = {};
|
|
20
|
-
__export(platform_exports, {
|
|
21
|
-
isAndroid: () => isAndroid,
|
|
22
|
-
isChrome: () => isChrome,
|
|
23
|
-
isClient: () => isClient,
|
|
24
|
-
isIOS: () => isIOS,
|
|
25
|
-
isRSC: () => isRSC,
|
|
26
|
-
isServer: () => isServer,
|
|
27
|
-
isTouchable: () => isTouchable,
|
|
28
|
-
isWeb: () => isWeb,
|
|
29
|
-
isWebTouchable: () => isWebTouchable,
|
|
30
|
-
isWindowDefined: () => isWindowDefined,
|
|
31
|
-
useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(platform_exports);
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var import_react_native = require("react-native");
|
|
36
|
-
const import_meta = {};
|
|
37
|
-
var _a, _b;
|
|
38
|
-
const isAndroid = ((_a = import_react_native.Platform) == null ? void 0 : _a.OS) === "android";
|
|
39
|
-
const isIOS = ((_b = import_react_native.Platform) == null ? void 0 : _b.OS) === "ios";
|
|
40
|
-
const isWeb = process.env.TAMAGUI_TARGET === "web";
|
|
41
|
-
const isWindowDefined = typeof window !== "undefined";
|
|
42
|
-
const isServer = isWeb && !isWindowDefined;
|
|
43
|
-
const isClient = isWeb && isWindowDefined;
|
|
44
|
-
const isRSC = process.env.ENABLE_RSC ? import_meta.env ? import_meta.env.SSR : false : false;
|
|
45
|
-
const idFn = () => {
|
|
46
|
-
};
|
|
47
|
-
const useIsomorphicLayoutEffect = isRSC ? idFn : isServer ? import_react.useEffect : import_react.useLayoutEffect;
|
|
48
|
-
const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
|
|
49
|
-
const isWebTouchable = isClient && "ontouchstart" in window;
|
|
50
|
-
const isTouchable = !isWeb || isWebTouchable;
|
|
51
|
-
if (process.env.NODE_ENV === "development") {
|
|
52
|
-
if (!process.env.TAMAGUI_TARGET) {
|
|
53
|
-
console.warn(`Must set TAMAGUI_TARGET to "web" or "native"`);
|
|
54
|
-
} else if (isClient && process.env.TAMAGUI_TARGET !== "web" && process.env.TAMAGUI_IGNORE_TARGET !== "1") {
|
|
55
|
-
console.warn(
|
|
56
|
-
`Must set TAMAGUI_TARGET to "web" for web apps - if you have window defined outside of the browser, set TAMAGUI_IGNORE_TARGET=1 to hide this`
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
-
0 && (module.exports = {
|
|
62
|
-
isAndroid,
|
|
63
|
-
isChrome,
|
|
64
|
-
isClient,
|
|
65
|
-
isIOS,
|
|
66
|
-
isRSC,
|
|
67
|
-
isServer,
|
|
68
|
-
isTouchable,
|
|
69
|
-
isWeb,
|
|
70
|
-
isWebTouchable,
|
|
71
|
-
isWindowDefined,
|
|
72
|
-
useIsomorphicLayoutEffect
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=platform.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/constants/platform.ts"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web'\nexport const isWindowDefined = typeof window !== 'undefined'\nexport const isServer = isWeb && !isWindowDefined\nexport const isClient = isWeb && isWindowDefined\n\n// may want to move to VITE_RSC_BUILD\nexport const isRSC = process.env.ENABLE_RSC\n ? // note this is statically analyzed so no funny business, just access it without optional chaining\n // @ts-ignore\n import.meta.env\n ? // @ts-ignore\n import.meta.env.SSR\n : false\n : false\n\nconst idFn = () => {}\nexport const useIsomorphicLayoutEffect = isRSC ? idFn : isServer ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const isWebTouchable = isClient && 'ontouchstart' in window\nexport const isTouchable = !isWeb || isWebTouchable\n\nif (process.env.NODE_ENV === 'development') {\n if (!process.env.TAMAGUI_TARGET) {\n // eslint-disable-next-line no-console\n console.warn(`Must set TAMAGUI_TARGET to \"web\" or \"native\"`)\n } else if (\n isClient &&\n process.env.TAMAGUI_TARGET !== 'web' &&\n process.env.TAMAGUI_IGNORE_TARGET !== '1'\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n `Must set TAMAGUI_TARGET to \"web\" for web apps - if you have window defined outside of the browser, set TAMAGUI_IGNORE_TARGET=1 to hide this`\n )\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,0BAAyB;AADzB;AAAA;AAGO,MAAM,cAAY,yDAAU,QAAO;AACnC,MAAM,UAAQ,yDAAU,QAAO;AAC/B,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,kBAAkB,OAAO,WAAW;AAC1C,MAAM,WAAW,SAAS,CAAC;AAC3B,MAAM,WAAW,SAAS;AAG1B,MAAM,QAAQ,QAAQ,IAAI,aAG7B,YAAY,MAEV,YAAY,IAAI,MAChB,QACF;AAEJ,MAAM,OAAO,MAAM;AAAC;AACb,MAAM,4BAA4B,QAAQ,OAAO,WAAW,yBAAY;AACxE,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa,EAAE;AAC5F,MAAM,iBAAiB,YAAY,kBAAkB;AACrD,MAAM,cAAc,CAAC,SAAS;AAErC,IAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,MAAI,CAAC,QAAQ,IAAI,gBAAgB;AAE/B,YAAQ,KAAK,8CAA8C;AAAA,EAC7D,WACE,YACA,QAAQ,IAAI,mBAAmB,SAC/B,QAAQ,IAAI,0BAA0B,KACtC;AAEA,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var platform_native_exports = {};
|
|
20
|
-
__export(platform_native_exports, {
|
|
21
|
-
isAndroid: () => isAndroid,
|
|
22
|
-
isChrome: () => isChrome,
|
|
23
|
-
isClient: () => isClient,
|
|
24
|
-
isIOS: () => isIOS,
|
|
25
|
-
isRSC: () => isRSC,
|
|
26
|
-
isServer: () => isServer,
|
|
27
|
-
isTouchable: () => isTouchable,
|
|
28
|
-
isWeb: () => isWeb,
|
|
29
|
-
isWebTouchable: () => isWebTouchable,
|
|
30
|
-
isWindowDefined: () => isWindowDefined,
|
|
31
|
-
useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(platform_native_exports);
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var import_react_native = require("react-native");
|
|
36
|
-
var _a, _b;
|
|
37
|
-
const isAndroid = ((_a = import_react_native.Platform) == null ? void 0 : _a.OS) === "android";
|
|
38
|
-
const isIOS = ((_b = import_react_native.Platform) == null ? void 0 : _b.OS) === "ios";
|
|
39
|
-
const isWeb = false;
|
|
40
|
-
const isWindowDefined = false;
|
|
41
|
-
const isServer = false;
|
|
42
|
-
const isClient = false;
|
|
43
|
-
const isRSC = false;
|
|
44
|
-
const useIsomorphicLayoutEffect = import_react.useLayoutEffect;
|
|
45
|
-
const isChrome = false;
|
|
46
|
-
const isWebTouchable = false;
|
|
47
|
-
const isTouchable = true;
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
isAndroid,
|
|
51
|
-
isChrome,
|
|
52
|
-
isClient,
|
|
53
|
-
isIOS,
|
|
54
|
-
isRSC,
|
|
55
|
-
isServer,
|
|
56
|
-
isTouchable,
|
|
57
|
-
isWeb,
|
|
58
|
-
isWebTouchable,
|
|
59
|
-
isWindowDefined,
|
|
60
|
-
useIsomorphicLayoutEffect
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=platform.native.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/constants/platform.native.ts"],
|
|
4
|
-
"sourcesContent": ["import { useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = false\nexport const isWindowDefined = false\nexport const isServer = false\nexport const isClient = false\nexport const isRSC = false\nexport const useIsomorphicLayoutEffect = useLayoutEffect\nexport const isChrome = false\nexport const isWebTouchable = false\nexport const isTouchable = true\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAChC,0BAAyB;AADzB;AAGO,MAAM,cAAY,yDAAU,QAAO;AACnC,MAAM,UAAQ,yDAAU,QAAO;AAC/B,MAAM,QAAQ;AACd,MAAM,kBAAkB;AACxB,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,4BAA4B;AAClC,MAAM,WAAW;AACjB,MAAM,iBAAiB;AACvB,MAAM,cAAc;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/createShallowUpdate.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback } from 'react'\n\nexport function createShallowUpdate<State extends Object>(\n setter: React.Dispatch<React.SetStateAction<State>>\n) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useCallback(\n (next: Partial<State>) => {\n setter((prev) => {\n for (const key in next) {\n if (prev[key] !== next[key]) {\n return { ...prev, ...next }\n }\n }\n return prev\n })\n },\n [setter]\n )\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmC;AAE5B,SAAS,oBACd,QACA;AAEA,aAAO;AAAA,IACL,CAAC,SAAyB;AACxB,aAAO,CAAC,SAAS;AACf,mBAAW,OAAO,MAAM;AACtB,cAAI,KAAK,SAAS,KAAK,MAAM;AAC3B,mBAAO,EAAE,GAAG,MAAM,GAAG,KAAK;AAAA,UAC5B;AAAA,QACF;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|