react-native-unistyles 3.0.0-alpha.40 → 3.0.0-alpha.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. package/README.md +7 -1
  2. package/android/CMakeLists.txt +3 -0
  3. package/android/build.gradle +10 -0
  4. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +10 -1
  5. package/cxx/core/UnistyleData.h +3 -2
  6. package/cxx/core/UnistylesRegistry.cpp +15 -5
  7. package/cxx/core/UnistylesRegistry.h +2 -2
  8. package/cxx/hybridObjects/HybridShadowRegistry.cpp +5 -2
  9. package/cxx/parser/Parser.cpp +10 -4
  10. package/cxx/shadowTree/ShadowLeafUpdate.h +1 -0
  11. package/cxx/shadowTree/ShadowTreeManager.cpp +4 -0
  12. package/ios/Extensions.swift +3 -1
  13. package/ios/NativePlatform+ios.swift +13 -2
  14. package/ios/NativePlatformListener+ios.swift +0 -1
  15. package/lib/commonjs/components/Display.js +2 -2
  16. package/lib/commonjs/components/Display.js.map +1 -1
  17. package/lib/commonjs/components/Hide.js +2 -2
  18. package/lib/commonjs/components/Hide.js.map +1 -1
  19. package/lib/commonjs/components/Pressable.js +64 -0
  20. package/lib/commonjs/components/Pressable.js.map +1 -0
  21. package/lib/commonjs/components/Pressable.web.js +97 -0
  22. package/lib/commonjs/components/Pressable.web.js.map +1 -0
  23. package/lib/commonjs/components/index.js +7 -0
  24. package/lib/commonjs/components/index.js.map +1 -1
  25. package/lib/commonjs/core/getBoundArgs.js +18 -0
  26. package/lib/commonjs/core/getBoundArgs.js.map +1 -0
  27. package/lib/commonjs/core/getId.js +9 -0
  28. package/lib/commonjs/core/getId.js.map +1 -0
  29. package/lib/commonjs/core/index.js +14 -0
  30. package/lib/commonjs/core/index.js.map +1 -1
  31. package/lib/commonjs/hooks/index.js +13 -0
  32. package/lib/commonjs/hooks/index.js.map +1 -0
  33. package/lib/commonjs/hooks/useMedia.js.map +1 -0
  34. package/lib/commonjs/hooks/useMedia.web.js.map +1 -0
  35. package/lib/commonjs/index.js +8 -1
  36. package/lib/commonjs/index.js.map +1 -1
  37. package/lib/commonjs/mq.js +6 -6
  38. package/lib/commonjs/mq.js.map +1 -1
  39. package/lib/commonjs/specs/ShadowRegistry/index.js +3 -4
  40. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  41. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  42. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
  43. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  44. package/lib/commonjs/specs/index.web.js +0 -7
  45. package/lib/commonjs/specs/index.web.js.map +1 -1
  46. package/lib/commonjs/utils.js +1 -1
  47. package/lib/commonjs/utils.js.map +1 -1
  48. package/lib/commonjs/web/convert/types.js.map +1 -1
  49. package/lib/commonjs/web/convert/utils.js +1 -1
  50. package/lib/commonjs/web/convert/utils.js.map +1 -1
  51. package/lib/commonjs/web/create.js +4 -1
  52. package/lib/commonjs/web/create.js.map +1 -1
  53. package/lib/commonjs/web/index.js +7 -5
  54. package/lib/commonjs/web/index.js.map +1 -1
  55. package/lib/commonjs/web/listener.js.map +1 -1
  56. package/lib/commonjs/web/runtime.js +7 -7
  57. package/lib/commonjs/web/runtime.js.map +1 -1
  58. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  59. package/lib/commonjs/web/state.js +23 -16
  60. package/lib/commonjs/web/state.js.map +1 -1
  61. package/lib/commonjs/web/utils/common.js +3 -3
  62. package/lib/commonjs/web/utils/common.js.map +1 -1
  63. package/lib/commonjs/web/utils/unistyle.js +2 -4
  64. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  65. package/lib/commonjs/web/variants/getVariants.js +1 -1
  66. package/lib/commonjs/web/variants/getVariants.js.map +1 -1
  67. package/lib/commonjs/web/variants/useVariants.js +1 -1
  68. package/lib/module/components/Display.js +1 -1
  69. package/lib/module/components/Display.js.map +1 -1
  70. package/lib/module/components/Hide.js +1 -1
  71. package/lib/module/components/Hide.js.map +1 -1
  72. package/lib/module/components/Pressable.js +58 -0
  73. package/lib/module/components/Pressable.js.map +1 -0
  74. package/lib/module/components/Pressable.web.js +91 -0
  75. package/lib/module/components/Pressable.web.js.map +1 -0
  76. package/lib/module/components/index.js +1 -0
  77. package/lib/module/components/index.js.map +1 -1
  78. package/lib/module/core/getBoundArgs.js +13 -0
  79. package/lib/module/core/getBoundArgs.js.map +1 -0
  80. package/lib/module/core/getId.js +4 -0
  81. package/lib/module/core/getId.js.map +1 -0
  82. package/lib/module/core/index.js +2 -0
  83. package/lib/module/core/index.js.map +1 -1
  84. package/lib/module/hooks/index.js +4 -0
  85. package/lib/module/hooks/index.js.map +1 -0
  86. package/lib/module/hooks/useMedia.js.map +1 -0
  87. package/lib/module/hooks/useMedia.web.js.map +1 -0
  88. package/lib/module/index.js +1 -1
  89. package/lib/module/index.js.map +1 -1
  90. package/lib/module/mq.js +6 -6
  91. package/lib/module/mq.js.map +1 -1
  92. package/lib/module/specs/ShadowRegistry/index.js +3 -4
  93. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  94. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  95. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
  96. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  97. package/lib/module/specs/index.web.js +0 -1
  98. package/lib/module/specs/index.web.js.map +1 -1
  99. package/lib/module/utils.js +1 -1
  100. package/lib/module/utils.js.map +1 -1
  101. package/lib/module/web/convert/types.js.map +1 -1
  102. package/lib/module/web/convert/utils.js +1 -1
  103. package/lib/module/web/convert/utils.js.map +1 -1
  104. package/lib/module/web/create.js +5 -2
  105. package/lib/module/web/create.js.map +1 -1
  106. package/lib/module/web/index.js +7 -3
  107. package/lib/module/web/index.js.map +1 -1
  108. package/lib/module/web/listener.js.map +1 -1
  109. package/lib/module/web/runtime.js +8 -8
  110. package/lib/module/web/runtime.js.map +1 -1
  111. package/lib/module/web/shadowRegistry.js.map +1 -1
  112. package/lib/module/web/state.js +24 -17
  113. package/lib/module/web/state.js.map +1 -1
  114. package/lib/module/web/utils/common.js +1 -1
  115. package/lib/module/web/utils/common.js.map +1 -1
  116. package/lib/module/web/utils/unistyle.js +1 -2
  117. package/lib/module/web/utils/unistyle.js.map +1 -1
  118. package/lib/module/web/variants/getVariants.js +1 -1
  119. package/lib/module/web/variants/getVariants.js.map +1 -1
  120. package/lib/module/web/variants/useVariants.js +1 -1
  121. package/lib/typescript/src/components/Pressable.d.ts +7 -0
  122. package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
  123. package/lib/typescript/src/components/Pressable.web.d.ts +13 -0
  124. package/lib/typescript/src/components/Pressable.web.d.ts.map +1 -0
  125. package/lib/typescript/src/components/index.d.ts +1 -0
  126. package/lib/typescript/src/components/index.d.ts.map +1 -1
  127. package/lib/typescript/src/core/getBoundArgs.d.ts +2 -0
  128. package/lib/typescript/src/core/getBoundArgs.d.ts.map +1 -0
  129. package/lib/typescript/src/core/getId.d.ts +2 -0
  130. package/lib/typescript/src/core/getId.d.ts.map +1 -0
  131. package/lib/typescript/src/core/index.d.ts +2 -0
  132. package/lib/typescript/src/core/index.d.ts.map +1 -1
  133. package/lib/typescript/src/hooks/index.d.ts +2 -0
  134. package/lib/typescript/src/hooks/index.d.ts.map +1 -0
  135. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -0
  136. package/lib/typescript/src/hooks/useMedia.web.d.ts.map +1 -0
  137. package/lib/typescript/src/index.d.ts +1 -1
  138. package/lib/typescript/src/index.d.ts.map +1 -1
  139. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +1 -1
  140. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
  141. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
  142. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  143. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +1 -0
  144. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  145. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +1 -1
  146. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
  147. package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -2
  148. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  149. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +1 -1
  150. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  151. package/lib/typescript/src/specs/index.web.d.ts +0 -2
  152. package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
  153. package/lib/typescript/src/types/common.d.ts +1 -0
  154. package/lib/typescript/src/types/common.d.ts.map +1 -1
  155. package/lib/typescript/src/types/index.d.ts +1 -1
  156. package/lib/typescript/src/types/index.d.ts.map +1 -1
  157. package/lib/typescript/src/web/convert/types.d.ts +1 -1
  158. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  159. package/lib/typescript/src/web/create.d.ts +1 -1
  160. package/lib/typescript/src/web/create.d.ts.map +1 -1
  161. package/lib/typescript/src/web/index.d.ts +8 -2
  162. package/lib/typescript/src/web/index.d.ts.map +1 -1
  163. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  164. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  165. package/lib/typescript/src/web/state.d.ts.map +1 -1
  166. package/lib/typescript/src/web/utils/common.d.ts +1 -1
  167. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  168. package/lib/typescript/src/web/utils/unistyle.d.ts +0 -1
  169. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  170. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +1 -1
  171. package/package.json +14 -18
  172. package/plugin/common.js +1 -4
  173. package/plugin/import.js +29 -3
  174. package/plugin/index.js +16 -6
  175. package/plugin/ref.js +4 -54
  176. package/plugin/style.js +116 -43
  177. package/src/components/Display.tsx +1 -1
  178. package/src/components/Hide.tsx +1 -1
  179. package/src/components/Pressable.tsx +72 -0
  180. package/src/components/Pressable.web.tsx +103 -0
  181. package/src/components/index.ts +1 -0
  182. package/src/core/getBoundArgs.ts +15 -0
  183. package/src/core/getId.ts +1 -0
  184. package/src/core/index.ts +2 -0
  185. package/src/hooks/index.ts +1 -0
  186. package/src/index.ts +1 -1
  187. package/src/mq.ts +6 -6
  188. package/src/specs/NativePlatform/NativePlatform.nitro.ts +1 -1
  189. package/src/specs/ShadowRegistry/index.ts +5 -6
  190. package/src/specs/ShadowRegistry/types.ts +2 -1
  191. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
  192. package/src/specs/StyleSheet/index.ts +3 -2
  193. package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -2
  194. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
  195. package/src/specs/UnistylesRuntime/index.ts +1 -1
  196. package/src/specs/index.web.ts +0 -4
  197. package/src/types/common.ts +1 -0
  198. package/src/types/index.ts +1 -1
  199. package/src/utils.ts +1 -1
  200. package/src/web/convert/types.ts +1 -1
  201. package/src/web/convert/utils.ts +2 -2
  202. package/src/web/create.ts +6 -2
  203. package/src/web/index.ts +7 -3
  204. package/src/web/listener.ts +2 -0
  205. package/src/web/registry.ts +1 -1
  206. package/src/web/runtime.ts +9 -9
  207. package/src/web/shadowRegistry.ts +2 -2
  208. package/src/web/state.ts +36 -17
  209. package/src/web/utils/common.ts +1 -1
  210. package/src/web/utils/unistyle.ts +3 -9
  211. package/src/web/variants/getVariants.ts +1 -1
  212. package/src/web/variants/useVariants.ts +1 -1
  213. package/lib/commonjs/components/useMedia.js.map +0 -1
  214. package/lib/commonjs/components/useMedia.web.js.map +0 -1
  215. package/lib/module/components/useMedia.js.map +0 -1
  216. package/lib/module/components/useMedia.web.js.map +0 -1
  217. package/lib/typescript/src/components/useMedia.d.ts.map +0 -1
  218. package/lib/typescript/src/components/useMedia.web.d.ts.map +0 -1
  219. /package/lib/commonjs/{components → hooks}/useMedia.js +0 -0
  220. /package/lib/commonjs/{components → hooks}/useMedia.web.js +0 -0
  221. /package/lib/module/{components → hooks}/useMedia.js +0 -0
  222. /package/lib/module/{components → hooks}/useMedia.web.js +0 -0
  223. /package/lib/typescript/src/{components → hooks}/useMedia.d.ts +0 -0
  224. /package/lib/typescript/src/{components → hooks}/useMedia.web.d.ts +0 -0
  225. /package/src/{components → hooks}/useMedia.ts +0 -0
  226. /package/src/{components → hooks}/useMedia.web.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  import type { FilterFunction, TextStyle, ViewStyle } from 'react-native';
2
2
  import type { ToDeepUnistyles } from '../../types/stylesheet';
3
+ import type { UnionToIntersection } from '../../types';
3
4
  export type ShadowOffset = ToDeepUnistyles<{
4
5
  width: number;
5
6
  height: number;
@@ -10,7 +11,6 @@ export declare const BOX_SHADOW_STYLES: readonly ["shadowColor", "shadowRadius",
10
11
  export type BoxShadow = Required<Pick<ViewStyle, typeof BOX_SHADOW_STYLES[number]>>;
11
12
  export type AllShadow = TextShadow & BoxShadow;
12
13
  export type AllShadowKeys = keyof AllShadow;
13
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
14
14
  type FilterKeys = keyof UnionToIntersection<FilterFunction>;
15
15
  export type Filters = {
16
16
  [K in FilterKeys]: UnionToIntersection<FilterFunction>[K];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE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uE,CAAA;AAEtG,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAErF,eAAO,MAAM,iBAAiB,2EAA4E,CAAA;AAE1G,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAEnF,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,CAAA;AAE9C,MAAM,MAAM,aAAa,GAAG,MAAM,SAAS,CAAA;AAE3C,KAAK,UAAU,GAAG,MAAM,mBAAmB,CAAC,cAAc,CAAC,CAAA;AAE3D,MAAM,MAAM,OAAO,GAAG;KACjB,CAAC,IAAI,UAAU,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CAC5D,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { StyleSheetWithSuperPowers, StyleSheet } from '../types/stylesheet';
2
- export declare const create: (stylesheet: StyleSheetWithSuperPowers<StyleSheet>) => {
2
+ export declare const create: (stylesheet: StyleSheetWithSuperPowers<StyleSheet>, id?: string) => {
3
3
  [x: string]: {
4
4
  backfaceVisibility?: "visible" | "hidden" | {
5
5
  [x: symbol]: "visible" | "hidden" | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/web/create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAMhF,eAAO,MAAM,MAAM,eAAgB,yBAAyB,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CpF,CAAA"}
@@ -1,6 +1,6 @@
1
1
  export declare const StyleSheet: {
2
2
  configure: (config: import("../specs/StyleSheet").UnistylesConfig) => void;
3
- create: (stylesheet: import("../types/stylesheet").StyleSheetWithSuperPowers<import("../types").StyleSheet>) => {
3
+ create: (stylesheet: import("../types/stylesheet").StyleSheetWithSuperPowers<import("../types").StyleSheet>, id?: string) => {
4
4
  [x: string]: {
5
5
  backfaceVisibility?: "visible" | "hidden" | {
6
6
  [x: symbol]: "visible" | "hidden" | undefined;
@@ -1448,6 +1448,13 @@ export declare const StyleSheet: {
1448
1448
  right: number;
1449
1449
  bottom: number;
1450
1450
  };
1451
+ absoluteFillObject: {
1452
+ position: string;
1453
+ left: number;
1454
+ top: number;
1455
+ right: number;
1456
+ bottom: number;
1457
+ };
1451
1458
  compose: (a: object, b: object) => object;
1452
1459
  flatten: (...styles: Array<object>) => object;
1453
1460
  hairlineWidth: number;
@@ -1455,5 +1462,4 @@ export declare const StyleSheet: {
1455
1462
  export { UnistylesRuntime } from './runtime';
1456
1463
  export { UnistylesShadowRegistry } from './shadowRegistry';
1457
1464
  export * from './mock';
1458
- export declare const getSSRUnistyles: () => never[];
1459
1465
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/web/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,SAAS,CAAoG;IACrH,OAAO,CAAC,mBAAmB,CAAoG;IAE/H,UAAU,eAAgB,kBAAkB,UAG3C;IAED,aAAa,aA8BZ;IAED,YAAY,iBAAkB,KAAK,CAAC,kBAAkB,CAAC,YAAY,YAAY,gBAM9E;IAED,sBAAsB,iBAAkB,KAAK,CAAC,kBAAkB,CAAC,YAAY,YAAY,gBAMxF;CACJ;AAED,eAAO,MAAM,iBAAiB,0BAAiC,CAAA"}
1
+ {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../src/web/listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAG5D,cAAM,wBAAwB;IAC1B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAoG;IACrH,OAAO,CAAC,mBAAmB,CAAoG;IAE/H,UAAU,eAAgB,kBAAkB,UAG3C;IAED,aAAa,aAgCZ;IAED,YAAY,iBAAkB,KAAK,CAAC,kBAAkB,CAAC,YAAY,YAAY,gBAM9E;IAED,sBAAsB,iBAAkB,KAAK,CAAC,kBAAkB,CAAC,YAAY,YAAY,gBAMxF;CACJ;AAED,eAAO,MAAM,iBAAiB,0BAAiC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/web/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAMjD,cAAM,uBAAuB;IACzB,UAAU,wBAAuB;IACjC,SAAS,wBAAsB;IAE/B,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,YAAY;IAYpB,IAAI,WAAW,gBASd;IAED,IAAI,SAAS,cAMZ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;;MAYT;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,MAAM;;;;;;MAQT;IAED,IAAI,SAAS,oDAEZ;IAED,IAAI,GAAG,YAEN;IAED,IAAI,iBAAiB,YAEpB;IAED,IAAI,aAAa,2DAEhB;IAED,IAAI,WAAW,IAAI,oBAAoB,CAuBtC;IAED,QAAQ,cAAe,YAAY,UAYlC;IAED,iBAAiB,cAAe,OAAO,UAQtC;IAED,0BAA0B,UAAW,MAAM,UAM1C;IAED,gBAAgB,aAAW;IAE3B,WAAW,cAAe,YAAY,WAAW,CAAC,YAAY,EAAE,QAAQ,KAAK,QAAQ,UAQpF;IAED,QAAQ,mCAQP;CACJ;AAED,eAAO,MAAM,gBAAgB,yBAAgC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/web/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAY,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,WAAW,CAAA;AAMtE,cAAM,qBAAqB;IACvB,MAAM,qBAAoC;IAC1C,SAAS,CAAC,EAAE,YAAY,CAAA;IAExB,OAAO,CAAC,mBAAmB,CAA6B;IAExD,IAAI,UAAU,IAKkB,aAAa,GAAG,SAAS,CACxD;IAED,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAElC,iBAAiB,UAAQ;IAEzB,IAAI,WAAY,eAAe,UAU9B;IAED,OAAO,CAAC,UAAU,CAIjB;IAED,OAAO,CAAC,YAAY,CAyBnB;IAED,OAAO,CAAC,eAAe,CAkBtB;CACJ;AAED,eAAO,MAAM,cAAc,uBAA8B,CAAA"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/web/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAY,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,WAAW,CAAA;AAStE,cAAM,qBAAqB;IACvB,MAAM,qBAAoC;IAC1C,SAAS,CAAC,EAAE,YAAY,CAAA;IAExB,OAAO,CAAC,mBAAmB,CAA6B;IAExD,IAAI,UAAU,IAKkB,aAAa,GAAG,SAAS,CACxD;IAED,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAElC,iBAAiB,UAAQ;IAEzB,IAAI,WAAY,eAAe,UAa9B;IAED,OAAO,CAAC,UAAU,CAIjB;IAED,OAAO,CAAC,YAAY,CA6BnB;IAED,OAAO,CAAC,eAAe,CA2BtB;CACJ;AAED,eAAO,MAAM,cAAc,uBAA8B,CAAA"}
@@ -1,7 +1,7 @@
1
1
  export declare const reduceObject: <TObj extends Record<string, any>, TReducer>(obj: TObj, reducer: (value: TObj[keyof TObj], key: keyof TObj) => TReducer) => { [K in keyof TObj]: TReducer; };
2
2
  export declare const keyInObject: <T extends Record<string, any>>(obj: T, key: PropertyKey) => key is keyof T;
3
3
  export declare const isServer: () => boolean;
4
- export declare const warn: (message: string) => void;
4
+ export declare const error: (message: string) => Error;
5
5
  export declare const equal: <T>(a: T, b: T) => boolean;
6
6
  export declare const generateHash: (value: any) => string;
7
7
  export declare const hyphenate: (propertyName: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,OAC9D,IAAI,WACA,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,IAAI,KAAK,QAAQ,KACmD,GAAG,CAAe,IAAV,MAAM,IAAI,GAAG,QAAQ,GAAE,CAAA;AAErJ,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,WAAW,KAAG,GAAG,IAAI,MAAM,CAAe,CAAA;AAElH,eAAO,MAAM,QAAQ,eAAsC,CAAA;AAE3D,eAAO,MAAM,IAAI,YAAa,MAAM,SAA2D,CAAA;AAE/F,eAAO,MAAM,KAAK,GAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAqBlC,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,GAAG,WAQtC,CAAA;AAED,eAAO,MAAM,SAAS,iBAAkB,MAAM,WAAyE,CAAA"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,OAC9D,IAAI,WACA,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,IAAI,KAAK,QAAQ,KACmD,GAAG,CAAC,IAAI,MAAM,IAAI,GAAG,QAAQ,GAAE,CAAA;AAErJ,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,WAAW,KAAG,GAAG,IAAI,MAAM,CAAe,CAAA;AAElH,eAAO,MAAM,QAAQ,eAAsC,CAAA;AAE3D,eAAO,MAAM,KAAK,YAAa,MAAM,UAAuC,CAAA;AAE5E,eAAO,MAAM,KAAK,GAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAqBlC,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,GAAG,WAQtC,CAAA;AAED,eAAO,MAAM,SAAS,iBAAkB,MAAM,WAAyE,CAAA"}
@@ -2,7 +2,6 @@ import type { UnistyleDependency } from '../../specs/NativePlatform';
2
2
  import { ColorScheme } from '../../specs/types';
3
3
  import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet';
4
4
  export declare const schemeToTheme: (scheme: ColorScheme) => "light" | "dark";
5
- export declare const hexToRGBA: (hex: string, opacity: number) => string;
6
5
  export type UnistyleSecrets = {
7
6
  __uni__stylesheet: StyleSheetWithSuperPowers<StyleSheet>;
8
7
  __uni__key: string;
@@ -1 +1 @@
1
- {"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAKpG,eAAO,MAAM,aAAa,WAAY,WAAW,qBAQhD,CAAA;AAED,eAAO,MAAM,SAAS,QAAS,MAAM,WAAW,MAAM,WAM5B,CAAA;AAE1B,MAAM,MAAM,eAAe,GAAG;IAC1B,iBAAiB,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,CAAC,UAAU,CAAC,WAAW,eAAe,MAKnE,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,GAAG,sBAUzC,CAAA;AAED,eAAO,MAAM,SAAS,WAAY,eAAe,OAUhD,CAAA;AAED,eAAO,MAAM,YAAY,YAAa,WAAW,YAAoC,CAAA;AAErF,eAAO,MAAM,sBAAsB,UAAW,MAAM,uBAUnD,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,MAAM,WAmB1C,CAAA;AAED,eAAO,MAAM,2BAA2B,UAAW,GAAG,yBAQrD,CAAA"}
1
+ {"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAKpG,eAAO,MAAM,aAAa,WAAY,WAAW,qBAQhD,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,iBAAiB,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,CAAC,UAAU,CAAC,WAAW,eAAe,MAKnE,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,GAAG,sBAUzC,CAAA;AAED,eAAO,MAAM,SAAS,WAAY,eAAe,OAUhD,CAAA;AAED,eAAO,MAAM,YAAY,YAAa,WAAW,YAAoC,CAAA;AAErF,eAAO,MAAM,sBAAsB,UAAW,MAAM,uBAYnD,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,MAAM,WAmB1C,CAAA;AAED,eAAO,MAAM,2BAA2B,UAAW,GAAG,yBAQrD,CAAA"}
@@ -43,7 +43,7 @@ namespace margelo::nitro::unistyles { struct UnistylesNativeMiniRuntime; }
43
43
  #include <NitroModules/ArrayBufferHolder.hpp>
44
44
  #include <NitroModules/AnyMapHolder.hpp>
45
45
  #include <NitroModules/HybridContext.hpp>
46
- #include <NitroModules/PromiseHolder.hpp>
46
+ #include <NitroModules/RuntimeError.hpp>
47
47
 
48
48
  // Forward declarations of Swift defined types
49
49
  // Forward declaration of `HybridNativePlatformSpecCxx` to properly resolve imports.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-alpha.40",
3
+ "version": "3.0.0-alpha.42",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -8,7 +8,7 @@
8
8
  "tsc": "node_modules/typescript/bin/tsc --noEmit",
9
9
  "lint": "biome lint",
10
10
  "prepare": "husky && bob build",
11
- "precommit": "concurrently 'bun tsc' 'bun lint' 'bun test'",
11
+ "precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn test'",
12
12
  "release": "release-it"
13
13
  },
14
14
  "main": "lib/commonjs/index",
@@ -42,11 +42,7 @@
42
42
  "react-native",
43
43
  "ios",
44
44
  "android",
45
- "react-native-macos",
46
- "react-native-windows",
47
45
  "react-native-web",
48
- "react-native-tvos",
49
- "react-native-visionos",
50
46
  "expo"
51
47
  ],
52
48
  "repository": "https://github.com/jpudysz/react-native-unistyles",
@@ -62,26 +58,26 @@
62
58
  "devDependencies": {
63
59
  "@babel/plugin-syntax-jsx": "7.25.9",
64
60
  "@biomejs/biome": "1.9.4",
65
- "@commitlint/config-conventional": "19.5.0",
66
- "@react-native/normalize-colors": "0.76.0",
61
+ "@commitlint/config-conventional": "19.6.0",
62
+ "@react-native/normalize-colors": "0.76.3",
67
63
  "@release-it/conventional-changelog": "8.0.2",
68
- "@testing-library/react-hooks": "8.0.1",
69
64
  "@types/jest": "29.5.14",
70
65
  "@types/react": "18.3.12",
71
66
  "babel-plugin-tester": "11.0.4",
72
- "commitlint": "19.5.0",
73
- "concurrently": "8.2.2",
74
- "husky": "9.1.6",
67
+ "commitlint": "19.6.0",
68
+ "concurrently": "9.1.0",
69
+ "husky": "9.1.7",
75
70
  "jest": "29.7.0",
76
71
  "metro-react-native-babel-preset": "0.77.0",
77
- "nitro-codegen": "0.16.2",
72
+ "nitro-codegen": "0.17.0",
78
73
  "react": "18.3.1",
79
- "react-native": "0.76.0",
80
- "react-native-builder-bob": "0.30.2",
81
- "react-native-nitro-modules": "0.16.2",
74
+ "react-native": "0.76.3",
75
+ "react-native-builder-bob": "0.33.1",
76
+ "react-native-nitro-modules": "0.17.0",
77
+ "react-native-web": "0.19.13",
82
78
  "react-test-renderer": "18.3.1",
83
- "release-it": "17.10.0",
84
- "typescript": "5.6.3"
79
+ "release-it": "17.6.0",
80
+ "typescript": "5.7.2"
85
81
  },
86
82
  "peerDependencies": {
87
83
  "@react-native/normalize-colors": "*",
package/plugin/common.js CHANGED
@@ -138,10 +138,7 @@ function getSecondPropertyName(t, memberExpression) {
138
138
  return []
139
139
  }
140
140
 
141
- const PRESSABLE_STATE_NAME = '__uni_pressable_state'
142
-
143
141
  module.exports = {
144
142
  getIdentifierNameFromExpression,
145
- getSecondPropertyName,
146
- PRESSABLE_STATE_NAME
143
+ getSecondPropertyName
147
144
  }
package/plugin/import.js CHANGED
@@ -1,8 +1,34 @@
1
- module.exports = function addShadowRegistryImport(t, path) {
1
+ module.exports = function addUnistylesImport(t, path, state) {
2
2
  const newImport = t.importDeclaration(
3
- [t.importSpecifier(t.identifier('UnistylesShadowRegistry'), t.identifier('UnistylesShadowRegistry'))],
3
+ [
4
+ t.importSpecifier(t.identifier('UnistylesShadowRegistry'), t.identifier('UnistylesShadowRegistry')),
5
+ ...state.file.shouldIncludePressable
6
+ ? [
7
+ t.importSpecifier(t.identifier('Pressable'), t.identifier('Pressable')),
8
+ t.importSpecifier(t.identifier('getBoundArgs'), t.identifier('getBoundArgs'))
9
+ ]
10
+ : []
11
+ ].filter(Boolean),
4
12
  t.stringLiteral('react-native-unistyles')
5
13
  )
6
14
 
7
- path.unshiftContainer('body', newImport)
15
+ if (state.file.shouldIncludePressable) {
16
+ const rnImport = path.node.body.find(node => t.isImportDeclaration(node) && node.source.value === 'react-native')
17
+
18
+ if (rnImport) {
19
+ rnImport.specifiers = rnImport.specifiers.filter(specifier => specifier.local.name !== 'Pressable')
20
+ }
21
+
22
+ const rnWebImport = path.node.body.find(node => t.isImportDeclaration(node) && node.source.value === 'react-native-web/dist/exports/Pressable')
23
+ const unistylesImport = path.node.body.find(node => t.isImportDeclaration(node) && node.source.value === 'react-native-unistyles')
24
+ const hasUniPressable = unistylesImport && unistylesImport.specifiers
25
+ ? unistylesImport.specifiers.find(specifier => specifier.imported.name === 'Pressable' && specifier.local.name !== "NativePressableReactNative")
26
+ : false
27
+
28
+ if (rnWebImport && !hasUniPressable) {
29
+ rnWebImport.specifiers = []
30
+ }
31
+ }
32
+
33
+ path.node.body.unshift(newImport)
8
34
  }
package/plugin/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const addShadowRegistryImport = require('./import')
1
+ const addUnistylesImport = require('./import')
2
2
  const { getStyleMetadata, getStyleAttribute, styleAttributeToArray, handlePressable } = require('./style')
3
3
  const { getRefProp, addRef, overrideRef, hasStringRef } = require('./ref')
4
4
  const { isUnistylesStyleSheet, analyzeDependencies, addStyleSheetTag, getUnistyle } = require('./stylesheet')
@@ -32,6 +32,8 @@ module.exports = function ({ types: t }) {
32
32
  enter(path, state) {
33
33
  state.file.hasAnyUnistyle = false
34
34
  state.file.hasUnistylesImport = false
35
+ state.file.shouldIncludePressable = false
36
+ state.file.hasVariants = false
35
37
  state.file.styleSheetLocalName = ''
36
38
  state.file.tagNumber = 0
37
39
  state.file.isClassComponent = false
@@ -39,7 +41,7 @@ module.exports = function ({ types: t }) {
39
41
  },
40
42
  exit(path, state) {
41
43
  if (state.file.hasAnyUnistyle) {
42
- addShadowRegistryImport(t, path)
44
+ addUnistylesImport(t, path, state)
43
45
  }
44
46
  }
45
47
  },
@@ -90,11 +92,19 @@ module.exports = function ({ types: t }) {
90
92
 
91
93
  if (importSource.includes('react-native')) {
92
94
  path.node.specifiers.forEach(specifier => {
95
+ if (specifier.imported && specifier.imported.name === 'Pressable' && specifier.local.name !== 'NativePressableReactNative') {
96
+ state.file.shouldIncludePressable = true
97
+ }
98
+
93
99
  if (specifier.imported && reactNativeComponentNames.includes(specifier.imported.name)) {
94
100
  state.reactNativeImports[specifier.local.name] = true
95
101
  }
96
102
  })
97
103
  }
104
+
105
+ if (importSource.includes('react-native-web/dist/exports/Pressable')) {
106
+ state.file.shouldIncludePressable = true
107
+ }
98
108
  },
99
109
  JSXElement(path, state) {
100
110
  if (state.file.isClassComponent) {
@@ -123,15 +133,15 @@ module.exports = function ({ types: t }) {
123
133
 
124
134
  const metadata = getStyleMetadata(t, styleAttr.value.expression)
125
135
 
136
+ if (openingElementName === 'Pressable') {
137
+ return handlePressable(t, path, styleAttr, metadata, state)
138
+ }
139
+
126
140
  // style prop is using unexpected expression
127
141
  if (metadata.length === 0) {
128
142
  return
129
143
  }
130
144
 
131
- if (openingElementName === 'Pressable') {
132
- handlePressable(t, path, styleAttr, metadata)
133
- }
134
-
135
145
  styleAttributeToArray(t, path)
136
146
 
137
147
  // to add import
package/plugin/ref.js CHANGED
@@ -1,5 +1,3 @@
1
- const { PRESSABLE_STATE_NAME } = require('./common')
2
-
3
1
  function getRefProp(t, path) {
4
2
  return path.node.openingElement.attributes.find(attr =>
5
3
  t.isJSXAttribute(attr) &&
@@ -33,63 +31,15 @@ function arrayExpressionFromMetadata(t, metadata) {
33
31
  }
34
32
 
35
33
  function arrayFromDynamicFunctionArgs(t, metadata, path) {
36
- const hasPressableDynamicFunction = path.node.openingElement.attributes
37
- .find(attr => t.isJSXIdentifier(attr.name) && attr.name.name === "style" && t.isArrowFunctionExpression(attr.value.expression))
38
-
39
34
  const memberExpressions = metadata
40
- .map(meta => {
41
- if (meta.dynamicFunction && meta.dynamicFunction.arguments) {
42
- const args = meta.dynamicFunction.arguments.map(arg => {
43
- // special case for pressable
44
- if (t.isIdentifier(arg) && arg.name === PRESSABLE_STATE_NAME) {
45
- // replace with { pressed: false }
46
- return t.objectExpression([
47
- t.objectProperty(
48
- t.identifier("pressed"),
49
- t.booleanLiteral(false)
50
- )
51
- ])
52
- }
53
-
54
- if (t.isMemberExpression(arg) && arg.object.name === PRESSABLE_STATE_NAME) {
55
- return t.identifier('false')
56
- }
57
-
58
- return arg
59
- })
60
-
61
- return t.arrayExpression(args)
62
- }
63
-
64
- // typeof styles.pressable === "function" ? { pressed: false } : []
65
- if (hasPressableDynamicFunction) {
66
- return t.arrayExpression([
67
- t.conditionalExpression(
68
- t.binaryExpression(
69
- "===",
70
- t.unaryExpression(
71
- "typeof",
72
- t.identifier("styles.pressable")
73
- ),
74
- t.stringLiteral("function")
75
- ),
76
- t.objectExpression([
77
- t.objectProperty(
78
- t.identifier("pressed"),
79
- t.booleanLiteral(false)
80
- )
81
- ]),
82
- t.arrayExpression([])
83
- )
84
- ])
85
- }
86
-
87
- return t.arrayExpression([])
88
- })
35
+ .map(meta => meta.dynamicFunction
36
+ ? t.arrayExpression(meta.dynamicFunction.arguments)
37
+ : t.arrayExpression([]))
89
38
  .filter(Boolean)
90
39
 
91
40
  return t.arrayExpression(memberExpressions)
92
41
  }
42
+
93
43
  function addRef(t, path, metadata, state) {
94
44
  const hasVariants = state.file.hasVariants
95
45
 
package/plugin/style.js CHANGED
@@ -1,5 +1,3 @@
1
- const { PRESSABLE_STATE_NAME } = require('./common')
2
-
3
1
  function getStyleMetadata(t, node, dynamicFunction = null) {
4
2
  // {styles.container}
5
3
  if (t.isMemberExpression(node)) {
@@ -70,7 +68,6 @@ function getStyleMetadata(t, node, dynamicFunction = null) {
70
68
  }]
71
69
  }
72
70
 
73
- // pressable
74
71
  if (t.isArrowFunctionExpression(node)) {
75
72
  return getStyleMetadata(t, node.body, node)
76
73
  }
@@ -89,12 +86,6 @@ function getStyleAttribute(t, path) {
89
86
  function styleAttributeToArray(t, path) {
90
87
  const styleAttribute = getStyleAttribute(t, path)
91
88
 
92
- // special case for pressable
93
- // {state => styles.pressable(state)}
94
- if (t.isArrowFunctionExpression(styleAttribute.value.expression)) {
95
- return
96
- }
97
-
98
89
  // {{...style.container, ...style.container}}
99
90
  if (t.isObjectExpression(styleAttribute.value.expression)) {
100
91
  const properties = styleAttribute.value.expression.properties
@@ -126,12 +117,35 @@ function styleAttributeToArray(t, path) {
126
117
  styleAttribute.value.expression = t.arrayExpression([styleAttribute.value.expression])
127
118
  }
128
119
 
129
- function handlePressable(t, path, styleAttr, metadata) {
130
- const styleExpression = styleAttr.value.expression
120
+ function handlePressable(t, path, styleAttr, metadata, state) {
121
+ if (state.file.hasVariants) {
122
+ const variants = t.jsxAttribute(
123
+ t.jsxIdentifier('variants'),
124
+ t.jsxExpressionContainer(t.identifier('__uni__variants'))
125
+ )
131
126
 
127
+ path.node.openingElement.attributes.push(variants)
128
+ }
129
+
130
+ // add raw C++ style as prop to be bound
131
+ const props = metadata
132
+ .map(meta => meta.members)
133
+ .filter(members => members.length > 0)
134
+ .flatMap(members => t.memberExpression(...members.map(member => t.identifier(member))))
135
+
136
+ const rawStyles = t.jsxAttribute(
137
+ t.jsxIdentifier('rawStyle'),
138
+ t.jsxExpressionContainer(t.arrayExpression([
139
+ ...props
140
+ ]))
141
+ )
142
+
143
+ path.node.openingElement.attributes.push(rawStyles)
144
+
145
+ const styleExpression = styleAttr.value.expression
132
146
  // {style.pressable}
133
- // the worst case, we don't know if user rely on state
134
147
  if (t.isMemberExpression(styleExpression)) {
148
+ // user may care about state, but didn't pass any arguments
135
149
  const members = metadata.at(0).members
136
150
 
137
151
  if (members.length === 0) {
@@ -142,8 +156,18 @@ function handlePressable(t, path, styleAttr, metadata) {
142
156
  (acc, property) => t.memberExpression(acc, t.identifier(property)),
143
157
  t.identifier(members[0])
144
158
  )
159
+ const expression = t.callExpression(
160
+ t.identifier('getBoundArgs'),
161
+ [stylePath]
162
+ )
163
+ const bindCall = t.callExpression(
164
+ t.memberExpression(expression, t.identifier('bind')),
165
+ [t.identifier('undefined'), t.identifier("state")]
166
+ )
145
167
 
146
- // state => typeof style.pressable === 'function' ? style.pressable(state) : style.pressable
168
+ // state => typeof style.pressable === 'function'
169
+ // ? getBoundArgs(style.pressable).bind(undefined, state)
170
+ // : style.pressable
147
171
  styleAttr.value.expression = t.arrowFunctionExpression(
148
172
  [t.identifier("state")],
149
173
  t.conditionalExpression(
@@ -155,10 +179,7 @@ function handlePressable(t, path, styleAttr, metadata) {
155
179
  ),
156
180
  t.stringLiteral("function")
157
181
  ),
158
- t.callExpression(
159
- stylePath,
160
- [t.identifier("state")]
161
- ),
182
+ bindCall,
162
183
  stylePath
163
184
  )
164
185
  )
@@ -169,51 +190,103 @@ function handlePressable(t, path, styleAttr, metadata) {
169
190
  // {style.pressable(1, 2)}
170
191
  if (t.isCallExpression(styleExpression)) {
171
192
  // user already called dynamic function
172
- // there is no work to do
193
+ const expression = t.callExpression(
194
+ t.identifier('getBoundArgs'),
195
+ [styleExpression.callee]
196
+ )
197
+ const bindCall = t.callExpression(
198
+ t.memberExpression(expression, t.identifier('bind')),
199
+ [t.identifier('undefined'), ...styleExpression.arguments]
200
+ )
201
+
202
+ path.node.openingElement.attributes = path.node.openingElement.attributes.map(attribute => {
203
+ if (attribute.name.name === "style") {
204
+ attribute.value.expression = t.arrowFunctionExpression([], bindCall)
205
+ }
206
+
207
+ return attribute
208
+ })
209
+
173
210
  return
174
211
  }
175
212
 
176
213
  // {() => style.pressable(1, 2)}
177
214
  if (t.isArrowFunctionExpression(styleExpression) && styleExpression.params.length === 0) {
178
- // user doesn't care about the state
179
- // we can safely unwrap the function
180
- styleAttr.value.expression = styleExpression.body
215
+ const wrapper = t.isBlockStatement(styleExpression.body)
216
+ ? styleExpression.body.body.find(node => t.isReturnStatement(node))
217
+ : styleExpression.body
218
+
219
+ if (t.isMemberExpression(wrapper)) {
220
+ return
221
+ }
222
+
223
+ const pressableArgs = t.isCallExpression(wrapper)
224
+ ? wrapper.arguments
225
+ : wrapper.argument.arguments
226
+ const callee = t.isCallExpression(wrapper)
227
+ ? wrapper.callee
228
+ : wrapper.argument.callee
229
+ const getBoundArgsCall = t.callExpression(
230
+ t.identifier('getBoundArgs'),
231
+ [callee]
232
+ )
233
+ const bindCall = t.callExpression(
234
+ t.memberExpression(getBoundArgsCall, t.identifier('bind')),
235
+ [t.identifier('undefined'), ...pressableArgs]
236
+ )
237
+
238
+ if (t.isCallExpression(wrapper)) {
239
+ styleExpression.body = bindCall
240
+
241
+ return
242
+ }
243
+
244
+ if (wrapper) {
245
+ wrapper.argument = bindCall
246
+ }
181
247
 
182
248
  return
183
249
  }
184
250
 
185
251
  // {state => style.pressable(state, 1, 2)}
186
252
  if (t.isArrowFunctionExpression(styleExpression) && styleExpression.params.length > 0) {
187
- // already a function, we need to set state to false
188
- // and pass it to C++ as in background it will never be true
189
- const args = metadata.at(0).dynamicFunction
253
+ // user used state with custom args we need to getBoundArgs
254
+ // detect between arrow function with body and arrow function
255
+ const wrapper = t.isBlockStatement(styleExpression.body)
256
+ ? styleExpression.body.body.find(node => t.isReturnStatement(node))
257
+ : styleExpression.body
190
258
 
191
- if (!t.isCallExpression(args) || args.arguments.length === 0) {
259
+ if (t.isMemberExpression(wrapper)) {
192
260
  return
193
261
  }
194
262
 
195
- // get state local name
196
- const stateIdentifier = styleExpression.params[0]
263
+ const pressableArgs = t.isCallExpression(wrapper)
264
+ ? wrapper.arguments
265
+ : wrapper.argument.arguments
266
+ const callee = t.isCallExpression(wrapper)
267
+ ? wrapper.callee
268
+ : wrapper.argument.callee
197
269
 
198
- if (!stateIdentifier || !t.isIdentifier(stateIdentifier)) {
199
- return
200
- }
270
+ const getBoundArgsCall = t.callExpression(
271
+ t.identifier('getBoundArgs'),
272
+ [callee]
273
+ )
274
+ const bindCall = t.callExpression(
275
+ t.memberExpression(getBoundArgsCall, t.identifier('bind')),
276
+ [t.identifier('undefined'), ...pressableArgs]
277
+ )
201
278
 
202
- // replace state name with matching identifier
203
- args.arguments.map(arg => {
204
- if (t.isIdentifier(arg) && arg.name === stateIdentifier.name) {
205
- arg.name = PRESSABLE_STATE_NAME
206
- }
279
+ // arrow function
280
+ if (t.isCallExpression(wrapper)) {
281
+ styleExpression.body = bindCall
207
282
 
208
- if (t.isMemberExpression(arg) && arg.object.name === stateIdentifier.name) {
209
- arg.object.name = PRESSABLE_STATE_NAME
210
- }
211
-
212
- return arg
213
- })
283
+ return
284
+ }
214
285
 
215
- // update arrow function arg name
216
- styleExpression.params[0].name = PRESSABLE_STATE_NAME
286
+ // arrow function with body
287
+ if (wrapper) {
288
+ wrapper.argument = bindCall
289
+ }
217
290
  }
218
291
  }
219
292
 
@@ -1,5 +1,5 @@
1
1
  import React, { type PropsWithChildren } from 'react'
2
- import { useMedia } from './useMedia'
2
+ import { useMedia } from '../hooks'
3
3
 
4
4
  type DisplayProps = { mq: symbol } & PropsWithChildren
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React, { type PropsWithChildren } from 'react'
2
- import { useMedia } from './useMedia'
2
+ import { useMedia } from '../hooks'
3
3
 
4
4
  type HideProps = { mq: symbol } & PropsWithChildren
5
5