BodyBuilder.Router

Router based on BodyBuilder and Elegant implementing transitions between pages and history (backward and forward)


type alias History route msg =

{ before : List.List (BodyBuilder.Router.Page route msg), current : BodyBuilder.Router.Page route msg, after : List.List (BodyBuilder.Router.Page route msg), transition : Maybe.Maybe (BodyBuilder.Router.Transition route msg), standardHistoryWrapper : BodyBuilder.Router.StandardHistoryMsg -> msg, firstFrameHasBeenPainted : Basics.Bool }

Generic History type handling current page, before pages, after pages and current transition



type StandardHistoryMsg

= StandardHistoryMsg

[['Tick', ['Basics.Float']], ['Back', []], ['FocusMsg', ['Result.Result Browser.Dom.Error ()']]]

Standard History Messages type : Tick to handle transitions with RequestAnimationFrame Back to handle back buttons



type alias Page route msg =

{ maybeFocusedId : Maybe.Maybe String.String, maybeTransition : Maybe.Maybe (BodyBuilder.Router.Transition route msg), route : route }

Page type handling transition



type alias Transition route msg =

{ timer : Basics.Float, length : Basics.Float, kind : BodyBuilder.Router.Kind route msg, direction : BodyBuilder.Router.Direction, easing : BodyBuilder.Router.Easing }

Transition between 2 pages



type alias PageView route msg =

BodyBuilder.Router.Page route msg -> Maybe.Maybe (BodyBuilder.Router.Transition route msg) -> BodyBuilder.NodeWithStyle msg



type Direction

= Direction

[['Forward', []], ['Backward', []]]



type Easing

= Easing

[['EaseInOut', []], ['Linear', []]]



handleStandardHistory : BodyBuilder.Router.StandardHistoryMsg -> { a | history : BodyBuilder.Router.History route msg } -> ( { a | history : BodyBuilder.Router.History route msg }, Platform.Cmd.Cmd msg )

handle model's history update using historyMsg



maybeTransitionSubscription : BodyBuilder.Router.History route msg -> Platform.Sub.Sub msg

maybe transition subscription



initHistory : route -> (BodyBuilder.Router.StandardHistoryMsg -> msg) -> BodyBuilder.Router.History route msg

Init your history.



initHistoryAndData : route -> data -> (BodyBuilder.Router.StandardHistoryMsg -> msg) -> { history : BodyBuilder.Router.History route msg, data : data }

initialize history and data based on the routing system



push : BodyBuilder.Router.Page route msg -> BodyBuilder.Router.History route msg -> BodyBuilder.Router.History route msg

push a page into history



slideUp : BodyBuilder.Router.Transition route msg

slideUp transition



forward : BodyBuilder.Router.Direction



pageWithDefaultTransition : route -> BodyBuilder.Router.Page route msg

creates a page with the defaultTransition



pageWithTransition : BodyBuilder.Router.Transition route msg -> route -> BodyBuilder.Router.Page route msg

creates a page with a custom transition



pageWithoutTransition : route -> BodyBuilder.Router.Page route msg

creates a page without any transition



customTransition : Basics.Float -> BodyBuilder.Router.Kind route msg -> BodyBuilder.Router.Direction -> BodyBuilder.Router.Easing -> BodyBuilder.Router.Transition route msg



easeInOut : BodyBuilder.Router.Easing



customKind : (BodyBuilder.Router.History route msg -> (BodyBuilder.Router.Page route msg -> Maybe.Maybe (BodyBuilder.Router.Transition route msg) -> BodyBuilder.NodeWithStyle msg) -> BodyBuilder.NodeWithStyle msg) -> BodyBuilder.Router.Kind route msg



overflowHiddenContainer : Modifiers.Modifiers (BodyBuilder.Attributes.FlexContainerAttributes msg) -> List.List (BodyBuilder.FlexItem msg) -> BodyBuilder.NodeWithStyle msg



pageView : (a -> Maybe.Maybe (BodyBuilder.Router.Transition route msg) -> BodyBuilder.NodeWithStyle msg) -> Maybe.Maybe (BodyBuilder.Router.Transition route msg) -> a -> BodyBuilder.NodeWithStyle msg



beforeTransition : BodyBuilder.Router.History route msg -> List.List (BodyBuilder.Router.Page route msg)



percentage : Basics.Float -> Basics.Float



getMaybeTransitionValue : Maybe.Maybe (BodyBuilder.Router.Transition route msg) -> Basics.Float



afterTransition : BodyBuilder.Router.History route msg -> List.List (BodyBuilder.Router.Page route msg)



visiblePages : BodyBuilder.Router.History route msg -> List.List (BodyBuilder.Router.Page route msg)



focusedElement : String.String -> BodyBuilder.Router.Page route msg -> BodyBuilder.Router.Page route msg



basicDuration : number



slideUpView : BodyBuilder.Router.History route msg -> BodyBuilder.Router.PageView route msg -> BodyBuilder.NodeWithStyle msg



slideLeftView : BodyBuilder.Router.History route msg -> BodyBuilder.Router.PageView route msg -> BodyBuilder.NodeWithStyle msg



headerElement : { a | center : BodyBuilder.NodeWithStyle msg, left : BodyBuilder.NodeWithStyle msg, right : BodyBuilder.NodeWithStyle msg } -> BodyBuilder.NodeWithStyle msg

display header



pageWithHeader : BodyBuilder.NodeWithStyle msg -> BodyBuilder.NodeWithStyle msg -> BodyBuilder.NodeWithStyle msg



headerButton : msg -> String.String -> BodyBuilder.NodeWithStyle msg

display button



historyView : (BodyBuilder.Router.Page route msg -> Maybe.Maybe (BodyBuilder.Router.Transition route msg) -> BodyBuilder.NodeWithStyle msg) -> BodyBuilder.Router.History route msg -> BodyBuilder.NodeWithStyle msg

display the current possible transition from one page to the other using the history and its own routing system



mobileMeta : BodyBuilder.NodeWithStyle msg

meta tag for a correct display on mobile devices