marcelmorgan/domino-ui/1.0.0

Rerouted (cache, verified). The original is gone. This copy comes from a Lamdera package cache made before it went. The Lamdera package server serves a copy recovered from a Lamdera package cache from 2021-02-13.

What we checked: Rebuilt from the unpacked sources in a Lamdera package cache (5 copies agree), which Elm only writes after the published SHA-1 checked out; elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, so its SHA-1 is not the published one.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/marcelmorgan/domino-ui/zipball/1.0.0/

Game

This makes is possible to represent a domino game using elm

Definition

type Game

Represents a Game

Common Helpers

addChatMessage : Message -> Game -> Game

adds a new chat message to the player chat

clear the draft being composed usually as a result of a message being sent

close previously opened chat

composeChat : String -> Game -> Game

Updates the draft of the chat being composed

decoder : Player Name -> Viewport -> ConnectionStatus -> Decoder Game

Decodes a game from JSON representation

decoder (Me "nexus") { width = 100, height = 200, ...} Online == <Decoder Game>
encodePlay : Play -> Game -> Value

Encode a play with the game ID

encodePlay play game == <encoded-play>
errorToString : Error -> String

Returns the string representation of the game error

executeEvent : Event -> Game -> Result Error Game

Execute the event staged

getChatDraft : Game -> Maybe String

Returns the current chat draft being typed

getId : Game -> GameId

Returns the game id

getId game == 3
getTimesoutAt : Game -> Maybe Int

Returns the timeout for the current game

hasChat : Game -> Bool

Does this game have chat feature?

isResumable : Game -> Bool

Can this game be resumed? Useful in situations where the game has been dormant and the first player opens the game

Is this game set completed?

isUpdating : Game -> Bool

So we know if the game is currently updating. This is useful if we want to know if we can apply updates just received

Push selected back in the hand

moveSelectedBack game == game
moveSelectedBy : ( Float, Float ) -> Game -> Game

Move the selected domino by the delta provided

moveSelectedBy ( 3, 4 ) game == game

Returns the timeout if a next round is just started

nextRoundStartedTimeout game == Just 25

Opens the game chat

roundNextEvent : Game -> Maybe Event

Returns the next event for the current round

roundNextEvent game == Just event
Domino
-> List End
-> Game
-> Result Error ( Game, NonEmptyList Highlighter )

Select a domino for play

setConnectionStatus : ConnectionStatus -> Game -> Game

Sets the connection status of the user so the user can be alerted

Sets next game update usually as a result of a new game update receieved

setViewport : Maybe Viewport -> Game -> Game

Sets the viewport based on browser changes

slug : Game -> String

Returns the game slug useful for building a url

slug game == "3"
stageEvent : Event -> Game -> Game

Stage the event

Switch to the next game

Switch to the next round

updateDecoder : Game -> Decoder Game

Decodes an update of an existing game from one that was already decoded

view : Game -> Html (Msg Domino)

Produced the HTML representation of the game

view game == "<game-html>"