@tamagui/core 1.0.1-beta.65 → 1.0.1-beta.66

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 (52) hide show
  1. package/dist/cjs/Tamagui.js +0 -3
  2. package/dist/cjs/Tamagui.js.map +2 -2
  3. package/dist/cjs/ThemeManager.js +1 -1
  4. package/dist/cjs/ThemeManager.js.map +2 -2
  5. package/dist/cjs/constants/constants.js +1 -1
  6. package/dist/cjs/constants/constants.js.map +1 -1
  7. package/dist/cjs/createComponent.js +1 -1
  8. package/dist/cjs/createComponent.js.map +2 -2
  9. package/dist/cjs/createTamagui.js +13 -9
  10. package/dist/cjs/createTamagui.js.map +2 -2
  11. package/dist/cjs/helpers/createTamaguiProvider.js +12 -12
  12. package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
  13. package/dist/cjs/types.js.map +1 -1
  14. package/dist/cjs/views/Theme.js +1 -4
  15. package/dist/cjs/views/Theme.js.map +2 -2
  16. package/dist/cjs/views/ThemeProvider.js +3 -2
  17. package/dist/cjs/views/ThemeProvider.js.map +2 -2
  18. package/dist/esm/Tamagui.js +0 -3
  19. package/dist/esm/Tamagui.js.map +2 -2
  20. package/dist/esm/ThemeManager.js +1 -1
  21. package/dist/esm/ThemeManager.js.map +2 -2
  22. package/dist/esm/constants/constants.js +1 -1
  23. package/dist/esm/constants/constants.js.map +1 -1
  24. package/dist/esm/createComponent.js +1 -1
  25. package/dist/esm/createComponent.js.map +2 -2
  26. package/dist/esm/createTamagui.js +14 -10
  27. package/dist/esm/createTamagui.js.map +2 -2
  28. package/dist/esm/helpers/createTamaguiProvider.js +7 -7
  29. package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
  30. package/dist/esm/views/Theme.js +1 -4
  31. package/dist/esm/views/Theme.js.map +2 -2
  32. package/dist/esm/views/ThemeProvider.js +3 -2
  33. package/dist/esm/views/ThemeProvider.js.map +2 -2
  34. package/dist/jsx/Tamagui.js +0 -3
  35. package/dist/jsx/ThemeManager.js +1 -1
  36. package/dist/jsx/constants/constants.js +1 -1
  37. package/dist/jsx/createComponent.js +1 -1
  38. package/dist/jsx/createTamagui.js +14 -10
  39. package/dist/jsx/helpers/createTamaguiProvider.js +4 -7
  40. package/dist/jsx/views/Theme.js +1 -4
  41. package/dist/jsx/views/ThemeProvider.js +3 -2
  42. package/package.json +5 -5
  43. package/reset.css +12 -7
  44. package/types/constants/constants.d.ts +1 -1
  45. package/types/constants/constants.d.ts.map +1 -1
  46. package/types/createTamagui.d.ts.map +1 -1
  47. package/types/helpers/createTamaguiProvider.d.ts +2 -5
  48. package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
  49. package/types/types.d.ts +1 -0
  50. package/types/types.d.ts.map +1 -1
  51. package/types/views/ThemeProvider.d.ts +1 -0
  52. package/types/views/ThemeProvider.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/createTamagui.ts"],
4
- "sourcesContent": ["import { configListeners, getHasConfigured, setConfig } from './conf'\nimport { THEME_CLASSNAME_PREFIX } from './constants/constants'\nimport { isWeb } from './constants/platform'\nimport { SpacerProps } from './createComponent'\nimport { Variable, createVariable, isVariable } from './createVariable'\nimport { createVariables } from './createVariables'\nimport { createTamaguiProvider } from './helpers/createTamaguiProvider'\nimport { getInsertedRules } from './helpers/insertStyleRule'\nimport {\n registerCSSVariable,\n tokenRules,\n tokensValueToVariable,\n} from './helpers/registerCSSVariable'\nimport { configureMedia } from './hooks/useMedia'\nimport { parseFont, registerFontVariables } from './insertFont'\nimport {\n AnimationDriver,\n CreateTamaguiConfig,\n GenericTamaguiConfig,\n MediaQueryKey,\n StackProps,\n TamaguiInternalConfig,\n TextProps,\n ThemeObject,\n} from './types'\n\nexport type CreateTamaguiProps =\n // user then re-defines the types after createTamagui returns the typed object they want\n Partial<Omit<GenericTamaguiConfig, 'themes' | 'tokens' | 'animations'>> & {\n animations?: AnimationDriver<any>\n tokens: GenericTamaguiConfig['tokens']\n themes: {\n [key: string]: {\n [key: string]: string | number | Variable\n }\n }\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?: MediaQueryKey[]\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// config is re-run by the @tamagui/static, dont double validate\nconst createdConfigs = new WeakMap<any, boolean>()\n\nexport type InferTamaguiConfig<Conf extends CreateTamaguiProps> = Conf extends Partial<\n CreateTamaguiConfig<infer A, infer B, infer C, infer D, infer E, infer F>\n>\n ? TamaguiInternalConfig<A, B, C, D, E, F>\n : unknown\n\nexport function createTamagui<Conf extends CreateTamaguiProps>(\n config: Conf\n): InferTamaguiConfig<Conf> {\n if (createdConfigs.has(config)) {\n return config as any\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (!config.tokens) {\n throw new Error(`No tokens provided to Tamagui config`)\n }\n if (!config.themes) {\n throw new Error(`No themes provided to Tamagui config`)\n }\n if (!config.fonts) {\n throw new Error(`No fonts provided to Tamagui config`)\n }\n }\n\n // test env loads a few times as it runs diff tests\n if (getHasConfigured()) {\n console.warn(`Warning: createTamagui called twice (maybe HMR)`)\n }\n\n configureMedia({\n queries: config.media as any,\n defaultActive: config.mediaQueryDefaultActive,\n })\n\n const fontTokens = createVariables(config.fonts!)\n const fontsParsed = (() => {\n const res = {} as typeof fontTokens\n for (const familyName in fontTokens) {\n res[`$${familyName}`] = parseFont(fontTokens[familyName])\n }\n return res!\n })()\n\n const themeConfig = (() => {\n const themes = { ...config.themes }\n let cssRules: string[] = []\n\n if (isWeb) {\n for (const key in config.tokens) {\n for (const skey in config.tokens[key]) {\n const val = config.tokens[key][skey]\n registerCSSVariable(val)\n }\n }\n\n for (const key in fontsParsed) {\n const val = fontsParsed[key]\n registerFontVariables(val)\n }\n\n const sep = process.env.NODE_ENV === 'development' ? config.cssStyleSeparator || ' ' : ''\n cssRules.push(`:root {${sep}${[...tokenRules].join(`;${sep}`)}${sep}}`)\n }\n\n // special case for SSR\n const hasDarkLight = 'light' in config.themes && 'dark' in config.themes\n const CNP = `.${THEME_CLASSNAME_PREFIX}`\n\n // dedupe themes to avoid duplicate CSS generation\n type DedupedTheme = {\n names: string[]\n theme: ThemeObject\n }\n const dedupedThemes: {\n [key: string]: DedupedTheme\n } = {}\n const existing = new WeakMap<ThemeObject, DedupedTheme>()\n\n // first, de-dupe and parse them\n for (const themeName in themes) {\n const rawTheme = themes[themeName]\n\n // if existing, avoid\n if (existing.has(rawTheme)) {\n const e = existing.get(rawTheme)!\n themes[themeName] = e.theme\n e.names.push(themeName)\n continue\n }\n\n // parse into variables\n const theme = { ...config.themes[themeName] }\n for (const key in theme) {\n // make sure properly names theme variables\n ensureThemeVariable(theme, key)\n }\n themes[themeName] = theme\n\n // set deduped\n dedupedThemes[themeName] = {\n names: [themeName],\n theme,\n }\n existing.set(config.themes[themeName], dedupedThemes[themeName])\n }\n\n // then, generate from de-duped\n if (isWeb) {\n for (const themeName in dedupedThemes) {\n const { theme, names } = dedupedThemes[themeName]\n let vars = ''\n\n for (const themeKey in theme) {\n const variable = theme[themeKey] as Variable\n let value: any = null\n if (variable.isFloating || !tokensValueToVariable.has(variable.val)) {\n value = variable.val\n } else {\n value = tokensValueToVariable.get(variable.val)!.variable\n }\n vars += `--${themeKey}:${value};`\n }\n\n const isDarkOrLightBase = themeName === 'dark' || themeName === 'light'\n const isDark = themeName.startsWith('dark')\n const selectors = names.map((name) => {\n return `${CNP}${name}`\n })\n\n // since we dont specify dark/light in classnames we have to do an awkward specificity war\n // use config.maxDarkLightNesting to determine how deep you can nest until it breaks\n if (hasDarkLight) {\n for (const subName of names) {\n const childSelector = `${CNP}${subName.replace('dark_', '').replace('light_', '')}`\n const order = isDark ? ['dark', 'light'] : ['light', 'dark']\n if (isDarkOrLightBase) {\n order.reverse()\n }\n const [stronger, weaker] = order\n const max = config.maxDarkLightNesting ?? 3\n new Array(max * 2).fill(undefined).forEach((_, pi) => {\n if (pi % 2 === 1) return\n const parents = new Array(pi + 1).fill(undefined).map((_, psi) => {\n return `${CNP}${psi % 2 === 0 ? stronger : weaker}`\n })\n selectors.push(\n `${(parents.length > 1 ? parents.slice(1) : parents).join(' ')} ${childSelector}`\n )\n })\n }\n }\n\n const rootSep = config.themeClassNameOnRoot ? '' : ' '\n cssRules.push(`${selectors.map((x) => `:root${rootSep}${x}`).join(', ')} {${vars}}`)\n\n if (config.shouldAddPrefersColorThemes ?? true) {\n // add media prefers for dark/light base\n if (isDarkOrLightBase) {\n cssRules.push(\n `@media(prefers-color-scheme: ${isDark ? 'dark' : 'light'}) {\n body { background:${theme.background}; color: ${theme.color} }\n :root {${vars} } \n }`\n )\n }\n }\n }\n }\n\n // proxy upwards to get parent variables (themes are subset going down)\n for (const themeName in themes) {\n // we could test if this is better as just a straight object spread or fancier proxy\n const cur: string[] = []\n // if theme is dark_blue_alt1_Button\n // this will be the parent names in order: ['dark', 'dark_blue', 'dark_blue_alt1\"]\n const parents = themeName\n .split('_')\n .slice(0, -1)\n .map((part) => {\n cur.push(part)\n return cur.join('_')\n })\n\n if (!parents.length) continue\n\n themes[themeName] = new Proxy(themes[themeName], {\n get(target, key) {\n if (Reflect.has(target, key)) {\n return Reflect.get(target, key)\n }\n // check parents\n for (let i = parents.length - 1; i >= 0; i--) {\n const parent = themes[parents[i]]\n if (!parent) {\n continue\n }\n if (Reflect.has(parent, key)) {\n return Reflect.get(parent, key)\n }\n }\n },\n })\n }\n\n tokensValueToVariable.clear()\n Object.freeze(cssRules)\n const css = cssRules.join('\\n')\n\n return {\n themes,\n cssRules,\n css,\n }\n })()\n\n // faster lookups token keys become $keys to match input\n const tokensParsed: any = parseTokens(config.tokens)\n\n const getCSS = () => {\n return `${themeConfig.css}\\n${getInsertedRules().join('\\n')}`\n }\n\n if (config.shorthands) {\n for (const key in config.shorthands) {\n reversedShorthands[config.shorthands[key]] = key\n }\n }\n\n const next: TamaguiInternalConfig = {\n fonts: {},\n animations: {} as any,\n shorthands: {},\n media: {},\n ...config,\n themes: themeConfig.themes,\n Provider: createTamaguiProvider({\n getCSS,\n defaultTheme: 'light',\n ...config,\n themes: themeConfig.themes,\n }),\n fontsParsed,\n themeConfig,\n tokensParsed,\n parsed: true,\n getCSS,\n }\n\n setConfig(next)\n\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(next))\n configListeners.clear()\n }\n\n createdConfigs.set(next, true)\n\n // @ts-expect-error\n return next\n}\n\nexport const reversedShorthands: Record<string, string> = {}\n\nconst parseTokens = (tokens: any) => {\n const res: any = {}\n for (const key in tokens) {\n res[key] = {}\n for (const skey in tokens[key]) {\n res[key][`$${skey}`] = tokens[key][skey]\n }\n }\n return res\n}\n\n// mutates, freeze after\n// shared by createTamagui so extracted here\nfunction ensureThemeVariable(theme: any, key: string) {\n const val = theme[key]\n const themeKey = key\n if (!isVariable(val)) {\n theme[key] = createVariable({\n key: themeKey,\n name: themeKey,\n val,\n })\n } else {\n if (val.name !== themeKey) {\n // rename to theme name\n theme[key] = createVariable({\n key: val.name,\n name: themeKey,\n val: val.val,\n })\n }\n }\n}\n\n// for quick testing types:\n// const x = createTamagui({\n// shorthands: {},\n// media: {},\n// themes: {},\n// tokens: {\n// font: {},\n// color: {},\n// radius: {},\n// size: {},\n// space: {},\n// zIndex: {},\n// },\n// })\n"],
5
- "mappings": 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;AAAA,MACA,cAAc;AAAA,OACX,SAH2B;AAAA,MAI9B,QAAQ,YAAY;AAAA,IACtB,EAAC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,EACF;AAEA,6BAAU,IAAI;AAEd,MAAI,4BAAgB,MAAM;AACxB,gCAAgB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;AACxC,gCAAgB,MAAM;AAAA,EACxB;AAEA,iBAAe,IAAI,MAAM,IAAI;AAG7B,SAAO;AACT;AA9PgB;AAgQT,MAAM,qBAA6C,CAAC;AAE3D,MAAM,cAAc,wBAAC,WAAgB;AACnC,QAAM,MAAW,CAAC;AAClB,aAAW,OAAO,QAAQ;AACxB,QAAI,OAAO,CAAC;AACZ,eAAW,QAAQ,OAAO,MAAM;AAC9B,UAAI,KAAK,IAAI,UAAU,OAAO,KAAK;AAAA,IACrC;AAAA,EACF;AACA,SAAO;AACT,GAToB;AAapB,6BAA6B,OAAY,KAAa;AACpD,QAAM,MAAM,MAAM;AAClB,QAAM,WAAW;AACjB,MAAI,CAAC,sCAAW,GAAG,GAAG;AACpB,UAAM,OAAO,0CAAe;AAAA,MAC1B,KAAK;AAAA,MACL,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,EACH,OAAO;AACL,QAAI,IAAI,SAAS,UAAU;AAEzB,YAAM,OAAO,0CAAe;AAAA,QAC1B,KAAK,IAAI;AAAA,QACT,MAAM;AAAA,QACN,KAAK,IAAI;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAnBS;",
4
+ "sourcesContent": ["import { configListeners, getHasConfigured, setConfig } from './conf'\nimport { THEME_CLASSNAME_PREFIX } from './constants/constants'\nimport { isWeb } from './constants/platform'\nimport { SpacerProps } from './createComponent'\nimport { Variable, createVariable, isVariable } from './createVariable'\nimport { createVariables } from './createVariables'\nimport { createTamaguiProvider } from './helpers/createTamaguiProvider'\nimport { getInsertedRules } from './helpers/insertStyleRule'\nimport {\n registerCSSVariable,\n tokenRules,\n tokensValueToVariable,\n} from './helpers/registerCSSVariable'\nimport { configureMedia } from './hooks/useMedia'\nimport { parseFont, registerFontVariables } from './insertFont'\nimport { Tamagui } from './Tamagui'\nimport {\n AnimationDriver,\n CreateTamaguiConfig,\n GenericTamaguiConfig,\n MediaQueryKey,\n StackProps,\n TamaguiInternalConfig,\n TextProps,\n ThemeObject,\n} from './types'\n\nexport type CreateTamaguiProps =\n // user then re-defines the types after createTamagui returns the typed object they want\n Partial<Omit<GenericTamaguiConfig, 'themes' | 'tokens' | 'animations'>> & {\n animations?: AnimationDriver<any>\n tokens: GenericTamaguiConfig['tokens']\n themes: {\n [key: string]: {\n [key: string]: string | number | Variable\n }\n }\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?: MediaQueryKey[]\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// config is re-run by the @tamagui/static, dont double validate\nconst createdConfigs = new WeakMap<any, boolean>()\n\nexport type InferTamaguiConfig<Conf extends CreateTamaguiProps> = Conf extends Partial<\n CreateTamaguiConfig<infer A, infer B, infer C, infer D, infer E, infer F>\n>\n ? TamaguiInternalConfig<A, B, C, D, E, F>\n : unknown\n\nexport function createTamagui<Conf extends CreateTamaguiProps>(\n config: Conf\n): InferTamaguiConfig<Conf> {\n if (createdConfigs.has(config)) {\n return config as any\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (!config.tokens) {\n throw new Error(`No tokens provided to Tamagui config`)\n }\n if (!config.themes) {\n throw new Error(`No themes provided to Tamagui config`)\n }\n if (!config.fonts) {\n throw new Error(`No fonts provided to Tamagui config`)\n }\n }\n\n // test env loads a few times as it runs diff tests\n if (getHasConfigured()) {\n console.warn(`Warning: createTamagui called twice (maybe HMR)`)\n }\n\n configureMedia({\n queries: config.media as any,\n defaultActive: config.mediaQueryDefaultActive,\n })\n\n const fontTokens = createVariables(config.fonts!)\n const fontsParsed = (() => {\n const res = {} as typeof fontTokens\n for (const familyName in fontTokens) {\n res[`$${familyName}`] = parseFont(fontTokens[familyName])\n }\n return res!\n })()\n\n const themeConfig = (() => {\n const themes = { ...config.themes }\n let cssRules: string[] = []\n\n if (isWeb) {\n for (const key in config.tokens) {\n for (const skey in config.tokens[key]) {\n const val = config.tokens[key][skey]\n registerCSSVariable(val)\n }\n }\n\n for (const key in fontsParsed) {\n const val = fontsParsed[key]\n registerFontVariables(val)\n }\n\n const sep = process.env.NODE_ENV === 'development' ? config.cssStyleSeparator || ' ' : ''\n cssRules.push(`:root {${sep}${[...tokenRules].join(`;${sep}`)}${sep}}`)\n }\n\n // special case for SSR\n const hasDarkLight = 'light' in config.themes && 'dark' in config.themes\n const CNP = `.${THEME_CLASSNAME_PREFIX}`\n\n // dedupe themes to avoid duplicate CSS generation\n type DedupedTheme = {\n names: string[]\n theme: ThemeObject\n }\n const dedupedThemes: {\n [key: string]: DedupedTheme\n } = {}\n const existing = new WeakMap<ThemeObject, DedupedTheme>()\n\n // first, de-dupe and parse them\n for (const themeName in themes) {\n const rawTheme = themes[themeName]\n\n // if existing, avoid\n if (existing.has(rawTheme)) {\n const e = existing.get(rawTheme)!\n themes[themeName] = e.theme\n e.names.push(themeName)\n continue\n }\n\n // parse into variables\n const theme = { ...config.themes[themeName] }\n for (const key in theme) {\n // make sure properly names theme variables\n ensureThemeVariable(theme, key)\n }\n themes[themeName] = theme\n\n // set deduped\n dedupedThemes[themeName] = {\n names: [themeName],\n theme,\n }\n existing.set(config.themes[themeName], dedupedThemes[themeName])\n }\n\n // then, generate from de-duped\n if (isWeb) {\n for (const themeName in dedupedThemes) {\n const { theme, names } = dedupedThemes[themeName]\n let vars = ''\n\n for (const themeKey in theme) {\n const variable = theme[themeKey] as Variable\n let value: any = null\n if (variable.isFloating || !tokensValueToVariable.has(variable.val)) {\n value = variable.val\n } else {\n value = tokensValueToVariable.get(variable.val)!.variable\n }\n vars += `--${themeKey}:${value};`\n }\n\n const isDarkOrLightBase = themeName === 'dark' || themeName === 'light'\n const selectors = names.map((name) => {\n return `${CNP}${name}`\n })\n\n // since we dont specify dark/light in classnames we have to do an awkward specificity war\n // use config.maxDarkLightNesting to determine how deep you can nest until it breaks\n if (hasDarkLight) {\n for (const subName of names) {\n const isDark = subName.startsWith('dark')\n const childSelector = `${CNP}${subName.replace('dark_', '').replace('light_', '')}`\n const order = isDark ? ['dark', 'light'] : ['light', 'dark']\n if (isDarkOrLightBase) {\n order.reverse()\n }\n const [stronger, weaker] = order\n const max = config.maxDarkLightNesting ?? 3\n new Array(max * 2).fill(undefined).forEach((_, pi) => {\n if (pi % 2 === 1) return\n const parents = new Array(pi + 1).fill(undefined).map((_, psi) => {\n return `${CNP}${psi % 2 === 0 ? stronger : weaker}`\n })\n selectors.push(\n `${(parents.length > 1 ? parents.slice(1) : parents).join(' ')} ${childSelector}`\n )\n })\n }\n }\n\n const rootSep = config.themeClassNameOnRoot ? '' : ' '\n cssRules.push(`${selectors.map((x) => `:root${rootSep}${x}`).join(', ')} {${vars}}`)\n\n if (config.shouldAddPrefersColorThemes) {\n const isDark = themeName.startsWith('dark')\n // add media prefers for dark/light base\n if (isDarkOrLightBase) {\n cssRules.push(\n `@media(prefers-color-scheme: ${isDark ? 'dark' : 'light'}) {\n body { background:${theme.background}; color: ${theme.color} }\n :root {${vars} } \n }`\n )\n }\n }\n }\n }\n\n // proxy upwards to get parent variables (themes are subset going down)\n for (const themeName in themes) {\n // we could test if this is better as just a straight object spread or fancier proxy\n const cur: string[] = []\n // if theme is dark_blue_alt1_Button\n // this will be the parent names in order: ['dark', 'dark_blue', 'dark_blue_alt1\"]\n const parents = themeName\n .split('_')\n .slice(0, -1)\n .map((part) => {\n cur.push(part)\n return cur.join('_')\n })\n\n if (!parents.length) continue\n\n themes[themeName] = new Proxy(themes[themeName], {\n get(target, key) {\n if (Reflect.has(target, key)) {\n return Reflect.get(target, key)\n }\n // check parents\n for (let i = parents.length - 1; i >= 0; i--) {\n const parent = themes[parents[i]]\n if (!parent) {\n continue\n }\n if (Reflect.has(parent, key)) {\n return Reflect.get(parent, key)\n }\n }\n },\n })\n }\n\n tokensValueToVariable.clear()\n Object.freeze(cssRules)\n const css = cssRules.join('\\n')\n\n return {\n themes,\n cssRules,\n css,\n }\n })()\n\n // faster lookups token keys become $keys to match input\n const tokensParsed: any = parseTokens(config.tokens)\n\n const getCSS = () => {\n return `${themeConfig.css}\\n${getInsertedRules().join('\\n')}`\n }\n\n if (config.shorthands) {\n for (const key in config.shorthands) {\n reversedShorthands[config.shorthands[key]] = key\n }\n }\n\n const next: TamaguiInternalConfig = {\n defaultTheme: 'light',\n fonts: {},\n animations: {} as any,\n shorthands: {},\n media: {},\n ...config,\n themes: themeConfig.themes,\n fontsParsed,\n themeConfig,\n tokensParsed,\n parsed: true,\n getCSS,\n Provider: null as any,\n }\n\n next.Provider = createTamaguiProvider(next)\n\n setConfig(next)\n\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(next))\n configListeners.clear()\n }\n\n createdConfigs.set(next, true)\n\n if (process.env.NODE_ENV === 'development') {\n if (!globalThis['Tamagui']) {\n globalThis['Tamagui'] = Tamagui\n }\n }\n\n // @ts-expect-error\n return next\n}\n\nexport const reversedShorthands: Record<string, string> = {}\n\nconst parseTokens = (tokens: any) => {\n const res: any = {}\n for (const key in tokens) {\n res[key] = {}\n for (const skey in tokens[key]) {\n res[key][`$${skey}`] = tokens[key][skey]\n }\n }\n return res\n}\n\n// mutates, freeze after\n// shared by createTamagui so extracted here\nfunction ensureThemeVariable(theme: any, key: string) {\n const val = theme[key]\n const themeKey = key\n if (!isVariable(val)) {\n theme[key] = createVariable({\n key: themeKey,\n name: themeKey,\n val,\n })\n } else {\n if (val.name !== themeKey) {\n // rename to theme name\n theme[key] = createVariable({\n key: val.name,\n name: themeKey,\n val: val.val,\n })\n }\n }\n}\n\n// for quick testing types:\n// const x = createTamagui({\n// shorthands: {},\n// media: {},\n// themes: {},\n// tokens: {\n// font: {},\n// color: {},\n// radius: {},\n// size: {},\n// space: {},\n// zIndex: {},\n// },\n// })\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6D;AAC7D,uBAAuC;AACvC,sBAAsB;AAEtB,4BAAqD;AACrD,6BAAgC;AAChC,mCAAsC;AACtC,6BAAiC;AACjC,iCAIO;AACP,sBAA+B;AAC/B,wBAAiD;AACjD,qBAAwB;AAqDxB,MAAM,iBAAiB,oBAAI,QAAsB;AAQ1C,uBACL,QAC0B;AAC1B,MAAI,eAAe,IAAI,MAAM,GAAG;AAC9B,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,OAAO,QAAQ;AAClB,YAAM,IAAI,MAAM,sCAAsC;AAAA,IACxD;AACA,QAAI,CAAC,OAAO,QAAQ;AAClB,YAAM,IAAI,MAAM,sCAAsC;AAAA,IACxD;AACA,QAAI,CAAC,OAAO,OAAO;AACjB,YAAM,IAAI,MAAM,qCAAqC;AAAA,IACvD;AAAA,EACF;AAGA,MAAI,kCAAiB,GAAG;AACtB,YAAQ,KAAK,iDAAiD;AAAA,EAChE;AAEA,sCAAe;AAAA,IACb,SAAS,OAAO;AAAA,IAChB,eAAe,OAAO;AAA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QAAM,WAAW;AACjB,MAAI,CAAC,sCAAW,GAAG,GAAG;AACpB,UAAM,OAAO,0CAAe;AAAA,MAC1B,KAAK;AAAA,MACL,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,EACH,OAAO;AACL,QAAI,IAAI,SAAS,UAAU;AAEzB,YAAM,OAAO,0CAAe;AAAA,QAC1B,KAAK,IAAI;AAAA,QACT,MAAM;AAAA,QACN,KAAK,IAAI;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAnBS;",
6
6
  "names": []
7
7
  }
@@ -54,17 +54,12 @@ var React = __toESM(require("react"));
54
54
  var import_ButtonInsideButtonContext = require("../contexts/ButtonInsideButtonContext");
55
55
  var import_TextAncestorContext = require("../views/TextAncestorContext");
56
56
  var import_ThemeProvider = require("../views/ThemeProvider");
57
- function createTamaguiProvider(_a) {
58
- var _b = _a, {
59
- getCSS
60
- } = _b, themeProps = __objRest(_b, [
61
- "getCSS"
62
- ]);
63
- return /* @__PURE__ */ __name(function TamaguiProvider(_a2) {
64
- var _b2 = _a2, {
57
+ function createTamaguiProvider(config) {
58
+ return /* @__PURE__ */ __name(function TamaguiProvider(_a) {
59
+ var _b = _a, {
65
60
  disableInjectCSS,
66
61
  children
67
- } = _b2, themePropsProvider = __objRest(_b2, [
62
+ } = _b, themePropsProvider = __objRest(_b, [
68
63
  "disableInjectCSS",
69
64
  "children"
70
65
  ]);
@@ -73,16 +68,21 @@ function createTamaguiProvider(_a) {
73
68
  if (disableInjectCSS)
74
69
  return;
75
70
  const style = document.createElement("style");
76
- style.appendChild(document.createTextNode(getCSS()));
71
+ style.appendChild(document.createTextNode(config.getCSS()));
77
72
  document.head.appendChild(style);
78
73
  return () => {
79
74
  document.head.removeChild(style);
80
75
  };
81
- }, []);
76
+ }, [disableInjectCSS]);
82
77
  }
83
78
  return /* @__PURE__ */ React.createElement(import_ButtonInsideButtonContext.ButtonInsideButtonContext.Provider, {
84
79
  value: false
85
- }, /* @__PURE__ */ React.createElement(import_TextAncestorContext.TextAncestorProvider, null, /* @__PURE__ */ React.createElement(import_ThemeProvider.ThemeProvider, __spreadValues(__spreadValues({}, themeProps), themePropsProvider), children)));
80
+ }, /* @__PURE__ */ React.createElement(import_TextAncestorContext.TextAncestorProvider, null, /* @__PURE__ */ React.createElement(import_ThemeProvider.ThemeProvider, __spreadValues({
81
+ themes: config.themes,
82
+ defaultTheme: config.defaultTheme || "light",
83
+ themeClassNameOnRoot: config.themeClassNameOnRoot,
84
+ disableRootThemeClass: config.disableRootThemeClass
85
+ }, themePropsProvider), children)));
86
86
  }, "TamaguiProvider");
87
87
  }
88
88
  __name(createTamaguiProvider, "createTamaguiProvider");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/createTamaguiProvider.tsx"],
4
- "sourcesContent": ["import * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TamaguiProviderProps } from '../types'\nimport { TextAncestorProvider } from '../views/TextAncestorContext'\nimport { ThemeProvider, ThemeProviderProps } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider({\n getCSS,\n ...themeProps\n}: ThemeProviderProps & {\n getCSS: () => string\n}) {\n return function TamaguiProvider({\n disableInjectCSS,\n children,\n ...themePropsProvider\n }: TamaguiProviderProps) {\n // inject CSS if asked to (not SSR compliant)\n if (typeof document !== 'undefined') {\n React.useLayoutEffect(() => {\n if (disableInjectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider {...themeProps} {...themePropsProvider}>\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAEvB,uCAA0C;AAE1C,iCAAqC;AACrC,2BAAkD;AAE3C,+BAA+B,IAKnC;AALmC,eACpC;AAAA;AAAA,MADoC,IAEjC,uBAFiC,IAEjC;AAAA,IADH;AAAA;AAKA,SAAO,gDAAyB,KAIP;AAJO,mBAC9B;AAAA;AAAA,MACA;AAAA,QAF8B,KAG3B,+BAH2B,KAG3B;AAAA,MAFH;AAAA,MACA;AAAA;AAIA,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,gBAAgB,MAAM;AAC1B,YAAI;AAAkB;AACtB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,cAAM,YAAY,SAAS,eAAe,OAAO,CAAC,CAAC;AACnD,iBAAS,KAAK,YAAY,KAAK;AAC/B,eAAO,MAAM;AACX,mBAAS,KAAK,YAAY,KAAK;AAAA,QACjC;AAAA,MACF,GAAG,CAAC,CAAC;AAAA,IACP;AAEA,WACE,oCAAC,2DAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,uDACC,oCAAC,sEAAkB,aAAgB,qBAChC,QACH,CACF,CACF;AAAA,EAEJ,GA3BO;AA4BT;AAlCgB;",
4
+ "sourcesContent": ["import * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TamaguiInternalConfig, TamaguiProviderProps } from '../types'\nimport { TextAncestorProvider } from '../views/TextAncestorContext'\nimport { ThemeProvider } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider(config: TamaguiInternalConfig) {\n return function TamaguiProvider({\n disableInjectCSS,\n children,\n ...themePropsProvider\n }: TamaguiProviderProps) {\n // inject CSS if asked to (not SSR compliant)\n if (typeof document !== 'undefined') {\n React.useLayoutEffect(() => {\n if (disableInjectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(config.getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [disableInjectCSS])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider\n themes={config.themes}\n defaultTheme={config.defaultTheme || 'light'}\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n >\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAEvB,uCAA0C;AAE1C,iCAAqC;AACrC,2BAA8B;AAEvB,+BAA+B,QAA+B;AACnE,SAAO,gDAAyB,IAIP;AAJO,iBAC9B;AAAA;AAAA,MACA;AAAA,QAF8B,IAG3B,+BAH2B,IAG3B;AAAA,MAFH;AAAA,MACA;AAAA;AAIA,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,gBAAgB,MAAM;AAC1B,YAAI;AAAkB;AACtB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,cAAM,YAAY,SAAS,eAAe,OAAO,OAAO,CAAC,CAAC;AAC1D,iBAAS,KAAK,YAAY,KAAK;AAC/B,eAAO,MAAM;AACX,mBAAS,KAAK,YAAY,KAAK;AAAA,QACjC;AAAA,MACF,GAAG,CAAC,gBAAgB,CAAC;AAAA,IACvB;AAEA,WACE,oCAAC,2DAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,uDACC,oCAAC;AAAA,MACC,QAAQ,OAAO;AAAA,MACf,cAAc,OAAO,gBAAgB;AAAA,MACrC,sBAAsB,OAAO;AAAA,MAC7B,uBAAuB,OAAO;AAAA,OAC1B,qBAEH,QACH,CACF,CACF;AAAA,EAEJ,GAjCO;AAkCT;AAnCgB;",
6
6
  "names": []
7
7
  }
@@ -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 { Properties } from 'csstype'\nimport React from 'react'\nimport {\n GestureResponderEvent,\n Image,\n TextProps as ReactTextProps,\n Text,\n TextInput,\n TextStyle,\n View,\n ViewProps,\n ViewStyle,\n} from 'react-native'\n\nimport { Variable } from './createVariable'\nimport { ResolveVariableTypes } from './helpers/createPropMapper'\nimport { RNWTextProps, RNWViewProps } from './types-rnw'\nimport { ThemeProviderProps } from './views/ThemeProvider'\n\nexport type SpaceFlexDirection = ViewStyle['flexDirection'] | 'both'\n\nexport type TamaguiElement = HTMLElement | View\n\nexport type DebugProp = boolean | 'break' | 'verbose'\n\n//\n// base props that are accepted by createComponent (additional to react-native-web)\n//\nexport type TamaguiComponentPropsBase = {\n asChild?: boolean\n space?: SpaceTokens\n spaceDirection?: SpaceFlexDirection\n separator?: React.ReactNode\n dangerouslySetInnerHTML?: { __html: string }\n animation?: AnimationProp\n animateOnly?: string[]\n children?: any | any[]\n debug?: DebugProp\n disabled?: boolean\n className?: string\n id?: string\n tag?: string\n theme?: ThemeName | null\n componentName?: string\n onHoverIn?: (e: MouseEvent) => any\n onHoverOut?: (e: MouseEvent) => any\n onPress?: (e: GestureResponderEvent) => any\n onPressIn?: (e: GestureResponderEvent) => any\n onPressOut?: (e: GestureResponderEvent) => any\n // WEB ONLY\n onMouseEnter?: (e: MouseEvent) => any\n onMouseLeave?: (e: MouseEvent) => any\n onMouseDown?: (e: MouseEvent) => any\n // WEB STYLES\n userSelect?: Properties['userSelect']\n cursor?: Properties['cursor']\n}\n\nexport type ReactComponentWithRef<Props, Ref> = React.ForwardRefExoticComponent<\n Props & React.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 | number | symbol\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\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}\ntype GenericShorthands = {\n // [key: string]: string\n}\n\ntype GenericMedia<K extends string = string> = {\n // name => media shorthand name (camelCase) => value\n [key in K]: {\n [key: string]: number | string\n }\n}\n\nexport type GenericFonts = {\n [key: string]: GenericFont\n}\n\ntype GenericAnimations = {\n [key: string]:\n | string\n | {\n [key: string]: any\n }\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> = Partial<Pick<ThemeProviderProps, 'defaultTheme' | 'disableRootThemeClass'>> & {\n fonts: F\n tokens: A\n themes: B\n shorthands: C\n media: D\n animations: AnimationDriver<E>\n defaultProps?: Record<string, Object>\n}\n\n// for use in creation functions so it doesnt get overwrtitten\nexport type GenericTamaguiConfig = CreateTamaguiConfig<\n GenericTokens,\n GenericThemes,\n GenericShorthands,\n GenericMedia,\n GenericAnimations,\n GenericFonts\n>\n\n// since TamaguiConfig will be re-declared, these will all be typed globally\nexport type ThemeObject = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]\nexport type Tokens = TamaguiConfig['tokens']\nexport type Shorthands = TamaguiConfig['shorthands']\nexport type Media = TamaguiConfig['media']\nexport type Themes = TamaguiConfig['themes']\nexport type ThemeName = GetAltThemeNames<keyof Themes>\n// export type ThemeNameWithSubThemes = GetSubThemes<ThemeName>\nexport type ThemeKeys = keyof ThemeObject\nexport type ThemeTokens = `$${ThemeKeys}`\nexport type AnimationKeys = Omit<GetAnimationKeys<TamaguiConfig>, number>\n\ntype GetAltThemeNames<S> = (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S) | S\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> = CreateTamaguiConfig<A, B, C, D, E, F> & {\n // TODO need to make it this but this breaks types, revisit\n // animations: E //AnimationDriver<E>\n Provider: (props: TamaguiProviderProps) => any\n // with $ prefixes for fast lookups (one time cost at startup vs every render)\n tokensParsed: CreateTokens<Variable>\n themeConfig: any\n fontsParsed: GenericFonts\n getCSS: () => string\n parsed: boolean\n}\n\nexport type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']['animations']\n\n// prevents const intersections from being clobbered into string, keeping the consts\nexport type UnionableString = string & {}\nexport type UnionableNumber = number & {}\nexport type PropTypes<A extends TamaguiComponent> = A extends React.FunctionComponent<infer Props>\n ? Props\n : unknown\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}\n\n// media\nexport type MediaKeys = keyof Media\nexport type MediaQueryObject = { [key: string]: string | number | string }\nexport type MediaQueryKey = keyof Media\nexport type MediaPropKeys = `$${MediaQueryKey}`\nexport type MediaQueryState = { [key in MediaPropKeys]: boolean }\nexport type MediaProps<A> = {\n [key in MediaPropKeys]?: A\n}\nexport type MediaQueries = {\n [key in MediaQueryKey]: MediaQueryObject\n}\nexport type ConfigureMediaQueryOptions = {\n queries?: MediaQueries\n defaultActive?: MediaQueryKey[]\n}\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\nexport type ColorTokens =\n | GetTokenString<keyof Tokens['color']>\n | GetTokenString<keyof ThemeObject>\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 FontWeightTokens =\n | `$${GetTokenFontKeysFor<'weight'>}`\n | `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`\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 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 PsuedoPropKeys = 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, psuedos...\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> = WithThemeShorthandsAndPseudos<A> &\n MediaProps<WithThemeShorthandsAndPseudos<A>>\n\n//\n// Stack\n//\n\ntype WebOnlyStyleProps = {\n // WEB ONLY\n cursor?: string\n // WEB ONLY\n contain?: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'paint' | string\n // WEB ONLY values: inherit, inline, block, content\n display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'\n // WEB ONLY pointerEvents can be a style prop\n pointerEvents?: ViewProps['pointerEvents']\n}\n\nexport type StackStylePropsBase = Omit<ViewStyle, 'display' | 'backfaceVisibility' | 'elevation'> &\n TransformStyleProps &\n WebOnlyStyleProps\n\nexport type StackPropsBaseShared = Omit<ViewProps, 'display' | 'children'> &\n RNWViewProps &\n TamaguiComponentPropsBase\n\nexport type StackStyleProps = WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>\nexport type StackPropsBase = StackPropsBaseShared & WithThemeAndShorthands<StackStylePropsBase>\nexport type StackProps = StackPropsBaseShared & StackStyleProps\n\nexport type GestureReponderEvent = Exclude<View['props']['onResponderMove'], void> extends (\n event: infer Event\n) => void\n ? Event\n : never\n\n//\n// Text props\n//\n\nexport type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVisibility'> &\n TransformStyleProps &\n WebOnlyStyleProps & {\n ellipse?: boolean\n selectable?: boolean\n textDecorationDistance?: number\n textOverflow?: Properties['textOverflow']\n whiteSpace?: Properties['whiteSpace']\n wordWrap?: Properties['wordWrap']\n }\n\nexport type TextPropsBaseShared = Omit<ReactTextProps, 'children'> &\n RNWTextProps &\n TamaguiComponentPropsBase\nexport type TextPropsBase = TextPropsBaseShared & WithThemeAndShorthands<TextStylePropsBase>\nexport type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>\nexport type TextProps = TextPropsBaseShared & 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: StaticConfig\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 disableInjectCSS?: boolean\n children?: React.ReactNode\n}\n\nexport type PropMapper = (\n key: string,\n value: any,\n theme: ThemeObject,\n props: Record<string, any>,\n state: Partial<SplitStyleState>,\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 StaticConfig = {\n Component?: React.FunctionComponent<any> & StaticComponentObject\n\n variants?: GenericVariantDefinitions\n\n /**\n * Used for applying sub theme style\n */\n componentName?: string\n\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 * Attempts to attach focus styles at runtime (useful for native)\n */\n isInput?: boolean\n\n /**\n * React native web images need special handling for className support\n */\n isImage?: boolean\n\n /**\n * Which style keys are allowed to be extracted.\n */\n validStyles?: { [key: string]: boolean }\n\n /**\n * Same as React.defaultProps, be sure to sync\n */\n defaultProps?: any\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 * Merges into defaultProps later on, used internally yonly\n */\n defaultVariants?: { [key: string]: any }\n\n /**\n * Auto-detect, but can ovverride, passes styles properly to react-native-web\n */\n isReactNativeWeb?: boolean\n\n /**\n * Used internally to keep reference to the original rnw component\n */\n reactNativeWebComponent?: any\n\n /**\n * Memoize the component\n */\n memo?: boolean\n\n /**\n * Auto-detect, but can ovverride, passes styles properly to react-native-web\n */\n isTamagui?: boolean\n\n /**\n * Used internally to handle extractable HoC separate\n */\n isExtractable?: boolean\n\n /**\n * Used insternally to attach default props to names\n */\n parentNames?: string[]\n}\n\n/**\n * --------------------------------------------\n * variants\n * --------------------------------------------\n */\n\nexport type StylableComponent =\n | TamaguiComponent\n | React.Component\n | React.ForwardRefExoticComponent<any>\n | (new (props: any) => any)\n | typeof View\n | typeof Text\n | typeof TextInput\n | typeof Image\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<infer Props>\n ? Props\n : A extends React.Component<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 | '...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 '...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]?: MyProps | 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<A, SizeTokens>\nexport type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ColorTokens>\nexport type FontLineHeightVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontLineHeightTokens\n>\nexport type FontLetterSpacingVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontLetterSpacingTokens\n>\nexport type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontStyleTokens\n>\nexport type FontTransformVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontTransformTokens\n>\nexport type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ZIndexTokens>\nexport type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, RadiusTokens>\nexport type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ThemeTokens>\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 mounted: boolean\n animation?: null | {\n style?: any\n avoidClasses?: boolean\n }\n}\n\nexport type SplitStyleState = TamaguiComponentState & {\n noClassNames?: boolean\n dynamicStylesInline?: boolean\n resolveVariablesAs?: ResolveVariableTypes\n fallbackProps?: Record<string, any>\n}\n\n// Animations:\n\ntype AnimationConfig = {\n [key: string]: any\n}\n\nexport type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {\n avoidClasses?: boolean\n useAnimations: UseAnimationHook\n animations: A\n View?: any\n Text?: any\n}\n\nexport type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>\n\nexport type UseAnimationHelpers = {\n staticConfig: StaticConfigParsed\n getStyle: (props?: {\n isEntering?: boolean\n exitVariant?: string | null\n enterVariant?: string | null\n }) => ViewStyle\n state: SplitStyleState\n pseudos: PseudoProps<ViewStyle>\n // style: ViewStyle | null | undefined\n // isMounted: boolean\n // exitStyle?: ViewStyle | null\n onDidAnimate?: any\n delay?: number\n // mergedStyles(props?: { isExiting?: boolean }): ViewStyle\n}\n\nexport type UseAnimationHook = (\n props: UseAnimationProps,\n helpers: UseAnimationHelpers\n) => {\n style?: StackStylePropsBase | StackStylePropsBase[]\n safeToUnmount?: () => void\n}\n"],
4
+ "sourcesContent": ["// TODO split this into own package @tamagui/types to share with animations packages\n\nimport { Properties } from 'csstype'\nimport React from 'react'\nimport {\n GestureResponderEvent,\n Image,\n TextProps as ReactTextProps,\n Text,\n TextInput,\n TextStyle,\n View,\n ViewProps,\n ViewStyle,\n} from 'react-native'\n\nimport { Variable } from './createVariable'\nimport { ResolveVariableTypes } from './helpers/createPropMapper'\nimport { RNWTextProps, RNWViewProps } from './types-rnw'\nimport { ThemeProviderProps } from './views/ThemeProvider'\n\nexport type SpaceFlexDirection = ViewStyle['flexDirection'] | 'both'\n\nexport type TamaguiElement = HTMLElement | View\n\nexport type DebugProp = boolean | 'break' | 'verbose'\n\n//\n// base props that are accepted by createComponent (additional to react-native-web)\n//\nexport type TamaguiComponentPropsBase = {\n asChild?: boolean\n space?: SpaceTokens\n spaceDirection?: SpaceFlexDirection\n separator?: React.ReactNode\n dangerouslySetInnerHTML?: { __html: string }\n animation?: AnimationProp\n animateOnly?: string[]\n children?: any | any[]\n debug?: DebugProp\n disabled?: boolean\n className?: string\n id?: string\n tag?: string\n theme?: ThemeName | null\n componentName?: string\n onHoverIn?: (e: MouseEvent) => any\n onHoverOut?: (e: MouseEvent) => any\n onPress?: (e: GestureResponderEvent) => any\n onPressIn?: (e: GestureResponderEvent) => any\n onPressOut?: (e: GestureResponderEvent) => any\n // WEB ONLY\n onMouseEnter?: (e: MouseEvent) => any\n onMouseLeave?: (e: MouseEvent) => any\n onMouseDown?: (e: MouseEvent) => any\n // WEB STYLES\n userSelect?: Properties['userSelect']\n cursor?: Properties['cursor']\n}\n\nexport type ReactComponentWithRef<Props, Ref> = React.ForwardRefExoticComponent<\n Props & React.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 | number | symbol\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\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}\ntype GenericShorthands = {\n // [key: string]: string\n}\n\ntype GenericMedia<K extends string = string> = {\n // name => media shorthand name (camelCase) => value\n [key in K]: {\n [key: string]: number | string\n }\n}\n\nexport type GenericFonts = {\n [key: string]: GenericFont\n}\n\ntype GenericAnimations = {\n [key: string]:\n | string\n | {\n [key: string]: any\n }\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> = Partial<Pick<ThemeProviderProps, 'defaultTheme' | 'disableRootThemeClass'>> & {\n fonts: F\n tokens: A\n themes: B\n shorthands: C\n media: D\n animations: AnimationDriver<E>\n defaultProps?: Record<string, Object>\n}\n\n// for use in creation functions so it doesnt get overwrtitten\nexport type GenericTamaguiConfig = CreateTamaguiConfig<\n GenericTokens,\n GenericThemes,\n GenericShorthands,\n GenericMedia,\n GenericAnimations,\n GenericFonts\n>\n\n// since TamaguiConfig will be re-declared, these will all be typed globally\nexport type ThemeObject = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]\nexport type Tokens = TamaguiConfig['tokens']\nexport type Shorthands = TamaguiConfig['shorthands']\nexport type Media = TamaguiConfig['media']\nexport type Themes = TamaguiConfig['themes']\nexport type ThemeName = GetAltThemeNames<keyof Themes>\n// export type ThemeNameWithSubThemes = GetSubThemes<ThemeName>\nexport type ThemeKeys = keyof ThemeObject\nexport type ThemeTokens = `$${ThemeKeys}`\nexport type AnimationKeys = Omit<GetAnimationKeys<TamaguiConfig>, number>\n\ntype GetAltThemeNames<S> = (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S) | S\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> = CreateTamaguiConfig<A, B, C, D, E, F> & {\n // TODO need to make it this but this breaks types, revisit\n // animations: E //AnimationDriver<E>\n Provider: (props: TamaguiProviderProps) => any\n // with $ prefixes for fast lookups (one time cost at startup vs every render)\n tokensParsed: CreateTokens<Variable>\n themeConfig: any\n fontsParsed: GenericFonts\n getCSS: () => string\n parsed: boolean\n\n // just passed in from CreateTamaguiProps\n themeClassNameOnRoot?: boolean\n}\n\nexport type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']['animations']\n\n// prevents const intersections from being clobbered into string, keeping the consts\nexport type UnionableString = string & {}\nexport type UnionableNumber = number & {}\nexport type PropTypes<A extends TamaguiComponent> = A extends React.FunctionComponent<infer Props>\n ? Props\n : unknown\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}\n\n// media\nexport type MediaKeys = keyof Media\nexport type MediaQueryObject = { [key: string]: string | number | string }\nexport type MediaQueryKey = keyof Media\nexport type MediaPropKeys = `$${MediaQueryKey}`\nexport type MediaQueryState = { [key in MediaPropKeys]: boolean }\nexport type MediaProps<A> = {\n [key in MediaPropKeys]?: A\n}\nexport type MediaQueries = {\n [key in MediaQueryKey]: MediaQueryObject\n}\nexport type ConfigureMediaQueryOptions = {\n queries?: MediaQueries\n defaultActive?: MediaQueryKey[]\n}\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\nexport type ColorTokens =\n | GetTokenString<keyof Tokens['color']>\n | GetTokenString<keyof ThemeObject>\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 FontWeightTokens =\n | `$${GetTokenFontKeysFor<'weight'>}`\n | `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`\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 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 PsuedoPropKeys = 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, psuedos...\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> = WithThemeShorthandsAndPseudos<A> &\n MediaProps<WithThemeShorthandsAndPseudos<A>>\n\n//\n// Stack\n//\n\ntype WebOnlyStyleProps = {\n // WEB ONLY\n cursor?: string\n // WEB ONLY\n contain?: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'paint' | string\n // WEB ONLY values: inherit, inline, block, content\n display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'\n // WEB ONLY pointerEvents can be a style prop\n pointerEvents?: ViewProps['pointerEvents']\n}\n\nexport type StackStylePropsBase = Omit<ViewStyle, 'display' | 'backfaceVisibility' | 'elevation'> &\n TransformStyleProps &\n WebOnlyStyleProps\n\nexport type StackPropsBaseShared = Omit<ViewProps, 'display' | 'children'> &\n RNWViewProps &\n TamaguiComponentPropsBase\n\nexport type StackStyleProps = WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>\nexport type StackPropsBase = StackPropsBaseShared & WithThemeAndShorthands<StackStylePropsBase>\nexport type StackProps = StackPropsBaseShared & StackStyleProps\n\nexport type GestureReponderEvent = Exclude<View['props']['onResponderMove'], void> extends (\n event: infer Event\n) => void\n ? Event\n : never\n\n//\n// Text props\n//\n\nexport type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVisibility'> &\n TransformStyleProps &\n WebOnlyStyleProps & {\n ellipse?: boolean\n selectable?: boolean\n textDecorationDistance?: number\n textOverflow?: Properties['textOverflow']\n whiteSpace?: Properties['whiteSpace']\n wordWrap?: Properties['wordWrap']\n }\n\nexport type TextPropsBaseShared = Omit<ReactTextProps, 'children'> &\n RNWTextProps &\n TamaguiComponentPropsBase\nexport type TextPropsBase = TextPropsBaseShared & WithThemeAndShorthands<TextStylePropsBase>\nexport type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>\nexport type TextProps = TextPropsBaseShared & 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: StaticConfig\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 disableInjectCSS?: boolean\n children?: React.ReactNode\n}\n\nexport type PropMapper = (\n key: string,\n value: any,\n theme: ThemeObject,\n props: Record<string, any>,\n state: Partial<SplitStyleState>,\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 StaticConfig = {\n Component?: React.FunctionComponent<any> & StaticComponentObject\n\n variants?: GenericVariantDefinitions\n\n /**\n * Used for applying sub theme style\n */\n componentName?: string\n\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 * Attempts to attach focus styles at runtime (useful for native)\n */\n isInput?: boolean\n\n /**\n * React native web images need special handling for className support\n */\n isImage?: boolean\n\n /**\n * Which style keys are allowed to be extracted.\n */\n validStyles?: { [key: string]: boolean }\n\n /**\n * Same as React.defaultProps, be sure to sync\n */\n defaultProps?: any\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 * Merges into defaultProps later on, used internally yonly\n */\n defaultVariants?: { [key: string]: any }\n\n /**\n * Auto-detect, but can ovverride, passes styles properly to react-native-web\n */\n isReactNativeWeb?: boolean\n\n /**\n * Used internally to keep reference to the original rnw component\n */\n reactNativeWebComponent?: any\n\n /**\n * Memoize the component\n */\n memo?: boolean\n\n /**\n * Auto-detect, but can ovverride, passes styles properly to react-native-web\n */\n isTamagui?: boolean\n\n /**\n * Used internally to handle extractable HoC separate\n */\n isExtractable?: boolean\n\n /**\n * Used insternally to attach default props to names\n */\n parentNames?: string[]\n}\n\n/**\n * --------------------------------------------\n * variants\n * --------------------------------------------\n */\n\nexport type StylableComponent =\n | TamaguiComponent\n | React.Component\n | React.ForwardRefExoticComponent<any>\n | (new (props: any) => any)\n | typeof View\n | typeof Text\n | typeof TextInput\n | typeof Image\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<infer Props>\n ? Props\n : A extends React.Component<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 | '...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 '...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]?: MyProps | 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<A, SizeTokens>\nexport type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ColorTokens>\nexport type FontLineHeightVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontLineHeightTokens\n>\nexport type FontLetterSpacingVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontLetterSpacingTokens\n>\nexport type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontStyleTokens\n>\nexport type FontTransformVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<\n A,\n FontTransformTokens\n>\nexport type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ZIndexTokens>\nexport type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, RadiusTokens>\nexport type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ThemeTokens>\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 mounted: boolean\n animation?: null | {\n style?: any\n avoidClasses?: boolean\n }\n}\n\nexport type SplitStyleState = TamaguiComponentState & {\n noClassNames?: boolean\n dynamicStylesInline?: boolean\n resolveVariablesAs?: ResolveVariableTypes\n fallbackProps?: Record<string, any>\n}\n\n// Animations:\n\ntype AnimationConfig = {\n [key: string]: any\n}\n\nexport type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {\n avoidClasses?: boolean\n useAnimations: UseAnimationHook\n animations: A\n View?: any\n Text?: any\n}\n\nexport type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>\n\nexport type UseAnimationHelpers = {\n staticConfig: StaticConfigParsed\n getStyle: (props?: {\n isEntering?: boolean\n exitVariant?: string | null\n enterVariant?: string | null\n }) => ViewStyle\n state: SplitStyleState\n pseudos: PseudoProps<ViewStyle>\n // style: ViewStyle | null | undefined\n // isMounted: boolean\n // exitStyle?: ViewStyle | null\n onDidAnimate?: any\n delay?: number\n // mergedStyles(props?: { isExiting?: boolean }): ViewStyle\n}\n\nexport type UseAnimationHook = (\n props: UseAnimationProps,\n helpers: UseAnimationHelpers\n) => {\n style?: StackStylePropsBase | StackStylePropsBase[]\n safeToUnmount?: () => void\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -42,10 +42,7 @@ const Theme = (0, import_react.memo)(/* @__PURE__ */ __name(function Theme2(prop
42
42
  }
43
43
  if (import_platform.isWeb) {
44
44
  return /* @__PURE__ */ import_react.default.createElement("span", {
45
- className: [
46
- `tui_Theme`,
47
- ...!props.disableThemeClass ? [props.className, className].filter(Boolean) : []
48
- ].join(" "),
45
+ className: (!props.disableThemeClass ? [props.className, className].filter(Boolean) : []).join(" "),
49
46
  style: {
50
47
  display: "contents",
51
48
  color: (_b = (_a = themes[name]) == null ? void 0 : _a.color) == null ? void 0 : _b.toString()
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../hooks/useTheme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n const missingTheme = !themes || !name || !theme\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => (missingTheme ? null : wrapThemeManagerContext(props.children, themeManager)),\n [props.children, themeManager]\n )\n\n if (missingTheme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n if (isWeb) {\n return (\n <span\n className={[\n `tui_Theme`,\n ...(!props.disableThemeClass ? [props.className, className].filter(Boolean) : []),\n ].join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqC;AAErC,sBAAsB;AACtB,qCAAwC;AACxC,sBAAqC;AAIrC,qBAAM;AAEC,MAAM,QAAQ,uBAAK,uCAAe,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,0CACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,QAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;AAI1C,QAAM,WAAW,0BACf,MAAO,eAAe,OAAO,4DAAwB,MAAM,UAAU,YAAY,GACjF,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,cAAc;AAChB,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,uBAAO;AACT,WACE,mDAAC;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,GAAI,CAAC,MAAM,oBAAoB,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,MACjF,EAAE,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GA1C0B,QA0CzB;",
4
+ "sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { wrapThemeManagerContext } from '../helpers/wrapThemeManagerContext'\nimport { useChangeThemeEffect } from '../hooks/useTheme'\nimport { ThemeProps } from '../hooks/useTheme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n const missingTheme = !themes || !name || !theme\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => (missingTheme ? null : wrapThemeManagerContext(props.children, themeManager)),\n [props.children, themeManager]\n )\n\n if (missingTheme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n if (isWeb) {\n return (\n <span\n className={(!props.disableThemeClass\n ? [props.className, className].filter(Boolean)\n : []\n ).join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: themes[name]?.color?.toString(),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqC;AAErC,sBAAsB;AACtB,qCAAwC;AACxC,sBAAqC;AAIrC,qBAAM;AAEC,MAAM,QAAQ,uBAAK,uCAAe,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,cAAc,0CACvD,MAAM,MACN,MAAM,eACN,KACF;AAEA,QAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;AAI1C,QAAM,WAAW,0BACf,MAAO,eAAe,OAAO,4DAAwB,MAAM,UAAU,YAAY,GACjF,CAAC,MAAM,UAAU,YAAY,CAC/B;AAEA,MAAI,cAAc;AAChB,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAC5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,uBAAO;AACT,WACE,mDAAC;AAAA,MACC,WAAY,EAAC,MAAM,oBACf,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAC3C,CAAC,GACH,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,mBAAO,UAAP,mBAAc,UAAd,mBAAqB;AAAA,MAC9B;AAAA,OAEC,QACH;AAAA,EAEJ;AAEA,SAAO;AACT,GA1C0B,QA0CzB;",
6
6
  "names": []
7
7
  }
@@ -40,9 +40,10 @@ const ThemeProvider = /* @__PURE__ */ __name((props) => {
40
40
  return;
41
41
  }
42
42
  const cn = `${import_constants.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`;
43
- document.body.classList.add(cn);
43
+ const target = props.themeClassNameOnRoot ? document.documentElement : document.body;
44
+ target.classList.add(cn);
44
45
  return () => {
45
- document.body.classList.remove(cn);
46
+ target.classList.remove(cn);
46
47
  };
47
48
  }, [props.defaultTheme, props.disableRootThemeClass]);
48
49
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/ThemeProvider.tsx"],
4
- "sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getHasConfigured } from '../conf'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n document.body.classList.add(cn)\n return () => {\n document.body.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass])\n }\n\n const themeContext = useMemo(() => {\n return {\n themes: props.themes,\n defaultTheme: props.defaultTheme,\n }\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgD;AAEhD,kBAAiC;AACjC,uBAAuC;AACvC,0BAA6B;AAC7B,mBAAsB;AAGtB,qBAAM;AAWC,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,kCAAiB,GAAG;AACvB,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,sCAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,0CAAyB,MAAM;AAC7C,eAAS,KAAK,UAAU,IAAI,EAAE;AAC9B,aAAO,MAAM;AACX,iBAAS,KAAK,UAAU,OAAO,EAAE;AAAA,MACnC;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,qBAAqB,CAAC;AAAA,EACtD;AAEA,QAAM,eAAe,0BAAQ,MAAM;AACjC,WAAO;AAAA,MACL,QAAQ,MAAM;AAAA,MACd,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SACE,mDAAC,iCAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,KAC5B,mDAAC;AAAA,IACC,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA,IACZ,mBAAmB,MAAM;AAAA,KAExB,MAAM,QACT,CACF;AAEJ,GArC6B;",
4
+ "sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getHasConfigured } from '../conf'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n const target = props.themeClassNameOnRoot ? document.documentElement : document.body\n target.classList.add(cn)\n return () => {\n target.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass])\n }\n\n const themeContext = useMemo(() => {\n return {\n themes: props.themes,\n defaultTheme: props.defaultTheme,\n }\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgD;AAEhD,kBAAiC;AACjC,uBAAuC;AACvC,0BAA6B;AAC7B,mBAAsB;AAGtB,qBAAM;AAYC,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,kCAAiB,GAAG;AACvB,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,sCAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,0CAAyB,MAAM;AAC7C,YAAM,SAAS,MAAM,uBAAuB,SAAS,kBAAkB,SAAS;AAChF,aAAO,UAAU,IAAI,EAAE;AACvB,aAAO,MAAM;AACX,eAAO,UAAU,OAAO,EAAE;AAAA,MAC5B;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,qBAAqB,CAAC;AAAA,EACtD;AAEA,QAAM,eAAe,0BAAQ,MAAM;AACjC,WAAO;AAAA,MACL,QAAQ,MAAM;AAAA,MACd,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SACE,mDAAC,iCAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,KAC5B,mDAAC;AAAA,IACC,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA,IACZ,mBAAmB,MAAM;AAAA,KAExB,MAAM,QACT,CACF;AAEJ,GAtC6B;",
6
6
  "names": []
7
7
  }
@@ -34,9 +34,6 @@ const getValueFromIdentifier = /* @__PURE__ */ __name((identifier) => {
34
34
  const setIdentifierValue = /* @__PURE__ */ __name((identifier, value) => {
35
35
  identifierToValue.set(identifier, value);
36
36
  }, "setIdentifierValue");
37
- if (!globalThis["Tamagui"]) {
38
- globalThis["Tamagui"] = Tamagui;
39
- }
40
37
  export {
41
38
  Tamagui,
42
39
  getValueFromIdentifier,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Tamagui.ts"],
4
- "sourcesContent": ["import * as Helpers from '@tamagui/helpers'\n\nimport { getConfig } from './conf'\nimport { rnw } from './constants/rnw'\nimport { getAllSelectors, getAllTransforms, getInsertedRules } from './helpers/insertStyleRule'\n\n// serves a central store for state\n\nclass TamaguiManager {\n rnw = rnw\n Helpers = Helpers\n\n get config() {\n return getConfig()\n }\n\n get insertedRules() {\n return getInsertedRules()\n }\n\n get allSelectors() {\n return getAllSelectors()\n }\n\n get allTransforms() {\n return getAllTransforms()\n }\n\n get identifierToValue() {\n return identifierToValue\n }\n}\n\nexport const Tamagui = new TamaguiManager()\n\nconst identifierToValue = new Map<string, any>()\n\nexport const getValueFromIdentifier = (identifier: string) => {\n return identifierToValue.get(identifier)\n}\n\nexport const setIdentifierValue = (identifier: string, value: any) => {\n identifierToValue.set(identifier, value)\n}\n\nif (!globalThis['Tamagui']) {\n globalThis['Tamagui'] = Tamagui\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM,eAAe;AAAA,EAArB;AACE,eAAM;AACN,mBAAU;AAAA;AAAA,EAEV,IAAI,SAAS;AACX,WAAO,UAAU;AAAA,EACnB;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,iBAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,gBAAgB;AAAA,EACzB;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,iBAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,oBAAoB;AACtB,WAAO;AAAA,EACT;AACF;AAvBM;AAyBC,MAAM,UAAU,IAAI,eAAe;AAE1C,MAAM,oBAAoB,oBAAI,IAAiB;AAExC,MAAM,yBAAyB,wBAAC,eAAuB;AAC5D,SAAO,kBAAkB,IAAI,UAAU;AACzC,GAFsC;AAI/B,MAAM,qBAAqB,wBAAC,YAAoB,UAAe;AACpE,oBAAkB,IAAI,YAAY,KAAK;AACzC,GAFkC;AAIlC,IAAI,CAAC,WAAW,YAAY;AAC1B,aAAW,aAAa;AAC1B;",
4
+ "sourcesContent": ["import * as Helpers from '@tamagui/helpers'\n\nimport { getConfig } from './conf'\nimport { rnw } from './constants/rnw'\nimport { getAllSelectors, getAllTransforms, getInsertedRules } from './helpers/insertStyleRule'\n\n// serves a central store for state\n\nclass TamaguiManager {\n rnw = rnw\n Helpers = Helpers\n\n get config() {\n return getConfig()\n }\n\n get insertedRules() {\n return getInsertedRules()\n }\n\n get allSelectors() {\n return getAllSelectors()\n }\n\n get allTransforms() {\n return getAllTransforms()\n }\n\n get identifierToValue() {\n return identifierToValue\n }\n}\n\nexport const Tamagui = new TamaguiManager()\n\nconst identifierToValue = new Map<string, any>()\n\nexport const getValueFromIdentifier = (identifier: string) => {\n return identifierToValue.get(identifier)\n}\n\nexport const setIdentifierValue = (identifier: string, value: any) => {\n identifierToValue.set(identifier, value)\n}\n"],
5
+ "mappings": ";;AAAA;AAEA;AACA;AACA;AAIA,MAAM,eAAe;AAAA,EAArB;AACE,eAAM;AACN,mBAAU;AAAA;AAAA,EAEV,IAAI,SAAS;AACX,WAAO,UAAU;AAAA,EACnB;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,iBAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,gBAAgB;AAAA,EACzB;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,iBAAiB;AAAA,EAC1B;AAAA,EAEA,IAAI,oBAAoB;AACtB,WAAO;AAAA,EACT;AACF;AAvBM;AAyBC,MAAM,UAAU,IAAI,eAAe;AAE1C,MAAM,oBAAoB,oBAAI,IAAiB;AAExC,MAAM,yBAAyB,wBAAC,eAAuB;AAC5D,SAAO,kBAAkB,IAAI,UAAU;AACzC,GAFsC;AAI/B,MAAM,qBAAqB,wBAAC,YAAoB,UAAe;AACpE,oBAAkB,IAAI,YAAY,KAAK;AACzC,GAFkC;",
6
6
  "names": []
7
7
  }
@@ -185,7 +185,7 @@ class ThemeManager {
185
185
  __name(ThemeManager, "ThemeManager");
186
186
  _getClassName = new WeakSet();
187
187
  getClassName_fn = /* @__PURE__ */ __name(function(name) {
188
- return `${THEME_CLASSNAME_PREFIX}${name} tui_theme`.replace("light_", "").replace("dark_", "");
188
+ return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace("light_", "").replace("dark_", "");
189
189
  }, "#getClassName");
190
190
  const ThemeManagerContext = createContext(null);
191
191
  const emptyManager = new ThemeManager();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ThemeManager.tsx"],
4
- "sourcesContent": ["import { createContext } from 'react'\n\nimport { getThemes } from './conf'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from './constants/constants'\nimport { ThemeObject, Themes } from './types'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport type SetActiveThemeProps = {\n className?: string\n parentManager?: ThemeManager | null\n name?: string | null\n theme?: any\n}\n\nexport type GetNextThemeProps = {\n themes?: Themes\n name?: string | null\n componentName?: string | null\n reset?: boolean\n}\n\nexport class ThemeManager {\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n className: string | null = null\n\n constructor(\n public name: string = '',\n public theme: ThemeObject | null = null,\n public parentManager: ThemeManager | null = null,\n public reset: boolean = false\n ) {\n // find the nearest different parentManager\n let parent = parentManager\n let tries = 0\n while (true) {\n tries++\n if (tries > 10) {\n throw new Error(`Nested 10 of the same theme in a row, likely error`)\n }\n if (!parent) break\n if (parent.name === name) {\n // go up if same\n parent = parent.parentManager\n } else {\n this.parentManager = parent\n break\n }\n }\n }\n\n get parentName() {\n return this.parentManager?.name || null\n }\n\n get fullName(): string {\n return this.getNextTheme().name || this.name || ''\n // const parentName = this.parentManager?.fullName || ''\n // const name = this.name || ''\n // const parts = [...new Set([...`${parentName}_${name}`.split('_')])].filter(Boolean)\n // return parts.join('_')\n }\n\n // gets value going up to parents\n getValue(key: string) {\n let theme = this.theme\n let manager = this as ThemeManager | null\n while (true) {\n if (!theme) return\n if (key in theme) {\n return theme[key]\n }\n manager = this.parentManager\n if (!manager) {\n return\n }\n if (manager.theme === theme) {\n return\n }\n theme = manager.theme\n }\n }\n\n update({ name, theme, className }: SetActiveThemeProps = {}) {\n // className compare on web, avoids light/dark re-renders\n const nameChanged = name !== this.name\n if (!nameChanged) {\n return false\n }\n this.className = className || null\n this.name = name || ''\n this.theme = theme\n this.notifyListeners()\n return true\n }\n\n getNextTheme(props: GetNextThemeProps = {}, debug?: any) {\n const { themes = getThemes(), name, componentName } = props\n\n if (props.reset && name) {\n return {\n name: name,\n theme: themes[name],\n className: this.#getClassName(name),\n }\n }\n\n const parentIsReset = this.parentManager?.reset\n\n if (!name) {\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${this.name}_${componentName}`,\n `${withoutComponentName(this.name)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n const className = this.#getClassName(name)\n return { name, theme: themes[name], className }\n }\n }\n }\n return {\n name: this.name,\n theme: this.theme,\n }\n }\n\n let nextName = name || this.name || ''\n let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName\n\n while (true) {\n if (nextName in themes) {\n break\n }\n nextName = `${parentName}_${name}`\n if (nextName in themes) {\n break\n }\n if (!parentName.includes(THEME_NAME_SEPARATOR)) {\n // not found!\n console.warn('theme not found', name)\n // this happens in next during _document.getInitialProps and has a terrible/non-existent stack trace\n // throw new Error(`Theme not found: ${name}`)\n break\n }\n // go up one\n parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR))\n }\n\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${nextName}_${componentName}`,\n `${withoutComponentName(nextName)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n nextName = name\n }\n }\n }\n\n let theme = themes[nextName]\n if (!theme) {\n theme = themes[`light_${nextName}`]\n }\n\n if (process.env.NODE_ENV === 'development' && debug) {\n console.log('getNextTheme', { props, nextName, parentName }, this)\n }\n\n return {\n name: nextName,\n theme,\n className: this.#getClassName(nextName),\n }\n }\n\n #getClassName(name: string) {\n return `${THEME_CLASSNAME_PREFIX}${name} tui_theme`.replace('light_', '').replace('dark_', '')\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n notifyListeners() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager | null>(null)\nexport const emptyManager = new ThemeManager()\n\nconst withoutComponentName = (name: string) => name.replace(/(\\_[A-Z][a-zA-Z]+)+$/g, '')\n"],
5
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAEA;AACA;AAmBO,MAAM,aAAa;AAAA,EAMxB,YACS,OAAe,IACf,QAA4B,MAC5B,gBAAqC,MACrC,QAAiB,OACxB;AAJO;AACA;AACA;AACA;AAsJT;AA/JA,gBAAO,oBAAI,IAAsB;AACjC,qBAAY,oBAAI,IAAmB;AACnC,0BAAiB,oBAAI,IAAmB;AACxC,qBAA2B;AASzB,QAAI,SAAS;AACb,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AAAA,IACnE;AAEA,WAAO;AAAA,MACL,MAAM;AAAA,MACN;AAAA,MACA,WAAW,sBAAK,gCAAL,WAAmB;AAAA,IAChC;AAAA,EACF;AAAA,EAMA,MAAM,MAAW,MAAmB;AAClC,QAAI,CAAC,KAAK;AAAM;AAChB,SAAK,KAAK,IAAI,MAAM,IAAI;AAAA,EAC1B;AAAA,EAEA,kBAAkB;AA/LpB;AAgMI,QAAI,CAAC,KAAK,MAAM;AACd,WAAK,KAAK,MAAM;AAAA,IAClB;AACA,eAAW,CAAC,MAAM,SAAS,KAAK,KAAK,QAAQ,GAAG;AAC9C,UAAI,KAAK,MAAM;AACb,mBAAK,UAAU,IAAI,IAAI,MAAvB;AAAA,MACF;AAAA,IACF;AACA,SAAK,eAAe,QAAQ,CAAC,OAAO,GAAG,KAAK,MAAM,IAAI,CAAC;AAAA,EACzD;AAAA,EAEA,cAAc,IAAmB;AAC/B,SAAK,eAAe,IAAI,EAAE;AAC1B,WAAO,MAAM;AACX,WAAK,eAAe,OAAO,EAAE;AAAA,IAC/B;AAAA,EACF;AAAA,EAEA,SAAS,MAAW,IAAc;AAChC,SAAK,UAAU,IAAI,MAAM,EAAE;AAC3B,WAAO,MAAM;AACX,WAAK,UAAU,OAAO,IAAI;AAC1B,WAAK,KAAK,OAAO,IAAI;AAAA,IACvB;AAAA,EACF;AACF;AAnMa;AAgKX;AAAA,kBAAa,gCAAC,MAAc;AAC1B,SAAO,GAAG,yBAAyB,iBAAiB,QAAQ,UAAU,EAAE,EAAE,QAAQ,SAAS,EAAE;AAC/F,GAFa;AAqCR,MAAM,sBAAsB,cAAmC,IAAI;AACnE,MAAM,eAAe,IAAI,aAAa;AAE7C,MAAM,uBAAuB,wBAAC,SAAiB,KAAK,QAAQ,yBAAyB,EAAE,GAA1D;",
4
+ "sourcesContent": ["import { createContext } from 'react'\n\nimport { getThemes } from './conf'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from './constants/constants'\nimport { ThemeObject, Themes } from './types'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport type SetActiveThemeProps = {\n className?: string\n parentManager?: ThemeManager | null\n name?: string | null\n theme?: any\n}\n\nexport type GetNextThemeProps = {\n themes?: Themes\n name?: string | null\n componentName?: string | null\n reset?: boolean\n}\n\nexport class ThemeManager {\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n className: string | null = null\n\n constructor(\n public name: string = '',\n public theme: ThemeObject | null = null,\n public parentManager: ThemeManager | null = null,\n public reset: boolean = false\n ) {\n // find the nearest different parentManager\n let parent = parentManager\n let tries = 0\n while (true) {\n tries++\n if (tries > 10) {\n throw new Error(`Nested 10 of the same theme in a row, likely error`)\n }\n if (!parent) break\n if (parent.name === name) {\n // go up if same\n parent = parent.parentManager\n } else {\n this.parentManager = parent\n break\n }\n }\n }\n\n get parentName() {\n return this.parentManager?.name || null\n }\n\n get fullName(): string {\n return this.getNextTheme().name || this.name || ''\n // const parentName = this.parentManager?.fullName || ''\n // const name = this.name || ''\n // const parts = [...new Set([...`${parentName}_${name}`.split('_')])].filter(Boolean)\n // return parts.join('_')\n }\n\n // gets value going up to parents\n getValue(key: string) {\n let theme = this.theme\n let manager = this as ThemeManager | null\n while (true) {\n if (!theme) return\n if (key in theme) {\n return theme[key]\n }\n manager = this.parentManager\n if (!manager) {\n return\n }\n if (manager.theme === theme) {\n return\n }\n theme = manager.theme\n }\n }\n\n update({ name, theme, className }: SetActiveThemeProps = {}) {\n // className compare on web, avoids light/dark re-renders\n const nameChanged = name !== this.name\n if (!nameChanged) {\n return false\n }\n this.className = className || null\n this.name = name || ''\n this.theme = theme\n this.notifyListeners()\n return true\n }\n\n getNextTheme(props: GetNextThemeProps = {}, debug?: any) {\n const { themes = getThemes(), name, componentName } = props\n\n if (props.reset && name) {\n return {\n name: name,\n theme: themes[name],\n className: this.#getClassName(name),\n }\n }\n\n const parentIsReset = this.parentManager?.reset\n\n if (!name) {\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${this.name}_${componentName}`,\n `${withoutComponentName(this.name)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n const className = this.#getClassName(name)\n return { name, theme: themes[name], className }\n }\n }\n }\n return {\n name: this.name,\n theme: this.theme,\n }\n }\n\n let nextName = name || this.name || ''\n let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName\n\n while (true) {\n if (nextName in themes) {\n break\n }\n nextName = `${parentName}_${name}`\n if (nextName in themes) {\n break\n }\n if (!parentName.includes(THEME_NAME_SEPARATOR)) {\n // not found!\n console.warn('theme not found', name)\n // this happens in next during _document.getInitialProps and has a terrible/non-existent stack trace\n // throw new Error(`Theme not found: ${name}`)\n break\n }\n // go up one\n parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR))\n }\n\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${nextName}_${componentName}`,\n `${withoutComponentName(nextName)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n nextName = name\n }\n }\n }\n\n let theme = themes[nextName]\n if (!theme) {\n theme = themes[`light_${nextName}`]\n }\n\n if (process.env.NODE_ENV === 'development' && debug) {\n console.log('getNextTheme', { props, nextName, parentName }, this)\n }\n\n return {\n name: nextName,\n theme,\n className: this.#getClassName(nextName),\n }\n }\n\n #getClassName(name: string) {\n return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace('light_', '').replace('dark_', '')\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n notifyListeners() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager | null>(null)\nexport const emptyManager = new ThemeManager()\n\nconst withoutComponentName = (name: string) => name.replace(/(\\_[A-Z][a-zA-Z]+)+$/g, '')\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAEA;AACA;AAmBO,MAAM,aAAa;AAAA,EAMxB,YACS,OAAe,IACf,QAA4B,MAC5B,gBAAqC,MACrC,QAAiB,OACxB;AAJO;AACA;AACA;AACA;AAsJT;AA/JA,gBAAO,oBAAI,IAAsB;AACjC,qBAAY,oBAAI,IAAmB;AACnC,0BAAiB,oBAAI,IAAmB;AACxC,qBAA2B;AASzB,QAAI,SAAS;AACb,QAAI,QAAQ;AACZ,WAAO,MAAM;AACX;AACA,UAAI,QAAQ,IAAI;AACd,cAAM,IAAI,MAAM,oDAAoD;AAAA,MACtE;AACA,UAAI,CAAC;AAAQ;AACb,UAAI,OAAO,SAAS,MAAM;AAExB,iBAAS,OAAO;AAAA,MAClB,OAAO;AACL,aAAK,gBAAgB;AACrB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,IAAI,aAAa;AArDnB;AAsDI,WAAO,YAAK,kBAAL,mBAAoB,SAAQ;AAAA,EACrC;AAAA,EAEA,IAAI,WAAmB;AACrB,WAAO,KAAK,aAAa,EAAE,QAAQ,KAAK,QAAQ;AAAA,EAKlD;AAAA,EAGA,SAAS,KAAa;AACpB,QAAI,QAAQ,KAAK;AACjB,QAAI,UAAU;AACd,WAAO,MAAM;AACX,UAAI,CAAC;AAAO;AACZ,UAAI,OAAO,OAAO;AAChB,eAAO,MAAM;AAAA,MACf;AACA,gBAAU,KAAK;AACf,UAAI,CAAC,SAAS;AACZ;AAAA,MACF;AACA,UAAI,QAAQ,UAAU,OAAO;AAC3B;AAAA,MACF;AACA,cAAQ,QAAQ;AAAA,IAClB;AAAA,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;AAC3B,WAAO,MAAM;AACX,WAAK,UAAU,OAAO,IAAI;AAC1B,WAAK,KAAK,OAAO,IAAI;AAAA,IACvB;AAAA,EACF;AACF;AAnMa;AAgKX;AAAA,kBAAa,gCAAC,MAAc;AAC1B,SAAO,GAAG,yBAAyB,eAAe,QAAQ,UAAU,EAAE,EAAE,QAAQ,SAAS,EAAE;AAC7F,GAFa;AAqCR,MAAM,sBAAsB,cAAmC,IAAI;AACnE,MAAM,eAAe,IAAI,aAAa;AAE7C,MAAM,uBAAuB,wBAAC,SAAiB,KAAK,QAAQ,yBAAyB,EAAE,GAA1D;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import { isWeb } from "./platform";
2
2
  const THEME_NAME_SEPARATOR = "_";
3
- const THEME_CLASSNAME_PREFIX = `tui_`;
3
+ const THEME_CLASSNAME_PREFIX = `t_`;
4
4
  const stackDefaultStyles = {
5
5
  alignItems: "stretch",
6
6
  flexShrink: 0,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/constants/constants.ts"],
4
- "sourcesContent": ["import { isWeb } from './platform'\n\nexport const THEME_NAME_SEPARATOR = '_'\nexport const THEME_CLASSNAME_PREFIX = `tui_`\n\nexport const stackDefaultStyles = {\n alignItems: 'stretch',\n flexShrink: 0,\n // more accurately match react-native defaults on web\n ...(isWeb && {\n display: 'flex',\n flexBasis: 'auto',\n boxSizing: 'border-box',\n }),\n}\n"],
4
+ "sourcesContent": ["import { isWeb } from './platform'\n\nexport const THEME_NAME_SEPARATOR = '_'\nexport const THEME_CLASSNAME_PREFIX = `t_`\n\nexport const stackDefaultStyles = {\n alignItems: 'stretch',\n flexShrink: 0,\n // more accurately match react-native defaults on web\n ...(isWeb && {\n display: 'flex',\n flexBasis: 'auto',\n boxSizing: 'border-box',\n }),\n}\n"],
5
5
  "mappings": "AAAA;AAEO,MAAM,uBAAuB;AAC7B,MAAM,yBAAyB;AAE/B,MAAM,qBAAqB;AAAA,EAChC,YAAY;AAAA,EACZ,YAAY;AAAA,EAEZ,GAAI,SAAS;AAAA,IACX,SAAS;AAAA,IACT,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;",
6
6
  "names": []
7
7
  }
@@ -577,7 +577,7 @@ function createComponent(configIn, ParentComponent) {
577
577
  const shouldWrapWithHover = events && attachHover;
578
578
  if (shouldWrapWithHover || shouldWrapWithComponentTheme) {
579
579
  const themeClassName = shouldWrapWithComponentTheme ? `${theme.className}` : "";
580
- const hoverClassName = shouldWrapWithHover ? "tui_Hoverable" : "";
580
+ const hoverClassName = shouldWrapWithHover ? "t_Hoverable" : "";
581
581
  content = /* @__PURE__ */ React.createElement("span", {
582
582
  className: `${hoverClassName} ${themeClassName}`,
583
583
  style: {