Comparing version 5.0.0-alpha.0 to 5.0.0-alpha.1
{ | ||
"name": "riot", | ||
"version": "5.0.0-alpha.0", | ||
"version": "5.0.0-alpha.1", | ||
"description": "Simple and elegant component-based UI library", | ||
@@ -5,0 +5,0 @@ "homepage": "http://riot.js.org/", |
@@ -1,3 +0,2 @@ | ||
/* Riot v4.14.0, @license MIT */ | ||
var t,e;t=this,e=function(t){"use strict";function e(t){return t.replace(/-(\w)/g,(t,e)=>e.toUpperCase())}function n(t){Array.from(t).forEach(r)}function r(t){const{parentNode:e}=t;t.remove?t.remove():e&&e.removeChild(t)}var o={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4},s={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const{indexOf:i,slice:u}=[],a=(t,e,n,r,o,s)=>{const u="selectedIndex"in e;let a=u;for(;r<o;){const o=t(n[r],1);if(e.insertBefore(o,s),u&&a&&o.selected){a=!a;let{selectedIndex:t}=e;e.selectedIndex=t<0?r:i.call(e.querySelectorAll("option"),o)}r++}},c=(t,e)=>t==e,l=t=>t,h=(t,e,n,r,o,s,i)=>{const u=s-o;if(u<1)return-1;for(;n-e>=u;){let u=e,a=o;for(;u<n&&a<s&&i(t[u],r[a]);)u++,a++;if(a===s)return e;e=u+1}return-1},p=(t,e,n,r,o)=>n<r?t(e[n],0):0<n?t(e[n-1],-0).nextSibling:o,d=(t,e,n,r)=>{for(;n<r;)b(t(e[n++],-1))},f=(t,e,n)=>{let r=1,o=e;for(;r<o;){const e=(r+o)/2>>>0;n<t[e]?o=e:r=e+1}return r},m=(t,e,n,r,o,s,i,u,c,l,h,p,m)=>{((t,e,n,r,o,s,i,u,c)=>{const l=[],h=t.length;let p=i,f=0;for(;f<h;)switch(t[f++]){case 0:o++,p++;break;case 1:l.push(r[o]),a(e,n,r,o++,o,p<u?e(s[p],0):c);break;case-1:p++}for(f=0;f<h;)switch(t[f++]){case 0:i++;break;case-1:-1<l.indexOf(s[i])?i++:d(e,s,i++,i)}})(((t,e,n,r,o,s,i)=>{const u=n+s,a=[];let c,l,h,p,d,f,m;t:for(c=0;c<=u;c++){if(c>50)return null;for(m=c-1,d=c?a[c-1]:[0,0],f=a[c]=[],l=-c;l<=c;l+=2){for(p=l===-c||l!==c&&d[m+l-1]<d[m+l+1]?d[m+l+1]:d[m+l-1]+1,h=p-l;p<s&&h<n&&i(r[o+p],t[e+h]);)p++,h++;if(p===s&&h===n)break t;f[c+l]=p}}const b=Array(c/2+u/2);let O=b.length-1;for(c=a.length-1;c>=0;c--){for(;p>0&&h>0&&i(r[o+p-1],t[e+h-1]);)b[O--]=0,p--,h--;if(!c)break;m=c-1,d=c?a[c-1]:[0,0],l=p-h,l===-c||l!==c&&d[m+l-1]<d[m+l+1]?(h--,b[O--]=1):(p--,b[O--]=-1)}return b})(n,r,s,i,u,l,p)||((t,e,n,r,o,s,i,u)=>{let a=0,c=r<u?r:u;const l=Array(c++),h=Array(c);h[0]=-1;for(let t=1;t<c;t++)h[t]=i;const p=o.slice(s,i);for(let r=e;r<n;r++){const e=p.indexOf(t[r]);if(-1<e){const t=e+s;a=f(h,c,t),-1<a&&(h[a]=t,l[a]={newi:r,oldi:t,prev:l[a-1]})}}for(a=--c,--i;h[a]>i;)--a;c=u+r-a;const d=Array(c);let m=l[a];for(--n;m;){const{newi:t,oldi:e}=m;for(;n>t;)d[--c]=1,--n;for(;i>e;)d[--c]=-1,--i;d[--c]=0,--n,--i,m=m.prev}for(;n>=e;)d[--c]=1,--n;for(;i>=s;)d[--c]=-1,--i;return d})(n,r,o,s,i,u,c,l),t,e,n,r,i,u,h,m)},b=t=>(t.remove||O).call(t);function O(){const{parentNode:t}=this;t&&t.removeChild(this)} | ||
/*! (c) 2018 Andrea Giammarchi (ISC) */function g(t,e){return typeof t===e}function E(t){const e=t.ownerSVGElement;return!!e||null===e}function v(t){return!y(t.content)}function N(t){return g(t,"function")}function T(t){return!y(t)&&g(t,"object")}function y(t){return null==t}const j=Symbol("unmount"),M=Object.seal({nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:o}=this,s=t===j?null:this.evaluate(t),i=s?Array.from(s):[],u=n.parentNode,{newChildrenMap:f,batches:b,futureNodes:O}=function(t,e,n,r){const{condition:o,template:s,childrenMap:i,itemName:u,getKey:a,indexName:c,root:l,isTemplateTag:h}=r,p=new Map,d=[],f=[];return t.forEach((t,r)=>{const m=function(t,e){let{itemName:n,indexName:r,index:o,item:s}=e;return t[n]=s,r&&(t[r]=o),t}(Object.create(e),{itemName:u,indexName:c,index:r,item:t}),b=a?a(m):r,O=i.get(b);if(function(t,e){return!!t&&!1===Boolean(t(e))}(o,m))return;const g=O?O.template:s.clone(),E=O?g.el:l.cloneNode(),v=!O,N=h&&v?function(t){const e=t.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:e,children:Array.from(e.childNodes)}}(g):{};if(v?d.push(()=>g.mount(E,m,n,N)):d.push(()=>g.update(m,n)),h){const t=N.children||g.children;f.push(...t)}else f.push(E);i.delete(b),p.set(b,{template:g,context:m,index:r})}),{newChildrenMap:p,batches:d,futureNodes:f}}(i,t,e,this);return((t,e,n,r)=>{r||(r={});const o=r.compare||c,s=r.node||l,i=null==r.before?null:s(r.before,0),u=e.length;let f=u,b=0,O=n.length,g=0;for(;b<f&&g<O&&o(e[b],n[g]);)b++,g++;for(;b<f&&g<O&&o(e[f-1],n[O-1]);)f--,O--;const E=b===f,v=g===O;if(E&&v)return n;if(E&&g<O)return a(s,t,n,g,O,p(s,e,b,u,i)),n;if(v&&b<f)return d(s,e,b,f),n;const N=f-b,T=O-g;let y=-1;if(N<T){if(y=h(n,g,O,e,b,f,o),-1<y)return a(s,t,n,g,y,s(e[b],0)),a(s,t,n,y+N,O,p(s,e,f,u,i)),n}else if(T<N&&(y=h(e,b,f,n,g,O,o),-1<y))return d(s,e,b,y),d(s,e,y+T,f),n;N<2||T<2?(a(s,t,n,g,O,s(e[b],0)),d(s,e,b,f)):N===T&&((t,e,n,r,o,s)=>{for(;r<o&&s(n[r],t[e-1]);)r++,e--;return 0===e})(n,O,e,b,f,o)?a(s,t,n,g,O,p(s,e,f,u,i)):m(s,t,n,g,O,T,e,b,f,N,u,o,i)})(u,r,O,{before:n,node:_(Array.from(o.values()),e)}),b.forEach(t=>t()),this.childrenMap=f,this.nodes=O,this},unmount(t,e){return this.update(j,e),this}});function _(t,e){return(n,r)=>{if(r<0){const n=t.pop();if(n){const{template:t,context:r}=n;t.unmount(r,e,null)}}return n}}const A=Object.seal({mount(t,e){return this.update(t,e)},update(t,e){const n=!!this.evaluate(t),r=!this.value&&n,o=this.value&&!n,s=()=>{const n=this.node.cloneNode();this.placeholder.parentNode.insertBefore(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,t,e)};switch(!0){case r:s();break;case o:this.unmount(t);break;default:n&&this.template.update(t,e)}return this.value=n,this},unmount(t,e){return this.template.unmount(t,e,!0),this}});function w(t){throw new Error(t)}function x(t){return t.reduce((t,n)=>{const{value:r,type:o}=n;switch(!0){case!n.name&&0===o:return Object.assign({},t,r);case 3===o:t.value=n.value;break;default:t[e(n.name)]=n.value}return t},{})}const S="removeAttribute",P="setAttribute",U="undefined"==typeof Element?{}:Element.prototype,C=function(t){const e=new Map,n=n=>(e.has(n)||e.set(n,t.call(this,n)))&&e.get(n);return n.cache=e,n}(t=>U.hasOwnProperty(t));function D(t,e,n,r){let{name:o}=e;if(!o)return r&&function(t,e,n){const r=e?Object.keys(e):[];Object.keys(n).filter(t=>!r.includes(t)).forEach(e=>t.removeAttribute(e))}(t,n,r),void(n&&function(t,e){Object.entries(e).forEach(e=>{let[n,r]=e;return D(t,{name:n},r)})}(t,n));!C(o)&&(function(t){return g(t,"boolean")}(n)||T(n)||N(n))&&(t[o]=n),t[function(t){return y(t)||!1===t||""===t||T(t)||N(t)?S:P}(n)](o,function(t,e){return!0===e?t:e}(o,n))}const I=/^on/,B={handleEvent(t){this[t.type](t)}},Y=new WeakMap;function L(t){return y(t)?"":t}const K=(t,e)=>{const n=t.childNodes[e];if(n.nodeType===Node.COMMENT_NODE){const e=document.createTextNode("");return t.replaceChild(e,n),e}return n};var k={0:D,1:function(t,e,n){let{name:r}=e;const o=r.replace(I,""),s=Y.get(t)||(t=>{const e=Object.create(B);return Y.set(t,e),e})(t),[i,u]=(t=>Array.isArray(t)?t:[t,!1])(n),a=s[o],c=i&&!a;a&&!i&&t.removeEventListener(o,s),c&&t.addEventListener(o,s,u),s[o]=i},2:function(t,e,n){t.data=L(n)},3:function(t,e,n){t.value=L(n)}};const R=Object.seal({mount(t){return this.value=this.evaluate(t),$(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&($(this,e),this.value=e),this},unmount(){return 1===this.type&&$(this,null),this}});function $(t,e){return k[t.type](t.node,t,e,t.value)}function z(t,e){return Object.assign({},R,e,{node:2===e.type?K(t,e.childNodeIndex):t})}const H=new Map,F=Symbol("riot-component"),V=new Set,G="is",q="mount",W="update",X="unmount",Z="shouldUpdate",J="onBeforeMount",Q="onMounted",tt="onBeforeUpdate",et="onUpdated",nt="onBeforeUnmount",rt="onUnmounted",ot="props",st="state",it="slots",ut="root",at=Symbol.for("pure"),ct=Symbol("parent"),lt=Symbol("attributes"),ht=Symbol("template");var pt=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:H,DOM_COMPONENT_INSTANCE_PROPERTY:F,PLUGINS_SET:V,IS_DIRECTIVE:G,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:q,UPDATE_METHOD_KEY:W,UNMOUNT_METHOD_KEY:X,SHOULD_UPDATE_KEY:Z,ON_BEFORE_MOUNT_KEY:J,ON_MOUNTED_KEY:Q,ON_BEFORE_UPDATE_KEY:tt,ON_UPDATED_KEY:et,ON_BEFORE_UNMOUNT_KEY:nt,ON_UNMOUNTED_KEY:rt,PROPS_KEY:ot,STATE_KEY:st,SLOTS_KEY:it,ROOT_KEY:ut,IS_PURE_SYMBOL:at,PARENT_KEY_SYMBOL:ct,ATTRIBUTES_KEY_SYMBOL:lt,TEMPLATE_KEY_SYMBOL:ht});const dt=(t,e)=>t[ct]||e,ft=Object.seal({attributes:[],getTemplateScope(t,e){return function(t,e,n){if(!t||!t.length)return n;const r=t.map(t=>Object.assign({},t,{value:t.evaluate(e)}));return Object.assign(Object.create(n||null),x(r))}(this.attributes,t,e)},mount(t,e){const n=!!t.slots&&t.slots.find(t=>{let{id:e}=t;return e===this.name}),{parentNode:o}=this.node,s=dt(t,e);return this.template=n&&yt(n.html,n.bindings).createDOM(o),this.template&&(this.template.mount(this.node,this.getTemplateScope(t,s),s),this.template.children=function t(e,n){void 0===n&&(n=[]);const r=e.firstChild;return r?(e.parentNode.insertBefore(r,e),[r,...t(e)]):n}(this.node)),r(this.node),this},update(t,e){if(this.template){const n=dt(t,e);this.template.update(this.getTemplateScope(t,n),n)}return this},unmount(t,e,n){return this.template&&this.template.unmount(this.getTemplateScope(t,e),null,n),this}});function mt(t){return t.reduce((t,e)=>{let{bindings:n}=e;return t.concat(n)},[])}const bt=Object.seal({mount(t){return this.update(t)},update(t,e){const n=this.evaluate(t);return n===this.name?this.tag.update(t):(this.unmount(t,e,!0),this.name=n,this.tag=function(t,e,n){return void 0===e&&(e=[]),void 0===n&&(n=[]),t?t({slots:e,attributes:n}):yt(function(t){return t.reduce((t,e)=>t+e.html,"")}(e),[...mt(e),{expressions:n.map(t=>Object.assign({type:0},t))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,t)),this},unmount(t,e,n){return this.tag&&this.tag.unmount(n),this}});var Ot={1:function(t,e){let{evaluate:n,template:o}=e;const s=t.parentNode,i=document.createTextNode("");return s.insertBefore(i,t),r(t),Object.assign({},A,{node:t,evaluate:n,placeholder:i,template:o.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map(e=>z(t,e)),["mount","update","unmount"].reduce((t,e)=>Object.assign({},t,{[e]:t=>r.map(n=>n[e](t))&&o}),{})));var r,o},0:function(t,e){let{evaluate:n,condition:o,itemName:s,indexName:i,getKey:u,template:a}=e;const c=document.createTextNode(""),l=t.parentNode,h=t.cloneNode();return l.insertBefore(c,t),r(t),Object.assign({},M,{childrenMap:new Map,node:t,root:h,condition:o,evaluate:n,isTemplateTag:v(h),template:a.createDOM(t),getKey:u,indexName:i,itemName:s,placeholder:c})},3:function(t,e){let{evaluate:n,getComponent:r,slots:o,attributes:s}=e;return Object.assign({},bt,{node:t,evaluate:n,slots:o,attributes:s,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},ft,{attributes:r,node:t,name:n})}};function gt(t,e){return t.map(t=>2===t.type?Object.assign({},t,{childNodeIndex:t.childNodeIndex+e}):t)}function Et(t,e,n){const{selector:r,type:o,redundantAttribute:s,expressions:i}=e,u=r?t.querySelector(r):t;s&&u.removeAttribute(s);const a=i||[];return(Ot[o]||Ot[2])(u,Object.assign({},e,{expressions:n&&!r?gt(a,n):a}))}function vt(t,e){return E(t)?function(t,e){return e.ownerDocument.importNode((new window.DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"application/xml").documentElement,!0)}(e,t):function(t,e){const n=v(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}function Nt(t,e){switch(!0){case E(t):!function t(e,n){e.firstChild&&(n.appendChild(e.firstChild),t(e,n))}(e,t);break;case v(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const Tt=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?vt(t,e):e)}(t,this.html),this},mount(t,e,n,r){if(void 0===r&&(r={}),!t)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);const{fragment:o,children:s,avoidDOMInjection:i}=r,{parentNode:u}=s?s[0]:t,a=v(t),c=a?Math.max(Array.from(u.childNodes).indexOf(t),0):null;return this.isTemplateTag=a,this.createDOM(t),this.dom&&(this.fragment=o||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?u:t,this.children=this.isTemplateTag?s||Array.from(this.fragment.childNodes):null,!i&&this.fragment&&Nt(t,this.fragment),this.bindings=this.bindingsData.map(t=>Et(this.el,t,c)),this.bindings.forEach(t=>t.mount(e,n)),this},update(t,e){return this.bindings.forEach(n=>n.update(t,e)),this},unmount(t,e,o){if(this.el){switch(this.bindings.forEach(n=>n.unmount(t,e,o)),!0){case this.children&&null!==o:n(this.children);break;case!0===o:r(this.el);break;case null!==o:n(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function yt(t,e){return void 0===e&&(e=[]),Object.assign({},Tt,{html:t,bindingsData:e})}var jt=Object.freeze({__proto__:null,template:yt,createBinding:Et,createExpression:z,bindingTypes:o,expressionTypes:s});function Mt(){return this}function _t(t){return N(t)?t.prototype&&t.prototype.constructor?new t:t():t}function At(t,e,n,r){return void 0===r&&(r={}),Object.defineProperty(t,e,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),t}function wt(t,e,n){return Object.entries(e).forEach(e=>{let[r,o]=e;At(t,r,o,n)}),t}function xt(t,e){return Object.entries(e).forEach(e=>{let[n,r]=e;t[n]||(t[n]=r)}),t}function St(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function Pt(t,e){return St("string"==typeof t?(e||document).querySelectorAll(t):t)}const Ut=t=>1===t.length?t[0]:t;function Ct(t,e,n){const r="object"==typeof e?e:{[e]:n},o=Object.keys(r);return St(t).forEach(t=>{o.forEach(e=>t.setAttribute(e,r[e]))}),t}function Dt(t,e){return function(t,e,n){const r="string"==typeof e?[e]:e;return Ut(St(t).map(t=>Ut(r.map(e=>t[n](e)))))}(t,e,"getAttribute")}const It=new Map,Bt=()=>Yt||(Ct(Yt=Pt("style[riot]")[0]||document.createElement("style"),"type","text/css"),Yt.parentNode||document.head.appendChild(Yt),Yt);var Yt,Lt={CSS_BY_NAME:It,add(t,e){return It.has(t)||(It.set(t,e),this.inject()),this},inject(){return Bt().innerHTML=[...It.values()].join("\n"),this},remove(t){return It.has(t)&&(It.delete(t),this.inject()),this}};function Kt(t){return Dt(t,G)||t.tagName.toLowerCase()}const kt=Object.freeze({$(t){return Pt(t,this.root)[0]},$$(t){return Pt(t,this.root)}}),Rt=Object.freeze({[q]:Mt,[W]:Mt,[X]:Mt}),$t=Object.freeze({[Z]:Mt,[J]:Mt,[Q]:Mt,[tt]:Mt,[et]:Mt,[nt]:Mt,[rt]:Mt}),zt=Object.assign({},Rt,{clone:Mt,createDOM:Mt});function Ht(t,n){return void 0===n&&(n={}),Object.assign({},function(t){return Array.from(t.attributes).reduce((t,n)=>(t[e(n.name)]=n.value,t),{})}(t),_t(n))}const Ft=(t,e)=>t[F]=e;function Vt(t){return[q,W,X].reduce((e,n)=>(e[n]=t(n),e),{})}function Gt(t){let{css:e,template:n,exports:r,name:i}=t;const u=n?function(t,e){return t(yt,s,o,t=>e[t]||H.get(t))}(n,r?(void 0===(a=r.components)&&(a={}),Object.entries(_t(a)).reduce((t,e)=>{let[n,r]=e;var o;return t[(o=n,o.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Gt(r),t},{})):{}):zt;var a;return t=>{let{slots:o,attributes:s,props:a}=t;if(r&&r[at])return function(t,e){let{slots:n,attributes:r,props:o,css:s,template:i}=e;i&&w("Pure components can not have html"),s&&w("Pure components do not have css");const u=xt(t({slots:n,attributes:r,props:o}),Rt);return Vt(t=>function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(t===q){const[t]=n;Ft(t,u)}return u[t](...n),u})}(r,{slots:o,attributes:s,props:a,css:e,template:n});const c=_t(r)||{},l=qt({css:e,template:u,componentAPI:c,name:i})({slots:o,attributes:s,props:a});return{mount:(t,e,n)=>l.mount(t,n,e),update:(t,e)=>l.update(e,t),unmount:t=>l.unmount(t)}}}function qt(t){let{css:e,template:n,componentAPI:r,name:o}=t;return e&&o&&Lt.add(o,e),function t(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return function(){for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return(o=[...r,...o]).length<e.length?t(e,...o):e(...o)}}(Xt)(wt(xt(r,Object.assign({},$t,{[st]:{}})),Object.assign({[it]:null,[ut]:null},kt,{name:o,css:e,template:n})))}function Wt(t,e){return Object.assign({},t,_t(e))}function Xt(t,e){let{slots:n,attributes:r,props:o}=e;return s=function(t){return[...V].reduce((t,e)=>e(t)||t,t)}(wt(Object.create(t),{mount(e,s,i){return void 0===s&&(s={}),this[lt]=function(t,e){void 0===e&&(e=[]);const n=e.map(e=>z(t,e)),r={};return Object.assign(r,Object.assign({expressions:n},Vt(t=>e=>(n.forEach(n=>n[t](e)),r))))}(e,r).mount(i),At(this,ot,Object.freeze(Object.assign({},Ht(e,o),x(this[lt].expressions)))),this.state=Wt(this.state,s),this[ht]=this.template.createDOM(e).clone(),Ft(e,this),t.name&&function(t,e){Kt(t)!==e&&Ct(t,G,e)}(e,t.name),At(this,ut,e),At(this,it,n),this.onBeforeMount(this.props,this.state),this[ct]=i,this[ht].mount(e,this,i),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[ct]=e,this[lt].update(e));const n=x(this[lt].expressions);if(!1!==this.shouldUpdate(n,this.props))return At(this,ot,Object.freeze(Object.assign({},this.props,n))),this.state=Wt(this.state,t),this.onBeforeUpdate(this.props,this.state),this[ht].update(this,this[ct]),this.onUpdated(this.props,this.state),this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[lt].unmount(),this[ht].unmount(this,this[ct],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter(e=>N(t[e])).forEach(t=>{s[t]=s[t].bind(s)}),s;var s}const{DOM_COMPONENT_INSTANCE_PROPERTY:Zt,COMPONENTS_IMPLEMENTATION_MAP:Jt,PLUGINS_SET:Qt}=pt,te={cssManager:Lt,DOMBindings:jt,createComponent:Gt,defineComponent:qt,globals:pt};t.__=te,t.component=function(t){return function(e,n,r){let{slots:o,attributes:s,parentScope:i}=void 0===r?{}:r;return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((t,e)=>function(){return t(e(...arguments))})}(t=>t.mount(e,i),t=>t({props:n,slots:o,attributes:s}),Gt)(t)}},t.install=function(t){return N(t)||w("Plugins must be of type function"),Qt.has(t)&&w("This plugin was already installed"),Qt.add(t),Qt},t.mount=function(t,e,n){return Pt(t).map(t=>function(t,e,n){const r=n||Kt(t);return H.has(r)||w(`The component named "${r}" was never registered`),H.get(r)({props:e}).mount(t)}(t,e,n))},t.pure=function(t){return N(t)||w('riot.pure accepts only arguments of type "function"'),t[at]=!0,t},t.register=function(t,e){let{css:n,template:r,exports:o}=e;return Jt.has(t)&&w(`The component "${t}" was already registered`),Jt.set(t,Gt({name:t,css:n,template:r,exports:o})),Jt},t.uninstall=function(t){return Qt.has(t)||w("This plugin was never installed"),Qt.delete(t),Qt},t.unmount=function(t,e){return Pt(t).map(t=>(t[Zt]&&t[Zt].unmount(e),t))},t.unregister=function(t){return Jt.has(t)||w(`The component "${t}" was never registered`),Jt.delete(t),Lt.remove(t),Jt},t.version="v4.14.0",Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).riot={}); | ||
/* Riot v5.0.0-alpha.1, @license MIT */ | ||
var t,e;t=this,e=function(t){"use strict";function e(t){return t.replace(/-(\w)/g,(t,e)=>e.toUpperCase())}function n(t,e){t.firstChild&&(e.appendChild(t.firstChild),n(t,e))}function r(t){Array.from(t).forEach(s)}function s(t){const{parentNode:e}=t;t.remove?t.remove():e&&e.removeChild(t)}var o={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4},i={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};function u(t,e){return typeof t===e}function a(t){const e=t.ownerSVGElement;return!!e||null===e}function c(t){return!p(t.content)}function l(t){return u(t,"function")}function h(t){return!p(t)&&u(t,"object")}function p(t){return null==t}const d=t=>{const{parentNode:e}=t;e&&(t.remove?t.remove():e.removeChild(t))},m=Symbol("unmount"),f=Object.seal({nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:s}=this,o=t===m?null:this.evaluate(t),i=o?Array.from(o):[],u=n.parentNode,{newChildrenMap:a,batches:c,futureNodes:l}=function(t,e,n,r){const{condition:s,template:o,childrenMap:i,itemName:u,getKey:a,indexName:c,root:l,isTemplateTag:h}=r,p=new Map,d=[],m=[];return t.forEach((t,r)=>{const f=function(t,e){let{itemName:n,indexName:r,index:s,item:o}=e;return t[n]=o,r&&(t[r]=s),t}(Object.create(e),{itemName:u,indexName:c,index:r,item:t}),b=a?a(f):r,O=i.get(b);if(function(t,e){return!!t&&!1===Boolean(t(e))}(s,f))return;const g=O?O.template:o.clone(),E=O?g.el:l.cloneNode(),v=!O,N=h&&v?function(t){const e=t.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:e,children:Array.from(e.childNodes)}}(g):{};if(v?d.push(()=>g.mount(E,f,n,N)):d.push(()=>g.update(f,n)),h){const t=N.children||g.children;m.push(...t)}else m.push(E);i.delete(b),p.set(b,{template:g,context:f,index:r})}),{newChildrenMap:p,batches:d,futureNodes:m}}(i,t,e,this);return((t,e,n,r,s)=>{const o=n.length;let i=e.length,u=o,a=0,c=0,l=null;for(;a<i||c<u;)if(i===a){const e=u<o?c?r(n[c-1],-0).nextSibling:r(n[u-c],0):s;for(;c<u;)t.insertBefore(r(n[c++],1),e)}else if(u===c)for(;a<i;)l&&l.has(e[a])||d(r(e[a],-1)),a++;else if(e[a]===n[c])a++,c++;else if(e[i-1]===n[u-1])i--,u--;else if(e[a]===n[u-1]&&n[c]===e[i-1]){const s=r(e[--i],-1).nextSibling;t.insertBefore(r(n[c++],1),r(e[a++],-1).nextSibling),t.insertBefore(r(n[--u],1),s),e[i]=n[u]}else{if(!l){l=new Map;let t=c;for(;t<u;)l.set(n[t],t++)}if(l.has(e[a])){const s=l.get(e[a]);if(c<s&&s<u){let o=a,h=1;for(;++o<i&&o<u&&l.get(e[o])===s+h;)h++;if(h>s-c){const o=r(e[a],0);for(;c<s;)t.insertBefore(r(n[c++],1),o)}else t.replaceChild(r(n[c++],1),r(e[a++],-1))}else a++}else d(r(e[a++],-1))}})(u,r,l,function(t,e){return(n,r)=>{if(r<0){const n=t.pop();if(n){const{template:t,context:r}=n;t.unmount(r,e,null)}}return n}}(Array.from(s.values()),e),n),c.forEach(t=>t()),this.childrenMap=a,this.nodes=l,this},unmount(t,e){return this.update(m,e),this}}),b=Object.seal({mount(t,e){return this.update(t,e)},update(t,e){const n=!!this.evaluate(t),r=!this.value&&n,s=this.value&&!n,o=()=>{const n=this.node.cloneNode();this.placeholder.parentNode.insertBefore(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,t,e)};switch(!0){case r:o();break;case s:this.unmount(t);break;default:n&&this.template.update(t,e)}return this.value=n,this},unmount(t,e){return this.template.unmount(t,e,!0),this}});function O(t){throw new Error(t)}function g(t){return t.reduce((t,n)=>{const{value:r,type:s}=n;switch(!0){case!n.name&&0===s:return Object.assign({},t,r);case 3===s:t.value=n.value;break;default:t[e(n.name)]=n.value}return t},{})}const E="removeAttribute",v="setAttribute",N="undefined"==typeof Element?{}:Element.prototype,T=function(t){const e=new Map,n=n=>(e.has(n)||e.set(n,t.call(this,n)))&&e.get(n);return n.cache=e,n}(t=>N.hasOwnProperty(t));function y(t,e,n,r){let{name:s}=e;if(!s)return r&&function(t,e,n){const r=e?Object.keys(e):[];Object.keys(n).filter(t=>!r.includes(t)).forEach(e=>t.removeAttribute(e))}(t,n,r),void(n&&function(t,e){Object.entries(e).forEach(e=>{let[n,r]=e;return y(t,{name:n},r)})}(t,n));!T(s)&&(function(t){return u(t,"boolean")}(n)||h(n)||l(n))&&(t[s]=n),t[function(t){return p(t)||!1===t||""===t||h(t)||l(t)?E:v}(n)](s,function(t,e){return!0===e?t:e}(s,n))}const M=/^on/,j={handleEvent(t){this[t.type](t)}},_=new WeakMap;function A(t){return p(t)?"":t}const S=(t,e)=>{const n=t.childNodes[e];if(n.nodeType===Node.COMMENT_NODE){const e=document.createTextNode("");return t.replaceChild(e,n),e}return n};var w={0:y,1:function(t,e,n){let{name:r}=e;const s=r.replace(M,""),o=_.get(t)||(t=>{const e=Object.create(j);return _.set(t,e),e})(t),[i,u]=(t=>Array.isArray(t)?t:[t,!1])(n),a=o[s],c=i&&!a;a&&!i&&t.removeEventListener(s,o),c&&t.addEventListener(s,o,u),o[s]=i},2:function(t,e,n){t.data=A(n)},3:function(t,e,n){t.value=A(n)}};const x=Object.seal({mount(t){return this.value=this.evaluate(t),P(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(P(this,e),this.value=e),this},unmount(){return 1===this.type&&P(this,null),this}});function P(t,e){return w[t.type](t.node,t,e,t.value)}function U(t,e){return Object.assign({},x,e,{node:2===e.type?S(t,e.childNodeIndex):t})}const C=new Map,D=Symbol("riot-component"),B=new Set,I="is",Y="mount",L="update",K="unmount",R="shouldUpdate",k="onBeforeMount",$="onMounted",z="onBeforeUpdate",H="onUpdated",F="onBeforeUnmount",V="onUnmounted",G="props",q="state",W="slots",X="root",Z=Symbol.for("pure"),J=Symbol("parent"),Q=Symbol("attributes"),tt=Symbol("template");var et=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:C,DOM_COMPONENT_INSTANCE_PROPERTY:D,PLUGINS_SET:B,IS_DIRECTIVE:I,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:Y,UPDATE_METHOD_KEY:L,UNMOUNT_METHOD_KEY:K,SHOULD_UPDATE_KEY:R,ON_BEFORE_MOUNT_KEY:k,ON_MOUNTED_KEY:$,ON_BEFORE_UPDATE_KEY:z,ON_UPDATED_KEY:H,ON_BEFORE_UNMOUNT_KEY:F,ON_UNMOUNTED_KEY:V,PROPS_KEY:G,STATE_KEY:q,SLOTS_KEY:W,ROOT_KEY:X,IS_PURE_SYMBOL:Z,PARENT_KEY_SYMBOL:J,ATTRIBUTES_KEY_SYMBOL:Q,TEMPLATE_KEY_SYMBOL:tt});const nt=(t,e)=>t[J]||e,rt=Object.seal({attributes:[],getTemplateScope(t,e){return function(t,e,n){if(!t||!t.length)return n;const r=t.map(t=>Object.assign({},t,{value:t.evaluate(e)}));return Object.assign(Object.create(n||null),g(r))}(this.attributes,t,e)},mount(t,e){const n=!!t.slots&&t.slots.find(t=>{let{id:e}=t;return e===this.name}),{parentNode:r}=this.node,o=nt(t,e);return this.template=n&&dt(n.html,n.bindings).createDOM(r),this.template&&(this.template.mount(this.node,this.getTemplateScope(t,o),o),this.template.children=st(this.node)),s(this.node),this},update(t,e){if(this.template){const n=nt(t,e);this.template.update(this.getTemplateScope(t,n),n)}return this},unmount(t,e,n){return this.template&&this.template.unmount(this.getTemplateScope(t,e),null,n),this}});function st(t,e){void 0===e&&(e=[]);const n=t.firstChild;return n?(t.parentNode.insertBefore(n,t),[n,...st(t)]):e}function ot(t){return t.reduce((t,e)=>{let{bindings:n}=e;return t.concat(n)},[])}const it=Object.seal({mount(t){return this.update(t)},update(t,e){const n=this.evaluate(t);return n===this.name?this.tag.update(t):(this.unmount(t,e,!0),this.name=n,this.tag=function(t,e,n){return void 0===e&&(e=[]),void 0===n&&(n=[]),t?t({slots:e,attributes:n}):dt(function(t){return t.reduce((t,e)=>t+e.html,"")}(e),[...ot(e),{expressions:n.map(t=>Object.assign({type:0},t))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,t)),this},unmount(t,e,n){return this.tag&&this.tag.unmount(n),this}});var ut={1:function(t,e){let{evaluate:n,template:r}=e;const o=t.parentNode,i=document.createTextNode("");return o.insertBefore(i,t),s(t),Object.assign({},b,{node:t,evaluate:n,placeholder:i,template:r.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map(e=>U(t,e)),["mount","update","unmount"].reduce((t,e)=>Object.assign({},t,{[e]:t=>r.map(n=>n[e](t))&&s}),{})));var r,s},0:function(t,e){let{evaluate:n,condition:r,itemName:o,indexName:i,getKey:u,template:a}=e;const l=document.createTextNode(""),h=t.parentNode,p=t.cloneNode();return h.insertBefore(l,t),s(t),Object.assign({},f,{childrenMap:new Map,node:t,root:p,condition:r,evaluate:n,isTemplateTag:c(p),template:a.createDOM(t),getKey:u,indexName:i,itemName:o,placeholder:l})},3:function(t,e){let{evaluate:n,getComponent:r,slots:s,attributes:o}=e;return Object.assign({},it,{node:t,evaluate:n,slots:s,attributes:o,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},rt,{attributes:r,node:t,name:n})}};function at(t,e){return t.map(t=>2===t.type?Object.assign({},t,{childNodeIndex:t.childNodeIndex+e}):t)}function ct(t,e,n){const{selector:r,type:s,redundantAttribute:o,expressions:i}=e,u=r?t.querySelector(r):t;o&&u.removeAttribute(o);const a=i||[];return(ut[s]||ut[2])(u,Object.assign({},e,{expressions:n&&!r?at(a,n):a}))}function lt(t,e){return a(t)?function(t,e){return e.ownerDocument.importNode((new window.DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"application/xml").documentElement,!0)}(e,t):function(t,e){const n=c(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}function ht(t,e){switch(!0){case a(t):n(e,t);break;case c(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const pt=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?lt(t,e):e)}(t,this.html),this},mount(t,e,n,r){if(void 0===r&&(r={}),!t)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);const{fragment:s,children:o,avoidDOMInjection:i}=r,{parentNode:u}=o?o[0]:t,a=c(t),l=a?Math.max(Array.from(u.childNodes).indexOf(t),0):null;return this.isTemplateTag=a,this.createDOM(t),this.dom&&(this.fragment=s||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?u:t,this.children=this.isTemplateTag?o||Array.from(this.fragment.childNodes):null,!i&&this.fragment&&ht(t,this.fragment),this.bindings=this.bindingsData.map(t=>ct(this.el,t,l)),this.bindings.forEach(t=>t.mount(e,n)),this},update(t,e){return this.bindings.forEach(n=>n.update(t,e)),this},unmount(t,e,n){if(this.el){switch(this.bindings.forEach(r=>r.unmount(t,e,n)),!0){case this.children&&null!==n:r(this.children);break;case!0===n:s(this.el);break;case null!==n:r(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function dt(t,e){return void 0===e&&(e=[]),Object.assign({},pt,{html:t,bindingsData:e})}var mt=Object.freeze({__proto__:null,template:dt,createBinding:ct,createExpression:U,bindingTypes:o,expressionTypes:i});function ft(){return this}function bt(t){return l(t)?t.prototype&&t.prototype.constructor?new t:t():t}function Ot(t,e,n,r){return void 0===r&&(r={}),Object.defineProperty(t,e,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),t}function gt(t,e,n){return Object.entries(e).forEach(e=>{let[r,s]=e;Ot(t,r,s,n)}),t}function Et(t,e){return Object.entries(e).forEach(e=>{let[n,r]=e;t[n]||(t[n]=r)}),t}function vt(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function Nt(t,e){return vt("string"==typeof t?(e||document).querySelectorAll(t):t)}const Tt=t=>1===t.length?t[0]:t;function yt(t,e,n){const r="object"==typeof e?e:{[e]:n},s=Object.keys(r);return vt(t).forEach(t=>{s.forEach(e=>t.setAttribute(e,r[e]))}),t}function Mt(t,e){return function(t,e,n){const r="string"==typeof e?[e]:e;return Tt(vt(t).map(t=>Tt(r.map(e=>t[n](e)))))}(t,e,"getAttribute")}const jt=new Map,_t=()=>At||(yt(At=Nt("style[riot]")[0]||document.createElement("style"),"type","text/css"),At.parentNode||document.head.appendChild(At),At);var At,St={CSS_BY_NAME:jt,add(t,e){return jt.has(t)||(jt.set(t,e),this.inject()),this},inject(){return _t().innerHTML=[...jt.values()].join("\n"),this},remove(t){return jt.has(t)&&(jt.delete(t),this.inject()),this}};function wt(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return(r=[...n,...r]).length<t.length?wt(t,...r):t(...r)}}function xt(t){return Mt(t,I)||t.tagName.toLowerCase()}const Pt=Object.freeze({$(t){return Nt(t,this.root)[0]},$$(t){return Nt(t,this.root)}}),Ut=Object.freeze({[Y]:ft,[L]:ft,[K]:ft}),Ct=Object.freeze({[R]:ft,[k]:ft,[$]:ft,[z]:ft,[H]:ft,[F]:ft,[V]:ft}),Dt=Object.assign({},Ut,{clone:ft,createDOM:ft});function Bt(t,n){return void 0===n&&(n={}),Object.assign({},function(t){return Array.from(t.attributes).reduce((t,n)=>(t[e(n.name)]=n.value,t),{})}(t),bt(n))}const It=(t,e)=>t[D]=e;function Yt(t){return[Y,L,K].reduce((e,n)=>(e[n]=t(n),e),{})}function Lt(t){let{css:e,template:n,exports:r,name:s}=t;const u=n?function(t,e){return t(dt,i,o,t=>e[t]||C.get(t))}(n,r?(void 0===(a=r.components)&&(a={}),Object.entries(bt(a)).reduce((t,e)=>{let[n,r]=e;var s;return t[(s=n,s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Lt(r),t},{})):{}):Dt;var a;return t=>{let{slots:o,attributes:i,props:a}=t;if(r&&r[Z])return function(t,e){let{slots:n,attributes:r,props:s,css:o,template:i}=e;i&&O("Pure components can not have html"),o&&O("Pure components do not have css");const u=Et(t({slots:n,attributes:r,props:s}),Ut);return Yt(t=>function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(t===Y){const[t]=n;It(t,u)}return u[t](...n),u})}(r,{slots:o,attributes:i,props:a,css:e,template:n});const c=bt(r)||{},l=Kt({css:e,template:u,componentAPI:c,name:s})({slots:o,attributes:i,props:a});return{mount:(t,e,n)=>l.mount(t,n,e),update:(t,e)=>l.update(e,t),unmount:t=>l.unmount(t)}}}function Kt(t){let{css:e,template:n,componentAPI:r,name:s}=t;return e&&s&&St.add(s,e),wt(kt)(gt(Et(r,Object.assign({},Ct,{[q]:{}})),Object.assign({[W]:null,[X]:null},Pt,{name:s,css:e,template:n})))}function Rt(t,e){return Object.assign({},t,bt(e))}function kt(t,e){let{slots:n,attributes:r,props:s}=e;return o=function(t){return[...B].reduce((t,e)=>e(t)||t,t)}(gt(Object.create(t),{mount(e,o,i){return void 0===o&&(o={}),this[Q]=function(t,e){void 0===e&&(e=[]);const n=e.map(e=>U(t,e)),r={};return Object.assign(r,Object.assign({expressions:n},Yt(t=>e=>(n.forEach(n=>n[t](e)),r))))}(e,r).mount(i),Ot(this,G,Object.freeze(Object.assign({},Bt(e,s),g(this[Q].expressions)))),this.state=Rt(this.state,o),this[tt]=this.template.createDOM(e).clone(),It(e,this),t.name&&function(t,e){xt(t)!==e&&yt(t,I,e)}(e,t.name),Ot(this,X,e),Ot(this,W,n),this.onBeforeMount(this.props,this.state),this[J]=i,this[tt].mount(e,this,i),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[J]=e,this[Q].update(e));const n=g(this[Q].expressions);if(!1!==this.shouldUpdate(n,this.props))return Ot(this,G,Object.freeze(Object.assign({},this.props,n))),this.state=Rt(this.state,t),this.onBeforeUpdate(this.props,this.state),this[tt].update(this,this[J]),this.onUpdated(this.props,this.state),this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[Q].unmount(),this[tt].unmount(this,this[J],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter(e=>l(t[e])).forEach(t=>{o[t]=o[t].bind(o)}),o;var o}const{DOM_COMPONENT_INSTANCE_PROPERTY:$t,COMPONENTS_IMPLEMENTATION_MAP:zt,PLUGINS_SET:Ht}=et,Ft={cssManager:St,DOMBindings:mt,createComponent:Lt,defineComponent:Kt,globals:et};t.__=Ft,t.component=function(t){return function(e,n,r){let{slots:s,attributes:o,parentScope:i}=void 0===r?{}:r;return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((t,e)=>function(){return t(e(...arguments))})}(t=>t.mount(e,i),t=>t({props:n,slots:s,attributes:o}),Lt)(t)}},t.install=function(t){return l(t)||O("Plugins must be of type function"),Ht.has(t)&&O("This plugin was already installed"),Ht.add(t),Ht},t.mount=function(t,e,n){return Nt(t).map(t=>function(t,e,n){const r=n||xt(t);return C.has(r)||O(`The component named "${r}" was never registered`),C.get(r)({props:e}).mount(t)}(t,e,n))},t.pure=function(t){return l(t)||O('riot.pure accepts only arguments of type "function"'),t[Z]=!0,t},t.register=function(t,e){let{css:n,template:r,exports:s}=e;return zt.has(t)&&O(`The component "${t}" was already registered`),zt.set(t,Lt({name:t,css:n,template:r,exports:s})),zt},t.uninstall=function(t){return Ht.has(t)||O("This plugin was never installed"),Ht.delete(t),Ht},t.unmount=function(t,e){return Nt(t).map(t=>(t[$t]&&t[$t].unmount(e),t))},t.unregister=function(t){return zt.has(t)||O(`The component "${t}" was never registered`),zt.delete(t),St.remove(t),zt},t.version="v5.0.0-alpha.1",Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).riot={}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1853939
16395