facebook / react-strict-dom

React Strict DOM (RSD) standardizes the development of styled React components for web and native.
https://facebook.github.io/react-strict-dom
MIT License
3.2k stars 161 forks source link

feat: expose the useCustomProperties hook #231

Closed nmn closed 3 weeks ago

nmn commented 3 weeks ago

When trying to style "native" (not RSD) components with StyleX APIs, it should be possible to resolve the themes that have been applied with stylex.createTheme APIs within the RSD tree.

This PR simply exposes the useCustomProperties hook to make this possible.

github-actions[bot] commented 3 weeks ago

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better. Results Base Patch Ratio
react-strict-dom/dist/dom/index.js
· compressed 2,488 2,488 1.00
· minified 8,586 8,586 1.00
react-strict-dom/dist/dom/runtime.js
· compressed 850 850 1.00
· minified 2,404 2,404 1.00
react-strict-dom/dist/native/index.js
· compressed 15,651 15,681 1.00 +
· minified 58,387 58,407 1.00 +
github-actions[bot] commented 3 weeks ago

workflow: benchmarks/perf (native)

Comparison of performance test results, measured in operations per second. Larger is better. Results Base Patch Ratio
css.create
· small 1,127,627 1,138,038 1.01 +
· small with units 446,963 448,333 1.00 +
· small with variables 687,934 683,651 0.99 -
· several small 328,169 326,856 1.00 -
· large 213,055 213,534 1.00 +
· large with polyfills 149,248 147,518 0.99 -
· complex 102,315 101,818 1.00 -
· unsupported 223,568 224,596 1.00 +
css.createTheme
· simple theme 225,271 225,560 1.00 +
· polyfill theme 212,056 211,946 1.00 -
css.props
· small 247,339 244,058 0.99 -
· small with units 192,668 193,149 1.00 +
· small with variables 107,004 106,766 1.00 -
· small with variables of units 75,598 75,627 1.00 +
· large 105,453 104,982 1.00 -
· large with polyfills 37,223 37,165 1.00 -
· complex 24,087 23,877 0.99 -
· unsupported 149,143 150,838 1.01 +
· simple merge 164,872 164,848 1.00 -
· wide merge 18,183 18,095 1.00 -
· deep merge 17,867 17,893 1.00 +
· themed merge 32,323 32,376 1.00 +
necolas commented 3 weeks ago

This API is private implementation detail and shouldn't be exposed. We don't want arbitrary parts of the internals exposed, especially when some of these features will be built into native one day. I don't think the use case of trying to use stylex directly with RN is significant enough to introduce a significant change to the public API