Specifying deck transitions: transition-type/.transitionType
By default, there is no transition animation applied when switching between <x-card>
elements, but we provide a batch of ready-made transitions you can apply using the transition-type
attribute (also accessible by the .transitionType
property).
- Valid options:
+
Valid options:
slide-up,
slide-down,
@@ -153,9 +153,9 @@ Markup
Previous card
-
Change transition-type
@@ -164,7 +164,7 @@
Markup
Markup
JavaScript
-
// assume transitionButton and deck are already // defined as their respective DOM elements var types = [ "slide-up", "slide-down", "slide-left", "slide-right", "scale-fade", "none" ]; transitionButton.addEventListener("click", function(){ var oldType = deck.transitionType; deck.transitionType = types[(types.indexOf(oldType)+1) % type.length]; // force animation to make visible for demo deck.nextCard("forward"); });
+
// assume transitionButton and deck are already // defined as their respective DOM elements var types = [ "slide-up", "slide-down", "slide-left", "slide-right", "fade-scale", "none" ]; transitionButton.addEventListener("click", function(){ var oldType = deck.transitionType; deck.transitionType = types[(types.indexOf(oldType)+1) % type.length]; // force animation to make visible for demo deck.nextCard("forward"); });
Top
@@ -186,7 +186,7 @@
JavaScript
Previous card
Next card
-
+
Markup
@@ -258,7 +258,7 @@ Styling
An hide
event is fired from a card target after it has completed its hide animation, and the hide state has been finalized.
-
+
0
1
2
diff --git a/demos/x-tag-flipbox/index.html b/demos/x-tag-flipbox/index.html
index 0cd7d1f1..3e965991 100644
--- a/demos/x-tag-flipbox/index.html
+++ b/demos/x-tag-flipbox/index.html
@@ -25,7 +25,7 @@
diff --git a/demos/x-tag-layout/index.html b/demos/x-tag-layout/index.html
index 761db960..950aa8ef 100644
--- a/demos/x-tag-layout/index.html
+++ b/demos/x-tag-layout/index.html
@@ -25,7 +25,7 @@
diff --git a/demos/x-tag-slider/index.html b/demos/x-tag-slider/index.html
index 15098872..b5d1ddda 100644
--- a/demos/x-tag-slider/index.html
+++ b/demos/x-tag-slider/index.html
@@ -25,7 +25,7 @@
diff --git a/demos/x-tag-tabbar/index.html b/demos/x-tag-tabbar/index.html
index d5159035..2fa63f97 100644
--- a/demos/x-tag-tabbar/index.html
+++ b/demos/x-tag-tabbar/index.html
@@ -25,7 +25,7 @@
diff --git a/demos/x-tag-toggle/index.html b/demos/x-tag-toggle/index.html
index c29e13ca..f5782344 100644
--- a/demos/x-tag-toggle/index.html
+++ b/demos/x-tag-toggle/index.html
@@ -25,7 +25,7 @@
diff --git a/dist/brick-common.css b/dist/brick-common.css
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/dist/brick-common.css
@@ -0,0 +1 @@
+
diff --git a/dist/brick-common.min.css b/dist/brick-common.min.css
new file mode 100644
index 00000000..e69de29b
diff --git a/dist/brick.css b/dist/brick.css
index 628e6ccb..fd9f6061 100644
--- a/dist/brick.css
+++ b/dist/brick.css
@@ -1,3 +1,5 @@
+
+
x-appbar {
padding: 0;
width: 100%;
@@ -44,6 +46,14 @@ x-appbar h6 {
text-overflow: ellipsis;
margin: 0;
}
+x-appbar > h1:after,
+x-appbar h2:after,
+x-appbar h3:after,
+x-appbar h4:after,
+x-appbar h5:after,
+x-appbar h6:after {
+ content: attr(subheading);
+}
x-calendar {
-webkit-touch-callout: none;
@@ -166,18 +176,11 @@ x-deck > x-card {
right: 0;
height: 100%;
width: 100%;
- overflow: hidden;
z-index: 0;
opacity: 1;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
- -ms-box-sizing: border-box;
box-sizing: border-box;
- -webkit-transform-style: preserve-3d;
- -moz-transform-style: preserve-3d;
- -ms-transform-style: preserve-3d;
- -o-transform-style: preserve-3d;
- transform-style: preserve-3d;
-webkit-transform: translate(0%, 0%) scale(1);
-moz-transform: translate(0%, 0%) scale(1);
-ms-transform: translate(0%, 0%) scale(1);
diff --git a/dist/brick.js b/dist/brick.js
index db94c1df..d52cecb5 100644
--- a/dist/brick.js
+++ b/dist/brick.js
@@ -1023,7 +1023,7 @@ if (typeof WeakMap === "undefined") {
attach: "OverflowEvent" in win ? "overflowchanged" : [],
condition: function(event, custom) {
event.flow = type;
- return event.type == type + "flow" || event.orient === 0 && event.horizontalOverflow == flow || event.orient == 1 && event.verticalOverflow == flow || event.orient == 2 && event.horizontalOverflow == flow && event.verticalOverflow == flow;
+ return event.type == type + "flow" || (event.orient === 0 && event.horizontalOverflow == flow || event.orient == 1 && event.verticalOverflow == flow || event.orient == 2 && event.horizontalOverflow == flow && event.verticalOverflow == flow);
}
};
}
@@ -2885,88 +2885,58 @@ if (typeof WeakMap === "undefined") {
})();
(function() {
- var matchNum = /[1-9]/;
- var replaceSpaces = / /g;
- var captureTimes = /(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi;
- var transPre = "transition" in getComputedStyle(document.documentElement) ? "t" : xtag.prefix.js + "T";
- var transDur = transPre + "ransitionDuration";
- var transProp = transPre + "ransitionProperty";
- var skipFrame = function(fn) {
+ var matchNum = /[1-9]/, replaceSpaces = / /g, captureTimes = /(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi, transPre = "transition" in getComputedStyle(document.documentElement) ? "t" : xtag.prefix.js + "T", transDur = transPre + "ransitionDuration", transProp = transPre + "ransitionProperty", skipFrame = function(fn) {
xtag.requestFrame(function() {
xtag.requestFrame(fn);
});
- };
- var ready;
- if (document.readyState == "complete") {
- ready = skipFrame(function() {
- ready = false;
- });
- } else {
- ready = xtag.addEvent(document, "readystatechange", function() {
- if (document.readyState == "complete") {
- skipFrame(function() {
- ready = false;
- });
- xtag.removeEvent(document, "readystatechange", ready);
- }
- });
- }
+ }, ready = document.readyState == "complete" ? skipFrame(function() {
+ ready = false;
+ }) : xtag.addEvent(document, "readystatechange", function() {
+ if (document.readyState == "complete") {
+ skipFrame(function() {
+ ready = false;
+ });
+ xtag.removeEvent(document, "readystatechange", ready);
+ }
+ });
function getTransitions(node) {
- node.__transitions__ = node.__transitions__ || {};
- return node.__transitions__;
+ return node.__transitions__ = node.__transitions__ || {};
}
function startTransition(node, name, transitions) {
var style = getComputedStyle(node), after = transitions[name].after;
node.setAttribute("transition", name);
- if (after && !style[transDur].match(matchNum)) {
- after();
- }
+ if (after && !style[transDur].match(matchNum)) after();
}
xtag.addEvents(document, {
transitionend: function(e) {
var node = e.target, name = node.getAttribute("transition");
if (name) {
- var i = 0, max = 0, prop = null, style = getComputedStyle(node), transitions = getTransitions(node), props = style[transProp].replace(replaceSpaces, "").split(",");
+ var i = max = 0, prop = null, style = getComputedStyle(node), transitions = getTransitions(node), props = style[transProp].replace(replaceSpaces, "").split(",");
style[transDur].replace(captureTimes, function(match, time, unit) {
- time = parseFloat(time) * (unit === "s" ? 1e3 : 1);
- if (time > max) {
- prop = i;
- max = time;
- }
+ var time = parseFloat(time) * (unit === "s" ? 1e3 : 1);
+ if (time > max) prop = i, max = time;
i++;
});
prop = props[prop];
- if (!prop) {
- throw new SyntaxError("No matching transition property found");
- } else if (e.propertyName == prop && transitions[name].after) {
- transitions[name].after();
- }
+ if (!prop) throw new SyntaxError("No matching transition property found"); else if (e.propertyName == prop && transitions[name].after) transitions[name].after();
}
}
});
xtag.transition = function(node, name, obj) {
var transitions = getTransitions(node), options = transitions[name] = obj || {};
- if (options.immediate) {
- options.immediate();
- }
+ if (options.immediate) options.immediate();
if (options.before) {
options.before();
- if (ready) {
- xtag.skipTransition(node, function() {
- startTransition(node, name, transitions);
- });
- } else {
- skipFrame(function() {
- startTransition(node, name, transitions);
- });
- }
- } else {
- startTransition(node, name, transitions);
- }
+ if (ready) xtag.skipTransition(node, function() {
+ startTransition(node, name, transitions);
+ }); else skipFrame(function() {
+ startTransition(node, name, transitions);
+ });
+ } else startTransition(node, name, transitions);
};
xtag.pseudos.transition = {
onCompiled: function(fn, pseudo) {
- var options = {}, when = pseudo["arguments"][0] || "immediate", name = pseudo["arguments"][1] || pseudo.key.split(":")[0];
+ var options = {}, when = pseudo.arguments[0] || "immediate", name = pseudo.arguments[1] || pseudo.key.split(":")[0];
return function() {
var target = this, args = arguments;
if (this.hasAttribute("transition")) {
@@ -2974,9 +2944,7 @@ if (typeof WeakMap === "undefined") {
return fn.apply(target, args);
};
xtag.transition(this, name, options);
- } else {
- return fn.apply(this, args);
- }
+ } else return fn.apply(this, args);
};
}
};
@@ -2994,7 +2962,7 @@ if (typeof WeakMap === "undefined") {
return item && item.nodeName ? item : isNaN(item) ? xtag.queryChildren(deck, item) : deck.children[item];
}
function checkCard(deck, card, selected) {
- return card && (selected ? card == deck.xtag.selected : card != deck.xtag.selected) && deck == card.parentNode && card.nodeName == "X-CARD";
+ return card && (selected ? card == deck.xtag.selected : card != deck.xtag.selected) && deck == card.parentNode && card.nodeName.toLowerCase() == "x-card";
}
function shuffle(deck, side, direction) {
var getters = sides[side];
@@ -3120,7 +3088,7 @@ if (typeof WeakMap === "undefined") {
lifecycle: {
inserted: function() {
var deck = this.parentNode;
- if (deck.nodeName == "X-DECK") {
+ if (deck.nodeName.toLowerCase() == "x-deck") {
this.xtag.deck = deck;
if (this != deck.selected && this.selected) {
deck.showCard(this);
@@ -3283,7 +3251,7 @@ if (typeof WeakMap === "undefined") {
scroll: evaluateScroll,
transitionend: function(e) {
var node = e.target;
- if (this.hasAttribute("content-maximizing") && node.parentNode == this && (node.nodeName == "HEADER" || node.nodeName == "FOOTER")) {
+ if (this.hasAttribute("content-maximizing") && node.parentNode == this && (node.nodeName.toLowerCase() == "header" || node.nodeName.toLowerCase() == "footer")) {
this.setAttribute("content-maximized", null);
this.removeAttribute("content-maximizing");
}
@@ -3924,7 +3892,7 @@ if (typeof WeakMap === "undefined") {
toggle.active = true;
}
function inTogglebar(toggle) {
- return toggle.parentNode && toggle.parentNode.nodeName == "X-TOGGLEBAR";
+ return toggle.parentNode && toggle.parentNode.nodeName.toLowerCase() == "x-togglebar";
}
var shifted = false;
xtag.addEvents(document, {
diff --git a/dist/brick.min.css b/dist/brick.min.css
index 6c49cdcf..49934e25 100644
--- a/dist/brick.min.css
+++ b/dist/brick.min.css
@@ -2,6 +2,7 @@ x-appbar{padding:0;width:100%;display:-webkit-box;display:-moz-box;display:-ms-f
x-appbar,x-appbar *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
x-appbar > *{border:none;vertical-align:middle;text-align:center;-webkit-flex-align:center;-ms-flex-align:center;-webkit-align-items:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;align-items:center;text-align:center}
x-appbar > h1,x-appbar h2,x-appbar h3,x-appbar h4,x-appbar h5,x-appbar h6{min-width:auto;min-height:auto;-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;box-flex:1;flex:1;overflow:hidden;text-overflow:ellipsis;margin:0}
+x-appbar > h1:after,x-appbar h2:after,x-appbar h3:after,x-appbar h4:after,x-appbar h5:after,x-appbar h6:after{content:attr(subheading)}
x-calendar{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent;position:relative;display:inline-block;margin:0;padding:0;max-width:100%;font-size:1em;text-align:center;overflow:hidden}
x-calendar,x-calendar *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
x-calendar .calendar{position:relative;display:inline-block;overflow:hidden;width:100%;height:100%}
@@ -21,7 +22,7 @@ x-calendar .prev{left:0}
x-calendar .next{right:0}
x-calendar:not([active]) .day:hover,x-calendar:not([active]) .prev:hover,x-calendar:not([active]) .next:hover{cursor:pointer}
x-deck{display:block;position:relative;overflow:hidden;height:100%;width:100%}
-x-deck > x-card{display:none;position:absolute !important;left:0;right:0;height:100%;width:100%;overflow:hidden;z-index:0;opacity:1;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-ms-transform-style:preserve-3d;-o-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transform:translate(0%,0%) scale(1);-moz-transform:translate(0%,0%) scale(1);-ms-transform:translate(0%,0%) scale(1);-o-transform:translate(0%,0%) scale(1);transform:translate(0%,0%) scale(1)}
+x-deck > x-card{display:none;position:absolute !important;left:0;right:0;height:100%;width:100%;z-index:0;opacity:1;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transform:translate(0%,0%) scale(1);-moz-transform:translate(0%,0%) scale(1);-ms-transform:translate(0%,0%) scale(1);-o-transform:translate(0%,0%) scale(1);transform:translate(0%,0%) scale(1)}
x-deck > x-card[selected],x-deck > x-card[transition]{display:block}
x-deck[transition-type="fade-scale"] > x-card,x-deck > x-card[transition-type="fade-scale"]{opacity:0;-webkit-transform:scale(.85);-moz-transform:scale(.85);-ms-transform:scale(.85);-o-transform:scale(.85);transform:scale(.85);-webkit-transition:opacity .5s ease,-webkit-transform .5s ease;-moz-transition:opacity .5s ease,-moz-transform .5s ease;-ms-transition:opacity .5s ease,-ms-transform .5s ease;-o-transition:opacity .5s ease,-o-transform .5s ease;transition:opacity .5s ease,transform .5s ease}
x-deck > x-card[show][transition]{opacity:1;-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}
diff --git a/dist/brick.min.js b/dist/brick.min.js
index e66c7bd2..db2ad545 100644
--- a/dist/brick.min.js
+++ b/dist/brick.min.js
@@ -1,3 +1,3 @@
-window.Platform={};var logFlags={};!function(){function a(a){if(this._element=a,a.className!=this._classCache){if(this._classCache=a.className,!this._classCache)return;var b,c=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(b=0;b>>0)+(b++ +"__")};c.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}},window.WeakMap=c}(),function(a){function b(a){u.push(a),t||(t=!0,q(d))}function c(a){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(a)||a}function d(){t=!1;var a=u;u=[],a.sort(function(a,b){return a.uid_-b.uid_});var b=!1;a.forEach(function(a){var c=a.takeRecords();e(a),c.length&&(a.callback_(c,a),b=!0)}),b&&d()}function e(a){a.nodes_.forEach(function(b){var c=p.get(b);c&&c.forEach(function(b){b.observer===a&&b.removeTransientObservers()})})}function f(a,b){for(var c=a;c;c=c.parentNode){var d=p.get(c);if(d)for(var e=0;e0){var e=c[d-1],f=n(e,a);if(f)return c[d-1]=f,void 0}else b(this.observer);c[d]=a},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(a){var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0),b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attributes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.removeEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target){this.addListeners_(a),this.transientObservedNodes.push(a);var b=p.get(a);b||p.set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transientObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.removeListeners_(a);for(var b=p.get(a),c=0;cc&&(a=b[c]);c++)a();B=[]}function l(a){z?j(function(){m(a)}):m(a)}function m(a){(a.attachedCallback||a.detachedCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("inserted:",a.localName),q(a)&&(a.__inserted=(a.__inserted||0)+1,a.__inserted<1&&(a.__inserted=1),a.__inserted>1?y.dom&&console.warn("inserted:",a.localName,"insert/remove count:",a.__inserted):a.attachedCallback&&(y.dom&&console.log("inserted:",a.localName),a.attachedCallback())),y.dom&&console.groupEnd())}function n(a){o(a),d(a,function(a){o(a)})}function o(a){z?j(function(){p(a)}):p(a)}function p(a){(a.attachedCallback||a.detachedCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("removed:",a.localName),q(a)||(a.__inserted=(a.__inserted||0)-1,a.__inserted>0&&(a.__inserted=0),a.__inserted<0?y.dom&&console.warn("removed:",a.localName,"insert/remove count:",a.__inserted):a.detachedCallback&&a.detachedCallback()),y.dom&&console.groupEnd())}function q(a){for(var b=a,c=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;b;){if(b==c)return!0;b=b.parentNode||b.host}}function r(a){if(a.shadowRoot&&!a.shadowRoot.__watched){y.dom&&console.log("watching shadow-root for: ",a.localName);for(var b=a.shadowRoot;b;)s(b),b=b.olderShadowRoot}}function s(a){a.__watched||(v(a),a.__watched=!0)}function t(a){if(y.dom){var b=a[0];if(b&&"childList"===b.type&&b.addedNodes&&b.addedNodes){for(var c=b.addedNodes[0];c&&c!==document&&!c.host;)c=c.parentNode;var d=c&&(c.URL||c._URL||c.host&&c.host.localName)||"";d=d.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",a.length,d||"")}a.forEach(function(a){"childList"===a.type&&(D(a.addedNodes,function(a){a.localName&&g(a)}),D(a.removedNodes,function(a){a.localName&&n(a)}))}),y.dom&&console.groupEnd()}function u(){t(C.takeRecords()),k()}function v(a){C.observe(a,{childList:!0,subtree:!0})}function w(a){v(a)}function x(a){y.dom&&console.group("upgradeDocument: ",(a.URL||a._URL||"").split("/").pop()),g(a),y.dom&&console.groupEnd()}var y=window.logFlags||{},z=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;a.hasPolyfillMutations=z;var A=!1,B=[],C=new MutationObserver(t),D=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.watchShadow=r,a.upgradeAll=g,a.upgradeSubtree=f,a.observeDocument=w,a.upgradeDocument=x,a.takeRecords=u}(window.CustomElements),function(){function a(a){return"link"===a.localName&&a.getAttribute("rel")===b}var b=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",c={selectors:["link[rel="+b+"]"],map:{link:"parseLink"},parse:function(a){if(!a.__parsed){a.__parsed=!0;var b=a.querySelectorAll(c.selectors);d(b,function(a){c[c.map[a.localName]](a)}),CustomElements.upgradeDocument(a),CustomElements.observeDocument(a)}},parseLink:function(b){a(b)&&this.parseImport(b)},parseImport:function(a){a.content&&c.parse(a.content)}},d=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=c}(),function(a){function b(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var a=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;a(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b=document.createEvent("HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"===document.readyState||a.flags.eager)b();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var c=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(c,b)}else b()}(window.CustomElements),function(){function a(a){var b=L.call(a);return K[b]||(K[b]=b.match(M)[1].toLowerCase())}function b(c,d){var e=b[d||a(c)];return e?e(c):c}function c(b){return-1==N.indexOf(a(b))?Array.prototype.slice.call(b,0):[b]}function d(a,b){return(b||O).length?c(a.querySelectorAll(b)):[]}function e(a,b){var c={added:[],removed:[]};b.forEach(function(b){b._mutation=!0;for(var d in c)for(var e=a._records["added"==d?"inserted":"removed"],f=b[d+"Nodes"],g=f.length,h=0;g>h&&-1==c[d].indexOf(f[h]);h++)c[d].push(f[h]),e.forEach(function(a){a(f[h],b)})})}function f(c,d,e){var f=a(e);return"object"==f&&"object"==a(c[d])?T.merge(c[d],e):c[d]=b(e,f),c}function g(a,b,c,d,e){var f=e[b];b in e?"function"==typeof e[b]&&(f.__mixins__||(f.__mixins__=[]),f.__mixins__.push(T.applyPseudos(c,d,a.pseudos))):e[b]=d}function h(a,b,c,d){if(d){var e={};for(var f in c)e[f.split(":")[0]]=f;for(f in b)g(a,e[f.split(":")[0]]||f,f,b[f],c)}else for(var h in b)c[h+":__mixin__("+P++ +")"]=T.applyPseudos(h,b[h],a.pseudos)}function i(a){return a.mixins.forEach(function(b){var c=T.mixins[b];for(var d in c){var e=c[d],f=a[d];if(f)switch(d){case"accessors":case"prototype":for(var g in e)f[g]?h(a,e[g],f[g],!0):f[g]=e[g];break;default:h(a,e,f,"events"!=d)}else a[d]=e}}),a}function j(a,b){var c,d=b.target;if(!d.tagName)return null;if(T.matchSelector(d,a.value))c=d;else if(T.matchSelector(d,a.value+" *"))for(var e=d.parentNode;!c;)T.matchSelector(e,a.value)&&(c=e),e=e.parentNode;return c?a.listener=a.listener.bind(c):null}function k(a){if(a.type.match("touch"))a.target.__touched__=!0;else if(a.target.__touched__&&a.type.match("mouse"))return delete a.target.__touched__,void 0;return!0}function l(a){var b="over"==a;return{attach:"OverflowEvent"in y?"overflowchanged":[],condition:function(c){return c.flow=a,c.type==a+"flow"||0===c.orient&&c.horizontalOverflow==b||1==c.orient&&c.verticalOverflow==b||2==c.orient&&c.horizontalOverflow==b&&c.verticalOverflow==b}}}function m(a,b,c,d){d?b[a]=c[a]:Object.defineProperty(b,a,{writable:!0,enumerable:!0,value:c[a]})}function n(a,b){var c=Object.getOwnPropertyDescriptor(a,"target");for(var d in b)Q[d]||m(d,a,b,c);a.baseEvent=b}function o(a,b){return{value:a.boolean?"":b,method:a.boolean&&!b?"removeAttribute":"setAttribute"}}function p(a,b,c,d){var e=o(b,d);a[e.method](c,e.value)}function q(a,b,c,d,e){for(var f=b.property?[a.xtag[b.property]]:b.selector?T.query(a,b.selector):[],g=f.length;g--;)f[g][e](c,d)}function r(a,b,c){a.__view__&&a.__view__.updateBindingValue(a,b,c)}function s(a,b,c,d,e,f){var g=c.split(":"),h=g[0];if("get"==h)g[0]=b,a.prototype[b].get=T.applyPseudos(g.join(":"),d[c],a.pseudos,d[c]);else if("set"==h){g[0]=b;var i=a.prototype[b].set=T.applyPseudos(g.join(":"),e?function(a){this.xtag._skipSet=!0,this.xtag._skipAttr||p(this,e,f,a),this.xtag._skipAttr&&e.skip&&delete this.xtag._skipAttr,d[c].call(this,e.boolean?!!a:a),r(this,f,a),delete this.xtag._skipSet}:d[c]?function(a){d[c].call(this,a),r(this,f,a)}:null,a.pseudos,d[c]);e&&(e.setter=i)}else a.prototype[b][c]=d[c]}function t(a,b){a.prototype[b]={};var c=a.accessors[b],d=c.attribute,e=d&&d.name?d.name.toLowerCase():b;d&&(d.key=b,a.attributes[e]=d);for(var f in c)s(a,b,f,c,d,e);if(d){if(!a.prototype[b].get){var g=(d.boolean?"has":"get")+"Attribute";a.prototype[b].get=function(){return this[g](e)}}a.prototype[b].set||(a.prototype[b].set=function(a){p(this,d,e,a),r(this,e,a)})}}function u(a){S[a]=(S[a]||[]).filter(function(b){return(b.tags=b.tags.filter(function(b){return b!=a&&!T.tags[b]})).length||b.fn()})}function v(a,b,c){a.__tap__||(a.__tap__={click:"mousedown"==c.type},a.__tap__.click?a.addEventListener("click",b.observer):(a.__tap__.scroll=b.observer.bind(a),window.addEventListener("scroll",a.__tap__.scroll,!0),a.addEventListener("touchmove",b.observer),a.addEventListener("touchcancel",b.observer),a.addEventListener("touchend",b.observer))),a.__tap__.click||(a.__tap__.x=c.touches[0].pageX,a.__tap__.y=c.touches[0].pageY)}function w(a,b){a.__tap__&&(a.__tap__.click?a.removeEventListener("click",b.observer):(window.removeEventListener("scroll",a.__tap__.scroll,!0),a.removeEventListener("touchmove",b.observer),a.removeEventListener("touchcancel",b.observer),a.removeEventListener("touchend",b.observer)),delete a.__tap__)}function x(a,b,c){var d=c.changedTouches[0],e=b.gesture.tolerance;return d.pageXa.__tap__.x-e&&d.pageYa.__tap__.y-e?!0:void 0}var y=window,z=document,A=z.createElement("div"),B=function(){},C=function(){return!0},D=/([\w-]+(?:\([^\)]+\))?)/g,E=/(\w*)(?:\(([^\)]*)\))?/,F=/(\d+)/g,G={action:function(a,b){return a.value.match(F).indexOf(String(b.keyCode))>-1==("keypass"==a.name)||null}},H=function(){var a=y.getComputedStyle(z.documentElement,""),b=(Array.prototype.slice.call(a).join("").match(/-(moz|webkit|ms)-/)||""===a.OLink&&["","o"])[1];return{dom:"ms"==b?"MS":b,lowercase:b,css:"-"+b+"-",js:"ms"==b?b:b[0].toUpperCase()+b.substr(1)}}(),I=Element.prototype.matchesSelector||Element.prototype[H.lowercase+"MatchesSelector"],J=y.MutationObserver||y[H.js+"MutationObserver"],K={},L=K.toString,M=/\s([a-zA-Z]+)/;b.object=function(a){var c={};for(var d in a)c[d]=b(a[d]);return c},b.array=function(a){for(var c=a.length,d=new Array(c);c--;)d[c]=b(a[c]);return d};var N=["undefined","null","number","boolean","string","function"],O="",P=0,Q={};for(var R in z.createEvent("CustomEvent"))Q[R]=1;var S={},T={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(a,b){var d;if("string"==typeof a){d=a.toLowerCase();var e=b.prototype;delete b.prototype;var f=T.tags[d]=i(T.merge({},T.defaultOptions,b));for(var g in f.events)f.events[g]=T.parseEvent(g,f.events[g]);for(g in f.lifecycle)f.lifecycle[g.split(":")[0]]=T.applyPseudos(g,f.lifecycle[g],f.pseudos,f.lifecycle[g]);for(g in f.methods)f.prototype[g.split(":")[0]]={value:T.applyPseudos(g,f.methods[g],f.pseudos,f.methods[g]),enumerable:!0};for(g in f.accessors)t(f,g);var h=f.lifecycle.created||f.lifecycle.ready;f.prototype.createdCallback={enumerable:!0,value:function(){var a=this;T.addEvents(this,f.events),f.mixins.forEach(function(b){T.mixins[b].events&&T.addEvents(a,T.mixins[b].events)});var b=h?h.apply(this,arguments):null;for(var c in f.attributes){var d=f.attributes[c],e=this.hasAttribute(c);(e||d.boolean)&&(this[d.key]=d.boolean?e:this.getAttribute(c))}return f.pseudos.forEach(function(b){b.onAdd.call(a,b)}),b}};var j=f.lifecycle.inserted,k=f.lifecycle.removed;(j||k)&&(f.prototype.attachedCallback={value:function(){return k&&(this.xtag.__parentNode__=this.parentNode),j?j.apply(this,arguments):void 0},enumerable:!0}),k&&(f.prototype.detachedCallback={value:function(){var a=c(arguments);a.unshift(this.xtag.__parentNode__);var b=k.apply(this,a);return delete this.xtag.__parentNode__,b},enumerable:!0}),f.lifecycle.attributeChanged&&(f.prototype.attributeChangedCallback={value:f.lifecycle.attributeChanged,enumerable:!0});var l=f.prototype.setAttribute||HTMLElement.prototype.setAttribute;f.prototype.setAttribute={writable:!0,enumberable:!0,value:function(a,b){var c=f.attributes[a.toLowerCase()];this.xtag._skipAttr||l.call(this,a,c&&c.boolean?"":b),c&&(c.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,c.setter.call(this,c.boolean?!0:b)),b=c.skip?c.boolean?this.hasAttribute(a):this.getAttribute(a):b,q(this,c,a,c.boolean?"":b,"setAttribute")),delete this.xtag._skipAttr}};var m=f.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;f.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(a){var b=f.attributes[a.toLowerCase()];this.xtag._skipAttr||m.call(this,a),b&&(b.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,b.setter.call(this,b.boolean?!1:void 0)),q(this,b,a,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var n=e?e:b["extends"]?Object.create(z.createElement(b["extends"]).constructor).prototype:y.HTMLElement.prototype,o={prototype:Object.create(n,f.prototype)};b["extends"]&&(o["extends"]=b["extends"]);var p=z.registerElement(d,o);return u(d),p}},ready:function(a,b){var d={tags:c(a),fn:b};d.tags.reduce(function(a,b){return T.tags[b]?a:((S[b]=S[b]||[]).push(d),void 0)},!0)&&b()},mixins:{},prefix:H,captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged","DOMMouseScroll"],customEvents:{overflow:l("over"),underflow:l("under"),animationstart:{attach:[H.dom+"AnimationStart"]},animationend:{attach:[H.dom+"AnimationEnd"]},transitionend:{attach:[H.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:k},enter:{attach:["mouseover","touchenter"],condition:k},leave:{attach:["mouseout","touchleave"],condition:k},scrollwheel:{attach:["DOMMouseScroll","mousewheel"],condition:function(a){return a.delta=a.wheelDelta?a.wheelDelta/40:Math.round(-1*(a.detail/3.5)),!0}},tapstart:{observe:{mousedown:z,touchstart:z},condition:k},tapend:{observe:{mouseup:z,touchend:z},condition:k},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(a,b){switch(a.type){case"move":return!0;case"dragover":var c=b.lastDrag||{};return b.lastDrag=a,c.pageX!=a.pageX&&c.pageY!=a.pageY||null;case"tapstart":b.move||(b.current=this,b.move=T.addEvents(this,{move:b.listener,dragover:b.listener}),b.tapend=T.addEvent(z,"tapend",b.listener));break;case"tapend":case"dragend":case"touchcancel":a.touches.length||(b.move&&T.removeEvents(b.current,b.move||{}),b.tapend&&T.removeEvent(z,b.tapend||{}),delete b.lastDrag,delete b.current,delete b.tapend,delete b.move)}}}},pseudos:{__mixin__:{},mixins:{onCompiled:function(a,b){var c=b.source.__mixins__;if(c)switch(b.value){case"before":return function(){var b=this,d=arguments;return c.forEach(function(a){a.apply(b,d)}),a.apply(b,d)};case"after":case null:return function(){var b=this,d=arguments;return returns=a.apply(b,d),c.forEach(function(a){a.apply(b,d)}),returns}}}},keypass:G,keyfail:G,delegate:{action:j},within:{action:j,onAdd:function(a){var b=a.source.condition;b&&(a.source.condition=function(c,d){return T.query(this,a.value).filter(function(a){return a==c.target||a.contains?a.contains(c.target):null})[0]?b.call(this,c,d):null})}},preventable:{action:function(a,b){return!b.defaultPrevented}}},clone:b,typeOf:a,toArray:c,wrap:function(a,b){return function(){var c=arguments,d=a.apply(this,c);return b.apply(this,c),d}},merge:function(b,c,d){if("string"==a(c))return f(b,c,d);for(var e=1,g=arguments.length;g>e;e++){var h=arguments[e];for(var i in h)f(b,i,h[i])}return b},uid:function(){return Math.random().toString(36).substr(2,10)},query:d,skipTransition:function(a,b,c){var d=H.js+"TransitionProperty";a.style[d]=a.style.transitionProperty="none";var e=b?b.call(c):null;return T.requestFrame(function(){T.requestFrame(function(){a.style[d]=a.style.transitionProperty="",e&&T.requestFrame(e)})})},requestFrame:function(){var a=y.requestAnimationFrame||y[H.lowercase+"RequestAnimationFrame"]||function(a){return y.setTimeout(a,20)};return function(b){return a(b)}}(),cancelFrame:function(){var a=y.cancelAnimationFrame||y[H.lowercase+"CancelAnimationFrame"]||y.clearTimeout;return function(b){return a(b)}}(),matchSelector:function(a,b){return I.call(a,b)},set:function(a,b,c){a[b]=c,window.CustomElements&&CustomElements.upgradeAll(a)},innerHTML:function(a,b){T.set(a,"innerHTML",b)},hasClass:function(a,b){return a.className.split(" ").indexOf(b.trim())>-1},addClass:function(a,b){var c=a.className.trim().split(" ");return b.trim().split(" ").forEach(function(a){~c.indexOf(a)||c.push(a)}),a.className=c.join(" ").trim(),a},removeClass:function(a,b){var c=b.trim().split(" ");return a.className=a.className.trim().split(" ").filter(function(a){return a&&!~c.indexOf(a)}).join(" "),a},toggleClass:function(a,b){return T[T.hasClass(a,b)?"removeClass":"addClass"].call(null,a,b)},queryChildren:function(a,b){var d=a.id,e=a.id=d||"x_"+T.uid(),f="#"+e+" > ",g=!1;a.parentNode||(g=!0,A.appendChild(a)),b=f+(b+"").replace(",",","+f,"g");var h=a.parentNode.querySelectorAll(b);return d||a.removeAttribute("id"),g&&A.removeChild(a),c(h)},createFragment:function(a){var b=z.createDocumentFragment();if(a){for(var d=b.appendChild(z.createElement("div")),e=c(a.nodeName?arguments:!(d.innerHTML=a)||d.children),f=e.length,g=0;f>g;)b.insertBefore(e[g++],d);b.removeChild(d)}return b},manipulate:function(a,b){var c=a.nextSibling,d=a.parentNode,e=z.createDocumentFragment(),f=b.call(e.appendChild(a),e)||a;c?d.insertBefore(f,c):d.appendChild(f)},applyPseudos:function(a,b,d,e){var f=b,g={};if(a.match(":"))for(var h=a.match(D),i=h.length;--i;)h[i].replace(E,function(b,j,k){if(!T.pseudos[j])throw"pseudo not found: "+j+" "+h;k=""===k||"undefined"==typeof k?null:k;var l=g[i]=Object.create(T.pseudos[j]);l.key=a,l.name=j,l.value=k,l.arguments=(k||"").split(","),l.action=l.action||C,l.source=e;var m=f;f=function(){var b=c(arguments),d={key:a,name:j,value:k,source:e,arguments:l.arguments,listener:m},f=l.action.apply(this,[d].concat(b));return null===f||f===!1?f:d.listener.apply(this,b)},d&&l.onAdd&&(d.nodeName?l.onAdd.call(d,l):d.push(l))});for(var j in g)g[j].onCompiled&&(f=g[j].onCompiled(f,g[j])||f);return f},removePseudos:function(a,b){b.forEach(function(b){b.onRemove&&b.onRemove.call(a,b)})},parseEvent:function(a,b){var d=a.split(":"),e=d.shift(),f=T.customEvents[e],g=T.merge({type:e,stack:B,condition:C,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:B,onRemove:B},f||{});g.attach=c(g.base||g.attach),g.chain=e+(g.pseudos.length?":"+g.pseudos:"")+(d.length?":"+d.join(":"):"");var h=g.condition;g.condition=function(a){return a.touches,a.targetTouches,h.apply(this,arguments)};var i=T.applyPseudos(g.chain,b,g._pseudos,g);if(g.stack=function(a){a.currentTarget=a.currentTarget||this,a.touches,a.targetTouches;var b=a.detail||{};return b.__stack__?b.__stack__==i?(a.stopPropagation(),a.cancelBubble=!0,i.apply(this,arguments)):void 0:i.apply(this,arguments)},g.listener=function(a){var b=c(arguments),d=g.condition.apply(this,b.concat([g]));return d?a.type==e?g.stack.apply(this,b):(T.fireEvent(a.target,e,{baseEvent:a,detail:d!==!0&&(d.__stack__=i)?d:{__stack__:i}}),void 0):d},g.attach.forEach(function(a){g._attach.push(T.parseEvent(a,g.listener))}),f&&f.observe&&!f.__observing__){f.observer=function(a){var b=g.condition.apply(this,c(arguments).concat([f]));return b?(T.fireEvent(a.target,e,{baseEvent:a,detail:b!==!0?b:{}}),void 0):b};for(var j in f.observe)T.addEvent(f.observe[j]||document,j,f.observer,!0);f.__observing__=!0}return g},addEvent:function(a,b,c,d){var e="function"==typeof c?T.parseEvent(b,c):c;return e._pseudos.forEach(function(b){b.onAdd.call(a,b)}),e._attach.forEach(function(b){T.addEvent(a,b.type,b)}),e.onAdd.call(a,e,e.listener),a.addEventListener(e.type,e.stack,d||T.captureEvents.indexOf(e.type)>-1),e},addEvents:function(a,b){var c={};for(var d in b)c[d]=T.addEvent(a,d,b[d]);return c},removeEvent:function(a,b,c){c=c||b,c.onRemove.call(a,c,c.listener),T.removePseudos(a,c._pseudos),c._attach.forEach(function(b){T.removeEvent(a,b)}),a.removeEventListener(c.type,c.stack)},removeEvents:function(a,b){for(var c in b)T.removeEvent(a,b[c])},fireEvent:function(a,b,c,d){var e=z.createEvent("CustomEvent");c=c||{},d&&console.warn("fireEvent has been modified"),e.initCustomEvent(b,c.bubbles!==!1,c.cancelable!==!1,c.detail),c.baseEvent&&n(e,c.baseEvent);try{a.dispatchEvent(e)}catch(f){console.warn("This error may have been caused by a change in the fireEvent method",f)}},addObserver:function(a,b,c){a._records||(a._records={inserted:[],removed:[]},J?(a._observer=new J(function(b){e(a,b)}),a._observer.observe(a,{subtree:!0,childList:!0,attributes:!1,characterData:!1})):["Inserted","Removed"].forEach(function(b){a.addEventListener("DOMNode"+b,function(c){c._mutation=!0,a._records[b.toLowerCase()].forEach(function(a){a(c.target,c)})},!1)})),-1==a._records[b].indexOf(c)&&a._records[b].push(c)},removeObserver:function(a,b,c){var d=a._records;d&&c?d[b].splice(d[b].indexOf(c),1):d[b]=[]}},U=!1,V=null;z.addEventListener("mousedown",function(a){U=!0,V=a.target},!0),z.addEventListener("mouseup",function(){U=!1,V=null},!0),z.addEventListener("dragend",function(){U=!1,V=null},!0);var W={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=U?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=U&&this.currentTarget&&(this.currentTarget==V||this.currentTarget.contains&&this.currentTarget.contains(V))?(this.identifier=0)||[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.__changedTouches__||(this.identifier=0)||(this.__changedTouches__=[this])}}};for(R in W)UIEvent.prototype[R]=W[R],Object.defineProperty(UIEvent.prototype,R,W[R]);T.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(a,b){var c=a.target;switch(a.type){case"touchstart":return c.__tap__&&c.__tap__.click&&w(c,b),v(c,b,a),void 0;case"mousedown":return c.__tap__||v(c,b,a),void 0;case"scroll":case"touchcancel":return w(this,b),void 0;case"touchmove":case"touchend":return this.__tap__&&!x(this,b,a)?(w(this,b),void 0):"touchend"==a.type||null;case"click":return w(this,b),!0}}},y.xtag=T,"function"==typeof define&&define.amd&&define(T),z.addEventListener("WebComponentsReady",function(){T.fireEvent(z.body,"DOMComponentsLoaded")})}(),function(){xtag.register("x-appbar",{lifecycle:{created:function(){var a=xtag.queryChildren(this,"h1,h2,h3,h4,h5,h6")[0];a||(a=document.createElement("h1"),this.appendChild(a)),this.xtag.data.header=a,this.subheading=this.subheading}},accessors:{heading:{attribute:{},get:function(){return this.xtag.data.header.innerHTML},set:function(a){this.xtag.data.header.innerHTML=a}},subheading:{attribute:{},get:function(){return this.getAttribute("subheading")||""},set:function(a){this.xtag.data.header.setAttribute("subheading",a)
-}}}})}(),function(){function a(a){var b=new Date(a.valueOf());return b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[W]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top;return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getFullYear()}function n(a){return a.getMonth()}function o(a){return a.getDate()}function p(a){return a.getDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=X.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return null}catch(c){var d=t(a);return d?[d]:null}}for(var g=0;gk.valueOf())return null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b){return b||(b=(new Date).getFullYear()),new Date(b,a+1,0).getDate()}function x(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function y(a){var b=a.getDate(),c=w(a.getMonth()+1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()+1,b)}function z(a){var b=a.getDate(),c=w(a.getMonth()-1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()-1,b)}function A(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=F(a)}throw"unable to find week start"}function B(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=E(a)}throw"unable to find week end"}function C(b){return b=new Date(b.valueOf()),b.setDate(1),a(b)}function D(a){return F(x(a,0,1,0))}function E(a){return x(a,0,0,1)}function F(a){return x(a,0,0,-1)}function G(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?H(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function H(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function I(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function J(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function K(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=R(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function L(a){a=a.slice(0),I(a);for(var b=[],c=0;c0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=G(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(G(d,[j])||G(F(d),[j])){var k=g.valueOf()f.valueOf()?h:f,m=G(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function M(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,V)?(a.xtag.dragType=U,c="datetoggleoff"):(a.xtag.dragType=T,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function N(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==T||l(b,V)?a.xtag.dragType===U&&l(b,V)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function O(){for(var a=xtag.query(document,"x-calendar"),b=0;bq;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var x=g("span.day");if(x.setAttribute("data-date",r(v)),x.textContent=o(v),n(v)!==h&&j(x,"badmonth"),G(v,d)&&j(x,V),G(v,S)&&j(x,"today"),b(u,x),v=E(v),0===(q+1)%7){b(k,u),u=g("div.week");var y=n(v)>h||n(v)m(i);if(y)break}}return k},Y._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=S;return c},Y._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=L(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},Y.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},Y.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;cc;c++)b(this.el,this.makeMonth(i)),i=x(i,0,1,0)}this._callCustomRenderer()},Y._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return C(this.view)}},lastVisibleMonth:{get:function(){return x(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return A(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return B(D(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=z(a.view)},nextMonth:function(){var a=this.xtag.calObj;a.view=y(a.view)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}(),function(){function a(a){return a.__transitions__=a.__transitions__||{},a.__transitions__}function b(a,b,c){var e=getComputedStyle(a),f=c[b].after;a.setAttribute("transition",b),f&&!e[h].match(d)&&f()}var c,d=/[1-9]/,e=/ /g,f=/(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi,g="transition"in getComputedStyle(document.documentElement)?"t":xtag.prefix.js+"T",h=g+"ransitionDuration",i=g+"ransitionProperty",j=function(a){xtag.requestFrame(function(){xtag.requestFrame(a)})};c="complete"==document.readyState?j(function(){c=!1}):xtag.addEvent(document,"readystatechange",function(){"complete"==document.readyState&&(j(function(){c=!1}),xtag.removeEvent(document,"readystatechange",c))}),xtag.addEvents(document,{transitionend:function(b){var c=b.target,d=c.getAttribute("transition");if(d){var g=0,j=0,k=null,l=getComputedStyle(c),m=a(c),n=l[i].replace(e,"").split(",");if(l[h].replace(f,function(a,b,c){b=parseFloat(b)*("s"===c?1e3:1),b>j&&(k=g,j=b),g++}),k=n[k],!k)throw new SyntaxError("No matching transition property found");b.propertyName==k&&m[d].after&&m[d].after()}}}),xtag.transition=function(d,e,f){var g=a(d),h=g[e]=f||{};h.immediate&&h.immediate(),h.before?(h.before(),c?xtag.skipTransition(d,function(){b(d,e,g)}):j(function(){b(d,e,g)})):b(d,e,g)},xtag.pseudos.transition={onCompiled:function(a,b){var c={},d=b.arguments[0]||"immediate",e=b.arguments[1]||b.key.split(":")[0];return function(){var b=this,f=arguments;return this.hasAttribute("transition")?(c[d]=function(){return a.apply(b,f)},xtag.transition(this,e,c),void 0):a.apply(this,f)}}}}(),function(){function a(a,b){return Array.prototype.indexOf.call(a.children,b)}function b(a,b){return b&&b.nodeName?b:isNaN(b)?xtag.queryChildren(a,b):a.children[b]}function c(a,b,c){return b&&(c?b==a.xtag.selected:b!=a.xtag.selected)&&a==b.parentNode&&"X-CARD"==b.nodeName}function d(a,b,c){var d=e[b],f=a.xtag.selected&&a.xtag.selected[d[0]];f?a.showCard(f,c):(a.loop||-1==a.selectedIndex)&&a.showCard(a[d[1]],c)}var e={next:["nextElementSibling","firstElementChild"],previous:["previousElementSibling","lastElementChild"]};xtag.register("x-deck",{events:{"reveal:delegate(x-card)":function(a){this.parentNode==a.currentTarget&&a.currentTarget.showCard(this)}},accessors:{loop:{attribute:{"boolean":!0}},cards:{get:function(){return xtag.queryChildren(this,"x-card")}},selectedCard:{get:function(){return this.xtag.selected||null},set:function(a){this.showCard(a)}},selectedIndex:{attribute:{name:"selected-index",unlink:!0},get:function(){return this.hasAttribute("selected-index")?Number(this.getAttribute("selected-index")):-1},set:function(a){var b=Number(a),c=this.cards[b];c?(this.setAttribute("selected-index",b),c!=this.xtag.selected&&this.showCard(c)):(this.removeAttribute("selected-index"),this.xtag.selected&&this.hideCard(this.xtag.selected))}},transitionType:{attribute:{name:"transition-type"}}},methods:{nextCard:function(a){d(this,"next",a)},previousCard:function(a){d(this,"previous",a)},showCard:function(d,e){var f=b(this,d);if(c(this,f,!1)){var g=this.xtag.selected,h=a(this,f);e=e||(h>a(this,g)?"forward":"reverse"),g&&this.hideCard(g,e),this.xtag.selected=f,this.selectedIndex=h,f.hasAttribute("selected")||(f.selected=!0),xtag.transition(f,"show",{before:function(){f.setAttribute("show",""),f.setAttribute("transition-direction",e)},after:function(){xtag.fireEvent(f,"show")}})}},hideCard:function(a,d){var e=b(this,a);c(this,e,!0)&&(this.xtag.selected=null,e.hasAttribute("selected")&&(e.selected=!1),xtag.transition(e,"hide",{before:function(){e.removeAttribute("show"),e.setAttribute("hide",""),e.setAttribute("transition-direction",d||"reverse")},after:function(){e.removeAttribute("hide"),e.removeAttribute("transition"),e.removeAttribute("transition-direction"),xtag.fireEvent(e,"hide")}}))}}}),xtag.register("x-card",{lifecycle:{inserted:function(){var a=this.parentNode;"X-DECK"==a.nodeName&&(this.xtag.deck=a,this!=a.selected&&this.selected&&a.showCard(this))},removed:function(){var a=this.xtag.deck;a&&(this==a.xtag.selected?(a.xtag.selected=null,a.removeAttribute("selected-index")):a.showCard(a.selectedCard),this.xtag.deck=null)}},accessors:{transitionType:{attribute:{name:"transition-type"}},selected:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.deck;b&&(a&&this!=b.selected?b.showCard(this):a||this!=b.selected||b.hideCard(this))}}}})}(),function(){function a(a){var b=a.currentTarget;this.parentNode==b&&(this.parentNode.firstElementChild==this?b.flipped=!1:this.parentNode.lastElementChild==this&&(b.flipped=!0))}xtag.register("x-flipbox",{lifecycle:{created:function(){this.firstElementChild&&xtag.skipTransition(this.firstElementChild,function(){}),this.lastElementChild&&xtag.skipTransition(this.lastElementChild,function(){}),this.hasAttribute("direction")||(this.xtag._direction="right")}},events:{"transitionend:delegate(x-flipbox > *:first-child)":function(a){var b=a.currentTarget;this.parentNode==b&&xtag.fireEvent(b,"flipend")},"reveal:delegate(x-flipbox > *)":a},accessors:{direction:{attribute:{},get:function(){return this.xtag._direction},set:function(a){var b=this;xtag.skipTransition(this.firstElementChild,function(){return b.setAttribute("_anim-direction",a),function(){}}),xtag.skipTransition(this.lastElementChild,function(){b.setAttribute("_anim-direction",a)}),this.xtag._direction=a}},flipped:{attribute:{"boolean":!0}}},methods:{toggle:function(){this.flipped=!this.flipped},showFront:function(){this.flipped=!1},showBack:function(){this.flipped=!0}}})}(),function(){function a(a,b){var c=b.__layoutScroll__=b.__layoutScroll__||Object.defineProperty(b,"__layoutScroll__",{value:{last:b.scrollTop}}).__layoutScroll__,d=b.scrollTop,e=a.scrollBuffer;return c.max=c.max||Math.max(d+e,e),c.min=c.min||Math.max(d-e,e),c}function b(a){a.setAttribute("content-maximizing",null)}function c(a){a.removeAttribute("content-maximized"),a.removeAttribute("content-maximizing")}function d(d){var e=d.currentTarget;if("scroll"==e.hideTrigger&&!d.currentTarget.hasAttribute("content-maximizing")){var f=d.target;if(e.scrollTarget?xtag.matchSelector(f,e.scrollTarget):f.parentNode==e){var g=f.scrollTop,h=e.scrollBuffer,i=a(e,f);g>i.last?i.min=Math.max(g-h,h):gi.max&&!e.hasAttribute("content-maximized")?b(e):g=+c)throw"invalid step "+c;return e((b-d)/c)*c+d}function d(a,b,d,e){return b>a?b:a>d?Math.max(b,c(d,e,b,Math.floor)):a}function e(a,b,e){var f=c((b-a)/2+a,e,a);return d(f,a,b,e)}function f(a,b){var c=a.min,d=a.max;return(b-c)/(d-c)}function g(a,b){var c=a.min,d=a.max;return(d-c)*b+c}function h(a,b){b=Math.min(Math.max(0,b),1);var e=g(a,b),f=c(e,a.step,a.min);return d(f,a.min,a.max,a.step)}function i(a,b){var c=a.xtag.sliderThumb;if(c){var d=a.getBoundingClientRect(),e=c.getBoundingClientRect(),g=f(a,b),h=a.vertical,i=d[h?"height":"width"],j=e[h?"height":"width"],k=Math.max(i-j,0),l=k*g,m=l/i;c.style[h?"left":"top"]=0,c.style[h?"top":"left"]=100*m+"%",a.xtag.sliderProgress.style[h?"height":"width"]=100*g+"%"}}function j(a){i(a,a.value)}function k(a,b,c){var d=a.xtag.rangeInputEl,e=d.getBoundingClientRect(),f=a.xtag.sliderThumb.getBoundingClientRect().width,g=b-e.left-f/2,i=e.width-f/2;a.vertical&&(i=e.height,g=c-e.top),a.value=h(a,g/i),xtag.fireEvent(a,"input"),j(a)}function l(a,b,c){a.xtag.dragInitVal=a.value,k(a,b,c);var d=a.xtag.callbackFns,e=function(a,b){document.body.addEventListener(a,b)};e("mousemove",d.onMouseDragMove),e("touchmove",d.onTouchDragMove),e("mouseup",d.onDragEnd),e("touchend",d.onDragEnd);var f=a.xtag.sliderThumb;f&&f.setAttribute("active",!0)}function m(a,b,c){k(a,b,c)}function n(a){return{onMouseDragStart:function(b){b.button===p&&(l(a,b.pageX,b.pageY),b.preventDefault())},onTouchDragStart:function(b){var c=b.targetTouches;1===c.length&&(l(a,c[0].pageX,c[0].pageY),b.preventDefault())},onMouseDragMove:function(b){m(a,b.pageX,b.pageY),b.preventDefault()},onTouchDragMove:function(b){var c=b.targetTouches;1===c.length&&(m(a,c[0].pageX,c[0].pageY),b.preventDefault())},onDragEnd:function(b){var c=a.xtag.callbackFns,d=function(a,b){document.body.removeEventListener(a,b)};d("mousemove",c.onMouseDragMove),d("touchmove",c.onTouchDragMove),d("mouseup",c.onDragEnd),d("touchend",c.onDragEnd);var e=a.xtag.sliderThumb;e&&e.removeAttribute("active"),a.value!==a.xtag.dragInitVal&&xtag.fireEvent(a,"change"),a.xtag.dragInitVal=null,b.preventDefault()},onKeyDown:function(a){var b=a.keyCode;if(b in o){var c=this.value,d=this.min,e=this.max,f=this.step,g=Math.max(0,e-d),h=Math.max(g/10,f);switch(o[b]){case"LEFT_ARROW":case"DOWN_ARROW":this.value=Math.max(c-f,d);break;case"RIGHT_ARROW":case"UP_ARROW":this.value=Math.min(c+f,e);break;case"HOME":this.value=d;break;case"END":this.value=e;break;case"PAGE_DOWN":this.value=Math.max(c-h,d);break;case"PAGE_UP":this.value=Math.min(c+h,e)}this.value!==c&&xtag.fireEvent(this,"change"),a.preventDefault()}}}}var o={33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT_ARROW",38:"UP_ARROW",39:"RIGHT_ARROW",40:"DOWN_ARROW"},p=0;xtag.register("x-slider",{lifecycle:{created:function(){var a=this;a.xtag.callbackFns=n(a),a.xtag.dragInitVal=null;var c=document.createElement("input");xtag.addClass(c,"input"),c.setAttribute("type","range");var d=b(a,"max")?+a.getAttribute("max"):100,f=b(a,"min")?+a.getAttribute("min"):0,g=b(a,"step")?+a.getAttribute("step"):1;g=g>0?g:1;var h=b(a,"value")?+a.getAttribute("value"):e(f,d,g);c.setAttribute("max",d),c.setAttribute("min",f),c.setAttribute("step",g),c.setAttribute("value",h),a.xtag.rangeInputEl=c,a.appendChild(a.xtag.rangeInputEl);var i=document.createElement("div");xtag.addClass(i,"slider-track"),this.xtag.sliderTrack=i,this.appendChild(i);var j=document.createElement("div");xtag.addClass(j,"slider-progress"),this.xtag.sliderProgress=j,i.appendChild(j);var k=document.createElement("span");xtag.addClass(k,"slider-thumb"),this.xtag.sliderThumb=k,this.appendChild(k),"range"!==c.type||a.hasAttribute("polyfill")?a.setAttribute("polyfill",!0):a.removeAttribute("polyfill"),this.addEventListener("mousedown",a.xtag.callbackFns.onMouseDragStart),this.addEventListener("touchstart",a.xtag.callbackFns.onTouchDragStart),this.addEventListener("keydown",a.xtag.callbackFns.onKeyDown),a.setAttribute("value",h)},inserted:function(){var a=this;xtag.requestFrame(function(){xtag.requestFrame(function(){j(a)})})},attributeChanged:function(a){("min"==a||"max"==a||"step"==a)&&j(this)}},events:{"change:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"input:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"input")},"focus:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"focus",{},{bubbles:!1})},"blur:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"blur",{},{bubbles:!1})}},accessors:{polyfill:{attribute:{"boolean":!0},set:function(a){this.xtag.callbackFns,a?(this.setAttribute("tabindex",0),this.xtag.rangeInputEl.setAttribute("tabindex",-1),this.xtag.rangeInputEl.setAttribute("readonly",!0),j(this)):(this.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("readonly"))}},vertical:{attribute:{"boolean":!0},set:function(){j(this)}},max:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("max")}},min:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("min")}},step:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("step")}},name:{attribute:{selector:"input[type=range]"},set:function(a){var b=this.xtag.rangeInputEl;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},value:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.value},set:function(b){a(b)||(b=e(this.min,this.max,this.step)),b=+b;var f=this.min,g=this.max,h=this.step,i=c(b,h,f),k=d(i,f,g,h);this.xtag.rangeInputEl.value=k,j(this)}},inputElem:{get:function(){return this.xtag.rangeInputEl}}},methods:{}})}(),function(){function a(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function b(b){var c=b.getBoundingClientRect(),d=a(),e=d.left,f=d.top;return{left:c.left+e,right:c.right+e,top:c.top+f,bottom:c.bottom+f,width:c.width,height:c.height}}function c(a,b,c){return c.left<=a&&a<=c.right&&c.top<=b&&b<=c.bottom}function d(a){if("x-tabbar"===a.parentNode.nodeName.toLowerCase()){var b=a.targetEvent,c=a.targetSelector?xtag.query(document,a.targetSelector):a.targetElems;c.forEach(function(a){xtag.fireEvent(a,b)})}}xtag.register("x-tabbar",{lifecycle:{created:function(){this.xtag.overallEventToFire="reveal"}},events:{"tap:delegate(x-tabbar-tab)":function(){var a=xtag.query(this.parentNode,"x-tabbar-tab[selected]");a.length&&a.forEach(function(a){a.removeAttribute("selected")}),this.setAttribute("selected",!0)}},accessors:{tabs:{get:function(){return xtag.queryChildren(this,"x-tabbar-tab")}},targetEvent:{attribute:{name:"target-event"},get:function(){return this.xtag.overallEventToFire},set:function(a){this.xtag.overallEventToFire=a}}},methods:{}}),xtag.register("x-tabbar-tab",{lifecycle:{created:function(){this.xtag.targetSelector=null,this.xtag.overrideTargetElems=null,this.xtag.targetEvent=null}},events:{tap:function(a){var e=a.currentTarget;if(a.changedTouches&&a.changedTouches.length>0){var f=a.changedTouches[0],g=b(e);c(f.pageX,f.pageY,g)&&d(e)}else d(e)}},accessors:{targetSelector:{attribute:{name:"target-selector"},get:function(){return this.xtag.targetSelector},set:function(a){this.xtag.targetSelector=a,a&&(this.xtag.overrideTargetElems=null)}},targetElems:{get:function(){return this.targetSelector?xtag.query(document,this.targetSelector):null!==this.xtag.overrideTargetElems?this.xtag.overrideTargetElems:[]},set:function(a){this.removeAttribute("target-selector"),this.xtag.overrideTargetElems=a}},targetEvent:{attribute:{name:"target-event"},get:function(){if(this.xtag.targetEvent)return this.xtag.targetEvent;if("x-tabbar"===this.parentNode.nodeName.toLowerCase())return this.parentNode.targetEvent;throw"tabbar-tab is missing event to fire"},set:function(a){this.xtag.targetEvent=a}}},methods:{}})}(),function(){function a(a){var b=a.xtag.input.form;b?a.removeAttribute("x-toggle-no-form"):a.setAttribute("x-toggle-no-form",""),a.xtag.scope=a.parentNode?b||document:null}function b(a){var b={},c=a==document?"[x-toggle-no-form]":"";xtag.query(a,"x-toggle[name]"+c).forEach(function(d){var e=d.name;if(e&&!b[e]){var f=xtag.query(a,'x-toggle[name="'+e+'"]'+c),g=f.length>1?"radio":"checkbox";f.forEach(function(a){a.xtag&&a.xtag.input&&(a.type=g)}),b[e]=!0}})}function c(a){if(f&&a.group&&"radio"!=a.type){var b=a.groupToggles,c='x-toggle[group="'+a.group+'"][active]',d=a.xtag.scope.querySelector(c);if(d&&a!=d){a.checked=d.checked;var e=d.checked,g=b.indexOf(a),h=b.indexOf(d),i=Math.min(g,h),j=Math.max(g,h);return b.slice(i,j+1).forEach(function(a){a!=d&&(a.checked=e)}),!0}}}function d(a){e(a)||(a.groupToggles.forEach(function(a){a.active=!1}),a.active=!0)}function e(a){return a.parentNode&&"X-TOGGLEBAR"==a.parentNode.nodeName}var f=!1;xtag.addEvents(document,{DOMComponentsLoaded:function(){b(document),xtag.toArray(document.forms).forEach(b)},WebComponentsReady:function(){b(document),xtag.toArray(document.forms).forEach(b)},keydown:function(a){f=a.shiftKey},keyup:function(a){f=a.shiftKey},"focus:delegate(x-toggle)":function(){this.focus=!0,this.xtag.input.focus()},"blur:delegate(x-toggle)":function(){this.focus=!1},"tap:delegate(x-toggle)":function(){var a=this.xtag.input;if("radio"==a.type?!this.checked:!0){a.checked=!a.checked;var b=document.createEvent("Event");b.initEvent("change",!0,!1),a.dispatchEvent(b)}a.focus()},"change:delegate(x-toggle)":function(){this.xtag.input.focus(),(e(this)||!c(this)&&"radio"!=this.type)&&(this.checked=this.xtag.input.checked),d(this)}});var g=xtag.createFragment('
');xtag.register("x-toggle",{lifecycle:{created:function(){this.appendChild(g.cloneNode(!0)),this.xtag.input=this.querySelector("input"),this.xtag.checkEl=this.querySelector(".x-toggle-check"),this.type="checkbox",a(this);var b=this.getAttribute("name");b&&(this.xtag.input.name=this.getAttribute("name")),this.hasAttribute("checked")&&(this.checked=!0)},inserted:function(){a(this),this.name&&b(this.xtag.scope)},removed:function(){b(this.xtag.scope),a(this)
-}},accessors:{noBox:{attribute:{name:"no-box","boolean":!0}},type:{attribute:{},set:function(a){this.xtag.input.type=a}},label:{attribute:{}},focus:{attribute:{"boolean":!0}},active:{attribute:{"boolean":!0}},group:{attribute:{}},groupToggles:{get:function(){return xtag.query(this.xtag.scope,'x-toggle[group="'+this.group+'"]')}},name:{attribute:{skip:!0},set:function(a){null===a?(this.removeAttribute("name"),this.type="checkbox"):this.setAttribute("name",a),this.xtag.input.name=a,b(this.xtag.scope)}},checked:{get:function(){return this.xtag.input.checked},set:function(a){var b=this.name,c="true"===a||a===!0;if(b){var d=this.xtag.scope==document?"[x-toggle-no-form]":"",e='x-toggle[checked][name="'+b+'"]'+d,f=this.xtag.scope.querySelector(e);f&&f.removeAttribute("checked")}this.xtag.input.checked=c,c?this.setAttribute("checked",""):this.removeAttribute("checked")}},value:{attribute:{},get:function(){return this.xtag.input.value},set:function(a){this.xtag.input.value=a}}}}),xtag.register("x-togglebar",{events:{}})}();
\ No newline at end of file
+window.Platform={};var logFlags={};!function(){function a(a){if(this._element=a,a.className!=this._classCache){if(this._classCache=a.className,!this._classCache)return;var b,c=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(b=0;b>>0)+(b++ +"__")};c.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}},window.WeakMap=c}(),function(a){function b(a){u.push(a),t||(t=!0,q(d))}function c(a){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(a)||a}function d(){t=!1;var a=u;u=[],a.sort(function(a,b){return a.uid_-b.uid_});var b=!1;a.forEach(function(a){var c=a.takeRecords();e(a),c.length&&(a.callback_(c,a),b=!0)}),b&&d()}function e(a){a.nodes_.forEach(function(b){var c=p.get(b);c&&c.forEach(function(b){b.observer===a&&b.removeTransientObservers()})})}function f(a,b){for(var c=a;c;c=c.parentNode){var d=p.get(c);if(d)for(var e=0;e0){var e=c[d-1],f=n(e,a);if(f)return void(c[d-1]=f)}else b(this.observer);c[d]=a},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(a){var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0),b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attributes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.removeEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target){this.addListeners_(a),this.transientObservedNodes.push(a);var b=p.get(a);b||p.set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transientObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.removeListeners_(a);for(var b=p.get(a),c=0;cc&&(a=b[c]);c++)a();B=[]}function l(a){z?j(function(){m(a)}):m(a)}function m(a){(a.attachedCallback||a.detachedCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("inserted:",a.localName),q(a)&&(a.__inserted=(a.__inserted||0)+1,a.__inserted<1&&(a.__inserted=1),a.__inserted>1?y.dom&&console.warn("inserted:",a.localName,"insert/remove count:",a.__inserted):a.attachedCallback&&(y.dom&&console.log("inserted:",a.localName),a.attachedCallback())),y.dom&&console.groupEnd())}function n(a){o(a),d(a,function(a){o(a)})}function o(a){z?j(function(){p(a)}):p(a)}function p(a){(a.attachedCallback||a.detachedCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("removed:",a.localName),q(a)||(a.__inserted=(a.__inserted||0)-1,a.__inserted>0&&(a.__inserted=0),a.__inserted<0?y.dom&&console.warn("removed:",a.localName,"insert/remove count:",a.__inserted):a.detachedCallback&&a.detachedCallback()),y.dom&&console.groupEnd())}function q(a){for(var b=a,c=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;b;){if(b==c)return!0;b=b.parentNode||b.host}}function r(a){if(a.shadowRoot&&!a.shadowRoot.__watched){y.dom&&console.log("watching shadow-root for: ",a.localName);for(var b=a.shadowRoot;b;)s(b),b=b.olderShadowRoot}}function s(a){a.__watched||(v(a),a.__watched=!0)}function t(a){if(y.dom){var b=a[0];if(b&&"childList"===b.type&&b.addedNodes&&b.addedNodes){for(var c=b.addedNodes[0];c&&c!==document&&!c.host;)c=c.parentNode;var d=c&&(c.URL||c._URL||c.host&&c.host.localName)||"";d=d.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",a.length,d||"")}a.forEach(function(a){"childList"===a.type&&(D(a.addedNodes,function(a){a.localName&&g(a)}),D(a.removedNodes,function(a){a.localName&&n(a)}))}),y.dom&&console.groupEnd()}function u(){t(C.takeRecords()),k()}function v(a){C.observe(a,{childList:!0,subtree:!0})}function w(a){v(a)}function x(a){y.dom&&console.group("upgradeDocument: ",(a.URL||a._URL||"").split("/").pop()),g(a),y.dom&&console.groupEnd()}var y=window.logFlags||{},z=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;a.hasPolyfillMutations=z;var A=!1,B=[],C=new MutationObserver(t),D=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.watchShadow=r,a.upgradeAll=g,a.upgradeSubtree=f,a.observeDocument=w,a.upgradeDocument=x,a.takeRecords=u}(window.CustomElements),function(){function a(a){return"link"===a.localName&&a.getAttribute("rel")===b}var b=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",c={selectors:["link[rel="+b+"]"],map:{link:"parseLink"},parse:function(a){if(!a.__parsed){a.__parsed=!0;var b=a.querySelectorAll(c.selectors);d(b,function(a){c[c.map[a.localName]](a)}),CustomElements.upgradeDocument(a),CustomElements.observeDocument(a)}},parseLink:function(b){a(b)&&this.parseImport(b)},parseImport:function(a){a.content&&c.parse(a.content)}},d=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=c}(),function(a){function b(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var a=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;a(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b=document.createEvent("HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"===document.readyState||a.flags.eager)b();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var c=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(c,b)}else b()}(window.CustomElements),function(){function a(a){var b=L.call(a);return K[b]||(K[b]=b.match(M)[1].toLowerCase())}function b(c,d){var e=b[d||a(c)];return e?e(c):c}function c(b){return-1==N.indexOf(a(b))?Array.prototype.slice.call(b,0):[b]}function d(a,b){return(b||O).length?c(a.querySelectorAll(b)):[]}function e(a,b){var c={added:[],removed:[]};b.forEach(function(b){b._mutation=!0;for(var d in c)for(var e=a._records["added"==d?"inserted":"removed"],f=b[d+"Nodes"],g=f.length,h=0;g>h&&-1==c[d].indexOf(f[h]);h++)c[d].push(f[h]),e.forEach(function(a){a(f[h],b)})})}function f(c,d,e){var f=a(e);return"object"==f&&"object"==a(c[d])?T.merge(c[d],e):c[d]=b(e,f),c}function g(a,b,c,d,e){var f=e[b];b in e?"function"==typeof e[b]&&(f.__mixins__||(f.__mixins__=[]),f.__mixins__.push(T.applyPseudos(c,d,a.pseudos))):e[b]=d}function h(a,b,c,d){if(d){var e={};for(var f in c)e[f.split(":")[0]]=f;for(f in b)g(a,e[f.split(":")[0]]||f,f,b[f],c)}else for(var h in b)c[h+":__mixin__("+P++ +")"]=T.applyPseudos(h,b[h],a.pseudos)}function i(a){return a.mixins.forEach(function(b){var c=T.mixins[b];for(var d in c){var e=c[d],f=a[d];if(f)switch(d){case"accessors":case"prototype":for(var g in e)f[g]?h(a,e[g],f[g],!0):f[g]=e[g];break;default:h(a,e,f,"events"!=d)}else a[d]=e}}),a}function j(a,b){var c,d=b.target;if(!d.tagName)return null;if(T.matchSelector(d,a.value))c=d;else if(T.matchSelector(d,a.value+" *"))for(var e=d.parentNode;!c;)T.matchSelector(e,a.value)&&(c=e),e=e.parentNode;return c?a.listener=a.listener.bind(c):null}function k(a){if(a.type.match("touch"))a.target.__touched__=!0;else if(a.target.__touched__&&a.type.match("mouse"))return void delete a.target.__touched__;return!0}function l(a){var b="over"==a;return{attach:"OverflowEvent"in y?"overflowchanged":[],condition:function(c){return c.flow=a,c.type==a+"flow"||0===c.orient&&c.horizontalOverflow==b||1==c.orient&&c.verticalOverflow==b||2==c.orient&&c.horizontalOverflow==b&&c.verticalOverflow==b}}}function m(a,b,c,d){d?b[a]=c[a]:Object.defineProperty(b,a,{writable:!0,enumerable:!0,value:c[a]})}function n(a,b){var c=Object.getOwnPropertyDescriptor(a,"target");for(var d in b)Q[d]||m(d,a,b,c);a.baseEvent=b}function o(a,b){return{value:a.boolean?"":b,method:a.boolean&&!b?"removeAttribute":"setAttribute"}}function p(a,b,c,d){var e=o(b,d);a[e.method](c,e.value)}function q(a,b,c,d,e){for(var f=b.property?[a.xtag[b.property]]:b.selector?T.query(a,b.selector):[],g=f.length;g--;)f[g][e](c,d)}function r(a,b,c){a.__view__&&a.__view__.updateBindingValue(a,b,c)}function s(a,b,c,d,e,f){var g=c.split(":"),h=g[0];if("get"==h)g[0]=b,a.prototype[b].get=T.applyPseudos(g.join(":"),d[c],a.pseudos,d[c]);else if("set"==h){g[0]=b;var i=a.prototype[b].set=T.applyPseudos(g.join(":"),e?function(a){this.xtag._skipSet=!0,this.xtag._skipAttr||p(this,e,f,a),this.xtag._skipAttr&&e.skip&&delete this.xtag._skipAttr,d[c].call(this,e.boolean?!!a:a),r(this,f,a),delete this.xtag._skipSet}:d[c]?function(a){d[c].call(this,a),r(this,f,a)}:null,a.pseudos,d[c]);e&&(e.setter=i)}else a.prototype[b][c]=d[c]}function t(a,b){a.prototype[b]={};var c=a.accessors[b],d=c.attribute,e=d&&d.name?d.name.toLowerCase():b;d&&(d.key=b,a.attributes[e]=d);for(var f in c)s(a,b,f,c,d,e);if(d){if(!a.prototype[b].get){var g=(d.boolean?"has":"get")+"Attribute";a.prototype[b].get=function(){return this[g](e)}}a.prototype[b].set||(a.prototype[b].set=function(a){p(this,d,e,a),r(this,e,a)})}}function u(a){S[a]=(S[a]||[]).filter(function(b){return(b.tags=b.tags.filter(function(b){return b!=a&&!T.tags[b]})).length||b.fn()})}function v(a,b,c){a.__tap__||(a.__tap__={click:"mousedown"==c.type},a.__tap__.click?a.addEventListener("click",b.observer):(a.__tap__.scroll=b.observer.bind(a),window.addEventListener("scroll",a.__tap__.scroll,!0),a.addEventListener("touchmove",b.observer),a.addEventListener("touchcancel",b.observer),a.addEventListener("touchend",b.observer))),a.__tap__.click||(a.__tap__.x=c.touches[0].pageX,a.__tap__.y=c.touches[0].pageY)}function w(a,b){a.__tap__&&(a.__tap__.click?a.removeEventListener("click",b.observer):(window.removeEventListener("scroll",a.__tap__.scroll,!0),a.removeEventListener("touchmove",b.observer),a.removeEventListener("touchcancel",b.observer),a.removeEventListener("touchend",b.observer)),delete a.__tap__)}function x(a,b,c){var d=c.changedTouches[0],e=b.gesture.tolerance;return d.pageXa.__tap__.x-e&&d.pageYa.__tap__.y-e?!0:void 0}var y=window,z=document,A=z.createElement("div"),B=function(){},C=function(){return!0},D=/([\w-]+(?:\([^\)]+\))?)/g,E=/(\w*)(?:\(([^\)]*)\))?/,F=/(\d+)/g,G={action:function(a,b){return a.value.match(F).indexOf(String(b.keyCode))>-1==("keypass"==a.name)||null}},H=function(){var a=y.getComputedStyle(z.documentElement,""),b=(Array.prototype.slice.call(a).join("").match(/-(moz|webkit|ms)-/)||""===a.OLink&&["","o"])[1];return{dom:"ms"==b?"MS":b,lowercase:b,css:"-"+b+"-",js:"ms"==b?b:b[0].toUpperCase()+b.substr(1)}}(),I=Element.prototype.matchesSelector||Element.prototype[H.lowercase+"MatchesSelector"],J=y.MutationObserver||y[H.js+"MutationObserver"],K={},L=K.toString,M=/\s([a-zA-Z]+)/;b.object=function(a){var c={};for(var d in a)c[d]=b(a[d]);return c},b.array=function(a){for(var c=a.length,d=new Array(c);c--;)d[c]=b(a[c]);return d};var N=["undefined","null","number","boolean","string","function"],O="",P=0,Q={};for(var R in z.createEvent("CustomEvent"))Q[R]=1;var S={},T={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(a,b){var d;if("string"==typeof a){d=a.toLowerCase();var e=b.prototype;delete b.prototype;var f=T.tags[d]=i(T.merge({},T.defaultOptions,b));for(var g in f.events)f.events[g]=T.parseEvent(g,f.events[g]);for(g in f.lifecycle)f.lifecycle[g.split(":")[0]]=T.applyPseudos(g,f.lifecycle[g],f.pseudos,f.lifecycle[g]);for(g in f.methods)f.prototype[g.split(":")[0]]={value:T.applyPseudos(g,f.methods[g],f.pseudos,f.methods[g]),enumerable:!0};for(g in f.accessors)t(f,g);var h=f.lifecycle.created||f.lifecycle.ready;f.prototype.createdCallback={enumerable:!0,value:function(){var a=this;T.addEvents(this,f.events),f.mixins.forEach(function(b){T.mixins[b].events&&T.addEvents(a,T.mixins[b].events)});var b=h?h.apply(this,arguments):null;for(var c in f.attributes){var d=f.attributes[c],e=this.hasAttribute(c);(e||d.boolean)&&(this[d.key]=d.boolean?e:this.getAttribute(c))}return f.pseudos.forEach(function(b){b.onAdd.call(a,b)}),b}};var j=f.lifecycle.inserted,k=f.lifecycle.removed;(j||k)&&(f.prototype.attachedCallback={value:function(){return k&&(this.xtag.__parentNode__=this.parentNode),j?j.apply(this,arguments):void 0},enumerable:!0}),k&&(f.prototype.detachedCallback={value:function(){var a=c(arguments);a.unshift(this.xtag.__parentNode__);var b=k.apply(this,a);return delete this.xtag.__parentNode__,b},enumerable:!0}),f.lifecycle.attributeChanged&&(f.prototype.attributeChangedCallback={value:f.lifecycle.attributeChanged,enumerable:!0});var l=f.prototype.setAttribute||HTMLElement.prototype.setAttribute;f.prototype.setAttribute={writable:!0,enumberable:!0,value:function(a,b){var c=f.attributes[a.toLowerCase()];this.xtag._skipAttr||l.call(this,a,c&&c.boolean?"":b),c&&(c.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,c.setter.call(this,c.boolean?!0:b)),b=c.skip?c.boolean?this.hasAttribute(a):this.getAttribute(a):b,q(this,c,a,c.boolean?"":b,"setAttribute")),delete this.xtag._skipAttr}};var m=f.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;f.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(a){var b=f.attributes[a.toLowerCase()];this.xtag._skipAttr||m.call(this,a),b&&(b.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,b.setter.call(this,b.boolean?!1:void 0)),q(this,b,a,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var n=e?e:b["extends"]?Object.create(z.createElement(b["extends"]).constructor).prototype:y.HTMLElement.prototype,o={prototype:Object.create(n,f.prototype)};b["extends"]&&(o["extends"]=b["extends"]);var p=z.registerElement(d,o);return u(d),p}},ready:function(a,b){var d={tags:c(a),fn:b};d.tags.reduce(function(a,b){return T.tags[b]?a:void(S[b]=S[b]||[]).push(d)},!0)&&b()},mixins:{},prefix:H,captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged","DOMMouseScroll"],customEvents:{overflow:l("over"),underflow:l("under"),animationstart:{attach:[H.dom+"AnimationStart"]},animationend:{attach:[H.dom+"AnimationEnd"]},transitionend:{attach:[H.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:k},enter:{attach:["mouseover","touchenter"],condition:k},leave:{attach:["mouseout","touchleave"],condition:k},scrollwheel:{attach:["DOMMouseScroll","mousewheel"],condition:function(a){return a.delta=a.wheelDelta?a.wheelDelta/40:Math.round(a.detail/3.5*-1),!0}},tapstart:{observe:{mousedown:z,touchstart:z},condition:k},tapend:{observe:{mouseup:z,touchend:z},condition:k},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(a,b){switch(a.type){case"move":return!0;case"dragover":var c=b.lastDrag||{};return b.lastDrag=a,c.pageX!=a.pageX&&c.pageY!=a.pageY||null;case"tapstart":b.move||(b.current=this,b.move=T.addEvents(this,{move:b.listener,dragover:b.listener}),b.tapend=T.addEvent(z,"tapend",b.listener));break;case"tapend":case"dragend":case"touchcancel":a.touches.length||(b.move&&T.removeEvents(b.current,b.move||{}),b.tapend&&T.removeEvent(z,b.tapend||{}),delete b.lastDrag,delete b.current,delete b.tapend,delete b.move)}}}},pseudos:{__mixin__:{},mixins:{onCompiled:function(a,b){var c=b.source.__mixins__;if(c)switch(b.value){case"before":return function(){var b=this,d=arguments;return c.forEach(function(a){a.apply(b,d)}),a.apply(b,d)};case"after":case null:return function(){var b=this,d=arguments;return returns=a.apply(b,d),c.forEach(function(a){a.apply(b,d)}),returns}}}},keypass:G,keyfail:G,delegate:{action:j},within:{action:j,onAdd:function(a){var b=a.source.condition;b&&(a.source.condition=function(c,d){return T.query(this,a.value).filter(function(a){return a==c.target||a.contains?a.contains(c.target):null})[0]?b.call(this,c,d):null})}},preventable:{action:function(a,b){return!b.defaultPrevented}}},clone:b,typeOf:a,toArray:c,wrap:function(a,b){return function(){var c=arguments,d=a.apply(this,c);return b.apply(this,c),d}},merge:function(b,c,d){if("string"==a(c))return f(b,c,d);for(var e=1,g=arguments.length;g>e;e++){var h=arguments[e];for(var i in h)f(b,i,h[i])}return b},uid:function(){return Math.random().toString(36).substr(2,10)},query:d,skipTransition:function(a,b,c){var d=H.js+"TransitionProperty";a.style[d]=a.style.transitionProperty="none";var e=b?b.call(c):null;return T.requestFrame(function(){T.requestFrame(function(){a.style[d]=a.style.transitionProperty="",e&&T.requestFrame(e)})})},requestFrame:function(){var a=y.requestAnimationFrame||y[H.lowercase+"RequestAnimationFrame"]||function(a){return y.setTimeout(a,20)};return function(b){return a(b)}}(),cancelFrame:function(){var a=y.cancelAnimationFrame||y[H.lowercase+"CancelAnimationFrame"]||y.clearTimeout;return function(b){return a(b)}}(),matchSelector:function(a,b){return I.call(a,b)},set:function(a,b,c){a[b]=c,window.CustomElements&&CustomElements.upgradeAll(a)},innerHTML:function(a,b){T.set(a,"innerHTML",b)},hasClass:function(a,b){return a.className.split(" ").indexOf(b.trim())>-1},addClass:function(a,b){var c=a.className.trim().split(" ");return b.trim().split(" ").forEach(function(a){~c.indexOf(a)||c.push(a)}),a.className=c.join(" ").trim(),a},removeClass:function(a,b){var c=b.trim().split(" ");return a.className=a.className.trim().split(" ").filter(function(a){return a&&!~c.indexOf(a)}).join(" "),a},toggleClass:function(a,b){return T[T.hasClass(a,b)?"removeClass":"addClass"].call(null,a,b)},queryChildren:function(a,b){var d=a.id,e=a.id=d||"x_"+T.uid(),f="#"+e+" > ",g=!1;a.parentNode||(g=!0,A.appendChild(a)),b=f+(b+"").replace(",",","+f,"g");var h=a.parentNode.querySelectorAll(b);return d||a.removeAttribute("id"),g&&A.removeChild(a),c(h)},createFragment:function(a){var b=z.createDocumentFragment();if(a){for(var d=b.appendChild(z.createElement("div")),e=c(a.nodeName?arguments:!(d.innerHTML=a)||d.children),f=e.length,g=0;f>g;)b.insertBefore(e[g++],d);b.removeChild(d)}return b},manipulate:function(a,b){var c=a.nextSibling,d=a.parentNode,e=z.createDocumentFragment(),f=b.call(e.appendChild(a),e)||a;c?d.insertBefore(f,c):d.appendChild(f)},applyPseudos:function(a,b,d,e){var f=b,g={};if(a.match(":"))for(var h=a.match(D),i=h.length;--i;)h[i].replace(E,function(b,j,k){if(!T.pseudos[j])throw"pseudo not found: "+j+" "+h;k=""===k||"undefined"==typeof k?null:k;var l=g[i]=Object.create(T.pseudos[j]);l.key=a,l.name=j,l.value=k,l.arguments=(k||"").split(","),l.action=l.action||C,l.source=e;var m=f;f=function(){var b=c(arguments),d={key:a,name:j,value:k,source:e,arguments:l.arguments,listener:m},f=l.action.apply(this,[d].concat(b));return null===f||f===!1?f:d.listener.apply(this,b)},d&&l.onAdd&&(d.nodeName?l.onAdd.call(d,l):d.push(l))});for(var j in g)g[j].onCompiled&&(f=g[j].onCompiled(f,g[j])||f);return f},removePseudos:function(a,b){b.forEach(function(b){b.onRemove&&b.onRemove.call(a,b)})},parseEvent:function(a,b){var d=a.split(":"),e=d.shift(),f=T.customEvents[e],g=T.merge({type:e,stack:B,condition:C,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:B,onRemove:B},f||{});g.attach=c(g.base||g.attach),g.chain=e+(g.pseudos.length?":"+g.pseudos:"")+(d.length?":"+d.join(":"):"");var h=g.condition;g.condition=function(a){a.touches,a.targetTouches;return h.apply(this,arguments)};var i=T.applyPseudos(g.chain,b,g._pseudos,g);if(g.stack=function(a){a.currentTarget=a.currentTarget||this;var b=(a.touches,a.targetTouches,a.detail||{});return b.__stack__?b.__stack__==i?(a.stopPropagation(),a.cancelBubble=!0,i.apply(this,arguments)):void 0:i.apply(this,arguments)},g.listener=function(a){var b=c(arguments),d=g.condition.apply(this,b.concat([g]));return d?a.type==e?g.stack.apply(this,b):void T.fireEvent(a.target,e,{baseEvent:a,detail:d!==!0&&(d.__stack__=i)?d:{__stack__:i}}):d},g.attach.forEach(function(a){g._attach.push(T.parseEvent(a,g.listener))}),f&&f.observe&&!f.__observing__){f.observer=function(a){var b=g.condition.apply(this,c(arguments).concat([f]));return b?void T.fireEvent(a.target,e,{baseEvent:a,detail:b!==!0?b:{}}):b};for(var j in f.observe)T.addEvent(f.observe[j]||document,j,f.observer,!0);f.__observing__=!0}return g},addEvent:function(a,b,c,d){var e="function"==typeof c?T.parseEvent(b,c):c;return e._pseudos.forEach(function(b){b.onAdd.call(a,b)}),e._attach.forEach(function(b){T.addEvent(a,b.type,b)}),e.onAdd.call(a,e,e.listener),a.addEventListener(e.type,e.stack,d||T.captureEvents.indexOf(e.type)>-1),e},addEvents:function(a,b){var c={};for(var d in b)c[d]=T.addEvent(a,d,b[d]);return c},removeEvent:function(a,b,c){c=c||b,c.onRemove.call(a,c,c.listener),T.removePseudos(a,c._pseudos),c._attach.forEach(function(b){T.removeEvent(a,b)}),a.removeEventListener(c.type,c.stack)},removeEvents:function(a,b){for(var c in b)T.removeEvent(a,b[c])},fireEvent:function(a,b,c,d){var e=z.createEvent("CustomEvent");c=c||{},d&&console.warn("fireEvent has been modified"),e.initCustomEvent(b,c.bubbles!==!1,c.cancelable!==!1,c.detail),c.baseEvent&&n(e,c.baseEvent);try{a.dispatchEvent(e)}catch(f){console.warn("This error may have been caused by a change in the fireEvent method",f)}},addObserver:function(a,b,c){a._records||(a._records={inserted:[],removed:[]},J?(a._observer=new J(function(b){e(a,b)}),a._observer.observe(a,{subtree:!0,childList:!0,attributes:!1,characterData:!1})):["Inserted","Removed"].forEach(function(b){a.addEventListener("DOMNode"+b,function(c){c._mutation=!0,a._records[b.toLowerCase()].forEach(function(a){a(c.target,c)})},!1)})),-1==a._records[b].indexOf(c)&&a._records[b].push(c)},removeObserver:function(a,b,c){var d=a._records;d&&c?d[b].splice(d[b].indexOf(c),1):d[b]=[]}},U=!1,V=null;z.addEventListener("mousedown",function(a){U=!0,V=a.target},!0),z.addEventListener("mouseup",function(){U=!1,V=null},!0),z.addEventListener("dragend",function(){U=!1,V=null},!0);var W={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=U?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=U&&this.currentTarget&&(this.currentTarget==V||this.currentTarget.contains&&this.currentTarget.contains(V))?(this.identifier=0)||[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.__changedTouches__||(this.identifier=0)||(this.__changedTouches__=[this])}}};for(R in W)UIEvent.prototype[R]=W[R],Object.defineProperty(UIEvent.prototype,R,W[R]);T.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(a,b){var c=a.target;switch(a.type){case"touchstart":return c.__tap__&&c.__tap__.click&&w(c,b),void v(c,b,a);case"mousedown":return void(c.__tap__||v(c,b,a));case"scroll":case"touchcancel":return void w(this,b);case"touchmove":case"touchend":return this.__tap__&&!x(this,b,a)?void w(this,b):"touchend"==a.type||null;case"click":return w(this,b),!0}}},y.xtag=T,"function"==typeof define&&define.amd&&define(T),z.addEventListener("WebComponentsReady",function(){T.fireEvent(z.body,"DOMComponentsLoaded")})}(),function(){xtag.register("x-appbar",{lifecycle:{created:function(){var a=xtag.queryChildren(this,"h1,h2,h3,h4,h5,h6")[0];a||(a=document.createElement("h1"),this.appendChild(a)),this.xtag.data.header=a,this.subheading=this.subheading}},accessors:{heading:{attribute:{},get:function(){return this.xtag.data.header.innerHTML},set:function(a){this.xtag.data.header.innerHTML=a}},subheading:{attribute:{},get:function(){return this.getAttribute("subheading")||""},set:function(a){this.xtag.data.header.setAttribute("subheading",a)
+}}}})}(),function(){function a(a){var b=new Date(a.valueOf());return b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[W]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top;return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getFullYear()}function n(a){return a.getMonth()}function o(a){return a.getDate()}function p(a){return a.getDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=X.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return null}catch(c){var d=t(a);return d?[d]:null}}for(var g=0;gk.valueOf())return null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b){return b||(b=(new Date).getFullYear()),new Date(b,a+1,0).getDate()}function x(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function y(a){var b=a.getDate(),c=w(a.getMonth()+1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()+1,b)}function z(a){var b=a.getDate(),c=w(a.getMonth()-1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()-1,b)}function A(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=F(a)}throw"unable to find week start"}function B(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=E(a)}throw"unable to find week end"}function C(b){return b=new Date(b.valueOf()),b.setDate(1),a(b)}function D(a){return F(x(a,0,1,0))}function E(a){return x(a,0,0,1)}function F(a){return x(a,0,0,-1)}function G(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?H(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function H(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function I(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function J(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function K(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=R(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function L(a){a=a.slice(0),I(a);for(var b=[],c=0;c0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=G(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(G(d,[j])||G(F(d),[j])){var k=g.valueOf()f.valueOf()?h:f,m=G(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function M(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,V)?(a.xtag.dragType=U,c="datetoggleoff"):(a.xtag.dragType=T,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function N(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==T||l(b,V)?a.xtag.dragType===U&&l(b,V)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function O(){for(var a=xtag.query(document,"x-calendar"),b=0;bq;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var x=g("span.day");if(x.setAttribute("data-date",r(v)),x.textContent=o(v),n(v)!==h&&j(x,"badmonth"),G(v,d)&&j(x,V),G(v,S)&&j(x,"today"),b(u,x),v=E(v),(q+1)%7===0){b(k,u),u=g("div.week");var y=n(v)>h||n(v)m(i);if(y)break}}return k},Y._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=S;return c},Y._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=L(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},Y.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},Y.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;cc;c++)b(this.el,this.makeMonth(i)),i=x(i,0,1,0)}this._callCustomRenderer()},Y._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return C(this.view)}},lastVisibleMonth:{get:function(){return x(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return A(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return B(D(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=z(a.view)},nextMonth:function(){var a=this.xtag.calObj;a.view=y(a.view)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}(),function(){function a(a){return a.__transitions__=a.__transitions__||{}}function b(a,b,d){var e=getComputedStyle(a),f=d[b].after;a.setAttribute("transition",b),f&&!e[g].match(c)&&f()}var c=/[1-9]/,d=/ /g,e=/(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi,f="transition"in getComputedStyle(document.documentElement)?"t":xtag.prefix.js+"T",g=f+"ransitionDuration",h=f+"ransitionProperty",i=function(a){xtag.requestFrame(function(){xtag.requestFrame(a)})},j="complete"==document.readyState?i(function(){j=!1}):xtag.addEvent(document,"readystatechange",function(){"complete"==document.readyState&&(i(function(){j=!1}),xtag.removeEvent(document,"readystatechange",j))});xtag.addEvents(document,{transitionend:function(b){var c=b.target,f=c.getAttribute("transition");if(f){var i=max=0,j=null,k=getComputedStyle(c),l=a(c),m=k[h].replace(d,"").split(",");if(k[g].replace(e,function(a,b,c){var b=parseFloat(b)*("s"===c?1e3:1);b>max&&(j=i,max=b),i++}),j=m[j],!j)throw new SyntaxError("No matching transition property found");b.propertyName==j&&l[f].after&&l[f].after()}}}),xtag.transition=function(c,d,e){var f=a(c),g=f[d]=e||{};g.immediate&&g.immediate(),g.before?(g.before(),j?xtag.skipTransition(c,function(){b(c,d,f)}):i(function(){b(c,d,f)})):b(c,d,f)},xtag.pseudos.transition={onCompiled:function(a,b){var c={},d=b.arguments[0]||"immediate",e=b.arguments[1]||b.key.split(":")[0];return function(){var b=this,f=arguments;return this.hasAttribute("transition")?(c[d]=function(){return a.apply(b,f)},void xtag.transition(this,e,c)):a.apply(this,f)}}}}(),function(){function a(a,b){return Array.prototype.indexOf.call(a.children,b)}function b(a,b){return b&&b.nodeName?b:isNaN(b)?xtag.queryChildren(a,b):a.children[b]}function c(a,b,c){return b&&(c?b==a.xtag.selected:b!=a.xtag.selected)&&a==b.parentNode&&"x-card"==b.nodeName.toLowerCase()}function d(a,b,c){var d=e[b],f=a.xtag.selected&&a.xtag.selected[d[0]];f?a.showCard(f,c):(a.loop||-1==a.selectedIndex)&&a.showCard(a[d[1]],c)}var e={next:["nextElementSibling","firstElementChild"],previous:["previousElementSibling","lastElementChild"]};xtag.register("x-deck",{events:{"reveal:delegate(x-card)":function(a){this.parentNode==a.currentTarget&&a.currentTarget.showCard(this)}},accessors:{loop:{attribute:{"boolean":!0}},cards:{get:function(){return xtag.queryChildren(this,"x-card")}},selectedCard:{get:function(){return this.xtag.selected||null},set:function(a){this.showCard(a)}},selectedIndex:{attribute:{name:"selected-index",unlink:!0},get:function(){return this.hasAttribute("selected-index")?Number(this.getAttribute("selected-index")):-1},set:function(a){var b=Number(a),c=this.cards[b];c?(this.setAttribute("selected-index",b),c!=this.xtag.selected&&this.showCard(c)):(this.removeAttribute("selected-index"),this.xtag.selected&&this.hideCard(this.xtag.selected))}},transitionType:{attribute:{name:"transition-type"}}},methods:{nextCard:function(a){d(this,"next",a)},previousCard:function(a){d(this,"previous",a)},showCard:function(d,e){var f=b(this,d);if(c(this,f,!1)){var g=this.xtag.selected,h=a(this,f);e=e||(h>a(this,g)?"forward":"reverse"),g&&this.hideCard(g,e),this.xtag.selected=f,this.selectedIndex=h,f.hasAttribute("selected")||(f.selected=!0),xtag.transition(f,"show",{before:function(){f.setAttribute("show",""),f.setAttribute("transition-direction",e)},after:function(){xtag.fireEvent(f,"show")}})}},hideCard:function(a,d){var e=b(this,a);c(this,e,!0)&&(this.xtag.selected=null,e.hasAttribute("selected")&&(e.selected=!1),xtag.transition(e,"hide",{before:function(){e.removeAttribute("show"),e.setAttribute("hide",""),e.setAttribute("transition-direction",d||"reverse")},after:function(){e.removeAttribute("hide"),e.removeAttribute("transition"),e.removeAttribute("transition-direction"),xtag.fireEvent(e,"hide")}}))}}}),xtag.register("x-card",{lifecycle:{inserted:function(){var a=this.parentNode;"x-deck"==a.nodeName.toLowerCase()&&(this.xtag.deck=a,this!=a.selected&&this.selected&&a.showCard(this))},removed:function(){var a=this.xtag.deck;a&&(this==a.xtag.selected?(a.xtag.selected=null,a.removeAttribute("selected-index")):a.showCard(a.selectedCard),this.xtag.deck=null)}},accessors:{transitionType:{attribute:{name:"transition-type"}},selected:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.deck;b&&(a&&this!=b.selected?b.showCard(this):a||this!=b.selected||b.hideCard(this))}}}})}(),function(){function a(a){var b=a.currentTarget;this.parentNode==b&&(this.parentNode.firstElementChild==this?b.flipped=!1:this.parentNode.lastElementChild==this&&(b.flipped=!0))}xtag.register("x-flipbox",{lifecycle:{created:function(){this.firstElementChild&&xtag.skipTransition(this.firstElementChild,function(){}),this.lastElementChild&&xtag.skipTransition(this.lastElementChild,function(){}),this.hasAttribute("direction")||(this.xtag._direction="right")}},events:{"transitionend:delegate(x-flipbox > *:first-child)":function(a){var b=a.currentTarget;this.parentNode==b&&xtag.fireEvent(b,"flipend")},"reveal:delegate(x-flipbox > *)":a},accessors:{direction:{attribute:{},get:function(){return this.xtag._direction},set:function(a){var b=this;xtag.skipTransition(this.firstElementChild,function(){return b.setAttribute("_anim-direction",a),function(){}}),xtag.skipTransition(this.lastElementChild,function(){b.setAttribute("_anim-direction",a)}),this.xtag._direction=a}},flipped:{attribute:{"boolean":!0}}},methods:{toggle:function(){this.flipped=!this.flipped},showFront:function(){this.flipped=!1},showBack:function(){this.flipped=!0}}})}(),function(){function a(a,b){var c=b.__layoutScroll__=b.__layoutScroll__||Object.defineProperty(b,"__layoutScroll__",{value:{last:b.scrollTop}}).__layoutScroll__,d=b.scrollTop,e=a.scrollBuffer;return c.max=c.max||Math.max(d+e,e),c.min=c.min||Math.max(d-e,e),c}function b(a){a.setAttribute("content-maximizing",null)}function c(a){a.removeAttribute("content-maximized"),a.removeAttribute("content-maximizing")}function d(d){var e=d.currentTarget;if("scroll"==e.hideTrigger&&!d.currentTarget.hasAttribute("content-maximizing")){var f=d.target;if(e.scrollTarget?xtag.matchSelector(f,e.scrollTarget):f.parentNode==e){var g=f.scrollTop,h=e.scrollBuffer,i=a(e,f);g>i.last?i.min=Math.max(g-h,h):gi.max&&!e.hasAttribute("content-maximized")?b(e):g=+c)throw"invalid step "+c;return e((b-d)/c)*c+d}function d(a,b,d,e){return b>a?b:a>d?Math.max(b,c(d,e,b,Math.floor)):a}function e(a,b,e){var f=c((b-a)/2+a,e,a);return d(f,a,b,e)}function f(a,b){var c=a.min,d=a.max;return(b-c)/(d-c)}function g(a,b){var c=a.min,d=a.max;return(d-c)*b+c}function h(a,b){b=Math.min(Math.max(0,b),1);var e=g(a,b),f=c(e,a.step,a.min);return d(f,a.min,a.max,a.step)}function i(a,b){var c=a.xtag.sliderThumb;if(c){var d=a.getBoundingClientRect(),e=c.getBoundingClientRect(),g=f(a,b),h=a.vertical,i=d[h?"height":"width"],j=e[h?"height":"width"],k=Math.max(i-j,0),l=k*g,m=l/i;c.style[h?"left":"top"]=0,c.style[h?"top":"left"]=100*m+"%",a.xtag.sliderProgress.style[h?"height":"width"]=100*g+"%"}}function j(a){i(a,a.value)}function k(a,b,c){var d=a.xtag.rangeInputEl,e=d.getBoundingClientRect(),f=a.xtag.sliderThumb.getBoundingClientRect().width,g=b-e.left-f/2,i=e.width-f/2;a.vertical&&(i=e.height,g=c-e.top),a.value=h(a,g/i),xtag.fireEvent(a,"input"),j(a)}function l(a,b,c){a.xtag.dragInitVal=a.value,k(a,b,c);var d=a.xtag.callbackFns,e=function(a,b){document.body.addEventListener(a,b)};e("mousemove",d.onMouseDragMove),e("touchmove",d.onTouchDragMove),e("mouseup",d.onDragEnd),e("touchend",d.onDragEnd);var f=a.xtag.sliderThumb;f&&f.setAttribute("active",!0)}function m(a,b,c){k(a,b,c)}function n(a){return{onMouseDragStart:function(b){b.button===p&&(l(a,b.pageX,b.pageY),b.preventDefault())},onTouchDragStart:function(b){var c=b.targetTouches;1===c.length&&(l(a,c[0].pageX,c[0].pageY),b.preventDefault())},onMouseDragMove:function(b){m(a,b.pageX,b.pageY),b.preventDefault()},onTouchDragMove:function(b){var c=b.targetTouches;1===c.length&&(m(a,c[0].pageX,c[0].pageY),b.preventDefault())},onDragEnd:function(b){var c=a.xtag.callbackFns,d=function(a,b){document.body.removeEventListener(a,b)};d("mousemove",c.onMouseDragMove),d("touchmove",c.onTouchDragMove),d("mouseup",c.onDragEnd),d("touchend",c.onDragEnd);var e=a.xtag.sliderThumb;e&&e.removeAttribute("active"),a.value!==a.xtag.dragInitVal&&xtag.fireEvent(a,"change"),a.xtag.dragInitVal=null,b.preventDefault()},onKeyDown:function(a){var b=a.keyCode;if(b in o){var c=this.value,d=this.min,e=this.max,f=this.step,g=Math.max(0,e-d),h=Math.max(g/10,f);switch(o[b]){case"LEFT_ARROW":case"DOWN_ARROW":this.value=Math.max(c-f,d);break;case"RIGHT_ARROW":case"UP_ARROW":this.value=Math.min(c+f,e);break;case"HOME":this.value=d;break;case"END":this.value=e;break;case"PAGE_DOWN":this.value=Math.max(c-h,d);break;case"PAGE_UP":this.value=Math.min(c+h,e)}this.value!==c&&xtag.fireEvent(this,"change"),a.preventDefault()}}}}var o={33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT_ARROW",38:"UP_ARROW",39:"RIGHT_ARROW",40:"DOWN_ARROW"},p=0;xtag.register("x-slider",{lifecycle:{created:function(){var a=this;a.xtag.callbackFns=n(a),a.xtag.dragInitVal=null;var c=document.createElement("input");xtag.addClass(c,"input"),c.setAttribute("type","range");var d=b(a,"max")?+a.getAttribute("max"):100,f=b(a,"min")?+a.getAttribute("min"):0,g=b(a,"step")?+a.getAttribute("step"):1;g=g>0?g:1;var h=b(a,"value")?+a.getAttribute("value"):e(f,d,g);c.setAttribute("max",d),c.setAttribute("min",f),c.setAttribute("step",g),c.setAttribute("value",h),a.xtag.rangeInputEl=c,a.appendChild(a.xtag.rangeInputEl);var i=document.createElement("div");xtag.addClass(i,"slider-track"),this.xtag.sliderTrack=i,this.appendChild(i);var j=document.createElement("div");xtag.addClass(j,"slider-progress"),this.xtag.sliderProgress=j,i.appendChild(j);var k=document.createElement("span");xtag.addClass(k,"slider-thumb"),this.xtag.sliderThumb=k,this.appendChild(k),"range"!==c.type||a.hasAttribute("polyfill")?a.setAttribute("polyfill",!0):a.removeAttribute("polyfill"),this.addEventListener("mousedown",a.xtag.callbackFns.onMouseDragStart),this.addEventListener("touchstart",a.xtag.callbackFns.onTouchDragStart),this.addEventListener("keydown",a.xtag.callbackFns.onKeyDown),a.setAttribute("value",h)},inserted:function(){var a=this;xtag.requestFrame(function(){xtag.requestFrame(function(){j(a)})})},attributeChanged:function(a){("min"==a||"max"==a||"step"==a)&&j(this)}},events:{"change:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"input:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"input")},"focus:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"focus",{},{bubbles:!1})},"blur:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"blur",{},{bubbles:!1})}},accessors:{polyfill:{attribute:{"boolean":!0},set:function(a){this.xtag.callbackFns;a?(this.setAttribute("tabindex",0),this.xtag.rangeInputEl.setAttribute("tabindex",-1),this.xtag.rangeInputEl.setAttribute("readonly",!0),j(this)):(this.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("readonly"))}},vertical:{attribute:{"boolean":!0},set:function(){j(this)}},max:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("max")}},min:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("min")}},step:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("step")}},name:{attribute:{selector:"input[type=range]"},set:function(a){var b=this.xtag.rangeInputEl;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},value:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.value},set:function(b){a(b)||(b=e(this.min,this.max,this.step)),b=+b;var f=this.min,g=this.max,h=this.step,i=c(b,h,f),k=d(i,f,g,h);this.xtag.rangeInputEl.value=k,j(this)}},inputElem:{get:function(){return this.xtag.rangeInputEl}}},methods:{}})}(),function(){function a(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function b(b){var c=b.getBoundingClientRect(),d=a(),e=d.left,f=d.top;return{left:c.left+e,right:c.right+e,top:c.top+f,bottom:c.bottom+f,width:c.width,height:c.height}}function c(a,b,c){return c.left<=a&&a<=c.right&&c.top<=b&&b<=c.bottom}function d(a){if("x-tabbar"===a.parentNode.nodeName.toLowerCase()){var b=a.targetEvent,c=a.targetSelector?xtag.query(document,a.targetSelector):a.targetElems;c.forEach(function(a){xtag.fireEvent(a,b)})}}xtag.register("x-tabbar",{lifecycle:{created:function(){this.xtag.overallEventToFire="reveal"}},events:{"tap:delegate(x-tabbar-tab)":function(){var a=xtag.query(this.parentNode,"x-tabbar-tab[selected]");a.length&&a.forEach(function(a){a.removeAttribute("selected")}),this.setAttribute("selected",!0)}},accessors:{tabs:{get:function(){return xtag.queryChildren(this,"x-tabbar-tab")}},targetEvent:{attribute:{name:"target-event"},get:function(){return this.xtag.overallEventToFire},set:function(a){this.xtag.overallEventToFire=a}}},methods:{}}),xtag.register("x-tabbar-tab",{lifecycle:{created:function(){this.xtag.targetSelector=null,this.xtag.overrideTargetElems=null,this.xtag.targetEvent=null}},events:{tap:function(a){var e=a.currentTarget;if(a.changedTouches&&a.changedTouches.length>0){var f=a.changedTouches[0],g=b(e);c(f.pageX,f.pageY,g)&&d(e)}else d(e)}},accessors:{targetSelector:{attribute:{name:"target-selector"},get:function(){return this.xtag.targetSelector},set:function(a){this.xtag.targetSelector=a,a&&(this.xtag.overrideTargetElems=null)}},targetElems:{get:function(){return this.targetSelector?xtag.query(document,this.targetSelector):null!==this.xtag.overrideTargetElems?this.xtag.overrideTargetElems:[]},set:function(a){this.removeAttribute("target-selector"),this.xtag.overrideTargetElems=a}},targetEvent:{attribute:{name:"target-event"},get:function(){if(this.xtag.targetEvent)return this.xtag.targetEvent;if("x-tabbar"===this.parentNode.nodeName.toLowerCase())return this.parentNode.targetEvent;throw"tabbar-tab is missing event to fire"},set:function(a){this.xtag.targetEvent=a}}},methods:{}})}(),function(){function a(a){var b=a.xtag.input.form;b?a.removeAttribute("x-toggle-no-form"):a.setAttribute("x-toggle-no-form",""),a.xtag.scope=a.parentNode?b||document:null}function b(a){var b={},c=a==document?"[x-toggle-no-form]":"";xtag.query(a,"x-toggle[name]"+c).forEach(function(d){var e=d.name;if(e&&!b[e]){var f=xtag.query(a,'x-toggle[name="'+e+'"]'+c),g=f.length>1?"radio":"checkbox";f.forEach(function(a){a.xtag&&a.xtag.input&&(a.type=g)}),b[e]=!0}})}function c(a){if(f&&a.group&&"radio"!=a.type){var b=a.groupToggles,c='x-toggle[group="'+a.group+'"][active]',d=a.xtag.scope.querySelector(c);if(d&&a!=d){a.checked=d.checked;var e=d.checked,g=b.indexOf(a),h=b.indexOf(d),i=Math.min(g,h),j=Math.max(g,h);return b.slice(i,j+1).forEach(function(a){a!=d&&(a.checked=e)}),!0}}}function d(a){e(a)||(a.groupToggles.forEach(function(a){a.active=!1}),a.active=!0)}function e(a){return a.parentNode&&"x-togglebar"==a.parentNode.nodeName.toLowerCase()}var f=!1;xtag.addEvents(document,{DOMComponentsLoaded:function(){b(document),xtag.toArray(document.forms).forEach(b)},WebComponentsReady:function(){b(document),xtag.toArray(document.forms).forEach(b)},keydown:function(a){f=a.shiftKey},keyup:function(a){f=a.shiftKey},"focus:delegate(x-toggle)":function(){this.focus=!0,this.xtag.input.focus()},"blur:delegate(x-toggle)":function(){this.focus=!1},"tap:delegate(x-toggle)":function(){var a=this.xtag.input;if("radio"==a.type?!this.checked:!0){a.checked=!a.checked;var b=document.createEvent("Event");b.initEvent("change",!0,!1),a.dispatchEvent(b)}a.focus()},"change:delegate(x-toggle)":function(){this.xtag.input.focus(),(e(this)||!c(this)&&"radio"!=this.type)&&(this.checked=this.xtag.input.checked),d(this)}});var g=xtag.createFragment('
');xtag.register("x-toggle",{lifecycle:{created:function(){this.appendChild(g.cloneNode(!0)),this.xtag.input=this.querySelector("input"),this.xtag.checkEl=this.querySelector(".x-toggle-check"),this.type="checkbox",a(this);var b=this.getAttribute("name");b&&(this.xtag.input.name=this.getAttribute("name")),this.hasAttribute("checked")&&(this.checked=!0)},inserted:function(){a(this),this.name&&b(this.xtag.scope)
+},removed:function(){b(this.xtag.scope),a(this)}},accessors:{noBox:{attribute:{name:"no-box","boolean":!0}},type:{attribute:{},set:function(a){this.xtag.input.type=a}},label:{attribute:{}},focus:{attribute:{"boolean":!0}},active:{attribute:{"boolean":!0}},group:{attribute:{}},groupToggles:{get:function(){return xtag.query(this.xtag.scope,'x-toggle[group="'+this.group+'"]')}},name:{attribute:{skip:!0},set:function(a){null===a?(this.removeAttribute("name"),this.type="checkbox"):this.setAttribute("name",a),this.xtag.input.name=a,b(this.xtag.scope)}},checked:{get:function(){return this.xtag.input.checked},set:function(a){var b=this.name,c="true"===a||a===!0;if(b){var d=this.xtag.scope==document?"[x-toggle-no-form]":"",e='x-toggle[checked][name="'+b+'"]'+d,f=this.xtag.scope.querySelector(e);f&&f.removeAttribute("checked")}this.xtag.input.checked=c,c?this.setAttribute("checked",""):this.removeAttribute("checked")}},value:{attribute:{},get:function(){return this.xtag.input.value},set:function(a){this.xtag.input.value=a}}}}),xtag.register("x-togglebar",{events:{}})}();
\ No newline at end of file
diff --git a/dist/x-tag-appbar.css b/dist/x-tag-appbar.css
index 89d43ab7..8e9fcfac 100644
--- a/dist/x-tag-appbar.css
+++ b/dist/x-tag-appbar.css
@@ -44,6 +44,14 @@ x-appbar h6 {
text-overflow: ellipsis;
margin: 0;
}
+x-appbar > h1:after,
+x-appbar h2:after,
+x-appbar h3:after,
+x-appbar h4:after,
+x-appbar h5:after,
+x-appbar h6:after {
+ content: attr(subheading);
+}
x-appbar {
background-color: #00202f;
diff --git a/dist/x-tag-appbar.min.css b/dist/x-tag-appbar.min.css
index 1f235341..145209d0 100644
--- a/dist/x-tag-appbar.min.css
+++ b/dist/x-tag-appbar.min.css
@@ -2,6 +2,7 @@ x-appbar{padding:0;width:100%;display:-webkit-box;display:-moz-box;display:-ms-f
x-appbar,x-appbar *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
x-appbar > *{border:none;vertical-align:middle;text-align:center;-webkit-flex-align:center;-ms-flex-align:center;-webkit-align-items:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;align-items:center;text-align:center}
x-appbar > h1,x-appbar h2,x-appbar h3,x-appbar h4,x-appbar h5,x-appbar h6{min-width:auto;min-height:auto;-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;box-flex:1;flex:1;overflow:hidden;text-overflow:ellipsis;margin:0}
+x-appbar > h1:after,x-appbar h2:after,x-appbar h3:after,x-appbar h4:after,x-appbar h5:after,x-appbar h6:after{content:attr(subheading)}
x-appbar{background-color:#00202f;color:#fff;font-family:"Fira Sans","Fira Sans","Segoe UI",Frutiger,"Frutiger Linotype","Dejavu Sans","Helvetica Neue",Arial,sans-serif;font-size:17px;height:45px;line-height:45px}
x-appbar > header{font-weight:600}
x-appbar > *{color:#fff;font-family:"Fira Sans","Fira Sans","Segoe UI",Frutiger,"Frutiger Linotype","Dejavu Sans","Helvetica Neue",Arial,sans-serif;font-size:inherit;line-height:inherit;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
diff --git a/dist/x-tag-calendar.min.js b/dist/x-tag-calendar.min.js
index 605cfb92..9627fada 100644
--- a/dist/x-tag-calendar.min.js
+++ b/dist/x-tag-calendar.min.js
@@ -1 +1 @@
-!function(){function a(a){var b=new Date(a.valueOf());return b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[W]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top;return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getFullYear()}function n(a){return a.getMonth()}function o(a){return a.getDate()}function p(a){return a.getDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=X.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return null}catch(c){var d=t(a);return d?[d]:null}}for(var g=0;gk.valueOf())return null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b){return b||(b=(new Date).getFullYear()),new Date(b,a+1,0).getDate()}function x(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function y(a){var b=a.getDate(),c=w(a.getMonth()+1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()+1,b)}function z(a){var b=a.getDate(),c=w(a.getMonth()-1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()-1,b)}function A(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=F(a)}throw"unable to find week start"}function B(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=E(a)}throw"unable to find week end"}function C(b){return b=new Date(b.valueOf()),b.setDate(1),a(b)}function D(a){return F(x(a,0,1,0))}function E(a){return x(a,0,0,1)}function F(a){return x(a,0,0,-1)}function G(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?H(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function H(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function I(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function J(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function K(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=R(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function L(a){a=a.slice(0),I(a);for(var b=[],c=0;c0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=G(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(G(d,[j])||G(F(d),[j])){var k=g.valueOf()f.valueOf()?h:f,m=G(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function M(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,V)?(a.xtag.dragType=U,c="datetoggleoff"):(a.xtag.dragType=T,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function N(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==T||l(b,V)?a.xtag.dragType===U&&l(b,V)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function O(){for(var a=xtag.query(document,"x-calendar"),b=0;bq;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var x=g("span.day");if(x.setAttribute("data-date",r(v)),x.textContent=o(v),n(v)!==h&&j(x,"badmonth"),G(v,d)&&j(x,V),G(v,S)&&j(x,"today"),b(u,x),v=E(v),0===(q+1)%7){b(k,u),u=g("div.week");var y=n(v)>h||n(v)m(i);if(y)break}}return k},Y._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=S;return c},Y._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=L(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},Y.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},Y.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;cc;c++)b(this.el,this.makeMonth(i)),i=x(i,0,1,0)}this._callCustomRenderer()},Y._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return C(this.view)}},lastVisibleMonth:{get:function(){return x(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return A(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return B(D(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=z(a.view)},nextMonth:function(){var a=this.xtag.calObj;a.view=y(a.view)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}();
\ No newline at end of file
+!function(){function a(a){var b=new Date(a.valueOf());return b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[W]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top;return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getFullYear()}function n(a){return a.getMonth()}function o(a){return a.getDate()}function p(a){return a.getDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=X.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return null}catch(c){var d=t(a);return d?[d]:null}}for(var g=0;gk.valueOf())return null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b){return b||(b=(new Date).getFullYear()),new Date(b,a+1,0).getDate()}function x(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function y(a){var b=a.getDate(),c=w(a.getMonth()+1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()+1,b)}function z(a){var b=a.getDate(),c=w(a.getMonth()-1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()-1,b)}function A(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=F(a)}throw"unable to find week start"}function B(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=E(a)}throw"unable to find week end"}function C(b){return b=new Date(b.valueOf()),b.setDate(1),a(b)}function D(a){return F(x(a,0,1,0))}function E(a){return x(a,0,0,1)}function F(a){return x(a,0,0,-1)}function G(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?H(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function H(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function I(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function J(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function K(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=R(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function L(a){a=a.slice(0),I(a);for(var b=[],c=0;c0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=G(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(G(d,[j])||G(F(d),[j])){var k=g.valueOf()f.valueOf()?h:f,m=G(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function M(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,V)?(a.xtag.dragType=U,c="datetoggleoff"):(a.xtag.dragType=T,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function N(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==T||l(b,V)?a.xtag.dragType===U&&l(b,V)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function O(){for(var a=xtag.query(document,"x-calendar"),b=0;bq;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var x=g("span.day");if(x.setAttribute("data-date",r(v)),x.textContent=o(v),n(v)!==h&&j(x,"badmonth"),G(v,d)&&j(x,V),G(v,S)&&j(x,"today"),b(u,x),v=E(v),(q+1)%7===0){b(k,u),u=g("div.week");var y=n(v)>h||n(v)m(i);if(y)break}}return k},Y._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=S;return c},Y._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=L(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},Y.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},Y.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;cc;c++)b(this.el,this.makeMonth(i)),i=x(i,0,1,0)}this._callCustomRenderer()},Y._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return C(this.view)}},lastVisibleMonth:{get:function(){return x(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return A(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return B(D(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=z(a.view)},nextMonth:function(){var a=this.xtag.calObj;a.view=y(a.view)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}();
\ No newline at end of file
diff --git a/dist/x-tag-core.js b/dist/x-tag-core.js
index b08c009a..3722d115 100644
--- a/dist/x-tag-core.js
+++ b/dist/x-tag-core.js
@@ -1,2570 +1,1794 @@
-// We don't use the platform bootstrapper, so fake this stuff.
-
window.Platform = {};
-var logFlags = {};
-
-
-// DOMTokenList polyfill for IE9
-(function () {
-
-if (typeof window.Element === "undefined" || "classList" in document.documentElement) return;
-
-var prototype = Array.prototype,
- indexOf = prototype.indexOf,
- slice = prototype.slice,
- push = prototype.push,
- splice = prototype.splice,
- join = prototype.join;
-
-function DOMTokenList(el) {
- this._element = el;
- if (el.className != this._classCache) {
- this._classCache = el.className;
- if (!this._classCache) return;
-
- // The className needs to be trimmed and split on whitespace
- // to retrieve a list of classes.
- var classes = this._classCache.replace(/^\s+|\s+$/g,'').split(/\s+/),
- i;
- for (i = 0; i < classes.length; i++) {
- push.call(this, classes[i]);
- }
- }
-};
-
-function setToClassName(el, classes) {
- el.className = classes.join(' ');
-}
+var logFlags = {};
-DOMTokenList.prototype = {
- add: function(token) {
- if(this.contains(token)) return;
- push.call(this, token);
- setToClassName(this._element, slice.call(this, 0));
- },
- contains: function(token) {
- return indexOf.call(this, token) !== -1;
- },
- item: function(index) {
- return this[index] || null;
- },
- remove: function(token) {
- var i = indexOf.call(this, token);
- if (i === -1) {
- return;
- }
- splice.call(this, i, 1);
- setToClassName(this._element, slice.call(this, 0));
- },
- toString: function() {
- return join.call(this, ' ');
- },
- toggle: function(token) {
- if (indexOf.call(this, token) === -1) {
- this.add(token);
- } else {
- this.remove(token);
+(function() {
+ if (typeof window.Element === "undefined" || "classList" in document.documentElement) return;
+ var prototype = Array.prototype, indexOf = prototype.indexOf, slice = prototype.slice, push = prototype.push, splice = prototype.splice, join = prototype.join;
+ function DOMTokenList(el) {
+ this._element = el;
+ if (el.className != this._classCache) {
+ this._classCache = el.className;
+ if (!this._classCache) return;
+ var classes = this._classCache.replace(/^\s+|\s+$/g, "").split(/\s+/), i;
+ for (i = 0; i < classes.length; i++) {
+ push.call(this, classes[i]);
+ }
+ }
}
- }
-};
-
-window.DOMTokenList = DOMTokenList;
-
-function defineElementGetter (obj, prop, getter) {
- if (Object.defineProperty) {
- Object.defineProperty(obj, prop,{
- get : getter
- })
- } else {
- obj.__defineGetter__(prop, getter);
- }
-}
-
-defineElementGetter(Element.prototype, 'classList', function () {
- return new DOMTokenList(this);
-});
-
-})();
-
-
-/*
- * Copyright 2012 The Polymer Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-
-if (typeof WeakMap === 'undefined') {
- (function() {
- var defineProperty = Object.defineProperty;
- var counter = Date.now() % 1e9;
-
- var WeakMap = function() {
- this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__');
- };
-
- WeakMap.prototype = {
- set: function(key, value) {
- var entry = key[this.name];
- if (entry && entry[0] === key)
- entry[1] = value;
- else
- defineProperty(key, this.name, {value: [key, value], writable: true});
- },
- get: function(key) {
- var entry;
- return (entry = key[this.name]) && entry[0] === key ?
- entry[1] : undefined;
- },
- delete: function(key) {
- this.set(key, undefined);
- }
+ function setToClassName(el, classes) {
+ el.className = classes.join(" ");
+ }
+ DOMTokenList.prototype = {
+ add: function(token) {
+ if (this.contains(token)) return;
+ push.call(this, token);
+ setToClassName(this._element, slice.call(this, 0));
+ },
+ contains: function(token) {
+ return indexOf.call(this, token) !== -1;
+ },
+ item: function(index) {
+ return this[index] || null;
+ },
+ remove: function(token) {
+ var i = indexOf.call(this, token);
+ if (i === -1) {
+ return;
+ }
+ splice.call(this, i, 1);
+ setToClassName(this._element, slice.call(this, 0));
+ },
+ toString: function() {
+ return join.call(this, " ");
+ },
+ toggle: function(token) {
+ if (indexOf.call(this, token) === -1) {
+ this.add(token);
+ } else {
+ this.remove(token);
+ }
+ }
};
+ window.DOMTokenList = DOMTokenList;
+ function defineElementGetter(obj, prop, getter) {
+ if (Object.defineProperty) {
+ Object.defineProperty(obj, prop, {
+ get: getter
+ });
+ } else {
+ obj.__defineGetter__(prop, getter);
+ }
+ }
+ defineElementGetter(Element.prototype, "classList", function() {
+ return new DOMTokenList(this);
+ });
+})();
- window.WeakMap = WeakMap;
- })();
+if (typeof WeakMap === "undefined") {
+ (function() {
+ var defineProperty = Object.defineProperty;
+ var counter = Date.now() % 1e9;
+ var WeakMap = function() {
+ this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
+ };
+ WeakMap.prototype = {
+ set: function(key, value) {
+ var entry = key[this.name];
+ if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
+ value: [ key, value ],
+ writable: true
+ });
+ },
+ get: function(key) {
+ var entry;
+ return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
+ },
+ "delete": function(key) {
+ this.set(key, undefined);
+ }
+ };
+ window.WeakMap = WeakMap;
+ })();
}
-/*
- * Copyright 2012 The Polymer Authors. All rights reserved.
- * Use of this source code is goverened by a BSD-style
- * license that can be found in the LICENSE file.
- */
-
(function(global) {
-
- var registrationsTable = new WeakMap();
-
- // We use setImmediate or postMessage for our future callback.
- var setImmediate = window.msSetImmediate;
-
- // Use post message to emulate setImmediate.
- if (!setImmediate) {
- var setImmediateQueue = [];
- var sentinel = String(Math.random());
- window.addEventListener('message', function(e) {
- if (e.data === sentinel) {
- var queue = setImmediateQueue;
- setImmediateQueue = [];
- queue.forEach(function(func) {
- func();
+ var registrationsTable = new WeakMap();
+ var setImmediate = window.msSetImmediate;
+ if (!setImmediate) {
+ var setImmediateQueue = [];
+ var sentinel = String(Math.random());
+ window.addEventListener("message", function(e) {
+ if (e.data === sentinel) {
+ var queue = setImmediateQueue;
+ setImmediateQueue = [];
+ queue.forEach(function(func) {
+ func();
+ });
+ }
});
- }
- });
- setImmediate = function(func) {
- setImmediateQueue.push(func);
- window.postMessage(sentinel, '*');
- };
- }
-
- // This is used to ensure that we never schedule 2 callas to setImmediate
- var isScheduled = false;
-
- // Keep track of observers that needs to be notified next time.
- var scheduledObservers = [];
-
- /**
- * Schedules |dispatchCallback| to be called in the future.
- * @param {MutationObserver} observer
- */
- function scheduleCallback(observer) {
- scheduledObservers.push(observer);
- if (!isScheduled) {
- isScheduled = true;
- setImmediate(dispatchCallbacks);
- }
- }
-
- function wrapIfNeeded(node) {
- return window.ShadowDOMPolyfill &&
- window.ShadowDOMPolyfill.wrapIfNeeded(node) ||
- node;
- }
-
- function dispatchCallbacks() {
- // http://dom.spec.whatwg.org/#mutation-observers
-
- isScheduled = false; // Used to allow a new setImmediate call above.
-
- var observers = scheduledObservers;
- scheduledObservers = [];
- // Sort observers based on their creation UID (incremental).
- observers.sort(function(o1, o2) {
- return o1.uid_ - o2.uid_;
- });
-
- var anyNonEmpty = false;
- observers.forEach(function(observer) {
-
- // 2.1, 2.2
- var queue = observer.takeRecords();
- // 2.3. Remove all transient registered observers whose observer is mo.
- removeTransientObserversFor(observer);
-
- // 2.4
- if (queue.length) {
- observer.callback_(queue, observer);
- anyNonEmpty = true;
- }
- });
-
- // 3.
- if (anyNonEmpty)
- dispatchCallbacks();
- }
-
- function removeTransientObserversFor(observer) {
- observer.nodes_.forEach(function(node) {
- var registrations = registrationsTable.get(node);
- if (!registrations)
- return;
- registrations.forEach(function(registration) {
- if (registration.observer === observer)
- registration.removeTransientObservers();
- });
- });
- }
-
- /**
- * This function is used for the "For each registered observer observer (with
- * observer's options as options) in target's list of registered observers,
- * run these substeps:" and the "For each ancestor ancestor of target, and for
- * each registered observer observer (with options options) in ancestor's list
- * of registered observers, run these substeps:" part of the algorithms. The
- * |options.subtree| is checked to ensure that the callback is called
- * correctly.
- *
- * @param {Node} target
- * @param {function(MutationObserverInit):MutationRecord} callback
- */
- function forEachAncestorAndObserverEnqueueRecord(target, callback) {
- for (var node = target; node; node = node.parentNode) {
- var registrations = registrationsTable.get(node);
-
- if (registrations) {
- for (var j = 0; j < registrations.length; j++) {
- var registration = registrations[j];
- var options = registration.options;
-
- // Only target ignores subtree.
- if (node !== target && !options.subtree)
- continue;
-
- var record = callback(options);
- if (record)
- registration.enqueue(record);
- }
- }
+ setImmediate = function(func) {
+ setImmediateQueue.push(func);
+ window.postMessage(sentinel, "*");
+ };
}
- }
-
- var uidCounter = 0;
-
- /**
- * The class that maps to the DOM MutationObserver interface.
- * @param {Function} callback.
- * @constructor
- */
- function JsMutationObserver(callback) {
- this.callback_ = callback;
- this.nodes_ = [];
- this.records_ = [];
- this.uid_ = ++uidCounter;
- }
-
- JsMutationObserver.prototype = {
- observe: function(target, options) {
- target = wrapIfNeeded(target);
-
- // 1.1
- if (!options.childList && !options.attributes && !options.characterData ||
-
- // 1.2
- options.attributeOldValue && !options.attributes ||
-
- // 1.3
- options.attributeFilter && options.attributeFilter.length &&
- !options.attributes ||
-
- // 1.4
- options.characterDataOldValue && !options.characterData) {
-
- throw new SyntaxError();
- }
-
- var registrations = registrationsTable.get(target);
- if (!registrations)
- registrationsTable.set(target, registrations = []);
-
- // 2
- // If target's list of registered observers already includes a registered
- // observer associated with the context object, replace that registered
- // observer's options with options.
- var registration;
- for (var i = 0; i < registrations.length; i++) {
- if (registrations[i].observer === this) {
- registration = registrations[i];
- registration.removeListeners();
- registration.options = options;
- break;
- }
- }
-
- // 3.
- // Otherwise, add a new registered observer to target's list of registered
- // observers with the context object as the observer and options as the
- // options, and add target to context object's list of nodes on which it
- // is registered.
- if (!registration) {
- registration = new Registration(this, target, options);
- registrations.push(registration);
- this.nodes_.push(target);
- }
-
- registration.addListeners();
- },
-
- disconnect: function() {
- this.nodes_.forEach(function(node) {
- var registrations = registrationsTable.get(node);
- for (var i = 0; i < registrations.length; i++) {
- var registration = registrations[i];
- if (registration.observer === this) {
- registration.removeListeners();
- registrations.splice(i, 1);
- // Each node can only have one registered observer associated with
- // this observer.
- break;
- }
+ var isScheduled = false;
+ var scheduledObservers = [];
+ function scheduleCallback(observer) {
+ scheduledObservers.push(observer);
+ if (!isScheduled) {
+ isScheduled = true;
+ setImmediate(dispatchCallbacks);
}
- }, this);
- this.records_ = [];
- },
-
- takeRecords: function() {
- var copyOfRecords = this.records_;
- this.records_ = [];
- return copyOfRecords;
}
- };
-
- /**
- * @param {string} type
- * @param {Node} target
- * @constructor
- */
- function MutationRecord(type, target) {
- this.type = type;
- this.target = target;
- this.addedNodes = [];
- this.removedNodes = [];
- this.previousSibling = null;
- this.nextSibling = null;
- this.attributeName = null;
- this.attributeNamespace = null;
- this.oldValue = null;
- }
-
- function copyMutationRecord(original) {
- var record = new MutationRecord(original.type, original.target);
- record.addedNodes = original.addedNodes.slice();
- record.removedNodes = original.removedNodes.slice();
- record.previousSibling = original.previousSibling;
- record.nextSibling = original.nextSibling;
- record.attributeName = original.attributeName;
- record.attributeNamespace = original.attributeNamespace;
- record.oldValue = original.oldValue;
- return record;
- };
-
- // We keep track of the two (possibly one) records used in a single mutation.
- var currentRecord, recordWithOldValue;
-
- /**
- * Creates a record without |oldValue| and caches it as |currentRecord| for
- * later use.
- * @param {string} oldValue
- * @return {MutationRecord}
- */
- function getRecord(type, target) {
- return currentRecord = new MutationRecord(type, target);
- }
-
- /**
- * Gets or creates a record with |oldValue| based in the |currentRecord|
- * @param {string} oldValue
- * @return {MutationRecord}
- */
- function getRecordWithOldValue(oldValue) {
- if (recordWithOldValue)
- return recordWithOldValue;
- recordWithOldValue = copyMutationRecord(currentRecord);
- recordWithOldValue.oldValue = oldValue;
- return recordWithOldValue;
- }
-
- function clearRecords() {
- currentRecord = recordWithOldValue = undefined;
- }
-
- /**
- * @param {MutationRecord} record
- * @return {boolean} Whether the record represents a record from the current
- * mutation event.
- */
- function recordRepresentsCurrentMutation(record) {
- return record === recordWithOldValue || record === currentRecord;
- }
-
- /**
- * Selects which record, if any, to replace the last record in the queue.
- * This returns |null| if no record should be replaced.
- *
- * @param {MutationRecord} lastRecord
- * @param {MutationRecord} newRecord
- * @param {MutationRecord}
- */
- function selectRecord(lastRecord, newRecord) {
- if (lastRecord === newRecord)
- return lastRecord;
-
- // Check if the the record we are adding represents the same record. If
- // so, we keep the one with the oldValue in it.
- if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord))
- return recordWithOldValue;
-
- return null;
- }
-
- /**
- * Class used to represent a registered observer.
- * @param {MutationObserver} observer
- * @param {Node} target
- * @param {MutationObserverInit} options
- * @constructor
- */
- function Registration(observer, target, options) {
- this.observer = observer;
- this.target = target;
- this.options = options;
- this.transientObservedNodes = [];
- }
-
- Registration.prototype = {
- enqueue: function(record) {
- var records = this.observer.records_;
- var length = records.length;
-
- // There are cases where we replace the last record with the new record.
- // For example if the record represents the same mutation we need to use
- // the one with the oldValue. If we get same record (this can happen as we
- // walk up the tree) we ignore the new record.
- if (records.length > 0) {
- var lastRecord = records[length - 1];
- var recordToReplaceLast = selectRecord(lastRecord, record);
- if (recordToReplaceLast) {
- records[length - 1] = recordToReplaceLast;
- return;
+ function wrapIfNeeded(node) {
+ return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
+ }
+ function dispatchCallbacks() {
+ isScheduled = false;
+ var observers = scheduledObservers;
+ scheduledObservers = [];
+ observers.sort(function(o1, o2) {
+ return o1.uid_ - o2.uid_;
+ });
+ var anyNonEmpty = false;
+ observers.forEach(function(observer) {
+ var queue = observer.takeRecords();
+ removeTransientObserversFor(observer);
+ if (queue.length) {
+ observer.callback_(queue, observer);
+ anyNonEmpty = true;
+ }
+ });
+ if (anyNonEmpty) dispatchCallbacks();
+ }
+ function removeTransientObserversFor(observer) {
+ observer.nodes_.forEach(function(node) {
+ var registrations = registrationsTable.get(node);
+ if (!registrations) return;
+ registrations.forEach(function(registration) {
+ if (registration.observer === observer) registration.removeTransientObservers();
+ });
+ });
+ }
+ function forEachAncestorAndObserverEnqueueRecord(target, callback) {
+ for (var node = target; node; node = node.parentNode) {
+ var registrations = registrationsTable.get(node);
+ if (registrations) {
+ for (var j = 0; j < registrations.length; j++) {
+ var registration = registrations[j];
+ var options = registration.options;
+ if (node !== target && !options.subtree) continue;
+ var record = callback(options);
+ if (record) registration.enqueue(record);
+ }
+ }
}
- } else {
- scheduleCallback(this.observer);
- }
-
- records[length] = record;
- },
-
- addListeners: function() {
- this.addListeners_(this.target);
- },
-
- addListeners_: function(node) {
- var options = this.options;
- if (options.attributes)
- node.addEventListener('DOMAttrModified', this, true);
-
- if (options.characterData)
- node.addEventListener('DOMCharacterDataModified', this, true);
-
- if (options.childList)
- node.addEventListener('DOMNodeInserted', this, true);
-
- if (options.childList || options.subtree)
- node.addEventListener('DOMNodeRemoved', this, true);
- },
-
- removeListeners: function() {
- this.removeListeners_(this.target);
- },
-
- removeListeners_: function(node) {
- var options = this.options;
- if (options.attributes)
- node.removeEventListener('DOMAttrModified', this, true);
-
- if (options.characterData)
- node.removeEventListener('DOMCharacterDataModified', this, true);
-
- if (options.childList)
- node.removeEventListener('DOMNodeInserted', this, true);
-
- if (options.childList || options.subtree)
- node.removeEventListener('DOMNodeRemoved', this, true);
- },
-
- /**
- * Adds a transient observer on node. The transient observer gets removed
- * next time we deliver the change records.
- * @param {Node} node
- */
- addTransientObserver: function(node) {
- // Don't add transient observers on the target itself. We already have all
- // the required listeners set up on the target.
- if (node === this.target)
- return;
-
- this.addListeners_(node);
- this.transientObservedNodes.push(node);
- var registrations = registrationsTable.get(node);
- if (!registrations)
- registrationsTable.set(node, registrations = []);
-
- // We know that registrations does not contain this because we already
- // checked if node === this.target.
- registrations.push(this);
- },
-
- removeTransientObservers: function() {
- var transientObservedNodes = this.transientObservedNodes;
- this.transientObservedNodes = [];
-
- transientObservedNodes.forEach(function(node) {
- // Transient observers are never added to the target.
- this.removeListeners_(node);
-
- var registrations = registrationsTable.get(node);
- for (var i = 0; i < registrations.length; i++) {
- if (registrations[i] === this) {
- registrations.splice(i, 1);
- // Each node can only have one registered observer associated with
- // this observer.
- break;
- }
+ }
+ var uidCounter = 0;
+ function JsMutationObserver(callback) {
+ this.callback_ = callback;
+ this.nodes_ = [];
+ this.records_ = [];
+ this.uid_ = ++uidCounter;
+ }
+ JsMutationObserver.prototype = {
+ observe: function(target, options) {
+ target = wrapIfNeeded(target);
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
+ throw new SyntaxError();
+ }
+ var registrations = registrationsTable.get(target);
+ if (!registrations) registrationsTable.set(target, registrations = []);
+ var registration;
+ for (var i = 0; i < registrations.length; i++) {
+ if (registrations[i].observer === this) {
+ registration = registrations[i];
+ registration.removeListeners();
+ registration.options = options;
+ break;
+ }
+ }
+ if (!registration) {
+ registration = new Registration(this, target, options);
+ registrations.push(registration);
+ this.nodes_.push(target);
+ }
+ registration.addListeners();
+ },
+ disconnect: function() {
+ this.nodes_.forEach(function(node) {
+ var registrations = registrationsTable.get(node);
+ for (var i = 0; i < registrations.length; i++) {
+ var registration = registrations[i];
+ if (registration.observer === this) {
+ registration.removeListeners();
+ registrations.splice(i, 1);
+ break;
+ }
+ }
+ }, this);
+ this.records_ = [];
+ },
+ takeRecords: function() {
+ var copyOfRecords = this.records_;
+ this.records_ = [];
+ return copyOfRecords;
}
- }, this);
- },
-
- handleEvent: function(e) {
- // Stop propagation since we are managing the propagation manually.
- // This means that other mutation events on the page will not work
- // correctly but that is by design.
- e.stopImmediatePropagation();
-
- switch (e.type) {
- case 'DOMAttrModified':
- // http://dom.spec.whatwg.org/#concept-mo-queue-attributes
-
- var name = e.attrName;
- var namespace = e.relatedNode.namespaceURI;
- var target = e.target;
-
- // 1.
- var record = new getRecord('attributes', target);
- record.attributeName = name;
- record.attributeNamespace = namespace;
-
- // 2.
- var oldValue =
- e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
-
- forEachAncestorAndObserverEnqueueRecord(target, function(options) {
- // 3.1, 4.2
- if (!options.attributes)
- return;
-
- // 3.2, 4.3
- if (options.attributeFilter && options.attributeFilter.length &&
- options.attributeFilter.indexOf(name) === -1 &&
- options.attributeFilter.indexOf(namespace) === -1) {
- return;
- }
- // 3.3, 4.4
- if (options.attributeOldValue)
- return getRecordWithOldValue(oldValue);
-
- // 3.4, 4.5
- return record;
- });
-
- break;
-
- case 'DOMCharacterDataModified':
- // http://dom.spec.whatwg.org/#concept-mo-queue-characterdata
- var target = e.target;
-
- // 1.
- var record = getRecord('characterData', target);
-
- // 2.
- var oldValue = e.prevValue;
-
-
- forEachAncestorAndObserverEnqueueRecord(target, function(options) {
- // 3.1, 4.2
- if (!options.characterData)
- return;
-
- // 3.2, 4.3
- if (options.characterDataOldValue)
- return getRecordWithOldValue(oldValue);
-
- // 3.3, 4.4
- return record;
- });
-
- break;
-
- case 'DOMNodeRemoved':
- this.addTransientObserver(e.target);
- // Fall through.
- case 'DOMNodeInserted':
- // http://dom.spec.whatwg.org/#concept-mo-queue-childlist
- var target = e.relatedNode;
- var changedNode = e.target;
- var addedNodes, removedNodes;
- if (e.type === 'DOMNodeInserted') {
- addedNodes = [changedNode];
- removedNodes = [];
- } else {
-
- addedNodes = [];
- removedNodes = [changedNode];
- }
- var previousSibling = changedNode.previousSibling;
- var nextSibling = changedNode.nextSibling;
-
- // 1.
- var record = getRecord('childList', target);
- record.addedNodes = addedNodes;
- record.removedNodes = removedNodes;
- record.previousSibling = previousSibling;
- record.nextSibling = nextSibling;
-
- forEachAncestorAndObserverEnqueueRecord(target, function(options) {
- // 2.1, 3.2
- if (!options.childList)
- return;
-
- // 2.2, 3.3
- return record;
- });
-
- }
-
- clearRecords();
+ };
+ function MutationRecord(type, target) {
+ this.type = type;
+ this.target = target;
+ this.addedNodes = [];
+ this.removedNodes = [];
+ this.previousSibling = null;
+ this.nextSibling = null;
+ this.attributeName = null;
+ this.attributeNamespace = null;
+ this.oldValue = null;
}
- };
-
- global.JsMutationObserver = JsMutationObserver;
-
- // Provide unprefixed MutationObserver with native or JS implementation
- if (!global.MutationObserver && global.WebKitMutationObserver)
- global.MutationObserver = global.WebKitMutationObserver;
-
- if (!global.MutationObserver)
- global.MutationObserver = JsMutationObserver;
-
-
+ function copyMutationRecord(original) {
+ var record = new MutationRecord(original.type, original.target);
+ record.addedNodes = original.addedNodes.slice();
+ record.removedNodes = original.removedNodes.slice();
+ record.previousSibling = original.previousSibling;
+ record.nextSibling = original.nextSibling;
+ record.attributeName = original.attributeName;
+ record.attributeNamespace = original.attributeNamespace;
+ record.oldValue = original.oldValue;
+ return record;
+ }
+ var currentRecord, recordWithOldValue;
+ function getRecord(type, target) {
+ return currentRecord = new MutationRecord(type, target);
+ }
+ function getRecordWithOldValue(oldValue) {
+ if (recordWithOldValue) return recordWithOldValue;
+ recordWithOldValue = copyMutationRecord(currentRecord);
+ recordWithOldValue.oldValue = oldValue;
+ return recordWithOldValue;
+ }
+ function clearRecords() {
+ currentRecord = recordWithOldValue = undefined;
+ }
+ function recordRepresentsCurrentMutation(record) {
+ return record === recordWithOldValue || record === currentRecord;
+ }
+ function selectRecord(lastRecord, newRecord) {
+ if (lastRecord === newRecord) return lastRecord;
+ if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
+ return null;
+ }
+ function Registration(observer, target, options) {
+ this.observer = observer;
+ this.target = target;
+ this.options = options;
+ this.transientObservedNodes = [];
+ }
+ Registration.prototype = {
+ enqueue: function(record) {
+ var records = this.observer.records_;
+ var length = records.length;
+ if (records.length > 0) {
+ var lastRecord = records[length - 1];
+ var recordToReplaceLast = selectRecord(lastRecord, record);
+ if (recordToReplaceLast) {
+ records[length - 1] = recordToReplaceLast;
+ return;
+ }
+ } else {
+ scheduleCallback(this.observer);
+ }
+ records[length] = record;
+ },
+ addListeners: function() {
+ this.addListeners_(this.target);
+ },
+ addListeners_: function(node) {
+ var options = this.options;
+ if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
+ if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
+ if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
+ if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
+ },
+ removeListeners: function() {
+ this.removeListeners_(this.target);
+ },
+ removeListeners_: function(node) {
+ var options = this.options;
+ if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
+ if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
+ if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
+ if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
+ },
+ addTransientObserver: function(node) {
+ if (node === this.target) return;
+ this.addListeners_(node);
+ this.transientObservedNodes.push(node);
+ var registrations = registrationsTable.get(node);
+ if (!registrations) registrationsTable.set(node, registrations = []);
+ registrations.push(this);
+ },
+ removeTransientObservers: function() {
+ var transientObservedNodes = this.transientObservedNodes;
+ this.transientObservedNodes = [];
+ transientObservedNodes.forEach(function(node) {
+ this.removeListeners_(node);
+ var registrations = registrationsTable.get(node);
+ for (var i = 0; i < registrations.length; i++) {
+ if (registrations[i] === this) {
+ registrations.splice(i, 1);
+ break;
+ }
+ }
+ }, this);
+ },
+ handleEvent: function(e) {
+ e.stopImmediatePropagation();
+ switch (e.type) {
+ case "DOMAttrModified":
+ var name = e.attrName;
+ var namespace = e.relatedNode.namespaceURI;
+ var target = e.target;
+ var record = new getRecord("attributes", target);
+ record.attributeName = name;
+ record.attributeNamespace = namespace;
+ var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
+ if (!options.attributes) return;
+ if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
+ return;
+ }
+ if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
+ return record;
+ });
+ break;
+
+ case "DOMCharacterDataModified":
+ var target = e.target;
+ var record = getRecord("characterData", target);
+ var oldValue = e.prevValue;
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
+ if (!options.characterData) return;
+ if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
+ return record;
+ });
+ break;
+
+ case "DOMNodeRemoved":
+ this.addTransientObserver(e.target);
+
+ case "DOMNodeInserted":
+ var target = e.relatedNode;
+ var changedNode = e.target;
+ var addedNodes, removedNodes;
+ if (e.type === "DOMNodeInserted") {
+ addedNodes = [ changedNode ];
+ removedNodes = [];
+ } else {
+ addedNodes = [];
+ removedNodes = [ changedNode ];
+ }
+ var previousSibling = changedNode.previousSibling;
+ var nextSibling = changedNode.nextSibling;
+ var record = getRecord("childList", target);
+ record.addedNodes = addedNodes;
+ record.removedNodes = removedNodes;
+ record.previousSibling = previousSibling;
+ record.nextSibling = nextSibling;
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
+ if (!options.childList) return;
+ return record;
+ });
+ }
+ clearRecords();
+ }
+ };
+ global.JsMutationObserver = JsMutationObserver;
+ if (!global.MutationObserver && global.WebKitMutationObserver) global.MutationObserver = global.WebKitMutationObserver;
+ if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
})(this);
-/*
- * Copyright 2013 The Polymer Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-
-/**
- * Implements `document.register`
- * @module CustomElements
-*/
-
-/**
- * Polyfilled extensions to the `document` object.
- * @class Document
-*/
-
(function(scope) {
-
-// imports
-
-if (!scope) {
- scope = window.CustomElements = {flags:{}};
-}
-var flags = scope.flags;
-
-// native document.registerElement?
-
-var hasNative = Boolean(document.registerElement);
-var useNative = !flags.register && hasNative;
-
-if (useNative) {
-
- // stub
- var nop = function() {};
-
- // exports
- scope.registry = {};
- scope.upgradeElement = nop;
-
- scope.watchShadow = nop;
- scope.upgrade = nop;
- scope.upgradeAll = nop;
- scope.upgradeSubtree = nop;
- scope.observeDocument = nop;
- scope.upgradeDocument = nop;
- scope.takeRecords = nop;
-
-} else {
-
- /**
- * Registers a custom tag name with the document.
- *
- * When a registered element is created, a `readyCallback` method is called
- * in the scope of the element. The `readyCallback` method can be specified on
- * either `options.prototype` or `options.lifecycle` with the latter taking
- * precedence.
- *
- * @method register
- * @param {String} name The tag name to register. Must include a dash ('-'),
- * for example 'x-component'.
- * @param {Object} options
- * @param {String} [options.extends]
- * (_off spec_) Tag name of an element to extend (or blank for a new
- * element). This parameter is not part of the specification, but instead
- * is a hint for the polyfill because the extendee is difficult to infer.
- * Remember that the input prototype must chain to the extended element's
- * prototype (or HTMLElement.prototype) regardless of the value of
- * `extends`.
- * @param {Object} options.prototype The prototype to use for the new
- * element. The prototype must inherit from HTMLElement.
- * @param {Object} [options.lifecycle]
- * Callbacks that fire at important phases in the life of the custom
- * element.
- *
- * @example
- * FancyButton = document.registerElement("fancy-button", {
- * extends: 'button',
- * prototype: Object.create(HTMLButtonElement.prototype, {
- * readyCallback: {
- * value: function() {
- * console.log("a fancy-button was created",
- * }
- * }
- * })
- * });
- * @return {Function} Constructor for the newly registered type.
- */
- function register(name, options) {
- //console.warn('document.registerElement("' + name + '", ', options, ')');
- // construct a defintion out of options
- // TODO(sjmiles): probably should clone options instead of mutating it
- var definition = options || {};
- if (!name) {
- // TODO(sjmiles): replace with more appropriate error (EricB can probably
- // offer guidance)
- throw new Error('document.registerElement: first argument `name` must not be empty');
- }
- if (name.indexOf('-') < 0) {
- // TODO(sjmiles): replace with more appropriate error (EricB can probably
- // offer guidance)
- throw new Error('document.registerElement: first argument (\'name\') must contain a dash (\'-\'). Argument provided was \'' + String(name) + '\'.');
- }
- // elements may only be registered once
- if (getRegisteredDefinition(name)) {
- throw new Error('DuplicateDefinitionError: a type with name \'' + String(name) + '\' is already registered');
- }
- // must have a prototype, default to an extension of HTMLElement
- // TODO(sjmiles): probably should throw if no prototype, check spec
- if (!definition.prototype) {
- // TODO(sjmiles): replace with more appropriate error (EricB can probably
- // offer guidance)
- throw new Error('Options missing required prototype property');
- }
- // record name
- definition.__name = name.toLowerCase();
- // ensure a lifecycle object so we don't have to null test it
- definition.lifecycle = definition.lifecycle || {};
- // build a list of ancestral custom elements (for native base detection)
- // TODO(sjmiles): we used to need to store this, but current code only
- // uses it in 'resolveTagName': it should probably be inlined
- definition.ancestry = ancestry(definition.extends);
- // extensions of native specializations of HTMLElement require localName
- // to remain native, and use secondary 'is' specifier for extension type
- resolveTagName(definition);
- // some platforms require modifications to the user-supplied prototype
- // chain
- resolvePrototypeChain(definition);
- // overrides to implement attributeChanged callback
- overrideAttributeApi(definition.prototype);
- // 7.1.5: Register the DEFINITION with DOCUMENT
- registerDefinition(definition.__name, definition);
- // 7.1.7. Run custom element constructor generation algorithm with PROTOTYPE
- // 7.1.8. Return the output of the previous step.
- definition.ctor = generateConstructor(definition);
- definition.ctor.prototype = definition.prototype;
- // force our .constructor to be our actual constructor
- definition.prototype.constructor = definition.ctor;
- // if initial parsing is complete
- if (scope.ready) {
- // upgrade any pre-existing nodes of this type
- scope.upgradeAll(document);
- }
- return definition.ctor;
- }
-
- function ancestry(extnds) {
- var extendee = getRegisteredDefinition(extnds);
- if (extendee) {
- return ancestry(extendee.extends).concat([extendee]);
+ if (!scope) {
+ scope = window.CustomElements = {
+ flags: {}
+ };
}
- return [];
- }
-
- function resolveTagName(definition) {
- // if we are explicitly extending something, that thing is our
- // baseTag, unless it represents a custom component
- var baseTag = definition.extends;
- // if our ancestry includes custom components, we only have a
- // baseTag if one of them does
- for (var i=0, a; (a=definition.ancestry[i]); i++) {
- baseTag = a.is && a.tag;
- }
- // our tag is our baseTag, if it exists, and otherwise just our name
- definition.tag = baseTag || definition.__name;
- if (baseTag) {
- // if there is a base tag, use secondary 'is' specifier
- definition.is = definition.__name;
- }
- }
-
- function resolvePrototypeChain(definition) {
- // if we don't support __proto__ we need to locate the native level
- // prototype for precise mixing in
- if (!Object.__proto__) {
- // default prototype
- var nativePrototype = HTMLElement.prototype;
- // work out prototype when using type-extension
- if (definition.is) {
- var inst = document.createElement(definition.tag);
- nativePrototype = Object.getPrototypeOf(inst);
- }
- // ensure __proto__ reference is installed at each point on the prototype
- // chain.
- // NOTE: On platforms without __proto__, a mixin strategy is used instead
- // of prototype swizzling. In this case, this generated __proto__ provides
- // limited support for prototype traversal.
- var proto = definition.prototype, ancestor;
- while (proto && (proto !== nativePrototype)) {
- var ancestor = Object.getPrototypeOf(proto);
- proto.__proto__ = ancestor;
- proto = ancestor;
- }
- }
- // cache this in case of mixin
- definition.native = nativePrototype;
- }
-
- // SECTION 4
-
- function instantiate(definition) {
- // 4.a.1. Create a new object that implements PROTOTYPE
- // 4.a.2. Let ELEMENT by this new object
- //
- // the custom element instantiation algorithm must also ensure that the
- // output is a valid DOM element with the proper wrapper in place.
- //
- return upgrade(domCreateElement(definition.tag), definition);
- }
-
- function upgrade(element, definition) {
- // some definitions specify an 'is' attribute
- if (definition.is) {
- element.setAttribute('is', definition.is);
- }
- // remove 'unresolved' attr, which is a standin for :unresolved.
- element.removeAttribute('unresolved');
- // make 'element' implement definition.prototype
- implement(element, definition);
- // flag as upgraded
- element.__upgraded__ = true;
- // there should never be a shadow root on element at this point
- // we require child nodes be upgraded before `created`
- scope.upgradeSubtree(element);
- // lifecycle management
- created(element);
- // OUTPUT
- return element;
- }
-
- function implement(element, definition) {
- // prototype swizzling is best
- if (Object.__proto__) {
- element.__proto__ = definition.prototype;
+ var flags = scope.flags;
+ var hasNative = Boolean(document.registerElement);
+ var useNative = !flags.register && hasNative;
+ if (useNative) {
+ var nop = function() {};
+ scope.registry = {};
+ scope.upgradeElement = nop;
+ scope.watchShadow = nop;
+ scope.upgrade = nop;
+ scope.upgradeAll = nop;
+ scope.upgradeSubtree = nop;
+ scope.observeDocument = nop;
+ scope.upgradeDocument = nop;
+ scope.takeRecords = nop;
} else {
- // where above we can re-acquire inPrototype via
- // getPrototypeOf(Element), we cannot do so when
- // we use mixin, so we install a magic reference
- customMixin(element, definition.prototype, definition.native);
- element.__proto__ = definition.prototype;
+ function register(name, options) {
+ var definition = options || {};
+ if (!name) {
+ throw new Error("document.registerElement: first argument `name` must not be empty");
+ }
+ if (name.indexOf("-") < 0) {
+ throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
+ }
+ if (getRegisteredDefinition(name)) {
+ throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
+ }
+ if (!definition.prototype) {
+ throw new Error("Options missing required prototype property");
+ }
+ definition.__name = name.toLowerCase();
+ definition.lifecycle = definition.lifecycle || {};
+ definition.ancestry = ancestry(definition.extends);
+ resolveTagName(definition);
+ resolvePrototypeChain(definition);
+ overrideAttributeApi(definition.prototype);
+ registerDefinition(definition.__name, definition);
+ definition.ctor = generateConstructor(definition);
+ definition.ctor.prototype = definition.prototype;
+ definition.prototype.constructor = definition.ctor;
+ if (scope.ready) {
+ scope.upgradeAll(document);
+ }
+ return definition.ctor;
+ }
+ function ancestry(extnds) {
+ var extendee = getRegisteredDefinition(extnds);
+ if (extendee) {
+ return ancestry(extendee.extends).concat([ extendee ]);
+ }
+ return [];
+ }
+ function resolveTagName(definition) {
+ var baseTag = definition.extends;
+ for (var i = 0, a; a = definition.ancestry[i]; i++) {
+ baseTag = a.is && a.tag;
+ }
+ definition.tag = baseTag || definition.__name;
+ if (baseTag) {
+ definition.is = definition.__name;
+ }
+ }
+ function resolvePrototypeChain(definition) {
+ if (!Object.__proto__) {
+ var nativePrototype = HTMLElement.prototype;
+ if (definition.is) {
+ var inst = document.createElement(definition.tag);
+ nativePrototype = Object.getPrototypeOf(inst);
+ }
+ var proto = definition.prototype, ancestor;
+ while (proto && proto !== nativePrototype) {
+ var ancestor = Object.getPrototypeOf(proto);
+ proto.__proto__ = ancestor;
+ proto = ancestor;
+ }
+ }
+ definition.native = nativePrototype;
+ }
+ function instantiate(definition) {
+ return upgrade(domCreateElement(definition.tag), definition);
+ }
+ function upgrade(element, definition) {
+ if (definition.is) {
+ element.setAttribute("is", definition.is);
+ }
+ element.removeAttribute("unresolved");
+ implement(element, definition);
+ element.__upgraded__ = true;
+ scope.upgradeSubtree(element);
+ created(element);
+ return element;
+ }
+ function implement(element, definition) {
+ if (Object.__proto__) {
+ element.__proto__ = definition.prototype;
+ } else {
+ customMixin(element, definition.prototype, definition.native);
+ element.__proto__ = definition.prototype;
+ }
+ }
+ function customMixin(inTarget, inSrc, inNative) {
+ var used = {};
+ var p = inSrc;
+ while (p !== inNative && p !== HTMLUnknownElement.prototype) {
+ var keys = Object.getOwnPropertyNames(p);
+ for (var i = 0, k; k = keys[i]; i++) {
+ if (!used[k]) {
+ Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
+ used[k] = 1;
+ }
+ }
+ p = Object.getPrototypeOf(p);
+ }
+ }
+ function created(element) {
+ if (element.createdCallback) {
+ element.createdCallback();
+ }
+ }
+ function overrideAttributeApi(prototype) {
+ if (prototype.setAttribute._polyfilled) {
+ return;
+ }
+ var setAttribute = prototype.setAttribute;
+ prototype.setAttribute = function(name, value) {
+ changeAttribute.call(this, name, value, setAttribute);
+ };
+ var removeAttribute = prototype.removeAttribute;
+ prototype.removeAttribute = function(name) {
+ changeAttribute.call(this, name, null, removeAttribute);
+ };
+ prototype.setAttribute._polyfilled = true;
+ }
+ function changeAttribute(name, value, operation) {
+ var oldValue = this.getAttribute(name);
+ operation.apply(this, arguments);
+ var newValue = this.getAttribute(name);
+ if (this.attributeChangedCallback && newValue !== oldValue) {
+ this.attributeChangedCallback(name, oldValue, newValue);
+ }
+ }
+ var registry = {};
+ function getRegisteredDefinition(name) {
+ if (name) {
+ return registry[name.toLowerCase()];
+ }
+ }
+ function registerDefinition(name, definition) {
+ registry[name] = definition;
+ }
+ function generateConstructor(definition) {
+ return function() {
+ return instantiate(definition);
+ };
+ }
+ function createElement(tag, typeExtension) {
+ var definition = getRegisteredDefinition(typeExtension || tag);
+ if (definition) {
+ return new definition.ctor();
+ }
+ return domCreateElement(tag);
+ }
+ function upgradeElement(element) {
+ if (!element.__upgraded__ && element.nodeType === Node.ELEMENT_NODE) {
+ var type = element.getAttribute("is") || element.localName;
+ var definition = getRegisteredDefinition(type);
+ return definition && upgrade(element, definition);
+ }
+ }
+ function cloneNode(deep) {
+ var n = domCloneNode.call(this, deep);
+ scope.upgradeAll(n);
+ return n;
+ }
+ var domCreateElement = document.createElement.bind(document);
+ var domCloneNode = Node.prototype.cloneNode;
+ document.registerElement = register;
+ document.createElement = createElement;
+ Node.prototype.cloneNode = cloneNode;
+ scope.registry = registry;
+ scope.upgrade = upgradeElement;
}
- }
+ document.register = document.registerElement;
+ scope.hasNative = hasNative;
+ scope.useNative = useNative;
+})(window.CustomElements);
- function customMixin(inTarget, inSrc, inNative) {
- // TODO(sjmiles): 'used' allows us to only copy the 'youngest' version of
- // any property. This set should be precalculated. We also need to
- // consider this for supporting 'super'.
- var used = {};
- // start with inSrc
- var p = inSrc;
- // sometimes the default is HTMLUnknownElement.prototype instead of
- // HTMLElement.prototype, so we add a test
- // the idea is to avoid mixing in native prototypes, so adding
- // the second test is WLOG
- while (p !== inNative && p !== HTMLUnknownElement.prototype) {
- var keys = Object.getOwnPropertyNames(p);
- for (var i=0, k; k=keys[i]; i++) {
- if (!used[k]) {
- Object.defineProperty(inTarget, k,
- Object.getOwnPropertyDescriptor(p, k));
- used[k] = 1;
+(function(scope) {
+ var logFlags = window.logFlags || {};
+ function findAll(node, find, data) {
+ var e = node.firstElementChild;
+ if (!e) {
+ e = node.firstChild;
+ while (e && e.nodeType !== Node.ELEMENT_NODE) {
+ e = e.nextSibling;
+ }
}
- }
- p = Object.getPrototypeOf(p);
+ while (e) {
+ if (find(e, data) !== true) {
+ findAll(e, find, data);
+ }
+ e = e.nextElementSibling;
+ }
+ return null;
}
- }
-
- function created(element) {
- // invoke createdCallback
- if (element.createdCallback) {
- element.createdCallback();
+ function forRoots(node, cb) {
+ var root = node.shadowRoot;
+ while (root) {
+ forSubtree(root, cb);
+ root = root.olderShadowRoot;
+ }
}
- }
-
- // attribute watching
-
- function overrideAttributeApi(prototype) {
- // overrides to implement callbacks
- // TODO(sjmiles): should support access via .attributes NamedNodeMap
- // TODO(sjmiles): preserves user defined overrides, if any
- if (prototype.setAttribute._polyfilled) {
- return;
- }
- var setAttribute = prototype.setAttribute;
- prototype.setAttribute = function(name, value) {
- changeAttribute.call(this, name, value, setAttribute);
- }
- var removeAttribute = prototype.removeAttribute;
- prototype.removeAttribute = function(name) {
- changeAttribute.call(this, name, null, removeAttribute);
- }
- prototype.setAttribute._polyfilled = true;
- }
-
- // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/
- // index.html#dfn-attribute-changed-callback
- function changeAttribute(name, value, operation) {
- var oldValue = this.getAttribute(name);
- operation.apply(this, arguments);
- var newValue = this.getAttribute(name);
- if (this.attributeChangedCallback
- && (newValue !== oldValue)) {
- this.attributeChangedCallback(name, oldValue, newValue);
- }
- }
-
- // element registry (maps tag names to definitions)
-
- var registry = {};
-
- function getRegisteredDefinition(name) {
- if (name) {
- return registry[name.toLowerCase()];
+ function forSubtree(node, cb) {
+ findAll(node, function(e) {
+ if (cb(e)) {
+ return true;
+ }
+ forRoots(e, cb);
+ });
+ forRoots(node, cb);
}
- }
-
- function registerDefinition(name, definition) {
- registry[name] = definition;
- }
-
- function generateConstructor(definition) {
- return function() {
- return instantiate(definition);
- };
- }
-
- function createElement(tag, typeExtension) {
- // TODO(sjmiles): ignore 'tag' when using 'typeExtension', we could
- // error check it, or perhaps there should only ever be one argument
- var definition = getRegisteredDefinition(typeExtension || tag);
- if (definition) {
- return new definition.ctor();
- }
- return domCreateElement(tag);
- }
-
- function upgradeElement(element) {
- if (!element.__upgraded__ && (element.nodeType === Node.ELEMENT_NODE)) {
- var type = element.getAttribute('is') || element.localName;
- var definition = getRegisteredDefinition(type);
- return definition && upgrade(element, definition);
+ function added(node) {
+ if (upgrade(node)) {
+ insertedNode(node);
+ return true;
+ }
+ inserted(node);
}
- }
-
- function cloneNode(deep) {
- // call original clone
- var n = domCloneNode.call(this, deep);
- // upgrade the element and subtree
- scope.upgradeAll(n);
- // return the clone
- return n;
- }
- // capture native createElement before we override it
-
- var domCreateElement = document.createElement.bind(document);
-
- // capture native cloneNode before we override it
-
- var domCloneNode = Node.prototype.cloneNode;
-
- // exports
-
- document.registerElement = register;
- document.createElement = createElement; // override
- Node.prototype.cloneNode = cloneNode; // override
-
- scope.registry = registry;
-
- /**
- * Upgrade an element to a custom element. Upgrading an element
- * causes the custom prototype to be applied, an `is` attribute
- * to be attached (as needed), and invocation of the `readyCallback`.
- * `upgrade` does nothing if the element is already upgraded, or
- * if it matches no registered custom tag name.
- *
- * @method ugprade
- * @param {Element} element The element to upgrade.
- * @return {Element} The upgraded element.
- */
- scope.upgrade = upgradeElement;
-}
-
-// bc
-document.register = document.registerElement;
-
-scope.hasNative = hasNative;
-scope.useNative = useNative;
-
+ function addedSubtree(node) {
+ forSubtree(node, function(e) {
+ if (added(e)) {
+ return true;
+ }
+ });
+ }
+ function addedNode(node) {
+ return added(node) || addedSubtree(node);
+ }
+ function upgrade(node) {
+ if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
+ var type = node.getAttribute("is") || node.localName;
+ var definition = scope.registry[type];
+ if (definition) {
+ logFlags.dom && console.group("upgrade:", node.localName);
+ scope.upgrade(node);
+ logFlags.dom && console.groupEnd();
+ return true;
+ }
+ }
+ }
+ function insertedNode(node) {
+ inserted(node);
+ if (inDocument(node)) {
+ forSubtree(node, function(e) {
+ inserted(e);
+ });
+ }
+ }
+ var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
+ scope.hasPolyfillMutations = hasPolyfillMutations;
+ var isPendingMutations = false;
+ var pendingMutations = [];
+ function deferMutation(fn) {
+ pendingMutations.push(fn);
+ if (!isPendingMutations) {
+ isPendingMutations = true;
+ var async = window.Platform && window.Platform.endOfMicrotask || setTimeout;
+ async(takeMutations);
+ }
+ }
+ function takeMutations() {
+ isPendingMutations = false;
+ var $p = pendingMutations;
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
+ p();
+ }
+ pendingMutations = [];
+ }
+ function inserted(element) {
+ if (hasPolyfillMutations) {
+ deferMutation(function() {
+ _inserted(element);
+ });
+ } else {
+ _inserted(element);
+ }
+ }
+ function _inserted(element) {
+ if (element.attachedCallback || element.detachedCallback || element.__upgraded__ && logFlags.dom) {
+ logFlags.dom && console.group("inserted:", element.localName);
+ if (inDocument(element)) {
+ element.__inserted = (element.__inserted || 0) + 1;
+ if (element.__inserted < 1) {
+ element.__inserted = 1;
+ }
+ if (element.__inserted > 1) {
+ logFlags.dom && console.warn("inserted:", element.localName, "insert/remove count:", element.__inserted);
+ } else if (element.attachedCallback) {
+ logFlags.dom && console.log("inserted:", element.localName);
+ element.attachedCallback();
+ }
+ }
+ logFlags.dom && console.groupEnd();
+ }
+ }
+ function removedNode(node) {
+ removed(node);
+ forSubtree(node, function(e) {
+ removed(e);
+ });
+ }
+ function removed(element) {
+ if (hasPolyfillMutations) {
+ deferMutation(function() {
+ _removed(element);
+ });
+ } else {
+ _removed(element);
+ }
+ }
+ function _removed(element) {
+ if (element.attachedCallback || element.detachedCallback || element.__upgraded__ && logFlags.dom) {
+ logFlags.dom && console.group("removed:", element.localName);
+ if (!inDocument(element)) {
+ element.__inserted = (element.__inserted || 0) - 1;
+ if (element.__inserted > 0) {
+ element.__inserted = 0;
+ }
+ if (element.__inserted < 0) {
+ logFlags.dom && console.warn("removed:", element.localName, "insert/remove count:", element.__inserted);
+ } else if (element.detachedCallback) {
+ element.detachedCallback();
+ }
+ }
+ logFlags.dom && console.groupEnd();
+ }
+ }
+ function inDocument(element) {
+ var p = element;
+ var doc = window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(document) || document;
+ while (p) {
+ if (p == doc) {
+ return true;
+ }
+ p = p.parentNode || p.host;
+ }
+ }
+ function watchShadow(node) {
+ if (node.shadowRoot && !node.shadowRoot.__watched) {
+ logFlags.dom && console.log("watching shadow-root for: ", node.localName);
+ var root = node.shadowRoot;
+ while (root) {
+ watchRoot(root);
+ root = root.olderShadowRoot;
+ }
+ }
+ }
+ function watchRoot(root) {
+ if (!root.__watched) {
+ observe(root);
+ root.__watched = true;
+ }
+ }
+ function handler(mutations) {
+ if (logFlags.dom) {
+ var mx = mutations[0];
+ if (mx && mx.type === "childList" && mx.addedNodes) {
+ if (mx.addedNodes) {
+ var d = mx.addedNodes[0];
+ while (d && d !== document && !d.host) {
+ d = d.parentNode;
+ }
+ var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
+ u = u.split("/?").shift().split("/").pop();
+ }
+ }
+ console.group("mutations (%d) [%s]", mutations.length, u || "");
+ }
+ mutations.forEach(function(mx) {
+ if (mx.type === "childList") {
+ forEach(mx.addedNodes, function(n) {
+ if (!n.localName) {
+ return;
+ }
+ addedNode(n);
+ });
+ forEach(mx.removedNodes, function(n) {
+ if (!n.localName) {
+ return;
+ }
+ removedNode(n);
+ });
+ }
+ });
+ logFlags.dom && console.groupEnd();
+ }
+ var observer = new MutationObserver(handler);
+ function takeRecords() {
+ handler(observer.takeRecords());
+ takeMutations();
+ }
+ var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
+ function observe(inRoot) {
+ observer.observe(inRoot, {
+ childList: true,
+ subtree: true
+ });
+ }
+ function observeDocument(document) {
+ observe(document);
+ }
+ function upgradeDocument(document) {
+ logFlags.dom && console.group("upgradeDocument: ", (document.URL || document._URL || "").split("/").pop());
+ addedNode(document);
+ logFlags.dom && console.groupEnd();
+ }
+ scope.watchShadow = watchShadow;
+ scope.upgradeAll = addedNode;
+ scope.upgradeSubtree = addedSubtree;
+ scope.observeDocument = observeDocument;
+ scope.upgradeDocument = upgradeDocument;
+ scope.takeRecords = takeRecords;
})(window.CustomElements);
- /*
-Copyright 2013 The Polymer Authors. All rights reserved.
-Use of this source code is governed by a BSD-style
-license that can be found in the LICENSE file.
-*/
-
-(function(scope){
-
-var logFlags = window.logFlags || {};
-
-// walk the subtree rooted at node, applying 'find(element, data)' function
-// to each element
-// if 'find' returns true for 'element', do not search element's subtree
-function findAll(node, find, data) {
- var e = node.firstElementChild;
- if (!e) {
- e = node.firstChild;
- while (e && e.nodeType !== Node.ELEMENT_NODE) {
- e = e.nextSibling;
- }
- }
- while (e) {
- if (find(e, data) !== true) {
- findAll(e, find, data);
- }
- e = e.nextElementSibling;
- }
- return null;
-}
-
-// walk all shadowRoots on a given node.
-function forRoots(node, cb) {
- var root = node.shadowRoot;
- while(root) {
- forSubtree(root, cb);
- root = root.olderShadowRoot;
- }
-}
-
-// walk the subtree rooted at node, including descent into shadow-roots,
-// applying 'cb' to each element
-function forSubtree(node, cb) {
- //logFlags.dom && node.childNodes && node.childNodes.length && console.group('subTree: ', node);
- findAll(node, function(e) {
- if (cb(e)) {
- return true;
- }
- forRoots(e, cb);
- });
- forRoots(node, cb);
- //logFlags.dom && node.childNodes && node.childNodes.length && console.groupEnd();
-}
-
-// manage lifecycle on added node
-function added(node) {
- if (upgrade(node)) {
- insertedNode(node);
- return true;
- }
- inserted(node);
-}
-
-// manage lifecycle on added node's subtree only
-function addedSubtree(node) {
- forSubtree(node, function(e) {
- if (added(e)) {
- return true;
- }
- });
-}
-
-// manage lifecycle on added node and it's subtree
-function addedNode(node) {
- return added(node) || addedSubtree(node);
-}
-
-// upgrade custom elements at node, if applicable
-function upgrade(node) {
- if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
- var type = node.getAttribute('is') || node.localName;
- var definition = scope.registry[type];
- if (definition) {
- logFlags.dom && console.group('upgrade:', node.localName);
- scope.upgrade(node);
- logFlags.dom && console.groupEnd();
- return true;
- }
- }
-}
-
-function insertedNode(node) {
- inserted(node);
- if (inDocument(node)) {
- forSubtree(node, function(e) {
- inserted(e);
- });
- }
-}
-
-
-// TODO(sorvell): on platforms without MutationObserver, mutations may not be
-// reliable and therefore attached/detached are not reliable.
-// To make these callbacks less likely to fail, we defer all inserts and removes
-// to give a chance for elements to be inserted into dom.
-// This ensures attachedCallback fires for elements that are created and
-// immediately added to dom.
-var hasPolyfillMutations = (!window.MutationObserver ||
- (window.MutationObserver === window.JsMutationObserver));
-scope.hasPolyfillMutations = hasPolyfillMutations;
-
-var isPendingMutations = false;
-var pendingMutations = [];
-function deferMutation(fn) {
- pendingMutations.push(fn);
- if (!isPendingMutations) {
- isPendingMutations = true;
- var async = (window.Platform && window.Platform.endOfMicrotask) ||
- setTimeout;
- async(takeMutations);
- }
-}
-
-function takeMutations() {
- isPendingMutations = false;
- var $p = pendingMutations;
- for (var i=0, l=$p.length, p; (i 1) {
- logFlags.dom && console.warn('inserted:', element.localName,
- 'insert/remove count:', element.__inserted)
- } else if (element.attachedCallback) {
- logFlags.dom && console.log('inserted:', element.localName);
- element.attachedCallback();
- }
- }
- logFlags.dom && console.groupEnd();
- }
-}
-
-function removedNode(node) {
- removed(node);
- forSubtree(node, function(e) {
- removed(e);
- });
-}
-
-
-function removed(element) {
- if (hasPolyfillMutations) {
- deferMutation(function() {
- _removed(element);
- });
- } else {
- _removed(element);
- }
-}
-
-function _removed(element) {
- // TODO(sjmiles): temporary: do work on all custom elements so we can track
- // behavior even when callbacks not defined
- if (element.attachedCallback || element.detachedCallback || (element.__upgraded__ && logFlags.dom)) {
- logFlags.dom && console.group('removed:', element.localName);
- if (!inDocument(element)) {
- element.__inserted = (element.__inserted || 0) - 1;
- // if we are in a 'inserted' state, bluntly adjust to an 'removed' state
- if (element.__inserted > 0) {
- element.__inserted = 0;
- }
- // if we are 'over removed', squelch the callback
- if (element.__inserted < 0) {
- logFlags.dom && console.warn('removed:', element.localName,
- 'insert/remove count:', element.__inserted)
- } else if (element.detachedCallback) {
- element.detachedCallback();
- }
- }
- logFlags.dom && console.groupEnd();
- }
-}
-
-function inDocument(element) {
- var p = element;
- var doc = window.ShadowDOMPolyfill &&
- window.ShadowDOMPolyfill.wrapIfNeeded(document) || document;
- while (p) {
- if (p == doc) {
- return true;
- }
- p = p.parentNode || p.host;
- }
-}
-
-function watchShadow(node) {
- if (node.shadowRoot && !node.shadowRoot.__watched) {
- logFlags.dom && console.log('watching shadow-root for: ', node.localName);
- // watch all unwatched roots...
- var root = node.shadowRoot;
- while (root) {
- watchRoot(root);
- root = root.olderShadowRoot;
- }
- }
-}
-
-function watchRoot(root) {
- if (!root.__watched) {
- observe(root);
- root.__watched = true;
- }
-}
-
-function handler(mutations) {
- //
- if (logFlags.dom) {
- var mx = mutations[0];
- if (mx && mx.type === 'childList' && mx.addedNodes) {
- if (mx.addedNodes) {
- var d = mx.addedNodes[0];
- while (d && d !== document && !d.host) {
- d = d.parentNode;
- }
- var u = d && (d.URL || d._URL || (d.host && d.host.localName)) || '';
- u = u.split('/?').shift().split('/').pop();
- }
- }
- console.group('mutations (%d) [%s]', mutations.length, u || '');
- }
- //
- mutations.forEach(function(mx) {
- //logFlags.dom && console.group('mutation');
- if (mx.type === 'childList') {
- forEach(mx.addedNodes, function(n) {
- //logFlags.dom && console.log(n.localName);
- if (!n.localName) {
- return;
- }
- // nodes added may need lifecycle management
- addedNode(n);
- });
- // removed nodes may need lifecycle management
- forEach(mx.removedNodes, function(n) {
- //logFlags.dom && console.log(n.localName);
- if (!n.localName) {
- return;
- }
- removedNode(n);
- });
- }
- //logFlags.dom && console.groupEnd();
- });
- logFlags.dom && console.groupEnd();
-};
-
-var observer = new MutationObserver(handler);
-
-function takeRecords() {
- // TODO(sjmiles): ask Raf why we have to call handler ourselves
- handler(observer.takeRecords());
- takeMutations();
-}
-
-var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
-
-function observe(inRoot) {
- observer.observe(inRoot, {childList: true, subtree: true});
-}
-
-function observeDocument(document) {
- observe(document);
-}
-
-function upgradeDocument(document) {
- logFlags.dom && console.group('upgradeDocument: ', (document.URL || document._URL || '').split('/').pop());
- addedNode(document);
- logFlags.dom && console.groupEnd();
-}
-
-// exports
-
-scope.watchShadow = watchShadow;
-scope.upgradeAll = addedNode;
-scope.upgradeSubtree = addedSubtree;
-
-scope.observeDocument = observeDocument;
-scope.upgradeDocument = upgradeDocument;
-
-scope.takeRecords = takeRecords;
-
-})(window.CustomElements);
-
-/*
- * Copyright 2013 The Polymer Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-
(function() {
-
-// import
-
-var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : 'none';
-
-// highlander object for parsing a document tree
-
-var parser = {
- selectors: [
- 'link[rel=' + IMPORT_LINK_TYPE + ']'
- ],
- map: {
- link: 'parseLink'
- },
- parse: function(inDocument) {
- if (!inDocument.__parsed) {
- // only parse once
- inDocument.__parsed = true;
- // all parsable elements in inDocument (depth-first pre-order traversal)
- var elts = inDocument.querySelectorAll(parser.selectors);
- // for each parsable node type, call the mapped parsing method
- forEach(elts, function(e) {
- parser[parser.map[e.localName]](e);
- });
- // upgrade all upgradeable static elements, anything dynamically
- // created should be caught by observer
- CustomElements.upgradeDocument(inDocument);
- // observe document for dom changes
- CustomElements.observeDocument(inDocument);
- }
- },
- parseLink: function(linkElt) {
- // imports
- if (isDocumentLink(linkElt)) {
- this.parseImport(linkElt);
- }
- },
- parseImport: function(linkElt) {
- if (linkElt.content) {
- parser.parse(linkElt.content);
- }
- }
-};
-
-function isDocumentLink(inElt) {
- return (inElt.localName === 'link'
- && inElt.getAttribute('rel') === IMPORT_LINK_TYPE);
-}
-
-var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
-
-// exports
-
-CustomElements.parser = parser;
-
+ var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
+ var parser = {
+ selectors: [ "link[rel=" + IMPORT_LINK_TYPE + "]" ],
+ map: {
+ link: "parseLink"
+ },
+ parse: function(inDocument) {
+ if (!inDocument.__parsed) {
+ inDocument.__parsed = true;
+ var elts = inDocument.querySelectorAll(parser.selectors);
+ forEach(elts, function(e) {
+ parser[parser.map[e.localName]](e);
+ });
+ CustomElements.upgradeDocument(inDocument);
+ CustomElements.observeDocument(inDocument);
+ }
+ },
+ parseLink: function(linkElt) {
+ if (isDocumentLink(linkElt)) {
+ this.parseImport(linkElt);
+ }
+ },
+ parseImport: function(linkElt) {
+ if (linkElt.content) {
+ parser.parse(linkElt.content);
+ }
+ }
+ };
+ function isDocumentLink(inElt) {
+ return inElt.localName === "link" && inElt.getAttribute("rel") === IMPORT_LINK_TYPE;
+ }
+ var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
+ CustomElements.parser = parser;
})();
-/*
- * Copyright 2013 The Polymer Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-(function(scope){
-
-// bootstrap parsing
-function bootstrap() {
- // parse document
- CustomElements.parser.parse(document);
- // one more pass before register is 'live'
- CustomElements.upgradeDocument(document);
- // choose async
- var async = window.Platform && Platform.endOfMicrotask ?
- Platform.endOfMicrotask :
- setTimeout;
- async(function() {
- // set internal 'ready' flag, now document.registerElement will trigger
- // synchronous upgrades
- CustomElements.ready = true;
- // capture blunt profiling data
- CustomElements.readyTime = Date.now();
- if (window.HTMLImports) {
- CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
- }
- // notify the system that we are bootstrapped
- document.dispatchEvent(
- new CustomEvent('WebComponentsReady', {bubbles: true})
- );
- });
-}
-
-// CustomEvent shim for IE
-if (typeof window.CustomEvent !== 'function') {
- window.CustomEvent = function(inType) {
- var e = document.createEvent('HTMLEvents');
- e.initEvent(inType, true, true);
- return e;
- };
-}
-
-// When loading at readyState complete time (or via flag), boot custom elements
-// immediately.
-// If relevant, HTMLImports must already be loaded.
-if (document.readyState === 'complete' || scope.flags.eager) {
- bootstrap();
-// When loading at readyState interactive time, bootstrap only if HTMLImports
-// are not pending. Also avoid IE as the semantics of this state are unreliable.
-} else if (document.readyState === 'interactive' && !window.attachEvent &&
- (!window.HTMLImports || window.HTMLImports.ready)) {
- bootstrap();
-// When loading at other readyStates, wait for the appropriate DOM event to
-// bootstrap.
-} else {
- var loadEvent = window.HTMLImports && !HTMLImports.ready ?
- 'HTMLImportsLoaded' : 'DOMContentLoaded';
- window.addEventListener(loadEvent, bootstrap);
-}
+(function(scope) {
+ function bootstrap() {
+ CustomElements.parser.parse(document);
+ CustomElements.upgradeDocument(document);
+ var async = window.Platform && Platform.endOfMicrotask ? Platform.endOfMicrotask : setTimeout;
+ async(function() {
+ CustomElements.ready = true;
+ CustomElements.readyTime = Date.now();
+ if (window.HTMLImports) {
+ CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
+ }
+ document.dispatchEvent(new CustomEvent("WebComponentsReady", {
+ bubbles: true
+ }));
+ });
+ }
+ if (typeof window.CustomEvent !== "function") {
+ window.CustomEvent = function(inType) {
+ var e = document.createEvent("HTMLEvents");
+ e.initEvent(inType, true, true);
+ return e;
+ };
+ }
+ if (document.readyState === "complete" || scope.flags.eager) {
+ bootstrap();
+ } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
+ bootstrap();
+ } else {
+ var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
+ window.addEventListener(loadEvent, bootstrap);
+ }
})(window.CustomElements);
-
-(function () {
-
-/*** Variables ***/
-
- var win = window,
- doc = document,
- container = doc.createElement('div'),
- noop = function(){},
- trueop = function(){ return true; },
- regexPseudoSplit = /([\w-]+(?:\([^\)]+\))?)/g,
- regexPseudoReplace = /(\w*)(?:\(([^\)]*)\))?/,
- regexDigits = /(\d+)/g,
- keypseudo = {
- action: function (pseudo, event) {
- return pseudo.value.match(regexDigits).indexOf(String(event.keyCode)) > -1 == (pseudo.name == 'keypass') || null;
- }
- },
- prefix = (function () {
- var styles = win.getComputedStyle(doc.documentElement, ''),
- pre = (Array.prototype.slice
- .call(styles)
- .join('')
- .match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])
- )[1];
- return {
- dom: pre == 'ms' ? 'MS' : pre,
- lowercase: pre,
- css: '-' + pre + '-',
- js: pre == 'ms' ? pre : pre[0].toUpperCase() + pre.substr(1)
- };
- })(),
- matchSelector = Element.prototype.matchesSelector || Element.prototype[prefix.lowercase + 'MatchesSelector'],
- mutation = win.MutationObserver || win[prefix.js + 'MutationObserver'];
-
-/*** Functions ***/
-
-// Utilities
-
- var typeCache = {},
- typeString = typeCache.toString,
- typeRegexp = /\s([a-zA-Z]+)/;
- function typeOf(obj) {
- var type = typeString.call(obj);
- return typeCache[type] || (typeCache[type] = type.match(typeRegexp)[1].toLowerCase());
- }
-
- function clone(item, type){
- var fn = clone[type || typeOf(item)];
- return fn ? fn(item) : item;
- }
- clone.object = function(src){
- var obj = {};
- for (var key in src) obj[key] = clone(src[key]);
- return obj;
- };
- clone.array = function(src){
- var i = src.length, array = new Array(i);
- while (i--) array[i] = clone(src[i]);
- return array;
- };
-
- var unsliceable = ['undefined', 'null', 'number', 'boolean', 'string', 'function'];
- function toArray(obj){
- return unsliceable.indexOf(typeOf(obj)) == -1 ?
- Array.prototype.slice.call(obj, 0) :
- [obj];
- }
-
-// DOM
-
- var str = '';
- function query(element, selector){
- return (selector || str).length ? toArray(element.querySelectorAll(selector)) : [];
- }
-
- function parseMutations(element, mutations) {
- var diff = { added: [], removed: [] };
- mutations.forEach(function(record){
- record._mutation = true;
- for (var z in diff) {
- var type = element._records[(z == 'added') ? 'inserted' : 'removed'],
- nodes = record[z + 'Nodes'], length = nodes.length;
- for (var i = 0; i < length && diff[z].indexOf(nodes[i]) == -1; i++){
- diff[z].push(nodes[i]);
- type.forEach(function(fn){
- fn(nodes[i], record);
- });
- }
- }
- });
- }
-
-// Mixins
-
- function mergeOne(source, key, current){
- var type = typeOf(current);
- if (type == 'object' && typeOf(source[key]) == 'object') xtag.merge(source[key], current);
- else source[key] = clone(current, type);
- return source;
- }
-
- function wrapMixin(tag, key, pseudo, value, original){
- var fn = original[key];
- if (!(key in original)) original[key] = value;
- else if (typeof original[key] == 'function') {
- if (!fn.__mixins__) fn.__mixins__ = [];
- fn.__mixins__.push(xtag.applyPseudos(pseudo, value, tag.pseudos));
- }
- }
-
- var uniqueMixinCount = 0;
- function mergeMixin(tag, mixin, original, mix) {
- if (mix) {
- var uniques = {};
- for (var z in original) uniques[z.split(':')[0]] = z;
- for (z in mixin) {
- wrapMixin(tag, uniques[z.split(':')[0]] || z, z, mixin[z], original);
- }
- }
- else {
- for (var zz in mixin){
- original[zz + ':__mixin__(' + (uniqueMixinCount++) + ')'] = xtag.applyPseudos(zz, mixin[zz], tag.pseudos);
- }
- }
- }
-
- function applyMixins(tag) {
- tag.mixins.forEach(function (name) {
- var mixin = xtag.mixins[name];
- for (var type in mixin) {
- var item = mixin[type],
- original = tag[type];
- if (!original) tag[type] = item;
- else {
- switch (type){
- case 'accessors': case 'prototype':
- for (var z in item) {
- if (!original[z]) original[z] = item[z];
- else mergeMixin(tag, item[z], original[z], true);
- }
- break;
- default: mergeMixin(tag, item, original, type != 'events');
- }
- }
- }
- });
- return tag;
- }
-
-// Events
-
- function delegateAction(pseudo, event) {
- var match, target = event.target;
- if (!target.tagName) return null;
- if (xtag.matchSelector(target, pseudo.value)) match = target;
- else if (xtag.matchSelector(target, pseudo.value + ' *')) {
- var parent = target.parentNode;
- while (!match) {
- if (xtag.matchSelector(parent, pseudo.value)) match = parent;
- parent = parent.parentNode;
- }
- }
- return match ? pseudo.listener = pseudo.listener.bind(match) : null;
- }
-
- function touchFilter(event) {
- if (event.type.match('touch')){
- event.target.__touched__ = true;
- }
- else if (event.target.__touched__ && event.type.match('mouse')){
- delete event.target.__touched__;
- return;
- }
- return true;
- }
-
- function createFlowEvent(type) {
- var flow = type == 'over';
- return {
- attach: 'OverflowEvent' in win ? 'overflowchanged' : [],
- condition: function (event, custom) {
- event.flow = type;
- return event.type == (type + 'flow') ||
- ((event.orient === 0 && event.horizontalOverflow == flow) ||
- (event.orient == 1 && event.verticalOverflow == flow) ||
- (event.orient == 2 && event.horizontalOverflow == flow && event.verticalOverflow == flow));
- }
- };
- }
-
- function writeProperty(key, event, base, desc){
- if (desc) event[key] = base[key];
- else Object.defineProperty(event, key, {
- writable: true,
- enumerable: true,
- value: base[key]
- });
- }
-
- var skipProps = {};
- for (var z in doc.createEvent('CustomEvent')) skipProps[z] = 1;
- function inheritEvent(event, base){
- var desc = Object.getOwnPropertyDescriptor(event, 'target');
- for (var z in base) {
- if (!skipProps[z]) writeProperty(z, event, base, desc);
- }
- event.baseEvent = base;
- }
-
-// Accessors
-
- function getArgs(attr, value){
- return {
- value: attr.boolean ? '' : value,
- method: attr.boolean && !value ? 'removeAttribute' : 'setAttribute'
- };
- }
-
- function modAttr(element, attr, name, value){
- var args = getArgs(attr, value);
- element[args.method](name, args.value);
- }
-
- function syncAttr(element, attr, name, value, method){
- var nodes = attr.property ? [element.xtag[attr.property]] : attr.selector ? xtag.query(element, attr.selector) : [],
- index = nodes.length;
- while (index--) nodes[index][method](name, value);
- }
-
- function updateView(element, name, value){
- if (element.__view__){
- element.__view__.updateBindingValue(element, name, value);
- }
- }
-
- function attachProperties(tag, prop, z, accessor, attr, name){
- var key = z.split(':'), type = key[0];
- if (type == 'get') {
- key[0] = prop;
- tag.prototype[prop].get = xtag.applyPseudos(key.join(':'), accessor[z], tag.pseudos, accessor[z]);
- }
- else if (type == 'set') {
- key[0] = prop;
- var setter = tag.prototype[prop].set = xtag.applyPseudos(key.join(':'), attr ? function(value){
- this.xtag._skipSet = true;
- if (!this.xtag._skipAttr) modAttr(this, attr, name, value);
- if (this.xtag._skipAttr && attr.skip) delete this.xtag._skipAttr;
- accessor[z].call(this, attr.boolean ? !!value : value);
- updateView(this, name, value);
- delete this.xtag._skipSet;
- } : accessor[z] ? function(value){
- accessor[z].call(this, value);
- updateView(this, name, value);
- } : null, tag.pseudos, accessor[z]);
-
- if (attr) attr.setter = setter;
- }
- else tag.prototype[prop][z] = accessor[z];
- }
-
- function parseAccessor(tag, prop){
- tag.prototype[prop] = {};
- var accessor = tag.accessors[prop],
- attr = accessor.attribute,
- name = attr && attr.name ? attr.name.toLowerCase() : prop;
-
- if (attr) {
- attr.key = prop;
- tag.attributes[name] = attr;
- }
-
- for (var z in accessor) attachProperties(tag, prop, z, accessor, attr, name);
-
- if (attr) {
- if (!tag.prototype[prop].get) {
- var method = (attr.boolean ? 'has' : 'get') + 'Attribute';
- tag.prototype[prop].get = function(){
- return this[method](name);
- };
- }
- if (!tag.prototype[prop].set) tag.prototype[prop].set = function(value){
- modAttr(this, attr, name, value);
- updateView(this, name, value);
- };
- }
- }
-
- var readyTags = {};
- function fireReady(name){
- readyTags[name] = (readyTags[name] || []).filter(function(obj){
- return (obj.tags = obj.tags.filter(function(z){
- return z != name && !xtag.tags[z];
- })).length || obj.fn();
- });
- }
-
-/*** X-Tag Object Definition ***/
-
- var xtag = {
- tags: {},
- defaultOptions: {
- pseudos: [],
- mixins: [],
- events: {},
- methods: {},
- accessors: {},
- lifecycle: {},
- attributes: {},
- 'prototype': {
- xtag: {
- get: function(){
- return this.__xtag__ ? this.__xtag__ : (this.__xtag__ = { data: {} });
- }
- }
- }
- },
- register: function (name, options) {
- var _name;
- if (typeof name == 'string') {
- _name = name.toLowerCase();
- } else {
- return;
- }
-
- // save prototype for actual object creation below
- var basePrototype = options.prototype;
- delete options.prototype;
-
- var tag = xtag.tags[_name] = applyMixins(xtag.merge({}, xtag.defaultOptions, options));
-
- for (var z in tag.events) tag.events[z] = xtag.parseEvent(z, tag.events[z]);
- for (z in tag.lifecycle) tag.lifecycle[z.split(':')[0]] = xtag.applyPseudos(z, tag.lifecycle[z], tag.pseudos, tag.lifecycle[z]);
- for (z in tag.methods) tag.prototype[z.split(':')[0]] = { value: xtag.applyPseudos(z, tag.methods[z], tag.pseudos, tag.methods[z]), enumerable: true };
- for (z in tag.accessors) parseAccessor(tag, z);
-
- var ready = tag.lifecycle.created || tag.lifecycle.ready;
- tag.prototype.createdCallback = {
- enumerable: true,
- value: function(){
- var element = this;
- xtag.addEvents(this, tag.events);
- tag.mixins.forEach(function(mixin){
- if (xtag.mixins[mixin].events) xtag.addEvents(element, xtag.mixins[mixin].events);
- });
- var output = ready ? ready.apply(this, arguments) : null;
- for (var name in tag.attributes) {
- var attr = tag.attributes[name],
- hasAttr = this.hasAttribute(name);
- if (hasAttr || attr.boolean) {
- this[attr.key] = attr.boolean ? hasAttr : this.getAttribute(name);
- }
- }
- tag.pseudos.forEach(function(obj){
- obj.onAdd.call(element, obj);
- });
- return output;
- }
- };
-
- var inserted = tag.lifecycle.inserted,
- removed = tag.lifecycle.removed;
- if (inserted || removed) {
- tag.prototype.attachedCallback = { value: function(){
- if (removed) this.xtag.__parentNode__ = this.parentNode;
- if (inserted) return inserted.apply(this, arguments);
- }, enumerable: true };
- }
- if (removed) {
- tag.prototype.detachedCallback = { value: function(){
- var args = toArray(arguments);
- args.unshift(this.xtag.__parentNode__);
- var output = removed.apply(this, args);
- delete this.xtag.__parentNode__;
- return output;
- }, enumerable: true };
- }
- if (tag.lifecycle.attributeChanged) tag.prototype.attributeChangedCallback = { value: tag.lifecycle.attributeChanged, enumerable: true };
-
- var setAttribute = tag.prototype.setAttribute || HTMLElement.prototype.setAttribute;
- tag.prototype.setAttribute = {
- writable: true,
- enumberable: true,
- value: function (name, value){
- var attr = tag.attributes[name.toLowerCase()];
- if (!this.xtag._skipAttr) setAttribute.call(this, name, attr && attr.boolean ? '' : value);
- if (attr) {
- if (attr.setter && !this.xtag._skipSet) {
- this.xtag._skipAttr = true;
- attr.setter.call(this, attr.boolean ? true : value);
- }
- value = attr.skip ? attr.boolean ? this.hasAttribute(name) : this.getAttribute(name) : value;
- syncAttr(this, attr, name, attr.boolean ? '' : value, 'setAttribute');
- }
- delete this.xtag._skipAttr;
- }
- };
-
- var removeAttribute = tag.prototype.removeAttribute || HTMLElement.prototype.removeAttribute;
- tag.prototype.removeAttribute = {
- writable: true,
- enumberable: true,
- value: function (name){
- var attr = tag.attributes[name.toLowerCase()];
- if (!this.xtag._skipAttr) removeAttribute.call(this, name);
- if (attr) {
- if (attr.setter && !this.xtag._skipSet) {
- this.xtag._skipAttr = true;
- attr.setter.call(this, attr.boolean ? false : undefined);
- }
- syncAttr(this, attr, name, undefined, 'removeAttribute');
- }
- delete this.xtag._skipAttr;
- }
- };
-
- var elementProto = basePrototype ?
- basePrototype :
- options['extends'] ?
- Object.create(doc.createElement(options['extends']).constructor).prototype :
- win.HTMLElement.prototype;
-
- var definition = {
- 'prototype': Object.create(elementProto, tag.prototype)
- };
- if (options['extends']) {
- definition['extends'] = options['extends'];
- }
- var reg = doc.registerElement(_name, definition);
- fireReady(_name);
- return reg;
- },
-
- ready: function(names, fn){
- var obj = { tags: toArray(names), fn: fn };
- if (obj.tags.reduce(function(last, name){
- if (xtag.tags[name]) return last;
- (readyTags[name] = readyTags[name] || []).push(obj);
- }, true)) fn();
- },
-
- /* Exposed Variables */
-
- mixins: {},
- prefix: prefix,
- captureEvents: ['focus', 'blur', 'scroll', 'underflow', 'overflow', 'overflowchanged', 'DOMMouseScroll'],
- customEvents: {
- overflow: createFlowEvent('over'),
- underflow: createFlowEvent('under'),
- animationstart: {
- attach: [prefix.dom + 'AnimationStart']
- },
- animationend: {
- attach: [prefix.dom + 'AnimationEnd']
- },
- transitionend: {
- attach: [prefix.dom + 'TransitionEnd']
- },
- move: {
- attach: ['mousemove', 'touchmove'],
- condition: touchFilter
- },
- enter: {
- attach: ['mouseover', 'touchenter'],
- condition: touchFilter
- },
- leave: {
- attach: ['mouseout', 'touchleave'],
- condition: touchFilter
- },
- scrollwheel: {
- attach: ['DOMMouseScroll', 'mousewheel'],
- condition: function(event){
- event.delta = event.wheelDelta ? event.wheelDelta / 40 : Math.round(event.detail / 3.5 * -1);
- return true;
- }
- },
- tapstart: {
- observe: {
- mousedown: doc,
- touchstart: doc
- },
- condition: touchFilter
- },
- tapend: {
- observe: {
- mouseup: doc,
- touchend: doc
- },
- condition: touchFilter
- },
- tapmove: {
- attach: ['tapstart', 'dragend', 'touchcancel'],
- condition: function(event, custom){
- switch (event.type) {
- case 'move': return true;
- case 'dragover':
- var last = custom.lastDrag || {};
- custom.lastDrag = event;
- return (last.pageX != event.pageX && last.pageY != event.pageY) || null;
- case 'tapstart':
- if (!custom.move) {
- custom.current = this;
- custom.move = xtag.addEvents(this, {
- move: custom.listener,
- dragover: custom.listener
- });
- custom.tapend = xtag.addEvent(doc, 'tapend', custom.listener);
- }
- break;
- case 'tapend': case 'dragend': case 'touchcancel':
- if (!event.touches.length) {
- if (custom.move) xtag.removeEvents(custom.current , custom.move || {});
- if (custom.tapend) xtag.removeEvent(doc, custom.tapend || {});
- delete custom.lastDrag;
- delete custom.current;
- delete custom.tapend;
- delete custom.move;
- }
- }
- }
- }
- },
- pseudos: {
- __mixin__: {},
- mixins: {
- onCompiled: function(fn, pseudo){
- var mixins = pseudo.source.__mixins__;
- if (mixins) switch (pseudo.value) {
- case 'before': return function(){
- var self = this,
- args = arguments;
- mixins.forEach(function(m){
- m.apply(self, args);
- });
- return fn.apply(self, args);
- };
- case 'after': case null: return function(){
- var self = this,
- args = arguments;
- returns = fn.apply(self, args);
- mixins.forEach(function(m){
- m.apply(self, args);
- });
- return returns;
- };
- }
- }
- },
- keypass: keypseudo,
- keyfail: keypseudo,
- delegate: { action: delegateAction },
- within: {
- action: delegateAction,
- onAdd: function(pseudo){
- var condition = pseudo.source.condition;
- if (condition) pseudo.source.condition = function(event, custom){
- return xtag.query(this, pseudo.value).filter(function(node){
- return node == event.target || node.contains ? node.contains(event.target) : null;
- })[0] ? condition.call(this, event, custom) : null;
- };
- }
- },
- preventable: {
- action: function (pseudo, event) {
- return !event.defaultPrevented;
- }
- }
- },
-
- /* UTILITIES */
-
- clone: clone,
- typeOf: typeOf,
- toArray: toArray,
-
- wrap: function (original, fn) {
- return function(){
- var args = arguments,
- output = original.apply(this, args);
- fn.apply(this, args);
- return output;
- };
- },
-
- merge: function(source, k, v){
- if (typeOf(k) == 'string') return mergeOne(source, k, v);
- for (var i = 1, l = arguments.length; i < l; i++){
- var object = arguments[i];
- for (var key in object) mergeOne(source, key, object[key]);
- }
- return source;
- },
-
- uid: function(){
- return Math.random().toString(36).substr(2,10);
- },
-
- /* DOM */
-
- query: query,
-
- skipTransition: function(element, fn, bind){
- var prop = prefix.js + 'TransitionProperty';
- element.style[prop] = element.style.transitionProperty = 'none';
- var callback = fn ? fn.call(bind) : null;
- return xtag.requestFrame(function(){
- xtag.requestFrame(function(){
- element.style[prop] = element.style.transitionProperty = '';
- if (callback) xtag.requestFrame(callback);
- });
- });
- },
-
- requestFrame: (function(){
- var raf = win.requestAnimationFrame ||
- win[prefix.lowercase + 'RequestAnimationFrame'] ||
- function(fn){ return win.setTimeout(fn, 20); };
- return function(fn){ return raf(fn); };
- })(),
-
- cancelFrame: (function(){
- var cancel = win.cancelAnimationFrame ||
- win[prefix.lowercase + 'CancelAnimationFrame'] ||
- win.clearTimeout;
- return function(id){ return cancel(id); };
- })(),
-
- matchSelector: function (element, selector) {
- return matchSelector.call(element, selector);
- },
-
- set: function (element, method, value) {
- element[method] = value;
- if (window.CustomElements) CustomElements.upgradeAll(element);
- },
-
- innerHTML: function(el, html){
- xtag.set(el, 'innerHTML', html);
- },
-
- hasClass: function (element, klass) {
- return element.className.split(' ').indexOf(klass.trim())>-1;
- },
-
- addClass: function (element, klass) {
- var list = element.className.trim().split(' ');
- klass.trim().split(' ').forEach(function (name) {
- if (!~list.indexOf(name)) list.push(name);
- });
- element.className = list.join(' ').trim();
- return element;
- },
-
- removeClass: function (element, klass) {
- var classes = klass.trim().split(' ');
- element.className = element.className.trim().split(' ').filter(function (name) {
- return name && !~classes.indexOf(name);
- }).join(' ');
- return element;
- },
-
- toggleClass: function (element, klass) {
- return xtag[xtag.hasClass(element, klass) ? 'removeClass' : 'addClass'].call(null, element, klass);
- },
-
- queryChildren: function (element, selector) {
- var id = element.id,
- guid = element.id = id || 'x_' + xtag.uid(),
- attr = '#' + guid + ' > ',
- noParent = false;
- if (!element.parentNode){
- noParent = true;
- container.appendChild(element);
- }
- selector = attr + (selector + '').replace(',', ',' + attr, 'g');
- var result = element.parentNode.querySelectorAll(selector);
- if (!id) element.removeAttribute('id');
- if (noParent){
- container.removeChild(element);
- }
- return toArray(result);
- },
-
- createFragment: function(content) {
- var frag = doc.createDocumentFragment();
- if (content) {
- var div = frag.appendChild(doc.createElement('div')),
- nodes = toArray(content.nodeName ? arguments : !(div.innerHTML = content) || div.children),
- length = nodes.length,
- index = 0;
- while (index < length) frag.insertBefore(nodes[index++], div);
- frag.removeChild(div);
- }
- return frag;
- },
-
- manipulate: function(element, fn){
- var next = element.nextSibling,
- parent = element.parentNode,
- frag = doc.createDocumentFragment(),
- returned = fn.call(frag.appendChild(element), frag) || element;
- if (next) parent.insertBefore(returned, next);
- else parent.appendChild(returned);
- },
-
- /* PSEUDOS */
-
- applyPseudos: function(key, fn, target, source) {
- var listener = fn,
- pseudos = {};
- if (key.match(':')) {
- var split = key.match(regexPseudoSplit),
- i = split.length;
- while (--i) {
- split[i].replace(regexPseudoReplace, function (match, name, value) {
- if (!xtag.pseudos[name]) throw "pseudo not found: " + name + " " + split;
- value = (value === '' || typeof value == 'undefined') ? null : value;
- var pseudo = pseudos[i] = Object.create(xtag.pseudos[name]);
- pseudo.key = key;
- pseudo.name = name;
- pseudo.value = value;
- pseudo['arguments'] = (value || '').split(',');
- pseudo.action = pseudo.action || trueop;
- pseudo.source = source;
- var last = listener;
- listener = function(){
- var args = toArray(arguments),
- obj = {
- key: key,
- name: name,
- value: value,
- source: source,
- 'arguments': pseudo['arguments'],
- listener: last
- };
- var output = pseudo.action.apply(this, [obj].concat(args));
- if (output === null || output === false) return output;
- return obj.listener.apply(this, args);
- };
- if (target && pseudo.onAdd) {
- if (target.nodeName) pseudo.onAdd.call(target, pseudo);
- else target.push(pseudo);
- }
- });
- }
- }
- for (var z in pseudos) {
- if (pseudos[z].onCompiled) listener = pseudos[z].onCompiled(listener, pseudos[z]) || listener;
- }
- return listener;
- },
-
- removePseudos: function(target, pseudos){
- pseudos.forEach(function(obj){
- if (obj.onRemove) obj.onRemove.call(target, obj);
- });
- },
-
- /*** Events ***/
-
- parseEvent: function(type, fn) {
- var pseudos = type.split(':'),
- key = pseudos.shift(),
- custom = xtag.customEvents[key],
- event = xtag.merge({
- type: key,
- stack: noop,
- condition: trueop,
- attach: [],
- _attach: [],
- pseudos: '',
- _pseudos: [],
- onAdd: noop,
- onRemove: noop
- }, custom || {});
- event.attach = toArray(event.base || event.attach);
- event.chain = key + (event.pseudos.length ? ':' + event.pseudos : '') + (pseudos.length ? ':' + pseudos.join(':') : '');
- var condition = event.condition;
- event.condition = function(e){
- var t = e.touches, tt = e.targetTouches;
- return condition.apply(this, arguments);
- };
- var stack = xtag.applyPseudos(event.chain, fn, event._pseudos, event);
- event.stack = function(e){
- e.currentTarget = e.currentTarget || this;
- var t = e.touches, tt = e.targetTouches;
- var detail = e.detail || {};
- if (!detail.__stack__) return stack.apply(this, arguments);
- else if (detail.__stack__ == stack) {
- e.stopPropagation();
- e.cancelBubble = true;
- return stack.apply(this, arguments);
- }
- };
- event.listener = function(e){
- var args = toArray(arguments),
- output = event.condition.apply(this, args.concat([event]));
- if (!output) return output;
- if (e.type != key) {
- xtag.fireEvent(e.target, key, {
- baseEvent: e,
- detail: output !== true && (output.__stack__ = stack) ? output : { __stack__: stack }
- });
- }
- else return event.stack.apply(this, args);
- };
- event.attach.forEach(function(name) {
- event._attach.push(xtag.parseEvent(name, event.listener));
- });
- if (custom && custom.observe && !custom.__observing__) {
- custom.observer = function(e){
- var output = event.condition.apply(this, toArray(arguments).concat([custom]));
- if (!output) return output;
- xtag.fireEvent(e.target, key, {
- baseEvent: e,
- detail: output !== true ? output : {}
- });
- };
- for (var z in custom.observe) xtag.addEvent(custom.observe[z] || document, z, custom.observer, true);
- custom.__observing__ = true;
- }
- return event;
- },
-
- addEvent: function (element, type, fn, capture) {
- var event = typeof fn == 'function' ? xtag.parseEvent(type, fn) : fn;
- event._pseudos.forEach(function(obj){
- obj.onAdd.call(element, obj);
- });
- event._attach.forEach(function(obj) {
- xtag.addEvent(element, obj.type, obj);
- });
- event.onAdd.call(element, event, event.listener);
- element.addEventListener(event.type, event.stack, capture || xtag.captureEvents.indexOf(event.type) > -1);
- return event;
- },
-
- addEvents: function (element, obj) {
- var events = {};
- for (var z in obj) {
- events[z] = xtag.addEvent(element, z, obj[z]);
- }
- return events;
- },
-
- removeEvent: function (element, type, event) {
- event = event || type;
- event.onRemove.call(element, event, event.listener);
- xtag.removePseudos(element, event._pseudos);
- event._attach.forEach(function(obj) {
- xtag.removeEvent(element, obj);
- });
- element.removeEventListener(event.type, event.stack);
- },
-
- removeEvents: function(element, obj){
- for (var z in obj) xtag.removeEvent(element, obj[z]);
- },
-
- fireEvent: function(element, type, options, warn){
- var event = doc.createEvent('CustomEvent');
- options = options || {};
- if (warn) console.warn('fireEvent has been modified');
- event.initCustomEvent(type,
- options.bubbles !== false,
- options.cancelable !== false,
- options.detail
- );
- if (options.baseEvent) inheritEvent(event, options.baseEvent);
- try { element.dispatchEvent(event); }
- catch (e) {
- console.warn('This error may have been caused by a change in the fireEvent method', e);
- }
- },
-
- addObserver: function(element, type, fn){
- if (!element._records) {
- element._records = { inserted: [], removed: [] };
- if (mutation){
- element._observer = new mutation(function(mutations) {
- parseMutations(element, mutations);
- });
- element._observer.observe(element, {
- subtree: true,
- childList: true,
- attributes: !true,
- characterData: false
- });
- }
- else ['Inserted', 'Removed'].forEach(function(type){
- element.addEventListener('DOMNode' + type, function(event){
- event._mutation = true;
- element._records[type.toLowerCase()].forEach(function(fn){
- fn(event.target, event);
- });
- }, false);
- });
- }
- if (element._records[type].indexOf(fn) == -1) element._records[type].push(fn);
- },
-
- removeObserver: function(element, type, fn){
- var obj = element._records;
- if (obj && fn){
- obj[type].splice(obj[type].indexOf(fn), 1);
- }
- else{
- obj[type] = [];
- }
- }
-
- };
-
-/*** Universal Touch ***/
-
-var touching = false,
- touchTarget = null;
-
-doc.addEventListener('mousedown', function(e){
- touching = true;
- touchTarget = e.target;
-}, true);
-
-doc.addEventListener('mouseup', function(){
- touching = false;
- touchTarget = null;
-}, true);
-
-doc.addEventListener('dragend', function(){
- touching = false;
- touchTarget = null;
-}, true);
-
-var UIEventProto = {
- touches: {
- configurable: true,
- get: function(){
- return this.__touches__ ||
- (this.identifier = 0) ||
- (this.__touches__ = touching ? [this] : []);
- }
- },
- targetTouches: {
- configurable: true,
- get: function(){
- return this.__targetTouches__ || (this.__targetTouches__ =
- (touching && this.currentTarget &&
- (this.currentTarget == touchTarget ||
- (this.currentTarget.contains && this.currentTarget.contains(touchTarget)))) ? (this.identifier = 0) || [this] : []);
- }
- },
- changedTouches: {
- configurable: true,
- get: function(){
- return this.__changedTouches__ || (this.identifier = 0) || (this.__changedTouches__ = [this]);
- }
- }
-};
-
-for (z in UIEventProto){
- UIEvent.prototype[z] = UIEventProto[z];
- Object.defineProperty(UIEvent.prototype, z, UIEventProto[z]);
-}
-
-
-/*** Custom Event Definitions ***/
-
- function addTap(el, tap, e){
- if (!el.__tap__) {
- el.__tap__ = { click: e.type == 'mousedown' };
- if (el.__tap__.click) el.addEventListener('click', tap.observer);
- else {
- el.__tap__.scroll = tap.observer.bind(el);
- window.addEventListener('scroll', el.__tap__.scroll, true);
- el.addEventListener('touchmove', tap.observer);
- el.addEventListener('touchcancel', tap.observer);
- el.addEventListener('touchend', tap.observer);
- }
- }
- if (!el.__tap__.click) {
- el.__tap__.x = e.touches[0].pageX;
- el.__tap__.y = e.touches[0].pageY;
- }
- }
-
- function removeTap(el, tap){
- if (el.__tap__) {
- if (el.__tap__.click) el.removeEventListener('click', tap.observer);
- else {
- window.removeEventListener('scroll', el.__tap__.scroll, true);
- el.removeEventListener('touchmove', tap.observer);
- el.removeEventListener('touchcancel', tap.observer);
- el.removeEventListener('touchend', tap.observer);
- }
- delete el.__tap__;
- }
- }
-
- function checkTapPosition(el, tap, e){
- var touch = e.changedTouches[0],
- tol = tap.gesture.tolerance;
- if (
- touch.pageX < el.__tap__.x + tol &&
- touch.pageX > el.__tap__.x - tol &&
- touch.pageY < el.__tap__.y + tol &&
- touch.pageY > el.__tap__.y - tol
- ) return true;
- }
-
- xtag.customEvents.tap = {
- observe: {
- mousedown: document,
- touchstart: document
- },
- gesture: {
- tolerance: 8
- },
- condition: function(e, tap){
- var el = e.target;
- switch (e.type) {
- case 'touchstart':
- if (el.__tap__ && el.__tap__.click) removeTap(el, tap);
- addTap(el, tap, e);
- return;
- case 'mousedown':
- if (!el.__tap__) addTap(el, tap, e);
- return;
- case 'scroll':
- case 'touchcancel':
- removeTap(this, tap);
- return;
- case 'touchmove':
- case 'touchend':
- if (this.__tap__ && !checkTapPosition(this, tap, e)) {
- removeTap(this, tap);
- return;
- }
- return e.type == 'touchend' || null;
- case 'click':
- removeTap(this, tap);
- return true;
- }
- }
- };
-
- win.xtag = xtag;
- if (typeof define == 'function' && define.amd) define(xtag);
-
- doc.addEventListener('WebComponentsReady', function(){
- xtag.fireEvent(doc.body, 'DOMComponentsLoaded');
- });
-
-})();
+
+(function() {
+ var win = window, doc = document, container = doc.createElement("div"), noop = function() {}, trueop = function() {
+ return true;
+ }, regexPseudoSplit = /([\w-]+(?:\([^\)]+\))?)/g, regexPseudoReplace = /(\w*)(?:\(([^\)]*)\))?/, regexDigits = /(\d+)/g, keypseudo = {
+ action: function(pseudo, event) {
+ return pseudo.value.match(regexDigits).indexOf(String(event.keyCode)) > -1 == (pseudo.name == "keypass") || null;
+ }
+ }, prefix = function() {
+ var styles = win.getComputedStyle(doc.documentElement, ""), pre = (Array.prototype.slice.call(styles).join("").match(/-(moz|webkit|ms)-/) || styles.OLink === "" && [ "", "o" ])[1];
+ return {
+ dom: pre == "ms" ? "MS" : pre,
+ lowercase: pre,
+ css: "-" + pre + "-",
+ js: pre == "ms" ? pre : pre[0].toUpperCase() + pre.substr(1)
+ };
+ }(), matchSelector = Element.prototype.matchesSelector || Element.prototype[prefix.lowercase + "MatchesSelector"], mutation = win.MutationObserver || win[prefix.js + "MutationObserver"];
+ var typeCache = {}, typeString = typeCache.toString, typeRegexp = /\s([a-zA-Z]+)/;
+ function typeOf(obj) {
+ var type = typeString.call(obj);
+ return typeCache[type] || (typeCache[type] = type.match(typeRegexp)[1].toLowerCase());
+ }
+ function clone(item, type) {
+ var fn = clone[type || typeOf(item)];
+ return fn ? fn(item) : item;
+ }
+ clone.object = function(src) {
+ var obj = {};
+ for (var key in src) obj[key] = clone(src[key]);
+ return obj;
+ };
+ clone.array = function(src) {
+ var i = src.length, array = new Array(i);
+ while (i--) array[i] = clone(src[i]);
+ return array;
+ };
+ var unsliceable = [ "undefined", "null", "number", "boolean", "string", "function" ];
+ function toArray(obj) {
+ return unsliceable.indexOf(typeOf(obj)) == -1 ? Array.prototype.slice.call(obj, 0) : [ obj ];
+ }
+ var str = "";
+ function query(element, selector) {
+ return (selector || str).length ? toArray(element.querySelectorAll(selector)) : [];
+ }
+ function parseMutations(element, mutations) {
+ var diff = {
+ added: [],
+ removed: []
+ };
+ mutations.forEach(function(record) {
+ record._mutation = true;
+ for (var z in diff) {
+ var type = element._records[z == "added" ? "inserted" : "removed"], nodes = record[z + "Nodes"], length = nodes.length;
+ for (var i = 0; i < length && diff[z].indexOf(nodes[i]) == -1; i++) {
+ diff[z].push(nodes[i]);
+ type.forEach(function(fn) {
+ fn(nodes[i], record);
+ });
+ }
+ }
+ });
+ }
+ function mergeOne(source, key, current) {
+ var type = typeOf(current);
+ if (type == "object" && typeOf(source[key]) == "object") xtag.merge(source[key], current); else source[key] = clone(current, type);
+ return source;
+ }
+ function wrapMixin(tag, key, pseudo, value, original) {
+ var fn = original[key];
+ if (!(key in original)) original[key] = value; else if (typeof original[key] == "function") {
+ if (!fn.__mixins__) fn.__mixins__ = [];
+ fn.__mixins__.push(xtag.applyPseudos(pseudo, value, tag.pseudos));
+ }
+ }
+ var uniqueMixinCount = 0;
+ function mergeMixin(tag, mixin, original, mix) {
+ if (mix) {
+ var uniques = {};
+ for (var z in original) uniques[z.split(":")[0]] = z;
+ for (z in mixin) {
+ wrapMixin(tag, uniques[z.split(":")[0]] || z, z, mixin[z], original);
+ }
+ } else {
+ for (var zz in mixin) {
+ original[zz + ":__mixin__(" + uniqueMixinCount++ + ")"] = xtag.applyPseudos(zz, mixin[zz], tag.pseudos);
+ }
+ }
+ }
+ function applyMixins(tag) {
+ tag.mixins.forEach(function(name) {
+ var mixin = xtag.mixins[name];
+ for (var type in mixin) {
+ var item = mixin[type], original = tag[type];
+ if (!original) tag[type] = item; else {
+ switch (type) {
+ case "accessors":
+ case "prototype":
+ for (var z in item) {
+ if (!original[z]) original[z] = item[z]; else mergeMixin(tag, item[z], original[z], true);
+ }
+ break;
+
+ default:
+ mergeMixin(tag, item, original, type != "events");
+ }
+ }
+ }
+ });
+ return tag;
+ }
+ function delegateAction(pseudo, event) {
+ var match, target = event.target;
+ if (!target.tagName) return null;
+ if (xtag.matchSelector(target, pseudo.value)) match = target; else if (xtag.matchSelector(target, pseudo.value + " *")) {
+ var parent = target.parentNode;
+ while (!match) {
+ if (xtag.matchSelector(parent, pseudo.value)) match = parent;
+ parent = parent.parentNode;
+ }
+ }
+ return match ? pseudo.listener = pseudo.listener.bind(match) : null;
+ }
+ function touchFilter(event) {
+ if (event.type.match("touch")) {
+ event.target.__touched__ = true;
+ } else if (event.target.__touched__ && event.type.match("mouse")) {
+ delete event.target.__touched__;
+ return;
+ }
+ return true;
+ }
+ function createFlowEvent(type) {
+ var flow = type == "over";
+ return {
+ attach: "OverflowEvent" in win ? "overflowchanged" : [],
+ condition: function(event, custom) {
+ event.flow = type;
+ return event.type == type + "flow" || (event.orient === 0 && event.horizontalOverflow == flow || event.orient == 1 && event.verticalOverflow == flow || event.orient == 2 && event.horizontalOverflow == flow && event.verticalOverflow == flow);
+ }
+ };
+ }
+ function writeProperty(key, event, base, desc) {
+ if (desc) event[key] = base[key]; else Object.defineProperty(event, key, {
+ writable: true,
+ enumerable: true,
+ value: base[key]
+ });
+ }
+ var skipProps = {};
+ for (var z in doc.createEvent("CustomEvent")) skipProps[z] = 1;
+ function inheritEvent(event, base) {
+ var desc = Object.getOwnPropertyDescriptor(event, "target");
+ for (var z in base) {
+ if (!skipProps[z]) writeProperty(z, event, base, desc);
+ }
+ event.baseEvent = base;
+ }
+ function getArgs(attr, value) {
+ return {
+ value: attr.boolean ? "" : value,
+ method: attr.boolean && !value ? "removeAttribute" : "setAttribute"
+ };
+ }
+ function modAttr(element, attr, name, value) {
+ var args = getArgs(attr, value);
+ element[args.method](name, args.value);
+ }
+ function syncAttr(element, attr, name, value, method) {
+ var nodes = attr.property ? [ element.xtag[attr.property] ] : attr.selector ? xtag.query(element, attr.selector) : [], index = nodes.length;
+ while (index--) nodes[index][method](name, value);
+ }
+ function updateView(element, name, value) {
+ if (element.__view__) {
+ element.__view__.updateBindingValue(element, name, value);
+ }
+ }
+ function attachProperties(tag, prop, z, accessor, attr, name) {
+ var key = z.split(":"), type = key[0];
+ if (type == "get") {
+ key[0] = prop;
+ tag.prototype[prop].get = xtag.applyPseudos(key.join(":"), accessor[z], tag.pseudos, accessor[z]);
+ } else if (type == "set") {
+ key[0] = prop;
+ var setter = tag.prototype[prop].set = xtag.applyPseudos(key.join(":"), attr ? function(value) {
+ this.xtag._skipSet = true;
+ if (!this.xtag._skipAttr) modAttr(this, attr, name, value);
+ if (this.xtag._skipAttr && attr.skip) delete this.xtag._skipAttr;
+ accessor[z].call(this, attr.boolean ? !!value : value);
+ updateView(this, name, value);
+ delete this.xtag._skipSet;
+ } : accessor[z] ? function(value) {
+ accessor[z].call(this, value);
+ updateView(this, name, value);
+ } : null, tag.pseudos, accessor[z]);
+ if (attr) attr.setter = setter;
+ } else tag.prototype[prop][z] = accessor[z];
+ }
+ function parseAccessor(tag, prop) {
+ tag.prototype[prop] = {};
+ var accessor = tag.accessors[prop], attr = accessor.attribute, name = attr && attr.name ? attr.name.toLowerCase() : prop;
+ if (attr) {
+ attr.key = prop;
+ tag.attributes[name] = attr;
+ }
+ for (var z in accessor) attachProperties(tag, prop, z, accessor, attr, name);
+ if (attr) {
+ if (!tag.prototype[prop].get) {
+ var method = (attr.boolean ? "has" : "get") + "Attribute";
+ tag.prototype[prop].get = function() {
+ return this[method](name);
+ };
+ }
+ if (!tag.prototype[prop].set) tag.prototype[prop].set = function(value) {
+ modAttr(this, attr, name, value);
+ updateView(this, name, value);
+ };
+ }
+ }
+ var readyTags = {};
+ function fireReady(name) {
+ readyTags[name] = (readyTags[name] || []).filter(function(obj) {
+ return (obj.tags = obj.tags.filter(function(z) {
+ return z != name && !xtag.tags[z];
+ })).length || obj.fn();
+ });
+ }
+ var xtag = {
+ tags: {},
+ defaultOptions: {
+ pseudos: [],
+ mixins: [],
+ events: {},
+ methods: {},
+ accessors: {},
+ lifecycle: {},
+ attributes: {},
+ prototype: {
+ xtag: {
+ get: function() {
+ return this.__xtag__ ? this.__xtag__ : this.__xtag__ = {
+ data: {}
+ };
+ }
+ }
+ }
+ },
+ register: function(name, options) {
+ var _name;
+ if (typeof name == "string") {
+ _name = name.toLowerCase();
+ } else {
+ return;
+ }
+ var basePrototype = options.prototype;
+ delete options.prototype;
+ var tag = xtag.tags[_name] = applyMixins(xtag.merge({}, xtag.defaultOptions, options));
+ for (var z in tag.events) tag.events[z] = xtag.parseEvent(z, tag.events[z]);
+ for (z in tag.lifecycle) tag.lifecycle[z.split(":")[0]] = xtag.applyPseudos(z, tag.lifecycle[z], tag.pseudos, tag.lifecycle[z]);
+ for (z in tag.methods) tag.prototype[z.split(":")[0]] = {
+ value: xtag.applyPseudos(z, tag.methods[z], tag.pseudos, tag.methods[z]),
+ enumerable: true
+ };
+ for (z in tag.accessors) parseAccessor(tag, z);
+ var ready = tag.lifecycle.created || tag.lifecycle.ready;
+ tag.prototype.createdCallback = {
+ enumerable: true,
+ value: function() {
+ var element = this;
+ xtag.addEvents(this, tag.events);
+ tag.mixins.forEach(function(mixin) {
+ if (xtag.mixins[mixin].events) xtag.addEvents(element, xtag.mixins[mixin].events);
+ });
+ var output = ready ? ready.apply(this, arguments) : null;
+ for (var name in tag.attributes) {
+ var attr = tag.attributes[name], hasAttr = this.hasAttribute(name);
+ if (hasAttr || attr.boolean) {
+ this[attr.key] = attr.boolean ? hasAttr : this.getAttribute(name);
+ }
+ }
+ tag.pseudos.forEach(function(obj) {
+ obj.onAdd.call(element, obj);
+ });
+ return output;
+ }
+ };
+ var inserted = tag.lifecycle.inserted, removed = tag.lifecycle.removed;
+ if (inserted || removed) {
+ tag.prototype.attachedCallback = {
+ value: function() {
+ if (removed) this.xtag.__parentNode__ = this.parentNode;
+ if (inserted) return inserted.apply(this, arguments);
+ },
+ enumerable: true
+ };
+ }
+ if (removed) {
+ tag.prototype.detachedCallback = {
+ value: function() {
+ var args = toArray(arguments);
+ args.unshift(this.xtag.__parentNode__);
+ var output = removed.apply(this, args);
+ delete this.xtag.__parentNode__;
+ return output;
+ },
+ enumerable: true
+ };
+ }
+ if (tag.lifecycle.attributeChanged) tag.prototype.attributeChangedCallback = {
+ value: tag.lifecycle.attributeChanged,
+ enumerable: true
+ };
+ var setAttribute = tag.prototype.setAttribute || HTMLElement.prototype.setAttribute;
+ tag.prototype.setAttribute = {
+ writable: true,
+ enumberable: true,
+ value: function(name, value) {
+ var attr = tag.attributes[name.toLowerCase()];
+ if (!this.xtag._skipAttr) setAttribute.call(this, name, attr && attr.boolean ? "" : value);
+ if (attr) {
+ if (attr.setter && !this.xtag._skipSet) {
+ this.xtag._skipAttr = true;
+ attr.setter.call(this, attr.boolean ? true : value);
+ }
+ value = attr.skip ? attr.boolean ? this.hasAttribute(name) : this.getAttribute(name) : value;
+ syncAttr(this, attr, name, attr.boolean ? "" : value, "setAttribute");
+ }
+ delete this.xtag._skipAttr;
+ }
+ };
+ var removeAttribute = tag.prototype.removeAttribute || HTMLElement.prototype.removeAttribute;
+ tag.prototype.removeAttribute = {
+ writable: true,
+ enumberable: true,
+ value: function(name) {
+ var attr = tag.attributes[name.toLowerCase()];
+ if (!this.xtag._skipAttr) removeAttribute.call(this, name);
+ if (attr) {
+ if (attr.setter && !this.xtag._skipSet) {
+ this.xtag._skipAttr = true;
+ attr.setter.call(this, attr.boolean ? false : undefined);
+ }
+ syncAttr(this, attr, name, undefined, "removeAttribute");
+ }
+ delete this.xtag._skipAttr;
+ }
+ };
+ var elementProto = basePrototype ? basePrototype : options["extends"] ? Object.create(doc.createElement(options["extends"]).constructor).prototype : win.HTMLElement.prototype;
+ var definition = {
+ prototype: Object.create(elementProto, tag.prototype)
+ };
+ if (options["extends"]) {
+ definition["extends"] = options["extends"];
+ }
+ var reg = doc.registerElement(_name, definition);
+ fireReady(_name);
+ return reg;
+ },
+ ready: function(names, fn) {
+ var obj = {
+ tags: toArray(names),
+ fn: fn
+ };
+ if (obj.tags.reduce(function(last, name) {
+ if (xtag.tags[name]) return last;
+ (readyTags[name] = readyTags[name] || []).push(obj);
+ }, true)) fn();
+ },
+ mixins: {},
+ prefix: prefix,
+ captureEvents: [ "focus", "blur", "scroll", "underflow", "overflow", "overflowchanged", "DOMMouseScroll" ],
+ customEvents: {
+ overflow: createFlowEvent("over"),
+ underflow: createFlowEvent("under"),
+ animationstart: {
+ attach: [ prefix.dom + "AnimationStart" ]
+ },
+ animationend: {
+ attach: [ prefix.dom + "AnimationEnd" ]
+ },
+ transitionend: {
+ attach: [ prefix.dom + "TransitionEnd" ]
+ },
+ move: {
+ attach: [ "mousemove", "touchmove" ],
+ condition: touchFilter
+ },
+ enter: {
+ attach: [ "mouseover", "touchenter" ],
+ condition: touchFilter
+ },
+ leave: {
+ attach: [ "mouseout", "touchleave" ],
+ condition: touchFilter
+ },
+ scrollwheel: {
+ attach: [ "DOMMouseScroll", "mousewheel" ],
+ condition: function(event) {
+ event.delta = event.wheelDelta ? event.wheelDelta / 40 : Math.round(event.detail / 3.5 * -1);
+ return true;
+ }
+ },
+ tapstart: {
+ observe: {
+ mousedown: doc,
+ touchstart: doc
+ },
+ condition: touchFilter
+ },
+ tapend: {
+ observe: {
+ mouseup: doc,
+ touchend: doc
+ },
+ condition: touchFilter
+ },
+ tapmove: {
+ attach: [ "tapstart", "dragend", "touchcancel" ],
+ condition: function(event, custom) {
+ switch (event.type) {
+ case "move":
+ return true;
+
+ case "dragover":
+ var last = custom.lastDrag || {};
+ custom.lastDrag = event;
+ return last.pageX != event.pageX && last.pageY != event.pageY || null;
+
+ case "tapstart":
+ if (!custom.move) {
+ custom.current = this;
+ custom.move = xtag.addEvents(this, {
+ move: custom.listener,
+ dragover: custom.listener
+ });
+ custom.tapend = xtag.addEvent(doc, "tapend", custom.listener);
+ }
+ break;
+
+ case "tapend":
+ case "dragend":
+ case "touchcancel":
+ if (!event.touches.length) {
+ if (custom.move) xtag.removeEvents(custom.current, custom.move || {});
+ if (custom.tapend) xtag.removeEvent(doc, custom.tapend || {});
+ delete custom.lastDrag;
+ delete custom.current;
+ delete custom.tapend;
+ delete custom.move;
+ }
+ }
+ }
+ }
+ },
+ pseudos: {
+ __mixin__: {},
+ mixins: {
+ onCompiled: function(fn, pseudo) {
+ var mixins = pseudo.source.__mixins__;
+ if (mixins) switch (pseudo.value) {
+ case "before":
+ return function() {
+ var self = this, args = arguments;
+ mixins.forEach(function(m) {
+ m.apply(self, args);
+ });
+ return fn.apply(self, args);
+ };
+
+ case "after":
+ case null:
+ return function() {
+ var self = this, args = arguments;
+ returns = fn.apply(self, args);
+ mixins.forEach(function(m) {
+ m.apply(self, args);
+ });
+ return returns;
+ };
+ }
+ }
+ },
+ keypass: keypseudo,
+ keyfail: keypseudo,
+ delegate: {
+ action: delegateAction
+ },
+ within: {
+ action: delegateAction,
+ onAdd: function(pseudo) {
+ var condition = pseudo.source.condition;
+ if (condition) pseudo.source.condition = function(event, custom) {
+ return xtag.query(this, pseudo.value).filter(function(node) {
+ return node == event.target || node.contains ? node.contains(event.target) : null;
+ })[0] ? condition.call(this, event, custom) : null;
+ };
+ }
+ },
+ preventable: {
+ action: function(pseudo, event) {
+ return !event.defaultPrevented;
+ }
+ }
+ },
+ clone: clone,
+ typeOf: typeOf,
+ toArray: toArray,
+ wrap: function(original, fn) {
+ return function() {
+ var args = arguments, output = original.apply(this, args);
+ fn.apply(this, args);
+ return output;
+ };
+ },
+ merge: function(source, k, v) {
+ if (typeOf(k) == "string") return mergeOne(source, k, v);
+ for (var i = 1, l = arguments.length; i < l; i++) {
+ var object = arguments[i];
+ for (var key in object) mergeOne(source, key, object[key]);
+ }
+ return source;
+ },
+ uid: function() {
+ return Math.random().toString(36).substr(2, 10);
+ },
+ query: query,
+ skipTransition: function(element, fn, bind) {
+ var prop = prefix.js + "TransitionProperty";
+ element.style[prop] = element.style.transitionProperty = "none";
+ var callback = fn ? fn.call(bind) : null;
+ return xtag.requestFrame(function() {
+ xtag.requestFrame(function() {
+ element.style[prop] = element.style.transitionProperty = "";
+ if (callback) xtag.requestFrame(callback);
+ });
+ });
+ },
+ requestFrame: function() {
+ var raf = win.requestAnimationFrame || win[prefix.lowercase + "RequestAnimationFrame"] || function(fn) {
+ return win.setTimeout(fn, 20);
+ };
+ return function(fn) {
+ return raf(fn);
+ };
+ }(),
+ cancelFrame: function() {
+ var cancel = win.cancelAnimationFrame || win[prefix.lowercase + "CancelAnimationFrame"] || win.clearTimeout;
+ return function(id) {
+ return cancel(id);
+ };
+ }(),
+ matchSelector: function(element, selector) {
+ return matchSelector.call(element, selector);
+ },
+ set: function(element, method, value) {
+ element[method] = value;
+ if (window.CustomElements) CustomElements.upgradeAll(element);
+ },
+ innerHTML: function(el, html) {
+ xtag.set(el, "innerHTML", html);
+ },
+ hasClass: function(element, klass) {
+ return element.className.split(" ").indexOf(klass.trim()) > -1;
+ },
+ addClass: function(element, klass) {
+ var list = element.className.trim().split(" ");
+ klass.trim().split(" ").forEach(function(name) {
+ if (!~list.indexOf(name)) list.push(name);
+ });
+ element.className = list.join(" ").trim();
+ return element;
+ },
+ removeClass: function(element, klass) {
+ var classes = klass.trim().split(" ");
+ element.className = element.className.trim().split(" ").filter(function(name) {
+ return name && !~classes.indexOf(name);
+ }).join(" ");
+ return element;
+ },
+ toggleClass: function(element, klass) {
+ return xtag[xtag.hasClass(element, klass) ? "removeClass" : "addClass"].call(null, element, klass);
+ },
+ queryChildren: function(element, selector) {
+ var id = element.id, guid = element.id = id || "x_" + xtag.uid(), attr = "#" + guid + " > ", noParent = false;
+ if (!element.parentNode) {
+ noParent = true;
+ container.appendChild(element);
+ }
+ selector = attr + (selector + "").replace(",", "," + attr, "g");
+ var result = element.parentNode.querySelectorAll(selector);
+ if (!id) element.removeAttribute("id");
+ if (noParent) {
+ container.removeChild(element);
+ }
+ return toArray(result);
+ },
+ createFragment: function(content) {
+ var frag = doc.createDocumentFragment();
+ if (content) {
+ var div = frag.appendChild(doc.createElement("div")), nodes = toArray(content.nodeName ? arguments : !(div.innerHTML = content) || div.children), length = nodes.length, index = 0;
+ while (index < length) frag.insertBefore(nodes[index++], div);
+ frag.removeChild(div);
+ }
+ return frag;
+ },
+ manipulate: function(element, fn) {
+ var next = element.nextSibling, parent = element.parentNode, frag = doc.createDocumentFragment(), returned = fn.call(frag.appendChild(element), frag) || element;
+ if (next) parent.insertBefore(returned, next); else parent.appendChild(returned);
+ },
+ applyPseudos: function(key, fn, target, source) {
+ var listener = fn, pseudos = {};
+ if (key.match(":")) {
+ var split = key.match(regexPseudoSplit), i = split.length;
+ while (--i) {
+ split[i].replace(regexPseudoReplace, function(match, name, value) {
+ if (!xtag.pseudos[name]) throw "pseudo not found: " + name + " " + split;
+ value = value === "" || typeof value == "undefined" ? null : value;
+ var pseudo = pseudos[i] = Object.create(xtag.pseudos[name]);
+ pseudo.key = key;
+ pseudo.name = name;
+ pseudo.value = value;
+ pseudo["arguments"] = (value || "").split(",");
+ pseudo.action = pseudo.action || trueop;
+ pseudo.source = source;
+ var last = listener;
+ listener = function() {
+ var args = toArray(arguments), obj = {
+ key: key,
+ name: name,
+ value: value,
+ source: source,
+ arguments: pseudo["arguments"],
+ listener: last
+ };
+ var output = pseudo.action.apply(this, [ obj ].concat(args));
+ if (output === null || output === false) return output;
+ return obj.listener.apply(this, args);
+ };
+ if (target && pseudo.onAdd) {
+ if (target.nodeName) pseudo.onAdd.call(target, pseudo); else target.push(pseudo);
+ }
+ });
+ }
+ }
+ for (var z in pseudos) {
+ if (pseudos[z].onCompiled) listener = pseudos[z].onCompiled(listener, pseudos[z]) || listener;
+ }
+ return listener;
+ },
+ removePseudos: function(target, pseudos) {
+ pseudos.forEach(function(obj) {
+ if (obj.onRemove) obj.onRemove.call(target, obj);
+ });
+ },
+ parseEvent: function(type, fn) {
+ var pseudos = type.split(":"), key = pseudos.shift(), custom = xtag.customEvents[key], event = xtag.merge({
+ type: key,
+ stack: noop,
+ condition: trueop,
+ attach: [],
+ _attach: [],
+ pseudos: "",
+ _pseudos: [],
+ onAdd: noop,
+ onRemove: noop
+ }, custom || {});
+ event.attach = toArray(event.base || event.attach);
+ event.chain = key + (event.pseudos.length ? ":" + event.pseudos : "") + (pseudos.length ? ":" + pseudos.join(":") : "");
+ var condition = event.condition;
+ event.condition = function(e) {
+ var t = e.touches, tt = e.targetTouches;
+ return condition.apply(this, arguments);
+ };
+ var stack = xtag.applyPseudos(event.chain, fn, event._pseudos, event);
+ event.stack = function(e) {
+ e.currentTarget = e.currentTarget || this;
+ var t = e.touches, tt = e.targetTouches;
+ var detail = e.detail || {};
+ if (!detail.__stack__) return stack.apply(this, arguments); else if (detail.__stack__ == stack) {
+ e.stopPropagation();
+ e.cancelBubble = true;
+ return stack.apply(this, arguments);
+ }
+ };
+ event.listener = function(e) {
+ var args = toArray(arguments), output = event.condition.apply(this, args.concat([ event ]));
+ if (!output) return output;
+ if (e.type != key) {
+ xtag.fireEvent(e.target, key, {
+ baseEvent: e,
+ detail: output !== true && (output.__stack__ = stack) ? output : {
+ __stack__: stack
+ }
+ });
+ } else return event.stack.apply(this, args);
+ };
+ event.attach.forEach(function(name) {
+ event._attach.push(xtag.parseEvent(name, event.listener));
+ });
+ if (custom && custom.observe && !custom.__observing__) {
+ custom.observer = function(e) {
+ var output = event.condition.apply(this, toArray(arguments).concat([ custom ]));
+ if (!output) return output;
+ xtag.fireEvent(e.target, key, {
+ baseEvent: e,
+ detail: output !== true ? output : {}
+ });
+ };
+ for (var z in custom.observe) xtag.addEvent(custom.observe[z] || document, z, custom.observer, true);
+ custom.__observing__ = true;
+ }
+ return event;
+ },
+ addEvent: function(element, type, fn, capture) {
+ var event = typeof fn == "function" ? xtag.parseEvent(type, fn) : fn;
+ event._pseudos.forEach(function(obj) {
+ obj.onAdd.call(element, obj);
+ });
+ event._attach.forEach(function(obj) {
+ xtag.addEvent(element, obj.type, obj);
+ });
+ event.onAdd.call(element, event, event.listener);
+ element.addEventListener(event.type, event.stack, capture || xtag.captureEvents.indexOf(event.type) > -1);
+ return event;
+ },
+ addEvents: function(element, obj) {
+ var events = {};
+ for (var z in obj) {
+ events[z] = xtag.addEvent(element, z, obj[z]);
+ }
+ return events;
+ },
+ removeEvent: function(element, type, event) {
+ event = event || type;
+ event.onRemove.call(element, event, event.listener);
+ xtag.removePseudos(element, event._pseudos);
+ event._attach.forEach(function(obj) {
+ xtag.removeEvent(element, obj);
+ });
+ element.removeEventListener(event.type, event.stack);
+ },
+ removeEvents: function(element, obj) {
+ for (var z in obj) xtag.removeEvent(element, obj[z]);
+ },
+ fireEvent: function(element, type, options, warn) {
+ var event = doc.createEvent("CustomEvent");
+ options = options || {};
+ if (warn) console.warn("fireEvent has been modified");
+ event.initCustomEvent(type, options.bubbles !== false, options.cancelable !== false, options.detail);
+ if (options.baseEvent) inheritEvent(event, options.baseEvent);
+ try {
+ element.dispatchEvent(event);
+ } catch (e) {
+ console.warn("This error may have been caused by a change in the fireEvent method", e);
+ }
+ },
+ addObserver: function(element, type, fn) {
+ if (!element._records) {
+ element._records = {
+ inserted: [],
+ removed: []
+ };
+ if (mutation) {
+ element._observer = new mutation(function(mutations) {
+ parseMutations(element, mutations);
+ });
+ element._observer.observe(element, {
+ subtree: true,
+ childList: true,
+ attributes: !true,
+ characterData: false
+ });
+ } else [ "Inserted", "Removed" ].forEach(function(type) {
+ element.addEventListener("DOMNode" + type, function(event) {
+ event._mutation = true;
+ element._records[type.toLowerCase()].forEach(function(fn) {
+ fn(event.target, event);
+ });
+ }, false);
+ });
+ }
+ if (element._records[type].indexOf(fn) == -1) element._records[type].push(fn);
+ },
+ removeObserver: function(element, type, fn) {
+ var obj = element._records;
+ if (obj && fn) {
+ obj[type].splice(obj[type].indexOf(fn), 1);
+ } else {
+ obj[type] = [];
+ }
+ }
+ };
+ var touching = false, touchTarget = null;
+ doc.addEventListener("mousedown", function(e) {
+ touching = true;
+ touchTarget = e.target;
+ }, true);
+ doc.addEventListener("mouseup", function() {
+ touching = false;
+ touchTarget = null;
+ }, true);
+ doc.addEventListener("dragend", function() {
+ touching = false;
+ touchTarget = null;
+ }, true);
+ var UIEventProto = {
+ touches: {
+ configurable: true,
+ get: function() {
+ return this.__touches__ || (this.identifier = 0) || (this.__touches__ = touching ? [ this ] : []);
+ }
+ },
+ targetTouches: {
+ configurable: true,
+ get: function() {
+ return this.__targetTouches__ || (this.__targetTouches__ = touching && this.currentTarget && (this.currentTarget == touchTarget || this.currentTarget.contains && this.currentTarget.contains(touchTarget)) ? (this.identifier = 0) || [ this ] : []);
+ }
+ },
+ changedTouches: {
+ configurable: true,
+ get: function() {
+ return this.__changedTouches__ || (this.identifier = 0) || (this.__changedTouches__ = [ this ]);
+ }
+ }
+ };
+ for (z in UIEventProto) {
+ UIEvent.prototype[z] = UIEventProto[z];
+ Object.defineProperty(UIEvent.prototype, z, UIEventProto[z]);
+ }
+ function addTap(el, tap, e) {
+ if (!el.__tap__) {
+ el.__tap__ = {
+ click: e.type == "mousedown"
+ };
+ if (el.__tap__.click) el.addEventListener("click", tap.observer); else {
+ el.__tap__.scroll = tap.observer.bind(el);
+ window.addEventListener("scroll", el.__tap__.scroll, true);
+ el.addEventListener("touchmove", tap.observer);
+ el.addEventListener("touchcancel", tap.observer);
+ el.addEventListener("touchend", tap.observer);
+ }
+ }
+ if (!el.__tap__.click) {
+ el.__tap__.x = e.touches[0].pageX;
+ el.__tap__.y = e.touches[0].pageY;
+ }
+ }
+ function removeTap(el, tap) {
+ if (el.__tap__) {
+ if (el.__tap__.click) el.removeEventListener("click", tap.observer); else {
+ window.removeEventListener("scroll", el.__tap__.scroll, true);
+ el.removeEventListener("touchmove", tap.observer);
+ el.removeEventListener("touchcancel", tap.observer);
+ el.removeEventListener("touchend", tap.observer);
+ }
+ delete el.__tap__;
+ }
+ }
+ function checkTapPosition(el, tap, e) {
+ var touch = e.changedTouches[0], tol = tap.gesture.tolerance;
+ if (touch.pageX < el.__tap__.x + tol && touch.pageX > el.__tap__.x - tol && touch.pageY < el.__tap__.y + tol && touch.pageY > el.__tap__.y - tol) return true;
+ }
+ xtag.customEvents.tap = {
+ observe: {
+ mousedown: document,
+ touchstart: document
+ },
+ gesture: {
+ tolerance: 8
+ },
+ condition: function(e, tap) {
+ var el = e.target;
+ switch (e.type) {
+ case "touchstart":
+ if (el.__tap__ && el.__tap__.click) removeTap(el, tap);
+ addTap(el, tap, e);
+ return;
+
+ case "mousedown":
+ if (!el.__tap__) addTap(el, tap, e);
+ return;
+
+ case "scroll":
+ case "touchcancel":
+ removeTap(this, tap);
+ return;
+
+ case "touchmove":
+ case "touchend":
+ if (this.__tap__ && !checkTapPosition(this, tap, e)) {
+ removeTap(this, tap);
+ return;
+ }
+ return e.type == "touchend" || null;
+
+ case "click":
+ removeTap(this, tap);
+ return true;
+ }
+ }
+ };
+ win.xtag = xtag;
+ if (typeof define == "function" && define.amd) define(xtag);
+ doc.addEventListener("WebComponentsReady", function() {
+ xtag.fireEvent(doc.body, "DOMComponentsLoaded");
+ });
+})();
\ No newline at end of file
diff --git a/dist/x-tag-core.min.js b/dist/x-tag-core.min.js
index 81d3d458..1a739a56 100644
--- a/dist/x-tag-core.min.js
+++ b/dist/x-tag-core.min.js
@@ -1 +1 @@
-window.Platform={};var logFlags={};(function(){function e(e){if(this._element=e,e.className!=this._classCache){if(this._classCache=e.className,!this._classCache)return;var t,n=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(t=0;n.length>t;t++)i.call(this,n[t])}}function t(e,t){e.className=t.join(" ")}function n(e,t,n){Object.defineProperty?Object.defineProperty(e,t,{get:n}):e.__defineGetter__(t,n)}if(!(window.Element===void 0||"classList"in document.documentElement)){var r=Array.prototype,o=r.indexOf,a=r.slice,i=r.push,s=r.splice,c=r.join;e.prototype={add:function(e){this.contains(e)||(i.call(this,e),t(this._element,a.call(this,0)))},contains:function(e){return-1!==o.call(this,e)},item:function(e){return this[e]||null},remove:function(e){var n=o.call(this,e);-1!==n&&(s.call(this,n,1),t(this._element,a.call(this,0)))},toString:function(){return c.call(this," ")},toggle:function(e){-1===o.call(this,e)?this.add(e):this.remove(e)}},window.DOMTokenList=e,n(Element.prototype,"classList",function(){return new e(this)})}})(),"undefined"==typeof WeakMap&&function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0})},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){this.set(e,void 0)}},window.WeakMap=n}(),function(e){function t(e){y.push(e),b||(b=!0,m(r))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function r(){b=!1;var e=y;y=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();o(e),n.length&&(e.callback_(n,e),t=!0)}),t&&r()}function o(e){e.nodes_.forEach(function(t){var n=h.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function a(e,t){for(var n=e;n;n=n.parentNode){var r=h.get(n);if(r)for(var o=0;r.length>o;o++){var a=r[o],i=a.options;if(n===e||i.subtree){var s=t(i);s&&a.enqueue(s)}}}}function i(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++E}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function c(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function u(e,t){return w=new s(e,t)}function d(e){return O?O:(O=c(w),O.oldValue=e,O)}function l(){w=O=void 0}function f(e){return e===O||e===w}function p(e,t){return e===t?e:O&&f(e)?O:null}function v(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}var h=new WeakMap,m=window.msSetImmediate;if(!m){var _=[],g=Math.random()+"";window.addEventListener("message",function(e){if(e.data===g){var t=_;_=[],t.forEach(function(e){e()})}}),m=function(e){_.push(e),window.postMessage(g,"*")}}var b=!1,y=[],E=0;i.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var r=h.get(e);r||h.set(e,r=[]);for(var o,a=0;r.length>a;a++)if(r[a].observer===this){o=r[a],o.removeListeners(),o.options=t;break}o||(o=new v(this,e,t),r.push(o),this.nodes_.push(e)),o.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=h.get(e),n=0;t.length>n;n++){var r=t[n];if(r.observer===this){r.removeListeners(),t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var w,O;v.prototype={enqueue:function(e){var n=this.observer.records_,r=n.length;if(n.length>0){var o=n[r-1],a=p(o,e);if(a)return n[r-1]=a,void 0}else t(this.observer);n[r]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=h.get(e);t||h.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=h.get(e),n=0;t.length>n;n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e.relatedNode.namespaceURI,r=e.target,o=new u("attributes",r);o.attributeName=t,o.attributeNamespace=n;var i=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;a(r,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0:e.attributeOldValue?d(i):o});break;case"DOMCharacterDataModified":var r=e.target,o=u("characterData",r),i=e.prevValue;a(r,function(e){return e.characterData?e.characterDataOldValue?d(i):o:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,c,r=e.relatedNode,f=e.target;"DOMNodeInserted"===e.type?(s=[f],c=[]):(s=[],c=[f]);var p=f.previousSibling,v=f.nextSibling,o=u("childList",r);o.addedNodes=s,o.removedNodes=c,o.previousSibling=p,o.nextSibling=v,a(r,function(e){return e.childList?o:void 0})}l()}},e.JsMutationObserver=i,!e.MutationObserver&&e.WebKitMutationObserver&&(e.MutationObserver=e.WebKitMutationObserver),e.MutationObserver||(e.MutationObserver=i)}(this),function(e){function t(t,a){var i=a||{};if(!t)throw Error("document.registerElement: first argument `name` must not be empty");if(0>t.indexOf("-"))throw Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+(t+"")+"'.");if(f(t))throw Error("DuplicateDefinitionError: a type with name '"+(t+"")+"' is already registered");if(!i.prototype)throw Error("Options missing required prototype property");return i.__name=t.toLowerCase(),i.lifecycle=i.lifecycle||{},i.ancestry=n(i.extends),r(i),o(i),d(i.prototype),p(i.__name,i),i.ctor=v(i),i.ctor.prototype=i.prototype,i.prototype.constructor=i.ctor,e.ready&&e.upgradeAll(document),i.ctor}function n(e){var t=f(e);return t?n(t.extends).concat([t]):[]}function r(e){for(var t,n=e.extends,r=0;t=e.ancestry[r];r++)n=t.is&&t.tag;e.tag=n||e.__name,n&&(e.is=e.__name)}function o(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag);t=Object.getPrototypeOf(n)}for(var r,o=e.prototype;o&&o!==t;){var r=Object.getPrototypeOf(o);o.__proto__=r,o=r}}e.native=t}function a(e){return i(O(e.tag),e)}function i(t,n){return n.is&&t.setAttribute("is",n.is),t.removeAttribute("unresolved"),s(t,n),t.__upgraded__=!0,e.upgradeSubtree(t),u(t),t}function s(e,t){Object.__proto__?e.__proto__=t.prototype:(c(e,t.prototype,t.native),e.__proto__=t.prototype)}function c(e,t,n){for(var r={},o=t;o!==n&&o!==HTMLUnknownElement.prototype;){for(var a,i=Object.getOwnPropertyNames(o),s=0;a=i[s];s++)r[a]||(Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(o,a)),r[a]=1);o=Object.getPrototypeOf(o)}}function u(e){e.createdCallback&&e.createdCallback()}function d(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){l.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){l.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function l(e,t,n){var r=this.getAttribute(e);n.apply(this,arguments);var o=this.getAttribute(e);this.attributeChangedCallback&&o!==r&&this.attributeChangedCallback(e,r,o)}function f(e){return e?w[e.toLowerCase()]:void 0}function p(e,t){w[e]=t}function v(e){return function(){return a(e)}}function h(e,t){var n=f(t||e);return n?new n.ctor:O(e)}function m(e){if(!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var t=e.getAttribute("is")||e.localName,n=f(t);return n&&i(e,n)}}function _(t){var n=N.call(this,t);return e.upgradeAll(n),n}e||(e=window.CustomElements={flags:{}});var g=e.flags,b=Boolean(document.registerElement),y=!g.register&&b;if(y){var E=function(){};e.registry={},e.upgradeElement=E,e.watchShadow=E,e.upgrade=E,e.upgradeAll=E,e.upgradeSubtree=E,e.observeDocument=E,e.upgradeDocument=E,e.takeRecords=E}else{var w={},O=document.createElement.bind(document),N=Node.prototype.cloneNode;document.registerElement=t,document.createElement=h,Node.prototype.cloneNode=_,e.registry=w,e.upgrade=m}document.register=document.registerElement,e.hasNative=b,e.useNative=y}(window.CustomElements),function(e){function t(e,n,r){var o=e.firstElementChild;if(!o)for(o=e.firstChild;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.nextSibling;for(;o;)n(o,r)!==!0&&t(o,n,r),o=o.nextElementSibling;return null}function n(e,t){for(var n=e.shadowRoot;n;)r(n,t),n=n.olderShadowRoot}function r(e,r){t(e,function(e){return r(e)?!0:(n(e,r),void 0)}),n(e,r)}function o(e){return s(e)?(c(e),!0):(l(e),void 0)}function a(e){r(e,function(e){return o(e)?!0:void 0})}function i(e){return o(e)||a(e)}function s(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var n=t.getAttribute("is")||t.localName,r=e.registry[n];if(r)return N.dom&&console.group("upgrade:",t.localName),e.upgrade(t),N.dom&&console.groupEnd(),!0}}function c(e){l(e),m(e)&&r(e,function(e){l(e)})}function u(e){if(C.push(e),!k){k=!0;var t=window.Platform&&window.Platform.endOfMicrotask||setTimeout;t(d)}}function d(){k=!1;for(var e,t=C,n=0,r=t.length;r>n&&(e=t[n]);n++)e();C=[]}function l(e){L?u(function(){f(e)}):f(e)}function f(e){(e.attachedCallback||e.detachedCallback||e.__upgraded__&&N.dom)&&(N.dom&&console.group("inserted:",e.localName),m(e)&&(e.__inserted=(e.__inserted||0)+1,1>e.__inserted&&(e.__inserted=1),e.__inserted>1?N.dom&&console.warn("inserted:",e.localName,"insert/remove count:",e.__inserted):e.attachedCallback&&(N.dom&&console.log("inserted:",e.localName),e.attachedCallback())),N.dom&&console.groupEnd())}function p(e){v(e),r(e,function(e){v(e)})}function v(e){L?u(function(){h(e)}):h(e)}function h(e){(e.attachedCallback||e.detachedCallback||e.__upgraded__&&N.dom)&&(N.dom&&console.group("removed:",e.localName),m(e)||(e.__inserted=(e.__inserted||0)-1,e.__inserted>0&&(e.__inserted=0),0>e.__inserted?N.dom&&console.warn("removed:",e.localName,"insert/remove count:",e.__inserted):e.detachedCallback&&e.detachedCallback()),N.dom&&console.groupEnd())}function m(e){for(var t=e,n=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;t;){if(t==n)return!0;t=t.parentNode||t.host}}function _(e){if(e.shadowRoot&&!e.shadowRoot.__watched){N.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)g(t),t=t.olderShadowRoot}}function g(e){e.__watched||(E(e),e.__watched=!0)}function b(e){if(N.dom){var t=e[0];if(t&&"childList"===t.type&&t.addedNodes&&t.addedNodes){for(var n=t.addedNodes[0];n&&n!==document&&!n.host;)n=n.parentNode;var r=n&&(n.URL||n._URL||n.host&&n.host.localName)||"";r=r.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,r||"")}e.forEach(function(e){"childList"===e.type&&(A(e.addedNodes,function(e){e.localName&&i(e)}),A(e.removedNodes,function(e){e.localName&&p(e)}))}),N.dom&&console.groupEnd()}function y(){b(M.takeRecords()),d()}function E(e){M.observe(e,{childList:!0,subtree:!0})}function w(e){E(e)}function O(e){N.dom&&console.group("upgradeDocument: ",(e.URL||e._URL||"").split("/").pop()),i(e),N.dom&&console.groupEnd()}var N=window.logFlags||{},L=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=L;var k=!1,C=[],M=new MutationObserver(b),A=Array.prototype.forEach.call.bind(Array.prototype.forEach);e.watchShadow=_,e.upgradeAll=i,e.upgradeSubtree=a,e.observeDocument=w,e.upgradeDocument=O,e.takeRecords=y}(window.CustomElements),function(){function e(e){return"link"===e.localName&&e.getAttribute("rel")===t}var t=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",n={selectors:["link[rel="+t+"]"],map:{link:"parseLink"},parse:function(e){if(!e.__parsed){e.__parsed=!0;var t=e.querySelectorAll(n.selectors);r(t,function(e){n[n.map[e.localName]](e)}),CustomElements.upgradeDocument(e),CustomElements.observeDocument(e)}},parseLink:function(t){e(t)&&this.parseImport(t)},parseImport:function(e){e.content&&n.parse(e.content)}},r=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=n}(),function(e){function t(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var e=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;e(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e){var t=document.createEvent("HTMLEvents");return t.initEvent(e,!0,!0),t}),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var n=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(n,t)}else t()}(window.CustomElements),function(){function e(e){var t=I.call(e);return R[t]||(R[t]=t.match(F)[1].toLowerCase())}function t(n,r){var o=t[r||e(n)];return o?o(n):n}function n(t){return-1==H.indexOf(e(t))?Array.prototype.slice.call(t,0):[t]}function r(e,t){return(t||q).length?n(e.querySelectorAll(t)):[]}function o(e,t){var n={added:[],removed:[]};t.forEach(function(t){t._mutation=!0;for(var r in n)for(var o=e._records["added"==r?"inserted":"removed"],a=t[r+"Nodes"],i=a.length,s=0;i>s&&-1==n[r].indexOf(a[s]);s++)n[r].push(a[s]),o.forEach(function(e){e(a[s],t)})})}function a(n,r,o){var a=e(o);return"object"==a&&"object"==e(n[r])?B.merge(n[r],o):n[r]=t(o,a),n}function i(e,t,n,r,o){var a=o[t];t in o?"function"==typeof o[t]&&(a.__mixins__||(a.__mixins__=[]),a.__mixins__.push(B.applyPseudos(n,r,e.pseudos))):o[t]=r}function s(e,t,n,r){if(r){var o={};for(var a in n)o[a.split(":")[0]]=a;for(a in t)i(e,o[a.split(":")[0]]||a,a,t[a],n)}else for(var s in t)n[s+":__mixin__("+V++ +")"]=B.applyPseudos(s,t[s],e.pseudos)}function c(e){return e.mixins.forEach(function(t){var n=B.mixins[t];for(var r in n){var o=n[r],a=e[r];if(a)switch(r){case"accessors":case"prototype":for(var i in o)a[i]?s(e,o[i],a[i],!0):a[i]=o[i];break;default:s(e,o,a,"events"!=r)}else e[r]=o}}),e}function u(e,t){var n,r=t.target;if(!r.tagName)return null;if(B.matchSelector(r,e.value))n=r;else if(B.matchSelector(r,e.value+" *"))for(var o=r.parentNode;!n;)B.matchSelector(o,e.value)&&(n=o),o=o.parentNode;return n?e.listener=e.listener.bind(n):null}function d(e){if(e.type.match("touch"))e.target.__touched__=!0;else if(e.target.__touched__&&e.type.match("mouse"))return delete e.target.__touched__,void 0;return!0}function l(e){var t="over"==e;return{attach:"OverflowEvent"in N?"overflowchanged":[],condition:function(n){return n.flow=e,n.type==e+"flow"||0===n.orient&&n.horizontalOverflow==t||1==n.orient&&n.verticalOverflow==t||2==n.orient&&n.horizontalOverflow==t&&n.verticalOverflow==t}}}function f(e,t,n,r){r?t[e]=n[e]:Object.defineProperty(t,e,{writable:!0,enumerable:!0,value:n[e]})}function p(e,t){var n=Object.getOwnPropertyDescriptor(e,"target");for(var r in t)U[r]||f(r,e,t,n);e.baseEvent=t}function v(e,t){return{value:e.boolean?"":t,method:e.boolean&&!t?"removeAttribute":"setAttribute"}}function h(e,t,n,r){var o=v(t,r);e[o.method](n,o.value)}function m(e,t,n,r,o){for(var a=t.property?[e.xtag[t.property]]:t.selector?B.query(e,t.selector):[],i=a.length;i--;)a[i][o](n,r)}function _(e,t,n){e.__view__&&e.__view__.updateBindingValue(e,t,n)}function g(e,t,n,r,o,a){var i=n.split(":"),s=i[0];if("get"==s)i[0]=t,e.prototype[t].get=B.applyPseudos(i.join(":"),r[n],e.pseudos,r[n]);else if("set"==s){i[0]=t;var c=e.prototype[t].set=B.applyPseudos(i.join(":"),o?function(e){this.xtag._skipSet=!0,this.xtag._skipAttr||h(this,o,a,e),this.xtag._skipAttr&&o.skip&&delete this.xtag._skipAttr,r[n].call(this,o.boolean?!!e:e),_(this,a,e),delete this.xtag._skipSet}:r[n]?function(e){r[n].call(this,e),_(this,a,e)}:null,e.pseudos,r[n]);o&&(o.setter=c)}else e.prototype[t][n]=r[n]}function b(e,t){e.prototype[t]={};var n=e.accessors[t],r=n.attribute,o=r&&r.name?r.name.toLowerCase():t;r&&(r.key=t,e.attributes[o]=r);for(var a in n)g(e,t,a,n,r,o);if(r){if(!e.prototype[t].get){var i=(r.boolean?"has":"get")+"Attribute";e.prototype[t].get=function(){return this[i](o)}}e.prototype[t].set||(e.prototype[t].set=function(e){h(this,r,o,e),_(this,o,e)})}}function y(e){Y[e]=(Y[e]||[]).filter(function(t){return(t.tags=t.tags.filter(function(t){return t!=e&&!B.tags[t]})).length||t.fn()})}function E(e,t,n){e.__tap__||(e.__tap__={click:"mousedown"==n.type},e.__tap__.click?e.addEventListener("click",t.observer):(e.__tap__.scroll=t.observer.bind(e),window.addEventListener("scroll",e.__tap__.scroll,!0),e.addEventListener("touchmove",t.observer),e.addEventListener("touchcancel",t.observer),e.addEventListener("touchend",t.observer))),e.__tap__.click||(e.__tap__.x=n.touches[0].pageX,e.__tap__.y=n.touches[0].pageY)}function w(e,t){e.__tap__&&(e.__tap__.click?e.removeEventListener("click",t.observer):(window.removeEventListener("scroll",e.__tap__.scroll,!0),e.removeEventListener("touchmove",t.observer),e.removeEventListener("touchcancel",t.observer),e.removeEventListener("touchend",t.observer)),delete e.__tap__)}function O(e,t,n){var r=n.changedTouches[0],o=t.gesture.tolerance;return r.pageXe.__tap__.x-o&&r.pageYe.__tap__.y-o?!0:void 0}var N=window,L=document,k=L.createElement("div"),C=function(){},M=function(){return!0},A=/([\w-]+(?:\([^\)]+\))?)/g,x=/(\w*)(?:\(([^\)]*)\))?/,D=/(\d+)/g,T={action:function(e,t){return e.value.match(D).indexOf(t.keyCode+"")>-1==("keypass"==e.name)||null}},S=function(){var e=N.getComputedStyle(L.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1];return{dom:"ms"==t?"MS":t,lowercase:t,css:"-"+t+"-",js:"ms"==t?t:t[0].toUpperCase()+t.substr(1)}}(),P=Element.prototype.matchesSelector||Element.prototype[S.lowercase+"MatchesSelector"],j=N.MutationObserver||N[S.js+"MutationObserver"],R={},I=R.toString,F=/\s([a-zA-Z]+)/;t.object=function(e){var n={};for(var r in e)n[r]=t(e[r]);return n},t.array=function(e){for(var n=e.length,r=Array(n);n--;)r[n]=t(e[n]);return r};var H=["undefined","null","number","boolean","string","function"],q="",V=0,U={};for(var W in L.createEvent("CustomEvent"))U[W]=1;var Y={},B={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(e,t){var r;if("string"==typeof e){r=e.toLowerCase();var o=t.prototype;delete t.prototype;var a=B.tags[r]=c(B.merge({},B.defaultOptions,t));for(var i in a.events)a.events[i]=B.parseEvent(i,a.events[i]);for(i in a.lifecycle)a.lifecycle[i.split(":")[0]]=B.applyPseudos(i,a.lifecycle[i],a.pseudos,a.lifecycle[i]);for(i in a.methods)a.prototype[i.split(":")[0]]={value:B.applyPseudos(i,a.methods[i],a.pseudos,a.methods[i]),enumerable:!0};for(i in a.accessors)b(a,i);var s=a.lifecycle.created||a.lifecycle.ready;a.prototype.createdCallback={enumerable:!0,value:function(){var e=this;B.addEvents(this,a.events),a.mixins.forEach(function(t){B.mixins[t].events&&B.addEvents(e,B.mixins[t].events)});var t=s?s.apply(this,arguments):null;for(var n in a.attributes){var r=a.attributes[n],o=this.hasAttribute(n);(o||r.boolean)&&(this[r.key]=r.boolean?o:this.getAttribute(n))}return a.pseudos.forEach(function(t){t.onAdd.call(e,t)}),t}};var u=a.lifecycle.inserted,d=a.lifecycle.removed;(u||d)&&(a.prototype.attachedCallback={value:function(){return d&&(this.xtag.__parentNode__=this.parentNode),u?u.apply(this,arguments):void 0},enumerable:!0}),d&&(a.prototype.detachedCallback={value:function(){var e=n(arguments);e.unshift(this.xtag.__parentNode__);var t=d.apply(this,e);return delete this.xtag.__parentNode__,t},enumerable:!0}),a.lifecycle.attributeChanged&&(a.prototype.attributeChangedCallback={value:a.lifecycle.attributeChanged,enumerable:!0});var l=a.prototype.setAttribute||HTMLElement.prototype.setAttribute;a.prototype.setAttribute={writable:!0,enumberable:!0,value:function(e,t){var n=a.attributes[e.toLowerCase()];this.xtag._skipAttr||l.call(this,e,n&&n.boolean?"":t),n&&(n.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,n.setter.call(this,n.boolean?!0:t)),t=n.skip?n.boolean?this.hasAttribute(e):this.getAttribute(e):t,m(this,n,e,n.boolean?"":t,"setAttribute")),delete this.xtag._skipAttr}};var f=a.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;a.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(e){var t=a.attributes[e.toLowerCase()];this.xtag._skipAttr||f.call(this,e),t&&(t.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,t.setter.call(this,t.boolean?!1:void 0)),m(this,t,e,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var p=o?o:t["extends"]?Object.create(L.createElement(t["extends"]).constructor).prototype:N.HTMLElement.prototype,v={prototype:Object.create(p,a.prototype)};t["extends"]&&(v["extends"]=t["extends"]);var h=L.registerElement(r,v);return y(r),h}},ready:function(e,t){var r={tags:n(e),fn:t};r.tags.reduce(function(e,t){return B.tags[t]?e:((Y[t]=Y[t]||[]).push(r),void 0)},!0)&&t()},mixins:{},prefix:S,captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged","DOMMouseScroll"],customEvents:{overflow:l("over"),underflow:l("under"),animationstart:{attach:[S.dom+"AnimationStart"]},animationend:{attach:[S.dom+"AnimationEnd"]},transitionend:{attach:[S.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:d},enter:{attach:["mouseover","touchenter"],condition:d},leave:{attach:["mouseout","touchleave"],condition:d},scrollwheel:{attach:["DOMMouseScroll","mousewheel"],condition:function(e){return e.delta=e.wheelDelta?e.wheelDelta/40:Math.round(-1*(e.detail/3.5)),!0}},tapstart:{observe:{mousedown:L,touchstart:L},condition:d},tapend:{observe:{mouseup:L,touchend:L},condition:d},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(e,t){switch(e.type){case"move":return!0;case"dragover":var n=t.lastDrag||{};return t.lastDrag=e,n.pageX!=e.pageX&&n.pageY!=e.pageY||null;case"tapstart":t.move||(t.current=this,t.move=B.addEvents(this,{move:t.listener,dragover:t.listener}),t.tapend=B.addEvent(L,"tapend",t.listener));break;case"tapend":case"dragend":case"touchcancel":e.touches.length||(t.move&&B.removeEvents(t.current,t.move||{}),t.tapend&&B.removeEvent(L,t.tapend||{}),delete t.lastDrag,delete t.current,delete t.tapend,delete t.move)}}}},pseudos:{__mixin__:{},mixins:{onCompiled:function(e,t){var n=t.source.__mixins__;if(n)switch(t.value){case"before":return function(){var t=this,r=arguments;return n.forEach(function(e){e.apply(t,r)}),e.apply(t,r)};case"after":case null:return function(){var t=this,r=arguments;return returns=e.apply(t,r),n.forEach(function(e){e.apply(t,r)}),returns}}}},keypass:T,keyfail:T,delegate:{action:u},within:{action:u,onAdd:function(e){var t=e.source.condition;t&&(e.source.condition=function(n,r){return B.query(this,e.value).filter(function(e){return e==n.target||e.contains?e.contains(n.target):null})[0]?t.call(this,n,r):null})}},preventable:{action:function(e,t){return!t.defaultPrevented}}},clone:t,typeOf:e,toArray:n,wrap:function(e,t){return function(){var n=arguments,r=e.apply(this,n);return t.apply(this,n),r}},merge:function(t,n,r){if("string"==e(n))return a(t,n,r);for(var o=1,i=arguments.length;i>o;o++){var s=arguments[o];for(var c in s)a(t,c,s[c])}return t},uid:function(){return Math.random().toString(36).substr(2,10)},query:r,skipTransition:function(e,t,n){var r=S.js+"TransitionProperty";e.style[r]=e.style.transitionProperty="none";var o=t?t.call(n):null;return B.requestFrame(function(){B.requestFrame(function(){e.style[r]=e.style.transitionProperty="",o&&B.requestFrame(o)})})},requestFrame:function(){var e=N.requestAnimationFrame||N[S.lowercase+"RequestAnimationFrame"]||function(e){return N.setTimeout(e,20)};return function(t){return e(t)}}(),cancelFrame:function(){var e=N.cancelAnimationFrame||N[S.lowercase+"CancelAnimationFrame"]||N.clearTimeout;return function(t){return e(t)}}(),matchSelector:function(e,t){return P.call(e,t)},set:function(e,t,n){e[t]=n,window.CustomElements&&CustomElements.upgradeAll(e)},innerHTML:function(e,t){B.set(e,"innerHTML",t)},hasClass:function(e,t){return e.className.split(" ").indexOf(t.trim())>-1},addClass:function(e,t){var n=e.className.trim().split(" ");return t.trim().split(" ").forEach(function(e){~n.indexOf(e)||n.push(e)}),e.className=n.join(" ").trim(),e},removeClass:function(e,t){var n=t.trim().split(" ");return e.className=e.className.trim().split(" ").filter(function(e){return e&&!~n.indexOf(e)}).join(" "),e},toggleClass:function(e,t){return B[B.hasClass(e,t)?"removeClass":"addClass"].call(null,e,t)},queryChildren:function(e,t){var r=e.id,o=e.id=r||"x_"+B.uid(),a="#"+o+" > ",i=!1;e.parentNode||(i=!0,k.appendChild(e)),t=a+(t+"").replace(",",","+a,"g");var s=e.parentNode.querySelectorAll(t);return r||e.removeAttribute("id"),i&&k.removeChild(e),n(s)},createFragment:function(e){var t=L.createDocumentFragment();if(e){for(var r=t.appendChild(L.createElement("div")),o=n(e.nodeName?arguments:!(r.innerHTML=e)||r.children),a=o.length,i=0;a>i;)t.insertBefore(o[i++],r);t.removeChild(r)}return t},manipulate:function(e,t){var n=e.nextSibling,r=e.parentNode,o=L.createDocumentFragment(),a=t.call(o.appendChild(e),o)||e;n?r.insertBefore(a,n):r.appendChild(a)},applyPseudos:function(e,t,r,o){var a=t,i={};if(e.match(":"))for(var s=e.match(A),c=s.length;--c;)s[c].replace(x,function(t,u,d){if(!B.pseudos[u])throw"pseudo not found: "+u+" "+s;d=""===d||d===void 0?null:d;var l=i[c]=Object.create(B.pseudos[u]);l.key=e,l.name=u,l.value=d,l.arguments=(d||"").split(","),l.action=l.action||M,l.source=o;var f=a;a=function(){var t=n(arguments),r={key:e,name:u,value:d,source:o,arguments:l.arguments,listener:f},a=l.action.apply(this,[r].concat(t));return null===a||a===!1?a:r.listener.apply(this,t)},r&&l.onAdd&&(r.nodeName?l.onAdd.call(r,l):r.push(l))});for(var u in i)i[u].onCompiled&&(a=i[u].onCompiled(a,i[u])||a);return a},removePseudos:function(e,t){t.forEach(function(t){t.onRemove&&t.onRemove.call(e,t)})},parseEvent:function(e,t){var r=e.split(":"),o=r.shift(),a=B.customEvents[o],i=B.merge({type:o,stack:C,condition:M,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:C,onRemove:C},a||{});i.attach=n(i.base||i.attach),i.chain=o+(i.pseudos.length?":"+i.pseudos:"")+(r.length?":"+r.join(":"):"");var s=i.condition;i.condition=function(e){return e.touches,e.targetTouches,s.apply(this,arguments)};var c=B.applyPseudos(i.chain,t,i._pseudos,i);if(i.stack=function(e){e.currentTarget=e.currentTarget||this,e.touches,e.targetTouches;var t=e.detail||{};return t.__stack__?t.__stack__==c?(e.stopPropagation(),e.cancelBubble=!0,c.apply(this,arguments)):void 0:c.apply(this,arguments)},i.listener=function(e){var t=n(arguments),r=i.condition.apply(this,t.concat([i]));return r?e.type==o?i.stack.apply(this,t):(B.fireEvent(e.target,o,{baseEvent:e,detail:r!==!0&&(r.__stack__=c)?r:{__stack__:c}}),void 0):r},i.attach.forEach(function(e){i._attach.push(B.parseEvent(e,i.listener))}),a&&a.observe&&!a.__observing__){a.observer=function(e){var t=i.condition.apply(this,n(arguments).concat([a]));return t?(B.fireEvent(e.target,o,{baseEvent:e,detail:t!==!0?t:{}}),void 0):t};for(var u in a.observe)B.addEvent(a.observe[u]||document,u,a.observer,!0);a.__observing__=!0}return i},addEvent:function(e,t,n,r){var o="function"==typeof n?B.parseEvent(t,n):n;return o._pseudos.forEach(function(t){t.onAdd.call(e,t)}),o._attach.forEach(function(t){B.addEvent(e,t.type,t)}),o.onAdd.call(e,o,o.listener),e.addEventListener(o.type,o.stack,r||B.captureEvents.indexOf(o.type)>-1),o},addEvents:function(e,t){var n={};for(var r in t)n[r]=B.addEvent(e,r,t[r]);return n},removeEvent:function(e,t,n){n=n||t,n.onRemove.call(e,n,n.listener),B.removePseudos(e,n._pseudos),n._attach.forEach(function(t){B.removeEvent(e,t)}),e.removeEventListener(n.type,n.stack)},removeEvents:function(e,t){for(var n in t)B.removeEvent(e,t[n])},fireEvent:function(e,t,n,r){var o=L.createEvent("CustomEvent");n=n||{},r&&console.warn("fireEvent has been modified"),o.initCustomEvent(t,n.bubbles!==!1,n.cancelable!==!1,n.detail),n.baseEvent&&p(o,n.baseEvent);try{e.dispatchEvent(o)}catch(a){console.warn("This error may have been caused by a change in the fireEvent method",a)}},addObserver:function(e,t,n){e._records||(e._records={inserted:[],removed:[]},j?(e._observer=new j(function(t){o(e,t)}),e._observer.observe(e,{subtree:!0,childList:!0,attributes:!!0,characterData:!1})):["Inserted","Removed"].forEach(function(t){e.addEventListener("DOMNode"+t,function(n){n._mutation=!0,e._records[t.toLowerCase()].forEach(function(e){e(n.target,n)})},!1)})),-1==e._records[t].indexOf(n)&&e._records[t].push(n)},removeObserver:function(e,t,n){var r=e._records;r&&n?r[t].splice(r[t].indexOf(n),1):r[t]=[]}},X=!1,z=null;L.addEventListener("mousedown",function(e){X=!0,z=e.target},!0),L.addEventListener("mouseup",function(){X=!1,z=null},!0),L.addEventListener("dragend",function(){X=!1,z=null},!0);var K={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=X?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=X&&this.currentTarget&&(this.currentTarget==z||this.currentTarget.contains&&this.currentTarget.contains(z))?(this.identifier=0)||[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.__changedTouches__||(this.identifier=0)||(this.__changedTouches__=[this])}}};for(W in K)UIEvent.prototype[W]=K[W],Object.defineProperty(UIEvent.prototype,W,K[W]);B.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(e,t){var n=e.target;switch(e.type){case"touchstart":return n.__tap__&&n.__tap__.click&&w(n,t),E(n,t,e),void 0;case"mousedown":return n.__tap__||E(n,t,e),void 0;case"scroll":case"touchcancel":return w(this,t),void 0;case"touchmove":case"touchend":return this.__tap__&&!O(this,t,e)?(w(this,t),void 0):"touchend"==e.type||null;case"click":return w(this,t),!0}}},N.xtag=B,"function"==typeof define&&define.amd&&define(B),L.addEventListener("WebComponentsReady",function(){B.fireEvent(L.body,"DOMComponentsLoaded")})}();
\ No newline at end of file
+window.Platform={};var logFlags={};!function(){function a(a){if(this._element=a,a.className!=this._classCache){if(this._classCache=a.className,!this._classCache)return;var b,c=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(b=0;b>>0)+(b++ +"__")};c.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}},window.WeakMap=c}(),function(a){function b(a){u.push(a),t||(t=!0,q(d))}function c(a){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(a)||a}function d(){t=!1;var a=u;u=[],a.sort(function(a,b){return a.uid_-b.uid_});var b=!1;a.forEach(function(a){var c=a.takeRecords();e(a),c.length&&(a.callback_(c,a),b=!0)}),b&&d()}function e(a){a.nodes_.forEach(function(b){var c=p.get(b);c&&c.forEach(function(b){b.observer===a&&b.removeTransientObservers()})})}function f(a,b){for(var c=a;c;c=c.parentNode){var d=p.get(c);if(d)for(var e=0;e0){var e=c[d-1],f=n(e,a);if(f)return void(c[d-1]=f)}else b(this.observer);c[d]=a},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(a){var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0),b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attributes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.removeEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target){this.addListeners_(a),this.transientObservedNodes.push(a);var b=p.get(a);b||p.set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transientObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.removeListeners_(a);for(var b=p.get(a),c=0;cc&&(a=b[c]);c++)a();B=[]}function l(a){z?j(function(){m(a)}):m(a)}function m(a){(a.attachedCallback||a.detachedCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("inserted:",a.localName),q(a)&&(a.__inserted=(a.__inserted||0)+1,a.__inserted<1&&(a.__inserted=1),a.__inserted>1?y.dom&&console.warn("inserted:",a.localName,"insert/remove count:",a.__inserted):a.attachedCallback&&(y.dom&&console.log("inserted:",a.localName),a.attachedCallback())),y.dom&&console.groupEnd())}function n(a){o(a),d(a,function(a){o(a)})}function o(a){z?j(function(){p(a)}):p(a)}function p(a){(a.attachedCallback||a.detachedCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("removed:",a.localName),q(a)||(a.__inserted=(a.__inserted||0)-1,a.__inserted>0&&(a.__inserted=0),a.__inserted<0?y.dom&&console.warn("removed:",a.localName,"insert/remove count:",a.__inserted):a.detachedCallback&&a.detachedCallback()),y.dom&&console.groupEnd())}function q(a){for(var b=a,c=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;b;){if(b==c)return!0;b=b.parentNode||b.host}}function r(a){if(a.shadowRoot&&!a.shadowRoot.__watched){y.dom&&console.log("watching shadow-root for: ",a.localName);for(var b=a.shadowRoot;b;)s(b),b=b.olderShadowRoot}}function s(a){a.__watched||(v(a),a.__watched=!0)}function t(a){if(y.dom){var b=a[0];if(b&&"childList"===b.type&&b.addedNodes&&b.addedNodes){for(var c=b.addedNodes[0];c&&c!==document&&!c.host;)c=c.parentNode;var d=c&&(c.URL||c._URL||c.host&&c.host.localName)||"";d=d.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",a.length,d||"")}a.forEach(function(a){"childList"===a.type&&(D(a.addedNodes,function(a){a.localName&&g(a)}),D(a.removedNodes,function(a){a.localName&&n(a)}))}),y.dom&&console.groupEnd()}function u(){t(C.takeRecords()),k()}function v(a){C.observe(a,{childList:!0,subtree:!0})}function w(a){v(a)}function x(a){y.dom&&console.group("upgradeDocument: ",(a.URL||a._URL||"").split("/").pop()),g(a),y.dom&&console.groupEnd()}var y=window.logFlags||{},z=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;a.hasPolyfillMutations=z;var A=!1,B=[],C=new MutationObserver(t),D=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.watchShadow=r,a.upgradeAll=g,a.upgradeSubtree=f,a.observeDocument=w,a.upgradeDocument=x,a.takeRecords=u}(window.CustomElements),function(){function a(a){return"link"===a.localName&&a.getAttribute("rel")===b}var b=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",c={selectors:["link[rel="+b+"]"],map:{link:"parseLink"},parse:function(a){if(!a.__parsed){a.__parsed=!0;var b=a.querySelectorAll(c.selectors);d(b,function(a){c[c.map[a.localName]](a)}),CustomElements.upgradeDocument(a),CustomElements.observeDocument(a)}},parseLink:function(b){a(b)&&this.parseImport(b)},parseImport:function(a){a.content&&c.parse(a.content)}},d=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=c}(),function(a){function b(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var a=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;a(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b=document.createEvent("HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"===document.readyState||a.flags.eager)b();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var c=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(c,b)}else b()}(window.CustomElements),function(){function a(a){var b=L.call(a);return K[b]||(K[b]=b.match(M)[1].toLowerCase())}function b(c,d){var e=b[d||a(c)];return e?e(c):c}function c(b){return-1==N.indexOf(a(b))?Array.prototype.slice.call(b,0):[b]}function d(a,b){return(b||O).length?c(a.querySelectorAll(b)):[]}function e(a,b){var c={added:[],removed:[]};b.forEach(function(b){b._mutation=!0;for(var d in c)for(var e=a._records["added"==d?"inserted":"removed"],f=b[d+"Nodes"],g=f.length,h=0;g>h&&-1==c[d].indexOf(f[h]);h++)c[d].push(f[h]),e.forEach(function(a){a(f[h],b)})})}function f(c,d,e){var f=a(e);return"object"==f&&"object"==a(c[d])?T.merge(c[d],e):c[d]=b(e,f),c}function g(a,b,c,d,e){var f=e[b];b in e?"function"==typeof e[b]&&(f.__mixins__||(f.__mixins__=[]),f.__mixins__.push(T.applyPseudos(c,d,a.pseudos))):e[b]=d}function h(a,b,c,d){if(d){var e={};for(var f in c)e[f.split(":")[0]]=f;for(f in b)g(a,e[f.split(":")[0]]||f,f,b[f],c)}else for(var h in b)c[h+":__mixin__("+P++ +")"]=T.applyPseudos(h,b[h],a.pseudos)}function i(a){return a.mixins.forEach(function(b){var c=T.mixins[b];for(var d in c){var e=c[d],f=a[d];if(f)switch(d){case"accessors":case"prototype":for(var g in e)f[g]?h(a,e[g],f[g],!0):f[g]=e[g];break;default:h(a,e,f,"events"!=d)}else a[d]=e}}),a}function j(a,b){var c,d=b.target;if(!d.tagName)return null;if(T.matchSelector(d,a.value))c=d;else if(T.matchSelector(d,a.value+" *"))for(var e=d.parentNode;!c;)T.matchSelector(e,a.value)&&(c=e),e=e.parentNode;return c?a.listener=a.listener.bind(c):null}function k(a){if(a.type.match("touch"))a.target.__touched__=!0;else if(a.target.__touched__&&a.type.match("mouse"))return void delete a.target.__touched__;return!0}function l(a){var b="over"==a;return{attach:"OverflowEvent"in y?"overflowchanged":[],condition:function(c){return c.flow=a,c.type==a+"flow"||0===c.orient&&c.horizontalOverflow==b||1==c.orient&&c.verticalOverflow==b||2==c.orient&&c.horizontalOverflow==b&&c.verticalOverflow==b}}}function m(a,b,c,d){d?b[a]=c[a]:Object.defineProperty(b,a,{writable:!0,enumerable:!0,value:c[a]})}function n(a,b){var c=Object.getOwnPropertyDescriptor(a,"target");for(var d in b)Q[d]||m(d,a,b,c);a.baseEvent=b}function o(a,b){return{value:a.boolean?"":b,method:a.boolean&&!b?"removeAttribute":"setAttribute"}}function p(a,b,c,d){var e=o(b,d);a[e.method](c,e.value)}function q(a,b,c,d,e){for(var f=b.property?[a.xtag[b.property]]:b.selector?T.query(a,b.selector):[],g=f.length;g--;)f[g][e](c,d)}function r(a,b,c){a.__view__&&a.__view__.updateBindingValue(a,b,c)}function s(a,b,c,d,e,f){var g=c.split(":"),h=g[0];if("get"==h)g[0]=b,a.prototype[b].get=T.applyPseudos(g.join(":"),d[c],a.pseudos,d[c]);else if("set"==h){g[0]=b;var i=a.prototype[b].set=T.applyPseudos(g.join(":"),e?function(a){this.xtag._skipSet=!0,this.xtag._skipAttr||p(this,e,f,a),this.xtag._skipAttr&&e.skip&&delete this.xtag._skipAttr,d[c].call(this,e.boolean?!!a:a),r(this,f,a),delete this.xtag._skipSet}:d[c]?function(a){d[c].call(this,a),r(this,f,a)}:null,a.pseudos,d[c]);e&&(e.setter=i)}else a.prototype[b][c]=d[c]}function t(a,b){a.prototype[b]={};var c=a.accessors[b],d=c.attribute,e=d&&d.name?d.name.toLowerCase():b;d&&(d.key=b,a.attributes[e]=d);for(var f in c)s(a,b,f,c,d,e);if(d){if(!a.prototype[b].get){var g=(d.boolean?"has":"get")+"Attribute";a.prototype[b].get=function(){return this[g](e)}}a.prototype[b].set||(a.prototype[b].set=function(a){p(this,d,e,a),r(this,e,a)})}}function u(a){S[a]=(S[a]||[]).filter(function(b){return(b.tags=b.tags.filter(function(b){return b!=a&&!T.tags[b]})).length||b.fn()})}function v(a,b,c){a.__tap__||(a.__tap__={click:"mousedown"==c.type},a.__tap__.click?a.addEventListener("click",b.observer):(a.__tap__.scroll=b.observer.bind(a),window.addEventListener("scroll",a.__tap__.scroll,!0),a.addEventListener("touchmove",b.observer),a.addEventListener("touchcancel",b.observer),a.addEventListener("touchend",b.observer))),a.__tap__.click||(a.__tap__.x=c.touches[0].pageX,a.__tap__.y=c.touches[0].pageY)}function w(a,b){a.__tap__&&(a.__tap__.click?a.removeEventListener("click",b.observer):(window.removeEventListener("scroll",a.__tap__.scroll,!0),a.removeEventListener("touchmove",b.observer),a.removeEventListener("touchcancel",b.observer),a.removeEventListener("touchend",b.observer)),delete a.__tap__)}function x(a,b,c){var d=c.changedTouches[0],e=b.gesture.tolerance;return d.pageXa.__tap__.x-e&&d.pageYa.__tap__.y-e?!0:void 0}var y=window,z=document,A=z.createElement("div"),B=function(){},C=function(){return!0},D=/([\w-]+(?:\([^\)]+\))?)/g,E=/(\w*)(?:\(([^\)]*)\))?/,F=/(\d+)/g,G={action:function(a,b){return a.value.match(F).indexOf(String(b.keyCode))>-1==("keypass"==a.name)||null}},H=function(){var a=y.getComputedStyle(z.documentElement,""),b=(Array.prototype.slice.call(a).join("").match(/-(moz|webkit|ms)-/)||""===a.OLink&&["","o"])[1];return{dom:"ms"==b?"MS":b,lowercase:b,css:"-"+b+"-",js:"ms"==b?b:b[0].toUpperCase()+b.substr(1)}}(),I=Element.prototype.matchesSelector||Element.prototype[H.lowercase+"MatchesSelector"],J=y.MutationObserver||y[H.js+"MutationObserver"],K={},L=K.toString,M=/\s([a-zA-Z]+)/;b.object=function(a){var c={};for(var d in a)c[d]=b(a[d]);return c},b.array=function(a){for(var c=a.length,d=new Array(c);c--;)d[c]=b(a[c]);return d};var N=["undefined","null","number","boolean","string","function"],O="",P=0,Q={};for(var R in z.createEvent("CustomEvent"))Q[R]=1;var S={},T={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(a,b){var d;if("string"==typeof a){d=a.toLowerCase();var e=b.prototype;delete b.prototype;var f=T.tags[d]=i(T.merge({},T.defaultOptions,b));for(var g in f.events)f.events[g]=T.parseEvent(g,f.events[g]);for(g in f.lifecycle)f.lifecycle[g.split(":")[0]]=T.applyPseudos(g,f.lifecycle[g],f.pseudos,f.lifecycle[g]);for(g in f.methods)f.prototype[g.split(":")[0]]={value:T.applyPseudos(g,f.methods[g],f.pseudos,f.methods[g]),enumerable:!0};for(g in f.accessors)t(f,g);var h=f.lifecycle.created||f.lifecycle.ready;f.prototype.createdCallback={enumerable:!0,value:function(){var a=this;T.addEvents(this,f.events),f.mixins.forEach(function(b){T.mixins[b].events&&T.addEvents(a,T.mixins[b].events)});var b=h?h.apply(this,arguments):null;for(var c in f.attributes){var d=f.attributes[c],e=this.hasAttribute(c);(e||d.boolean)&&(this[d.key]=d.boolean?e:this.getAttribute(c))}return f.pseudos.forEach(function(b){b.onAdd.call(a,b)}),b}};var j=f.lifecycle.inserted,k=f.lifecycle.removed;(j||k)&&(f.prototype.attachedCallback={value:function(){return k&&(this.xtag.__parentNode__=this.parentNode),j?j.apply(this,arguments):void 0},enumerable:!0}),k&&(f.prototype.detachedCallback={value:function(){var a=c(arguments);a.unshift(this.xtag.__parentNode__);var b=k.apply(this,a);return delete this.xtag.__parentNode__,b},enumerable:!0}),f.lifecycle.attributeChanged&&(f.prototype.attributeChangedCallback={value:f.lifecycle.attributeChanged,enumerable:!0});var l=f.prototype.setAttribute||HTMLElement.prototype.setAttribute;f.prototype.setAttribute={writable:!0,enumberable:!0,value:function(a,b){var c=f.attributes[a.toLowerCase()];this.xtag._skipAttr||l.call(this,a,c&&c.boolean?"":b),c&&(c.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,c.setter.call(this,c.boolean?!0:b)),b=c.skip?c.boolean?this.hasAttribute(a):this.getAttribute(a):b,q(this,c,a,c.boolean?"":b,"setAttribute")),delete this.xtag._skipAttr}};var m=f.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;f.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(a){var b=f.attributes[a.toLowerCase()];this.xtag._skipAttr||m.call(this,a),b&&(b.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,b.setter.call(this,b.boolean?!1:void 0)),q(this,b,a,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var n=e?e:b["extends"]?Object.create(z.createElement(b["extends"]).constructor).prototype:y.HTMLElement.prototype,o={prototype:Object.create(n,f.prototype)};b["extends"]&&(o["extends"]=b["extends"]);var p=z.registerElement(d,o);return u(d),p}},ready:function(a,b){var d={tags:c(a),fn:b};d.tags.reduce(function(a,b){return T.tags[b]?a:void(S[b]=S[b]||[]).push(d)},!0)&&b()},mixins:{},prefix:H,captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged","DOMMouseScroll"],customEvents:{overflow:l("over"),underflow:l("under"),animationstart:{attach:[H.dom+"AnimationStart"]},animationend:{attach:[H.dom+"AnimationEnd"]},transitionend:{attach:[H.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:k},enter:{attach:["mouseover","touchenter"],condition:k},leave:{attach:["mouseout","touchleave"],condition:k},scrollwheel:{attach:["DOMMouseScroll","mousewheel"],condition:function(a){return a.delta=a.wheelDelta?a.wheelDelta/40:Math.round(a.detail/3.5*-1),!0}},tapstart:{observe:{mousedown:z,touchstart:z},condition:k},tapend:{observe:{mouseup:z,touchend:z},condition:k},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(a,b){switch(a.type){case"move":return!0;case"dragover":var c=b.lastDrag||{};return b.lastDrag=a,c.pageX!=a.pageX&&c.pageY!=a.pageY||null;case"tapstart":b.move||(b.current=this,b.move=T.addEvents(this,{move:b.listener,dragover:b.listener}),b.tapend=T.addEvent(z,"tapend",b.listener));break;case"tapend":case"dragend":case"touchcancel":a.touches.length||(b.move&&T.removeEvents(b.current,b.move||{}),b.tapend&&T.removeEvent(z,b.tapend||{}),delete b.lastDrag,delete b.current,delete b.tapend,delete b.move)}}}},pseudos:{__mixin__:{},mixins:{onCompiled:function(a,b){var c=b.source.__mixins__;if(c)switch(b.value){case"before":return function(){var b=this,d=arguments;return c.forEach(function(a){a.apply(b,d)}),a.apply(b,d)};case"after":case null:return function(){var b=this,d=arguments;return returns=a.apply(b,d),c.forEach(function(a){a.apply(b,d)}),returns}}}},keypass:G,keyfail:G,delegate:{action:j},within:{action:j,onAdd:function(a){var b=a.source.condition;b&&(a.source.condition=function(c,d){return T.query(this,a.value).filter(function(a){return a==c.target||a.contains?a.contains(c.target):null})[0]?b.call(this,c,d):null})}},preventable:{action:function(a,b){return!b.defaultPrevented}}},clone:b,typeOf:a,toArray:c,wrap:function(a,b){return function(){var c=arguments,d=a.apply(this,c);return b.apply(this,c),d}},merge:function(b,c,d){if("string"==a(c))return f(b,c,d);for(var e=1,g=arguments.length;g>e;e++){var h=arguments[e];for(var i in h)f(b,i,h[i])}return b},uid:function(){return Math.random().toString(36).substr(2,10)},query:d,skipTransition:function(a,b,c){var d=H.js+"TransitionProperty";a.style[d]=a.style.transitionProperty="none";var e=b?b.call(c):null;return T.requestFrame(function(){T.requestFrame(function(){a.style[d]=a.style.transitionProperty="",e&&T.requestFrame(e)})})},requestFrame:function(){var a=y.requestAnimationFrame||y[H.lowercase+"RequestAnimationFrame"]||function(a){return y.setTimeout(a,20)};return function(b){return a(b)}}(),cancelFrame:function(){var a=y.cancelAnimationFrame||y[H.lowercase+"CancelAnimationFrame"]||y.clearTimeout;return function(b){return a(b)}}(),matchSelector:function(a,b){return I.call(a,b)},set:function(a,b,c){a[b]=c,window.CustomElements&&CustomElements.upgradeAll(a)},innerHTML:function(a,b){T.set(a,"innerHTML",b)},hasClass:function(a,b){return a.className.split(" ").indexOf(b.trim())>-1},addClass:function(a,b){var c=a.className.trim().split(" ");return b.trim().split(" ").forEach(function(a){~c.indexOf(a)||c.push(a)}),a.className=c.join(" ").trim(),a},removeClass:function(a,b){var c=b.trim().split(" ");return a.className=a.className.trim().split(" ").filter(function(a){return a&&!~c.indexOf(a)}).join(" "),a},toggleClass:function(a,b){return T[T.hasClass(a,b)?"removeClass":"addClass"].call(null,a,b)},queryChildren:function(a,b){var d=a.id,e=a.id=d||"x_"+T.uid(),f="#"+e+" > ",g=!1;a.parentNode||(g=!0,A.appendChild(a)),b=f+(b+"").replace(",",","+f,"g");var h=a.parentNode.querySelectorAll(b);return d||a.removeAttribute("id"),g&&A.removeChild(a),c(h)},createFragment:function(a){var b=z.createDocumentFragment();if(a){for(var d=b.appendChild(z.createElement("div")),e=c(a.nodeName?arguments:!(d.innerHTML=a)||d.children),f=e.length,g=0;f>g;)b.insertBefore(e[g++],d);b.removeChild(d)}return b},manipulate:function(a,b){var c=a.nextSibling,d=a.parentNode,e=z.createDocumentFragment(),f=b.call(e.appendChild(a),e)||a;c?d.insertBefore(f,c):d.appendChild(f)},applyPseudos:function(a,b,d,e){var f=b,g={};if(a.match(":"))for(var h=a.match(D),i=h.length;--i;)h[i].replace(E,function(b,j,k){if(!T.pseudos[j])throw"pseudo not found: "+j+" "+h;k=""===k||"undefined"==typeof k?null:k;var l=g[i]=Object.create(T.pseudos[j]);l.key=a,l.name=j,l.value=k,l.arguments=(k||"").split(","),l.action=l.action||C,l.source=e;var m=f;f=function(){var b=c(arguments),d={key:a,name:j,value:k,source:e,arguments:l.arguments,listener:m},f=l.action.apply(this,[d].concat(b));return null===f||f===!1?f:d.listener.apply(this,b)},d&&l.onAdd&&(d.nodeName?l.onAdd.call(d,l):d.push(l))});for(var j in g)g[j].onCompiled&&(f=g[j].onCompiled(f,g[j])||f);return f},removePseudos:function(a,b){b.forEach(function(b){b.onRemove&&b.onRemove.call(a,b)})},parseEvent:function(a,b){var d=a.split(":"),e=d.shift(),f=T.customEvents[e],g=T.merge({type:e,stack:B,condition:C,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:B,onRemove:B},f||{});g.attach=c(g.base||g.attach),g.chain=e+(g.pseudos.length?":"+g.pseudos:"")+(d.length?":"+d.join(":"):"");var h=g.condition;g.condition=function(a){a.touches,a.targetTouches;return h.apply(this,arguments)};var i=T.applyPseudos(g.chain,b,g._pseudos,g);if(g.stack=function(a){a.currentTarget=a.currentTarget||this;var b=(a.touches,a.targetTouches,a.detail||{});return b.__stack__?b.__stack__==i?(a.stopPropagation(),a.cancelBubble=!0,i.apply(this,arguments)):void 0:i.apply(this,arguments)},g.listener=function(a){var b=c(arguments),d=g.condition.apply(this,b.concat([g]));return d?a.type==e?g.stack.apply(this,b):void T.fireEvent(a.target,e,{baseEvent:a,detail:d!==!0&&(d.__stack__=i)?d:{__stack__:i}}):d},g.attach.forEach(function(a){g._attach.push(T.parseEvent(a,g.listener))}),f&&f.observe&&!f.__observing__){f.observer=function(a){var b=g.condition.apply(this,c(arguments).concat([f]));return b?void T.fireEvent(a.target,e,{baseEvent:a,detail:b!==!0?b:{}}):b};for(var j in f.observe)T.addEvent(f.observe[j]||document,j,f.observer,!0);f.__observing__=!0}return g},addEvent:function(a,b,c,d){var e="function"==typeof c?T.parseEvent(b,c):c;return e._pseudos.forEach(function(b){b.onAdd.call(a,b)}),e._attach.forEach(function(b){T.addEvent(a,b.type,b)}),e.onAdd.call(a,e,e.listener),a.addEventListener(e.type,e.stack,d||T.captureEvents.indexOf(e.type)>-1),e},addEvents:function(a,b){var c={};for(var d in b)c[d]=T.addEvent(a,d,b[d]);return c},removeEvent:function(a,b,c){c=c||b,c.onRemove.call(a,c,c.listener),T.removePseudos(a,c._pseudos),c._attach.forEach(function(b){T.removeEvent(a,b)}),a.removeEventListener(c.type,c.stack)},removeEvents:function(a,b){for(var c in b)T.removeEvent(a,b[c])},fireEvent:function(a,b,c,d){var e=z.createEvent("CustomEvent");c=c||{},d&&console.warn("fireEvent has been modified"),e.initCustomEvent(b,c.bubbles!==!1,c.cancelable!==!1,c.detail),c.baseEvent&&n(e,c.baseEvent);try{a.dispatchEvent(e)}catch(f){console.warn("This error may have been caused by a change in the fireEvent method",f)}},addObserver:function(a,b,c){a._records||(a._records={inserted:[],removed:[]},J?(a._observer=new J(function(b){e(a,b)}),a._observer.observe(a,{subtree:!0,childList:!0,attributes:!1,characterData:!1})):["Inserted","Removed"].forEach(function(b){a.addEventListener("DOMNode"+b,function(c){c._mutation=!0,a._records[b.toLowerCase()].forEach(function(a){a(c.target,c)})},!1)})),-1==a._records[b].indexOf(c)&&a._records[b].push(c)},removeObserver:function(a,b,c){var d=a._records;d&&c?d[b].splice(d[b].indexOf(c),1):d[b]=[]}},U=!1,V=null;z.addEventListener("mousedown",function(a){U=!0,V=a.target},!0),z.addEventListener("mouseup",function(){U=!1,V=null},!0),z.addEventListener("dragend",function(){U=!1,V=null},!0);var W={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=U?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=U&&this.currentTarget&&(this.currentTarget==V||this.currentTarget.contains&&this.currentTarget.contains(V))?(this.identifier=0)||[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.__changedTouches__||(this.identifier=0)||(this.__changedTouches__=[this])}}};for(R in W)UIEvent.prototype[R]=W[R],Object.defineProperty(UIEvent.prototype,R,W[R]);T.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(a,b){var c=a.target;switch(a.type){case"touchstart":return c.__tap__&&c.__tap__.click&&w(c,b),void v(c,b,a);case"mousedown":return void(c.__tap__||v(c,b,a));case"scroll":case"touchcancel":return void w(this,b);case"touchmove":case"touchend":return this.__tap__&&!x(this,b,a)?void w(this,b):"touchend"==a.type||null;case"click":return w(this,b),!0}}},y.xtag=T,"function"==typeof define&&define.amd&&define(T),z.addEventListener("WebComponentsReady",function(){T.fireEvent(z.body,"DOMComponentsLoaded")})}();
\ No newline at end of file
diff --git a/dist/x-tag-deck.css b/dist/x-tag-deck.css
index 9fd910e3..6dad4c40 100644
--- a/dist/x-tag-deck.css
+++ b/dist/x-tag-deck.css
@@ -12,18 +12,11 @@ x-deck > x-card {
right: 0;
height: 100%;
width: 100%;
- overflow: hidden;
z-index: 0;
opacity: 1;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
- -ms-box-sizing: border-box;
box-sizing: border-box;
- -webkit-transform-style: preserve-3d;
- -moz-transform-style: preserve-3d;
- -ms-transform-style: preserve-3d;
- -o-transform-style: preserve-3d;
- transform-style: preserve-3d;
-webkit-transform: translate(0%, 0%) scale(1);
-moz-transform: translate(0%, 0%) scale(1);
-ms-transform: translate(0%, 0%) scale(1);
diff --git a/dist/x-tag-deck.js b/dist/x-tag-deck.js
index fa02317e..5a8f5673 100644
--- a/dist/x-tag-deck.js
+++ b/dist/x-tag-deck.js
@@ -1,101 +1,3 @@
-(function() {
- var matchNum = /[1-9]/;
- var replaceSpaces = / /g;
- var captureTimes = /(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi;
- var transPre = "transition" in getComputedStyle(document.documentElement) ? "t" : xtag.prefix.js + "T";
- var transDur = transPre + "ransitionDuration";
- var transProp = transPre + "ransitionProperty";
- var skipFrame = function(fn) {
- xtag.requestFrame(function() {
- xtag.requestFrame(fn);
- });
- };
- var ready;
- if (document.readyState == "complete") {
- ready = skipFrame(function() {
- ready = false;
- });
- } else {
- ready = xtag.addEvent(document, "readystatechange", function() {
- if (document.readyState == "complete") {
- skipFrame(function() {
- ready = false;
- });
- xtag.removeEvent(document, "readystatechange", ready);
- }
- });
- }
- function getTransitions(node) {
- node.__transitions__ = node.__transitions__ || {};
- return node.__transitions__;
- }
- function startTransition(node, name, transitions) {
- var style = getComputedStyle(node), after = transitions[name].after;
- node.setAttribute("transition", name);
- if (after && !style[transDur].match(matchNum)) {
- after();
- }
- }
- xtag.addEvents(document, {
- transitionend: function(e) {
- var node = e.target, name = node.getAttribute("transition");
- if (name) {
- var i = 0, max = 0, prop = null, style = getComputedStyle(node), transitions = getTransitions(node), props = style[transProp].replace(replaceSpaces, "").split(",");
- style[transDur].replace(captureTimes, function(match, time, unit) {
- time = parseFloat(time) * (unit === "s" ? 1e3 : 1);
- if (time > max) {
- prop = i;
- max = time;
- }
- i++;
- });
- prop = props[prop];
- if (!prop) {
- throw new SyntaxError("No matching transition property found");
- } else if (e.propertyName == prop && transitions[name].after) {
- transitions[name].after();
- }
- }
- }
- });
- xtag.transition = function(node, name, obj) {
- var transitions = getTransitions(node), options = transitions[name] = obj || {};
- if (options.immediate) {
- options.immediate();
- }
- if (options.before) {
- options.before();
- if (ready) {
- xtag.skipTransition(node, function() {
- startTransition(node, name, transitions);
- });
- } else {
- skipFrame(function() {
- startTransition(node, name, transitions);
- });
- }
- } else {
- startTransition(node, name, transitions);
- }
- };
- xtag.pseudos.transition = {
- onCompiled: function(fn, pseudo) {
- var options = {}, when = pseudo["arguments"][0] || "immediate", name = pseudo["arguments"][1] || pseudo.key.split(":")[0];
- return function() {
- var target = this, args = arguments;
- if (this.hasAttribute("transition")) {
- options[when] = function() {
- return fn.apply(target, args);
- };
- xtag.transition(this, name, options);
- } else {
- return fn.apply(this, args);
- }
- };
- }
- };
-})();
-
(function() {
var sides = {
next: [ "nextElementSibling", "firstElementChild" ],
@@ -108,7 +10,7 @@
return item && item.nodeName ? item : isNaN(item) ? xtag.queryChildren(deck, item) : deck.children[item];
}
function checkCard(deck, card, selected) {
- return card && (selected ? card == deck.xtag.selected : card != deck.xtag.selected) && deck == card.parentNode && card.nodeName == "X-CARD";
+ return card && (selected ? card == deck.xtag.selected : card != deck.xtag.selected) && deck == card.parentNode && card.nodeName.toLowerCase() == "x-card";
}
function shuffle(deck, side, direction) {
var getters = sides[side];
@@ -234,7 +136,7 @@
lifecycle: {
inserted: function() {
var deck = this.parentNode;
- if (deck.nodeName == "X-DECK") {
+ if (deck.nodeName.toLowerCase() == "x-deck") {
this.xtag.deck = deck;
if (this != deck.selected && this.selected) {
deck.showCard(this);
diff --git a/dist/x-tag-deck.min.css b/dist/x-tag-deck.min.css
index 6220cda2..beeca8f6 100644
--- a/dist/x-tag-deck.min.css
+++ b/dist/x-tag-deck.min.css
@@ -1,5 +1,5 @@
x-deck{display:block;position:relative;overflow:hidden;height:100%;width:100%}
-x-deck > x-card{display:none;position:absolute !important;left:0;right:0;height:100%;width:100%;overflow:hidden;z-index:0;opacity:1;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-ms-transform-style:preserve-3d;-o-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transform:translate(0%,0%) scale(1);-moz-transform:translate(0%,0%) scale(1);-ms-transform:translate(0%,0%) scale(1);-o-transform:translate(0%,0%) scale(1);transform:translate(0%,0%) scale(1)}
+x-deck > x-card{display:none;position:absolute !important;left:0;right:0;height:100%;width:100%;z-index:0;opacity:1;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transform:translate(0%,0%) scale(1);-moz-transform:translate(0%,0%) scale(1);-ms-transform:translate(0%,0%) scale(1);-o-transform:translate(0%,0%) scale(1);transform:translate(0%,0%) scale(1)}
x-deck > x-card[selected],x-deck > x-card[transition]{display:block}
x-deck[transition-type="fade-scale"] > x-card,x-deck > x-card[transition-type="fade-scale"]{opacity:0;-webkit-transform:scale(.85);-moz-transform:scale(.85);-ms-transform:scale(.85);-o-transform:scale(.85);transform:scale(.85);-webkit-transition:opacity .5s ease,-webkit-transform .5s ease;-moz-transition:opacity .5s ease,-moz-transform .5s ease;-ms-transition:opacity .5s ease,-ms-transform .5s ease;-o-transition:opacity .5s ease,-o-transform .5s ease;transition:opacity .5s ease,transform .5s ease}
x-deck > x-card[show][transition]{opacity:1;-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}
diff --git a/dist/x-tag-deck.min.js b/dist/x-tag-deck.min.js
index 84aa9c00..58cdfc1e 100644
--- a/dist/x-tag-deck.min.js
+++ b/dist/x-tag-deck.min.js
@@ -1 +1 @@
-!function(){function a(a){return a.__transitions__=a.__transitions__||{},a.__transitions__}function b(a,b,c){var e=getComputedStyle(a),f=c[b].after;a.setAttribute("transition",b),f&&!e[h].match(d)&&f()}var c,d=/[1-9]/,e=/ /g,f=/(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi,g="transition"in getComputedStyle(document.documentElement)?"t":xtag.prefix.js+"T",h=g+"ransitionDuration",i=g+"ransitionProperty",j=function(a){xtag.requestFrame(function(){xtag.requestFrame(a)})};c="complete"==document.readyState?j(function(){c=!1}):xtag.addEvent(document,"readystatechange",function(){"complete"==document.readyState&&(j(function(){c=!1}),xtag.removeEvent(document,"readystatechange",c))}),xtag.addEvents(document,{transitionend:function(b){var c=b.target,d=c.getAttribute("transition");if(d){var g=0,j=0,k=null,l=getComputedStyle(c),m=a(c),n=l[i].replace(e,"").split(",");if(l[h].replace(f,function(a,b,c){b=parseFloat(b)*("s"===c?1e3:1),b>j&&(k=g,j=b),g++}),k=n[k],!k)throw new SyntaxError("No matching transition property found");b.propertyName==k&&m[d].after&&m[d].after()}}}),xtag.transition=function(d,e,f){var g=a(d),h=g[e]=f||{};h.immediate&&h.immediate(),h.before?(h.before(),c?xtag.skipTransition(d,function(){b(d,e,g)}):j(function(){b(d,e,g)})):b(d,e,g)},xtag.pseudos.transition={onCompiled:function(a,b){var c={},d=b.arguments[0]||"immediate",e=b.arguments[1]||b.key.split(":")[0];return function(){var b=this,f=arguments;return this.hasAttribute("transition")?(c[d]=function(){return a.apply(b,f)},xtag.transition(this,e,c),void 0):a.apply(this,f)}}}}(),function(){function a(a,b){return Array.prototype.indexOf.call(a.children,b)}function b(a,b){return b&&b.nodeName?b:isNaN(b)?xtag.queryChildren(a,b):a.children[b]}function c(a,b,c){return b&&(c?b==a.xtag.selected:b!=a.xtag.selected)&&a==b.parentNode&&"X-CARD"==b.nodeName}function d(a,b,c){var d=e[b],f=a.xtag.selected&&a.xtag.selected[d[0]];f?a.showCard(f,c):(a.loop||-1==a.selectedIndex)&&a.showCard(a[d[1]],c)}var e={next:["nextElementSibling","firstElementChild"],previous:["previousElementSibling","lastElementChild"]};xtag.register("x-deck",{events:{"reveal:delegate(x-card)":function(a){this.parentNode==a.currentTarget&&a.currentTarget.showCard(this)}},accessors:{loop:{attribute:{"boolean":!0}},cards:{get:function(){return xtag.queryChildren(this,"x-card")}},selectedCard:{get:function(){return this.xtag.selected||null},set:function(a){this.showCard(a)}},selectedIndex:{attribute:{name:"selected-index",unlink:!0},get:function(){return this.hasAttribute("selected-index")?Number(this.getAttribute("selected-index")):-1},set:function(a){var b=Number(a),c=this.cards[b];c?(this.setAttribute("selected-index",b),c!=this.xtag.selected&&this.showCard(c)):(this.removeAttribute("selected-index"),this.xtag.selected&&this.hideCard(this.xtag.selected))}},transitionType:{attribute:{name:"transition-type"}}},methods:{nextCard:function(a){d(this,"next",a)},previousCard:function(a){d(this,"previous",a)},showCard:function(d,e){var f=b(this,d);if(c(this,f,!1)){var g=this.xtag.selected,h=a(this,f);e=e||(h>a(this,g)?"forward":"reverse"),g&&this.hideCard(g,e),this.xtag.selected=f,this.selectedIndex=h,f.hasAttribute("selected")||(f.selected=!0),xtag.transition(f,"show",{before:function(){f.setAttribute("show",""),f.setAttribute("transition-direction",e)},after:function(){xtag.fireEvent(f,"show")}})}},hideCard:function(a,d){var e=b(this,a);c(this,e,!0)&&(this.xtag.selected=null,e.hasAttribute("selected")&&(e.selected=!1),xtag.transition(e,"hide",{before:function(){e.removeAttribute("show"),e.setAttribute("hide",""),e.setAttribute("transition-direction",d||"reverse")},after:function(){e.removeAttribute("hide"),e.removeAttribute("transition"),e.removeAttribute("transition-direction"),xtag.fireEvent(e,"hide")}}))}}}),xtag.register("x-card",{lifecycle:{inserted:function(){var a=this.parentNode;"X-DECK"==a.nodeName&&(this.xtag.deck=a,this!=a.selected&&this.selected&&a.showCard(this))},removed:function(){var a=this.xtag.deck;a&&(this==a.xtag.selected?(a.xtag.selected=null,a.removeAttribute("selected-index")):a.showCard(a.selectedCard),this.xtag.deck=null)}},accessors:{transitionType:{attribute:{name:"transition-type"}},selected:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.deck;b&&(a&&this!=b.selected?b.showCard(this):a||this!=b.selected||b.hideCard(this))}}}})}();
\ No newline at end of file
+!function(){function a(a,b){return Array.prototype.indexOf.call(a.children,b)}function b(a,b){return b&&b.nodeName?b:isNaN(b)?xtag.queryChildren(a,b):a.children[b]}function c(a,b,c){return b&&(c?b==a.xtag.selected:b!=a.xtag.selected)&&a==b.parentNode&&"x-card"==b.nodeName.toLowerCase()}function d(a,b,c){var d=e[b],f=a.xtag.selected&&a.xtag.selected[d[0]];f?a.showCard(f,c):(a.loop||-1==a.selectedIndex)&&a.showCard(a[d[1]],c)}var e={next:["nextElementSibling","firstElementChild"],previous:["previousElementSibling","lastElementChild"]};xtag.register("x-deck",{events:{"reveal:delegate(x-card)":function(a){this.parentNode==a.currentTarget&&a.currentTarget.showCard(this)}},accessors:{loop:{attribute:{"boolean":!0}},cards:{get:function(){return xtag.queryChildren(this,"x-card")}},selectedCard:{get:function(){return this.xtag.selected||null},set:function(a){this.showCard(a)}},selectedIndex:{attribute:{name:"selected-index",unlink:!0},get:function(){return this.hasAttribute("selected-index")?Number(this.getAttribute("selected-index")):-1},set:function(a){var b=Number(a),c=this.cards[b];c?(this.setAttribute("selected-index",b),c!=this.xtag.selected&&this.showCard(c)):(this.removeAttribute("selected-index"),this.xtag.selected&&this.hideCard(this.xtag.selected))}},transitionType:{attribute:{name:"transition-type"}}},methods:{nextCard:function(a){d(this,"next",a)},previousCard:function(a){d(this,"previous",a)},showCard:function(d,e){var f=b(this,d);if(c(this,f,!1)){var g=this.xtag.selected,h=a(this,f);e=e||(h>a(this,g)?"forward":"reverse"),g&&this.hideCard(g,e),this.xtag.selected=f,this.selectedIndex=h,f.hasAttribute("selected")||(f.selected=!0),xtag.transition(f,"show",{before:function(){f.setAttribute("show",""),f.setAttribute("transition-direction",e)},after:function(){xtag.fireEvent(f,"show")}})}},hideCard:function(a,d){var e=b(this,a);c(this,e,!0)&&(this.xtag.selected=null,e.hasAttribute("selected")&&(e.selected=!1),xtag.transition(e,"hide",{before:function(){e.removeAttribute("show"),e.setAttribute("hide",""),e.setAttribute("transition-direction",d||"reverse")},after:function(){e.removeAttribute("hide"),e.removeAttribute("transition"),e.removeAttribute("transition-direction"),xtag.fireEvent(e,"hide")}}))}}}),xtag.register("x-card",{lifecycle:{inserted:function(){var a=this.parentNode;"x-deck"==a.nodeName.toLowerCase()&&(this.xtag.deck=a,this!=a.selected&&this.selected&&a.showCard(this))},removed:function(){var a=this.xtag.deck;a&&(this==a.xtag.selected?(a.xtag.selected=null,a.removeAttribute("selected-index")):a.showCard(a.selectedCard),this.xtag.deck=null)}},accessors:{transitionType:{attribute:{name:"transition-type"}},selected:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.deck;b&&(a&&this!=b.selected?b.showCard(this):a||this!=b.selected||b.hideCard(this))}}}})}();
\ No newline at end of file
diff --git a/dist/x-tag-layout.js b/dist/x-tag-layout.js
index 26f8bcc2..59c41571 100644
--- a/dist/x-tag-layout.js
+++ b/dist/x-tag-layout.js
@@ -44,7 +44,7 @@
scroll: evaluateScroll,
transitionend: function(e) {
var node = e.target;
- if (this.hasAttribute("content-maximizing") && node.parentNode == this && (node.nodeName == "HEADER" || node.nodeName == "FOOTER")) {
+ if (this.hasAttribute("content-maximizing") && node.parentNode == this && (node.nodeName.toLowerCase() == "header" || node.nodeName.toLowerCase() == "footer")) {
this.setAttribute("content-maximized", null);
this.removeAttribute("content-maximizing");
}
diff --git a/dist/x-tag-layout.min.js b/dist/x-tag-layout.min.js
index c6e841e7..c03b3f40 100644
--- a/dist/x-tag-layout.min.js
+++ b/dist/x-tag-layout.min.js
@@ -1 +1 @@
-!function(){function a(a,b){var c=b.__layoutScroll__=b.__layoutScroll__||Object.defineProperty(b,"__layoutScroll__",{value:{last:b.scrollTop}}).__layoutScroll__,d=b.scrollTop,e=a.scrollBuffer;return c.max=c.max||Math.max(d+e,e),c.min=c.min||Math.max(d-e,e),c}function b(a){a.setAttribute("content-maximizing",null)}function c(a){a.removeAttribute("content-maximized"),a.removeAttribute("content-maximizing")}function d(d){var e=d.currentTarget;if("scroll"==e.hideTrigger&&!d.currentTarget.hasAttribute("content-maximizing")){var f=d.target;if(e.scrollTarget?xtag.matchSelector(f,e.scrollTarget):f.parentNode==e){var g=f.scrollTop,h=e.scrollBuffer,i=a(e,f);g>i.last?i.min=Math.max(g-h,h):gi.max&&!e.hasAttribute("content-maximized")?b(e):gi.last?i.min=Math.max(g-h,h):gi.max&&!e.hasAttribute("content-maximized")?b(e):g=+c)throw"invalid step "+c;return e((b-d)/c)*c+d}function d(a,b,d,e){return b>a?b:a>d?Math.max(b,c(d,e,b,Math.floor)):a}function e(a,b,e){var f=c((b-a)/2+a,e,a);return d(f,a,b,e)}function f(a,b){var c=a.min,d=a.max;return(b-c)/(d-c)}function g(a,b){var c=a.min,d=a.max;return(d-c)*b+c}function h(a,b){b=Math.min(Math.max(0,b),1);var e=g(a,b),f=c(e,a.step,a.min);return d(f,a.min,a.max,a.step)}function i(a,b){var c=a.xtag.sliderThumb;if(c){var d=a.getBoundingClientRect(),e=c.getBoundingClientRect(),g=f(a,b),h=a.vertical,i=d[h?"height":"width"],j=e[h?"height":"width"],k=Math.max(i-j,0),l=k*g,m=l/i;c.style[h?"left":"top"]=0,c.style[h?"top":"left"]=100*m+"%",a.xtag.sliderProgress.style[h?"height":"width"]=100*g+"%"}}function j(a){i(a,a.value)}function k(a,b,c){var d=a.xtag.rangeInputEl,e=d.getBoundingClientRect(),f=a.xtag.sliderThumb.getBoundingClientRect().width,g=b-e.left-f/2,i=e.width-f/2;a.vertical&&(i=e.height,g=c-e.top),a.value=h(a,g/i),xtag.fireEvent(a,"input"),j(a)}function l(a,b,c){a.xtag.dragInitVal=a.value,k(a,b,c);var d=a.xtag.callbackFns,e=function(a,b){document.body.addEventListener(a,b)};e("mousemove",d.onMouseDragMove),e("touchmove",d.onTouchDragMove),e("mouseup",d.onDragEnd),e("touchend",d.onDragEnd);var f=a.xtag.sliderThumb;f&&f.setAttribute("active",!0)}function m(a,b,c){k(a,b,c)}function n(a){return{onMouseDragStart:function(b){b.button===p&&(l(a,b.pageX,b.pageY),b.preventDefault())},onTouchDragStart:function(b){var c=b.targetTouches;1===c.length&&(l(a,c[0].pageX,c[0].pageY),b.preventDefault())},onMouseDragMove:function(b){m(a,b.pageX,b.pageY),b.preventDefault()},onTouchDragMove:function(b){var c=b.targetTouches;1===c.length&&(m(a,c[0].pageX,c[0].pageY),b.preventDefault())},onDragEnd:function(b){var c=a.xtag.callbackFns,d=function(a,b){document.body.removeEventListener(a,b)};d("mousemove",c.onMouseDragMove),d("touchmove",c.onTouchDragMove),d("mouseup",c.onDragEnd),d("touchend",c.onDragEnd);var e=a.xtag.sliderThumb;e&&e.removeAttribute("active"),a.value!==a.xtag.dragInitVal&&xtag.fireEvent(a,"change"),a.xtag.dragInitVal=null,b.preventDefault()},onKeyDown:function(a){var b=a.keyCode;if(b in o){var c=this.value,d=this.min,e=this.max,f=this.step,g=Math.max(0,e-d),h=Math.max(g/10,f);switch(o[b]){case"LEFT_ARROW":case"DOWN_ARROW":this.value=Math.max(c-f,d);break;case"RIGHT_ARROW":case"UP_ARROW":this.value=Math.min(c+f,e);break;case"HOME":this.value=d;break;case"END":this.value=e;break;case"PAGE_DOWN":this.value=Math.max(c-h,d);break;case"PAGE_UP":this.value=Math.min(c+h,e)}this.value!==c&&xtag.fireEvent(this,"change"),a.preventDefault()}}}}var o={33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT_ARROW",38:"UP_ARROW",39:"RIGHT_ARROW",40:"DOWN_ARROW"},p=0;xtag.register("x-slider",{lifecycle:{created:function(){var a=this;a.xtag.callbackFns=n(a),a.xtag.dragInitVal=null;var c=document.createElement("input");xtag.addClass(c,"input"),c.setAttribute("type","range");var d=b(a,"max")?+a.getAttribute("max"):100,f=b(a,"min")?+a.getAttribute("min"):0,g=b(a,"step")?+a.getAttribute("step"):1;g=g>0?g:1;var h=b(a,"value")?+a.getAttribute("value"):e(f,d,g);c.setAttribute("max",d),c.setAttribute("min",f),c.setAttribute("step",g),c.setAttribute("value",h),a.xtag.rangeInputEl=c,a.appendChild(a.xtag.rangeInputEl);var i=document.createElement("div");xtag.addClass(i,"slider-track"),this.xtag.sliderTrack=i,this.appendChild(i);var j=document.createElement("div");xtag.addClass(j,"slider-progress"),this.xtag.sliderProgress=j,i.appendChild(j);var k=document.createElement("span");xtag.addClass(k,"slider-thumb"),this.xtag.sliderThumb=k,this.appendChild(k),"range"!==c.type||a.hasAttribute("polyfill")?a.setAttribute("polyfill",!0):a.removeAttribute("polyfill"),this.addEventListener("mousedown",a.xtag.callbackFns.onMouseDragStart),this.addEventListener("touchstart",a.xtag.callbackFns.onTouchDragStart),this.addEventListener("keydown",a.xtag.callbackFns.onKeyDown),a.setAttribute("value",h)},inserted:function(){var a=this;xtag.requestFrame(function(){xtag.requestFrame(function(){j(a)})})},attributeChanged:function(a){("min"==a||"max"==a||"step"==a)&&j(this)}},events:{"change:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"input:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"input")},"focus:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"focus",{},{bubbles:!1})},"blur:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"blur",{},{bubbles:!1})}},accessors:{polyfill:{attribute:{"boolean":!0},set:function(a){this.xtag.callbackFns,a?(this.setAttribute("tabindex",0),this.xtag.rangeInputEl.setAttribute("tabindex",-1),this.xtag.rangeInputEl.setAttribute("readonly",!0),j(this)):(this.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("readonly"))}},vertical:{attribute:{"boolean":!0},set:function(){j(this)}},max:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("max")}},min:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("min")}},step:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("step")}},name:{attribute:{selector:"input[type=range]"},set:function(a){var b=this.xtag.rangeInputEl;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},value:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.value},set:function(b){a(b)||(b=e(this.min,this.max,this.step)),b=+b;var f=this.min,g=this.max,h=this.step,i=c(b,h,f),k=d(i,f,g,h);this.xtag.rangeInputEl.value=k,j(this)}},inputElem:{get:function(){return this.xtag.rangeInputEl}}},methods:{}})}();
\ No newline at end of file
+!function(){function a(a){return!isNaN(parseFloat(a))}function b(b,c){return b.hasAttribute(c)&&a(b.getAttribute(c))}function c(b,c,d,e){if(e=e?e:Math.round,d=a(d)?d:0,!a(b))throw"invalid value "+b;if(!a(c)||0>=+c)throw"invalid step "+c;return e((b-d)/c)*c+d}function d(a,b,d,e){return b>a?b:a>d?Math.max(b,c(d,e,b,Math.floor)):a}function e(a,b,e){var f=c((b-a)/2+a,e,a);return d(f,a,b,e)}function f(a,b){var c=a.min,d=a.max;return(b-c)/(d-c)}function g(a,b){var c=a.min,d=a.max;return(d-c)*b+c}function h(a,b){b=Math.min(Math.max(0,b),1);var e=g(a,b),f=c(e,a.step,a.min);return d(f,a.min,a.max,a.step)}function i(a,b){var c=a.xtag.sliderThumb;if(c){var d=a.getBoundingClientRect(),e=c.getBoundingClientRect(),g=f(a,b),h=a.vertical,i=d[h?"height":"width"],j=e[h?"height":"width"],k=Math.max(i-j,0),l=k*g,m=l/i;c.style[h?"left":"top"]=0,c.style[h?"top":"left"]=100*m+"%",a.xtag.sliderProgress.style[h?"height":"width"]=100*g+"%"}}function j(a){i(a,a.value)}function k(a,b,c){var d=a.xtag.rangeInputEl,e=d.getBoundingClientRect(),f=a.xtag.sliderThumb.getBoundingClientRect().width,g=b-e.left-f/2,i=e.width-f/2;a.vertical&&(i=e.height,g=c-e.top),a.value=h(a,g/i),xtag.fireEvent(a,"input"),j(a)}function l(a,b,c){a.xtag.dragInitVal=a.value,k(a,b,c);var d=a.xtag.callbackFns,e=function(a,b){document.body.addEventListener(a,b)};e("mousemove",d.onMouseDragMove),e("touchmove",d.onTouchDragMove),e("mouseup",d.onDragEnd),e("touchend",d.onDragEnd);var f=a.xtag.sliderThumb;f&&f.setAttribute("active",!0)}function m(a,b,c){k(a,b,c)}function n(a){return{onMouseDragStart:function(b){b.button===p&&(l(a,b.pageX,b.pageY),b.preventDefault())},onTouchDragStart:function(b){var c=b.targetTouches;1===c.length&&(l(a,c[0].pageX,c[0].pageY),b.preventDefault())},onMouseDragMove:function(b){m(a,b.pageX,b.pageY),b.preventDefault()},onTouchDragMove:function(b){var c=b.targetTouches;1===c.length&&(m(a,c[0].pageX,c[0].pageY),b.preventDefault())},onDragEnd:function(b){var c=a.xtag.callbackFns,d=function(a,b){document.body.removeEventListener(a,b)};d("mousemove",c.onMouseDragMove),d("touchmove",c.onTouchDragMove),d("mouseup",c.onDragEnd),d("touchend",c.onDragEnd);var e=a.xtag.sliderThumb;e&&e.removeAttribute("active"),a.value!==a.xtag.dragInitVal&&xtag.fireEvent(a,"change"),a.xtag.dragInitVal=null,b.preventDefault()},onKeyDown:function(a){var b=a.keyCode;if(b in o){var c=this.value,d=this.min,e=this.max,f=this.step,g=Math.max(0,e-d),h=Math.max(g/10,f);switch(o[b]){case"LEFT_ARROW":case"DOWN_ARROW":this.value=Math.max(c-f,d);break;case"RIGHT_ARROW":case"UP_ARROW":this.value=Math.min(c+f,e);break;case"HOME":this.value=d;break;case"END":this.value=e;break;case"PAGE_DOWN":this.value=Math.max(c-h,d);break;case"PAGE_UP":this.value=Math.min(c+h,e)}this.value!==c&&xtag.fireEvent(this,"change"),a.preventDefault()}}}}var o={33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT_ARROW",38:"UP_ARROW",39:"RIGHT_ARROW",40:"DOWN_ARROW"},p=0;xtag.register("x-slider",{lifecycle:{created:function(){var a=this;a.xtag.callbackFns=n(a),a.xtag.dragInitVal=null;var c=document.createElement("input");xtag.addClass(c,"input"),c.setAttribute("type","range");var d=b(a,"max")?+a.getAttribute("max"):100,f=b(a,"min")?+a.getAttribute("min"):0,g=b(a,"step")?+a.getAttribute("step"):1;g=g>0?g:1;var h=b(a,"value")?+a.getAttribute("value"):e(f,d,g);c.setAttribute("max",d),c.setAttribute("min",f),c.setAttribute("step",g),c.setAttribute("value",h),a.xtag.rangeInputEl=c,a.appendChild(a.xtag.rangeInputEl);var i=document.createElement("div");xtag.addClass(i,"slider-track"),this.xtag.sliderTrack=i,this.appendChild(i);var j=document.createElement("div");xtag.addClass(j,"slider-progress"),this.xtag.sliderProgress=j,i.appendChild(j);var k=document.createElement("span");xtag.addClass(k,"slider-thumb"),this.xtag.sliderThumb=k,this.appendChild(k),"range"!==c.type||a.hasAttribute("polyfill")?a.setAttribute("polyfill",!0):a.removeAttribute("polyfill"),this.addEventListener("mousedown",a.xtag.callbackFns.onMouseDragStart),this.addEventListener("touchstart",a.xtag.callbackFns.onTouchDragStart),this.addEventListener("keydown",a.xtag.callbackFns.onKeyDown),a.setAttribute("value",h)},inserted:function(){var a=this;xtag.requestFrame(function(){xtag.requestFrame(function(){j(a)})})},attributeChanged:function(a){("min"==a||"max"==a||"step"==a)&&j(this)}},events:{"change:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"input:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"input")},"focus:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"focus",{},{bubbles:!1})},"blur:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"blur",{},{bubbles:!1})}},accessors:{polyfill:{attribute:{"boolean":!0},set:function(a){this.xtag.callbackFns;a?(this.setAttribute("tabindex",0),this.xtag.rangeInputEl.setAttribute("tabindex",-1),this.xtag.rangeInputEl.setAttribute("readonly",!0),j(this)):(this.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("readonly"))}},vertical:{attribute:{"boolean":!0},set:function(){j(this)}},max:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("max")}},min:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("min")}},step:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("step")}},name:{attribute:{selector:"input[type=range]"},set:function(a){var b=this.xtag.rangeInputEl;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},value:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.value},set:function(b){a(b)||(b=e(this.min,this.max,this.step)),b=+b;var f=this.min,g=this.max,h=this.step,i=c(b,h,f),k=d(i,f,g,h);this.xtag.rangeInputEl.value=k,j(this)}},inputElem:{get:function(){return this.xtag.rangeInputEl}}},methods:{}})}();
\ No newline at end of file
diff --git a/dist/x-tag-toggle.js b/dist/x-tag-toggle.js
index c03ea2e5..721c9675 100644
--- a/dist/x-tag-toggle.js
+++ b/dist/x-tag-toggle.js
@@ -48,7 +48,7 @@
toggle.active = true;
}
function inTogglebar(toggle) {
- return toggle.parentNode && toggle.parentNode.nodeName == "X-TOGGLEBAR";
+ return toggle.parentNode && toggle.parentNode.nodeName.toLowerCase() == "x-togglebar";
}
var shifted = false;
xtag.addEvents(document, {
diff --git a/dist/x-tag-toggle.min.js b/dist/x-tag-toggle.min.js
index 5e209fcd..4ca8483d 100644
--- a/dist/x-tag-toggle.min.js
+++ b/dist/x-tag-toggle.min.js
@@ -1 +1 @@
-!function(){function a(a){var b=a.xtag.input.form;b?a.removeAttribute("x-toggle-no-form"):a.setAttribute("x-toggle-no-form",""),a.xtag.scope=a.parentNode?b||document:null}function b(a){var b={},c=a==document?"[x-toggle-no-form]":"";xtag.query(a,"x-toggle[name]"+c).forEach(function(d){var e=d.name;if(e&&!b[e]){var f=xtag.query(a,'x-toggle[name="'+e+'"]'+c),g=f.length>1?"radio":"checkbox";f.forEach(function(a){a.xtag&&a.xtag.input&&(a.type=g)}),b[e]=!0}})}function c(a){if(f&&a.group&&"radio"!=a.type){var b=a.groupToggles,c='x-toggle[group="'+a.group+'"][active]',d=a.xtag.scope.querySelector(c);if(d&&a!=d){a.checked=d.checked;var e=d.checked,g=b.indexOf(a),h=b.indexOf(d),i=Math.min(g,h),j=Math.max(g,h);return b.slice(i,j+1).forEach(function(a){a!=d&&(a.checked=e)}),!0}}}function d(a){e(a)||(a.groupToggles.forEach(function(a){a.active=!1}),a.active=!0)}function e(a){return a.parentNode&&"X-TOGGLEBAR"==a.parentNode.nodeName}var f=!1;xtag.addEvents(document,{DOMComponentsLoaded:function(){b(document),xtag.toArray(document.forms).forEach(b)},WebComponentsReady:function(){b(document),xtag.toArray(document.forms).forEach(b)},keydown:function(a){f=a.shiftKey},keyup:function(a){f=a.shiftKey},"focus:delegate(x-toggle)":function(){this.focus=!0,this.xtag.input.focus()},"blur:delegate(x-toggle)":function(){this.focus=!1},"tap:delegate(x-toggle)":function(){var a=this.xtag.input;if("radio"==a.type?!this.checked:!0){a.checked=!a.checked;var b=document.createEvent("Event");b.initEvent("change",!0,!1),a.dispatchEvent(b)}a.focus()},"change:delegate(x-toggle)":function(){this.xtag.input.focus(),(e(this)||!c(this)&&"radio"!=this.type)&&(this.checked=this.xtag.input.checked),d(this)}});var g=xtag.createFragment('
');xtag.register("x-toggle",{lifecycle:{created:function(){this.appendChild(g.cloneNode(!0)),this.xtag.input=this.querySelector("input"),this.xtag.checkEl=this.querySelector(".x-toggle-check"),this.type="checkbox",a(this);var b=this.getAttribute("name");b&&(this.xtag.input.name=this.getAttribute("name")),this.hasAttribute("checked")&&(this.checked=!0)},inserted:function(){a(this),this.name&&b(this.xtag.scope)},removed:function(){b(this.xtag.scope),a(this)}},accessors:{noBox:{attribute:{name:"no-box","boolean":!0}},type:{attribute:{},set:function(a){this.xtag.input.type=a}},label:{attribute:{}},focus:{attribute:{"boolean":!0}},active:{attribute:{"boolean":!0}},group:{attribute:{}},groupToggles:{get:function(){return xtag.query(this.xtag.scope,'x-toggle[group="'+this.group+'"]')}},name:{attribute:{skip:!0},set:function(a){null===a?(this.removeAttribute("name"),this.type="checkbox"):this.setAttribute("name",a),this.xtag.input.name=a,b(this.xtag.scope)}},checked:{get:function(){return this.xtag.input.checked},set:function(a){var b=this.name,c="true"===a||a===!0;if(b){var d=this.xtag.scope==document?"[x-toggle-no-form]":"",e='x-toggle[checked][name="'+b+'"]'+d,f=this.xtag.scope.querySelector(e);f&&f.removeAttribute("checked")}this.xtag.input.checked=c,c?this.setAttribute("checked",""):this.removeAttribute("checked")}},value:{attribute:{},get:function(){return this.xtag.input.value},set:function(a){this.xtag.input.value=a}}}}),xtag.register("x-togglebar",{events:{}})}();
\ No newline at end of file
+!function(){function a(a){var b=a.xtag.input.form;b?a.removeAttribute("x-toggle-no-form"):a.setAttribute("x-toggle-no-form",""),a.xtag.scope=a.parentNode?b||document:null}function b(a){var b={},c=a==document?"[x-toggle-no-form]":"";xtag.query(a,"x-toggle[name]"+c).forEach(function(d){var e=d.name;if(e&&!b[e]){var f=xtag.query(a,'x-toggle[name="'+e+'"]'+c),g=f.length>1?"radio":"checkbox";f.forEach(function(a){a.xtag&&a.xtag.input&&(a.type=g)}),b[e]=!0}})}function c(a){if(f&&a.group&&"radio"!=a.type){var b=a.groupToggles,c='x-toggle[group="'+a.group+'"][active]',d=a.xtag.scope.querySelector(c);if(d&&a!=d){a.checked=d.checked;var e=d.checked,g=b.indexOf(a),h=b.indexOf(d),i=Math.min(g,h),j=Math.max(g,h);return b.slice(i,j+1).forEach(function(a){a!=d&&(a.checked=e)}),!0}}}function d(a){e(a)||(a.groupToggles.forEach(function(a){a.active=!1}),a.active=!0)}function e(a){return a.parentNode&&"x-togglebar"==a.parentNode.nodeName.toLowerCase()}var f=!1;xtag.addEvents(document,{DOMComponentsLoaded:function(){b(document),xtag.toArray(document.forms).forEach(b)},WebComponentsReady:function(){b(document),xtag.toArray(document.forms).forEach(b)},keydown:function(a){f=a.shiftKey},keyup:function(a){f=a.shiftKey},"focus:delegate(x-toggle)":function(){this.focus=!0,this.xtag.input.focus()},"blur:delegate(x-toggle)":function(){this.focus=!1},"tap:delegate(x-toggle)":function(){var a=this.xtag.input;if("radio"==a.type?!this.checked:!0){a.checked=!a.checked;var b=document.createEvent("Event");b.initEvent("change",!0,!1),a.dispatchEvent(b)}a.focus()},"change:delegate(x-toggle)":function(){this.xtag.input.focus(),(e(this)||!c(this)&&"radio"!=this.type)&&(this.checked=this.xtag.input.checked),d(this)}});var g=xtag.createFragment('
');xtag.register("x-toggle",{lifecycle:{created:function(){this.appendChild(g.cloneNode(!0)),this.xtag.input=this.querySelector("input"),this.xtag.checkEl=this.querySelector(".x-toggle-check"),this.type="checkbox",a(this);var b=this.getAttribute("name");b&&(this.xtag.input.name=this.getAttribute("name")),this.hasAttribute("checked")&&(this.checked=!0)},inserted:function(){a(this),this.name&&b(this.xtag.scope)},removed:function(){b(this.xtag.scope),a(this)}},accessors:{noBox:{attribute:{name:"no-box","boolean":!0}},type:{attribute:{},set:function(a){this.xtag.input.type=a}},label:{attribute:{}},focus:{attribute:{"boolean":!0}},active:{attribute:{"boolean":!0}},group:{attribute:{}},groupToggles:{get:function(){return xtag.query(this.xtag.scope,'x-toggle[group="'+this.group+'"]')}},name:{attribute:{skip:!0},set:function(a){null===a?(this.removeAttribute("name"),this.type="checkbox"):this.setAttribute("name",a),this.xtag.input.name=a,b(this.xtag.scope)}},checked:{get:function(){return this.xtag.input.checked},set:function(a){var b=this.name,c="true"===a||a===!0;if(b){var d=this.xtag.scope==document?"[x-toggle-no-form]":"",e='x-toggle[checked][name="'+b+'"]'+d,f=this.xtag.scope.querySelector(e);f&&f.removeAttribute("checked")}this.xtag.input.checked=c,c?this.setAttribute("checked",""):this.removeAttribute("checked")}},value:{attribute:{},get:function(){return this.xtag.input.value},set:function(a){this.xtag.input.value=a}}}}),xtag.register("x-togglebar",{events:{}})}();
\ No newline at end of file
diff --git a/dist/x-tag-transitions.js b/dist/x-tag-transitions.js
new file mode 100644
index 00000000..975f5b13
--- /dev/null
+++ b/dist/x-tag-transitions.js
@@ -0,0 +1,65 @@
+(function() {
+ var matchNum = /[1-9]/, replaceSpaces = / /g, captureTimes = /(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi, transPre = "transition" in getComputedStyle(document.documentElement) ? "t" : xtag.prefix.js + "T", transDur = transPre + "ransitionDuration", transProp = transPre + "ransitionProperty", skipFrame = function(fn) {
+ xtag.requestFrame(function() {
+ xtag.requestFrame(fn);
+ });
+ }, ready = document.readyState == "complete" ? skipFrame(function() {
+ ready = false;
+ }) : xtag.addEvent(document, "readystatechange", function() {
+ if (document.readyState == "complete") {
+ skipFrame(function() {
+ ready = false;
+ });
+ xtag.removeEvent(document, "readystatechange", ready);
+ }
+ });
+ function getTransitions(node) {
+ return node.__transitions__ = node.__transitions__ || {};
+ }
+ function startTransition(node, name, transitions) {
+ var style = getComputedStyle(node), after = transitions[name].after;
+ node.setAttribute("transition", name);
+ if (after && !style[transDur].match(matchNum)) after();
+ }
+ xtag.addEvents(document, {
+ transitionend: function(e) {
+ var node = e.target, name = node.getAttribute("transition");
+ if (name) {
+ var i = max = 0, prop = null, style = getComputedStyle(node), transitions = getTransitions(node), props = style[transProp].replace(replaceSpaces, "").split(",");
+ style[transDur].replace(captureTimes, function(match, time, unit) {
+ var time = parseFloat(time) * (unit === "s" ? 1e3 : 1);
+ if (time > max) prop = i, max = time;
+ i++;
+ });
+ prop = props[prop];
+ if (!prop) throw new SyntaxError("No matching transition property found"); else if (e.propertyName == prop && transitions[name].after) transitions[name].after();
+ }
+ }
+ });
+ xtag.transition = function(node, name, obj) {
+ var transitions = getTransitions(node), options = transitions[name] = obj || {};
+ if (options.immediate) options.immediate();
+ if (options.before) {
+ options.before();
+ if (ready) xtag.skipTransition(node, function() {
+ startTransition(node, name, transitions);
+ }); else skipFrame(function() {
+ startTransition(node, name, transitions);
+ });
+ } else startTransition(node, name, transitions);
+ };
+ xtag.pseudos.transition = {
+ onCompiled: function(fn, pseudo) {
+ var options = {}, when = pseudo.arguments[0] || "immediate", name = pseudo.arguments[1] || pseudo.key.split(":")[0];
+ return function() {
+ var target = this, args = arguments;
+ if (this.hasAttribute("transition")) {
+ options[when] = function() {
+ return fn.apply(target, args);
+ };
+ xtag.transition(this, name, options);
+ } else return fn.apply(this, args);
+ };
+ }
+ };
+})();
\ No newline at end of file
diff --git a/dist/x-tag-transitions.min.js b/dist/x-tag-transitions.min.js
new file mode 100644
index 00000000..5213946a
--- /dev/null
+++ b/dist/x-tag-transitions.min.js
@@ -0,0 +1 @@
+!function(){function a(a){return a.__transitions__=a.__transitions__||{}}function b(a,b,d){var e=getComputedStyle(a),f=d[b].after;a.setAttribute("transition",b),f&&!e[g].match(c)&&f()}var c=/[1-9]/,d=/ /g,e=/(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi,f="transition"in getComputedStyle(document.documentElement)?"t":xtag.prefix.js+"T",g=f+"ransitionDuration",h=f+"ransitionProperty",i=function(a){xtag.requestFrame(function(){xtag.requestFrame(a)})},j="complete"==document.readyState?i(function(){j=!1}):xtag.addEvent(document,"readystatechange",function(){"complete"==document.readyState&&(i(function(){j=!1}),xtag.removeEvent(document,"readystatechange",j))});xtag.addEvents(document,{transitionend:function(b){var c=b.target,f=c.getAttribute("transition");if(f){var i=max=0,j=null,k=getComputedStyle(c),l=a(c),m=k[h].replace(d,"").split(",");if(k[g].replace(e,function(a,b,c){var b=parseFloat(b)*("s"===c?1e3:1);b>max&&(j=i,max=b),i++}),j=m[j],!j)throw new SyntaxError("No matching transition property found");b.propertyName==j&&l[f].after&&l[f].after()}}}),xtag.transition=function(c,d,e){var f=a(c),g=f[d]=e||{};g.immediate&&g.immediate(),g.before?(g.before(),j?xtag.skipTransition(c,function(){b(c,d,f)}):i(function(){b(c,d,f)})):b(c,d,f)},xtag.pseudos.transition={onCompiled:function(a,b){var c={},d=b.arguments[0]||"immediate",e=b.arguments[1]||b.key.split(":")[0];return function(){var b=this,f=arguments;return this.hasAttribute("transition")?(c[d]=function(){return a.apply(b,f)},void xtag.transition(this,e,c)):a.apply(this,f)}}}}();
\ No newline at end of file
diff --git a/docs.html b/docs.html
index e82fcbbf..70fe1f8d 100644
--- a/docs.html
+++ b/docs.html
@@ -24,7 +24,7 @@
@@ -99,7 +99,7 @@ Build Your Own Bundle
deck
+ data-dependencies="x-tag-core x-tag-transitions brick-common">
@@ -108,7 +108,7 @@ Build Your Own Bundle
flipbox
+ data-dependencies="x-tag-core brick-common">
@@ -117,7 +117,7 @@ Build Your Own Bundle
layout
+ data-dependencies="x-tag-core brick-common">
@@ -126,7 +126,7 @@ Build Your Own Bundle
slider
+ data-dependencies="x-tag-core brick-common">
@@ -135,7 +135,7 @@ Build Your Own Bundle
tabbar
+ data-dependencies="x-tag-core brick-common">
@@ -144,7 +144,7 @@ Build Your Own Bundle
toggle
+ data-dependencies="x-tag-core brick-common">
@@ -256,6 +256,13 @@ Build Your Own Bundle
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].checked) {
+ if(inputs[i].dataset.dependencies){
+ inputs[i].dataset.dependencies.split(' ').forEach(function(dep){
+ if(selected.indexOf(dep)==-1){
+ selected.push(dep);
+ }
+ });
+ }
selected.push(inputs[i].value);
}
}
@@ -267,8 +274,8 @@ Build Your Own Bundle
prog = 0;
progress.value = 0;
- getCss(selected, function(css) {
- getJs(selected, function(js) {
+ getFiles(selected, 'css', function(css) {
+ getFiles(selected, 'js', function(js) {
getExtraFiles(function(extraFileInfo){
makeZip(buildURL + js, buildURL + css, extraFileInfo);
});
@@ -279,41 +286,8 @@ Build Your Own Bundle
var zipLink = document.querySelector('#zip');
var progress = document.querySelector('progress');
- function getCss(c, cb) {
- var numReqs = c.length;
- var numDone = 0;
- var total = '';
-
- function done() {
- prog++;
- progress.value = prog;
- numDone++;
- if (numDone === numReqs) {
- cb(total);
- } else {
- get(c[numDone]);
- }
- }
- function get(c) {
- var req = new XMLHttpRequest();
- req.onload = function(e) {
- if (this.status != 200 && this.status != 304) {
- if (console) console.warn('file not found:', getFileName(c, 'css'));
- done();
- } else {
- total += '\n' + req.response;
- done();
- }
- };
- req.open("get", getFileName(c, 'css'));
- req.send();
- }
-
- get(c[0]);
- }
-
- function getJs(c, cb) {
+ function getFiles(c, type, cb){
var numReqs = c.length;
var numDone = 0;
var total = '';
@@ -333,14 +307,14 @@ Build Your Own Bundle
var req = new XMLHttpRequest();
req.onload = function(e) {
if (this.status != 200 && this.status != 304) {
- if (console) console.warn('file not found:', getFileName(c, 'js'));
+ if (console) console.warn('file not found:', getFileName(c, type));
done();
} else {
total += '\n' + req.response;
done();
}
};
- req.open("get", getFileName(c, 'js'));
+ req.open("get", getFileName(c, type));
req.send();
}
@@ -365,7 +339,6 @@ Build Your Own Bundle
function get(filePath) {
var req = new XMLHttpRequest();
-
req.onload = function(e) {
fileInfo.push({
name: filePath.replace(/^dist\//, ""),
@@ -373,11 +346,8 @@ Build Your Own Bundle
});
done();
};
-
req.open("get", filePath);
-
req.responseType = "arraybuffer";
-
req.send();
}
@@ -396,8 +366,8 @@ Build Your Own Bundle
function makeZip(js, css, extraFileInfo) {
var zip = new JSZip();
- zip.file('brick-1.0.0-rc2.byob'+(minifed?'.min.':'.')+'js', js);
- zip.file('brick-1.0.0-rc2.byob'+(minifed?'.min.':'.')+'css', css);
+ zip.file('brick-1.0.0.byob'+(minifed?'.min.':'.')+'js', js);
+ zip.file('brick-1.0.0.byob'+(minifed?'.min.':'.')+'css', css);
for(var i=0; i < extraFileInfo.length; i++){
var fileData = extraFileInfo[i];
@@ -410,8 +380,7 @@ Build Your Own Bundle
progress.style.display = 'none';
var blob = zip.generate({type:"blob"});
- console.log(blob);
- zipLink.setAttribute('download', 'brick-1.0.0-rc2-byob.zip');
+ zipLink.setAttribute('download', 'brick-1.0.0-byob.zip');
zipLink.style.display = 'inline-block';
zipLink.setAttribute('href', window.URL.createObjectURL(blob));
}
diff --git a/index.html b/index.html
index be95b8f6..19e5e1b7 100644
--- a/index.html
+++ b/index.html
@@ -25,7 +25,7 @@
@@ -149,4 +146,4 @@