react-native-unistyles 3.0.0-nightly-20250206 → 3.0.0-nightly-20250207

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 (204) hide show
  1. package/cxx/core/HostUnistyle.cpp +18 -4
  2. package/cxx/core/UnistyleWrapper.h +0 -1
  3. package/lib/commonjs/components/native/Animated.js +2 -2
  4. package/lib/commonjs/components/native/Animated.js.map +1 -1
  5. package/lib/commonjs/components/native/ImageBackground.js +5 -5
  6. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  7. package/lib/commonjs/components/native/NativeText.native.js.map +1 -1
  8. package/lib/commonjs/components/native/NativeView.native.js.map +1 -1
  9. package/lib/commonjs/components/native/Pressable.js +1 -1
  10. package/lib/commonjs/components/native/Pressable.js.map +1 -1
  11. package/lib/commonjs/components/native/Pressable.native.js +6 -10
  12. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  13. package/lib/commonjs/core/createUnistylesElement.js +5 -5
  14. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  15. package/lib/commonjs/core/createUnistylesElement.native.js +1 -1
  16. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  17. package/lib/commonjs/core/createUnistylesImageBackground.js +1 -1
  18. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  19. package/lib/commonjs/core/withUnistyles/withUnistyles.js +1 -1
  20. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  21. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +1 -1
  22. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  23. package/lib/commonjs/hooks/useMedia.native.js +1 -1
  24. package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
  25. package/lib/commonjs/mq.js.map +1 -1
  26. package/lib/commonjs/server/getServerUnistyles.js +1 -1
  27. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  28. package/lib/commonjs/server/hydrateServerUnistyles.js +1 -1
  29. package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
  30. package/lib/commonjs/server/resetServerUnistyles.js +1 -1
  31. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
  32. package/lib/commonjs/server/useServerUnistyles.js +2 -2
  33. package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
  34. package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
  35. package/lib/commonjs/specs/StyleSheet/index.js +1 -1
  36. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  37. package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
  38. package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
  39. package/lib/commonjs/specs/index.native.js +3 -3
  40. package/lib/commonjs/specs/index.native.js.map +1 -1
  41. package/lib/commonjs/web/convert/index.js +3 -3
  42. package/lib/commonjs/web/convert/index.js.map +1 -1
  43. package/lib/commonjs/web/convert/object/boxShadow.js +4 -4
  44. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
  45. package/lib/commonjs/web/convert/object/filter.js +3 -3
  46. package/lib/commonjs/web/convert/object/filter.js.map +1 -1
  47. package/lib/commonjs/web/convert/object/transform.js +1 -1
  48. package/lib/commonjs/web/convert/object/transform.js.map +1 -1
  49. package/lib/commonjs/web/convert/utils.js.map +1 -1
  50. package/lib/commonjs/web/index.js +1 -1
  51. package/lib/commonjs/web/index.js.map +1 -1
  52. package/lib/commonjs/web/registry.js +1 -1
  53. package/lib/commonjs/web/registry.js.map +1 -1
  54. package/lib/commonjs/web/runtime.js.map +1 -1
  55. package/lib/commonjs/web/shadowRegistry.js +1 -1
  56. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  57. package/lib/commonjs/web/state.js +1 -1
  58. package/lib/commonjs/web/state.js.map +1 -1
  59. package/lib/commonjs/web/utils/unistyle.js +2 -2
  60. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  61. package/lib/module/components/native/Animated.js +2 -2
  62. package/lib/module/components/native/Animated.js.map +1 -1
  63. package/lib/module/components/native/ImageBackground.js +3 -3
  64. package/lib/module/components/native/ImageBackground.js.map +1 -1
  65. package/lib/module/components/native/NativeText.native.js.map +1 -1
  66. package/lib/module/components/native/NativeView.native.js.map +1 -1
  67. package/lib/module/components/native/Pressable.js +1 -1
  68. package/lib/module/components/native/Pressable.js.map +1 -1
  69. package/lib/module/components/native/Pressable.native.js +6 -10
  70. package/lib/module/components/native/Pressable.native.js.map +1 -1
  71. package/lib/module/core/createUnistylesElement.js +3 -3
  72. package/lib/module/core/createUnistylesElement.js.map +1 -1
  73. package/lib/module/core/createUnistylesElement.native.js +1 -1
  74. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  75. package/lib/module/core/createUnistylesImageBackground.js +1 -1
  76. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  77. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  78. package/lib/module/core/withUnistyles/withUnistyles.js +1 -1
  79. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  80. package/lib/module/core/withUnistyles/withUnistyles.native.js +1 -1
  81. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  82. package/lib/module/hooks/useMedia.native.js +1 -1
  83. package/lib/module/hooks/useMedia.native.js.map +1 -1
  84. package/lib/module/mq.js.map +1 -1
  85. package/lib/module/server/getServerUnistyles.js +1 -1
  86. package/lib/module/server/getServerUnistyles.js.map +1 -1
  87. package/lib/module/server/hydrateServerUnistyles.js +1 -1
  88. package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
  89. package/lib/module/server/resetServerUnistyles.js +1 -1
  90. package/lib/module/server/resetServerUnistyles.js.map +1 -1
  91. package/lib/module/server/useServerUnistyles.js +2 -2
  92. package/lib/module/server/useServerUnistyles.js.map +1 -1
  93. package/lib/module/specs/StatusBar/index.js.map +1 -1
  94. package/lib/module/specs/StyleSheet/index.js +1 -1
  95. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  96. package/lib/module/specs/UnistylesRuntime/index.js +1 -1
  97. package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
  98. package/lib/module/specs/index.native.js +4 -4
  99. package/lib/module/specs/index.native.js.map +1 -1
  100. package/lib/module/web/convert/index.js +4 -4
  101. package/lib/module/web/convert/index.js.map +1 -1
  102. package/lib/module/web/convert/object/boxShadow.js +2 -2
  103. package/lib/module/web/convert/object/boxShadow.js.map +1 -1
  104. package/lib/module/web/convert/object/filter.js +3 -3
  105. package/lib/module/web/convert/object/filter.js.map +1 -1
  106. package/lib/module/web/convert/object/transform.js +1 -1
  107. package/lib/module/web/convert/object/transform.js.map +1 -1
  108. package/lib/module/web/convert/utils.js.map +1 -1
  109. package/lib/module/web/index.js +1 -1
  110. package/lib/module/web/index.js.map +1 -1
  111. package/lib/module/web/registry.js +1 -1
  112. package/lib/module/web/registry.js.map +1 -1
  113. package/lib/module/web/runtime.js.map +1 -1
  114. package/lib/module/web/shadowRegistry.js +1 -1
  115. package/lib/module/web/shadowRegistry.js.map +1 -1
  116. package/lib/module/web/state.js +1 -1
  117. package/lib/module/web/state.js.map +1 -1
  118. package/lib/module/web/utils/unistyle.js +2 -2
  119. package/lib/module/web/utils/unistyle.js.map +1 -1
  120. package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
  121. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  122. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  123. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  124. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  125. package/lib/typescript/src/mq.d.ts +1 -1
  126. package/lib/typescript/src/mq.d.ts.map +1 -1
  127. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
  128. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  129. package/lib/typescript/src/specs/StatusBar/index.d.ts +1 -1
  130. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  131. package/lib/typescript/src/specs/StyleSheet/index.d.ts +1 -1
  132. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  133. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -1
  134. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  135. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +5 -5
  136. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  137. package/lib/typescript/src/specs/index.native.d.ts +4 -4
  138. package/lib/typescript/src/specs/index.native.d.ts.map +1 -1
  139. package/lib/typescript/src/types/breakpoints.d.ts +2 -2
  140. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  141. package/lib/typescript/src/types/core.d.ts +1 -1
  142. package/lib/typescript/src/types/core.d.ts.map +1 -1
  143. package/lib/typescript/src/types/stylesheet.d.ts +4 -4
  144. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  145. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  146. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  147. package/lib/typescript/src/web/convert/types.d.ts +1 -1
  148. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  149. package/lib/typescript/src/web/convert/utils.d.ts +2 -2
  150. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  151. package/lib/typescript/src/web/create.d.ts +1 -1
  152. package/lib/typescript/src/web/create.d.ts.map +1 -1
  153. package/lib/typescript/src/web/index.d.ts +1 -1
  154. package/lib/typescript/src/web/index.d.ts.map +1 -1
  155. package/lib/typescript/src/web/registry.d.ts +1 -1
  156. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  157. package/lib/typescript/src/web/runtime.d.ts +1 -1
  158. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  159. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  160. package/lib/typescript/src/web/state.d.ts +1 -1
  161. package/lib/typescript/src/web/state.d.ts.map +1 -1
  162. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  163. package/package.json +4 -2
  164. package/plugin/index.js +3 -0
  165. package/plugin/stylesheet.js +3 -3
  166. package/src/components/native/Animated.tsx +2 -2
  167. package/src/components/native/ImageBackground.tsx +4 -4
  168. package/src/components/native/NativeText.native.tsx +1 -1
  169. package/src/components/native/NativeView.native.tsx +1 -1
  170. package/src/components/native/Pressable.native.tsx +6 -11
  171. package/src/components/native/Pressable.tsx +1 -1
  172. package/src/core/createUnistylesElement.native.tsx +1 -1
  173. package/src/core/createUnistylesElement.tsx +3 -3
  174. package/src/core/createUnistylesImageBackground.tsx +1 -1
  175. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +1 -1
  176. package/src/core/withUnistyles/withUnistyles.native.tsx +2 -2
  177. package/src/core/withUnistyles/withUnistyles.tsx +3 -3
  178. package/src/hooks/useMedia.native.ts +1 -1
  179. package/src/mq.ts +1 -1
  180. package/src/server/getServerUnistyles.tsx +1 -1
  181. package/src/server/hydrateServerUnistyles.ts +1 -1
  182. package/src/server/resetServerUnistyles.ts +1 -1
  183. package/src/server/useServerUnistyles.tsx +2 -2
  184. package/src/specs/StatusBar/index.ts +1 -1
  185. package/src/specs/StyleSheet/index.ts +3 -3
  186. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
  187. package/src/specs/UnistylesRuntime/index.ts +5 -5
  188. package/src/specs/index.native.ts +4 -4
  189. package/src/types/breakpoints.ts +2 -2
  190. package/src/types/core.ts +1 -1
  191. package/src/types/stylesheet.ts +4 -4
  192. package/src/web/convert/index.ts +4 -4
  193. package/src/web/convert/object/boxShadow.ts +2 -2
  194. package/src/web/convert/object/filter.ts +3 -3
  195. package/src/web/convert/object/transform.ts +2 -2
  196. package/src/web/convert/types.ts +1 -1
  197. package/src/web/convert/utils.ts +2 -2
  198. package/src/web/create.ts +1 -1
  199. package/src/web/index.ts +3 -3
  200. package/src/web/registry.ts +2 -2
  201. package/src/web/runtime.ts +2 -2
  202. package/src/web/shadowRegistry.ts +2 -2
  203. package/src/web/state.ts +4 -4
  204. package/src/web/utils/unistyle.ts +3 -3
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-nightly-20250206",
3
+ "version": "3.0.0-nightly-20250207",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
7
7
  "test:coverage": "jest --passWithNoTests --coverage",
8
8
  "tsc": "node_modules/typescript/bin/tsc --noEmit",
9
9
  "lint": "biome lint",
10
+ "check": "biome check --write",
11
+ "check:ci": "biome check",
10
12
  "prepare": "husky && bob build",
11
- "precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn test'",
13
+ "precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn check' 'yarn test'",
12
14
  "release": "release-it"
13
15
  },
14
16
  "main": "lib/commonjs/index.js",
package/plugin/index.js CHANGED
@@ -17,6 +17,7 @@ module.exports = function ({ types: t }) {
17
17
  .some(path => state.filename.includes(path))
18
18
 
19
19
  state.file.hasAnyUnistyle = false
20
+ state.file.hasUnistylesImport = false
20
21
  state.file.hasVariants = false
21
22
  state.file.styleSheetLocalName = ''
22
23
  state.file.tagNumber = 0
@@ -95,6 +96,8 @@ module.exports = function ({ types: t }) {
95
96
  const importSource = path.node.source.value
96
97
 
97
98
  if (importSource.includes('react-native-unistyles')) {
99
+ state.file.hasUnistylesImport = true
100
+
98
101
  path.node.specifiers.forEach(specifier => {
99
102
  if (specifier.imported && specifier.imported.name === 'StyleSheet') {
100
103
  state.file.styleSheetLocalName = specifier.local.name
@@ -41,7 +41,7 @@ function isUnistylesStyleSheet(t, path, state) {
41
41
  }
42
42
 
43
43
  function isKindOfStyleSheet(t, path, state) {
44
- if (!state.file.forceProcessing) {
44
+ if (!state.file.forceProcessing && !state.file.hasUnistylesImport) {
45
45
  return false
46
46
  }
47
47
 
@@ -169,7 +169,7 @@ function getStylesDependenciesFromFunction(t, path) {
169
169
  let themeNames = []
170
170
 
171
171
  // destructured theme object
172
- if (themeParam.type === 'ObjectPattern') {
172
+ if (themeParam && themeParam.type === 'ObjectPattern') {
173
173
  // If destructured, collect all property names
174
174
  for (const prop of themeParam.properties) {
175
175
  themeNames.push(getProperty(t, prop))
@@ -177,7 +177,7 @@ function getStylesDependenciesFromFunction(t, path) {
177
177
  }
178
178
 
179
179
  // user used 'theme' without destructuring
180
- if (themeParam.type === 'Identifier') {
180
+ if (themeParam && themeParam.type === 'Identifier') {
181
181
  themeNames.push({
182
182
  properties: [themeParam.name]
183
183
  })
@@ -1,10 +1,10 @@
1
1
  import { Animated as RNAnimated } from 'react-native'
2
- import { View } from './View'
3
- import { Text } from './Text'
4
2
  import { FlatList } from './FlatList'
5
3
  import { Image } from './Image'
6
4
  import { ScrollView } from './ScrollView'
7
5
  import { SectionList } from './SectionList'
6
+ import { Text } from './Text'
7
+ import { View } from './View'
8
8
 
9
9
  export const Animated = {
10
10
  ...RNAnimated,
@@ -1,11 +1,11 @@
1
1
  import React from 'react'
2
- import { ImageBackground as NativeImageBackground } from 'react-native'
3
2
  import { forwardRef } from 'react'
4
- import type { UnistylesValues } from '../../types'
3
+ import { ImageBackground as NativeImageBackground } from 'react-native'
5
4
  import { getClassName } from '../../core'
6
- import { isServer } from '../../web/utils'
7
- import { UnistylesShadowRegistry } from '../../web'
5
+ import type { UnistylesValues } from '../../types'
8
6
  import { copyComponentProperties } from '../../utils'
7
+ import { UnistylesShadowRegistry } from '../../web'
8
+ import { isServer } from '../../web/utils'
9
9
 
10
10
  type Props = {
11
11
  style?: UnistylesValues
@@ -1,5 +1,5 @@
1
- import type { TextProps } from 'react-native'
2
1
  import { type ComponentType, createElement, forwardRef } from 'react'
2
+ import type { TextProps } from 'react-native'
3
3
  import { createUnistylesElement } from '../../core'
4
4
 
5
5
  // credits to @hirbod
@@ -1,5 +1,5 @@
1
- import type { ViewProps } from 'react-native'
2
1
  import { type ComponentType, createElement, forwardRef } from 'react'
2
+ import type { ViewProps } from 'react-native'
3
3
  import { createUnistylesElement } from '../../core'
4
4
 
5
5
  // credits to @hirbod
@@ -1,8 +1,8 @@
1
1
  import React, { forwardRef, useLayoutEffect, useRef } from 'react'
2
2
  import { Pressable as NativePressableReactNative } from 'react-native'
3
3
  import type { PressableProps as Props, View } from 'react-native'
4
- import { UnistylesShadowRegistry } from '../../specs'
5
4
  import { passForwardedRef } from '../../core'
5
+ import { UnistylesShadowRegistry } from '../../specs'
6
6
 
7
7
  type PressableProps = Props & {
8
8
  variants?: Record<string, string | boolean>
@@ -20,7 +20,7 @@ const getStyles = (styleProps: Record<string, any> = {}) => {
20
20
  return {
21
21
  // styles without C++ state
22
22
  ...styleProps[unistyleKey].uni__getStyles(),
23
- [unistyleKey]: styleProps[unistyleKey].uni__getStyles()
23
+ [unistyleKey]: styleProps[unistyleKey]
24
24
  }
25
25
  }
26
26
 
@@ -40,13 +40,6 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
40
40
  <NativePressableReactNative
41
41
  {...props}
42
42
  ref={ref => {
43
- const unistyles = typeof style === 'function'
44
- ? style({ pressed: false })
45
- : style
46
-
47
- // @ts-expect-error - this is hidden from TS
48
- UnistylesShadowRegistry.add(ref, unistyles)
49
-
50
43
  if (ref) {
51
44
  storedRef.current = ref
52
45
  }
@@ -54,16 +47,18 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
54
47
  return passForwardedRef(props, ref, forwardedRef)
55
48
  }}
56
49
  style={state => {
57
- const unistyles = typeof style === 'function'
50
+ const isPropStyleAFunction = typeof style === 'function'
51
+ const unistyles = isPropStyleAFunction
58
52
  ? style.call(style, state)
59
53
  : getStyles(style as unknown as Record<string, any>)
60
54
 
61
- if (!storedRef.current) {
55
+ if (!storedRef.current || !isPropStyleAFunction) {
62
56
  return unistyles
63
57
  }
64
58
 
65
59
  // @ts-expect-error - this is hidden from TS
66
60
  UnistylesShadowRegistry.remove(storedRef.current)
61
+
67
62
  // @ts-expect-error - this is hidden from TS
68
63
  UnistylesShadowRegistry.add(storedRef.current, unistyles)
69
64
 
@@ -1,9 +1,9 @@
1
1
  import React, { forwardRef } from 'react'
2
2
  import { Pressable as NativePressableReactNative } from 'react-native'
3
3
  import type { PressableProps as Props, View } from 'react-native'
4
+ import { getClassName } from '../../core'
4
5
  import { UnistylesShadowRegistry } from '../../specs'
5
6
  import type { UnistylesValues } from '../../types'
6
- import { getClassName } from '../../core'
7
7
  import { isServer } from '../../web/utils'
8
8
 
9
9
  type Variants = Record<string, string | boolean | undefined>
@@ -1,8 +1,8 @@
1
1
  import React, { useLayoutEffect, useRef } from 'react'
2
2
  import { UnistylesShadowRegistry } from '../specs'
3
+ import { copyComponentProperties } from '../utils'
3
4
  import { passForwardedRef } from './passForwardRef'
4
5
  import { maybeWarnAboutMultipleUnistyles } from './warn'
5
- import { copyComponentProperties } from '../utils'
6
6
 
7
7
  const getNativeRef = (Component: any, ref: any) => {
8
8
  switch (Component.name) {
@@ -1,10 +1,10 @@
1
1
  import React from 'react'
2
2
  import type { UnistylesValues } from '../types'
3
- import { getClassName } from './getClassname'
4
- import { isServer } from '../web/utils'
3
+ import { copyComponentProperties } from '../utils'
5
4
  import { UnistylesShadowRegistry } from '../web'
5
+ import { isServer } from '../web/utils'
6
+ import { getClassName } from './getClassname'
6
7
  import { maybeWarnAboutMultipleUnistyles } from './warn'
7
- import { copyComponentProperties } from '../utils'
8
8
 
9
9
  type ComponentProps = {
10
10
  style?: UnistylesValues | Array<UnistylesValues>
@@ -1,9 +1,9 @@
1
1
  import React, { useLayoutEffect, useRef } from 'react'
2
2
  import type { Image, ImageBackground, ImageBackgroundProps } from 'react-native'
3
3
  import { UnistylesShadowRegistry } from '../specs'
4
+ import { copyComponentProperties } from '../utils'
4
5
  import { passForwardedRef } from './passForwardRef'
5
6
  import { maybeWarnAboutMultipleUnistyles } from './warn'
6
- import { copyComponentProperties } from '../utils'
7
7
 
8
8
  export const createUnistylesImageBackground = (Component: typeof ImageBackground) => {
9
9
  const UnistylesImageBackground = React.forwardRef<ImageBackground, ImageBackgroundProps>((props, forwardedRef) => {
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useReducer, useRef, useState } from 'react'
2
- import { UnistylesRuntime, UnistylesShadowRegistry, type UnistylesMiniRuntime } from '../../specs'
2
+ import { type UnistylesMiniRuntime, UnistylesRuntime, UnistylesShadowRegistry } from '../../specs'
3
3
  // It's imported that way because of circular dependency
4
4
  import { UnistyleDependency } from '../../specs/NativePlatform'
5
5
  import type { UnistylesTheme } from '../../types'
@@ -2,9 +2,9 @@ import React, { forwardRef, useEffect, type ComponentType } from 'react'
2
2
  import type { UnistyleDependency } from '../../specs'
3
3
  import type { PartialBy } from '../../types/common'
4
4
  import { deepMergeObjects } from '../../utils'
5
- import type { Mappings, SupportedStyleProps } from './types'
6
- import { maybeWarnAboutMultipleUnistyles } from '../warn'
7
5
  import { useProxifiedUnistyles } from '../useProxifiedUnistyles'
6
+ import { maybeWarnAboutMultipleUnistyles } from '../warn'
7
+ import type { Mappings, SupportedStyleProps } from './types'
8
8
 
9
9
  // @ts-expect-error
10
10
  type GenericComponentProps<P> = ComponentProps<P>
@@ -1,11 +1,11 @@
1
1
  import React, { type ComponentType, forwardRef, type ComponentProps, type ComponentRef } from 'react'
2
+ import type { UnistylesValues } from '../../types'
2
3
  import type { PartialBy } from '../../types/common'
3
4
  import { deepMergeObjects } from '../../utils'
4
- import type { Mappings, SupportedStyleProps } from './types'
5
- import type { UnistylesValues } from '../../types'
6
5
  import { getClassName } from '../getClassname'
7
- import { maybeWarnAboutMultipleUnistyles } from '../warn'
8
6
  import { useProxifiedUnistyles } from '../useProxifiedUnistyles'
7
+ import { maybeWarnAboutMultipleUnistyles } from '../warn'
8
+ import type { Mappings, SupportedStyleProps } from './types'
9
9
 
10
10
  // @ts-expect-error
11
11
  type GenericComponentProps<T> = ComponentProps<T>
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useLayoutEffect, useState } from 'react'
2
+ import { isUnistylesMq, isValidMq, parseMq } from '../mq'
2
3
  import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
3
- import { isValidMq, parseMq, isUnistylesMq } from '../mq'
4
4
 
5
5
  export const useMedia = (config: { mq: symbol }) => {
6
6
  const computeIsVisible = (): boolean => {
package/src/mq.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Nullable } from './types'
2
1
  import type { UnistylesBreakpoints } from './global'
3
2
  import { UnistylesRuntime } from './specs'
3
+ import type { Nullable } from './types'
4
4
 
5
5
  const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/
6
6
  const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { StyleSheet } from 'react-native'
3
- import { error, isServer } from '../web/utils'
4
3
  import { UnistylesWeb } from '../web'
4
+ import { error, isServer } from '../web/utils'
5
5
  import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
6
6
 
7
7
  export const getServerUnistyles = ({ includeRNWStyles = true }: ServerUnistylesSettings = DefaultServerUnistylesSettings) => {
@@ -1,5 +1,5 @@
1
- import { error, isServer } from '../web/utils'
2
1
  import { UnistylesWeb } from '../web'
2
+ import { error, isServer } from '../web/utils'
3
3
 
4
4
  declare global {
5
5
  interface Window {
@@ -1,5 +1,5 @@
1
- import { error, isServer } from '../web/utils'
2
1
  import { UnistylesWeb } from '../web'
2
+ import { error, isServer } from '../web/utils'
3
3
 
4
4
  export const resetServerUnistyles = () => {
5
5
  if (!isServer()) {
@@ -1,9 +1,9 @@
1
1
  import React, { useRef } from 'react'
2
2
  import { isServer } from '../web/utils'
3
- import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
4
3
  import { getServerUnistyles } from './getServerUnistyles'
5
- import { resetServerUnistyles } from './resetServerUnistyles'
6
4
  import { hydrateServerUnistyles } from './hydrateServerUnistyles'
5
+ import { resetServerUnistyles } from './resetServerUnistyles'
6
+ import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
7
7
 
8
8
  export const useServerUnistyles = (settings: ServerUnistylesSettings = DefaultServerUnistylesSettings): React.ReactNode | null => {
9
9
  const isServerInserted = useRef(false)
@@ -1,6 +1,6 @@
1
1
  import { StatusBar as NativeStatusBar } from 'react-native'
2
- import type { UnistylesStatusBar as UnistylesStatusBarSpec } from './UnistylesStatusBar.nitro'
3
2
  import { StatusBarStyle } from '../types'
3
+ import type { UnistylesStatusBar as UnistylesStatusBarSpec } from './UnistylesStatusBar.nitro'
4
4
 
5
5
  export type StatusBarHiddenAnimation = 'none' | 'fade' | 'slide'
6
6
 
@@ -1,9 +1,9 @@
1
- import { NitroModules } from 'react-native-nitro-modules'
2
- import { processColor, StyleSheet as NativeStyleSheet } from 'react-native'
1
+ import { StyleSheet as NativeStyleSheet, processColor } from 'react-native'
3
2
  import type { StyleSheet as NativeStyleSheetType } from 'react-native'
4
- import type { UnistylesStyleSheet as UnistylesStyleSheetSpec } from './UnistylesStyleSheet.nitro'
3
+ import { NitroModules } from 'react-native-nitro-modules'
5
4
  import type { UnistylesBreakpoints, UnistylesThemes } from '../../global'
6
5
  import type { CreateUnistylesStyleSheet } from '../../types'
6
+ import type { UnistylesStyleSheet as UnistylesStyleSheetSpec } from './UnistylesStyleSheet.nitro'
7
7
 
8
8
  type UnistylesThemeSettings = {
9
9
  initialTheme: (() => keyof UnistylesThemes) | keyof UnistylesThemes
@@ -1,7 +1,7 @@
1
1
  import type { HybridObject } from 'react-native-nitro-modules'
2
- import type { AppBreakpoint, AppThemeName, Dimensions, Insets } from '../types'
3
2
  import type { AndroidContentSizeCategory, IOSContentSizeCategory, WebContentSizeCategory } from '../../types'
4
3
  import type { UnistylesNativeMiniRuntime } from '../NativePlatform'
4
+ import type { AppBreakpoint, AppThemeName, Dimensions, Insets } from '../types'
5
5
 
6
6
  type ColorScheme = 'light' | 'dark' | 'unspecified'
7
7
  type Orientation = 'portrait' | 'landscape'
@@ -1,12 +1,12 @@
1
1
  import { processColor } from 'react-native'
2
2
  import { NitroModules } from 'react-native-nitro-modules'
3
- import type { UnistylesRuntime as UnistylesRuntimeSpec, UnistylesMiniRuntime } from './UnistylesRuntime.nitro'
4
- import type { AppBreakpoint, AppTheme, AppThemeName, Color, ColorScheme, Orientation } from '../types'
5
- import { attachStatusBarJSMethods, type UnistylesStatusBar } from '../StatusBar'
6
- import type { UnistylesNavigationBar } from '../NavigtionBar'
7
- import type { AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesTheme } from '../../types'
8
3
  import { isIOS } from '../../common'
9
4
  import type { UnistylesThemes } from '../../global'
5
+ import type { AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesTheme } from '../../types'
6
+ import type { UnistylesNavigationBar } from '../NavigtionBar'
7
+ import { type UnistylesStatusBar, attachStatusBarJSMethods } from '../StatusBar'
8
+ import type { AppBreakpoint, AppTheme, AppThemeName, Color, ColorScheme, Orientation } from '../types'
9
+ import type { UnistylesMiniRuntime, UnistylesRuntime as UnistylesRuntimeSpec } from './UnistylesRuntime.nitro'
10
10
 
11
11
  export interface UnistylesRuntimePrivate extends Omit<UnistylesRuntimeSpec, 'setRootViewBackgroundColor'> {
12
12
  readonly colorScheme: ColorScheme,
@@ -1,12 +1,12 @@
1
1
  import './TurboUnistyles'
2
2
 
3
- import { Runtime } from './UnistylesRuntime'
3
+ import { UnistyleDependency } from './NativePlatform'
4
+ import { UnistylesShadowRegistry } from './ShadowRegistry'
4
5
  import { StyleSheet } from './StyleSheet'
5
6
  import type { UnistylesStyleSheet } from './StyleSheet'
6
- import { UnistylesShadowRegistry } from './ShadowRegistry'
7
+ import { Runtime } from './UnistylesRuntime'
7
8
  import type { UnistylesMiniRuntime } from './UnistylesRuntime'
8
- import { StatusBarStyle, ColorScheme, Orientation } from './types'
9
- import { UnistyleDependency } from './NativePlatform'
9
+ import { ColorScheme, Orientation, StatusBarStyle } from './types'
10
10
 
11
11
  export {
12
12
  StatusBarStyle,
@@ -1,7 +1,7 @@
1
1
  import type { ColorValue, OpaqueColorValue } from 'react-native'
2
- import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet'
3
- import type { TransformStyles } from './core'
4
2
  import type { SafeReturnType } from './common'
3
+ import type { TransformStyles } from './core'
4
+ import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet'
5
5
 
6
6
  type ExtractTransformArray<T> = T extends object
7
7
  ? { [K in keyof T]: ExtractBreakpoints<T[K]> }
package/src/types/core.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
1
2
  import type {
2
3
  MatrixTransform,
3
4
  PerspectiveTransform,
@@ -13,7 +14,6 @@ import type {
13
14
  TranslateXTransform,
14
15
  TranslateYTransform
15
16
  } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'
16
- import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
17
17
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
18
18
 
19
19
  export type ShadowOffset = {
@@ -1,11 +1,11 @@
1
- import type { BoxShadowValue, ImageStyle, TextStyle, ViewStyle, FilterFunction } from 'react-native'
2
- import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core'
1
+ import type { CSSProperties } from 'react'
2
+ import type { BoxShadowValue, FilterFunction, ImageStyle, TextStyle, ViewStyle } from 'react-native'
3
3
  import type { UnistylesBreakpoints } from '../global'
4
4
  import type { UnistylesMiniRuntime } from '../specs'
5
+ import type { Pseudo } from '../web/convert/pseudo'
5
6
  import type { ReactNativeStyleSheet } from './breakpoints'
7
+ import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core'
6
8
  import type { ExtractVariantNames } from './variants'
7
- import type { CSSProperties } from 'react'
8
- import type { Pseudo } from '../web/convert/pseudo'
9
9
 
10
10
  // these props are treated differently to nest breakpoints and media queries
11
11
  type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset' | 'boxShadow' | 'filter'
@@ -1,10 +1,10 @@
1
1
  import type { UnistylesValues } from '../../types'
2
+ import { deepMergeObjects } from '../../utils'
3
+ import { getBoxShadow, getFilterStyle, getTransformStyle } from './object'
2
4
  import { isPseudo } from './pseudo'
5
+ import { getBoxShadowStyle, getTextShadowStyle } from './shadow'
3
6
  import { getStyle } from './style'
4
- import { deepMergeObjects } from '../../utils'
5
- import { getTransformStyle, getBoxShadow, getFilterStyle } from './object'
6
- import { isShadow, isFilter, isTextShadow, isTransform, isBoxShadow } from './utils'
7
- import { getTextShadowStyle, getBoxShadowStyle } from './shadow'
7
+ import { isBoxShadow, isFilter, isShadow, isTextShadow, isTransform } from './utils'
8
8
 
9
9
  export const convertUnistyles = (value: UnistylesValues) => {
10
10
  // Flag to mark if textShadow is already created
@@ -1,7 +1,7 @@
1
1
  import type { BoxShadowValue } from 'react-native'
2
- import { normalizeNumericValue } from '../utils'
3
- import { keyInObject } from '../../utils'
4
2
  import { deepMergeObjects } from '../../../utils'
3
+ import { keyInObject } from '../../utils'
4
+ import { normalizeNumericValue } from '../utils'
5
5
 
6
6
  const createBoxShadowValue = (style: BoxShadowValue) => {
7
7
  const { offsetX, offsetY, blurRadius = 0, spreadDistance = 0, color = '#000', inset } = style
@@ -1,10 +1,10 @@
1
1
  import type { DropShadowValue } from 'react-native'
2
+ import { isUnistylesMq } from '../../../mq'
3
+ import { UnistylesWeb } from '../../index'
2
4
  import { hyphenate } from '../../utils'
3
5
  import type { Filters } from '../types'
4
- import { getObjectStyle } from './objectStyle'
5
6
  import { normalizeColor, normalizeNumericValue } from '../utils'
6
- import { isUnistylesMq } from '../../../mq'
7
- import { UnistylesWeb } from '../../index'
7
+ import { getObjectStyle } from './objectStyle'
8
8
 
9
9
  const getDropShadowStyle = (dropShadow: DropShadowValue) => {
10
10
  const { offsetX = 0, offsetY = 0, standardDeviation = 0, color = '#000' } = dropShadow
@@ -1,6 +1,6 @@
1
- import { getObjectStyle } from './objectStyle'
2
- import { normalizeNumericValue } from '../utils'
3
1
  import type { TransformStyles } from '../../../types/core'
2
+ import { normalizeNumericValue } from '../utils'
3
+ import { getObjectStyle } from './objectStyle'
4
4
 
5
5
  const normalizeTransform = (key: string, value: any) => {
6
6
  if (key.includes('scale')) {
@@ -1,6 +1,6 @@
1
1
  import type { FilterFunction, TextStyle, ViewStyle } from 'react-native'
2
- import type { ToDeepUnistyles } from '../../types/stylesheet'
3
2
  import type { UnionToIntersection } from '../../types'
3
+ import type { ToDeepUnistyles } from '../../types/stylesheet'
4
4
 
5
5
  export type ShadowOffset = ToDeepUnistyles<{ width: number, height: number }>
6
6
 
@@ -1,9 +1,9 @@
1
1
  // based on react-native-web normalizer
2
2
  // https://github.com/necolas/react-native-web
3
3
  import normalizeColors from '@react-native/normalize-colors'
4
- import { BOX_SHADOW_STYLES, TEXT_SHADOW_STYLES, type AllShadow, type AllShadowKeys, type Filters } from './types'
5
- import type { TransformStyles } from '../../types/core'
6
4
  import type { BoxShadowValue } from 'react-native'
5
+ import type { TransformStyles } from '../../types/core'
6
+ import { type AllShadow, type AllShadowKeys, BOX_SHADOW_STYLES, type Filters, TEXT_SHADOW_STYLES } from './types'
7
7
 
8
8
  export const isTransform = (key: string, value: any): value is Array<TransformStyles> => key === 'transform' && Array.isArray(value)
9
9
 
package/src/web/create.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { StyleSheetWithSuperPowers, StyleSheet } from '../types/stylesheet'
1
+ import type { StyleSheet, StyleSheetWithSuperPowers } from '../types/stylesheet'
2
2
  import { UnistylesWeb } from './index'
3
3
  import { assignSecrets, error, removeInlineStyles } from './utils'
4
4
 
package/src/web/index.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { create } from './create'
2
- import { deepMergeObjects } from '../utils'
1
+ import type { UnistylesShadowRegistry as NativeUnistylesShadowRegistry } from '../specs/ShadowRegistry'
3
2
  import type { StyleSheet as NativeStyleSheet } from '../specs/StyleSheet'
4
3
  import type { Runtime as NativeUnistylesRuntime } from '../specs/UnistylesRuntime'
5
- import type { UnistylesShadowRegistry as NativeUnistylesShadowRegistry } from '../specs/ShadowRegistry'
4
+ import { deepMergeObjects } from '../utils'
5
+ import { create } from './create'
6
6
  import { UnistylesServices } from './services'
7
7
  import { isServer } from './utils'
8
8
 
@@ -1,9 +1,9 @@
1
+ import type { UnistyleDependency, UnistylesMiniRuntime } from '../specs'
1
2
  import type { UnistylesTheme, UnistylesValues } from '../types'
2
3
  import type { StyleSheet, StyleSheetWithSuperPowers } from '../types/stylesheet'
3
- import { generateHash, extractUnistyleDependencies, error } from './utils'
4
- import type { UnistylesMiniRuntime, UnistyleDependency } from '../specs'
5
4
  import { CSSState } from './css'
6
5
  import type { UnistylesServices } from './types'
6
+ import { error, extractUnistyleDependencies, generateHash } from './utils'
7
7
 
8
8
  export class UnistylesRegistry {
9
9
  private readonly stylesheets = new Map<StyleSheetWithSuperPowers<StyleSheet>, StyleSheet>()
@@ -1,10 +1,10 @@
1
1
  import { UnistyleDependency } from '../specs/NativePlatform'
2
- import { ColorScheme, Orientation, type AppTheme, type AppThemeName } from '../specs/types'
3
2
  import type { UnistylesMiniRuntime } from '../specs/UnistylesRuntime'
3
+ import { type AppTheme, type AppThemeName, ColorScheme, Orientation } from '../specs/types'
4
4
  import { WebContentSizeCategory } from '../types'
5
5
  import { NavigationBar, StatusBar } from './mock'
6
- import { error, isServer, schemeToTheme } from './utils'
7
6
  import type { UnistylesServices } from './types'
7
+ import { error, isServer, schemeToTheme } from './utils'
8
8
 
9
9
  export class UnistylesRuntime {
10
10
  lightMedia = this.getLightMedia()
@@ -1,9 +1,9 @@
1
+ import { UnistyleDependency } from '../specs'
1
2
  import type { UnistylesTheme, UnistylesValues } from '../types'
2
3
  import { deepMergeObjects } from '../utils'
4
+ import type { UnistylesServices } from './types'
3
5
  import { extractSecrets, extractUnistyleDependencies } from './utils'
4
6
  import { getVariants } from './variants'
5
- import type { UnistylesServices } from './types'
6
- import { UnistyleDependency } from '../specs'
7
7
 
8
8
  export class UnistylesShadowRegistry {
9
9
  // MOCKS
package/src/web/state.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { UnistylesTheme } from '../types'
2
- import type { UnistylesConfig } from '../specs/StyleSheet'
3
- import type { AppBreakpoint, AppTheme, AppThemeName } from '../specs/types'
4
1
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
5
- import { error, hyphenate, isServer, schemeToTheme } from './utils'
6
2
  import { UnistyleDependency } from '../specs/NativePlatform'
3
+ import type { UnistylesConfig } from '../specs/StyleSheet'
4
+ import type { AppBreakpoint, AppTheme, AppThemeName } from '../specs/types'
5
+ import type { UnistylesTheme } from '../types'
7
6
  import type { UnionToIntersection } from '../types'
8
7
  import type { UnistylesServices } from './types'
8
+ import { error, hyphenate, isServer, schemeToTheme } from './utils'
9
9
 
10
10
  type UnistylesSettings = Partial<UnionToIntersection<Required<UnistylesConfig>['settings']>>
11
11
 
@@ -1,10 +1,10 @@
1
+ import type { UnistylesBreakpoints } from '../../global'
2
+ import { isUnistylesMq, parseMq } from '../../mq'
1
3
  import type { UnistyleDependency } from '../../specs/NativePlatform'
2
4
  import { ColorScheme, Orientation } from '../../specs/types'
3
5
  import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet'
4
- import { isUnistylesMq, parseMq } from '../../mq'
5
- import { keyInObject, reduceObject } from './common'
6
- import type { UnistylesBreakpoints } from '../../global'
7
6
  import { UnistylesWeb } from '../index'
7
+ import { keyInObject, reduceObject } from './common'
8
8
 
9
9
  export const schemeToTheme = (scheme: ColorScheme) => {
10
10
  switch (scheme) {