stylex icon indicating copy to clipboard operation
stylex copied to clipboard

[babel-plugin] Do not compile logical styles into `ltr` and `rtl` equivalents.

Open nmn opened this issue 1 year ago • 4 comments

Currently, when using styleResolution: 'legacy-expand-shorthands', CSS logical properties are compiled into two ltr and rtl equivalent CSS rules.

All new browsers natively support logical CSS properties, so we should just use those.

The one exception is border-*-*-radius, which is not supported in older browsers. In that case, we should polyfill it after CSS generation if it makes sense.

nmn avatar Oct 15 '24 23:10 nmn

I hope this will be made a top priority.

mobalti avatar Dec 02 '24 16:12 mobalti

@mobalti Could you please explain why this is a priority for you? styleResolution: 'legacy-expand-shorthands' is something that no one should be using and it's a setting that we use internally for esoteric reasons.

If you use any other value for styleResolution we already do not generate separate ltr and rtl styles.

Do you have a usecase for using styleResolution: 'legacy-expand-shorthands' in your own codebase?

nmn avatar Dec 04 '24 21:12 nmn

I thought this issue was related to a discussion I started a few months ago about why the library converts all logical properties to their physical equivalents, such as changing "block-size" to "height" and "inline-size" to "width."

It would be helpful if the library offered an option to disable this feature because logical properties represent how we think when we design with CSS, not just browser behavior.

Thank you for considering this.

mobalti avatar Dec 04 '24 22:12 mobalti

the library converts all logical properties to their physical equivalents, such as changing "block-size" to "height" and "inline-size" to "width."

@mobalti This is not completely accurate. Logical styles such as margin-inline-start etc are preserved. The current limitation is that StyleX does not support vertical writing modes. Logical styles along the horizontal axis are fully supported.

We are planning to fix this limitation.

nmn avatar Dec 04 '24 23:12 nmn