├── source ├── minify │ ├── package.js │ ├── minify.bat │ └── minify.sh ├── boot │ ├── package.js │ ├── enyo.js │ ├── boot.js │ └── loader.js ├── package.js ├── ajax │ ├── package.js │ ├── json.js │ ├── cookie.js │ ├── xhr.js │ ├── Async.js │ └── Ajax.js ├── touch │ ├── Scroller.css │ ├── package.js │ ├── ScrollStrategy.js │ ├── touch.js │ ├── TouchScrollStrategy.js │ ├── Scroller.js │ └── ScrollMath.js ├── dom │ ├── package.js │ ├── dom.css │ ├── dom.js │ ├── drag.js │ ├── gesture.js │ └── Dispatcher.js └── kernel │ ├── package.js │ ├── Layout.js │ ├── Signals.js │ ├── macroize.js │ ├── animation.js │ ├── log.js │ ├── Object.js │ ├── UiComponent.js │ ├── Oop.js │ └── lang.js ├── tools ├── minifier │ ├── node_modules │ │ ├── uglify-js │ │ │ ├── test │ │ │ │ ├── unit │ │ │ │ │ ├── compress │ │ │ │ │ │ ├── test │ │ │ │ │ │ │ ├── issue20.js │ │ │ │ │ │ │ ├── issue53.js │ │ │ │ │ │ │ ├── issue69.js │ │ │ │ │ │ │ ├── issue16.js │ │ │ │ │ │ │ ├── issue27.js │ │ │ │ │ │ │ ├── with.js │ │ │ │ │ │ │ ├── issue48.js │ │ │ │ │ │ │ ├── null_string.js │ │ │ │ │ │ │ ├── issue29.js │ │ │ │ │ │ │ ├── issue11.js │ │ │ │ │ │ │ ├── issue28.js │ │ │ │ │ │ │ ├── issue34.js │ │ │ │ │ │ │ ├── issue4.js │ │ │ │ │ │ │ ├── issue30.js │ │ │ │ │ │ │ ├── array1.js │ │ │ │ │ │ │ ├── issue17.js │ │ │ │ │ │ │ ├── issue54.1.js │ │ │ │ │ │ │ ├── issue9.js │ │ │ │ │ │ │ ├── if.js │ │ │ │ │ │ │ ├── issue10.js │ │ │ │ │ │ │ ├── strict-equals.js │ │ │ │ │ │ │ ├── var.js │ │ │ │ │ │ │ ├── issue21.js │ │ │ │ │ │ │ ├── array3.js │ │ │ │ │ │ │ ├── issue14.js │ │ │ │ │ │ │ ├── issue68.js │ │ │ │ │ │ │ ├── array2.js │ │ │ │ │ │ │ ├── mangle.js │ │ │ │ │ │ │ ├── concatstring.js │ │ │ │ │ │ │ ├── ifreturn.js │ │ │ │ │ │ │ ├── empty-blocks.js │ │ │ │ │ │ │ ├── issue25.js │ │ │ │ │ │ │ ├── issue13.js │ │ │ │ │ │ │ ├── array4.js │ │ │ │ │ │ │ ├── const.js │ │ │ │ │ │ │ ├── forstatement.js │ │ │ │ │ │ │ ├── assignment.js │ │ │ │ │ │ │ ├── issue50.js │ │ │ │ │ │ │ ├── ifreturn2.js │ │ │ │ │ │ │ └── whitespace.js │ │ │ │ │ │ └── expected │ │ │ │ │ │ │ ├── issue20.js │ │ │ │ │ │ │ ├── var.js │ │ │ │ │ │ │ ├── const.js │ │ │ │ │ │ │ ├── issue27.js │ │ │ │ │ │ │ ├── issue53.js │ │ │ │ │ │ │ ├── issue69.js │ │ │ │ │ │ │ ├── with.js │ │ │ │ │ │ │ ├── if.js │ │ │ │ │ │ │ ├── issue16.js │ │ │ │ │ │ │ ├── issue30.js │ │ │ │ │ │ │ ├── issue48.js │ │ │ │ │ │ │ ├── issue9.js │ │ │ │ │ │ │ ├── issue4.js │ │ │ │ │ │ │ ├── array1.js │ │ │ │ │ │ │ ├── issue17.js │ │ │ │ │ │ │ ├── null_string.js │ │ │ │ │ │ │ ├── ifreturn.js │ │ │ │ │ │ │ ├── issue11.js │ │ │ │ │ │ │ ├── issue21.js │ │ │ │ │ │ │ ├── issue28.js │ │ │ │ │ │ │ ├── issue29.js │ │ │ │ │ │ │ ├── issue34.js │ │ │ │ │ │ │ ├── whitespace.js │ │ │ │ │ │ │ ├── issue10.js │ │ │ │ │ │ │ ├── issue25.js │ │ │ │ │ │ │ ├── issue54.1.js │ │ │ │ │ │ │ ├── strict-equals.js │ │ │ │ │ │ │ ├── issue68.js │ │ │ │ │ │ │ ├── array3.js │ │ │ │ │ │ │ ├── mangle.js │ │ │ │ │ │ │ ├── array2.js │ │ │ │ │ │ │ ├── concatstring.js │ │ │ │ │ │ │ ├── array4.js │ │ │ │ │ │ │ ├── issue14.js │ │ │ │ │ │ │ ├── empty-blocks.js │ │ │ │ │ │ │ ├── issue50.js │ │ │ │ │ │ │ ├── assignment.js │ │ │ │ │ │ │ ├── ifreturn2.js │ │ │ │ │ │ │ ├── forstatement.js │ │ │ │ │ │ │ └── issue13.js │ │ │ │ │ └── scripts.js │ │ │ │ └── beautify.js │ │ │ ├── .gitignore │ │ │ ├── package.json │ │ │ ├── uglify-js.js │ │ │ ├── tmp │ │ │ │ ├── hoist.js │ │ │ │ ├── test.js │ │ │ │ ├── instrument.js │ │ │ │ └── instrument2.js │ │ │ ├── docstyle.css │ │ │ └── lib │ │ │ │ ├── squeeze-more.js │ │ │ │ └── object-ast.js │ │ └── walker.js │ └── minify.js ├── node.exe ├── api │ ├── favicon.ico │ ├── images │ │ ├── close.png │ │ ├── icons.png │ │ ├── enyo-logo.png │ │ ├── icons-24.png │ │ ├── search-24.png │ │ ├── protected-8.png │ │ ├── tab-gradient.png │ │ └── tab-active-gradient.png │ └── index.html ├── test │ ├── tests │ │ ├── package.js │ │ ├── KindTest.js │ │ ├── langTest.js │ │ ├── AjaxTest.js │ │ ├── AsyncTest.js │ │ └── DecodePackagePathTest.js │ ├── index.html │ ├── test.css │ └── test.js ├── minify.sh └── minify.bat ├── examples ├── 2 - Making a Package │ ├── source │ │ ├── HelloWorld.css │ │ ├── package.js │ │ └── HelloWorld.js │ └── index.html ├── 3 - Making Builds │ ├── source │ │ ├── HelloWorld.css │ │ ├── minify │ │ │ ├── package.js │ │ │ └── minify.bat │ │ ├── package.js │ │ ├── minify-include-enyo │ │ │ ├── package.js │ │ │ └── minify.bat │ │ └── HelloWorld.js │ └── index.html ├── 1 - Making a Kind │ ├── HelloWorld.js │ └── index.html └── 0 - Hello World │ └── index.html ├── .gitignore ├── enyo.js ├── README.md └── LICENSE-2.0.txt /source/minify/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "../boot", 3 | "../" 4 | ); 5 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue20.js: -------------------------------------------------------------------------------- 1 | {a: 1} -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue20.js: -------------------------------------------------------------------------------- 1 | a:1 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/var.js: -------------------------------------------------------------------------------- 1 | var a=1,b=2 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/const.js: -------------------------------------------------------------------------------- 1 | var a=13,b=1/3 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue27.js: -------------------------------------------------------------------------------- 1 | (a?b:c)?d:e -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue53.js: -------------------------------------------------------------------------------- 1 | x=(y,z) 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue69.js: -------------------------------------------------------------------------------- 1 | [(a,b)] 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/with.js: -------------------------------------------------------------------------------- 1 | with({}); 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue53.js: -------------------------------------------------------------------------------- 1 | x = (y, z) 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue69.js: -------------------------------------------------------------------------------- 1 | [(a,b)] 2 | -------------------------------------------------------------------------------- /tools/node.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/node.exe -------------------------------------------------------------------------------- /examples/2 - Making a Package/source/HelloWorld.css: -------------------------------------------------------------------------------- 1 | .bigfont { 2 | font-size: x-large; 3 | }; -------------------------------------------------------------------------------- /examples/3 - Making Builds/source/HelloWorld.css: -------------------------------------------------------------------------------- 1 | .bigfont { 2 | font-size: x-large; 3 | }; -------------------------------------------------------------------------------- /source/boot/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "enyo.js", 3 | "loader.js", 4 | "boot.js" 5 | ); -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/if.js: -------------------------------------------------------------------------------- 1 | var a=1;a==1?a=2:a=17 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue16.js: -------------------------------------------------------------------------------- 1 | var a=3250441966 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue30.js: -------------------------------------------------------------------------------- 1 | var a=8,b=4,c=4 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue48.js: -------------------------------------------------------------------------------- 1 | var s,i;s="",i=0 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue9.js: -------------------------------------------------------------------------------- 1 | var a={a:1,b:2} -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue16.js: -------------------------------------------------------------------------------- 1 | var a = 0xC1BDCEEE; -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue27.js: -------------------------------------------------------------------------------- 1 | (a ? b : c) ? d : e -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/with.js: -------------------------------------------------------------------------------- 1 | with({}) { 2 | }; 3 | -------------------------------------------------------------------------------- /examples/3 - Making Builds/source/minify/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "../package.js" 3 | ); 4 | -------------------------------------------------------------------------------- /source/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "kernel", 3 | "ajax", 4 | "dom", 5 | "touch" 6 | ); 7 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .tmp*~ 3 | *.local.* 4 | .pinf-* -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue4.js: -------------------------------------------------------------------------------- 1 | var a=2e3,b=.002,c=2e-5 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue48.js: -------------------------------------------------------------------------------- 1 | var s, i; s = ''; i = 0; -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/null_string.js: -------------------------------------------------------------------------------- 1 | var nullString = "\0" -------------------------------------------------------------------------------- /tools/api/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/favicon.ico -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/array1.js: -------------------------------------------------------------------------------- 1 | [],Array(1),[1,2,3] 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue17.js: -------------------------------------------------------------------------------- 1 | var a=function(b){b(),a()} -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/null_string.js: -------------------------------------------------------------------------------- 1 | var nullString="\0" -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js: -------------------------------------------------------------------------------- 1 | function a(a){return a==1?2:17} -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue11.js: -------------------------------------------------------------------------------- 1 | new(A,B),new(A||B),new(X?A:B) -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue21.js: -------------------------------------------------------------------------------- 1 | var a=0;switch(a){case 0:a++} -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue28.js: -------------------------------------------------------------------------------- 1 | o={".5":.5},o={.5:.5},o={.5:.5} -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue29.js: -------------------------------------------------------------------------------- 1 | result=function(){return 1}() -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue34.js: -------------------------------------------------------------------------------- 1 | var a={};a["this"]=1,a.that=2 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/whitespace.js: -------------------------------------------------------------------------------- 1 | function id(a){return a} 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue29.js: -------------------------------------------------------------------------------- 1 | result=(function(){ return 1;})() -------------------------------------------------------------------------------- /examples/3 - Making Builds/source/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "HelloWorld.css", 3 | "HelloWorld.js" 4 | ); 5 | -------------------------------------------------------------------------------- /tools/api/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/images/close.png -------------------------------------------------------------------------------- /tools/api/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/images/icons.png -------------------------------------------------------------------------------- /examples/2 - Making a Package/source/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "HelloWorld.css", 3 | "HelloWorld.js" 4 | ); 5 | -------------------------------------------------------------------------------- /tools/api/images/enyo-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/images/enyo-logo.png -------------------------------------------------------------------------------- /tools/api/images/icons-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/images/icons-24.png -------------------------------------------------------------------------------- /tools/api/images/search-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/images/search-24.png -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue10.js: -------------------------------------------------------------------------------- 1 | function f(){var a;return(a="a")?a:a}f() -------------------------------------------------------------------------------- /examples/3 - Making Builds/source/minify-include-enyo/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "$enyo/source", 3 | ".." 4 | ); 5 | -------------------------------------------------------------------------------- /source/ajax/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "Async.js", 3 | "json.js", 4 | "cookie.js", 5 | "xhr.js", 6 | "Ajax.js" 7 | ); -------------------------------------------------------------------------------- /tools/api/images/protected-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/images/protected-8.png -------------------------------------------------------------------------------- /tools/api/images/tab-gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/images/tab-gradient.png -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue25.js: -------------------------------------------------------------------------------- 1 | label1:{label2:break label2;console.log(1)} -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js: -------------------------------------------------------------------------------- 1 | foo+"",a.toString(16),b.toString.call(c) 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js: -------------------------------------------------------------------------------- 1 | typeof a=="string",b+""!=c+"",d> 1; 3 | var c = 8 >>> 1; -------------------------------------------------------------------------------- /source/touch/Scroller.css: -------------------------------------------------------------------------------- 1 | .enyo-scroller { 2 | overflow: hidden; 3 | } 4 | 5 | .enyo-touch-scroller { 6 | overflow: hidden; 7 | } -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/array3.js: -------------------------------------------------------------------------------- 1 | (function(){function a(){}return new a(1,2,3,4)})() 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/mangle.js: -------------------------------------------------------------------------------- 1 | (function(){var a=function b(a,b,c){return b}})() 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/array1.js: -------------------------------------------------------------------------------- 1 | new Array(); 2 | new Array(1); 3 | new Array(1, 2, 3); 4 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue17.js: -------------------------------------------------------------------------------- 1 | var a = function(b) { 2 | b(); 3 | a() 4 | } 5 | -------------------------------------------------------------------------------- /tools/api/images/tab-active-gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/enyo/master/tools/api/images/tab-active-gradient.png -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/array2.js: -------------------------------------------------------------------------------- 1 | (function(){var a=function(){};return new a(1,2,3,4)})() 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue54.1.js: -------------------------------------------------------------------------------- 1 | foo.toString(); 2 | a.toString(16); 3 | b.toString.call(c); 4 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/concatstring.js: -------------------------------------------------------------------------------- 1 | var a=a+"a"+"b"+1+c,b=a+"c"+"ds"+123+c,c=a+"c"+123+d+"ds"+c -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue9.js: -------------------------------------------------------------------------------- 1 | var a = { 2 | a: 1, 3 | b: 2, // <-- trailing comma 4 | }; 5 | -------------------------------------------------------------------------------- /examples/1 - Making a Kind/HelloWorld.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "HelloWorld", 3 | kind: enyo.Control, 4 | content: "Hello World from Enyo" 5 | }); -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/array4.js: -------------------------------------------------------------------------------- 1 | (function(){function a(){}(function(){return new a(1,2,3)})()})() 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/if.js: -------------------------------------------------------------------------------- 1 | var a = 1; 2 | if (a == 1) { 3 | a = 2; 4 | } else { 5 | a = 17; 6 | } 7 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue10.js: -------------------------------------------------------------------------------- 1 | function f() { var a; if (a = 'a') { return a; } else { return a; } }; f(); -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/strict-equals.js: -------------------------------------------------------------------------------- 1 | typeof a === 'string' 2 | b + "" !== c + "" 3 | d < e === f < g 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /source/minify/build 3 | /examples/3 - Making Builds/source/minify/build 4 | /examples/3 - Making Builds/source/minify-include-enyo/build -------------------------------------------------------------------------------- /source/dom/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "dom.css", 3 | "dom.js", 4 | "Control.js", 5 | "Dispatcher.js", 6 | "gesture.js", 7 | "drag.js" 8 | ); 9 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/var.js: -------------------------------------------------------------------------------- 1 | // var declarations after each other should be combined 2 | var a = 1; 3 | var b = 2; -------------------------------------------------------------------------------- /examples/2 - Making a Package/source/HelloWorld.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "HelloWorld", 3 | kind: enyo.Control, 4 | content: "Hello World from Enyo" 5 | }); -------------------------------------------------------------------------------- /examples/3 - Making Builds/source/HelloWorld.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "HelloWorld", 3 | kind: enyo.Control, 4 | content: "Hello World from Enyo" 5 | }); -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue21.js: -------------------------------------------------------------------------------- 1 | var a = 0; 2 | switch(a) { 3 | case 0: 4 | a++; 5 | break; 6 | } -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue14.js: -------------------------------------------------------------------------------- 1 | var a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"} 2 | -------------------------------------------------------------------------------- /tools/test/tests/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "langTest.js", 3 | "KindTest.js", 4 | "AsyncTest.js", 5 | "AjaxTest.js", 6 | "DecodePackagePathTest.js" 7 | ); 8 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js: -------------------------------------------------------------------------------- 1 | function bar(){return--x}function foo(){while(bar());}function mak(){for(;;);}var x=5 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/array3.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | return new Array(1, 2, 3, 4); 3 | function Array() {}; 4 | })(); 5 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue14.js: -------------------------------------------------------------------------------- 1 | var a = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'}; -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue68.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | if (a) return; 3 | g(); 4 | function g(){} 5 | }; 6 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue50.js: -------------------------------------------------------------------------------- 1 | function bar(a){try{foo()}catch(b){alert("Exception caught (foo not defined)")}alert(a)}bar(10) 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/array2.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var Array = function(){}; 3 | return new Array(1, 2, 3, 4); 4 | })(); 5 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/mangle.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var x = function fun(a, fun, b) { 3 | return fun; 4 | }; 5 | }()); 6 | -------------------------------------------------------------------------------- /source/touch/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "touch.js", 3 | "ScrollMath.js", 4 | "ScrollStrategy.js", 5 | "TouchScrollStrategy.js", 6 | "Scroller.js", 7 | "Scroller.css" 8 | ); -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/assignment.js: -------------------------------------------------------------------------------- 1 | a=1,b=a,c=1,d=b,e=d,longname=2;if(longname+1){x=3;if(x)var z=7}z=1,y=1,x=1,g+=1,h=g,++i,j=i,i++,j=i+17 -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js: -------------------------------------------------------------------------------- 1 | function x(a){return typeof a=="object"?a:a===42?0:a*2}function y(a){return typeof a=="object"?a:null} 2 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/concatstring.js: -------------------------------------------------------------------------------- 1 | var a = a + "a" + "b" + 1 + c; 2 | var b = a + "c" + "ds" + 123 + c; 3 | var c = a + "c" + 123 + d + "ds" + c; -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/ifreturn.js: -------------------------------------------------------------------------------- 1 | function a(b) { 2 | if (b == 1) { 3 | return 2; 4 | } else { 5 | return 17; 6 | } 7 | 8 | return 3; 9 | } -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/forstatement.js: -------------------------------------------------------------------------------- 1 | a=func(),b=z;for(a++;i<10;i++)alert(i);var z=1;g=2;for(;i<10;i++)alert(i);var a=2;for(var i=1;i<10;i++)alert(i) -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js: -------------------------------------------------------------------------------- 1 | var x = 5; 2 | function bar() { return --x; } 3 | function foo() { while (bar()); } 4 | function mak() { for(;;); } 5 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue25.js: -------------------------------------------------------------------------------- 1 | label1 : { 2 | label2 : { 3 | break label2; 4 | console.log(2); 5 | } 6 | console.log(1); 7 | } -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/expected/issue13.js: -------------------------------------------------------------------------------- 1 | var a=/^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#])(?::(\d))?)?(..?$|(?:[^?#\/]\/))([^?#]*)(?:\?([^#]))?(?:#(.))?/ -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue13.js: -------------------------------------------------------------------------------- 1 | var a = /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#])(?::(\d))?)?(..?$|(?:[^?#\/]\/))([^?#]*)(?:\?([^#]))?(?:#(.))?/; -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/array4.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | (function(){ 3 | return new Array(1, 2, 3); 4 | })(); 5 | function Array(){}; 6 | })(); 7 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/const.js: -------------------------------------------------------------------------------- 1 | // test that the calculation is fold to 13 2 | var a = 1 + 2 * 6; 3 | 4 | // test that it isn't replaced with 0.3333 because that is more characters 5 | var b = 1/3; -------------------------------------------------------------------------------- /source/kernel/package.js: -------------------------------------------------------------------------------- 1 | enyo.depends( 2 | "log.js", 3 | "lang.js", 4 | "macroize.js", 5 | "animation.js", 6 | "Oop.js", 7 | "Object.js", 8 | "Component.js", 9 | "UiComponent.js", 10 | "Layout.js", 11 | "Signals.js" 12 | ); 13 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/forstatement.js: -------------------------------------------------------------------------------- 1 | a=func(); 2 | b=z; 3 | for (a++; i < 10; i++) { alert(i); } 4 | 5 | var z=1; 6 | g=2; 7 | for (; i < 10; i++) { alert(i); } 8 | 9 | var a = 2; 10 | for (var i = 1; i < 10; i++) { alert(i); } 11 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/assignment.js: -------------------------------------------------------------------------------- 1 | a=1; 2 | b=a; 3 | c=1; 4 | d=b; 5 | e=d; 6 | longname=2; 7 | if (longname+1) { 8 | x=3; 9 | if (x) var z = 7; 10 | } 11 | z=1,y=1,x=1 12 | 13 | g+=1; 14 | h=g; 15 | 16 | ++i; 17 | j=i; 18 | 19 | i++; 20 | j=i+17; -------------------------------------------------------------------------------- /examples/3 - Making Builds/source/minify/minify.bat: -------------------------------------------------------------------------------- 1 | REM @ECHO OFF 2 | 3 | SET ENYO=..\..\..\..\ 4 | 5 | SET TOOLS=%ENYO%\tools 6 | SET NODE=%TOOLS%\node.exe 7 | SET MINIFY=%TOOLS%\minifier\minify.js 8 | 9 | MKDIR build 10 | %NODE% %MINIFY% package.js -enyo %ENYO% -output build/build 11 | 12 | PAUSE -------------------------------------------------------------------------------- /tools/test/tests/KindTest.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "KindTest", 3 | kind: enyo.TestSuite, 4 | testNamespace: function() { 5 | enyo.kind({name: "custom.Namespace"}); 6 | Boolean(custom.Namespace); // throws an exception if namespace is undefined (Boolean() is just for lint) 7 | this.finish(); 8 | } 9 | }) -------------------------------------------------------------------------------- /examples/3 - Making Builds/source/minify-include-enyo/minify.bat: -------------------------------------------------------------------------------- 1 | REM @ECHO OFF 2 | 3 | SET ENYO=..\..\..\..\ 4 | 5 | SET TOOLS=%ENYO%\tools 6 | SET NODE=%TOOLS%\node.exe 7 | SET MINIFY=%TOOLS%\minifier\minify.js 8 | 9 | MKDIR build 10 | %NODE% %MINIFY% package.js -enyo %ENYO% -output build/build 11 | 12 | PAUSE -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/issue50.js: -------------------------------------------------------------------------------- 1 | function bar(a) { 2 | try { 3 | foo(); 4 | } catch(e) { 5 | alert("Exception caught (foo not defined)"); 6 | } 7 | alert(a); // 10 in FF, "[object Error]" in IE 8 | } 9 | bar(10); 10 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js: -------------------------------------------------------------------------------- 1 | function x(a) { 2 | if (typeof a === 'object') 3 | return a; 4 | 5 | if (a === 42) 6 | return 0; 7 | 8 | return a * 2; 9 | } 10 | 11 | function y(a) { 12 | if (typeof a === 'object') 13 | return a; 14 | 15 | return null; 16 | }; 17 | -------------------------------------------------------------------------------- /source/minify/minify.bat: -------------------------------------------------------------------------------- 1 | REM @ECHO OFF 2 | 3 | SET TOOLS=..\..\tools 4 | SET NODE=%TOOLS%\node.exe 5 | SET MINIFY=%TOOLS%\minifier\minify.js 6 | SET ENYO=..\.. 7 | SET TARGET=.\build 8 | 9 | %NODE% %MINIFY% package.js -enyo %ENYO% -output enyo -no-alias 10 | 11 | mkdir %TARGET% 12 | move /Y enyo.js %TARGET% 13 | move /Y enyo.css %TARGET% 14 | 15 | PAUSE 16 | -------------------------------------------------------------------------------- /source/minify/minify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TOOLS=../../tools 3 | MINIFY=$TOOLS/minifier/minify.js 4 | ENYO=../.. 5 | TARGET=./build 6 | 7 | if command -v node >/dev/null 2>&1 8 | then 9 | node $MINIFY package.js -enyo $ENYO -output enyo -no-alias 10 | mkdir $TARGET 11 | mv enyo.js enyo.css $TARGET 12 | else 13 | echo "No node executable found!" 14 | exit 1 15 | fi 16 | -------------------------------------------------------------------------------- /tools/minify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # the folder this script is in (*/enyo/tools) 4 | TOOLS=$(cd `dirname $0`; pwd) 5 | # enyo location 6 | ENYO=$TOOLS/.. 7 | # minify script location 8 | MINIFY=$TOOLS/minifier/minify.js 9 | 10 | # check for node, but quietly 11 | if command -v node >/dev/null 2>&1; then 12 | # use node to invoke minify with a known path to enyo and imported parameters 13 | node $MINIFY -enyo $ENYO $@ 14 | else 15 | echo "No node found in path" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /source/kernel/Layout.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "enyo.Layout", 3 | layoutClass: "", 4 | //* @protected 5 | constructor: function(inContainer) { 6 | this.container = inContainer; 7 | inContainer.addClass(this.layoutClass); 8 | }, 9 | destroy: function() { 10 | if (this.container) { 11 | this.container.removeClass(this.layoutClass); 12 | } 13 | }, 14 | // static property layout 15 | flow: function() { 16 | }, 17 | // dynamic measuring layout 18 | reflow: function() { 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /tools/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Enyo Core Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tools/minify.bat: -------------------------------------------------------------------------------- 1 | REM don't watch the sausage being made 2 | @ECHO OFF 3 | 4 | REM the folder this script is in (*/enyo/tools) 5 | SET TOOLS=%~DP0 6 | REM enyo location 7 | SET ENYO=%TOOLS%\.. 8 | REM default node location 9 | SET NODE=%TOOLS%\node.exe 10 | REM minify script location 11 | SET MINIFY=%TOOLS%\minifier\minify.js 12 | 13 | REM use node to invoke minify with a known path to enyo and imported parameters 14 | %NODE% %MINIFY% -enyo %ENYO% %1 %2 %3 %4 %5 %6 15 | 16 | REM let the user see the console output 17 | PAUSE 18 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/compress/test/whitespace.js: -------------------------------------------------------------------------------- 1 | function id(a) { 2 | // Form-Feed 3 | // Vertical Tab 4 | // No-Break Space 5 | ᠎// Mongolian Vowel Separator 6 |  // En quad 7 |  // Em quad 8 |  // En space 9 |  // Em space 10 |  // Three-Per-Em Space 11 |  // Four-Per-Em Space 12 |  // Six-Per-Em Space 13 |  // Figure Space 14 |  // Punctuation Space 15 |  // Thin Space 16 |  // Hair Space 17 |  // Narrow No-Break Space 18 |  // Medium Mathematical Space 19 |  // Ideographic Space 20 | return a; 21 | } 22 | -------------------------------------------------------------------------------- /examples/0 - Hello World/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Enyo 5 | 6 | 7 | 8 | 12 | 13 | 14 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "uglify-js", 3 | 4 | "description" : "JavaScript parser and compressor/beautifier toolkit", 5 | 6 | "author" : { 7 | "name" : "Mihai Bazon", 8 | "email" : "mihai.bazon@gmail.com", 9 | "url" : "http://mihai.bazon.net/blog" 10 | }, 11 | 12 | "version" : "1.1.1", 13 | 14 | "main" : "./uglify-js.js", 15 | 16 | "bin" : { 17 | "uglifyjs" : "./bin/uglifyjs" 18 | }, 19 | 20 | "repository": { 21 | "type": "git", 22 | "url": "git@github.com:mishoo/UglifyJS.git" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tools/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Api Docs 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/1 - Making a Kind/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Enyo 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/uglify-js.js: -------------------------------------------------------------------------------- 1 | //convienence function(src, [options]); 2 | function uglify(orig_code, options){ 3 | options || (options = {}); 4 | var jsp = uglify.parser; 5 | var pro = uglify.uglify; 6 | 7 | var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST 8 | ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names 9 | ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations 10 | var final_code = pro.gen_code(ast, options.gen_options); // compressed code here 11 | return final_code; 12 | }; 13 | 14 | uglify.parser = require("./lib/parse-js"); 15 | uglify.uglify = require("./lib/process"); 16 | 17 | module.exports = uglify -------------------------------------------------------------------------------- /tools/test/test.css: -------------------------------------------------------------------------------- 1 | 2 | /* ..\..\..\..\enyo/../lib/extra/test/TestCase.css */ 3 | 4 | .enyo-testcase { 5 | font-family: Helvetica, Arial, sans-serif; 6 | font-size: smaller; 7 | } 8 | 9 | .enyo-testcase-title { 10 | font-weight: bold; 11 | padding: 4px; 12 | color: white; 13 | background-color: #222; 14 | text-align: center; 15 | } 16 | 17 | .enyo-testcase-group { 18 | } 19 | 20 | .enyo-testcase-running, .enyo-testcase-passed, .enyo-testcase-failed { 21 | padding: 4px 4px 4px 36px; 22 | border-bottom: 1px dotted gray; 23 | white-space: pre; 24 | } 25 | 26 | .enyo-testcase-running { 27 | background-color: yellow; 28 | } 29 | 30 | .enyo-testcase-passed { 31 | background-color: #B0FFB0; 32 | } 33 | 34 | .enyo-testcase-failed { 35 | background-color: #FF8080; 36 | } 37 | -------------------------------------------------------------------------------- /source/ajax/json.js: -------------------------------------------------------------------------------- 1 | enyo.json = { 2 | //* @public 3 | /** 4 | Returns a JSON string for a given object, using native stringify 5 | routine. 6 | inValue is the Object to be converted to JSON. 7 | inReplacer is the optional value inclusion array or replacement function. 8 | inSpace is the optional number or string to use for pretty-printing whitespace. 9 | */ 10 | stringify: function(inValue, inReplacer, inSpace) { 11 | return JSON.stringify(inValue, inReplacer, inSpace); 12 | }, 13 | /** 14 | Returns a JavaScript object for a given JSON string, using native stringify 15 | routine. 16 | inJson is the JSON string to be converted to a JavaScript object. 17 | */ 18 | parse: function(inJson) { 19 | return inJson ? JSON.parse(inJson) : null; 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /examples/2 - Making a Package/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Enyo 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/3 - Making Builds/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Enyo 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /source/kernel/Signals.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "enyo.Signals", 3 | kind: enyo.Component, 4 | create: function() { 5 | this.inherited(arguments); 6 | enyo.Signals.addListener(this); 7 | }, 8 | destroy: function() { 9 | enyo.Signals.removeListener(this); 10 | this.inherited(arguments); 11 | }, 12 | notify: function(inMsg, inPayload) { 13 | this.dispatchIndirectly(inMsg, inPayload); 14 | }, 15 | statics: { 16 | listeners: [], 17 | addListener: function(inListener) { 18 | this.listeners.push(inListener); 19 | }, 20 | removeListener: function(inListener) { 21 | enyo.remove(inListener, this.listeners); 22 | }, 23 | send: function(inMsg, inPayload) { 24 | var signal = "on" + inMsg; 25 | enyo.forEach(this.listeners, function(l) { 26 | l.notify(signal, inPayload); 27 | }); 28 | } 29 | } 30 | }); 31 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/tmp/hoist.js: -------------------------------------------------------------------------------- 1 | function foo(arg1, arg2, arg3, arg4, arg5, arg6) { 2 | var a = 5; 3 | { 4 | var d = 10, mak = 20, buz = 30; 5 | var q = buz * 2; 6 | } 7 | if (moo) { 8 | var a, b, c; 9 | } 10 | for (var arg1 = 0, d = 20; arg1 < 10; ++arg1) 11 | console.log(arg3); 12 | for (var i in mak) {} 13 | for (j in d) {} 14 | var d; 15 | 16 | function test() { 17 | 18 | }; 19 | 20 | //test(); 21 | 22 | (function moo(first, second){ 23 | console.log(first); 24 | })(1); 25 | 26 | (function moo(first, second){ 27 | console.log(moo()); 28 | })(1); 29 | } 30 | 31 | 32 | var foo; 33 | var bar; 34 | -------------------------------------------------------------------------------- /source/dom/dom.css: -------------------------------------------------------------------------------- 1 | /* for apps */ 2 | 3 | html, body { 4 | margin: 0; 5 | height: 100%; 6 | /* ios needs at least overflow: auto to scroll */ 7 | overflow: auto; 8 | position: relative; 9 | -webkit-overflow-scrolling: touch; 10 | } 11 | 12 | /* reset */ 13 | 14 | button { 15 | font-size: inherit; 16 | font-family: inherit; 17 | } 18 | 19 | /* user selection */ 20 | 21 | .enyo-unselectable { 22 | cursor: default; 23 | -webkit-user-select: none; 24 | -moz-user-select: -moz-none; 25 | } 26 | 27 | .enyo-unselectable ::selection { 28 | color: transparent; 29 | } 30 | 31 | .enyo-selectable { 32 | cursor: auto; 33 | -webkit-user-select: text; 34 | -moz-user-select: text; 35 | } 36 | 37 | .enyo-selectable ::selection { 38 | background: #3297FD; 39 | color: #FFF; 40 | } 41 | 42 | /* layout */ 43 | 44 | .enyo-fit { 45 | position: absolute; 46 | left: 0; 47 | top: 0; 48 | right: 0; 49 | bottom: 0; 50 | } -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/tmp/test.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | global.sys = require(/^v0\.[012]/.test(process.version) ? "sys" : "util"); 4 | var fs = require("fs"); 5 | var uglify = require("uglify-js"), // symlink ~/.node_libraries/uglify-js.js to ../uglify-js.js 6 | jsp = uglify.parser, 7 | pro = uglify.uglify; 8 | 9 | var code = fs.readFileSync("hoist.js", "utf8"); 10 | var ast = jsp.parse(code); 11 | 12 | ast = pro.ast_lift_variables(ast); 13 | 14 | var w = pro.ast_walker(); 15 | ast = w.with_walkers({ 16 | "function": function() { 17 | var node = w.dive(this); // walk depth first 18 | console.log(pro.gen_code(node, { beautify: true })); 19 | return node; 20 | }, 21 | "name": function(name) { 22 | return [ this[0], "X" ]; 23 | } 24 | }, function(){ 25 | return w.walk(ast); 26 | }); 27 | 28 | console.log(pro.gen_code(ast, { 29 | beautify: true 30 | })); 31 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/walker.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | 3 | // 4 | // setup DOM-like sandbox 5 | // 6 | 7 | var window = {}; 8 | var loader; 9 | 10 | var script = function(inPath) { 11 | eval(fs.readFileSync(inPath, "utf8")); 12 | }; 13 | 14 | module.exports = { 15 | init: function(inEnyoPath) { 16 | script(inEnyoPath + "/source/boot/loader.js"); 17 | enyo.path.addPaths({ 18 | enyo: inEnyoPath, 19 | lib: inEnyoPath + "/../lib" 20 | }); 21 | loader = new enyo.loaderFactory({ 22 | script: function() {}, 23 | sheet: function() {} 24 | }); 25 | loader.loadPackage = function(inScript) { 26 | script(inScript); 27 | }; 28 | enyo.depends = function() { 29 | //console.log(arguments); 30 | loader.load.apply(loader, arguments); 31 | }; 32 | }, 33 | walk: function(inScript, inCallback) { 34 | //console.log("walking: ", inScript); 35 | loader.finish = function() { 36 | inCallback(loader); 37 | }; 38 | script(enyo.path.rewrite(inScript)); 39 | } 40 | } -------------------------------------------------------------------------------- /source/boot/enyo.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | // enyo can use information from the script tag that loads this bootstrap file 3 | var thisScript = "enyo.js"; 4 | 5 | enyo = window.enyo || {}; 6 | 7 | enyo.locateScript = function(inName) { 8 | var scripts = document.getElementsByTagName("script"); 9 | for (var i=scripts.length-1, s, src, l=inName.length; (i>=0) && (s=scripts[i]); i--) { 10 | if (!s.located) { 11 | src = s.getAttribute("src") || ""; 12 | if (src.slice(-l) == inName) { 13 | s.located = true; 14 | return {path: src.slice(0, -l -1), node: s}; 15 | } 16 | } 17 | } 18 | }; 19 | 20 | enyo.args = enyo.args || {}; 21 | 22 | var tag = enyo.locateScript(thisScript); 23 | if (tag) { 24 | // infer the framework path from the document, unless the user has specified one explicitly 25 | enyo.args.root = (enyo.args.root || tag.path).replace("/source", ""); 26 | // all attributes of the bootstrap script tag become enyo.args 27 | for (var i=0, it; (it = tag.node.attributes.item(i)); i++) { 28 | enyo.args[it.nodeName] = it.nodeValue; 29 | } 30 | } 31 | })(); -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/beautify.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | global.sys = require("sys"); 4 | var fs = require("fs"); 5 | 6 | var jsp = require("../lib/parse-js"); 7 | var pro = require("../lib/process"); 8 | 9 | var filename = process.argv[2]; 10 | fs.readFile(filename, "utf8", function(err, text){ 11 | try { 12 | var ast = time_it("parse", function(){ return jsp.parse(text); }); 13 | ast = time_it("mangle", function(){ return pro.ast_mangle(ast); }); 14 | ast = time_it("squeeze", function(){ return pro.ast_squeeze(ast); }); 15 | var gen = time_it("generate", function(){ return pro.gen_code(ast, false); }); 16 | sys.puts(gen); 17 | } catch(ex) { 18 | sys.debug(ex.stack); 19 | sys.debug(sys.inspect(ex)); 20 | sys.debug(JSON.stringify(ex)); 21 | } 22 | }); 23 | 24 | function time_it(name, cont) { 25 | var t1 = new Date().getTime(); 26 | try { return cont(); } 27 | finally { sys.debug("// " + name + ": " + ((new Date().getTime() - t1) / 1000).toFixed(3) + " sec."); } 28 | }; 29 | -------------------------------------------------------------------------------- /source/boot/boot.js: -------------------------------------------------------------------------------- 1 | // machine for a loader instance 2 | enyo.machine = { 3 | sheet: function(s) { 4 | document.write(''); 5 | }, 6 | script: function(inSrc, onLoad, onError) { 7 | document.write(''); 8 | }, 9 | inject: function(inCode) { 10 | document.write('"); 11 | } 12 | }; 13 | 14 | // create a dependency processor using our script machine 15 | enyo.loader = new enyo.loaderFactory(enyo.machine); 16 | 17 | // dependency API uses enyo loader 18 | enyo.depends = function() { 19 | var ldr = enyo.loader; 20 | if (!ldr.packageFolder) { 21 | var tag = enyo.locateScript("package.js"); 22 | if (tag && tag.path) { 23 | ldr.aliasPackage(tag.path); 24 | ldr.packageFolder = tag.path + "/"; 25 | //console.log("detected PACKAGEFOLDER [" + ldr.packageFolder + "]"); 26 | } 27 | } 28 | ldr.load.apply(ldr, arguments); 29 | }; 30 | 31 | // predefined path aliases 32 | enyo.path.addPaths({ 33 | enyo: enyo.args.root, 34 | lib: enyo.args.root + "/../lib" 35 | }); 36 | -------------------------------------------------------------------------------- /enyo.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | // enyo can use information from the script tag that loads this bootstrap file 3 | var thisScript = "enyo.js"; 4 | 5 | enyo = window.enyo || {}; 6 | 7 | enyo.locateScript = function(inName) { 8 | var scripts = document.getElementsByTagName("script"); 9 | for (var i=scripts.length-1, s, src, l=inName.length; (i>=0) && (s=scripts[i]); i--) { 10 | if (!s.located) { 11 | src = s.getAttribute("src") || ""; 12 | if (src.slice(-l) == inName) { 13 | s.located = true; 14 | return {path: src.slice(0, -l -1), node: s}; 15 | } 16 | } 17 | } 18 | }; 19 | 20 | enyo.args = enyo.args || {}; 21 | 22 | var tag = enyo.locateScript(thisScript); 23 | if (tag) { 24 | // infer the framework path from the document, unless the user has specified one explicitly 25 | enyo.args.root = (enyo.args.root || tag.path); /*.replace("/source", "")*/; 26 | // all attributes of the bootstrap script tag become enyo.args 27 | for (var i=0, it; (it = tag.node.attributes.item(i)); i++) { 28 | enyo.args[it.nodeName] = it.nodeValue; 29 | } 30 | } 31 | 32 | var root = enyo.args.root; 33 | 34 | var script = function(inSrc) { 35 | document.write(''); 36 | }; 37 | 38 | script("loader.js"); 39 | script("boot.js"); 40 | script("../package.js"); 41 | })(); -------------------------------------------------------------------------------- /tools/test/tests/langTest.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "langTest", 3 | kind: enyo.TestSuite, 4 | testCallee: function() { 5 | var err = ""; 6 | var fn = function() { 7 | err = (arguments.callee.nom !== 'fn'); 8 | } 9 | fn.nom = "fn"; 10 | fn(); 11 | this.finish(err); 12 | }, 13 | testClass: function() { 14 | enyo.kind({ 15 | name: "AClass" 16 | }); 17 | var obj = new AClass(); 18 | var err = (typeof AClass !== 'function'); 19 | this.finish(err) 20 | } 21 | /* 22 | test("class-fn", function() { 23 | ok = false; 24 | opus.kind({ 25 | name: "AClass", 26 | iam: function() { 27 | return 'AClass'; 28 | } 29 | }); 30 | var obj = new AClass(); 31 | ok = (obj.iam() == "AClass"); 32 | return ok; 33 | }); 34 | 35 | test("constructor", function() { 36 | ok = false; 37 | opus.kind({ 38 | name: "Base", 39 | constructor: function() { 40 | ok = true; 41 | } 42 | }); 43 | var b = new Base(); 44 | return ok; 45 | }); 46 | 47 | test("subclass", function() { 48 | var base = sub = false; 49 | opus.kind({ 50 | name: "Base", 51 | constructor: function() { 52 | base = true; 53 | } 54 | }); 55 | opus.kind({ 56 | name: "Sub", 57 | isa: Base, 58 | constructor: function() { 59 | // note: name tricks re: _constructor, normally one would use this.inherited(arguments); 60 | Base.prototype._constructor.apply(this); 61 | sub = true; 62 | } 63 | }); 64 | new Sub(); 65 | return base && sub; 66 | }); 67 | */ 68 | }); -------------------------------------------------------------------------------- /source/dom/dom.js: -------------------------------------------------------------------------------- 1 | //* @public 2 | 3 | /** 4 | Allow bootstrapping in environments that do not have a window object right away. 5 | */ 6 | enyo.requiresWindow = function(inFunction) { 7 | inFunction(); 8 | }; 9 | 10 | enyo.dom = { 11 | /** 12 | 13 | Shortcut for _document.getElementById_ if _id_ is a string, otherwise returns _id_. Uses _window.document_ unless a document is specified in the (optional) _doc_ parameter. 14 | 15 | // find 'node' if it's a string id, or return it unchanged if it's already a node reference 16 | var domNode = enyo.byId(node); 17 | */ 18 | byId: function(id, doc){ 19 | return (typeof id == "string") ? (doc || document).getElementById(id) : id; 20 | }, 21 | /** 22 | return string with ampersand, less-than, and greater-than characters replaced with HTML entities, 23 | e.g. 24 | 25 | '<code>"This & That"</code>' 26 | 27 | becomes 28 | 29 | '&lt;code&gt;"This &amp; That"&lt;/code&gt;' 30 | */ 31 | escape: function(inText) { 32 | return inText != null ? String(inText).replace(/&/g,'&').replace(//g,'>') : ''; 33 | }, 34 | //* @protected 35 | getComputedStyle: function(inNode) { 36 | return window.getComputedStyle(inNode, null); 37 | }, 38 | getComputedStyleValue: function(inNode, inProperty, inComputedStyle) { 39 | var s = inComputedStyle || this.getComputedStyle(inNode); 40 | return s.getPropertyValue(inProperty); 41 | } 42 | }; 43 | -------------------------------------------------------------------------------- /source/kernel/macroize.js: -------------------------------------------------------------------------------- 1 | //* @public 2 | 3 | /** 4 | Populates a string template with data values. 5 | 6 | Returns a copy of _inText_, with macros defined by _inPattern_ replaced by 7 | named values in _inMap_. 8 | 9 | _inPattern_ may be omitted, in which case the default macro pattern is used. 10 | The default pattern matches macros of the form 11 | 12 | {$name} 13 | 14 | Example: 15 | 16 | // returns "My name is Barney." 17 | enyo.macroize("My name is {$name}.", {name: "Barney"}); 18 | 19 | Dot notation is supported, like so: 20 | 21 | var info = { 22 | product_0: { 23 | name: "Gizmo" 24 | weight: 3 25 | } 26 | } 27 | // returns "Each Gizmo weighs 3 pounds." 28 | enyo.macroize("Each {$product_0.name} weighs {$product_0.weight} pounds.", info); 29 | */ 30 | enyo.macroize = function(inText, inMap, inPattern) { 31 | var v, working, result = inText, pattern = inPattern || enyo.macroize.pattern; 32 | var fn = function(macro, name) { 33 | working = true; 34 | v = enyo.getObject(name, false, inMap); 35 | //v = inMap[name]; 36 | return (v === undefined || v === null) ? "{$" + name + "}" : v; 37 | }; 38 | var prevent = 0; 39 | do { 40 | working = false; 41 | result = result.replace(pattern, fn); 42 | // if iterating more than 100 times, we assume a recursion (we should throw probably) 43 | } while (working && (prevent++ < 100)); 44 | return result; 45 | }; 46 | 47 | //* @protected 48 | 49 | // matches macros of form {$name} 50 | enyo.macroize.pattern = /{\$([^{}]*)}/g; 51 | -------------------------------------------------------------------------------- /source/ajax/cookie.js: -------------------------------------------------------------------------------- 1 | //* @public 2 | 3 | /** 4 | Gets a named value from the document cookie. 5 | */ 6 | enyo.getCookie = function(inName) { 7 | var matches = document.cookie.match(new RegExp("(?:^|; )" + inName + "=([^;]*)")); 8 | return matches ? decodeURIComponent(matches[1]) : undefined; 9 | }; 10 | 11 | /** 12 | Sets a named value into the document cookie, with properties. 13 | 14 | Properties in the optional inProps argument are attached to the cookie. 15 | inProps may have an expires property, which can be a number of days, a Date object, 16 | or a UTC time string. 17 | 18 | To remove a cookie, use a inProps value of { "Max-Age": 0 }. 19 | 20 | If developing in the Google Chrome browser with a local file as your application, 21 | start chrome with the --enable-file-cookies switch to allow cookies to be set. 22 | */ 23 | enyo.setCookie = function(inName, inValue, inProps) { 24 | var cookie = inName + "=" + encodeURIComponent(inValue); 25 | var p = inProps || {}; 26 | // 27 | // FIXME: expires=0 seems to disappear right away, not on close? (FF3) Change docs? 28 | var exp = p.expires; 29 | if (typeof exp == "number") { 30 | var d = new Date(); 31 | d.setTime(d.getTime() + exp*24*60*60*1000); 32 | exp = d; 33 | } 34 | if (exp && exp.toUTCString) { 35 | p.expires = exp.toUTCString(); 36 | } 37 | // 38 | var name, value; 39 | for (name in p){ 40 | cookie += "; " + name; 41 | value = p[name]; 42 | if (value !== true) { 43 | cookie += "=" + value; 44 | } 45 | } 46 | // 47 | //console.log(cookie); 48 | document.cookie = cookie; 49 | }; 50 | -------------------------------------------------------------------------------- /tools/test/tests/AjaxTest.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "AjaxTest", 3 | kind: enyo.TestSuite, 4 | testAjax200: function() { 5 | new enyo.Ajax({url: "index.html", handleAs: "text"}) 6 | .response(this, function(inSender, inValue){ 7 | this.finish(); 8 | }) 9 | .error(this, function(inSender, inValue) { 10 | this.finish("bad status: " + inValue); 11 | }) 12 | .go(); 13 | }, 14 | testAjax404: function() { 15 | new enyo.Ajax({url: "noexist.not"}) 16 | .response(this, function(inSender, inValue){ 17 | this.finish("ajax failed to fail"); 18 | }) 19 | .error(this, function(inSender, inValue) { 20 | this.finish(); 21 | }) 22 | .go(); 23 | }, 24 | testAjaxCustomError: function() { 25 | new enyo.Ajax({url: "appinfo.json"}) 26 | .response(function(inSender, inValue){ 27 | inSender.fail("cuz I said so"); 28 | }) 29 | .error(this, function(inSender, inValue) { 30 | this.finish(); 31 | }) 32 | .go(); 33 | }, 34 | testAjaxSerial: function() { 35 | // if the test finishes before ready, it's a failure 36 | var ready = false; 37 | // 38 | // when 'index' request completes, we are 'ready' 39 | var index = new enyo.Ajax({url: "index.html", handleAs: "text"}); 40 | index.response(function() { 41 | ready = true; 42 | }); 43 | // 44 | // request triggers 'index' request when it completes 45 | new enyo.Ajax({url: "index.html", handleAs: "text"}) 46 | .response(index) 47 | .response(this, function() { 48 | // finish clean if 'ready' 49 | this.finish(ready ? "" : "requests failed to complete in order"); 50 | }) 51 | .go(); 52 | } 53 | }); -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/test/unit/scripts.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'), 2 | uglify = require('uglify-js'), 3 | jsp = uglify.parser, 4 | nodeunit = require('nodeunit'), 5 | path = require('path'), 6 | pro = uglify.uglify; 7 | 8 | var Script = process.binding('evals').Script; 9 | 10 | var scriptsPath = __dirname; 11 | 12 | function compress(code) { 13 | var ast = jsp.parse(code); 14 | ast = pro.ast_mangle(ast); 15 | ast = pro.ast_squeeze(ast, { no_warnings: true }); 16 | ast = pro.ast_squeeze_more(ast); 17 | return pro.gen_code(ast); 18 | }; 19 | 20 | var testDir = path.join(scriptsPath, "compress", "test"); 21 | var expectedDir = path.join(scriptsPath, "compress", "expected"); 22 | 23 | function getTester(script) { 24 | return function(test) { 25 | var testPath = path.join(testDir, script); 26 | var expectedPath = path.join(expectedDir, script); 27 | var content = fs.readFileSync(testPath, 'utf-8'); 28 | var outputCompress = compress(content); 29 | 30 | // Check if the noncompressdata is larger or same size as the compressed data 31 | test.ok(content.length >= outputCompress.length); 32 | 33 | // Check that a recompress gives the same result 34 | var outputReCompress = compress(content); 35 | test.equal(outputCompress, outputReCompress); 36 | 37 | // Check if the compressed output is what is expected 38 | var expected = fs.readFileSync(expectedPath, 'utf-8'); 39 | test.equal(outputCompress, expected.replace(/(\r?\n)+$/, "")); 40 | 41 | test.done(); 42 | }; 43 | }; 44 | 45 | var tests = {}; 46 | 47 | var scripts = fs.readdirSync(testDir); 48 | for (var i in scripts) { 49 | var script = scripts[i]; 50 | if (/\.js$/.test(script)) { 51 | tests[script] = getTester(script); 52 | } 53 | } 54 | 55 | module.exports = nodeunit.testCase(tests); 56 | -------------------------------------------------------------------------------- /source/ajax/xhr.js: -------------------------------------------------------------------------------- 1 | //* @protected 2 | enyo.xhr = { 3 | /** 4 | inParams is an Object that may contain these properties: 5 | 6 | - _url_: The URL to request (required). 7 | - _method_: The HTTP method to use for the request. Defaults to GET. 8 | - _callback_: Called when request is completed. 9 | - _body_: Specific contents for the request body for POST method. 10 | - _headers_: Request headers. 11 | - _username_: The optional user name to use for authentication purposes. 12 | - _password_: The optional password to use for authentication purposes. 13 | */ 14 | request: function(inParams) { 15 | var xhr = this.getXMLHttpRequest(); 16 | // 17 | var method = inParams.method || "GET"; 18 | var async = ("sync" in inParams) ? !inParams.sync : true; 19 | // 20 | if (inParams.username) { 21 | xhr.open(method, enyo.path.rewrite(inParams.url), async, inParams.username, inParams.password); 22 | } else { 23 | xhr.open(method, enyo.path.rewrite(inParams.url), async); 24 | } 25 | this.makeReadyStateHandler(xhr, inParams.callback); 26 | if (inParams.headers) { 27 | for (var key in inParams.headers) { 28 | xhr.setRequestHeader(key, inParams.headers[key]); 29 | } 30 | } 31 | xhr.send(inParams.body || null); 32 | if (!async) { 33 | xhr.onreadystatechange(xhr); 34 | } 35 | return xhr; 36 | }, 37 | //* @protected 38 | getXMLHttpRequest: function() { 39 | try { 40 | return new XMLHttpRequest(); 41 | } catch (e) {} 42 | try { 43 | return new ActiveXObject('Msxml2.XMLHTTP'); 44 | } catch (e) {} 45 | try { 46 | return new ActiveXObject('Microsoft.XMLHTTP'); 47 | } catch (e) {} 48 | return null; 49 | }, 50 | makeReadyStateHandler: function(inXhr, inCallback) { 51 | inXhr.onreadystatechange = function() { 52 | if (inXhr.readyState == 4) { 53 | inCallback && inCallback.apply(null, [inXhr.responseText, inXhr]); 54 | } 55 | } 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /source/kernel/animation.js: -------------------------------------------------------------------------------- 1 | // TODOC 2 | (function(){ 3 | // API is non-standard, so what enyo exposes may vary from 4 | // web documentation for various browsers 5 | // in particular, enyo.requestAnimationFrame takes no arguments, 6 | // and the callback receives no arguments 7 | var builtin = window.webkitRequestAnimationFrame; 8 | enyo.requestAnimationFrame = builtin ? enyo.bind(window, builtin) : 9 | function(inCallback) { 10 | return window.setTimeout(inCallback, Math.round(1000/60)); 11 | }; 12 | // 13 | // Note: (we have requested to change the native implementation to do this) 14 | // first return value of webkitRequestAnimationFrame is 0 and a call 15 | // to webkitCancelRequestAnimationFrame with no arguments will cancel this. 16 | // To avoid this and to allow for a boolean test of the return value, 17 | // make 1 bogus call so the first used return value of webkitRequestAnimationFrame is > 0. 18 | // (we choose to do this rather than wrapping the native function to avoid the overhead) 19 | // 20 | if (builtin) { 21 | var f = webkitRequestAnimationFrame(enyo.nop); 22 | webkitCancelRequestAnimationFrame(f); 23 | } 24 | // 25 | builtin = window.webkitCancelRequestAnimationFrame || window.clearTimeout; 26 | enyo.cancelRequestAnimationFrame = enyo.bind(window, builtin); 27 | })(); 28 | 29 | enyo.easing = { 30 | cubicIn: function(n) { 31 | return Math.pow(n, 3); 32 | }, 33 | cubicOut: function(n) { 34 | return Math.pow(n - 1, 3) + 1; 35 | }, 36 | expoOut: function(n) { 37 | return (n == 1) ? 1 : (-1 * Math.pow(2, -10 * n) + 1); 38 | }, 39 | quadInOut: function(n){ 40 | n = n * 2; 41 | if (n < 1) { 42 | return Math.pow(n, 2) / 2; 43 | } 44 | return -1 * ((--n) * (n - 2) - 1) / 2; 45 | }, 46 | linear: function(n) { 47 | return n; 48 | } 49 | }; 50 | 51 | enyo.easedLerp = function(inT0, inDuration, inEasing) { 52 | var lerp = (new Date().getTime() - inT0) / inDuration; 53 | return lerp >= 1 ? 1 : inEasing(lerp); 54 | }; -------------------------------------------------------------------------------- /source/touch/ScrollStrategy.js: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | enyo.kind({ 4 | name: "enyo.ScrollStrategy", 5 | kind: enyo.Control, 6 | events: { 7 | onScroll: "doScroll" 8 | }, 9 | published: { 10 | vertical: true, 11 | horizontal: true, 12 | scrollLeft: 0, 13 | scrollTop: 0 14 | }, 15 | handlers: { 16 | scroll: "scrollHandler" 17 | }, 18 | classes: "enyo-scroller", 19 | create: function() { 20 | this.inherited(arguments); 21 | this.horizontalChanged(); 22 | this.verticalChanged(); 23 | this.setAttribute("onscroll", enyo.bubbler); 24 | }, 25 | rendered: function() { 26 | this.inherited(arguments); 27 | this.scrollNode = this.calcScrollNode(); 28 | }, 29 | teardownRender: function() { 30 | this.inherited(arguments); 31 | this.scrollNode = null; 32 | }, 33 | calcScrollNode: function() { 34 | return this.hasNode(); 35 | }, 36 | horizontalChanged: function() { 37 | this.applyStyle("overflow-x", this.horizontal ? "auto" : "hidden"); 38 | }, 39 | verticalChanged: function() { 40 | this.applyStyle("overflow-y", this.vertical ? "auto" : "hidden"); 41 | }, 42 | scrollHandler: function(inSender, e) { 43 | // keep these properties up to date 44 | if (this.scrollNode) { 45 | this.scrollTop = this.scrollNode.scrollTop; 46 | this.scrollLeft = this.scrollNode.scrollLeft; 47 | } 48 | return this.doScroll(e); 49 | }, 50 | scrollTo: function(inX, inY) { 51 | if (this.scrollNode) { 52 | this.setScrollLeft(inX); 53 | this.setScrollTop(inY); 54 | } 55 | }, 56 | scrollIntoView: function(inControl, inAlignWithTop) { 57 | if (inControl.hasNode()) { 58 | inControl.node.scrollIntoView(inAlignWithTop); 59 | } 60 | }, 61 | setScrollTop: function(inTop) { 62 | this.scrollTop = inTop; 63 | if (this.scrollNode) { 64 | this.scrollNode.scrollTop = this.scrollTop; 65 | } 66 | }, 67 | setScrollLeft: function(inLeft) { 68 | this.scrollLeft = inLeft; 69 | if (this.scrollNode) { 70 | this.scrollNode.scrollLeft = this.scrollLeft; 71 | } 72 | }, 73 | getScrollLeft: function() { 74 | return this.scrollNode ? this.scrollNode.scrollLeft : this.scrollLeft; 75 | }, 76 | getScrollTop: function() { 77 | return this.scrollNode ? this.scrollNode.scrollTop : this.scrollTop; 78 | } 79 | }); 80 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/docstyle.css: -------------------------------------------------------------------------------- 1 | html { font-family: "Lucida Grande","Trebuchet MS",sans-serif; font-size: 12pt; } 2 | body { max-width: 60em; } 3 | .title { text-align: center; } 4 | .todo { color: red; } 5 | .done { color: green; } 6 | .tag { background-color:lightblue; font-weight:normal } 7 | .target { } 8 | .timestamp { color: grey } 9 | .timestamp-kwd { color: CadetBlue } 10 | p.verse { margin-left: 3% } 11 | pre { 12 | border: 1pt solid #AEBDCC; 13 | background-color: #F3F5F7; 14 | padding: 5pt; 15 | font-family: monospace; 16 | font-size: 90%; 17 | overflow:auto; 18 | } 19 | pre.src { 20 | background-color: #eee; color: #112; border: 1px solid #000; 21 | } 22 | table { border-collapse: collapse; } 23 | td, th { vertical-align: top; } 24 | dt { font-weight: bold; } 25 | div.figure { padding: 0.5em; } 26 | div.figure p { text-align: center; } 27 | .linenr { font-size:smaller } 28 | .code-highlighted {background-color:#ffff00;} 29 | .org-info-js_info-navigation { border-style:none; } 30 | #org-info-js_console-label { font-size:10px; font-weight:bold; 31 | white-space:nowrap; } 32 | .org-info-js_search-highlight {background-color:#ffff00; color:#000000; 33 | font-weight:bold; } 34 | 35 | sup { 36 | vertical-align: baseline; 37 | position: relative; 38 | top: -0.5em; 39 | font-size: 80%; 40 | } 41 | 42 | sup a:link, sup a:visited { 43 | text-decoration: none; 44 | color: #c00; 45 | } 46 | 47 | sup a:before { content: "["; color: #999; } 48 | sup a:after { content: "]"; color: #999; } 49 | 50 | h1.title { border-bottom: 4px solid #000; padding-bottom: 5px; margin-bottom: 2em; } 51 | 52 | #postamble { 53 | color: #777; 54 | font-size: 90%; 55 | padding-top: 1em; padding-bottom: 1em; border-top: 1px solid #999; 56 | margin-top: 2em; 57 | padding-left: 2em; 58 | padding-right: 2em; 59 | text-align: right; 60 | } 61 | 62 | #postamble p { margin: 0; } 63 | 64 | #footnotes { border-top: 1px solid #000; } 65 | 66 | h1 { font-size: 200% } 67 | h2 { font-size: 175% } 68 | h3 { font-size: 150% } 69 | h4 { font-size: 125% } 70 | 71 | h1, h2, h3, h4 { font-family: "Bookman",Georgia,"Times New Roman",serif; font-weight: normal; } 72 | 73 | @media print { 74 | html { font-size: 11pt; } 75 | } 76 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/lib/squeeze-more.js: -------------------------------------------------------------------------------- 1 | var jsp = require("./parse-js"), 2 | pro = require("./process"), 3 | slice = jsp.slice, 4 | member = jsp.member, 5 | curry = jsp.curry, 6 | MAP = pro.MAP, 7 | PRECEDENCE = jsp.PRECEDENCE, 8 | OPERATORS = jsp.OPERATORS; 9 | 10 | function ast_squeeze_more(ast) { 11 | var w = pro.ast_walker(), walk = w.walk, scope; 12 | function with_scope(s, cont) { 13 | var save = scope, ret; 14 | scope = s; 15 | ret = cont(); 16 | scope = save; 17 | return ret; 18 | }; 19 | function _lambda(name, args, body) { 20 | return [ this[0], name, args, with_scope(body.scope, curry(MAP, body, walk)) ]; 21 | }; 22 | return w.with_walkers({ 23 | "toplevel": function(body) { 24 | return [ this[0], with_scope(this.scope, curry(MAP, body, walk)) ]; 25 | }, 26 | "function": _lambda, 27 | "defun": _lambda, 28 | "new": function(ctor, args) { 29 | if (ctor[0] == "name" && ctor[1] == "Array" && !scope.has("Array")) { 30 | if (args.length != 1) { 31 | return [ "array", args ]; 32 | } else { 33 | return walk([ "call", [ "name", "Array" ], args ]); 34 | } 35 | } 36 | }, 37 | "call": function(expr, args) { 38 | if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) { 39 | // foo.toString() ==> foo+"" 40 | return [ "binary", "+", expr[1], [ "string", "" ]]; 41 | } 42 | if (expr[0] == "name" && expr[1] == "Array" && args.length != 1 && !scope.has("Array")) { 43 | return [ "array", args ]; 44 | } 45 | } 46 | }, function() { 47 | return walk(pro.ast_add_scope(ast)); 48 | }); 49 | }; 50 | 51 | exports.ast_squeeze_more = ast_squeeze_more; 52 | -------------------------------------------------------------------------------- /source/ajax/Async.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "enyo.Async", 3 | kind: enyo.Object, 4 | //* @protected 5 | failed: false, 6 | context: null, 7 | constructor: function() { 8 | this.responders = []; 9 | this.errorHandlers = []; 10 | }, 11 | accumulate: function(inArray, inMethodArgs) { 12 | var fn = (inMethodArgs.length < 2) ? inMethodArgs[0] : enyo.bind(inMethodArgs[0], inMethodArgs[1]); 13 | inArray.push(fn); 14 | }, 15 | //* @public 16 | response: function(/* [inContext], inResponder */) { 17 | this.accumulate(this.responders, arguments); 18 | return this; 19 | }, 20 | error: function(/* [inContext], inResponder */) { 21 | this.accumulate(this.errorHandlers, arguments); 22 | return this; 23 | }, 24 | //* @protected 25 | route: function(inAsync, inValue) { 26 | var r = enyo.bind(this, "respond"); 27 | inAsync.response(function(inSender, inValue) { 28 | r(inValue); 29 | }); 30 | var f = enyo.bind(this, "fail"); 31 | inAsync.error(function(inSender, inValue) { 32 | f(inValue); 33 | }); 34 | inAsync.go(inValue); 35 | }, 36 | handle: function(inValue, inHandlers) { 37 | var r = inHandlers.shift(); 38 | if (r) { 39 | if (r instanceof enyo.Async) { 40 | this.route(r, inValue); 41 | } else { 42 | var v = enyo.call(this.context || this, r, [this, inValue]); 43 | (this.failed ? this.fail : this.respond).call(this, v); 44 | } 45 | } 46 | }, 47 | startTimer: function() { 48 | this.startTime = new Date().getTime(); 49 | if (this.timeout) { 50 | this.timeoutJob = setTimeout(enyo.bind(this, "timeoutComplete"), this.timeout); 51 | } 52 | }, 53 | endTimer: function() { 54 | if (this.timeoutJob) { 55 | this.endTime = new Date().getTime(); 56 | clearTimeout(this.timeoutJob); 57 | this.timeoutJob = null; 58 | this.latency = this.endTime - this.startTime; 59 | } 60 | }, 61 | timeoutComplete: function() { 62 | this.timedout = true; 63 | this.fail("timeout"); 64 | }, 65 | //* @public 66 | respond: function(inValue) { 67 | this.failed = false; 68 | this.endTimer(); 69 | this.handle(inValue, this.responders); 70 | }, 71 | fail: function(inError) { 72 | this.failed = true; 73 | this.endTimer(); 74 | this.handle(inError, this.errorHandlers); 75 | }, 76 | recover: function() { 77 | this.failed = false; 78 | }, 79 | go: function(inValue) { 80 | this.respond(inValue); 81 | return this; 82 | } 83 | }); 84 | -------------------------------------------------------------------------------- /source/kernel/log.js: -------------------------------------------------------------------------------- 1 | //* @protected 2 | 3 | enyo.logging = { 4 | // log levels are integers from 0-99 5 | // 99 is maximum logging 6 | level: 99, 7 | // set level to -1 to disable all logging 8 | levels: {log: 20, warn: 10, error: 0}, 9 | // return true if logging level is lower than the current log level 10 | shouldLog: function(inMethod) { 11 | var ll = parseInt(enyo.logging.levels[inMethod]); 12 | return (ll <= enyo.logging.level); 13 | }, 14 | /* 15 | formatArgs: function(inMethod, inArgs) { 16 | var a$ = []; 17 | for (var i=0, l=inArgs.length, a; (a=inArgs[i]) || i0 && y>0 && x<=o.width && y<=o.height) { 75 | //console.log("IN: " + n.id + " -> [" + x + "," + y + " in " + o.width + "x" + o.height + "] (children: " + n.childNodes.length + ")"); 76 | var target; 77 | for (var n$=n.childNodes, i=n$.length-1, c; c=n$[i]; i--) { 78 | target = this.findTarget(c, inX, inY); 79 | if (target) { 80 | return target; 81 | } 82 | } 83 | return n; 84 | } 85 | } 86 | }, 87 | connect: function() { 88 | document.ontouchstart = enyo.dispatch; 89 | document.ontouchmove = enyo.dispatch; 90 | document.ontouchend = enyo.dispatch; 91 | document.ongesturestart = enyo.dispatch; 92 | document.ongesturechange = enyo.dispatch; 93 | document.ongestureend = enyo.dispatch; 94 | } 95 | }; 96 | // 97 | touchGesture.connect(); 98 | }); -------------------------------------------------------------------------------- /source/dom/drag.js: -------------------------------------------------------------------------------- 1 | /** 2 | Enyo supports a cross-platform set of drag events. These events are provide to allow a single set of event handlers to be 3 | written for all supports platforms, desktop and mobile alike. The following events are provided: 4 | 5 | * "dragstart", "dragfinish" - sent for pointer moves that exceed a certain threshhold 6 | * "drag", "drop" - sent to the original target of the pointer move to inform it about the item being moved over or released over another element 7 | * "dragover", "dragout" - sent in addition to over and out when there is an active drag 8 | 9 | */ 10 | 11 | //* @protected 12 | enyo.dispatcher.features.push( 13 | function(e) { 14 | // NOTE: beware of properties in enyo.gesture inadvertantly mapped to event types 15 | if (enyo.gesture.drag[e.type]) { 16 | return enyo.gesture.drag[e.type](e); 17 | } 18 | } 19 | ); 20 | 21 | //* @public 22 | enyo.gesture.drag = { 23 | //* @protected 24 | hysteresis: 4, 25 | down: function(e) { 26 | // tracking if the mouse is down 27 | //console.log("tracking ON"); 28 | // Note: 'tracking' flag indicates interest in mousemove, it's turned off 29 | // on mouseup 30 | // make sure to stop dragging in case the up event was not received. 31 | this.stopDragging(e); 32 | this.tracking = true; 33 | this.target = e.target; 34 | this.dispatchTarget = e.dispatchTarget; 35 | this.targetEvent = e; 36 | this.px0 = e.pageX; 37 | this.py0 = e.pageY; 38 | }, 39 | move: function(e) { 40 | if (this.tracking) { 41 | this.dx = e.pageX - this.px0; 42 | this.dy = e.pageY - this.py0; 43 | if (this.dragEvent) { 44 | this.sendDrag(e); 45 | } else if (Math.sqrt(this.dy*this.dy + this.dx*this.dx) >= this.hysteresis) { 46 | this.sendDragStart(e); 47 | } 48 | } 49 | }, 50 | up: function(e) { 51 | this.tracking = false; 52 | this.stopDragging(e); 53 | }, 54 | leave: function(e) { 55 | if (this.dragEvent) { 56 | this.sendDragOut(e); 57 | } 58 | }, 59 | stopDragging: function(e) { 60 | if (this.dragEvent) { 61 | this.sendDrop(e); 62 | var handled = this.sendDragFinish(e); 63 | this.dragEvent = null; 64 | return handled; 65 | } 66 | }, 67 | makeDragEvent: function(inType, inTarget, inEvent, inInfo) { 68 | var adx = Math.abs(this.dx), ady = Math.abs(this.dy); 69 | var h = adx > ady; 70 | // suggest locking if off-axis < 22.5 degrees 71 | var l = (h ? ady/adx : adx/ady) < 0.414; 72 | return { 73 | type: inType, 74 | dx: this.dx, 75 | dy: this.dy, 76 | pageX: inEvent.pageX, 77 | pageY: inEvent.pageY, 78 | horizontal: h, 79 | vertical: !h, 80 | lockable: l, 81 | target: inTarget, 82 | dragInfo: inInfo, 83 | ctrlKey: inEvent.ctrlKey, 84 | altKey: inEvent.altKey, 85 | metaKey: inEvent.metaKey, 86 | shiftKey: inEvent.shiftKey 87 | }; 88 | }, 89 | sendDragStart: function(e) { 90 | //console.log("dragstart"); 91 | this.dragEvent = this.makeDragEvent("dragstart", this.target, e); 92 | enyo.dispatch(this.dragEvent); 93 | }, 94 | sendDrag: function(e) { 95 | //console.log("sendDrag to " + this.dragEvent.target.id + ", over to " + e.target.id); 96 | // send dragOver event to the standard event target 97 | var synth = this.makeDragEvent("dragover", e.target, e, this.dragEvent.dragInfo); 98 | enyo.dispatch(synth); 99 | // send drag event to the drag source 100 | synth.type = "drag"; 101 | synth.target = this.dragEvent.target; 102 | enyo.dispatch(synth); 103 | }, 104 | sendDragFinish: function(e) { 105 | //console.log("dragfinish"); 106 | var synth = this.makeDragEvent("dragfinish", this.dragEvent.target, e, this.dragEvent.dragInfo); 107 | synth.preventTap = function() { 108 | e.preventTap && e.preventTap(); 109 | }; 110 | enyo.dispatch(synth); 111 | }, 112 | sendDragOut: function(e) { 113 | var synth = this.makeDragEvent("dragout", e.target, e, this.dragEvent.dragInfo); 114 | enyo.dispatch(synth); 115 | }, 116 | sendDrop: function(e) { 117 | var synth = this.makeDragEvent("drop", e.target, e, this.dragEvent.dragInfo); 118 | synth.preventTap = function() { 119 | e.preventTap && e.preventTap(); 120 | }; 121 | enyo.dispatch(synth); 122 | } 123 | }; 124 | -------------------------------------------------------------------------------- /source/ajax/Ajax.js: -------------------------------------------------------------------------------- 1 | enyo.kind({ 2 | name: "enyo.Ajax", 3 | kind: enyo.Async, 4 | published: { 5 | cacheBust: true, 6 | /** 7 | The URL for the service. This can be a relative URL if used to fetch resources bundled with the application. 8 | */ 9 | url: "", 10 | /** 11 | The HTTP method to use for the request, defaults to GET. Supported values include 12 | "GET", "POST", "PUT", and "DELETE". 13 | */ 14 | method: "GET", // {value: "GET", options: ["GET", "POST", "PUT", "DELETE"]}, 15 | /** 16 | How the response will be handled. 17 | Supported values are: "json", "text", "xml". 18 | */ 19 | handleAs: "json", // {value: "json", options: ["text", "json", "xml"]}, 20 | /** 21 | The Content-Type header for the request as a String. 22 | */ 23 | contentType: "application/x-www-form-urlencoded", 24 | /** 25 | If true, makes a synchronous (blocking) call, if supported. Synchronous requests 26 | are not supported on HP webOS. 27 | */ 28 | sync: false, 29 | /** 30 | Optional additional request headers as a JS object, e.g. 31 | { "X-My-Header": "My Value", "Mood": "Happy" }, or null. 32 | */ 33 | headers: null, 34 | /** 35 | The content for the request body for POST method. If this is not set, params will be used instead. 36 | */ 37 | postBody: "", 38 | /** 39 | The optional user name to use for authentication purposes. 40 | */ 41 | username: "", 42 | /** 43 | The optional password to use for authentication purposes. 44 | */ 45 | password: "" 46 | }, 47 | //* @protected 48 | constructor: function(inParams) { 49 | enyo.mixin(this, inParams); 50 | this.inherited(arguments); 51 | }, 52 | //* @public 53 | /** 54 | Send the ajax request with parameters _inParams_. 55 | */ 56 | go: function(inParams) { 57 | this.startTimer(); 58 | this.xhr(inParams); 59 | return this; 60 | }, 61 | //* @protected 62 | xhr: function(inParams) { 63 | var parts = this.url.split("?"); 64 | var uri = parts.shift() || ""; 65 | var args = parts.join("?").split("&"); 66 | // 67 | var body = enyo.isString(inParams) ? inParams : enyo.Ajax.objectToQuery(inParams); 68 | if (this.method == "GET") { 69 | if (body) { 70 | args.push(body); 71 | body = null; 72 | } 73 | if (this.cacheBust) { 74 | args.push(Math.random()); 75 | } 76 | } 77 | // 78 | var url = [uri, args.join("&")].join("?"); 79 | // 80 | var xhr_headers = { 81 | "Content-Type": this.contentType 82 | }; 83 | enyo.mixin(xhr_headers, this.headers); 84 | // 85 | enyo.xhr.request({ 86 | url: url, 87 | method: this.method, 88 | callback: enyo.bind(this, "receive"), 89 | body: body, 90 | headers: xhr_headers, 91 | sync: window.PalmSystem ? false : this.sync, 92 | username: this.username, 93 | password: this.password 94 | }); 95 | }, 96 | receive: function(inText, inXhr) { 97 | if (this.isFailure(inXhr)) { 98 | this.fail(inXhr.status); 99 | } else { 100 | this.respond(this.xhrToResponse(inXhr)); 101 | } 102 | }, 103 | xhrToResponse: function(inXhr) { 104 | if (inXhr) { 105 | return this[(this.handleAs || "text") + "Handler"](inXhr); 106 | } 107 | }, 108 | isFailure: function(inXhr) { 109 | // Usually we will treat status code 0 and 2xx as success. But in webos, if url is a local file, 110 | // 200 is returned if the file exists, 0 otherwise. So we workaround this by treating 0 differently if 111 | // the app running inside webos and the url is not http. 112 | //return ((!window.PalmSystem || this.isHttpUrl()) && !inStatus) || (inStatus >= 200 && inStatus < 300); 113 | return (inXhr.status !== 0) && (inXhr.status < 200 || inXhr.status >= 300); 114 | }, 115 | xmlHandler: function(inXhr) { 116 | return inXhr.responseXML; 117 | }, 118 | textHandler: function(inXhr) { 119 | return inXhr.responseText; 120 | }, 121 | jsonHandler: function(inXhr) { 122 | var r = inXhr.responseText; 123 | try { 124 | return r && enyo.json.parse(r); 125 | } catch (x) { 126 | console.warn("Ajax request set to handleAs JSON but data was not in JSON format"); 127 | return r; 128 | } 129 | }, 130 | statics: { 131 | objectToQuery: function(/*Object*/ map) { 132 | var enc = encodeURIComponent; 133 | var pairs = []; 134 | var backstop = {}; 135 | for (var name in map){ 136 | var value = map[name]; 137 | if (value != backstop[name]) { 138 | var assign = enc(name) + "="; 139 | if (enyo.isArray(value)) { 140 | for (var i=0; i < value.length; i++) { 141 | pairs.push(assign + enc(value[i])); 142 | } 143 | } else { 144 | pairs.push(assign + enc(value)); 145 | } 146 | } 147 | } 148 | return pairs.join("&"); 149 | } 150 | } 151 | }); 152 | -------------------------------------------------------------------------------- /source/kernel/Object.js: -------------------------------------------------------------------------------- 1 | /** 2 | _enyo.Object_ implements the property publishing system. 3 | Published properties are declared by providing a _published_ property within a call to 4 | _enyo.kind_. Getter and setter methods are automatically generated for 5 | properties declared this way. Also, setters for published properties 6 | trigger _<propertyName>Changed_ methods by convention. 7 | 8 | enyo.kind({ 9 | name: "MyObject", 10 | kind: enyo.Object, 11 | 12 | // declare 'published' properties 13 | published: { 14 | myValue: 3 15 | }, 16 | 17 | // these methods will be automatically generated: 18 | // getMyValue: function() ... 19 | // setMyValue: function(inValue) ... 20 | 21 | // optional method that is called whenever setMyValue is called 22 | myValueChanged: function(inOldValue) { 23 | this.delta = this.myValue - inOldValue; 24 | } 25 | }); 26 | 27 | In the above example, _myValue_ becomes a regular property on the MyObject 28 | prototype (with a default value of 3), and the getter and setter methods are generated 29 | as noted in the comments. 30 | 31 | myobj = new MyObject(); 32 | var x = myobj.getMyValue(); // x gets 3 33 | 34 | You may choose to declare a _changed_ method to observe set calls on a property. 35 | The _myValueChanged_ method in the example above is called whenever _setMyValue_ is called. 36 | 37 | myobj.setMyValue(7); // myValue becomes 7; myValueChanged side-effect sets delta to 4 38 | 39 | _Changed_ methods are called whenever setters are invoked, whether the actual value has changed 40 | or not. 41 | 42 | Published properties are stored as regular properties on the object prototype, so it's possible 43 | to query or set their values directly (changed methods are not called if you set a property directly). 44 | 45 | var x = myobj.myValue; 46 | 47 | enyo.Object also provides some utility functions for its subkinds. 48 | */ 49 | enyo.kind({ 50 | name: "enyo.Object", 51 | //* @protected 52 | constructor: function() { 53 | enyo._objectCount++; 54 | }, 55 | _setProperty: function(n, v, cf) { 56 | if (this[cf]) { 57 | var old = this[n]; 58 | this[n] = v; 59 | if (old !== v) { 60 | this[cf](old); 61 | } 62 | } else { 63 | this[n] = v; 64 | } 65 | }, 66 | //* @public 67 | destroyObject: function(inName) { 68 | if (this[inName] && this[inName].destroy) { 69 | this[inName].destroy(); 70 | } 71 | this[inName] = null; 72 | }, 73 | getProperty: function(n) { 74 | return this[n]; 75 | }, 76 | setProperty: function(n, v) { 77 | var setter = "set" + enyo.cap(n); 78 | if (this[setter]) { 79 | this[setter](v); 80 | } else { 81 | this._setProperty(n, v, n + "Changed"); 82 | } 83 | }, 84 | /** 85 | Sends a log message to the console, prepended with the name of the kind and method from which log was invoked. Multiple arguments are coerced to String and joined with spaces. 86 | 87 | enyo.kind({ 88 | name: "MyObject", 89 | kind: enyo.Object, 90 | hello: function() { 91 | this.log("says", "hi"); 92 | // shows in the console: MyObject.hello: says hi 93 | } 94 | }); 95 | */ 96 | log: function() { 97 | enyo.logging.log("log", [arguments.callee.caller.nom + ": "].concat(enyo.cloneArray(arguments))); 98 | }, 99 | //* Same as _log_, except uses the console's warn method (if it exists). 100 | warn: function() { 101 | this._log("warn", arguments); 102 | }, 103 | //* Same as _log_, except uses the console's error method (if it exists). 104 | error: function() { 105 | this._log("error", arguments); 106 | }, 107 | //* @protected 108 | _log: function(inMethod, inArgs) { 109 | if (enyo.logging.shouldLog(inMethod)) { 110 | try { 111 | throw new Error(); 112 | } catch(x) { 113 | enyo.logging._log(inMethod, [inArgs.callee.caller.nom + ": "].concat(enyo.cloneArray(inArgs))); 114 | console.log(x.stack); 115 | } 116 | } 117 | } 118 | }); 119 | 120 | //* @protected 121 | 122 | enyo._objectCount = 0; 123 | 124 | enyo.Object.subclass = function(ctor, props) { 125 | this.publish(ctor, props); 126 | }; 127 | 128 | enyo.Object.publish = function(ctor, props) { 129 | var pp = props.published; 130 | if (pp) { 131 | var cp = ctor.prototype; 132 | for (var n in pp) { 133 | enyo.Object.addGetterSetter(n, pp[n], cp); 134 | } 135 | } 136 | }; 137 | 138 | enyo.Object.addGetterSetter = function(inName, inValue, inProto) { 139 | var priv_n = inName; 140 | inProto[priv_n] = inValue; 141 | // 142 | var cap_n = enyo.cap(priv_n); 143 | var get_n = "get" + cap_n; 144 | if (!inProto[get_n]) { 145 | inProto[get_n] = function() { 146 | return this.getProperty(priv_n); 147 | }; 148 | } 149 | // 150 | var set_n = "set" + cap_n; 151 | var change_n = priv_n + "Changed"; 152 | if (!inProto[set_n]) { 153 | inProto[set_n] = function(v) { 154 | this._setProperty(priv_n, v, change_n); 155 | }; 156 | } 157 | }; 158 | -------------------------------------------------------------------------------- /source/touch/TouchScrollStrategy.js: -------------------------------------------------------------------------------- 1 | /** 2 | enyo.TouchScroller is a touch based scroller that integrates the scrolling simulation provided 3 | by enyo.ScrollMath 4 | into a Control. 5 | 6 | enyo.ScrollMath is not typically created in application code. 7 | */ 8 | enyo.kind({ 9 | name: "enyo.TouchScrollStrategy", 10 | kind: enyo.ScrollStrategy, 11 | /** 12 | If true, the scroller will not propagate dragstart events that cause it to start scrolling (defaults to true) 13 | */ 14 | preventDragPropagation: true, 15 | events: { 16 | onScrollStart: "doScrollStart", 17 | onScroll: "doScroll", 18 | onScrollStop: "doScrollStop" 19 | }, 20 | //* @protected 21 | handlers: { 22 | flick: "flickHandler", 23 | hold: "holdHandler", 24 | dragstart: "dragstartHandler", 25 | drag: "dragHandler", 26 | dragfinish: "dragfinishHandler", 27 | mousewheel: "mousewheelHandler", 28 | touchmove: "touchmoveHandler" 29 | }, 30 | classes: "enyo-touch-scroller", 31 | components: [ 32 | {name: "scroll", kind: "ScrollMath"}, 33 | {name: "client", classes: "enyo-fit enyo-touch-scroller", attributes: {"onscroll": enyo.bubbler}} 34 | ], 35 | horizontalChanged: function() { 36 | this.$.scroll.horizontal = this.horizontal; 37 | }, 38 | verticalChanged: function() { 39 | this.$.scroll.vertical = this.vertical; 40 | }, 41 | calcScrollNode: function() { 42 | return this.$.client.hasNode(); 43 | }, 44 | calcAutoScrolling: function() { 45 | var v = this.vertical == "auto"; 46 | var h = this.horizontal == "auto"; 47 | if ((v || h) && this.scrollNode) { 48 | var b = this.getBounds(); 49 | if (v) { 50 | this.$.scroll.vertical = this.node.scrollHeight > b.height; 51 | } 52 | if (h) { 53 | this.$.scroll.horizontal = this.node.scrollWidth > b.width; 54 | } 55 | } 56 | }, 57 | shouldDrag: function(e) { 58 | var requestV = e.vertical; 59 | var canH = this.$.scroll.horizontal; 60 | var canV = this.$.scroll.vertical; 61 | return requestV && canV || !requestV && canH; 62 | }, 63 | flickHandler: function(inSender, e) { 64 | var onAxis = Math.abs(e.xVelocity) > Math.abs(e.yVelocity) ? this.horizontal : this.vertical; 65 | if (onAxis) { 66 | this.$.scroll.flick(e); 67 | return this.preventDragPropagation; 68 | } 69 | }, 70 | holdHandler: function(inSender, e) { 71 | if (this.$.scroll.isScrolling() && !this.$.scroll.isInOverScroll()) { 72 | this.$.scroll.stop(e); 73 | return true; 74 | } 75 | }, 76 | touchmoveHandler: function(inSender, e) { 77 | e.preventDefault(); 78 | }, 79 | // special synthetic DOM events served up by the Gesture system 80 | dragstartHandler: function(inSender, inEvent) { 81 | this.calcAutoScrolling(); 82 | this.dragging = this.shouldDrag(inEvent); 83 | if (this.dragging) { 84 | this.$.scroll.startDrag(inEvent); 85 | if (this.preventDragPropagation) { 86 | return true; 87 | } 88 | } 89 | }, 90 | dragHandler: function(inSender, inEvent) { 91 | if (this.dragging) { 92 | this.$.scroll.drag(inEvent); 93 | } 94 | }, 95 | dragfinishHandler: function(inSender, inEvent) { 96 | if (this.dragging) { 97 | inEvent.preventTap(); 98 | this.$.scroll.dragFinish(); 99 | this.dragging = false; 100 | } 101 | }, 102 | mousewheelHandler: function(inSender, e) { 103 | if (!this.dragging && this.$.scroll.mousewheel(e)) { 104 | e.preventDefault(); 105 | return true; 106 | } 107 | }, 108 | scrollStart: function(inSender) { 109 | if (this.scrollNode) { 110 | var b = this.$.client.getBounds(); 111 | inSender.bottomBoundary = b.height - this.scrollNode.scrollHeight; 112 | inSender.rightBoundary = b.width - this.scrollNode.scrollWidth; 113 | this.doScrollStart(inSender); 114 | } 115 | }, 116 | scroll: function(inSender) { 117 | this.effectScroll(-inSender.x, -inSender.y); 118 | this.doScroll(inSender); 119 | }, 120 | scrollStop: function(inSender) { 121 | this.effectOverscroll(null, null); 122 | this.doScrollStop(inSender); 123 | }, 124 | setScrollLeft: function() { 125 | this.inherited(arguments); 126 | var s = this.$.scroll; 127 | s.x = s.x0 = -this.getScrollLeft(); 128 | }, 129 | setScrollTop: function() { 130 | this.inherited(arguments); 131 | var s = this.$.scroll; 132 | s.y = s.y0 = -this.getScrollTop();; 133 | }, 134 | effectScroll: function(inX, inY) { 135 | if (this.scrollNode) { 136 | this.scrollNode.scrollLeft = inX; 137 | this.scrollNode.scrollTop = inY; 138 | this.effectOverscroll(inX, inY); 139 | } 140 | }, 141 | effectOverscroll: function(inX, inY) { 142 | var n = this.scrollNode; 143 | var o = ""; 144 | if (inY != n.scrollTop && inY !== null) { 145 | o += " translateY(" + (n.scrollTop - inY) + "px)"; 146 | } 147 | if (inX != n.scrollLeft && inX !== null) { 148 | o += " translateX(" + (n.scrollLeft - inX) + "px)"; 149 | } 150 | if (n) { 151 | var s = n.style; 152 | s.webkitTransform = s.MozTransform = s.msTransform = s.transform = o; 153 | } 154 | } 155 | }); 156 | -------------------------------------------------------------------------------- /tools/minifier/node_modules/uglify-js/tmp/instrument2.js: -------------------------------------------------------------------------------- 1 | // sample on how to use the parser and walker API to instrument some code 2 | 3 | var jsp = require("uglify-js").parser; 4 | var pro = require("uglify-js").uglify; 5 | 6 | function instrument(code) { 7 | var ast = jsp.parse(code, false, true); // true for the third arg specifies that we want 8 | // to have start/end tokens embedded in the 9 | // statements 10 | var w = pro.ast_walker(); 11 | 12 | function trace (line, comment) { 13 | var code = pro.gen_code(line, { beautify: true }); 14 | var data = line[0] 15 | 16 | var args = [] 17 | if (!comment) comment = "" 18 | if (typeof data === "object") { 19 | code = code.split(/\n/).shift() 20 | args = [ [ "string", data.toString() ], 21 | [ "string", code ], 22 | [ "num", data.start.line ], 23 | [ "num", data.start.col ], 24 | [ "num", data.end.line ], 25 | [ "num", data.end.col ]] 26 | } else { 27 | args = [ [ "string", data ], 28 | [ "string", code ]] 29 | 30 | } 31 | return [ "call", [ "name", "trace" ], args ]; 32 | } 33 | 34 | // we're gonna need this to push elements that we're currently looking at, to avoid 35 | // endless recursion. 36 | var analyzing = []; 37 | function do_stat() { 38 | var ret; 39 | if (this[0].start && analyzing.indexOf(this) < 0) { 40 | // without the `analyzing' hack, w.walk(this) would re-enter here leading 41 | // to infinite recursion 42 | analyzing.push(this); 43 | ret = [ "splice", 44 | [ [ "stat", trace(this) ], 45 | w.walk(this) ]]; 46 | analyzing.pop(this); 47 | } 48 | return ret; 49 | } 50 | 51 | function do_cond(c, t, f) { 52 | return [ this[0], w.walk(c), 53 | ["seq", trace(t), w.walk(t) ], 54 | ["seq", trace(f), w.walk(f) ]]; 55 | } 56 | 57 | function do_binary(c, l, r) { 58 | if (c !== "&&" && c !== "||") { 59 | return [this[0], c, w.walk(l), w.walk(r)]; 60 | } 61 | return [ this[0], c, 62 | ["seq", trace(l), w.walk(l) ], 63 | ["seq", trace(r), w.walk(r) ]]; 64 | } 65 | 66 | var new_ast = w.with_walkers({ 67 | "stat" : do_stat, 68 | "label" : do_stat, 69 | "break" : do_stat, 70 | "continue" : do_stat, 71 | "debugger" : do_stat, 72 | "var" : do_stat, 73 | "const" : do_stat, 74 | "return" : do_stat, 75 | "throw" : do_stat, 76 | "try" : do_stat, 77 | "defun" : do_stat, 78 | "if" : do_stat, 79 | "while" : do_stat, 80 | "do" : do_stat, 81 | "for" : do_stat, 82 | "for-in" : do_stat, 83 | "switch" : do_stat, 84 | "with" : do_stat, 85 | "conditional" : do_cond, 86 | "binary" : do_binary 87 | }, function(){ 88 | return w.walk(ast); 89 | }); 90 | return pro.gen_code(new_ast, { beautify: true }); 91 | } 92 | 93 | 94 | ////// test code follows. 95 | 96 | var code = instrument(test.toString()); 97 | console.log(code); 98 | 99 | function test() { 100 | // simple stats 101 | a = 5; 102 | c += a + b; 103 | "foo"; 104 | 105 | // var 106 | var foo = 5; 107 | const bar = 6, baz = 7; 108 | 109 | // switch block. note we can't track case lines the same way. 110 | switch ("foo") { 111 | case "foo": 112 | return 1; 113 | case "bar": 114 | return 2; 115 | } 116 | 117 | // for/for in 118 | for (var i = 0; i < 5; ++i) { 119 | console.log("Hello " + i); 120 | } 121 | for (var i in [ 1, 2, 3]) { 122 | console.log(i); 123 | } 124 | 125 | for (var i = 0; i < 5; ++i) 126 | console.log("foo"); 127 | 128 | for (var i = 0; i < 5; ++i) { 129 | console.log("foo"); 130 | } 131 | 132 | var k = plurp() ? 1 : 0; 133 | var x = a ? doX(y) && goZoo("zoo") 134 | : b ? blerg({ x: y }) 135 | : null; 136 | 137 | var x = X || Y; 138 | } 139 | -------------------------------------------------------------------------------- /source/touch/Scroller.js: -------------------------------------------------------------------------------- 1 | /** 2 | enyo.Scroller is scroller suitable for use in both desktop and mobile applications. 3 | 4 | In some mobile environments, a default scrolling solution is not implemented for dom elements. In these cases, enyo.Scroller implements 5 | a touch based scrolling solution. This can be opted into either globally by setting the flag enyo.Scroller.touchScrolling = true; 6 | or on a per instance basis by specifying a strategyKind of "TouchScrollStrategy." 7 | 8 | */ 9 | enyo.kind({ 10 | name: "enyo.Scroller", 11 | kind: enyo.Control, 12 | published: { 13 | /** 14 | Set to false to prevent horizontal scrolling. 15 | */ 16 | horizontal: true, 17 | /** 18 | Set to false to prevent vertical scrolling. 19 | */ 20 | vertical: true, 21 | /** 22 | Sets the vertical scroll position. 23 | */ 24 | scrollTop: 0, 25 | /** 26 | Sets the horizontal scroll position. 27 | */ 28 | scrollLeft: 0, 29 | /** 30 | Specify a type of scrolling. The enyo Scroller will attempt to automatically select 31 | a strategy compatbile with the runtime environment. A specific strategy can also be chosen: 32 | "ScrollStrategy" is the default and implements no scrolling, relying instead on the environment to scroll properly. 33 | "TouchScrollStrategy" implements a touch scrolling mechanism. 34 | */ 35 | strategyKind: "ScrollStrategy" 36 | }, 37 | events: { 38 | onScrollStart: "", 39 | onScroll: "", 40 | onScrollStop: "" 41 | }, 42 | /** 43 | If true, the scroller will not propagate dragstart events that cause it to start scrolling (defaults to true) 44 | */ 45 | preventDragPropagation: true, 46 | statics: { 47 | osInfo: [ 48 | {os: "Android", version: 3}, 49 | {os: "iPhone", version: 5}, 50 | {os: "iPad", version: 5}, 51 | {os: "webos", version: 1e9} 52 | ], 53 | calcOsVersion: function(inTest, inOs) { 54 | var m = inTest.match(new RegExp(inOs + ".*?([0-9])", "i")); 55 | if (m) { 56 | return Number(m[1]); 57 | } 58 | }, 59 | hasTouchScrolling: function() { 60 | var ua = navigator.userAgent; 61 | for (var i=0, t, m; t=this.osInfo[i]; i++) { 62 | if (this.calcOsVersion(ua, t.os) >= t.version) { 63 | return true; 64 | } 65 | } 66 | }, 67 | hasNativeScrolling: function() { 68 | var ua = navigator.userAgent; 69 | for (var i=0, t, m; t=this.osInfo[i]; i++) { 70 | if (this.calcOsVersion(ua, t.os) < t.version) { 71 | return false; 72 | } 73 | } 74 | return true; 75 | } 76 | }, 77 | //* @protected 78 | controlParentName: "strategy", 79 | create: function() { 80 | this.inherited(arguments); 81 | this.addClass("enyo-scroller"); 82 | this.horizontalChanged(); 83 | this.verticalChanged(); 84 | }, 85 | importProps: function(inProps) { 86 | this.inherited(arguments); 87 | // allow global overriding of strategy kind 88 | if (inProps.strategyKind === undefined && enyo.Scroller.forceTouchScrolling) { 89 | this.strategyKind = "TouchScrollStrategy"; 90 | } 91 | }, 92 | initComponents: function() { 93 | this.strategyKindChanged(); 94 | this.inherited(arguments); 95 | }, 96 | rendered: function() { 97 | this.inherited(arguments); 98 | this.cachedPosition = null; 99 | }, 100 | strategyKindChanged: function() { 101 | if (this.$.strategy) { 102 | this.$.strategy.destroy(); 103 | this.controlParent = null; 104 | } 105 | this.createComponent({name: "strategy", classes: "enyo-fit", kind: this.strategyKind, preventDragPropagation: this.preventDragPropagation, isChrome: true}); 106 | if (this.hasNode()) { 107 | this.discoverControlParent(); 108 | this.render(); 109 | } 110 | }, 111 | showingChanged: function() { 112 | if (!this.showing) { 113 | this.cacheScrollPosition(); 114 | this.setScrollLeft(0); 115 | this.setScrollTop(0); 116 | } 117 | this.inherited(arguments); 118 | if (this.showing) { 119 | this.restoreScrollPosition(); 120 | } 121 | }, 122 | cacheScrollPosition: function() { 123 | this.cachedPosition = {left: this.getScrollLeft(), top: this.getScrollTop()}; 124 | }, 125 | restoreScrollPosition: function() { 126 | if (this.cachedPosition) { 127 | this.setScrollLeft(this.cachedPosition.left); 128 | this.setScrollTop(this.cachedPosition.top); 129 | } 130 | }, 131 | horizontalChanged: function() { 132 | this.$.strategy.setHorizontal(this.horizontal); 133 | }, 134 | verticalChanged: function() { 135 | this.$.strategy.setVertical(this.vertical); 136 | }, 137 | // FIXME: these properties are virtual; property changed methods are fired only if 138 | // property value changes, not if getter changes. 139 | setScrollLeft: function(inLeft) { 140 | this.scrollLeft = inLeft; 141 | this.$.strategy.setScrollLeft(this.scrollLeft); 142 | }, 143 | setScrollTop: function(inTop) { 144 | this.scrollTop = inTop; 145 | this.$.strategy.setScrollTop(inTop); 146 | }, 147 | getScrollLeft: function() { 148 | return this.$.strategy.getScrollLeft(); 149 | }, 150 | getScrollTop: function() { 151 | return this.$.strategy.getScrollTop(); 152 | }, 153 | scrollIntoView: function(inControl, inAlignWithTop) { 154 | this.$.strategy.scrollIntoView(inX, inY, inToTop); 155 | }, 156 | scrollTo: function(inX, inY) { 157 | this.$.strategy.scrollTo(inX, inY); 158 | } 159 | }); 160 | 161 | // provide a touch scrolling solution by default when the environment has no native scrolling. 162 | if (!enyo.Scroller.hasNativeScrolling()) { 163 | enyo.Scroller.prototype.strategyKind = "TouchScrollStrategy"; 164 | } -------------------------------------------------------------------------------- /tools/test/test.js: -------------------------------------------------------------------------------- 1 | 2 | // minifier: path aliases 3 | 4 | enyo.path.addPaths({}); 5 | 6 | // TestRunner.js 7 | 8 | enyo.kind({ 9 | name: "enyo.TestRunner", 10 | kind: enyo.Control, 11 | index: 0, 12 | rendered: function() { 13 | this.inherited(arguments), this.next(); 14 | }, 15 | next: function() { 16 | var a = enyo.TestSuite.tests[this.index++]; 17 | a && (a = a.prototype.kindName, this.createComponent({ 18 | name: a, 19 | kind: enyo.TestReporter, 20 | onFinishAll: "next" 21 | }).render(), this.$[a].runTests()); 22 | } 23 | }); 24 | 25 | // TestSuite.js 26 | 27 | enyo.kind({ 28 | name: "enyo.TestSuite", 29 | kind: enyo.Component, 30 | events: { 31 | onBegin: "", 32 | onFinish: "", 33 | onFinishAll: "" 34 | }, 35 | components: [], 36 | timeout: 3e3, 37 | timeoutMessage: "timed out", 38 | resetTimeout: function(a) { 39 | this.clearTimer(), this.timer = window.setTimeout(enyo.bind(this, "timedout"), a || this.timeout); 40 | }, 41 | log: function(a) { 42 | this.logMessages = this.logMessages || [], typeof a != "string" && (a = JSON.stringify(a)), this.logMessages.push(a); 43 | }, 44 | beforeEach: function() {}, 45 | afterEach: function() {}, 46 | runAllTests: function() { 47 | if (this.autoRunNextTest) { 48 | console.error("TestSuite.runAllTests: Already running."); 49 | return; 50 | } 51 | this.testNames = this.getTestNames(), this.index = 0, this.autoRunNextTest = !0, this.next(); 52 | }, 53 | create: function(a) { 54 | this.inherited(arguments); 55 | }, 56 | getTestNames: function() { 57 | var a = []; 58 | for (var b in this) /^test/.test(b) && a.push(b); 59 | return a; 60 | }, 61 | next: function() { 62 | var a; 63 | if (!this.autoRunNextTest) return; 64 | a = this.testNames[this.index++], this.current = a, a ? (this.$[a] && this.$[a].destroy(), this.createComponent({ 65 | name: a, 66 | kind: this.kind, 67 | onBegin: "childTestBegun", 68 | onFinish: "childTestFinished" 69 | }), this.$[a].runTest(a)) : (this.autoRunNextTest = !1, this.doFinishAll()); 70 | }, 71 | runTest: function(a) { 72 | this.resetTimeout(), this.doBegin(); 73 | try { 74 | this.beforeEach(), this[a](); 75 | } catch (b) { 76 | this.finish(b); 77 | } 78 | }, 79 | timedout: function() { 80 | this.finish(this.timeoutMessage); 81 | }, 82 | clearTimer: function() { 83 | window.clearTimeout(this.timer); 84 | }, 85 | finish: function(a) { 86 | var b = this, c = arguments; 87 | window.setTimeout(function() { 88 | b.reallyFinish.apply(b, c); 89 | }, 0); 90 | }, 91 | reallyFinish: function(a) { 92 | if (this.results) { 93 | console.warn("Finish called more than once in test " + this.name); 94 | if (!this.results.passed || !a) return; 95 | } 96 | this.results = { 97 | suite: this.kindName, 98 | name: this.name, 99 | passed: !a, 100 | logs: this.logMessages 101 | }; 102 | if (a) { 103 | typeof a == "string" ? this.results.message = a : a.message !== undefined ? (this.results.message = a.message, this.results.exception = a) : (this.results.message = a.errorText || a.toString(), this.results.failValue = a); 104 | if (!this.results.exception && a !== this.timeoutMessage) try { 105 | throw new Error(a); 106 | } catch (b) { 107 | this.results.exception = b; 108 | } 109 | } 110 | this.clearTimer(); 111 | if (this.afterEach) { 112 | try { 113 | this.afterEach(); 114 | } catch (c) { 115 | this.afterEach = null, this.finish(c); 116 | } 117 | this.afterEach = null; 118 | } 119 | this.doFinish(this.results); 120 | }, 121 | childTestBegun: function(a) { 122 | this.triggeredNextTest = !1, this.doBegin(a.name); 123 | }, 124 | childTestFinished: function(a, b) { 125 | this.doFinish(b), this.triggeredNextTest || (this.triggeredNextTest = !0, enyo.asyncMethod(this, "next")); 126 | } 127 | }), enyo.TestSuite.tests = [], enyo.TestSuite.subclass = function(a, b) { 128 | b.testBase || enyo.TestSuite.tests.push(a); 129 | }; 130 | 131 | // TestReporter.js 132 | 133 | enyo.kind({ 134 | name: "enyo.TestReporter", 135 | kind: enyo.Control, 136 | published: { 137 | results: null 138 | }, 139 | events: { 140 | onFinishAll: "" 141 | }, 142 | components: [ { 143 | name: "title", 144 | classes: "enyo-testcase-title" 145 | }, { 146 | name: "group", 147 | classes: "enyo-testcase-group", 148 | components: [] 149 | } ], 150 | timeout: 3e3, 151 | create: function(a) { 152 | this.inherited(arguments), this.addClass("enyo-testcase"), this.$.title.setContent(this.name); 153 | }, 154 | initComponents: function() { 155 | this.inherited(arguments), this.createComponent({ 156 | name: "testSuite", 157 | kind: this.name, 158 | onBegin: "testBegun", 159 | onFinish: "updateTestDisplay", 160 | onFinishAll: "suiteFinished" 161 | }); 162 | }, 163 | runTests: function() { 164 | this.$.testSuite.runAllTests(); 165 | }, 166 | testBegun: function(a, b) { 167 | this.$.group.createComponent({ 168 | name: b, 169 | classes: "enyo-testcase-running", 170 | content: b + ": running" 171 | }).render(); 172 | }, 173 | suiteFinished: function() { 174 | this.doFinishAll(); 175 | }, 176 | formatStackTrace: function(a) { 177 | var b = a.split("\n"), c = [ "" ]; 178 | for (var d = 0, e; e = b[d]; d++) { 179 | if (e.indexOf(" at Object.do") == 0 || e.indexOf(" at Object.dispatchIndirectly") == 0 || e.indexOf("TestSuite.js") != -1) continue; 180 | c.push(e); 181 | } 182 | return c.join("
"); 183 | }, 184 | updateTestDisplay: function(a, b) { 185 | var c = b.exception, d = this.$.group.$[b.name], e = "" + b.name + ": " + (b.passed ? "PASSED" : b.message); 186 | c && (c.stack ? e += this.formatStackTrace(c.stack) : c.sourceURL && c.line && (e += "
" + c.sourceURL + ":" + c.line), b.failValue && (e += "
" + enyo.json.stringify(b.failValue).replace(/\\n/g, "
"))), !b.passed && b.logs && (e += "
" + b.logs.join("
")), d.setContent(e), d.setClasses("enyo-testcase-" + (b.passed ? "passed" : "failed")); 187 | } 188 | }); 189 | -------------------------------------------------------------------------------- /source/dom/gesture.js: -------------------------------------------------------------------------------- 1 | //* @public 2 | /** 3 | Enyo supports a set of cross-platform gesture events that work similarly on all supported platforms. These events are 4 | provided so that users can write a single set of event handlers for applications that run on both mobile and 5 | desktop platforms. They are needed because desktop and mobile platforms handle basic gestures differently. 6 | For example, desktop platforms provide mouse events while mobile platforms support touch events and a limited 7 | set of mouse events for backward compatibility. 8 | 9 | The following events are available: 10 | 11 | * "down" - generated when the pointer is pressed down. 12 | * "up" - generated when the pointer is released up. 13 | * "tap" - genereted when the pointer is pressed down and released up. The target is the lowest dom element that received both 14 | the related down and up events. 15 | * "move" - generated when the pointer moves. 16 | * "enter" - generated when the pointer enters a dom node. 17 | * "leave" - generated when the pointer leaves a dom node. 18 | * "hold" - generated when the pointer is held down without moving for a short period (about 200ms). 19 | * "release" - generated when the pointer is released after being held down. The target is the same as the hold event. 20 | * "holdpulse" - generated when the pointer is held down without moving for a short period and periodically thereafter about every 200ms. 21 | Use this event to trigger an action after an arbitrary period of time. The holdTime property provides the elapsed time. 22 | * "flick" - generated when the user flicks the pointer quickly. This event provides flick velocity data: xVelocity is the velocity in the horizontal and 23 | yVelocity is the vertical velocity. 24 | 25 | These events are synthesized from the available dom events and contain these common properties, when available: "target", 26 | relatedTarget", "clientX", "clientY", "pageX", "pageY", "screenX", "screenY", "altKey", "ctrlKey", "metaKey", "shiftKey", 27 | "detail", "identifier." 28 | 29 | Please note that enyo's gesture events are generated on enyo controls, not dom elements. 30 | 31 | */ 32 | enyo.gesture = { 33 | //* @protected 34 | holdPulseDelay: 200, 35 | minFlick: 0.1, 36 | minTrack: 8, 37 | eventProps: ["target", "relatedTarget", "clientX", "clientY", "pageX", "pageY", "screenX", "screenY", "altKey", "ctrlKey", "metaKey", "shiftKey", 38 | "detail", "identifier", "dispatchTarget"], 39 | makeEvent: function(inType, inEvent) { 40 | var e = {type: inType}; 41 | for (var i=0, p; p=this.eventProps[i]; i++) { 42 | e[p] = inEvent[p]; 43 | } 44 | return e; 45 | }, 46 | down: function(inEvent) { 47 | var e = this.makeEvent("down", inEvent); 48 | enyo.dispatch(e); 49 | this.startTracking(e); 50 | this.target = e.target; 51 | this.dispatchTarget = e.dispatchTarget; 52 | this.beginHold(e); 53 | }, 54 | move: function(inEvent) { 55 | this.cancelHold(); 56 | var e = this.makeEvent("move", inEvent); 57 | enyo.dispatch(e); 58 | if (this.trackInfo) { 59 | this.track(e); 60 | } 61 | }, 62 | up: function(inEvent) { 63 | this.cancelHold(); 64 | var e = this.makeEvent("up", inEvent); 65 | var tapPrevented = false; 66 | e.preventTap = function() { 67 | tapPrevented = true; 68 | }; 69 | this.endTracking(e); 70 | enyo.dispatch(e); 71 | if (!tapPrevented) { 72 | this.sendTap(e); 73 | } 74 | }, 75 | startTracking: function(e) { 76 | this.trackInfo = {}; 77 | this.flickable = false; 78 | this.track(e); 79 | }, 80 | track: function(inEvent) { 81 | //this.flickable = false; 82 | var ti = this.trackInfo; 83 | var s = ti.last; 84 | if (s) { 85 | // setting max hz to 120 helps avoid spaz data 86 | ti.time = new Date().getTime(); 87 | var dt = ti.dt = Math.max(this.minTrack, ti.time - s.time); 88 | var x = ti.vx = (inEvent.pageX - s.x) / dt; 89 | var y = ti.vy = (inEvent.pageY - s.y) / dt; 90 | var v = ti.v = Math.sqrt(x*x + y*y); 91 | this.flickable = v > this.minFlick; 92 | } 93 | ti.last = {x: inEvent.pageX, y: inEvent.pageY, time: new Date().getTime()}; 94 | }, 95 | endTracking: function(e) { 96 | if (this.flickable && this.trackInfo && (new Date().getTime() - this.trackInfo.time < this.minTrack)) { 97 | this.sendFlick(e); 98 | } 99 | this.trackInfo = null; 100 | }, 101 | over: function(inEvent) { 102 | enyo.dispatch(this.makeEvent("enter", inEvent)); 103 | }, 104 | out: function(inEvent) { 105 | enyo.dispatch(this.makeEvent("leave", inEvent)); 106 | }, 107 | beginHold: function(inEvent) { 108 | this.holdStart = new Date().getTime(); 109 | this.holdJob = setInterval(enyo.bind(this, "sendHoldPulse", inEvent), this.holdPulseDelay); 110 | }, 111 | cancelHold: function() { 112 | clearInterval(this.holdJob); 113 | this.holdJob = null; 114 | if (this.sentHold) { 115 | this.sentHold = false; 116 | this.sendRelease(this.holdEvent); 117 | } 118 | }, 119 | sendHoldPulse: function(inEvent) { 120 | if (!this.sentHold) { 121 | this.sentHold = true; 122 | this.sendHold(inEvent); 123 | } 124 | var e = this.makeEvent("holdpulse", inEvent); 125 | e.holdTime = new Date().getTime() - this.holdStart; 126 | enyo.dispatch(e); 127 | }, 128 | sendHold: function(inEvent) { 129 | this.holdEvent = inEvent; 130 | var e = this.makeEvent("hold", inEvent); 131 | enyo.dispatch(e); 132 | }, 133 | sendRelease: function(inEvent) { 134 | var e = this.makeEvent("release", inEvent); 135 | enyo.dispatch(e); 136 | }, 137 | sendTap: function(inEvent) { 138 | // The common ancestor for the down/up pair is the origin for the tap event 139 | var t = this.findCommonAncestor(this.target, inEvent.target); 140 | if (t) { 141 | var e = this.makeEvent("tap", inEvent); 142 | e.target = t; 143 | enyo.dispatch(e); 144 | } 145 | }, 146 | findCommonAncestor: function(inA, inB) { 147 | var p = inB; 148 | while (p) { 149 | if (this.isTargetDescendantOf(inA, p)) { 150 | return p; 151 | } 152 | p = p.parentNode; 153 | } 154 | }, 155 | isTargetDescendantOf: function(inChild, inParent) { 156 | var c = inChild; 157 | while(c) { 158 | if (c == inParent) { 159 | return true; 160 | } 161 | c = c.parentNode; 162 | } 163 | }, 164 | sendFlick: function(inEvent) { 165 | var e = this.makeEvent("flick", inEvent); 166 | e.xVelocity = this.trackInfo.vx; 167 | e.yVelocity = this.trackInfo.vy; 168 | e.velocity = this.trackInfo.v; 169 | e.target = this.target; 170 | enyo.dispatch(e); 171 | } 172 | }; 173 | 174 | //* @protected 175 | enyo.dispatcher.features.push( 176 | function(e) { 177 | // NOTE: beware of properties in enyo.gesture inadvertantly mapped to event types 178 | if (enyo.gesture.events[e.type]) { 179 | return enyo.gesture.events[e.type](e); 180 | } 181 | } 182 | ); 183 | 184 | enyo.gesture.events = { 185 | mousedown: function(e) { 186 | enyo.gesture.down(e); 187 | }, 188 | mouseup: function(e) { 189 | enyo.gesture.up(e); 190 | }, 191 | mousemove: function(e) { 192 | enyo.gesture.move(e); 193 | }, 194 | mouseover: function(e) { 195 | enyo.gesture.over(e); 196 | }, 197 | mouseout: function(e) { 198 | enyo.gesture.out(e); 199 | } 200 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Quick Info 2 | 3 | ## Core 4 | 5 | This repository contains Enyo core. We've pared it down to the essentials, so folks can work at the metal. Widget libraries, g11n code, and other fancy bits are optional packages. 6 | 7 | ## Lib 8 | 9 | Packages should go in a folder named _lib_ (e.g. the _extra_ or _canvas_ repositories on GitHub). _lib_ is a magic name that enyo uses to work with add-on packages. It's recommended you create a _lib_ folder as sibling to _enyo_ and keep your packages there, but you can make as many _lib_ folders as you like and put them anywhere. 10 | 11 | ## Api Viewer 12 | 13 | The Api Viewer application parses and renders documentation in real-time from the Enyo source. Run the application by loading _tools/api/index.html_. 14 | 15 | ## Warning about file:// 16 | 17 | _Note_: in Chrome, various samples will not work from file:// because of Chrome's security policy. Run from a local http server, use the --allow-file-access-from-files in Chrome, or use the online versions at http://enyojs.com. 18 | 19 | # What Is Enyo 20 | 21 | Enyo is an object-oriented JavaScript application framework emphasizing modularity and encapsulation. Enyo is suitable for small and large-scale applications. 22 | 23 | Enyo up to 1.x was the underlying framework used to develop applications for HP's TouchPad tablet. Enyo as shipped on the TouchPad included an complete set of user interface components and service wrappers. What you will find here is Enyo 2, what we informally call _core_: the primary infrastructure needed to support any number of Enyo-based libraries. Not to worry, Enyo 1.x itself is open-source licensed, and work is progressing on packaging up those controls and goodies to work with Enyo 2. 24 | 25 | Enyo was designed from the beginning to be highly extensible. This repository reflects a small working set of code, that can be expanded with any number of libraries or plugins. 26 | 27 | Enyo 2 is lightweight (at the time of this writing, roughly 13k gzipped), easy to digest, and powerful. 28 | 29 | # What Do I Get 30 | 31 | The core code includes the Enyo kernel, the DOM extensions, and some Ajax (XHR) tools. These things are actually separable (it's easy to make micro-builds of Enyo), but we believe this is a useful working set. 32 | 33 | The Enyo 2 kernel provides a modularity concept (Component) and a view concept (UiComponent). The DOM aspect includes a widget concept (Control) and an extensible event system (Dispatcher). The Ajax package includes basic xhr functionality and an implementation of xhr as a Component (Ajax). 34 | 35 | Just these pieces are sufficient to create large applications using the Enyo encapsulation model. Developers that want only this low-level code are encouraged to roll-their-own. For those that want a richer set of tools, there are some pre-built libraries already available, and much more on the way. 36 | 37 | # Why Do I Care 38 | 39 | First is our emphasis on cross-platform: Enyo core works on both desktop and mobile browsers. 40 | 41 | Second is Enyo's building block approach to applications. Each piece of an application is a Component, and Components are constructed out of other Components. 42 | 43 | For example, it's easy to define a combination of an 44 | 45 | 46 | 47 | tag with a 48 | 49 |