aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elm-package.json13
-rw-r--r--src/Main.elm22
-rw-r--r--src/Model/Edition/Edition.elm4
-rw-r--r--src/Model/Edition/NameEdition.elm2
-rw-r--r--src/Model/Edition/TimeEdition.elm8
-rw-r--r--src/Model/IdGenerator.elm2
-rw-r--r--src/Model/Model.elm12
-rw-r--r--src/Model/Position.elm2
-rw-r--r--src/Model/Timer.elm4
-rw-r--r--src/Update/Update.elm32
-rw-r--r--src/Update/UpdateEdition.elm6
-rw-r--r--src/Update/UpdateTimer.elm8
-rw-r--r--src/View/ActivatedClasses.elm2
-rw-r--r--src/View/Timer.elm49
-rw-r--r--src/View/View.elm20
15 files changed, 92 insertions, 94 deletions
diff --git a/elm-package.json b/elm-package.json
index 9a8a7ea..995d8e9 100644
--- a/elm-package.json
+++ b/elm-package.json
@@ -2,14 +2,13 @@
"version": "0.0.1",
"summary": "",
"description": "",
+ "repository": "https://github.com/guyonvarch/timer.git",
"license": "BSD3",
- "source-directories": [
- "src"
- ],
+ "source-directories": ["src"],
"exposed-modules": [],
+ "elm-version": "0.15.0 <= v < 0.16.0",
"dependencies": {
- "elm-lang/core": "1.0.0 <= v < 2.0.0",
- "evancz/elm-html": "1.0.0 <= v < 2.0.0"
- },
- "repository": "https://github.com/guyonvarch/timer.git"
+ "elm-lang/core": "2.0.1 <= v < 3.0.0",
+ "evancz/elm-html": "3.0.0 <= v < 4.0.0"
+ }
}
diff --git a/src/Main.elm b/src/Main.elm
index b84a3ae..746df14 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -3,22 +3,22 @@ module Main
) where
import Signal
-import Html (Html)
-import Time (..)
+import Html exposing (Html)
+import Time exposing (..)
import Mouse
-import Json.Encode (Value)
+import Json.Encode exposing (Value)
import Keyboard
import Char
import Dict
import List
-import Keyboard (KeyCode)
+import Keyboard exposing (KeyCode)
-import Model.Model (..)
-import Model.Position (..)
-import Model.TimerState (..)
-import Model.Id (..)
-import Update.Update (..)
-import View.View (view)
+import Model.Model exposing (..)
+import Model.Position exposing (..)
+import Model.TimerState exposing (..)
+import Model.Id exposing (..)
+import Update.Update exposing (..)
+import View.View exposing (view)
main : Signal Html
main = Signal.map view model
@@ -29,7 +29,7 @@ model = Signal.foldp logUpdate (initialModel initialTime) input
input : Signal Action
input =
Signal.mergeMany
- [ Signal.subscribe updates
+ [ actions.signal
, Signal.map DeltaTime (fps 30)
, Signal.map KeyPressed keyPress
]
diff --git a/src/Model/Edition/Edition.elm b/src/Model/Edition/Edition.elm
index be7aa02..9a28253 100644
--- a/src/Model/Edition/Edition.elm
+++ b/src/Model/Edition/Edition.elm
@@ -6,10 +6,10 @@ module Model.Edition.Edition
, isEmpty
) where
-import Keyboard (KeyCode)
+import Keyboard exposing (KeyCode)
import String
-import Model.Id (..)
+import Model.Id exposing (..)
import Model.Edition.NameEdition as NameEdition
import Model.Edition.TimeEdition as TimeEdition
diff --git a/src/Model/Edition/NameEdition.elm b/src/Model/Edition/NameEdition.elm
index 89e5441..be7c6b3 100644
--- a/src/Model/Edition/NameEdition.elm
+++ b/src/Model/Edition/NameEdition.elm
@@ -4,7 +4,7 @@ module Model.Edition.NameEdition
) where
import Char
-import Keyboard (KeyCode)
+import Keyboard exposing (KeyCode)
import String
import List
diff --git a/src/Model/Edition/TimeEdition.elm b/src/Model/Edition/TimeEdition.elm
index 2ba1628..3b70c3d 100644
--- a/src/Model/Edition/TimeEdition.elm
+++ b/src/Model/Edition/TimeEdition.elm
@@ -4,15 +4,15 @@ module Model.Edition.TimeEdition
, toMinutesAndSeconds
) where
-import Time (Time)
+import Time exposing (Time)
import List
import Array
import String
-import Keyboard (KeyCode)
+import Keyboard exposing (KeyCode)
import Char
-import Utils.List (..)
-import Utils.Maybe (..)
+import Utils.List exposing (..)
+import Utils.Maybe exposing (..)
keyCodeToChar : KeyCode -> Maybe Char
keyCodeToChar code =
diff --git a/src/Model/IdGenerator.elm b/src/Model/IdGenerator.elm
index ba760d8..9001191 100644
--- a/src/Model/IdGenerator.elm
+++ b/src/Model/IdGenerator.elm
@@ -4,7 +4,7 @@ module Model.IdGenerator
, getId
) where
-import Model.Id (..)
+import Model.Id exposing (..)
type alias IdGenerator =
{ counter : Id
diff --git a/src/Model/Model.elm b/src/Model/Model.elm
index c45300b..a660b16 100644
--- a/src/Model/Model.elm
+++ b/src/Model/Model.elm
@@ -4,15 +4,15 @@ module Model.Model
, numberOfTimers
) where
-import Dict (Dict)
+import Dict exposing (Dict)
import Dict
-import Time (Time)
+import Time exposing (Time)
import List
-import Model.Timer (..)
-import Model.Edition.Edition (..)
-import Model.Id (..)
-import Model.IdGenerator (..)
+import Model.Timer exposing (..)
+import Model.Edition.Edition exposing (..)
+import Model.Id exposing (..)
+import Model.IdGenerator exposing (..)
type alias Model =
{ currentTime : Time
diff --git a/src/Model/Position.elm b/src/Model/Position.elm
index b73a3d9..d15e853 100644
--- a/src/Model/Position.elm
+++ b/src/Model/Position.elm
@@ -2,7 +2,7 @@ module Model.Position
( positionEncoder
) where
-import Json.Encode (..)
+import Json.Encode exposing (..)
positionEncoder : (Int, Int) -> Value
positionEncoder (x, y) =
diff --git a/src/Model/Timer.elm b/src/Model/Timer.elm
index 35850fc..20c0ea8 100644
--- a/src/Model/Timer.elm
+++ b/src/Model/Timer.elm
@@ -5,9 +5,9 @@ module Model.Timer
) where
import List
-import Time (Time)
+import Time exposing (Time)
-import Model.TimerState (..)
+import Model.TimerState exposing (..)
type alias Timer =
{ creationTime : Time
diff --git a/src/Update/Update.elm b/src/Update/Update.elm
index 2f4d7a4..b4cf741 100644
--- a/src/Update/Update.elm
+++ b/src/Update/Update.elm
@@ -1,32 +1,32 @@
module Update.Update
( Action(..)
- , updates
+ , actions
, logUpdate
, update
) where
import Signal
import Dict
-import Dict (Dict)
-import Time (Time)
+import Dict exposing (Dict)
+import Time exposing (Time)
import Maybe
-import Keyboard (KeyCode)
+import Keyboard exposing (KeyCode)
import Char
import List
import Debug
-import Model.Model (..)
-import Model.Timer (..)
-import Model.Edition.Edition (..)
-import Model.Edition.NameEdition (..)
-import Model.Edition.TimeEdition (..)
-import Model.Id (..)
-import Model.IdGenerator (..)
+import Model.Model exposing (..)
+import Model.Timer exposing (..)
+import Model.Edition.Edition exposing (..)
+import Model.Edition.NameEdition exposing (..)
+import Model.Edition.TimeEdition exposing (..)
+import Model.Id exposing (..)
+import Model.IdGenerator exposing (..)
-import Update.UpdateTimer (..)
-import Update.UpdateEdition (..)
+import Update.UpdateTimer exposing (..)
+import Update.UpdateEdition exposing (..)
-import Utils.Maybe (..)
+import Utils.Maybe exposing (..)
type Action =
NoOp
@@ -39,8 +39,8 @@ type Action =
| ClickAway
| KeyPressed KeyCode
-updates : Signal.Channel Action
-updates = Signal.channel NoOp
+actions : Signal.Mailbox Action
+actions = Signal.mailbox NoOp
logUpdate : Action -> Model -> Model
logUpdate action model =
diff --git a/src/Update/UpdateEdition.elm b/src/Update/UpdateEdition.elm
index d94bd1e..47b0e22 100644
--- a/src/Update/UpdateEdition.elm
+++ b/src/Update/UpdateEdition.elm
@@ -4,11 +4,11 @@ module Update.UpdateEdition
) where
import Char
-import Char (KeyCode)
+import Char exposing (KeyCode)
-import Model.Edition.Edition (..)
+import Model.Edition.Edition exposing (..)
-import Utils.List (..)
+import Utils.List exposing (..)
type EditionAction =
DeleteLast
diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm
index 30603cd..49593d0 100644
--- a/src/Update/UpdateTimer.elm
+++ b/src/Update/UpdateTimer.elm
@@ -3,11 +3,11 @@ module Update.UpdateTimer
, updateTimer
) where
-import Time (Time)
+import Time exposing (Time)
-import Model.Timer (..)
-import Model.TimerState (..)
-import Model.Id (..)
+import Model.Timer exposing (..)
+import Model.TimerState exposing (..)
+import Model.Id exposing (..)
type TimerAction =
Rename String
diff --git a/src/View/ActivatedClasses.elm b/src/View/ActivatedClasses.elm
index 9594448..85b0841 100644
--- a/src/View/ActivatedClasses.elm
+++ b/src/View/ActivatedClasses.elm
@@ -3,7 +3,7 @@ module View.ActivatedClasses
) where
import Html
-import Html.Attributes (..)
+import Html.Attributes exposing (..)
import List
import String
diff --git a/src/View/Timer.elm b/src/View/Timer.elm
index a88f9dd..c4b3bbb 100644
--- a/src/View/Timer.elm
+++ b/src/View/Timer.elm
@@ -2,29 +2,29 @@ module View.Timer
( timerView
) where
-import Html (..)
-import Html.Attributes (..)
-import Html.Events (..)
-import Time (Time)
+import Html exposing (..)
+import Html.Attributes exposing (..)
+import Html.Events exposing (..)
+import Time exposing (Time)
import Signal
import Maybe
import List
import String
-import Model.Model (..)
-import Model.Timer (..)
-import Model.Edition.Edition (..)
-import Model.Edition.NameEdition (..)
-import Model.Edition.TimeEdition (..)
-import Model.TimerState (..)
-import Model.Id (..)
+import Model.Model exposing (..)
+import Model.Timer exposing (..)
+import Model.Edition.Edition exposing (..)
+import Model.Edition.NameEdition exposing (..)
+import Model.Edition.TimeEdition exposing (..)
+import Model.TimerState exposing (..)
+import Model.Id exposing (..)
-import Update.Update (..)
-import Update.UpdateTimer (..)
+import Update.Update exposing (..)
+import Update.UpdateTimer exposing (..)
-import View.ActivatedClasses (..)
+import View.ActivatedClasses exposing (..)
-import Utils.Maybe (..)
+import Utils.Maybe exposing (..)
timerView : Model -> (Id, Timer) -> Html
timerView model (id, timer) =
@@ -41,7 +41,7 @@ nameBlockReadOnly : Id -> Timer -> Html
nameBlockReadOnly id timer =
div
[ class "name block"
- , onClick (Signal.send updates (Edit id Name))
+ , onClick actions.address (Edit id Name)
]
[ text (timerName id timer) ]
@@ -52,7 +52,7 @@ nameBlockEdition id timer edition =
, (isEmpty edition, "empty")
]
|> activatedClasses
- , onClick (Signal.send updates NoOp)
+ , onClick actions.address NoOp
]
[ if isEmpty edition
then
@@ -75,10 +75,9 @@ timeBlockReadOnly id timer =
, (timer.state == Running, "isRunning")
]
|> activatedClasses
- , onClick
- <| if timer.state == Ringing
- then Signal.send updates (UpdateTimer id Stop)
- else Signal.send updates (Edit id Time)
+ , if timer.state == Ringing
+ then onClick actions.address (UpdateTimer id Stop)
+ else onClick actions.address (Edit id Time)
]
[ timeWithProgressBar timer ]
@@ -89,7 +88,7 @@ timeBlockEdition timer edition =
, (isEmpty edition, "empty")
]
|> activatedClasses
- , onClick (Signal.send updates NoOp)
+ , onClick actions.address NoOp
]
[ if isEmpty edition
then
@@ -134,7 +133,7 @@ playPauseBlock : (Id, Timer) -> Html
playPauseBlock (id, timer) =
button
[ class <| "playPause block"
- , onClick (Signal.send updates (UpdateTimer id ToggleRunning))
+ , onClick actions.address (UpdateTimer id ToggleRunning)
]
[ let icon = if timer.state == Running then "fa-pause" else "fa-play"
in i
@@ -146,7 +145,7 @@ stopBlock : (Id, Timer) -> Html
stopBlock (id, timer) =
button
[ class <| "stop block"
- , onClick (Signal.send updates (UpdateTimer id Stop))
+ , onClick actions.address (UpdateTimer id Stop)
]
[ i [ class "fa fa-fw fa-stop" ] [] ]
@@ -154,7 +153,7 @@ removeBlock : (Id, Timer) -> Html
removeBlock (id, timer) =
button
[ class <| "remove block"
- , onClick (Signal.send updates (RemoveTimer id))
+ , onClick actions.address (RemoveTimer id)
]
[ i [ class "fa fa-fw fa-remove" ] [] ]
diff --git a/src/View/View.elm b/src/View/View.elm
index 0500610..b3d1dcc 100644
--- a/src/View/View.elm
+++ b/src/View/View.elm
@@ -2,21 +2,21 @@ module View.View
( view
) where
-import Html (..)
-import Html.Attributes (..)
-import Html.Events (..)
+import Html exposing (..)
+import Html.Attributes exposing (..)
+import Html.Events exposing (..)
import Signal
import List
import Dict
import Json.Decode as Json
-import Model.Model (..)
-import Model.Timer (..)
-import Model.Id (..)
+import Model.Model exposing (..)
+import Model.Timer exposing (..)
+import Model.Id exposing (..)
-import Update.Update (..)
+import Update.Update exposing (..)
-import View.Timer (timerView)
+import View.Timer exposing (timerView)
view : Model -> Html
view model =
@@ -35,12 +35,12 @@ title =
div
[ class "headerBar" ]
[ button
- [ onClick (Signal.send updates Initialize)
+ [ onClick actions.address Initialize
, class "title"
]
[ text "Timer" ]
, button
- [ onClick (Signal.send updates AddNewTimer)
+ [ onClick actions.address AddNewTimer
, class "addTimer"
]
[ i