@tamagui/core 1.0.1-beta.206 → 1.0.1-beta.208

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/getSplitStyles.tsx"],
4
- "sourcesContent": ["import { isClient, isRSC, isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { stylePropsText, stylePropsTransform, validPseudoKeys, validStyles } from '@tamagui/helpers'\nimport type { ViewStyle } from '@tamagui/types-react-native'\nimport { useInsertionEffect } from 'react'\n\nimport { getConfig } from '../config'\nimport { isDevTools } from '../constants/isDevTools'\nimport {\n mediaState as globalMediaState,\n mediaQueryConfig,\n mergeMediaByImportance,\n} from '../hooks/useMedia'\nimport type {\n DebugProp,\n MediaQueryKey,\n PseudoPropKeys,\n PseudoStyles,\n SplitStyleState,\n StackProps,\n StaticConfigParsed,\n TamaguiInternalConfig,\n ThemeParsed,\n} from '../types'\nimport { FontLanguageProps, LanguageContextType } from '../views/FontLanguage.types'\nimport { createMediaStyle } from './createMediaStyle'\nimport { getPropMappedFontFamily } from './createPropMapper'\nimport { createProxy } from './createProxy'\nimport { fixStyles } from './expandStyles'\nimport { getAtomicStyle, getStylesAtomic, styleToCSS } from './getStylesAtomic'\nimport {\n PartialStyleObject,\n RulesToInsert,\n insertStyleRules,\n insertedTransforms,\n shouldInsertStyleRules,\n updateInserted,\n updateRules,\n} from './insertStyleRule'\nimport { mergeTransform } from './mergeTransform'\nimport {\n normalizeValueWithProperty,\n reverseMapClassNameToValue,\n} from './normalizeValueWithProperty.js'\nimport { pseudoDescriptors } from './pseudoDescriptors'\n\nexport type SplitStyles = ReturnType<typeof getSplitStyles>\nexport type ClassNamesObject = Record<string, string>\nexport type SplitStyleResult = ReturnType<typeof getSplitStyles>\n\nconst skipProps = {\n animation: true,\n animateOnly: true,\n debug: true,\n componentName: true,\n role: true,\n tag: true,\n}\n\nconst emptyObject = {}\nconst IS_STATIC = process.env.IS_STATIC === 'is_static'\n\n// native only skips\nif (process.env.TAMAGUI_TARGET === 'native') {\n Object.assign(skipProps, {\n whiteSpace: true,\n wordWrap: true,\n textOverflow: true,\n textDecorationDistance: true,\n userSelect: true,\n selectable: true,\n cursor: true,\n contain: true,\n boxSizing: true,\n boxShadow: true,\n })\n}\n\n// web only maps accessibility to aria props\nconst accessibilityDirectMap: Record<string, string> = {}\nif (process.env.TAMAGUI_TARGET === 'web') {\n // bundle size shave\n const items = {\n Hidden: true,\n ActiveDescendant: true,\n Atomic: true,\n AutoComplete: true,\n Busy: true,\n Checked: true,\n ColumnCount: 'colcount',\n ColumnIndex: 'colindex',\n ColumnSpan: 'colspan',\n Current: true,\n Details: true,\n ErrorMessage: true,\n Expanded: true,\n HasPopup: true,\n Invalid: true,\n Label: true,\n Level: true,\n Modal: true,\n Multiline: true,\n MultiSelectable: true,\n Orientation: true,\n Owns: true,\n Placeholder: true,\n PosInSet: true,\n Pressed: true,\n RoleDescription: true,\n RowCount: true,\n RowIndex: true,\n RowSpan: true,\n Selected: true,\n SetSize: true,\n Sort: true,\n ValueMax: true,\n ValueMin: true,\n ValueNow: true,\n ValueText: true,\n }\n for (const key in items) {\n let val = items[key]\n if (val === true) {\n val = key.toLowerCase()\n }\n accessibilityDirectMap[`accessibility${key}`] = `aria-${val}`\n }\n}\n\ntype TransformNamespaceKey = 'transform' | PseudoPropKeys | MediaQueryKey\n\nlet conf: TamaguiInternalConfig\n\ntype SplitStylesAndProps = {\n pseudos: PseudoStyles\n medias: Record<MediaQueryKey, ViewStyle>\n style: ViewStyle\n classNames: ClassNamesObject\n rulesToInsert: RulesToInsert\n viewProps: StackProps & Record<string, any>\n fontFamily: string | undefined\n mediaKeys: string[]\n}\n\ntype StyleSplitter = (\n props: { [key: string]: any },\n staticConfig: StaticConfigParsed,\n theme: ThemeParsed,\n state: SplitStyleState,\n parentSplitStyles?: SplitStylesAndProps | null,\n languageContext?: LanguageContextType,\n // web-only\n elementType?: string,\n debug?: DebugProp\n) => SplitStylesAndProps\n\nexport const PROP_SPLIT = '-'\n\nconst accessibilityRoleToWebRole = {\n adjustable: 'slider',\n header: 'heading',\n image: 'img',\n link: 'link',\n none: 'presentation',\n summary: 'region',\n}\n\n// loop props backwards\n// track used keys:\n// const keys = new Set<string>()\n// keep classnames and styles separate:\n// const styles = {}\n// const classNames = {}\n\nconst isMediaKey = (key: string) => Boolean(key[0] === '$' && mediaQueryConfig[key.slice(1)])\n\nexport const getSplitStyles: StyleSplitter = (\n props,\n staticConfig,\n theme,\n state,\n parentSplitStyles,\n languageContext,\n elementType,\n debug\n) => {\n conf = conf || getConfig()\n const validStyleProps = staticConfig.isText ? stylePropsText : validStyles\n const mediaKeys: string[] = []\n const viewProps: SplitStylesAndProps['viewProps'] = {}\n const pseudos: PseudoStyles = {}\n const medias: Record<MediaQueryKey, ViewStyle> = {}\n const mediaState = state.mediaState || globalMediaState\n const usedKeys: Record<string, number> = {}\n const propKeys = Object.keys(props)\n\n const shouldDoClasses =\n staticConfig.acceptsClassName && (isWeb || IS_STATIC) && !state.noClassNames\n\n let style: ViewStyle = {}\n\n const len = propKeys.length\n const rulesToInsert: RulesToInsert = []\n const classNames: ClassNamesObject = {}\n // we need to gather these specific to each media query / pseudo\n // value is [hash, val], so [\"-jnjad-asdnjk\", \"scaleX(1) rotate(10deg)\"]\n const transforms: Record<TransformNamespaceKey, [string, string]> = {}\n // fontFamily is our special baby, ensure we grab the latest set one always\n let fontFamily: string | undefined\n\n // loop backwards so we can skip already-used props\n for (let i = len - 1; i >= 0; i--) {\n let keyInit = propKeys[i]\n const valInit = props[keyInit]\n\n // normalize shorthands up front\n const expandedKey = conf.shorthands[keyInit]\n if (expandedKey) {\n keyInit = expandedKey\n }\n\n if (usedKeys[keyInit]) continue\n if (skipProps[keyInit]) continue\n if (!isWeb && keyInit.startsWith('data-')) continue\n\n if (keyInit === 'style' || keyInit.startsWith('_style')) {\n if (!valInit) continue\n const styles = Array.isArray(valInit) ? valInit : [valInit]\n const styleLen = styles.length\n for (let j = styleLen; j >= 0; j--) {\n const cur = styles[j]\n if (!cur) continue\n for (const key in cur) {\n if (usedKeys[key]) continue\n usedKeys[key] = 1\n style[key] = cur[key]\n }\n }\n continue\n }\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n /**\n * Copying in the accessibility/prop handling from react-native-web here\n * Keeps it in a single loop, avoids dup de-structuring to avoid bundle size\n */\n if (keyInit === 'disabled' && valInit === true) {\n usedKeys[keyInit] = 1\n viewProps['aria-disabled'] = true\n // Enhance with native semantics\n if (\n elementType === 'button' ||\n elementType === 'form' ||\n elementType === 'input' ||\n elementType === 'select' ||\n elementType === 'textarea'\n ) {\n viewProps.disabled = true\n }\n if (!staticConfig.variants?.disabled) {\n continue\n }\n }\n\n if (keyInit === 'id' || keyInit === 'nativeID') {\n usedKeys[keyInit] = 1\n if (staticConfig.isReactNative) {\n viewProps.nativeID = valInit\n } else {\n viewProps.id = valInit\n }\n continue\n }\n\n let didUseKeyInit = true\n\n if (staticConfig.isReactNative) {\n didUseKeyInit = false\n } else {\n if (accessibilityDirectMap[keyInit]) {\n viewProps[accessibilityDirectMap[keyInit]] = valInit\n usedKeys[keyInit] = 1\n continue\n }\n\n switch (keyInit) {\n case 'accessibilityRole': {\n if (valInit === 'none') {\n viewProps.role = 'presentation'\n } else {\n viewProps.role = accessibilityRoleToWebRole[valInit] || valInit\n }\n break\n }\n case 'accessibilityControls': {\n viewProps['aria-controls'] = processIDRefList(valInit)\n break\n }\n case 'accessibilityDescribedBy': {\n viewProps['aria-describedby'] = processIDRefList(valInit)\n break\n }\n case 'accessibilityFlowTo': {\n viewProps['aria-flowto'] = processIDRefList(valInit)\n break\n }\n case 'accessibilityLabelledBy': {\n viewProps['aria-labelledby'] = processIDRefList(valInit)\n break\n }\n case 'accessibilityKeyShortcuts': {\n if (Array.isArray(valInit)) {\n viewProps['aria-keyshortcuts'] = valInit.join(' ')\n }\n break\n }\n case 'accessibilityLiveRegion': {\n viewProps['aria-live'] = valInit === 'none' ? 'off' : valInit\n break\n }\n case 'accessibilityReadOnly': {\n viewProps['aria-readonly'] = valInit\n // Enhance with native semantics\n if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {\n viewProps.readOnly = true\n }\n break\n }\n case 'accessibilityRequired': {\n viewProps['aria-required'] = valInit\n // Enhance with native semantics\n if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {\n viewProps.required = true\n }\n break\n }\n default: {\n didUseKeyInit = false\n }\n }\n }\n\n if (didUseKeyInit) {\n usedKeys[keyInit] = 1\n continue\n }\n\n if (keyInit === 'className') {\n let nonTamaguis = ''\n if (!valInit) continue\n for (const cn of valInit.split(' ')) {\n if (cn[0] === '_') {\n // tamagui, merge it expanded on key, eventually this will go away with better compiler\n const [shorthand, mediaOrPseudo] = cn.slice(1).split('-')\n const isMedia = mediaOrPseudo[0] === '_'\n const isPseudo = mediaOrPseudo[0] === '0'\n const isMediaOrPseudo = isMedia || isPseudo\n let fullKey = conf.shorthands[shorthand]\n if (isMedia) {\n // is media\n let mediaShortKey = mediaOrPseudo.slice(1)\n mediaShortKey = mediaShortKey.slice(0, mediaShortKey.indexOf('_'))\n fullKey += `${PROP_SPLIT}${mediaShortKey}`\n } else if (isPseudo) {\n // is pseudo\n const pseudoShortKey = mediaOrPseudo.slice(1)\n fullKey += `${PROP_SPLIT}${pseudoShortKey}`\n }\n usedKeys[fullKey] = 1\n mergeClassName(transforms, classNames, fullKey, cn, isMediaOrPseudo)\n } else {\n nonTamaguis += ' ' + cn\n }\n }\n if (nonTamaguis) {\n usedKeys[keyInit] = 1\n mergeClassName(transforms, classNames, keyInit, nonTamaguis)\n }\n continue\n }\n\n if (valInit && valInit[0] === '_') {\n // if valid style key (or pseudo like color-hover):\n // this conditional and esp the pseudo check rarely runs so not a perf issue\n const isValidClassName = validStyles[keyInit]\n const isMediaOrPseudo =\n !isValidClassName &&\n keyInit.includes(PROP_SPLIT) &&\n validStyles[keyInit.split(PROP_SPLIT)[0]]\n if (isValidClassName || isMediaOrPseudo) {\n usedKeys[keyInit] = 1\n mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo)\n continue\n }\n }\n }\n\n if (state.keepVariantsAsProps) {\n if (\n (staticConfig.defaultVariants && keyInit in staticConfig.defaultVariants) ||\n // may want to just: not compile styled() into classnames, always do this, and always pass in all values in extras.props\n // but we'd want to add styled({ extracted: true }) or something at compile time to save on parsing a bit...\n (staticConfig.variants && keyInit in staticConfig.variants)\n ) {\n viewProps[keyInit] = valInit\n }\n }\n\n /**\n * There's (some) reason to this madness: we want to allow returning media/pseudo from variants\n * Say you have a variant hoverable: { true: { hoverStyle: {} } }\n * We run propMapper first to expand variant, then we run the inner loop and look again\n * for if there's a pseudo/media returned from it.\n */\n\n let isMedia = isMediaKey(keyInit)\n let isPseudo = validPseudoKeys[keyInit]\n\n if (\n !isMedia &&\n !isPseudo &&\n !staticConfig.variants?.[keyInit] &&\n !validStyleProps[keyInit] &&\n !conf.shorthands[keyInit]\n ) {\n usedKeys[keyInit] = 1\n viewProps[keyInit] = valInit\n continue\n }\n\n if (process.env.NODE_ENV === 'development' && debug === 'verbose') {\n // eslint-disable-next-line no-console\n console.groupCollapsed(' \uD83D\uDD39 styles', keyInit, valInit)\n }\n\n const expanded =\n isMedia || isPseudo\n ? [[keyInit, valInit]]\n : staticConfig.propMapper(\n keyInit,\n valInit,\n theme,\n props,\n state,\n languageContext,\n undefined,\n debug\n )\n\n if (!fontFamily) {\n fontFamily = getPropMappedFontFamily(expanded)\n }\n\n if (process.env.NODE_ENV === 'development' && debug === 'verbose') {\n if (isClient) {\n // eslint-disable-next-line no-console\n console.log('expanded', expanded)\n // eslint-disable-next-line no-console\n console.log('usedKeys', usedKeys)\n }\n // eslint-disable-next-line no-console\n console.groupEnd()\n }\n\n if (!expanded) continue\n\n for (const [key, val] of expanded) {\n if (val === undefined) continue\n\n isMedia = isMediaKey(key)\n isPseudo = validPseudoKeys[key]\n const isMediaOrPseudo = isMedia || isPseudo\n\n if (!isMediaOrPseudo && usedKeys[key]) {\n continue\n }\n\n if (\n staticConfig.deoptProps?.has(key) ||\n staticConfig.inlineProps?.has(key) ||\n staticConfig.inlineWhenUnflattened?.has(key)\n ) {\n usedKeys[key] = 1\n viewProps[key] = props[key] ?? val\n }\n\n // pseudo\n if (isPseudo) {\n if (!val) continue\n if (key === 'enterStyle' && state.mounted) {\n // once mounted we can ignore enterStyle\n continue\n }\n pseudos[key] ??= {}\n const pseudoStyleObject = getSubStyle(\n key,\n val,\n staticConfig,\n theme,\n props,\n state,\n conf,\n languageContext,\n true\n )\n\n pseudos[key] = {\n ...pseudoStyleObject,\n ...pseudos[key],\n }\n\n if (key === 'enterStyle' || key === 'exitStyle') {\n continue\n }\n\n if (shouldDoClasses) {\n const pseudoStyles = getAtomicStyle(pseudoStyleObject, pseudoDescriptors[key])\n for (const style of pseudoStyles) {\n const postfix = pseudoDescriptors[key]?.name || key // exitStyle/enterStyle dont have pseudoDescriptors\n const fullKey = `${style.property}${PROP_SPLIT}${postfix}`\n if (!usedKeys[fullKey]) {\n usedKeys[fullKey] = 1\n addStyleToInsertRules(rulesToInsert, style)\n mergeClassName(transforms, classNames, fullKey, style.identifier, isMediaOrPseudo)\n }\n }\n } else {\n // need same treatment as media (individual merge + importance) + can avoid calling getSubStyle entirely when state = off\n }\n continue\n }\n\n // media\n if (isMedia) {\n const mediaKey = key\n const mediaKeyShort = mediaKey.slice(1)\n mediaKeys.push(mediaKeyShort)\n\n // THIS USED TO PROXY BACK TO REGULAR PROPS BUT THAT IS THE WRONG BEHAVIOR\n // we avoid passing in default props for media queries because that would confuse things like SizableText.size:\n\n const mediaStyle = getSubStyle(\n key,\n val,\n staticConfig,\n theme,\n props,\n state,\n conf,\n languageContext\n )\n\n if (process.env.NODE_ENV === 'development' && debug === 'verbose') {\n // prettier-ignore\n // eslint-disable-next-line no-console\n console.log(` \uD83D\uDCFA ${mediaKey}`, mediaState[mediaKeyShort], { mediaKey, mediaStyle, props, shouldDoClasses, mediaState: { ...mediaState } })\n }\n\n if (shouldDoClasses) {\n const mediaStyles = getStylesAtomic(mediaStyle)\n for (const style of mediaStyles) {\n const out = createMediaStyle(style, mediaKeyShort, mediaQueryConfig)\n const fullKey = `${style.property}${PROP_SPLIT}${mediaKeyShort}`\n if (!usedKeys[fullKey]) {\n usedKeys[fullKey] = 1\n addStyleToInsertRules(rulesToInsert, out)\n mergeClassName(transforms, classNames, fullKey, out.identifier, true)\n }\n }\n } else if (mediaState[mediaKeyShort]) {\n for (const key in mediaStyle) {\n const didMerge = mergeMediaByImportance(style, key, mediaStyle[key], usedKeys)\n if (didMerge && key === 'fontFamily') {\n fontFamily = mediaStyle[key]\n }\n }\n }\n continue\n }\n\n if (!isWeb && key === 'pointerEvents') {\n usedKeys[key] = 1\n viewProps[key] = val\n continue\n }\n\n if (key === 'fontFamily' && !fontFamily && valInit && val) {\n fontFamily = valInit[0] === '$' ? valInit : val\n }\n\n if (validStyleProps[key]) {\n usedKeys[key] = 1\n if (val && val[0] === '_') {\n classNames[key] = val\n } else if (key in stylePropsTransform) {\n mergeTransform(style, key, val, true)\n } else {\n style[key] = normalizeValueWithProperty(val, key)\n }\n continue\n }\n\n // pass to view props\n if (!staticConfig.variants || !(key in staticConfig.variants)) {\n if (!skipProps[key]) {\n viewProps[key] = val\n usedKeys[key] = 1\n }\n }\n }\n }\n\n fixStyles(style)\n if (isWeb) {\n styleToCSS(style)\n }\n\n // add in defaults if not set:\n if (parentSplitStyles) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n for (const key in parentSplitStyles.classNames) {\n if (key in classNames) continue\n if (key in style) continue\n const val = parentSplitStyles.classNames[key]\n if (!shouldDoClasses) {\n style[key] = reverseMapClassNameToValue(key, val)\n } else {\n classNames[key] = val\n }\n }\n }\n if (!shouldDoClasses) {\n for (const key in parentSplitStyles.style) {\n if (key in classNames) continue\n if (key in style) continue\n style[key] = parentSplitStyles.style[key]\n }\n }\n }\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (shouldDoClasses) {\n const atomic = getStylesAtomic(style)\n for (const atomicStyle of atomic) {\n const key = atomicStyle.property\n addStyleToInsertRules(rulesToInsert, atomicStyle)\n mergeClassName(transforms, classNames, key, atomicStyle.identifier)\n }\n if (!IS_STATIC) {\n style = emptyObject\n }\n }\n\n if (transforms) {\n for (const namespace in transforms) {\n if (!transforms[namespace]) {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('Error no transform', transforms, namespace)\n }\n continue\n }\n const [hash, val] = transforms[namespace]\n const identifier = `_transform${hash}`\n if (isClient) {\n if (!insertedTransforms[identifier]) {\n const rule = `.${identifier} { transform: ${val}; }`\n addStyleToInsertRules(rulesToInsert, {\n identifier,\n rules: [rule],\n property: namespace,\n })\n }\n }\n classNames[namespace] = identifier\n }\n }\n }\n\n if (process.env.NODE_ENV === 'development' && debug === 'verbose') {\n if (isDevTools) {\n // prettier-ignore\n // eslint-disable-next-line no-console\n console.groupCollapsed(' \uD83D\uDD39 styles =>')\n const logs = { style, pseudos, medias, classNames, viewProps, state, rulesToInsert }\n for (const key in logs) {\n // eslint-disable-next-line no-console\n console.log(key, logs[key])\n }\n // eslint-disable-next-line no-console\n console.groupEnd()\n }\n }\n\n return {\n fontFamily,\n viewProps,\n style,\n medias,\n mediaKeys,\n pseudos,\n classNames,\n rulesToInsert,\n }\n}\n\nfunction mergeClassName(\n transforms: Record<string, any[]>,\n classNames: Record<string, string>,\n key: string,\n val: string,\n isMediaOrPseudo = false\n) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n // empty classnames passed by compiler sometimes\n if (!val) return\n if (val.startsWith('_transform-')) {\n const namespace: TransformNamespaceKey = isMediaOrPseudo ? key : 'transform'\n let transform = insertedTransforms[val]\n if (isClient) {\n if (!transform) {\n // HMR or loaded a new chunk\n updateInserted()\n transform = insertedTransforms[val]\n if (process.env.NODE_ENV === 'development') {\n if (!transform) {\n // eslint-disable-next-line no-console\n console.warn('no transform found', { insertedTransforms, val })\n }\n }\n }\n if (!transform) {\n if (isWeb && val[0] !== '_') {\n // runtime insert\n transform = val\n }\n }\n }\n transforms[namespace] = transforms[namespace] || ['', '']\n const identifier = val.replace('_transform', '')\n transforms[namespace][0] += identifier\n // ssr doesn't need to do anything just make the right classname\n if (transform) {\n transforms[namespace][1] += transform\n }\n } else {\n classNames[key] = val\n }\n }\n}\n\n/**\n * getSubStyle calls propMapper with props\n * those should be specific to the substyle, but fallback to the base props\n * so given props:\n *\n * { fontSize: 12, color: 'red', $sm: { color: 'blue' } }\n *\n * getSubStyle props should be a proxy that ends up like:\n *\n * { fontSize: 12, color: 'blue' }\n *\n * and to avoid re-creating it over and over, use a WeakMap\n */\nconst propProxies = new WeakMap()\nfunction getSubStyleProxiedProps(defaultProps: Object, baseProps: Object, specificProps: Object) {\n if (!specificProps) {\n // functional variants may want to eventually do something like:\n // have a hooks-like rule (no conditionals)\n // then we run them once on compile with a proxy to capture the keys accessed\n // then add those keys to `inlineProps` so we know we must inline them\n // for now this will trigger because compiled away\n // right now also we don't pass in any pre-extracted styled() props but we should pass them in..\n return baseProps\n }\n // can cache based only on specific it's always referentially consistent with base\n if (propProxies.has(specificProps)) {\n return propProxies.get(specificProps)\n }\n const next = createProxy(specificProps, {\n has(_, key) {\n return key in defaultProps || key in specificProps || key in baseProps\n },\n get(_, key) {\n return defaultProps[key] ?? specificProps[key] ?? baseProps[key]\n },\n })\n propProxies.set(specificProps, next)\n return next\n}\n\nexport const getSubStyle = (\n subKey: string,\n styleIn: Object,\n staticConfig: StaticConfigParsed,\n theme: ThemeParsed,\n props: any,\n state: SplitStyleState,\n conf: TamaguiInternalConfig,\n languageContext?: FontLanguageProps,\n avoidDefaultProps?: boolean\n): ViewStyle => {\n const styleOut: ViewStyle = {}\n for (let key in styleIn) {\n const val = styleIn[key]\n key = conf.shorthands[key] || key\n const expanded = staticConfig.propMapper(\n key,\n val,\n theme,\n getSubStyleProxiedProps(staticConfig.defaultProps, props, props[subKey]),\n state,\n languageContext,\n avoidDefaultProps\n )\n if (!expanded) continue\n for (const [skey, sval] of expanded) {\n if (skey in stylePropsTransform) {\n mergeTransform(styleOut, skey, sval)\n } else {\n styleOut[skey] = normalizeValueWithProperty(sval, key)\n }\n }\n }\n\n fixStyles(styleOut)\n\n return styleOut\n}\n\nexport const insertSplitStyles: StyleSplitter = (...args) => {\n const res = getSplitStyles(...args)\n insertStyleRules(res.rulesToInsert)\n return res\n}\n\n// on native no need to insert any css\nconst useInsertEffectCompat = isWeb ? useInsertionEffect || useIsomorphicLayoutEffect : () => {}\n\nexport const useSplitStyles: StyleSplitter = (...args) => {\n const res = getSplitStyles(...args)\n\n if (!isRSC) {\n useInsertEffectCompat(() => {\n insertStyleRules(res.rulesToInsert)\n }, [res.rulesToInsert])\n }\n\n return res\n}\n\nfunction addStyleToInsertRules(rulesToInsert: RulesToInsert, styleObject: PartialStyleObject) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (!shouldInsertStyleRules(styleObject)) {\n return\n }\n updateRules(styleObject.identifier, styleObject.rules)\n rulesToInsert.push(styleObject)\n }\n}\n\nfunction processIDRefList(idRefList: string | Array<string>): string {\n return Array.isArray(idRefList) ? idRefList.join(' ') : idRefList\n}\n"],
5
- "mappings": "AAAA,SAAS,UAAU,OAAO,OAAO,iCAAiC;AAClE,SAAS,gBAAgB,qBAAqB,iBAAiB,mBAAmB;AAElF,SAAS,0BAA0B;AAEnC,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B;AAAA,EACE,cAAc;AAAA,EACd;AAAA,EACA;AAAA,OACK;AAaP,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB,iBAAiB,kBAAkB;AAC5D;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B;AAAA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ayoutEffect } from '@tamagui/constants'\nimport { stylePropsText, stylePropsTransform, validPseudoKeys, validStyles } from '@tamagui/helpers'\nimport type { ViewStyle } from '@tamagui/types-react-native'\nimport { useInsertionEffect } from 'react'\n\nimport { getConfig } from '../config'\nimport { isDevTools } from '../constants/isDevTools'\nimport {\n mediaState as globalMediaState,\n mediaQueryConfig,\n mergeMediaByImportance,\n} from '../hooks/useMedia'\nimport type {\n DebugProp,\n MediaQueryKey,\n PseudoPropKeys,\n PseudoStyles,\n SplitStyleState,\n StackProps,\n StaticConfigParsed,\n TamaguiInternalConfig,\n ThemeParsed,\n} from '../types'\nimport { FontLanguageProps, LanguageContextType } from '../views/FontLanguage.types'\nimport { createMediaStyle } from './createMediaStyle'\nimport { getPropMappedFontFamily } from './createPropMapper'\nimport { createProxy } from './createProxy'\nimport { fixStyles } from './expandStyles'\nimport { getAtomicStyle, getStylesAtomic, styleToCSS } from './getStylesAtomic'\nimport {\n PartialStyleObject,\n RulesToInsert,\n insertStyleRules,\n insertedTransforms,\n shouldInsertStyleRules,\n updateInserted,\n updateRules,\n} from './insertStyleRule'\nimport { mergeTransform } from './mergeTransform'\nimport {\n normalizeValueWithProperty,\n reverseMapClassNameToValue,\n} from './normalizeValueWithProperty.js'\nimport { pseudoDescriptors } from './pseudoDescriptors'\n\nexport type SplitStyles = ReturnType<typeof getSplitStyles>\nexport type ClassNamesObject = Record<string, string>\nexport type SplitStyleResult = ReturnType<typeof getSplitStyles>\n\nconst skipProps = {\n animation: true,\n animateOnly: true,\n debug: true,\n componentName: true,\n role: true,\n tag: true,\n}\n\nconst emptyObject = {}\nconst IS_STATIC = process.env.IS_STATIC === 'is_static'\n\n// native only skips\nif (process.env.TAMAGUI_TARGET === 'native') {\n Object.assign(skipProps, {\n whiteSpace: true,\n wordWrap: true,\n textOverflow: true,\n textDecorationDistance: true,\n userSelect: true,\n selectable: true,\n cursor: true,\n contain: true,\n boxSizing: true,\n boxShadow: true,\n })\n}\n\n// web only maps accessibility to aria props\nconst accessibilityDirectMap: Record<string, string> = {}\nif (process.env.TAMAGUI_TARGET === 'web') {\n // bundle size shave\n const items = {\n Hidden: true,\n ActiveDescendant: true,\n Atomic: true,\n AutoComplete: true,\n Busy: true,\n Checked: true,\n ColumnCount: 'colcount',\n ColumnIndex: 'colindex',\n ColumnSpan: 'colspan',\n Current: true,\n Details: true,\n ErrorMessage: true,\n Expanded: true,\n HasPopup: true,\n Invalid: true,\n Label: true,\n Level: true,\n Modal: true,\n Multiline: true,\n MultiSelectable: true,\n Orientation: true,\n Owns: true,\n Placeholder: true,\n PosInSet: true,\n Pressed: true,\n RoleDescription: true,\n RowCount: true,\n RowIndex: true,\n RowSpan: true,\n Selected: true,\n SetSize: true,\n Sort: true,\n ValueMax: true,\n ValueMin: true,\n ValueNow: true,\n ValueText: true,\n }\n for (const key in items) {\n let val = items[key]\n if (val === true) {\n val = key.toLowerCase()\n }\n accessibilityDirectMap[`accessibility${key}`] = `aria-${val}`\n }\n}\n\ntype TransformNamespaceKey = 'transform' | PseudoPropKeys | MediaQueryKey\n\nlet conf: TamaguiInternalConfig\n\ntype SplitStylesAndProps = {\n pseudos: PseudoStyles\n medias: Record<MediaQueryKey, ViewStyle>\n style: ViewStyle\n classNames: ClassNamesObject\n rulesToInsert: RulesToInsert\n viewProps: StackProps & Record<string, any>\n fontFamily: string | undefined\n mediaKeys: string[]\n}\n\ntype StyleSplitter = (\n props: { [key: string]: any },\n staticConfig: StaticConfigParsed,\n theme: ThemeParsed,\n state: SplitStyleState,\n parentSplitStyles?: SplitStylesAndProps | null,\n languageContext?: LanguageContextType,\n // web-only\n elementType?: string,\n debug?: DebugProp\n) => SplitStylesAndProps\n\nexport const PROP_SPLIT = '-'\n\nconst accessibilityRoleToWebRole = {\n adjustable: 'slider',\n header: 'heading',\n image: 'img',\n link: 'link',\n none: 'presentation',\n summary: 'region',\n}\n\n// loop props backwards\n// track used keys:\n// const keys = new Set<string>()\n// keep classnames and styles separate:\n// const styles = {}\n// const classNames = {}\n\nconst isMediaKey = (key: string) => Boolean(key[0] === '$' && mediaQueryConfig[key.slice(1)])\n\nexport const getSplitStyles: StyleSplitter = (\n props,\n staticConfig,\n theme,\n state,\n parentSplitStyles,\n languageContext,\n elementType,\n debug\n) => {\n conf = conf || getConfig()\n const validStyleProps = staticConfig.isText ? stylePropsText : validStyles\n const mediaKeys: string[] = []\n const viewProps: SplitStylesAndProps['viewProps'] = {}\n const pseudos: PseudoStyles = {}\n let psuedosUsed: Record<string, number> | null = null\n const medias: Record<MediaQueryKey, ViewStyle> = {}\n const mediaState = state.mediaState || globalMediaState\n const usedKeys: Record<string, number> = {}\n const propKeys = Object.keys(props)\n\n const shouldDoClasses =\n staticConfig.acceptsClassName && (isWeb || IS_STATIC) && !state.noClassNames\n\n let style: ViewStyle = {}\n\n const len = propKeys.length\n const rulesToInsert: RulesToInsert = []\n const classNames: ClassNamesObject = {}\n // we need to gather these specific to each media query / pseudo\n // value is [hash, val], so [\"-jnjad-asdnjk\", \"scaleX(1) rotate(10deg)\"]\n const transforms: Record<TransformNamespaceKey, [string, string]> = {}\n // fontFamily is our special baby, ensure we grab the latest set one always\n let fontFamily: string | undefined\n\n // loop backwards so we can skip already-used props\n for (let i = len - 1; i >= 0; i--) {\n let keyInit = propKeys[i]\n const valInit = props[keyInit]\n\n // normalize shorthands up front\n const expandedKey = conf.shorthands[keyInit]\n if (expandedKey) {\n keyInit = expandedKey\n }\n\n if (usedKeys[keyInit]) continue\n if (skipProps[keyInit]) continue\n if (!isWeb && keyInit.startsWith('data-')) continue\n\n if (keyInit === 'style' || keyInit.startsWith('_style')) {\n if (!valInit) continue\n const styles = Array.isArray(valInit) ? valInit : [valInit]\n const styleLen = styles.length\n for (let j = styleLen; j >= 0; j--) {\n const cur = styles[j]\n if (!cur) continue\n for (const key in cur) {\n if (usedKeys[key]) continue\n usedKeys[key] = 1\n style[key] = cur[key]\n }\n }\n continue\n }\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n /**\n * Copying in the accessibility/prop handling from react-native-web here\n * Keeps it in a single loop, avoids dup de-structuring to avoid bundle size\n */\n if (keyInit === 'disabled' && valInit === true) {\n usedKeys[keyInit] = 1\n viewProps['aria-disabled'] = true\n // Enhance with native semantics\n if (\n elementType === 'button' ||\n elementType === 'form' ||\n elementType === 'input' ||\n elementType === 'select' ||\n elementType === 'textarea'\n ) {\n viewProps.disabled = true\n }\n if (!staticConfig.variants?.disabled) {\n continue\n }\n }\n\n if (keyInit === 'testID') {\n usedKeys[keyInit] = 1\n viewProps['data-testid'] = valInit\n continue\n }\n\n if (keyInit === 'id' || keyInit === 'nativeID') {\n usedKeys[keyInit] = 1\n if (staticConfig.isReactNative) {\n viewProps.nativeID = valInit\n } else {\n viewProps.id = valInit\n }\n continue\n }\n\n let didUseKeyInit = true\n\n if (staticConfig.isReactNative) {\n didUseKeyInit = false\n\n // pass along to react-native-web\n if (accessibilityDirectMap[keyInit] || keyInit.startsWith('accessibility')) {\n viewProps[keyInit] = valInit\n usedKeys[keyInit] = 1\n continue\n }\n } else {\n if (accessibilityDirectMap[keyInit]) {\n viewProps[accessibilityDirectMap[keyInit]] = valInit\n usedKeys[keyInit] = 1\n continue\n }\n\n switch (keyInit) {\n case 'accessibilityRole': {\n if (valInit === 'none') {\n viewProps.role = 'presentation'\n } else {\n viewProps.role = accessibilityRoleToWebRole[valInit] || valInit\n }\n break\n }\n case 'accessibilityControls': {\n viewProps['aria-controls'] = processIDRefList(valInit)\n break\n }\n case 'accessibilityDescribedBy': {\n viewProps['aria-describedby'] = processIDRefList(valInit)\n break\n }\n case 'accessibilityFlowTo': {\n viewProps['aria-flowto'] = processIDRefList(valInit)\n break\n }\n case 'accessibilityLabelledBy': {\n viewProps['aria-labelledby'] = processIDRefList(valInit)\n break\n }\n case 'accessibilityKeyShortcuts': {\n if (Array.isArray(valInit)) {\n viewProps['aria-keyshortcuts'] = valInit.join(' ')\n }\n break\n }\n case 'accessibilityLiveRegion': {\n viewProps['aria-live'] = valInit === 'none' ? 'off' : valInit\n break\n }\n case 'accessibilityReadOnly': {\n viewProps['aria-readonly'] = valInit\n // Enhance with native semantics\n if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {\n viewProps.readOnly = true\n }\n break\n }\n case 'accessibilityRequired': {\n viewProps['aria-required'] = valInit\n // Enhance with native semantics\n if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {\n viewProps.required = true\n }\n break\n }\n default: {\n didUseKeyInit = false\n }\n }\n }\n\n if (didUseKeyInit) {\n usedKeys[keyInit] = 1\n continue\n }\n\n if (keyInit === 'className') {\n let nonTamaguis = ''\n if (!valInit) continue\n for (const cn of valInit.split(' ')) {\n if (cn[0] === '_') {\n // tamagui, merge it expanded on key, eventually this will go away with better compiler\n const [shorthand, mediaOrPseudo] = cn.slice(1).split('-')\n const isMedia = mediaOrPseudo[0] === '_'\n const isPseudo = mediaOrPseudo[0] === '0'\n const isMediaOrPseudo = isMedia || isPseudo\n let fullKey = conf.shorthands[shorthand]\n if (isMedia) {\n // is media\n let mediaShortKey = mediaOrPseudo.slice(1)\n mediaShortKey = mediaShortKey.slice(0, mediaShortKey.indexOf('_'))\n fullKey += `${PROP_SPLIT}${mediaShortKey}`\n } else if (isPseudo) {\n // is pseudo\n const pseudoShortKey = mediaOrPseudo.slice(1)\n fullKey += `${PROP_SPLIT}${pseudoShortKey}`\n }\n usedKeys[fullKey] = 1\n mergeClassName(transforms, classNames, fullKey, cn, isMediaOrPseudo)\n } else {\n nonTamaguis += ' ' + cn\n }\n }\n if (nonTamaguis) {\n usedKeys[keyInit] = 1\n mergeClassName(transforms, classNames, keyInit, nonTamaguis)\n }\n continue\n }\n\n if (valInit && valInit[0] === '_') {\n // if valid style key (or pseudo like color-hover):\n // this conditional and esp the pseudo check rarely runs so not a perf issue\n const isValidClassName = validStyles[keyInit]\n const isMediaOrPseudo =\n !isValidClassName &&\n keyInit.includes(PROP_SPLIT) &&\n validStyles[keyInit.split(PROP_SPLIT)[0]]\n if (isValidClassName || isMediaOrPseudo) {\n usedKeys[keyInit] = 1\n mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo)\n continue\n }\n }\n }\n\n if (state.keepVariantsAsProps) {\n if (\n (staticConfig.defaultVariants && keyInit in staticConfig.defaultVariants) ||\n // may want to just: not compile styled() into classnames, always do this, and always pass in all values in extras.props\n // but we'd want to add styled({ extracted: true }) or something at compile time to save on parsing a bit...\n (staticConfig.variants && keyInit in staticConfig.variants)\n ) {\n viewProps[keyInit] = valInit\n }\n }\n\n /**\n * There's (some) reason to this madness: we want to allow returning media/pseudo from variants\n * Say you have a variant hoverable: { true: { hoverStyle: {} } }\n * We run propMapper first to expand variant, then we run the inner loop and look again\n * for if there's a pseudo/media returned from it.\n */\n\n let isMedia = isMediaKey(keyInit)\n let isPseudo = validPseudoKeys[keyInit]\n\n if (\n !isMedia &&\n !isPseudo &&\n !staticConfig.variants?.[keyInit] &&\n !validStyleProps[keyInit] &&\n !conf.shorthands[keyInit]\n ) {\n usedKeys[keyInit] = 1\n viewProps[keyInit] = valInit\n continue\n }\n\n if (process.env.NODE_ENV === 'development' && debug === 'verbose') {\n // eslint-disable-next-line no-console\n console.groupCollapsed(' \uD83D\uDD39 styles', keyInit, valInit)\n }\n\n const expanded =\n isMedia || isPseudo\n ? [[keyInit, valInit]]\n : staticConfig.propMapper(\n keyInit,\n valInit,\n theme,\n props,\n state,\n languageContext,\n undefined,\n debug\n )\n\n if (!fontFamily) {\n fontFamily = getPropMappedFontFamily(expanded)\n }\n\n if (process.env.NODE_ENV === 'development' && debug === 'verbose') {\n if (isClient) {\n // eslint-disable-next-line no-console\n console.log('expanded', expanded)\n // eslint-disable-next-line no-console\n console.log('usedKeys', usedKeys)\n }\n // eslint-disable-next-line no-console\n console.groupEnd()\n }\n\n if (!expanded) continue\n\n for (const [key, val] of expanded) {\n if (val === undefined) continue\n\n isMedia = isMediaKey(key)\n isPseudo = validPseudoKeys[key]\n const isMediaOrPseudo = isMedia || isPseudo\n\n if (!isMediaOrPseudo && usedKeys[key]) {\n continue\n }\n\n if (\n staticConfig.deoptProps?.has(key) ||\n staticConfig.inlineProps?.has(key) ||\n staticConfig.inlineWhenUnflattened?.has(key)\n ) {\n usedKeys[key] = 1\n viewProps[key] = props[key] ?? val\n }\n\n // pseudo\n if (isPseudo) {\n if (!val) continue\n if (key === 'enterStyle' && state.mounted) {\n // once mounted we can ignore enterStyle\n continue\n }\n pseudos[key] ??= {}\n const pseudoStyleObject = getSubStyle(\n key,\n val,\n staticConfig,\n theme,\n props,\n state,\n conf,\n languageContext,\n true\n )\n\n pseudos[key] = {\n ...pseudoStyleObject,\n ...pseudos[key],\n }\n\n if (key === 'enterStyle' || key === 'exitStyle') {\n continue\n }\n\n const pseudoStyles = getAtomicStyle(pseudoStyleObject, pseudoDescriptors[key])\n for (const psuedoStyle of pseudoStyles) {\n const postfix = pseudoDescriptors[key]?.name || key // exitStyle/enterStyle dont have pseudoDescriptors\n const fullKey = shouldDoClasses\n ? `${psuedoStyle.property}${PROP_SPLIT}${postfix}`\n : psuedoStyle.property\n if (!usedKeys[fullKey]) {\n usedKeys[fullKey] = 1\n if (shouldDoClasses) {\n addStyleToInsertRules(rulesToInsert, psuedoStyle)\n mergeClassName(\n transforms,\n classNames,\n fullKey,\n psuedoStyle.identifier,\n isMediaOrPseudo\n )\n } else {\n psuedosUsed ??= {}\n psuedosUsed[psuedoStyle.property] ??= 0\n const importance = pseudoDescriptors[key].priority\n if (psuedosUsed[importance] <= importance) {\n psuedosUsed[psuedoStyle.property] = importance\n style[psuedoStyle.property] = psuedoStyle.value\n }\n }\n }\n }\n continue\n }\n\n // media\n if (isMedia) {\n const mediaKey = key\n const mediaKeyShort = mediaKey.slice(1)\n mediaKeys.push(mediaKeyShort)\n\n // THIS USED TO PROXY BACK TO REGULAR PROPS BUT THAT IS THE WRONG BEHAVIOR\n // we avoid passing in default props for media queries because that would confuse things like SizableText.size:\n\n const mediaStyle = getSubStyle(\n key,\n val,\n staticConfig,\n theme,\n props,\n state,\n conf,\n languageContext\n )\n\n if (process.env.NODE_ENV === 'development' && debug === 'verbose') {\n // prettier-ignore\n // eslint-disable-next-line no-console\n console.log(` \uD83D\uDCFA ${mediaKey}`, mediaState[mediaKeyShort], { mediaKey, mediaStyle, props, shouldDoClasses, mediaState: { ...mediaState } })\n }\n\n if (shouldDoClasses) {\n const mediaStyles = getStylesAtomic(mediaStyle)\n for (const style of mediaStyles) {\n const out = createMediaStyle(style, mediaKeyShort, mediaQueryConfig)\n const fullKey = `${style.property}${PROP_SPLIT}${mediaKeyShort}`\n if (!usedKeys[fullKey]) {\n usedKeys[fullKey] = 1\n addStyleToInsertRules(rulesToInsert, out)\n mergeClassName(transforms, classNames, fullKey, out.identifier, true)\n }\n }\n } else if (mediaState[mediaKeyShort]) {\n for (const key in mediaStyle) {\n const didMerge = mergeMediaByImportance(style, key, mediaStyle[key], usedKeys)\n if (didMerge && key === 'fontFamily') {\n fontFamily = mediaStyle[key]\n }\n }\n }\n continue\n }\n\n if (!isWeb && key === 'pointerEvents') {\n usedKeys[key] = 1\n viewProps[key] = val\n continue\n }\n\n if (key === 'fontFamily' && !fontFamily && valInit && val) {\n fontFamily = valInit[0] === '$' ? valInit : val\n }\n\n if (validStyleProps[key]) {\n usedKeys[key] = 1\n if (val && val[0] === '_') {\n classNames[key] = val\n } else if (key in stylePropsTransform) {\n mergeTransform(style, key, val, true)\n } else {\n style[key] = normalizeValueWithProperty(val, key)\n }\n continue\n }\n\n // pass to view props\n if (!staticConfig.variants || !(key in staticConfig.variants)) {\n if (!skipProps[key]) {\n viewProps[key] = val\n usedKeys[key] = 1\n }\n }\n }\n }\n\n fixStyles(style)\n if (isWeb) {\n styleToCSS(style)\n }\n\n // add in defaults if not set:\n if (parentSplitStyles) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n for (const key in parentSplitStyles.classNames) {\n if (key in classNames) continue\n if (key in style) continue\n const val = parentSplitStyles.classNames[key]\n if (!shouldDoClasses) {\n style[key] = reverseMapClassNameToValue(key, val)\n } else {\n classNames[key] = val\n }\n }\n }\n if (!shouldDoClasses) {\n for (const key in parentSplitStyles.style) {\n if (key in classNames) continue\n if (key in style) continue\n style[key] = parentSplitStyles.style[key]\n }\n }\n }\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (shouldDoClasses) {\n if (style['$$css']) {\n // avoid re-processing for rnw\n } else {\n const atomic = getStylesAtomic(style)\n for (const atomicStyle of atomic) {\n const key = atomicStyle.property\n addStyleToInsertRules(rulesToInsert, atomicStyle)\n mergeClassName(transforms, classNames, key, atomicStyle.identifier)\n }\n if (!IS_STATIC) {\n style = emptyObject\n }\n }\n }\n\n if (transforms) {\n for (const namespace in transforms) {\n if (!transforms[namespace]) {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('Error no transform', transforms, namespace)\n }\n continue\n }\n const [hash, val] = transforms[namespace]\n const identifier = `_transform${hash}`\n if (isClient) {\n if (!insertedTransforms[identifier]) {\n const rule = `.${identifier} { transform: ${val}; }`\n addStyleToInsertRules(rulesToInsert, {\n identifier,\n rules: [rule],\n property: namespace,\n })\n }\n }\n classNames[namespace] = identifier\n }\n }\n }\n\n if (process.env.NODE_ENV === 'development' && debug === 'verbose') {\n if (isDevTools) {\n // prettier-ignore\n // eslint-disable-next-line no-console\n console.groupCollapsed(' \uD83D\uDD39 styles =>')\n const logs = { style, pseudos, medias, classNames, viewProps, state, rulesToInsert }\n for (const key in logs) {\n // eslint-disable-next-line no-console\n console.log(key, logs[key])\n }\n // eslint-disable-next-line no-console\n console.groupEnd()\n }\n }\n\n return {\n fontFamily,\n viewProps,\n style,\n medias,\n mediaKeys,\n pseudos,\n classNames,\n rulesToInsert,\n }\n}\n\nfunction mergeClassName(\n transforms: Record<string, any[]>,\n classNames: Record<string, string>,\n key: string,\n val: string,\n isMediaOrPseudo = false\n) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n // empty classnames passed by compiler sometimes\n if (!val) return\n if (val.startsWith('_transform-')) {\n const namespace: TransformNamespaceKey = isMediaOrPseudo ? key : 'transform'\n let transform = insertedTransforms[val]\n if (isClient) {\n if (!transform) {\n // HMR or loaded a new chunk\n updateInserted()\n transform = insertedTransforms[val]\n if (process.env.NODE_ENV === 'development') {\n if (!transform) {\n // eslint-disable-next-line no-console\n console.warn('no transform found', { insertedTransforms, val })\n }\n }\n }\n if (!transform) {\n if (isWeb && val[0] !== '_') {\n // runtime insert\n transform = val\n }\n }\n }\n transforms[namespace] = transforms[namespace] || ['', '']\n const identifier = val.replace('_transform', '')\n transforms[namespace][0] += identifier\n // ssr doesn't need to do anything just make the right classname\n if (transform) {\n transforms[namespace][1] += transform\n }\n } else {\n classNames[key] = val\n }\n }\n}\n\n/**\n * getSubStyle calls propMapper with props\n * those should be specific to the substyle, but fallback to the base props\n * so given props:\n *\n * { fontSize: 12, color: 'red', $sm: { color: 'blue' } }\n *\n * getSubStyle props should be a proxy that ends up like:\n *\n * { fontSize: 12, color: 'blue' }\n *\n * and to avoid re-creating it over and over, use a WeakMap\n */\nconst propProxies = new WeakMap()\nfunction getSubStyleProxiedProps(defaultProps: Object, baseProps: Object, specificProps: Object) {\n if (!specificProps) {\n // functional variants may want to eventually do something like:\n // have a hooks-like rule (no conditionals)\n // then we run them once on compile with a proxy to capture the keys accessed\n // then add those keys to `inlineProps` so we know we must inline them\n // for now this will trigger because compiled away\n // right now also we don't pass in any pre-extracted styled() props but we should pass them in..\n return baseProps\n }\n // can cache based only on specific it's always referentially consistent with base\n if (propProxies.has(specificProps)) {\n return propProxies.get(specificProps)\n }\n const next = createProxy(specificProps, {\n has(_, key) {\n return key in defaultProps || key in specificProps || key in baseProps\n },\n get(_, key) {\n return defaultProps[key] ?? specificProps[key] ?? baseProps[key]\n },\n })\n propProxies.set(specificProps, next)\n return next\n}\n\nexport const getSubStyle = (\n subKey: string,\n styleIn: Object,\n staticConfig: StaticConfigParsed,\n theme: ThemeParsed,\n props: any,\n state: SplitStyleState,\n conf: TamaguiInternalConfig,\n languageContext?: FontLanguageProps,\n avoidDefaultProps?: boolean\n): ViewStyle => {\n const styleOut: ViewStyle = {}\n for (let key in styleIn) {\n const val = styleIn[key]\n key = conf.shorthands[key] || key\n const expanded = staticConfig.propMapper(\n key,\n val,\n theme,\n getSubStyleProxiedProps(staticConfig.defaultProps, props, props[subKey]),\n state,\n languageContext,\n avoidDefaultProps\n )\n if (!expanded) continue\n for (const [skey, sval] of expanded) {\n if (skey in stylePropsTransform) {\n mergeTransform(styleOut, skey, sval)\n } else {\n styleOut[skey] = normalizeValueWithProperty(sval, key)\n }\n }\n }\n\n fixStyles(styleOut)\n\n return styleOut\n}\n\nexport const insertSplitStyles: StyleSplitter = (...args) => {\n const res = getSplitStyles(...args)\n insertStyleRules(res.rulesToInsert)\n return res\n}\n\n// on native no need to insert any css\nconst useInsertEffectCompat = isWeb ? useInsertionEffect || useIsomorphicLayoutEffect : () => {}\n\nexport const useSplitStyles: StyleSplitter = (...args) => {\n const res = getSplitStyles(...args)\n\n if (!isRSC) {\n useInsertEffectCompat(() => {\n insertStyleRules(res.rulesToInsert)\n }, [res.rulesToInsert])\n }\n\n return res\n}\n\nfunction addStyleToInsertRules(rulesToInsert: RulesToInsert, styleObject: PartialStyleObject) {\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (!shouldInsertStyleRules(styleObject)) {\n return\n }\n updateRules(styleObject.identifier, styleObject.rules)\n rulesToInsert.push(styleObject)\n }\n}\n\nfunction processIDRefList(idRefList: string | Array<string>): string {\n return Array.isArray(idRefList) ? idRefList.join(' ') : idRefList\n}\n"],
5
+ "mappings": "AAAA,SAAS,UAAU,OAAO,OAAO,iCAAiC;AAClE,SAAS,gBAAgB,qBAAqB,iBAAiB,mBAAmB;AAElF,SAAS,0BAA0B;AAEnC,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B;AAAA,EACE,cAAc;AAAA,EACd;AAAA,EACA;AAAA,OACK;AAaP,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,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IAAI;AAClC,mBAAiB,IAAI,aAAa;AAClC,SAAO;AACT;AAGA,MAAM,wBAAwB,QAAQ,sBAAsB,4BAA4B,MAAM;AAAC;AAExF,MAAM,iBAAgC,IAAI,SAAS;AACxD,QAAM,MAAM,eAAe,GAAG,IAAI;AAElC,MAAI,CAAC,OAAO;AACV,0BAAsB,MAAM;AAC1B,uBAAiB,IAAI,aAAa;AAAA,IACpC,GAAG,CAAC,IAAI,aAAa,CAAC;AAAA,EACxB;AAEA,SAAO;AACT;AAEA,SAAS,sBAAsB,eAA8B,aAAiC;AAC5F,MAAI,QAAQ,IAAI,mBAAmB,OAAO;AACxC,QAAI,CAAC,uBAAuB,WAAW,GAAG;AACxC;AAAA,IACF;AACA,gBAAY,YAAY,YAAY,YAAY,KAAK;AACrD,kBAAc,KAAK,WAAW;AAAA,EAChC;AACF;AAEA,SAAS,iBAAiB,WAA2C;AACnE,SAAO,MAAM,QAAQ,SAAS,IAAI,UAAU,KAAK,GAAG,IAAI;AAC1D;",
6
6
  "names": ["isMedia", "isPseudo", "style", "key", "conf"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/themeable.tsx"],
4
- "sourcesContent": ["import React, { forwardRef } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport type ThemeableProps = {\n theme?: ThemeName | string | null\n themeInverse?: boolean\n}\n\nexport function themeable<Component extends (props: any) => any>(\n component: Component,\n opts?: { componentName?: string }\n) {\n const withThemeComponent = forwardRef(function WithTheme(props: any, ref) {\n const { themeInverse, theme, ...rest } = props\n const element = React.createElement(component, { ...rest, ref } as any)\n if (themeInverse) {\n return <ThemeInverse>{element}</ThemeInverse>\n }\n if (theme || opts) {\n return (\n <Theme componentName={opts?.componentName} name={(theme as any) || null}>\n {element}\n </Theme>\n )\n }\n return element\n })\n\n const withTheme: any = withThemeComponent\n withTheme.displayName = `Themed(${\n (component as any)?.displayName || (component as any)?.name || 'Anonymous'\n })`\n\n return withTheme as Component extends (props: infer P) => infer R\n ? (\n props: Omit<P, 'theme' | 'themeInverse'> & {\n theme?: ThemeName | null\n themeInverse?: boolean\n }\n ) => R\n : unknown\n}\n"],
5
- "mappings": "AAmBa;AAnBb,OAAO,SAAS,kBAAkB;AAGlC,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAOtB,SAAS,UACd,WACA,MACA;AACA,QAAM,qBAAqB,WAAW,SAAS,UAAU,OAAY,KAAK;AACxE,UAAM,EAAE,cAAc,UAAU,KAAK,IAAI;AACzC,UAAM,UAAU,MAAM,cAAc,WAAW,EAAE,GAAG,MAAM,IAAI,CAAQ;AACtE,QAAI,cAAc;AAChB,aAAO,oBAAC;AAAA,QAAc;AAAA,OAAQ;AAAA,IAChC;AACA,QAAI,SAAS,MAAM;AACjB,aACE,oBAAC;AAAA,QAAM,eAAe,6BAAM;AAAA,QAAe,MAAO,SAAiB;AAAA,QAChE;AAAA,OACH;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,CAAC;AAED,QAAM,YAAiB;AACvB,YAAU,cAAc,WACrB,uCAAmB,iBAAgB,uCAAmB,SAAQ;AAGjE,SAAO;AAQT;",
4
+ "sourcesContent": ["import React, { forwardRef } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport interface ThemeableProps {\n theme?: ThemeName | null\n themeInverse?: boolean\n}\n\nexport function themeable<Component extends (props: any) => any>(\n component: Component,\n opts?: { componentName?: string }\n) {\n const withThemeComponent = forwardRef(function WithTheme(props: any, ref) {\n const { themeInverse, theme, ...rest } = props\n const element = React.createElement(component, { ...rest, ref } as any)\n if (themeInverse) {\n return <ThemeInverse>{element}</ThemeInverse>\n }\n if (theme || opts) {\n return (\n <Theme componentName={opts?.componentName} name={(theme as any) || null}>\n {element}\n </Theme>\n )\n }\n return element\n })\n\n const withTheme: any = withThemeComponent\n withTheme.displayName = `Themed(${\n (component as any)?.displayName || (component as any)?.name || 'Anonymous'\n })`\n\n return withTheme as Component extends (props: infer P) => infer R\n ? (props: Omit<P, 'theme' | 'themeInverse'> & ThemeableProps) => R\n : unknown\n}\n"],
5
+ "mappings": "AAmBa;AAnBb,OAAO,SAAS,kBAAkB;AAGlC,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAOtB,SAAS,UACd,WACA,MACA;AACA,QAAM,qBAAqB,WAAW,SAAS,UAAU,OAAY,KAAK;AACxE,UAAM,EAAE,cAAc,UAAU,KAAK,IAAI;AACzC,UAAM,UAAU,MAAM,cAAc,WAAW,EAAE,GAAG,MAAM,IAAI,CAAQ;AACtE,QAAI,cAAc;AAChB,aAAO,oBAAC;AAAA,QAAc;AAAA,OAAQ;AAAA,IAChC;AACA,QAAI,SAAS,MAAM;AACjB,aACE,oBAAC;AAAA,QAAM,eAAe,6BAAM;AAAA,QAAe,MAAO,SAAiB;AAAA,QAChE;AAAA,OACH;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,CAAC;AAED,QAAM,YAAiB;AACvB,YAAU,cAAc,WACrB,uCAAmB,iBAAgB,uCAAmB,SAAQ;AAGjE,SAAO;AAGT;",
6
6
  "names": []
7
7
  }
@@ -57,7 +57,7 @@ const useTheme = (themeName, componentName, props, forceUpdate) => {
57
57
  if (process.env.NODE_ENV === "development") {
58
58
  console.warn("No theme with name", themeName);
59
59
  }
60
- return themes[getConfig().defaultTheme || "light"];
60
+ return themes[Object.keys(themes)[0]];
61
61
  }
62
62
  return useMemo(() => {
63
63
  return getThemeProxied(theme, name, className, themeManager, state, debugProp);
@@ -111,10 +111,10 @@ const getThemeManager = (theme) => {
111
111
  return;
112
112
  return theme[GetThemeManager];
113
113
  };
114
- const useThemeName = (opts) => {
114
+ function useThemeName(opts) {
115
115
  if (isRSC) {
116
116
  const config = getConfig();
117
- return config.defaultTheme || "light";
117
+ return config.themes[Object.keys(config.themes)[0]];
118
118
  }
119
119
  const parent = useContext(ThemeManagerContext);
120
120
  const [name, setName] = useState((parent == null ? void 0 : parent.name) || "");
@@ -129,7 +129,7 @@ const useThemeName = (opts) => {
129
129
  });
130
130
  }, [parent]);
131
131
  return name;
132
- };
132
+ }
133
133
  const useDefaultThemeName = () => {
134
134
  var _a;
135
135
  return (_a = useContext(ThemeContext)) == null ? void 0 : _a.defaultTheme;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useTheme.tsx"],
4
- "sourcesContent": ["import { isRSC, isServer, useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../config'\nimport { isDevTools } from '../constants/isDevTools'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport { createProxy } from '../helpers/createProxy'\nimport {\n GetNextThemeProps,\n ThemeManager,\n ThemeManagerContext,\n emptyManager,\n} from '../helpers/ThemeManager'\nimport { ThemeName, ThemeParsed } from '../types'\nimport { GetThemeUnwrapped } from './getThemeUnwrapped'\nimport { useServerRef } from './useServerHooks'\n\nexport interface ThemeProps {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: boolean | 'verbose'\n}\n\ninterface UseThemeState {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdate?: any\n): ThemeParsed => {\n // TODO this can use useChangeThemeEffect almost ready\n if (isRSC) {\n const config = getConfig()\n // @ts-ignore\n return getThemeProxied(config.themes[config.defaultTheme], config.defaultTheme)\n }\n\n const state = useServerRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n\n const { name, theme, themes, themeManager, className } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate,\n state.current.uuid\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.debug === 'verbose') {\n // eslint-disable-next-line no-console\n console.groupCollapsed(' \uD83D\uDD39 useTheme =>', name)\n const logs = { themeName, componentName, name, className, ...(isDevTools && { theme }) }\n for (const key in logs) {\n // eslint-disable-next-line no-console\n console.log(' ', key, logs[key])\n }\n // eslint-disable-next-line no-console\n console.groupEnd()\n }\n }\n\n // track usage\n state.current.isRendering = true\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n const debugProp = props && props['debug']\n\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('No theme with name', themeName)\n }\n return themes[getConfig().defaultTheme || 'light']\n }\n\n return useMemo(() => {\n return getThemeProxied(theme, name, className, themeManager, state, debugProp)\n }, [theme, name, className, themeManager, state, debugProp])\n}\n\nfunction getThemeProxied(\n theme: any,\n name: string,\n className?: string,\n themeManager?: ThemeManager | null,\n state?: React.MutableRefObject<UseThemeState>,\n debugProp?: boolean | 'verbose'\n) {\n return createProxy(theme, {\n has(_, key) {\n if (typeof key === 'string' && key[0] === '$') {\n key = key.slice(1)\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (key === GetThemeUnwrapped) {\n return theme\n }\n if (key === GetThemeManager) {\n return themeManager\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!name || key === '__proto__' || typeof key === 'symbol' || key === '$typeof') {\n return Reflect.get(_, key)\n }\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n if (!themeManager) {\n return theme[key]\n }\n if (state) {\n if (state.current.isRendering && !state.current.keys.has(key)) {\n state.current.keys.add(key)\n if (process.env.NODE_ENV === 'development' && debugProp === 'verbose') {\n // eslint-disable-next-line no-console\n console.log(' \uD83D\uDD38 tracking theme', key)\n }\n }\n }\n return themeManager.getValue(key)\n },\n })\n}\n\nconst GetThemeManager = Symbol()\n\nexport const getThemeManager = (theme: any): ThemeManager | undefined => {\n if (!theme) return\n return theme[GetThemeManager]\n}\n\nexport const useThemeName = (opts?: { parent?: true }) => {\n if (isRSC) {\n const config = getConfig()\n return config.defaultTheme || 'light'\n }\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const activeThemeManagers = new Set<ThemeManager>()\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdateProp?: any,\n uuid?: Object\n): {\n themes: Record<string, ThemeParsed>\n themeManager: ThemeManager | null\n name: string\n theme: ThemeParsed | null\n className?: string\n} => {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error(\n `Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering.`\n )\n }\n }\n\n const { themes } = config\n\n if (isRSC) {\n // we need context working for this to work well\n const parentManager = new ThemeManager('light', 'light', themes.light)\n const next = parentManager.getNextTheme({\n name,\n componentName,\n themes,\n reset: props?.reset,\n })\n return {\n ...next,\n themes,\n themeManager: null,\n }\n }\n\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const reset = props?.reset || false\n const getThemeProps: GetNextThemeProps = {\n name,\n componentName,\n themes,\n reset,\n }\n const next = parentManager.getNextTheme(getThemeProps, debug)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const forceUpdate = forceUpdateProp || useForceUpdate()\n\n const themeManager = useMemo(() => {\n return new ThemeManager(next.name, next.className, next.theme, parentManager, reset)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // not concurrent safe but fixes native (but breaks SSR and not needed on web (i think) so leave only on native)\n let didChange = false\n if (process.env.TAMAGUI_TARGET === 'native') {\n didChange = Boolean(\n next?.name !== themeManager.name || next?.className !== themeManager.className\n )\n if (didChange) {\n themeManager.update(next, false, false)\n }\n }\n\n if (!isServer) {\n useLayoutEffect(() => {\n themeManager.update(next, didChange)\n activeThemeManagers.add(themeManager)\n\n const disposeParentOnChange = parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme(getThemeProps, debug)\n if (!next) return\n if (themeManager.update(next)) {\n if (uuid && !themeManager.isTracking(uuid)) {\n // no need to re-render if not tracking any keys\n return\n }\n if (process.env.NODE_ENV === 'development' && debug) {\n // eslint-disable-next-line no-console\n console.log('Changed theme', componentName, next, { props })\n }\n forceUpdate()\n }\n })\n\n return () => {\n activeThemeManagers.delete(themeManager)\n disposeParentOnChange()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [didChange, themes, next?.name, next?.className, componentName, debug])\n }\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n className: next.className === parentManager.className ? undefined : next.className,\n themes,\n themeManager,\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,OAAO,UAAU,iCAAiC;AAC3D,SAAS,sBAAsB;AAC/B,SAAgB,YAAY,iBAAiB,SAAiB,gBAAgB;AAE9E,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAkBtB,MAAM,WAAW,CACtB,WACA,eACA,OACA,gBACgB;AAEhB,MAAI,OAAO;AACT,UAAM,SAAS,UAAU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AAA,EACF;AACF;",
4
+ "sourcesContent": ["import { isRSC, isServer, useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { useForceUpdate } from '@tamagui/use-force-update'\nimport React, { useContext, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport { getConfig } from '../config'\nimport { isDevTools } from '../constants/isDevTools'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { areEqualSets } from '../helpers/areEqualSets'\nimport { createProxy } from '../helpers/createProxy'\nimport {\n GetNextThemeProps,\n ThemeManager,\n ThemeManagerContext,\n emptyManager,\n} from '../helpers/ThemeManager'\nimport { ThemeName, ThemeParsed } from '../types'\nimport { GetThemeUnwrapped } from './getThemeUnwrapped'\nimport { useServerRef } from './useServerHooks'\n\nexport interface ThemeProps {\n className?: string\n disableThemeClass?: boolean\n name: Exclude<ThemeName, number> | null\n componentName?: string\n children?: any\n reset?: boolean\n debug?: boolean | 'verbose'\n}\n\ninterface UseThemeState {\n uuid: Object\n keys: Set<string>\n isRendering: boolean\n}\n\nexport const useTheme = (\n themeName?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdate?: any\n): ThemeParsed => {\n // TODO this can use useChangeThemeEffect almost ready\n if (isRSC) {\n const config = getConfig()\n // @ts-ignore\n return getThemeProxied(config.themes[config.defaultTheme], config.defaultTheme)\n }\n\n const state = useServerRef() as React.MutableRefObject<UseThemeState>\n if (!state.current) {\n state.current = {\n uuid: {},\n keys: new Set(),\n isRendering: true,\n }\n }\n\n const { name, theme, themes, themeManager, className } = useChangeThemeEffect(\n themeName,\n componentName,\n props,\n forceUpdate,\n state.current.uuid\n )\n\n if (process.env.NODE_ENV === 'development') {\n if (props?.debug === 'verbose') {\n // eslint-disable-next-line no-console\n console.groupCollapsed(' \uD83D\uDD39 useTheme =>', name)\n const logs = { themeName, componentName, name, className, ...(isDevTools && { theme }) }\n for (const key in logs) {\n // eslint-disable-next-line no-console\n console.log(' ', key, logs[key])\n }\n // eslint-disable-next-line no-console\n console.groupEnd()\n }\n }\n\n // track usage\n state.current.isRendering = true\n useIsomorphicLayoutEffect(() => {\n const st = state.current\n st.isRendering = false\n const cur = themeManager?.keys.get(st.uuid)\n if (!cur || !areEqualSets(st.keys, cur)) {\n themeManager?.track(st.uuid, st.keys)\n }\n })\n\n const debugProp = props && props['debug']\n\n if (!theme) {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('No theme with name', themeName)\n }\n return themes[Object.keys(themes)[0]]\n }\n\n return useMemo(() => {\n return getThemeProxied(theme, name, className, themeManager, state, debugProp)\n }, [theme, name, className, themeManager, state, debugProp])\n}\n\nfunction getThemeProxied(\n theme: any,\n name: string,\n className?: string,\n themeManager?: ThemeManager | null,\n state?: React.MutableRefObject<UseThemeState>,\n debugProp?: boolean | 'verbose'\n) {\n return createProxy(theme, {\n has(_, key) {\n if (typeof key === 'string' && key[0] === '$') {\n key = key.slice(1)\n }\n return Reflect.has(theme, key)\n },\n get(_, key) {\n if (key === GetThemeUnwrapped) {\n return theme\n }\n if (key === GetThemeManager) {\n return themeManager\n }\n if (key === 'name') {\n return name\n }\n if (key === 'className') {\n return className\n }\n if (!name || key === '__proto__' || typeof key === 'symbol' || key === '$typeof') {\n return Reflect.get(_, key)\n }\n // auto convert variables to plain\n if (key[0] === '$') {\n key = key.slice(1)\n }\n if (!themeManager) {\n return theme[key]\n }\n if (state) {\n if (state.current.isRendering && !state.current.keys.has(key)) {\n state.current.keys.add(key)\n if (process.env.NODE_ENV === 'development' && debugProp === 'verbose') {\n // eslint-disable-next-line no-console\n console.log(' \uD83D\uDD38 tracking theme', key)\n }\n }\n }\n return themeManager.getValue(key)\n },\n })\n}\n\nconst GetThemeManager = Symbol()\n\nexport const getThemeManager = (theme: any): ThemeManager | undefined => {\n if (!theme) return\n return theme[GetThemeManager]\n}\n\nexport function useThemeName(opts?: { parent?: true }): ThemeName {\n if (isRSC) {\n const config = getConfig()\n return config.themes[Object.keys(config.themes)[0]] as any\n }\n const parent = useContext(ThemeManagerContext)\n const [name, setName] = useState(parent?.name || '')\n\n useIsomorphicLayoutEffect(() => {\n if (!parent) return\n return parent.onChangeTheme((next, manager) => {\n const name = opts?.parent ? manager.parentName || next : next\n if (!name) return\n setName(name)\n })\n }, [parent])\n\n return name\n}\n\nexport const useDefaultThemeName = () => {\n return useContext(ThemeContext)?.defaultTheme\n}\n\nexport const activeThemeManagers = new Set<ThemeManager>()\n\nexport const useChangeThemeEffect = (\n name?: string | null,\n componentName?: string,\n props?: ThemeProps,\n forceUpdateProp?: any,\n uuid?: Object\n): {\n themes: Record<string, ThemeParsed>\n themeManager: ThemeManager | null\n name: string\n theme: ThemeParsed | null\n className?: string\n} => {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error(\n `Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering.`\n )\n }\n }\n\n const { themes } = config\n\n if (isRSC) {\n // we need context working for this to work well\n const parentManager = new ThemeManager('light', 'light', themes.light)\n const next = parentManager.getNextTheme({\n name,\n componentName,\n themes,\n reset: props?.reset,\n })\n return {\n ...next,\n themes,\n themeManager: null,\n }\n }\n\n const debug = props && props['debug']\n const parentManager = useContext(ThemeManagerContext) || emptyManager\n const reset = props?.reset || false\n const getThemeProps: GetNextThemeProps = {\n name,\n componentName,\n themes,\n reset,\n }\n const next = parentManager.getNextTheme(getThemeProps, debug)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const forceUpdate = forceUpdateProp || useForceUpdate()\n\n const themeManager = useMemo(() => {\n return new ThemeManager(next.name, next.className, next.theme, parentManager, reset)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // not concurrent safe but fixes native (but breaks SSR and not needed on web (i think) so leave only on native)\n let didChange = false\n if (process.env.TAMAGUI_TARGET === 'native') {\n didChange = Boolean(\n next?.name !== themeManager.name || next?.className !== themeManager.className\n )\n if (didChange) {\n themeManager.update(next, false, false)\n }\n }\n\n if (!isServer) {\n useLayoutEffect(() => {\n themeManager.update(next, didChange)\n activeThemeManagers.add(themeManager)\n\n const disposeParentOnChange = parentManager.onChangeTheme(() => {\n const next = parentManager.getNextTheme(getThemeProps, debug)\n if (!next) return\n if (themeManager.update(next)) {\n if (uuid && !themeManager.isTracking(uuid)) {\n // no need to re-render if not tracking any keys\n return\n }\n if (process.env.NODE_ENV === 'development' && debug) {\n // eslint-disable-next-line no-console\n console.log('Changed theme', componentName, next, { props })\n }\n forceUpdate()\n }\n })\n\n return () => {\n activeThemeManagers.delete(themeManager)\n disposeParentOnChange()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [didChange, themes, next?.name, next?.className, componentName, debug])\n }\n\n return {\n ...(parentManager && {\n name: parentManager.name,\n theme: parentManager.theme,\n }),\n ...next,\n className: next.className === parentManager.className ? undefined : next.className,\n themes,\n themeManager,\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,OAAO,UAAU,iCAAiC;AAC3D,SAAS,sBAAsB;AAC/B,SAAgB,YAAY,iBAAiB,SAAiB,gBAAgB;AAE9E,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAkBtB,MAAM,WAAW,CACtB,WACA,eACA,OACA,gBACgB;AAEhB,MAAI,OAAO;AACT,UAAM,SAAS,UAAU;AAEzB,WAAO,gBAAgB,OAAO,OAAO,OAAO,eAAe,OAAO,YAAY;AAAA,EAChF;AAEA,QAAM,QAAQ,aAAa;AAC3B,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,UAAU;AAAA,MACd,MAAM,CAAC;AAAA,MACP,MAAM,oBAAI,IAAI;AAAA,MACd,aAAa;AAAA,IACf;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,OAAO,QAAQ,cAAc,UAAU,IAAI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V,6BAAM,UAAS,aAAa,SAAQ,6BAAM,eAAc,aAAa;AAAA,IACvE;AACA,QAAI,WAAW;AACb,mBAAa,OAAO,MAAM,OAAO,KAAK;AAAA,IACxC;AAAA,EACF;AAEA,MAAI,CAAC,UAAU;AACb,oBAAgB,MAAM;AACpB,mBAAa,OAAO,MAAM,SAAS;AACnC,0BAAoB,IAAI,YAAY;AAEpC,YAAM,wBAAwB,cAAc,cAAc,MAAM;AAC9D,cAAMA,QAAO,cAAc,aAAa,eAAe,KAAK;AAC5D,YAAI,CAACA;AAAM;AACX,YAAI,aAAa,OAAOA,KAAI,GAAG;AAC7B,cAAI,QAAQ,CAAC,aAAa,WAAW,IAAI,GAAG;AAE1C;AAAA,UACF;AACA,cAAI,QAAQ,IAAI,aAAa,iBAAiB,OAAO;AAEnD,oBAAQ,IAAI,iBAAiB,eAAeA,OAAM,EAAE,MAAM,CAAC;AAAA,UAC7D;AACA,sBAAY;AAAA,QACd;AAAA,MACF,CAAC;AAED,aAAO,MAAM;AACX,4BAAoB,OAAO,YAAY;AACvC,8BAAsB;AAAA,MACxB;AAAA,IAEF,GAAG,CAAC,WAAW,QAAQ,6BAAM,MAAM,6BAAM,WAAW,eAAe,KAAK,CAAC;AAAA,EAC3E;AAEA,SAAO;AAAA,IACL,GAAI,iBAAiB;AAAA,MACnB,MAAM,cAAc;AAAA,MACpB,OAAO,cAAc;AAAA,IACvB;AAAA,IACA,GAAG;AAAA,IACH,WAAW,KAAK,cAAc,cAAc,YAAY,SAAY,KAAK;AAAA,IACzE;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": ["name", "parentManager", "next"]
7
7
  }
@@ -5,6 +5,7 @@ import { ButtonInsideButtonContext } from "../contexts/ButtonInsideButtonContext
5
5
  import { TextAncestorContext } from "../contexts/TextAncestorContext";
6
6
  import { useMediaListeners } from "../hooks/useMedia";
7
7
  import { ThemeProvider } from "./ThemeProvider";
8
+ import { getConfig } from "..";
8
9
  function TamaguiProvider({
9
10
  children,
10
11
  disableInjectCSS,
@@ -12,9 +13,10 @@ function TamaguiProvider({
12
13
  ...themePropsProvider
13
14
  }) {
14
15
  if (isRSC) {
16
+ const { themes: themes2 } = getConfig();
15
17
  return /* @__PURE__ */ jsx("span", {
16
18
  style: { display: "contents" },
17
- className: `t_${config.defaultTheme || "light"}`,
19
+ className: `t_${Object.keys(themes2)[0] || "light"}`,
18
20
  children
19
21
  });
20
22
  }
@@ -33,15 +35,16 @@ function TamaguiProvider({
33
35
  };
34
36
  }, [config, disableInjectCSS]);
35
37
  }
38
+ const { themes } = getConfig();
36
39
  return /* @__PURE__ */ jsx(ButtonInsideButtonContext.Provider, {
37
40
  value: false,
38
41
  children: /* @__PURE__ */ jsx(TextAncestorContext.Provider, {
39
42
  value: false,
40
43
  children: /* @__PURE__ */ jsx(ThemeProvider, {
41
- defaultTheme: config.defaultTheme || "light",
42
44
  themeClassNameOnRoot: config.themeClassNameOnRoot,
43
45
  disableRootThemeClass: config.disableRootThemeClass,
44
46
  ...themePropsProvider,
47
+ defaultTheme: themePropsProvider.defaultTheme ?? Object.keys(themes)[0],
45
48
  children
46
49
  })
47
50
  })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/views/TamaguiProvider.tsx"],
4
- "sourcesContent": ["import { isClient, isRSC, isServer } from '@tamagui/constants'\nimport * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TextAncestorContext } from '../contexts/TextAncestorContext'\nimport { useMediaListeners } from '../hooks/useMedia'\nimport type { TamaguiProviderProps } from '../types'\nimport { ThemeProvider } from './ThemeProvider'\n\nexport function TamaguiProvider({\n children,\n disableInjectCSS,\n config,\n ...themePropsProvider\n}: TamaguiProviderProps) {\n if (isRSC) {\n return (\n <span style={{ display: 'contents' }} className={`t_${config.defaultTheme || 'light'}`}>\n {children}\n </span>\n )\n }\n\n if (!isServer) {\n useMediaListeners(config)\n }\n\n if (isClient) {\n // inject CSS if asked to (not SSR compliant)\n // eslint-disable-next-line react-hooks/rules-of-hooks\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 }, [config, disableInjectCSS])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorContext.Provider value={false}>\n <ThemeProvider\n defaultTheme={config.defaultTheme || 'light'}\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n >\n {children}\n </ThemeProvider>\n </TextAncestorContext.Provider>\n </ButtonInsideButtonContext.Provider>\n )\n}\n"],
5
- "mappings": "AAiBM;AAjBN,SAAS,UAAU,OAAO,gBAAgB;AAC1C,YAAY,WAAW;AAEvB,SAAS,iCAAiC;AAC1C,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAElC,SAAS,qBAAqB;AAEvB,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,KACG;AACL,GAAyB;AACvB,MAAI,OAAO;AACT,WACE,oBAAC;AAAA,MAAK,OAAO,EAAE,SAAS,WAAW;AAAA,MAAG,WAAW,KAAK,OAAO,gBAAgB;AAAA,MAC1E;AAAA,KACH;AAAA,EAEJ;AAEA,MAAI,CAAC,UAAU;AACb,sBAAkB,MAAM;AAAA,EAC1B;AAEA,MAAI,UAAU;AAGZ,UAAM,gBAAgB,MAAM;AAC1B,UAAI;AAAkB;AACtB,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,YAAY,SAAS,eAAe,OAAO,OAAO,CAAC,CAAC;AAC1D,eAAS,KAAK,YAAY,KAAK;AAC/B,aAAO,MAAM;AACX,iBAAS,KAAK,YAAY,KAAK;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,QAAQ,gBAAgB,CAAC;AAAA,EAC/B;AAEA,SACE,oBAAC,0BAA0B,UAA1B;AAAA,IAAmC,OAAO;AAAA,IACzC,8BAAC,oBAAoB,UAApB;AAAA,MAA6B,OAAO;AAAA,MACnC,8BAAC;AAAA,QACC,cAAc,OAAO,gBAAgB;AAAA,QACrC,sBAAsB,OAAO;AAAA,QAC7B,uBAAuB,OAAO;AAAA,QAC7B,GAAG;AAAA,QAEH;AAAA,OACH;AAAA,KACF;AAAA,GACF;AAEJ;",
6
- "names": []
4
+ "sourcesContent": ["import { isClient, isRSC, isServer } from '@tamagui/constants'\nimport * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TextAncestorContext } from '../contexts/TextAncestorContext'\nimport { useMediaListeners } from '../hooks/useMedia'\nimport type { TamaguiProviderProps } from '../types'\nimport { ThemeProvider } from './ThemeProvider'\nimport { getConfig } from '..'\n\nexport function TamaguiProvider({\n children,\n disableInjectCSS,\n config,\n ...themePropsProvider\n}: TamaguiProviderProps) {\n if (isRSC) {\n const { themes } = getConfig()\n return (\n <span style={{ display: 'contents' }} className={`t_${Object.keys(themes)[0] || 'light'}`}>\n {children}\n </span>\n )\n }\n\n if (!isServer) {\n useMediaListeners(config)\n }\n\n if (isClient) {\n // inject CSS if asked to (not SSR compliant)\n // eslint-disable-next-line react-hooks/rules-of-hooks\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 }, [config, disableInjectCSS])\n }\n\n const { themes } = getConfig()\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorContext.Provider value={false}>\n <ThemeProvider\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n defaultTheme={themePropsProvider.defaultTheme ?? Object.keys(themes)[0]}\n >\n {children}\n </ThemeProvider>\n </TextAncestorContext.Provider>\n </ButtonInsideButtonContext.Provider>\n )\n}\n"],
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6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "1.0.1-beta.206",
3
+ "version": "1.0.1-beta.208",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -28,23 +28,23 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@expo/match-media": "^0.3.0",
31
- "@tamagui/compose-refs": "^1.0.1-beta.206",
32
- "@tamagui/constants": "^1.0.1-beta.206",
33
- "@tamagui/helpers": "^1.0.1-beta.206",
34
- "@tamagui/normalize-css-color-lite": "^1.0.1-beta.206",
35
- "@tamagui/react-native-use-pressable": "^1.0.1-beta.206",
36
- "@tamagui/react-native-use-responder-events": "^1.0.1-beta.206",
37
- "@tamagui/types-react-native": "^1.0.1-beta.206",
38
- "@tamagui/use-did-finish-ssr": "^1.0.1-beta.206",
39
- "@tamagui/use-event": "^1.0.1-beta.206",
40
- "@tamagui/use-force-update": "^1.0.1-beta.206"
31
+ "@tamagui/compose-refs": "^1.0.1-beta.208",
32
+ "@tamagui/constants": "^1.0.1-beta.208",
33
+ "@tamagui/helpers": "^1.0.1-beta.208",
34
+ "@tamagui/normalize-css-color-lite": "^1.0.1-beta.208",
35
+ "@tamagui/react-native-use-pressable": "^1.0.1-beta.208",
36
+ "@tamagui/react-native-use-responder-events": "^1.0.1-beta.208",
37
+ "@tamagui/types-react-native": "^1.0.1-beta.208",
38
+ "@tamagui/use-did-finish-ssr": "^1.0.1-beta.208",
39
+ "@tamagui/use-event": "^1.0.1-beta.208",
40
+ "@tamagui/use-force-update": "^1.0.1-beta.208"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": "*",
44
44
  "react-dom": "*"
45
45
  },
46
46
  "devDependencies": {
47
- "@tamagui/build": "^1.0.1-beta.206",
47
+ "@tamagui/build": "^1.0.1-beta.208",
48
48
  "@types/node": "^16.11.9",
49
49
  "@types/react": "^18.0.15",
50
50
  "@types/react-native": "^0.69.2",
@@ -966,11 +966,13 @@ export function createComponent<
966
966
  }
967
967
 
968
968
  if (!initialTheme) {
969
- const next = conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]
969
+ const next = conf.themes[Object.keys(conf.themes)[0]]
970
970
  initialTheme = proxyThemeVariables(next)
971
- if (!initialTheme && process.env.NODE_ENV === 'development') {
972
- // eslint-disable-next-line no-console
973
- console.log(`Warning: Missing theme`)
971
+ if (process.env.NODE_ENV === 'development') {
972
+ if (!initialTheme) {
973
+ // eslint-disable-next-line no-console
974
+ console.log(`Warning: Missing theme`)
975
+ }
974
976
  }
975
977
  }
976
978
  }
@@ -181,7 +181,6 @@ export function createTamagui<Conf extends CreateTamaguiProps>(
181
181
  const shorthands = configIn.shorthands || {}
182
182
  const config: TamaguiInternalConfig = {
183
183
  fontLanguages: [],
184
- defaultTheme: 'light',
185
184
  animations: {} as any,
186
185
  media: {},
187
186
  ...configIn,
@@ -188,6 +188,7 @@ export const getSplitStyles: StyleSplitter = (
188
188
  const mediaKeys: string[] = []
189
189
  const viewProps: SplitStylesAndProps['viewProps'] = {}
190
190
  const pseudos: PseudoStyles = {}
191
+ let psuedosUsed: Record<string, number> | null = null
191
192
  const medias: Record<MediaQueryKey, ViewStyle> = {}
192
193
  const mediaState = state.mediaState || globalMediaState
193
194
  const usedKeys: Record<string, number> = {}
@@ -261,6 +262,12 @@ export const getSplitStyles: StyleSplitter = (
261
262
  }
262
263
  }
263
264
 
265
+ if (keyInit === 'testID') {
266
+ usedKeys[keyInit] = 1
267
+ viewProps['data-testid'] = valInit
268
+ continue
269
+ }
270
+
264
271
  if (keyInit === 'id' || keyInit === 'nativeID') {
265
272
  usedKeys[keyInit] = 1
266
273
  if (staticConfig.isReactNative) {
@@ -275,6 +282,13 @@ export const getSplitStyles: StyleSplitter = (
275
282
 
276
283
  if (staticConfig.isReactNative) {
277
284
  didUseKeyInit = false
285
+
286
+ // pass along to react-native-web
287
+ if (accessibilityDirectMap[keyInit] || keyInit.startsWith('accessibility')) {
288
+ viewProps[keyInit] = valInit
289
+ usedKeys[keyInit] = 1
290
+ continue
291
+ }
278
292
  } else {
279
293
  if (accessibilityDirectMap[keyInit]) {
280
294
  viewProps[accessibilityDirectMap[keyInit]] = valInit
@@ -512,19 +526,33 @@ export const getSplitStyles: StyleSplitter = (
512
526
  continue
513
527
  }
514
528
 
515
- if (shouldDoClasses) {
516
- const pseudoStyles = getAtomicStyle(pseudoStyleObject, pseudoDescriptors[key])
517
- for (const style of pseudoStyles) {
518
- const postfix = pseudoDescriptors[key]?.name || key // exitStyle/enterStyle dont have pseudoDescriptors
519
- const fullKey = `${style.property}${PROP_SPLIT}${postfix}`
520
- if (!usedKeys[fullKey]) {
521
- usedKeys[fullKey] = 1
522
- addStyleToInsertRules(rulesToInsert, style)
523
- mergeClassName(transforms, classNames, fullKey, style.identifier, isMediaOrPseudo)
529
+ const pseudoStyles = getAtomicStyle(pseudoStyleObject, pseudoDescriptors[key])
530
+ for (const psuedoStyle of pseudoStyles) {
531
+ const postfix = pseudoDescriptors[key]?.name || key // exitStyle/enterStyle dont have pseudoDescriptors
532
+ const fullKey = shouldDoClasses
533
+ ? `${psuedoStyle.property}${PROP_SPLIT}${postfix}`
534
+ : psuedoStyle.property
535
+ if (!usedKeys[fullKey]) {
536
+ usedKeys[fullKey] = 1
537
+ if (shouldDoClasses) {
538
+ addStyleToInsertRules(rulesToInsert, psuedoStyle)
539
+ mergeClassName(
540
+ transforms,
541
+ classNames,
542
+ fullKey,
543
+ psuedoStyle.identifier,
544
+ isMediaOrPseudo
545
+ )
546
+ } else {
547
+ psuedosUsed ??= {}
548
+ psuedosUsed[psuedoStyle.property] ??= 0
549
+ const importance = pseudoDescriptors[key].priority
550
+ if (psuedosUsed[importance] <= importance) {
551
+ psuedosUsed[psuedoStyle.property] = importance
552
+ style[psuedoStyle.property] = psuedoStyle.value
553
+ }
524
554
  }
525
555
  }
526
- } else {
527
- // need same treatment as media (individual merge + importance) + can avoid calling getSubStyle entirely when state = off
528
556
  }
529
557
  continue
530
558
  }
@@ -639,14 +667,18 @@ export const getSplitStyles: StyleSplitter = (
639
667
 
640
668
  if (process.env.TAMAGUI_TARGET === 'web') {
641
669
  if (shouldDoClasses) {
642
- const atomic = getStylesAtomic(style)
643
- for (const atomicStyle of atomic) {
644
- const key = atomicStyle.property
645
- addStyleToInsertRules(rulesToInsert, atomicStyle)
646
- mergeClassName(transforms, classNames, key, atomicStyle.identifier)
647
- }
648
- if (!IS_STATIC) {
649
- style = emptyObject
670
+ if (style['$$css']) {
671
+ // avoid re-processing for rnw
672
+ } else {
673
+ const atomic = getStylesAtomic(style)
674
+ for (const atomicStyle of atomic) {
675
+ const key = atomicStyle.property
676
+ addStyleToInsertRules(rulesToInsert, atomicStyle)
677
+ mergeClassName(transforms, classNames, key, atomicStyle.identifier)
678
+ }
679
+ if (!IS_STATIC) {
680
+ style = emptyObject
681
+ }
650
682
  }
651
683
  }
652
684
 
@@ -4,8 +4,8 @@ import { ThemeName } from '../types'
4
4
  import { Theme } from '../views/Theme'
5
5
  import { ThemeInverse } from '../views/ThemeInverse'
6
6
 
7
- export type ThemeableProps = {
8
- theme?: ThemeName | string | null
7
+ export interface ThemeableProps {
8
+ theme?: ThemeName | null
9
9
  themeInverse?: boolean
10
10
  }
11
11
 
@@ -35,11 +35,6 @@ export function themeable<Component extends (props: any) => any>(
35
35
  })`
36
36
 
37
37
  return withTheme as Component extends (props: infer P) => infer R
38
- ? (
39
- props: Omit<P, 'theme' | 'themeInverse'> & {
40
- theme?: ThemeName | null
41
- themeInverse?: boolean
42
- }
43
- ) => R
38
+ ? (props: Omit<P, 'theme' | 'themeInverse'> & ThemeableProps) => R
44
39
  : unknown
45
40
  }
@@ -95,7 +95,7 @@ export const useTheme = (
95
95
  // eslint-disable-next-line no-console
96
96
  console.warn('No theme with name', themeName)
97
97
  }
98
- return themes[getConfig().defaultTheme || 'light']
98
+ return themes[Object.keys(themes)[0]]
99
99
  }
100
100
 
101
101
  return useMemo(() => {
@@ -162,10 +162,10 @@ export const getThemeManager = (theme: any): ThemeManager | undefined => {
162
162
  return theme[GetThemeManager]
163
163
  }
164
164
 
165
- export const useThemeName = (opts?: { parent?: true }) => {
165
+ export function useThemeName(opts?: { parent?: true }): ThemeName {
166
166
  if (isRSC) {
167
167
  const config = getConfig()
168
- return config.defaultTheme || 'light'
168
+ return config.themes[Object.keys(config.themes)[0]] as any
169
169
  }
170
170
  const parent = useContext(ThemeManagerContext)
171
171
  const [name, setName] = useState(parent?.name || '')