cfuendev / twimba

CSS-in-JS for Imba's CSS syntax.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

font-weight / fw value unit is pixels in transpilation

cfuendev opened this issue · comments

While recreating some Chakra UI components from scratch to test the usability of the library, I came across this:

As you can see, since in my ignorance I made the macro turn any default values to px (Not only uses the wrong unit, but is also short-sighted), the value of font-weight is appended the "px" unit, which shouldn't happen because font-weight is just a number, not a size unit.

I will see if I can make this transpile step (Because it is a very specific step built into the macro) only apply to values related to units. Besides, I need to fix that pixels shouldn't be the default replaced value.

1/2/2023: Working on a fix rn. Hope to release it today!

3/2/2023: Well, that didn't go well lol. I lied, I had some other things keeping me busy so today I started debugging. Turns out that Imba uses 0.25rem as their default unit. Thet tasks would go as following:

  • Make it so that, when no unit is specified, values are parsed to ${value*0.25}rem.
  • Do not perform this transformation on font-weight / fw.

image

You'd be surprised of the wonders that a single piece of sweet bread and a Coronita do while coding. The first line had px:4 as the input that resulted in padding-left: 1rem and padding-right: 1rem, while the last line is the code that I was writing when I found this bug, which now works properly, resulting in font-weight:600 point blank.

Fixed. Will publish the patch shortly!

2279e72 fixed the problem
And the fixed npm package has been published as 0.3.1