@tamagui/web 1.74.12 → 1.74.14

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 (132) hide show
  1. package/dist/cjs/createComponent.js +38 -24
  2. package/dist/cjs/createComponent.js.map +1 -1
  3. package/dist/cjs/createComponent.native.js +11 -7
  4. package/dist/cjs/createComponent.native.js.map +1 -1
  5. package/dist/cjs/helpers/createMediaStyle.js +3 -3
  6. package/dist/cjs/helpers/createMediaStyle.js.map +1 -1
  7. package/dist/cjs/helpers/createMediaStyle.native.js +3 -3
  8. package/dist/cjs/helpers/createMediaStyle.native.js.map +1 -1
  9. package/dist/cjs/helpers/getSplitStyles.js +6 -6
  10. package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
  11. package/dist/cjs/helpers/getSplitStyles.native.js +6 -6
  12. package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
  13. package/dist/cjs/helpers/themeable.js +6 -18
  14. package/dist/cjs/helpers/themeable.js.map +2 -2
  15. package/dist/cjs/helpers/themeable.native.js +6 -18
  16. package/dist/cjs/helpers/themeable.native.js.map +2 -2
  17. package/dist/cjs/hooks/useMedia.js +13 -1
  18. package/dist/cjs/hooks/useMedia.js.map +1 -1
  19. package/dist/cjs/hooks/useMedia.native.js +13 -1
  20. package/dist/cjs/hooks/useMedia.native.js.map +1 -1
  21. package/dist/cjs/hooks/useProps.js +1 -0
  22. package/dist/cjs/hooks/useProps.js.map +1 -1
  23. package/dist/cjs/hooks/useProps.native.js +1 -0
  24. package/dist/cjs/hooks/useProps.native.js.map +1 -1
  25. package/dist/cjs/views/Theme.js +18 -10
  26. package/dist/cjs/views/Theme.js.map +1 -1
  27. package/dist/cjs/views/Theme.native.js +18 -10
  28. package/dist/cjs/views/Theme.native.js.map +1 -1
  29. package/dist/esm/createComponent.js +38 -24
  30. package/dist/esm/createComponent.js.map +1 -1
  31. package/dist/esm/createComponent.native.js +11 -7
  32. package/dist/esm/createComponent.native.js.map +1 -1
  33. package/dist/esm/helpers/createMediaStyle.js +3 -3
  34. package/dist/esm/helpers/createMediaStyle.js.map +1 -1
  35. package/dist/esm/helpers/createMediaStyle.native.js +3 -3
  36. package/dist/esm/helpers/createMediaStyle.native.js.map +1 -1
  37. package/dist/esm/helpers/getSplitStyles.js +6 -6
  38. package/dist/esm/helpers/getSplitStyles.js.map +1 -1
  39. package/dist/esm/helpers/getSplitStyles.native.js +6 -6
  40. package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
  41. package/dist/esm/helpers/themeable.js +4 -8
  42. package/dist/esm/helpers/themeable.js.map +1 -1
  43. package/dist/esm/helpers/themeable.native.js +4 -8
  44. package/dist/esm/helpers/themeable.native.js.map +1 -1
  45. package/dist/esm/hooks/useMedia.js +13 -1
  46. package/dist/esm/hooks/useMedia.js.map +1 -1
  47. package/dist/esm/hooks/useMedia.native.js +13 -1
  48. package/dist/esm/hooks/useMedia.native.js.map +1 -1
  49. package/dist/esm/hooks/useProps.js +1 -0
  50. package/dist/esm/hooks/useProps.js.map +1 -1
  51. package/dist/esm/hooks/useProps.native.js +1 -0
  52. package/dist/esm/hooks/useProps.native.js.map +1 -1
  53. package/dist/esm/views/Theme.js +14 -8
  54. package/dist/esm/views/Theme.js.map +1 -1
  55. package/dist/esm/views/Theme.native.js +14 -8
  56. package/dist/esm/views/Theme.native.js.map +1 -1
  57. package/package.json +9 -9
  58. package/src/createComponent.tsx +60 -23
  59. package/src/helpers/createMediaStyle.ts +7 -6
  60. package/src/helpers/getSplitStyles.tsx +9 -8
  61. package/src/helpers/themeable.tsx +6 -9
  62. package/src/hooks/useMedia.tsx +11 -9
  63. package/src/hooks/useProps.tsx +1 -0
  64. package/src/types.tsx +10 -1
  65. package/src/views/Theme.tsx +24 -20
  66. package/types/createComponent.d.ts.map +1 -1
  67. package/types/helpers/createMediaStyle.d.ts +2 -2
  68. package/types/helpers/createMediaStyle.d.ts.map +1 -1
  69. package/types/helpers/getSplitStyles.d.ts.map +1 -1
  70. package/types/helpers/themeable.d.ts +1 -1
  71. package/types/helpers/themeable.d.ts.map +1 -1
  72. package/types/hooks/useMedia.d.ts +2 -2
  73. package/types/hooks/useMedia.d.ts.map +1 -1
  74. package/types/hooks/useProps.d.ts.map +1 -1
  75. package/types/types.d.ts +8 -1
  76. package/types/types.d.ts.map +1 -1
  77. package/types/views/Theme.d.ts +7 -1
  78. package/types/views/Theme.d.ts.map +1 -1
  79. package/dist/cjs/contexts/AnimationDriverContext.js +0 -30
  80. package/dist/cjs/contexts/AnimationDriverContext.js.map +0 -6
  81. package/dist/cjs/contexts/AnimationDriverContext.native.js +0 -27
  82. package/dist/cjs/contexts/AnimationDriverContext.native.js.map +0 -6
  83. package/dist/cjs/contexts/ButtonNestingContext.js +0 -30
  84. package/dist/cjs/contexts/ButtonNestingContext.js.map +0 -6
  85. package/dist/cjs/contexts/ButtonNestingContext.native.js +0 -27
  86. package/dist/cjs/contexts/ButtonNestingContext.native.js.map +0 -6
  87. package/dist/cjs/contexts/FontLanguageContext.js +0 -30
  88. package/dist/cjs/contexts/FontLanguageContext.js.map +0 -6
  89. package/dist/cjs/contexts/FontLanguageContext.native.js +0 -27
  90. package/dist/cjs/contexts/FontLanguageContext.native.js.map +0 -6
  91. package/dist/cjs/contexts/TextAncestorContext.js +0 -30
  92. package/dist/cjs/contexts/TextAncestorContext.js.map +0 -6
  93. package/dist/cjs/contexts/TextAncestorContext.native.js +0 -27
  94. package/dist/cjs/contexts/TextAncestorContext.native.js.map +0 -6
  95. package/dist/cjs/helpers/getAnimationDriver.js +0 -32
  96. package/dist/cjs/helpers/getAnimationDriver.js.map +0 -6
  97. package/dist/cjs/helpers/getAnimationDriver.native.js +0 -29
  98. package/dist/cjs/helpers/getAnimationDriver.native.js.map +0 -6
  99. package/dist/cjs/helpers/useShallowSetState.js +0 -39
  100. package/dist/cjs/helpers/useShallowSetState.js.map +0 -6
  101. package/dist/cjs/helpers/useShallowSetState.native.js +0 -34
  102. package/dist/cjs/helpers/useShallowSetState.native.js.map +0 -6
  103. package/dist/cjs/hooks/useAnimationDriver.js +0 -34
  104. package/dist/cjs/hooks/useAnimationDriver.js.map +0 -6
  105. package/dist/cjs/hooks/useAnimationDriver.native.js +0 -27
  106. package/dist/cjs/hooks/useAnimationDriver.native.js.map +0 -6
  107. package/dist/cjs/hooks/useStyle.js +0 -64
  108. package/dist/cjs/hooks/useStyle.js.map +0 -6
  109. package/dist/cjs/hooks/useStyle.native.js +0 -49
  110. package/dist/cjs/hooks/useStyle.native.js.map +0 -6
  111. package/dist/cjs/views/AnimationDriverProvider.js +0 -33
  112. package/dist/cjs/views/AnimationDriverProvider.js.map +0 -6
  113. package/dist/cjs/views/AnimationDriverProvider.native.js +0 -27
  114. package/dist/cjs/views/AnimationDriverProvider.native.js.map +0 -6
  115. package/dist/esm/contexts/AnimationDriverContext.js +0 -6
  116. package/dist/esm/contexts/AnimationDriverContext.js.map +0 -6
  117. package/dist/esm/contexts/ButtonNestingContext.js +0 -6
  118. package/dist/esm/contexts/ButtonNestingContext.js.map +0 -6
  119. package/dist/esm/contexts/FontLanguageContext.js +0 -6
  120. package/dist/esm/contexts/FontLanguageContext.js.map +0 -6
  121. package/dist/esm/contexts/TextAncestorContext.js +0 -6
  122. package/dist/esm/contexts/TextAncestorContext.js.map +0 -6
  123. package/dist/esm/helpers/getAnimationDriver.js +0 -8
  124. package/dist/esm/helpers/getAnimationDriver.js.map +0 -6
  125. package/dist/esm/helpers/useShallowSetState.js +0 -15
  126. package/dist/esm/helpers/useShallowSetState.js.map +0 -6
  127. package/dist/esm/hooks/useAnimationDriver.js +0 -10
  128. package/dist/esm/hooks/useAnimationDriver.js.map +0 -6
  129. package/dist/esm/hooks/useStyle.js +0 -40
  130. package/dist/esm/hooks/useStyle.js.map +0 -6
  131. package/dist/esm/views/AnimationDriverProvider.js +0 -9
  132. package/dist/esm/views/AnimationDriverProvider.js.map +0 -6
@@ -49,6 +49,7 @@ import {
49
49
  SpacerProps,
50
50
  StackProps,
51
51
  StaticConfig,
52
+ StyleableOptions,
52
53
  TamaguiComponent,
53
54
  TamaguiComponentEvents,
54
55
  TamaguiComponentState,
@@ -62,7 +63,7 @@ import {
62
63
  WebOnlyPressEvents,
63
64
  } from './types'
64
65
  import { Slot } from './views/Slot'
65
- import { useThemedChildren } from './views/Theme'
66
+ import { getThemeCNStyle, useThemedChildren } from './views/Theme'
66
67
  import { ThemeDebug } from './views/ThemeDebug'
67
68
 
68
69
  // this appears to fix expo / babel not picking this up sometimes? really odd
@@ -725,6 +726,8 @@ export function createComponent<
725
726
  onMouseDown,
726
727
  onMouseEnter,
727
728
  onMouseLeave,
729
+ onFocus,
730
+ onBlur,
728
731
  separator,
729
732
  // ignore from here on out
730
733
  forceStyle: _forceStyle,
@@ -897,12 +900,20 @@ export function createComponent<
897
900
  let className: string | undefined
898
901
 
899
902
  if (process.env.TAMAGUI_TARGET === 'web') {
900
- const classList = [
901
- componentName ? componentClassName : '',
902
- fontFamilyClassName,
903
- classNames ? Object.values(classNames).join(' ') : '',
904
- groupClassName,
905
- ]
903
+ // TODO this could be moved into getSplitStyles right?
904
+ // const fromTheme = getThemeCNStyle(themeState)
905
+
906
+ let classList: string[] = []
907
+ if (componentName) classList.push(componentClassName)
908
+ if (fontFamilyClassName) classList.push(fontFamilyClassName)
909
+ if (classNames) classList.push(Object.values(classNames).join(' '))
910
+ if (groupClassName) classList.push(groupClassName)
911
+
912
+ // if (fromTheme) {
913
+ // classList.push(fromTheme.className)
914
+ // style.color ??= fromTheme.style?.color
915
+ // }
916
+
906
917
  className = classList.join(' ')
907
918
 
908
919
  if (isAnimatedReactNativeWeb && !avoidAnimationStyle) {
@@ -939,6 +950,7 @@ export function createComponent<
939
950
  // if its a group its gotta listen for pseudos to emit them to children
940
951
 
941
952
  const runtimePressStyle = !disabled && noClassNames && pseudos?.pressStyle
953
+ const runtimeFocusStyle = !disabled && noClassNames && pseudos?.focusStyle
942
954
  const attachPress = Boolean(
943
955
  groupName ||
944
956
  runtimePressStyle ||
@@ -958,7 +970,11 @@ export function createComponent<
958
970
  // check presence rather than value to prevent reparenting bugs
959
971
  // allows for onPress={x ? function : undefined} without re-ordering dom
960
972
  const shouldAttach = Boolean(
961
- attachPress || isHoverable || runtimePressStyle || runtimeHoverStyle
973
+ attachPress ||
974
+ isHoverable ||
975
+ runtimePressStyle ||
976
+ runtimeHoverStyle ||
977
+ runtimeFocusStyle
962
978
  )
963
979
 
964
980
  if (process.env.NODE_ENV === 'development' && time) time`events-setup`
@@ -1031,15 +1047,29 @@ export function createComponent<
1031
1047
  }
1032
1048
  }
1033
1049
  : undefined,
1034
- ...(process.env.TAMAGUI_TARGET === 'native' && {
1035
- onLongPress:
1036
- attachPress && onLongPress
1037
- ? (e) => {
1038
- unPress()
1039
- onLongPress?.(e)
1040
- }
1041
- : undefined,
1042
- }),
1050
+ ...(process.env.TAMAGUI_TARGET === 'native' &&
1051
+ attachPress &&
1052
+ onLongPress && {
1053
+ onLongPress: (e) => {
1054
+ unPress()
1055
+ onLongPress?.(e)
1056
+ },
1057
+ }),
1058
+ ...(process.env.TAMAGUI_TARGET === 'web' &&
1059
+ runtimeFocusStyle && {
1060
+ onFocus: (e) => {
1061
+ setStateShallow({
1062
+ focus: true,
1063
+ })
1064
+ onFocus?.(e)
1065
+ },
1066
+ onBlur: (e) => {
1067
+ setStateShallow({
1068
+ focus: false,
1069
+ })
1070
+ onBlur?.(e)
1071
+ },
1072
+ }),
1043
1073
  }
1044
1074
  : null
1045
1075
 
@@ -1057,6 +1087,10 @@ export function createComponent<
1057
1087
  })
1058
1088
  }
1059
1089
 
1090
+ if (process.env.TAMAGUI_TARGET === 'web' && events && !isReactNative) {
1091
+ Object.assign(viewProps, getWebEvents(events))
1092
+ }
1093
+
1060
1094
  if (process.env.NODE_ENV === 'development' && time) time`events`
1061
1095
 
1062
1096
  if (process.env.NODE_ENV === 'development' && debugProp === 'verbose') {
@@ -1175,7 +1209,7 @@ export function createComponent<
1175
1209
  // disable theme prop is deterministic so conditional hook ok here
1176
1210
  content = disableThemeProp
1177
1211
  ? content
1178
- : useThemedChildren(themeState, content, themeStateProps)
1212
+ : useThemedChildren(themeState, content, themeStateProps, false)
1179
1213
 
1180
1214
  if (process.env.NODE_ENV === 'development' && time) time`themed-children`
1181
1215
 
@@ -1188,7 +1222,7 @@ export function createComponent<
1188
1222
  }
1189
1223
 
1190
1224
  if (process.env.TAMAGUI_TARGET === 'web') {
1191
- if (events || isAnimatedReactNativeWeb) {
1225
+ if (isReactNative) {
1192
1226
  content = (
1193
1227
  <span
1194
1228
  className={`${isAnimatedReactNativeWeb ? className : ''} _dsp_contents`}
@@ -1317,15 +1351,16 @@ export function createComponent<
1317
1351
  return Component
1318
1352
  }
1319
1353
 
1320
- function styleable(Component: any, extended?: Partial<StaticConfig>) {
1354
+ function styleable(Component: any, options?: StyleableOptions) {
1321
1355
  const isForwardedRefAlready = Component.render?.length === 2
1322
1356
  const ComponentForwardedRef = isForwardedRefAlready
1323
1357
  ? (Component as any)
1324
1358
  : // memo because theme changes otherwise would always re-render
1325
1359
  memo(forwardRef(Component as any))
1326
-
1327
- const extendedConfig = extendStyledConfig(extended)
1328
- const out = themeable(ComponentForwardedRef, extendedConfig) as any
1360
+ const extendedConfig = extendStyledConfig(options?.staticConfig)
1361
+ const out = options?.disableTheme
1362
+ ? ComponentForwardedRef
1363
+ : (themeable(ComponentForwardedRef, extendedConfig) as any)
1329
1364
  out.staticConfig = extendedConfig
1330
1365
  out.styleable = styleable
1331
1366
  return out
@@ -1351,6 +1386,8 @@ function getWebEvents<E extends EventLikeObject>(events: E, webStyle = true) {
1351
1386
  onMouseUp: events.onPressOut,
1352
1387
  onTouchStart: events.onPressIn,
1353
1388
  onTouchEnd: events.onPressOut,
1389
+ onFocus: events.onFocus,
1390
+ onBlur: events.onBlur,
1354
1391
  }
1355
1392
  }
1356
1393
 
@@ -1,6 +1,6 @@
1
1
  import { getConfig } from '../config'
2
2
  import { mediaObjectToString } from '../hooks/useMedia'
3
- import type { MediaQueries, MediaStyleObject, StyleObject } from '../types'
3
+ import type { IsMediaType, MediaQueries, MediaStyleObject, StyleObject } from '../types'
4
4
  import { getGroupPropParts } from './getGroupPropParts'
5
5
 
6
6
  // TODO have this be used by extractMediaStyle in tamagui static
@@ -18,16 +18,17 @@ export const createMediaStyle = (
18
18
  styleObject: StyleObject,
19
19
  mediaKeyIn: string,
20
20
  mediaQueries: MediaQueries,
21
+ type: IsMediaType,
21
22
  negate?: boolean,
22
23
  priority?: number
23
24
  ): MediaStyleObject => {
24
25
  const { property, identifier, rules } = styleObject
25
26
  const conf = getConfig()
26
27
  const enableMediaPropOrder = conf.settings.mediaPropOrder
27
- const isThemeMedia = mediaKeyIn.startsWith('theme-')
28
- const isPlatformMedia = !isThemeMedia && mediaKeyIn.startsWith('platform-')
29
- const isGroup = !isThemeMedia && !isPlatformMedia && mediaKeyIn.startsWith('group-')
30
- const isNonWindowMedia = isThemeMedia || isPlatformMedia || isGroup
28
+ const isTheme = type === 'theme'
29
+ const isPlatform = type === 'platform'
30
+ const isGroup = type === 'group'
31
+ const isNonWindowMedia = isTheme || isPlatform || isGroup
31
32
  const negKey = negate ? '0' : ''
32
33
  const ogPrefix = identifier.slice(0, identifier.indexOf('-') + 1)
33
34
  const id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace('-', '')}${negKey}${MEDIA_SEP}`
@@ -43,7 +44,7 @@ export const createMediaStyle = (
43
44
  .fill(':root')
44
45
  .join('')
45
46
 
46
- if (isThemeMedia || isGroup) {
47
+ if (isTheme || isGroup) {
47
48
  const groupInfo = getGroupPropParts(mediaKeyIn)
48
49
  const mediaName = groupInfo?.name
49
50
  groupMediaKey = groupInfo?.media
@@ -38,6 +38,7 @@ import type {
38
38
  DebugProp,
39
39
  GetStyleResult,
40
40
  GetStyleState,
41
+ IsMediaType,
41
42
  MediaQueryKey,
42
43
  PseudoPropKeys,
43
44
  PseudoStyles,
@@ -513,8 +514,8 @@ export const getSplitStyles: StyleSplitter = (
513
514
  const isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant
514
515
 
515
516
  let isPseudo = keyInit in validPseudoKeys
516
- let isMedia = !isStyleLikeKey && !isPseudo && isMediaKey(keyInit)
517
- let isMediaOrPseudo = isMedia || isPseudo
517
+ let isMedia: IsMediaType = !isStyleLikeKey && !isPseudo && isMediaKey(keyInit)
518
+ let isMediaOrPseudo = Boolean(isMedia || isPseudo)
518
519
 
519
520
  const isStyleProp =
520
521
  isMediaOrPseudo ||
@@ -669,7 +670,7 @@ export const getSplitStyles: StyleSplitter = (
669
670
 
670
671
  isPseudo = key in validPseudoKeys
671
672
  isMedia = !isPseudo && !isValidStyleKeyInit && isMediaKey(key)
672
- isMediaOrPseudo = isMedia || isPseudo
673
+ isMediaOrPseudo = Boolean(isMedia || isPseudo)
673
674
  isVariant = variants && key in variants
674
675
 
675
676
  if (inlineProps?.has(key) || (IS_STATIC && inlineWhenUnflattened?.has(key))) {
@@ -844,8 +845,7 @@ export const getSplitStyles: StyleSplitter = (
844
845
  else if (isMedia) {
845
846
  if (!val) continue
846
847
 
847
- const isPlatformMedia = key.startsWith('$platform-')
848
- if (isPlatformMedia) {
848
+ if (isMedia === 'platform') {
849
849
  const platform = key.slice(10)
850
850
  if (
851
851
  // supports web, ios, android
@@ -925,6 +925,7 @@ export const getSplitStyles: StyleSplitter = (
925
925
  style,
926
926
  mediaKeyShort,
927
927
  mediaQueryConfig,
928
+ isMedia,
928
929
  false,
929
930
  priority
930
931
  )
@@ -934,9 +935,9 @@ export const getSplitStyles: StyleSplitter = (
934
935
  mergeClassName(transforms, classNames, fullKey, out.identifier, true, true)
935
936
  }
936
937
  } else {
937
- const isThemeMedia = !isPlatformMedia && mediaKeyShort.startsWith('theme-')
938
- const isGroupMedia =
939
- !isPlatformMedia && !isThemeMedia && mediaKeyShort.startsWith('group-')
938
+ const isThemeMedia = isMedia === 'theme'
939
+ const isGroupMedia = isMedia === 'group'
940
+ const isPlatformMedia = isMedia === 'platform'
940
941
 
941
942
  if (!isThemeMedia && !isPlatformMedia && !isGroupMedia) {
942
943
  if (!mediaState[mediaKeyShort]) {
@@ -3,18 +3,15 @@ import React, { forwardRef } from 'react'
3
3
  import { StaticConfig, ThemeableProps } from '../types'
4
4
  import { Theme } from '../views/Theme'
5
5
 
6
- export function themeable<Component extends (props: any) => any>(
7
- component: Component,
6
+ export function themeable<ComponentType extends (props: any) => any>(
7
+ Component: ComponentType,
8
8
  staticConfig?: Partial<StaticConfig>
9
9
  ) {
10
10
  const withThemeComponent = forwardRef(function WithTheme(props: ThemeableProps, ref) {
11
11
  const { themeInverse, theme, componentName, themeReset, ...rest } = props
12
12
 
13
- const element = React.createElement(component, {
14
- ...rest,
15
- ref,
16
- 'data-disable-theme': true,
17
- } as any)
13
+ // @ts-expect-error its ok
14
+ const element = <Component ref={ref} {...rest} data-disable-theme />
18
15
 
19
16
  let contents = (
20
17
  <Theme
@@ -34,10 +31,10 @@ export function themeable<Component extends (props: any) => any>(
34
31
 
35
32
  const withTheme: any = withThemeComponent
36
33
  withTheme.displayName = `Themed(${
37
- (component as any)?.displayName || (component as any)?.name || 'Anonymous'
34
+ (Component as any)?.displayName || (Component as any)?.name || 'Anonymous'
38
35
  })`
39
36
 
40
- return withTheme as Component extends (props: infer P) => infer R
37
+ return withTheme as ComponentType extends (props: infer P) => infer R
41
38
  ? (props: Omit<P, 'theme' | 'themeInverse'> & ThemeableProps) => R
42
39
  : unknown
43
40
  }
@@ -1,13 +1,13 @@
1
1
  import { useIsomorphicLayoutEffect } from '@tamagui/constants'
2
- import { useContext, useRef, useSyncExternalStore } from 'react'
2
+ import { useRef, useSyncExternalStore } from 'react'
3
3
 
4
4
  import { getConfig } from '../config'
5
- import { ComponentContext } from '../contexts/ComponentContext'
6
5
  import { createProxy } from '../helpers/createProxy'
7
6
  import { matchMedia } from '../helpers/matchMedia'
8
7
  import { pseudoDescriptors } from '../helpers/pseudoDescriptors'
9
8
  import type {
10
9
  ComponentContextI,
10
+ IsMediaType,
11
11
  MediaQueries,
12
12
  MediaQueryKey,
13
13
  MediaQueryObject,
@@ -15,7 +15,6 @@ import type {
15
15
  TamaguiInternalConfig,
16
16
  UseMediaState,
17
17
  } from '../types'
18
- import { useConfiguration } from './useConfiguration'
19
18
  import { getDisableSSR, useDisableSSR } from './useDisableSSR'
20
19
 
21
20
  export let mediaState: MediaQueryState =
@@ -45,12 +44,15 @@ export const getMedia = () => mediaState
45
44
 
46
45
  export const mediaKeys = new Set<string>() // with $ prefix
47
46
 
48
- export const isMediaKey = (key: string) =>
49
- mediaKeys.has(key) ||
50
- (key[0] === '$' &&
51
- (key.startsWith('$platform-') ||
52
- key.startsWith('$theme-') ||
53
- key.startsWith('$group-')))
47
+ export const isMediaKey = (key: string): IsMediaType => {
48
+ if (mediaKeys.has(key)) return true
49
+ if (key[0] === '$') {
50
+ if (key.startsWith('$platform-')) return 'platform'
51
+ if (key.startsWith('$theme-')) return 'theme'
52
+ if (key.startsWith('$group-')) return 'group'
53
+ }
54
+ return false
55
+ }
54
56
 
55
57
  // for SSR capture it at time of startup
56
58
  let initState: MediaQueryState
@@ -83,6 +83,7 @@ export function usePropsAndStyle<A extends Object>(
83
83
  mediaState: media,
84
84
  noSkip: true,
85
85
  noClassNames: true,
86
+ resolveValues: 'auto',
86
87
  ...opts,
87
88
  },
88
89
  null,
package/src/types.tsx CHANGED
@@ -29,6 +29,8 @@ import type { ThemeProviderProps } from './views/ThemeProvider'
29
29
 
30
30
  export type { MediaStyleObject, StyleObject } from '@tamagui/helpers'
31
31
 
32
+ export type IsMediaType = boolean | 'platform' | 'theme' | 'group'
33
+
32
34
  export type SpaceDirection = 'vertical' | 'horizontal' | 'both'
33
35
 
34
36
  export type TamaguiElement = HTMLElement | View
@@ -147,6 +149,8 @@ export type WebOnlyPressEvents = {
147
149
  onMouseLeave?: DivAttributes['onMouseLeave']
148
150
  onMouseDown?: DivAttributes['onMouseDown']
149
151
  onMouseUp?: DivAttributes['onMouseUp']
152
+ onFocus?: DivAttributes['onFocus']
153
+ onBlur?: DivAttributes['onBlur']
150
154
  }
151
155
 
152
156
  /**
@@ -1343,6 +1347,11 @@ export interface ThemeableProps {
1343
1347
  debug?: DebugProp
1344
1348
  }
1345
1349
 
1350
+ export type StyleableOptions = {
1351
+ disableTheme?: boolean
1352
+ staticConfig?: Partial<StaticConfig>
1353
+ }
1354
+
1346
1355
  export type Styleable<Props, Ref> = <
1347
1356
  CustomProps extends Object,
1348
1357
  X extends FunctionComponent<any> = FunctionComponent<
@@ -1350,7 +1359,7 @@ export type Styleable<Props, Ref> = <
1350
1359
  >
1351
1360
  >(
1352
1361
  a: X,
1353
- staticConfig?: Partial<StaticConfig>
1362
+ options?: StyleableOptions
1354
1363
  ) => ReactComponentWithRef<
1355
1364
  CustomProps & Omit<Props & ThemeableProps, keyof CustomProps>,
1356
1365
  Ref
@@ -63,7 +63,8 @@ export function useThemedChildren(
63
63
  themeState: ChangedThemeResponse,
64
64
  children: any,
65
65
  props: ThemeProps,
66
- isRoot = false
66
+ isRoot = false,
67
+ avoidWrap = false
67
68
  ) {
68
69
  const { themeManager, isNewTheme } = themeState
69
70
  const { shallow, forceClassName } = props
@@ -108,7 +109,7 @@ export function useThemedChildren(
108
109
  return elementsWithContext
109
110
  }
110
111
 
111
- if (isWeb) {
112
+ if (isWeb && !avoidWrap) {
112
113
  return wrapThemeElements({
113
114
  children: elementsWithContext,
114
115
  themeState,
@@ -120,6 +121,25 @@ export function useThemedChildren(
120
121
  return elementsWithContext
121
122
  }
122
123
 
124
+ export function getThemeCNStyle(themeState: ChangedThemeResponse, isRoot = false) {
125
+ if (!themeState.isNewTheme) return
126
+ // in order to provide currentColor, set color by default
127
+ const themeColor =
128
+ themeState.state?.theme && themeState.isNewTheme
129
+ ? variableToString(themeState.state.theme.color)
130
+ : ''
131
+ const style = themeColor
132
+ ? {
133
+ color: themeColor,
134
+ }
135
+ : undefined
136
+ let className = themeState.state?.className || ''
137
+ if (isRoot) {
138
+ className = className.replace('t_sub_theme', '')
139
+ }
140
+ return { style, className }
141
+ }
142
+
123
143
  export function wrapThemeElements({
124
144
  children,
125
145
  themeState,
@@ -141,25 +161,9 @@ export function wrapThemeElements({
141
161
  return <span className="_dsp_contents is_Theme">{children}</span>
142
162
  }
143
163
 
144
- // in order to provide currentColor, set color by default
145
- const themeColor =
146
- themeState.state?.theme && themeState.isNewTheme
147
- ? variableToString(themeState.state.theme.color)
148
- : ''
149
- const colorStyle = themeColor
150
- ? {
151
- color: themeColor,
152
- }
153
- : undefined
154
-
155
- let className = themeState.state?.className || ''
156
-
157
- if (isRoot) {
158
- className = className.replace('t_sub_theme', '')
159
- }
160
-
164
+ const { className, style } = getThemeCNStyle(themeState, isRoot)!
161
165
  let themedChildren = (
162
- <span className={`${className} _dsp_contents is_Theme`} style={colorStyle}>
166
+ <span className={`${className} _dsp_contents is_Theme`} style={style}>
163
167
  {children}
164
168
  </span>
165
169
  )
@@ -1 +1 @@
1
- {"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAaN,MAAM,OAAO,CAAA;AAsBd,OAAO,EAEL,SAAS,EAKT,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,gBAAgB,EAGhB,cAAc,EAEd,SAAS,EAMV,MAAM,SAAS,CAAA;AAoBhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA6D3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,UAAU,GAAG,SAAS,GAAG,EAAE,EACtD,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EACjB,YAAY,EAAE,YAAY,4DAsqC3B;AAoBD,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,OAEjD;AAiBD,eAAO,MAAM,MAAM,0DAqCjB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA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SAAS,CAAA;CAClB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,mBAiGxD"}
@@ -1,4 +1,4 @@
1
- import type { MediaQueries, MediaStyleObject, StyleObject } from '../types';
1
+ import type { IsMediaType, MediaQueries, MediaStyleObject, StyleObject } from '../types';
2
2
  export declare const MEDIA_SEP = "_";
3
- export declare const createMediaStyle: (styleObject: StyleObject, mediaKeyIn: string, mediaQueries: MediaQueries, negate?: boolean, priority?: number) => MediaStyleObject;
3
+ export declare const createMediaStyle: (styleObject: StyleObject, mediaKeyIn: string, mediaQueries: MediaQueries, type: IsMediaType, negate?: boolean, priority?: number) => MediaStyleObject;
4
4
  //# sourceMappingURL=createMediaStyle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMediaStyle.d.ts","sourceRoot":"","sources":["../../src/helpers/createMediaStyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAK3E,eAAO,MAAM,SAAS,MAAM,CAAA;AAS5B,eAAO,MAAM,gBAAgB,gBACd,WAAW,cACZ,MAAM,gBACJ,YAAY,WACjB,OAAO,aACL,MAAM,KAChB,gBAqGF,CAAA"}
1
+ {"version":3,"file":"createMediaStyle.d.ts","sourceRoot":"","sources":["../../src/helpers/createMediaStyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAKxF,eAAO,MAAM,SAAS,MAAM,CAAA;AAS5B,eAAO,MAAM,gBAAgB,gBACd,WAAW,cACZ,MAAM,gBACJ,YAAY,QACpB,WAAW,WACR,OAAO,aACL,MAAM,KAChB,gBAqGF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AAkCA,OAAO,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CAAC,OAAO,cAAc,CAAC,CAAA;AAMhE,KAAK,aAAa,GAAG,CACnB,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC7B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,qBAAqB,EACrC,UAAU,EAAE,eAAe,EAC3B,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,EACzC,OAAO,CAAC,EAAE,iBAAiB,EAE3B,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,SAAS,KACd,cAAc,CAAA;AAEnB,eAAO,MAAM,UAAU,MAAM,CAAA;AAuB7B,eAAO,MAAM,cAAc,EAAE,aAiqC5B,CAAA;AAsDD,eAAO,MAAM,WAAW,eACV,aAAa,UACjB,MAAM,WACL,MAAM,wBACO,OAAO,KAC5B,cA2BF,CAAA;AA0BD,eAAO,MAAM,cAAc,EAAE,aAQ5B,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import { StaticConfig, ThemeableProps } from '../types';
2
- export declare function themeable<Component extends (props: any) => any>(component: Component, staticConfig?: Partial<StaticConfig>): Component extends (props: infer P) => infer R ? (props: Omit<P, "theme" | "themeInverse"> & ThemeableProps) => R : unknown;
2
+ export declare function themeable<ComponentType extends (props: any) => any>(Component: ComponentType, staticConfig?: Partial<StaticConfig>): ComponentType extends (props: infer P) => infer R ? (props: Omit<P, "theme" | "themeInverse"> & ThemeableProps) => R : unknown;
3
3
  //# sourceMappingURL=themeable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"themeable.d.ts","sourceRoot":"","sources":["../../src/helpers/themeable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvD,wBAAgB,SAAS,CAAC,SAAS,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,EAC7D,SAAS,EAAE,SAAS,EACpB,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,8HAmCrC"}
1
+ {"version":3,"file":"themeable.d.ts","sourceRoot":"","sources":["../../src/helpers/themeable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvD,wBAAgB,SAAS,CAAC,aAAa,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,EACjE,SAAS,EAAE,aAAa,EACxB,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,kIAgCrC"}
@@ -1,9 +1,9 @@
1
- import type { ComponentContextI, MediaQueries, MediaQueryKey, MediaQueryObject, MediaQueryState, TamaguiInternalConfig, UseMediaState } from '../types';
1
+ import type { ComponentContextI, IsMediaType, MediaQueries, MediaQueryKey, MediaQueryObject, MediaQueryState, TamaguiInternalConfig, UseMediaState } from '../types';
2
2
  export declare let mediaState: MediaQueryState;
3
3
  export declare const mediaQueryConfig: MediaQueries;
4
4
  export declare const getMedia: () => MediaQueryState;
5
5
  export declare const mediaKeys: Set<string>;
6
- export declare const isMediaKey: (key: string) => boolean;
6
+ export declare const isMediaKey: (key: string) => IsMediaType;
7
7
  export declare const getMediaKeyImportance: (key: string) => number;
8
8
  export declare const configureMedia: (config: TamaguiInternalConfig) => void;
9
9
  export declare function setupMediaListeners(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../src/hooks/useMedia.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACd,MAAM,UAAU,CAAA;AAIjB,eAAO,IAAI,UAAU,EAAE,eAmBN,CAAA;AAEjB,eAAO,MAAM,gBAAgB,EAAE,YAAiB,CAAA;AAEhD,eAAO,MAAM,QAAQ,uBAAmB,CAAA;AAExC,eAAO,MAAM,SAAS,aAAoB,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AE,aAAa,CAAC,CAyBpE"}
package/types/types.d.ts CHANGED
@@ -9,6 +9,7 @@ import { Role } from './interfaces/Role';
9
9
  import type { LanguageContextType } from './views/FontLanguage.types';
10
10
  import type { ThemeProviderProps } from './views/ThemeProvider';
11
11
  export type { MediaStyleObject, StyleObject } from '@tamagui/helpers';
12
+ export type IsMediaType = boolean | 'platform' | 'theme' | 'group';
12
13
  export type SpaceDirection = 'vertical' | 'horizontal' | 'both';
13
14
  export type TamaguiElement = HTMLElement | View;
14
15
  export type TamaguiTextElement = HTMLElement | RNText;
@@ -104,6 +105,8 @@ export type WebOnlyPressEvents = {
104
105
  onMouseLeave?: DivAttributes['onMouseLeave'];
105
106
  onMouseDown?: DivAttributes['onMouseDown'];
106
107
  onMouseUp?: DivAttributes['onMouseUp'];
108
+ onFocus?: DivAttributes['onFocus'];
109
+ onBlur?: DivAttributes['onBlur'];
107
110
  };
108
111
  /**
109
112
  * For static / studio
@@ -746,7 +749,11 @@ export interface ThemeableProps {
746
749
  componentName?: string;
747
750
  debug?: DebugProp;
748
751
  }
749
- export type Styleable<Props, Ref> = <CustomProps extends Object, X extends FunctionComponent<any> = FunctionComponent<ThemeableProps & Props & CustomProps>>(a: X, staticConfig?: Partial<StaticConfig>) => ReactComponentWithRef<CustomProps & Omit<Props & ThemeableProps, keyof CustomProps>, Ref> & {
752
+ export type StyleableOptions = {
753
+ disableTheme?: boolean;
754
+ staticConfig?: Partial<StaticConfig>;
755
+ };
756
+ export type Styleable<Props, Ref> = <CustomProps extends Object, X extends FunctionComponent<any> = FunctionComponent<ThemeableProps & Props & CustomProps>>(a: X, options?: StyleableOptions) => ReactComponentWithRef<CustomProps & Omit<Props & ThemeableProps, keyof CustomProps>, Ref> & {
750
757
  staticConfig: StaticConfig;
751
758
  styleable: Styleable<Props, Ref>;
752
759
  };