Skip to content

Commit

Permalink
Post 0.19 debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeboudon committed Aug 22, 2018
1 parent accfe29 commit 095873b
Show file tree
Hide file tree
Showing 14 changed files with 1,449 additions and 146 deletions.
2 changes: 1 addition & 1 deletion demo/09-Slider.elm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ view model =

main : Program () Int msg
main =
Builder.embed
Builder.element
{ init = \_ -> ( 0, Cmd.none )
, update = \msg model -> ( model, Cmd.none )
, subscriptions = always Sub.none
Expand Down
81 changes: 0 additions & 81 deletions demo/test.elm

This file was deleted.

15 changes: 0 additions & 15 deletions elm-package.json

This file was deleted.

14 changes: 9 additions & 5 deletions elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "elm-athlete/athlete",
"summary": "Native looking apps builder on the web",
"license": "BSD-3-Clause",
"version": "2.0.0",
"version": "1.0.0",
"exposed-modules": [
"Modifiers",
"Elegant",
Expand Down Expand Up @@ -34,7 +34,11 @@
"BodyBuilder.Events",
"BodyBuilder.Router",
"BodyBuilder.Style",
"BodyBuilder.Elements.DateTimePicker"
"BodyBuilder.Elements.DateTimePicker",
"Color",
"Color.Convert",
"Color.Interpolate",
"Color.Manipulate"
],
"elm-version": "0.19.0 <= v < 0.20.0",
"dependencies": {
Expand All @@ -43,15 +47,15 @@
"elm/html": "1.0.0 <= v < 2.0.0",
"elm/json": "1.0.0 <= v < 2.0.0",
"elm/parser": "1.0.0 <= v < 2.0.0",
"elm/regex": "1.0.0 <= v < 2.0.0",
"elm/time": "1.0.0 <= v < 2.0.0",
"elm/url": "1.0.0 <= v < 2.0.0",
"elm/virtual-dom": "1.0.0 <= v < 2.0.0",
"elm-athlete/color": "1.0.0 <= v < 2.0.0",
"elm-community/dict-extra": "2.3.1 <= v < 3.0.0",
"elm-community/list-extra": "8.0.0 <= v < 9.0.0",
"justinmimbs/date": "1.0.0 <= v < 2.0.0",
"mpizenberg/elm-pointer-events": "3.0.0 <= v < 4.0.0",
"toastal/either": "4.0.0 <= v < 5.0.0"
"toastal/either": "3.5.0 <= v < 4.0.0"
},
"test-dependencies": {}
}
}
2 changes: 1 addition & 1 deletion src/BodyBuilder/Elements/DateTimePicker.elm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import Elegant.Margin as Margin
import Elegant.Typography as Typography
import Function
import Time exposing (Month(..), Posix, Zone)
import Events.Extra.Touch as Touch
import Html.Events.Extra.Touch as Touch


---- CONSTANTS ----
Expand Down
2 changes: 1 addition & 1 deletion src/BodyBuilder/Elements/WheelPicker.elm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import Elegant.Typography as Typography
import Function
import Task
import Time exposing (Posix, Zone, utc)
import Events.Extra.Touch as Touch
import Html.Events.Extra.Touch as Touch
import Tuple


Expand Down
44 changes: 23 additions & 21 deletions src/BodyBuilder/Internals/Convert.elm
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,19 @@ toElegantStyle flexModifiers flexItemModifiers gridModifiers gridItemModifiers b
, computedBoxDetails = computedBoxDetails
}
in
separatedComponentsToElegantStyle
computedFlexContainerDetails
computedFlexItemDetails
computedGridContainerDetails
computedGridItemDetails
computedBlockDetails
computedBoxDetails
separatedComponentsToElegantStyle
computedFlexContainerDetails
computedFlexItemDetails
computedGridContainerDetails
computedGridItemDetails
computedBlockDetails
computedBoxDetails


groupByStyleSelectorAndCompute : a -> List ( Modifiers a, Attributes.StyleSelector ) -> List ( Attributes.StyleSelector, a )
groupByStyleSelectorAndCompute default =
List.Extra.groupWhile (\x y -> Tuple.second x == Tuple.second y)
>> List.map (\( a, list ) -> a :: list)
>> List.concatMap mergeModifiersAndSwap
>> List.map (Tuple.mapSecond (\modifiers -> Function.compose modifiers default))

Expand Down Expand Up @@ -139,6 +140,7 @@ separatedComponentsToElegantStyle flexModifiers flexItemModifiers gridModifiers
|> insertStyleComponents (Just boxModifiers) setMediaBox
|> Dict.values
|> List.Extra.groupWhile samePseudoClass
|> List.map (\( a, list ) -> a :: list)
|> List.map (componentsToElegantStyle (Maybe.Extra.isJust blockModifiers) (Maybe.Extra.isJust flexModifiers) (Maybe.Extra.isJust gridModifiers))


Expand Down Expand Up @@ -180,7 +182,7 @@ serializeStyleSelector styleSelector =
Just pc ->
"pseudoClass:Just " ++ pc
in
media_ ++ " | " ++ pseudoClass_
media_ ++ " | " ++ pseudoClass_


appendInStyleComponent :
Expand All @@ -193,14 +195,14 @@ appendInStyleComponent setter ( styleSelector, elem ) results =
key =
serializeStyleSelector styleSelector
in
Dict.get key results
|> Maybe.Extra.unwrap
(defaultStyleComponents
|> setter elem
|> Tuple.pair styleSelector
)
(Tuple.mapSecond (setter elem))
|> Function.flip (Dict.insert key) results
Dict.get key results
|> Maybe.Extra.unwrap
(defaultStyleComponents
|> setter elem
|> Tuple.pair styleSelector
)
(Tuple.mapSecond (setter elem))
|> Function.flip (Dict.insert key) results


samePseudoClass :
Expand All @@ -227,11 +229,11 @@ componentsToElegantStyle isBlock isFlex isGrid components =
computedDisplay =
List.map (componentsToParameteredDisplayBox isBlock isFlex isGrid) components
in
computedDisplay
|> List.Extra.find noMediaQueries
|> Maybe.Extra.unwrap Elegant.emptyStyle (Tuple.second >> Elegant.style)
|> Maybe.Extra.unwrap identity Elegant.setSuffix suffix
|> Elegant.withScreenWidth (List.concatMap toScreenWidth computedDisplay)
computedDisplay
|> List.Extra.find noMediaQueries
|> Maybe.Extra.unwrap Elegant.emptyStyle (Tuple.second >> Elegant.style)
|> Maybe.Extra.unwrap identity Elegant.setSuffix suffix
|> Elegant.withScreenWidth (List.concatMap toScreenWidth computedDisplay)


componentsToParameteredDisplayBox :
Expand Down
48 changes: 27 additions & 21 deletions src/BodyBuilder/Router.elm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pages and history (backward and forward)
@docs pageWithHeader
@docs headerButton
@docs historyView
@docs mobileMeta
-}

Expand Down Expand Up @@ -656,24 +657,24 @@ standardHandleHistory historyMsg history =
newTransition =
transition |> timeDiff diff
in
if newTransition.timer > 0 then
( { history | transition = Just newTransition }, Cmd.none )
else
( { history | transition = Nothing }
, case history.currentPageHasFocusElement of
False ->
Cmd.none

True ->
case history.current.maybeFocusedId of
Nothing ->
Cmd.none

Just maybeFocusedId_ ->
Task.attempt
(FocusMsg >> history.standardHistoryWrapper)
(Browser.Dom.focus maybeFocusedId_)
)
if newTransition.timer > 0 then
( { history | transition = Just newTransition }, Cmd.none )
else
( { history | transition = Nothing }
, case history.currentPageHasFocusElement of
False ->
Cmd.none

True ->
case history.current.maybeFocusedId of
Nothing ->
Cmd.none

Just maybeFocusedId_ ->
Task.attempt
(FocusMsg >> history.standardHistoryWrapper)
(Browser.Dom.focus maybeFocusedId_)
)


{-| handle model's history update using historyMsg
Expand Down Expand Up @@ -771,10 +772,15 @@ headerButton msg content =
]


{-| meta tag for a correct display on mobile devices
-}
mobileMeta : NodeWithStyle msg
mobileMeta =
(Html.node "meta"
( Html.node "meta"
[ Html.Attributes.name "viewport"
, Html.Attributes.attribute "content"
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
]
[], [])
[]
, []
)

0 comments on commit 095873b

Please sign in to comment.