module Main ( main ) where import Signal import Html (Html) import Time (..) import Mouse import Json.Encode (Value) import Keyboard import Char import Dict import List import Model.Model (..) import Model.Position (..) import Model.TimerState (..) import Model.Id (..) import Update.Update (..) import View.View (view) main : Signal Html main = Signal.map view model model : Signal Model model = Signal.foldp update (initialModel initialTime) input input : Signal Action input = Signal.mergeMany [ Signal.subscribe updates , Signal.map DeltaTime (fps 30) , Signal.map (\_ -> ClickAway) clickAway , Signal.map KeyPressed Keyboard.lastPressed ] port clickPosition : Signal Value port clickPosition = Signal.sampleOn Mouse.clicks (Signal.map positionEncoder Mouse.position) port ringingTimers : Signal Bool port ringingTimers = Signal.map (\model -> model.timers |> Dict.toList |> List.map snd |> List.any (\timer -> timer.state == Ringing) ) model |> Signal.dropRepeats port clickAway : Signal () port initialTime : Time