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

Rework examples #39

Closed upsiflu closed 11 months ago

upsiflu commented 11 months ago

Situation: Examples have no obvious logic or progression

Would be nice: Either an overview of all features or some sort of progressive tutorial, or both.

Nice example:

Questions:

  1. Sometimes, small examples next to the functions are nicer than a big example in the /test or /examples folder. Where's the boundary? Which features can be illustrated (and verified) inside the doc comments? Which ones should be part of the tutorial?

Scope of examples:

  1. Build an application without a persistent model
    • Let your view show in multiple regions
    • Progressive disclosure: toggle a property sheet
    • Let your user filter a list of items
    • Combine filters
    • Toggle across preset filters
  2. Nest a widget (example: elm-any-type-form) and persist the model state
    • Build an editor for shapes
    • Replace Control.views with your own property sheets
    • Persist your data with elm-multitool
  3. Build a non-Html Ui -> Milestone v2
    • Tui (...)
upsiflu commented 11 months ago

Ideas:

type Region = Toc | Main | Control | Output

In the view, we have a series of chapters. Each has associated md at Main and is wrapped in a goTo at Toc. In addition, togglebuttons may appear in the Toc under active pages. The Control region would have filters and filtered lists in the first chapter, and the shapes in the second chapter. The output region could appear just as we bring in elm-multitool and url-codec.

We can make very type-centric modules.

Perhaps we don't use shapes as examples but the md texts and examples that are displayed anyways. We could bring in elm-rte into the control for good measure... fun! In that case, the chapters go into the model and can be rearranged through elm-any-type-forms, and we can watch the Ui adapt in realtime. And we could have fulltext search!

upsiflu commented 11 months ago

A self-explaining example.

import markdown
import Less

main =
     Less.application
        { init = init
        , update = update
        , view =
          Less.mapDocument identity
            { body =
               Ui.singleton (md ```import markdown import Less etc.```)
             , layout = Less.Ui.Html.layout
             , title = "Less Ui feature test"
            }
        }
upsiflu commented 11 months ago

view = goTo { "chapter1" } chapter1 ++ goTo { "chapter2" } chapter2 ++ (Explanation text |> at Main) |> toggle { "Table of Contents" } |> at Toc

chapter1 =

chapter3 = (List with search results in the Main + fulltext search for the chapters in the toc + some preset filters)

chapter4 = TODO: Nesting (for elm-any-type-forms/multitool)

upsiflu commented 11 months ago

It's live. :-)