@niibase/uniwind 1.6.1 → 1.6.3

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 (150) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/common/common/utils.js +15 -0
  3. package/dist/common/components/native/ActivityIndicator.js +2 -1
  4. package/dist/common/components/native/Button.js +2 -2
  5. package/dist/common/components/native/FlatList.js +2 -1
  6. package/dist/common/components/native/Image.js +2 -1
  7. package/dist/common/components/native/ImageBackground.js +2 -1
  8. package/dist/common/components/native/InputAccessoryView.js +2 -1
  9. package/dist/common/components/native/Modal.js +2 -1
  10. package/dist/common/components/native/RefreshControl.js +5 -4
  11. package/dist/common/components/native/ScrollView.js +2 -1
  12. package/dist/common/components/native/SectionList.js +2 -1
  13. package/dist/common/components/native/Switch.js +5 -4
  14. package/dist/common/components/native/Text.js +2 -1
  15. package/dist/common/components/native/TextInput.js +6 -5
  16. package/dist/common/components/native/TouchableHighlight.js +2 -1
  17. package/dist/common/components/native/VirtualizedList.js +2 -1
  18. package/dist/common/components/native/useAccentColor.js +19 -0
  19. package/dist/common/components/react-native-gesture-handler/native/FlatList.js +2 -1
  20. package/dist/common/components/react-native-gesture-handler/native/RefreshControl.js +5 -4
  21. package/dist/common/components/react-native-gesture-handler/native/Text.js +2 -1
  22. package/dist/common/components/react-native-gesture-handler/native/TextInput.js +5 -4
  23. package/dist/common/components/web/ActivityIndicator.js +2 -2
  24. package/dist/common/components/web/Button.js +2 -2
  25. package/dist/common/components/web/Image.js +2 -1
  26. package/dist/common/components/web/ImageBackground.js +2 -2
  27. package/dist/common/components/web/Switch.js +4 -4
  28. package/dist/common/components/web/TextInput.js +2 -2
  29. package/dist/common/components/web/TouchableHighlight.js +2 -2
  30. package/dist/common/components/web/useUniwindAccent.js +20 -0
  31. package/dist/common/core/config/config.common.js +4 -7
  32. package/dist/common/core/config/config.js +42 -23
  33. package/dist/common/core/config/config.native.js +1 -3
  34. package/dist/common/core/web/cssListener.js +1 -1
  35. package/dist/common/hoc/withUniwind.js +7 -0
  36. package/dist/common/hoc/withUniwind.native.js +7 -0
  37. package/dist/common/hooks/index.js +0 -11
  38. package/dist/common/hooks/useCSSVariable/useCSSVariable.js +2 -7
  39. package/dist/metro/index.cjs +11 -5
  40. package/dist/metro/index.mjs +12 -6
  41. package/dist/metro/metro-transformer.cjs +14 -14
  42. package/dist/metro/metro-transformer.mjs +8 -8
  43. package/dist/module/common/utils.d.ts +2 -0
  44. package/dist/module/common/utils.js +7 -0
  45. package/dist/module/components/native/ActivityIndicator.js +2 -1
  46. package/dist/module/components/native/Button.js +2 -2
  47. package/dist/module/components/native/FlatList.js +2 -1
  48. package/dist/module/components/native/Image.js +2 -1
  49. package/dist/module/components/native/ImageBackground.js +2 -1
  50. package/dist/module/components/native/InputAccessoryView.js +2 -1
  51. package/dist/module/components/native/Modal.js +2 -1
  52. package/dist/module/components/native/RefreshControl.js +5 -4
  53. package/dist/module/components/native/ScrollView.js +2 -1
  54. package/dist/module/components/native/SectionList.js +2 -1
  55. package/dist/module/components/native/Switch.js +5 -4
  56. package/dist/module/components/native/Text.js +2 -1
  57. package/dist/module/components/native/TextInput.js +6 -5
  58. package/dist/module/components/native/TouchableHighlight.js +2 -1
  59. package/dist/module/components/native/VirtualizedList.js +2 -1
  60. package/dist/module/components/native/useAccentColor.d.ts +2 -0
  61. package/dist/module/components/native/useAccentColor.js +14 -0
  62. package/dist/module/components/react-native-gesture-handler/native/FlatList.js +2 -1
  63. package/dist/module/components/react-native-gesture-handler/native/RefreshControl.js +5 -4
  64. package/dist/module/components/react-native-gesture-handler/native/Text.js +2 -1
  65. package/dist/module/components/react-native-gesture-handler/native/TextInput.js +5 -4
  66. package/dist/module/components/web/ActivityIndicator.js +1 -1
  67. package/dist/module/components/web/Button.js +1 -1
  68. package/dist/module/components/web/Image.js +2 -1
  69. package/dist/module/components/web/ImageBackground.js +1 -1
  70. package/dist/module/components/web/Switch.js +1 -1
  71. package/dist/module/components/web/TextInput.js +1 -1
  72. package/dist/module/components/web/TouchableHighlight.js +1 -1
  73. package/dist/module/components/web/useUniwindAccent.js +15 -0
  74. package/dist/module/core/config/config.common.d.ts +1 -1
  75. package/dist/module/core/config/config.common.js +3 -4
  76. package/dist/module/core/config/config.d.ts +4 -4
  77. package/dist/module/core/config/config.js +44 -25
  78. package/dist/module/core/config/config.native.js +1 -3
  79. package/dist/module/core/web/cssListener.js +1 -1
  80. package/dist/module/hoc/withUniwind.js +9 -0
  81. package/dist/module/hoc/withUniwind.native.js +9 -0
  82. package/dist/module/hooks/index.d.ts +0 -1
  83. package/dist/module/hooks/index.js +0 -1
  84. package/dist/module/hooks/useCSSVariable/useCSSVariable.js +1 -6
  85. package/dist/shared/{uniwind.C-rHhHOg.mjs → uniwind.BGiqYvxb.mjs} +1 -1
  86. package/dist/shared/{uniwind.nl8746mK.cjs → uniwind.Cv73KtI-.cjs} +0 -2
  87. package/dist/shared/{uniwind.F-0-Rr--.mjs → uniwind.PtWWxxnh.mjs} +1 -2
  88. package/dist/shared/{uniwind.BZyFsest.cjs → uniwind.r2i22V6d.cjs} +1 -1
  89. package/dist/vite/index.cjs +2 -2
  90. package/dist/vite/index.mjs +2 -2
  91. package/package.json +3 -3
  92. package/src/common/utils.ts +9 -0
  93. package/src/components/native/ActivityIndicator.tsx +2 -1
  94. package/src/components/native/Button.tsx +2 -2
  95. package/src/components/native/FlatList.tsx +2 -1
  96. package/src/components/native/Image.tsx +2 -1
  97. package/src/components/native/ImageBackground.tsx +2 -1
  98. package/src/components/native/InputAccessoryView.tsx +2 -1
  99. package/src/components/native/Modal.tsx +2 -1
  100. package/src/components/native/RefreshControl.tsx +5 -4
  101. package/src/components/native/ScrollView.tsx +2 -1
  102. package/src/components/native/SectionList.tsx +2 -1
  103. package/src/components/native/Switch.tsx +5 -4
  104. package/src/components/native/Text.tsx +2 -1
  105. package/src/components/native/TextInput.tsx +6 -5
  106. package/src/components/native/TouchableHighlight.tsx +2 -1
  107. package/src/components/native/VirtualizedList.tsx +2 -1
  108. package/src/components/native/useAccentColor.ts +19 -0
  109. package/src/components/react-native-gesture-handler/native/FlatList.tsx +2 -1
  110. package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +5 -4
  111. package/src/components/react-native-gesture-handler/native/Text.tsx +2 -1
  112. package/src/components/react-native-gesture-handler/native/TextInput.tsx +5 -4
  113. package/src/components/web/ActivityIndicator.tsx +1 -1
  114. package/src/components/web/Button.tsx +1 -1
  115. package/src/components/web/Image.tsx +2 -1
  116. package/src/components/web/ImageBackground.tsx +1 -1
  117. package/src/components/web/Switch.tsx +1 -1
  118. package/src/components/web/TextInput.tsx +1 -1
  119. package/src/components/web/TouchableHighlight.tsx +1 -1
  120. package/src/components/web/useUniwindAccent.ts +21 -0
  121. package/src/core/config/config.common.ts +4 -7
  122. package/src/core/config/config.native.ts +1 -3
  123. package/src/core/config/config.ts +61 -29
  124. package/src/core/logger.ts +0 -2
  125. package/src/core/native/parsers/transforms.ts +0 -1
  126. package/src/core/native/store.ts +0 -1
  127. package/src/core/web/cssListener.ts +2 -3
  128. package/src/hoc/withUniwind.native.tsx +11 -1
  129. package/src/hoc/withUniwind.tsx +11 -0
  130. package/src/hooks/index.ts +0 -1
  131. package/src/hooks/useCSSVariable/useCSSVariable.ts +1 -8
  132. package/src/metro/addMetaToStylesTemplate.ts +3 -3
  133. package/src/metro/logger.ts +0 -2
  134. package/src/metro/metro-css-patches.ts +1 -2
  135. package/src/metro/metro-transformer.ts +3 -3
  136. package/src/metro/processor/css.ts +3 -2
  137. package/src/metro/processor/functions.ts +0 -1
  138. package/src/metro/processor/rn.ts +2 -1
  139. package/src/metro/resolvers.ts +12 -13
  140. package/src/metro/utils/common.ts +0 -3
  141. package/src/metro/utils/serialize.ts +0 -1
  142. package/src/types.ts +0 -1
  143. package/dist/common/components/native/TextInput.android.js +0 -52
  144. package/dist/common/hooks/useUniwindAccent.js +0 -13
  145. package/dist/module/components/native/TextInput.android.d.ts +0 -3
  146. package/dist/module/components/native/TextInput.android.js +0 -49
  147. package/dist/module/hooks/useUniwindAccent.js +0 -6
  148. package/src/components/native/TextInput.android.tsx +0 -51
  149. package/src/hooks/useUniwindAccent.ts +0 -10
  150. /package/dist/module/{hooks → components/web}/useUniwindAccent.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import { normalizePath } from '@tailwindcss/node';
2
2
  import path from 'path';
3
- import { u as uniq, n as name } from '../shared/uniwind.F-0-Rr--.mjs';
4
- import { s as stringifyThemes, U as UniwindCSSVisitor, a as buildCSS, b as buildDtsFile } from '../shared/uniwind.C-rHhHOg.mjs';
3
+ import { u as uniq, n as name } from '../shared/uniwind.PtWWxxnh.mjs';
4
+ import { s as stringifyThemes, U as UniwindCSSVisitor, a as buildCSS, b as buildDtsFile } from '../shared/uniwind.BGiqYvxb.mjs';
5
5
  import 'fs';
6
6
  import 'lightningcss';
7
7
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@niibase/uniwind",
4
- "version": "1.6.1",
4
+ "version": "1.6.3",
5
5
  "description": "A fork of Uniwind with Reanimated 4 support",
6
6
  "homepage": "https://uniwind.dev",
7
7
  "author": "Unistack",
@@ -12,8 +12,8 @@
12
12
  "precommit": "bun lint",
13
13
  "build": "unbuild",
14
14
  "check:typescript": "tsc --noEmit",
15
- "lint": "eslint src",
16
- "lint:fix": "eslint src --fix",
15
+ "lint": "oxlint src",
16
+ "lint:fix": "oxlint src --fix",
17
17
  "format": "dprint fmt",
18
18
  "prepublishOnly": "bun run build",
19
19
  "circular:check": "dpdm --no-warning --no-tree -T --exit-code circular:1 'src/**/*.ts' 'src/**/*.tsx'",
@@ -0,0 +1,9 @@
1
+ export const isDefined = <T>(value: T): value is NonNullable<T> => value !== undefined && value !== null
2
+
3
+ export const arrayEquals = <T>(a: Array<T>, b: Array<T>) => {
4
+ if (a.length !== b.length) {
5
+ return false
6
+ }
7
+
8
+ return a.every((value, index) => value === b[index])
9
+ }
@@ -1,10 +1,11 @@
1
1
  import { ActivityIndicator as RNActivityIndicator, ActivityIndicatorProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const ActivityIndicator = copyComponentProperties(RNActivityIndicator, (props: ActivityIndicatorProps) => {
6
7
  const { Component, style } = useStyle(RNActivityIndicator, props.className, props, { isPressed: Boolean(props.animating) })
7
- const color = useStyle(props.colorClassName, props).accentColor
8
+ const color = useAccentColor(props.colorClassName, props)
8
9
 
9
10
  return (
10
11
  <Component
@@ -1,9 +1,9 @@
1
1
  import { Button as RNButton, ButtonProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
- import { useStyle } from './useStyle'
3
+ import { useAccentColor } from './useAccentColor'
4
4
 
5
5
  export const Button = copyComponentProperties(RNButton, (props: ButtonProps) => {
6
- const color = useStyle(props.colorClassName, props).accentColor
6
+ const color = useAccentColor(props.colorClassName, props)
7
7
 
8
8
  return (
9
9
  <RNButton
@@ -1,5 +1,6 @@
1
1
  import { FlatList as RNFlatList, FlatListProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const FlatList = copyComponentProperties(RNFlatList, (props: FlatListProps<unknown>) => {
@@ -8,7 +9,7 @@ export const FlatList = copyComponentProperties(RNFlatList, (props: FlatListProp
8
9
  const styleContentContainer = useStyle(props.contentContainerClassName, props)
9
10
  const styleListFooterComponent = useStyle(props.ListFooterComponentClassName, props)
10
11
  const styleListHeaderComponent = useStyle(props.ListHeaderComponentClassName, props)
11
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor
12
+ const endFillColor = useAccentColor(props.endFillColorClassName, props)
12
13
  const hasSingleColumn = !('numColumns' in props) || props.numColumns === 1
13
14
 
14
15
  return (
@@ -1,10 +1,11 @@
1
1
  import { Image as RNImage, ImageProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const Image = copyComponentProperties(RNImage, (props: ImageProps) => {
6
7
  const { Component, style } = useStyle(RNImage, props.className, props)
7
- const tintColor = useStyle(props.tintColorClassName, props).accentColor
8
+ const tintColor = useAccentColor(props.tintColorClassName, props)
8
9
 
9
10
  return (
10
11
  <Component
@@ -1,11 +1,12 @@
1
1
  import { ImageBackground as RNImageBackground, ImageBackgroundProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const ImageBackground = copyComponentProperties(RNImageBackground, (props: ImageBackgroundProps) => {
6
7
  const { Component, style } = useStyle(RNImageBackground, props.className, props)
7
8
  const imageStyle = useStyle(props.imageClassName, props)
8
- const tintColor = useStyle(props.tintColorClassName, props).accentColor
9
+ const tintColor = useAccentColor(props.tintColorClassName, props)
9
10
 
10
11
  return (
11
12
  <Component
@@ -1,13 +1,14 @@
1
1
  import { ForwardedRef } from 'react'
2
2
  import { InputAccessoryView as RNInputAccessoryView, InputAccessoryViewProps } from 'react-native'
3
3
  import { copyComponentProperties } from '../utils'
4
+ import { useAccentColor } from './useAccentColor'
4
5
  import { useStyle } from './useStyle'
5
6
 
6
7
  export const InputAccessoryView = copyComponentProperties(
7
8
  RNInputAccessoryView,
8
9
  (props: InputAccessoryViewProps & { ref?: ForwardedRef<RNInputAccessoryView> }) => {
9
10
  const { Component, style } = useStyle(RNInputAccessoryView, props.className, props)
10
- const backgroundColor = useStyle(props.backgroundColorClassName, props).accentColor
11
+ const backgroundColor = useAccentColor(props.backgroundColorClassName, props)
11
12
 
12
13
  return (
13
14
  <Component
@@ -1,10 +1,11 @@
1
1
  import { Modal as RNModal, ModalProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const Modal = copyComponentProperties(RNModal, (props: ModalProps) => {
6
7
  const { Component, style } = useStyle(RNModal, props.className, props)
7
- const backdropColor = useStyle(props.backdropColorClassName, props).accentColor
8
+ const backdropColor = useAccentColor(props.backdropColorClassName, props)
8
9
 
9
10
  return (
10
11
  <Component
@@ -1,15 +1,16 @@
1
1
  import { RefreshControl as RNRefreshControl, RefreshControlProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const RefreshControl = copyComponentProperties(RNRefreshControl, (props: RefreshControlProps) => {
6
7
  const { Component, style } = useStyle(RNRefreshControl, props.className, props, {
7
8
  isPressed: Boolean(props.refreshing),
8
9
  })
9
- const color = useStyle(props.colorsClassName, props).accentColor
10
- const tintColor = useStyle(props.tintColorClassName, props).accentColor
11
- const titleColor = useStyle(props.titleColorClassName, props).accentColor
12
- const progressBackgroundColor = useStyle(props.progressBackgroundColorClassName, props).accentColor
10
+ const color = useAccentColor(props.colorsClassName, props)
11
+ const tintColor = useAccentColor(props.tintColorClassName, props)
12
+ const titleColor = useAccentColor(props.titleColorClassName, props)
13
+ const progressBackgroundColor = useAccentColor(props.progressBackgroundColorClassName, props)
13
14
 
14
15
  return (
15
16
  <Component
@@ -1,11 +1,12 @@
1
1
  import { ScrollView as RNScrollView, ScrollViewProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const ScrollView = copyComponentProperties(RNScrollView, (props: ScrollViewProps) => {
6
7
  const { Component, style } = useStyle(RNScrollView, props.className, props)
7
8
  const contentContainerStyle = useStyle(props.contentContainerClassName, props)
8
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor
9
+ const endFillColor = useAccentColor(props.endFillColorClassName, props)
9
10
 
10
11
  return (
11
12
  <Component
@@ -1,5 +1,6 @@
1
1
  import { SectionList as RNSectionList, SectionListProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const SectionList = copyComponentProperties(RNSectionList, (props: SectionListProps<unknown, unknown>) => {
@@ -7,7 +8,7 @@ export const SectionList = copyComponentProperties(RNSectionList, (props: Sectio
7
8
  const contentContainerStyle = useStyle(props.contentContainerClassName, props)
8
9
  const listFooterComponentStyle = useStyle(props.ListFooterComponentClassName, props)
9
10
  const listHeaderComponentStyle = useStyle(props.ListHeaderComponentClassName, props)
10
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor
11
+ const endFillColor = useAccentColor(props.endFillColorClassName, props)
11
12
 
12
13
  return (
13
14
  <Component
@@ -1,6 +1,7 @@
1
1
  import { Switch as RNSwitch, SwitchProps } from 'react-native'
2
2
  import { ComponentState } from '../../core/types'
3
3
  import { copyComponentProperties } from '../utils'
4
+ import { useAccentColor } from './useAccentColor'
4
5
  import { useStyle } from './useStyle'
5
6
 
6
7
  export const Switch = copyComponentProperties(RNSwitch, (props: SwitchProps) => {
@@ -9,10 +10,10 @@ export const Switch = copyComponentProperties(RNSwitch, (props: SwitchProps) =>
9
10
  isPressed: Boolean(props.value),
10
11
  } satisfies ComponentState
11
12
  const { Component, style } = useStyle(RNSwitch, props.className, props, state)
12
- const trackColorOn = useStyle(props.trackColorOnClassName, props, state).accentColor
13
- const trackColorOff = useStyle(props.trackColorOffClassName, props, state).accentColor
14
- const thumbColor = useStyle(props.thumbColorClassName, props, state).accentColor
15
- const ios_backgroundColor = useStyle(props.ios_backgroundColorClassName, props, state).accentColor
13
+ const trackColorOn = useAccentColor(props.trackColorOnClassName, props, state)
14
+ const trackColorOff = useAccentColor(props.trackColorOffClassName, props, state)
15
+ const thumbColor = useAccentColor(props.thumbColorClassName, props, state)
16
+ const ios_backgroundColor = useAccentColor(props.ios_backgroundColorClassName, props, state)
16
17
 
17
18
  return (
18
19
  <Component
@@ -2,6 +2,7 @@ import { useState } from 'react'
2
2
  import { Text as RNText, TextProps } from 'react-native'
3
3
  import { ComponentState } from '../../core/types'
4
4
  import { copyComponentProperties } from '../utils'
5
+ import { useAccentColor } from './useAccentColor'
5
6
  import { useStyle } from './useStyle'
6
7
 
7
8
  type StyleWithWebkitLineClamp = {
@@ -15,7 +16,7 @@ export const Text = copyComponentProperties(RNText, (props: TextProps) => {
15
16
  isDisabled: Boolean(props.disabled),
16
17
  } satisfies ComponentState
17
18
  const { Component, style } = useStyle(RNText, props.className, props, state)
18
- const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor
19
+ const selectionColor = useAccentColor(props.selectionColorClassName, props, state)
19
20
 
20
21
  return (
21
22
  <Component
@@ -2,6 +2,7 @@ import { useState } from 'react'
2
2
  import { TextInput as RNTextInput, TextInputProps } from 'react-native'
3
3
  import { ComponentState } from '../../core/types'
4
4
  import { copyComponentProperties } from '../utils'
5
+ import { useAccentColor } from './useAccentColor'
5
6
  import { useStyle } from './useStyle'
6
7
 
7
8
  export const TextInput = copyComponentProperties(RNTextInput, (props: TextInputProps) => {
@@ -13,11 +14,11 @@ export const TextInput = copyComponentProperties(RNTextInput, (props: TextInputP
13
14
  isPressed,
14
15
  } satisfies ComponentState
15
16
  const { Component, style } = useStyle(RNTextInput, props.className, props, state)
16
- const cursorColor = useStyle(props.cursorColorClassName, props, state).accentColor
17
- const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor
18
- const placeholderTextColor = useStyle(props.placeholderTextColorClassName, props, state).accentColor
19
- const selectionHandleColor = useStyle(props.selectionHandleColorClassName, props, state).accentColor
20
- const underlineColorAndroid = useStyle(props.underlineColorAndroidClassName, props, state).accentColor
17
+ const cursorColor = useAccentColor(props.cursorColorClassName, props, state)
18
+ const selectionColor = useAccentColor(props.selectionColorClassName, props, state)
19
+ const placeholderTextColor = useAccentColor(props.placeholderTextColorClassName, props, state)
20
+ const selectionHandleColor = useAccentColor(props.selectionHandleColorClassName, props, state)
21
+ const underlineColorAndroid = useAccentColor(props.underlineColorAndroidClassName, props, state)
21
22
 
22
23
  return (
23
24
  <Component
@@ -2,6 +2,7 @@ import { useState } from 'react'
2
2
  import { TouchableHighlight as RNTouchableHighlight, TouchableHighlightProps } from 'react-native'
3
3
  import { ComponentState } from '../../core/types'
4
4
  import { copyComponentProperties } from '../utils'
5
+ import { useAccentColor } from './useAccentColor'
5
6
  import { useStyle } from './useStyle'
6
7
 
7
8
  export const TouchableHighlight = copyComponentProperties(RNTouchableHighlight, (props: TouchableHighlightProps) => {
@@ -13,7 +14,7 @@ export const TouchableHighlight = copyComponentProperties(RNTouchableHighlight,
13
14
  isFocused,
14
15
  } satisfies ComponentState
15
16
  const { Component, style } = useStyle(RNTouchableHighlight, props.className, props, state)
16
- const underlayColor = useStyle(props.underlayColorClassName, props, state).accentColor
17
+ const underlayColor = useAccentColor(props.underlayColorClassName, props, state)
17
18
 
18
19
  return (
19
20
  <Component
@@ -1,5 +1,6 @@
1
1
  import { VirtualizedList as RNVirtualizedList, VirtualizedListProps } from 'react-native'
2
2
  import { copyComponentProperties } from '../utils'
3
+ import { useAccentColor } from './useAccentColor'
3
4
  import { useStyle } from './useStyle'
4
5
 
5
6
  export const VirtualizedList = copyComponentProperties(RNVirtualizedList, (props: VirtualizedListProps<unknown>) => {
@@ -7,7 +8,7 @@ export const VirtualizedList = copyComponentProperties(RNVirtualizedList, (props
7
8
  const contentContainerStyle = useStyle(props.contentContainerClassName, props)
8
9
  const listFooterComponentStyle = useStyle(props.ListFooterComponentClassName, props)
9
10
  const listHeaderComponentStyle = useStyle(props.ListHeaderComponentClassName, props)
10
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor
11
+ const endFillColor = useAccentColor(props.endFillColorClassName, props)
11
12
 
12
13
  return (
13
14
  <Component
@@ -0,0 +1,19 @@
1
+ import { isDefined } from '../../common/utils'
2
+ import { Logger } from '../../core/logger'
3
+ import { ComponentState } from '../../core/types'
4
+ import { useStyle } from './useStyle'
5
+
6
+ let warnedOnce = false
7
+
8
+ export const useAccentColor = (className: string | undefined, componentProps: Record<string, any>, state?: ComponentState) => {
9
+ const styles = useStyle(className, componentProps, state)
10
+
11
+ if (__DEV__ && !warnedOnce && isDefined(className) && className.trim() !== '' && styles.accentColor === undefined) {
12
+ warnedOnce = true
13
+ Logger.warn(
14
+ `className '${className}' was provided to extract accentColor but no color was found. Make sure the className includes a color utility (e.g., 'accent-red-500', 'accent-blue-600'). See https://docs.uniwind.dev/class-names#the-accent-prefix`,
15
+ )
16
+ }
17
+
18
+ return styles.accentColor
19
+ }
@@ -1,5 +1,6 @@
1
1
  import { FlatListProps } from 'react-native'
2
2
  import { FlatList as RNGHFlatList } from 'react-native-gesture-handler'
3
+ import { useAccentColor } from '../../native/useAccentColor'
3
4
  import { useStyle } from '../../native/useStyle'
4
5
  import { copyComponentProperties } from '../../utils'
5
6
 
@@ -9,7 +10,7 @@ export const FlatList = copyComponentProperties(RNGHFlatList, (props: FlatListPr
9
10
  const styleContentContainer = useStyle(props.contentContainerClassName, props)
10
11
  const styleListFooterComponent = useStyle(props.ListFooterComponentClassName, props)
11
12
  const styleListHeaderComponent = useStyle(props.ListHeaderComponentClassName, props)
12
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor
13
+ const endFillColor = useAccentColor(props.endFillColorClassName, props)
13
14
  const hasSingleColumn = !('numColumns' in props) || props.numColumns === 1
14
15
 
15
16
  return (
@@ -1,14 +1,15 @@
1
1
  import { RefreshControlProps } from 'react-native'
2
2
  import { RefreshControl as RNGHRefreshControl } from 'react-native-gesture-handler'
3
+ import { useAccentColor } from '../../native/useAccentColor'
3
4
  import { useStyle } from '../../native/useStyle'
4
5
  import { copyComponentProperties } from '../../utils'
5
6
 
6
7
  export const RefreshControl = copyComponentProperties(RNGHRefreshControl, (props: RefreshControlProps) => {
7
8
  const style = useStyle(props.className, props)
8
- const color = useStyle(props.colorsClassName, props).accentColor
9
- const tintColor = useStyle(props.tintColorClassName, props).accentColor
10
- const titleColor = useStyle(props.titleColorClassName, props).accentColor
11
- const progressBackgroundColor = useStyle(props.progressBackgroundColorClassName, props).accentColor
9
+ const color = useAccentColor(props.colorsClassName, props)
10
+ const tintColor = useAccentColor(props.tintColorClassName, props)
11
+ const titleColor = useAccentColor(props.titleColorClassName, props)
12
+ const progressBackgroundColor = useAccentColor(props.progressBackgroundColorClassName, props)
12
13
 
13
14
  return (
14
15
  <RNGHRefreshControl
@@ -2,6 +2,7 @@ import { useState } from 'react'
2
2
  import { TextProps } from 'react-native'
3
3
  import { Text as RNGHText } from 'react-native-gesture-handler'
4
4
  import { ComponentState } from '../../../core/types'
5
+ import { useAccentColor } from '../../native/useAccentColor'
5
6
  import { useStyle } from '../../native/useStyle'
6
7
  import { copyComponentProperties } from '../../utils'
7
8
 
@@ -16,7 +17,7 @@ export const Text = copyComponentProperties(RNGHText, (props: TextProps) => {
16
17
  isDisabled: Boolean(props.disabled),
17
18
  } satisfies ComponentState
18
19
  const style = useStyle(props.className, props, state)
19
- const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor
20
+ const selectionColor = useAccentColor(props.selectionColorClassName, props, state)
20
21
 
21
22
  return (
22
23
  <RNGHText
@@ -2,6 +2,7 @@ import { useState } from 'react'
2
2
  import { TextInputProps } from 'react-native'
3
3
  import { TextInput as RNGHTextInput } from 'react-native-gesture-handler'
4
4
  import { ComponentState } from '../../../core/types'
5
+ import { useAccentColor } from '../../native/useAccentColor'
5
6
  import { useStyle } from '../../native/useStyle'
6
7
  import { copyComponentProperties } from '../../utils'
7
8
 
@@ -15,10 +16,10 @@ export const TextInput = copyComponentProperties(RNGHTextInput, (props: TextInpu
15
16
  } satisfies ComponentState
16
17
  const style = useStyle(props.className, props, state)
17
18
  const cursorColor = useStyle(props.cursorColorClassName, props, state).accentColor
18
- const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor
19
- const placeholderTextColor = useStyle(props.placeholderTextColorClassName, props, state).accentColor
20
- const selectionHandleColor = useStyle(props.selectionHandleColorClassName, props, state).accentColor
21
- const underlineColorAndroid = useStyle(props.underlineColorAndroidClassName, props, state).accentColor
19
+ const selectionColor = useAccentColor(props.selectionColorClassName, props, state)
20
+ const placeholderTextColor = useAccentColor(props.placeholderTextColorClassName, props, state)
21
+ const selectionHandleColor = useAccentColor(props.selectionHandleColorClassName, props, state)
22
+ const underlineColorAndroid = useAccentColor(props.underlineColorAndroidClassName, props, state)
22
23
 
23
24
  return (
24
25
  <RNGHTextInput
@@ -1,8 +1,8 @@
1
1
  import { ActivityIndicator as RNActivityIndicator, ActivityIndicatorProps } from 'react-native'
2
- import { useUniwindAccent } from '../../hooks'
3
2
  import { copyComponentProperties } from '../utils'
4
3
  import { generateDataSet } from './generateDataSet'
5
4
  import { toRNWClassName } from './rnw'
5
+ import { useUniwindAccent } from './useUniwindAccent'
6
6
 
7
7
  export const ActivityIndicator = copyComponentProperties(RNActivityIndicator, (props: ActivityIndicatorProps) => {
8
8
  const color = useUniwindAccent(props.colorClassName)
@@ -1,7 +1,7 @@
1
1
  import { Button as RNButton, ButtonProps } from 'react-native'
2
- import { useUniwindAccent } from '../../hooks'
3
2
  import { copyComponentProperties } from '../utils'
4
3
  import { generateDataSet } from './generateDataSet'
4
+ import { useUniwindAccent } from './useUniwindAccent'
5
5
 
6
6
  export const Button = copyComponentProperties(RNButton, (props: ButtonProps) => {
7
7
  const color = useUniwindAccent(props.colorClassName)
@@ -1,8 +1,9 @@
1
1
  import { Image as RNImage, ImageProps } from 'react-native'
2
- import { useResolveClassNames, useUniwindAccent } from '../../hooks'
2
+ import { useResolveClassNames } from '../../hooks'
3
3
  import { copyComponentProperties } from '../utils'
4
4
  import { generateDataSet } from './generateDataSet'
5
5
  import { toRNWClassName } from './rnw'
6
+ import { useUniwindAccent } from './useUniwindAccent'
6
7
 
7
8
  export const Image = copyComponentProperties(RNImage, (props: ImageProps) => {
8
9
  const tintColor = useUniwindAccent(props.tintColorClassName)
@@ -1,8 +1,8 @@
1
1
  import { ImageBackground as RNImageBackground, ImageBackgroundProps } from 'react-native'
2
- import { useUniwindAccent } from '../../hooks'
3
2
  import { copyComponentProperties } from '../utils'
4
3
  import { generateDataSet } from './generateDataSet'
5
4
  import { toRNWClassName } from './rnw'
5
+ import { useUniwindAccent } from './useUniwindAccent'
6
6
 
7
7
  export const ImageBackground = copyComponentProperties(RNImageBackground, (props: ImageBackgroundProps) => {
8
8
  const tintColor = useUniwindAccent(props.tintColorClassName)
@@ -1,8 +1,8 @@
1
1
  import { Switch as RNSwitch, SwitchProps } from 'react-native'
2
- import { useUniwindAccent } from '../../hooks'
3
2
  import { copyComponentProperties } from '../utils'
4
3
  import { generateDataSet } from './generateDataSet'
5
4
  import { toRNWClassName } from './rnw'
5
+ import { useUniwindAccent } from './useUniwindAccent'
6
6
 
7
7
  export const Switch = copyComponentProperties(RNSwitch, (props: SwitchProps) => {
8
8
  const trackColorOn = useUniwindAccent(props.trackColorOnClassName)
@@ -1,8 +1,8 @@
1
1
  import { TextInput as RNTextInput, TextInputProps } from 'react-native'
2
- import { useUniwindAccent } from '../../hooks'
3
2
  import { copyComponentProperties } from '../utils'
4
3
  import { generateDataSet } from './generateDataSet'
5
4
  import { toRNWClassName } from './rnw'
5
+ import { useUniwindAccent } from './useUniwindAccent'
6
6
 
7
7
  export const TextInput = copyComponentProperties(RNTextInput, (props: TextInputProps) => {
8
8
  const placeholderTextColor = useUniwindAccent(props.placeholderTextColorClassName)
@@ -1,8 +1,8 @@
1
1
  import { TouchableHighlight as RNTouchableHighlight, TouchableHighlightProps } from 'react-native'
2
- import { useUniwindAccent } from '../../hooks'
3
2
  import { copyComponentProperties } from '../utils'
4
3
  import { generateDataSet } from './generateDataSet'
5
4
  import { toRNWClassName } from './rnw'
5
+ import { useUniwindAccent } from './useUniwindAccent'
6
6
 
7
7
  export const TouchableHighlight = copyComponentProperties(RNTouchableHighlight, (props: TouchableHighlightProps) => {
8
8
  const underlayColor = useUniwindAccent(props.underlayColorClassName)
@@ -0,0 +1,21 @@
1
+ import { isDefined } from '../../common/utils'
2
+ import { Logger } from '../../core/logger'
3
+ import { formatColor } from '../../core/web/formatColor'
4
+ import { useResolveClassNames } from '../../hooks/useResolveClassNames'
5
+
6
+ let warnedOnce = false
7
+
8
+ export const useUniwindAccent = (className: string | undefined) => {
9
+ const styles = useResolveClassNames(className ?? '')
10
+
11
+ if (__DEV__ && !warnedOnce && isDefined(className) && className.trim() !== '' && styles.accentColor === undefined) {
12
+ warnedOnce = true
13
+ Logger.warn(
14
+ `className '${className}' was provided to extract accentColor but no color was found. Make sure the className includes a color utility (e.g., 'accent-red-500', 'accent-blue-600'). See https://docs.uniwind.dev/class-names#the-accent-prefix`,
15
+ )
16
+ }
17
+
18
+ return styles.accentColor !== undefined
19
+ ? formatColor(styles.accentColor)
20
+ : undefined
21
+ }
@@ -7,8 +7,7 @@ import { UniwindListener } from '../listener'
7
7
  import { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types'
8
8
 
9
9
  const SYSTEM_THEME = 'system' as const
10
-
11
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
10
+ // Platform.constants is not defined in RNW
12
11
  const RN_VERSION = Platform.constants?.reactNativeVersion?.minor ?? 0
13
12
  const UNSPECIFIED_THEME = RN_VERSION >= 82 ? 'unspecified' : undefined
14
13
 
@@ -21,7 +20,6 @@ export class UniwindConfigBuilder {
21
20
  Appearance.addChangeListener(event => {
22
21
  const colorScheme = event.colorScheme === 'unspecified'
23
22
  ? ColorScheme.Light
24
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
25
23
  : event.colorScheme ?? ColorScheme.Light
26
24
  const prevTheme = this.#currentTheme
27
25
 
@@ -108,15 +106,14 @@ export class UniwindConfigBuilder {
108
106
  }
109
107
  }
110
108
 
111
- updateCSSVariables(theme: ThemeName, variables: CSSVariables) {
109
+ // oxlint-disable-next-line typescript/no-unused-vars
110
+ updateCSSVariables(theme: ThemeName, cssVariables: CSSVariables) {
112
111
  // noop
113
- theme
114
- variables
115
112
  }
116
113
 
114
+ // oxlint-disable-next-line typescript/no-unused-vars
117
115
  updateInsets(insets: Insets) {
118
116
  // noop
119
- insets
120
117
  }
121
118
 
122
119
  protected __reinit(_: GenerateStyleSheetsCallback, themes: Array<string>) {
@@ -44,9 +44,7 @@ class UniwindConfigBuilder extends UniwindConfigBuilderBase {
44
44
  })
45
45
  })
46
46
 
47
- if (theme === this.currentTheme) {
48
- UniwindListener.notify([StyleDependency.Variables])
49
- }
47
+ UniwindListener.notify([StyleDependency.Variables])
50
48
  }
51
49
 
52
50
  updateInsets(insets: Insets) {