diff options
author | Francois-Xavier KOWALSKI <francois-xavier.kowalski@hp.com> | 2012-10-26 19:40:48 +0200 |
---|---|---|
committer | Francois-Xavier KOWALSKI <francois-xavier.kowalski@hp.com> | 2012-10-26 19:40:48 +0200 |
commit | 78039d054cd1568e0e891a4f079d2e934e7d9061 (patch) | |
tree | b4027dff04eb6ff47e8025cade7f48f2b3b57394 | |
parent | d7d72296d52a609d36d01464f582c8c9d7c0b1ed (diff) | |
parent | b8e9776bb1be9142c5bbeb8e8a3782be6fe9f7d3 (diff) | |
download | biblez-ng-78039d054cd1568e0e891a4f079d2e934e7d9061.tar.gz |
Merge branch 'master' into ENYO-1259
Conflicts:
tools/deploy.bat
-rw-r--r-- | api/assets/manifest.json | 3 | ||||
-rw-r--r-- | api/build/app.css | 14 | ||||
-rw-r--r-- | api/build/app.js | 656 | ||||
-rw-r--r-- | api/build/enyo.css | 6 | ||||
-rw-r--r-- | api/build/enyo.js | 339 | ||||
m--------- | enyo | 0 | ||||
m--------- | lib/layout | 0 | ||||
m--------- | lib/onyx | 0 |
8 files changed, 768 insertions, 250 deletions
diff --git a/api/assets/manifest.json b/api/assets/manifest.json index c16c52a..b3fb186 100644 --- a/api/assets/manifest.json +++ b/api/assets/manifest.json @@ -1,8 +1,9 @@ { - "version": "2.0.1", + "version": "2.1", "packages": [ {"name": "enyo", "path": "../enyo/source"}, {"name": "layout/fittable", "path": "../lib/layout/fittable"}, + {"name": "layout/imageview", "path": "../lib/layout/imageview"}, {"name": "layout/list", "path": "../lib/layout/list"}, {"name": "layout/panels", "path": "../lib/layout/panels"}, {"name": "layout/slideable", "path": "../lib/layout/slideable"}, diff --git a/api/build/app.css b/api/build/app.css index 10b0da4..685a1db 100644 --- a/api/build/app.css +++ b/api/build/app.css @@ -1,5 +1,5 @@ -/* /Users/bencombee/git/enyojs/api-tool/enyo/tools/../../lib/layout/fittable/source/FittableLayout.css */ +/* /home/enyojs/git/api-tool/enyo/tools/../../lib/layout/fittable/source/FittableLayout.css */ .enyo-fittable-rows-layout { position: relative; @@ -71,7 +71,7 @@ margin-bottom: 0 !important; } -/* /Users/bencombee/git/enyojs/api-tool/enyo/tools/../../lib/layout/list/source/List.css */ +/* /home/enyojs/git/api-tool/enyo/tools/../../lib/layout/list/source/List.css */ .enyo-list { position: relative; @@ -80,7 +80,7 @@ .enyo-list-port { overflow: hidden; position: relative; - height: 10000000px; + height: 1000000px; } .enyo-list-page { @@ -89,7 +89,7 @@ right: 0; } -/* /Users/bencombee/git/enyojs/api-tool/enyo/tools/../../lib/layout/list/source/PulldownList.css */ +/* /home/enyojs/git/api-tool/enyo/tools/../../lib/layout/list/source/PulldownList.css */ .enyo-list-pulldown { position: absolute; @@ -152,7 +152,7 @@ -ms-transform: rotate(180deg); } -/* /Users/bencombee/git/enyojs/api-tool/enyo/tools/../../lib/layout/panels/source/arrangers/Arranger.css */ +/* /home/enyojs/git/api-tool/enyo/tools/../../lib/layout/panels/source/arrangers/Arranger.css */ .enyo-arranger { position: relative; @@ -185,7 +185,7 @@ } -/* /Users/bencombee/git/enyojs/api-tool/enyo/tools/../../lib/layout/panels/source/Panels.css */ +/* /home/enyojs/git/api-tool/enyo/tools/../../lib/layout/panels/source/Panels.css */ .enyo-panels { } @@ -200,7 +200,7 @@ } } -/* /Users/bencombee/git/enyojs/api-tool/enyo/tools/../../lib/layout/tree/source/Node.css */ +/* /home/enyojs/git/api-tool/enyo/tools/../../lib/layout/tree/source/Node.css */ .enyo-node { cursor: default; diff --git a/api/build/app.js b/api/build/app.js index acf74e0..22f1636 100644 --- a/api/build/app.js +++ b/api/build/app.js @@ -1,7 +1,7 @@ // minifier: path aliases -enyo.path.addPaths({layout: "/Users/bencombee/git/enyojs/api-tool/enyo/tools/../../lib/layout/"}); +enyo.path.addPaths({layout: "/home/enyojs/git/api-tool/enyo/tools/../../lib/layout/"}); // FittableLayout.js @@ -76,6 +76,7 @@ enyo.kind({ name: "enyo.FlyweightRepeater", published: { count: 0, +noSelect: !1, multiSelect: !1, toggleSelected: !1, clientClasses: "", @@ -84,6 +85,7 @@ clientStyle: "" events: { onSetupItem: "" }, +bottomUp: !1, components: [ { kind: "Selection", onSelect: "selectDeselect", @@ -92,9 +94,11 @@ onDeselect: "selectDeselect" name: "client" } ], rowOffset: 0, -bottomUp: !1, create: function() { -this.inherited(arguments), this.multiSelectChanged(), this.clientClassesChanged(), this.clientStyleChanged(); +this.inherited(arguments), this.noSelectChanged(), this.multiSelectChanged(), this.clientClassesChanged(), this.clientStyleChanged(); +}, +noSelectChanged: function() { +this.noSelect && this.$.selection.clear(); }, multiSelectChanged: function() { this.$.selection.setMulti(this.multiSelect); @@ -114,7 +118,7 @@ selected: this.isSelected(e) generateChildHtml: function() { var e = ""; this.index = null; -for (var t = 0, n = 0; t < this.count; t++) n = this.rowOffset + (this.bottomUp ? this.count - t - 1 : t), this.setupItem(n), this.$.client.setAttribute("index", n), e += this.inherited(arguments), this.$.client.teardownRender(); +for (var t = 0, n = 0; t < this.count; t++) n = this.rowOffset + (this.bottomUp ? this.count - t - 1 : t), this.setupItem(n), this.$.client.setAttribute("data-enyo-index", n), e += this.inherited(arguments), this.$.client.teardownRender(); return e; }, previewDomEvent: function(e) { @@ -126,6 +130,7 @@ var r = t && t.index != null ? t.index : this.index; t && r != null && (t.index = r, t.flyweight = this), this.inherited(arguments); }, tap: function(e, t) { +if (this.noSelect) return; this.toggleSelected ? this.$.selection.toggle(t.index) : this.$.selection.select(t.index); }, selectDeselect: function(e, t) { @@ -143,14 +148,14 @@ t && (this.setupItem(e), t.innerHTML = this.$.client.generateChildHtml(), this.$ }, fetchRowNode: function(e) { if (this.hasNode()) { -var t = this.node.querySelectorAll('[index="' + e + '"]'); +var t = this.node.querySelectorAll('[data-enyo-index="' + e + '"]'); return t && t[0]; } }, rowForEvent: function(e) { var t = e.target, n = this.hasNode().id; while (t && t.parentNode && t.id != n) { -var r = t.getAttribute && t.getAttribute("index"); +var r = t.getAttribute && t.getAttribute("data-enyo-index"); if (r !== null) return Number(r); t = t.parentNode; } @@ -185,6 +190,7 @@ published: { count: 0, rowsPerPage: 50, bottomUp: !1, +noSelect: !1, multiSelect: !1, toggleSelected: !1, fixedHeight: !1 @@ -218,7 +224,7 @@ classes: "enyo-list-page" } ] } ], create: function() { -this.pageHeights = [], this.inherited(arguments), this.getStrategy().translateOptimized = !0, this.bottomUpChanged(), this.multiSelectChanged(), this.toggleSelectedChanged(); +this.pageHeights = [], this.inherited(arguments), this.getStrategy().translateOptimized = !0, this.bottomUpChanged(), this.noSelectChanged(), this.multiSelectChanged(), this.toggleSelectedChanged(); }, createStrategy: function() { this.controlParentName = "strategy", this.inherited(arguments), this.createChrome(this.listTools), this.controlParentName = "client", this.discoverControlParent(); @@ -232,6 +238,9 @@ this.inherited(arguments), this.refresh(); bottomUpChanged: function() { this.$.generator.bottomUp = this.bottomUp, this.$.page0.applyStyle(this.pageBound, null), this.$.page1.applyStyle(this.pageBound, null), this.pageBound = this.bottomUp ? "bottom" : "top", this.hasNode() && this.reset(); }, +noSelectChanged: function() { +this.$.generator.setNoSelect(this.noSelect); +}, multiSelectChanged: function() { this.$.generator.setMultiSelect(this.multiSelect); }, @@ -258,8 +267,8 @@ o != s && s > 0 && (this.pageHeights[e] = s, this.portSize += s - o); } }, update: function(e) { -var t = !1, n = this.positionToPageInfo(e), r = n.pos + this.scrollerHeight / 2, i = Math.floor(r / Math.max(n.height, this.scrollerHeight) + .5) + n.no, s = i % 2 == 0 ? i : i - 1; -this.p0 != s && this.isPageInRange(s) && (this.generatePage(s, this.$.page0), this.positionPage(s, this.$.page0), this.p0 = s, t = !0), s = i % 2 == 0 ? Math.max(1, i - 1) : i, this.p1 != s && this.isPageInRange(s) && (this.generatePage(s, this.$.page1), this.positionPage(s, this.$.page1), this.p1 = s, t = !0), t && !this.fixedHeight && (this.adjustBottomPage(), this.adjustPortSize()); +var t = !1, n = this.positionToPageInfo(e), r = n.pos + this.scrollerHeight / 2, i = Math.floor(r / Math.max(n.height, this.scrollerHeight) + .5) + n.no, s = i % 2 === 0 ? i : i - 1; +this.p0 != s && this.isPageInRange(s) && (this.generatePage(s, this.$.page0), this.positionPage(s, this.$.page0), this.p0 = s, t = !0), s = i % 2 === 0 ? Math.max(1, i - 1) : i, this.p1 != s && this.isPageInRange(s) && (this.generatePage(s, this.$.page1), this.positionPage(s, this.$.page1), this.p1 = s, t = !0), t && !this.fixedHeight && (this.adjustBottomPage(), this.adjustPortSize()); }, updateForPosition: function(e) { this.update(this.calcPos(e)); @@ -354,6 +363,9 @@ return this.$.generator.getSelection(); select: function(e, t) { return this.getSelection().select(e, t); }, +deselect: function(e) { +return this.getSelection().deselect(e); +}, isSelected: function(e) { return this.$.generator.isSelected(e); }, @@ -494,6 +506,60 @@ this.$.icon.setClasses(this.iconClass); } }); +// AroundList.js + +enyo.kind({ +name: "enyo.AroundList", +kind: "enyo.List", +listTools: [ { +name: "port", +classes: "enyo-list-port enyo-border-box", +components: [ { +name: "aboveClient" +}, { +name: "generator", +kind: "enyo.FlyweightRepeater", +canGenerate: !1, +components: [ { +tag: null, +name: "client" +} ] +}, { +name: "page0", +allowHtml: !0, +classes: "enyo-list-page" +}, { +name: "page1", +allowHtml: !0, +classes: "enyo-list-page" +}, { +name: "belowClient" +} ] +} ], +aboveComponents: null, +initComponents: function() { +this.inherited(arguments), this.aboveComponents && this.$.aboveClient.createComponents(this.aboveComponents, { +owner: this.owner +}), this.belowComponents && this.$.belowClient.createComponents(this.belowComponents, { +owner: this.owner +}); +}, +updateMetrics: function() { +this.defaultPageHeight = this.rowsPerPage * (this.rowHeight || 100), this.pageCount = Math.ceil(this.count / this.rowsPerPage), this.aboveHeight = this.$.aboveClient.getBounds().height, this.belowHeight = this.$.belowClient.getBounds().height, this.portSize = this.aboveHeight + this.belowHeight; +for (var e = 0; e < this.pageCount; e++) this.portSize += this.getPageHeight(e); +this.adjustPortSize(); +}, +positionPage: function(e, t) { +t.pageNo = e; +var n = this.pageToPosition(e), r = this.bottomUp ? this.belowHeight : this.aboveHeight; +n += r, t.applyStyle(this.pageBound, n + "px"); +}, +scrollToContentStart: function() { +var e = this.bottomUp ? this.belowHeight : this.aboveHeight; +this.setScrollPosition(e); +} +}); + // Slideable.js enyo.kind({ @@ -693,6 +759,7 @@ while (r >= 0) i += t < e ? -1 : 1, n.push(i), r--; n.push(this.container.toIndex); }, finish: function() {}, +calcArrangementDifference: function(e, t, n, r) {}, canDragEvent: function(e) { return e[this.canDragProp]; }, @@ -710,7 +777,6 @@ measureArrangementDelta: function(e, t, n, r, i) { var s = this.calcArrangementDifference(t, n, r, i), o = s ? e / Math.abs(s) : 0; return o *= this.container.fromIndex > this.container.toIndex ? -1 : 1, o; }, -calcArrangementDifference: function(e, t, n, r) {}, _arrange: function(e) { this.containerBounds || this.reflow(); var t = this.getOrderedControls(e); @@ -754,8 +820,8 @@ statics: { positionControl: function(e, t, n) { var r = n || "px"; if (!this.updating) if (enyo.dom.canTransform() && !enyo.platform.android) { -var i = t.left, s = t.top, i = enyo.isString(i) ? i : i && i + r, s = enyo.isString(s) ? s : s && s + r; -enyo.dom.transform(e, { +var i = t.left, s = t.top; +i = enyo.isString(i) ? i : i && i + r, s = enyo.isString(s) ? s : s && s + r, enyo.dom.transform(e, { translateX: i || null, translateY: s || null }); @@ -778,7 +844,7 @@ calcArrangementDifference: function(e, t, n, r) { return this.containerBounds.width; }, arrange: function(e, t) { -for (var n = 0, r, i, s; r = e[n]; n++) s = n == 0 ? 1 : 0, this.arrangeControl(r, { +for (var n = 0, r, i, s; r = e[n]; n++) s = n === 0 ? 1 : 0, this.arrangeControl(r, { opacity: s }); }, @@ -813,8 +879,8 @@ for (var t = 0, n; n = e[t]; t++) { var r = n.showing; n.setShowing(t == this.container.fromIndex || t == this.container.toIndex), n.showing && !r && n.resized(); } -var i = this.container.fromIndex, t = this.container.toIndex; -this.container.transitionPoints = [ t + "." + i + ".s", t + "." + i + ".f" ]; +var i = this.container.fromIndex; +t = this.container.toIndex, this.container.transitionPoints = [ t + "." + i + ".s", t + "." + i + ".f" ]; }, finish: function() { this.inherited(arguments); @@ -842,15 +908,15 @@ enyo.kind({ name: "enyo.CarouselArranger", kind: "Arranger", size: function() { -var e = this.container.getPanels(), t = this.containerPadding = this.container.hasNode() ? enyo.dom.calcPaddingExtents(this.container.node) : {}, n = this.containerBounds; +var e = this.container.getPanels(), t = this.containerPadding = this.container.hasNode() ? enyo.dom.calcPaddingExtents(this.container.node) : {}, n = this.containerBounds, r, i, s, o, u; n.height -= t.top + t.bottom, n.width -= t.left + t.right; -var r; -for (var i = 0, s = 0, o, u; u = e[i]; i++) o = enyo.dom.calcMarginExtents(u.hasNode()), u.width = u.getBounds().width, u.marginWidth = o.right + o.left, s += (u.fit ? 0 : u.width) + u.marginWidth, u.fit && (r = u); -if (r) { -var a = n.width - s; -r.width = a >= 0 ? a : r.width; +var a; +for (r = 0, s = 0; u = e[r]; r++) o = enyo.dom.calcMarginExtents(u.hasNode()), u.width = u.getBounds().width, u.marginWidth = o.right + o.left, s += (u.fit ? 0 : u.width) + u.marginWidth, u.fit && (a = u); +if (a) { +var f = n.width - s; +a.width = f >= 0 ? f : a.width; } -for (var i = 0, f = t.left, o, u; u = e[i]; i++) u.setBounds({ +for (r = 0, i = t.left; u = e[r]; r++) u.setBounds({ top: t.top, bottom: t.bottom, width: u.fit ? u.width : null @@ -860,27 +926,28 @@ arrange: function(e, t) { this.container.wrap ? this.arrangeWrap(e, t) : this.arrangeNoWrap(e, t); }, arrangeNoWrap: function(e, t) { -var n = this.container.getPanels(), r = this.container.clamp(t), i = this.containerBounds.width; -for (var s = r, o = 0, u; u = n[s]; s++) { -o += u.width + u.marginWidth; -if (o > i) break; -} -var a = i - o, f = 0; -if (a > 0) { -var l = r; -for (var s = r - 1, c = 0, u; u = n[s]; s--) { -c += u.width + u.marginWidth; -if (a - c <= 0) { -f = a - c, r = s; +var n, r, i, s, o = this.container.getPanels(), u = this.container.clamp(t), a = this.containerBounds.width; +for (n = u, i = 0; s = o[n]; n++) { +i += s.width + s.marginWidth; +if (i > a) break; +} +var f = a - i, l = 0; +if (f > 0) { +var c = u; +for (n = u - 1, r = 0; s = o[n]; n--) { +r += s.width + s.marginWidth; +if (f - r <= 0) { +l = f - r, u = n; break; } } } -for (var s = 0, h = this.containerPadding.left + f, p, u; u = n[s]; s++) p = u.width + u.marginWidth, s < r ? this.arrangeControl(u, { -left: -p -}) : (this.arrangeControl(u, { -left: Math.floor(h) -}), h += p); +var h, p; +for (n = 0, p = this.containerPadding.left + l; s = o[n]; n++) h = s.width + s.marginWidth, n < u ? this.arrangeControl(s, { +left: -h +}) : (this.arrangeControl(s, { +left: Math.floor(p) +}), p += h); }, arrangeWrap: function(e, t) { for (var n = 0, r = this.containerPadding.left, i, s; s = e[n]; n++) this.arrangeControl(s, { @@ -965,13 +1032,13 @@ var e = this.container.fromIndex, t = this.container.toIndex, n = this.getOrdere for (var i = 0, s; s = n[i]; i++) e > t ? i == n.length - r ? s.applyStyle("z-index", 0) : s.applyStyle("z-index", 1) : i == n.length - 1 - r ? s.applyStyle("z-index", 0) : s.applyStyle("z-index", 1); }, arrange: function(e, t) { +var n, r, i, s; if (this.container.getPanels().length == 1) { -var n = {}; -n[this.axisPosition] = this.margin, this.arrangeControl(this.container.getPanels()[0], n); +s = {}, s[this.axisPosition] = this.margin, this.arrangeControl(this.container.getPanels()[0], s); return; } -var r = Math.floor(this.container.getPanels().length / 2), i = this.getOrderedControls(Math.floor(t) - r), s = this.containerBounds[this.axisSize] - this.margin - this.margin, o = this.margin - s * r; -for (var u = 0, a, n, f; a = i[u]; u++) n = {}, n[this.axisPosition] = o, this.arrangeControl(a, n), o += s; +var o = Math.floor(this.container.getPanels().length / 2), u = this.getOrderedControls(Math.floor(t) - o), a = this.containerBounds[this.axisSize] - this.margin - this.margin, f = this.margin - a * o; +for (n = 0; r = u[n]; n++) s = {}, s[this.axisPosition] = f, this.arrangeControl(r, s), f += a; }, calcArrangementDifference: function(e, t, n, r) { if (this.container.getPanels().length == 1) return 0; @@ -1089,7 +1156,8 @@ onTransitionFinish: "" handlers: { ondragstart: "dragstart", ondrag: "drag", -ondragfinish: "dragfinish" +ondragfinish: "dragfinish", +onscroll: "domScroll" }, tools: [ { kind: "Animator", @@ -1098,7 +1166,10 @@ onEnd: "completed" } ], fraction: 0, create: function() { -this.transitionPoints = [], this.inherited(arguments), this.arrangerKindChanged(), this.narrowFitChanged(), this.indexChanged(); +this.transitionPoints = [], this.inherited(arguments), this.arrangerKindChanged(), this.narrowFitChanged(), this.indexChanged(), this.setAttribute("onscroll", enyo.bubbler); +}, +domScroll: function(e, t) { +this.hasNode() && this.node.scrollLeft > 0 && (this.node.scrollLeft = 0); }, initComponents: function() { this.createChrome(this.tools), this.inherited(arguments); @@ -1110,7 +1181,7 @@ narrowFitChanged: function() { this.addRemoveClass("enyo-panels-fit-narrow", this.narrowFit); }, removeControl: function(e) { -this.inherited(arguments), this.controls.length > 1 && this.isPanel(e) && (this.setIndex(Math.max(this.index - 1, 0)), this.flow(), this.reflow()); +this.inherited(arguments), this.controls.length > 0 && this.isPanel(e) && (this.setIndex(Math.max(this.index - 1, 0)), this.flow(), this.reflow()); }, isPanel: function() { return !0; @@ -1126,8 +1197,8 @@ var e = this.controlParent || this; return e.children; }, getActive: function() { -var e = this.getPanels(); -return e[this.index]; +var e = this.getPanels(), t = this.index % e.length; +return t < 0 ? t += e.length : enyo.nop, e[t]; }, getAnimator: function() { return this.$.animator; @@ -1149,7 +1220,7 @@ var t = this.getPanels().length - 1; return this.wrap ? e : Math.max(0, Math.min(e, t)); }, indexChanged: function(e) { -this.lastIndex = e, this.index = this.clamp(this.index), this.dragging || (this.$.animator.isAnimating() && this.completed(), this.$.animator.stop(), this.hasNode() && (this.animate ? (this.startTransition(), this.$.animator.play({ +this.lastIndex = e, this.index = this.clamp(this.index), !this.dragging && this.$.animator && (this.$.animator.isAnimating() && this.completed(), this.$.animator.stop(), this.hasNode() && (this.animate ? (this.startTransition(), this.$.animator.play({ startValue: this.fraction })) : this.refresh())); }, @@ -1194,7 +1265,7 @@ n = r, r = i; n != this.fromIndex && (this.fraction = 1 - this.fraction), this.fromIndex = n, this.toIndex = r; }, refresh: function() { -this.$.animator.isAnimating() && this.$.animator.stop(), this.startTransition(), this.fraction = 1, this.stepTransition(), this.finishTransition(); +this.$.animator && this.$.animator.isAnimating() && this.$.animator.stop(), this.startTransition(), this.fraction = 1, this.stepTransition(), this.finishTransition(); }, startTransition: function() { this.fromIndex = this.fromIndex != null ? this.fromIndex : this.lastIndex || 0, this.toIndex = this.toIndex != null ? this.toIndex : this.index, this.layout && this.layout.start(), this.fireTransitionStart(); @@ -1385,6 +1456,261 @@ this.$.client && (this.expanded ? this._expand() : this._collapse()); } }); +// ImageView.js + +enyo.kind({ +name: "enyo.ImageView", +kind: enyo.Scroller, +touchOverscroll: !1, +thumb: !1, +animate: !0, +verticalDragPropagation: !0, +horizontalDragPropagation: !0, +published: { +scale: "auto", +disableZoom: !1, +src: undefined +}, +events: { +onZoom: "" +}, +touch: !0, +preventDragPropagation: !1, +handlers: { +ondragstart: "dragPropagation" +}, +components: [ { +name: "animator", +kind: "Animator", +onStep: "zoomAnimationStep", +onEnd: "zoomAnimationEnd" +}, { +name: "viewport", +style: "overflow:hidden;min-height:100%;min-width:100%;", +classes: "enyo-fit", +ongesturechange: "gestureTransform", +ongestureend: "saveState", +ontap: "singleTap", +ondblclick: "doubleClick", +onmousewheel: "mousewheel", +components: [ { +kind: "Image", +ondown: "down" +} ] +} ], +create: function() { +this.inherited(arguments), this.canTransform = enyo.dom.canTransform(), this.canTransform || this.$.image.applyStyle("position", "relative"), this.canAccelerate = enyo.dom.canAccelerate(), this.bufferImage = new Image, this.bufferImage.onload = enyo.bind(this, "imageLoaded"), this.bufferImage.onerror = enyo.bind(this, "imageError"), this.srcChanged(), this.getStrategy().setDragDuringGesture(!1); +}, +down: function(e, t) { +t.preventDefault(); +}, +dragPropagation: function(e, t) { +var n = this.getStrategy().getScrollBounds(), r = n.top === 0 && t.dy > 0 || n.top >= n.maxTop - 2 && t.dy < 0, i = n.left === 0 && t.dx > 0 || n.left >= n.maxLeft - 2 && t.dx < 0; +return !(r && this.verticalDragPropagation || i && this.horizontalDragPropagation); +}, +mousewheel: function(e, t) { +t.pageX |= t.clientX + t.target.scrollLeft, t.pageY |= t.clientY + t.target.scrollTop; +var n = (this.maxScale - this.minScale) / 10, r = this.scale; +if (t.wheelDelta > 0 || t.detail < 0) this.scale = this.limitScale(this.scale + n); else if (t.wheelDelta < 0 || t.detail > 0) this.scale = this.limitScale(this.scale - n); +return this.eventPt = this.calcEventLocation(t), this.transformImage(this.scale), r != this.scale && this.doZoom({ +scale: this.scale +}), this.ratioX = this.ratioY = null, t.preventDefault(), !0; +}, +srcChanged: function() { +this.src && this.src.length > 0 && this.bufferImage && this.src != this.bufferImage.src && (this.bufferImage.src = this.src); +}, +imageLoaded: function(e) { +this.originalWidth = this.bufferImage.width, this.originalHeight = this.bufferImage.height, this.scaleChanged(), this.$.image.setSrc(this.bufferImage.src), enyo.dom.transformValue(this.getStrategy().$.client, "translate3d", "0px, 0px, 0"); +}, +resizeHandler: function() { +this.inherited(arguments), this.$.image.src && this.scaleChanged(); +}, +scaleChanged: function() { +var e = this.hasNode(); +if (e) { +this.containerWidth = e.clientWidth, this.containerHeight = e.clientHeight; +var t = this.containerWidth / this.originalWidth, n = this.containerHeight / this.originalHeight; +this.minScale = Math.min(t, n), this.maxScale = this.minScale * 3 < 1 ? 1 : this.minScale * 3, this.scale == "auto" ? this.scale = this.minScale : this.scale == "width" ? this.scale = t : this.scale == "height" ? this.scale = n : (this.maxScale = Math.max(this.maxScale, this.scale), this.scale = this.limitScale(this.scale)); +} +this.eventPt = this.calcEventLocation(), this.transformImage(this.scale); +}, +imageError: function(e) { +enyo.error("Error loading image: " + this.src), this.bubble("onerror", e); +}, +gestureTransform: function(e, t) { +this.eventPt = this.calcEventLocation(t), this.transformImage(this.limitScale(this.scale * t.scale)); +}, +calcEventLocation: function(e) { +var t = { +x: 0, +y: 0 +}; +if (e && this.hasNode()) { +var n = this.node.getBoundingClientRect(); +t.x = Math.round(e.pageX - n.left - this.imageBounds.x), t.x = Math.max(0, Math.min(this.imageBounds.width, t.x)), t.y = Math.round(e.pageY - n.top - this.imageBounds.y), t.y = Math.max(0, Math.min(this.imageBounds.height, t.y)); +} +return t; +}, +transformImage: function(e) { +this.tapped = !1; +var t = this.imageBounds || this.innerImageBounds(e); +this.imageBounds = this.innerImageBounds(e), this.scale > this.minScale ? this.$.viewport.applyStyle("cursor", "move") : this.$.viewport.applyStyle("cursor", null), this.$.viewport.setBounds({ +width: this.imageBounds.width + "px", +height: this.imageBounds.height + "px" +}), this.ratioX = this.ratioX || (this.eventPt.x + this.getScrollLeft()) / t.width, this.ratioY = this.ratioY || (this.eventPt.y + this.getScrollTop()) / t.height; +var n, r; +this.$.animator.ratioLock ? (n = this.$.animator.ratioLock.x * this.imageBounds.width - this.containerWidth / 2, r = this.$.animator.ratioLock.y * this.imageBounds.height - this.containerHeight / 2) : (n = this.ratioX * this.imageBounds.width - this.eventPt.x, r = this.ratioY * this.imageBounds.height - this.eventPt.y), n = Math.max(0, Math.min(this.imageBounds.width - this.containerWidth, n)), r = Math.max(0, Math.min(this.imageBounds.height - this.containerHeight, r)); +if (this.canTransform) { +var i = { +scale: e +}; +this.canAccelerate ? i = enyo.mixin({ +translate3d: Math.round(this.imageBounds.left) + "px, " + Math.round(this.imageBounds.top) + "px, 0px" +}, i) : i = enyo.mixin({ +translate: this.imageBounds.left + "px, " + this.imageBounds.top + "px" +}, i), enyo.dom.transform(this.$.image, i); +} else this.$.image.setBounds({ +width: this.imageBounds.width + "px", +height: this.imageBounds.height + "px", +left: this.imageBounds.left + "px", +top: this.imageBounds.top + "px" +}); +this.setScrollLeft(n), this.setScrollTop(r); +}, +limitScale: function(e) { +return this.disableZoom ? e = this.scale : e > this.maxScale ? e = this.maxScale : e < this.minScale && (e = this.minScale), e; +}, +innerImageBounds: function(e) { +var t = this.originalWidth * e, n = this.originalHeight * e, r = { +x: 0, +y: 0, +transX: 0, +transY: 0 +}; +return t < this.containerWidth && (r.x += (this.containerWidth - t) / 2), n < this.containerHeight && (r.y += (this.containerHeight - n) / 2), this.canTransform && (r.transX -= (this.originalWidth - t) / 2, r.transY -= (this.originalHeight - n) / 2), { +left: r.x + r.transX, +top: r.y + r.transY, +width: t, +height: n, +x: r.x, +y: r.y +}; +}, +saveState: function(e, t) { +var n = this.scale; +this.scale *= t.scale, this.scale = this.limitScale(this.scale), n != this.scale && this.doZoom({ +scale: this.scale +}), this.ratioX = this.ratioY = null; +}, +doubleClick: function(e, t) { +enyo.platform.ie == 8 && (this.tapped = !0, t.pageX = t.clientX + t.target.scrollLeft, t.pageY = t.clientY + t.target.scrollTop, this.singleTap(e, t), t.preventDefault()); +}, +singleTap: function(e, t) { +setTimeout(enyo.bind(this, function() { +this.tapped = !1; +}), 300), this.tapped ? (this.tapped = !1, this.smartZoom(e, t)) : this.tapped = !0; +}, +smartZoom: function(e, t) { +var n = this.hasNode(), r = this.$.image.hasNode(); +if (n && r && this.hasNode() && !this.disableZoom) { +var i = this.scale; +this.scale != this.minScale ? this.scale = this.minScale : this.scale = this.maxScale, this.eventPt = this.calcEventLocation(t); +if (this.animate) { +var s = { +x: (this.eventPt.x + this.getScrollLeft()) / this.imageBounds.width, +y: (this.eventPt.y + this.getScrollTop()) / this.imageBounds.height +}; +this.$.animator.play({ +duration: 350, +ratioLock: s, +baseScale: i, +deltaScale: this.scale - i +}); +} else this.transformImage(this.scale), this.doZoom({ +scale: this.scale +}); +} +}, +zoomAnimationStep: function(e, t) { +var n = this.$.animator.baseScale + this.$.animator.deltaScale * this.$.animator.value; +this.transformImage(n); +}, +zoomAnimationEnd: function(e, t) { +this.doZoom({ +scale: this.scale +}), this.$.animator.ratioLock = undefined; +} +}); + +// ImageCarousel.js + +enyo.kind({ +name: "enyo.ImageCarousel", +kind: enyo.Panels, +arrangerKind: "enyo.CarouselArranger", +defaultScale: "auto", +disableZoom: !1, +lowMemory: !1, +published: { +images: [] +}, +handlers: { +onTransitionStart: "transitionStart", +onTransitionFinish: "transitionFinish" +}, +create: function() { +this.inherited(arguments), this.imageCount = this.images.length, this.images.length > 0 && (this.initContainers(), this.loadNearby()); +}, +initContainers: function() { +for (var e = 0; e < this.images.length; e++) this.$["container" + e] || (this.createComponent({ +name: "container" + e, +style: "height:100%; width:100%;" +}), this.$["container" + e].render()); +for (e = this.images.length; e < this.imageCount; e++) this.$["image" + e] && this.$["image" + e].destroy(), this.$["container" + e].destroy(); +this.imageCount = this.images.length; +}, +loadNearby: function() { +this.images.length > 0 && (this.loadImageView(this.index - 1), this.loadImageView(this.index), this.loadImageView(this.index + 1)); +}, +loadImageView: function(e) { +return this.wrap && (e = (e % this.images.length + this.images.length) % this.images.length), e >= 0 && e <= this.images.length - 1 && (this.$["image" + e] ? (this.$["image" + e].src != this.images[e] && this.$["image" + e].setSrc(this.images[e]), this.$["image" + e].setScale(this.defaultScale), this.$["image" + e].setDisableZoom(this.disableZoom)) : (this.$["container" + e].createComponent({ +name: "image" + e, +kind: "ImageView", +scale: this.defaultScale, +disableZoom: this.disableZoom, +src: this.images[e], +verticalDragPropagation: !1, +style: "height:100%; width:100%;" +}, { +owner: this +}), this.$["image" + e].render())), this.$["image" + e]; +}, +setImages: function(e) { +this.setPropertyValue("images", e, "imagesChanged"); +}, +imagesChanged: function() { +this.initContainers(), this.loadNearby(); +}, +indexChanged: function() { +this.loadNearby(), this.lowMemory && this.cleanupMemory(), this.inherited(arguments); +}, +transitionStart: function(e, t) { +if (t.fromIndex == t.toIndex) return !0; +}, +transitionFinish: function(e, t) { +this.loadImageView(this.index - 1), this.loadImageView(this.index + 1), this.lowMemory && this.cleanupMemory(); +}, +getActiveImage: function() { +return this.getImageByIndex(this.index); +}, +getImageByIndex: function(e) { +return this.$["image" + e] || this.loadImageView(e); +}, +cleanupMemory: function() { +for (var e = 0; e < this.images.length; e++) (e < this.index - 1 || e > this.index + 1) && this.$["image" + e] && this.$["image" + e].destroy(); +} +}); + // runtime-machine.js runtimeMachine = { @@ -1439,6 +1765,68 @@ this._continue(); } }; +// AnalyzerDebug.js + +enyo.kind({ +name: "AnalyzerDebug", +kind: null, +debug: !1, +_level: 0, +methodName: function(e) { +var t = this.getStackInfo(3 + (e || 0)); +return t = t.replace(/ .http:.*$/g, ""), t = t.replace(/^.*.enyo.kind/g, this.kindName), t += " ", t.substr(0, 30); +}, +getCurrentStackInfo: function(e) { +return " current: " + this.getStackInfo(3 + (e || 0)); +}, +getPreviousStackInfo: function(e) { +return " previous: " + this.getStackInfo(4 + (e || 0)); +}, +getStackInfo: function(e) { +try { +throw new Error; +} catch (t) { +var n = t.stack; +if (n) { +var r = n.split("\n"); +return r[e]; +} +return "(stack trace not available)"; +} +}, +showLevel: function() { +return "#####################################".substr(0, this._level) + " "; +}, +incremLevel: function() { +return this._level++, this.showLevel() + " --> "; +}, +decremLevel: function() { +var e = this.showLevel() + " <-- "; +return this._level--, e; +}, +showIterator: function(e) { +return e ? "[" + e.ID + "/" + e.i + "] " : ""; +}, +logMethodEntry: function(e, t) { +t = t || "", enyo.log(this.methodName(1) + this.incremLevel() + this.showIterator(e) + t + this.getPreviousStackInfo(1)); +}, +logMethodExit: function(e, t) { +t = t || "", enyo.log(this.methodName(1) + this.decremLevel() + this.showIterator(e) + t + this.getCurrentStackInfo(1)); +}, +logProcessing: function(e, t) { +enyo.log(this.methodName(1) + this.showLevel() + this.showIterator(e) + "PROCESSING kind: " + t.kind + " >>" + t.token + "<< line: " + t.line + this.getCurrentStackInfo(1)); +}, +logIterMsg: function(e, t) { +enyo.log(this.methodName(1) + this.showLevel() + this.showIterator(e) + t + this.getPreviousStackInfo(1)); +}, +logMsg: function(e) { +enyo.log(this.methodName(1) + this.showLevel() + e + this.getPreviousStackInfo(1)); +}, +statics: { +_debugEnabled: !1 +} +}); + // Walker.js enyo.kind({ @@ -1510,7 +1898,10 @@ kind: null, i: -1, nodes: null, constructor: function(e) { -this.stream = e; +this.ID = Iterator._objectCount++, this.stream = e; +}, +statics: { +_objectCount: 0 }, next: function() { return this.i++, this._read(); @@ -1638,9 +2029,9 @@ this.pushToken("string", this.m[0].length); enyo.kind({ name: "Parser", -kind: null, +kind: "AnalyzerDebug", constructor: function(e) { -return this.parse(e); +return this.debug = AnalyzerDebug._debugEnabled, this.parse(e); }, parse: function(e) { var t = [], n = new Iterator(e); @@ -1654,58 +2045,66 @@ for (var n = 0, r; r = e[n]; n++) t += r.token; return t; }, walk: function(e, t) { +this.debug && this.logMethodEntry(e, "inState " + t + " >>" + JSON.stringify(e.value) + "<<"); var n = [], r; try { while (e.next()) { -r = e.value; +r = e.value, this.debug && this.logProcessing(e, r); if (r.kind == "ws") continue; if (r.kind == "comment") r.kind = "comment"; else if (t == "array") { if (r.kind == "terminal") continue; -e.prev(), r = { +e.prev(); +var i = e.value; +r = { kind: "element", token: "expr", children: this.walk(e, "expression") }; -if (e.value && e.value.token == "]") return r.children.length && n.push(r), n; -} else if (r.token == "[") r.kind = "array", r.children = this.walk(e, r.kind), e.value ? r.end = e.value.end : console.log("No end token for array?"); else { -if (t == "expression" && r.token == "]") return n; +if (e.value && e.value.token == "]" || e.value && e.value === i) return r.children.length && n.push(r), this.debug && this.logMethodExit(e), n; +} else if (r.token == "[") r.kind = "array", r.children = this.walk(e, r.kind), e.value ? r.end = e.value.end : this.debug && this.logIterMsg(e, "No end token for array?"); else { +if (t == "expression" && r.token == "]") return this.debug && this.logMethodExit(e), n; if (r.token == "var") r.kind = "var", r.children = this.walk(e, "expression"); else { -if (r.kind == "terminal" && (t == "expression" || t == "var")) return n; +if (r.kind == "terminal" && (t == "expression" || t == "var")) return this.debug && this.logMethodExit(e), n; if (r.kind == "terminal") continue; if (r.token == "{") { -r.kind = "block", r.children = this.walk(e, r.kind), e.value ? r.end = e.value.end : console.log("No end token for block?"); -if (t == "expression" || t == "function") return n.push(r), n; +r.kind = "block", this.debug && this.logIterMsg(e, "PROCESS BLOCK - START"), r.children = this.walk(e, r.kind), this.debug && this.logIterMsg(e, "PROCESS BLOCK - END"), e.value ? r.end = e.value.end : this.debug && this.logIterMsg(e, "No end token for block?"), r.commaTerminated = this.isCommaTerminated(e); +if (t == "expression" || t == "function") return n.push(r), this.debug && this.logMethodExit(e), n; } else { -if (t == "expression" && (r.token == "}" || r.token == ")")) return e.prev(), n; -if (t == "block" && r.token == "}") return n; +if (t == "expression" && (r.token == "}" || r.token == ")")) return e.prev(), this.debug && this.logMethodExit(e), n; +if (t == "block" && r.token == "}") return this.debug && this.logMethodExit(e), n; if (r.token == "=" || r.token == ":" && t != "expression") { -var i = n.pop(); -i.kind == "identifier" ? (i.op = r.token, i.kind = "assignment", i.children = this.walk(e, "expression"), e.value && e.value.kind == "terminal" && e.prev(), r = i) : n.push(i); +var s = n.pop(); +s.kind == "identifier" ? (s.op = r.token, s.kind = "assignment", s.children = this.walk(e, "expression"), e.value && e.value.kind == "terminal" && (s.commaTerminated = e.value.token === ",", e.prev()), r = s) : n.push(s); } else if (r.token == "(") r.kind = "association", r.children = this.walk(e, r.kind); else { -if (t == "association" && r.token == ")") return n; +if (t == "association" && r.token == ")") return this.debug && this.logMethodExit(e), n; if (r.token == "function") { -r.kind = "function", r.children = this.walk(e, r.kind); +r.kind = "function", this.debug && this.logIterMsg(e, "PROCESS FUNCTION - START"), r.children = this.walk(e, r.kind), this.debug && this.logIterMsg(e, "PROCESS FUNCTION - END"), (!e.value || e.value.kind !== "symbol" || e.value.token !== "}") && this.debug && this.logIterMsg(e, "No end token for function?"); if (t !== "expression" && r.children && r.children.length && r.children[0].kind == "identifier") { -r.name = r.children[0].token, r.children.shift(); -var s = { +this.debug && this.logIterMsg(e, "C-Style function"), r.name = r.children[0].token, r.children.shift(); +var o = { kind: "assignment", token: r.name, children: [ r ] }; -r = s; +r = o; } -if (t == "expression" || t == "function") return n.push(r), n; +if (t == "expression" || t == "function") return r.commaTerminated = this.isCommaTerminated(e), n.push(r), this.debug && this.logMethodExit(e), n; } } } } } -n.push(r); +this.debug && this.logIterMsg(e, "PUSH NODE"), n.push(r); } -} catch (o) { -console.error(o); +} catch (u) { +console.error(u); } -return n; +return this.debug && this.logMethodExit(e), n; +}, +isCommaTerminated: function(e) { +commaPresent = !1; +var t = e.next(); +return t && (commaPresent = t.kind === "terminal" && t.token === ","), e.prev(), commaPresent; } }); @@ -1713,10 +2112,10 @@ return n; enyo.kind({ name: "Documentor", -kind: null, +kind: "AnalyzerDebug", group: "public", constructor: function(e) { -return this.comment = [], this.parse(e); +return this.comment = [], this.debug = AnalyzerDebug._debugEnabled, this.parse(e); }, parse: function(e) { var t = new Iterator(e); @@ -1724,8 +2123,9 @@ return this.walk(t); }, walk: function(e, t) { var n = [], r, i; +this.debug && this.logMethodEntry(e, "inState " + t + " >>" + JSON.stringify(e.value) + "<<"); while (e.next()) { -r = e.value; +r = e.value, this.debug && this.logProcessing(e, r); if (r.kind == "comment") this.cook_comment(r.token); else if (r.token == "enyo.kind" && e.future.kind == "association") i = this.cook_kind(e); else if (r.kind == "assignment") i = this.cook_assignment(e); else if (r.kind == "association" && r.children && r.children.length == 1 && r.children[0].kind == "function") { var s = r.children[0]; if (s.children && s.children.length == 2) { @@ -1736,58 +2136,72 @@ e.next(); } i && (n.push(i), i = null); } -return n; +return this.debug && this.logMethodExit(e), n; }, cook_kind: function(e) { +this.debug && this.logMethodEntry(e, ">>" + JSON.stringify(e.value) + "<<"); var t = function(e, t) { var n = Documentor.indexByName(e, t), r; return n >= 0 && (r = e[n], e.splice(r, 1)), r && r.value && r.value.length && r.value[0].token; }, n = this.make("kind", e.value); e.next(); var r = e.value.children; -return r && r[0] && r[0].kind == "block" && (n.properties = this.cook_block(r[0].children), n.name = Documentor.stripQuotes(t(n.properties, "name") || ""), n.superkind = Documentor.stripQuotes(t(n.properties, "kind") || "enyo.Control"), n.superkind == "null" && (n.superkind = null)), n; +return r && r[0] && r[0].kind == "block" && (n.properties = this.cook_block(r[0].children), n.name = Documentor.stripQuotes(t(n.properties, "name") || ""), n.superkind = Documentor.stripQuotes(t(n.properties, "kind") || "enyo.Control"), n.superkind == "null" && (n.superkind = null), n.block = { +start: r[0].start, +end: r[0].end +}), this.debug && this.logMethodExit(e), n; }, cook_block: function(e) { +this.debug && this.logMethodEntry(); var t = []; -for (var n = 0, r; r = e[n]; n++) if (r.kind == "comment") this.cook_comment(r.token); else if (r.kind == "assignment") { +for (var n = 0, r; r = e[n]; n++) { +this.debug && this.logProcessing(null, r); +if (r.kind == "comment") this.cook_comment(r.token); else if (r.kind == "assignment") { var i = this.make("property", r); -r.children && (i.value = [ this.walkValue(new Iterator(r.children)) ]), t.push(i); +r.children && (i.value = [ this.walkValue(new Iterator(r.children)) ], r.commaTerminated === undefined ? (i.commaTerminated = r.children[0].commaTerminated || !1, r.children[0].commaTerminated === undefined && this.debug && this.logMsg("NO COMMA TERMINATED INFO")) : i.commaTerminated = r.commaTerminated), t.push(i); } -return t; +} +return this.debug && this.logMethodExit(), t; }, walkValue: function(e, t) { +this.debug && this.logMethodEntry(e, "inState: " + t + " >>" + JSON.stringify(e.value) + "<<"); while (e.next()) { var n = e.value, r; +this.debug && this.logProcessing(e, n); if (n.kind != "comment") { -if (n.kind == "block") return r = this.make("block", n), r.properties = this.cook_block(n.children), r; -if (n.kind == "array") return this.cook_array(e); -if (n.kind == "function") return this.cook_function(e); +if (n.kind == "block") return r = this.make("block", n), r.properties = this.cook_block(n.children), this.debug && this.logMethodExit(e, "inState: " + t + " >>" + JSON.stringify(e.value) + "<<"), r; +if (n.kind == "array") return r = this.cook_array(e), this.debug && this.logMethodExit(e), r; +if (n.kind == "function") return r = this.cook_function(e), this.debug && this.logMethodExit(e, "inState: " + t + " >>" + JSON.stringify(e.value) + "<<"), r; r = this.make("expression", n); var i = n.token; while (e.next()) i += e.value.token; -return r.token = i, r; +return r.token = i, this.debug && this.logMethodExit(e), r; } this.cook_comment(n.token); } +this.debug && this.logMethodExit(e); }, cook_function: function(e) { +this.debug && this.logMethodEntry(e, ">>" + JSON.stringify(e.value) + "<<"); var t = e.value, n = this.make("expression", t); -return n.arguments = enyo.map(t.children[0].children, function(e) { +return n.commaTerminated = t.commaTerminated, n.arguments = enyo.map(t.children[0].children, function(e) { return e.token; -}), n; +}), this.debug && this.logMethodExit(e), n; }, cook_array: function(e) { +this.debug && this.logMethodEntry(e, ">>" + JSON.stringify(e.value) + "<<"); var t = e.value, n = this.make("array", t), r = t.children; if (r) { var i = []; for (var s = 0, o, u; o = r[s]; s++) o.children && (u = this.walkValue(new Iterator(o.children)), u && i.push(u)); n.properties = i; } -return n; +return this.debug && this.logMethodExit(e), n; }, cook_assignment: function(e) { +this.debug && this.logMethodEntry(e, ">>" + JSON.stringify(e.value) + "<<"); var t = e.value, n = this.make("global", t); -return t.children && (t.children[0] && t.children[0].token == "function" && (n.type = "function"), n.value = [ this.walkValue(new Iterator(t.children)) ]), n; +return t.children && (t.children[0] && t.children[0].token == "function" && (n.type = "function"), n.value = [ this.walkValue(new Iterator(t.children)) ]), this.debug && this.logMethodExit(), n; }, make: function(e, t) { return { @@ -1804,12 +2218,14 @@ comment: this.consumeComment() }, commentRx: /\/\*\*([\s\S]*)\*\/|\/\/\*(.*)/m, cook_comment: function(e) { +this.debug && this.logMethodEntry(); var t = e.match(this.commentRx); if (t) { t = t[1] ? t[1] : t[2]; var n = this.extractPragmas(t); this.honorPragmas(n); } +this.debug && this.logMethodExit(); }, extractPragmas: function(e) { var t = /^[*\s]*@[\S\s]*/g, n = [], r = e; @@ -1870,12 +2286,24 @@ group: "public", constructor: function() { this.objects = []; }, +debug: !1, findByName: function(e) { return Documentor.findByProperty(this.objects, "name", e); }, findByTopic: function(e) { return Documentor.findByProperty(this.objects, "topic", e); }, +getKindList: function(e, t) { +this.debug && enyo.log("getEnyoKindList --> result - regexp: " + e + " group: " + t); +var n = []; +for (var r = 0, i; i = this.objects[r]; r++) i.type === "kind" && i.token === "enyo.kind" && i.group === t && e.test(i.name) && (this.debug && enyo.log("getEnyoKindList --> this.objects[" + r + "]: type: " + i.type + " token: " + i.token + " group: " + i.group + " name: " + i.name), n.push(i.name)); +return n; +}, +getFunctionList: function(e, t) { +var n = []; +for (var r = 0, i; i = this.objects[r]; r++) i.type === "function" && i.group === t && e.test(i.name) && n.push(i.name); +return n; +}, addModules: function(e) { enyo.forEach(e, this.addModule, this), this.objects.sort(Indexer.nameCompare); }, @@ -1889,7 +2317,7 @@ mergeProperties: function(e) { e.properties ? this.objects = this.objects.concat(e.properties) : e.value && e.value[0] && e.value[0].properties && (this.objects = this.objects.concat(e.value[0].properties)); }, indexModule: function(e) { -e.type = "module", e.name = e.name || e.rawPath, e.objects = new Documentor(new Parser(new Lexer(e.code))), this.indexObjects(e); +e.type = "module", e.name = e.path ? e.path.replace("lib/", "") : e.label + "/" + e.rawPath, e.objects = new Documentor(new Parser(new Lexer(e.code))), this.indexObjects(e); }, indexObjects: function(e) { enyo.forEach(e.objects, function(t) { @@ -2698,22 +3126,25 @@ return this.presentProperty(e); } }, presentObjects: function(e) { -var t = this.groupFilter(e), n = "", r, i, s = this.getByType(t, "kind"); -if (s.length) { +var t = this.groupFilter(e), n = "", r, i, s = !1, o = this.getByType(t, "kind"); +if (o.length) { n += "<h3>Kinds</h3>"; -for (r = 0; i = s[r]; r++) n += "<kind>" + i.name + "</kind><br/>", n += this.presentComment(i.comment); +for (r = 0; i = o[r]; r++) n += "<kind>" + i.name + "</kind><br/>", n += this.presentComment(i.comment); +s = !0; } -s = this.getByType(t, "function"); -if (s.length) { +o = this.getByType(t, "function"); +if (o.length) { n += "<h3>Functions</h3>"; -for (r = 0; i = s[r]; r++) n += this.presentComment(i.comment), i.group && (n += "<" + i.group + ">" + i.group + "</" + i.group + ">"), n += "<i>name:</i> <label>" + i.name + "(<arguments>" + i.value[0].arguments.join(", ") + "</arguments>)</label><br/>"; +for (r = 0; i = o[r]; r++) i.group && (n += "<" + i.group + ">" + i.group + "</" + i.group + ">"), n += "<label>" + i.name + "</label>: function(<arguments>" + i.value[0].arguments.join(", ") + "</arguments>)</label><br/>", n += this.presentComment(i.comment); +s = !0; } -s = this.getByType(t, "global"); -if (s.length) { +o = this.getByType(t, "global"); +if (o.length) { n += "<h3>Variables</h3>"; -for (r = 0; i = s[r]; r++) n += this.presentComment(i.comment), i.group && (n += "<" + i.group + ">" + i.group + "</" + i.group + ">"), n += "<label>" + i.name + "</label> = ", n += this.presentExpression(i.value[0]), n += "<br/>"; +for (r = 0; i = o[r]; r++) n += this.presentComment(i.comment), i.group && (n += "<" + i.group + ">" + i.group + "</" + i.group + ">"), n += "<label>" + i.name + "</label> = ", n += this.presentExpression(i.value[0]), n += "<br/>"; +s = !0; } -return n; +return s || (n += "<h3>This module has no public properties or functions to display.</h3>"), n; }, presentComment: function(e) { return e ? "<comment>" + this.markupToHtml(e) + "</comment>" : ""; @@ -2747,7 +3178,7 @@ return r; presentProperty: function(e, t) { var n = "", r = e; n += '<a name="' + r.name + '"></a>', r.group && (n += "<" + r.group + ">" + r.group + "</" + r.group + ">"); -var i = r.name; +var i = r.name.replace(".prototype", ""); return r.object && t && t != r.object && (i = "<prototype>" + r.object.name + "::</prototype>" + i), n += "<label>" + i + "</label>: ", r.value && r.value[0] && r.value[0].token == "function" ? n += "function(<arguments>" + r.value[0].arguments.join(", ") + "</arguments>)<br/>" : n += this.presentValue(r), n += this.presentComment(r.comment), n += "<hr/>", n; }, presentValue: function(e) { @@ -3112,7 +3543,7 @@ this.presentKinds(), this.presentModules(), this.presentIndex(), this.$.indexBus }, indexalize: function(e, t, n) { var r = e ? enyo.filter(this.index.objects, e, this) : this.index.objects; -r = this.nameFilter(r); +e(r[0]) && r.sort(this.moduleCompare), r = this.nameFilter(r); var i = "", s; for (var o = 0, u; u = r[o]; o++) { var a = n(u).divider; @@ -3120,6 +3551,15 @@ a && s != a && (s = a, i += "<divider>" + a + "</divider>"), i += enyo.macroize( } return i; }, +moduleCompare: function(e, t) { +var n, r; +try { +n = e.name.match("[^/]*.js$")[0], r = t.name.match("[^/]*.js$")[0]; +} catch (i) { +n = e.name, r = t.name; +} +return n.toUpperCase() < r.toUpperCase() ? -1 : n.toUpperCase() > r.toUpperCase() ? 1 : 0; +}, nameFilter: function(e) { return enyo.filter(e, function(e) { return e.name && e.name[0] !== "_"; @@ -3129,10 +3569,10 @@ presentFilteredIndex: function(e) { var t = '<a href="#{$link}"><prototype>{$object}</prototype><topic>{$topic}</topic>{$module}</a><br/>', n = function(e) { return { link: e.topic || e.name, -topic: e.name, +topic: e.name.replace(".prototype", ""), divider: e.name[0].toUpperCase(), object: e.object && e.object.name ? e.object.name + "::" : "", -module: !e.object && e.module && e.module.name ? " [" + e.module.name + "]" : "" +module: !e.object && e.module && e.module.name ? " [" + e.module.name.match("[^/]*.js$") + "]" : "" }; }; this.$.index.setContent(this.indexalize(e, t, n)); @@ -3149,8 +3589,8 @@ return e.type == "module"; }, t = '<a href="#{$link}"><topic>{$topic}</topic></a><br/>', n = function(e) { return { link: e.topic || e.name, -topic: e.name, -divider: e.name[0].toUpperCase() +topic: e.name.match("[^/]*.js$"), +divider: e.name.match("[^/]*.js$")[0][0].toUpperCase() }; }; this.$.modules.setContent(this.indexalize(e, t, n)); diff --git a/api/build/enyo.css b/api/build/enyo.css index 09985fb..e3de23c 100644 --- a/api/build/enyo.css +++ b/api/build/enyo.css @@ -3,10 +3,14 @@ /* things we always want */ body { - -webkit-overflow-scrolling: touch; font-family: 'Helvetica Neue', 'Nimbus Sans L', Arial, sans-serif; } +/* allow hw-accelerated scrolling on platforms that support it */ +body.webkitOverflowScrolling { + -webkit-overflow-scrolling: touch; +} + /* for apps */ .enyo-document-fit { margin: 0; diff --git a/api/build/enyo.js b/api/build/enyo.js index 36b630d..f2b2331 100644 --- a/api/build/enyo.js +++ b/api/build/enyo.js @@ -48,6 +48,7 @@ this.machine = e, this.packages = [], this.modules = [], this.sheets = [], this. packageName: "", packageFolder: "", verbose: !1, +finishCallbacks: {}, loadScript: function(e) { this.machine.script(e); }, @@ -70,7 +71,8 @@ var t = this.stack.pop(); t ? (this.verbose && console.groupEnd("* finish package (" + (t.packageName || "anon") + ")"), this.packageFolder = t.folder, this.packageName = "", this.more(t)) : this.finish(); }, finish: function() { -this.packageFolder = "", this.verbose && console.log("-------------- fini"), this.finishCallback && this.finishCallback(); +this.packageFolder = "", this.verbose && console.log("-------------- fini"); +for (var e in this.finishCallbacks) this.finishCallbacks[e] && (this.finishCallbacks[e](), this.finishCallbacks[e] = null); }, continueBlock: function(e) { while (e.index < e.depends.length) { @@ -83,8 +85,8 @@ if (this.require(t, e)) return !0; require: function(e, t) { var n = enyo.path.rewrite(e), r = this.getPathPrefix(e); n = r + n; -if (n.slice(-3) == "css") this.verbose && console.log("+ stylesheet: [" + r + "][" + e + "]"), this.requireStylesheet(n); else { -if (n.slice(-2) != "js" || n.slice(-10) == "package.js") return this.requirePackage(n, t), !0; +if (n.slice(-4) == ".css" || n.slice(-5) == ".less") this.verbose && console.log("+ stylesheet: [" + r + "][" + e + "]"), this.requireStylesheet(n); else { +if (n.slice(-3) != ".js" || n.slice(-10) == "package.js") return this.requirePackage(n, t), !0; this.verbose && console.log("+ module: [" + r + "][" + e + "]"), this.requireScript(e, n); } }, @@ -143,10 +145,12 @@ t.folder = this.packageFolder, this.aliasPackage(e), t.packageName = this.packag enyo.machine = { sheet: function(e) { -if (!enyo.runtimeLoading) document.write('<link href="' + e + '" media="screen" rel="stylesheet" type="text/css" />'); else { -var t = document.createElement("link"); -t.href = e, t.media = "screen", t.rel = "stylesheet", t.type = "text/css", document.getElementsByTagName("head")[0].appendChild(t); -} +var t = "text/css", n = "stylesheet", r = e.slice(-5) == ".less"; +r && (window.less ? (t = "text/less", n = "stylesheet/less") : e = e.slice(0, e.length - 4) + "css"); +var i; +enyo.runtimeLoading || r ? (i = document.createElement("link"), i.href = e, i.media = "screen", i.rel = n, i.type = t, document.getElementsByTagName("head")[0].appendChild(i)) : document.write('<link href="' + e + '" media="screen" rel="' + n + '" type="' + t + '" />'), r && window.less && (less.sheets.push(i), enyo.loader.finishCallbacks.lessRefresh || (enyo.loader.finishCallbacks.lessRefresh = function() { +less.refresh(!0); +})); }, script: function(e, t, n) { if (!enyo.runtimeLoading) document.write('<script src="' + e + '"' + (t ? ' onload="' + t + '"' : "") + (n ? ' onerror="' + n + '"' : "") + "></scri" + "pt>"); else { @@ -169,12 +173,12 @@ function n(r) { r && r(); if (t.length) { var i = t.shift(), s = i[0], o = e.isArray(s) ? s : [ s ], u = i[1]; -e.loader.finishCallback = function() { +e.loader.finishCallbacks.runtimeLoader = function() { n(function() { u && u(s); }); }, e.loader.packageFolder = "./", e.depends.apply(this, o); -} else e.runtimeLoading = !1, e.loader.finishCallback = null, e.loader.packageFolder = ""; +} else e.runtimeLoading = !1, e.loader.packageFolder = ""; } var e = window.enyo, t = []; e.load = function(r, i) { @@ -336,6 +340,8 @@ return (new Date).getTime(); e.prototype = t; }), enyo.delegate = function(e) { return enyo.setPrototype(enyo.instance, e), new enyo.instance; +}, $L = function(e) { +return e; }; })(); @@ -367,47 +373,6 @@ return n in t ? r = t[n] : r = enyo.getObject(n, !1, t), r === undefined || r == return s = s.replace(o, u), s; }, enyo.macroize.pattern = /\{\$([^{}]*)\}/g; -// animation.js - -(function() { -var e = Math.round(1e3 / 60), t = [ "webkit", "moz", "ms", "o", "" ], n = "requestAnimationFrame", r = "cancel" + enyo.cap(n), i = function(t) { -return window.setTimeout(t, e); -}, s = function(e) { -return window.clearTimeout(e); -}; -for (var o = 0, u = t.length, a, f, l; (a = t[o]) || o < u; o++) { -f = a ? a + enyo.cap(r) : r, l = a ? a + enyo.cap(n) : n; -if (window[f]) { -s = window[f], i = window[l], a == "webkit" && s(i(enyo.nop)); -break; -} -} -enyo.requestAnimationFrame = function(e, t) { -return i(e, t); -}, enyo.cancelRequestAnimationFrame = function(e) { -return s(e); -}; -})(), enyo.easing = { -cubicIn: function(e) { -return Math.pow(e, 3); -}, -cubicOut: function(e) { -return Math.pow(e - 1, 3) + 1; -}, -expoOut: function(e) { -return e == 1 ? 1 : -1 * Math.pow(2, -10 * e) + 1; -}, -quadInOut: function(e) { -return e *= 2, e < 1 ? Math.pow(e, 2) / 2 : -1 * (--e * (e - 2) - 1) / 2; -}, -linear: function(e) { -return e; -} -}, enyo.easedLerp = function(e, t, n, r) { -var i = (enyo.now() - e) / t; -return r ? i >= 1 ? 0 : 1 - n(1 - i) : i >= 1 ? 1 : n(i); -}; - // Oop.js enyo.kind = function(e) { @@ -544,7 +509,8 @@ id: "", owner: null }, statics: { -_kindPrefixi: {} +_kindPrefixi: {}, +_unnamedKindNumber: 0 }, defaultKind: "Component", handlers: {}, @@ -589,8 +555,8 @@ e.destroyed || e.destroy(); }); }, makeId: function() { -var e = "_", t = this.owner && this.owner.getId(); -return this.name ? (t ? t + e : "") + this.name : ""; +var e = "_", t = this.owner && this.owner.getId(), n = this.name || "@@" + ++enyo.Component._unnamedKindNumber; +return (t ? t + e : "") + n; }, ownerChanged: function(e) { e && e.removeComponent(this), this.owner && this.owner.addComponent(this), this.id || (this.id = this.makeId()); @@ -616,6 +582,7 @@ adjustComponentProps: function(e) { this.defaultProps && enyo.mixin(e, this.defaultProps), e.kind = e.kind || e.isa || this.defaultKind, e.owner = e.owner || this; }, _createComponent: function(e, t) { +if (!e.kind && "kind" in e) throw "enyo.create: Attempt to create a null kind. Check dependencies for [" + e.name + "]."; var n = enyo.mixin(enyo.clone(t), e); return this.adjustComponentProps(n), enyo.Component.create(n); }, @@ -668,7 +635,7 @@ waterfallDown: function(e, t, n) { for (var r in this.$) this.$[r].waterfall(e, t, n); } }), enyo.defaultCtor = enyo.Component, enyo.create = enyo.Component.create = function(e) { -if (!e.kind && "kind" in e) throw "enyo.create: Attempt to create a null kind. Check dependencies."; +if (!e.kind && "kind" in e) throw "enyo.create: Attempt to create a null kind. Check dependencies for [" + (e.name || "") + "]."; var t = e.kind || e.isa || enyo.defaultCtor, n = enyo.constructorForKind(t); return n || (console.error('no constructor found for kind "' + t + '"'), n = enyo.Component), new n(e); }, enyo.Component.subclass = function(e, t) { @@ -713,6 +680,7 @@ layoutKind: "" handlers: { onresize: "resizeHandler" }, +addBefore: undefined, statics: { _resizeFlags: { showingOnly: !0 @@ -738,7 +706,7 @@ adjustComponentProps: function(e) { e.container = e.container || this, this.inherited(arguments); }, containerChanged: function(e) { -e && e.removeControl(this), this.container && this.container.addControl(this); +e && e.removeControl(this), this.container && this.container.addControl(this, this.addBefore); }, parentChanged: function(e) { e && e != this.parent && e.removeChild(this); @@ -784,10 +752,10 @@ return this.controls[e]; addChild: function(e, t) { if (this.controlParent) this.controlParent.addChild(e); else { e.setParent(this); -if (t === undefined) this.children[this.prepend ? "unshift" : "push"](e); else if (t === null) this.children.push(e); else { -var n = this.indexOfChild(t); +if (t !== undefined) { +var n = t === null ? 0 : this.indexOfChild(t); this.children.splice(n, 0, e); -} +} else this.children.push(e); } }, removeChild: function(e) { @@ -979,26 +947,34 @@ document.cookie = r; enyo.xhr = { request: function(e) { -var t = this.getXMLHttpRequest(), n = e.method || "GET", r = "sync" in e ? !e.sync : !0; -e.username ? t.open(n, enyo.path.rewrite(e.url), r, e.username, e.password) : t.open(n, enyo.path.rewrite(e.url), r), enyo.mixin(t, e.xhrFields), this.makeReadyStateHandler(t, e.callback); +var t = this.getXMLHttpRequest(e.url), n = e.method || "GET", r = !e.sync; +e.username ? t.open(n, enyo.path.rewrite(e.url), r, e.username, e.password) : t.open(n, enyo.path.rewrite(e.url), r), enyo.mixin(t, e.xhrFields), e.callback && this.makeReadyStateHandler(t, e.callback); if (e.headers) for (var i in e.headers) t.setRequestHeader(i, e.headers[i]); -return typeof t.overrideMimeType == "function" && e.mimeType && t.overrideMimeType(e.mimeType), t.send(e.body || null), r || t.onreadystatechange(t), t; +return typeof t.overrideMimeType == "function" && e.mimeType && t.overrideMimeType(e.mimeType), t.send(e.body || null), !r && e.callback && t.onreadystatechange(t), t; +}, +cancel: function(e) { +e.onload && (e.onload = null), e.onreadystatechange && (e.onreadystatechange = null), e.abort && e.abort(); }, makeReadyStateHandler: function(e, t) { -e.onreadystatechange = function() { -e.readyState == 4 && t && t.apply(null, [ e.responseText, e ]); +window.XDomainRequest && e instanceof XDomainRequest && (e.onload = function() { +t.apply(null, [ e.responseText, e ]); +}), e.onreadystatechange = function() { +e.readyState == 4 && t.apply(null, [ e.responseText, e ]); }; }, -getXMLHttpRequest: function() { -try { -return new XMLHttpRequest; -} catch (e) {} +inOrigin: function(e) { +var t = document.createElement("a"), n = !1; +t.href = e; +if (t.protocol === ":" || t.protocol === window.location.protocol && t.hostname === window.location.hostname && t.port === (window.location.port || (window.location.protocol === "https:" ? "443" : "80"))) n = !0; +return n; +}, +getXMLHttpRequest: function(e) { try { -return new ActiveXObject("Msxml2.XMLHTTP"); -} catch (e) {} +if (window.XDomainRequest && !this.inOrigin(e) && !/^file:\/\//.test(window.location.href)) return new XDomainRequest; +} catch (t) {} try { -return new ActiveXObject("Microsoft.XMLHTTP"); -} catch (e) {} +return new XMLHttpRequest; +} catch (t) {} return null; } }; @@ -1036,7 +1012,9 @@ request: function(e) { var t = this.url.split("?"), n = t.shift() || "", r = t.length ? t.join("?").split("&") : [], i = enyo.isString(e) ? e : enyo.Ajax.objectToQuery(e); this.method == "GET" && (i && (r.push(i), i = null), this.cacheBust && !/^file:/i.test(n) && r.push(Math.random())); var s = r.length ? [ n, r.join("&") ].join("?") : n, o = {}; -this.method != "GET" && (o["Content-Type"] = this.contentType), enyo.mixin(o, this.headers), this.xhr = enyo.xhr.request({ +this.method != "GET" && (o["Content-Type"] = this.contentType), enyo.mixin(o, this.headers); +try { +this.xhr = enyo.xhr.request({ url: s, method: this.method, callback: enyo.bind(this, "receive"), @@ -1048,15 +1026,26 @@ password: this.password, xhrFields: this.xhrFields, mimeType: this.mimeType }); +} catch (u) { +this.fail(u); +} }, receive: function(e, t) { -this.destroyed || (this.isFailure(t) ? this.fail(t.status) : this.respond(this.xhrToResponse(t))); +!this.failed && !this.destroyed && (this.isFailure(t) ? this.fail(t.status) : this.respond(this.xhrToResponse(t))); +}, +fail: function(e) { +this.xhr && (enyo.xhr.cancel(this.xhr), this.xhr = null), this.inherited(arguments); }, xhrToResponse: function(e) { if (e) return this[(this.handleAs || "text") + "Handler"](e); }, isFailure: function(e) { -return e.status !== 0 && (e.status < 200 || e.status >= 300); +try { +var t = ""; +return typeof e.responseText == "string" && (t = e.responseText), e.status === 0 && t === "" ? !0 : e.status !== 0 && (e.status < 200 || e.status >= 300); +} catch (n) { +return !0; +} }, xmlHandler: function(e) { return e.responseXML; @@ -1069,7 +1058,7 @@ var t = e.responseText; try { return t && enyo.json.parse(t); } catch (n) { -return console.warn("Ajax request set to handleAs JSON but data was not in JSON format"), t; +return enyo.warn("Ajax request set to handleAs JSON but data was not in JSON format"), t; } }, statics: { @@ -1104,7 +1093,7 @@ nextCallbackID: 0 addScriptElement: function() { var e = document.createElement("script"); e.src = this.src, e.async = "async", this.charset && (e.charset = this.charset), e.onerror = enyo.bind(this, function() { -this.fail(400), this.removeScriptElement(); +this.fail(400); }); var t = document.getElementsByTagName("script")[0]; t.parentNode.insertBefore(e, t), this.scriptTag = e; @@ -1418,6 +1407,10 @@ this.node.style.cssText = this.style + (this.style[this.style.length - 1] == ";" setupBodyFitting: function() { enyo.dom.applyBodyFit(), this.addClass("enyo-fit enyo-clip"); }, +setupOverflowScrolling: function() { +if (enyo.platform.android || enyo.platform.androidChrome) return; +document.getElementsByTagName("body")[0].className += " webkitOverflowScrolling"; +}, render: function() { if (this.parent) { this.parent.beforeChildRender(this); @@ -1428,10 +1421,10 @@ return this.hasNode() || this.renderNode(), this.hasNode() && (this.renderDom(), renderInto: function(e) { this.teardownRender(); var t = enyo.dom.byId(e); -return t == document.body ? this.setupBodyFitting() : this.fit && this.addClass("enyo-fit enyo-clip"), t.innerHTML = this.generateHtml(), this.rendered(), this; +return t == document.body ? this.setupBodyFitting() : this.fit && this.addClass("enyo-fit enyo-clip"), this.setupOverflowScrolling(), t.innerHTML = this.generateHtml(), this.rendered(), this; }, write: function() { -return this.fit && this.setupBodyFitting(), document.write(this.generateHtml()), this.rendered(), this; +return this.fit && this.setupBodyFitting(), this.setupOverflowScrolling(), document.write(this.generateHtml()), this.rendered(), this; }, rendered: function() { this.reflow(); @@ -1490,7 +1483,7 @@ generateChildHtml: function() { var e = ""; for (var t = 0, n; n = this.children[t]; t++) { var r = n.generateHtml(); -n.prepend ? e = r + e : e += r; +e += r; } return e; }, @@ -1511,12 +1504,12 @@ attributesToNode: function() { for (var e in this.attributes) this.attributeToNode(e, this.attributes[e]); }, getParentNode: function() { -return this.parentNode || this.parent && this.parent.hasNode(); +return this.parentNode || this.parent && (this.parent.hasNode() || this.parent.getParentNode()); }, addNodeToParent: function() { if (this.node) { var e = this.getParentNode(); -e && this[this.prepend ? "insertNodeInParent" : "appendNodeToParent"](e); +e && (this.addBefore !== undefined ? this.insertNodeInParent(e, this.addBefore && this.addBefore.hasNode()) : this.appendNodeToParent(e)); } }, appendNodeToParent: function(e) { @@ -1648,9 +1641,13 @@ platform: "android", regex: /Android (\d+)/ }, { platform: "android", -regex: /Silk\//, +regex: /Silk\/1./, forceVersion: 2 }, { +platform: "android", +regex: /Silk\/2./, +forceVersion: 4 +}, { platform: "ie", regex: /MSIE (\d+)/ }, { @@ -1665,6 +1662,12 @@ regex: /Version\/(\d+)[.\d]+\s+Safari/ }, { platform: "chrome", regex: /Chrome\/(\d+)[.\d]+/ +}, { +platform: "androidFirefox", +regex: /Android;.*Firefox\/(\d+)/ +}, { +platform: "firefox", +regex: /Firefox\/(\d+)/ } ]; for (var r = 0, i, s, o; i = n[r]; r++) { s = i.regex.exec(e); @@ -1676,6 +1679,48 @@ break; enyo.dumbConsole = Boolean(t.android || t.ios || t.webos); }(); +// animation.js + +(function() { +var e = Math.round(1e3 / 60), t = [ "webkit", "moz", "ms", "o", "" ], n = "requestAnimationFrame", r = "cancel" + enyo.cap(n), i = function(t) { +return window.setTimeout(t, e); +}, s = function(e) { +return window.clearTimeout(e); +}; +for (var o = 0, u = t.length, a, f, l; (a = t[o]) || o < u; o++) { +if (enyo.platform.ios >= 6) break; +f = a ? a + enyo.cap(r) : r, l = a ? a + enyo.cap(n) : n; +if (window[f]) { +s = window[f], i = window[l], a == "webkit" && s(i(enyo.nop)); +break; +} +} +enyo.requestAnimationFrame = function(e, t) { +return i(e, t); +}, enyo.cancelRequestAnimationFrame = function(e) { +return s(e); +}; +})(), enyo.easing = { +cubicIn: function(e) { +return Math.pow(e, 3); +}, +cubicOut: function(e) { +return Math.pow(e - 1, 3) + 1; +}, +expoOut: function(e) { +return e == 1 ? 1 : -1 * Math.pow(2, -10 * e) + 1; +}, +quadInOut: function(e) { +return e *= 2, e < 1 ? Math.pow(e, 2) / 2 : -1 * (--e * (e - 2) - 1) / 2; +}, +linear: function(e) { +return e; +} +}, enyo.easedLerp = function(e, t, n, r) { +var i = (enyo.now() - e) / t; +return r ? i >= 1 ? 0 : 1 - n(1 - i) : i >= 1 ? 1 : n(i); +}; + // phonegap.js (function() { @@ -1692,19 +1737,22 @@ events: [ "mousedown", "mouseup", "mouseover", "mouseout", "mousemove", "mousewh windowEvents: [ "resize", "load", "unload", "message" ], features: [], connect: function() { -var e = enyo.dispatcher; -for (var t = 0, n; n = e.events[t]; t++) e.listen(document, n); -for (t = 0, n; n = e.windowEvents[t]; t++) e.listen(window, n); -}, -listen: function(e, t) { -var n = enyo.dispatch; -e.addEventListener ? this.listen = function(e, t) { -e.addEventListener(t, n, !1); -} : this.listen = function(e, t, r) { +var e = enyo.dispatcher, t, n; +for (t = 0; n = e.events[t]; t++) e.listen(document, n); +for (t = 0; n = e.windowEvents[t]; t++) { +if (n === "unload" && typeof window.chrome == "object" && window.chrome.app) continue; +e.listen(window, n); +} +}, +listen: function(e, t, n) { +var r = enyo.dispatch; +e.addEventListener ? this.listen = function(e, t, n) { +e.addEventListener(t, n || r, !1); +} : this.listen = function(e, t, n) { e.attachEvent("on" + t, function(e) { -return e.target = e.srcElement, e.preventDefault || (e.preventDefault = enyo.iePreventDefault), n(e); +return e.target = e.srcElement, e.preventDefault || (e.preventDefault = enyo.iePreventDefault), (n || r)(e); }); -}, this.listen(e, t); +}, this.listen(e, t, n); }, dispatch: function(e) { var t = this.findDispatchTarget(e.target) || this.findDefaultTarget(e); @@ -1740,7 +1788,17 @@ return enyo.dispatcher.dispatch(e); }, enyo.bubble = function(e) { var t = e || window.event; t && (t.target || (t.target = t.srcElement), enyo.dispatch(t)); -}, enyo.bubbler = "enyo.bubble(arguments[0])", enyo.requiresWindow(enyo.dispatcher.connect); +}, enyo.bubbler = "enyo.bubble(arguments[0])", function() { +var e = function() { +enyo.bubble(arguments[0]); +}; +enyo.makeBubble = function() { +var t = Array.prototype.slice.call(arguments, 0), n = t.shift(); +typeof n == "object" && typeof n.hasNode == "function" && enyo.forEach(t, function(t) { +this.hasNode() && enyo.dispatcher.listen(this.node, t, e); +}, n); +}; +}(), enyo.requiresWindow(enyo.dispatcher.connect); // preview.js @@ -1813,7 +1871,7 @@ if (enyo.platform.ie) { enyo.platform.ie == 8 && n.target && (n.pageX = n.clientX + n.target.scrollLeft, n.pageY = n.clientY + n.target.scrollTop); var s = window.event && window.event.button; n.which = s & 1 ? 1 : s & 2 ? 2 : s & 4 ? 3 : 0; -} +} else (enyo.platform.webos || window.PalmSystem) && n.which === 0 && (n.which = 1); return n; }, down: function(e) { @@ -2036,28 +2094,32 @@ i.xVelocity = t, i.yVelocity = n, i.velocity = r, enyo.dispatch(i); // touch.js enyo.requiresWindow(function() { -var e = enyo.gesture; -e.events.touchstart = function(n) { -e.events = t, e.events.touchstart(n); +var e = enyo.gesture, t = e.events; +e.events.touchstart = function(t) { +e.events = n, e.events.touchstart(t); }; -var t = { +var n = { +_touchCount: 0, touchstart: function(t) { -this.excludedTarget = null; +enyo.job.stop("resetGestureEvents"), this._touchCount += t.changedTouches.length, this.excludedTarget = null; var n = this.makeEvent(t); e.down(n), n = this.makeEvent(t), this.overEvent = n, e.over(n); }, touchmove: function(t) { +enyo.job.stop("resetGestureEvents"); var n = e.drag.dragEvent; this.excludedTarget = n && n.dragInfo && n.dragInfo.node; var r = this.makeEvent(t); e.move(r), enyo.bodyIsFitting && t.preventDefault(), this.overEvent && this.overEvent.target != r.target && (this.overEvent.relatedTarget = r.target, r.relatedTarget = this.overEvent.target, e.out(this.overEvent), e.over(r)), this.overEvent = r; }, -touchend: function(t) { -e.up(this.makeEvent(t)), e.out(this.overEvent); +touchend: function(n) { +e.up(this.makeEvent(n)), e.out(this.overEvent), this._touchCount -= n.changedTouches.length, enyo.platform.chrome && this._touchCount === 0 && enyo.job("resetGestureEvents", function() { +e.events = t; +}, 10); }, makeEvent: function(e) { var t = enyo.clone(e.changedTouches[0]); -return t.srcEvent = e, t.target = this.findTarget(t.clientX, t.clientY), t.which = 1, t; +return t.srcEvent = e, t.target = this.findTarget(t), t.which = 1, t; }, calcNodeOffset: function(e) { if (e.getBoundingClientRect) { @@ -2070,8 +2132,8 @@ height: t.height }; } }, -findTarget: function(e, t) { -return document.elementFromPoint(e, t); +findTarget: function(e) { +return document.elementFromPoint(e.clientX, e.clientY); }, findTargetTraverse: function(e, t, n) { var r = e || document.body, i = this.calcNodeOffset(r); @@ -2090,18 +2152,14 @@ return r; connect: function() { enyo.forEach([ "ontouchstart", "ontouchmove", "ontouchend", "ongesturestart", "ongesturechange", "ongestureend" ], function(e) { document[e] = enyo.dispatch; -}); -if (enyo.platform.androidChrome <= 18) { -var e = window.devicePixelRatio; -this.findTarget = function(t, n) { -return document.elementFromPoint(t * e, n * e); -}; -} else document.elementFromPoint || (this.findTarget = function(e, t) { -return this.findTargetTraverse(null, e, t); +}), enyo.platform.androidChrome <= 18 ? this.findTarget = function(e) { +return document.elementFromPoint(e.screenX, e.screenY); +} : document.elementFromPoint || (this.findTarget = function(e) { +return this.findTargetTraverse(null, e.clientX, e.clientY); }); } }; -t.connect(); +n.connect(); }); // msevents.js @@ -2389,10 +2447,10 @@ ondown: "down", onmove: "move" }, create: function() { -this.inherited(arguments), this.horizontalChanged(), this.verticalChanged(), this.maxHeightChanged(), this.container.setAttribute("onscroll", enyo.bubbler); +this.inherited(arguments), this.horizontalChanged(), this.verticalChanged(), this.maxHeightChanged(); }, rendered: function() { -this.inherited(arguments), this.scrollNode = this.calcScrollNode(); +this.inherited(arguments), enyo.makeBubble(this.container, "scroll"), this.scrollNode = this.calcScrollNode(); }, teardownRender: function() { this.inherited(arguments), this.scrollNode = null; @@ -2553,7 +2611,8 @@ published: { vertical: "default", horizontal: "default", thumb: !0, -scrim: !1 +scrim: !1, +dragDuringGesture: !0 }, events: { onShouldDrag: "" @@ -2592,9 +2651,6 @@ showing: !1 } ], components: [ { name: "client", -attributes: { -onscroll: enyo.bubbler -}, classes: "enyo-touch-scroller" } ], create: function() { @@ -2609,7 +2665,7 @@ destroy: function() { this.container.removeClass("enyo-touch-strategy-container"), this.inherited(arguments); }, rendered: function() { -this.inherited(arguments), this.calcBoundaries(), this.syncScrollMath(), this.thumb && this.alertThumbs(); +this.inherited(arguments), enyo.makeBubble(this.$.client, "scroll"), this.calcBoundaries(), this.syncScrollMath(), this.thumb && this.alertThumbs(); }, scrimChanged: function() { this.scrim && !this.$.scrim && this.makeScrim(), !this.scrim && this.$.scrim && this.$.scrim.destroy(); @@ -2690,6 +2746,7 @@ if (this.isScrolling() && !this.isOverscrolling()) return this.$.scrollMath.stop }, move: function(e, t) {}, dragstart: function(e, t) { +if (!this.dragDuringGesture && t.srcEvent.touches && t.srcEvent.touches.length > 1) return !0; this.doShouldDrag(t), this.dragging = t.dragger == this || !t.dragger && t.boundaryDragger == this; if (this.dragging) { t.preventDefault(), this.syncScrollMath(), this.$.scrollMath.startDrag(t); @@ -2777,17 +2834,17 @@ this.$.vthumb.delayHide(e), this.$.hthumb.delayHide(e); enyo.kind({ name: "enyo.TranslateScrollStrategy", kind: "TouchScrollStrategy", +translateOptimized: !1, components: [ { name: "clientContainer", classes: "enyo-touch-scroller", -attributes: { -onscroll: enyo.bubbler -}, components: [ { name: "client" } ] } ], -translateOptimized: !1, +rendered: function() { +this.inherited(arguments), enyo.makeBubble(this.$.clientContainer, "scroll"); +}, getScrollSize: function() { var e = this.$.client.hasNode(); return { @@ -2886,6 +2943,12 @@ osInfo: [ { os: "android", version: 3 }, { +os: "androidChrome", +version: 18 +}, { +os: "androidFirefox", +version: 16 +}, { os: "ios", version: 5 }, { @@ -3101,12 +3164,13 @@ name: "enyo.Image", noEvents: !1, tag: "img", attributes: { -onload: enyo.bubbler, -onerror: enyo.bubbler, draggable: "false" }, create: function() { this.noEvents && (delete this.attributes.onload, delete this.attributes.onerror), this.inherited(arguments); +}, +rendered: function() { +this.inherited(arguments), enyo.makeBubble(this, "load", "error"); } }); @@ -3118,7 +3182,8 @@ published: { value: "", placeholder: "", type: "", -disabled: !1 +disabled: !1, +selectOnFocus: !1 }, events: { onDisabledChange: "" @@ -3126,11 +3191,8 @@ onDisabledChange: "" defaultFocus: !1, tag: "input", classes: "enyo-input", -attributes: { -onfocus: enyo.bubbler, -onblur: enyo.bubbler -}, handlers: { +onfocus: "focused", oninput: "input", onclear: "clear", ondragstart: "dragstart" @@ -3139,7 +3201,7 @@ create: function() { enyo.platform.ie && (this.handlers.onkeyup = "iekeyup"), this.inherited(arguments), this.placeholderChanged(), this.type && this.typeChanged(), this.valueChanged(); }, rendered: function() { -this.inherited(arguments), this.disabledChanged(), this.defaultFocus && this.focus(); +this.inherited(arguments), enyo.makeBubble(this, "focus", "blur"), this.disabledChanged(), this.defaultFocus && this.focus(); }, typeChanged: function() { this.setAttribute("type", this.type); @@ -3168,6 +3230,16 @@ this.hasNode() && this.node.focus(); }, dragstart: function() { return !0; +}, +focused: function() { +this.selectOnFocus && enyo.asyncMethod(this, "selectContents"); +}, +selectContents: function() { +var e = this.hasNode(); +if (e && e.setSelectionRange) e.setSelectionRange(0, e.value.length); else if (e && e.createTextRange) { +var t = e.createTextRange(); +t.expand("textedit"), t.select(); +} } }); @@ -3382,6 +3454,7 @@ disabledChanged: function() { this.setAttribute("disabled", this.disabled); }, tap: function() { +if (this.disabled) return !0; this.setActive(!0); } }); diff --git a/enyo b/enyo -Subproject 12a394e0739773388125fd4339953637b4b0780 +Subproject 9a4d01b49055f686d86a2409babbca556357cf8 diff --git a/lib/layout b/lib/layout -Subproject 81002e755d7dd97c66dd26be03223614edff341 +Subproject 798d4ec6d0b22593f0cac80e51493eea10bc9d1 diff --git a/lib/onyx b/lib/onyx -Subproject 1c2420579dae1d128df74f9165404ec7cbd9eaa +Subproject d1ef65d8b733232ea5403558a2800f01143f8cb |