@tamagui/web 1.13.4 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cjs/createComponent.js +2 -2
  2. package/dist/cjs/createComponent.js.map +3 -3
  3. package/dist/cjs/helpers/ThemeManager.js +1 -1
  4. package/dist/cjs/helpers/ThemeManager.js.map +3 -3
  5. package/dist/cjs/helpers/getSplitStyles.js +2 -2
  6. package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
  7. package/dist/cjs/hooks/useTheme.js +1 -1
  8. package/dist/cjs/hooks/useTheme.js.map +3 -3
  9. package/dist/cjs/types.js.map +1 -1
  10. package/dist/cjs/views/Theme.js +1 -1
  11. package/dist/cjs/views/Theme.js.map +3 -3
  12. package/dist/esm/createComponent.js +2 -2
  13. package/dist/esm/createComponent.js.map +3 -3
  14. package/dist/esm/createComponent.mjs +2 -2
  15. package/dist/esm/createComponent.mjs.map +3 -3
  16. package/dist/esm/helpers/ThemeManager.js +1 -1
  17. package/dist/esm/helpers/ThemeManager.js.map +3 -3
  18. package/dist/esm/helpers/ThemeManager.mjs +1 -1
  19. package/dist/esm/helpers/ThemeManager.mjs.map +3 -3
  20. package/dist/esm/helpers/getSplitStyles.js +2 -2
  21. package/dist/esm/helpers/getSplitStyles.js.map +2 -2
  22. package/dist/esm/helpers/getSplitStyles.mjs +2 -2
  23. package/dist/esm/helpers/getSplitStyles.mjs.map +2 -2
  24. package/dist/esm/hooks/useTheme.js +1 -1
  25. package/dist/esm/hooks/useTheme.js.map +3 -3
  26. package/dist/esm/hooks/useTheme.mjs +1 -1
  27. package/dist/esm/hooks/useTheme.mjs.map +3 -3
  28. package/dist/esm/views/Theme.js +1 -1
  29. package/dist/esm/views/Theme.js.map +3 -3
  30. package/dist/esm/views/Theme.mjs +1 -1
  31. package/dist/esm/views/Theme.mjs.map +3 -3
  32. package/package.json +9 -9
  33. package/src/createComponent.tsx +38 -5
  34. package/src/helpers/ThemeManager.tsx +40 -32
  35. package/src/helpers/getSplitStyles.tsx +0 -8
  36. package/src/hooks/useTheme.tsx +145 -93
  37. package/src/types.tsx +2 -2
  38. package/src/views/Theme.tsx +49 -27
  39. package/types/createComponent.d.ts.map +1 -1
  40. package/types/helpers/ThemeManager.d.ts +1 -0
  41. package/types/helpers/ThemeManager.d.ts.map +1 -1
  42. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  43. package/types/hooks/useTheme.d.ts +5 -7
  44. package/types/hooks/useTheme.d.ts.map +1 -1
  45. package/types/types.d.ts +2 -2
  46. package/types/types.d.ts.map +1 -1
  47. package/types/views/Theme.d.ts.map +1 -1
@@ -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?: 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"],
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' | 'visualize'\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 | any\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": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["types_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var f=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var S=(e,r)=>{for(var o in r)f(e,o,{get:r[o],enumerable:!0})},M=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of x(r))!E.call(e,t)&&t!==o&&f(e,t,{get:()=>r[t],enumerable:!(a=w(r,t))||a.enumerable});return e};var _=e=>M(f({},"__esModule",{value:!0}),e);var A={};S(A,{Theme:()=>y,useThemedChildren:()=>v});module.exports=_(A);var m=require("react/jsx-runtime"),T=require("@tamagui/constants"),n=require("react"),p=require("../createVariable.js"),C=require("../helpers/ThemeManagerContext.js"),b=require("../hooks/useServerHooks.js"),g=require("../hooks/useTheme.js");function y(e){if(e.disable)return e.children;const r=!!e._isRoot,o=(0,g.useChangeThemeEffect)(e,r),a=e["data-themeable"]?n.Children.map(e.children,t=>(0,n.cloneElement)(t,{["data-themeable"]:!0})):e.children;return v(o,a,e,r)}function v(e,r,o,a=!1){const{themeManager:t,isNewTheme:l,className:N,theme:c}=e,{shallow:P,forceClassName:d}=o,u=(0,b.useServerRef)(!1);if(l&&(u.current=!0),l||u.current||d||a){let h=n.Children.toArray(r);P&&t&&(h=h.map(s=>(0,n.isValidElement)(s)?(0,n.cloneElement)(s,void 0,(0,m.jsx)(y,{name:t.state.parentName,children:s.props.children})):s));const i=(0,m.jsx)(C.ThemeManagerContext.Provider,{value:t,children:h});if(d===!1)return i;if(T.isWeb&&!o.passPropsToChildren){const R={color:c&&l?(0,p.variableToString)(c.color):""};return(0,m.jsx)("span",{className:`${N||""} _dsp_contents`,style:R,children:i})}return i}return r}0&&(module.exports={Theme,useThemedChildren});
1
+ "use strict";var p=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var r in t)p(e,r,{get:t[r],enumerable:!0})},_=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of R(t))!x.call(e,n)&&n!==r&&p(e,n,{get:()=>t[n],enumerable:!(o=P(t,n))||o.enumerable});return e};var I=e=>_(p({},"__esModule",{value:!0}),e);var O={};S(O,{Theme:()=>M,useThemedChildren:()=>E});module.exports=I(O);var s=require("react/jsx-runtime"),C=require("@tamagui/constants"),a=require("react"),N=require("../createVariable.js"),b=require("../helpers/ThemeManagerContext.js"),v=require("../hooks/useServerHooks.js"),y=require("../hooks/useTheme.js");function M(e){var n,l,i,m,d;if(e.disable)return e.children;const t=!!e._isRoot,r=(0,y.useChangeThemeEffect)(e,t);let o=e["data-themeable"]?a.Children.map(e.children,c=>(0,a.cloneElement)(c,{["data-themeable"]:!0})):e.children;return process.env.NODE_ENV==="development"&&e.debug==="visualize"&&(o=(0,s.jsxs)("div",{style:{display:"inline",border:"1px solid #ccc"},children:[(0,s.jsx)("code",{children:(0,s.jsxs)("pre",{children:["<Theme />\xA0",JSON.stringify({name:(n=r.themeManager)==null?void 0:n.state.name,parent:(l=r.themeManager)==null?void 0:l.state.parentName,id:(i=r.themeManager)==null?void 0:i.id,parentId:(d=(m=r.themeManager)==null?void 0:m.parentManager)==null?void 0:d.id,isNew:r.isNewTheme})]})}),o]})),E(r,o,e,t)}function E(e,t,r,o=!1){const{themeManager:n,className:l,theme:i,isNewTheme:m}=e,{shallow:d,forceClassName:c}=r,T=(0,v.useServerRef)(!1);m&&(T.current=!0);const g=m||T.current||c||o;return(0,a.useMemo)(()=>{if(!g)return t;let f=a.Children.toArray(t);d&&n&&(f=f.map(h=>(0,a.isValidElement)(h)?(0,a.cloneElement)(h,void 0,(0,s.jsx)(M,{name:n.state.parentName,children:h.props.children})):h));const u=(0,s.jsx)(b.ThemeManagerContext.Provider,{value:n,children:f});if(c===!1)return u;if(C.isWeb&&!r.passPropsToChildren){const w={color:i&&m?(0,N.variableToString)(i.color):""};return(0,s.jsx)("span",{className:`${l||""} _dsp_contents is_Theme`,style:w,children:u})}return u},[g,n,t,i,m,l])}0&&(module.exports={Theme,useThemedChildren});
2
2
  //# sourceMappingURL=Theme.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { Children, cloneElement, isValidElement } from 'react'\n\nimport { variableToString } from '../createVariable.js'\nimport { ThemeManagerContext } from '../helpers/ThemeManagerContext.js'\nimport { useServerRef } from '../hooks/useServerHooks.js'\nimport { ChangedThemeResponse, useChangeThemeEffect } from '../hooks/useTheme.js'\nimport type { ThemeProps } from '../types.js'\n\nexport function Theme(props: ThemeProps) {\n // @ts-expect-error only for internal views\n if (props.disable) return props.children\n const isRoot = !!props['_isRoot']\n const themeState = useChangeThemeEffect(props, isRoot)\n const children = props['data-themeable']\n ? Children.map(props.children, (child) =>\n cloneElement(child, { ['data-themeable']: true })\n )\n : props.children\n\n return useThemedChildren(themeState, children, props, isRoot)\n}\n\nexport function useThemedChildren(\n themeState: ChangedThemeResponse,\n children: any,\n options: {\n forceClassName?: boolean\n shallow?: boolean\n passPropsToChildren?: boolean\n },\n isRoot = false\n) {\n const { themeManager, isNewTheme, className, theme } = themeState\n const { shallow, forceClassName } = options\n const hasEverThemed = useServerRef(false)\n if (isNewTheme) {\n hasEverThemed.current = true\n }\n\n if (isNewTheme || hasEverThemed.current || forceClassName || isRoot) {\n // be sure to memoize shouldReset to avoid reparenting\n let next = Children.toArray(children)\n\n // each children of these children wont get the theme\n if (shallow && themeManager) {\n next = next.map((child) => {\n return isValidElement(child)\n ? cloneElement(\n child,\n undefined,\n <Theme name={themeManager.state.parentName}>\n {(child as any).props.children}\n </Theme>\n )\n : child\n })\n }\n\n // tried this but themes css doesn't fully like it\n // if (shouldAttachClassName && options.passPropsToChildren) {\n // next = next.map((child: any) => {\n // const childStyle = child.props?.style\n // console.log('pass it down', className, child.props.className || '')\n // const newProps = {\n // className: (child.props.className || '') + ' ' + className,\n // style: Array.isArray(childStyle)\n // ? [colorStyle, ...childStyle]\n // : {\n // ...colorStyle,\n // ...childStyle,\n // },\n // }\n // return isValidElement(child) ? cloneElement(child as any, newProps) : child\n // })\n // }\n\n const wrapped = (\n <ThemeManagerContext.Provider value={themeManager}>\n {next}\n </ThemeManagerContext.Provider>\n )\n\n if (forceClassName === false) {\n return wrapped\n }\n\n if (isWeb && !options.passPropsToChildren) {\n // in order to provide currentColor, set color by default\n const themeColor = theme && isNewTheme ? variableToString(theme.color) : ''\n const colorStyle = {\n color: themeColor,\n }\n\n return (\n <span className={`${className || ''} _dsp_contents`} style={colorStyle}>\n {wrapped}\n </span>\n )\n }\n\n return wrapped\n }\n\n return children\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,sBAAAC,IAAA,eAAAC,EAAAJ,GAmDc,IAAAK,EAAA,6BAnDdC,EAAsB,8BACtBC,EAAuD,iBAEvDC,EAAiC,gCACjCC,EAAoC,6CACpCC,EAA6B,sCAC7BC,EAA2D,gCAGpD,SAAST,EAAMU,EAAmB,CAEvC,GAAIA,EAAM,QAAS,OAAOA,EAAM,SAChC,MAAMC,EAAS,CAAC,CAACD,EAAM,QACjBE,KAAa,wBAAqBF,EAAOC,CAAM,EAC/CE,EAAWH,EAAM,gBAAgB,EACnC,WAAS,IAAIA,EAAM,SAAWI,MAC5B,gBAAaA,EAAO,CAAE,CAAC,gBAAgB,EAAG,EAAK,CAAC,CAClD,EACAJ,EAAM,SAEV,OAAOT,EAAkBW,EAAYC,EAAUH,EAAOC,CAAM,CAC9D,CAEO,SAASV,EACdW,EACAC,EACAE,EAKAJ,EAAS,GACT,CACA,KAAM,CAAE,aAAAK,EAAc,WAAAC,EAAY,UAAAC,EAAW,MAAAC,CAAM,EAAIP,EACjD,CAAE,QAAAQ,EAAS,eAAAC,CAAe,EAAIN,EAC9BO,KAAgB,gBAAa,EAAK,EAKxC,GAJIL,IACFK,EAAc,QAAU,IAGtBL,GAAcK,EAAc,SAAWD,GAAkBV,EAAQ,CAEnE,IAAIY,EAAO,WAAS,QAAQV,CAAQ,EAGhCO,GAAWJ,IACbO,EAAOA,EAAK,IAAKT,MACR,kBAAeA,CAAK,KACvB,gBACEA,EACA,UACA,OAACd,EAAA,CAAM,KAAMgB,EAAa,MAAM,WAC5B,SAAAF,EAAc,MAAM,SACxB,CACF,EACAA,CACL,GAqBH,MAAMU,KACJ,OAAC,sBAAoB,SAApB,CAA6B,MAAOR,EAClC,SAAAO,EACH,EAGF,GAAIF,IAAmB,GACrB,OAAOG,EAGT,GAAI,SAAS,CAACT,EAAQ,oBAAqB,CAGzC,MAAMU,EAAa,CACjB,MAFiBN,GAASF,KAAa,oBAAiBE,EAAM,KAAK,EAAI,EAGzE,EAEA,SACE,OAAC,QAAK,UAAW,GAAGD,GAAa,mBAAoB,MAAOO,EACzD,SAAAD,EACH,CAEJ,CAEA,OAAOA,CACT,CAEA,OAAOX,CACT",
6
- "names": ["Theme_exports", "__export", "Theme", "useThemedChildren", "__toCommonJS", "import_jsx_runtime", "import_constants", "import_react", "import_createVariable", "import_ThemeManagerContext", "import_useServerHooks", "import_useTheme", "props", "isRoot", "themeState", "children", "child", "options", "themeManager", "isNewTheme", "className", "theme", "shallow", "forceClassName", "hasEverThemed", "next", "wrapped", "colorStyle"]
4
+ "sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { Children, cloneElement, isValidElement, useEffect, useId, useMemo } from 'react'\n\nimport { variableToString } from '../createVariable.js'\nimport { ThemeManagerContext } from '../helpers/ThemeManagerContext.js'\nimport { useServerRef } from '../hooks/useServerHooks.js'\nimport { ChangedThemeResponse, useChangeThemeEffect } from '../hooks/useTheme.js'\nimport type { ThemeProps } from '../types.js'\n\nexport function Theme(props: ThemeProps) {\n // @ts-expect-error only for internal views\n if (props.disable) {\n return props.children\n }\n\n const isRoot = !!props['_isRoot']\n const themeState = useChangeThemeEffect(props, isRoot)\n\n let children = props['data-themeable']\n ? Children.map(props.children, (child) =>\n cloneElement(child, { ['data-themeable']: true })\n )\n : props.children\n\n if (process.env.NODE_ENV === 'development') {\n if (props['debug'] === 'visualize') {\n children = (\n <div style={{ display: 'inline', border: '1px solid #ccc' }}>\n <code>\n <pre>\n &lt;Theme /&gt;&nbsp;\n {JSON.stringify({\n name: themeState.themeManager?.state.name,\n parent: themeState.themeManager?.state.parentName,\n id: themeState.themeManager?.id,\n parentId: themeState.themeManager?.parentManager?.id,\n isNew: themeState.isNewTheme,\n })}\n </pre>\n </code>\n {children}\n </div>\n )\n }\n }\n\n return useThemedChildren(themeState, children, props, isRoot)\n}\n\nexport function useThemedChildren(\n themeState: ChangedThemeResponse,\n children: any,\n options: {\n forceClassName?: boolean\n shallow?: boolean\n passPropsToChildren?: boolean\n },\n isRoot = false\n) {\n const { themeManager, className, theme, isNewTheme } = themeState\n const { shallow, forceClassName } = options\n const hasEverThemed = useServerRef(false)\n if (isNewTheme) {\n hasEverThemed.current = true\n }\n\n const shouldRenderChildrenWithTheme =\n isNewTheme || hasEverThemed.current || forceClassName || isRoot\n\n return useMemo(() => {\n // console.warn(`re-render Theme`)\n\n if (!shouldRenderChildrenWithTheme) {\n return children\n }\n\n // be sure to memoize shouldReset to avoid reparenting\n let next = Children.toArray(children)\n\n // each children of these children wont get the theme\n if (shallow && themeManager) {\n next = next.map((child) => {\n return isValidElement(child)\n ? cloneElement(\n child,\n undefined,\n <Theme name={themeManager.state.parentName}>\n {(child as any).props.children}\n </Theme>\n )\n : child\n })\n }\n\n const wrapped = (\n <ThemeManagerContext.Provider value={themeManager}>\n {next}\n </ThemeManagerContext.Provider>\n )\n\n if (forceClassName === false) {\n return wrapped\n }\n\n if (isWeb && !options.passPropsToChildren) {\n // in order to provide currentColor, set color by default\n const themeColor = theme && isNewTheme ? variableToString(theme.color) : ''\n const colorStyle = {\n color: themeColor,\n }\n\n return (\n <span className={`${className || ''} _dsp_contents is_Theme`} style={colorStyle}>\n {wrapped}\n </span>\n )\n }\n\n return wrapped\n }, [\n shouldRenderChildrenWithTheme,\n themeManager,\n children,\n theme,\n isNewTheme,\n className,\n ])\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,sBAAAC,IAAA,eAAAC,EAAAJ,GA4BU,IAAAK,EAAA,6BA5BVC,EAAsB,8BACtBC,EAAkF,iBAElFC,EAAiC,gCACjCC,EAAoC,6CACpCC,EAA6B,sCAC7BC,EAA2D,gCAGpD,SAAST,EAAMU,EAAmB,CATzC,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAWE,GAAIL,EAAM,QACR,OAAOA,EAAM,SAGf,MAAMM,EAAS,CAAC,CAACN,EAAM,QACjBO,KAAa,wBAAqBP,EAAOM,CAAM,EAErD,IAAIE,EAAWR,EAAM,gBAAgB,EACjC,WAAS,IAAIA,EAAM,SAAWS,MAC5B,gBAAaA,EAAO,CAAE,CAAC,gBAAgB,EAAG,EAAK,CAAC,CAClD,EACAT,EAAM,SAEV,OAAI,QAAQ,IAAI,WAAa,eACvBA,EAAM,QAAa,cACrBQ,KACE,QAAC,OAAI,MAAO,CAAE,QAAS,SAAU,OAAQ,gBAAiB,EACxD,oBAAC,QACC,oBAAC,OAAI,0BAEF,KAAK,UAAU,CACd,MAAMP,EAAAM,EAAW,eAAX,YAAAN,EAAyB,MAAM,KACrC,QAAQC,EAAAK,EAAW,eAAX,YAAAL,EAAyB,MAAM,WACvC,IAAIC,EAAAI,EAAW,eAAX,YAAAJ,EAAyB,GAC7B,UAAUE,GAAAD,EAAAG,EAAW,eAAX,YAAAH,EAAyB,gBAAzB,YAAAC,EAAwC,GAClD,MAAOE,EAAW,UACpB,CAAC,GACH,EACF,EACCC,GACH,GAKCjB,EAAkBgB,EAAYC,EAAUR,EAAOM,CAAM,CAC9D,CAEO,SAASf,EACdgB,EACAC,EACAE,EAKAJ,EAAS,GACT,CACA,KAAM,CAAE,aAAAK,EAAc,UAAAC,EAAW,MAAAC,EAAO,WAAAC,CAAW,EAAIP,EACjD,CAAE,QAAAQ,EAAS,eAAAC,CAAe,EAAIN,EAC9BO,KAAgB,gBAAa,EAAK,EACpCH,IACFG,EAAc,QAAU,IAG1B,MAAMC,EACJJ,GAAcG,EAAc,SAAWD,GAAkBV,EAE3D,SAAO,WAAQ,IAAM,CAGnB,GAAI,CAACY,EACH,OAAOV,EAIT,IAAIW,EAAO,WAAS,QAAQX,CAAQ,EAGhCO,GAAWJ,IACbQ,EAAOA,EAAK,IAAKV,MACR,kBAAeA,CAAK,KACvB,gBACEA,EACA,UACA,OAACnB,EAAA,CAAM,KAAMqB,EAAa,MAAM,WAC5B,SAAAF,EAAc,MAAM,SACxB,CACF,EACAA,CACL,GAGH,MAAMW,KACJ,OAAC,sBAAoB,SAApB,CAA6B,MAAOT,EAClC,SAAAQ,EACH,EAGF,GAAIH,IAAmB,GACrB,OAAOI,EAGT,GAAI,SAAS,CAACV,EAAQ,oBAAqB,CAGzC,MAAMW,EAAa,CACjB,MAFiBR,GAASC,KAAa,oBAAiBD,EAAM,KAAK,EAAI,EAGzE,EAEA,SACE,OAAC,QAAK,UAAW,GAAGD,GAAa,4BAA6B,MAAOS,EAClE,SAAAD,EACH,CAEJ,CAEA,OAAOA,CACT,EAAG,CACDF,EACAP,EACAH,EACAK,EACAC,EACAF,CACF,CAAC,CACH",
6
+ "names": ["Theme_exports", "__export", "Theme", "useThemedChildren", "__toCommonJS", "import_jsx_runtime", "import_constants", "import_react", "import_createVariable", "import_ThemeManagerContext", "import_useServerHooks", "import_useTheme", "props", "_a", "_b", "_c", "_d", "_e", "isRoot", "themeState", "children", "child", "options", "themeManager", "className", "theme", "isNewTheme", "shallow", "forceClassName", "hasEverThemed", "shouldRenderChildrenWithTheme", "next", "wrapped", "colorStyle"]
7
7
  }
@@ -1,3 +1,3 @@
1
- import{jsx as ue}from"react/jsx-runtime";import{useComposedRefs as xt}from"@tamagui/compose-refs";import{isClient as Ae,isRSC as ce,isServer as Rt,isWeb as T}from"@tamagui/constants";import{stylePropsView as Vt,validPseudoKeys as Ot,validStyles as _t}from"@tamagui/helpers";import de,{Children as nt,Fragment as kt,createElement as Dt,forwardRef as Mt,memo as Ut,useCallback as Gt,useContext as ot,useEffect as at,useId as It,useRef as $t}from"react";import{onConfiguredOnce as Ft}from"./config.js";import{stackDefaultStyles as it}from"./constants/constants.js";import{FontLanguageContext as jt}from"./contexts/FontLanguageContext.js";import{TextAncestorContext as Bt}from"./contexts/TextAncestorContext.js";import{didGetVariableValue as Lt,setDidGetVariableValue as Wt}from"./createVariable.js";import{extendStaticConfig as rt,parseStaticConfig as Ht}from"./helpers/extendStaticConfig.js";import{useSplitStyles as Kt}from"./helpers/getSplitStyles.js";import{mergeProps as Z}from"./helpers/mergeProps.js";import{proxyThemeVariables as Zt}from"./helpers/proxyThemeVariables.js";import{useShallowSetState as zt}from"./helpers/useShallowSetState.js";import{useAnimationDriver as qt}from"./hooks/useAnimationDriver.js";import{setMediaShouldUpdate as Jt,useMedia as Qt}from"./hooks/useMedia.js";import{useServerRef as Xt,useServerState as Yt}from"./hooks/useServerHooks.js";import{useThemeWithState as es}from"./hooks/useTheme.js";import{hooks as Ce}from"./setupHooks.js";import{Slot as ts}from"./views/Slot.js";import{useThemedChildren as ss}from"./views/Theme.js";process.env.TAMAGUI_TARGET;const lt={hover:!1,press:!1,pressIn:!1,focus:!1,unmounted:!0},ns={...lt,unmounted:!1};let M,ct,dt,Ne;const z=new Set;if(typeof document<"u"){const n=()=>{z.forEach(a=>a()),z.clear()};addEventListener("mouseup",n),addEventListener("touchend",n),addEventListener("touchcancel",n)}function os({defaultProps:n},{shorthands:a}){for(const t of Object.keys(n))n[a[t]||t]=n[t]}let ut,ft,mt=!1;function pt(n,a){const t=(()=>{const o=rt(n,a);return"parsed"in o?o:Ht(o)})(),p=`is_${t.componentName}`;let v,A;const m=Mt((o,i)=>{var je,Be,Le,We,He,Ke,Ze,ze,qe,Je,Qe,Xe,Ye;if(process.env.TAMAGUI_TARGET==="native"&&!mt){mt=!0;const e=(Be=(je=Ce).getBaseViews)==null?void 0:Be.call(je);e&&(ut=e.Text,ft=e.View)}process.env.NODE_ENV==="test"&&o["data-test-renders"]&&(o["data-test-renders"].current??=0,o["data-test-renders"].current+=1);let s;v&&!o.asChild?s=Z(v,o)[0]:s=o;const f=s.debug,{Component:u,isText:w,isZStack:G}=t,h=s.componentName||t.componentName,r=$t(void 0);r.current??={};const c=qt(),O=c==null?void 0:c.useAnimations,b=(()=>{const e=!!(!t.isHOC&&O&&(s.animation||s.style&&ds(s.style)));return e&&!r.current.hasAnimated&&(r.current.hasAnimated=!0),e||r.current.hasAnimated})(),fe=s.asChild?"":s.componentName?`is_${s.componentName}`:p,C=!!(T&&w&&ot(Bt)),me=ce?null:ot(jt),we=s.disabled??((Le=s.accessibilityState)==null?void 0:Le.disabled),xe=T&&(!u||typeof u=="string")&&(s.tag||A)||u,Re=ut||xe||"span",Ve=ft||xe||(C?"span":"div");ct=c?c.Text:Re,dt=c?c.View:Ve;let x=w?(b?ct:null)||Re:(b?dt:null)||Ve;const pe=c==null?void 0:c.isReactNative,Oe=!!s.enterStyle,J=Boolean((T?Ae:!0)&&(Oe||s.animation)),ye=Yt(J?lt:ns),P=o.forceStyle?{...ye[0],[o.forceStyle]:!0}:ye[0],ht=ye[1],_=zt(ht,f,h),_e=c==null?void 0:c.usePresence,I=!ce&&b&&_e?_e():null;if(b&&I){const e=I[2];e&&(P.unmounted&&e.enterVariant&&(s[e.enterVariant]=!0),!e.isPresent&&e.exitVariant&&(s[e.exitVariant]=!0))}const ke=b&&(c==null?void 0:c.isReactNative),he=Boolean(t.isReactNative||ke);if(process.env.NODE_ENV==="development"){const e=It();if(f){const d=`${h||(u==null?void 0:u.displayName)||(u==null?void 0:u.name)||"[Unnamed Component]"}`,N=ke?"(animated)":he?"(rnw)":"",K=o["data-is"]||"",E=`${d}${K?` ${K}`:""} ${N} id ${e}`;console.group(`%c ${E}`,"background: yellow;"),Rt||console.log("state",P)}}const ge=!T||!!(s.animation&&pe)||!t.acceptsClassName,Q=!!o.forceStyle,k=ge||Q,X=es({name:s.theme,componentName:h,reset:s.reset,inverse:s.themeInverse,disable:s["data-themeable"],debug:s.debug,shouldUpdate:()=>!!r.current.didAccessThemeVariableValue});x=u||x;const De=typeof x=="string",gt=(I==null?void 0:I[0])===!1,St=Qt(r,f?{props:s,staticConfig:t}:null);Wt(!1);const g=Kt(s,t,X.theme,{...P,mediaState:St,noClassNames:k,dynamicStylesInline:k,hasTextAncestor:C,resolveVariablesAs:"auto",isExiting:gt},null,me||void 0,x,f),Me=Array.isArray(g.hasMedia),Ue=Lt()||Me||k&&g.hasMedia===!0;Jt(r,{enabled:Ue,keys:k&&Me?g.hasMedia:null});const Y=Xt(null),ee=b&&pe;if(process.env.NODE_ENV==="development"&&(process.env.TAMAGUI_TARGET||console.error('No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".'),f&&(console.groupCollapsed("props"),console.log("props in",o,"mapped to",s,"in order",Object.keys(s)),console.log("splitStyles",g),console.log("shouldListenForMedia",Ue),console.log("className",Object.values(g.classNames)),Ae&&console.log("ref",Y,"(click to view)"),console.groupEnd(),f==="break")))debugger;const{viewProps:vt,pseudos:D,style:te,classNames:Ge,space:bt}=g,Pt=s;let F;if(!ce&&b&&O&&!t.isHOC){const e=O({props:Pt,style:te,presence:I,state:P,pseudos:D||null,onDidAnimate:s.onDidAnimate,hostRef:Y,staticConfig:t});e&&(F=e.style)}const{asChild:j,children:Se,onPress:B,onPressIn:L,onPressOut:W,onHoverIn:se,onHoverOut:ne,themeShallow:Tt,spaceDirection:fs,disabled:ms,onMouseUp:ve,onMouseDown:be,onMouseEnter:oe,onMouseLeave:ae,separator:At,forceStyle:ps,onClick:ie,theme:ys,defaultVariants:hs,...Pe}=vt,Ie=((We=s.accessibilityState)==null?void 0:We.disabled)||s.accessibilityDisabled;let l=Pe;process.env.TAMAGUI_TARGET==="web"&&!he&&!j?l=(Ke=(He=Ce).usePropsTransform)==null?void 0:Ke.call(He,x,Pe,Y):l=Pe,l.ref=xt(Y,i),process.env.NODE_ENV==="development"&&!w&&T&&!t.isHOC&&nt.toArray(s.children).forEach(e=>{typeof e=="string"&&e!==`
2
- `&&console.error(`Unexpected text node: ${e}. A text node cannot be a child of a <View>.`)});const H=Gt(()=>{_({press:!1,pressIn:!1})},[_]);T&&at(()=>()=>{z.delete(H)},[]);const $e=J&&P.unmounted;at(()=>{if($e){if(P.unmounted===!0&&J){_({unmounted:!1});return}_({unmounted:!1})}},[$e,P.unmounted]);let R;if(De&&ge&&!Q)R={...F??te};else if(R=[F??te],Q){const e={};R.forEach(d=>Object.assign(e,d)),Object.assign(g.style,e)}let $=w?g.fontFamily||t.defaultProps.fontFamily:null;$&&$[0]==="$"&&($=$.slice(1));const Ct=$?`font_${$}`:"",Te=[Oe&&(P.unmounted&&J||!Ae)?"t_will-mount":"",h?fe:"",Ct,Ge?Object.values(Ge).join(" "):""].join(" ");if(process.env.TAMAGUI_TARGET==="web"){const e=F??g.style;if(ee)l.style=e;else if(he){const d={$$css:!0};for(const N of Te.split(" "))d[N]=N;l.style=[...Array.isArray(e)?e:[e],d],process.env.NODE_ENV==="development"&&Object.keys(l).forEach(N=>{N.startsWith("data-")&&(l.dataSet??={},l.dataSet[N.replace("data-","")]=l[N],delete l[N])})}else l.className=Te,l.style=e}if(process.env.TAMAGUI_TARGET==="native"){if(g.fontFamily){const e=(Ze=M.fontsParsed[g.fontFamily])==null?void 0:Ze.face;if(e){const[d,N]=(()=>{var tt,st;let E,et;for(let le=R.length;le>=0;le--)E??=(tt=R[le])==null?void 0:tt.fontWeight,et??=(st=R[le])==null?void 0:st.fontStyle;return[E||"400",et||"normal"]})(),K=(qe=(ze=e[d])==null?void 0:ze[N])==null?void 0:qe.val;if(K)for(const E of R)E!=null&&E.fontFamily&&(E.fontFamily=K,E.fontWeight=void 0,E.fontStyle=void 0)}}l.style=R}const Nt=!Ie&&k&&(D==null?void 0:D.pressStyle),re=Boolean(Nt||B||W||L||ie),Et=!Ie&&k&&(D==null?void 0:D.hoverStyle),U=T&&!!(Et||se||ne||oe||ae),wt=!(T||j),Fe=Boolean(re||U||k&&"pressStyle"in s||T&&k&&"hoverStyle"in s),S=Fe&&!ce&&!we&&!j?{onPressOut:re?e=>{H(),W==null||W(e),ve==null||ve(e)}:void 0,...U&&{onMouseEnter:U?e=>{const d={};U&&(d.hover=!0),P.pressIn&&(d.press=!0),(U||P.pressIn)&&_(d),se==null||se(e),oe==null||oe(e)}:void 0,onMouseLeave:U?e=>{const d={};z.add(H),U&&(d.hover=!1),P.pressIn&&(d.press=!1,d.pressIn=!1),Object.keys(d).length&&_(d),ne==null||ne(e),ae==null||ae(e)}:void 0},onPressIn:re?e=>{_({press:!0,pressIn:!0,hover:!1}),L==null||L(e),be==null||be(e),T&&z.add(H)}:void 0,onPress:re?e=>{H(),T&&(ie==null||ie(e)),B==null||B(e)}:void 0}:null;process.env.TAMAGUI_TARGET==="native"&&S&&Object.assign(S,{cancelable:!s.rejectResponderTermination,disabled:we,hitSlop:s.hitSlop,delayLongPress:s.delayLongPress,delayPressIn:s.delayPressIn,delayPressOut:s.delayPressOut,focusable:l.focusable??!0,minPressDuration:0}),(Qe=(Je=Ce).useEvents)==null||Qe.call(Je,l,S,g,_),!!(Tt&&X.isNewTheme)&&(r.current.themeShallow=!0);let V=!Se||j?Se:rs({separator:At,children:Se,space:bt,direction:s.spaceDirection||"both",isZStack:G,debug:f});if(j&&(x=ts,l={...l,onPress:B,onPressIn:L,onPressOut:W}),V=Dt(x,l,V),V=ss(X,V,{shallow:r.current.themeShallow}),process.env.TAMAGUI_TARGET==="web"&&(S||ee)&&(V=ue("span",{className:`${ee?Te:""} _dsp_contents`,...S&&{onMouseEnter:S.onMouseEnter,onMouseLeave:S.onMouseLeave,onClick:S.onPress,onMouseDown:S.onPressIn,onMouseUp:S.onPressOut,onTouchStart:S.onPressIn,onTouchEnd:S.onPressOut},children:V})),process.env.NODE_ENV==="development"&&process.env.DEBUG!=="tamagui"&&f){console.groupCollapsed(`render <${typeof x=="string"?x:"Component"} /> with props`,l);for(const d in l)console.log(d,l[d]);console.log("children",V),console.groupEnd(),typeof window<"u"&&console.log({state:P,themeState:X,isAnimated:b,isAnimatedReactNativeWeb:ee,tamaguiDefaultProps:v,viewProps:l,splitStyles:g,animationStyles:F,handlesPressEvents:wt,isStringElement:De,classNamesIn:(Xe=s.className)==null?void 0:Xe.split(" "),classNamesOut:(Ye=l.className)==null?void 0:Ye.split(" "),events:S,shouldAttach:Fe,styles:R,pseudos:D,content:V,shouldAvoidClasses:ge,avoidClasses:pe,animation:s.animation,style:te,staticConfig:t,tamaguiConfig:M,shouldForcePseudo:Q}),console.groupEnd()}return V});t.componentName&&(m.displayName=t.componentName),Ft(o=>{if(!M&&(M=o,!Ne)){const C=o.themes[Object.keys(o.themes)[0]];Ne=Zt(C),process.env.NODE_ENV==="development"&&(Ne||console.log("Warning: Missing theme"))}os(t,M);let i=t.defaultProps||{};const s=[...t.parentNames||[],t.componentName];M.defaultProps&&s&&t.componentName&&(i=ls(t.componentName,i,M.defaultProps,s,M));const f=i.debug,[u,w]=Z(i,{});u.tag&&(A=u.tag);const G=!t.acceptsClassName,{name:h,variants:r,defaultVariants:c,...O}=u,[b,fe]=Z(m.defaultProps,{...c,...O});if(!T)for(const C in t.defaultProps){const me=t.defaultProps[C];Ot[C]||(b[C]=me)}v=b,process.env.NODE_ENV==="development"&&f&&process.env.IS_STATIC!=="is_static"&&console.log(`\u{1F41B} [${t.componentName||"Component"}]`,{staticConfig:t,tamaguiDefaultProps:v,defaults:b,defaultPropsIn:i,defaultPropsKeyOrder:Object.keys(t.defaultProps),defaultPropsInKeyOrder:Object.keys(i).map(C=>[C,i[C]]),ourProps:u,ourClassNames:w,defaultsClassnames:fe,defaultTag:A,noClassNames:G})});let y=m;return n.memo&&(y=Ut(y)),y.staticConfig={validStyles:t.validStyles||Vt,...t},y.extractable=(o,i)=>(o.staticConfig=rt({Component:o,...i,neverFlatten:!0,isHOC:!0,defaultProps:{...o.defaultProps,...i==null?void 0:i.defaultProps}},y),o),y}const as=n=>n.children;as.isUnspaced=!0;const is=pt({acceptsClassName:!0,memo:!0,componentName:"Spacer",validStyles:_t,defaultProps:{...it,tag:"span",size:!0,pointerEvents:"none"},variants:{size:{"...size":(n,{tokens:a})=>{n=n===!0?"$true":n;const t=a.space[n]??n;return{width:t,height:t,minWidth:t,minHeight:t}}},flex:{true:{flexGrow:1}},direction:{horizontal:{height:0,minHeight:0},vertical:{width:0,minWidth:0},both:{}}}});function rs(n){var u,w,G;const{isZStack:a,children:t,space:p,direction:v,spaceFlex:A,separator:m}=n,y=!!(p||A),o=m!=null;if(!(y||o||a))return t;const i=nt.toArray(t);if(i.length<=1&&!a&&!((w=(u=i[0])==null?void 0:u.type)!=null&&w.shouldForwardSpace))return i;const f=[];for(let[h,r]of i.entries()){const c=r==null||Array.isArray(r)&&r.length===0;if(!c&&de.isValidElement(r)&&((G=r.type)!=null&&G.shouldForwardSpace)&&(r=de.cloneElement(r,{space:p,spaceFlex:A,separator:m,key:r.key})),c||!r||r.key&&!a?f.push(r):f.push(ue(kt,{children:a?ue(cs,{children:r}):r},h)),yt(r)&&h===0||a)continue;const O=i[h+1];O&&!yt(O)&&(m?(y&&f.push(Ee({key:`_${h}_00tmgui`,direction:v,space:p,spaceFlex:A})),f.push(de.isValidElement(m)?de.cloneElement(m,{key:`sep_${h}`}):m),y&&f.push(Ee({key:`_${h}01tmgui`,direction:v,space:p,spaceFlex:A}))):f.push(Ee({key:`_${h}02tmgui`,direction:v,space:p,spaceFlex:A})))}return process.env.NODE_ENV==="development"&&n.debug&&console.log(" Spaced children",f,n),f}function Ee({key:n,direction:a,space:t,spaceFlex:p}){return ue(is,{size:t,direction:a,...typeof p<"u"&&{flex:p===!0?1:p===!1?0:p}},n)}function yt(n){const a=n==null?void 0:n.type;return(a==null?void 0:a.isVisuallyHidden)||(a==null?void 0:a.isUnspaced)}const q=new Map;function ls(n,a,t,p,v){const A=p.length;let m;for(let o=0;o<A;o++){const i=p[o];if(!i)continue;if(q.has(i)){m=q.get(i);continue}const s=t[i];if(!s){m&&q.set(i,m);continue}m=Z(m||{},s,!1,v.inverseShorthands)[0],q.set(i,m)}const y=q.get(n);return y?Z(a,y,!1,v.inverseShorthands)[0]:a}const cs=pt({defaultProps:{...it,flexDirection:"column",position:"absolute",top:0,right:0,bottom:0,left:0,pointerEvents:"box-none"}});function ds(n){return Object.keys(n).some(a=>{const t=n[a];return t&&typeof t=="object"&&"_animation"in t})}export{is as Spacer,as as Unspaced,pt as createComponent,lt as defaultComponentState,z as mouseUps,rs as spacedChildren};
1
+ import{Fragment as Sn,jsx as L,jsxs as vn}from"react/jsx-runtime";import{useComposedRefs as Mt}from"@tamagui/compose-refs";import{isClient as Ne,isRSC as me,isServer as Dt,isWeb as N}from"@tamagui/constants";import{stylePropsView as kt,validPseudoKeys as It,validStyles as Ut}from"@tamagui/helpers";import fe,{Children as lt,Fragment as Gt,createElement as $t,forwardRef as Ft,memo as jt,useCallback as Bt,useContext as ct,useEffect as Ce,useId as Lt,useRef as Wt,useState as Ht}from"react";import{onConfiguredOnce as zt}from"./config.js";import{stackDefaultStyles as dt}from"./constants/constants.js";import{FontLanguageContext as Kt}from"./contexts/FontLanguageContext.js";import{TextAncestorContext as Zt}from"./contexts/TextAncestorContext.js";import{didGetVariableValue as Jt,setDidGetVariableValue as qt}from"./createVariable.js";import{extendStaticConfig as ut,parseStaticConfig as Qt}from"./helpers/extendStaticConfig.js";import{useSplitStyles as Xt}from"./helpers/getSplitStyles.js";import{mergeProps as q}from"./helpers/mergeProps.js";import{proxyThemeVariables as Yt}from"./helpers/proxyThemeVariables.js";import{useShallowSetState as en}from"./helpers/useShallowSetState.js";import{useAnimationDriver as tn}from"./hooks/useAnimationDriver.js";import{setMediaShouldUpdate as nn,useMedia as sn}from"./hooks/useMedia.js";import{useServerRef as on,useServerState as an}from"./hooks/useServerHooks.js";import{useThemeWithState as rn}from"./hooks/useTheme.js";import{hooks as Ae}from"./setupHooks.js";import{Slot as ln}from"./views/Slot.js";import{useThemedChildren as cn}from"./views/Theme.js";process.env.TAMAGUI_TARGET;const mt={hover:!1,press:!1,pressIn:!1,focus:!1,unmounted:!0},dn={...mt,unmounted:!1};let I,ft,pt,Ee;const Q=new Set;if(typeof document<"u"){const s=()=>{Q.forEach(a=>a()),Q.clear()};addEventListener("mouseup",s),addEventListener("touchend",s),addEventListener("touchcancel",s)}function un({defaultProps:s},{shorthands:a}){for(const n of Object.keys(s))s[a[n]||n]=s[n]}let ht,yt,gt=!1;function St(s,a){const n=(()=>{const o=ut(s,a);return"parsed"in o?o:Qt(o)})(),p=`is_${n.componentName}`;let b,C;const f=Ft((o,i)=>{var Be,Le,We,He,ze,Ke,Ze,Je,qe,Qe,Xe,Ye,et,tt,nt,st,ot,at;if(process.env.TAMAGUI_TARGET==="native"&&!gt){gt=!0;const e=(Le=(Be=Ae).getBaseViews)==null?void 0:Le.call(Be);e&&(ht=e.Text,yt=e.View)}process.env.NODE_ENV==="test"&&o["data-test-renders"]&&(o["data-test-renders"].current??=0,o["data-test-renders"].current+=1);let t;b&&!o.asChild?t=q(b,o)[0]:t=o;const m=t.debug,{Component:u,isText:O,isZStack:F}=n,g=t.componentName||n.componentName,r=Wt(void 0);r.current||={};const w=on(null),d=tn(),U=d==null?void 0:d.useAnimations,x=(()=>{const e=!!(!n.isHOC&&U&&(t.animation||t.style&&gn(t.style)));return e&&!r.current.hasAnimated&&(r.current.hasAnimated=!0),e||r.current.hasAnimated})(),V=t.asChild?"":t.componentName?`is_${t.componentName}`:p,Y=!!(N&&O&&ct(Zt)),bt=me?null:ct(Kt),xe=t.disabled??((We=t.accessibilityState)==null?void 0:We.disabled),Ve=N&&(!u||typeof u=="string")&&(t.tag||C)||u,Oe=ht||Ve||"span",Re=yt||Ve||(Y?"span":"div");ft=d?d.Text:Oe,pt=d?d.View:Re;let R=O?(x?ft:null)||Oe:(x?pt:null)||Re;const pe=d==null?void 0:d.isReactNative,_e=!!t.enterStyle,ee=Boolean((N?Ne:!0)&&(_e||t.animation)),he=an(ee?mt:dn),T=o.forceStyle?{...he[0],[o.forceStyle]:!0}:he[0],Tt=he[1],M=en(Tt,m,g),Me=d==null?void 0:d.usePresence,j=!me&&x&&Me?Me():null;if(x&&j){const e=j[2];e&&(T.unmounted&&e.enterVariant&&(t[e.enterVariant]=!0),!e.isPresent&&e.exitVariant&&(t[e.exitVariant]=!0))}const De=x&&(d==null?void 0:d.isReactNative),ye=Boolean(n.isReactNative||De);if(process.env.NODE_ENV==="development"){const e=Lt();if(m){const c=`${g||(u==null?void 0:u.displayName)||(u==null?void 0:u.name)||"[Unnamed Component]"}`,h=De?"(animated)":ye?"(rnw)":"",$=o["data-is"]||"",P=`${c}${$?` ${$}`:""} ${h} id ${e}`;console.group(`%c ${P}`,"background: yellow;"),Dt||console.log("state",T)}}const ge=!N||!!(t.animation&&pe)||!n.acceptsClassName,te=!!o.forceStyle,D=ge||te,A=rn({name:t.theme,componentName:g,reset:t.reset,inverse:t.themeInverse,disable:t["data-themeable"],debug:process.env.NODE_ENV==="development"&&t.debug?{hostRef:w}:void 0,shouldUpdate:()=>!!r.current.didAccessThemeVariableValue});R=u||R;const ke=typeof R=="string",Pt=(j==null?void 0:j[0])===!1,Nt=sn(r,m?{props:t,staticConfig:n}:null);qt(!1);const S=Xt(t,n,A.theme,{...T,mediaState:Nt,noClassNames:D,dynamicStylesInline:D,hasTextAncestor:Y,resolveVariablesAs:"auto",isExiting:Pt},null,bt||void 0,R,m),Ie=Array.isArray(S.hasMedia),Ue=Jt()||Ie||D&&S.hasMedia===!0;nn(r,{enabled:Ue,keys:D&&Ie?S.hasMedia:null});const ne=x&&pe;if(process.env.NODE_ENV==="development"&&(process.env.TAMAGUI_TARGET||console.error('No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".'),m&&(console.groupCollapsed("props"),console.log("props in",o,"mapped to",t,"in order",Object.keys(t)),console.log("splitStyles",S),console.log("shouldListenForMedia",Ue),console.log("className",Object.values(S.classNames)),Ne&&console.log("ref",w,"(click to view)"),console.groupEnd(),m==="break")))debugger;const{viewProps:Ct,pseudos:k,style:se,classNames:Ge,space:At}=S,Et=t;let W;if(!me&&x&&U&&!n.isHOC){const e=U({props:Et,style:se,presence:j,state:T,pseudos:k||null,onDidAnimate:t.onDidAnimate,hostRef:w,staticConfig:n});e&&(W=e.style)}const{asChild:H,children:Se,onPress:z,onPressIn:K,onPressOut:Z,onHoverIn:oe,onHoverOut:ae,themeShallow:wt,spaceDirection:Tn,disabled:Pn,onMouseUp:ve,onMouseDown:be,onMouseEnter:ie,onMouseLeave:re,separator:xt,forceStyle:Nn,onClick:le,theme:Cn,defaultVariants:An,...Te}=Ct,$e=((He=t.accessibilityState)==null?void 0:He.disabled)||t.accessibilityDisabled;let l=Te;process.env.TAMAGUI_TARGET==="web"&&!ye&&!H?l=(Ke=(ze=Ae).usePropsTransform)==null?void 0:Ke.call(ze,R,Te,w):l=Te,l.ref=Mt(w,i),process.env.NODE_ENV==="development"&&!O&&N&&!n.isHOC&&lt.toArray(t.children).forEach(e=>{typeof e=="string"&&e!==`
2
+ `&&console.error(`Unexpected text node: ${e}. A text node cannot be a child of a <View>.`)});const J=Bt(()=>{M({press:!1,pressIn:!1})},[M]);N&&Ce(()=>()=>{Q.delete(J)},[]);const Fe=ee&&T.unmounted;Ce(()=>{if(Fe){if(T.unmounted===!0&&ee){M({unmounted:!1});return}M({unmounted:!1})}},[Fe,T.unmounted]);let _;if(ke&&ge&&!te)_={...W??se};else if(_=[W??se],te){const e={};_.forEach(c=>Object.assign(e,c)),Object.assign(S.style,e)}let B=O?S.fontFamily||n.defaultProps.fontFamily:null;B&&B[0]==="$"&&(B=B.slice(1));const Vt=B?`font_${B}`:"",Pe=[_e&&(T.unmounted&&ee||!Ne)?"t_will-mount":"",g?V:"",Vt,Ge?Object.values(Ge).join(" "):""].join(" ");if(process.env.TAMAGUI_TARGET==="web"){const e=W??S.style;if(ne)l.style=e;else if(ye){const c={$$css:!0};for(const h of Pe.split(" "))c[h]=h;l.style=[...Array.isArray(e)?e:[e],c],process.env.NODE_ENV==="development"&&Object.keys(l).forEach(h=>{h.startsWith("data-")&&(l.dataSet??={},l.dataSet[h.replace("data-","")]=l[h],delete l[h])})}else l.className=Pe,l.style=e}if(process.env.TAMAGUI_TARGET==="native"){if(S.fontFamily){const e=(Ze=I.fontsParsed[S.fontFamily])==null?void 0:Ze.face;if(e){const[c,h]=(()=>{var it,rt;let P,de;for(let ue=_.length;ue>=0;ue--)P??=(it=_[ue])==null?void 0:it.fontWeight,de??=(rt=_[ue])==null?void 0:rt.fontStyle;return[P||"400",de||"normal"]})(),$=(qe=(Je=e[c])==null?void 0:Je[h])==null?void 0:qe.val;if($)for(const P of _)P!=null&&P.fontFamily&&(P.fontFamily=$,P.fontWeight=void 0,P.fontStyle=void 0)}}l.style=_}const Ot=!$e&&D&&(k==null?void 0:k.pressStyle),ce=Boolean(Ot||z||Z||K||le),Rt=!$e&&D&&(k==null?void 0:k.hoverStyle),G=N&&!!(Rt||oe||ae||ie||re),_t=!(N||H),je=Boolean(ce||G||D&&"pressStyle"in t||N&&D&&"hoverStyle"in t),v=je&&!me&&!xe&&!H?{onPressOut:ce?e=>{J(),Z==null||Z(e),ve==null||ve(e)}:void 0,...G&&{onMouseEnter:G?e=>{const c={};G&&(c.hover=!0),T.pressIn&&(c.press=!0),(G||T.pressIn)&&M(c),oe==null||oe(e),ie==null||ie(e)}:void 0,onMouseLeave:G?e=>{const c={};Q.add(J),G&&(c.hover=!1),T.pressIn&&(c.press=!1,c.pressIn=!1),Object.keys(c).length&&M(c),ae==null||ae(e),re==null||re(e)}:void 0},onPressIn:ce?e=>{M({press:!0,pressIn:!0,hover:!1}),K==null||K(e),be==null||be(e),N&&Q.add(J)}:void 0,onPress:ce?e=>{J(),N&&(le==null||le(e)),z==null||z(e)}:void 0}:null;process.env.TAMAGUI_TARGET==="native"&&v&&Object.assign(v,{cancelable:!t.rejectResponderTermination,disabled:xe,hitSlop:t.hitSlop,delayLongPress:t.delayLongPress,delayPressIn:t.delayPressIn,delayPressOut:t.delayPressOut,focusable:l.focusable??!0,minPressDuration:0}),(Xe=(Qe=Ae).useEvents)==null||Xe.call(Qe,l,v,S,M),!!(wt&&A.isNewTheme)&&(r.current.themeShallow=!0);let E=!Se||H?Se:pn({separator:xt,children:Se,space:At,direction:t.spaceDirection||"both",isZStack:F,debug:m});if(H&&(R=ln,l={...l,onPress:z,onPressIn:K,onPressOut:Z}),E=$t(R,l,E),E=cn(A,E,{shallow:r.current.themeShallow}),process.env.NODE_ENV==="development"&&t.debug==="visualize"){const[e,c]=Ht(0);Ce(()=>{var h;(h=A.themeManager)==null||h.onChangeTheme(($,P)=>{c(de=>++de),console.warn("\u{1F5A4}",$)})},[A.themeManager]),E=vn(Sn,{children:[E,L("code",{children:L("pre",{children:JSON.stringify({name:(Ye=A.themeManager)==null?void 0:Ye.state.name,parent:(et=A.themeManager)==null?void 0:et.state.parentName,id:(tt=A.themeManager)==null?void 0:tt.id,parentId:(st=(nt=A.themeManager)==null?void 0:nt.parentManager)==null?void 0:st.id,isNew:A.isNewTheme,onChangeCount:e})})})]})}if(process.env.TAMAGUI_TARGET==="web"&&(v||ne)&&(E=L("span",{className:`${ne?Pe:""} _dsp_contents`,...v&&{onMouseEnter:v.onMouseEnter,onMouseLeave:v.onMouseLeave,onClick:v.onPress,onMouseDown:v.onPressIn,onMouseUp:v.onPressOut,onTouchStart:v.onPressIn,onTouchEnd:v.onPressOut},children:E})),process.env.NODE_ENV==="development"&&process.env.DEBUG!=="tamagui"&&m){console.groupCollapsed(`render <${typeof R=="string"?R:"Component"} /> with props`,l);for(const c in l)console.log(c,l[c]);console.log("children",E),console.groupEnd(),typeof window<"u"&&console.log({state:T,themeState:A,isAnimated:x,isAnimatedReactNativeWeb:ne,tamaguiDefaultProps:b,viewProps:l,splitStyles:S,animationStyles:W,handlesPressEvents:_t,isStringElement:ke,classNamesIn:(ot=t.className)==null?void 0:ot.split(" "),classNamesOut:(at=l.className)==null?void 0:at.split(" "),events:v,shouldAttach:je,styles:_,pseudos:k,content:E,shouldAvoidClasses:ge,avoidClasses:pe,animation:t.animation,style:se,staticConfig:n,tamaguiConfig:I,shouldForcePseudo:te}),console.groupEnd()}return E});n.componentName&&(f.displayName=n.componentName),zt(o=>{if(!I&&(I=o,!Ee)){const V=o.themes[Object.keys(o.themes)[0]];Ee=Yt(V),process.env.NODE_ENV==="development"&&(Ee||console.log("Warning: Missing theme"))}un(n,I);let i=n.defaultProps||{};const t=[...n.parentNames||[],n.componentName];I.defaultProps&&t&&n.componentName&&(i=hn(n.componentName,i,I.defaultProps,t,I));const m=i.debug,[u,O]=q(i,{});u.tag&&(C=u.tag);const F=!n.acceptsClassName,{name:g,variants:r,defaultVariants:w,...d}=u,[U,x]=q(f.defaultProps,{...w,...d});if(!N)for(const V in n.defaultProps){const Y=n.defaultProps[V];It[V]||(U[V]=Y)}b=U,process.env.NODE_ENV==="development"&&m&&process.env.IS_STATIC!=="is_static"&&console.log(`\u{1F41B} [${n.componentName||"Component"}]`,{staticConfig:n,tamaguiDefaultProps:b,defaults:U,defaultPropsIn:i,defaultPropsKeyOrder:Object.keys(n.defaultProps),defaultPropsInKeyOrder:Object.keys(i).map(V=>[V,i[V]]),ourProps:u,ourClassNames:O,defaultsClassnames:x,defaultTag:C,noClassNames:F})});let y=f;return s.memo&&(y=jt(y)),y.staticConfig={validStyles:n.validStyles||kt,...n},y.extractable=(o,i)=>(o.staticConfig=ut({Component:o,...i,neverFlatten:!0,isHOC:!0,defaultProps:{...o.defaultProps,...i==null?void 0:i.defaultProps}},y),o),y}const mn=s=>s.children;mn.isUnspaced=!0;const fn=St({acceptsClassName:!0,memo:!0,componentName:"Spacer",validStyles:Ut,defaultProps:{...dt,tag:"span",size:!0,pointerEvents:"none"},variants:{size:{"...size":(s,{tokens:a})=>{s=s===!0?"$true":s;const n=a.space[s]??s;return{width:n,height:n,minWidth:n,minHeight:n}}},flex:{true:{flexGrow:1}},direction:{horizontal:{height:0,minHeight:0},vertical:{width:0,minWidth:0},both:{}}}});function pn(s){var u,O,F;const{isZStack:a,children:n,space:p,direction:b,spaceFlex:C,separator:f}=s,y=!!(p||C),o=f!=null;if(!(y||o||a))return n;const i=lt.toArray(n);if(i.length<=1&&!a&&!((O=(u=i[0])==null?void 0:u.type)!=null&&O.shouldForwardSpace))return i;const m=[];for(let[g,r]of i.entries()){const w=r==null||Array.isArray(r)&&r.length===0;if(!w&&fe.isValidElement(r)&&((F=r.type)!=null&&F.shouldForwardSpace)&&(r=fe.cloneElement(r,{space:p,spaceFlex:C,separator:f,key:r.key})),w||!r||r.key&&!a?m.push(r):m.push(L(Gt,{children:a?L(yn,{children:r}):r},g)),vt(r)&&g===0||a)continue;const d=i[g+1];d&&!vt(d)&&(f?(y&&m.push(we({key:`_${g}_00tmgui`,direction:b,space:p,spaceFlex:C})),m.push(fe.isValidElement(f)?fe.cloneElement(f,{key:`sep_${g}`}):f),y&&m.push(we({key:`_${g}01tmgui`,direction:b,space:p,spaceFlex:C}))):m.push(we({key:`_${g}02tmgui`,direction:b,space:p,spaceFlex:C})))}return process.env.NODE_ENV==="development"&&s.debug&&console.log(" Spaced children",m,s),m}function we({key:s,direction:a,space:n,spaceFlex:p}){return L(fn,{size:n,direction:a,...typeof p<"u"&&{flex:p===!0?1:p===!1?0:p}},s)}function vt(s){const a=s==null?void 0:s.type;return(a==null?void 0:a.isVisuallyHidden)||(a==null?void 0:a.isUnspaced)}const X=new Map;function hn(s,a,n,p,b){const C=p.length;let f;for(let o=0;o<C;o++){const i=p[o];if(!i)continue;if(X.has(i)){f=X.get(i);continue}const t=n[i];if(!t){f&&X.set(i,f);continue}f=q(f||{},t,!1,b.inverseShorthands)[0],X.set(i,f)}const y=X.get(s);return y?q(a,y,!1,b.inverseShorthands)[0]:a}const yn=St({defaultProps:{...dt,flexDirection:"column",position:"absolute",top:0,right:0,bottom:0,left:0,pointerEvents:"box-none"}});function gn(s){return Object.keys(s).some(a=>{const n=s[a];return n&&typeof n=="object"&&"_animation"in n})}export{fn as Spacer,mn as Unspaced,St as createComponent,mt as defaultComponentState,Q as mouseUps,pn as spacedChildren};
3
3
  //# sourceMappingURL=createComponent.js.map