[elm-discuss] Maybe oneOf

2016-11-18 Thread Jacky See
from the commit message it says "oneOf is weird in a strict language because it will definitely do all the work. Would be good to have a use case that seems legitimate before adding this back." https://github.com/elm-lang/core/commit/5f43ad84532bd4d462edf5c1ec22b7a62352a2db Personally, I have se

Re: [elm-discuss] Localstorage data migration

2016-11-08 Thread Jacky
e app using Value instead of whatever >> you have now and create a series of Json Decoders for each version of the >> schema. >> You could then use Json.Decode.oneOf to produce the current structure >> from any of the old schemas. >> >> You could also use a schema

[elm-discuss] Localstorage data migration

2016-11-08 Thread Jacky See
I have an Elm app that would store the entire model into the local storage, using `programWithFlags` to feed in the data directly when `init`. As the app develop, more fields is added to the model so there will be model mismatch between localStorage and the new model and Elm would fail at the JS

Re: [elm-discuss] Changing root font size

2016-11-03 Thread Jacky
le" [ property "innerHTML" encodedStyles ] [] > > > On Thu, Nov 3, 2016 at 9:10 AM, Jacky See wrote: > >> Say you want to provide layout customization : Compact, Cozy, Comfortable >> (like in gmail) >> correspond to root font size 12px, 16px, 18px respecti

Re: [elm-discuss] Changing root font size

2016-11-03 Thread Jacky See
> > On Tue, Nov 1, 2016 at 9:22 PM, Jacky > > wrote: > >> For app that use `rem` for styling, the font size is set at html node >> >> html { font-size: 18px; } >> >> Is that the only way to control this value is by port and do it in js? >> --

[elm-discuss] Changing root font size

2016-11-01 Thread Jacky
For app that use `rem` for styling, the font size is set at html node html { font-size: 18px; } Is that the only way to control this value is by port and do it in js? -- Best Regards, Jacky See -- You received this message because you are subscribed to the Google Groups "Elm Di

[elm-discuss] How to preventDefault on keyup of a specific key?

2016-10-21 Thread Jacky See
In the js version of the code would look like el.addEventListener('keyup', function(ev){ if(ev.keyCode == 32){ ev.preventDefault(); } }); Can't seems to do that in current Html.Events.onWithOptions -- You received this message because you are subscribed to

Re: [elm-discuss] How to model a transient state?

2016-10-20 Thread Jacky
read and Marked. When the user > refreshes, you can map all the Marked items to Read. > > On Thu, Oct 20, 2016 at 12:43 AM, Jacky See wrote: > >> My current approach is to have a `readStateToBe` which contains the >> pending update state. >> and 'flush update

Re: [elm-discuss] Re: Re-position element once its dimension is known

2016-10-20 Thread Jacky
own menu into > the same div with its button? > > > On Thursday, October 20, 2016 at 10:08:55 AM UTC+2, Jacky See wrote: >> >> I'm doing some dropdown UI where I would like to re-calculate position of >> the element once it appeared on screen. >> Something like

[elm-discuss] Re-position element once its dimension is known

2016-10-20 Thread Jacky See
I'm doing some dropdown UI where I would like to re-calculate position of the element once it appeared on screen. Something like http://github.hubspot.com/drop/docs/welcome/ While I can get the triggering element position on click, I'm thinking how should get the offsetWidth/offsetHeight of the

Re: [elm-discuss] How to model a transient state?

2016-10-20 Thread Jacky See
My current approach is to have a `readStateToBe` which contains the pending update state. and 'flush update' (write `readStateToBe` to `readState`) on appropriate update branch (e.g. switching filter). -- You received this message because you are subscribed to the Google Groups "Elm Discuss" g

[elm-discuss] How to model a transient state?

2016-10-18 Thread Jacky See
Here is a simplified scenario: type alias Item = { text : String, readState : ReadState, ... } type ReadState = Read | Unread type alias Model = { items : List Item } In the item list view, there is a filter switch: All or Unread. When the 'Unread' switch is on, it lists all unread

Re: [elm-discuss] Re: Print date/time as text like '3 days ago'

2016-09-29 Thread Jacky
gt; To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/elm-discuss/G32oBI6yAxw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > elm-discuss+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optou

[elm-discuss] Print date/time as text like '3 days ago'

2016-09-29 Thread Jacky See
I'm wondering how can I print a date/time as '3 days ago' like this library http://timeago.yarp.com/ ? What I can think of is to use subscription and Time.every to pass current date time to model for rendering. Is it possible to update current date to model only when update function is called?

Re: [elm-discuss] Re: Child model change propagation problem in elm architecture

2016-08-17 Thread Jacky
it a view-only widget (a pure function), passing in the data and > message constructors it needs to fulfill its purpose. > > http://elm-lang.org/blog/blazing-fast-html#reusable-widgets > > The thread Magnus linked is a good read as well. > > > On Tuesday, August 16, 2016 at 9

[elm-discuss] Child model change propagation problem in elm architecture

2016-08-16 Thread Jacky See
Hi, I'm a new comer to elm. I try to build application using elm and have some problem on component. Suppose I'm building an BMI calculator, initially I have a model type alias Model = { weight:Int, height:Int } The rendering is just an two input[type=number]. The result is rendered by a p