react-native-unistyles 3.0.0-alpha.41 → 3.0.0-alpha.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. package/README.md +7 -1
  2. package/cxx/common/Constants.h +0 -1
  3. package/cxx/core/UnistylesRegistry.cpp +10 -4
  4. package/cxx/core/UnistylesRegistry.h +1 -1
  5. package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -2
  6. package/cxx/parser/Parser.cpp +7 -22
  7. package/cxx/parser/Parser.h +0 -1
  8. package/lib/commonjs/components/Display.js +2 -2
  9. package/lib/commonjs/components/Display.js.map +1 -1
  10. package/lib/commonjs/components/Hide.js +2 -2
  11. package/lib/commonjs/components/Hide.js.map +1 -1
  12. package/lib/commonjs/components/Pressable.js +82 -0
  13. package/lib/commonjs/components/Pressable.js.map +1 -0
  14. package/lib/commonjs/components/Pressable.web.js +97 -0
  15. package/lib/commonjs/components/Pressable.web.js.map +1 -0
  16. package/lib/commonjs/components/index.js +7 -0
  17. package/lib/commonjs/components/index.js.map +1 -1
  18. package/lib/commonjs/core/getBoundArgs.js +18 -0
  19. package/lib/commonjs/core/getBoundArgs.js.map +1 -0
  20. package/lib/commonjs/core/getId.js +9 -0
  21. package/lib/commonjs/core/getId.js.map +1 -0
  22. package/lib/commonjs/core/index.js +14 -0
  23. package/lib/commonjs/core/index.js.map +1 -1
  24. package/lib/commonjs/hooks/index.js +13 -0
  25. package/lib/commonjs/hooks/index.js.map +1 -0
  26. package/lib/commonjs/hooks/useMedia.js.map +1 -0
  27. package/lib/commonjs/hooks/useMedia.web.js.map +1 -0
  28. package/lib/commonjs/index.js +8 -1
  29. package/lib/commonjs/index.js.map +1 -1
  30. package/lib/commonjs/mq.js +6 -6
  31. package/lib/commonjs/mq.js.map +1 -1
  32. package/lib/commonjs/specs/ShadowRegistry/index.js +3 -4
  33. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  34. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  35. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
  36. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  37. package/lib/commonjs/specs/index.web.js +0 -7
  38. package/lib/commonjs/specs/index.web.js.map +1 -1
  39. package/lib/commonjs/utils.js +1 -1
  40. package/lib/commonjs/utils.js.map +1 -1
  41. package/lib/commonjs/web/convert/types.js.map +1 -1
  42. package/lib/commonjs/web/convert/utils.js +1 -1
  43. package/lib/commonjs/web/convert/utils.js.map +1 -1
  44. package/lib/commonjs/web/create.js +10 -2
  45. package/lib/commonjs/web/create.js.map +1 -1
  46. package/lib/commonjs/web/index.js +7 -5
  47. package/lib/commonjs/web/index.js.map +1 -1
  48. package/lib/commonjs/web/listener.js.map +1 -1
  49. package/lib/commonjs/web/runtime.js +7 -7
  50. package/lib/commonjs/web/runtime.js.map +1 -1
  51. package/lib/commonjs/web/shadowRegistry.js +1 -1
  52. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  53. package/lib/commonjs/web/state.js +23 -16
  54. package/lib/commonjs/web/state.js.map +1 -1
  55. package/lib/commonjs/web/utils/common.js +3 -3
  56. package/lib/commonjs/web/utils/common.js.map +1 -1
  57. package/lib/commonjs/web/utils/unistyle.js +2 -4
  58. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  59. package/lib/commonjs/web/{variants/getVariants.js → variants.js} +3 -3
  60. package/lib/commonjs/web/variants.js.map +1 -0
  61. package/lib/module/components/Display.js +1 -1
  62. package/lib/module/components/Display.js.map +1 -1
  63. package/lib/module/components/Hide.js +1 -1
  64. package/lib/module/components/Hide.js.map +1 -1
  65. package/lib/module/components/Pressable.js +76 -0
  66. package/lib/module/components/Pressable.js.map +1 -0
  67. package/lib/module/components/Pressable.web.js +91 -0
  68. package/lib/module/components/Pressable.web.js.map +1 -0
  69. package/lib/module/components/index.js +1 -0
  70. package/lib/module/components/index.js.map +1 -1
  71. package/lib/module/core/getBoundArgs.js +13 -0
  72. package/lib/module/core/getBoundArgs.js.map +1 -0
  73. package/lib/module/core/getId.js +4 -0
  74. package/lib/module/core/getId.js.map +1 -0
  75. package/lib/module/core/index.js +2 -0
  76. package/lib/module/core/index.js.map +1 -1
  77. package/lib/module/hooks/index.js +4 -0
  78. package/lib/module/hooks/index.js.map +1 -0
  79. package/lib/module/hooks/useMedia.js.map +1 -0
  80. package/lib/module/hooks/useMedia.web.js.map +1 -0
  81. package/lib/module/index.js +1 -1
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/mq.js +6 -6
  84. package/lib/module/mq.js.map +1 -1
  85. package/lib/module/specs/ShadowRegistry/index.js +3 -4
  86. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  87. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  88. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
  89. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  90. package/lib/module/specs/index.web.js +0 -1
  91. package/lib/module/specs/index.web.js.map +1 -1
  92. package/lib/module/utils.js +1 -1
  93. package/lib/module/utils.js.map +1 -1
  94. package/lib/module/web/convert/types.js.map +1 -1
  95. package/lib/module/web/convert/utils.js +1 -1
  96. package/lib/module/web/convert/utils.js.map +1 -1
  97. package/lib/module/web/create.js +12 -4
  98. package/lib/module/web/create.js.map +1 -1
  99. package/lib/module/web/index.js +7 -3
  100. package/lib/module/web/index.js.map +1 -1
  101. package/lib/module/web/listener.js.map +1 -1
  102. package/lib/module/web/runtime.js +8 -8
  103. package/lib/module/web/runtime.js.map +1 -1
  104. package/lib/module/web/shadowRegistry.js +1 -1
  105. package/lib/module/web/shadowRegistry.js.map +1 -1
  106. package/lib/module/web/state.js +24 -17
  107. package/lib/module/web/state.js.map +1 -1
  108. package/lib/module/web/utils/common.js +1 -1
  109. package/lib/module/web/utils/common.js.map +1 -1
  110. package/lib/module/web/utils/unistyle.js +1 -2
  111. package/lib/module/web/utils/unistyle.js.map +1 -1
  112. package/lib/module/web/{variants/getVariants.js → variants.js} +3 -3
  113. package/lib/module/web/variants.js.map +1 -0
  114. package/lib/typescript/src/components/Pressable.d.ts +7 -0
  115. package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
  116. package/lib/typescript/src/components/Pressable.web.d.ts +13 -0
  117. package/lib/typescript/src/components/Pressable.web.d.ts.map +1 -0
  118. package/lib/typescript/src/components/index.d.ts +1 -0
  119. package/lib/typescript/src/components/index.d.ts.map +1 -1
  120. package/lib/typescript/src/core/getBoundArgs.d.ts +2 -0
  121. package/lib/typescript/src/core/getBoundArgs.d.ts.map +1 -0
  122. package/lib/typescript/src/core/getId.d.ts +2 -0
  123. package/lib/typescript/src/core/getId.d.ts.map +1 -0
  124. package/lib/typescript/src/core/index.d.ts +2 -0
  125. package/lib/typescript/src/core/index.d.ts.map +1 -1
  126. package/lib/typescript/src/hooks/index.d.ts +2 -0
  127. package/lib/typescript/src/hooks/index.d.ts.map +1 -0
  128. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -0
  129. package/lib/typescript/src/hooks/useMedia.web.d.ts.map +1 -0
  130. package/lib/typescript/src/index.d.ts +1 -1
  131. package/lib/typescript/src/index.d.ts.map +1 -1
  132. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +1 -1
  133. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
  134. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
  135. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  136. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +1 -0
  137. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  138. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +1 -1
  139. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
  140. package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -2
  141. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  142. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +1 -1
  143. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  144. package/lib/typescript/src/specs/index.web.d.ts +0 -2
  145. package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
  146. package/lib/typescript/src/types/common.d.ts +1 -0
  147. package/lib/typescript/src/types/common.d.ts.map +1 -1
  148. package/lib/typescript/src/types/index.d.ts +1 -1
  149. package/lib/typescript/src/types/index.d.ts.map +1 -1
  150. package/lib/typescript/src/web/convert/types.d.ts +1 -1
  151. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  152. package/lib/typescript/src/web/create.d.ts +1 -1
  153. package/lib/typescript/src/web/create.d.ts.map +1 -1
  154. package/lib/typescript/src/web/index.d.ts +8 -2
  155. package/lib/typescript/src/web/index.d.ts.map +1 -1
  156. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  157. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  158. package/lib/typescript/src/web/state.d.ts.map +1 -1
  159. package/lib/typescript/src/web/utils/common.d.ts +1 -1
  160. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  161. package/lib/typescript/src/web/utils/unistyle.d.ts +0 -1
  162. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  163. package/lib/typescript/src/web/{variants/getVariants.d.ts → variants.d.ts} +2 -2
  164. package/lib/typescript/src/web/variants.d.ts.map +1 -0
  165. package/package.json +12 -16
  166. package/plugin/common.js +1 -4
  167. package/plugin/import.js +29 -3
  168. package/plugin/index.js +18 -8
  169. package/plugin/ref.js +15 -75
  170. package/plugin/style.js +251 -88
  171. package/src/components/Display.tsx +1 -1
  172. package/src/components/Hide.tsx +1 -1
  173. package/src/components/Pressable.tsx +101 -0
  174. package/src/components/Pressable.web.tsx +103 -0
  175. package/src/components/index.ts +1 -0
  176. package/src/core/getBoundArgs.ts +15 -0
  177. package/src/core/getId.ts +1 -0
  178. package/src/core/index.ts +2 -0
  179. package/src/hooks/index.ts +1 -0
  180. package/src/index.ts +1 -1
  181. package/src/mq.ts +6 -6
  182. package/src/specs/NativePlatform/NativePlatform.nitro.ts +1 -1
  183. package/src/specs/ShadowRegistry/index.ts +5 -6
  184. package/src/specs/ShadowRegistry/types.ts +2 -1
  185. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
  186. package/src/specs/StyleSheet/index.ts +3 -2
  187. package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -2
  188. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
  189. package/src/specs/UnistylesRuntime/index.ts +1 -1
  190. package/src/specs/index.web.ts +0 -4
  191. package/src/types/common.ts +1 -0
  192. package/src/types/index.ts +1 -1
  193. package/src/utils.ts +1 -1
  194. package/src/web/convert/types.ts +1 -1
  195. package/src/web/convert/utils.ts +2 -2
  196. package/src/web/create.ts +13 -4
  197. package/src/web/index.ts +7 -3
  198. package/src/web/listener.ts +2 -0
  199. package/src/web/registry.ts +1 -1
  200. package/src/web/runtime.ts +9 -9
  201. package/src/web/shadowRegistry.ts +3 -3
  202. package/src/web/state.ts +36 -17
  203. package/src/web/utils/common.ts +1 -1
  204. package/src/web/utils/unistyle.ts +3 -9
  205. package/src/web/{variants/getVariants.ts → variants.ts} +3 -3
  206. package/lib/commonjs/components/useMedia.js.map +0 -1
  207. package/lib/commonjs/components/useMedia.web.js.map +0 -1
  208. package/lib/commonjs/web/variants/getVariants.js.map +0 -1
  209. package/lib/commonjs/web/variants/index.js +0 -28
  210. package/lib/commonjs/web/variants/index.js.map +0 -1
  211. package/lib/commonjs/web/variants/useVariants.js +0 -59
  212. package/lib/commonjs/web/variants/useVariants.js.map +0 -1
  213. package/lib/module/components/useMedia.js.map +0 -1
  214. package/lib/module/components/useMedia.web.js.map +0 -1
  215. package/lib/module/web/variants/getVariants.js.map +0 -1
  216. package/lib/module/web/variants/index.js +0 -5
  217. package/lib/module/web/variants/index.js.map +0 -1
  218. package/lib/module/web/variants/useVariants.js +0 -54
  219. package/lib/module/web/variants/useVariants.js.map +0 -1
  220. package/lib/typescript/src/components/useMedia.d.ts.map +0 -1
  221. package/lib/typescript/src/components/useMedia.web.d.ts.map +0 -1
  222. package/lib/typescript/src/web/variants/getVariants.d.ts.map +0 -1
  223. package/lib/typescript/src/web/variants/index.d.ts +0 -3
  224. package/lib/typescript/src/web/variants/index.d.ts.map +0 -1
  225. package/lib/typescript/src/web/variants/useVariants.d.ts +0 -3
  226. package/lib/typescript/src/web/variants/useVariants.d.ts.map +0 -1
  227. package/src/web/variants/index.ts +0 -2
  228. package/src/web/variants/useVariants.ts +0 -65
  229. /package/lib/commonjs/{components → hooks}/useMedia.js +0 -0
  230. /package/lib/commonjs/{components → hooks}/useMedia.web.js +0 -0
  231. /package/lib/module/{components → hooks}/useMedia.js +0 -0
  232. /package/lib/module/{components → hooks}/useMedia.web.js +0 -0
  233. /package/lib/typescript/src/{components → hooks}/useMedia.d.ts +0 -0
  234. /package/lib/typescript/src/{components → hooks}/useMedia.web.d.ts +0 -0
  235. /package/src/{components → hooks}/useMedia.ts +0 -0
  236. /package/src/{components → hooks}/useMedia.web.ts +0 -0
@@ -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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBN,MAAM,KAAK,MAAM;yBACT,KAAK,CAAC,MAAM,CAAC;;CAErC,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,cAAc,QAAQ,CAAA"}
@@ -1 +1 @@
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,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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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":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AM,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"}
@@ -1,3 +1,3 @@
1
- import type { ReactNativeStyleSheet, StyleSheet } from '../../types';
1
+ import type { ReactNativeStyleSheet, StyleSheet } from '../types';
2
2
  export declare const getVariants: (styles: ReactNativeStyleSheet<StyleSheet>, selectedVariants: Record<string, any>) => (readonly [string, any])[];
3
- //# sourceMappingURL=getVariants.d.ts.map
3
+ //# sourceMappingURL=variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/web/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAWjE,eAAO,MAAM,WAAW,WAAY,qBAAqB,CAAC,UAAU,CAAC,oBAAoB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,+BA8B3G,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-alpha.41",
3
+ "version": "3.0.0-alpha.43",
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
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",
74
+ "react-native": "0.76.3",
75
+ "react-native-builder-bob": "0.33.1",
81
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
- const uniquePressableId = openingElementName === 'Pressable'
132
- ? handlePressable(t, path, styleAttr, metadata)
133
- : undefined
134
-
135
145
  styleAttributeToArray(t, path)
136
146
 
137
147
  // to add import
@@ -144,8 +154,8 @@ module.exports = function ({ types: t }) {
144
154
  }
145
155
 
146
156
  refProp
147
- ? overrideRef(t, path, refProp, metadata, state, uniquePressableId)
148
- : addRef(t, path, metadata, state, uniquePressableId)
157
+ ? overrideRef(t, path, refProp, metadata, state)
158
+ : addRef(t, path, metadata, state)
149
159
  },
150
160
  CallExpression(path, state) {
151
161
  if (isUsingVariants(t, path)) {
package/plugin/ref.js CHANGED
@@ -1,9 +1,3 @@
1
- const { PRESSABLE_STATE_NAME } = require('./common')
2
-
3
- function generateUniqueId() {
4
- return `${Math.random().toString(36).substring(2, 9)}`
5
- }
6
-
7
1
  function getRefProp(t, path) {
8
2
  return path.node.openingElement.attributes.find(attr =>
9
3
  t.isJSXAttribute(attr) &&
@@ -25,7 +19,7 @@ function arrayExpressionFromMetadata(t, metadata) {
25
19
  .map(meta => {
26
20
  // possible for inline styles
27
21
  if (meta.members.length === 0) {
28
- return meta.inlineStyle || meta.conditionalExpression
22
+ return meta.inlineStyle || meta.conditionalExpression || meta.logicalExpression
29
23
  }
30
24
 
31
25
  const [base, ...members] = meta.members
@@ -37,65 +31,16 @@ function arrayExpressionFromMetadata(t, metadata) {
37
31
  }
38
32
 
39
33
  function arrayFromDynamicFunctionArgs(t, metadata, path) {
40
- const hasPressableDynamicFunction = path.node.openingElement.attributes
41
- .find(attr => t.isJSXIdentifier(attr.name) && attr.name.name === "style" && t.isArrowFunctionExpression(attr.value.expression))
42
-
43
34
  const memberExpressions = metadata
44
- .map(meta => {
45
- if (meta.dynamicFunction && meta.dynamicFunction.arguments) {
46
- const args = meta.dynamicFunction.arguments.map(arg => {
47
- // special case for pressable
48
- if (t.isIdentifier(arg) && arg.name === PRESSABLE_STATE_NAME) {
49
- // replace with { pressed: false }
50
- return t.objectExpression([
51
- t.objectProperty(
52
- t.identifier("pressed"),
53
- t.booleanLiteral(false)
54
- )
55
- ])
56
- }
57
-
58
- if (t.isMemberExpression(arg) && arg.object.name === PRESSABLE_STATE_NAME) {
59
- return t.identifier('false')
60
- }
61
-
62
- return arg
63
- })
64
-
65
- return t.arrayExpression(args)
66
- }
67
-
68
- // typeof styles.pressable === "function" ? { pressed: false } : []
69
- if (hasPressableDynamicFunction) {
70
- return t.arrayExpression([
71
- t.conditionalExpression(
72
- t.binaryExpression(
73
- "===",
74
- t.unaryExpression(
75
- "typeof",
76
- t.identifier("styles.pressable")
77
- ),
78
- t.stringLiteral("function")
79
- ),
80
- t.objectExpression([
81
- t.objectProperty(
82
- t.identifier("pressed"),
83
- t.booleanLiteral(false)
84
- )
85
- ]),
86
- t.arrayExpression([])
87
- )
88
- ])
89
- }
90
-
91
- return t.arrayExpression([])
92
- })
35
+ .map(meta => meta.dynamicFunction
36
+ ? t.arrayExpression(meta.dynamicFunction.arguments)
37
+ : t.arrayExpression([]))
93
38
  .filter(Boolean)
94
39
 
95
40
  return t.arrayExpression(memberExpressions)
96
41
  }
97
42
 
98
- function addRef(t, path, metadata, state, uniquePressableId) {
43
+ function addRef(t, path, metadata, state) {
99
44
  const hasVariants = state.file.hasVariants
100
45
 
101
46
  const newRefFunction = t.arrowFunctionExpression(
@@ -108,9 +53,8 @@ function addRef(t, path, metadata, state, uniquePressableId) {
108
53
  t.identifier('ref'),
109
54
  arrayExpressionFromMetadata(t, metadata),
110
55
  t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
111
- arrayFromDynamicFunctionArgs(t, metadata, path),
112
- uniquePressableId ? t.stringLiteral(uniquePressableId) : undefined
113
- ].filter(Boolean)
56
+ arrayFromDynamicFunctionArgs(t, metadata, path)
57
+ ]
114
58
  )
115
59
  ),
116
60
  t.returnStatement(
@@ -132,7 +76,7 @@ function addRef(t, path, metadata, state, uniquePressableId) {
132
76
  path.node.openingElement.attributes.push(newRefProp)
133
77
  }
134
78
 
135
- function overrideRef(t, path, refProp, metadata, state, uniquePressableId) {
79
+ function overrideRef(t, path, refProp, metadata, state) {
136
80
  const hasVariants = state.file.hasVariants
137
81
  const uniqueRefName = path.scope.generateUidIdentifier('ref').name
138
82
  const isIdentifier = t.isIdentifier(refProp.value.expression)
@@ -158,9 +102,8 @@ function overrideRef(t, path, refProp, metadata, state, uniquePressableId) {
158
102
  t.identifier(uniqueRefName),
159
103
  arrayExpressionFromMetadata(t, metadata),
160
104
  t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
161
- arrayFromDynamicFunctionArgs(t, metadata, path),
162
- uniquePressableId ? t.stringLiteral(uniquePressableId) : undefined
163
- ].filter(Boolean)
105
+ arrayFromDynamicFunctionArgs(t, metadata, path)
106
+ ]
164
107
  )
165
108
  ),
166
109
  t.returnStatement(
@@ -204,9 +147,8 @@ function overrideRef(t, path, refProp, metadata, state, uniquePressableId) {
204
147
  t.identifier(userRefName),
205
148
  arrayExpressionFromMetadata(t, metadata),
206
149
  t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
207
- arrayFromDynamicFunctionArgs(t, metadata, path),
208
- uniquePressableId ? t.stringLiteral(uniquePressableId) : undefined
209
- ].filter(Boolean)
150
+ arrayFromDynamicFunctionArgs(t, metadata, path)
151
+ ]
210
152
  )
211
153
  ),
212
154
  // Merged cleanup function
@@ -267,9 +209,8 @@ function overrideRef(t, path, refProp, metadata, state, uniquePressableId) {
267
209
  t.identifier(uniqueRefName),
268
210
  arrayExpressionFromMetadata(t, metadata),
269
211
  t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
270
- arrayFromDynamicFunctionArgs(t, metadata, path),
271
- uniquePressableId ? t.stringLiteral(uniquePressableId) : undefined
272
- ].filter(Boolean)
212
+ arrayFromDynamicFunctionArgs(t, metadata, path)
213
+ ]
273
214
  )
274
215
  ),
275
216
  t.returnStatement(
@@ -300,6 +241,5 @@ module.exports = {
300
241
  getRefProp,
301
242
  addRef,
302
243
  overrideRef,
303
- hasStringRef,
304
- generateUniqueId
244
+ hasStringRef
305
245
  }