elm-athlete / athlete

💪 type safe elm-html-css-builder aka athlete

Home Page:https://package.elm-lang.org/packages/elm-athlete/athlete/6.0.1/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need for documentation : Style.block wrt. Dimensions & Overflow

opened this issue · comments

In the current state of athlete, one should call

Style.block [ Display.dimensions [...]]

and

Style.blockProperties [ Display.overflow [...]]

It appears as a naming inconsistency that is pretty much

  • impossible to guess since it does not seem to follow CSS logic (no blockProperty property)
  • really hard to resolve in the absence of usage documentation.

I had to analyze a dozen type signatures in the source code of athlete to find the blockProperty function.
This is not what you want when using a library.

Hello,

You are right. We'll do it when we can. If you want, you can write the doc as a base and we'll merge it.

I would gladly write a doc if I had the knowledge.

  • why blockProperties in addition to block in the first place ?
  • how to use block and blockProperties calls on the same node ?

It appears that
B.div [ Attr.style [ Style.block [ Display.overflow [...]]
but that
B.node [ Attr.style [ Style.block [ Display.overflow [...]]
is ok.

It has to do with the first argument of div being a Modifiers BlockAttributes and that of node being a Modifiers NodeAttributes, which in turn point to a difference of type in the block field.

Overflow being obviously a block attribute, I think something the current behaviour is incorrect. I lack the athlete knowledge to precise how it should work with node, however I am pretty sure it should be ok with div.

did you try

div [ style [ Style.blockProperties [ Display.overflow [...]] ]

?

Yes It tried and it works - it is actually the point reported initially in this issue.

The actual problem then (outside the lack of documentatio) is in the use of other block properties such as Display.dimensions, which are valid arguments for Style.block but not for Style.blockProperties.

I feel there is a rationale for all this - and probably a right way to organize the code - but I can't get my head around how it is supposed to work.

can you mention something that doesn't compile and should ?

Thank you again for your dedication :)