From b44ef3ce0ef9e76b820f3320be38074d4c1775f8 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Wed, 31 Jan 2018 15:41:32 +0100 Subject: [PATCH] fix system & context menu --- src/core/gui.coffee | 12 ++++++------ src/core/schemes/dm.html | 2 +- src/core/tags/afx-menu.js | 6 +++--- src/core/tags/afx-tree-view.js | 2 +- src/libs/riot.compiler.min.js | 4 ++-- src/libs/riot.min.js | 4 ++-- src/packages/Files/main.coffee | 28 ++++++++++++++++------------ src/packages/wTerm/main.coffee | 2 +- 8 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/core/gui.coffee b/src/core/gui.coffee index 5bba88b..2f59f3b 100644 --- a/src/core/gui.coffee +++ b/src/core/gui.coffee @@ -247,7 +247,7 @@ self.OS.GUI = { text: "Open", dataid: "desktop-open" }, { text: "Refresh", dataid: "desktop-refresh" } ] - menu = menu.concat _OS.setting.desktop.menu + menu = menu.concat ( v for k, v of _OS.setting.desktop.menu) m.set "items", menu m.set "onmenuselect", (evt) -> switch evt.item.data.dataid @@ -260,7 +260,7 @@ self.OS.GUI = when "desktop-refresh" desktop[0].fetch() else - _GUI.launch evt.item.data.app if evt.item.data.app + _GUI.launch evt.item.data.app, evt.item.data.args if evt.item.data.app m.show(e) desktop[0].fetch() @@ -290,7 +290,7 @@ self.OS.GUI = _GUI.launch d.item.data.app } ] - menu.child = menu.child.concat _OS.setting.system.menu + menu.child = menu.child.concat (v for k, v of _OS.setting.system.menu) menu.child.push text: "Log out", dataid: "sys-logout", @@ -329,7 +329,7 @@ self.OS.GUI = _OS.setting.user = conf.user _OS.setting.VFS = conf.VFS if conf.VFS _OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path - _OS.setting.desktop.menu = [] unless _OS.setting.desktop.menu + _OS.setting.desktop.menu = {} unless _OS.setting.desktop.menu _OS.setting.VFS.mountpoints = [ #TODO: multi app try to write to this object, it neet to be cloned { text: "Applications", path: 'app:///', iconclass: "fa fa-adn", type: "app" }, @@ -343,7 +343,7 @@ self.OS.GUI = "home:///.packages", "os:///packages" ] unless _OS.setting.system.pkgpaths - _OS.setting.system.menu = [] unless _OS.setting.system.menu + _OS.setting.system.menu = {} unless _OS.setting.system.menu _OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme # load theme @@ -367,7 +367,7 @@ self.OS.GUI = _GUI.pushServices [ "CoreServices/PushNotification", "CoreServices/Spotlight", - "CoreServices/Calendar" + #"CoreServices/Calendar" ] # startup application here diff --git a/src/core/schemes/dm.html b/src/core/schemes/dm.html index 077dfad..6f84f09 100644 --- a/src/core/schemes/dm.html +++ b/src/core/schemes/dm.html @@ -6,4 +6,4 @@ - + diff --git a/src/core/tags/afx-menu.js b/src/core/tags/afx-menu.js index 722d87a..e6c4e89 100644 --- a/src/core/tags/afx-menu.js +++ b/src/core/tags/afx-menu.js @@ -1,13 +1,13 @@ @@ -78,7 +78,7 @@ self.root.show = function(e) { //only for menucontext - if(opts.context != "true") return; + if(opts.context != "true") return $(self.root) .css("top", e.clientY - 15 + "px") .css("left",e.clientX -5 + "px") diff --git a/src/core/tags/afx-tree-view.js b/src/core/tags/afx-tree-view.js index c3d9aba..749d072 100644 --- a/src/core/tags/afx-tree-view.js +++ b/src/core/tags/afx-tree-view.js @@ -96,7 +96,7 @@ self.update() }) } - + select(event) { if(istoggle) diff --git a/src/libs/riot.compiler.min.js b/src/libs/riot.compiler.min.js index 2b4fbff..0837389 100644 --- a/src/libs/riot.compiler.min.js +++ b/src/libs/riot.compiler.min.js @@ -1,2 +1,2 @@ -/* Riot v3.6.1, @license MIT */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.riot=t()}(this,function(){"use strict";function e(e){return mt.test(e)}function t(e){return typeof e===st}function n(e){return e&&typeof e===rt}function r(e){return typeof e===it}function i(e){return typeof e===nt}function s(e){return r(e)||null===e||""===e}function o(e){return Array.isArray(e)||e instanceof Array}function a(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return r(e[t])||n&&n.writable}function u(e){return ht.test(e)}function c(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function l(e,t){return(t||document).querySelector(e)}function p(){return document.createDocumentFragment()}function f(){return document.createTextNode("")}function h(e){return!!e.ownerSVGElement}function d(e){return"svg"===e?document.createElementNS(at,e):document.createElement(e)}function g(e,t){if(r(e.innerHTML)){var n=(new DOMParser).parseFromString(t,"application/xml"),i=e.ownerDocument.importNode(n.documentElement,!0);e.appendChild(i)}else e.innerHTML=t}function m(e,t){e.style.display=t?"":"none",e.hidden=!t}function v(e,t){e.removeAttribute(t)}function x(e){return Object.keys(e).reduce(function(t,n){return t+" "+n+": "+e[n]+";"},"")}function y(e,t){return e.getAttribute(t)}function b(e,t,n){var r=ut.exec(t);r&&r[1]?e.setAttributeNS(ot,r[1],n):e.setAttribute(t,n)}function _(e,t,n){e.insertBefore(t,n.parentNode&&n)}function w(e,t){if(e)for(var n;n=dt.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function O(e,t,n){if(e){var r,i=t(e,n);if(!1===i)return;for(e=e.firstChild;e;)r=e.nextSibling,O(e,t,i),e=r}}function j(e,t){for(var n=e?e.length:0,r=0;rr;)n--,F.apply(t[n],[t,n])}function F(e,t){e.splice(t,1),this.unmount(),he(this.parent,this,this.__.tagName,!0)}function H(e){var t=this;j(Object.keys(this.tags),function(n){oe.apply(t.tags[n],[n,e])})}function z(e,t,n){n?ve.apply(this,[e,t]):_(e,this.root,t.root)}function B(e,t,n){n?me.apply(this,[e,t]):_(e,this.root,t.root)}function U(e,t){t?me.call(this,e):e.appendChild(this.root)}function V(e,t,n){v(e,Je);var r,s=typeof y(e,Xe)!==nt||v(e,Xe),a=le(e),u=De[a],c=e.parentNode,l=f(),h=ie(e),d=y(e,Qe),g=[],m=[],x=!De[a],b="VIRTUAL"===e.tagName;return n=St.loopKeys(n),n.isLoop=!0,d&&v(e,Qe),c.insertBefore(l,e),c.removeChild(e),n.update=function(){n.value=St(n.val,t);var c=p(),f=n.value,v=!o(f)&&!i(f),y=l.parentNode;y&&(v?f=(r=f||!1)?Object.keys(f).map(function(e){return $(n,f[e],e)}):[]:r=!1,d&&(f=f.filter(function(e,r){return n.key&&!v?!!St(d,$(n,e,r,t)):!!St(d,A(Object.create(t),e))})),j(f,function(i,o){var l=s&&typeof i===rt&&!r,p=m.indexOf(i),d=-1===p,v=!d&&l?p:o,_=g[v],w=o>=m.length,O=l&&d||!l&&!_;i=!r&&n.key?$(n,i,o):i,O?((_=new re(u,{parent:t,isLoop:!0,isAnonymous:x,tagName:a,root:e.cloneNode(x),item:i,index:o},e.innerHTML)).mount(),w?U.apply(_,[c||y,b]):B.apply(_,[y,g[o],b]),w||m.splice(o,0,i),g.splice(o,0,_),h&&fe(t.tags,a,_,!0)):v!==o&&l&&(N(f,m[v])&&(z.apply(_,[y,g[o],b]),g.splice(o,0,g.splice(v,1)[0]),m.splice(o,0,m.splice(v,1)[0])),n.pos&&(_[n.pos]=o),!h&&_.tags&&H.call(_,o)),_.__.item=i,_.__.index=o,_.__.parent=t,O||_.update(i)}),P(f,g),m=f.slice(),y.insertBefore(c,l))},n.unmount=function(){j(g,function(e){e.unmount()})},n}function q(e,t,n){var r=this;O(e,function(t,i){var s,o,a,u=t.nodeType,c=i.parent;if(!n&&t===e)return{parent:c};if(3===u&&"STYLE"!==t.parentNode.tagName&&St.hasExpr(t.nodeValue)&&c.children.push({dom:t,expr:t.nodeValue}),1!==u)return i;var l="VIRTUAL"===t.tagName;if(s=y(t,Je))return l&&b(t,"loopVirtual",!0),c.children.push(V(t,r,s)),!1;if(s=y(t,Qe))return c.children.push(Object.create(kt).init(t,r,s)),!1;if((o=y(t,We))&&St.hasExpr(o))return c.children.push({isRtag:!0,expr:o,dom:t,attrs:[].slice.call(t.attributes)}),!1;if(a=ie(t),l&&(y(t,"virtualized")&&t.parentElement.removeChild(t),a||y(t,"virtualized")||y(t,"loopVirtual")||(a={tmpl:t.outerHTML})),a&&(t!==e||n)){if(!l||y(t,We)){var p={root:t,parent:r,hasImpl:!0};return c.children.push(ae(a,p,t.innerHTML,r)),!1}b(t,"virtualized",!0);var f=new re({tmpl:t.outerHTML},{root:t,parent:r},t.innerHTML);c.children.push(f)}return D.apply(r,[t,t.attributes,function(e,t){t&&c.children.push(t)}]),{parent:c}},{parent:{children:t}})}function D(t,n,r){var i=this;j(n,function(n){if(!n)return!1;var s,o=n.name,a=e(o);N(Ge,o)?s=Object.create(Rt).init(t,i,o,n.value):St.hasExpr(n.value)&&(s={dom:t,expr:n.value,attr:o,bool:a}),r(n,s)})}function Z(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+""}),!t.whitespace){var r=[];/]/.test(e)&&(e=e.replace(vn,function(e){return r.push(e),""})),e=e.trim().replace(/\s+/g," "),r.length&&(e=e.replace(/\u0002/g,function(){return r.shift()}))}return t.compact&&(e=e.replace(dn,"><$1")),Oe(e,n).replace(bn,"")}function Ne(e){var t,n,r,i,s,o,a=[],u=RegExp;for(~e.indexOf("/")&&(e=function(e,t,n){for(t.lastIndex=0;n=t.exec(e);)n[1]?t.lastIndex=Ct.skipRegex(e,n.index):"/"===n[0][0]&&(e=e.slice(0,n.index)+" "+e.slice(t.lastIndex),t.lastIndex=n.index+1);return e}(e,An));t=e.match(Cn);)a.push(u.leftContext),r=function(e,t){var n,r=1;for(t.lastIndex=0;r&&(n=t.exec(e));)"{"===n[0]?++r:"}"===n[0]&&--r;return r?e.length:t.lastIndex}(e=u.rightContext,Sn),i=t[1],s=t[2]||"",o=t[3],o=(n=!/^(?:if|while|for|switch|catch|function)$/.test(o))?t[0].replace(i,"this."+o+" ="+s+" function"):t[0],a.push(o,e.slice(0,r)),e=e.slice(r),n&&!/^\s*.\s*bind\b/.test(e)&&a.push(".bind(this)");return a.length?a.join("")+e:e}function Ee(e,t,n,r,i){return/\S/.test(e)?(n||(n=t.type),(t.parser||n&&an._req("js."+n,!0)||Ne)(e,r,i).replace(/\r\n?/g,"\n").replace(bn,"")):""}function Ce(e,t){return t.replace(Tn,function(t,n,r){return r?(r=r.replace(/[^,]+/g,function(t){var n=t.trim();return 0===n.indexOf(e)?t:n&&"from"!==n&&"to"!==n&&"%"!==n.slice(-1)?n=n.indexOf(":scope")<0?e+" "+n+',[data-is="'+e+'"] '+n:n.replace(":scope",e)+","+n.replace(":scope",'[data-is="'+e+'"]'):t}),n?n+" "+r:r):t})}function Se(e,t,n,r){return r=r||{},n&&"css"!==n&&(e=an._req("css."+n,!0)(t,e,r.parserOpts||{},r.url)),e=e.replace(Ct.R_MLCOMMS,"").replace(/\s+/g," ").trim(),t&&(e=Ce(t,e)),e}function Ae(e,t){return e?(e=En+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+En,t&&~e.indexOf("\n")?e.replace(/\n/g,"\\n"):e):"''"}function Te(e,t,n,r,i,s,o){var a=o.debug?",\n ":", ",u="});";return i&&"\n"!==i.slice(-1)&&(u="\n"+u),s+"riot.tag2('"+e+En+a+Ae(t,1)+a+Ae(n)+a+Ae(r)+", function(opts) {\n"+i+u}function Le(e){if(/<[-\w]/.test(e))for(var t,n=e.lastIndexOf("<"),r=e.length;~n;){if(t=e.slice(n,r).match(Rn))return n+=t.index+t[0].length,"<-/>\n"===(t=e.slice(0,n)).slice(-5)&&(t=t.slice(0,-5)),[t,e.slice(n)];r=n,n=e.lastIndexOf("<",n-1)}return["",e]}function ke(e){if(e){var t=e.match(Ln);if(t=t&&(t[2]||t[3]))return t.replace("text/","")}return""}function Re(e,t){if(e){var n=e.match(RegExp("\\s"+t+kn,"i"));if(n=n&&n[1])return/^['"]/.test(n)?n.slice(1,-1):n}return""}function Ie(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function Me(e){var t=Ie(Re(e,"options"));return t?JSON.parse(t):null}function $e(e,t,n,r){var i=ke(n),s=Re(n,"src"),o=un({},t.parserOptions.js);return!s&&Ee(e,t,i,un(o,Me(n)),r)}function Pe(e,t,n,r,i){var s=un({},t.parserOptions.style),o={parserOpts:un(s,Me(n)),url:r};return Se(e,i,ke(n)||t.style,o)}function Fe(e,t,n,r){return an._req("html."+n,!0)(e,r,t)}function He(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){4===r.readyState&&(200===r.status||!r.status&&r.responseText.length)&&t(r.responseText,n,e)},r.open("GET",e,!0),r.send("")}function ze(e,t){if(typeof e===nt){var n=d("script"),r=document.documentElement;t&&(e+="\n//# sourceURL="+t+".js"),n.text=e,r.appendChild(n),r.removeChild(n)}}function Be(e,t){function n(){Ot.trigger("ready"),jt=!0,e&&e()}function r(e,t,r){ze(Pn.compile(e,t,r),r),--s||n()}var i=c('script[type="riot/tag"]'),s=i.length;if(s)for(var o=0;o=0&&/\s/.test(e[t]););return t}var t="[{(,;:?=|&!^~>%*/",n=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],r=n.reduce(function(e,t){return e+t.slice(-1)},""),i=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,s=/[$\w]/;return function(o,a){var u=/.*/g,c=u.lastIndex=a++,l=u.exec(o)[0].match(i);if(l){var p=c+l[0].length,f=o[c=e(o,c)];if(c<0||~t.indexOf(f))return p;if("."===f)"."===o[c-1]&&(a=p);else if("+"===f||"-"===f)(o[--c]!==f||(c=e(o,c))<0||!s.test(o[c]))&&(a=p);else if(~r.indexOf(f)){for(var h=c+1;--c>=0&&s.test(o[c]););~n.indexOf(o.slice(c+1,h))&&(a=p)}}return a}}(),Ct=function(e){function t(e){return e}function n(e,t){return t||(t=y),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?u:"")}function r(e){if(e===m)return v;var t=e.split(" ");if(2!==t.length||f.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(h,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:v[4],t),t[5]=n(e.length>3?/\\({|})/g:v[5],t),t[6]=n(v[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+d,u),t[8]=e,t}function i(e){return e instanceof RegExp?o(e):y[e]}function s(e){(e||(e=m))!==y[8]&&(y=r(e),o=e===m?t:n,y[9]=o(v[9])),x=e}var o,a,u="g",c=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,l=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,p=l.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,f=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),h=/(?=[[\]()*+?.^$|])/g,d=l.source+"|"+/(\/)(?![*\/])/.source,g={"(":RegExp("([()])|"+d,u),"[":RegExp("([[\\]])|"+d,u),"{":RegExp("([{}])|"+d,u)},m="{ }",v=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+d,u),m,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],x=void 0,y=[];return i.split=function(e,t,n){function r(e){d&&(e=d+e,d=""),t||o?p.push(e&&e.replace(n[5],"$1")):p.push(e)}function i(n,r,i){return i&&(r=Et(e,n)),t&&r>n+2&&(c="⁗"+h.length+"~",h.push(e.slice(n,r)),d+=e.slice(a,n)+c,a=r),r}n||(n=y);var s,o,a,u,c,l,p=[],f=n[6],h=[],d="";for(o=a=f.lastIndex=0;s=f.exec(e);){if(l=f.lastIndex,u=s.index,o){if(s[2]){var m=s[2],v=g[m],x=1;for(v.lastIndex=l;s=v.exec(e);)if(s[1]){if(s[1]===m)++x;else if(!--x)break}else v.lastIndex=i(s.index,v.lastIndex,s[2]);f.lastIndex=x?e.length:v.lastIndex;continue}if(!s[3]){f.lastIndex=i(u,l,s[4]);continue}}s[1]||(r(e.slice(a,u)),a=f.lastIndex,(f=n[6+(o^=1)]).lastIndex=a)}return e&&a %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}function n(e){var t=r(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function r(e){var t,n=Ct.split(e.replace(a,'"'),1),r=n.qblocks;if(n.length>2||n[0]){var s,o,c=[];for(s=o=0;s1?"["+i.join(",")+'].join(" ").trim()':i[0]:s(e,t)}return e}function s(e,t,n){var r;return e=e.replace(f,function(e,t,n,i,s){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+p+n,i&&(r="."===(s=s[i])||"("===s||"["===s)):i&&(r=!h.test(s.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var o={};e.hasExpr=Ct.hasExpr,e.loopKeys=Ct.loopKeys,e.clearCache=function(){o={}},e.errorHandler=null;var a=/\u2057/g,u=/\u2057(\d+)~/g,c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,l={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},p='"in this?this:'+("object"!=typeof window?"global":"window")+").",f=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,h=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=Ct.version="v3.0.8",e}(),At=function(e){e=e||{};var t={},n=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(n,r){return"function"==typeof r&&(t[n]=t[n]||[]).push(r),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,s=t[n],o=0;i=s&&s[o];++o)i==r&&s.splice(o--,1);else delete t[n];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,s,o,a=arguments,u=arguments.length-1,c=new Array(u);for(o=0;o|>([\S\s]*?)<\/yield\s*>|>)/gi,$t=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,Pt=/|>([\S\s]*?)<\/yield\s*>)/gi,Ft={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},Ht=vt&&vt<10?lt:pt,zt="div",Bt="svg",Ut={},Vt=Ut[Ze]={},qt=0,Dt=Object.freeze({Tag:W,tag:Q,tag2:J,mount:X,mixin:Y,update:ee,unregister:te,version:"v3.6.1"}),Zt=0,Kt=Object.freeze({getTag:ie,inheritFrom:se,moveChildTag:oe,initChildTag:ae,getImmediateCustomParentTag:ue,unmountAll:ce,getTagName:le,cleanUpData:pe,arrayishAdd:fe,arrayishRemove:he,mountTo:de,makeReplaceVirtual:ge,makeVirtual:me,moveVirtual:ve,selectTags:xe}),Gt=Lt,Wt={tmpl:St,brackets:Ct,styleManager:Nt,vdom:qe,styleNode:Nt.styleNode,dom:yt,check:xt,misc:Tt,tags:Kt},Qt=W,Jt=Q,Xt=J,Yt=X,en=Y,tn=ee,nn=te,rn=At,sn=A({},Dt,{observable:At,settings:Gt,util:Wt}),on=Object.freeze({settings:Gt,util:Wt,Tag:Qt,tag:Jt,tag2:Xt,mount:Yt,mixin:en,update:tn,unregister:nn,version:"v3.6.1",observable:rn,default:sn}),an=function(e){function t(t){var n=e[t];if(n)return n;throw new Error('Parser "'+t+'" not loaded.')}function n(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function r(e,r,i,s){return i=n({pretty:!0,filename:s,doctype:"html"},i),t(e).render(r,i)}var i={};return i.html={jade:function(e,t,n){return console.log('DEPRECATION WARNING: jade was renamed "pug" - The jade parser will be removed in riot@3.0.0!'),r("jade",e,t,n)},pug:function(e,t,n){return r("pug",e,t,n)}},i.css={less:function(e,r,i,s){var o;return i=n({sync:!0,syncImport:!0,filename:s},i),t("less").render(r,i,function(e,t){if(e)throw e;o=t.css}),o}},i.js={es6:function(e,r,i){return t("Babel").transform(e,n({plugins:[["transform-es2015-template-literals",{loose:!0}],"transform-es2015-literals","transform-es2015-function-name","transform-es2015-arrow-functions","transform-es2015-block-scoped-functions",["transform-es2015-classes",{loose:!0}],"transform-es2015-object-super","transform-es2015-shorthand-properties","transform-es2015-duplicate-keys",["transform-es2015-computed-properties",{loose:!0}],["transform-es2015-for-of",{loose:!0}],"transform-es2015-sticky-regex","transform-es2015-unicode-regex","check-es2015-constants",["transform-es2015-spread",{loose:!0}],"transform-es2015-parameters",["transform-es2015-destructuring",{loose:!0}],"transform-es2015-block-scoping","transform-es2015-typeof-symbol",["transform-es2015-modules-commonjs",{allowTopLevelThis:!0}],["transform-regenerator",{async:!1,asyncGenerators:!1}]]},r)).code},buble:function(e,r,i){return r=n({source:i,modules:!1},r),t("buble").transform(e,r).code},coffee:function(e,r){return t("CoffeeScript").compile(e,n({bare:!0},r))},livescript:function(e,r){return t("livescript").compile(e,n({bare:!0,header:!1},r))},typescript:function(e,n){return t("typescript")(e,n)},none:function(e){return e}},i.js.javascript=i.js.none,i.js.coffeescript=i.js.coffee,i._req=function(e){var t=e.split(".");if(2!==t.length)throw new Error("Bad format for parsers._req");var n=i[t[0]][t[1]];if(n)return n;throw new Error('Parser "'+e+'" not found.')},i.utils={extend:n},i}(window||global),un=an.utils.extend,cn=/"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source,ln=Ct.R_STRINGS.source,pn=/ *([-\w:\xA0-\xFF]+) ?(?:= ?('[^']*'|"[^"]*"|\S+))?/g,fn=RegExp(//.source+"|"+cn,"g"),hn=/<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^"'\/>]*(?:(?:"[^"]*"|'[^']*'|\/[^>])[^'"\/>]*)*)|\s*)(\/?)>/g,dn=/>[ \t]+<(-?[A-Za-z]|\/[-A-Za-z])/g,gn=["style","src","d","value"],mn=/^(?:input|img|br|wbr|hr|area|base|col|embed|keygen|link|meta|param|source|track)$/,vn=/]*|"[^"]*")*)?>([\S\s]+?)<\/pre\s*>/gi,xn=/^"(?:number|date(?:time)?|time|month|email|color)\b/i,yn=/^\s*import(?!\w)(?:(?:\s|[^\s'"])*)['|"].*\n?/gm,bn=/[ \t]+$/gm,_n=ye(/@#\d/,"x01"),wn=ye(/@#(\d+)/g,"x01"),On="#",jn="⁗",Nn='"',En="'",Cn=/^[ \t]*(((?:async|\*)\s*)?([$_A-Za-z][$\w]*))\s*\([^()]*\)\s*{/m,Sn=RegExp("[{}]|"+Ct.S_QBLOCKS,"g"),An=RegExp(Ct.R_MLCOMMS.source+"|//[^\r\n]*|"+Ct.S_QBLOCK2,"g"),Tn=RegExp("([{}]|^)[; ]*((?:[^@ ;{}][^{}]*)?[^@ ;{}:] ?)(?={)|"+cn,"g"),Ln=/\stype\s*=\s*(?:(['"])(.+?)\1|(\S+))/i,kn="\\s*=\\s*("+ln+"|{[^}]+}|\\S+)",Rn=/\/>\n|^<(?:\/?-?[A-Za-z][-\w\xA0-\xFF]*\s*|-?[A-Za-z][-\w\xA0-\xFF]*\s+[-\w:\xA0-\xFF][\S\s]*?)>\n/,In=RegExp(/^([ \t]*)<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^'"\/>]+(?:(?:@|\/[^>])[^'"\/>]*)*)|\s*)?(?:\/>|>[ \t]*\n?([\S\s]*)^\1<\/\2\s*>|>(.*)<\/\2\s*>)/.source.replace("@",ln),"gim"),Mn=/]*)?>\n?([\S\s]*?)<\/script\s*>/gi,$n=/]*)?>\n?([\S\s]*?)<\/style\s*>/gi,Pn={compile:function(e,t,n){var r,i=[],s={template:{},js:{},style:{}};t||(t={}),t.parserOptions=un(s,t.parserOptions||{}),r=t.exclude?function(e){return t.exclude.indexOf(e)<0}:function(){return 1},n||(n="");var o=Ct.array(t.brackets);return t.template&&(e=Fe(e,n,t.template,t.parserOptions.template)),e=be(e).replace(In,function(e,s,a,u,c,l){var p="",f="",h="",d="",g=[];if(g._bp=o,a=a.toLowerCase(),u=u&&r("attribs")?Oe(_e(we(u,t,g),g),g):"",(c||(c=l))&&/\S/.test(c))if(l)r("html")&&(h=je(l,t,g));else{var m=Le((c=(c=(c=c.replace(RegExp("^"+s,"gm"),"")).replace(Mn,function(e,i,s){if(r("js")){var o=$e(s,t,i,n);o&&(p+=(p?"\n":"")+o)}return""})).replace($n,function(e,i,s){return r("css")&&(f+=(f?" ":"")+Pe(s,t,i,n,a)),""})).replace(bn,""));r("html")&&(h=je(m[0],t,g)),r("js")&&((c=Ee(m[1],t,null,null,n))&&(p+=(p?"\n":"")+c),p=p.replace(yn,function(e){return d+=e.trim()+"\n",""}))}return p=/\S/.test(p)?p.replace(/\n{3,}/g,"\n\n"):"",t.entities?(i.push({tagName:a,html:h,css:f,attribs:u,js:p,imports:d}),""):Te(a,h,f,u,p,d,t)}),t.entities?i:e},compileHTML:function(e,t,n){return Array.isArray(t)?(n=t,t={}):(n||(n=[]),t||(t={})),n._bp=Ct.array(t.brackets),je(be(e),t,n)},compileCSS:function(e,t,n){return t&&"object"==typeof t?(n=t,t=""):n||(n={}),Se(e,n.tagName,t,n)},compileJS:function(e,t,n,r){return"string"==typeof t&&(r=n,n=t,t={}),n&&"object"==typeof n&&(r=n,n=""),r||(r={}),Ee(e,t||{},n,r.parserOptions,r.url)},parsers:an,version:"v3.2.3"},Fn=Pn.parsers,Hn=function(e,r,i){if(typeof e===nt){if(n(r)&&(i=r,r=!1),/^\s*'+t+"","application/xml").documentElement,!0);e.appendChild(r)}else e.innerHTML=t}function a(e,t){e.style.display=t?"":"none",e.hidden=!t}function u(e,t){e.removeAttribute(t)}function c(e){return Object.keys(e).reduce(function(t,n){return t+" "+n+": "+e[n]+";"},"")}function l(e,t){return e.getAttribute(t)}function f(e,t,n){var r=We.exec(t);r&&r[1]?e.setAttributeNS(Ge,r[1],n):e.setAttribute(t,n)}function p(e,t,n){e.insertBefore(t,n.parentNode&&n)}function d(e,t){if(e)for(var n;n=Xe.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function h(e,t,n){if(e){var r,i=t(e,n);if(!1===i)return;for(e=e.firstChild;e;)r=e.nextSibling,h(e,t,i),e=r}}function g(e){return et.test(e)}function m(e){return typeof e===Ze}function v(e){return e&&typeof e===qe}function x(e){return typeof e===De}function y(e){return typeof e===Be}function b(e){return _(e)||""===e}function _(e){return x(e)||null===e}function w(e){return Array.isArray(e)||e instanceof Array}function O(e,t){var n=gt(e,t);return x(e[t])||n&&n.writable}function j(e,t){for(var n=e?e.length:0,r=0;rr;)(function(e,t){e.splice(t,1),this.unmount(),re(this.parent,this,this.__.tagName,!0)}).apply(t[--n],[t,n])}function P(e,t,i){var o,s=typeof l(e,Fe)!==Be||u(e,Fe),a=l(e,Ue),c=!!a&&ft.hasExpr(a),f=te(e),d=Te[f],h=e.parentNode,g=r(),m=J(e),v=l(e,Pe),x=[],b=e.innerHTML,_=!Te[f],O="VIRTUAL"===e.tagName,N=[];return u(e,$e),u(e,Ue),i=ft.loopKeys(i),i.isLoop=!0,v&&u(e,Pe),h.insertBefore(g,e),h.removeChild(e),i.update=function(){i.value=ft(i.val,t);var r=i.value,u=n(),l=!w(r)&&!y(r),h=g.parentNode,C=[];h&&(l?r=(o=r||!1)?Object.keys(r).map(function(e){return R(i,r[e],e)}):[]:o=!1,v&&(r=r.filter(function(e,n){return i.key&&!l?!!ft(v,R(i,e,n,t)):!!ft(v,T(Object.create(t),e))})),j(r,function(n,l){var g=!o&&i.key?R(i,n,l):n,v=function(e,t,n,r){return e?r?ft(e,n):t[e]:t}(a,n,g,c),y=s&&typeof n===qe&&!o,w=N.indexOf(v),S=-1===w,A=!S&&y?w:l,T=x[A],k=l>=N.length,L=y&&S||!y&&!T;L?((T=W(d,{parent:t,isLoop:!0,isAnonymous:_,tagName:f,root:e.cloneNode(_),item:g,index:l},b)).mount(),k?function(e,t){t?se.call(this,e):e.appendChild(this.root)}.apply(T,[u||h,O]):function(e,t,n){n?se.apply(this,[e,t]):p(e,this.root,t.root)}.apply(T,[h,x[l],O]),k||N.splice(l,0,g),x.splice(l,0,T),m&&ne(t.tags,f,T,!0)):A!==l&&y&&((a||E(r,N[A]))&&(function(e,t,n){n?ue.apply(this,[e,t]):p(e,this.root,t.root)}.apply(T,[h,x[l],O]),x.splice(l,0,x.splice(A,1)[0]),N.splice(l,0,N.splice(A,1)[0])),i.pos&&(T[i.pos]=l),!m&&T.tags&&function(e){var t=this;j(Object.keys(this.tags),function(n){Q.apply(t.tags[n],[n,e])})}.call(T,l)),T.__.item=g,T.__.index=l,T.__.parent=t,C[l]=v,L||T.update(g)}),M(r,x),N=C.slice(),h.insertBefore(u,g))},i.unmount=function(){j(x,function(e){e.unmount()})},i}function $(e,t){var n=this,r=[];return h(e,function(i){var o,s,a=i.nodeType;if((t||i!==e)&&(3===a&&"STYLE"!==i.parentNode.tagName&&ft.hasExpr(i.nodeValue)&&r.push({dom:i,expr:i.nodeValue}),1===a)){var u="VIRTUAL"===i.tagName;if(o=l(i,$e))return u&&f(i,"loopVirtual",!0),r.push(P(i,n,o)),!1;if(o=l(i,Pe))return r.push(Object.create(xt).init(i,n,o)),!1;if((o=l(i,Me))&&ft.hasExpr(o))return r.push({isRtag:!0,expr:o,dom:i,attrs:[].slice.call(i.attributes)}),!1;if(s=J(i),u&&(l(i,"virtualized")&&i.parentElement.removeChild(i),s||l(i,"virtualized")||l(i,"loopVirtual")||(s={tmpl:i.outerHTML})),s&&(i!==e||t)){if(!u)return r.push(X(s,{root:i,parent:n},i.innerHTML,n)),!1;l(i,Me)&&A("Virtual tags shouldn't be used together with the \""+Me+'" attribute - https://github.com/riot/riot/issues/2511'),f(i,"virtualized",!0);var c=W({tmpl:i.outerHTML},{root:i,parent:n},i.innerHTML);r.push(c)}F.apply(n,[i,i.attributes,function(e,t){t&&r.push(t)}])}}),r}function F(e,t,n){var r=this;j(t,function(t){if(!t)return!1;var i,o=t.name,s=g(o);E(Re,o)&&e.tagName.toLowerCase()!==ke?i=Object.create(yt).init(e,r,o,t.value):ft.hasExpr(t.value)&&(i={dom:e,expr:t.value,attr:o,bool:s}),n(t,i)})}function z(e,n,r){var i=e&&e.match(/^\s*<([-\w]+)/),a=i&&i[1].toLowerCase(),u=o(r?Ct:Nt);return e=function(e,t){if(!bt.test(e))return e;var n={};return t=t&&t.replace(wt,function(e,t,r){return n[t]=n[t]||r,""}).trim(),e.replace(Ot,function(e,t,r){return n[t]||r||""}).replace(_t,function(e,n){return t||n||""})}(e,n),Et.test(a)?u=function(e,n,r){var i="o"===r[0],o=i?"select>":"table>";if(e.innerHTML="<"+o+n.trim()+""}),!t.whitespace){var r=[];/]/.test(e)&&(e=e.replace(on,function(e){return r.push(e),""})),e=e.trim().replace(/\s+/g," "),r.length&&(e=e.replace(/\u0002/g,function(){return r.shift()}))}return t.compact&&(e=e.replace(tn,"><$1")),ge(e,n).replace(un,"")}function ve(e){var t,n,r,i,o,s,a=[],u=RegExp,c=function(e,t){for(var n,r,i,o,s,a,u=new RegExp(Gt,"g"),c=lt.skipRegex,l=0|t,f=[[]],p=[],d=u,h=d.lastIndex=l;a=d.exec(e);){if(o=a.index,s=d.lastIndex,r="",i=a[1]){if("{"===i)p.push("}");else if("}"===i){if(p.pop()!==i)throw new Error("Unexpected '}'");"`"===p[p.length-1]&&(i=p.pop())}else"/"===i&&(s=c(e,o))>o+1&&(r=e.slice(o,s));"`"===i&&(s=fe(e,s,p),r=e.slice(o,s),d=p.length?n||(n=new RegExp(Kt,"g")):u)}else"/"===(r=a[0])[0]?(r="*"===r[1]?" ":"",e=e.slice(l,o)+r+e.slice(s),s=o+r.length,r=""):2===r.length&&(r="");r&&(f[0].push(e.slice(h,o)),f.push(r),h=s),d.lastIndex=s}return f[0].push(e.slice(h)),f}(e);for(e=c.shift().join("<%>");t=e.match(gn);)a.push(u.leftContext),r=function(e){for(var t=/[{}]/g,n=1;n&&t.exec(e);)"{"===e[t.lastIndex-1]?++n:--n;return n?e.length:t.lastIndex}(e=u.rightContext),i=t[1],o=t[2]||"",s=t[3],s=(n=!/^(?:if|while|for|switch|catch|function)$/.test(s))?t[0].replace(i,"this."+s+" ="+o+" function"):t[0],a.push(s,e.slice(0,r)),e=e.slice(r),n&&!/^\s*.\s*bind\b/.test(e)&&a.push(".bind(this)");return a.length&&(e=a.join("")+e),c.length&&(e=e.replace(/<%>/g,function(){return c.shift()})),e}function xe(e,t,n,r,i){if(!/\S/.test(e))return"";n||(n=t.type);return(t.parser||n&&Dt._req("js."+n,!0)||ve)(e,r,i).replace(/\r\n?/g,"\n").replace(un,"")}function ye(e,t,n,r){if(r=r||{},n&&"css"!==n){e=Dt._req("css."+n,!0)(t,e,r.parserOpts||{},r.url)}return e=e.replace(lt.R_MLCOMMS,"").replace(/\s+/g," ").trim(),t&&(e=function(e,t){return t.replace(mn,function(t,n,r){return r?(r=r.replace(/[^,]+/g,function(t){var n=t.trim();return 0===n.indexOf(e)?t:n&&"from"!==n&&"to"!==n&&"%"!==n.slice(-1)?n=n.indexOf(":scope")<0?e+" "+n+',[data-is="'+e+'"] '+n:n.replace(":scope",e)+","+n.replace(":scope",'[data-is="'+e+'"]'):t}),n?n+" "+r:r):t})}(t,e)),e}function be(e,t){return e?(e=hn+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+hn,t&&-1!==e.indexOf("\n")?e.replace(/\n/g,"\\n"):e):"''"}function _e(e){if(e){var t=e.match(vn);if(t=t&&(t[2]||t[3]))return t.replace("text/","")}return""}function we(e,t){if(e){var n=e.match(RegExp("\\s"+t+xn,"i"));if(n=n&&n[1])return/^['"]/.test(n)?n.slice(1,-1):n}return""}function Oe(e){var t=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}(we(e,"options"));return t?JSON.parse(t):null}function je(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){4===r.readyState&&(200===r.status||!r.status&&r.responseText.length?t(r.responseText,n,e):Ne.error('"'+e+'" not found'))},r.onerror=function(e){return Ne.error(e)},r.open("GET",e,!0),r.send("")}function Ee(e,t){if(typeof e===Be){var n=o("script"),r=document.documentElement;t&&(e+="\n//# sourceURL="+t+".js"),n.text=e,r.appendChild(n),r.removeChild(n)}}function Ne(t,n,r){if(typeof t===Be){if(v(n)&&(r=n,n=!1),/^\s*=0&&/\s/.test(e[t]););return t}var t="[{(,;:?=|&!^~>%*/",n=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],r=n.reduce(function(e,t){return e+t.slice(-1)},""),i=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,o=/[$\w]/;return function(s,a){var u=/.*/g,c=u.lastIndex=a++,l=u.exec(s)[0].match(i);if(l){var f=c+l[0].length,p=s[c=e(s,c)];if(c<0||~t.indexOf(p))return f;if("."===p)"."===s[c-1]&&(a=f);else if("+"===p||"-"===p)(s[--c]!==p||(c=e(s,c))<0||!o.test(s[c]))&&(a=f);else if(~r.indexOf(p)){for(var d=c+1;--c>=0&&o.test(s[c]););~n.indexOf(s.slice(c+1,d))&&(a=f)}}return a}}(),lt=function(e){function t(e){return e}function n(e,t){return t||(t=x),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?u:"")}function r(e){if(e===g)return m;var t=e.split(" ");if(2!==t.length||f.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(p,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:m[4],t),t[5]=n(e.length>3?/\\({|})/g:m[5],t),t[6]=n(m[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+d,u),t[8]=e,t}function i(e){return e instanceof RegExp?s(e):x[e]}function o(e){(e||(e=g))!==x[8]&&(x=r(e),s=e===g?t:n,x[9]=s(m[9])),v=e}var s,a,u="g",c=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,l=c.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,f=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),p=/(?=[[\]()*+?.^$|])/g,d=c.source+"|"+/(\/)(?![*\/])/.source,h={"(":RegExp("([()])|"+d,u),"[":RegExp("([[\\]])|"+d,u),"{":RegExp("([{}])|"+d,u)},g="{ }",m=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+d,u),g,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],v=void 0,x=[];return i.split=function(e,t,n){function r(e){g&&(e=g+e,g=""),t||s?f.push(e&&e.replace(n[5],"$1")):f.push(e)}function i(n,r,i){return i&&(r=ct(e,n)),t&&r>n+2&&(c="⁗"+d.length+"~",d.push(e.slice(n,r)),g+=e.slice(a,n)+c,a=r),r}n||(n=x);var o,s,a,u,c,l,f=[],p=n[6],d=[],g="";for(s=a=p.lastIndex=0;o=p.exec(e);){if(l=p.lastIndex,u=o.index,s){if(o[2]){var m=o[2],v=h[m],y=1;for(v.lastIndex=l;o=v.exec(e);)if(o[1]){if(o[1]===m)++y;else if(!--y)break}else v.lastIndex=i(o.index,v.lastIndex,o[2]);p.lastIndex=y?e.length:v.lastIndex;continue}if(!o[3]){p.lastIndex=i(u,l,o[4]);continue}}o[1]||(r(e.slice(a,u)),a=p.lastIndex,(p=n[6+(s^=1)]).lastIndex=a)}return e&&a2||r[0]){var a,u,c=[];for(a=u=0;a %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}.bind({data:s,tmpl:n})):n}function t(e,t,r){if(e=e.replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,o=[],u=0;e&&(i=e.match(s))&&!i.index;){var c,l,f=/,|([[{(])|$/g;for(e=RegExp.rightContext,c=i[2]?r[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];l=(i=f.exec(e))[1];)!function(t,n){var r,i=1,o=a[t];for(o.lastIndex=n.lastIndex;r=o.exec(e);)if(r[0]===t)++i;else if(!--i)break;n.lastIndex=i?e.length:o.lastIndex}(l,f);l=e.slice(0,i.index),e=RegExp.rightContext,o[u++]=n(l,1,c)}e=u?u>1?"["+o.join(",")+'].join(" ").trim()':o[0]:n(e,t)}return e}function n(e,t,n){var r;return e=e.replace(c,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+u+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!l.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var r={};e.hasExpr=lt.hasExpr,e.loopKeys=lt.loopKeys,e.clearCache=function(){r={}},e.errorHandler=null;var i=/\u2057/g,o=/\u2057(\d+)~/g,s=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,a={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},u='"in this?this:'+("object"!=typeof window?"global":"window")+").",c=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,l=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=lt.version="v3.0.8",e}(),pt=function(e){e=e||{};var t={},n=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(n,r){return"function"==typeof r&&(t[n]=t[n]||[]).push(r),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,o=t[n],s=0;i=o&&o[s];++s)i==r&&o.splice(s--,1);else delete t[n];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,o,s,a=arguments,u=arguments.length-1,c=new Array(u);for(s=0;s|>([\S\s]*?)<\/yield\s*>|>)/gi,wt=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,Ot=/|>([\S\s]*?)<\/yield\s*>)/gi,jt={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},Et=tt&&tt<10?/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,Nt="div",Ct="svg",St={},At=St[Le]={},Tt=0,kt=Object.freeze({Tag:H,tag:U,tag2:V,mount:B,mixin:q,update:D,unregister:Z,version:"v3.8.1"}),Lt=Object.freeze({getTag:J,moveChildTag:Q,initChildTag:X,getImmediateCustomParentTag:Y,unmountAll:ee,getTagName:te,arrayishAdd:ne,arrayishRemove:re,mountTo:ie,makeReplaceVirtual:oe,makeVirtual:se,inheritParentProps:ae,moveVirtual:ue,selectTags:ce}),It=vt,Rt={tmpl:ft,brackets:lt,styleManager:ut,vdom:Ae,styleNode:ut.styleNode,dom:nt,check:dt,misc:mt,tags:Lt},Mt=H,Pt=U,$t=V,Ft=B,zt=q,Ht=D,Ut=Z,Vt=pt,Bt=T({},kt,{observable:pt,settings:It,util:Rt}),qt=Object.freeze({settings:It,util:Rt,Tag:Mt,tag:Pt,tag2:$t,mount:Ft,mixin:zt,update:Ht,unregister:Ut,version:"v3.8.1",observable:Vt,default:Bt}),Dt=function(e){function t(t){var n=e[t];if(n)return n;throw new Error('Parser "'+t+'" not loaded.')}function n(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function r(e,r,i,o){return i=n({pretty:!0,filename:o,doctype:"html"},i),t(e).render(r,i)}var i={};return i.html={jade:function(e,t,n){return console.log('DEPRECATION WARNING: jade was renamed "pug" - The jade parser will be removed in riot@3.0.0!'),r("jade",e,t,n)},pug:function(e,t,n){return r("pug",e,t,n)}},i.css={less:function(e,r,i,o){var s;return i=n({sync:!0,syncImport:!0,filename:o},i),t("less").render(r,i,function(e,t){if(e)throw e;s=t.css}),s}},i.js={es6:function(e,r,i){return t("Babel").transform(e,n({plugins:[["transform-es2015-template-literals",{loose:!0}],"transform-es2015-literals","transform-es2015-function-name","transform-es2015-arrow-functions","transform-es2015-block-scoped-functions",["transform-es2015-classes",{loose:!0}],"transform-es2015-object-super","transform-es2015-shorthand-properties","transform-es2015-duplicate-keys",["transform-es2015-computed-properties",{loose:!0}],["transform-es2015-for-of",{loose:!0}],"transform-es2015-sticky-regex","transform-es2015-unicode-regex","check-es2015-constants",["transform-es2015-spread",{loose:!0}],"transform-es2015-parameters",["transform-es2015-destructuring",{loose:!0}],"transform-es2015-block-scoping","transform-es2015-typeof-symbol",["transform-es2015-modules-commonjs",{allowTopLevelThis:!0}],["transform-regenerator",{async:!1,asyncGenerators:!1}]]},r)).code},buble:function(e,r,i){return r=n({source:i,modules:!1},r),t("buble").transform(e,r).code},coffee:function(e,r){return t("CoffeeScript").compile(e,n({bare:!0},r))},livescript:function(e,r){return t("livescript").compile(e,n({bare:!0,header:!1},r))},typescript:function(e,n){return t("typescript")(e,n)},none:function(e){return e}},i.js.javascript=i.js.none,i.js.coffeescript=i.js.coffee,i._req=function(e){var t=e.split(".");if(2!==t.length)throw new Error("Bad format for parsers._req");var n=i[t[0]][t[1]];if(n)return n;throw new Error('Parser "'+e+'" not found.')},i.utils={extend:n},i}(window||global),Zt=/'[^'\n\r\\]*(?:\\(?:\r\n?|[\S\s])[^'\n\r\\]*)*'/.source,Gt=[/\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//.source,"//.*",Zt,Zt.replace(/'/g,'"'),"([/`])"].join("|"),Kt=Gt.slice(0,-2)+"{}])",Wt=Dt.utils.extend,Jt=/"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source,Qt=lt.R_STRINGS.source,Xt=/ *([-\w:\xA0-\xFF]+) ?(?:= ?('[^']*'|"[^"]*"|\S+))?/g,Yt=RegExp(//.source+"|"+Jt,"g"),en=/<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^"'/>]*(?:(?:"[^"]*"|'[^']*'|\/[^>])[^'"/>]*)*)|\s*)(\/?)>/g,tn=/>[ \t]+<(-?[A-Za-z]|\/[-A-Za-z])/g,nn=["style","src","d","value"],rn=/^(?:input|img|br|wbr|hr|area|base|col|embed|keygen|link|meta|param|source|track)$/,on=/]*|"[^"]*")*)?>([\S\s]+?)<\/pre\s*>/gi,sn=/^"(?:number|date(?:time)?|time|month|email|color)\b/i,an=/^\s*import(?!\w)(?:(?:\s|[^\s'"])*)['|"].*\n?/gm,un=/[ \t]+$/gm,cn=le(/@#\d/,"x01"),ln=le(/@#(\d+)/g,"x01"),fn="#",pn="⁗",dn='"',hn="'",gn=/^[ \t]*(((?:async|\*)\s*)?([$_A-Za-z][$\w]*))\s*\([^()]*\)\s*{/m,mn=RegExp("([{}]|^)[; ]*((?:[^@ ;{}][^{}]*)?[^@ ;{}:] ?)(?={)|"+Jt,"g"),vn=/\stype\s*=\s*(?:(['"])(.+?)\1|(\S+))/i,xn="\\s*=\\s*("+Qt+"|{[^}]+}|\\S+)",yn=/\/>\n|^<(?:\/?-?[A-Za-z][-\w\xA0-\xFF]*\s*|-?[A-Za-z][-\w\xA0-\xFF]*\s+[-\w:\xA0-\xFF][\S\s]*?)>\n/,bn=RegExp(/^([ \t]*)<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^'"/>]+(?:(?:@|\/[^>])[^'"/>]*)*)|\s*)?(?:\/>|>[ \t]*\n?([\S\s]*)^\1<\/\2\s*>|>(.*)<\/\2\s*>)/.source.replace("@",Qt),"gim"),_n=/]*)?>\n?([\S\s]*?)<\/script\s*>/gi,wn=/]*)?>\n?([\S\s]*?)<\/style\s*>/gi,On={compile:function(e,t,n){var r,i=[],o=e;t||(t={}),t.parserOptions=Wt({template:{},js:{},style:{}},t.parserOptions||{}),r=t.exclude?function(e){return t.exclude.indexOf(e)<0}:function(){return 1},n||(n="");var s=lt.array(t.brackets);return t.template&&(o=function(e,t,n,r){return Dt._req("html."+n,!0)(e,r,t)}(o,n,t.template,t.parserOptions.template)),o=pe(o).replace(bn,function(e,o,a,u,c,l){var f="",p="",d="",h="",g=[];if(g._bp=s,a=a.toLowerCase(),u=u&&r("attribs")?ge(de(he(u,t,g),g),g):"",(c||(c=l))&&/\S/.test(c))if(l)r("html")&&(d=me(l,t,g));else{var m=function(e){if(/<[-\w]/.test(e))for(var t,n=e.lastIndexOf("<"),r=e.length;-1!==n;){if(t=e.slice(n,r).match(yn))return n+=t.index+t[0].length,"<-/>\n"===(t=e.slice(0,n)).slice(-5)&&(t=t.slice(0,-5)),[t,e.slice(n)];r=n,n=e.lastIndexOf("<",n-1)}return["",e]}((c=(c=(c=c.replace(RegExp("^"+o,"gm"),"")).replace(_n,function(e,i,o){if(r("js")){var s=function(e,t,n,r){var i=_e(n),o=we(n,"src"),s=Wt({},t.parserOptions.js);return!o&&xe(e,t,i,Wt(s,Oe(n)),r)}(o,t,i,n);s&&(f+=(f?"\n":"")+s)}return""})).replace(wn,function(e,i,o){return r("css")&&(p+=(p?" ":"")+function(e,t,n,r,i){var o=Wt({},t.parserOptions.style),s={parserOpts:Wt(o,Oe(n)),url:r};return ye(e,i,_e(n)||t.style,s)}(o,t,i,n,a)),""})).replace(un,""));r("html")&&(d=me(m[0],t,g)),r("js")&&((c=xe(m[1],t,null,null,n))&&(f+=(f?"\n":"")+c),f=f.replace(an,function(e){return h+=e.trim()+"\n",""}))}return f=/\S/.test(f)?f.replace(/\n{3,}/g,"\n\n"):"",t.entities?(i.push({tagName:a,html:d,css:p,attribs:u,js:f,imports:h}),""):function(e,t,n,r,i,o,s){var a=s.debug?",\n ":", ",u="});";return i&&"\n"!==i.slice(-1)&&(u="\n"+u),o+"riot.tag2('"+e+hn+a+be(t,1)+a+be(n)+a+be(r)+", function(opts) {\n"+i+u}(a,d,p,u,f,h,t)}),t.entities?i:o},compileHTML:function(e,t,n){return Array.isArray(t)?(n=t,t={}):(n||(n=[]),t||(t={})),n._bp=lt.array(t.brackets),me(pe(e),t,n)},compileCSS:function(e,t,n){return t&&"object"==typeof t?(n=t,t=""):n||(n={}),ye(e,n.tagName,t,n)},compileJS:function(e,t,n,r){return"string"==typeof t&&(r=n,n=t,t={}),n&&"object"==typeof n&&(r=n,n=""),r||(r={}),xe(e,t||{},n,r.parserOptions,r.url)},parsers:Dt,version:"v3.4.0"},jn=On.parsers;Ne.error=function(e){throw new Error(e)};return T({},qt,{mount:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n;return Ne(function(){n=Ft.apply(qt,e)}),n},compile:Ne,parsers:jn})}); diff --git a/src/libs/riot.min.js b/src/libs/riot.min.js index e207a35..3c865ed 100644 --- a/src/libs/riot.min.js +++ b/src/libs/riot.min.js @@ -1,2 +1,2 @@ -/* Riot v3.6.1, @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.riot=t.riot||{})}(this,function(t){"use strict";function e(t){return Zt.test(t)}function n(t){return typeof t===$t}function r(t){return t&&typeof t===Rt}function i(t){return typeof t===Pt}function o(t){return typeof t===It}function a(t){return i(t)||null===t||""===t}function s(t){return Array.isArray(t)||t instanceof Array}function u(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return i(t[e])||n&&n.writable}function l(t){return Kt.test(t)}function c(t,e){return Array.prototype.slice.call((e||document).querySelectorAll(t))}function f(t,e){return(e||document).querySelector(t)}function p(){return document.createDocumentFragment()}function h(){return document.createTextNode("")}function d(t){return!!t.ownerSVGElement}function g(t){return"svg"===t?document.createElementNS(Ut,t):document.createElement(t)}function m(t,e){if(i(t.innerHTML)){var n=(new DOMParser).parseFromString(e,"application/xml"),r=t.ownerDocument.importNode(n.documentElement,!0);t.appendChild(r)}else t.innerHTML=e}function v(t,e){t.style.display=e?"":"none",t.hidden=!e}function y(t,e){t.removeAttribute(e)}function x(t){return Object.keys(t).reduce(function(e,n){return e+" "+n+": "+t[n]+";"},"")}function b(t,e){return t.getAttribute(e)}function _(t,e,n){var r=Vt.exec(e);r&&r[1]?t.setAttributeNS(Ht,r[1],n):t.setAttribute(e,n)}function w(t,e,n){t.insertBefore(e,n.parentNode&&n)}function O(t,e){if(t)for(var n;n=qt.exec(t);)e(n[1].toLowerCase(),n[2]||n[3]||n[4])}function N(t,e,n){if(t){var r,i=e(t,n);if(!1===i)return;for(t=t.firstChild;t;)r=t.nextSibling,N(t,e,i),t=r}}function j(t,e){for(var n=t?t.length:0,r=0;rr;)n--,U.apply(e[n],[e,n])}function U(t,e){t.splice(e,1),this.unmount(),dt(this.parent,this,this.__.tagName,!0)}function V(t){var e=this;j(Object.keys(this.tags),function(n){st.apply(e.tags[n],[n,t])})}function B(t,e,n){n?yt.apply(this,[t,e]):w(t,this.root,e.root)}function z(t,e,n){n?vt.apply(this,[t,e]):w(t,this.root,e.root)}function F(t,e){e?vt.call(this,t):t.appendChild(this.root)}function D(t,e,n){y(t,At);var r,i=typeof b(t,Lt)!==It||y(t,Lt),a=ft(t),u=Ot[a],l=t.parentNode,c=h(),f=ot(t),d=b(t,Tt),g=[],m=[],v=!Ot[a],x="VIRTUAL"===t.tagName;return n=ie.loopKeys(n),n.isLoop=!0,d&&y(t,Tt),l.insertBefore(c,t),l.removeChild(t),n.update=function(){n.value=ie(n.val,e);var l=p(),h=n.value,y=!s(h)&&!o(h),b=c.parentNode;b&&(y?h=(r=h||!1)?Object.keys(h).map(function(t){return $(n,h[t],t)}):[]:r=!1,d&&(h=h.filter(function(t,r){return n.key&&!y?!!ie(d,$(n,t,r,e)):!!ie(d,L(Object.create(e),t))})),j(h,function(o,s){var c=i&&typeof o===Rt&&!r,p=m.indexOf(o),d=-1===p,y=!d&&c?p:s,_=g[y],w=s>=m.length,O=c&&d||!c&&!_;o=!r&&n.key?$(n,o,s):o,O?((_=new it(u,{parent:e,isLoop:!0,isAnonymous:v,tagName:a,root:t.cloneNode(v),item:o,index:s},t.innerHTML)).mount(),w?F.apply(_,[l||b,x]):z.apply(_,[b,g[s],x]),w||m.splice(s,0,o),g.splice(s,0,_),f&&ht(e.tags,a,_,!0)):y!==s&&c&&(C(h,m[y])&&(B.apply(_,[b,g[s],x]),g.splice(s,0,g.splice(y,1)[0]),m.splice(s,0,m.splice(y,1)[0])),n.pos&&(_[n.pos]=s),!f&&_.tags&&V.call(_,s)),_.__.item=o,_.__.index=s,_.__.parent=e,O||_.update(o)}),H(h,g),m=h.slice(),b.insertBefore(l,c))},n.unmount=function(){j(g,function(t){t.unmount()})},n}function K(t,e,n){var r=this;N(t,function(e,i){var o,a,s,u=e.nodeType,l=i.parent;if(!n&&e===t)return{parent:l};if(3===u&&"STYLE"!==e.parentNode.tagName&&ie.hasExpr(e.nodeValue)&&l.children.push({dom:e,expr:e.nodeValue}),1!==u)return i;var c="VIRTUAL"===e.tagName;if(o=b(e,At))return c&&_(e,"loopVirtual",!0),l.children.push(D(e,r,o)),!1;if(o=b(e,Tt))return l.children.push(Object.create(ue).init(e,r,o)),!1;if((a=b(e,Et))&&ie.hasExpr(a))return l.children.push({isRtag:!0,expr:a,dom:e,attrs:[].slice.call(e.attributes)}),!1;if(s=ot(e),c&&(b(e,"virtualized")&&e.parentElement.removeChild(e),s||b(e,"virtualized")||b(e,"loopVirtual")||(s={tmpl:e.outerHTML})),s&&(e!==t||n)){if(!c||b(e,Et)){var f={root:e,parent:r,hasImpl:!0};return l.children.push(ut(s,f,e.innerHTML,r)),!1}_(e,"virtualized",!0);var p=new it({tmpl:e.outerHTML},{root:e,parent:r},e.innerHTML);l.children.push(p)}return q.apply(r,[e,e.attributes,function(t,e){e&&l.children.push(e)}]),{parent:l}},{parent:{children:e}})}function q(t,n,r){var i=this;j(n,function(n){if(!n)return!1;var o,a=n.name,s=e(a);C(Ct,a)?o=Object.create(le).init(t,i,a,n.value):ie.hasExpr(n.value)&&(o={dom:t,expr:n.value,attr:a,bool:s}),r(n,o)})}function W(t,e,n){var r="o"===n[0],i=r?"select>":"table>";if(t.innerHTML="<"+i+e.trim()+"=0&&/\s/.test(t[e]););return e}var e="[{(,;:?=|&!^~>%*/",n=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],r=n.reduce(function(t,e){return t+e.slice(-1)},""),i=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,o=/[$\w]/;return function(a,s){var u=/.*/g,l=u.lastIndex=s++,c=u.exec(a)[0].match(i);if(c){var f=l+c[0].length,p=a[l=t(a,l)];if(l<0||~e.indexOf(p))return f;if("."===p)"."===a[l-1]&&(s=f);else if("+"===p||"-"===p)(a[--l]!==p||(l=t(a,l))<0||!o.test(a[l]))&&(s=f);else if(~r.indexOf(p)){for(var h=l+1;--l>=0&&o.test(a[l]););~n.indexOf(a.slice(l+1,h))&&(s=f)}}return s}}(),re=function(t){function e(t){return t}function n(t,e){return e||(e=x),new RegExp(t.source.replace(/{/g,e[2]).replace(/}/g,e[3]),t.global?u:"")}function r(t){if(t===m)return v;var e=t.split(" ");if(2!==e.length||p.test(t))throw new Error('Unsupported brackets "'+t+'"');return e=e.concat(t.replace(h,"\\").split(" ")),e[4]=n(e[1].length>1?/{[\S\s]*?}/:v[4],e),e[5]=n(t.length>3?/\\({|})/g:v[5],e),e[6]=n(v[6],e),e[7]=RegExp("\\\\("+e[3]+")|([[({])|("+e[3]+")|"+d,u),e[8]=t,e}function i(t){return t instanceof RegExp?a(t):x[t]}function o(t){(t||(t=m))!==x[8]&&(x=r(t),a=t===m?e:n,x[9]=a(v[9])),y=t}var a,s,u="g",l=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,c=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,f=c.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,p=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),h=/(?=[[\]()*+?.^$|])/g,d=c.source+"|"+/(\/)(?![*\/])/.source,g={"(":RegExp("([()])|"+d,u),"[":RegExp("([[\\]])|"+d,u),"{":RegExp("([{}])|"+d,u)},m="{ }",v=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+d,u),m,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],y=void 0,x=[];return i.split=function(t,e,n){function r(t){d&&(t=d+t,d=""),e||a?f.push(t&&t.replace(n[5],"$1")):f.push(t)}function i(n,r,i){return i&&(r=ne(t,n)),e&&r>n+2&&(l="⁗"+h.length+"~",h.push(t.slice(n,r)),d+=t.slice(s,n)+l,s=r),r}n||(n=x);var o,a,s,u,l,c,f=[],p=n[6],h=[],d="";for(a=s=p.lastIndex=0;o=p.exec(t);){if(c=p.lastIndex,u=o.index,a){if(o[2]){var m=o[2],v=g[m],y=1;for(v.lastIndex=c;o=v.exec(t);)if(o[1]){if(o[1]===m)++y;else if(!--y)break}else v.lastIndex=i(o.index,v.lastIndex,o[2]);p.lastIndex=y?t.length:v.lastIndex;continue}if(!o[3]){p.lastIndex=i(u,c,o[4]);continue}}o[1]||(r(t.slice(s,u)),s=p.lastIndex,(p=n[6+(a^=1)]).lastIndex=s)}return t&&s %s",e.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}function n(t){var e=r(t);return"try{return "!==e.slice(0,11)&&(e="return "+e),new Function("E",e+";")}function r(t){var e,n=re.split(t.replace(s,'"'),1),r=n.qblocks;if(n.length>2||n[0]){var o,a,l=[];for(o=a=0;o1?"["+i.join(",")+'].join(" ").trim()':i[0]:o(t,e)}return t}function o(t,e,n){var r;return t=t.replace(p,function(t,e,n,i,o){return n&&(i=r?0:i+t.length,"this"!==n&&"global"!==n&&"window"!==n?(t=e+'("'+n+f+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!h.test(o.slice(i)))),t}),r&&(t="try{return "+t+"}catch(e){E(e,this)}"),n?t=(r?"function(){"+t+"}.call(this)":"("+t+")")+'?"'+n+'":""':e&&(t="function(v){"+(r?t.replace("return ","v="):"v=("+t+")")+';return v||v===0?v:""}.call(this)'),t}var a={};t.hasExpr=re.hasExpr,t.loopKeys=re.loopKeys,t.clearCache=function(){a={}},t.errorHandler=null;var s=/\u2057/g,u=/\u2057(\d+)~/g,l=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,c={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},f='"in this?this:'+("object"!=typeof window?"global":"window")+").",p=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,h=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return t.version=re.version="v3.0.8",t}(),oe=function(t){t=t||{};var e={},n=Array.prototype.slice;return Object.defineProperties(t,{on:{value:function(n,r){return"function"==typeof r&&(e[n]=e[n]||[]).push(r),t},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,o=e[n],a=0;i=o&&o[a];++a)i==r&&o.splice(a--,1);else delete e[n];else e={};return t},enumerable:!1,writable:!1,configurable:!1},one:{value:function(e,n){function r(){t.off(e,r),n.apply(t,arguments)}return t.on(e,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,o,a,s=arguments,u=arguments.length-1,l=new Array(u);for(a=0;a|>([\S\s]*?)<\/yield\s*>|>)/gi,pe=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,he=/|>([\S\s]*?)<\/yield\s*>)/gi,de={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},ge=Gt&&Gt<10?zt:Ft,me="div",ve="svg",ye={},xe=ye[Nt]={},be=0,_e=Object.freeze({Tag:Q,tag:J,tag2:X,mount:Y,mixin:tt,update:et,unregister:nt,version:"v3.6.1"}),we=0,Oe=Object.freeze({getTag:ot,inheritFrom:at,moveChildTag:st,initChildTag:ut,getImmediateCustomParentTag:lt,unmountAll:ct,getTagName:ft,cleanUpData:pt,arrayishAdd:ht,arrayishRemove:dt,mountTo:gt,makeReplaceVirtual:mt,makeVirtual:vt,moveVirtual:yt,selectTags:xt}),Ne=se,je={tmpl:ie,brackets:re,styleManager:ee,vdom:wt,styleNode:ee.styleNode,dom:Jt,check:Qt,misc:ae,tags:Oe},Ce=Q,Ee=J,Te=X,Ae=Y,Le=tt,ke=et,Me=nt,Se=oe,Ie=L({},_e,{observable:oe,settings:Ne,util:je});t.settings=Ne,t.util=je,t.Tag=Ce,t.tag=Ee,t.tag2=Te,t.mount=Ae,t.mixin=Le,t.update=ke,t.unregister=Me,t.version="v3.6.1",t.observable=Se,t.default=Ie,Object.defineProperty(t,"__esModule",{value:!0})}); +/* Riot v3.8.1, @license MIT */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.riot={})}(this,function(e){"use strict";function t(e,t){return[].slice.call((t||document).querySelectorAll(e))}function n(e,t){return(t||document).querySelector(e)}function r(){return document.createDocumentFragment()}function i(){return document.createTextNode("")}function o(e){var t=e.ownerSVGElement;return!!t||null===t}function a(e){return"svg"===e?document.createElementNS(Me,e):document.createElement(e)}function s(e,t,n){if(n){var r=e.ownerDocument.importNode((new DOMParser).parseFromString(''+t+"","application/xml").documentElement,!0);e.appendChild(r)}else e.innerHTML=t}function u(e,t){e.style.display=t?"":"none",e.hidden=!t}function l(e,t){e.removeAttribute(t)}function c(e){return Object.keys(e).reduce(function(t,n){return t+" "+n+": "+e[n]+";"},"")}function f(e,t){return e.getAttribute(t)}function p(e,t,n){var r=Se.exec(t);r&&r[1]?e.setAttributeNS(ke,r[1],n):e.setAttribute(t,n)}function d(e,t,n){e.insertBefore(t,n.parentNode&&n)}function h(e,t){if(e)for(var n;n=Re.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function g(e,t,n){if(e){var r,i=t(e,n);if(!1===i)return;for(e=e.firstChild;e;)r=e.nextSibling,g(e,t,i),e=r}}function m(e){return Ve.test(e)}function v(e){return typeof e===Le}function y(e){return e&&typeof e===Te}function _(e){return typeof e===Ae}function x(e){return typeof e===je}function b(e){return w(e)||""===e}function w(e){return _(e)||null===e}function N(e){return Array.isArray(e)||e instanceof Array}function O(e,t){var n=Je(e,t);return _(e[t])||n&&n.writable}function C(e,t){for(var n=e?e.length:0,r=0;rr;)(function(e,t){e.splice(t,1),this.unmount(),ie(this.parent,this,this.__.tagName,!0)}).apply(t[--n],[t,n])}function $(e,t,n){var o,a=typeof f(e,we)!==je||l(e,we),s=f(e,Ce),u=!!s&&We.hasExpr(s),c=ne(e),p=he[c],h=e.parentNode,g=i(),m=J(e),v=f(e,xe),y=[],_=e.innerHTML,b=!he[c],w="VIRTUAL"===e.tagName,O=[];return l(e,be),l(e,Ce),n=We.loopKeys(n),n.isLoop=!0,v&&l(e,xe),h.insertBefore(g,e),h.removeChild(e),n.update=function(){n.value=We(n.val,t);var i=n.value,l=r(),f=!N(i)&&!x(i),h=g.parentNode,j=[];h&&(f?i=(o=i||!1)?Object.keys(i).map(function(e){return P(n,i[e],e)}):[]:o=!1,v&&(i=i.filter(function(e,r){return n.key&&!f?!!We(v,P(n,e,r,t)):!!We(v,k(Object.create(t),e))})),C(i,function(r,f){var g=!o&&n.key?P(n,r,f):r,v=function(e,t,n,r){return e?r?We(e,n):t[e]:t}(s,r,g,u),x=a&&typeof r===Te&&!o,N=O.indexOf(v),T=-1===N,A=!T&&x?N:f,L=y[A],k=f>=O.length,M=x&&T||!x&&!L;M?((L=Q(p,{parent:t,isLoop:!0,isAnonymous:b,tagName:c,root:e.cloneNode(b),item:g,index:f},_)).mount(),k?function(e,t){t?se.call(this,e):e.appendChild(this.root)}.apply(L,[l||h,w]):function(e,t,n){n?se.apply(this,[e,t]):d(e,this.root,t.root)}.apply(L,[h,y[f],w]),k||O.splice(f,0,g),y.splice(f,0,L),m&&re(t.tags,c,L,!0)):A!==f&&x&&((s||E(i,O[A]))&&(function(e,t,n){n?le.apply(this,[e,t]):d(e,this.root,t.root)}.apply(L,[h,y[f],w]),y.splice(f,0,y.splice(A,1)[0]),O.splice(f,0,O.splice(A,1)[0])),n.pos&&(L[n.pos]=f),!m&&L.tags&&function(e){var t=this;C(Object.keys(this.tags),function(n){X.apply(t.tags[n],[n,e])})}.call(L,f)),L.__.item=g,L.__.index=f,L.__.parent=t,j[f]=v,M||L.update(g)}),R(i,y),O=j.slice(),h.insertBefore(l,g))},n.unmount=function(){C(y,function(e){e.unmount()})},n}function V(e,t){var n=this,r=[];return g(e,function(i){var o,a,s=i.nodeType;if((t||i!==e)&&(3===s&&"STYLE"!==i.parentNode.tagName&&We.hasExpr(i.nodeValue)&&r.push({dom:i,expr:i.nodeValue}),1===s)){var u="VIRTUAL"===i.tagName;if(o=f(i,be))return u&&p(i,"loopVirtual",!0),r.push($(i,n,o)),!1;if(o=f(i,xe))return r.push(Object.create(et).init(i,n,o)),!1;if((o=f(i,_e))&&We.hasExpr(o))return r.push({isRtag:!0,expr:o,dom:i,attrs:[].slice.call(i.attributes)}),!1;if(a=J(i),u&&(f(i,"virtualized")&&i.parentElement.removeChild(i),a||f(i,"virtualized")||f(i,"loopVirtual")||(a={tmpl:i.outerHTML})),a&&(i!==e||t)){if(!u)return r.push(Y(a,{root:i,parent:n},i.innerHTML,n)),!1;f(i,_e)&&L("Virtual tags shouldn't be used together with the \""+_e+'" attribute - https://github.com/riot/riot/issues/2511'),p(i,"virtualized",!0);var l=Q({tmpl:i.outerHTML},{root:i,parent:n},i.innerHTML);r.push(l)}H.apply(n,[i,i.attributes,function(e,t){t&&r.push(t)}])}}),r}function H(e,t,n){var r=this;C(t,function(t){if(!t)return!1;var i,o=t.name,a=m(o);E(ye,o)&&e.tagName.toLowerCase()!==ge?i=Object.create(tt).init(e,r,o,t.value):We.hasExpr(t.value)&&(i={dom:e,expr:t.value,attr:o,bool:a}),n(t,i)})}function U(e,t,r){var i=e&&e.match(/^\s*<([-\w]+)/),o=i&&i[1].toLowerCase(),u=a(r?lt:ut);return e=function(e,t){if(!nt.test(e))return e;var n={};return t=t&&t.replace(it,function(e,t,r){return n[t]=n[t]||r,""}).trim(),e.replace(ot,function(e,t,r){return n[t]||r||""}).replace(rt,function(e,n){return t||n||""})}(e,t),st.test(o)?u=function(e,t,r){var i="o"===r[0],o=i?"select>":"table>";if(e.innerHTML="<"+o+t.trim()+"=0&&/\s/.test(e[t]););return t}var t="[{(,;:?=|&!^~>%*/",n=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],r=n.reduce(function(e,t){return e+t.slice(-1)},""),i=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,o=/[$\w]/;return function(a,s){var u=/.*/g,l=u.lastIndex=s++,c=u.exec(a)[0].match(i);if(c){var f=l+c[0].length,p=a[l=e(a,l)];if(l<0||~t.indexOf(p))return f;if("."===p)"."===a[l-1]&&(s=f);else if("+"===p||"-"===p)(a[--l]!==p||(l=e(a,l))<0||!o.test(a[l]))&&(s=f);else if(~r.indexOf(p)){for(var d=l+1;--l>=0&&o.test(a[l]););~n.indexOf(a.slice(l+1,d))&&(s=f)}}return s}}(),qe=function(e){function t(e){return e}function n(e,t){return t||(t=y),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?u:"")}function r(e){if(e===g)return m;var t=e.split(" ");if(2!==t.length||f.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(p,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:m[4],t),t[5]=n(e.length>3?/\\({|})/g:m[5],t),t[6]=n(m[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+d,u),t[8]=e,t}function i(e){return e instanceof RegExp?a(e):y[e]}function o(e){(e||(e=g))!==y[8]&&(y=r(e),a=e===g?t:n,y[9]=a(m[9])),v=e}var a,s,u="g",l=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,c=l.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,f=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),p=/(?=[[\]()*+?.^$|])/g,d=l.source+"|"+/(\/)(?![*\/])/.source,h={"(":RegExp("([()])|"+d,u),"[":RegExp("([[\\]])|"+d,u),"{":RegExp("([{}])|"+d,u)},g="{ }",m=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+d,u),g,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],v=void 0,y=[];return i.split=function(e,t,n){function r(e){g&&(e=g+e,g=""),t||a?f.push(e&&e.replace(n[5],"$1")):f.push(e)}function i(n,r,i){return i&&(r=Ke(e,n)),t&&r>n+2&&(l="⁗"+d.length+"~",d.push(e.slice(n,r)),g+=e.slice(s,n)+l,s=r),r}n||(n=y);var o,a,s,u,l,c,f=[],p=n[6],d=[],g="";for(a=s=p.lastIndex=0;o=p.exec(e);){if(c=p.lastIndex,u=o.index,a){if(o[2]){var m=o[2],v=h[m],_=1;for(v.lastIndex=c;o=v.exec(e);)if(o[1]){if(o[1]===m)++_;else if(!--_)break}else v.lastIndex=i(o.index,v.lastIndex,o[2]);p.lastIndex=_?e.length:v.lastIndex;continue}if(!o[3]){p.lastIndex=i(u,c,o[4]);continue}}o[1]||(r(e.slice(s,u)),s=p.lastIndex,(p=n[6+(a^=1)]).lastIndex=s)}return e&&s2||r[0]){var s,u,l=[];for(s=u=0;s %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}.bind({data:a,tmpl:n})):n}function t(e,t,r){if(e=e.replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,o=[],u=0;e&&(i=e.match(a))&&!i.index;){var l,c,f=/,|([[{(])|$/g;for(e=RegExp.rightContext,l=i[2]?r[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];c=(i=f.exec(e))[1];)!function(t,n){var r,i=1,o=s[t];for(o.lastIndex=n.lastIndex;r=o.exec(e);)if(r[0]===t)++i;else if(!--i)break;n.lastIndex=i?e.length:o.lastIndex}(c,f);c=e.slice(0,i.index),e=RegExp.rightContext,o[u++]=n(c,1,l)}e=u?u>1?"["+o.join(",")+'].join(" ").trim()':o[0]:n(e,t)}return e}function n(e,t,n){var r;return e=e.replace(l,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+u+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!c.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var r={};e.hasExpr=qe.hasExpr,e.loopKeys=qe.loopKeys,e.clearCache=function(){r={}},e.errorHandler=null;var i=/\u2057/g,o=/\u2057(\d+)~/g,a=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,s={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},u='"in this?this:'+("object"!=typeof window?"global":"window")+").",l=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,c=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=qe.version="v3.0.8",e}(),Ze=function(e){e=e||{};var t={},n=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(n,r){return"function"==typeof r&&(t[n]=t[n]||[]).push(r),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,o=t[n],a=0;i=o&&o[a];++a)i==r&&o.splice(a--,1);else delete t[n];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,o,a,s=arguments,u=arguments.length-1,l=new Array(u);for(a=0;a|>([\S\s]*?)<\/yield\s*>|>)/gi,it=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,ot=/|>([\S\s]*?)<\/yield\s*>)/gi,at={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},st=He&&He<10?/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,ut="div",lt="svg",ct={},ft=ct[me]={},pt=0,dt=Object.freeze({Tag:B,tag:z,tag2:F,mount:D,mixin:K,update:q,unregister:W,version:"v3.8.1"}),ht=Object.freeze({getTag:J,moveChildTag:X,initChildTag:Y,getImmediateCustomParentTag:ee,unmountAll:te,getTagName:ne,arrayishAdd:re,arrayishRemove:ie,mountTo:oe,makeReplaceVirtual:ae,makeVirtual:se,inheritParentProps:ue,moveVirtual:le,selectTags:ce}),gt=Ye,mt={tmpl:We,brackets:qe,styleManager:De,vdom:de,styleNode:De.styleNode,dom:Ue,check:Ge,misc:Xe,tags:ht},vt=B,yt=z,_t=F,xt=D,bt=K,wt=q,Nt=W,Ot=Ze,Ct=k({},dt,{observable:Ze,settings:gt,util:mt});e.settings=gt,e.util=mt,e.Tag=vt,e.tag=yt,e.tag2=_t,e.mount=xt,e.mixin=bt,e.update=wt,e.unregister=Nt,e.version="v3.8.1",e.observable=Ot,e.default=Ct,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/src/packages/Files/main.coffee b/src/packages/Files/main.coffee index d20d8ac..6fcc54a 100644 --- a/src/packages/Files/main.coffee +++ b/src/packages/Files/main.coffee @@ -12,8 +12,12 @@ class Files extends this.OS.GUI.BaseApplication @favo = @find "favouri" @clipboard = undefined + @apps = [] + @view.contextmenuHandler = (e, m) -> m.set "items", [ me.mnFile(), me.mnEdit() ] + m.set "onmenuselect", (evt) -> + me._gui.launch evt.item.data.app, evt.item.data.args if evt.item.data.app m.show(e) #@on "fileselect", (d) -> console.log d @view.set "onfileopen", (e) -> @@ -21,7 +25,7 @@ class Files extends this.OS.GUI.BaseApplication return if e.type is "dir" me._gui.openWith e - @favo.set "onlistselect", (e) -> + @favo.set "onlistselect", (e) -> me.chdir e.data.path ($ @find "btback").click () -> @@ -41,6 +45,14 @@ class Files extends this.OS.GUI.BaseApplication return me.error "Resource not found #{e.child.path}" if d.error f d.result + @view.set "onfileselect", (e) -> + file = me.view.get "selectedFile" + return unless file + file.mime = "dir" if file.type is "dir" + me.apps.length = 0 + for v in me._gui.appsByMime file.mime + v.args = [ file.path ] + me.apps.push v @setting.sidebar = true if @setting.sidebar is undefined @setting.nav = true if @setting.nav is undefined @setting.showhidden = false if @setting.showhidden is undefined @@ -83,23 +95,18 @@ class Files extends this.OS.GUI.BaseApplication mnFile:() -> #console.log file me = @ - f = () -> - console.log "called" - file = me.view.get "selectedFile" - return undefined unless file - return me._gui.appsByMime file.mime - - { + arr = { text: "File", child: [ { text: "New file", dataid: "#{@name}-mkf" }, { text: "New folder", dataid: "#{@name}-mkdir" }, - { text: "Open with", dataid: "#{@name}-open", child: f }, + { text: "Open with", dataid: "#{@name}-open", child:@apps }, { text: "Upload", dataid: "#{@name}-upload" }, { text: "Download", dataid: "#{@name}-download" }, { text: "Properties", dataid: "#{@name}-info" } ], onmenuselect: (e) -> me.actionFile e } + return arr mnEdit: () -> me = @ { @@ -247,9 +254,6 @@ class Files extends this.OS.GUI.BaseApplication when "#{@name}-download" return unless file file.path.asFileHandler().download ()-> - when "#{@name}-open" - return unless file - @_gui.openWith file else console.log e diff --git a/src/packages/wTerm/main.coffee b/src/packages/wTerm/main.coffee index 0a58cb0..5e32fc3 100644 --- a/src/packages/wTerm/main.coffee +++ b/src/packages/wTerm/main.coffee @@ -32,7 +32,7 @@ class wTerm extends this.OS.GUI.BaseApplication me.term.write pastedText.substring i * 1000, end #self.socket.send("i"+ substr.replace(/\n/g,"\r\n")) # make desktop menu if not exist - @systemsetting.desktop.menu.push { text: "Open terminal", app: "wTerm" } + @systemsetting.desktop.menu[@name] = { text: "Open terminal", app: "wTerm" } unless @systemsetting.desktop.menu[@name] @openSession() @on "vboxchange", (e) -> me.resizeContent e.w, e.h