miyamoen/elm-command-pallet/1.0.0

CommandPallet

A command pallet component.

Model

type Model msg

Contains a current state for a command pallet.

init : (Msg -> msg) -> List ( String, msg ) -> Model msg

Accepts Msg converter function and your commands.

CommandPallet.init CommandPalletMsg
    [ ( "Increment", Increment )
    , ( "Decrement", Decrement )
    , ( "1", Set 1 )
    , ( "11", Set 11 )
    , ( "123", Set 123 )
    , ( "151", Set 151 )
    , ( "100", Set 100 )
    , ( "101", Set 101 )
    , ( "900", Set 900 )
    ]

View

inFront : Model msg -> Attribute msg

Attribute in elm-ui.

Use like below:

layout [ CommandPallet.inFront model.commandPallet ] <|
    column [] [ text "your application..." ]
html : Model msg -> Html msg

View function with Html

Update

type alias Msg =
Msg

Needs to be passed to update.

update : Msg -> Model msg -> ( Model msg, Cmd msg )

Returns a new Model and a parent Cmd msg.

Startup

subscriptions : Model msg -> Sub msg

Subsciption for startup key, p.

subscriptionsWithKey : Key -> Model msg -> Sub msg

Customizable subsciption for startup key.

Key type is in SwiftsNamesake/proper-keyboard.

showUpMsg : Msg

Use showUpMsg in your application and customize command pallet startup.