upsiflu / less-ui

Write your views across several screen regions, and hide all Ui state in the Url.
https://package.elm-lang.org/packages/upsiflu/less-ui/latest
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Unsupported use case: `elm-w3` #21

Open upsiflu opened 1 year ago

upsiflu commented 1 year ago

Use case:

Consider ol

ol :
    List
        ( GlobalAttributes
            { reversed : SupportedAttribute
            , start : SupportedAttribute
            , type_list : SupportedAttribute
            }
            msg
        )
    -> List 
        ( Node
            { li : Supported } 
            msg
        )
    -> Node
        { compatible | ol : Supported } 
        msg
ol = node "ol"

and li (followingt html.spec.whatwg.org/li)

li :
    List 
        ( GlobalAttributes 
            { value_ordinal : SupportedAttribute } 
            msg
        )
    -> List 
        ( Node
            FlowContent 
            msg
        )
    -> node
            { compatible | li : Supported } 
            msg
li = node "li"

Both are Nodes:

type Node nodes msg
    = Node String (List (VirtualDom.Attribute msg)) (List (VirtualDom.Node msg))
    | Keyed String (List (VirtualDom.Attribute msg)) (List ( String, VirtualDom.Node msg ))
    | Lazy (VirtualDom.Node msg)
    | Text String

Now, if we want to render a Ui nodes msg then there are two ways the type restrictions should kick in:

  1. wrap

    wrap : wrapper -> Ui .. html attribute wrapper -> Ui .. html attribute wrapper 
  2. toggle (same with bounce and goTo)

    List attribute
    ->
          { flag : State.Flag
          , isInline : Bool
          , label : html
          }
       -> Ui aspect html attribute wrapper
       -> Ui aspect html attribute wrapper

Discussion:

Perhaps it's more nuanced. If I ++ two Uis and both render some html at the same region, their constraints combine. (...)