on master help sign in
Make sure Mouse, Random, Window, and Time import their native implementation.
1552651evancz
libraries/Mouse.elm+2
@@ -1,6 +1,8 @@
1
1
2module Mouse where
2module Mouse where
3
3
4+import Native.Mouse
5+
4-- The current mouse position.
6-- The current mouse position.
5position : Signal (Int,Int)
7position : Signal (Int,Int)
6
8
libraries/Native/Graphics/Text.js+6−2
@@ -10,6 +10,7 @@ Elm.Native.Graphics.Text = function(elm) {
10 var htmlHeight = Elm.Native.Utils(elm).htmlHeight;
10 var htmlHeight = Elm.Native.Utils(elm).htmlHeight;
11 var Color = Elm.Native.Graphics.Color(elm);
11 var Color = Elm.Native.Graphics.Color(elm);
12 var Element = Elm.Graphics.Element(elm);
12 var Element = Elm.Graphics.Element(elm);
13+ var show = Elm.Native.Show(elm).show;
13
14
14 function makeSpaces(s) {
15 function makeSpaces(s) {
15 if (s.length == 0) { return s; }
16 if (s.length == 0) { return s; }
@@ -66,6 +67,9 @@ Elm.Native.Graphics.Text = function(elm) {
66 function typeface(name, text) {
67 function typeface(name, text) {
67 return addStyle('font-family', JS.fromString(name), text);
68 return addStyle('font-family', JS.fromString(name), text);
68 }
69 }
70+ function monospace(text) {
71+ return addStyle('font-family', 'monospace', text);
72+ }
69 function size(px, text) { return addStyle('font-size', px + 'px', text) }
73 function size(px, text) { return addStyle('font-size', px + 'px', text) }
70 var header = addTag('h1');
74 var header = addTag('h1');
71 function height(h, text) { return addStyle('font-size', hf+'em', text) }
75 function height(h, text) { return addStyle('font-size', hf+'em', text) }
@@ -94,7 +98,7 @@ Elm.Native.Graphics.Text = function(elm) {
94 }
98 }
95
99
96 function asText(v) {
100 function asText(v) {
97− return position('left')(typeface('monospace', toText(show(v))));
101+ return position('left')(monospace(toText(show(v))));
98 }
102 }
99
103
100 return elm.Native.Graphics.Text = {
104 return elm.Native.Graphics.Text = {
@@ -107,7 +111,7 @@ Elm.Native.Graphics.Text = function(elm) {
107 underline : underline,
111 underline : underline,
108 overline : overline,
112 overline : overline,
109 strikeThrough : strikeThrough,
113 strikeThrough : strikeThrough,
110− monospace : function(text) { return typeface('monospace', text) },
114+ monospace : monospace,
111 typeface : F2(typeface),
115 typeface : F2(typeface),
112 color : F2(color),
116 color : F2(color),
113 link : F2(link),
117 link : F2(link),
libraries/Random.elm+2
@@ -1,6 +1,8 @@
1
1
2module Random where
2module Random where
3
3
4+import Native.Random
5+
4-- Given a range from low to high and a signal of values, this produces
6-- Given a range from low to high and a signal of values, this produces
5-- a new signal that changes whenever the input signal changes. The new
7-- a new signal that changes whenever the input signal changes. The new
6-- values are random number between 'low' and 'high' inclusive.
8-- values are random number between 'low' and 'high' inclusive.
libraries/Time.elm+2
@@ -3,6 +3,8 @@
3
3
4module Time where
4module Time where
5
5
6+import Native.Time
7+
6type Time = Float
8type Time = Float
7
9
8-- Units of time, making it easier to specify things like a
10-- Units of time, making it easier to specify things like a
libraries/Window.elm+2
@@ -1,6 +1,8 @@
1
1
2module Window where
2module Window where
3
3
4+import Native.Mouse
5+
4-- The current dimensions of the window (i.e. the area viewable to the
6-- The current dimensions of the window (i.e. the area viewable to the
5-- user, not including scroll bars).
7-- user, not including scroll bars).
6dimensions : Signal (Int,Int)
8dimensions : Signal (Int,Int)