react-native-unistyles 3.0.0-nightly-20250520 → 3.0.0-nightly-20250526

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 (119) hide show
  1. package/README.md +9 -6
  2. package/android/src/main/cxx/NativeUnistylesModule.cpp +3 -7
  3. package/android/src/main/cxx/NativeUnistylesModule.h +0 -4
  4. package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -7
  5. package/cxx/core/UnistylesCommitShadowNode.h +0 -21
  6. package/cxx/core/UnistylesRegistry.cpp +45 -43
  7. package/cxx/hybridObjects/HybridStyleSheet.cpp +0 -13
  8. package/cxx/hybridObjects/HybridStyleSheet.h +2 -7
  9. package/cxx/parser/Parser.cpp +150 -107
  10. package/cxx/shadowTree/ShadowTreeManager.cpp +36 -33
  11. package/cxx/shadowTree/ShadowTreeManager.h +0 -1
  12. package/ios/UnistylesModuleOnLoad.h +1 -5
  13. package/ios/UnistylesModuleOnLoad.mm +5 -13
  14. package/lib/commonjs/components/ScopedTheme.js +1 -2
  15. package/lib/commonjs/components/ScopedTheme.js.map +1 -1
  16. package/lib/commonjs/components/native/Image.js +1 -2
  17. package/lib/commonjs/components/native/Image.js.map +1 -1
  18. package/lib/commonjs/components/native/ImageBackground.js +1 -2
  19. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  20. package/lib/commonjs/components/native/Pressable.js +1 -2
  21. package/lib/commonjs/components/native/Pressable.js.map +1 -1
  22. package/lib/commonjs/components/native/Pressable.native.js +1 -2
  23. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  24. package/lib/commonjs/core/createUnistylesElement.native.js +2 -28
  25. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  26. package/lib/commonjs/core/createUnistylesImageBackground.js +6 -21
  27. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  28. package/lib/commonjs/core/getClassname.js +1 -2
  29. package/lib/commonjs/core/getClassname.js.map +1 -1
  30. package/lib/commonjs/core/useProxifiedUnistyles/listener.js +1 -2
  31. package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
  32. package/lib/commonjs/core/withUnistyles/withUnistyles.js +1 -2
  33. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  34. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +1 -2
  35. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  36. package/lib/commonjs/index.js +6 -0
  37. package/lib/commonjs/index.js.map +1 -1
  38. package/lib/commonjs/server/getServerUnistyles.js +1 -2
  39. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  40. package/lib/commonjs/server/hydrateServerUnistyles.js +1 -2
  41. package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
  42. package/lib/commonjs/server/resetServerUnistyles.js +1 -2
  43. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
  44. package/lib/commonjs/web/create.js +1 -2
  45. package/lib/commonjs/web/create.js.map +1 -1
  46. package/lib/commonjs/web/index.js +1 -2
  47. package/lib/commonjs/web/index.js.map +1 -1
  48. package/lib/commonjs/web/shadowRegistry.js +1 -1
  49. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  50. package/lib/commonjs/web/utils/createUnistylesRef.js +1 -2
  51. package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -1
  52. package/lib/commonjs/web/utils/unistyle.js +1 -2
  53. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  54. package/lib/module/core/createUnistylesElement.native.js +1 -26
  55. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  56. package/lib/module/core/createUnistylesImageBackground.js +5 -19
  57. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  58. package/lib/module/index.js +5 -0
  59. package/lib/module/index.js.map +1 -1
  60. package/lib/module/web/shadowRegistry.js +1 -1
  61. package/lib/module/web/shadowRegistry.js.map +1 -1
  62. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
  63. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  64. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  65. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  66. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  67. package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
  68. package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -1
  69. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
  70. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  71. package/lib/typescript/src/core/warn.d.ts.map +1 -1
  72. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  73. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  74. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -1
  75. package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -1
  76. package/lib/typescript/src/index.d.ts.map +1 -1
  77. package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
  78. package/lib/typescript/src/server/serialize.d.ts.map +1 -1
  79. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  80. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  81. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  82. package/lib/typescript/src/utils.d.ts.map +1 -1
  83. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  84. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
  85. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  86. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
  87. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  88. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
  89. package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -1
  90. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -1
  91. package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -1
  92. package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
  93. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  94. package/lib/typescript/src/web/create.d.ts.map +1 -1
  95. package/lib/typescript/src/web/css/core.d.ts.map +1 -1
  96. package/lib/typescript/src/web/css/state.d.ts.map +1 -1
  97. package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
  98. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  99. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  100. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  101. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  102. package/lib/typescript/src/web/state.d.ts.map +1 -1
  103. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  104. package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -1
  105. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  106. package/lib/typescript/src/web/variants.d.ts.map +1 -1
  107. package/lib/typescript/src/web-only/getWebProps.d.ts.map +1 -1
  108. package/package.json +17 -20
  109. package/plugin/index.d.ts +5 -4
  110. package/plugin/index.js +9 -1
  111. package/src/core/createUnistylesElement.native.tsx +1 -29
  112. package/src/core/createUnistylesImageBackground.tsx +7 -22
  113. package/src/index.ts +8 -0
  114. package/src/web/shadowRegistry.ts +1 -1
  115. package/cxx/core/UnistylesCommitHook.cpp +0 -59
  116. package/cxx/core/UnistylesCommitHook.h +0 -27
  117. package/cxx/core/UnistylesMountHook.cpp +0 -26
  118. package/cxx/core/UnistylesMountHook.h +0 -24
  119. package/lib/module/package.json +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/web/css/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,UAAU,QAAS,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,MAAM,qBAYzE,CAAA;AAED,eAAO,MAAM,kBAAkB,UAAW,QAAQ,WAoCjD,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/web/css/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,UAAU,GAAI,KAAK,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,MAAM,qBAYzE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,QAAQ,WAoCjD,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;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,qBAAa,iBAAiB;IAKd,OAAO,CAAC,QAAQ;IAJ5B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAoG;IACrH,OAAO,CAAC,mBAAmB,CAAoG;gBAE3G,QAAQ,EAAE,iBAAiB;IAE/C,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"}
1
+ {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../src/web/listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAA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AmBlC;IAED,iBAAiB,GAAI,WAAW,OAAO,UAWtC;IAED,0BAA0B,GAAI,OAAO,MAAM,UAM1C;IAED,gBAAgB,aAAW;IAE3B,WAAW,GAAI,WAAW,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,QAAQ,KAAK,QAAQ,UAQpF;IAED,QAAQ,GAAI,qBAA0B,EAAE,iBAAe,WActD;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAInE,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,QAAS,GAAG,SAAS,MAAM,UAM7B;IAED,SAAS,cAAe,KAAK,CAAC,eAAe,CAAC,aAAa,OAAO;;;MAoEjE;IAED,cAAc,WAAY,cAAc,UAEvC;IAED,cAAc,kBAAyB;IAEvC,MAAM,QAAS,GAAG,SAAS,MAAM,UAchC;CACJ"}
1
+ {"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAInE,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAA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BtB;IAED,SAAS,wBAAqB;CACjC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/web/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,WAAW,CAAA;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAY,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAKhD,qBAAa,cAAc;IAsBX,OAAO,CAAC,QAAQ;IArB5B,aAAa,UAAQ;IACrB,MAAM,qBAAoC;IAC1C,SAAS,qBAAoC;IAC7C,SAAS,CAAC,EAAE,YAAY,CAAA;IACxB,OAAO,UAAO;IAEd,OAAO,CAAC,mBAAmB,CAA6B;IACxD,OAAO,CAAC,OAAO,CAAsB;IAErC,IAAI,UAAU,IAKkB,aAAa,GAAG,SAAS,CACxD;IAED,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAElC,iBAAiB,UAAQ;gBAEL,QAAQ,EAAE,iBAAiB;IAE/C,IAAI,GAAI,QAAQ,eAAe,UAyB9B;IAED,OAAO,CAAC,UAAU,CA8BjB;IAED,OAAO,CAAC,YAAY,CA6BnB;IAED,OAAO,CAAC,eAAe,CA+BtB;IAED,SAAS,wBAAqB;CACjC"}
@@ -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,CAAC,IAAI,MAAM,IAAI,GAAG,QAAQ,GAAE,CAAA;AAErJ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MAAM,SAAS,GAAI,KAAK,MAAM,GAAG,MAAM,GAAG,MAAM,KAAG,MASzD,CAAA;AAmBD,eAAO,MAAM,YAAY,GAAI,OAAO,GAAG,WAItC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"createUnistylesRef.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/createUnistylesRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAI5D,KAAK,MAAM,GAAG,SAAS;IACnB;QACI,IAAI,EAAE,MAAM,CAAA;KACf;IACD,KAAK,CAAC,eAAe,CAAC;CACzB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,CAAC,WAAW,MAAM,iBAAiB,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,YAIjD,QAAQ,CAAC,CAAC,CAAC,sBAgBpD,CAAA"}
1
+ {"version":3,"file":"createUnistylesRef.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/createUnistylesRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAI5D,KAAK,MAAM,GAAG,SAAS;IACnB;QACI,IAAI,EAAE,MAAM,CAAA;KACf;IACD,KAAK,CAAC,eAAe,CAAC;CACzB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,YAIjD,QAAQ,CAAC,CAAC,CAAC,sBAgBpD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAA;AACzF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AAY,eAAe,oBAAoB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,2DA2BzF,CAAA"}
1
+ {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/web/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAc/C,eAAO,MAAM,WAAW,GAAI,QAAQ,eAAe,EAAE,kBAAkB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,2DA2BzF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getWebProps.d.ts","sourceRoot":"","sources":["../../../../src/web-only/getWebProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,UAAU,CAAA;AAGxD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,SAAS,CAAC,OAAO,CAAC;;;CAYvD,CAAA"}
1
+ {"version":3,"file":"getWebProps.d.ts","sourceRoot":"","sources":["../../../../src/web-only/getWebProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,UAAU,CAAA;AAGxD,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,OAAO,SAAS,CAAC,OAAO,CAAC;;;CAYvD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-nightly-20250520",
3
+ "version": "3.0.0-nightly-20250526",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "NODE_ENV=babel-test jest ./plugin",
@@ -126,37 +126,37 @@
126
126
  "registry": "https://registry.npmjs.org/"
127
127
  },
128
128
  "devDependencies": {
129
- "@babel/core": "7.26.9",
130
- "@babel/plugin-syntax-jsx": "7.25.9",
131
- "@babel/preset-flow": "7.25.9",
132
- "@babel/preset-typescript": "7.26.0",
133
- "@babel/types": "7.26.9",
129
+ "@babel/core": "7.27.1",
130
+ "@babel/plugin-syntax-jsx": "7.27.1",
131
+ "@babel/preset-flow": "7.27.1",
132
+ "@babel/preset-typescript": "7.27.1",
133
+ "@babel/types": "7.27.1",
134
134
  "@biomejs/biome": "1.9.4",
135
135
  "@callstack/repack": "5.1.0",
136
- "@commitlint/config-conventional": "19.7.1",
137
- "@react-native/normalize-colors": "0.78.0",
136
+ "@commitlint/config-conventional": "19.8.1",
137
+ "@react-native/normalize-colors": "0.79.2",
138
138
  "@release-it/conventional-changelog": "8.0.2",
139
139
  "@rspack/core": "1.3.10",
140
140
  "@types/jest": "29.5.14",
141
- "@types/react": "19.0.10",
141
+ "@types/react": "19.1.4",
142
142
  "babel-plugin-tester": "11.0.4",
143
- "commitlint": "19.7.1",
143
+ "commitlint": "19.8.1",
144
144
  "concurrently": "9.1.2",
145
145
  "dpdm": "3.14.0",
146
- "esbuild": "0.25.0",
146
+ "esbuild": "0.25.4",
147
147
  "husky": "9.1.7",
148
148
  "jest": "29.7.0",
149
149
  "metro-react-native-babel-preset": "0.77.0",
150
150
  "nitro-codegen": "0.25.2",
151
- "react": "18.3.1",
152
- "react-native": "0.77.1",
153
- "react-native-builder-bob": "0.37.0",
151
+ "react": "19.1.0",
152
+ "react-native": "0.79.2",
153
+ "react-native-builder-bob": "0.40.10",
154
154
  "react-native-nitro-modules": "0.25.2",
155
155
  "react-native-reanimated": "3.17.5",
156
- "react-native-web": "0.19.13",
157
- "react-test-renderer": "18.3.1",
156
+ "react-native-web": "0.20.0",
157
+ "react-test-renderer": "19.1.0",
158
158
  "release-it": "17.11.0",
159
- "typescript": "5.7.3"
159
+ "typescript": "5.8.3"
160
160
  },
161
161
  "peerDependencies": {
162
162
  "@react-native/normalize-colors": "*",
@@ -234,8 +234,5 @@
234
234
  "name": "TurboUnistyles",
235
235
  "type": "modules",
236
236
  "jsSrcsDir": "./src/specs/TurboUnistyles"
237
- },
238
- "resolutions": {
239
- "@babel/types": "7.26.8"
240
237
  }
241
238
  }
package/plugin/index.d.ts CHANGED
@@ -37,11 +37,12 @@ export interface RemapConfig {
37
37
 
38
38
  export interface UnistylesPluginOptions {
39
39
  /**
40
- * Example: 'src' or 'apps/mobile'
41
- * Add this option if some of your components don't have `react-native-unistyles` import.
42
- * Babel plugin will automatically process all files under this root.
40
+ * Required from RC.5
41
+ * Example: 'src' or 'app'
42
+ * Add root folder of your project. All files under this folder will be processed by the Babel plugin.
43
+ * If you need to process extra folders, use with `autoProcessPaths` option.
43
44
  */
44
- autoProcessRoot?: string,
45
+ root: string,
45
46
 
46
47
  /**
47
48
  * Example: ['@codemask/styles']
package/plugin/index.js CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  default: () => index_default
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
+ var import_node_path2 = __toESM(require("node:path"));
36
37
  var t6 = __toESM(require("@babel/types"));
37
38
 
38
39
  // plugin/src/consts.ts
@@ -724,6 +725,13 @@ function index_default() {
724
725
  visitor: {
725
726
  Program: {
726
727
  enter(path2, state) {
728
+ if (!state.opts.root) {
729
+ throw new Error("Unistyles \u{1F984}: Babel plugin requires `root` option to be set. Please check https://www.unistyl.es/v3/other/babel-plugin#extra-configuration");
730
+ }
731
+ const appRoot = toPlatformPath(import_node_path2.default.join(state.file.opts.root, state.opts.root));
732
+ if (state.file.opts.root === appRoot) {
733
+ throw new Error("Unistyles \u{1F984}: Root option can't resolve to project root as it will include node_modules folder. Please check https://www.unistyl.es/v3/other/babel-plugin#extra-configuration");
734
+ }
727
735
  state.file.replaceWithUnistyles = REPLACE_WITH_UNISTYLES_PATHS.map(toPlatformPath).concat(state.opts.autoProcessPaths ?? []).some((path3) => state.filename?.includes(path3));
728
736
  state.file.hasAnyUnistyle = false;
729
737
  state.file.hasUnistylesImport = false;
@@ -733,7 +741,7 @@ function index_default() {
733
741
  state.file.reactNativeCommonJSName = "";
734
742
  state.file.tagNumber = 0;
735
743
  state.reactNativeImports = {};
736
- state.file.forceProcessing = state.opts.autoProcessRoot && state.filename ? state.filename.includes(toPlatformPath(`${state.file.opts.root}/${state.opts.autoProcessRoot}/`)) : false;
744
+ state.file.forceProcessing = state.filename?.includes(appRoot) ?? false;
737
745
  path2.traverse({
738
746
  BlockStatement(blockPath) {
739
747
  if (isInsideNodeModules(state)) {
@@ -1,43 +1,15 @@
1
- import React, { useLayoutEffect, useRef } from 'react'
1
+ import React from 'react'
2
2
  import { UnistylesShadowRegistry } from '../specs'
3
3
  import { copyComponentProperties } from '../utils'
4
4
  import { passForwardedRef } from './passForwardRef'
5
5
  import { maybeWarnAboutMultipleUnistyles } from './warn'
6
6
 
7
- const getNativeRef = (Component: any, ref: any) => {
8
- switch (Component.name) {
9
- case 'KeyboardAvoidingView':
10
- return ref.viewRef?.current
11
- case 'FlatList':
12
- return ref.getNativeScrollRef?.()
13
- case 'VirtualizedList':
14
- return ref.getScrollRef?.()
15
- default:
16
- return ref
17
- }
18
- }
19
-
20
7
  export const createUnistylesElement = (Component: any) => {
21
8
  const UnistylesComponent = React.forwardRef((props, forwardedRef) => {
22
- const storedRef = useRef<unknown>(null)
23
-
24
- useLayoutEffect(() => {
25
- return () => {
26
- if (storedRef.current) {
27
- // @ts-ignore
28
- UnistylesShadowRegistry.remove(storedRef.current)
29
- }
30
- }
31
- }, [])
32
-
33
9
  return (
34
10
  <Component
35
11
  {...props}
36
12
  ref={(ref: unknown) => {
37
- if (ref) {
38
- storedRef.current = getNativeRef(Component, ref)
39
- }
40
-
41
13
  // @ts-ignore we don't know the type of the component
42
14
  maybeWarnAboutMultipleUnistyles(props.style, Component.displayName)
43
15
 
@@ -1,5 +1,5 @@
1
- import React, { useLayoutEffect, useRef } from 'react'
2
- import type { Image, ImageBackground, ImageBackgroundProps } from 'react-native'
1
+ import React from 'react'
2
+ import type { ImageBackground, ImageBackgroundProps } from 'react-native'
3
3
  import { UnistylesShadowRegistry } from '../specs'
4
4
  import { copyComponentProperties } from '../utils'
5
5
  import { passForwardedRef } from './passForwardRef'
@@ -7,17 +7,6 @@ import { maybeWarnAboutMultipleUnistyles } from './warn'
7
7
 
8
8
  export const createUnistylesImageBackground = (Component: typeof ImageBackground) => {
9
9
  const UnistylesImageBackground = React.forwardRef<ImageBackground, ImageBackgroundProps>((props, forwardedRef) => {
10
- const storedImageRef = useRef<Image | null>(null)
11
-
12
- useLayoutEffect(() => {
13
- return () => {
14
- if (storedImageRef.current) {
15
- // @ts-ignore
16
- UnistylesShadowRegistry.remove(storedImageRef.current)
17
- }
18
- }
19
- }, [])
20
-
21
10
  // @ts-expect-error we don't know the type of the component
22
11
  maybeWarnAboutMultipleUnistyles(props.style, 'ImageBackground')
23
12
  // @ts-ignore we don't know the type of the component
@@ -37,21 +26,17 @@ export const createUnistylesImageBackground = (Component: typeof ImageBackground
37
26
  () => {
38
27
  // @ts-expect-error - this is hidden from TS
39
28
  UnistylesShadowRegistry.remove(ref)
40
-
41
- if (storedImageRef.current) {
42
- // @ts-expect-error - this is hidden from TS
43
- UnistylesShadowRegistry.remove(storedImageRef.current)
44
- }
45
29
  }
46
30
  )
47
31
  }}
48
32
  imageRef={ref => {
49
- if (ref) {
50
- storedImageRef.current = ref
51
- }
52
-
53
33
  // @ts-expect-error web types are not compatible with RN styles
54
34
  UnistylesShadowRegistry.add(ref, props.imageStyle)
35
+
36
+ return () => {
37
+ // @ts-ignore this is hidden from TS
38
+ UnistylesShadowRegistry.remove(ref)
39
+ }
55
40
  }}
56
41
  />
57
42
  )
package/src/index.ts CHANGED
@@ -1,3 +1,11 @@
1
+ import React from 'react'
2
+
3
+ const [majorReactVersions] = React.version.split('.').map(Number.parseInt)
4
+
5
+ if (majorReactVersions === undefined || majorReactVersions < 19) {
6
+ throw new Error('Unistyles 🦄: To enable full Fabric power you need to use React 19.0.0 or higher')
7
+ }
8
+
1
9
  export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs'
2
10
  export { mq } from './mq'
3
11
  export type { UnistylesThemes, UnistylesBreakpoints } from './global'
@@ -20,7 +20,7 @@ export class UnistylesShadowRegistry {
20
20
  constructor(private services: UnistylesServices) {}
21
21
 
22
22
  add = (ref: any, hash?: string) => {
23
- if (!(ref instanceof HTMLElement) || !hash) {
23
+ if (isServer() || !(ref instanceof HTMLElement) || !hash) {
24
24
  return
25
25
  }
26
26
 
@@ -1,59 +0,0 @@
1
- #include "UnistylesCommitHook.h"
2
-
3
- using namespace margelo::nitro::unistyles;
4
- using namespace facebook::react;
5
-
6
- core::UnistylesCommitHook::~UnistylesCommitHook() noexcept {
7
- _uiManager->unregisterCommitHook(*this);
8
- }
9
-
10
- void core::UnistylesCommitHook::commitHookWasRegistered(const UIManager &uiManager) noexcept {}
11
- void core::UnistylesCommitHook::commitHookWasUnregistered(const UIManager &uiManager) noexcept {}
12
-
13
- RootShadowNode::Unshared core::UnistylesCommitHook::shadowTreeWillCommit(
14
- const ShadowTree &shadowTree,
15
- const RootShadowNode::Shared &oldRootShadowNode,
16
- const RootShadowNode::Unshared &newRootShadowNode
17
- ) noexcept {
18
- RootShadowNode::Unshared rootNode = newRootShadowNode;
19
- auto unistylesRootNode = std::reinterpret_pointer_cast<core::UnistylesCommitShadowNode>(newRootShadowNode);
20
-
21
- // this is Unistyles commit, we don't need to override it
22
- if (unistylesRootNode->hasUnistylesCommitTrait()) {
23
- unistylesRootNode->removeUnistylesCommitTrait();
24
- unistylesRootNode->addUnistylesMountTrait();
25
-
26
- return newRootShadowNode;
27
- }
28
-
29
- auto& registry = core::UnistylesRegistry::get();
30
-
31
- if (registry.trafficController.shouldStop()) {
32
- registry.trafficController.resumeUnistylesTraffic();
33
-
34
- return newRootShadowNode;
35
- }
36
-
37
- // this is React Native / Reanimated commit
38
- // merge Unistyles updates before it completes
39
-
40
- return registry.trafficController.withLock([&](){
41
- auto& shadowLeafUpdates = registry.trafficController.getUpdates();
42
-
43
- // oops, no updates from Unistyles yet, skip it!
44
- if (shadowLeafUpdates.size() == 0) {
45
- return newRootShadowNode;
46
- }
47
-
48
- auto affectedNodes = shadow::ShadowTreeManager::findAffectedNodes(*rootNode, shadowLeafUpdates);
49
-
50
- registry.trafficController.stopUnistylesTraffic();
51
-
52
- // we have few updates, so merge it
53
- return std::static_pointer_cast<RootShadowNode>(shadow::ShadowTreeManager::cloneShadowTree(
54
- *rootNode,
55
- shadowLeafUpdates,
56
- affectedNodes
57
- ));
58
- });
59
- }
@@ -1,27 +0,0 @@
1
- #pragma once
2
-
3
- #include <react/renderer/uimanager/UIManager.h>
4
- #include <react/renderer/uimanager/UIManagerCommitHook.h>
5
- #include "ShadowTreeManager.h"
6
- #include "ShadowTrafficController.h"
7
-
8
- namespace margelo::nitro::unistyles::core {
9
-
10
- using namespace facebook::react;
11
-
12
- struct UnistylesCommitHook : public UIManagerCommitHook {
13
- UnistylesCommitHook(std::shared_ptr<UIManager> uiManager) : _uiManager{uiManager} {
14
- _uiManager->registerCommitHook(*this);
15
- }
16
-
17
- ~UnistylesCommitHook() noexcept override;
18
-
19
- void commitHookWasRegistered(const UIManager &uiManager) noexcept override;
20
- void commitHookWasUnregistered(const UIManager &uiManager) noexcept override;
21
- RootShadowNode::Unshared shadowTreeWillCommit(const ShadowTree &shadowTree, const RootShadowNode::Shared &oldRootShadowNode, const RootShadowNode::Unshared &newRootShadowNode) noexcept override;
22
-
23
- private:
24
- std::shared_ptr<UIManager> _uiManager;
25
- };
26
-
27
- }
@@ -1,26 +0,0 @@
1
- #include "UnistylesMountHook.h"
2
-
3
- using namespace margelo::nitro::unistyles;
4
- using namespace facebook::react;
5
-
6
- core::UnistylesMountHook::~UnistylesMountHook() noexcept {
7
- _uiManager->unregisterMountHook(*this);
8
- }
9
-
10
- void core::UnistylesMountHook::shadowTreeDidMount(RootShadowNode::Shared const &rootShadowNode, double mountTime) noexcept {
11
- auto rootNode = std::const_pointer_cast<RootShadowNode>(rootShadowNode);
12
- auto unistylesRootNode = std::reinterpret_pointer_cast<core::UnistylesCommitShadowNode>(rootNode);
13
-
14
- // if this is Unistyles commit, do nothing
15
- if (unistylesRootNode->hasUnistylesMountTrait()) {
16
- unistylesRootNode->removeUnistylesMountTrait();
17
-
18
- return;
19
- }
20
-
21
- // this is React Native or Reanimated commit
22
- // one more time merge Unistyles changes
23
- auto& registry = core::UnistylesRegistry::get();
24
-
25
- registry.trafficController.stopUnistylesTraffic();
26
- }
@@ -1,24 +0,0 @@
1
- #pragma once
2
-
3
- #include <react/renderer/uimanager/UIManager.h>
4
- #include <react/renderer/uimanager/UIManagerMountHook.h>
5
- #include "ShadowTreeManager.h"
6
-
7
- namespace margelo::nitro::unistyles::core {
8
-
9
- using namespace facebook::react;
10
-
11
- struct UnistylesMountHook : public UIManagerMountHook {
12
- UnistylesMountHook(std::shared_ptr<UIManager> uiManager): _uiManager{uiManager} {
13
- _uiManager->registerMountHook(*this);
14
- }
15
-
16
- ~UnistylesMountHook() noexcept override;
17
-
18
- void shadowTreeDidMount(RootShadowNode::Shared const &rootShadowNode, double mountTime) noexcept override;
19
-
20
- private:
21
- std::shared_ptr<UIManager> _uiManager;
22
- };
23
-
24
- }
@@ -1 +0,0 @@
1
- {"type":"module"}