@tamagui/web 1.11.2 → 1.12.1
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 -1
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/styled.js +10 -10
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/createComponent.js +3 -1
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.mjs +3 -1
- package/dist/esm/createComponent.mjs.map +2 -2
- package/dist/esm/styled.js +10 -10
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/styled.mjs +10 -10
- package/dist/esm/styled.mjs.map +2 -2
- package/package.json +9 -9
- package/src/createComponent.tsx +4 -1
- package/src/styled.tsx +18 -13
- package/src/types.tsx +2 -2
- package/types/createComponent.d.ts.map +1 -1
- package/types/styled.d.ts +1 -1
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/types.d.ts.map +1 -1
package/dist/cjs/types.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types.tsx"],
|
|
4
|
-
"sourcesContent": ["// TODO split this into own package @tamagui/types to share with animations packages\n\nimport type { StyleObject } from '@tamagui/helpers'\nimport type { Properties } from 'csstype'\nimport type {\n ComponentType,\n ForwardRefExoticComponent,\n FunctionComponent,\n HTMLAttributes,\n ReactNode,\n RefAttributes,\n RefObject,\n} from 'react'\nimport type {\n GestureResponderHandlers,\n PressableProps,\n TextProps as ReactTextProps,\n TextStyle,\n View,\n ViewProps,\n ViewStyle,\n} from 'react-native'\n\nimport type { Variable } from './createVariable.js'\nimport type { ResolveVariableTypes } from './helpers/createPropMapper.js'\nimport type { FontLanguageProps } from './views/FontLanguage.types.js'\nimport type { ThemeProviderProps } from './views/ThemeProvider.js'\n\nexport type { MediaStyleObject, StyleObject } from '@tamagui/helpers'\n\nexport type SpaceDirection = 'vertical' | 'horizontal' | 'both'\n\nexport type TamaguiElement = HTMLElement | View\n\nexport type DebugProp = boolean | 'break' | 'verbose'\n\n// base props that are accepted by createComponent (additional to react-native-web)\n\ntype DivAttributes = HTMLAttributes<HTMLDivElement>\n\nexport type TamaguiReactElement<P = any> = React.ReactElement<P> & {\n type: TamaguiComponent\n}\n\nexport type TamaguiComponentPropsBase = {\n target?: string\n hitSlop?: PressableProps['hitSlop']\n asChild?: boolean\n space?: SpaceTokens | null\n spaceDirection?: SpaceDirection\n separator?: ReactNode\n dangerouslySetInnerHTML?: { __html: string }\n animation?: AnimationProp | null\n animateOnly?: string[]\n children?: any | any[]\n debug?: DebugProp\n disabled?: boolean\n className?: string\n themeShallow?: boolean\n id?: string\n tag?: string\n theme?: ThemeName | null\n componentName?: string\n tabIndex?: string | number\n role?: string\n\n /**\n * Forces the pseudo style state to be on\n */\n forceStyle?: 'hover' | 'press' | 'focus'\n onPress?: PressableProps['onPress']\n onPressIn?: PressableProps['onPress']\n onPressOut?: PressableProps['onPress']\n\n // WEB ONLY TODO probably remove these in favor of something better\n onHoverIn?: DivAttributes['onMouseEnter']\n onHoverOut?: DivAttributes['onMouseLeave']\n onMouseEnter?: DivAttributes['onMouseEnter']\n onMouseLeave?: DivAttributes['onMouseLeave']\n onMouseDown?: DivAttributes['onMouseDown']\n onMouseUp?: DivAttributes['onMouseUp']\n onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void\n onScroll?: (event: React.UIEvent<HTMLDivElement, UIEvent>) => void\n}\n\nexport type ReactComponentWithRef<Props, Ref> = ForwardRefExoticComponent<\n Props & RefAttributes<Ref>\n>\n\nexport type ConfigListener = (conf: TamaguiInternalConfig) => void\n\n// to prevent things from going circular, hoisting some types in this file\n// to generally order them as building up towards TamaguiConfig\n\nexport type VariableVal = number | string | Variable\nexport type VariableColorVal = string | Variable\n\ntype GenericKey = string\n\nexport interface CreateTokens<Val extends VariableVal = VariableVal> {\n color: { [key: GenericKey]: Val }\n space: { [key: GenericKey]: Val }\n size: { [key: GenericKey]: Val }\n radius: { [key: GenericKey]: Val }\n zIndex: { [key: GenericKey]: Val }\n}\n\ntype Tokenify<A extends GenericTokens> = {\n color: TokenifyRecord<A['color']>\n space: TokenifyRecord<A['space']>\n size: TokenifyRecord<A['size']>\n radius: TokenifyRecord<A['radius']>\n zIndex: TokenifyRecord<A['zIndex']>\n}\n\ntype TokenifyRecord<A extends CreateTokens[keyof CreateTokens]> = {\n [Key in keyof A]: A[Key] extends Variable ? A[Key] : Variable<A[Key]>\n}\n\nexport type TamaguiBaseTheme = {\n // defined for our tamagui kit , we could do this inside `tamagui`\n // but maybe helpful to have some sort of universally shared things +\n // + enforce if they want their own, redefine in their design sys\n background: VariableColorVal\n backgroundHover: VariableColorVal\n backgroundPress: VariableColorVal\n backgroundFocus: VariableColorVal\n color: VariableColorVal\n colorHover: VariableColorVal\n colorPress: VariableColorVal\n colorFocus: VariableColorVal\n borderColor: VariableColorVal\n borderColorHover: VariableColorVal\n borderColorPress: VariableColorVal\n borderColorFocus: VariableColorVal\n shadowColor: VariableColorVal\n shadowColorHover: VariableColorVal\n shadowColorPress: VariableColorVal\n shadowColorFocus: VariableColorVal\n}\n\ntype GenericTokens = CreateTokens\ntype GenericThemes = {\n [key: string]:\n | Partial<TamaguiBaseTheme> & {\n [key: string]: VariableVal\n }\n}\n\nexport type CreateShorthands = {\n // for some reason using keyof ViewStyle here will cause type circularity on react native 0.71\n [key: string]: string\n}\n\nexport type GenericShorthands = {}\n\n// sm: { minWidth: 100 }\ntype GenericMedia = {\n [key: string]: {\n [key: string]: number | string\n }\n}\n\nexport type GenericFonts = Record<string, GenericFont>\n\ntype GenericAnimations = {\n [key: string]:\n | string\n | {\n [key: string]: any\n }\n | any[]\n}\n\n// this is the \"main\" typed object, which users re-define\n// (internal) keep all types directly on this object and reference them from elsewhere\n//\n// const config = createTamagui(...)\n// type MyConfig = typeof config\n// declare module 'tamagui' {\n// export interface TamaguiCustomConfig extends MyConfig {}\n// }\n// now your whole app/kit should be typed correctly\n//\nexport interface TamaguiCustomConfig {}\n\nexport interface TamaguiConfig\n extends Omit<GenericTamaguiConfig, keyof TamaguiCustomConfig>,\n TamaguiCustomConfig {}\n\nexport type CreateTamaguiConfig<\n A extends GenericTokens,\n B extends GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = {\n fonts: RemoveLanguagePostfixes<F>\n fontLanguages: GetLanguagePostfixes<F> extends never\n ? string[]\n : GetLanguagePostfixes<F>[]\n tokens: A\n // parsed\n themes: {\n [Name in keyof B]: {\n [Key in keyof B[Name]]: Variable\n }\n }\n shorthands: C\n media: D\n animations: AnimationDriver<E>\n}\n\ntype GetLanguagePostfix<Set> = Set extends string\n ? Set extends `${string}_${infer Postfix}`\n ? Postfix\n : never\n : never\n\ntype OmitLanguagePostfix<Set> = Set extends string\n ? Set extends `${infer Prefix}_${string}`\n ? Prefix\n : Set\n : never\n\ntype RemoveLanguagePostfixes<F extends GenericFonts> = {\n [Key in OmitLanguagePostfix<keyof F>]: F[Key]\n}\n\ntype GetLanguagePostfixes<F extends GenericFonts> = GetLanguagePostfix<keyof F>\n\n// test RemoveLanguagePostfixes\n// type x = CreateTamaguiConfig<any, any, any, any, any, {\n// body: any,\n// body_en: any\n// }>['fonts']\n\ntype ConfProps<\n A extends GenericTokens,\n B extends GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = {\n tokens: A\n themes: B\n shorthands?: C\n media?: D\n animations?: AnimationDriver<E>\n fonts: F\n}\n\nexport type InferTamaguiConfig<Conf> = Conf extends ConfProps<\n infer A,\n infer B,\n infer C,\n infer D,\n infer E,\n infer F\n>\n ? TamaguiInternalConfig<A, B, C, D, E, F>\n : unknown\n\n// for use in creation functions so it doesnt get overwritten\nexport type GenericTamaguiConfig = CreateTamaguiConfig<\n GenericTokens,\n GenericThemes,\n GenericShorthands,\n GenericMedia,\n GenericAnimations,\n GenericFonts\n>\n\n// try and find the top level types as they can be supersets:\ntype NonSubThemeNames<A extends string | number> = A extends `${string}_${string}`\n ? never\n : A\ntype BaseThemeDefinitions = TamaguiConfig['themes'][NonSubThemeNames<\n keyof TamaguiConfig['themes']\n>]\ntype GenericThemeDefinition = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]\nexport type ThemeDefinition = BaseThemeDefinitions extends never\n ? GenericThemeDefinition\n : BaseThemeDefinitions\nexport type ThemeKeys = keyof ThemeDefinition\nexport type ThemeParsed = {\n [key in ThemeKeys]: Variable<any>\n}\n\nexport type Tokens = TamaguiConfig['tokens']\n\nexport type TokensParsed = {\n size: TokenPrefixed<Tokens['size']>\n color: TokenPrefixed<Tokens['color']>\n radius: TokenPrefixed<Tokens['radius']>\n zIndex: TokenPrefixed<Tokens['zIndex']>\n space: TokenPrefixed<Tokens['space']>\n}\n\ntype TokenPrefixed<A extends { [key: string]: any }> = {\n [key in Ensure$Prefix<keyof A>]: A[keyof A]\n}\n\ntype Ensure$Prefix<A extends string | number | symbol> = A extends string\n ? A extends `$${string}`\n ? A\n : `$${A}`\n : never\n\nexport type TokensMerged = {\n size: TokensParsed['size'] & Tokens['size']\n color: TokensParsed['color'] & Tokens['color']\n radius: TokensParsed['radius'] & Tokens['radius']\n zIndex: TokensParsed['zIndex'] & Tokens['zIndex']\n space: TokensParsed['space'] & Tokens['space']\n}\n\nexport type Shorthands = TamaguiConfig['shorthands']\nexport type Media = TamaguiConfig['media']\nexport type Themes = TamaguiConfig['themes']\nexport type ThemeName = Exclude<GetAltThemeNames<keyof Themes>, number>\nexport type ThemeTokens = `$${ThemeKeys}`\nexport type AnimationKeys = TamaguiConfig['animations'] extends AnimationDriver<\n infer Config\n>\n ? keyof Config\n : string\nexport type FontLanguages = ArrayIntersection<TamaguiConfig['fontLanguages']>\n\nexport interface ThemeProps {\n className?: string\n name?: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: DebugProp\n inverse?: boolean\n // on the web, for portals we need to re-insert className\n forceClassName?: boolean\n // allows for disabling the auto-update behavior\n shouldUpdate?: () => boolean\n}\n\ntype ArrayIntersection<A extends any[]> = A[keyof A]\n\ntype GetAltThemeNames<S> =\n | (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S)\n | S\n\ntype SpacerPropsBase = {\n size?: number | SpaceTokens | null\n flex?: boolean | number\n direction?: SpaceDirection\n}\ntype SpacerOwnProps = SpacerPropsBase &\n //\n WithThemeShorthandsPseudosMediaAnimation<SpacerPropsBase>\n\nexport type SpacerProps = Omit<StackProps, 'flex' | 'direction' | 'size'> &\n //\n SpacerOwnProps\n\nexport type CreateTamaguiProps = {\n reactNative?: any\n shorthands?: CreateShorthands\n media?: GenericTamaguiConfig['media']\n animations?: AnimationDriver<any>\n fonts: GenericTamaguiConfig['fonts']\n tokens: GenericTamaguiConfig['tokens']\n themes: {\n [key: string]: {\n [key: string]: string | number | Variable\n }\n }\n\n /**\n * *Advanced use case* For all CSS extracted views, this has no effect.\n *\n * For SSR compatibility on the web, Tamagui will render once with the settings\n * from `mediaQueryDefaultActive` set for all media queries. Then, it will render\n * again after the initial render using the proper media query values. This is so that\n * hydration will match perfectly with the server.\n *\n * Setting disableSSR will avoid this second render by setting the media query state\n * to the actual browser dimensions on initial load. This is only useful for client-only\n * apps.\n *\n */\n disableSSR?: boolean\n\n /**\n * Disable inserting a theme class in the DOM or context, allowing you to manually place it higher.\n * For custom use cases like integration with next-theme.\n */\n disableRootThemeClass?: boolean\n\n defaultProps?: Record<string, any> & {\n Stack?: StackProps\n Text?: TextProps\n Spacer?: SpacerProps\n }\n\n // for the first render, determines which media queries are true\n // useful for SSR\n mediaQueryDefaultActive?: Record<MediaQueryKey, boolean>\n\n // what's between each CSS style rule, set to \"\\n\" to be easier to read\n // defaults: \"\\n\" when NODE_ENV=development, \"\" otherwise\n cssStyleSeparator?: string\n\n // (Advanced)\n // on the web, tamagui treats `dark` and `light` themes as special and\n // generates extra CSS to avoid having to re-render the entire page.\n // this CSS relies on specificity hacks that multiply by your sub-themes.\n // this sets the maxiumum number of nested dark/light themes you can do\n // defaults to 3 for a balance, but can be higher if you nest them deeply.\n maxDarkLightNesting?: number\n\n // adds @media(prefers-color-scheme) media queries for dark/light\n shouldAddPrefersColorThemes?: boolean\n\n // only if you put the theme classname on the html element we have to generate diff\n themeClassNameOnRoot?: boolean\n}\n\n// this is the config generated via createTamagui()\nexport type TamaguiInternalConfig<\n A extends GenericTokens = GenericTokens,\n B extends GenericThemes = GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = Omit<CreateTamaguiProps, keyof GenericTamaguiConfig> &\n Omit<CreateTamaguiConfig<A, B, C, D, E, F>, 'tokens'> & {\n // TODO need to make it this but this breaks types, revisit\n // animations: E //AnimationDriver<E>\n // with $ prefixes for fast lookups (one time cost at startup vs every render)\n tokens: Tokenify<A>\n tokensParsed: Tokenify<A>\n themeConfig: any\n fontsParsed: GenericFonts\n getCSS: () => string\n parsed: boolean\n inverseShorthands: Record<string, string>\n reactNative?: any\n }\n\nexport type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']\n\n// prevents const intersections from being clobbered into string, keeping the consts\nexport type UnionableString = string & {}\nexport type UnionableNumber = number & {}\n\nexport type GenericFont<Key extends number | string = number | string> = {\n size: { [key in Key]: number | Variable }\n lineHeight: Partial<{ [key in Key]: number | Variable }>\n letterSpacing: Partial<{ [key in Key]: number | Variable }>\n weight: Partial<{ [key in Key]: number | string | Variable }>\n family: string | Variable\n style?: Partial<{ [key in Key]: TextStyle['fontStyle'] | Variable }>\n transform?: Partial<{ [key in Key]: TextStyle['textTransform'] | Variable }>\n color?: Partial<{ [key in Key]: string | Variable }>\n // for native use only, lets you map to alternative fonts\n face?: Partial<{\n [key in FontWeightSteps]: { normal?: string; italic?: string }\n }>\n}\n\n// media\nexport type MediaQueryObject = { [key: string]: string | number | string }\nexport type MediaQueryKey = keyof Media\nexport type MediaPropKeys = `$${MediaQueryKey}`\nexport type MediaQueryState = { [key in MediaQueryKey]: boolean }\nexport type MediaProps<A> = {\n [key in MediaPropKeys]?: A\n}\nexport type MediaQueries = {\n [key in MediaQueryKey]: MediaQueryObject\n}\n\nexport interface MediaQueryList {\n addListener(listener?: any): void\n removeListener(listener?: any): void\n matches: boolean\n}\n\nexport type MatchMedia = (query: string) => MediaQueryList\n\nexport type TransformStyleProps = {\n x?: number\n y?: number\n perspective?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n skewX?: string\n skewY?: string\n matrix?: number[]\n rotate?: string\n rotateY?: string\n rotateX?: string\n rotateZ?: string\n}\n\n// createComponent props helpers\n\n// animation=\"bouncy\"\n// animation={['bouncy', { }]}\n// { all: 'name' }\n\n// TODO can override for better types\nexport type AnimationConfigType = any\n\nexport type AnimationProp =\n | AnimationKeys\n | {\n [key: string]:\n | AnimationKeys\n | {\n type: AnimationKeys\n [key: string]: any\n }\n }\n | [\n AnimationKeys,\n {\n [key: string]:\n | AnimationKeys\n | {\n type?: AnimationKeys\n [key: string]: any\n }\n }\n ]\n\ntype GetTokenFontKeysFor<\n A extends\n | 'size'\n | 'weight'\n | 'letterSpacing'\n | 'family'\n | 'lineHeight'\n | 'transform'\n | 'style'\n | 'color'\n> = keyof TamaguiConfig['fonts']['body'][A]\n\ntype GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`\n\n// base tokens\nexport type SizeTokens = GetTokenString<keyof Tokens['size']> | number\nexport type SpaceTokens = GetTokenString<keyof Tokens['space']> | number | boolean\n\nexport type ColorTokens =\n | GetTokenString<keyof Tokens['color']>\n | GetTokenString<keyof ThemeParsed>\n | CSSColorNames\nexport type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number\nexport type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number\n\n// font tokens\nexport type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>\nexport type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number\nexport type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number\nexport type FontWeightSteps = `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`\nexport type FontWeightTokens = `$${GetTokenFontKeysFor<'weight'>}` | FontWeightSteps\nexport type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number\nexport type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number\nexport type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle']\nexport type FontTransformTokens =\n | `$${GetTokenFontKeysFor<'transform'>}`\n | TextStyle['textTransform']\n\n//\n// adds theme short values to relevant props\n//\n\nexport type ThemeValueByCategory<K extends string | number | symbol> = K extends 'theme'\n ? ThemeTokens\n : K extends 'size'\n ? SizeTokens\n : K extends 'font'\n ? FontTokens\n : K extends 'fontSize'\n ? FontSizeTokens\n : K extends 'space'\n ? SpaceTokens\n : K extends 'color'\n ? ColorTokens\n : K extends 'zIndex'\n ? ZIndexTokens\n : K extends 'lineHeight'\n ? FontLineHeightTokens\n : K extends 'fontWeight'\n ? FontWeightTokens\n : K extends 'letterSpacing'\n ? FontLetterSpacingTokens\n : {}\n\ntype FontKeys = 'fontFamily'\ntype FontSizeKeys = 'fontSize'\ntype FontWeightKeys = 'fontWeight'\ntype FontLetterSpacingKeys = 'letterSpacing'\ntype LineHeightKeys = 'lineHeight'\ntype ZIndexKeys = 'zIndex'\n\nexport type ThemeValueGet<K extends string | number | symbol> = K extends 'theme'\n ? ThemeTokens\n : K extends SizeKeys\n ? SizeTokens\n : K extends FontKeys\n ? FontTokens\n : K extends FontSizeKeys\n ? FontSizeTokens\n : K extends `${`border${string | ''}Radius`}`\n ? RadiusTokens\n : K extends SpaceKeys\n ? K extends 'shadowOffset'\n ? { width: SpaceTokens; height: SpaceTokens }\n : SpaceTokens\n : K extends ColorKeys\n ? ColorTokens\n : K extends ZIndexKeys\n ? ZIndexTokens\n : K extends LineHeightKeys\n ? FontLineHeightTokens\n : K extends FontWeightKeys\n ? FontWeightTokens\n : K extends FontLetterSpacingKeys\n ? FontLetterSpacingTokens\n : never\n\nexport type ThemeValueFallback = UnionableString | Variable\n\nexport type WithThemeValues<T extends object> = {\n [K in keyof T]: ThemeValueGet<K> extends never\n ? T[K]\n : ThemeValueGet<K> | Exclude<T[K], string> | ThemeValueFallback\n}\n\n// adds shorthand props\nexport type WithShorthands<StyleProps> = {\n [Key in keyof Shorthands]?: Shorthands[Key] extends keyof StyleProps\n ? StyleProps[Shorthands[Key]] | null\n : undefined\n}\n\n// adds pseudo props\nexport type PseudoProps<A> = {\n hoverStyle?: A | null\n pressStyle?: A | null\n focusStyle?: A | null\n exitStyle?: A | null\n enterStyle?: A | null\n}\n\nexport type PseudoPropKeys = keyof PseudoProps<any>\n\nexport type PseudoStyles = {\n hoverStyle?: ViewStyle\n pressStyle?: ViewStyle\n focusStyle?: ViewStyle\n enterStyle?: ViewStyle\n exitStyle?: ViewStyle\n}\n\n//\n// add both theme and shorthands\n//\ntype WithThemeAndShorthands<A extends object> = WithThemeValues<A> &\n WithShorthands<WithThemeValues<A>>\n\n//\n// combines all of theme, shorthands, pseudos...\n//\ntype WithThemeShorthandsAndPseudos<A extends object> =\n | WithThemeAndShorthands<A> & PseudoProps<WithThemeAndShorthands<A>>\n\n//\n// ... media queries and animations\n//\ntype WithThemeShorthandsPseudosMediaAnimation<A extends object> =\n WithThemeShorthandsAndPseudos<A> & MediaProps<WithThemeShorthandsAndPseudos<A>>\n\n/**\n * Base style-only props (no media, pseudo):\n */\n\ntype SharedBaseExtraStyleProps = {\n pointerEvents?: ViewProps['pointerEvents']\n cursor?: Properties['cursor']\n contain?: Properties['contain']\n display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'\n gap?: number | SpaceTokens\n columnGap?: number | SpaceTokens\n rowGap?: number | SpaceTokens\n userSelect?: Properties['userSelect']\n outlineColor?: Properties['outlineColor']\n outlineStyle?: Properties['outlineStyle']\n outlineOffset?: Properties['outlineOffset']\n outlineWidth?: Properties['outlineWidth']\n}\n\ntype OverrideRNStyleProps =\n | 'display'\n | 'backfaceVisibility'\n | 'elevation'\n | 'gap'\n | 'columnGap'\n | 'rowGap'\n\nexport type StackStylePropsBase = Omit<ViewStyle, OverrideRNStyleProps> &\n TransformStyleProps &\n SharedBaseExtraStyleProps\n\nexport type TextStylePropsBase = Omit<TextStyle, OverrideRNStyleProps> &\n TransformStyleProps &\n SharedBaseExtraStyleProps & {\n ellipse?: boolean\n textDecorationDistance?: number\n textOverflow?: Properties['textOverflow']\n whiteSpace?: Properties['whiteSpace']\n wordWrap?: Properties['wordWrap']\n }\n\nexport interface ExtendBaseStackProps {}\nexport interface ExtendsBaseTextProps {}\n\n//\n// Stack\n//\n\n// these are added back in by core\ntype OmitRemovedNonWebProps = 'onLayout' | keyof GestureResponderHandlers\n\nexport type StackNonStyleProps = Omit<\n ViewProps,\n 'display' | 'children' | OmitRemovedNonWebProps\n> &\n ExtendBaseStackProps &\n TamaguiComponentPropsBase\n\nexport type StackStyleProps =\n WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>\nexport type StackPropsBase = StackNonStyleProps &\n WithThemeAndShorthands<StackStylePropsBase>\nexport type StackProps = StackNonStyleProps & StackStyleProps\n\n//\n// Text props\n//\n\nexport type TextNonStyleProps = Omit<\n ReactTextProps,\n 'children' | OmitRemovedNonWebProps\n> &\n ExtendsBaseTextProps &\n TamaguiComponentPropsBase\n\nexport type TextPropsBase = TextNonStyleProps & WithThemeAndShorthands<TextStylePropsBase>\n\nexport type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>\nexport type TextProps = TextNonStyleProps & TextStyleProps\n\n// could actually infer from parent\nexport type ViewOrTextProps = WithThemeShorthandsPseudosMediaAnimation<\n Omit<TextStylePropsBase, keyof StackStylePropsBase> & StackStylePropsBase\n>\n\n//\n// StaticComponent\n//\n\nexport type TamaguiComponent<\n Props = any,\n Ref = any,\n BaseProps = {},\n VariantProps = {}\n> = ReactComponentWithRef<Props, Ref> & StaticComponentObject\n\ntype StaticComponentObject = {\n staticConfig: StaticConfigParsed\n /*\n * Only needed for more complex components\n * If you create a styled frame component this is a HoC to extract\n * styles from all parents.\n */\n extractable: <X>(a: X, opts?: Partial<StaticConfig>) => X\n}\n\nexport type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {\n config: TamaguiInternalConfig\n disableInjectCSS?: boolean\n children?: ReactNode\n}\n\nexport type PropMapper = (\n key: string,\n value: any,\n theme: ThemeParsed,\n props: Record<string, any>,\n state: Partial<SplitStyleState>,\n languageContext?: FontLanguageProps,\n avoidDefaultProps?: boolean,\n debug?: DebugProp\n) => undefined | [string, any][]\n\nexport type StaticConfigParsed = StaticConfig & {\n parsed: true\n propMapper: PropMapper\n variantsParsed?: {\n [key: string]: {\n [key: string]: any\n }\n }\n}\n\nexport type GenericVariantDefinitions = {\n [key: string]: {\n [key: string]:\n | ((a: any, b: any) => any)\n | {\n [key: string]: any\n }\n }\n}\n\nexport type StaticConfigPublic = {\n /**\n * (compiler) If you need to pass context or something, prevents from ever\n * flattening. The 'jsx' option means it will never flatten. if you\n * pass JSX as a children (if its purely string, it will still flatten).\n */\n neverFlatten?: boolean | 'jsx'\n\n /**\n * Determines ultimate output tag (Text vs View)\n */\n isText?: boolean\n\n /**\n * Which style keys are allowed to be extracted.\n */\n validStyles?: { [key: string]: boolean }\n\n /**\n * (compiler) If these props are encountered, bail on all optimization.\n */\n deoptProps?: Set<string>\n\n /**\n * (compiler) If these props are encountered, leave them un-extracted.\n */\n inlineProps?: Set<string>\n\n /**\n * (compiler) If not flattening, leave this prop as original value.\n * Only applies to style attributes\n */\n inlineWhenUnflattened?: Set<string>\n\n /**\n * (compiler) A bit odd, only for more advanced heirarchies.\n * Indicates that the component will set this prop so the\n * static extraction can ensure it sets them to ={undefined}\n * so they get overriddent. In the future, this can be smarter.\n */\n ensureOverriddenProp?: { [key: string]: boolean }\n\n /**\n * Auto-detected, but can ovverride. Wraps children to space them on top\n */\n isZStack?: boolean\n\n /**\n * Auto-detect, but can override, passes styles properly to react-native-web\n */\n isReactNative?: boolean\n\n /**\n * By default if styled() doesn't recognize a parent Tamagui compoent or specific react-native views,\n * it will assume the passed in component only accepts style={} for react-native compatibility.\n * Setting `acceptsClassName: true` indicates Tamagui can pass in className props.\n */\n acceptsClassName?: boolean\n}\n\ntype StaticConfigBase = StaticConfigPublic & {\n Component?: FunctionComponent<any> & StaticComponentObject\n\n variants?: GenericVariantDefinitions\n\n /**\n * Used for applying sub theme style\n */\n componentName?: string\n\n /**\n * Same as React.defaultProps, be sure to sync\n */\n defaultProps: Record<string, any>\n\n /**\n * Merges into defaultProps later on, used internally yonly\n */\n defaultVariants?: { [key: string]: any }\n\n /**\n * Memoize the component\n */\n memo?: boolean\n\n /**\n * Used insternally to attach default props to names\n */\n parentNames?: string[]\n\n /**\n * By default if styled() doesn't recognize a parent Tamagui compoent or specific react-native views,\n * it will assume the passed in component only accepts style={} for react-native compatibility.\n * Setting `acceptsClassName: true` indicates Tamagui can pass in className props.\n */\n acceptsClassName?: boolean\n\n /**\n * Used internally for handling focus\n */\n isInput?: boolean\n\n /**\n * Used internally for knowing how to handle when a HOC is in-between styled()\n */\n isHOC?: boolean\n}\n\nexport type StaticConfig = StaticConfigBase & {\n parentStaticConfig?: StaticConfigBase\n}\n\nexport type ViewStyleWithPseudos =\n | TextStyleProps\n | (TextStyleProps & {\n hoverStyle?: TextStyleProps\n pressStyle?: TextStyleProps\n focusStyle?: TextStyleProps\n })\n\n/**\n * --------------------------------------------\n * variants\n * --------------------------------------------\n */\n\nexport type StylableComponent =\n | TamaguiComponent\n // * excessively deep type instantiation\n // | TamaguiReactElement\n | ComponentType<any>\n | ForwardRefExoticComponent<any>\n | ReactComponentWithRef<any, any>\n | (new (props: any) => any)\n\nexport type GetStyledVariants<A extends TamaguiComponent> = A extends TamaguiComponent<\n any,\n any,\n any,\n infer Variants\n>\n ? Variants\n : never\n\nexport type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<\n any,\n any,\n infer BaseProps\n>\n ? BaseProps\n : never\n\nexport type GetProps<A extends StylableComponent> = A extends TamaguiComponent<\n infer Props\n>\n ? Props\n : A extends TamaguiReactElement<infer Props>\n ? Props\n : A extends ComponentType<infer Props>\n ? GetGenericComponentTamaguiProps<Props>\n : A extends new (props: infer Props) => any\n ? GetGenericComponentTamaguiProps<Props>\n : {}\n\ntype GetGenericComponentTamaguiProps<P> = P &\n Omit<'textAlign' extends keyof P ? TextProps : StackProps, keyof P>\n\nexport type SpreadKeys =\n | '...fontSize'\n | '...fontStyle'\n | '...fontTransform'\n | '...lineHeight'\n | '...letterSpacing'\n | '...size'\n | '...space'\n | '...color'\n | '...zIndex'\n | '...theme'\n | '...radius'\n\nexport type VariantDefinitions<\n Parent extends StylableComponent = TamaguiComponent,\n MyProps extends Object = GetProps<Parent>,\n Val = any\n> = VariantDefinitionFromProps<MyProps, Val>\n\nexport type VariantDefinitionFromProps<MyProps, Val> = MyProps extends Object\n ? {\n [propName: string]:\n | VariantSpreadFunction<MyProps, Val>\n | ({\n [Key in SpreadKeys]?: Key extends '...fontSize'\n ? FontSizeVariantSpreadFunction<MyProps>\n : Key extends '...size'\n ? SizeVariantSpreadFunction<MyProps>\n : Key extends '...space'\n ? SpaceVariantSpreadFunction<MyProps>\n : Key extends '...color'\n ? ColorVariantSpreadFunction<MyProps>\n : Key extends '...lineHeight'\n ? FontLineHeightVariantSpreadFunction<MyProps>\n : Key extends '...fontTransform'\n ? FontTransformVariantSpreadFunction<MyProps>\n : Key extends '...fontStyle'\n ? FontStyleVariantSpreadFunction<MyProps>\n : Key extends '...letterSpacing'\n ? FontLetterSpacingVariantSpreadFunction<MyProps>\n : Key extends '...zIndex'\n ? ZIndexVariantSpreadFunction<MyProps>\n : Key extends '...radius'\n ? RadiusVariantSpreadFunction<MyProps>\n : Key extends '...theme'\n ? ThemeVariantSpreadFunction<MyProps>\n : never\n } & {\n [Key in string | number | 'true' | 'false']?:\n | MyProps\n | VariantSpreadFunction<MyProps, Val>\n } & {\n [Key in VariantTypeKeys]?: Key extends ':number'\n ? VariantSpreadFunction<MyProps, number>\n : Key extends ':boolean'\n ? VariantSpreadFunction<MyProps, boolean>\n : Key extends ':string'\n ? VariantSpreadFunction<MyProps, string>\n : never\n })\n }\n : never\n\nexport type GenericStackVariants = VariantDefinitionFromProps<StackProps, any>\nexport type GenericTextVariants = VariantDefinitionFromProps<StackProps, any>\n\nexport type GetVariantProps<Variants> = {\n [Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>\n ? Val\n : GetVariantValues<keyof Variants[Key]>\n}\n\nexport type VariantSpreadExtras<Props> = {\n fonts: TamaguiConfig['fonts']\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n props: Props\n}\n\ntype PropLike = { [key: string]: any }\n\nexport type VariantSpreadFunction<Props extends PropLike, Val = any> = (\n val: Val,\n config: VariantSpreadExtras<Props>\n) =>\n | {\n [Key in keyof Props]: Props[Key] | Variable\n }\n | null\n | undefined\n\nexport type VariantTypeKeys = ':string' | ':boolean' | ':number'\n\nexport type GetVariantValues<Key> = Key extends `...${infer VariantSpread}`\n ? ThemeValueByCategory<VariantSpread>\n : Key extends 'true' | 'false'\n ? boolean\n : Key extends ':string'\n ? string\n : Key extends ':boolean'\n ? boolean\n : Key extends ':number'\n ? number\n : Key\n\nexport type FontSizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontSizeTokens\n>\nexport type SizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n SizeTokens\n>\nexport type SpaceVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n SpaceTokens\n>\nexport type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n ColorTokens\n>\nexport type FontLineHeightVariantSpreadFunction<A extends PropLike> =\n VariantSpreadFunction<A, FontLineHeightTokens>\nexport type FontLetterSpacingVariantSpreadFunction<A extends PropLike> =\n VariantSpreadFunction<A, FontLetterSpacingTokens>\nexport type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontStyleTokens\n>\nexport type FontTransformVariantSpreadFunction<A extends PropLike> =\n VariantSpreadFunction<A, FontTransformTokens>\nexport type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n ZIndexTokens\n>\nexport type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n RadiusTokens\n>\nexport type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n ThemeTokens\n>\n\n/**\n * --------------------------------------------\n * end variants\n * --------------------------------------------\n */\n\ntype SizeKeys =\n | 'width'\n | 'height'\n | 'minWidth'\n | 'minHeight'\n | 'maxWidth'\n | 'maxHeight'\n | 'shadowRadius'\n\ntype ColorKeys =\n | 'color'\n | 'backgroundColor'\n | 'borderColor'\n | 'borderBottomColor'\n | 'borderTopColor'\n | 'borderLeftColor'\n | 'borderRightColor'\n | 'shadowColor'\n | 'textShadowColor'\n\ntype SpaceKeys =\n | 'space'\n | 'padding'\n | 'paddingHorizontal'\n | 'paddingVertical'\n | 'paddingLeft'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'paddingEnd'\n | 'paddingStart'\n | 'margin'\n | 'marginHorizontal'\n | 'marginVertical'\n | 'marginLeft'\n | 'marginTop'\n | 'marginBottom'\n | 'marginLeft'\n | 'marginRight'\n | 'marginEnd'\n | 'marginStart'\n | 'x'\n | 'y'\n | 'scale'\n | 'scaleX'\n | 'scaleY'\n | 'borderTopEndRadius'\n | 'borderTopLeftRadius'\n | 'borderTopRightRadius'\n | 'borderTopStartRadius'\n | 'borderBottomEndRadius'\n | 'borderBottomLeftRadius'\n | 'borderBottomRightRadius'\n | 'borderBottomStartRadius'\n | 'borderBottomWidth'\n | 'borderLeftWidth'\n | 'borderRadius'\n | 'borderRightWidth'\n | 'borderTopEndRadius'\n | 'borderTopLeftRadius'\n | 'borderTopRightRadius'\n | 'borderEndWidth'\n | 'borderStartWidth'\n | 'borderTopStartRadius'\n | 'borderTopWidth'\n | 'borderWidth'\n | 'left'\n | 'top'\n | 'right'\n | 'bottom'\n | 'shadowOffset'\n\ntype CSSColorNames =\n | 'aliceblue'\n | 'antiquewhite'\n | 'aqua'\n | 'aquamarine'\n | 'azure'\n | 'beige'\n | 'bisque'\n | 'black'\n | 'blanchedalmond'\n | 'blue'\n | 'blueviolet'\n | 'brown'\n | 'burlywood'\n | 'cadetblue'\n | 'chartreuse'\n | 'chocolate'\n | 'coral'\n | 'cornflowerblue'\n | 'cornsilk'\n | 'crimson'\n | 'cyan'\n | 'darkblue'\n | 'darkcyan'\n | 'darkgoldenrod'\n | 'darkgray'\n | 'darkgreen'\n | 'darkkhaki'\n | 'darkmagenta'\n | 'darkolivegreen'\n | 'darkorange'\n | 'darkorchid'\n | 'darkred'\n | 'darksalmon'\n | 'darkseagreen'\n | 'darkslateblue'\n | 'darkslategray'\n | 'darkturquoise'\n | 'darkviolet'\n | 'deeppink'\n | 'deepskyblue'\n | 'dimgray'\n | 'dodgerblue'\n | 'firebrick'\n | 'floralwhite'\n | 'forestgreen'\n | 'fuchsia'\n | 'gainsboro'\n | 'ghostwhite'\n | 'gold'\n | 'goldenrod'\n | 'gray'\n | 'green'\n | 'greenyellow'\n | 'honeydew'\n | 'hotpink'\n | 'indianred '\n | 'indigo '\n | 'ivory'\n | 'khaki'\n | 'lavender'\n | 'lavenderblush'\n | 'lawngreen'\n | 'lemonchiffon'\n | 'lightblue'\n | 'lightcoral'\n | 'lightcyan'\n | 'lightgoldenrodyellow'\n | 'lightgrey'\n | 'lightgreen'\n | 'lightpink'\n | 'lightsalmon'\n | 'lightseagreen'\n | 'lightskyblue'\n | 'lightslategray'\n | 'lightsteelblue'\n | 'lightyellow'\n | 'lime'\n | 'limegreen'\n | 'linen'\n | 'magenta'\n | 'maroon'\n | 'mediumaquamarine'\n | 'mediumblue'\n | 'mediumorchid'\n | 'mediumpurple'\n | 'mediumseagreen'\n | 'mediumslateblue'\n | 'mediumspringgreen'\n | 'mediumturquoise'\n | 'mediumvioletred'\n | 'midnightblue'\n | 'mintcream'\n | 'mistyrose'\n | 'moccasin'\n | 'navajowhite'\n | 'navy'\n | 'oldlace'\n | 'olive'\n | 'olivedrab'\n | 'orange'\n | 'orangered'\n | 'orchid'\n | 'palegoldenrod'\n | 'palegreen'\n | 'paleturquoise'\n | 'palevioletred'\n | 'papayawhip'\n | 'peachpuff'\n | 'peru'\n | 'pink'\n | 'plum'\n | 'powderblue'\n | 'purple'\n | 'red'\n | 'rosybrown'\n | 'royalblue'\n | 'saddlebrown'\n | 'salmon'\n | 'sandybrown'\n | 'seagreen'\n | 'seashell'\n | 'sienna'\n | 'silver'\n | 'skyblue'\n | 'slateblue'\n | 'slategray'\n | 'snow'\n | 'springgreen'\n | 'steelblue'\n | 'tan'\n | 'teal'\n | 'thistle'\n | 'tomato'\n | 'turquoise'\n | 'violet'\n | 'wheat'\n | 'white'\n | 'whitesmoke'\n | 'yellow'\n | 'yellowgreen'\n\nexport type TamaguiComponentState = {\n hover: boolean\n press: boolean\n pressIn: boolean\n focus: boolean\n unmounted: boolean\n animation?: null | {\n style?: any\n avoidClasses?: boolean\n }\n}\n\nexport type SplitStyleState = TamaguiComponentState & {\n mediaState?: Record<string, boolean>\n noClassNames?: boolean\n dynamicStylesInline?: boolean\n resolveVariablesAs?: ResolveVariableTypes\n fallbackProps?: Record<string, any>\n hasTextAncestor?: boolean\n\n // for animations\n isExiting?: boolean\n exitVariant?: string\n enterVariant?: string\n}\n\n// Presence\n\nexport interface PresenceContextProps {\n id: string\n isPresent: boolean\n register: (id: string) => () => void\n onExitComplete?: (id: string) => void\n initial?: false | string | string[]\n custom?: any\n exitVariant?: string | null\n enterVariant?: string | null\n}\n\ntype SafeToRemoveCallback = () => void\ntype AlwaysPresent = [true, null, null]\ntype Present = [true, undefined, PresenceContextProps]\ntype NotPresent = [false, SafeToRemoveCallback, PresenceContextProps]\n\nexport type UsePresenceResult = AlwaysPresent | Present | NotPresent\n\n// Animations:\n\ntype AnimationConfig = {\n [key: string]: any\n}\n\n// includes a very limited adapter between various impls for number => style\n// this is useful only in limited scenarios like `Sheet`, but necessary in those cases\n// TODO: make css driver compatible with this?\n\nexport type AnimatedNumberStrategy =\n // only values shared between reanimated/react-native for now\n | {\n type: 'spring'\n stiffness?: number\n damping?: number\n mass?: number\n overshootClamping?: boolean\n restSpeedThreshold?: number\n restDisplacementThreshold?: number\n }\n | { type: 'timing'; duration: number }\n | { type: 'direct' }\n\nexport type UniversalAnimatedNumber<A> = {\n getInstance(): A\n getValue(): number\n setValue(next: number, config?: AnimatedNumberStrategy): void\n stop(): void\n}\n\nexport type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {\n isReactNative?: boolean\n useAnimations: UseAnimationHook\n usePresence: () => UsePresenceResult\n useAnimatedNumber: (initial: number) => UniversalAnimatedNumber<any>\n useAnimatedNumberStyle: <V extends UniversalAnimatedNumber<any>>(\n val: V,\n getStyle: (current: any) => any\n ) => any\n useAnimatedNumberReaction: <V extends UniversalAnimatedNumber<any>>(\n opts: {\n value: V\n hostRef: RefObject<HTMLElement | View>\n },\n onValue: (current: number) => void\n ) => void\n animations: A\n View?: any\n Text?: any\n}\n\nexport type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>\n\nexport type UseAnimationHook = (props: {\n style: Record<string, any>\n props: Record<string, any>\n presence?: UsePresenceResult | null\n hostRef: RefObject<HTMLElement | View>\n staticConfig: StaticConfigParsed\n state: SplitStyleState\n pseudos: PseudoProps<ViewStyle> | null\n onDidAnimate?: any\n delay?: number\n}) => null | {\n style?: StackStylePropsBase | StackStylePropsBase[]\n}\n\nexport type GestureReponderEvent = Exclude<\n View['props']['onResponderMove'],\n void\n> extends (event: infer Event) => void\n ? Event\n : never\n\nexport type RulesToInsert = StyleObject[]\n\nexport type GetStyleResult = {\n pseudos?: PseudoStyles\n style: ViewStyle\n classNames: ClassNamesObject\n rulesToInsert: RulesToInsert\n viewProps: StackProps & Record<string, any>\n fontFamily: string | undefined\n space?: any // SpaceTokens?\n hasMedia: boolean | 'space'\n}\n\nexport type ClassNamesObject = Record<string, string>\n\nexport type TamaguiComponentEvents = {\n cancelable?: boolean | undefined\n disabled?: any\n hitSlop?: any\n delayLongPress?: any\n delayPressIn?: any\n delayPressOut?: any\n focusable?: any\n minPressDuration?: number | undefined\n onPressIn: ((e: any) => void) | undefined\n onPress: ((e: any) => void) | undefined\n onMouseEnter?: ((e: any) => void) | undefined\n onMouseLeave?: ((e: any) => void) | undefined\n onPressOut: ((e: any) => void) | undefined\n}\n"],
|
|
4
|
+
"sourcesContent": ["// TODO split this into own package @tamagui/types to share with animations packages\n\nimport type { StyleObject } from '@tamagui/helpers'\nimport type { Properties } from 'csstype'\nimport type {\n ComponentType,\n ForwardRefExoticComponent,\n FunctionComponent,\n HTMLAttributes,\n ReactNode,\n RefAttributes,\n RefObject,\n} from 'react'\nimport type {\n GestureResponderHandlers,\n PressableProps,\n TextProps as ReactTextProps,\n TextStyle,\n View,\n ViewProps,\n ViewStyle,\n} from 'react-native'\n\nimport type { Variable } from './createVariable.js'\nimport type { ResolveVariableTypes } from './helpers/createPropMapper.js'\nimport type { FontLanguageProps } from './views/FontLanguage.types.js'\nimport type { ThemeProviderProps } from './views/ThemeProvider.js'\n\nexport type { MediaStyleObject, StyleObject } from '@tamagui/helpers'\n\nexport type SpaceDirection = 'vertical' | 'horizontal' | 'both'\n\nexport type TamaguiElement = HTMLElement | View\n\nexport type DebugProp = boolean | 'break' | 'verbose'\n\n// base props that are accepted by createComponent (additional to react-native-web)\n\ntype DivAttributes = HTMLAttributes<HTMLDivElement>\n\nexport type TamaguiReactElement<P = any> = React.ReactElement<P> & {\n type: TamaguiComponent\n}\n\nexport type TamaguiComponentPropsBase = {\n target?: string\n hitSlop?: PressableProps['hitSlop']\n asChild?: boolean\n space?: SpaceTokens | null\n spaceDirection?: SpaceDirection\n separator?: ReactNode\n dangerouslySetInnerHTML?: { __html: string }\n animation?: AnimationProp | null\n animateOnly?: string[]\n children?: any | any[]\n debug?: DebugProp\n disabled?: boolean\n className?: string\n themeShallow?: boolean\n id?: string\n tag?: string\n theme?: ThemeName | null\n componentName?: string\n tabIndex?: string | number\n role?: string\n\n /**\n * Forces the pseudo style state to be on\n */\n forceStyle?: 'hover' | 'press' | 'focus'\n onPress?: PressableProps['onPress']\n onPressIn?: PressableProps['onPress']\n onPressOut?: PressableProps['onPress']\n\n // WEB ONLY TODO probably remove these in favor of something better\n onHoverIn?: DivAttributes['onMouseEnter']\n onHoverOut?: DivAttributes['onMouseLeave']\n onMouseEnter?: DivAttributes['onMouseEnter']\n onMouseLeave?: DivAttributes['onMouseLeave']\n onMouseDown?: DivAttributes['onMouseDown']\n onMouseUp?: DivAttributes['onMouseUp']\n onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void\n onScroll?: (event: React.UIEvent<HTMLDivElement, UIEvent>) => void\n}\n\nexport type ReactComponentWithRef<Props, Ref> = ForwardRefExoticComponent<\n Props & RefAttributes<Ref>\n>\n\nexport type ConfigListener = (conf: TamaguiInternalConfig) => void\n\n// to prevent things from going circular, hoisting some types in this file\n// to generally order them as building up towards TamaguiConfig\n\nexport type VariableVal = number | string | Variable\nexport type VariableColorVal = string | Variable\n\ntype GenericKey = string\n\nexport interface CreateTokens<Val extends VariableVal = VariableVal> {\n color: { [key: GenericKey]: Val }\n space: { [key: GenericKey]: Val }\n size: { [key: GenericKey]: Val }\n radius: { [key: GenericKey]: Val }\n zIndex: { [key: GenericKey]: Val }\n}\n\ntype Tokenify<A extends GenericTokens> = {\n color: TokenifyRecord<A['color']>\n space: TokenifyRecord<A['space']>\n size: TokenifyRecord<A['size']>\n radius: TokenifyRecord<A['radius']>\n zIndex: TokenifyRecord<A['zIndex']>\n}\n\ntype TokenifyRecord<A extends CreateTokens[keyof CreateTokens]> = {\n [Key in keyof A]: A[Key] extends Variable ? A[Key] : Variable<A[Key]>\n}\n\nexport type TamaguiBaseTheme = {\n // defined for our tamagui kit , we could do this inside `tamagui`\n // but maybe helpful to have some sort of universally shared things +\n // + enforce if they want their own, redefine in their design sys\n background: VariableColorVal\n backgroundHover: VariableColorVal\n backgroundPress: VariableColorVal\n backgroundFocus: VariableColorVal\n color: VariableColorVal\n colorHover: VariableColorVal\n colorPress: VariableColorVal\n colorFocus: VariableColorVal\n borderColor: VariableColorVal\n borderColorHover: VariableColorVal\n borderColorPress: VariableColorVal\n borderColorFocus: VariableColorVal\n shadowColor: VariableColorVal\n shadowColorHover: VariableColorVal\n shadowColorPress: VariableColorVal\n shadowColorFocus: VariableColorVal\n}\n\ntype GenericTokens = CreateTokens\ntype GenericThemes = {\n [key: string]:\n | Partial<TamaguiBaseTheme> & {\n [key: string]: VariableVal\n }\n}\n\nexport type CreateShorthands = {\n // for some reason using keyof ViewStyle here will cause type circularity on react native 0.71\n [key: string]: string\n}\n\nexport type GenericShorthands = {}\n\n// sm: { minWidth: 100 }\ntype GenericMedia = {\n [key: string]: {\n [key: string]: number | string\n }\n}\n\nexport type GenericFonts = Record<string, GenericFont>\n\ntype GenericAnimations = {\n [key: string]:\n | string\n | {\n [key: string]: any\n }\n | any[]\n}\n\n// this is the \"main\" typed object, which users re-define\n// (internal) keep all types directly on this object and reference them from elsewhere\n//\n// const config = createTamagui(...)\n// type MyConfig = typeof config\n// declare module 'tamagui' {\n// export interface TamaguiCustomConfig extends MyConfig {}\n// }\n// now your whole app/kit should be typed correctly\n//\nexport interface TamaguiCustomConfig {}\n\nexport interface TamaguiConfig\n extends Omit<GenericTamaguiConfig, keyof TamaguiCustomConfig>,\n TamaguiCustomConfig {}\n\nexport type CreateTamaguiConfig<\n A extends GenericTokens,\n B extends GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = {\n fonts: RemoveLanguagePostfixes<F>\n fontLanguages: GetLanguagePostfixes<F> extends never\n ? string[]\n : GetLanguagePostfixes<F>[]\n tokens: A\n // parsed\n themes: {\n [Name in keyof B]: {\n [Key in keyof B[Name]]: Variable\n }\n }\n shorthands: C\n media: D\n animations: AnimationDriver<E>\n}\n\ntype GetLanguagePostfix<Set> = Set extends string\n ? Set extends `${string}_${infer Postfix}`\n ? Postfix\n : never\n : never\n\ntype OmitLanguagePostfix<Set> = Set extends string\n ? Set extends `${infer Prefix}_${string}`\n ? Prefix\n : Set\n : never\n\ntype RemoveLanguagePostfixes<F extends GenericFonts> = {\n [Key in OmitLanguagePostfix<keyof F>]: F[Key]\n}\n\ntype GetLanguagePostfixes<F extends GenericFonts> = GetLanguagePostfix<keyof F>\n\n// test RemoveLanguagePostfixes\n// type x = CreateTamaguiConfig<any, any, any, any, any, {\n// body: any,\n// body_en: any\n// }>['fonts']\n\ntype ConfProps<\n A extends GenericTokens,\n B extends GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = {\n tokens: A\n themes: B\n shorthands?: C\n media?: D\n animations?: AnimationDriver<E>\n fonts: F\n}\n\nexport type InferTamaguiConfig<Conf> = Conf extends ConfProps<\n infer A,\n infer B,\n infer C,\n infer D,\n infer E,\n infer F\n>\n ? TamaguiInternalConfig<A, B, C, D, E, F>\n : unknown\n\n// for use in creation functions so it doesnt get overwritten\nexport type GenericTamaguiConfig = CreateTamaguiConfig<\n GenericTokens,\n GenericThemes,\n GenericShorthands,\n GenericMedia,\n GenericAnimations,\n GenericFonts\n>\n\n// try and find the top level types as they can be supersets:\ntype NonSubThemeNames<A extends string | number> = A extends `${string}_${string}`\n ? never\n : A\ntype BaseThemeDefinitions = TamaguiConfig['themes'][NonSubThemeNames<\n keyof TamaguiConfig['themes']\n>]\ntype GenericThemeDefinition = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]\nexport type ThemeDefinition = BaseThemeDefinitions extends never\n ? GenericThemeDefinition\n : BaseThemeDefinitions\nexport type ThemeKeys = keyof ThemeDefinition\nexport type ThemeParsed = {\n [key in ThemeKeys]: Variable<any>\n}\n\nexport type Tokens = TamaguiConfig['tokens']\n\nexport type TokensParsed = {\n size: TokenPrefixed<Tokens['size']>\n color: TokenPrefixed<Tokens['color']>\n radius: TokenPrefixed<Tokens['radius']>\n zIndex: TokenPrefixed<Tokens['zIndex']>\n space: TokenPrefixed<Tokens['space']>\n}\n\ntype TokenPrefixed<A extends { [key: string]: any }> = {\n [key in Ensure$Prefix<keyof A>]: A[keyof A]\n}\n\ntype Ensure$Prefix<A extends string | number | symbol> = A extends string\n ? A extends `$${string}`\n ? A\n : `$${A}`\n : never\n\nexport type TokensMerged = {\n size: TokensParsed['size'] & Tokens['size']\n color: TokensParsed['color'] & Tokens['color']\n radius: TokensParsed['radius'] & Tokens['radius']\n zIndex: TokensParsed['zIndex'] & Tokens['zIndex']\n space: TokensParsed['space'] & Tokens['space']\n}\n\nexport type Shorthands = TamaguiConfig['shorthands']\nexport type Media = TamaguiConfig['media']\nexport type Themes = TamaguiConfig['themes']\nexport type ThemeName = Exclude<GetAltThemeNames<keyof Themes>, number>\nexport type ThemeTokens = `$${ThemeKeys}`\nexport type AnimationKeys = TamaguiConfig['animations'] extends AnimationDriver<\n infer Config\n>\n ? keyof Config\n : string\nexport type FontLanguages = ArrayIntersection<TamaguiConfig['fontLanguages']>\n\nexport interface ThemeProps {\n className?: string\n name?: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: DebugProp\n inverse?: boolean\n // on the web, for portals we need to re-insert className\n forceClassName?: boolean\n // allows for disabling the auto-update behavior\n shouldUpdate?: () => boolean\n}\n\ntype ArrayIntersection<A extends any[]> = A[keyof A]\n\ntype GetAltThemeNames<S> =\n | (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S)\n | S\n\ntype SpacerPropsBase = {\n size?: number | SpaceTokens | null\n flex?: boolean | number\n direction?: SpaceDirection\n}\ntype SpacerOwnProps = SpacerPropsBase &\n //\n WithThemeShorthandsPseudosMediaAnimation<SpacerPropsBase>\n\nexport type SpacerProps = Omit<StackProps, 'flex' | 'direction' | 'size'> &\n //\n SpacerOwnProps\n\nexport type CreateTamaguiProps = {\n reactNative?: any\n shorthands?: CreateShorthands\n media?: GenericTamaguiConfig['media']\n animations?: AnimationDriver<any>\n fonts: GenericTamaguiConfig['fonts']\n tokens: GenericTamaguiConfig['tokens']\n themes: {\n [key: string]: {\n [key: string]: string | number | Variable\n }\n }\n\n /**\n * *Advanced use case* For all CSS extracted views, this has no effect.\n *\n * For SSR compatibility on the web, Tamagui will render once with the settings\n * from `mediaQueryDefaultActive` set for all media queries. Then, it will render\n * again after the initial render using the proper media query values. This is so that\n * hydration will match perfectly with the server.\n *\n * Setting disableSSR will avoid this second render by setting the media query state\n * to the actual browser dimensions on initial load. This is only useful for client-only\n * apps.\n *\n */\n disableSSR?: boolean\n\n /**\n * Disable inserting a theme class in the DOM or context, allowing you to manually place it higher.\n * For custom use cases like integration with next-theme.\n */\n disableRootThemeClass?: boolean\n\n defaultProps?: Record<string, any> & {\n Stack?: StackProps\n Text?: TextProps\n Spacer?: SpacerProps\n }\n\n // for the first render, determines which media queries are true\n // useful for SSR\n mediaQueryDefaultActive?: Record<MediaQueryKey, boolean>\n\n // what's between each CSS style rule, set to \"\\n\" to be easier to read\n // defaults: \"\\n\" when NODE_ENV=development, \"\" otherwise\n cssStyleSeparator?: string\n\n // (Advanced)\n // on the web, tamagui treats `dark` and `light` themes as special and\n // generates extra CSS to avoid having to re-render the entire page.\n // this CSS relies on specificity hacks that multiply by your sub-themes.\n // this sets the maxiumum number of nested dark/light themes you can do\n // defaults to 3 for a balance, but can be higher if you nest them deeply.\n maxDarkLightNesting?: number\n\n // adds @media(prefers-color-scheme) media queries for dark/light\n shouldAddPrefersColorThemes?: boolean\n\n // only if you put the theme classname on the html element we have to generate diff\n themeClassNameOnRoot?: boolean\n}\n\n// this is the config generated via createTamagui()\nexport type TamaguiInternalConfig<\n A extends GenericTokens = GenericTokens,\n B extends GenericThemes = GenericThemes,\n C extends GenericShorthands = GenericShorthands,\n D extends GenericMedia = GenericMedia,\n E extends GenericAnimations = GenericAnimations,\n F extends GenericFonts = GenericFonts\n> = Omit<CreateTamaguiProps, keyof GenericTamaguiConfig> &\n Omit<CreateTamaguiConfig<A, B, C, D, E, F>, 'tokens'> & {\n // TODO need to make it this but this breaks types, revisit\n // animations: E //AnimationDriver<E>\n // with $ prefixes for fast lookups (one time cost at startup vs every render)\n tokens: Tokenify<A>\n tokensParsed: Tokenify<A>\n themeConfig: any\n fontsParsed: GenericFonts\n getCSS: () => string\n parsed: boolean\n inverseShorthands: Record<string, string>\n reactNative?: any\n }\n\nexport type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']\n\n// prevents const intersections from being clobbered into string, keeping the consts\nexport type UnionableString = string & {}\nexport type UnionableNumber = number & {}\n\nexport type GenericFont<Key extends number | string = number | string> = {\n size: { [key in Key]: number | Variable }\n lineHeight: Partial<{ [key in Key]: number | Variable }>\n letterSpacing: Partial<{ [key in Key]: number | Variable }>\n weight: Partial<{ [key in Key]: number | string | Variable }>\n family: string | Variable\n style?: Partial<{ [key in Key]: TextStyle['fontStyle'] | Variable }>\n transform?: Partial<{ [key in Key]: TextStyle['textTransform'] | Variable }>\n color?: Partial<{ [key in Key]: string | Variable }>\n // for native use only, lets you map to alternative fonts\n face?: Partial<{\n [key in FontWeightSteps]: { normal?: string; italic?: string }\n }>\n}\n\n// media\nexport type MediaQueryObject = { [key: string]: string | number | string }\nexport type MediaQueryKey = keyof Media\nexport type MediaPropKeys = `$${MediaQueryKey}`\nexport type MediaQueryState = { [key in MediaQueryKey]: boolean }\nexport type MediaProps<A> = {\n [key in MediaPropKeys]?: A\n}\nexport type MediaQueries = {\n [key in MediaQueryKey]: MediaQueryObject\n}\n\nexport interface MediaQueryList {\n addListener(listener?: any): void\n removeListener(listener?: any): void\n matches: boolean\n}\n\nexport type MatchMedia = (query: string) => MediaQueryList\n\nexport type TransformStyleProps = {\n x?: number\n y?: number\n perspective?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n skewX?: string\n skewY?: string\n matrix?: number[]\n rotate?: string\n rotateY?: string\n rotateX?: string\n rotateZ?: string\n}\n\n// createComponent props helpers\n\n// animation=\"bouncy\"\n// animation={['bouncy', { }]}\n// { all: 'name' }\n\n// TODO can override for better types\nexport type AnimationConfigType = any\n\nexport type AnimationProp =\n | AnimationKeys\n | {\n [key: string]:\n | AnimationKeys\n | {\n type: AnimationKeys\n [key: string]: any\n }\n }\n | [\n AnimationKeys,\n {\n [key: string]:\n | AnimationKeys\n | {\n type?: AnimationKeys\n [key: string]: any\n }\n }\n ]\n\ntype GetTokenFontKeysFor<\n A extends\n | 'size'\n | 'weight'\n | 'letterSpacing'\n | 'family'\n | 'lineHeight'\n | 'transform'\n | 'style'\n | 'color'\n> = keyof TamaguiConfig['fonts']['body'][A]\n\ntype GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`\n\n// base tokens\nexport type SizeTokens = GetTokenString<keyof Tokens['size']> | number\nexport type SpaceTokens = GetTokenString<keyof Tokens['space']> | number | boolean\n\nexport type ColorTokens =\n | GetTokenString<keyof Tokens['color']>\n | GetTokenString<keyof ThemeParsed>\n | CSSColorNames\nexport type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number\nexport type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number\n\n// font tokens\nexport type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>\nexport type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number\nexport type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number\nexport type FontWeightSteps = `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`\nexport type FontWeightTokens = `$${GetTokenFontKeysFor<'weight'>}` | FontWeightSteps\nexport type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number\nexport type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number\nexport type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle']\nexport type FontTransformTokens =\n | `$${GetTokenFontKeysFor<'transform'>}`\n | TextStyle['textTransform']\n\n//\n// adds theme short values to relevant props\n//\n\nexport type ThemeValueByCategory<K extends string | number | symbol> = K extends 'theme'\n ? ThemeTokens\n : K extends 'size'\n ? SizeTokens\n : K extends 'font'\n ? FontTokens\n : K extends 'fontSize'\n ? FontSizeTokens\n : K extends 'space'\n ? SpaceTokens\n : K extends 'color'\n ? ColorTokens\n : K extends 'zIndex'\n ? ZIndexTokens\n : K extends 'lineHeight'\n ? FontLineHeightTokens\n : K extends 'fontWeight'\n ? FontWeightTokens\n : K extends 'letterSpacing'\n ? FontLetterSpacingTokens\n : {}\n\ntype FontKeys = 'fontFamily'\ntype FontSizeKeys = 'fontSize'\ntype FontWeightKeys = 'fontWeight'\ntype FontLetterSpacingKeys = 'letterSpacing'\ntype LineHeightKeys = 'lineHeight'\ntype ZIndexKeys = 'zIndex'\n\nexport type ThemeValueGet<K extends string | number | symbol> = K extends 'theme'\n ? ThemeTokens\n : K extends SizeKeys\n ? SizeTokens\n : K extends FontKeys\n ? FontTokens\n : K extends FontSizeKeys\n ? FontSizeTokens\n : K extends `${`border${string | ''}Radius`}`\n ? RadiusTokens\n : K extends SpaceKeys\n ? K extends 'shadowOffset'\n ? { width: SpaceTokens; height: SpaceTokens }\n : SpaceTokens\n : K extends ColorKeys\n ? ColorTokens\n : K extends ZIndexKeys\n ? ZIndexTokens\n : K extends LineHeightKeys\n ? FontLineHeightTokens\n : K extends FontWeightKeys\n ? FontWeightTokens\n : K extends FontLetterSpacingKeys\n ? FontLetterSpacingTokens\n : never\n\nexport type ThemeValueFallback = UnionableString | Variable\n\nexport type WithThemeValues<T extends object> = {\n [K in keyof T]: ThemeValueGet<K> extends never\n ? T[K]\n : ThemeValueGet<K> | Exclude<T[K], string> | ThemeValueFallback\n}\n\n// adds shorthand props\nexport type WithShorthands<StyleProps> = {\n [Key in keyof Shorthands]?: Shorthands[Key] extends keyof StyleProps\n ? StyleProps[Shorthands[Key]] | null\n : undefined\n}\n\n// adds pseudo props\nexport type PseudoProps<A> = {\n hoverStyle?: A | null\n pressStyle?: A | null\n focusStyle?: A | null\n exitStyle?: A | null\n enterStyle?: A | null\n}\n\nexport type PseudoPropKeys = keyof PseudoProps<any>\n\nexport type PseudoStyles = {\n hoverStyle?: ViewStyle\n pressStyle?: ViewStyle\n focusStyle?: ViewStyle\n enterStyle?: ViewStyle\n exitStyle?: ViewStyle\n}\n\n//\n// add both theme and shorthands\n//\ntype WithThemeAndShorthands<A extends object> = WithThemeValues<A> &\n WithShorthands<WithThemeValues<A>>\n\n//\n// combines all of theme, shorthands, pseudos...\n//\ntype WithThemeShorthandsAndPseudos<A extends object> =\n | WithThemeAndShorthands<A> & PseudoProps<WithThemeAndShorthands<A>>\n\n//\n// ... media queries and animations\n//\ntype WithThemeShorthandsPseudosMediaAnimation<A extends object> =\n WithThemeShorthandsAndPseudos<A> & MediaProps<WithThemeShorthandsAndPseudos<A>>\n\n/**\n * Base style-only props (no media, pseudo):\n */\n\ntype SharedBaseExtraStyleProps = {\n pointerEvents?: ViewProps['pointerEvents']\n cursor?: Properties['cursor']\n contain?: Properties['contain']\n display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'\n gap?: number | SpaceTokens\n columnGap?: number | SpaceTokens\n rowGap?: number | SpaceTokens\n userSelect?: Properties['userSelect']\n outlineColor?: Properties['outlineColor']\n outlineStyle?: Properties['outlineStyle']\n outlineOffset?: number | SpaceTokens\n outlineWidth?: number | SpaceTokens\n}\n\ntype OverrideRNStyleProps =\n | 'display'\n | 'backfaceVisibility'\n | 'elevation'\n | 'gap'\n | 'columnGap'\n | 'rowGap'\n\nexport type StackStylePropsBase = Omit<ViewStyle, OverrideRNStyleProps> &\n TransformStyleProps &\n SharedBaseExtraStyleProps\n\nexport type TextStylePropsBase = Omit<TextStyle, OverrideRNStyleProps> &\n TransformStyleProps &\n SharedBaseExtraStyleProps & {\n ellipse?: boolean\n textDecorationDistance?: number\n textOverflow?: Properties['textOverflow']\n whiteSpace?: Properties['whiteSpace']\n wordWrap?: Properties['wordWrap']\n }\n\nexport interface ExtendBaseStackProps {}\nexport interface ExtendsBaseTextProps {}\n\n//\n// Stack\n//\n\n// these are added back in by core\ntype OmitRemovedNonWebProps = 'onLayout' | keyof GestureResponderHandlers\n\nexport type StackNonStyleProps = Omit<\n ViewProps,\n 'display' | 'children' | OmitRemovedNonWebProps\n> &\n ExtendBaseStackProps &\n TamaguiComponentPropsBase\n\nexport type StackStyleProps =\n WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>\nexport type StackPropsBase = StackNonStyleProps &\n WithThemeAndShorthands<StackStylePropsBase>\nexport type StackProps = StackNonStyleProps & StackStyleProps\n\n//\n// Text props\n//\n\nexport type TextNonStyleProps = Omit<\n ReactTextProps,\n 'children' | OmitRemovedNonWebProps\n> &\n ExtendsBaseTextProps &\n TamaguiComponentPropsBase\n\nexport type TextPropsBase = TextNonStyleProps & WithThemeAndShorthands<TextStylePropsBase>\n\nexport type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>\nexport type TextProps = TextNonStyleProps & TextStyleProps\n\n// could actually infer from parent\nexport type ViewOrTextProps = WithThemeShorthandsPseudosMediaAnimation<\n Omit<TextStylePropsBase, keyof StackStylePropsBase> & StackStylePropsBase\n>\n\n//\n// StaticComponent\n//\n\nexport type TamaguiComponent<\n Props = any,\n Ref = any,\n BaseProps = {},\n VariantProps = {}\n> = ReactComponentWithRef<Props, Ref> & StaticComponentObject\n\ntype StaticComponentObject = {\n staticConfig: StaticConfigParsed\n /*\n * Only needed for more complex components\n * If you create a styled frame component this is a HoC to extract\n * styles from all parents.\n */\n extractable: <X>(a: X, opts?: Partial<StaticConfig>) => X\n}\n\nexport type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {\n config: TamaguiInternalConfig\n disableInjectCSS?: boolean\n children?: ReactNode\n}\n\nexport type PropMapper = (\n key: string,\n value: any,\n theme: ThemeParsed,\n props: Record<string, any>,\n state: Partial<SplitStyleState>,\n languageContext?: FontLanguageProps,\n avoidDefaultProps?: boolean,\n debug?: DebugProp\n) => undefined | [string, any][]\n\nexport type StaticConfigParsed = StaticConfig & {\n parsed: true\n propMapper: PropMapper\n variantsParsed?: {\n [key: string]: {\n [key: string]: any\n }\n }\n}\n\nexport type GenericVariantDefinitions = {\n [key: string]: {\n [key: string]:\n | ((a: any, b: any) => any)\n | {\n [key: string]: any\n }\n }\n}\n\nexport type StaticConfigPublic = {\n /**\n * (compiler) If you need to pass context or something, prevents from ever\n * flattening. The 'jsx' option means it will never flatten. if you\n * pass JSX as a children (if its purely string, it will still flatten).\n */\n neverFlatten?: boolean | 'jsx'\n\n /**\n * Determines ultimate output tag (Text vs View)\n */\n isText?: boolean\n\n /**\n * Which style keys are allowed to be extracted.\n */\n validStyles?: { [key: string]: boolean }\n\n /**\n * (compiler) If these props are encountered, bail on all optimization.\n */\n deoptProps?: Set<string>\n\n /**\n * (compiler) If these props are encountered, leave them un-extracted.\n */\n inlineProps?: Set<string>\n\n /**\n * (compiler) If not flattening, leave this prop as original value.\n * Only applies to style attributes\n */\n inlineWhenUnflattened?: Set<string>\n\n /**\n * (compiler) A bit odd, only for more advanced heirarchies.\n * Indicates that the component will set this prop so the\n * static extraction can ensure it sets them to ={undefined}\n * so they get overriddent. In the future, this can be smarter.\n */\n ensureOverriddenProp?: { [key: string]: boolean }\n\n /**\n * Auto-detected, but can ovverride. Wraps children to space them on top\n */\n isZStack?: boolean\n\n /**\n * Auto-detect, but can override, passes styles properly to react-native-web\n */\n isReactNative?: boolean\n\n /**\n * By default if styled() doesn't recognize a parent Tamagui compoent or specific react-native views,\n * it will assume the passed in component only accepts style={} for react-native compatibility.\n * Setting `acceptsClassName: true` indicates Tamagui can pass in className props.\n */\n acceptsClassName?: boolean\n}\n\ntype StaticConfigBase = StaticConfigPublic & {\n Component?: FunctionComponent<any> & StaticComponentObject\n\n variants?: GenericVariantDefinitions\n\n /**\n * Used for applying sub theme style\n */\n componentName?: string\n\n /**\n * Same as React.defaultProps, be sure to sync\n */\n defaultProps: Record<string, any>\n\n /**\n * Merges into defaultProps later on, used internally yonly\n */\n defaultVariants?: { [key: string]: any }\n\n /**\n * Memoize the component\n */\n memo?: boolean\n\n /**\n * Used insternally to attach default props to names\n */\n parentNames?: string[]\n\n /**\n * By default if styled() doesn't recognize a parent Tamagui compoent or specific react-native views,\n * it will assume the passed in component only accepts style={} for react-native compatibility.\n * Setting `acceptsClassName: true` indicates Tamagui can pass in className props.\n */\n acceptsClassName?: boolean\n\n /**\n * Used internally for handling focus\n */\n isInput?: boolean\n\n /**\n * Used internally for knowing how to handle when a HOC is in-between styled()\n */\n isHOC?: boolean\n}\n\nexport type StaticConfig = StaticConfigBase & {\n parentStaticConfig?: StaticConfigBase\n}\n\nexport type ViewStyleWithPseudos =\n | TextStyleProps\n | (TextStyleProps & {\n hoverStyle?: TextStyleProps\n pressStyle?: TextStyleProps\n focusStyle?: TextStyleProps\n })\n\n/**\n * --------------------------------------------\n * variants\n * --------------------------------------------\n */\n\nexport type StylableComponent =\n | TamaguiComponent\n // * excessively deep type instantiation\n // | TamaguiReactElement\n | ComponentType<any>\n | ForwardRefExoticComponent<any>\n | ReactComponentWithRef<any, any>\n | (new (props: any) => any)\n\nexport type GetStyledVariants<A extends TamaguiComponent> = A extends TamaguiComponent<\n any,\n any,\n any,\n infer Variants\n>\n ? Variants\n : never\n\nexport type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<\n any,\n any,\n infer BaseProps\n>\n ? BaseProps\n : never\n\nexport type GetProps<A extends StylableComponent> = A extends TamaguiComponent<\n infer Props\n>\n ? Props\n : A extends TamaguiReactElement<infer Props>\n ? Props\n : A extends ComponentType<infer Props>\n ? GetGenericComponentTamaguiProps<Props>\n : A extends new (props: infer Props) => any\n ? GetGenericComponentTamaguiProps<Props>\n : {}\n\ntype GetGenericComponentTamaguiProps<P> = P &\n Omit<'textAlign' extends keyof P ? TextProps : StackProps, keyof P>\n\nexport type SpreadKeys =\n | '...fontSize'\n | '...fontStyle'\n | '...fontTransform'\n | '...lineHeight'\n | '...letterSpacing'\n | '...size'\n | '...space'\n | '...color'\n | '...zIndex'\n | '...theme'\n | '...radius'\n\nexport type VariantDefinitions<\n Parent extends StylableComponent = TamaguiComponent,\n MyProps extends Object = GetProps<Parent>,\n Val = any\n> = VariantDefinitionFromProps<MyProps, Val>\n\nexport type VariantDefinitionFromProps<MyProps, Val> = MyProps extends Object\n ? {\n [propName: string]:\n | VariantSpreadFunction<MyProps, Val>\n | ({\n [Key in SpreadKeys]?: Key extends '...fontSize'\n ? FontSizeVariantSpreadFunction<MyProps>\n : Key extends '...size'\n ? SizeVariantSpreadFunction<MyProps>\n : Key extends '...space'\n ? SpaceVariantSpreadFunction<MyProps>\n : Key extends '...color'\n ? ColorVariantSpreadFunction<MyProps>\n : Key extends '...lineHeight'\n ? FontLineHeightVariantSpreadFunction<MyProps>\n : Key extends '...fontTransform'\n ? FontTransformVariantSpreadFunction<MyProps>\n : Key extends '...fontStyle'\n ? FontStyleVariantSpreadFunction<MyProps>\n : Key extends '...letterSpacing'\n ? FontLetterSpacingVariantSpreadFunction<MyProps>\n : Key extends '...zIndex'\n ? ZIndexVariantSpreadFunction<MyProps>\n : Key extends '...radius'\n ? RadiusVariantSpreadFunction<MyProps>\n : Key extends '...theme'\n ? ThemeVariantSpreadFunction<MyProps>\n : never\n } & {\n [Key in string | number | 'true' | 'false']?:\n | MyProps\n | VariantSpreadFunction<MyProps, Val>\n } & {\n [Key in VariantTypeKeys]?: Key extends ':number'\n ? VariantSpreadFunction<MyProps, number>\n : Key extends ':boolean'\n ? VariantSpreadFunction<MyProps, boolean>\n : Key extends ':string'\n ? VariantSpreadFunction<MyProps, string>\n : never\n })\n }\n : never\n\nexport type GenericStackVariants = VariantDefinitionFromProps<StackProps, any>\nexport type GenericTextVariants = VariantDefinitionFromProps<StackProps, any>\n\nexport type GetVariantProps<Variants> = {\n [Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>\n ? Val\n : GetVariantValues<keyof Variants[Key]>\n}\n\nexport type VariantSpreadExtras<Props> = {\n fonts: TamaguiConfig['fonts']\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n props: Props\n}\n\ntype PropLike = { [key: string]: any }\n\nexport type VariantSpreadFunction<Props extends PropLike, Val = any> = (\n val: Val,\n config: VariantSpreadExtras<Props>\n) =>\n | {\n [Key in keyof Props]: Props[Key] | Variable\n }\n | null\n | undefined\n\nexport type VariantTypeKeys = ':string' | ':boolean' | ':number'\n\nexport type GetVariantValues<Key> = Key extends `...${infer VariantSpread}`\n ? ThemeValueByCategory<VariantSpread>\n : Key extends 'true' | 'false'\n ? boolean\n : Key extends ':string'\n ? string\n : Key extends ':boolean'\n ? boolean\n : Key extends ':number'\n ? number\n : Key\n\nexport type FontSizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontSizeTokens\n>\nexport type SizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n SizeTokens\n>\nexport type SpaceVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n SpaceTokens\n>\nexport type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n ColorTokens\n>\nexport type FontLineHeightVariantSpreadFunction<A extends PropLike> =\n VariantSpreadFunction<A, FontLineHeightTokens>\nexport type FontLetterSpacingVariantSpreadFunction<A extends PropLike> =\n VariantSpreadFunction<A, FontLetterSpacingTokens>\nexport type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontStyleTokens\n>\nexport type FontTransformVariantSpreadFunction<A extends PropLike> =\n VariantSpreadFunction<A, FontTransformTokens>\nexport type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n ZIndexTokens\n>\nexport type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n RadiusTokens\n>\nexport type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n ThemeTokens\n>\n\n/**\n * --------------------------------------------\n * end variants\n * --------------------------------------------\n */\n\ntype SizeKeys =\n | 'width'\n | 'height'\n | 'minWidth'\n | 'minHeight'\n | 'maxWidth'\n | 'maxHeight'\n | 'shadowRadius'\n\ntype ColorKeys =\n | 'color'\n | 'backgroundColor'\n | 'borderColor'\n | 'borderBottomColor'\n | 'borderTopColor'\n | 'borderLeftColor'\n | 'borderRightColor'\n | 'shadowColor'\n | 'textShadowColor'\n\ntype SpaceKeys =\n | 'space'\n | 'padding'\n | 'paddingHorizontal'\n | 'paddingVertical'\n | 'paddingLeft'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'paddingEnd'\n | 'paddingStart'\n | 'margin'\n | 'marginHorizontal'\n | 'marginVertical'\n | 'marginLeft'\n | 'marginTop'\n | 'marginBottom'\n | 'marginLeft'\n | 'marginRight'\n | 'marginEnd'\n | 'marginStart'\n | 'x'\n | 'y'\n | 'scale'\n | 'scaleX'\n | 'scaleY'\n | 'borderTopEndRadius'\n | 'borderTopLeftRadius'\n | 'borderTopRightRadius'\n | 'borderTopStartRadius'\n | 'borderBottomEndRadius'\n | 'borderBottomLeftRadius'\n | 'borderBottomRightRadius'\n | 'borderBottomStartRadius'\n | 'borderBottomWidth'\n | 'borderLeftWidth'\n | 'borderRadius'\n | 'borderRightWidth'\n | 'borderTopEndRadius'\n | 'borderTopLeftRadius'\n | 'borderTopRightRadius'\n | 'borderEndWidth'\n | 'borderStartWidth'\n | 'borderTopStartRadius'\n | 'borderTopWidth'\n | 'borderWidth'\n | 'left'\n | 'top'\n | 'right'\n | 'bottom'\n | 'shadowOffset'\n\ntype CSSColorNames =\n | 'aliceblue'\n | 'antiquewhite'\n | 'aqua'\n | 'aquamarine'\n | 'azure'\n | 'beige'\n | 'bisque'\n | 'black'\n | 'blanchedalmond'\n | 'blue'\n | 'blueviolet'\n | 'brown'\n | 'burlywood'\n | 'cadetblue'\n | 'chartreuse'\n | 'chocolate'\n | 'coral'\n | 'cornflowerblue'\n | 'cornsilk'\n | 'crimson'\n | 'cyan'\n | 'darkblue'\n | 'darkcyan'\n | 'darkgoldenrod'\n | 'darkgray'\n | 'darkgreen'\n | 'darkkhaki'\n | 'darkmagenta'\n | 'darkolivegreen'\n | 'darkorange'\n | 'darkorchid'\n | 'darkred'\n | 'darksalmon'\n | 'darkseagreen'\n | 'darkslateblue'\n | 'darkslategray'\n | 'darkturquoise'\n | 'darkviolet'\n | 'deeppink'\n | 'deepskyblue'\n | 'dimgray'\n | 'dodgerblue'\n | 'firebrick'\n | 'floralwhite'\n | 'forestgreen'\n | 'fuchsia'\n | 'gainsboro'\n | 'ghostwhite'\n | 'gold'\n | 'goldenrod'\n | 'gray'\n | 'green'\n | 'greenyellow'\n | 'honeydew'\n | 'hotpink'\n | 'indianred '\n | 'indigo '\n | 'ivory'\n | 'khaki'\n | 'lavender'\n | 'lavenderblush'\n | 'lawngreen'\n | 'lemonchiffon'\n | 'lightblue'\n | 'lightcoral'\n | 'lightcyan'\n | 'lightgoldenrodyellow'\n | 'lightgrey'\n | 'lightgreen'\n | 'lightpink'\n | 'lightsalmon'\n | 'lightseagreen'\n | 'lightskyblue'\n | 'lightslategray'\n | 'lightsteelblue'\n | 'lightyellow'\n | 'lime'\n | 'limegreen'\n | 'linen'\n | 'magenta'\n | 'maroon'\n | 'mediumaquamarine'\n | 'mediumblue'\n | 'mediumorchid'\n | 'mediumpurple'\n | 'mediumseagreen'\n | 'mediumslateblue'\n | 'mediumspringgreen'\n | 'mediumturquoise'\n | 'mediumvioletred'\n | 'midnightblue'\n | 'mintcream'\n | 'mistyrose'\n | 'moccasin'\n | 'navajowhite'\n | 'navy'\n | 'oldlace'\n | 'olive'\n | 'olivedrab'\n | 'orange'\n | 'orangered'\n | 'orchid'\n | 'palegoldenrod'\n | 'palegreen'\n | 'paleturquoise'\n | 'palevioletred'\n | 'papayawhip'\n | 'peachpuff'\n | 'peru'\n | 'pink'\n | 'plum'\n | 'powderblue'\n | 'purple'\n | 'red'\n | 'rosybrown'\n | 'royalblue'\n | 'saddlebrown'\n | 'salmon'\n | 'sandybrown'\n | 'seagreen'\n | 'seashell'\n | 'sienna'\n | 'silver'\n | 'skyblue'\n | 'slateblue'\n | 'slategray'\n | 'snow'\n | 'springgreen'\n | 'steelblue'\n | 'tan'\n | 'teal'\n | 'thistle'\n | 'tomato'\n | 'turquoise'\n | 'violet'\n | 'wheat'\n | 'white'\n | 'whitesmoke'\n | 'yellow'\n | 'yellowgreen'\n\nexport type TamaguiComponentState = {\n hover: boolean\n press: boolean\n pressIn: boolean\n focus: boolean\n unmounted: boolean\n animation?: null | {\n style?: any\n avoidClasses?: boolean\n }\n}\n\nexport type SplitStyleState = TamaguiComponentState & {\n mediaState?: Record<string, boolean>\n noClassNames?: boolean\n dynamicStylesInline?: boolean\n resolveVariablesAs?: ResolveVariableTypes\n fallbackProps?: Record<string, any>\n hasTextAncestor?: boolean\n\n // for animations\n isExiting?: boolean\n exitVariant?: string\n enterVariant?: string\n}\n\n// Presence\n\nexport interface PresenceContextProps {\n id: string\n isPresent: boolean\n register: (id: string) => () => void\n onExitComplete?: (id: string) => void\n initial?: false | string | string[]\n custom?: any\n exitVariant?: string | null\n enterVariant?: string | null\n}\n\ntype SafeToRemoveCallback = () => void\ntype AlwaysPresent = [true, null, null]\ntype Present = [true, undefined, PresenceContextProps]\ntype NotPresent = [false, SafeToRemoveCallback, PresenceContextProps]\n\nexport type UsePresenceResult = AlwaysPresent | Present | NotPresent\n\n// Animations:\n\ntype AnimationConfig = {\n [key: string]: any\n}\n\n// includes a very limited adapter between various impls for number => style\n// this is useful only in limited scenarios like `Sheet`, but necessary in those cases\n// TODO: make css driver compatible with this?\n\nexport type AnimatedNumberStrategy =\n // only values shared between reanimated/react-native for now\n | {\n type: 'spring'\n stiffness?: number\n damping?: number\n mass?: number\n overshootClamping?: boolean\n restSpeedThreshold?: number\n restDisplacementThreshold?: number\n }\n | { type: 'timing'; duration: number }\n | { type: 'direct' }\n\nexport type UniversalAnimatedNumber<A> = {\n getInstance(): A\n getValue(): number\n setValue(next: number, config?: AnimatedNumberStrategy): void\n stop(): void\n}\n\nexport type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {\n isReactNative?: boolean\n useAnimations: UseAnimationHook\n usePresence: () => UsePresenceResult\n useAnimatedNumber: (initial: number) => UniversalAnimatedNumber<any>\n useAnimatedNumberStyle: <V extends UniversalAnimatedNumber<any>>(\n val: V,\n getStyle: (current: any) => any\n ) => any\n useAnimatedNumberReaction: <V extends UniversalAnimatedNumber<any>>(\n opts: {\n value: V\n hostRef: RefObject<HTMLElement | View>\n },\n onValue: (current: number) => void\n ) => void\n animations: A\n View?: any\n Text?: any\n}\n\nexport type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>\n\nexport type UseAnimationHook = (props: {\n style: Record<string, any>\n props: Record<string, any>\n presence?: UsePresenceResult | null\n hostRef: RefObject<HTMLElement | View>\n staticConfig: StaticConfigParsed\n state: SplitStyleState\n pseudos: PseudoProps<ViewStyle> | null\n onDidAnimate?: any\n delay?: number\n}) => null | {\n style?: StackStylePropsBase | StackStylePropsBase[]\n}\n\nexport type GestureReponderEvent = Exclude<\n View['props']['onResponderMove'],\n void\n> extends (event: infer Event) => void\n ? Event\n : never\n\nexport type RulesToInsert = StyleObject[]\n\nexport type GetStyleResult = {\n pseudos?: PseudoStyles\n style: ViewStyle\n classNames: ClassNamesObject\n rulesToInsert: RulesToInsert\n viewProps: StackProps & Record<string, any>\n fontFamily: string | undefined\n space?: any // SpaceTokens?\n hasMedia: boolean | 'space'\n}\n\nexport type ClassNamesObject = Record<string, string>\n\nexport type TamaguiComponentEvents = {\n cancelable?: boolean | undefined\n disabled?: any\n hitSlop?: any\n delayLongPress?: any\n delayPressIn?: any\n delayPressOut?: any\n focusable?: any\n minPressDuration?: number | undefined\n onPressIn: ((e: any) => void) | undefined\n onPress: ((e: any) => void) | undefined\n onMouseEnter?: ((e: any) => void) | undefined\n onMouseLeave?: ((e: any) => void) | undefined\n onPressOut: ((e: any) => void) | undefined\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ import React, {
|
|
|
11
11
|
useCallback,
|
|
12
12
|
useContext,
|
|
13
13
|
useEffect,
|
|
14
|
+
useId,
|
|
14
15
|
useRef
|
|
15
16
|
} from "react";
|
|
16
17
|
import { onConfiguredOnce } from "./config.js";
|
|
@@ -154,11 +155,12 @@ function createComponent(configIn, ParentComponent) {
|
|
|
154
155
|
const isAnimatedReactNative = isAnimated && (animationsConfig == null ? void 0 : animationsConfig.isReactNative);
|
|
155
156
|
const isReactNative = Boolean(staticConfig.isReactNative || isAnimatedReactNative);
|
|
156
157
|
if (process.env.NODE_ENV === "development") {
|
|
158
|
+
const id = useId();
|
|
157
159
|
if (debugProp) {
|
|
158
160
|
const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
|
|
159
161
|
const type = isAnimatedReactNative ? "(animated)" : isReactNative ? "(rnw)" : "";
|
|
160
162
|
const dataIs = propsIn["data-is"] || "";
|
|
161
|
-
const banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
|
|
163
|
+
const banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type} id ${id}`;
|
|
162
164
|
console.group(`%c ${banner}`, "background: yellow;");
|
|
163
165
|
if (!isServer) {
|
|
164
166
|
console.log("state", state);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createComponent.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useComposedRefs } from '@tamagui/compose-refs'\nimport { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'\nimport { stylePropsView, validPseudoKeys, validStyles } from '@tamagui/helpers'\nimport React, {\n Children,\n Fragment,\n createElement,\n forwardRef,\n memo,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react'\n\nimport { onConfiguredOnce } from './config.js'\nimport { stackDefaultStyles } from './constants/constants.js'\nimport { FontLanguageContext } from './contexts/FontLanguageContext.js'\nimport { TextAncestorContext } from './contexts/TextAncestorContext.js'\nimport { didGetVariableValue, setDidGetVariableValue } from './createVariable.js'\nimport { extendStaticConfig, parseStaticConfig } from './helpers/extendStaticConfig.js'\nimport { useSplitStyles } from './helpers/getSplitStyles.js'\nimport { mergeProps } from './helpers/mergeProps.js'\nimport { proxyThemeVariables } from './helpers/proxyThemeVariables.js'\nimport { useShallowSetState } from './helpers/useShallowSetState.js'\nimport { useAnimationDriver } from './hooks/useAnimationDriver.js'\nimport { setMediaShouldUpdate, useMedia } from './hooks/useMedia.js'\nimport { useServerRef, useServerState } from './hooks/useServerHooks.js'\nimport { useThemeWithState } from './hooks/useTheme.js'\nimport { hooks } from './setupHooks.js'\nimport {\n DebugProp,\n SpaceDirection,\n SpaceTokens,\n SpacerProps,\n StaticConfig,\n StaticConfigParsed,\n StylableComponent,\n TamaguiComponent,\n TamaguiComponentEvents,\n TamaguiComponentState,\n TamaguiConfig,\n TamaguiElement,\n TamaguiInternalConfig,\n UseAnimationHook,\n UseAnimationProps,\n} from './types'\nimport { Slot } from './views/Slot.js'\nimport { Stack } from './views/Stack.js'\nimport { Text } from './views/Text.js'\nimport { useThemedChildren } from './views/Theme.js'\n\n// let t\n// import { timer } from '@tamagui/timer'\n// if (true || process.env.ANALYZE) {\n// t = require().timer()\n// setTimeout(() => {\n// const out = t.print()\n// if (isClient) {\n// alert(out)\n// }\n// }, 2000)\n// }\n\n// this appears to fix expo / babel not picking this up sometimes? really odd\nprocess.env.TAMAGUI_TARGET\n\nexport const defaultComponentState: TamaguiComponentState = {\n hover: false,\n press: false,\n pressIn: false,\n focus: false,\n unmounted: true,\n}\n\nconst defaultComponentStateMounted: TamaguiComponentState = {\n ...defaultComponentState,\n unmounted: false,\n}\n\n/**\n * All things that need one-time setup after createTamagui is called\n */\nlet tamaguiConfig: TamaguiInternalConfig\nlet AnimatedText: any\nlet AnimatedView: any\nlet initialTheme: any\n\nexport const mouseUps = new Set<Function>()\nif (typeof document !== 'undefined') {\n const cancelTouches = () => {\n mouseUps.forEach((x) => x())\n mouseUps.clear()\n }\n addEventListener('mouseup', cancelTouches)\n addEventListener('touchend', cancelTouches)\n addEventListener('touchcancel', cancelTouches)\n}\n\n// mutates\nfunction mergeShorthands(\n { defaultProps }: StaticConfigParsed,\n { shorthands }: TamaguiConfig\n) {\n // they are defined in correct order already { ...parent, ...child }\n for (const key of Object.keys(defaultProps)) {\n defaultProps[shorthands[key] || key] = defaultProps[key]\n }\n}\n\n/**\n * Only on native do we need the actual underlying View/Text\n * On the web we avoid react-native dep altogether.\n */\nlet BaseText: any\nlet BaseView: any\nlet hasSetupBaseViews = false\n\nexport function createComponent<\n ComponentPropTypes extends Object = {},\n Ref = TamaguiElement,\n BaseProps = never\n>(\n configIn: Partial<StaticConfig> | StaticConfigParsed,\n ParentComponent?: StylableComponent\n) {\n const staticConfig = (() => {\n const next = extendStaticConfig(configIn, ParentComponent)\n if ('parsed' in next) {\n return next\n } else {\n return parseStaticConfig(next)\n }\n })()\n\n const defaultComponentClassName = `is_${staticConfig.componentName}`\n let tamaguiDefaultProps: any\n let defaultTag: string | undefined\n\n // see onConfiguredOnce below which attaches a name then to this component\n const component = forwardRef<Ref, ComponentPropTypes>((propsIn: any, forwardedRef) => {\n if (process.env.TAMAGUI_TARGET === 'native') {\n // todo this could be moved to a cleaner location\n if (!hasSetupBaseViews) {\n hasSetupBaseViews = true\n const baseViews = hooks.getBaseViews?.()\n if (baseViews) {\n BaseText = baseViews.Text\n BaseView = baseViews.View\n }\n }\n }\n\n // test only\n if (process.env.NODE_ENV === 'test') {\n if (propsIn['data-test-renders']) {\n propsIn['data-test-renders']['current'] ??= 0\n propsIn['data-test-renders']['current'] += 1\n }\n }\n // const time = t.start({ quiet: true })\n\n // React inserts default props after your props for some reason...\n // order important so we do loops, you can't just spread because JS does weird things\n let props: any\n if (tamaguiDefaultProps && !propsIn.asChild) {\n props = mergeProps(tamaguiDefaultProps, propsIn)[0]\n } else {\n props = propsIn\n }\n\n const debugProp = props['debug'] as DebugProp\n const { Component, isText, isZStack } = staticConfig\n const componentName = props.componentName || staticConfig.componentName\n\n // conditional but if ever true stays true\n // [animated, inversed]\n const stateRef = useRef(\n undefined as any as {\n hasAnimated?: boolean\n themeShallow?: boolean\n didAccessThemeVariableValue?: boolean\n }\n )\n stateRef.current ??= {}\n\n /**\n * Component state for tracking animations, pseudos\n */\n const animationsConfig = useAnimationDriver()\n const useAnimations = animationsConfig?.useAnimations as UseAnimationHook | undefined\n const isAnimated = (() => {\n const next = !!(\n !staticConfig.isHOC &&\n useAnimations &&\n (props.animation || (props.style && hasAnimatedStyleValue(props.style)))\n )\n if (next && !stateRef.current.hasAnimated) {\n stateRef.current.hasAnimated = true\n }\n return next || stateRef.current.hasAnimated\n })()\n const componentClassName = props.asChild\n ? ''\n : props.componentName\n ? `is_${props.componentName}`\n : defaultComponentClassName\n const hasTextAncestor = !!(isWeb && isText ? useContext(TextAncestorContext) : false)\n const languageContext = isRSC ? null : useContext(FontLanguageContext)\n const isDisabled = props.disabled ?? props.accessibilityState?.disabled\n\n const isTaggable = !Component || typeof Component === 'string'\n // default to tag, fallback to component (when both strings)\n const element = isWeb\n ? isTaggable\n ? props.tag || defaultTag || Component\n : Component\n : Component\n\n const BaseTextComponent = BaseText || element || 'span'\n const BaseViewComponent = BaseView || element || (hasTextAncestor ? 'span' : 'div')\n\n AnimatedText = animationsConfig ? animationsConfig.Text : BaseTextComponent\n AnimatedView = animationsConfig ? animationsConfig.View : BaseViewComponent\n\n let elementType = isText\n ? (isAnimated ? AnimatedText : null) || BaseTextComponent\n : (isAnimated ? AnimatedView : null) || BaseViewComponent\n\n const avoidClassesWhileAnimating = animationsConfig?.isReactNative\n const hasEnterStyle = !!props.enterStyle\n const needsMount = Boolean(\n (isWeb ? isClient : true) && (hasEnterStyle || props.animation)\n )\n const states = useServerState<TamaguiComponentState>(\n needsMount ? defaultComponentState! : defaultComponentStateMounted!\n )\n\n const state = propsIn.forceStyle\n ? { ...states[0], [propsIn.forceStyle]: true }\n : states[0]\n const setState = states[1]\n const setStateShallow = useShallowSetState(setState, debugProp, componentName)\n\n const usePresence = animationsConfig?.usePresence\n const presence = !isRSC && isAnimated && usePresence ? usePresence() : null\n\n // set enter/exit variants onto our new props object\n if (isAnimated && presence) {\n const presenceState = presence[2]\n if (presenceState) {\n if (state.unmounted && presenceState.enterVariant) {\n props[presenceState.enterVariant] = true\n }\n if (!presenceState.isPresent && presenceState.exitVariant) {\n props[presenceState.exitVariant] = true\n }\n }\n }\n\n const isAnimatedReactNative = isAnimated && animationsConfig?.isReactNative\n const isReactNative = Boolean(staticConfig.isReactNative || isAnimatedReactNative)\n\n if (process.env.NODE_ENV === 'development') {\n if (debugProp) {\n // prettier-ignore\n const name = `${componentName || Component?.displayName || Component?.name || '[Unnamed Component]'}`\n const type = isAnimatedReactNative ? '(animated)' : isReactNative ? '(rnw)' : ''\n const dataIs = propsIn['data-is'] || ''\n const banner = `${name}${dataIs ? ` ${dataIs}` : ''} ${type}`\n console.group(`%c ${banner}`, 'background: yellow;')\n if (!isServer) {\n console.log('state', state)\n }\n }\n }\n\n const shouldAvoidClasses =\n !isWeb ||\n !!(props.animation && avoidClassesWhileAnimating) ||\n !staticConfig.acceptsClassName\n const shouldForcePseudo = !!propsIn.forceStyle\n const noClassNames = shouldAvoidClasses || shouldForcePseudo\n\n const themeState = useThemeWithState({\n name: props.theme,\n componentName,\n reset: props.reset,\n inverse: props.themeInverse,\n // @ts-expect-error\n disable: props['data-themeable'],\n debug: props.debug,\n shouldUpdate: () => !!stateRef.current.didAccessThemeVariableValue,\n })!\n\n elementType = Component || elementType\n const isStringElement = typeof elementType === 'string'\n\n const isExiting = presence?.[0] === false\n\n const mediaState = useMedia(\n // @ts-ignore, we just pass a stable object so we can get it later with\n // should match to the one used in `setMediaShouldUpdate` below\n stateRef,\n debugProp ? { props, staticConfig } : null\n )\n\n setDidGetVariableValue(false)\n\n const splitStyles = useSplitStyles(\n props,\n staticConfig,\n themeState.theme,\n {\n ...state,\n mediaState,\n noClassNames,\n dynamicStylesInline: noClassNames,\n hasTextAncestor,\n resolveVariablesAs: 'auto',\n isExiting,\n },\n null,\n languageContext || undefined,\n elementType,\n debugProp\n )\n\n // only listen for changes if we are using raw theme values or media space, or dynamic media (native)\n // array = space media breakpoints\n const isMediaSpaced = Array.isArray(splitStyles.hasMedia)\n const shouldListenForMedia =\n didGetVariableValue() ||\n isMediaSpaced ||\n (noClassNames && splitStyles.hasMedia === true)\n\n setMediaShouldUpdate(stateRef, {\n enabled: shouldListenForMedia,\n keys: noClassNames && isMediaSpaced ? (splitStyles.hasMedia as any) : null,\n })\n\n const hostRef = useServerRef<TamaguiElement>(null)\n\n // animation setup\n const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating\n\n if (process.env.NODE_ENV === 'development') {\n if (!process.env.TAMAGUI_TARGET) {\n console.error(\n `No process.env.TAMAGUI_TARGET set, please set it to \"native\" or \"web\".`\n )\n }\n\n if (debugProp) {\n console.groupCollapsed('props')\n // prettier-ignore\n console.log('props in', propsIn, 'mapped to', props, 'in order', Object.keys(props))\n console.log('splitStyles', splitStyles)\n // eslint-disable-next-line no-console\n console.log('shouldListenForMedia', shouldListenForMedia)\n // eslint-disable-next-line no-console\n console.log('className', Object.values(splitStyles.classNames))\n if (isClient) {\n console.log('ref', hostRef, '(click to view)')\n }\n console.groupEnd()\n if (debugProp === 'break') {\n // rome-ignore lint/suspicious/noDebugger: ok\n debugger\n }\n }\n }\n\n const {\n viewProps: viewPropsIn,\n pseudos,\n style: splitStylesStyle,\n classNames,\n space,\n } = splitStyles\n\n const propsWithAnimation = props as UseAnimationProps\n\n // once you set animation prop don't remove it, you can set to undefined/false\n // reason is animations are heavy - no way around it, and must be run inline here (\uD83D\uDE45 loading as a sub-component)\n let animationStyles: any\n if (!isRSC && isAnimated && useAnimations && !staticConfig.isHOC) {\n const animations = useAnimations({\n props: propsWithAnimation,\n style: splitStylesStyle,\n presence,\n state,\n pseudos: pseudos || null,\n onDidAnimate: props.onDidAnimate,\n hostRef,\n staticConfig,\n })\n if (animations) {\n animationStyles = animations.style\n }\n }\n\n const {\n asChild,\n children,\n onPress,\n onPressIn,\n onPressOut,\n onHoverIn,\n onHoverOut,\n themeShallow,\n spaceDirection: _spaceDirection,\n disabled: disabledProp,\n onMouseUp,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n separator,\n // ignore from here on out\n forceStyle: _forceStyle,\n // @ts-ignore for next/link compat etc\n onClick,\n theme: _themeProp,\n // @ts-ignore\n defaultVariants,\n\n ...nonTamaguiProps\n } = viewPropsIn\n\n const disabled = props.accessibilityState?.disabled || props.accessibilityDisabled\n\n // these can ultimately be for DOM, react-native-web views, or animated views\n // so the type is pretty loose\n let viewProps = nonTamaguiProps\n\n // if react-native-web view just pass all props down\n if (process.env.TAMAGUI_TARGET === 'web' && !isReactNative && !asChild) {\n viewProps = hooks.usePropsTransform?.(elementType, nonTamaguiProps, hostRef)\n } else {\n viewProps = nonTamaguiProps\n }\n\n viewProps.ref = useComposedRefs(hostRef as any, forwardedRef)\n\n if (process.env.NODE_ENV === 'development') {\n if (!isText && isWeb && !staticConfig.isHOC) {\n Children.toArray(props.children).forEach((item) => {\n // allow newlines because why not its annoying with mdx\n if (typeof item === 'string' && item !== '\\n') {\n console.error(\n `Unexpected text node: ${item}. A text node cannot be a child of a <View>.`\n )\n }\n })\n }\n }\n\n const unPress = useCallback(() => {\n setStateShallow({\n press: false,\n pressIn: false,\n })\n }, [setStateShallow])\n\n if (isWeb) {\n useEffect(() => {\n return () => {\n mouseUps.delete(unPress)\n }\n }, [])\n }\n\n const shouldSetMounted = needsMount && state.unmounted\n useEffect(() => {\n if (!shouldSetMounted) return\n if (state.unmounted === true && needsMount) {\n setStateShallow({\n unmounted: false,\n })\n return\n }\n\n setStateShallow({\n unmounted: false,\n })\n }, [shouldSetMounted, state.unmounted])\n\n let styles: Record<string, any>[]\n\n if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {\n styles = {\n ...(animationStyles ?? splitStylesStyle),\n }\n } else {\n styles = [animationStyles ?? splitStylesStyle]\n\n // ugly but for now...\n if (shouldForcePseudo) {\n const next = {}\n styles.forEach((style) => Object.assign(next, style))\n // @ts-ignore\n Object.assign(splitStyles.style, next)\n }\n }\n\n let fontFamily = isText\n ? splitStyles.fontFamily || staticConfig.defaultProps.fontFamily\n : null\n if (fontFamily && fontFamily[0] === '$') {\n fontFamily = fontFamily.slice(1)\n }\n const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : ''\n\n const classList = [\n hasEnterStyle && ((state.unmounted && needsMount) || !isClient)\n ? 't_will-mount'\n : '',\n componentName ? componentClassName : '',\n fontFamilyClassName,\n classNames ? Object.values(classNames).join(' ') : '',\n ]\n\n const className = classList.join(' ')\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n const style = animationStyles ?? splitStyles.style\n\n if (isAnimatedReactNativeWeb) {\n viewProps.style = style\n } else if (isReactNative) {\n // TODO these shouldn't really return from getSplitStyles when in Native mode\n const cnStyles = { $$css: true }\n for (const name of className.split(' ')) {\n cnStyles[name] = name\n }\n viewProps.style = [...(Array.isArray(style) ? style : [style]), cnStyles]\n\n if (process.env.NODE_ENV === 'development') {\n // turn debug data- props into dataSet in dev mode\n Object.keys(viewProps).forEach((key) => {\n if (key.startsWith('data-')) {\n viewProps.dataSet ??= {}\n viewProps.dataSet[key.replace('data-', '')] = viewProps[key]\n delete viewProps[key]\n }\n })\n }\n } else {\n viewProps.className = className\n viewProps.style = style\n }\n }\n\n // TODO MOVE INTO HOOK\n if (process.env.TAMAGUI_TARGET === 'native') {\n // swap out the right family based on weight/style\n if (splitStyles.fontFamily) {\n const faceInfo = tamaguiConfig.fontsParsed[splitStyles.fontFamily]?.face\n if (faceInfo) {\n const [weight, style] = (() => {\n let weight: string | undefined\n let style: string | undefined\n for (let i = styles.length; i >= 0; i--) {\n weight ??= styles[i]?.fontWeight\n style ??= styles[i]?.fontStyle\n }\n return [weight || '400', style || 'normal'] as const\n })()\n const overrideFace = faceInfo[weight]?.[style]?.val\n if (overrideFace) {\n for (const style of styles) {\n if (style?.fontFamily) {\n style.fontFamily = overrideFace\n style.fontWeight = undefined\n style.fontStyle = undefined\n }\n }\n }\n }\n }\n\n // assign styles\n viewProps.style = styles\n }\n\n const runtimePressStyle = !disabled && noClassNames && pseudos?.pressStyle\n const attachPress = Boolean(\n runtimePressStyle || onPress || onPressOut || onPressIn || onClick\n )\n const runtimeHoverStyle = !disabled && noClassNames && pseudos?.hoverStyle\n const isHoverable =\n isWeb &&\n !!(runtimeHoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave)\n\n const handlesPressEvents = !(isWeb || asChild)\n\n // check presence rather than value to prevent reparenting bugs\n // allows for onPress={x ? function : undefined} without re-ordering dom\n const shouldAttach = Boolean(\n attachPress ||\n isHoverable ||\n (noClassNames && 'pressStyle' in props) ||\n (isWeb && noClassNames && 'hoverStyle' in props)\n )\n\n const events: TamaguiComponentEvents | null =\n shouldAttach && !isRSC && !isDisabled && !asChild\n ? {\n onPressOut: attachPress\n ? (e) => {\n unPress()\n onPressOut?.(e)\n onMouseUp?.(e)\n }\n : undefined,\n ...(isHoverable && {\n onMouseEnter: isHoverable\n ? (e) => {\n const next: Partial<typeof state> = {}\n if (isHoverable) {\n next.hover = true\n }\n if (state.pressIn) {\n next.press = true\n }\n if (isHoverable || state.pressIn) {\n setStateShallow(next)\n }\n onHoverIn?.(e)\n onMouseEnter?.(e)\n }\n : undefined,\n onMouseLeave: isHoverable\n ? (e) => {\n const next: Partial<typeof state> = {}\n mouseUps.add(unPress)\n if (isHoverable) {\n next.hover = false\n }\n if (state.pressIn) {\n next.press = false\n next.pressIn = false\n }\n if (Object.keys(next).length) {\n setStateShallow(next)\n }\n onHoverOut?.(e)\n onMouseLeave?.(e)\n }\n : undefined,\n }),\n onPressIn: attachPress\n ? (e) => {\n setStateShallow({\n press: true,\n pressIn: true,\n hover: false,\n })\n onPressIn?.(e)\n onMouseDown?.(e)\n if (isWeb) {\n mouseUps.add(unPress)\n }\n }\n : undefined,\n onPress: attachPress\n ? (e) => {\n unPress()\n // @ts-ignore\n isWeb && onClick?.(e)\n onPress?.(e)\n }\n : undefined,\n }\n : null\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n if (events) {\n // replicating TouchableWithoutFeedback\n Object.assign(events, {\n cancelable: !props.rejectResponderTermination,\n disabled: isDisabled,\n hitSlop: props.hitSlop,\n delayLongPress: props.delayLongPress,\n delayPressIn: props.delayPressIn,\n delayPressOut: props.delayPressOut,\n focusable: viewProps.focusable ?? true,\n minPressDuration: 0,\n })\n }\n }\n\n // EVENTS native\n hooks.useEvents?.(viewProps, events, splitStyles, setStateShallow)\n\n const shouldReset = !!(themeShallow && themeState.isNewTheme)\n if (shouldReset) {\n stateRef.current.themeShallow = true\n }\n\n let content =\n !children || asChild\n ? children\n : spacedChildren({\n separator,\n children,\n space,\n direction: props.spaceDirection || 'both',\n isZStack,\n debug: debugProp,\n })\n\n if (asChild) {\n elementType = Slot\n viewProps = {\n ...viewProps,\n onPress,\n onPressIn,\n onPressOut,\n }\n }\n\n content = createElement(elementType, viewProps, content)\n\n content = useThemedChildren(themeState, content, {\n shallow: stateRef.current.themeShallow,\n // passPropsToChildren: true,\n })\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (events || isAnimatedReactNativeWeb) {\n content = (\n <span\n className={`${isAnimatedReactNativeWeb ? className : ''} _dsp_contents`}\n {...(events && {\n onMouseEnter: events.onMouseEnter,\n onMouseLeave: events.onMouseLeave,\n onClick: events.onPress,\n onMouseDown: events.onPressIn,\n onMouseUp: events.onPressOut,\n onTouchStart: events.onPressIn,\n onTouchEnd: events.onPressOut,\n })}\n >\n {content}\n </span>\n )\n }\n }\n\n if (process.env.NODE_ENV === 'development' && process.env.DEBUG !== 'tamagui') {\n if (debugProp) {\n const element = typeof elementType === 'string' ? elementType : 'Component'\n console.groupCollapsed(`render <${element} /> with props`, viewProps)\n for (const key in viewProps) {\n console.log(key, viewProps[key])\n }\n console.log('children', content)\n console.groupEnd()\n if (typeof window !== 'undefined') {\n // prettier-ignore\n console.log({ state, themeState, isAnimated, isAnimatedReactNativeWeb, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: props.className?.split(' '), classNamesOut: viewProps.className?.split(' '), events, shouldAttach, styles, pseudos, content, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, staticConfig, tamaguiConfig, shouldForcePseudo })\n }\n console.groupEnd()\n }\n }\n\n return content\n })\n\n if (staticConfig.componentName) {\n component.displayName = staticConfig.componentName\n }\n\n onConfiguredOnce((conf) => {\n // one time only setup\n if (!tamaguiConfig) {\n tamaguiConfig = conf\n\n if (!initialTheme) {\n const next = conf.themes[Object.keys(conf.themes)[0]]\n initialTheme = proxyThemeVariables(next)\n if (process.env.NODE_ENV === 'development') {\n if (!initialTheme) {\n console.log('Warning: Missing theme')\n }\n }\n }\n }\n\n // per-component setup\n // do this to make sure shorthands don't duplicate with.. longhands\n mergeShorthands(staticConfig, tamaguiConfig)\n\n let defaultPropsIn = staticConfig.defaultProps || {}\n\n // because we run createTamagui after styled() defs, have to do some work here\n // gather defaults props one time and merge downwards\n // find last unprocessed and process\n const parentNames = [...(staticConfig.parentNames || []), staticConfig.componentName]\n\n if (tamaguiConfig.defaultProps && parentNames && staticConfig.componentName) {\n defaultPropsIn = mergeConfigDefaultProps(\n staticConfig.componentName,\n defaultPropsIn,\n tamaguiConfig.defaultProps,\n parentNames,\n tamaguiConfig\n )\n }\n\n const debug = defaultPropsIn['debug']\n\n // remove all classNames\n const [ourProps, ourClassNames] = mergeProps(defaultPropsIn, {})\n\n if (ourProps.tag) {\n defaultTag = ourProps.tag\n }\n\n const noClassNames = !staticConfig.acceptsClassName\n const { name, variants, defaultVariants, ...restProps } = ourProps\n\n // must preserve prop order\n // leave out className because we handle that already with initialSplitStyles.classNames\n // otherwise it confuses variant functions getting className props\n const [defaults, defaultsClassnames] = mergeProps(component.defaultProps as any, {\n ...defaultVariants,\n ...restProps,\n })\n\n // split - keep variables on props to be processed using theme values at runtime (native)\n if (!isWeb) {\n for (const key in staticConfig.defaultProps) {\n const val = staticConfig.defaultProps[key]\n if (validPseudoKeys[key]) continue\n defaults[key] = val\n }\n }\n\n // set to global\n tamaguiDefaultProps = defaults\n\n // add debug logs\n if (process.env.NODE_ENV === 'development' && debug) {\n if (process.env.IS_STATIC !== 'is_static') {\n console.log(`\uD83D\uDC1B [${staticConfig.componentName || 'Component'}]`, {\n staticConfig,\n tamaguiDefaultProps,\n defaults,\n defaultPropsIn,\n defaultPropsKeyOrder: Object.keys(staticConfig.defaultProps),\n defaultPropsInKeyOrder: Object.keys(defaultPropsIn).map((k) => [\n k,\n defaultPropsIn[k],\n ]),\n ourProps,\n ourClassNames,\n defaultsClassnames,\n defaultTag,\n noClassNames,\n })\n }\n }\n })\n\n let res: TamaguiComponent<ComponentPropTypes, Ref, BaseProps> = component as any\n\n if (configIn.memo) {\n res = memo(res) as any\n }\n\n res.staticConfig = {\n validStyles: staticConfig.validStyles || stylePropsView,\n ...staticConfig,\n }\n\n // res.extractable HoC\n res.extractable = (Component: any, conf?: Partial<StaticConfig>) => {\n Component.staticConfig = extendStaticConfig(\n {\n Component,\n ...conf,\n neverFlatten: true,\n isHOC: true,\n defaultProps: {\n ...Component.defaultProps,\n ...conf?.defaultProps,\n },\n },\n res\n )\n return Component\n }\n\n return res\n}\n\n// for elements to avoid spacing\nexport const Unspaced = (props: { children?: any }) => props.children\nUnspaced['isUnspaced'] = true\n\n// dont used styled() here to avoid circular deps\n// keep inline to avoid circular deps\n\nexport const Spacer = createComponent<SpacerProps>({\n acceptsClassName: true,\n memo: true,\n componentName: 'Spacer',\n validStyles,\n\n defaultProps: {\n ...stackDefaultStyles,\n // avoid nesting issues\n tag: 'span',\n size: true,\n pointerEvents: 'none',\n },\n\n variants: {\n size: {\n '...size': (size, { tokens }) => {\n size = size === true ? '$true' : size\n const sizePx = tokens.space[size] ?? size\n return {\n width: sizePx,\n height: sizePx,\n minWidth: sizePx,\n minHeight: sizePx,\n }\n },\n },\n\n flex: {\n true: {\n flexGrow: 1,\n },\n },\n\n direction: {\n horizontal: {\n height: 0,\n minHeight: 0,\n },\n vertical: {\n width: 0,\n minWidth: 0,\n },\n both: {},\n },\n } as const,\n})\n\nexport type SpacedChildrenProps = {\n isZStack?: boolean\n children?: React.ReactNode\n space?: SpaceTokens | number | null\n spaceFlex?: boolean | number\n direction?: SpaceDirection\n separator?: React.ReactNode\n debug?: DebugProp\n}\n\nexport function spacedChildren(props: SpacedChildrenProps) {\n const { isZStack, children, space, direction, spaceFlex, separator } = props\n const hasSpace = !!(space || spaceFlex)\n const hasSeparator = !(separator === undefined || separator === null)\n if (!(hasSpace || hasSeparator || isZStack)) {\n return children\n }\n\n const childrenList = Children.toArray(children)\n\n const len = childrenList.length\n if (len <= 1 && !isZStack && !childrenList[0]?.['type']?.['shouldForwardSpace']) {\n return childrenList\n }\n\n const final: React.ReactNode[] = []\n for (let [index, child] of childrenList.entries()) {\n const isEmpty =\n child === null ||\n child === undefined ||\n (Array.isArray(child) && child.length === 0)\n\n // forward space\n if (!isEmpty && React.isValidElement(child) && child.type?.['shouldForwardSpace']) {\n child = React.cloneElement(child, {\n space,\n spaceFlex,\n separator,\n key: child.key,\n } as any)\n }\n\n // push them all, but wrap some in Fragment\n if (isEmpty || !child || (child['key'] && !isZStack)) {\n final.push(child)\n } else {\n final.push(\n <Fragment key={index}>\n {isZStack ? <AbsoluteFill>{child}</AbsoluteFill> : child}\n </Fragment>\n )\n }\n\n // first child unspaced avoid insert space\n if (isUnspaced(child) && index === 0) continue\n // no spacing on ZStack\n if (isZStack) continue\n\n const next = childrenList[index + 1]\n\n if (next && !isUnspaced(next)) {\n if (separator) {\n if (hasSpace) {\n final.push(\n createSpacer({\n key: `_${index}_00tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n final.push(\n React.isValidElement(separator)\n ? React.cloneElement(separator, { key: `sep_${index}` })\n : separator\n )\n if (hasSpace) {\n final.push(\n createSpacer({\n key: `_${index}01tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n } else {\n final.push(\n createSpacer({\n key: `_${index}02tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n }\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (props.debug) {\n console.log(` Spaced children`, final, props)\n }\n }\n\n return final\n}\n\ntype CreateSpacerProps = SpacedChildrenProps & { key: string }\n\nfunction createSpacer({ key, direction, space, spaceFlex }: CreateSpacerProps) {\n return (\n <Spacer\n key={key}\n size={space}\n direction={direction}\n {...(typeof spaceFlex !== 'undefined' && {\n flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex,\n })}\n />\n )\n}\n\nfunction isUnspaced(child: React.ReactNode) {\n const t = child?.['type']\n return t?.['isVisuallyHidden'] || t?.['isUnspaced']\n}\n\nconst DefaultProps = new Map()\n\nfunction mergeConfigDefaultProps(\n name: string,\n props: Record<string, any>,\n configDefaults: Record<string, Object>,\n parentNames: (string | undefined)[],\n conf: TamaguiInternalConfig\n) {\n const len = parentNames.length\n let prev\n\n for (let i = 0; i < len; i++) {\n const n = parentNames[i]\n if (!n) continue\n if (DefaultProps.has(n)) {\n prev = DefaultProps.get(n)\n continue\n }\n const props = configDefaults[n]\n if (!props) {\n if (prev) {\n DefaultProps.set(n, prev)\n }\n continue\n }\n prev = mergeProps(prev || {}, props, false, conf.inverseShorthands)[0]\n DefaultProps.set(n, prev)\n }\n\n // overwrite the user defined defaults on top of internal defined defaults\n const ourDefaultsMerged = DefaultProps.get(name)\n if (ourDefaultsMerged) {\n return mergeProps(props, ourDefaultsMerged, false, conf.inverseShorthands)[0]\n }\n return props\n}\n\nconst AbsoluteFill: any = createComponent({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n pointerEvents: 'box-none',\n },\n})\n\nfunction hasAnimatedStyleValue(style: Object) {\n return Object.keys(style).some((k) => {\n const val = style[k]\n return val && typeof val === 'object' && '_animation' in val\n })\n}\n"],
|
|
5
|
-
"mappings": "AA4tBU;AA5tBV,SAAS,uBAAuB;AAChC,SAAS,UAAU,OAAO,UAAU,aAAa;AACjD,SAAS,gBAAgB,iBAAiB,mBAAmB;AAC7D,OAAO;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AACpC,SAAS,2BAA2B;AACpC,SAAS,qBAAqB,8BAA8B;AAC5D,SAAS,oBAAoB,yBAAyB;AACtD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB,gBAAgB;AAC/C,SAAS,cAAc,sBAAsB;AAC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,IAAI;AAAA,MAC1B;AACA;AAAA,IACF;AACA,WAAO,WAAW,QAAQ,CAAC,GAAGA,QAAO,OAAO,KAAK,iBAAiB,EAAE,CAAC;AACrE,iBAAa,IAAI,GAAG,IAAI;AAAA,EAC1B;AAGA,QAAM,oBAAoB,aAAa,IAAI,IAAI;AAC/C,MAAI,mBAAmB;AACrB,WAAO,WAAW,OAAO,mBAAmB,OAAO,KAAK,iBAAiB,EAAE,CAAC;AAAA,EAC9E;AACA,SAAO;AACT;AAEA,MAAM,eAAoB,gBAAgB;AAAA,EACxC,cAAc;AAAA,IACZ,GAAG;AAAA,IACH,eAAe;AAAA,IACf,UAAU;AAAA,IACV,KAAK;AAAA,IACL,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,eAAe;AAAA,EACjB;AACF,CAAC;AAED,SAAS,sBAAsB,OAAe;AAC5C,SAAO,OAAO,KAAK,KAAK,EAAE,KAAK,CAAC,MAAM;AACpC,UAAM,MAAM,MAAM,CAAC;AACnB,WAAO,OAAO,OAAO,QAAQ,YAAY,gBAAgB;AAAA,EAC3D,CAAC;AACH;",
|
|
4
|
+
"sourcesContent": ["import { useComposedRefs } from '@tamagui/compose-refs'\nimport { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'\nimport { stylePropsView, validPseudoKeys, validStyles } from '@tamagui/helpers'\nimport React, {\n Children,\n Fragment,\n createElement,\n forwardRef,\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n} from 'react'\n\nimport { onConfiguredOnce } from './config.js'\nimport { stackDefaultStyles } from './constants/constants.js'\nimport { FontLanguageContext } from './contexts/FontLanguageContext.js'\nimport { TextAncestorContext } from './contexts/TextAncestorContext.js'\nimport { didGetVariableValue, setDidGetVariableValue } from './createVariable.js'\nimport { extendStaticConfig, parseStaticConfig } from './helpers/extendStaticConfig.js'\nimport { useSplitStyles } from './helpers/getSplitStyles.js'\nimport { mergeProps } from './helpers/mergeProps.js'\nimport { proxyThemeVariables } from './helpers/proxyThemeVariables.js'\nimport { useShallowSetState } from './helpers/useShallowSetState.js'\nimport { useAnimationDriver } from './hooks/useAnimationDriver.js'\nimport { setMediaShouldUpdate, useMedia } from './hooks/useMedia.js'\nimport { useServerRef, useServerState } from './hooks/useServerHooks.js'\nimport { useThemeWithState } from './hooks/useTheme.js'\nimport { hooks } from './setupHooks.js'\nimport {\n DebugProp,\n SpaceDirection,\n SpaceTokens,\n SpacerProps,\n StaticConfig,\n StaticConfigParsed,\n StylableComponent,\n TamaguiComponent,\n TamaguiComponentEvents,\n TamaguiComponentState,\n TamaguiConfig,\n TamaguiElement,\n TamaguiInternalConfig,\n UseAnimationHook,\n UseAnimationProps,\n} from './types'\nimport { Slot } from './views/Slot.js'\nimport { Stack } from './views/Stack.js'\nimport { Text } from './views/Text.js'\nimport { useThemedChildren } from './views/Theme.js'\n\n// let t\n// import { timer } from '@tamagui/timer'\n// if (true || process.env.ANALYZE) {\n// t = require().timer()\n// setTimeout(() => {\n// const out = t.print()\n// if (isClient) {\n// alert(out)\n// }\n// }, 2000)\n// }\n\n// this appears to fix expo / babel not picking this up sometimes? really odd\nprocess.env.TAMAGUI_TARGET\n\nexport const defaultComponentState: TamaguiComponentState = {\n hover: false,\n press: false,\n pressIn: false,\n focus: false,\n unmounted: true,\n}\n\nconst defaultComponentStateMounted: TamaguiComponentState = {\n ...defaultComponentState,\n unmounted: false,\n}\n\n/**\n * All things that need one-time setup after createTamagui is called\n */\nlet tamaguiConfig: TamaguiInternalConfig\nlet AnimatedText: any\nlet AnimatedView: any\nlet initialTheme: any\n\nexport const mouseUps = new Set<Function>()\nif (typeof document !== 'undefined') {\n const cancelTouches = () => {\n mouseUps.forEach((x) => x())\n mouseUps.clear()\n }\n addEventListener('mouseup', cancelTouches)\n addEventListener('touchend', cancelTouches)\n addEventListener('touchcancel', cancelTouches)\n}\n\n// mutates\nfunction mergeShorthands(\n { defaultProps }: StaticConfigParsed,\n { shorthands }: TamaguiConfig\n) {\n // they are defined in correct order already { ...parent, ...child }\n for (const key of Object.keys(defaultProps)) {\n defaultProps[shorthands[key] || key] = defaultProps[key]\n }\n}\n\n/**\n * Only on native do we need the actual underlying View/Text\n * On the web we avoid react-native dep altogether.\n */\nlet BaseText: any\nlet BaseView: any\nlet hasSetupBaseViews = false\n\nexport function createComponent<\n ComponentPropTypes extends Object = {},\n Ref = TamaguiElement,\n BaseProps = never\n>(\n configIn: Partial<StaticConfig> | StaticConfigParsed,\n ParentComponent?: StylableComponent\n) {\n const staticConfig = (() => {\n const next = extendStaticConfig(configIn, ParentComponent)\n if ('parsed' in next) {\n return next\n } else {\n return parseStaticConfig(next)\n }\n })()\n\n const defaultComponentClassName = `is_${staticConfig.componentName}`\n let tamaguiDefaultProps: any\n let defaultTag: string | undefined\n\n // see onConfiguredOnce below which attaches a name then to this component\n const component = forwardRef<Ref, ComponentPropTypes>((propsIn: any, forwardedRef) => {\n if (process.env.TAMAGUI_TARGET === 'native') {\n // todo this could be moved to a cleaner location\n if (!hasSetupBaseViews) {\n hasSetupBaseViews = true\n const baseViews = hooks.getBaseViews?.()\n if (baseViews) {\n BaseText = baseViews.Text\n BaseView = baseViews.View\n }\n }\n }\n\n // test only\n if (process.env.NODE_ENV === 'test') {\n if (propsIn['data-test-renders']) {\n propsIn['data-test-renders']['current'] ??= 0\n propsIn['data-test-renders']['current'] += 1\n }\n }\n // const time = t.start({ quiet: true })\n\n // React inserts default props after your props for some reason...\n // order important so we do loops, you can't just spread because JS does weird things\n let props: any\n if (tamaguiDefaultProps && !propsIn.asChild) {\n props = mergeProps(tamaguiDefaultProps, propsIn)[0]\n } else {\n props = propsIn\n }\n\n const debugProp = props['debug'] as DebugProp\n const { Component, isText, isZStack } = staticConfig\n const componentName = props.componentName || staticConfig.componentName\n\n // conditional but if ever true stays true\n // [animated, inversed]\n const stateRef = useRef(\n undefined as any as {\n hasAnimated?: boolean\n themeShallow?: boolean\n didAccessThemeVariableValue?: boolean\n }\n )\n stateRef.current ??= {}\n\n /**\n * Component state for tracking animations, pseudos\n */\n const animationsConfig = useAnimationDriver()\n const useAnimations = animationsConfig?.useAnimations as UseAnimationHook | undefined\n const isAnimated = (() => {\n const next = !!(\n !staticConfig.isHOC &&\n useAnimations &&\n (props.animation || (props.style && hasAnimatedStyleValue(props.style)))\n )\n if (next && !stateRef.current.hasAnimated) {\n stateRef.current.hasAnimated = true\n }\n return next || stateRef.current.hasAnimated\n })()\n const componentClassName = props.asChild\n ? ''\n : props.componentName\n ? `is_${props.componentName}`\n : defaultComponentClassName\n const hasTextAncestor = !!(isWeb && isText ? useContext(TextAncestorContext) : false)\n const languageContext = isRSC ? null : useContext(FontLanguageContext)\n const isDisabled = props.disabled ?? props.accessibilityState?.disabled\n\n const isTaggable = !Component || typeof Component === 'string'\n // default to tag, fallback to component (when both strings)\n const element = isWeb\n ? isTaggable\n ? props.tag || defaultTag || Component\n : Component\n : Component\n\n const BaseTextComponent = BaseText || element || 'span'\n const BaseViewComponent = BaseView || element || (hasTextAncestor ? 'span' : 'div')\n\n AnimatedText = animationsConfig ? animationsConfig.Text : BaseTextComponent\n AnimatedView = animationsConfig ? animationsConfig.View : BaseViewComponent\n\n let elementType = isText\n ? (isAnimated ? AnimatedText : null) || BaseTextComponent\n : (isAnimated ? AnimatedView : null) || BaseViewComponent\n\n const avoidClassesWhileAnimating = animationsConfig?.isReactNative\n const hasEnterStyle = !!props.enterStyle\n const needsMount = Boolean(\n (isWeb ? isClient : true) && (hasEnterStyle || props.animation)\n )\n const states = useServerState<TamaguiComponentState>(\n needsMount ? defaultComponentState! : defaultComponentStateMounted!\n )\n\n const state = propsIn.forceStyle\n ? { ...states[0], [propsIn.forceStyle]: true }\n : states[0]\n const setState = states[1]\n const setStateShallow = useShallowSetState(setState, debugProp, componentName)\n\n const usePresence = animationsConfig?.usePresence\n const presence = !isRSC && isAnimated && usePresence ? usePresence() : null\n\n // set enter/exit variants onto our new props object\n if (isAnimated && presence) {\n const presenceState = presence[2]\n if (presenceState) {\n if (state.unmounted && presenceState.enterVariant) {\n props[presenceState.enterVariant] = true\n }\n if (!presenceState.isPresent && presenceState.exitVariant) {\n props[presenceState.exitVariant] = true\n }\n }\n }\n\n const isAnimatedReactNative = isAnimated && animationsConfig?.isReactNative\n const isReactNative = Boolean(staticConfig.isReactNative || isAnimatedReactNative)\n\n if (process.env.NODE_ENV === 'development') {\n const id = useId()\n\n if (debugProp) {\n // prettier-ignore\n const name = `${componentName || Component?.displayName || Component?.name || '[Unnamed Component]'}`\n const type = isAnimatedReactNative ? '(animated)' : isReactNative ? '(rnw)' : ''\n const dataIs = propsIn['data-is'] || ''\n const banner = `${name}${dataIs ? ` ${dataIs}` : ''} ${type} id ${id}`\n console.group(`%c ${banner}`, 'background: yellow;')\n if (!isServer) {\n console.log('state', state)\n }\n }\n }\n\n const shouldAvoidClasses =\n !isWeb ||\n !!(props.animation && avoidClassesWhileAnimating) ||\n !staticConfig.acceptsClassName\n const shouldForcePseudo = !!propsIn.forceStyle\n const noClassNames = shouldAvoidClasses || shouldForcePseudo\n\n const themeState = useThemeWithState({\n name: props.theme,\n componentName,\n reset: props.reset,\n inverse: props.themeInverse,\n // @ts-expect-error\n disable: props['data-themeable'],\n debug: props.debug,\n shouldUpdate: () => !!stateRef.current.didAccessThemeVariableValue,\n })!\n\n elementType = Component || elementType\n const isStringElement = typeof elementType === 'string'\n\n const isExiting = presence?.[0] === false\n\n const mediaState = useMedia(\n // @ts-ignore, we just pass a stable object so we can get it later with\n // should match to the one used in `setMediaShouldUpdate` below\n stateRef,\n debugProp ? { props, staticConfig } : null\n )\n\n setDidGetVariableValue(false)\n\n const splitStyles = useSplitStyles(\n props,\n staticConfig,\n themeState.theme,\n {\n ...state,\n mediaState,\n noClassNames,\n dynamicStylesInline: noClassNames,\n hasTextAncestor,\n resolveVariablesAs: 'auto',\n isExiting,\n },\n null,\n languageContext || undefined,\n elementType,\n debugProp\n )\n\n // only listen for changes if we are using raw theme values or media space, or dynamic media (native)\n // array = space media breakpoints\n const isMediaSpaced = Array.isArray(splitStyles.hasMedia)\n const shouldListenForMedia =\n didGetVariableValue() ||\n isMediaSpaced ||\n (noClassNames && splitStyles.hasMedia === true)\n\n setMediaShouldUpdate(stateRef, {\n enabled: shouldListenForMedia,\n keys: noClassNames && isMediaSpaced ? (splitStyles.hasMedia as any) : null,\n })\n\n const hostRef = useServerRef<TamaguiElement>(null)\n\n // animation setup\n const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating\n\n if (process.env.NODE_ENV === 'development') {\n if (!process.env.TAMAGUI_TARGET) {\n console.error(\n `No process.env.TAMAGUI_TARGET set, please set it to \"native\" or \"web\".`\n )\n }\n\n if (debugProp) {\n console.groupCollapsed('props')\n // prettier-ignore\n console.log('props in', propsIn, 'mapped to', props, 'in order', Object.keys(props))\n console.log('splitStyles', splitStyles)\n // eslint-disable-next-line no-console\n console.log('shouldListenForMedia', shouldListenForMedia)\n // eslint-disable-next-line no-console\n console.log('className', Object.values(splitStyles.classNames))\n if (isClient) {\n console.log('ref', hostRef, '(click to view)')\n }\n console.groupEnd()\n if (debugProp === 'break') {\n // rome-ignore lint/suspicious/noDebugger: ok\n debugger\n }\n }\n }\n\n const {\n viewProps: viewPropsIn,\n pseudos,\n style: splitStylesStyle,\n classNames,\n space,\n } = splitStyles\n\n const propsWithAnimation = props as UseAnimationProps\n\n // once you set animation prop don't remove it, you can set to undefined/false\n // reason is animations are heavy - no way around it, and must be run inline here (\uD83D\uDE45 loading as a sub-component)\n let animationStyles: any\n if (!isRSC && isAnimated && useAnimations && !staticConfig.isHOC) {\n const animations = useAnimations({\n props: propsWithAnimation,\n style: splitStylesStyle,\n presence,\n state,\n pseudos: pseudos || null,\n onDidAnimate: props.onDidAnimate,\n hostRef,\n staticConfig,\n })\n if (animations) {\n animationStyles = animations.style\n }\n }\n\n const {\n asChild,\n children,\n onPress,\n onPressIn,\n onPressOut,\n onHoverIn,\n onHoverOut,\n themeShallow,\n spaceDirection: _spaceDirection,\n disabled: disabledProp,\n onMouseUp,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n separator,\n // ignore from here on out\n forceStyle: _forceStyle,\n // @ts-ignore for next/link compat etc\n onClick,\n theme: _themeProp,\n // @ts-ignore\n defaultVariants,\n\n ...nonTamaguiProps\n } = viewPropsIn\n\n const disabled = props.accessibilityState?.disabled || props.accessibilityDisabled\n\n // these can ultimately be for DOM, react-native-web views, or animated views\n // so the type is pretty loose\n let viewProps = nonTamaguiProps\n\n // if react-native-web view just pass all props down\n if (process.env.TAMAGUI_TARGET === 'web' && !isReactNative && !asChild) {\n viewProps = hooks.usePropsTransform?.(elementType, nonTamaguiProps, hostRef)\n } else {\n viewProps = nonTamaguiProps\n }\n\n viewProps.ref = useComposedRefs(hostRef as any, forwardedRef)\n\n if (process.env.NODE_ENV === 'development') {\n if (!isText && isWeb && !staticConfig.isHOC) {\n Children.toArray(props.children).forEach((item) => {\n // allow newlines because why not its annoying with mdx\n if (typeof item === 'string' && item !== '\\n') {\n console.error(\n `Unexpected text node: ${item}. A text node cannot be a child of a <View>.`\n )\n }\n })\n }\n }\n\n const unPress = useCallback(() => {\n setStateShallow({\n press: false,\n pressIn: false,\n })\n }, [setStateShallow])\n\n if (isWeb) {\n useEffect(() => {\n return () => {\n mouseUps.delete(unPress)\n }\n }, [])\n }\n\n const shouldSetMounted = needsMount && state.unmounted\n useEffect(() => {\n if (!shouldSetMounted) return\n if (state.unmounted === true && needsMount) {\n setStateShallow({\n unmounted: false,\n })\n return\n }\n\n setStateShallow({\n unmounted: false,\n })\n }, [shouldSetMounted, state.unmounted])\n\n let styles: Record<string, any>[]\n\n if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {\n styles = {\n ...(animationStyles ?? splitStylesStyle),\n }\n } else {\n styles = [animationStyles ?? splitStylesStyle]\n\n // ugly but for now...\n if (shouldForcePseudo) {\n const next = {}\n styles.forEach((style) => Object.assign(next, style))\n // @ts-ignore\n Object.assign(splitStyles.style, next)\n }\n }\n\n let fontFamily = isText\n ? splitStyles.fontFamily || staticConfig.defaultProps.fontFamily\n : null\n if (fontFamily && fontFamily[0] === '$') {\n fontFamily = fontFamily.slice(1)\n }\n const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : ''\n\n const classList = [\n hasEnterStyle && ((state.unmounted && needsMount) || !isClient)\n ? 't_will-mount'\n : '',\n componentName ? componentClassName : '',\n fontFamilyClassName,\n classNames ? Object.values(classNames).join(' ') : '',\n ]\n\n const className = classList.join(' ')\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n const style = animationStyles ?? splitStyles.style\n\n if (isAnimatedReactNativeWeb) {\n viewProps.style = style\n } else if (isReactNative) {\n // TODO these shouldn't really return from getSplitStyles when in Native mode\n const cnStyles = { $$css: true }\n for (const name of className.split(' ')) {\n cnStyles[name] = name\n }\n viewProps.style = [...(Array.isArray(style) ? style : [style]), cnStyles]\n\n if (process.env.NODE_ENV === 'development') {\n // turn debug data- props into dataSet in dev mode\n Object.keys(viewProps).forEach((key) => {\n if (key.startsWith('data-')) {\n viewProps.dataSet ??= {}\n viewProps.dataSet[key.replace('data-', '')] = viewProps[key]\n delete viewProps[key]\n }\n })\n }\n } else {\n viewProps.className = className\n viewProps.style = style\n }\n }\n\n // TODO MOVE INTO HOOK\n if (process.env.TAMAGUI_TARGET === 'native') {\n // swap out the right family based on weight/style\n if (splitStyles.fontFamily) {\n const faceInfo = tamaguiConfig.fontsParsed[splitStyles.fontFamily]?.face\n if (faceInfo) {\n const [weight, style] = (() => {\n let weight: string | undefined\n let style: string | undefined\n for (let i = styles.length; i >= 0; i--) {\n weight ??= styles[i]?.fontWeight\n style ??= styles[i]?.fontStyle\n }\n return [weight || '400', style || 'normal'] as const\n })()\n const overrideFace = faceInfo[weight]?.[style]?.val\n if (overrideFace) {\n for (const style of styles) {\n if (style?.fontFamily) {\n style.fontFamily = overrideFace\n style.fontWeight = undefined\n style.fontStyle = undefined\n }\n }\n }\n }\n }\n\n // assign styles\n viewProps.style = styles\n }\n\n const runtimePressStyle = !disabled && noClassNames && pseudos?.pressStyle\n const attachPress = Boolean(\n runtimePressStyle || onPress || onPressOut || onPressIn || onClick\n )\n const runtimeHoverStyle = !disabled && noClassNames && pseudos?.hoverStyle\n const isHoverable =\n isWeb &&\n !!(runtimeHoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave)\n\n const handlesPressEvents = !(isWeb || asChild)\n\n // check presence rather than value to prevent reparenting bugs\n // allows for onPress={x ? function : undefined} without re-ordering dom\n const shouldAttach = Boolean(\n attachPress ||\n isHoverable ||\n (noClassNames && 'pressStyle' in props) ||\n (isWeb && noClassNames && 'hoverStyle' in props)\n )\n\n const events: TamaguiComponentEvents | null =\n shouldAttach && !isRSC && !isDisabled && !asChild\n ? {\n onPressOut: attachPress\n ? (e) => {\n unPress()\n onPressOut?.(e)\n onMouseUp?.(e)\n }\n : undefined,\n ...(isHoverable && {\n onMouseEnter: isHoverable\n ? (e) => {\n const next: Partial<typeof state> = {}\n if (isHoverable) {\n next.hover = true\n }\n if (state.pressIn) {\n next.press = true\n }\n if (isHoverable || state.pressIn) {\n setStateShallow(next)\n }\n onHoverIn?.(e)\n onMouseEnter?.(e)\n }\n : undefined,\n onMouseLeave: isHoverable\n ? (e) => {\n const next: Partial<typeof state> = {}\n mouseUps.add(unPress)\n if (isHoverable) {\n next.hover = false\n }\n if (state.pressIn) {\n next.press = false\n next.pressIn = false\n }\n if (Object.keys(next).length) {\n setStateShallow(next)\n }\n onHoverOut?.(e)\n onMouseLeave?.(e)\n }\n : undefined,\n }),\n onPressIn: attachPress\n ? (e) => {\n setStateShallow({\n press: true,\n pressIn: true,\n hover: false,\n })\n onPressIn?.(e)\n onMouseDown?.(e)\n if (isWeb) {\n mouseUps.add(unPress)\n }\n }\n : undefined,\n onPress: attachPress\n ? (e) => {\n unPress()\n // @ts-ignore\n isWeb && onClick?.(e)\n onPress?.(e)\n }\n : undefined,\n }\n : null\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n if (events) {\n // replicating TouchableWithoutFeedback\n Object.assign(events, {\n cancelable: !props.rejectResponderTermination,\n disabled: isDisabled,\n hitSlop: props.hitSlop,\n delayLongPress: props.delayLongPress,\n delayPressIn: props.delayPressIn,\n delayPressOut: props.delayPressOut,\n focusable: viewProps.focusable ?? true,\n minPressDuration: 0,\n })\n }\n }\n\n // EVENTS native\n hooks.useEvents?.(viewProps, events, splitStyles, setStateShallow)\n\n const shouldReset = !!(themeShallow && themeState.isNewTheme)\n if (shouldReset) {\n stateRef.current.themeShallow = true\n }\n\n let content =\n !children || asChild\n ? children\n : spacedChildren({\n separator,\n children,\n space,\n direction: props.spaceDirection || 'both',\n isZStack,\n debug: debugProp,\n })\n\n if (asChild) {\n elementType = Slot\n viewProps = {\n ...viewProps,\n onPress,\n onPressIn,\n onPressOut,\n }\n }\n\n content = createElement(elementType, viewProps, content)\n\n content = useThemedChildren(themeState, content, {\n shallow: stateRef.current.themeShallow,\n // passPropsToChildren: true,\n })\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (events || isAnimatedReactNativeWeb) {\n content = (\n <span\n className={`${isAnimatedReactNativeWeb ? className : ''} _dsp_contents`}\n {...(events && {\n onMouseEnter: events.onMouseEnter,\n onMouseLeave: events.onMouseLeave,\n onClick: events.onPress,\n onMouseDown: events.onPressIn,\n onMouseUp: events.onPressOut,\n onTouchStart: events.onPressIn,\n onTouchEnd: events.onPressOut,\n })}\n >\n {content}\n </span>\n )\n }\n }\n\n if (process.env.NODE_ENV === 'development' && process.env.DEBUG !== 'tamagui') {\n if (debugProp) {\n const element = typeof elementType === 'string' ? elementType : 'Component'\n console.groupCollapsed(`render <${element} /> with props`, viewProps)\n for (const key in viewProps) {\n console.log(key, viewProps[key])\n }\n console.log('children', content)\n console.groupEnd()\n if (typeof window !== 'undefined') {\n // prettier-ignore\n console.log({ state, themeState, isAnimated, isAnimatedReactNativeWeb, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: props.className?.split(' '), classNamesOut: viewProps.className?.split(' '), events, shouldAttach, styles, pseudos, content, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, staticConfig, tamaguiConfig, shouldForcePseudo })\n }\n console.groupEnd()\n }\n }\n\n return content\n })\n\n if (staticConfig.componentName) {\n component.displayName = staticConfig.componentName\n }\n\n onConfiguredOnce((conf) => {\n // one time only setup\n if (!tamaguiConfig) {\n tamaguiConfig = conf\n\n if (!initialTheme) {\n const next = conf.themes[Object.keys(conf.themes)[0]]\n initialTheme = proxyThemeVariables(next)\n if (process.env.NODE_ENV === 'development') {\n if (!initialTheme) {\n console.log('Warning: Missing theme')\n }\n }\n }\n }\n\n // per-component setup\n // do this to make sure shorthands don't duplicate with.. longhands\n mergeShorthands(staticConfig, tamaguiConfig)\n\n let defaultPropsIn = staticConfig.defaultProps || {}\n\n // because we run createTamagui after styled() defs, have to do some work here\n // gather defaults props one time and merge downwards\n // find last unprocessed and process\n const parentNames = [...(staticConfig.parentNames || []), staticConfig.componentName]\n\n if (tamaguiConfig.defaultProps && parentNames && staticConfig.componentName) {\n defaultPropsIn = mergeConfigDefaultProps(\n staticConfig.componentName,\n defaultPropsIn,\n tamaguiConfig.defaultProps,\n parentNames,\n tamaguiConfig\n )\n }\n\n const debug = defaultPropsIn['debug']\n\n // remove all classNames\n const [ourProps, ourClassNames] = mergeProps(defaultPropsIn, {})\n\n if (ourProps.tag) {\n defaultTag = ourProps.tag\n }\n\n const noClassNames = !staticConfig.acceptsClassName\n const { name, variants, defaultVariants, ...restProps } = ourProps\n\n // must preserve prop order\n // leave out className because we handle that already with initialSplitStyles.classNames\n // otherwise it confuses variant functions getting className props\n const [defaults, defaultsClassnames] = mergeProps(component.defaultProps as any, {\n ...defaultVariants,\n ...restProps,\n })\n\n // split - keep variables on props to be processed using theme values at runtime (native)\n if (!isWeb) {\n for (const key in staticConfig.defaultProps) {\n const val = staticConfig.defaultProps[key]\n if (validPseudoKeys[key]) continue\n defaults[key] = val\n }\n }\n\n // set to global\n tamaguiDefaultProps = defaults\n\n // add debug logs\n if (process.env.NODE_ENV === 'development' && debug) {\n if (process.env.IS_STATIC !== 'is_static') {\n console.log(`\uD83D\uDC1B [${staticConfig.componentName || 'Component'}]`, {\n staticConfig,\n tamaguiDefaultProps,\n defaults,\n defaultPropsIn,\n defaultPropsKeyOrder: Object.keys(staticConfig.defaultProps),\n defaultPropsInKeyOrder: Object.keys(defaultPropsIn).map((k) => [\n k,\n defaultPropsIn[k],\n ]),\n ourProps,\n ourClassNames,\n defaultsClassnames,\n defaultTag,\n noClassNames,\n })\n }\n }\n })\n\n let res: TamaguiComponent<ComponentPropTypes, Ref, BaseProps> = component as any\n\n if (configIn.memo) {\n res = memo(res) as any\n }\n\n res.staticConfig = {\n validStyles: staticConfig.validStyles || stylePropsView,\n ...staticConfig,\n }\n\n // res.extractable HoC\n res.extractable = (Component: any, conf?: Partial<StaticConfig>) => {\n Component.staticConfig = extendStaticConfig(\n {\n Component,\n ...conf,\n neverFlatten: true,\n isHOC: true,\n defaultProps: {\n ...Component.defaultProps,\n ...conf?.defaultProps,\n },\n },\n res\n )\n return Component\n }\n\n return res\n}\n\n// for elements to avoid spacing\nexport const Unspaced = (props: { children?: any }) => props.children\nUnspaced['isUnspaced'] = true\n\n// dont used styled() here to avoid circular deps\n// keep inline to avoid circular deps\n\nexport const Spacer = createComponent<SpacerProps>({\n acceptsClassName: true,\n memo: true,\n componentName: 'Spacer',\n validStyles,\n\n defaultProps: {\n ...stackDefaultStyles,\n // avoid nesting issues\n tag: 'span',\n size: true,\n pointerEvents: 'none',\n },\n\n variants: {\n size: {\n '...size': (size, { tokens }) => {\n size = size === true ? '$true' : size\n const sizePx = tokens.space[size] ?? size\n return {\n width: sizePx,\n height: sizePx,\n minWidth: sizePx,\n minHeight: sizePx,\n }\n },\n },\n\n flex: {\n true: {\n flexGrow: 1,\n },\n },\n\n direction: {\n horizontal: {\n height: 0,\n minHeight: 0,\n },\n vertical: {\n width: 0,\n minWidth: 0,\n },\n both: {},\n },\n } as const,\n})\n\nexport type SpacedChildrenProps = {\n isZStack?: boolean\n children?: React.ReactNode\n space?: SpaceTokens | number | null\n spaceFlex?: boolean | number\n direction?: SpaceDirection\n separator?: React.ReactNode\n debug?: DebugProp\n}\n\nexport function spacedChildren(props: SpacedChildrenProps) {\n const { isZStack, children, space, direction, spaceFlex, separator } = props\n const hasSpace = !!(space || spaceFlex)\n const hasSeparator = !(separator === undefined || separator === null)\n if (!(hasSpace || hasSeparator || isZStack)) {\n return children\n }\n\n const childrenList = Children.toArray(children)\n\n const len = childrenList.length\n if (len <= 1 && !isZStack && !childrenList[0]?.['type']?.['shouldForwardSpace']) {\n return childrenList\n }\n\n const final: React.ReactNode[] = []\n for (let [index, child] of childrenList.entries()) {\n const isEmpty =\n child === null ||\n child === undefined ||\n (Array.isArray(child) && child.length === 0)\n\n // forward space\n if (!isEmpty && React.isValidElement(child) && child.type?.['shouldForwardSpace']) {\n child = React.cloneElement(child, {\n space,\n spaceFlex,\n separator,\n key: child.key,\n } as any)\n }\n\n // push them all, but wrap some in Fragment\n if (isEmpty || !child || (child['key'] && !isZStack)) {\n final.push(child)\n } else {\n final.push(\n <Fragment key={index}>\n {isZStack ? <AbsoluteFill>{child}</AbsoluteFill> : child}\n </Fragment>\n )\n }\n\n // first child unspaced avoid insert space\n if (isUnspaced(child) && index === 0) continue\n // no spacing on ZStack\n if (isZStack) continue\n\n const next = childrenList[index + 1]\n\n if (next && !isUnspaced(next)) {\n if (separator) {\n if (hasSpace) {\n final.push(\n createSpacer({\n key: `_${index}_00tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n final.push(\n React.isValidElement(separator)\n ? React.cloneElement(separator, { key: `sep_${index}` })\n : separator\n )\n if (hasSpace) {\n final.push(\n createSpacer({\n key: `_${index}01tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n } else {\n final.push(\n createSpacer({\n key: `_${index}02tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n }\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (props.debug) {\n console.log(` Spaced children`, final, props)\n }\n }\n\n return final\n}\n\ntype CreateSpacerProps = SpacedChildrenProps & { key: string }\n\nfunction createSpacer({ key, direction, space, spaceFlex }: CreateSpacerProps) {\n return (\n <Spacer\n key={key}\n size={space}\n direction={direction}\n {...(typeof spaceFlex !== 'undefined' && {\n flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex,\n })}\n />\n )\n}\n\nfunction isUnspaced(child: React.ReactNode) {\n const t = child?.['type']\n return t?.['isVisuallyHidden'] || t?.['isUnspaced']\n}\n\nconst DefaultProps = new Map()\n\nfunction mergeConfigDefaultProps(\n name: string,\n props: Record<string, any>,\n configDefaults: Record<string, Object>,\n parentNames: (string | undefined)[],\n conf: TamaguiInternalConfig\n) {\n const len = parentNames.length\n let prev\n\n for (let i = 0; i < len; i++) {\n const n = parentNames[i]\n if (!n) continue\n if (DefaultProps.has(n)) {\n prev = DefaultProps.get(n)\n continue\n }\n const props = configDefaults[n]\n if (!props) {\n if (prev) {\n DefaultProps.set(n, prev)\n }\n continue\n }\n prev = mergeProps(prev || {}, props, false, conf.inverseShorthands)[0]\n DefaultProps.set(n, prev)\n }\n\n // overwrite the user defined defaults on top of internal defined defaults\n const ourDefaultsMerged = DefaultProps.get(name)\n if (ourDefaultsMerged) {\n return mergeProps(props, ourDefaultsMerged, false, conf.inverseShorthands)[0]\n }\n return props\n}\n\nconst AbsoluteFill: any = createComponent({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n pointerEvents: 'box-none',\n },\n})\n\nfunction hasAnimatedStyleValue(style: Object) {\n return Object.keys(style).some((k) => {\n const val = style[k]\n return val && typeof val === 'object' && '_animation' in val\n })\n}\n"],
|
|
5
|
+
"mappings": "AA+tBU;AA/tBV,SAAS,uBAAuB;AAChC,SAAS,UAAU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
|
"names": ["_a", "_b", "weight", "style", "element", "props"]
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ import React, {
|
|
|
11
11
|
useCallback,
|
|
12
12
|
useContext,
|
|
13
13
|
useEffect,
|
|
14
|
+
useId,
|
|
14
15
|
useRef
|
|
15
16
|
} from "react";
|
|
16
17
|
import { onConfiguredOnce } from "./config.js";
|
|
@@ -154,11 +155,12 @@ function createComponent(configIn, ParentComponent) {
|
|
|
154
155
|
const isAnimatedReactNative = isAnimated && (animationsConfig == null ? void 0 : animationsConfig.isReactNative);
|
|
155
156
|
const isReactNative = Boolean(staticConfig.isReactNative || isAnimatedReactNative);
|
|
156
157
|
if (process.env.NODE_ENV === "development") {
|
|
158
|
+
const id = useId();
|
|
157
159
|
if (debugProp) {
|
|
158
160
|
const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
|
|
159
161
|
const type = isAnimatedReactNative ? "(animated)" : isReactNative ? "(rnw)" : "";
|
|
160
162
|
const dataIs = propsIn["data-is"] || "";
|
|
161
|
-
const banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
|
|
163
|
+
const banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type} id ${id}`;
|
|
162
164
|
console.group(`%c ${banner}`, "background: yellow;");
|
|
163
165
|
if (!isServer) {
|
|
164
166
|
console.log("state", state);
|