Comparing version 2.2.0 to 2.2.1
@@ -73,3 +73,4 @@ | ||
isLoop: true, | ||
root: root | ||
root: root, | ||
item: _item | ||
}) | ||
@@ -76,0 +77,0 @@ ).mount() |
@@ -8,2 +8,3 @@ function Tag(impl, conf, innerHTML) { | ||
isLoop = conf.isLoop, | ||
item = conf.item, | ||
expressions = [], | ||
@@ -44,3 +45,3 @@ childTags = [], | ||
extend(this, { parent: parent, root: root, opts: opts, tags: {} }) | ||
extend(this, { parent: parent, root: root, opts: opts, tags: {} }, item) | ||
@@ -47,0 +48,0 @@ // grab attributes |
{ | ||
"name": "riot", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "A React- like, 3.5K user interface library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://muut.com/riotjs/", |
10
riot.js
@@ -1,6 +0,6 @@ | ||
/* Riot v2.2.0, @license MIT, (c) 2015 Muut Inc. + contributors */ | ||
/* Riot v2.2.1, @license MIT, (c) 2015 Muut Inc. + contributors */ | ||
;(function(window) { | ||
'use strict' | ||
var riot = { version: 'v2.2.0', settings: {} } | ||
var riot = { version: 'v2.2.1', settings: {} } | ||
@@ -490,3 +490,4 @@ // This globals 'const' helps code size reduction | ||
isLoop: true, | ||
root: root | ||
root: root, | ||
item: _item | ||
}) | ||
@@ -617,2 +618,3 @@ ).mount() | ||
isLoop = conf.isLoop, | ||
item = conf.item, | ||
expressions = [], | ||
@@ -653,3 +655,3 @@ childTags = [], | ||
extend(this, { parent: parent, root: root, opts: opts, tags: {} }) | ||
extend(this, { parent: parent, root: root, opts: opts, tags: {} }, item) | ||
@@ -656,0 +658,0 @@ // grab attributes |
@@ -1,2 +0,2 @@ | ||
/* Riot v2.2.0, @license MIT, (c) 2015 Muut Inc. + contributors */ | ||
(function(e){"use strict";var t={version:"v2.2.0",settings:{}};var n="string";var i="object";var r=Array.isArray||function(){var e=Object.prototype.toString;return function(t){return e.call(t)==="[object Array]"}}();var o=function(e){return(e&&e.document||{}).documentMode|0}(e);t.observable=function(e){e=e||{};var t={},n=0;e.on=function(i,r){if(b(r)){r._id=typeof r._id=="undefined"?n++:r._id;i.replace(/\S+/g,function(e,n){(t[e]=t[e]||[]).push(r);r.typed=n>0})}return e};e.off=function(n,i){if(n=="*")t={};else{n.replace(/\S+/g,function(e){if(i){var n=t[e];for(var r=0,o;o=n&&n[r];++r){if(o._id==i._id){n.splice(r,1);r--}}}else{t[e]=[]}})}return e};e.one=function(t,n){function i(){e.off(t,i);n.apply(e,arguments)}return e.on(t,i)};e.trigger=function(n){var i=[].slice.call(arguments,1),r=t[n]||[];for(var o=0,u;u=r[o];++o){if(!u.busy){u.busy=1;u.apply(e,u.typed?[n].concat(i):i);if(r[o]!==u){o--}u.busy=0}}if(t.all&&n!="all"){e.trigger.apply(e,["all",n].concat(i))}return e};return e};t.mixin=function(){var e={};return function(t,n){if(!n)return e[t];e[t]=n}}();(function(e,t,n){if(!n)return;var i=n.location,r=e.observable(),o=n,u=false,f;function a(){return i.href.split("#")[1]||""}function s(e){return e.split("/")}function c(e){if(e.type)e=a();if(e!=f){r.trigger.apply(null,["H"].concat(s(e)));f=e}}var l=e.route=function(e){if(e[0]){i.hash=e;c(e)}else{r.on("H",e)}};l.exec=function(e){e.apply(null,s(a()))};l.parser=function(e){s=e};l.stop=function(){if(!u)return;o.removeEventListener?o.removeEventListener(t,c,false):o.detachEvent("on"+t,c);r.off("*");u=false};l.start=function(){if(u)return;o.addEventListener?o.addEventListener(t,c,false):o.attachEvent("on"+t,c);u=true};l.start()})(t,"hashchange",e);var u=function(e){var n,i,r,o=/[{}]/g;return function(u){var f=t.settings.brackets||e;if(n!==f){n=f;r=f.split(" ");i=r.map(function(e){return e.replace(/(?=.)/g,"\\")})}return u instanceof RegExp?f===e?u:new RegExp(u.source.replace(o,function(e){return i[~~(e==="}")]}),u.global?"g":""):r[u]}}("{ }");var f=function(){var t={},n=/(['"\/]).*?[^\\]\1|\.\w*|\w*:|\b(?:(?:new|typeof|in|instanceof) |(?:this|true|false|null|undefined)\b|function *\()|([a-z_$]\w*)/gi;return function(e,n){return e&&(t[e]=t[e]||i(e))(n)};function i(e,t){e=(e||u(0)+u(1)).replace(u(/\\{/g),"").replace(u(/\\}/g),"");t=f(e,a(e,u(/{/),u(/}/)));return new Function("d","return "+(!t[0]&&!t[2]&&!t[3]?r(t[1]):"["+t.map(function(e,t){return t%2?r(e,true):'"'+e.replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"'}).join(",")+'].join("")').replace(/\uFFF0/g,u(0)).replace(/\uFFF1/g,u(1))+";")}function r(e,t){e=e.replace(/\n/g," ").replace(u(/^[{ ]+|[ }]+$|\/\*.+?\*\//g),"");return/^\s*[\w- "']+ *:/.test(e)?"["+a(e,/["' ]*[\w- ]+["' ]*:/,/,(?=["' ]*[\w- ]+["' ]*:)|}|$/).map(function(e){return e.replace(/^[ "']*(.+?)[ "']*: *(.+?),? *$/,function(e,t,n){return n.replace(/[^&|=!><]+/g,o)+'?"'+t+'":"",'})}).join("")+'].join(" ").trim()':o(e,t)}function o(t,i){t=t.trim();return!t?"":"(function(v){try{v="+(t.replace(n,function(t,n,i){return i?"(d."+i+"===undefined?"+(typeof e=="undefined"?"global.":"window.")+i+":d."+i+")":t})||"x")+"}catch(e){"+"}finally{return "+(i===true?'!v&&v!==0?"":v':"v")+"}}).call(d)"}function f(e,t){var n=[];t.map(function(t,i){i=e.indexOf(t);n.push(e.slice(0,i),t);e=e.slice(i+t.length)});return n.concat(e)}function a(e,t,n){var i,r=0,o=[],u=new RegExp("("+t.source+")|("+n.source+")","g");e.replace(u,function(t,n,u,f){if(!r&&n)i=f;r+=n?1:-1;if(!r&&u!=null)o.push(e.slice(i,f+u.length))});return o}}();function a(e){var t=u(0),n=e.slice(t.length).match(/\s*(\S+?)\s*(?:,\s*(\S)+)?\s+in\s+(.+)/);return n?{key:n[1],pos:n[2],val:t+n[3]}:{val:e}}function s(e,t,n){var i={};i[e.key]=t;if(e.pos)i[e.pos]=n;return i}function c(e,t,n){y(e,"each");var i=e.outerHTML,o=e.parentNode,u=document.createComment("riot placeholder"),c=[],l=D(e),p;o.insertBefore(u,e);n=a(n);t.one("premount",function(){if(o.stub)o=t.root;e.parentNode.removeChild(e)}).on("update",function(){var a=f(n.val,t),g;if(!r(a)){g=p;p=a?JSON.stringify(a):"";if(p===g)return;a=!a?[]:Object.keys(a).map(function(e){return s(n,e,a[e])})}var v=document.createDocumentFragment(),m=c.length,h=a.length;while(m>h)c[--m].unmount();c.length=h;g=!p&&!!n.key;for(m=0;m<h;++m){var b=g?s(n,a[m],m):a[m];if(!c[m]){(c[m]=new d({tmpl:i},{parent:t,isLoop:true,root:o})).mount();v.appendChild(c[m].root)}c[m]._item=b;c[m].update(b)}o.insertBefore(v,u);if(l)t.tags[L(e)]=c}).one("updated",function(){var e=Object.keys(t);T(o,function(n){if(n.nodeType==1&&!n.isLoop&&!n._looped){n._visited=false;n._looped=true;S(n,t,e)}})})}function l(e,t,n){T(e,function(e){if(e.nodeType==1){e.isLoop=e.parentNode&&e.parentNode.isLoop||e.getAttribute("each")?1:0;var i=D(e);if(i&&!e.isLoop){var o=new d(i,{root:e,parent:t},e.innerHTML),u=L(e),f=t,a;while(!D(f.root)){if(!f.parent)break;f=f.parent}o.parent=f;a=f.tags[u];if(a){if(!r(a))f.tags[u]=[a];f.tags[u].push(o)}else{f.tags[u]=o}e.innerHTML="";n.push(o)}if(!e.isLoop)S(e,t,[])}})}function p(e,t,n){function i(e,t,i){if(t.indexOf(u(0))>=0){var r={dom:e,expr:t};n.push(_(r,i))}}T(e,function(e){var n=e.nodeType;if(n==3&&e.parentNode.tagName!="STYLE")i(e,e.nodeValue);if(n!=1)return;var r=e.getAttribute("each");if(r){c(e,t,r);return false}h(e.attributes,function(t){var n=t.name,r=n.split("__")[1];i(e,t.value,{attr:r||n,bool:r});if(r){y(e,n);return false}});if(D(e))return false})}function d(e,n,i){var o=t.observable(this),a=H(n.opts)||{},s=C(e.tmpl),c=n.parent,d=n.isLoop,g=[],v=[],b=n.root,y=e.fn,L=b.tagName.toLowerCase(),T={},x,A=/([\w\-]+)\s?=\s?['"]([^'"]+)["']/gim;if(y&&b._tag){b._tag.unmount(true)}this.isMounted=false;if(e.attrs){var S=e.attrs.match(A);h(S,function(e){var t=e.split(/\s?=\s?/);b.setAttribute(t[0],t[1].replace(/['"]/g,""))})}b._tag=this;this._id=w(~~((new Date).getTime()*Math.random()));_(this,{parent:c,root:b,opts:a,tags:{}});h(b.attributes,function(e){var t=e.value;if(u(/\{.*\}/).test(t))T[e.name]=t});if(s.innerHTML&&!/select|select|optgroup|tbody|tr/.test(L))s.innerHTML=N(s.innerHTML,i);function j(){h(b.attributes,function(e){a[e.name]=f(e.value,c||o)});h(Object.keys(T),function(e){a[e]=f(T[e],c||o)})}this.update=function(e){_(o,e);j();o.trigger("update",e);m(g,o,e);o.trigger("updated")};this.mixin=function(){h(arguments,function(e){e=typeof e=="string"?t.mixin(e):e;h(Object.keys(e),function(t){if(t!="init")o[t]=typeof e[t]=="function"?e[t].bind(o):e[t]});if(e.init)e.init.bind(o)()})};this.mount=function(){j();y&&y.call(o,a);E(true);p(s,o,g);if(!o.parent)o.update();o.trigger("premount");if(d){o.root=b=x=s.firstChild}else{while(s.firstChild)b.appendChild(s.firstChild);if(b.stub)o.root=b=c.root}if(!o.parent||o.parent.isMounted){o.isMounted=true;o.trigger("mount")}else o.parent.one("mount",function(){if(!M(o.root)){o.parent.isMounted=o.isMounted=true;o.trigger("mount")}})};this.unmount=function(e){var t=x||b,n=t.parentNode;if(n){if(c){if(r(c.tags[L])){h(c.tags[L],function(e,t){if(e._id==o._id)c.tags[L].splice(t,1)})}else c.tags[L]=undefined}else{while(t.firstChild)t.removeChild(t.firstChild)}if(!e)n.removeChild(t)}o.trigger("unmount");E();o.off("*");b._tag=null};function E(e){h(v,function(t){t[e?"mount":"unmount"]()});if(c){var t=e?"on":"off";if(d)c[t]("unmount",o.unmount);else c[t]("update",o.update)[t]("unmount",o.unmount)}}l(s,this,v)}function g(t,n,i,r,o){i[t]=function(t){t=t||e.event;if(!t.which)t.which=t.charCode||t.keyCode;if(!t.target)t.target=t.srcElement;try{t.currentTarget=i}catch(u){""}t.item=r._item?r._item:o;if(n.call(r,t)!==true&&!/radio|check/.test(i.type)){t.preventDefault&&t.preventDefault();t.returnValue=false}if(!t.preventUpdate){var f=o?r.parent:r;f.update()}}}function v(e,t,n){if(e){e.insertBefore(n,t);e.removeChild(t)}}function m(e,t,n){h(e,function(e,i){var r=e.dom,o=e.attr,u=f(e.expr,t),a=e.dom.parentNode;if(u==null)u="";if(a&&a.tagName=="TEXTAREA")u=u.replace(/riot-/g,"");if(e.value===u)return;e.value=u;if(!o)return r.nodeValue=u.toString();y(r,o);if(typeof u=="function"){g(o,u,r,t,n)}else if(o=="if"){var s=e.stub;if(u){if(s){v(s.parentNode,s,r);r.inStub=false;if(!M(r)){T(r,function(e){if(e._tag&&!e._tag.isMounted)e._tag.isMounted=!!e._tag.trigger("mount")})}}}else{s=e.stub=s||document.createTextNode("");v(r.parentNode,r,s);r.inStub=true}}else if(/^(show|hide)$/.test(o)){if(o=="hide")u=!u;r.style.display=u?"":"none"}else if(o=="value"){r.value=u}else if(o.slice(0,5)=="riot-"&&o!="riot-tag"){o=o.slice(5);u?r.setAttribute(o,u):y(r,o)}else{if(e.bool){r[o]=u;if(!u)return;u=o}if(typeof u!="object")r.setAttribute(o,u)}})}function h(e,t){for(var n=0,i=(e||[]).length,r;n<i;n++){r=e[n];if(r!=null&&t(r,n)===false)n--}return e}function b(e){return typeof e==="function"||false}function y(e,t){e.removeAttribute(t)}function w(e){return(e^e>>31)-(e>>31)}function L(e){var t=D(e),n=e.getAttribute("name"),i=n&&n.indexOf(u(0))<0?n:t.name;return i}function _(e){var t,n=arguments;for(var i=1;i<n.length;++i){if(t=n[i]){for(var r in t){e[r]=t[r]}}}return e}function C(e){var t=o&&o<10,n=/^\s*<([\w-]+)/.exec(e),i=n?n[1].toLowerCase():"",r=i==="th"||i==="td"?"tr":i==="tr"?"tbody":"div",u=x(r);u.stub=true;if(t){if(i==="optgroup")k(u,e);else if(i==="option")E(u,e);else if(r!=="div")j(u,e,i);else t=0}if(!t)u.innerHTML=e;return u}function T(e,t){if(e){if(t(e)===false)T(e.nextSibling,t);else{e=e.firstChild;while(e){T(e,t);e=e.nextSibling}}}}function M(e){while(e){if(e.inStub)return true;e=e.parentNode}return false}function x(e){return document.createElement(e)}function N(e,t){return e.replace(/<(yield)\/?>(<\/\1>)?/gim,t||"")}function A(e,t){return(t||document).querySelectorAll(e)}function H(e){function t(){}t.prototype=e;return new t}function S(e,t,n){h(e.attributes,function(i){if(e._visited)return;if(i.name==="id"||i.name==="name"){e._visited=true;var o,u=i.value;if(~n.indexOf(u))return;o=t[u];if(!o)t[u]=e;else r(o)?o.push(e):t[u]=[o,e]}})}function j(e,t,n){var i=x("div"),r=/td|th/.test(n)?3:2,o;i.innerHTML="<table>"+t+"</table>";o=i.firstChild;while(r--){o=o.firstChild}e.appendChild(o)}function E(e,t){var n=x("option"),i=/value=[\"'](.+?)[\"']/,r=/selected=[\"'](.+?)[\"']/,o=/each=[\"'](.+?)[\"']/,u=/if=[\"'](.+?)[\"']/,f=/>([^<]*)</,a=t.match(i),s=t.match(r),c=t.match(f),l=t.match(o),p=t.match(u);if(c){n.innerHTML=c[1]}else{n.innerHTML=t}if(a){n.value=a[1]}if(s){n.setAttribute("riot-selected",s[1])}if(l){n.setAttribute("each",l[1])}if(p){n.setAttribute("if",p[1])}e.appendChild(n)}function k(e,t){var n=x("optgroup"),i=/label=[\"'](.+?)[\"']/,r=/^<([^>]*)>/,o=/^<([^ \>]*)/,u=t.match(i),f=t.match(r),a=t.match(o),s=t;if(f){var c=t.slice(f[1].length+2,-a[1].length-3).trim();s=c}if(u){n.setAttribute("riot-label",u[1])}if(s){var l=x("div");E(l,s);n.appendChild(l.firstChild)}e.appendChild(n)}var O=[],F={},$;var B="riot-tag";function D(e){return F[e.getAttribute(B)||e.tagName.toLowerCase()]}function R(e){$=$||x("style");if(!document.head)return;if($.styleSheet)$.styleSheet.cssText+=e;else $.innerHTML+=e;if(!$._rendered)if($.styleSheet){document.body.appendChild($)}else{var t=A("style[type=riot]")[0];if(t){t.parentNode.insertBefore($,t);t.parentNode.removeChild(t)}else{document.head.appendChild($)}}$._rendered=true}function V(e,t,n){var i=F[t],r=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";if(i&&e)i=new d(i,{root:e,opts:n},r);if(i&&i.mount){i.mount();O.push(i);return i.on("unmount",function(){O.splice(O.indexOf(i),1)})}}t.tag=function(e,t,n,i,r){if(b(i)){r=i;if(/^[\w\-]+\s?=/.test(n)){i=n;n=""}else i=""}if(n){if(b(n))r=n;else R(n)}F[e]={name:e,tmpl:t,attrs:i,fn:r};return e};t.mount=function(e,t,r){var o,u,f=[];function a(e){var t="";h(e,function(e){t+=', *[riot-tag="'+e.trim()+'"]'});return t}function s(){var e=Object.keys(F);return e+a(e)}function c(e){if(e.tagName){if(t&&!e.getAttribute(B))e.setAttribute(B,t);var n=V(e,t||e.getAttribute(B)||e.tagName.toLowerCase(),r);if(n)f.push(n)}else if(e.length){h(e,c)}}if(typeof t===i){r=t;t=0}if(typeof e===n){if(e==="*"){e=u=s()}else{e+=a(e.split(","))}o=A(e)}else o=e;if(t==="*"){t=u||s();if(o.tagName){o=A(t,o)}else{var l=[];h(o,function(e){l.push(A(t,e))});o=l}t=0}if(o.tagName)c(o);else h(o,c);return f};t.update=function(){return h(O,function(e){e.update()})};t.mountTo=t.mount;t.util={brackets:u,tmpl:f};if(typeof exports==="object")module.exports=t;else if(typeof define==="function"&&define.amd)define(function(){return t});else e.riot=t})(typeof window!="undefined"?window:undefined); | ||
/* Riot v2.2.1, @license MIT, (c) 2015 Muut Inc. + contributors */ | ||
(function(e){"use strict";var t={version:"v2.2.1",settings:{}};var n="string";var i="object";var r=Array.isArray||function(){var e=Object.prototype.toString;return function(t){return e.call(t)==="[object Array]"}}();var o=function(e){return(e&&e.document||{}).documentMode|0}(e);t.observable=function(e){e=e||{};var t={},n=0;e.on=function(i,r){if(b(r)){r._id=typeof r._id=="undefined"?n++:r._id;i.replace(/\S+/g,function(e,n){(t[e]=t[e]||[]).push(r);r.typed=n>0})}return e};e.off=function(n,i){if(n=="*")t={};else{n.replace(/\S+/g,function(e){if(i){var n=t[e];for(var r=0,o;o=n&&n[r];++r){if(o._id==i._id){n.splice(r,1);r--}}}else{t[e]=[]}})}return e};e.one=function(t,n){function i(){e.off(t,i);n.apply(e,arguments)}return e.on(t,i)};e.trigger=function(n){var i=[].slice.call(arguments,1),r=t[n]||[];for(var o=0,u;u=r[o];++o){if(!u.busy){u.busy=1;u.apply(e,u.typed?[n].concat(i):i);if(r[o]!==u){o--}u.busy=0}}if(t.all&&n!="all"){e.trigger.apply(e,["all",n].concat(i))}return e};return e};t.mixin=function(){var e={};return function(t,n){if(!n)return e[t];e[t]=n}}();(function(e,t,n){if(!n)return;var i=n.location,r=e.observable(),o=n,u=false,f;function a(){return i.href.split("#")[1]||""}function s(e){return e.split("/")}function c(e){if(e.type)e=a();if(e!=f){r.trigger.apply(null,["H"].concat(s(e)));f=e}}var l=e.route=function(e){if(e[0]){i.hash=e;c(e)}else{r.on("H",e)}};l.exec=function(e){e.apply(null,s(a()))};l.parser=function(e){s=e};l.stop=function(){if(!u)return;o.removeEventListener?o.removeEventListener(t,c,false):o.detachEvent("on"+t,c);r.off("*");u=false};l.start=function(){if(u)return;o.addEventListener?o.addEventListener(t,c,false):o.attachEvent("on"+t,c);u=true};l.start()})(t,"hashchange",e);var u=function(e){var n,i,r,o=/[{}]/g;return function(u){var f=t.settings.brackets||e;if(n!==f){n=f;r=f.split(" ");i=r.map(function(e){return e.replace(/(?=.)/g,"\\")})}return u instanceof RegExp?f===e?u:new RegExp(u.source.replace(o,function(e){return i[~~(e==="}")]}),u.global?"g":""):r[u]}}("{ }");var f=function(){var t={},n=/(['"\/]).*?[^\\]\1|\.\w*|\w*:|\b(?:(?:new|typeof|in|instanceof) |(?:this|true|false|null|undefined)\b|function *\()|([a-z_$]\w*)/gi;return function(e,n){return e&&(t[e]=t[e]||i(e))(n)};function i(e,t){e=(e||u(0)+u(1)).replace(u(/\\{/g),"").replace(u(/\\}/g),"");t=f(e,a(e,u(/{/),u(/}/)));return new Function("d","return "+(!t[0]&&!t[2]&&!t[3]?r(t[1]):"["+t.map(function(e,t){return t%2?r(e,true):'"'+e.replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"'}).join(",")+'].join("")').replace(/\uFFF0/g,u(0)).replace(/\uFFF1/g,u(1))+";")}function r(e,t){e=e.replace(/\n/g," ").replace(u(/^[{ ]+|[ }]+$|\/\*.+?\*\//g),"");return/^\s*[\w- "']+ *:/.test(e)?"["+a(e,/["' ]*[\w- ]+["' ]*:/,/,(?=["' ]*[\w- ]+["' ]*:)|}|$/).map(function(e){return e.replace(/^[ "']*(.+?)[ "']*: *(.+?),? *$/,function(e,t,n){return n.replace(/[^&|=!><]+/g,o)+'?"'+t+'":"",'})}).join("")+'].join(" ").trim()':o(e,t)}function o(t,i){t=t.trim();return!t?"":"(function(v){try{v="+(t.replace(n,function(t,n,i){return i?"(d."+i+"===undefined?"+(typeof e=="undefined"?"global.":"window.")+i+":d."+i+")":t})||"x")+"}catch(e){"+"}finally{return "+(i===true?'!v&&v!==0?"":v':"v")+"}}).call(d)"}function f(e,t){var n=[];t.map(function(t,i){i=e.indexOf(t);n.push(e.slice(0,i),t);e=e.slice(i+t.length)});return n.concat(e)}function a(e,t,n){var i,r=0,o=[],u=new RegExp("("+t.source+")|("+n.source+")","g");e.replace(u,function(t,n,u,f){if(!r&&n)i=f;r+=n?1:-1;if(!r&&u!=null)o.push(e.slice(i,f+u.length))});return o}}();function a(e){var t=u(0),n=e.slice(t.length).match(/\s*(\S+?)\s*(?:,\s*(\S)+)?\s+in\s+(.+)/);return n?{key:n[1],pos:n[2],val:t+n[3]}:{val:e}}function s(e,t,n){var i={};i[e.key]=t;if(e.pos)i[e.pos]=n;return i}function c(e,t,n){y(e,"each");var i=e.outerHTML,o=e.parentNode,u=document.createComment("riot placeholder"),c=[],l=D(e),p;o.insertBefore(u,e);n=a(n);t.one("premount",function(){if(o.stub)o=t.root;e.parentNode.removeChild(e)}).on("update",function(){var a=f(n.val,t),g;if(!r(a)){g=p;p=a?JSON.stringify(a):"";if(p===g)return;a=!a?[]:Object.keys(a).map(function(e){return s(n,e,a[e])})}var v=document.createDocumentFragment(),m=c.length,h=a.length;while(m>h)c[--m].unmount();c.length=h;g=!p&&!!n.key;for(m=0;m<h;++m){var b=g?s(n,a[m],m):a[m];if(!c[m]){(c[m]=new d({tmpl:i},{parent:t,isLoop:true,root:o,item:b})).mount();v.appendChild(c[m].root)}c[m]._item=b;c[m].update(b)}o.insertBefore(v,u);if(l)t.tags[L(e)]=c}).one("updated",function(){var e=Object.keys(t);T(o,function(n){if(n.nodeType==1&&!n.isLoop&&!n._looped){n._visited=false;n._looped=true;S(n,t,e)}})})}function l(e,t,n){T(e,function(e){if(e.nodeType==1){e.isLoop=e.parentNode&&e.parentNode.isLoop||e.getAttribute("each")?1:0;var i=D(e);if(i&&!e.isLoop){var o=new d(i,{root:e,parent:t},e.innerHTML),u=L(e),f=t,a;while(!D(f.root)){if(!f.parent)break;f=f.parent}o.parent=f;a=f.tags[u];if(a){if(!r(a))f.tags[u]=[a];f.tags[u].push(o)}else{f.tags[u]=o}e.innerHTML="";n.push(o)}if(!e.isLoop)S(e,t,[])}})}function p(e,t,n){function i(e,t,i){if(t.indexOf(u(0))>=0){var r={dom:e,expr:t};n.push(_(r,i))}}T(e,function(e){var n=e.nodeType;if(n==3&&e.parentNode.tagName!="STYLE")i(e,e.nodeValue);if(n!=1)return;var r=e.getAttribute("each");if(r){c(e,t,r);return false}h(e.attributes,function(t){var n=t.name,r=n.split("__")[1];i(e,t.value,{attr:r||n,bool:r});if(r){y(e,n);return false}});if(D(e))return false})}function d(e,n,i){var o=t.observable(this),a=H(n.opts)||{},s=C(e.tmpl),c=n.parent,d=n.isLoop,g=n.item,v=[],b=[],y=n.root,L=e.fn,T=y.tagName.toLowerCase(),x={},A,S=/([\w\-]+)\s?=\s?['"]([^'"]+)["']/gim;if(L&&y._tag){y._tag.unmount(true)}this.isMounted=false;if(e.attrs){var j=e.attrs.match(S);h(j,function(e){var t=e.split(/\s?=\s?/);y.setAttribute(t[0],t[1].replace(/['"]/g,""))})}y._tag=this;this._id=w(~~((new Date).getTime()*Math.random()));_(this,{parent:c,root:y,opts:a,tags:{}},g);h(y.attributes,function(e){var t=e.value;if(u(/\{.*\}/).test(t))x[e.name]=t});if(s.innerHTML&&!/select|select|optgroup|tbody|tr/.test(T))s.innerHTML=N(s.innerHTML,i);function E(){h(y.attributes,function(e){a[e.name]=f(e.value,c||o)});h(Object.keys(x),function(e){a[e]=f(x[e],c||o)})}this.update=function(e){_(o,e);E();o.trigger("update",e);m(v,o,e);o.trigger("updated")};this.mixin=function(){h(arguments,function(e){e=typeof e=="string"?t.mixin(e):e;h(Object.keys(e),function(t){if(t!="init")o[t]=typeof e[t]=="function"?e[t].bind(o):e[t]});if(e.init)e.init.bind(o)()})};this.mount=function(){E();L&&L.call(o,a);k(true);p(s,o,v);if(!o.parent)o.update();o.trigger("premount");if(d){o.root=y=A=s.firstChild}else{while(s.firstChild)y.appendChild(s.firstChild);if(y.stub)o.root=y=c.root}if(!o.parent||o.parent.isMounted){o.isMounted=true;o.trigger("mount")}else o.parent.one("mount",function(){if(!M(o.root)){o.parent.isMounted=o.isMounted=true;o.trigger("mount")}})};this.unmount=function(e){var t=A||y,n=t.parentNode;if(n){if(c){if(r(c.tags[T])){h(c.tags[T],function(e,t){if(e._id==o._id)c.tags[T].splice(t,1)})}else c.tags[T]=undefined}else{while(t.firstChild)t.removeChild(t.firstChild)}if(!e)n.removeChild(t)}o.trigger("unmount");k();o.off("*");y._tag=null};function k(e){h(b,function(t){t[e?"mount":"unmount"]()});if(c){var t=e?"on":"off";if(d)c[t]("unmount",o.unmount);else c[t]("update",o.update)[t]("unmount",o.unmount)}}l(s,this,b)}function g(t,n,i,r,o){i[t]=function(t){t=t||e.event;if(!t.which)t.which=t.charCode||t.keyCode;if(!t.target)t.target=t.srcElement;try{t.currentTarget=i}catch(u){""}t.item=r._item?r._item:o;if(n.call(r,t)!==true&&!/radio|check/.test(i.type)){t.preventDefault&&t.preventDefault();t.returnValue=false}if(!t.preventUpdate){var f=o?r.parent:r;f.update()}}}function v(e,t,n){if(e){e.insertBefore(n,t);e.removeChild(t)}}function m(e,t,n){h(e,function(e,i){var r=e.dom,o=e.attr,u=f(e.expr,t),a=e.dom.parentNode;if(u==null)u="";if(a&&a.tagName=="TEXTAREA")u=u.replace(/riot-/g,"");if(e.value===u)return;e.value=u;if(!o)return r.nodeValue=u.toString();y(r,o);if(typeof u=="function"){g(o,u,r,t,n)}else if(o=="if"){var s=e.stub;if(u){if(s){v(s.parentNode,s,r);r.inStub=false;if(!M(r)){T(r,function(e){if(e._tag&&!e._tag.isMounted)e._tag.isMounted=!!e._tag.trigger("mount")})}}}else{s=e.stub=s||document.createTextNode("");v(r.parentNode,r,s);r.inStub=true}}else if(/^(show|hide)$/.test(o)){if(o=="hide")u=!u;r.style.display=u?"":"none"}else if(o=="value"){r.value=u}else if(o.slice(0,5)=="riot-"&&o!="riot-tag"){o=o.slice(5);u?r.setAttribute(o,u):y(r,o)}else{if(e.bool){r[o]=u;if(!u)return;u=o}if(typeof u!="object")r.setAttribute(o,u)}})}function h(e,t){for(var n=0,i=(e||[]).length,r;n<i;n++){r=e[n];if(r!=null&&t(r,n)===false)n--}return e}function b(e){return typeof e==="function"||false}function y(e,t){e.removeAttribute(t)}function w(e){return(e^e>>31)-(e>>31)}function L(e){var t=D(e),n=e.getAttribute("name"),i=n&&n.indexOf(u(0))<0?n:t.name;return i}function _(e){var t,n=arguments;for(var i=1;i<n.length;++i){if(t=n[i]){for(var r in t){e[r]=t[r]}}}return e}function C(e){var t=o&&o<10,n=/^\s*<([\w-]+)/.exec(e),i=n?n[1].toLowerCase():"",r=i==="th"||i==="td"?"tr":i==="tr"?"tbody":"div",u=x(r);u.stub=true;if(t){if(i==="optgroup")k(u,e);else if(i==="option")E(u,e);else if(r!=="div")j(u,e,i);else t=0}if(!t)u.innerHTML=e;return u}function T(e,t){if(e){if(t(e)===false)T(e.nextSibling,t);else{e=e.firstChild;while(e){T(e,t);e=e.nextSibling}}}}function M(e){while(e){if(e.inStub)return true;e=e.parentNode}return false}function x(e){return document.createElement(e)}function N(e,t){return e.replace(/<(yield)\/?>(<\/\1>)?/gim,t||"")}function A(e,t){return(t||document).querySelectorAll(e)}function H(e){function t(){}t.prototype=e;return new t}function S(e,t,n){h(e.attributes,function(i){if(e._visited)return;if(i.name==="id"||i.name==="name"){e._visited=true;var o,u=i.value;if(~n.indexOf(u))return;o=t[u];if(!o)t[u]=e;else r(o)?o.push(e):t[u]=[o,e]}})}function j(e,t,n){var i=x("div"),r=/td|th/.test(n)?3:2,o;i.innerHTML="<table>"+t+"</table>";o=i.firstChild;while(r--){o=o.firstChild}e.appendChild(o)}function E(e,t){var n=x("option"),i=/value=[\"'](.+?)[\"']/,r=/selected=[\"'](.+?)[\"']/,o=/each=[\"'](.+?)[\"']/,u=/if=[\"'](.+?)[\"']/,f=/>([^<]*)</,a=t.match(i),s=t.match(r),c=t.match(f),l=t.match(o),p=t.match(u);if(c){n.innerHTML=c[1]}else{n.innerHTML=t}if(a){n.value=a[1]}if(s){n.setAttribute("riot-selected",s[1])}if(l){n.setAttribute("each",l[1])}if(p){n.setAttribute("if",p[1])}e.appendChild(n)}function k(e,t){var n=x("optgroup"),i=/label=[\"'](.+?)[\"']/,r=/^<([^>]*)>/,o=/^<([^ \>]*)/,u=t.match(i),f=t.match(r),a=t.match(o),s=t;if(f){var c=t.slice(f[1].length+2,-a[1].length-3).trim();s=c}if(u){n.setAttribute("riot-label",u[1])}if(s){var l=x("div");E(l,s);n.appendChild(l.firstChild)}e.appendChild(n)}var O=[],F={},$;var B="riot-tag";function D(e){return F[e.getAttribute(B)||e.tagName.toLowerCase()]}function R(e){$=$||x("style");if(!document.head)return;if($.styleSheet)$.styleSheet.cssText+=e;else $.innerHTML+=e;if(!$._rendered)if($.styleSheet){document.body.appendChild($)}else{var t=A("style[type=riot]")[0];if(t){t.parentNode.insertBefore($,t);t.parentNode.removeChild(t)}else{document.head.appendChild($)}}$._rendered=true}function V(e,t,n){var i=F[t],r=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";if(i&&e)i=new d(i,{root:e,opts:n},r);if(i&&i.mount){i.mount();O.push(i);return i.on("unmount",function(){O.splice(O.indexOf(i),1)})}}t.tag=function(e,t,n,i,r){if(b(i)){r=i;if(/^[\w\-]+\s?=/.test(n)){i=n;n=""}else i=""}if(n){if(b(n))r=n;else R(n)}F[e]={name:e,tmpl:t,attrs:i,fn:r};return e};t.mount=function(e,t,r){var o,u,f=[];function a(e){var t="";h(e,function(e){t+=', *[riot-tag="'+e.trim()+'"]'});return t}function s(){var e=Object.keys(F);return e+a(e)}function c(e){if(e.tagName){if(t&&!e.getAttribute(B))e.setAttribute(B,t);var n=V(e,t||e.getAttribute(B)||e.tagName.toLowerCase(),r);if(n)f.push(n)}else if(e.length){h(e,c)}}if(typeof t===i){r=t;t=0}if(typeof e===n){if(e==="*"){e=u=s()}else{e+=a(e.split(","))}o=A(e)}else o=e;if(t==="*"){t=u||s();if(o.tagName){o=A(t,o)}else{var l=[];h(o,function(e){l.push(A(t,e))});o=l}t=0}if(o.tagName)c(o);else h(o,c);return f};t.update=function(){return h(O,function(e){e.update()})};t.mountTo=t.mount;t.util={brackets:u,tmpl:f};if(typeof exports==="object")module.exports=t;else if(typeof define==="function"&&define.amd)define(function(){return t});else e.riot=t})(typeof window!="undefined"?window:undefined); |
@@ -1,6 +0,6 @@ | ||
/* Riot v2.2.0, @license MIT, (c) 2015 Muut Inc. + contributors */ | ||
/* Riot v2.2.1, @license MIT, (c) 2015 Muut Inc. + contributors */ | ||
;(function(window) { | ||
'use strict' | ||
var riot = { version: 'v2.2.0', settings: {} } | ||
var riot = { version: 'v2.2.1', settings: {} } | ||
@@ -490,3 +490,4 @@ // This globals 'const' helps code size reduction | ||
isLoop: true, | ||
root: root | ||
root: root, | ||
item: _item | ||
}) | ||
@@ -617,2 +618,3 @@ ).mount() | ||
isLoop = conf.isLoop, | ||
item = conf.item, | ||
expressions = [], | ||
@@ -653,3 +655,3 @@ childTags = [], | ||
extend(this, { parent: parent, root: root, opts: opts, tags: {} }) | ||
extend(this, { parent: parent, root: root, opts: opts, tags: {} }, item) | ||
@@ -656,0 +658,0 @@ // grab attributes |
@@ -1,2 +0,2 @@ | ||
/* Riot v2.2.0, @license MIT, (c) 2015 Muut Inc. + contributors */ | ||
(function(e){"use strict";var t={version:"v2.2.0",settings:{}};var n="string";var r="object";var i=Array.isArray||function(){var e=Object.prototype.toString;return function(t){return e.call(t)==="[object Array]"}}();var o=function(e){return(e&&e.document||{}).documentMode|0}(e);t.observable=function(e){e=e||{};var t={},n=0;e.on=function(r,i){if(b(i)){i._id=typeof i._id=="undefined"?n++:i._id;r.replace(/\S+/g,function(e,n){(t[e]=t[e]||[]).push(i);i.typed=n>0})}return e};e.off=function(n,r){if(n=="*")t={};else{n.replace(/\S+/g,function(e){if(r){var n=t[e];for(var i=0,o;o=n&&n[i];++i){if(o._id==r._id){n.splice(i,1);i--}}}else{t[e]=[]}})}return e};e.one=function(t,n){function r(){e.off(t,r);n.apply(e,arguments)}return e.on(t,r)};e.trigger=function(n){var r=[].slice.call(arguments,1),i=t[n]||[];for(var o=0,u;u=i[o];++o){if(!u.busy){u.busy=1;u.apply(e,u.typed?[n].concat(r):r);if(i[o]!==u){o--}u.busy=0}}if(t.all&&n!="all"){e.trigger.apply(e,["all",n].concat(r))}return e};return e};t.mixin=function(){var e={};return function(t,n){if(!n)return e[t];e[t]=n}}();(function(e,t,n){if(!n)return;var r=n.location,i=e.observable(),o=n,u=false,a;function f(){return r.href.split("#")[1]||""}function s(e){return e.split("/")}function c(e){if(e.type)e=f();if(e!=a){i.trigger.apply(null,["H"].concat(s(e)));a=e}}var l=e.route=function(e){if(e[0]){r.hash=e;c(e)}else{i.on("H",e)}};l.exec=function(e){e.apply(null,s(f()))};l.parser=function(e){s=e};l.stop=function(){if(!u)return;o.removeEventListener?o.removeEventListener(t,c,false):o.detachEvent("on"+t,c);i.off("*");u=false};l.start=function(){if(u)return;o.addEventListener?o.addEventListener(t,c,false):o.attachEvent("on"+t,c);u=true};l.start()})(t,"hashchange",e);var u=function(e){var n,r,i,o=/[{}]/g;return function(u){var a=t.settings.brackets||e;if(n!==a){n=a;i=a.split(" ");r=i.map(function(e){return e.replace(/(?=.)/g,"\\")})}return u instanceof RegExp?a===e?u:new RegExp(u.source.replace(o,function(e){return r[~~(e==="}")]}),u.global?"g":""):i[u]}}("{ }");var a=function(){var t={},n=/(['"\/]).*?[^\\]\1|\.\w*|\w*:|\b(?:(?:new|typeof|in|instanceof) |(?:this|true|false|null|undefined)\b|function *\()|([a-z_$]\w*)/gi;return function(e,n){return e&&(t[e]=t[e]||r(e))(n)};function r(e,t){e=(e||u(0)+u(1)).replace(u(/\\{/g),"").replace(u(/\\}/g),"");t=a(e,f(e,u(/{/),u(/}/)));return new Function("d","return "+(!t[0]&&!t[2]&&!t[3]?i(t[1]):"["+t.map(function(e,t){return t%2?i(e,true):'"'+e.replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"'}).join(",")+'].join("")').replace(/\uFFF0/g,u(0)).replace(/\uFFF1/g,u(1))+";")}function i(e,t){e=e.replace(/\n/g," ").replace(u(/^[{ ]+|[ }]+$|\/\*.+?\*\//g),"");return/^\s*[\w- "']+ *:/.test(e)?"["+f(e,/["' ]*[\w- ]+["' ]*:/,/,(?=["' ]*[\w- ]+["' ]*:)|}|$/).map(function(e){return e.replace(/^[ "']*(.+?)[ "']*: *(.+?),? *$/,function(e,t,n){return n.replace(/[^&|=!><]+/g,o)+'?"'+t+'":"",'})}).join("")+'].join(" ").trim()':o(e,t)}function o(t,r){t=t.trim();return!t?"":"(function(v){try{v="+(t.replace(n,function(t,n,r){return r?"(d."+r+"===undefined?"+(typeof e=="undefined"?"global.":"window.")+r+":d."+r+")":t})||"x")+"}catch(e){"+"}finally{return "+(r===true?'!v&&v!==0?"":v':"v")+"}}).call(d)"}function a(e,t){var n=[];t.map(function(t,r){r=e.indexOf(t);n.push(e.slice(0,r),t);e=e.slice(r+t.length)});return n.concat(e)}function f(e,t,n){var r,i=0,o=[],u=new RegExp("("+t.source+")|("+n.source+")","g");e.replace(u,function(t,n,u,a){if(!i&&n)r=a;i+=n?1:-1;if(!i&&u!=null)o.push(e.slice(r,a+u.length))});return o}}();function f(e){var t=u(0),n=e.slice(t.length).match(/\s*(\S+?)\s*(?:,\s*(\S)+)?\s+in\s+(.+)/);return n?{key:n[1],pos:n[2],val:t+n[3]}:{val:e}}function s(e,t,n){var r={};r[e.key]=t;if(e.pos)r[e.pos]=n;return r}function c(e,t,n){y(e,"each");var r=e.outerHTML,o=e.parentNode,u=document.createComment("riot placeholder"),c=[],l=q(e),p;o.insertBefore(u,e);n=f(n);t.one("premount",function(){if(o.stub)o=t.root;e.parentNode.removeChild(e)}).on("update",function(){var f=a(n.val,t),m;if(!i(f)){m=p;p=f?JSON.stringify(f):"";if(p===m)return;f=!f?[]:Object.keys(f).map(function(e){return s(n,e,f[e])})}var g=document.createDocumentFragment(),v=c.length,h=f.length;while(v>h)c[--v].unmount();c.length=h;m=!p&&!!n.key;for(v=0;v<h;++v){var b=m?s(n,f[v],v):f[v];if(!c[v]){(c[v]=new d({tmpl:r},{parent:t,isLoop:true,root:o})).mount();g.appendChild(c[v].root)}c[v]._item=b;c[v].update(b)}o.insertBefore(g,u);if(l)t.tags[x(e)]=c}).one("updated",function(){var e=Object.keys(t);_(o,function(n){if(n.nodeType==1&&!n.isLoop&&!n._looped){n._visited=false;n._looped=true;E(n,t,e)}})})}function l(e,t,n){_(e,function(e){if(e.nodeType==1){e.isLoop=e.parentNode&&e.parentNode.isLoop||e.getAttribute("each")?1:0;var r=q(e);if(r&&!e.isLoop){var o=new d(r,{root:e,parent:t},e.innerHTML),u=x(e),a=t,f;while(!q(a.root)){if(!a.parent)break;a=a.parent}o.parent=a;f=a.tags[u];if(f){if(!i(f))a.tags[u]=[f];a.tags[u].push(o)}else{a.tags[u]=o}e.innerHTML="";n.push(o)}if(!e.isLoop)E(e,t,[])}})}function p(e,t,n){function r(e,t,r){if(t.indexOf(u(0))>=0){var i={dom:e,expr:t};n.push(L(i,r))}}_(e,function(e){var n=e.nodeType;if(n==3&&e.parentNode.tagName!="STYLE")r(e,e.nodeValue);if(n!=1)return;var i=e.getAttribute("each");if(i){c(e,t,i);return false}h(e.attributes,function(t){var n=t.name,i=n.split("__")[1];r(e,t.value,{attr:i||n,bool:i});if(i){y(e,n);return false}});if(q(e))return false})}function d(e,n,r){var o=t.observable(this),f=N(n.opts)||{},s=C(e.tmpl),c=n.parent,d=n.isLoop,m=[],g=[],b=n.root,y=e.fn,x=b.tagName.toLowerCase(),_={},M,A=/([\w\-]+)\s?=\s?['"]([^'"]+)["']/gim;if(y&&b._tag){b._tag.unmount(true)}this.isMounted=false;if(e.attrs){var E=e.attrs.match(A);h(E,function(e){var t=e.split(/\s?=\s?/);b.setAttribute(t[0],t[1].replace(/['"]/g,""))})}b._tag=this;this._id=w(~~((new Date).getTime()*Math.random()));L(this,{parent:c,root:b,opts:f,tags:{}});h(b.attributes,function(e){var t=e.value;if(u(/\{.*\}/).test(t))_[e.name]=t});if(s.innerHTML&&!/select|select|optgroup|tbody|tr/.test(x))s.innerHTML=k(s.innerHTML,r);function S(){h(b.attributes,function(e){f[e.name]=a(e.value,c||o)});h(Object.keys(_),function(e){f[e]=a(_[e],c||o)})}this.update=function(e){L(o,e);S();o.trigger("update",e);v(m,o,e);o.trigger("updated")};this.mixin=function(){h(arguments,function(e){e=typeof e=="string"?t.mixin(e):e;h(Object.keys(e),function(t){if(t!="init")o[t]=typeof e[t]=="function"?e[t].bind(o):e[t]});if(e.init)e.init.bind(o)()})};this.mount=function(){S();y&&y.call(o,f);j(true);p(s,o,m);if(!o.parent)o.update();o.trigger("premount");if(d){o.root=b=M=s.firstChild}else{while(s.firstChild)b.appendChild(s.firstChild);if(b.stub)o.root=b=c.root}if(!o.parent||o.parent.isMounted){o.isMounted=true;o.trigger("mount")}else o.parent.one("mount",function(){if(!T(o.root)){o.parent.isMounted=o.isMounted=true;o.trigger("mount")}})};this.unmount=function(e){var t=M||b,n=t.parentNode;if(n){if(c){if(i(c.tags[x])){h(c.tags[x],function(e,t){if(e._id==o._id)c.tags[x].splice(t,1)})}else c.tags[x]=undefined}else{while(t.firstChild)t.removeChild(t.firstChild)}if(!e)n.removeChild(t)}o.trigger("unmount");j();o.off("*");b._tag=null};function j(e){h(g,function(t){t[e?"mount":"unmount"]()});if(c){var t=e?"on":"off";if(d)c[t]("unmount",o.unmount);else c[t]("update",o.update)[t]("unmount",o.unmount)}}l(s,this,g)}function m(t,n,r,i,o){r[t]=function(t){t=t||e.event;if(!t.which)t.which=t.charCode||t.keyCode;if(!t.target)t.target=t.srcElement;try{t.currentTarget=r}catch(u){""}t.item=i._item?i._item:o;if(n.call(i,t)!==true&&!/radio|check/.test(r.type)){t.preventDefault&&t.preventDefault();t.returnValue=false}if(!t.preventUpdate){var a=o?i.parent:i;a.update()}}}function g(e,t,n){if(e){e.insertBefore(n,t);e.removeChild(t)}}function v(e,t,n){h(e,function(e,r){var i=e.dom,o=e.attr,u=a(e.expr,t),f=e.dom.parentNode;if(u==null)u="";if(f&&f.tagName=="TEXTAREA")u=u.replace(/riot-/g,"");if(e.value===u)return;e.value=u;if(!o)return i.nodeValue=u.toString();y(i,o);if(typeof u=="function"){m(o,u,i,t,n)}else if(o=="if"){var s=e.stub;if(u){if(s){g(s.parentNode,s,i);i.inStub=false;if(!T(i)){_(i,function(e){if(e._tag&&!e._tag.isMounted)e._tag.isMounted=!!e._tag.trigger("mount")})}}}else{s=e.stub=s||document.createTextNode("");g(i.parentNode,i,s);i.inStub=true}}else if(/^(show|hide)$/.test(o)){if(o=="hide")u=!u;i.style.display=u?"":"none"}else if(o=="value"){i.value=u}else if(o.slice(0,5)=="riot-"&&o!="riot-tag"){o=o.slice(5);u?i.setAttribute(o,u):y(i,o)}else{if(e.bool){i[o]=u;if(!u)return;u=o}if(typeof u!="object")i.setAttribute(o,u)}})}function h(e,t){for(var n=0,r=(e||[]).length,i;n<r;n++){i=e[n];if(i!=null&&t(i,n)===false)n--}return e}function b(e){return typeof e==="function"||false}function y(e,t){e.removeAttribute(t)}function w(e){return(e^e>>31)-(e>>31)}function x(e){var t=q(e),n=e.getAttribute("name"),r=n&&n.indexOf(u(0))<0?n:t.name;return r}function L(e){var t,n=arguments;for(var r=1;r<n.length;++r){if(t=n[r]){for(var i in t){e[i]=t[i]}}}return e}function C(e){var t=o&&o<10,n=/^\s*<([\w-]+)/.exec(e),r=n?n[1].toLowerCase():"",i=r==="th"||r==="td"?"tr":r==="tr"?"tbody":"div",u=M(i);u.stub=true;if(t){if(r==="optgroup")H(u,e);else if(r==="option")j(u,e);else if(i!=="div")S(u,e,r);else t=0}if(!t)u.innerHTML=e;return u}function _(e,t){if(e){if(t(e)===false)_(e.nextSibling,t);else{e=e.firstChild;while(e){_(e,t);e=e.nextSibling}}}}function T(e){while(e){if(e.inStub)return true;e=e.parentNode}return false}function M(e){return document.createElement(e)}function k(e,t){return e.replace(/<(yield)\/?>(<\/\1>)?/gim,t||"")}function A(e,t){return(t||document).querySelectorAll(e)}function N(e){function t(){}t.prototype=e;return new t}function E(e,t,n){h(e.attributes,function(r){if(e._visited)return;if(r.name==="id"||r.name==="name"){e._visited=true;var o,u=r.value;if(~n.indexOf(u))return;o=t[u];if(!o)t[u]=e;else i(o)?o.push(e):t[u]=[o,e]}})}function S(e,t,n){var r=M("div"),i=/td|th/.test(n)?3:2,o;r.innerHTML="<table>"+t+"</table>";o=r.firstChild;while(i--){o=o.firstChild}e.appendChild(o)}function j(e,t){var n=M("option"),r=/value=[\"'](.+?)[\"']/,i=/selected=[\"'](.+?)[\"']/,o=/each=[\"'](.+?)[\"']/,u=/if=[\"'](.+?)[\"']/,a=/>([^<]*)</,f=t.match(r),s=t.match(i),c=t.match(a),l=t.match(o),p=t.match(u);if(c){n.innerHTML=c[1]}else{n.innerHTML=t}if(f){n.value=f[1]}if(s){n.setAttribute("riot-selected",s[1])}if(l){n.setAttribute("each",l[1])}if(p){n.setAttribute("if",p[1])}e.appendChild(n)}function H(e,t){var n=M("optgroup"),r=/label=[\"'](.+?)[\"']/,i=/^<([^>]*)>/,o=/^<([^ \>]*)/,u=t.match(r),a=t.match(i),f=t.match(o),s=t;if(a){var c=t.slice(a[1].length+2,-f[1].length-3).trim();s=c}if(u){n.setAttribute("riot-label",u[1])}if(s){var l=M("div");j(l,s);n.appendChild(l.firstChild)}e.appendChild(n)}var O=[],$={},F;var R="riot-tag";function q(e){return $[e.getAttribute(R)||e.tagName.toLowerCase()]}function B(e){F=F||M("style");if(!document.head)return;if(F.styleSheet)F.styleSheet.cssText+=e;else F.innerHTML+=e;if(!F._rendered)if(F.styleSheet){document.body.appendChild(F)}else{var t=A("style[type=riot]")[0];if(t){t.parentNode.insertBefore(F,t);t.parentNode.removeChild(t)}else{document.head.appendChild(F)}}F._rendered=true}function D(e,t,n){var r=$[t],i=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";if(r&&e)r=new d(r,{root:e,opts:n},i);if(r&&r.mount){r.mount();O.push(r);return r.on("unmount",function(){O.splice(O.indexOf(r),1)})}}t.tag=function(e,t,n,r,i){if(b(r)){i=r;if(/^[\w\-]+\s?=/.test(n)){r=n;n=""}else r=""}if(n){if(b(n))i=n;else B(n)}$[e]={name:e,tmpl:t,attrs:r,fn:i};return e};t.mount=function(e,t,i){var o,u,a=[];function f(e){var t="";h(e,function(e){t+=', *[riot-tag="'+e.trim()+'"]'});return t}function s(){var e=Object.keys($);return e+f(e)}function c(e){if(e.tagName){if(t&&!e.getAttribute(R))e.setAttribute(R,t);var n=D(e,t||e.getAttribute(R)||e.tagName.toLowerCase(),i);if(n)a.push(n)}else if(e.length){h(e,c)}}if(typeof t===r){i=t;t=0}if(typeof e===n){if(e==="*"){e=u=s()}else{e+=f(e.split(","))}o=A(e)}else o=e;if(t==="*"){t=u||s();if(o.tagName){o=A(t,o)}else{var l=[];h(o,function(e){l.push(A(t,e))});o=l}t=0}if(o.tagName)c(o);else h(o,c);return a};t.update=function(){return h(O,function(e){e.update()})};t.mountTo=t.mount;t.util={brackets:u,tmpl:a};if(typeof exports==="object")module.exports=t;else if(typeof define==="function"&&define.amd)define(function(){return t});else e.riot=t})(typeof window!="undefined"?window:undefined);(function(e){riot.parsers={html:{},css:{},js:{coffee:function(e){return CoffeeScript.compile(e,{bare:true})},es6:function(e){return babel.transform(e,{blacklist:["useStrict"]}).code},none:function(e){return e}}};riot.parsers.js.coffeescript=riot.parsers.js.coffee;var t=("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,"+"defaultchecked,defaultmuted,defaultselected,defer,disabled,draggable,enabled,formnovalidate,hidden,"+"indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,"+"pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,spellcheck,translate,truespeed,"+"typemustmatch,visible").split(","),n="area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(","),r=["style","src","d"],i=/^<([\w\-]+)>(.*)<\/\1>/gim,o=/=({[^}]+})([\s\/\>])/g,u=/([\w\-]+)=(["'])([^\2]+?)\2/g,a=/{\s*([^}]+)\s*}/g,f=/^<([\w\-]+)\s?([^>]*)>([^\x00]*[\w\/}"']>$)?([^\x00]*?)^<\/\1>/gim,s=/<script(\s+type=['"]?([^>'"]+)['"]?)?>([^\x00]*?)<\/script>/gm,c=/<style(\s+type=['"]?([^>'"]+)['"]?|\s+scoped)?>([^\x00]*?)<\/style>/gm,l=/(^|\}|\{)\s*([^\{\}]+)\s*(?=\{)/g,p=/\/\*[^\x00]*?\*\//gm,d=/<!--.*?-->/g,m=/<([\w\-]+)([^>]*)\/\s*>/g,g=/^\s*\/\/.*$/gm,v=/\/\*[^\x00]*?\*\//gm,h=/(<input\s[^>]*?)type=['"]number['"]/gm;function b(e,t,n,r,i){return"riot.tag('"+e+"', '"+t+"'"+(n?", '"+n+"'":"")+(r?", '"+r.replace(/'/g,"\\'")+"'":"")+", function(opts) {"+i+"\n});"}function y(e,i,f){var s=riot.util.brackets;e=e.replace(s(o),'="$1"$2');e=i.whitespace?e.replace(/\n/g,"\\n"):e.replace(/\s+/g," ");e=e.trim().replace(d,"");e=e.replace(h,"$1riot-type="+s(0)+'"number"'+s(1));e=e.replace(u,function(e,n,i,o){if(o.indexOf(s(0))>=0){n=n.toLowerCase();if(r.indexOf(n)>=0)n="riot-"+n;else if(t.indexOf(n)>=0)n="__"+n}return n+'="'+o+'"'});if(i.expr){e=e.replace(s(a),function(e,t){var n=L(t,i,f).trim().replace(/\r?\n|\r/g,"").trim();if(n.slice(-1)==";")n=n.slice(0,-1);return s(0)+n+s(1)})}e=e.replace(m,function(e,t,r){var i="<"+t+(r?" "+r.trim():"")+">";if(n.indexOf(t.toLowerCase())==-1)i+="</"+t+">";return i});e=e.replace(/'/g,"\\'");e=e.replace(s(/\\{|\\}/g),"\\$&");if(i.compact)e=e.replace(/> </g,"><");return e}function w(e){e=e.replace(g,"").replace(v,"");var t=e.split("\n"),n="";t.forEach(function(e,r){var i=e.trim();if(i[0]!="}"&&i.indexOf("(")>0&&i.indexOf("function")==-1){var o=/[{}]/.exec(i.slice(-1)),u=o&&/(\s+)([\w]+)\s*\(([\w,\s]*)\)\s*\{/.exec(e);if(u&&!/^(if|while|switch|for|catch)$/.test(u[2])){t[r]=u[1]+"this."+u[2]+" = function("+u[3]+") {";if(o[0]=="}"){t[r]+=" "+i.slice(u[0].length-1,-1)+"}.bind(this)"}else{n=u[1]}}}if(e.slice(0,n.length+1)==n+"}"){t[r]=n+"}.bind(this);";n=""}});return t.join("\n")}function x(e,t,n){return t.replace(p,"").replace(l,function(t,n,r){return n+" "+r.split(/\s*,\s*/g).map(function(t){var n=t.trim().replace(/:scope\s*/,"");return n[0]=="@"||n=="from"||n=="to"||/%$/.test(n)?n:e+" "+n+', [riot-tag="'+e+'"] '+n}).join(",")}).trim()}function L(e,t,n){var r=t.parser||(n?riot.parsers.js[n]:w);if(!r)throw new Error('Parser not found "'+n+'"');return r(e,t)}function C(e,t){var n=riot.parsers.html[e];if(!n)throw new Error('Template parser not found "'+e+'"');return n(t)}function _(e,t,n){if(n=="scoped-css")e=x(t,e);else if(riot.parsers.css[n])e=riot.parsers.css[n](t,e);return e.replace(/\s+/g," ").replace(/\\/g,"\\\\").replace(/'/g,"\\'").trim()}function T(e,t){t=t||{};if(t.brackets)riot.settings.brackets=t.brackets;if(t.template)e=C(t.template,e);e=e.replace(i,function(e,n,r){return b(n,y(r,t),"","","")});return e.replace(f,function(e,n,r,i,o){i=i||"";var u=t.type;if(!o.trim()){i=i.replace(s,function(e,t,n,r){if(n)u=n.replace("text/","");o=r;return""})}var a="css",f="";i=i.replace(c,function(e,t,n,r){if(t&&t.trim()=="scoped")a="scoped-css";else if(n)a=n.replace("text/","");f=r;return""});return b(n,y(i,t,u),_(f,n,a),r,L(o,t,u))})}var M=e.document,k,A;function N(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(n.readyState==4&&n.status==200)t(n.responseText)};n.open("GET",e,true);n.send("")}function E(e){var t=/[ \t]+/.exec(e);if(t)e=e.replace(new RegExp("^"+t[0],"gm"),"");return e}function S(e){var t=M.createElement("script"),n=M.documentElement;t.text=T(e);n.appendChild(t);n.removeChild(t)}function j(e){var t=M.querySelectorAll('script[type="riot/tag"]'),n=t.length;function r(){k.trigger("ready");A=true;e&&e()}if(!n){r()}else{[].map.call(t,function(e){var t=e.getAttribute("src");function i(e){S(e);n--;if(!n){r()}}return t?N(t,i):i(E(e.innerHTML))})}}riot.compile=function(e,t){if(typeof e=="string"){if(e.trim()[0]=="<"){var n=E(T(e));if(!t)S(n);return n}else{return N(e,function(e){var n=E(T(e));S(n);t&&t(n,e)})}}if(typeof e!="function")e=undefined;if(A)return e&&e();if(k){e&&k.on("ready",e)}else{k=riot.observable();j(e)}};var H=riot.mount;riot.mount=function(e,t,n){var r;riot.compile(function(){r=H(e,t,n)});return r};riot.mountTo=riot.mount})(this); | ||
/* Riot v2.2.1, @license MIT, (c) 2015 Muut Inc. + contributors */ | ||
(function(e){"use strict";var t={version:"v2.2.1",settings:{}};var n="string";var r="object";var i=Array.isArray||function(){var e=Object.prototype.toString;return function(t){return e.call(t)==="[object Array]"}}();var o=function(e){return(e&&e.document||{}).documentMode|0}(e);t.observable=function(e){e=e||{};var t={},n=0;e.on=function(r,i){if(b(i)){i._id=typeof i._id=="undefined"?n++:i._id;r.replace(/\S+/g,function(e,n){(t[e]=t[e]||[]).push(i);i.typed=n>0})}return e};e.off=function(n,r){if(n=="*")t={};else{n.replace(/\S+/g,function(e){if(r){var n=t[e];for(var i=0,o;o=n&&n[i];++i){if(o._id==r._id){n.splice(i,1);i--}}}else{t[e]=[]}})}return e};e.one=function(t,n){function r(){e.off(t,r);n.apply(e,arguments)}return e.on(t,r)};e.trigger=function(n){var r=[].slice.call(arguments,1),i=t[n]||[];for(var o=0,u;u=i[o];++o){if(!u.busy){u.busy=1;u.apply(e,u.typed?[n].concat(r):r);if(i[o]!==u){o--}u.busy=0}}if(t.all&&n!="all"){e.trigger.apply(e,["all",n].concat(r))}return e};return e};t.mixin=function(){var e={};return function(t,n){if(!n)return e[t];e[t]=n}}();(function(e,t,n){if(!n)return;var r=n.location,i=e.observable(),o=n,u=false,a;function f(){return r.href.split("#")[1]||""}function s(e){return e.split("/")}function c(e){if(e.type)e=f();if(e!=a){i.trigger.apply(null,["H"].concat(s(e)));a=e}}var l=e.route=function(e){if(e[0]){r.hash=e;c(e)}else{i.on("H",e)}};l.exec=function(e){e.apply(null,s(f()))};l.parser=function(e){s=e};l.stop=function(){if(!u)return;o.removeEventListener?o.removeEventListener(t,c,false):o.detachEvent("on"+t,c);i.off("*");u=false};l.start=function(){if(u)return;o.addEventListener?o.addEventListener(t,c,false):o.attachEvent("on"+t,c);u=true};l.start()})(t,"hashchange",e);var u=function(e){var n,r,i,o=/[{}]/g;return function(u){var a=t.settings.brackets||e;if(n!==a){n=a;i=a.split(" ");r=i.map(function(e){return e.replace(/(?=.)/g,"\\")})}return u instanceof RegExp?a===e?u:new RegExp(u.source.replace(o,function(e){return r[~~(e==="}")]}),u.global?"g":""):i[u]}}("{ }");var a=function(){var t={},n=/(['"\/]).*?[^\\]\1|\.\w*|\w*:|\b(?:(?:new|typeof|in|instanceof) |(?:this|true|false|null|undefined)\b|function *\()|([a-z_$]\w*)/gi;return function(e,n){return e&&(t[e]=t[e]||r(e))(n)};function r(e,t){e=(e||u(0)+u(1)).replace(u(/\\{/g),"").replace(u(/\\}/g),"");t=a(e,f(e,u(/{/),u(/}/)));return new Function("d","return "+(!t[0]&&!t[2]&&!t[3]?i(t[1]):"["+t.map(function(e,t){return t%2?i(e,true):'"'+e.replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"'}).join(",")+'].join("")').replace(/\uFFF0/g,u(0)).replace(/\uFFF1/g,u(1))+";")}function i(e,t){e=e.replace(/\n/g," ").replace(u(/^[{ ]+|[ }]+$|\/\*.+?\*\//g),"");return/^\s*[\w- "']+ *:/.test(e)?"["+f(e,/["' ]*[\w- ]+["' ]*:/,/,(?=["' ]*[\w- ]+["' ]*:)|}|$/).map(function(e){return e.replace(/^[ "']*(.+?)[ "']*: *(.+?),? *$/,function(e,t,n){return n.replace(/[^&|=!><]+/g,o)+'?"'+t+'":"",'})}).join("")+'].join(" ").trim()':o(e,t)}function o(t,r){t=t.trim();return!t?"":"(function(v){try{v="+(t.replace(n,function(t,n,r){return r?"(d."+r+"===undefined?"+(typeof e=="undefined"?"global.":"window.")+r+":d."+r+")":t})||"x")+"}catch(e){"+"}finally{return "+(r===true?'!v&&v!==0?"":v':"v")+"}}).call(d)"}function a(e,t){var n=[];t.map(function(t,r){r=e.indexOf(t);n.push(e.slice(0,r),t);e=e.slice(r+t.length)});return n.concat(e)}function f(e,t,n){var r,i=0,o=[],u=new RegExp("("+t.source+")|("+n.source+")","g");e.replace(u,function(t,n,u,a){if(!i&&n)r=a;i+=n?1:-1;if(!i&&u!=null)o.push(e.slice(r,a+u.length))});return o}}();function f(e){var t=u(0),n=e.slice(t.length).match(/\s*(\S+?)\s*(?:,\s*(\S)+)?\s+in\s+(.+)/);return n?{key:n[1],pos:n[2],val:t+n[3]}:{val:e}}function s(e,t,n){var r={};r[e.key]=t;if(e.pos)r[e.pos]=n;return r}function c(e,t,n){y(e,"each");var r=e.outerHTML,o=e.parentNode,u=document.createComment("riot placeholder"),c=[],l=q(e),p;o.insertBefore(u,e);n=f(n);t.one("premount",function(){if(o.stub)o=t.root;e.parentNode.removeChild(e)}).on("update",function(){var f=a(n.val,t),m;if(!i(f)){m=p;p=f?JSON.stringify(f):"";if(p===m)return;f=!f?[]:Object.keys(f).map(function(e){return s(n,e,f[e])})}var g=document.createDocumentFragment(),v=c.length,h=f.length;while(v>h)c[--v].unmount();c.length=h;m=!p&&!!n.key;for(v=0;v<h;++v){var b=m?s(n,f[v],v):f[v];if(!c[v]){(c[v]=new d({tmpl:r},{parent:t,isLoop:true,root:o,item:b})).mount();g.appendChild(c[v].root)}c[v]._item=b;c[v].update(b)}o.insertBefore(g,u);if(l)t.tags[x(e)]=c}).one("updated",function(){var e=Object.keys(t);_(o,function(n){if(n.nodeType==1&&!n.isLoop&&!n._looped){n._visited=false;n._looped=true;E(n,t,e)}})})}function l(e,t,n){_(e,function(e){if(e.nodeType==1){e.isLoop=e.parentNode&&e.parentNode.isLoop||e.getAttribute("each")?1:0;var r=q(e);if(r&&!e.isLoop){var o=new d(r,{root:e,parent:t},e.innerHTML),u=x(e),a=t,f;while(!q(a.root)){if(!a.parent)break;a=a.parent}o.parent=a;f=a.tags[u];if(f){if(!i(f))a.tags[u]=[f];a.tags[u].push(o)}else{a.tags[u]=o}e.innerHTML="";n.push(o)}if(!e.isLoop)E(e,t,[])}})}function p(e,t,n){function r(e,t,r){if(t.indexOf(u(0))>=0){var i={dom:e,expr:t};n.push(L(i,r))}}_(e,function(e){var n=e.nodeType;if(n==3&&e.parentNode.tagName!="STYLE")r(e,e.nodeValue);if(n!=1)return;var i=e.getAttribute("each");if(i){c(e,t,i);return false}h(e.attributes,function(t){var n=t.name,i=n.split("__")[1];r(e,t.value,{attr:i||n,bool:i});if(i){y(e,n);return false}});if(q(e))return false})}function d(e,n,r){var o=t.observable(this),f=N(n.opts)||{},s=C(e.tmpl),c=n.parent,d=n.isLoop,m=n.item,g=[],b=[],y=n.root,x=e.fn,_=y.tagName.toLowerCase(),M={},A,E=/([\w\-]+)\s?=\s?['"]([^'"]+)["']/gim;if(x&&y._tag){y._tag.unmount(true)}this.isMounted=false;if(e.attrs){var S=e.attrs.match(E);h(S,function(e){var t=e.split(/\s?=\s?/);y.setAttribute(t[0],t[1].replace(/['"]/g,""))})}y._tag=this;this._id=w(~~((new Date).getTime()*Math.random()));L(this,{parent:c,root:y,opts:f,tags:{}},m);h(y.attributes,function(e){var t=e.value;if(u(/\{.*\}/).test(t))M[e.name]=t});if(s.innerHTML&&!/select|select|optgroup|tbody|tr/.test(_))s.innerHTML=k(s.innerHTML,r);function j(){h(y.attributes,function(e){f[e.name]=a(e.value,c||o)});h(Object.keys(M),function(e){f[e]=a(M[e],c||o)})}this.update=function(e){L(o,e);j();o.trigger("update",e);v(g,o,e);o.trigger("updated")};this.mixin=function(){h(arguments,function(e){e=typeof e=="string"?t.mixin(e):e;h(Object.keys(e),function(t){if(t!="init")o[t]=typeof e[t]=="function"?e[t].bind(o):e[t]});if(e.init)e.init.bind(o)()})};this.mount=function(){j();x&&x.call(o,f);H(true);p(s,o,g);if(!o.parent)o.update();o.trigger("premount");if(d){o.root=y=A=s.firstChild}else{while(s.firstChild)y.appendChild(s.firstChild);if(y.stub)o.root=y=c.root}if(!o.parent||o.parent.isMounted){o.isMounted=true;o.trigger("mount")}else o.parent.one("mount",function(){if(!T(o.root)){o.parent.isMounted=o.isMounted=true;o.trigger("mount")}})};this.unmount=function(e){var t=A||y,n=t.parentNode;if(n){if(c){if(i(c.tags[_])){h(c.tags[_],function(e,t){if(e._id==o._id)c.tags[_].splice(t,1)})}else c.tags[_]=undefined}else{while(t.firstChild)t.removeChild(t.firstChild)}if(!e)n.removeChild(t)}o.trigger("unmount");H();o.off("*");y._tag=null};function H(e){h(b,function(t){t[e?"mount":"unmount"]()});if(c){var t=e?"on":"off";if(d)c[t]("unmount",o.unmount);else c[t]("update",o.update)[t]("unmount",o.unmount)}}l(s,this,b)}function m(t,n,r,i,o){r[t]=function(t){t=t||e.event;if(!t.which)t.which=t.charCode||t.keyCode;if(!t.target)t.target=t.srcElement;try{t.currentTarget=r}catch(u){""}t.item=i._item?i._item:o;if(n.call(i,t)!==true&&!/radio|check/.test(r.type)){t.preventDefault&&t.preventDefault();t.returnValue=false}if(!t.preventUpdate){var a=o?i.parent:i;a.update()}}}function g(e,t,n){if(e){e.insertBefore(n,t);e.removeChild(t)}}function v(e,t,n){h(e,function(e,r){var i=e.dom,o=e.attr,u=a(e.expr,t),f=e.dom.parentNode;if(u==null)u="";if(f&&f.tagName=="TEXTAREA")u=u.replace(/riot-/g,"");if(e.value===u)return;e.value=u;if(!o)return i.nodeValue=u.toString();y(i,o);if(typeof u=="function"){m(o,u,i,t,n)}else if(o=="if"){var s=e.stub;if(u){if(s){g(s.parentNode,s,i);i.inStub=false;if(!T(i)){_(i,function(e){if(e._tag&&!e._tag.isMounted)e._tag.isMounted=!!e._tag.trigger("mount")})}}}else{s=e.stub=s||document.createTextNode("");g(i.parentNode,i,s);i.inStub=true}}else if(/^(show|hide)$/.test(o)){if(o=="hide")u=!u;i.style.display=u?"":"none"}else if(o=="value"){i.value=u}else if(o.slice(0,5)=="riot-"&&o!="riot-tag"){o=o.slice(5);u?i.setAttribute(o,u):y(i,o)}else{if(e.bool){i[o]=u;if(!u)return;u=o}if(typeof u!="object")i.setAttribute(o,u)}})}function h(e,t){for(var n=0,r=(e||[]).length,i;n<r;n++){i=e[n];if(i!=null&&t(i,n)===false)n--}return e}function b(e){return typeof e==="function"||false}function y(e,t){e.removeAttribute(t)}function w(e){return(e^e>>31)-(e>>31)}function x(e){var t=q(e),n=e.getAttribute("name"),r=n&&n.indexOf(u(0))<0?n:t.name;return r}function L(e){var t,n=arguments;for(var r=1;r<n.length;++r){if(t=n[r]){for(var i in t){e[i]=t[i]}}}return e}function C(e){var t=o&&o<10,n=/^\s*<([\w-]+)/.exec(e),r=n?n[1].toLowerCase():"",i=r==="th"||r==="td"?"tr":r==="tr"?"tbody":"div",u=M(i);u.stub=true;if(t){if(r==="optgroup")H(u,e);else if(r==="option")j(u,e);else if(i!=="div")S(u,e,r);else t=0}if(!t)u.innerHTML=e;return u}function _(e,t){if(e){if(t(e)===false)_(e.nextSibling,t);else{e=e.firstChild;while(e){_(e,t);e=e.nextSibling}}}}function T(e){while(e){if(e.inStub)return true;e=e.parentNode}return false}function M(e){return document.createElement(e)}function k(e,t){return e.replace(/<(yield)\/?>(<\/\1>)?/gim,t||"")}function A(e,t){return(t||document).querySelectorAll(e)}function N(e){function t(){}t.prototype=e;return new t}function E(e,t,n){h(e.attributes,function(r){if(e._visited)return;if(r.name==="id"||r.name==="name"){e._visited=true;var o,u=r.value;if(~n.indexOf(u))return;o=t[u];if(!o)t[u]=e;else i(o)?o.push(e):t[u]=[o,e]}})}function S(e,t,n){var r=M("div"),i=/td|th/.test(n)?3:2,o;r.innerHTML="<table>"+t+"</table>";o=r.firstChild;while(i--){o=o.firstChild}e.appendChild(o)}function j(e,t){var n=M("option"),r=/value=[\"'](.+?)[\"']/,i=/selected=[\"'](.+?)[\"']/,o=/each=[\"'](.+?)[\"']/,u=/if=[\"'](.+?)[\"']/,a=/>([^<]*)</,f=t.match(r),s=t.match(i),c=t.match(a),l=t.match(o),p=t.match(u);if(c){n.innerHTML=c[1]}else{n.innerHTML=t}if(f){n.value=f[1]}if(s){n.setAttribute("riot-selected",s[1])}if(l){n.setAttribute("each",l[1])}if(p){n.setAttribute("if",p[1])}e.appendChild(n)}function H(e,t){var n=M("optgroup"),r=/label=[\"'](.+?)[\"']/,i=/^<([^>]*)>/,o=/^<([^ \>]*)/,u=t.match(r),a=t.match(i),f=t.match(o),s=t;if(a){var c=t.slice(a[1].length+2,-f[1].length-3).trim();s=c}if(u){n.setAttribute("riot-label",u[1])}if(s){var l=M("div");j(l,s);n.appendChild(l.firstChild)}e.appendChild(n)}var O=[],$={},F;var R="riot-tag";function q(e){return $[e.getAttribute(R)||e.tagName.toLowerCase()]}function B(e){F=F||M("style");if(!document.head)return;if(F.styleSheet)F.styleSheet.cssText+=e;else F.innerHTML+=e;if(!F._rendered)if(F.styleSheet){document.body.appendChild(F)}else{var t=A("style[type=riot]")[0];if(t){t.parentNode.insertBefore(F,t);t.parentNode.removeChild(t)}else{document.head.appendChild(F)}}F._rendered=true}function D(e,t,n){var r=$[t],i=e._innerHTML=e._innerHTML||e.innerHTML;e.innerHTML="";if(r&&e)r=new d(r,{root:e,opts:n},i);if(r&&r.mount){r.mount();O.push(r);return r.on("unmount",function(){O.splice(O.indexOf(r),1)})}}t.tag=function(e,t,n,r,i){if(b(r)){i=r;if(/^[\w\-]+\s?=/.test(n)){r=n;n=""}else r=""}if(n){if(b(n))i=n;else B(n)}$[e]={name:e,tmpl:t,attrs:r,fn:i};return e};t.mount=function(e,t,i){var o,u,a=[];function f(e){var t="";h(e,function(e){t+=', *[riot-tag="'+e.trim()+'"]'});return t}function s(){var e=Object.keys($);return e+f(e)}function c(e){if(e.tagName){if(t&&!e.getAttribute(R))e.setAttribute(R,t);var n=D(e,t||e.getAttribute(R)||e.tagName.toLowerCase(),i);if(n)a.push(n)}else if(e.length){h(e,c)}}if(typeof t===r){i=t;t=0}if(typeof e===n){if(e==="*"){e=u=s()}else{e+=f(e.split(","))}o=A(e)}else o=e;if(t==="*"){t=u||s();if(o.tagName){o=A(t,o)}else{var l=[];h(o,function(e){l.push(A(t,e))});o=l}t=0}if(o.tagName)c(o);else h(o,c);return a};t.update=function(){return h(O,function(e){e.update()})};t.mountTo=t.mount;t.util={brackets:u,tmpl:a};if(typeof exports==="object")module.exports=t;else if(typeof define==="function"&&define.amd)define(function(){return t});else e.riot=t})(typeof window!="undefined"?window:undefined);(function(e){riot.parsers={html:{},css:{},js:{coffee:function(e){return CoffeeScript.compile(e,{bare:true})},es6:function(e){return babel.transform(e,{blacklist:["useStrict"]}).code},none:function(e){return e}}};riot.parsers.js.coffeescript=riot.parsers.js.coffee;var t=("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,"+"defaultchecked,defaultmuted,defaultselected,defer,disabled,draggable,enabled,formnovalidate,hidden,"+"indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,"+"pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,spellcheck,translate,truespeed,"+"typemustmatch,visible").split(","),n="area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(","),r=["style","src","d"],i=/^<([\w\-]+)>(.*)<\/\1>/gim,o=/=({[^}]+})([\s\/\>])/g,u=/([\w\-]+)=(["'])([^\2]+?)\2/g,a=/{\s*([^}]+)\s*}/g,f=/^<([\w\-]+)\s?([^>]*)>([^\x00]*[\w\/}"']>$)?([^\x00]*?)^<\/\1>/gim,s=/<script(\s+type=['"]?([^>'"]+)['"]?)?>([^\x00]*?)<\/script>/gm,c=/<style(\s+type=['"]?([^>'"]+)['"]?|\s+scoped)?>([^\x00]*?)<\/style>/gm,l=/(^|\}|\{)\s*([^\{\}]+)\s*(?=\{)/g,p=/\/\*[^\x00]*?\*\//gm,d=/<!--.*?-->/g,m=/<([\w\-]+)([^>]*)\/\s*>/g,g=/^\s*\/\/.*$/gm,v=/\/\*[^\x00]*?\*\//gm,h=/(<input\s[^>]*?)type=['"]number['"]/gm;function b(e,t,n,r,i){return"riot.tag('"+e+"', '"+t+"'"+(n?", '"+n+"'":"")+(r?", '"+r.replace(/'/g,"\\'")+"'":"")+", function(opts) {"+i+"\n});"}function y(e,i,f){var s=riot.util.brackets;e=e.replace(s(o),'="$1"$2');e=i.whitespace?e.replace(/\n/g,"\\n"):e.replace(/\s+/g," ");e=e.trim().replace(d,"");e=e.replace(h,"$1riot-type="+s(0)+'"number"'+s(1));e=e.replace(u,function(e,n,i,o){if(o.indexOf(s(0))>=0){n=n.toLowerCase();if(r.indexOf(n)>=0)n="riot-"+n;else if(t.indexOf(n)>=0)n="__"+n}return n+'="'+o+'"'});if(i.expr){e=e.replace(s(a),function(e,t){var n=L(t,i,f).trim().replace(/\r?\n|\r/g,"").trim();if(n.slice(-1)==";")n=n.slice(0,-1);return s(0)+n+s(1)})}e=e.replace(m,function(e,t,r){var i="<"+t+(r?" "+r.trim():"")+">";if(n.indexOf(t.toLowerCase())==-1)i+="</"+t+">";return i});e=e.replace(/'/g,"\\'");e=e.replace(s(/\\{|\\}/g),"\\$&");if(i.compact)e=e.replace(/> </g,"><");return e}function w(e){e=e.replace(g,"").replace(v,"");var t=e.split("\n"),n="";t.forEach(function(e,r){var i=e.trim();if(i[0]!="}"&&i.indexOf("(")>0&&i.indexOf("function")==-1){var o=/[{}]/.exec(i.slice(-1)),u=o&&/(\s+)([\w]+)\s*\(([\w,\s]*)\)\s*\{/.exec(e);if(u&&!/^(if|while|switch|for|catch)$/.test(u[2])){t[r]=u[1]+"this."+u[2]+" = function("+u[3]+") {";if(o[0]=="}"){t[r]+=" "+i.slice(u[0].length-1,-1)+"}.bind(this)"}else{n=u[1]}}}if(e.slice(0,n.length+1)==n+"}"){t[r]=n+"}.bind(this);";n=""}});return t.join("\n")}function x(e,t,n){return t.replace(p,"").replace(l,function(t,n,r){return n+" "+r.split(/\s*,\s*/g).map(function(t){var n=t.trim().replace(/:scope\s*/,"");return n[0]=="@"||n=="from"||n=="to"||/%$/.test(n)?n:e+" "+n+', [riot-tag="'+e+'"] '+n}).join(",")}).trim()}function L(e,t,n){var r=t.parser||(n?riot.parsers.js[n]:w);if(!r)throw new Error('Parser not found "'+n+'"');return r(e,t)}function C(e,t){var n=riot.parsers.html[e];if(!n)throw new Error('Template parser not found "'+e+'"');return n(t)}function _(e,t,n){if(n=="scoped-css")e=x(t,e);else if(riot.parsers.css[n])e=riot.parsers.css[n](t,e);return e.replace(/\s+/g," ").replace(/\\/g,"\\\\").replace(/'/g,"\\'").trim()}function T(e,t){t=t||{};if(t.brackets)riot.settings.brackets=t.brackets;if(t.template)e=C(t.template,e);e=e.replace(i,function(e,n,r){return b(n,y(r,t),"","","")});return e.replace(f,function(e,n,r,i,o){i=i||"";var u=t.type;if(!o.trim()){i=i.replace(s,function(e,t,n,r){if(n)u=n.replace("text/","");o=r;return""})}var a="css",f="";i=i.replace(c,function(e,t,n,r){if(t&&t.trim()=="scoped")a="scoped-css";else if(n)a=n.replace("text/","");f=r;return""});return b(n,y(i,t,u),_(f,n,a),r,L(o,t,u))})}var M=e.document,k,A;function N(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(n.readyState==4&&n.status==200)t(n.responseText)};n.open("GET",e,true);n.send("")}function E(e){var t=/[ \t]+/.exec(e);if(t)e=e.replace(new RegExp("^"+t[0],"gm"),"");return e}function S(e){var t=M.createElement("script"),n=M.documentElement;t.text=T(e);n.appendChild(t);n.removeChild(t)}function j(e){var t=M.querySelectorAll('script[type="riot/tag"]'),n=t.length;function r(){k.trigger("ready");A=true;e&&e()}if(!n){r()}else{[].map.call(t,function(e){var t=e.getAttribute("src");function i(e){S(e);n--;if(!n){r()}}return t?N(t,i):i(E(e.innerHTML))})}}riot.compile=function(e,t){if(typeof e=="string"){if(e.trim()[0]=="<"){var n=E(T(e));if(!t)S(n);return n}else{return N(e,function(e){var n=E(T(e));S(n);t&&t(n,e)})}}if(typeof e!="function")e=undefined;if(A)return e&&e();if(k){e&&k.on("ready",e)}else{k=riot.observable();j(e)}};var H=riot.mount;riot.mount=function(e,t,n){var r;riot.compile(function(){r=H(e,t,n)});return r};riot.mountTo=riot.mount})(this); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
186545
4374
1