on master help sign in
Update non-essentials.
commitb021434799598e65ec863db38dbfce128a22b247 authorevancz <info@elm-lang.org> dateMon 22 Oct 2012, 00:22 (14 years ago) parent215315f
2 files changed+59−78
elm/changelog.txt+1−3 elm/elm-runtime-0.5.0.js+58−75
elm/changelog.txt+1−3
@@ -2,9 +2,7 @@
22Release 0.4.1
33=============
44
5−* Add Automaton library.
6−
7−* Add Dict and Set libraries.
5+* Add Automaton, Dict, and Set libraries.
86
97* Remove the library prefixes `Data.` and `Signal.` because they were
108 more confusing than helpful.
elm/elm-runtime-0.5.0.js+58−75
@@ -977,17 +977,53 @@ Elm.List = function() {
977977 take:take,
978978 drop:drop};
979979}();
980−try{
980+var Elm = Elm || {};
981+Elm.Maybe = function() {
982+ function consMaybe(x) { return function(xs) {
983+ if (x[0] === "Just") return ["Cons", x[1], xs];
984+ return xs;
985+ };
986+ }
987+ function fromMaybe(b) { return function(m) {
988+ if (m[0] === "Just") return m[1];
989+ return b;
990+ };
991+ }
992+ function mapCons(f) { return function(y) { return function(xs) {
993+ var x = f(y);
994+ if (x[0] === "Just") return ["Cons", x[1], xs];
995+ return xs;
996+ };
997+ };
998+ }
999+ function maybe(b) { return function(f) { return function(m) {
1000+ if (m[0] === "Just") return f(m[1]);
1001+ return b;
1002+ };
1003+ };
1004+ }
1005+
1006+ return {Just : function(x) { return ["Just",x]; },
1007+ Nothing : ["Nothing"],
1008+ catMaybes : Elm.List.foldr(consMaybe)(["Nil"]),
1009+ isJust : function(m) { return m[0] === "Just"; },
1010+ isNothing : function(m) { return m[0] === "Nothing"; },
1011+ fromMaybe : fromMaybe,
1012+ consMaybe : consMaybe,
1013+ mapMaybe : function(f) { return Elm.List.foldr(mapCons(f))(["Nil"]); },
1014+ maybe : maybe
1015+ };
1016+}();
1017+
1018+(function() {
9811019
9821020for(var i in Elm) { this[i] = Elm[i]; }
9831021if (Elm.Dict) throw "Module name collision, 'Dict' is already defined.";
9841022Elm.Dict=function(){
985− try{if (!(Elm.Prelude instanceof Object)) throw 'module not found'; } catch(e) {throw "Module 'Prelude' is missing. Compile with --make flag or load missing module in a separate JavaScript file.";}
9861023 var hiddenVars=[];
9871024 for(var i in Elm.Prelude){
9881025 if (hiddenVars.indexOf(i) >= 0) continue;
9891026 this[i]=Elm.Prelude[i];}
990− try{if (!(Elm.Maybe instanceof Object)) throw 'module not found'; } catch(e) {throw "Module 'Maybe' is missing. Compile with --make flag or load missing module in a separate JavaScript file.";}
9911027 var isJust=Elm.Maybe.isJust;
9921028 var Red_0=["Red"];
9931029 var Black_1=["Black"];
@@ -1456,15 +1492,11 @@ Elm.Dict=function(){
14561492 function fromList_42(assocs_235){
14571493 return List.foldl(uncurry(insert_20))(empty_4)(assocs_235);};
14581494 return {empty:empty_4,lookup:lookup_7,findWithDefault:findWithDefault_8,member:member_10,insert:insert_20,singleton:singleton_21,remove:remove_32,map:map_33,foldl:foldl_34,foldr:foldr_35,union:union_36,intersect:intersect_37,diff:diff_38,keys:keys_39,values:values_40,toList:toList_41,fromList:fromList_42};}();
1459−Elm.main=function(){
1460− return Elm.Dict.main;};
1461−} catch (e) {Elm.main=function() {var msg = ('<br/><h2>Your browser may not be supported. Are you using a modern browser?</h2>' + '<br/><span style="color:grey">Runtime Error in Dict module:<br/>' + e + '</span>');document.body.innerHTML = Text.monospace(msg);throw e;};}
1462−try{
1495+}());
1496+(function() {
14631497
14641498for(var i in Elm) { this[i] = Elm[i]; }
1465−if (Elm.Set) throw "Module name collision, 'Set' is already defined.";
14661499Elm.Set=function(){
1467− try{if (!(Elm.Prelude instanceof Object)) throw 'module not found'; } catch(e) {throw "Module 'Prelude' is missing. Compile with --make flag or load missing module in a separate JavaScript file.";}
14681500 var hiddenVars=[];
14691501 for(var i in Elm.Prelude){
14701502 if (hiddenVars.indexOf(i) >= 0) continue;
@@ -1498,9 +1530,7 @@ Elm.Set=function(){
14981530 return function(x){
14991531 return fromList_9(List.map(f_25)(x));}(toList_8(t_26));};};
15001532 return {empty:empty_0,singleton:singleton_1,insert:insert_2,remove:remove_3,member:member_4,union:union_5,intersect:intersect_6,diff:diff_7,toList:toList_8,fromList:fromList_9,foldl:foldl_10,foldr:foldr_11,map:map_12};}();
1501−Elm.main=function(){
1502− return Elm.Set.main;};
1503−} catch (e) {Elm.main=function() {var msg = ('<br/><h2>Your browser may not be supported. Are you using a modern browser?</h2>' + '<br/><span style="color:grey">Runtime Error in Set module:<br/>' + e + '</span>');document.body.innerHTML = Text.monospace(msg);throw e;};}
1533+}());
15041534var Elm = Elm || {};
15051535Elm.Char = function() {
15061536 function isBetween(lo,hi) { return function(chr) {
@@ -1526,44 +1556,6 @@ Elm.Char = function() {
15261556 };
15271557}();
15281558
1529−var Elm = Elm || {};
1530−Elm.Maybe = function() {
1531− function consMaybe(x) { return function(xs) {
1532− if (x[0] === "Just") return ["Cons", x[1], xs];
1533− return xs;
1534− };
1535− }
1536− function fromMaybe(b) { return function(m) {
1537− if (m[0] === "Just") return m[1];
1538− return b;
1539− };
1540− }
1541− function mapCons(f) { return function(y) { return function(xs) {
1542− var x = f(y);
1543− if (x[0] === "Just") return ["Cons", x[1], xs];
1544− return xs;
1545− };
1546− };
1547− }
1548− function maybe(b) { return function(f) { return function(m) {
1549− if (m[0] === "Just") return f(m[1]);
1550− return b;
1551− };
1552− };
1553− }
1554−
1555− return {Just : function(x) { return ["Just",x]; },
1556− Nothing : ["Nothing"],
1557− catMaybes : Elm.List.foldr(consMaybe)(["Nil"]),
1558− isJust : function(m) { return m[0] === "Just"; },
1559− isNothing : function(m) { return m[0] === "Nothing"; },
1560− fromMaybe : fromMaybe,
1561− consMaybe : consMaybe,
1562− mapMaybe : function(f) { return Elm.List.foldr(mapCons(f))(["Nil"]); },
1563− maybe : maybe
1564− };
1565−}();
1566−
15671559/*
15681560var String = function() {
15691561
@@ -1647,8 +1639,7 @@ var String = function() {
16471639
16481640var String = {toText:Value.toText, properEscape:Value.properEscape};
16491641var Elm = Elm || {};
1650−Elm.Graphics = Elm.Graphics || {};
1651−Elm.Graphics.Color = function() {
1642+Elm.Color = function() {
16521643 function Color_0(a1) {
16531644 return function(a2) {
16541645 return function(a3) {
@@ -1695,13 +1686,13 @@ function tracePoints(ctx,points) {
16951686
16961687function solid(ctx,color,points) {
16971688 tracePoints(ctx,points);
1698− ctx.strokeStyle = Elm.Graphics.Color.extract(color);
1689+ ctx.strokeStyle = Elm.Color.extract(color);
16991690 ctx.stroke();
17001691};
17011692
17021693function filled(ctx,color,points) {
17031694 tracePoints(ctx,points);
1704− ctx.fillStyle = Elm.Graphics.Color.extract(color);
1695+ ctx.fillStyle = Elm.Color.extract(color);
17051696 ctx.fill();
17061697}
17071698
@@ -1718,7 +1709,7 @@ function textured(redo,ctx,src,points) {
17181709function customLine(pattern,ctx,color,points) {
17191710 if (pattern.length === 0) { pattern = [8,4]; }
17201711 customLineHelp(ctx, pattern, points);
1721− ctx.strokeStyle = Elm.Graphics.Color.extract(color);
1712+ ctx.strokeStyle = Elm.Color.extract(color);
17221713 ctx.stroke();
17231714};
17241715
@@ -1991,8 +1982,7 @@ function insideShape(point,theta,scale,pos,points) {
19911982return {collage:collage, updateCollage:updateCollage, insideForm:insideForm};
19921983
19931984}();var Elm = Elm || {};
1994−Elm.Graphics = Elm.Graphics || {};
1995−Elm.Graphics.Element = function() {
1985+Elm.Graphics = function() {
19961986 var JS = Elm.JavaScript;
19971987 var DLeft_0 = ["DLeft"];
19981988 var DRight_1 = ["DRight"];
@@ -2506,7 +2496,8 @@ Elm.Graphics.Element = function() {
25062496 outlined:outlined_94, customOutline:customOutline_95, textured:textured, sprite:sprite_96, toForm:toForm_97, rotate:rotate_98, scale:scale_99, move:move_100,
25072497 isWithin: Collage.insideForm}
25082498}();
2509−var Text = function() {
2499+var Elm = Elm || {};
2500+Elm.Text = function() {
25102501 function fromString(s) { return Value.toText(s); }
25112502
25122503 var addTag = function(tag) { return function(text) {
@@ -2530,7 +2521,7 @@ var Text = function() {
25302521 var italic = addStyle('font-style', 'italic');
25312522 var bold = addTag('b');
25322523 var color = function(c) {
2533− return addStyle('color', Elm.Graphics.Color.extract(c));
2524+ return addStyle('color', Elm.Color.extract(c));
25342525 };
25352526 var underline = addStyle('text-decoration', 'underline');
25362527 var overline = addStyle('text-decoration', 'overline');
@@ -2555,9 +2546,6 @@ var Text = function() {
25552546 link : link };
25562547}();
25572548
2558−var Elm = Elm || {};
2559−Elm.Graphics.Text = Text;
2560−
25612549var Render = function(){
25622550
25632551function newElement(elementType) {
@@ -2736,7 +2724,7 @@ function render(elem) {
27362724 e.style.height = (~~elem[4]) + 'px';
27372725 if (elem[5] !== 1) { e.style.opacity = elem[5]; }
27382726 if (elem[6][0] === "Just") {
2739− e.style.backgroundColor = Elm.Graphics.Color.extract(elem[6][1]);
2727+ e.style.backgroundColor = Elm.Color.extract(elem[6][1]);
27402728 }
27412729 if (elem[7][0] === "Just") {
27422730 var a = newElement('a');
@@ -2822,7 +2810,7 @@ function update(node,curr,next) {
28222810 if (next[4] !== curr[4]) node.style.height = (~~next[4]) + 'px';
28232811 if (next[5] !== curr[5]) node.style.opacity = next[5];
28242812 if (next[6].length === 2) {
2825− var clr = Elm.Graphics.Color.extract(next[6][1]);
2813+ var clr = Elm.Color.extract(next[6][1]);
28262814 if (clr !== node.style.backgroundColor) node.style.backgroundColor = clr;
28272815 }
28282816 if (next[7].length === 2) {
@@ -3145,7 +3133,7 @@ Elm.Input = function() {
31453133 var opts = [];
31463134 while (options[0] === "Cons") {
31473135 var opt = newElement('option');
3148− var str = Text.toText(options[1][1]);
3136+ var str = Value.toText(options[1][1]);
31493137 opt.value = str;
31503138 opt.innerHTML = str;
31513139 slct.appendChild(opt);
@@ -3509,20 +3497,17 @@ Elm.Prelude = function() {
35093497 Elm.Prelude[i] = library[i];
35103498 }
35113499 };
3512− include (Elm.Graphics.Color);
3513− include (Elm.Graphics.Text);
3514− include (Elm.Graphics.Element);
3500+ include (Elm.Color);
3501+ include (Elm.Text);
3502+ include (Elm.Graphics);
35153503
35163504 show = Value.show;
35173505
35183506}());
3519−
3520−try{
3507+(function() {
35213508
35223509for(var i in Elm) { this[i] = Elm[i]; }
3523−if (Elm.Automaton) throw "Module name collision, 'Automaton' is already defined.";
35243510Elm.Automaton=function(){
3525− try{if (!(Elm.Prelude instanceof Object)) throw 'module not found'; } catch(e) {throw "Module 'Prelude' is missing. Compile with --make flag or load missing module in a separate JavaScript file.";}
35263511 var hiddenVars=[];
35273512 for(var i in Elm.Prelude){
35283513 if (hiddenVars.indexOf(i) >= 0) continue;
@@ -3702,6 +3687,4 @@ Elm.Automaton=function(){
37023687 function draggable_14(form_93){
37033688 return init__7(["Tuple2",Listen_9,form_93])(stepDrag_13);};
37043689 return {Automaton:Automaton_0,run:run_1,step:step_2,composeAuto:composeAuto_3,combine:combine_4,pure:pure_5,init:init_6,init_:init__7,count:count_8,Listen:Listen_9,Ignore:Ignore_10,DragFrom:DragFrom_11,vecSub:vecSub_12,stepDrag:stepDrag_13,draggable:draggable_14};}();
3705−Elm.main=function(){
3706− return Elm.Automaton.main;};
3707−} catch (e) {Elm.main=function() {var msg = ('<br/><h2>Your browser may not be supported. Are you using a modern browser?</h2>' + '<br/><span style="color:grey">Runtime Error in Automaton module:<br/>' + e + '</span>');document.body.innerHTML = Text.monospace(msg);throw e;};}
3690+}());