@tamagui/core 1.0.1-beta.190 → 1.0.1-beta.191

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.
Files changed (51) hide show
  1. package/dist/cjs/addTheme.js.map +2 -2
  2. package/dist/cjs/createComponent.js +2 -2
  3. package/dist/cjs/createComponent.js.map +2 -2
  4. package/dist/cjs/createShorthands.js.map +2 -2
  5. package/dist/cjs/helpers/createPropMapper.js +4 -2
  6. package/dist/cjs/helpers/createPropMapper.js.map +2 -2
  7. package/dist/cjs/helpers/expandStyles.js.map +2 -2
  8. package/dist/cjs/helpers/insertStyleRule.js +5 -9
  9. package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
  10. package/dist/cjs/types.js.map +1 -1
  11. package/dist/cjs/views/Slot.js +12 -18
  12. package/dist/cjs/views/Slot.js.map +2 -2
  13. package/dist/esm/addTheme.js.map +2 -2
  14. package/dist/esm/createComponent.js +2 -2
  15. package/dist/esm/createComponent.js.map +2 -2
  16. package/dist/esm/createShorthands.js.map +2 -2
  17. package/dist/esm/helpers/createPropMapper.js +4 -2
  18. package/dist/esm/helpers/createPropMapper.js.map +2 -2
  19. package/dist/esm/helpers/expandStyles.js.map +2 -2
  20. package/dist/esm/helpers/insertStyleRule.js +5 -9
  21. package/dist/esm/helpers/insertStyleRule.js.map +2 -2
  22. package/dist/esm/views/Slot.js +12 -12
  23. package/dist/esm/views/Slot.js.map +2 -2
  24. package/package.json +13 -12
  25. package/src/addTheme.ts +1 -0
  26. package/src/createComponent.tsx +4 -2
  27. package/src/createShorthands.ts +4 -2
  28. package/src/helpers/createPropMapper.ts +5 -2
  29. package/src/helpers/expandStyles.ts +1 -0
  30. package/src/helpers/insertStyleRule.tsx +11 -11
  31. package/src/types.tsx +58 -39
  32. package/src/views/Slot.tsx +16 -20
  33. package/types/Tamagui.d.ts +1 -1
  34. package/types/config.d.ts +1 -1
  35. package/types/createShorthands.d.ts +2 -1
  36. package/types/helpers/expandStyles.d.ts +5 -5
  37. package/types/helpers/insertStyleRule.d.ts +1 -1
  38. package/types/types.d.ts +30 -19
  39. package/types/views/Slot.d.ts +4 -4
  40. package/src/constants/platform.native.ts +0 -14
  41. package/src/constants/platform.ts +0 -41
  42. package/types/conf.d.ts +0 -26
  43. package/types/createComponent.server.d.ts +0 -36
  44. package/types/helpers/createShallowUpdate.d.ts +0 -3
  45. package/types/helpers/cssHash.d.ts +0 -2
  46. package/types/helpers/useAnimationDriver.d.ts +0 -1
  47. package/types/hooks/useAnimationDriver.d.ts +0 -1
  48. package/types/hooks/useDidFinishSSR.d.ts +0 -3
  49. package/types/hooks/useFeatures.d.ts +0 -23
  50. package/types/hooks/useIsSSR.d.ts +0 -4
  51. package/types/hooks/useServerContext.d.ts +0 -2
package/types/types.d.ts CHANGED
@@ -30,6 +30,9 @@ export declare type TamaguiComponentPropsBase = {
30
30
  tag?: string;
31
31
  theme?: ThemeName | null;
32
32
  componentName?: string;
33
+ /**
34
+ * Forces the pseudo style state to be on
35
+ */
33
36
  forceStyle?: 'hover' | 'press' | 'focus';
34
37
  onHoverIn?: (e: MouseEvent) => any;
35
38
  onHoverOut?: (e: MouseEvent) => any;
@@ -39,8 +42,6 @@ export declare type TamaguiComponentPropsBase = {
39
42
  onMouseEnter?: (e: MouseEvent) => any;
40
43
  onMouseLeave?: (e: MouseEvent) => any;
41
44
  onMouseDown?: (e: MouseEvent) => any;
42
- userSelect?: Properties['userSelect'];
43
- cursor?: Properties['cursor'];
44
45
  };
45
46
  export declare type ReactComponentWithRef<Props, Ref> = React.ForwardRefExoticComponent<Props & React.RefAttributes<Ref>>;
46
47
  export declare type ConfigListener = (conf: TamaguiInternalConfig) => void;
@@ -88,7 +89,11 @@ declare type GenericThemes = {
88
89
  [key: string]: VariableVal;
89
90
  });
90
91
  };
91
- declare type GenericShorthands = {};
92
+ declare type AllStyleKeys = keyof StackStylePropsBase | keyof TextStylePropsBase;
93
+ export declare type CreateShorthands = {
94
+ [key: string]: AllStyleKeys;
95
+ };
96
+ export declare type GenericShorthands = {};
92
97
  declare type GenericMedia = {
93
98
  [key: string]: {
94
99
  [key: string]: number | string;
@@ -148,13 +153,15 @@ export declare type AnimationKeys = TamaguiConfig['animations'] extends Animatio
148
153
  export declare type FontLanguages = ArrayIntersection<TamaguiConfig['fontLanguages']>;
149
154
  declare type ArrayIntersection<A extends any[]> = A[keyof A];
150
155
  declare type GetAltThemeNames<S> = (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S) | S;
151
- export declare type SpacerProps = Omit<StackProps, 'flex' | 'direction' | 'size'> & {
156
+ declare type SpacerPropsBase = {
152
157
  size?: number | SpaceTokens | null;
153
158
  flex?: boolean | number;
154
159
  direction?: SpaceDirection;
155
160
  };
161
+ declare type SpacerOwnProps = SpacerPropsBase & WithThemeShorthandsPseudosMediaAnimation<SpacerPropsBase>;
162
+ export declare type SpacerProps = Omit<StackProps, 'flex' | 'direction' | 'size'> & SpacerOwnProps;
156
163
  export declare type CreateTamaguiProps = {
157
- shorthands?: GenericTamaguiConfig['shorthands'];
164
+ shorthands?: CreateShorthands;
158
165
  media?: GenericTamaguiConfig['media'];
159
166
  animations?: AnimationDriver<any>;
160
167
  fonts: GenericTamaguiConfig['fonts'];
@@ -333,19 +340,18 @@ export declare type PseudoStyles = {
333
340
  declare type WithThemeAndShorthands<A extends object> = WithThemeValues<A> & WithShorthands<WithThemeValues<A>>;
334
341
  declare type WithThemeShorthandsAndPseudos<A extends object> = WithThemeAndShorthands<A> & PseudoProps<WithThemeAndShorthands<A>>;
335
342
  declare type WithThemeShorthandsPseudosMediaAnimation<A extends object> = WithThemeShorthandsAndPseudos<A> & MediaProps<WithThemeShorthandsAndPseudos<A>>;
336
- declare type WebOnlyStyleProps = {
337
- cursor?: string;
338
- contain?: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'paint' | string;
339
- display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex';
343
+ /**
344
+ * Base style-only props (no media, pseudo):
345
+ */
346
+ declare type StylePropsWebOnly = {
340
347
  pointerEvents?: ViewProps['pointerEvents'];
348
+ cursor?: Properties['cursor'];
349
+ contain?: Properties['contain'];
350
+ display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex';
351
+ userSelect?: Properties['userSelect'];
341
352
  };
342
- export declare type StackStylePropsBase = Omit<ViewStyle, 'display' | 'backfaceVisibility' | 'elevation'> & TransformStyleProps & WebOnlyStyleProps;
343
- export declare type StackPropsBaseShared = Omit<ViewProps, 'display' | 'children'> & RNWViewProps & TamaguiComponentPropsBase;
344
- export declare type StackStyleProps = WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>;
345
- export declare type StackPropsBase = StackPropsBaseShared & WithThemeAndShorthands<StackStylePropsBase>;
346
- export declare type StackProps = StackPropsBaseShared & StackStyleProps;
347
- export declare type GestureReponderEvent = Exclude<View['props']['onResponderMove'], void> extends (event: infer Event) => void ? Event : never;
348
- export declare type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVisibility'> & TransformStyleProps & WebOnlyStyleProps & {
353
+ export declare type StackStylePropsBase = Omit<ViewStyle, 'display' | 'backfaceVisibility' | 'elevation'> & TransformStyleProps & StylePropsWebOnly;
354
+ export declare type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVisibility'> & TransformStyleProps & StylePropsWebOnly & {
349
355
  ellipse?: boolean;
350
356
  selectable?: boolean;
351
357
  textDecorationDistance?: number;
@@ -353,10 +359,14 @@ export declare type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVi
353
359
  whiteSpace?: Properties['whiteSpace'];
354
360
  wordWrap?: Properties['wordWrap'];
355
361
  };
356
- export declare type TextPropsBaseShared = Omit<ReactTextProps, 'children'> & RNWTextProps & TamaguiComponentPropsBase;
357
- export declare type TextPropsBase = TextPropsBaseShared & WithThemeAndShorthands<TextStylePropsBase>;
362
+ export declare type StackNonStyleProps = Omit<ViewProps, 'display' | 'children'> & RNWViewProps & TamaguiComponentPropsBase;
363
+ export declare type StackStyleProps = WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>;
364
+ export declare type StackPropsBase = StackNonStyleProps & WithThemeAndShorthands<StackStylePropsBase>;
365
+ export declare type StackProps = StackNonStyleProps & StackStyleProps;
366
+ export declare type TextNonStyleProps = Omit<ReactTextProps, 'children'> & RNWTextProps & TamaguiComponentPropsBase;
367
+ export declare type TextPropsBase = TextNonStyleProps & WithThemeAndShorthands<TextStylePropsBase>;
358
368
  export declare type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>;
359
- export declare type TextProps = TextPropsBaseShared & TextStyleProps;
369
+ export declare type TextProps = TextNonStyleProps & TextStyleProps;
360
370
  export declare type ViewOrTextProps = WithThemeShorthandsPseudosMediaAnimation<Omit<TextStylePropsBase, keyof StackStylePropsBase> & StackStylePropsBase>;
361
371
  export declare type TamaguiComponent<Props = any, Ref = any, BaseProps = {}, VariantProps = {}> = ReactComponentWithRef<Props, Ref> & StaticComponentObject;
362
372
  declare type StaticComponentObject = {
@@ -617,5 +627,6 @@ export declare type UseAnimationHelpers = {
617
627
  export declare type UseAnimationHook = (props: UseAnimationProps, helpers: UseAnimationHelpers) => null | {
618
628
  style?: StackStylePropsBase | StackStylePropsBase[];
619
629
  };
630
+ export declare type GestureReponderEvent = Exclude<View['props']['onResponderMove'], void> extends (event: infer Event) => void ? Event : never;
620
631
  export {};
621
632
  //# sourceMappingURL=types.d.ts.map
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
1
+ import { ReactNode } from 'react';
2
2
  export declare type SlotProps = {
3
- children?: React.ReactNode;
3
+ children?: ReactNode;
4
4
  };
5
- export declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
5
+ export declare const Slot: import("react").ForwardRefExoticComponent<SlotProps & import("react").RefAttributes<HTMLElement>>;
6
6
  export declare const Slottable: ({ children }: {
7
- children: React.ReactNode;
7
+ children: ReactNode;
8
8
  }) => JSX.Element;
9
9
  export declare function mergeEvent(a?: Function, b?: Function): (...args: unknown[]) => void;
10
10
  //# sourceMappingURL=Slot.d.ts.map
@@ -1,14 +0,0 @@
1
- import { useLayoutEffect } from 'react'
2
- import { Platform } from 'react-native'
3
-
4
- export const isAndroid = Platform?.OS === 'android'
5
- export const isIOS = Platform?.OS === 'ios'
6
- export const isWeb = false
7
- export const isWindowDefined = false
8
- export const isServer = false
9
- export const isClient = false
10
- export const isRSC = false
11
- export const useIsomorphicLayoutEffect = useLayoutEffect
12
- export const isChrome = false
13
- export const isWebTouchable = false
14
- export const isTouchable = true
@@ -1,41 +0,0 @@
1
- import { useEffect, useLayoutEffect } from 'react'
2
- import { Platform } from 'react-native'
3
-
4
- export const isAndroid = Platform?.OS === 'android'
5
- export const isIOS = Platform?.OS === 'ios'
6
- export const isWeb = process.env.TAMAGUI_TARGET === 'web'
7
- export const isWindowDefined = typeof window !== 'undefined'
8
- export const isServer = isWeb && !isWindowDefined
9
- export const isClient = isWeb && isWindowDefined
10
-
11
- // may want to move to VITE_RSC_BUILD
12
- export const isRSC = process.env.ENABLE_RSC
13
- ? // note this is statically analyzed so no funny business, just access it without optional chaining
14
- // @ts-ignore
15
- import.meta.env
16
- ? // @ts-ignore
17
- import.meta.env.SSR
18
- : false
19
- : false
20
-
21
- const idFn = () => {}
22
- export const useIsomorphicLayoutEffect = isRSC ? idFn : isServer ? useEffect : useLayoutEffect
23
- export const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')
24
- export const isWebTouchable = isClient && 'ontouchstart' in window
25
- export const isTouchable = !isWeb || isWebTouchable
26
-
27
- if (process.env.NODE_ENV === 'development') {
28
- if (!process.env.TAMAGUI_TARGET) {
29
- // eslint-disable-next-line no-console
30
- console.warn(`Must set TAMAGUI_TARGET to "web" or "native"`)
31
- } else if (
32
- isClient &&
33
- process.env.TAMAGUI_TARGET !== 'web' &&
34
- process.env.TAMAGUI_IGNORE_TARGET !== '1'
35
- ) {
36
- // eslint-disable-next-line no-console
37
- console.warn(
38
- `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`
39
- )
40
- }
41
- }
package/types/conf.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import { ConfigListener, TamaguiInternalConfig } from './types';
2
- export declare const setConfig: (next: TamaguiInternalConfig) => void;
3
- export declare const setConfigFont: (name: string, font: any, fontParsed: any) => void;
4
- export declare const getHasConfigured: () => boolean;
5
- export declare const getConfig: () => TamaguiInternalConfig<import("./types").CreateTokens<import("./types").VariableVal>, {
6
- [key: string]: Partial<import("./types").TamaguiBaseTheme> & {
7
- [key: string]: import("./types").VariableVal;
8
- };
9
- }, {}, {
10
- [key: string]: {
11
- [key: string]: string | number;
12
- };
13
- }, {
14
- [key: string]: string | {
15
- [key: string]: any;
16
- };
17
- }, import("./types").GenericFonts>;
18
- export declare const getTokens: () => import("./types").CreateTokens<import("./createVariable").Variable<import("./createVariable").VariableValue>>;
19
- export declare const getThemes: () => {
20
- [key: string]: Partial<import("./types").TamaguiBaseTheme> & {
21
- [key: string]: import("./types").VariableVal;
22
- };
23
- };
24
- export declare const configListeners: Set<ConfigListener>;
25
- export declare const onConfiguredOnce: (cb: ConfigListener) => void;
26
- //# sourceMappingURL=conf.d.ts.map
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { SpaceDirection, SpaceTokens, SpacerProps, StaticConfig, StaticConfigParsed, StylableComponent, TamaguiComponent, TamaguiElement } from './types';
3
- export declare const mouseUps: Set<Function>;
4
- export declare function createComponent<ComponentPropTypes extends Object = {}, Ref = TamaguiElement, BaseProps = never>(configIn: Partial<StaticConfig> | StaticConfigParsed, ParentComponent?: StylableComponent): TamaguiComponent<ComponentPropTypes, Ref, BaseProps, {}>;
5
- export declare const Unspaced: {
6
- (props: {
7
- children?: any;
8
- }): any;
9
- isUnspaced: boolean;
10
- };
11
- export declare const Spacer: TamaguiComponent<SpacerProps, TamaguiElement, never, {}>;
12
- export declare type SpacedChildrenProps = {
13
- isZStack?: boolean;
14
- children?: React.ReactNode;
15
- space?: SpaceTokens | number | null;
16
- spaceFlex?: boolean | number;
17
- direction?: SpaceDirection;
18
- separator?: React.ReactNode;
19
- };
20
- export declare function spacedChildren({ isZStack, children, space, direction, spaceFlex, separator, }: SpacedChildrenProps): React.ReactNode;
21
- export declare function processIDRefList(idRefList: string | Array<string>): string;
22
- export declare const accessibilityRoleToWebRole: {
23
- adjustable: string;
24
- button: string;
25
- header: string;
26
- image: string;
27
- imagebutton: null;
28
- keyboardkey: null;
29
- label: null;
30
- link: string;
31
- none: string;
32
- search: string;
33
- summary: string;
34
- text: null;
35
- };
36
- //# sourceMappingURL=createComponent.server.d.ts.map
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare function useShallowSetState<State extends Object>(setter: React.Dispatch<React.SetStateAction<State>>): (next: Partial<State>) => void;
3
- //# sourceMappingURL=createShallowUpdate.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare function cssHash(val: string, maxLen?: number): string;
2
- //# sourceMappingURL=cssHash.d.ts.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=useAnimationDriver.d.ts.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=useAnimationDriver.d.ts.map
@@ -1,3 +0,0 @@
1
- export declare function useSetupHasSSRRendered(): void;
2
- export declare function useDidFinishSSR(): boolean;
3
- //# sourceMappingURL=useDidFinishSSR.d.ts.map
@@ -1,23 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { View, ViewStyle } from 'react-native';
3
- import { PseudoStyles, SplitStyleState, StaticConfigParsed, TamaguiComponentState, UseAnimationHook } from '../types';
4
- declare type FeatureUtils = {
5
- forceUpdate: Function;
6
- state: SplitStyleState;
7
- setStateShallow: (next: Partial<TamaguiComponentState>) => void;
8
- useAnimations?: UseAnimationHook;
9
- pseudos: PseudoStyles;
10
- style: ViewStyle | null | undefined;
11
- staticConfig: StaticConfigParsed;
12
- theme: any;
13
- onDidAnimate?: () => void;
14
- hostRef: RefObject<HTMLElement | View>;
15
- };
16
- export declare const useFeatures: (props: any, utils?: FeatureUtils) => {
17
- elements: JSX.Element[];
18
- enabled: {
19
- mediaQuery?: boolean | undefined;
20
- };
21
- };
22
- export {};
23
- //# sourceMappingURL=useFeatures.d.ts.map
@@ -1,4 +0,0 @@
1
- export declare const useIsSSR: (props?: {
2
- immediate?: boolean;
3
- }) => boolean;
4
- //# sourceMappingURL=useIsSSR.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useServerContext.d.ts.map