[elm-discuss] Re: Again: which editor do you like best for Elm?

2017-02-02 Thread 'Andrew Radford' via Elm Discuss
Try elmjutsu if you haven't already.

On Thursday, 2 February 2017 16:53:59 UTC, Rupert Smith wrote:
>
> I'm currently using Atom.
>
> I see lots of new features are getting added to the Light-Table plug in 
> though...  (Right now I want to be able to preview what the Elm docs will 
> look like).
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Using Elm with existing UI controls

2017-02-02 Thread Eric G
Not a maintainer, but what about http://faq.elm-community.org/ ?

On Thursday, February 2, 2017 at 7:31:30 PM UTC-5, Joe Andaverde wrote:
>
> Elm maintainers: where would be the best place to document this use case? 
> I'd hate for this to be lost in a sea of threads.
>
> On Tuesday, January 31, 2017 at 10:41:51 AM UTC-6, Joe Andaverde wrote:
>>
>> The DOM could still be invalidated and redrawn at any time by 
>> virtual-dom. I haven't studied the code to see when it decides to recreate 
>> an element.
>>
>> On Monday, January 30, 2017 at 11:57:38 AM UTC-6, Josh Szmajda wrote:
>>>
>>> Do you think it's a viable alternate solution for now for an application 
>>> to not unload any elements connected via ports and simply to hide them 
>>> instead? Would certainly prefer your lifecycle events idea but thinking 
>>> about near-term workarounds..
>>>
>>> On Saturday, January 28, 2017 at 11:27:17 PM UTC-5, Joe Andaverde wrote:

 Statement: Elm is difficult to adopt for some groups because they 
 require UI controls that may be difficult or time-prohibitive to 
 re-implement.

 Current Approach: Use ports to initialize controls by passing the id of 
 a DOM element to use as the container.

 Problem: Using ports to wire UI controls can cause memory leaks because 
 there's no indication when a DOM element has been removed. When these DOM 
 elements disappear there's no way to clean up event handlers or other GC 
 roots.

 Due Diligence: I've put together an example of one type of memory leak 
 that's possible using a jQuery Date picker control:

 https://github.com/joeandaverde/elm-jquery-memory-leak

 The README contains a short gif of the memory leak in action.

 Solutions to being notified when a DOM element is created or removed 
 have been proposed in various (closed) issues in virtual-dom and this 
 list. 
 I understand these lifecycle hooks have been acknowledged as a useful 
 tool. 
 I propose that these lifecycle hooks are more than a convenience and 
 instead required in order to prevent memory leaks and aid adoption of Elm.




-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Using Elm with existing UI controls

2017-02-02 Thread Joe Andaverde
Elm maintainers: where would be the best place to document this use case? 
I'd hate for this to be lost in a sea of threads.

On Tuesday, January 31, 2017 at 10:41:51 AM UTC-6, Joe Andaverde wrote:
>
> The DOM could still be invalidated and redrawn at any time by virtual-dom. 
> I haven't studied the code to see when it decides to recreate an element.
>
> On Monday, January 30, 2017 at 11:57:38 AM UTC-6, Josh Szmajda wrote:
>>
>> Do you think it's a viable alternate solution for now for an application 
>> to not unload any elements connected via ports and simply to hide them 
>> instead? Would certainly prefer your lifecycle events idea but thinking 
>> about near-term workarounds..
>>
>> On Saturday, January 28, 2017 at 11:27:17 PM UTC-5, Joe Andaverde wrote:
>>>
>>> Statement: Elm is difficult to adopt for some groups because they 
>>> require UI controls that may be difficult or time-prohibitive to 
>>> re-implement.
>>>
>>> Current Approach: Use ports to initialize controls by passing the id of 
>>> a DOM element to use as the container.
>>>
>>> Problem: Using ports to wire UI controls can cause memory leaks because 
>>> there's no indication when a DOM element has been removed. When these DOM 
>>> elements disappear there's no way to clean up event handlers or other GC 
>>> roots.
>>>
>>> Due Diligence: I've put together an example of one type of memory leak 
>>> that's possible using a jQuery Date picker control:
>>>
>>> https://github.com/joeandaverde/elm-jquery-memory-leak
>>>
>>> The README contains a short gif of the memory leak in action.
>>>
>>> Solutions to being notified when a DOM element is created or removed 
>>> have been proposed in various (closed) issues in virtual-dom and this list. 
>>> I understand these lifecycle hooks have been acknowledged as a useful tool. 
>>> I propose that these lifecycle hooks are more than a convenience and 
>>> instead required in order to prevent memory leaks and aid adoption of Elm.
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Svg without getBBox?

2017-02-02 Thread Max Goldstein
Try it with ports. If that's helpful, it could possibly be added to the DOM 
package: https://github.com/elm-lang/dom

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Local third-party packages

2017-02-02 Thread Oliver Searle-Barnes
What do you think to using the version from the elm-package.json in the 
cloned repo? That way it's as though you'd specified a hard constraint in 
elm-package.json (e.g. 1.2 <= v <= 1.2) and then you can follow the usual 
semantics.


On Thursday, 2 February 2017 07:48:48 UTC+1, Gusztáv Szikszai wrote:
>
> Hey, author of elm-github-install here.
>
> it resolves the git ref then pulls the version number in from it's 
>> elm-package.json
>
> This is basically how it works and it adds the ref as the build number 
> `1.0.0+master` , so this way it tracks what version to resolve and what 
> code to use eventually.
>
> As I read this thread this morning, I realized that I can make the local 
> repositories work along with using different named repositories (forks) for 
> a package. I threw together a prof of concept for it:
> https://github.com/gdotdesign/elm-github-install/pull/14
>
> The basic method works:
> {
>   "dependencies": {
> "elm-lang/svg": "2.0.0 <= v < 3.0.0",
> "elm-lang/dom": "1.1.1 <= v < 2.0.0",
> "elm-lang/core": "5.0.0 <= v < 6.0.0"
>   },
>   "dependency-sources": {
> "elm-lang/core": {
>   "url": "file:///path-to/elm-lang/core",
>   "ref": "master"
> }
>   }
> }
>
> However I'm stuck a little and I would appreciate your thoughts on how to 
> handle transitive versions: what are the priorities when dealing with 
> different versions, this is what I am suggesting:
>
>- 2 - current packages dependency - if the current package (the one we 
>are installing dependencies for) sets a source it will be the one we use
>- 1 - packages dependency - if the current package doesn't have 
>dependency for a package but an other has we use that 
>- 0 - Github - if no package defines dependency for a package we fall 
>back to Github
>
> Let me know if you are trying this branch out.
>
> On Wednesday, February 1, 2017 at 10:57:43 PM UTC+1, Oliver Searle-Barnes 
> wrote:
>>
>> elm-github-install has a separate dependency-sources section which you 
>> can use to override the dependency versions. The readme has the following 
>> example
>>
>>   "dependencies": {
>> "gdotdesign/elm-install-test": "1.0.0 <= v < 2.0.0",
>> "elm-lang/core": "5.0.0 <= v < 6.0.0",
>> "elm-lang/svg": "2.0.0 <= v < 3.0.0",
>> "elm-lang/dom": "1.1.1 <= v < 2.0.0"
>>   },
>>   "dependency-sources": {
>> "elm-lang/core": "g...@github.com:elm-lang/core",
>> "gdotdesign/elm-install-test": {
>>   "url": "gdotdes...@bitbucket.org:gdotdesign/elm-install-test",
>>   "ref": "master"
>> }
>>   }
>>
>>
>> So you would specify your file:///uri in the "url" property and whatever 
>> git treeish value you want in "ref" (e.g. master). I'm not entirely sure 
>> how it works in the case that you override a transitive dependency. It may 
>> just ignore semantic versioning completely and use the version you've 
>> specified in the git reference or perhaps it resolves the git ref then 
>> pulls the version number in from it's elm-package.json. Because Elm uses a 
>> flat dependency structure specifying the dependency explicitly will be 
>> enough to constrain the transitive version as well.
>>
>>
>> On Wednesday, 1 February 2017 17:58:34 UTC+1, Rupert Smith wrote:
>>>
>>> On Wednesday, February 1, 2017 at 4:57:22 PM UTC, Rupert Smith wrote:

 This is actually something I have been wondering how to do because I 
 wanted to do some hacking on elm-lang/virtual-dom, but I have no idea how 
 to import the hacked version into another project in order to try it out.

>>>
>>> Also, one does not normally include elm-lang/virtual-dom explicitly, it 
>>> gets sucked in as a transitive dependency of elm-lang/html or elm-lang/svg. 
>>> Is it possible to override transitive dependencies? 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Again: which editor do you like best for Elm?

2017-02-02 Thread 'Rupert Smith' via Elm Discuss
I'm currently using Atom.

I see lots of new features are getting added to the Light-Table plug in 
though...  (Right now I want to be able to preview what the Elm docs will 
look like).

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] ANN: opensolid/geometry, a comprehensive 2D/3D geometry package for Elm

2017-02-02 Thread Duane Johnson
On Thu, Feb 2, 2017 at 9:11 AM, Ian Mackenzie 
wrote:

> Thanks Duane! You have have already noticed this in the README, but
> there's also an associated opensolid/svg
>  package...so
> if you used an OpenSolid Triangle2d value to define the shape of one of
> your HCCB triangles, you could then use OpenSolid.Svg.triangle2d to draw
> it as SVG (and supply whatever additional fill/stroke etc. attributes you
> want).
>
> Yes, that would be ideal.


> (By the way, what part of Canada are you from? I'm currently living in New
> York but I'm a Toronto native...)
>

Ha! I'm from BC but living in Utah.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] ANN: opensolid/geometry, a comprehensive 2D/3D geometry package for Elm

2017-02-02 Thread Ian Mackenzie
Thanks Duane! You have have already noticed this in the README, but there's 
also an associated opensolid/svg 
 package...so if 
you used an OpenSolid Triangle2d value to define the shape of one of your 
HCCB triangles, you could then use OpenSolid.Svg.triangle2d to draw it as 
SVG (and supply whatever additional fill/stroke etc. attributes you want).

(By the way, what part of Canada are you from? I'm currently living in New 
York but I'm a Toronto native...)

On Wednesday, 1 February 2017 15:47:47 UTC-5, Duane Johnson wrote:
>
> Nice work! I hope to use this in some of my projects (like the HCCB 
> package  
> I just released perhaps...)
>
> On Wed, Feb 1, 2017 at 10:31 AM, Ian Mackenzie  > wrote:
>
>> Just posted this to Reddit, but thought I should mention it here as well: 
>> http://package.elm-lang.org/packages/opensolid/geometry/latest
>>
>> I'd love to get feedback, and I'm happy to answer any questions!
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Elm Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to elm-discuss...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Detecting keypresses

2017-02-02 Thread Bernardo
Your code should work with a couple of changes. To receive the events the 
div should have the focus; divs normally don't have focus, so you need to 
add the attribute tabindex 0 to be able to focus the div. Also instead of 
the keypress event you should listen to keydown as keypress is only for 
printable characters.

On Thursday, 2 February 2017 04:23:31 UTC-3, Lyle Kopnicky wrote:
>
> Hi folks,
>
> I'm having trouble detecting keypresses in Elm 0.18. The only examples I 
> can find are old ones that use Signals. There are no examples in the Elm 
> Architecture Tutorial. The Html.Events module documentation shows a piece 
> of the puzzle with the example for onKeyUp.
>
> Heres a gist with the code: 
> https://gist.github.com/anonymous/5f54c2b2c8fb42a31d4ae37058a72e2a
>
> You can ignore the KaTeX import - that's not used at the moment.
>
> It compiles and runs, but the circle just sits there. I have know way of 
> knowing if it's detecting my keypresses. I thought that by putting the 
> event handler on the outer div, it would intercept keypresses. I didn't 
> have any way of adding handler to the svg element.
>
> BTW I also tried 'keyup' instead of 'keypress', and I tried making it 
> generate the MoveRight message for any key, just to make sure it wasn't bad 
> key code problem.
>
> Do I need to somehow attach the keypress handler to the document instead? 
> Perhaps I need to use a subscription? I'm not finding any guidance in the 
> docs. Any help would be appreciated.
>
> Thanks,
> Lyle
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Svg without getBBox?

2017-02-02 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, February 1, 2017 at 5:04:11 PM UTC, papl...@gmail.com wrote:
>
> I'm trying to create a simple SVG app (rectangle, text, arrow), but can't 
> seem to align them properly without getBBox (not even with monospaced 
> fonts).
> Is there really no way to get back any information from the browser 
> without a proper event?
>

The problem with just encoding a getBBox or getDimensions or getSize 
function in Elm is that it could return different values when called 
multiple times, so it is not really a function. However, you could use a 
port to ask for a size, and a subscription to get the result.

I have a similar issue where I want to get the size of a div, and have now 
worked out a solution using MutationObserver to watch for changes to the 
div and report its new size on every change.

So these kinds of queries do fit within the Elm model. Perhaps we could 
start asking for a proper 'effect' module to support these and other 
related queries.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Svg without getBBox?

2017-02-02 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, February 1, 2017 at 5:21:43 PM UTC, Christopher Anand wrote:
>
> I got better results by using centered alignment and fixed-width text. 
>  Embedding html in svg was so unreliable, I gave up on it, but it seems to 
> me that should be the right way of doing it.
>

There was also this discussion about text input in SVG, which is possible 
by emebdding html inputs within SVG. I was interested to hear how this 
goes, as it is something I will need to explore.

https://groups.google.com/forum/#!searchin/elm-discuss/svg%7Csort:date/elm-discuss/Mfbtoka5Pj0/cJamdgWoBQAJ

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Detecting keypresses

2017-02-02 Thread roovo
There is a Keyboard package which might work for you -> 'This library lets 
you listen to global keyboard events' 

http://package.elm-lang.org/packages/elm-lang/keyboard/1.0.1/Keyboard

although I seem to remember that I did have problems with event propagation 
when I was playing with it (in that I couldn't stop them from bubbling up 
the DOM).


On Thursday, February 2, 2017 at 7:23:31 AM UTC, Lyle Kopnicky wrote:
>
> Hi folks,
>
> I'm having trouble detecting keypresses in Elm 0.18. The only examples I 
> can find are old ones that use Signals. There are no examples in the Elm 
> Architecture Tutorial. The Html.Events module documentation shows a piece 
> of the puzzle with the example for onKeyUp.
>
> Heres a gist with the code: 
> https://gist.github.com/anonymous/5f54c2b2c8fb42a31d4ae37058a72e2a
>
> You can ignore the KaTeX import - that's not used at the moment.
>
> It compiles and runs, but the circle just sits there. I have know way of 
> knowing if it's detecting my keypresses. I thought that by putting the 
> event handler on the outer div, it would intercept keypresses. I didn't 
> have any way of adding handler to the svg element.
>
> BTW I also tried 'keyup' instead of 'keypress', and I tried making it 
> generate the MoveRight message for any key, just to make sure it wasn't bad 
> key code problem.
>
> Do I need to somehow attach the keypress handler to the document instead? 
> Perhaps I need to use a subscription? I'm not finding any guidance in the 
> docs. Any help would be appreciated.
>
> Thanks,
> Lyle
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.