alexbruf/elm-daisyui/1.0.0

Daisy.Render

Daisy.Tree -> Html.

This is the only module in the package that emits a class attribute, and every daisyUI class it emits comes from a Daisy.Schema.* value — a component, an entry of a parts list, or the result of a generated xToClass function. No daisyUI class name is written as a literal anywhere below.

Layout is not authorable. Every Tailwind utility the renderer may emit is a named constant listed in tokens, so spacing, column counts and chart height are fixed by the library rather than passed in per call.

Rendering

page : Page msg -> Html msg

Render a whole page.

The page root carries data-theme, so every daisyUI colour below it follows Page.theme.

Page.cta is placed by the shell and nowhere else:

  • Shell.Dashboard puts it at the end of the navbar (navbar-end).
  • Shell.Plain puts it at the end of the last section.

Overlays render after every section, inside one fixed wrapper, always in the order drawer, modal, toast, so stacking is decided once by the library. dock and fab render in the same fixed layer, after the overlays.

Lower-level renderers

Exposed so tests can render one node at a time. page is the only entry point an application needs.

section : Section msg -> Html msg

Render one section.

block : Block msg -> Html msg

Render one block, outside any footer.

leaf : Leaf msg -> Html msg

Render one leaf.

overlay : Overlay msg -> Html msg

Render one overlay. page always renders overlays in the order drawer, modal, toast, inside a single fixed wrapper, so an application never chooses a stacking order.

The calendar picker's state

Leaf.Calendar is the one leaf whose state the application has to keep, and these are the three constructors and the one update that go with it. They live here rather than in Daisy.Tree because they need the alexbruf/elm-cally Config record that this module builds out of Daisy.Tree.CalendarConfig — the same record Leaf.Calendar is rendered with, so paging and focus behave the same in update as they look in view. Daisy.Tree.setCalendarValue completes the loop on the way back.

initCalendarDate : CalendarConfig msg -> Maybe Date -> CalendarState

A single-date picker's starting state, focused on the value or on CalendarConfig.today.

initCalendarRange : CalendarConfig msg -> Maybe ( Date, Date ) -> CalendarState

A date-range picker's starting state. The pair is start-then-end and is always kept sorted by the picker.

initCalendarMulti : CalendarConfig msg -> List Date -> CalendarState

A multiple-date picker's starting state.

CalendarConfig msg
-> ( CalendarState, Cmd msg )

Advance the picker's own state.

Route every CalendarMsg your CalendarConfig.toMsg produced through here and run the returned command: it carries both the onChange callback and the Browser.Dom.focus call that the roving tabindex needs after an arrow key. The new selection arrives separately, as CalendarConfig.onChange; store it with Daisy.Tree.setCalendarValue.

A message for one kind of picker cannot act on another kind's state — the pair is impossible to build from a single Leaf.Calendar — so a mismatch is a no-op rather than a runtime error.

Class budget

tokens : List String

Every Tailwind utility Daisy.Render is allowed to emit.

RenderPurityTest asserts that every class the renderer produces is either in Daisy.Schema.allClasses or in this list. Each entry has a named constant in this module; nothing writes a utility inline.

unreachableClasses : List String

The daisyUI classes that no Daisy.Tree value can reach.

CoverageTest asserts that the classes emitted across all constructors equal Daisy.Schema.allClasses minus this list. Keeping it short is the point: four entries out of 554.