Socket
Socket
Sign inDemoInstall

riot

Package Overview
Dependencies
Maintainers
1
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

riot - npm Package Compare versions

Comparing version 7.0.1 to 7.0.2

4

package.json
{
"name": "riot",
"version": "7.0.1",
"version": "7.0.2",
"description": "Simple and elegant component-based UI library",

@@ -38,3 +38,3 @@ "homepage": "https://riot.js.org/",

"dependencies": {
"@riotjs/compiler": "^6.3.1",
"@riotjs/compiler": "^6.3.2",
"@riotjs/dom-bindings": "6.0.3",

@@ -41,0 +41,0 @@ "@riotjs/util": "^2.1.1",

@@ -1,1 +0,1 @@

var t,e;t=this,e=function(t){"use strict";const e={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};function n(t,e){return typeof t===e}function r(t){const e=t.ownerSVGElement;return!!e||null===e}function s(t){return"template"===t.tagName.toLowerCase()}function o(t){return n(t,"function")}function i(t){return!u(t)&&t.constructor===Object}function u(t){return null==t}const a=new Map,c=Symbol(),l=new Set,h="mount",d="update",p="unmount",m="props",f="slots",b="root",g=Symbol(),v=Symbol(),y=Symbol(),O=Symbol(),j=Symbol();function N(t){return t.replace(/-(\w)/g,((t,e)=>e.toUpperCase()))}function x(t,e){t.firstChild&&(e.appendChild(t.firstChild),x(t,e))}function M(t){E(t.childNodes)}function E(t){Array.from(t).forEach(A)}const A=t=>t&&t.parentNode&&t.parentNode.removeChild(t),T=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),w={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};function S(){return this}function C(t){return o(t)?t.prototype&&t.prototype.constructor?new t:t():t}function D(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}function k(t){return t.reduce(((t,e)=>{const{value:n,type:r}=e;switch(!0){case!e.name&&0===r:return Object.assign({},t,n);case 3===r:t.value=e.value;break;default:t[N(e.name)]=e.value}return t}),{})}function U(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 I(t,e,n){return Object.entries(e).forEach((e=>{let[r,s]=e;U(t,r,s,n)})),t}function L(t,e){return Object.entries(e).forEach((e=>{let[n,r]=e;t[n]||(t[n]=r)})),t}const P=Object.freeze({[h]:S,[d]:S,[p]:S}),B=Object.assign({},P,{clone:S,createDOM:S}),_=Symbol(),z=Symbol(),$=Symbol(),H={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:s}=this,o=t===$?null:this.evaluate(t),i=o?Array.from(o):[],{newChildrenMap:u,batches:a,futureNodes:c}=function(t,e,n,r){const{condition:s,template:o,childrenMap:i,itemName:u,getKey:a,indexName:c,root:l,isTemplateTag:h}=r,d=new Map,p=[],m=[];return t.forEach(((t,r)=>{const f=function(t,e){let{itemName:n,indexName:r,index:s,item:o}=e;return U(t,n,o),r&&U(t,r,s),t}(Object.create(e),{itemName:u,indexName:c,index:r,item:t}),b=a?a(f):r,g=i.get(b),v=[];if(function(t,e){return!!t&&!t(e)}(s,f))return;const y=!g,O=g?g.template:o.clone(),j=O.el||l.cloneNode(),N=h&&y?function(t){const e=t.dom.cloneNode(!0),{head:n,tail:r}=function(){const t=document.createTextNode(""),e=document.createTextNode("");return t[_]=!0,e[z]=!0,{head:t,tail:e}}();return{avoidDOMInjection:!0,fragment:e,head:n,tail:r,children:[n,...Array.from(e.childNodes),r]}}(O):O.meta;y?p.push((()=>O.mount(j,f,n,N))):p.push((()=>O.update(f,n))),h?v.push(...N.children):v.push(j),i.delete(b),m.push(...v),d.set(b,{nodes:v,template:O,context:f,index:r})})),{newChildrenMap:d,batches:p,futureNodes:m}}(i,t,e,this);return((t,e,n,r)=>{const s=e.length;let o=t.length,i=s,u=0,a=0,c=null;for(;u<o||a<i;)if(o===u){const t=i<s?a?n(e[a-1],-0).nextSibling:n(e[i-a],0):r;for(;a<i;)T(n(e[a++],1),t)}else if(i===a)for(;u<o;)c&&c.has(t[u])||A(n(t[u],-1)),u++;else if(t[u]===e[a])u++,a++;else if(t[o-1]===e[i-1])o--,i--;else if(t[u]===e[i-1]&&e[a]===t[o-1]){const r=n(t[--o],-1).nextSibling;T(n(e[a++],1),n(t[u++],-1).nextSibling),T(n(e[--i],1),r),t[o]=e[i]}else{if(!c){c=new Map;let t=a;for(;t<i;)c.set(e[t],t++)}if(c.has(t[u])){const r=c.get(t[u]);if(a<r&&r<i){let s=u,d=1;for(;++s<o&&s<i&&c.get(t[s])===r+d;)d++;if(d>r-a){const s=n(t[u],0);for(;a<r;)T(n(e[a++],1),s)}else l=n(e[a++],1),(h=n(t[u++],-1))&&h.parentNode&&h.parentNode.replaceChild(l,h)}else u++}else A(n(t[u++],-1))}var l,h})(r,c,function(t,e){return(n,r)=>{if(r<0){const n=t[t.length-1];if(n){const{template:r,nodes:s,context:o}=n;s.pop(),s.length||(t.pop(),r.unmount(o,e,null))}}return n}}(Array.from(s.values()),e),n),a.forEach((t=>t())),this.childrenMap=u,this.nodes=c,this},unmount(t,e){return this.update($,e),this}},F={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();T(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}},K="undefined"==typeof Element?{}:Element.prototype,R=D((t=>K.hasOwnProperty(t))),V=/^on/,q={handleEvent(t){this[t.type](t)}},G=new WeakMap;function W(t){return u(t)?"":t}const Y=(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},X={0:function t(e,r,s,u){let{name:a}=r;if(!a)return u&&function(t,e,n){const r=e?Object.keys(e):[];Object.keys(n).filter((t=>!r.includes(t))).forEach((e=>t.removeAttribute(e)))}(e,s,u),void(s&&function(e,n){Object.entries(n).forEach((n=>{let[r,s]=n;return t(e,{name:r},s)}))}(e,s));!R(a)&&(function(t){return n(t,"boolean")}(s)||i(s)||o(s))&&(e[a]=s),function(t){return!t&&0!==t}(s)?e.removeAttribute(a):function(t){return!0===t||["string","number"].includes(typeof t)}(s)&&e.setAttribute(a,function(t,e){return!0===e?t:e}(a,s))},1:function(t,e,n){let{name:r}=e;const s=r.replace(V,""),o=G.get(t)||(t=>{const e=Object.create(q);return G.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=W(n)},3:function(t,e,n){t.value=W(n)}},Z={mount(t){return this.value=this.evaluate(t),J(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(J(this,e),this.value=e),this},unmount(){return 1===this.type&&J(this,null),this}};function J(t,e){return X[t.type](t.node,t,e,t.value)}function Q(t,e){return Object.assign({},Z,e,{node:2===e.type?Y(t,e.childNodeIndex):t})}const tt=(t,e)=>t[y]||e,et={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),k(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,s=tt(t,e);return this.template=n&&lt(n.html,n.bindings).createDOM(r),this.template&&(M(this.node),this.template.mount(this.node,this.getTemplateScope(t,s),s),this.template.children=Array.from(this.node.childNodes)),nt(this.node),A(this.node),this},update(t,e){if(this.template){const n=tt(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 nt(t){const e=t&&t.firstChild;e&&(T(e,t),nt(t))}function rt(t){return t.reduce(((t,e)=>{let{bindings:n}=e;return t.concat(n)}),[])}const st={mount(t){return this.update(t)},update(t,e){const n=this.evaluate(t);return n&&n===this.name?this.tag.update(t):(this.unmount(t,e,!0),this.name=n,this.tag=(r=this.getComponent(n),void 0===(s=this.slots)&&(s=[]),void 0===(o=this.attributes)&&(o=[]),r?r({slots:s,attributes:o}):lt(function(t){return t.reduce(((t,e)=>t+e.html),"")}(s),[...rt(s),{expressions:o.map((t=>Object.assign({type:0},t)))}])),this.tag.mount(this.node,t)),this;var r,s,o},unmount(t,e,n){return this.tag&&this.tag.unmount(n),this}},ot={1:function(t,e){let{evaluate:n,template:r}=e;const s=document.createTextNode("");return T(s,t),A(t),Object.assign({},F,{node:t,evaluate:n,placeholder:s,template:r.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map((e=>Q(t,e))),["mount","update","unmount"].reduce(((t,e)=>Object.assign({},t,{[e]:t=>r.map((n=>n[e](t)))&&void 0})),{})));var r},0:function(t,e){let{evaluate:n,condition:r,itemName:o,indexName:i,getKey:u,template:a}=e;const c=document.createTextNode(""),l=t.cloneNode();return T(c,t),A(t),Object.assign({},H,{childrenMap:new Map,node:t,root:l,condition:r,evaluate:n,isTemplateTag:s(l),template:a.createDOM(t),getKey:u,indexName:i,itemName:o,placeholder:c})},3:function(t,e){let{evaluate:n,getComponent:r,slots:s,attributes:o}=e;return Object.assign({},st,{node:t,evaluate:n,slots:s,attributes:o,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},et,{attributes:r,node:t,name:n})}};function it(t,e){return t.map((t=>2===t.type?Object.assign({},t,{childNodeIndex:t.childNodeIndex+e}):t))}function ut(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(ot[s]||ot[2])(u,Object.assign({},e,{expressions:n&&!r?it(a,n):a}))}function at(t,e){switch(!0){case r(t):x(e,t);break;case s(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const ct=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?function(t,e){return r(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=s(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}(t,e):e)}(t,this.html)||document.createDocumentFragment(),this},mount(t,e,n,r){if(void 0===r&&(r={}),!t)throw Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);const{fragment:o,children:i,avoidDOMInjection:u}=r,{parentNode:a}=i?i[0]:t,c=s(t),l=c?function(t,e,n){const r=Array.from(t.childNodes);return Math.max(r.indexOf(e),r.indexOf(n.head)+1,0)}(a,t,r):null;this.createDOM(t);const h=o||this.dom.cloneNode(!0);return this.el=c?a:t,this.children=c?i||Array.from(h.childNodes):null,!u&&h&&at(t,h),this.bindings=this.bindingsData.map((t=>ut(this.el,t,l))),this.bindings.forEach((t=>t.mount(e,n))),this.meta=r,this},update(t,e){return this.bindings.forEach((n=>n.update(t,e))),this},unmount(t,e,n){void 0===n&&(n=!1);const r=this.el;if(!r)return this;switch(this.bindings.forEach((r=>r.unmount(t,e,n))),!0){case r[g]||null===n:break;case Array.isArray(this.children):E(this.children);break;case!n:M(r);break;case!!n:A(r)}return this.el=null,this},clone(){return Object.assign({},this,{meta:{},el:null})}});function lt(t,e){return void 0===e&&(e=[]),Object.assign({},ct,{html:t,bindingsData:e})}const ht=(t,e)=>t[c]=e;function dt(t){return[h,d,p].reduce(((e,n)=>(e[n]=t(n),e)),{})}function pt(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 mt(t,e){return pt("string"==typeof t?(e||document).querySelectorAll(t):t)}const ft=Object.freeze({$(t){return mt(t,this.root)[0]},$$(t){return mt(t,this.root)}}),bt=Object.freeze({shouldUpdate:S,onBeforeMount:S,onMounted:S,onBeforeUpdate:S,onUpdated:S,onBeforeUnmount:S,onUnmounted:S}),gt=t=>1===t.length?t[0]:t;function vt(t,e,n){const r="object"==typeof e?e:{[e]:n},s=Object.keys(r);return pt(t).forEach((t=>{s.forEach((e=>t.setAttribute(e,r[e])))})),t}const yt=new Map;var Ot;const jt={CSS_BY_NAME:yt,add(t,e){return yt.has(t)||(yt.set(t,e),this.inject()),this},inject(){return(Ot||(vt(Ot=mt("style[riot]")[0]||document.createElement("style"),"type","text/css"),Ot.parentNode||document.head.appendChild(Ot),Ot)).innerHTML=[...yt.values()].join("\n"),this},remove(t){return yt.has(t)&&(yt.delete(t),this.inject()),this}};function Nt(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return function(){for(var e=arguments.length,r=Array(e),s=0;s<e;s++)r[s]=arguments[s];return(r=[...n,...r]).length<t.length?Nt(t,...r):t(...r)}}function xt(t){return function(t,e,n){const r=["is"];return gt(pt(t).map((t=>gt(r.map((e=>t.getAttribute(e)))))))}(t)||t.tagName.toLowerCase()}function Mt(t,e){return Object.assign({},t,C(e))}function Et(t,e){let{slots:n,attributes:r,props:s}=e;return u=function(t){return[...l].reduce(((t,e)=>e(t)||t),t)}(I(i(t)?Object.create(t):t,{mount(e,o,i){return void 0===o&&(o={}),U(e,g,!1),this[y]=i,this[O]=function(t,e){void 0===e&&(e=[]);const n=e.map((e=>Q(t,e))),r={};return Object.assign(r,Object.assign({expressions:n},dt((t=>e=>(n.forEach((n=>n[t](e))),r)))))}(e,r).mount(i),U(this,m,Object.freeze(Object.assign({},function(t,e){return void 0===e&&(e={}),Object.assign({},function(t){return Array.from(t.attributes).reduce(((t,e)=>(t[N(e.name)]=e.value,t)),{})}(t),C(e))}(e,s),k(this[O].expressions)))),this.state=Mt(this.state,o),this[j]=this.template.createDOM(e).clone(),ht(e,this),t.name&&function(t,e){xt(t)!==e&&vt(t,"is",e)}(e,t.name),U(this,b,e),U(this,f,n),this.onBeforeMount(this.props,this.state),this[j].mount(e,this,i),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[y]=e,this[O].update(e));const n=k(this[O].expressions);if(!1!==this.shouldUpdate(n,this.props))return U(this,m,Object.freeze(Object.assign({},this.props,n))),this.state=Mt(this.state,t),this.onBeforeUpdate(this.props,this.state),this[v]||(this[v]=!0,this[j].update(this,this[y])),this.onUpdated(this.props,this.state),this[v]=!1,this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[O].unmount(),this[j].unmount(this,this[y],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>o(t[e]))).forEach((t=>{u[t]=u[t].bind(u)})),u;var u}function At(t){let{css:e,template:n,componentAPI:r,name:s}=t;return e&&s&&jt.add(s,e),Nt(Et)(I(L(r,Object.assign({},bt,{[m]:{},state:{}})),Object.assign({[f]:null,[b]:null},ft,{name:s,css:e,template:n})))}function Tt(t){const{css:n,template:r,exports:s,name:o}=t,i=r?function(t,n){const r=function(t){return void 0===t&&(t={}),Object.entries(C(t)).reduce(((t,e)=>{let[n,r]=e;var s;return t[(s=n,s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Tt(r),t}),{})}(n.exports?n.exports.components:{});return t(lt,w,e,(t=>t===n.name?wt(n):r[t]||a.get(t)))}(r,t):B;return t=>{let{slots:e,attributes:u,props:a}=t;if(s&&s[g])return function(t,e){let{slots:n,attributes:r,props:s,css:o,template:i}=e;const u=L(t({slots:n,attributes:r,props:s}),P);return dt((t=>function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];if(t===h){const[t]=n;U(t,g,!0),ht(t,u)}return u[t](...n),u}))}(s,{slots:e,attributes:u,props:a,css:n,template:r});const c=C(s)||{},l=At({css:n,template:i,componentAPI:c,name:o})({slots:e,attributes:u,props:a});return{mount:(t,e,n)=>l.mount(t,n,e),update:(t,e)=>l.update(e,t),unmount:t=>l.unmount(t)}}}const wt=D(Tt),St={cssManager:jt,DOMBindings:{template:lt,createBinding:ut,createExpression:Q,bindingTypes:e,expressionTypes:w},globals:{DOM_COMPONENT_INSTANCE_PROPERTY:c}};t.__=St,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=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})),Tt)(t)}},t.install=function(t){return o(t),l.has(t),l.add(t),l},t.mount=function(t,e,n){return mt(t).map((t=>function(t,e,n,r){const s=n||xt(t);return a.has(s),a.get(s)({props:e,slots:void 0}).mount(t)}(t,e,n)))},t.pure=function(t){return o(t),t[g]=!0,t},t.register=function(t,e){let{css:n,template:r,exports:s}=e;return a.has(t),a.set(t,Tt({name:t,css:n,template:r,exports:s})),a},t.uninstall=function(t){return l.has(t),l.delete(t),l},t.unmount=function(t,e){return mt(t).map((t=>(t[c]&&t[c].unmount(e),t)))},t.unregister=function(t){return a.has(t),a.delete(t),jt.remove(t),a},t.version="v7.0.1",t.withTypes=t=>t,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={});
var t,e;t=this,e=function(t){"use strict";const e={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};function n(t,e){return typeof t===e}function r(t){const e=t.ownerSVGElement;return!!e||null===e}function s(t){return"template"===t.tagName.toLowerCase()}function o(t){return n(t,"function")}function i(t){return!u(t)&&t.constructor===Object}function u(t){return null==t}const a=new Map,c=Symbol(),l=new Set,h="mount",d="update",p="unmount",m="props",f="slots",b="root",g=Symbol(),v=Symbol(),y=Symbol(),O=Symbol(),j=Symbol();function N(t){return t.replace(/-(\w)/g,((t,e)=>e.toUpperCase()))}function x(t,e){t.firstChild&&(e.appendChild(t.firstChild),x(t,e))}function M(t){E(t.childNodes)}function E(t){Array.from(t).forEach(A)}const A=t=>t&&t.parentNode&&t.parentNode.removeChild(t),T=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),w={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};function S(){return this}function C(t){return o(t)?t.prototype&&t.prototype.constructor?new t:t():t}function D(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}function k(t){return t.reduce(((t,e)=>{const{value:n,type:r}=e;switch(!0){case!e.name&&0===r:return Object.assign({},t,n);case 3===r:t.value=e.value;break;default:t[N(e.name)]=e.value}return t}),{})}function U(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 I(t,e,n){return Object.entries(e).forEach((e=>{let[r,s]=e;U(t,r,s,n)})),t}function L(t,e){return Object.entries(e).forEach((e=>{let[n,r]=e;t[n]||(t[n]=r)})),t}const P=Object.freeze({[h]:S,[d]:S,[p]:S}),B=Object.assign({},P,{clone:S,createDOM:S}),_=Symbol(),z=Symbol(),$=Symbol(),H={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:s}=this,o=t===$?null:this.evaluate(t),i=o?Array.from(o):[],{newChildrenMap:u,batches:a,futureNodes:c}=function(t,e,n,r){const{condition:s,template:o,childrenMap:i,itemName:u,getKey:a,indexName:c,root:l,isTemplateTag:h}=r,d=new Map,p=[],m=[];return t.forEach(((t,r)=>{const f=function(t,e){let{itemName:n,indexName:r,index:s,item:o}=e;return U(t,n,o),r&&U(t,r,s),t}(Object.create(e),{itemName:u,indexName:c,index:r,item:t}),b=a?a(f):r,g=i.get(b),v=[];if(function(t,e){return!!t&&!t(e)}(s,f))return;const y=!g,O=g?g.template:o.clone(),j=O.el||l.cloneNode(),N=h&&y?function(t){const e=t.dom.cloneNode(!0),{head:n,tail:r}=function(){const t=document.createTextNode(""),e=document.createTextNode("");return t[_]=!0,e[z]=!0,{head:t,tail:e}}();return{avoidDOMInjection:!0,fragment:e,head:n,tail:r,children:[n,...Array.from(e.childNodes),r]}}(O):O.meta;y?p.push((()=>O.mount(j,f,n,N))):p.push((()=>O.update(f,n))),h?v.push(...N.children):v.push(j),i.delete(b),m.push(...v),d.set(b,{nodes:v,template:O,context:f,index:r})})),{newChildrenMap:d,batches:p,futureNodes:m}}(i,t,e,this);return((t,e,n,r)=>{const s=e.length;let o=t.length,i=s,u=0,a=0,c=null;for(;u<o||a<i;)if(o===u){const t=i<s?a?n(e[a-1],-0).nextSibling:n(e[i-a],0):r;for(;a<i;)T(n(e[a++],1),t)}else if(i===a)for(;u<o;)c&&c.has(t[u])||A(n(t[u],-1)),u++;else if(t[u]===e[a])u++,a++;else if(t[o-1]===e[i-1])o--,i--;else if(t[u]===e[i-1]&&e[a]===t[o-1]){const r=n(t[--o],-1).nextSibling;T(n(e[a++],1),n(t[u++],-1).nextSibling),T(n(e[--i],1),r),t[o]=e[i]}else{if(!c){c=new Map;let t=a;for(;t<i;)c.set(e[t],t++)}if(c.has(t[u])){const r=c.get(t[u]);if(a<r&&r<i){let s=u,d=1;for(;++s<o&&s<i&&c.get(t[s])===r+d;)d++;if(d>r-a){const s=n(t[u],0);for(;a<r;)T(n(e[a++],1),s)}else l=n(e[a++],1),(h=n(t[u++],-1))&&h.parentNode&&h.parentNode.replaceChild(l,h)}else u++}else A(n(t[u++],-1))}var l,h})(r,c,function(t,e){return(n,r)=>{if(r<0){const n=t[t.length-1];if(n){const{template:r,nodes:s,context:o}=n;s.pop(),s.length||(t.pop(),r.unmount(o,e,null))}}return n}}(Array.from(s.values()),e),n),a.forEach((t=>t())),this.childrenMap=u,this.nodes=c,this},unmount(t,e){return this.update($,e),this}},F={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();T(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}},K="undefined"==typeof Element?{}:Element.prototype,R=D((t=>K.hasOwnProperty(t))),V=/^on/,q={handleEvent(t){this[t.type](t)}},G=new WeakMap;function W(t){return u(t)?"":t}const Y=(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},X={0:function t(e,r,s,u){let{name:a}=r;if(!a)return u&&function(t,e,n){const r=e?Object.keys(e):[];Object.keys(n).filter((t=>!r.includes(t))).forEach((e=>t.removeAttribute(e)))}(e,s,u),void(s&&function(e,n){Object.entries(n).forEach((n=>{let[r,s]=n;return t(e,{name:r},s)}))}(e,s));!R(a)&&(function(t){return n(t,"boolean")}(s)||i(s)||o(s))&&(e[a]=s),function(t){return!t&&0!==t}(s)?e.removeAttribute(a):function(t){return!0===t||["string","number"].includes(typeof t)}(s)&&e.setAttribute(a,function(t,e){return!0===e?t:e}(a,s))},1:function(t,e,n){let{name:r}=e;const s=r.replace(V,""),o=G.get(t)||(t=>{const e=Object.create(q);return G.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=W(n)},3:function(t,e,n){t.value=W(n)}},Z={mount(t){return this.value=this.evaluate(t),J(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(J(this,e),this.value=e),this},unmount(){return 1===this.type&&J(this,null),this}};function J(t,e){return X[t.type](t.node,t,e,t.value)}function Q(t,e){return Object.assign({},Z,e,{node:2===e.type?Y(t,e.childNodeIndex):t})}const tt=(t,e)=>t[y]||e,et={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),k(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,s=tt(t,e);return this.template=n&&lt(n.html,n.bindings).createDOM(r),this.template&&(M(this.node),this.template.mount(this.node,this.getTemplateScope(t,s),s),this.template.children=Array.from(this.node.childNodes)),nt(this.node),A(this.node),this},update(t,e){if(this.template){const n=tt(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 nt(t){const e=t&&t.firstChild;e&&(T(e,t),nt(t))}function rt(t){return t.reduce(((t,e)=>{let{bindings:n}=e;return t.concat(n)}),[])}const st={mount(t){return this.update(t)},update(t,e){const n=this.evaluate(t);return n&&n===this.name?this.tag.update(t):(this.unmount(t,e,!0),this.name=n,this.tag=(r=this.getComponent(n),void 0===(s=this.slots)&&(s=[]),void 0===(o=this.attributes)&&(o=[]),r?r({slots:s,attributes:o}):lt(function(t){return t.reduce(((t,e)=>t+e.html),"")}(s),[...rt(s),{expressions:o.map((t=>Object.assign({type:0},t)))}])),this.tag.mount(this.node,t)),this;var r,s,o},unmount(t,e,n){return this.tag&&this.tag.unmount(n),this}},ot={1:function(t,e){let{evaluate:n,template:r}=e;const s=document.createTextNode("");return T(s,t),A(t),Object.assign({},F,{node:t,evaluate:n,placeholder:s,template:r.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map((e=>Q(t,e))),["mount","update","unmount"].reduce(((t,e)=>Object.assign({},t,{[e]:t=>r.map((n=>n[e](t)))&&void 0})),{})));var r},0:function(t,e){let{evaluate:n,condition:r,itemName:o,indexName:i,getKey:u,template:a}=e;const c=document.createTextNode(""),l=t.cloneNode();return T(c,t),A(t),Object.assign({},H,{childrenMap:new Map,node:t,root:l,condition:r,evaluate:n,isTemplateTag:s(l),template:a.createDOM(t),getKey:u,indexName:i,itemName:o,placeholder:c})},3:function(t,e){let{evaluate:n,getComponent:r,slots:s,attributes:o}=e;return Object.assign({},st,{node:t,evaluate:n,slots:s,attributes:o,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},et,{attributes:r,node:t,name:n})}};function it(t,e){return t.map((t=>2===t.type?Object.assign({},t,{childNodeIndex:t.childNodeIndex+e}):t))}function ut(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(ot[s]||ot[2])(u,Object.assign({},e,{expressions:n&&!r?it(a,n):a}))}function at(t,e){switch(!0){case r(t):x(e,t);break;case s(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const ct=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?function(t,e){return r(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=s(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}(t,e):e)}(t,this.html)||document.createDocumentFragment(),this},mount(t,e,n,r){if(void 0===r&&(r={}),!t)throw Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);const{fragment:o,children:i,avoidDOMInjection:u}=r,{parentNode:a}=i?i[0]:t,c=s(t),l=c?function(t,e,n){const r=Array.from(t.childNodes);return Math.max(r.indexOf(e),r.indexOf(n.head)+1,0)}(a,t,r):null;this.createDOM(t);const h=o||this.dom.cloneNode(!0);return this.el=c?a:t,this.children=c?i||Array.from(h.childNodes):null,!u&&h&&at(t,h),this.bindings=this.bindingsData.map((t=>ut(this.el,t,l))),this.bindings.forEach((t=>t.mount(e,n))),this.meta=r,this},update(t,e){return this.bindings.forEach((n=>n.update(t,e))),this},unmount(t,e,n){void 0===n&&(n=!1);const r=this.el;if(!r)return this;switch(this.bindings.forEach((r=>r.unmount(t,e,n))),!0){case r[g]||null===n:break;case Array.isArray(this.children):E(this.children);break;case!n:M(r);break;case!!n:A(r)}return this.el=null,this},clone(){return Object.assign({},this,{meta:{},el:null})}});function lt(t,e){return void 0===e&&(e=[]),Object.assign({},ct,{html:t,bindingsData:e})}const ht=(t,e)=>t[c]=e;function dt(t){return[h,d,p].reduce(((e,n)=>(e[n]=t(n),e)),{})}function pt(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 mt(t,e){return pt("string"==typeof t?(e||document).querySelectorAll(t):t)}const ft=Object.freeze({$(t){return mt(t,this.root)[0]},$$(t){return mt(t,this.root)}}),bt=Object.freeze({shouldUpdate:S,onBeforeMount:S,onMounted:S,onBeforeUpdate:S,onUpdated:S,onBeforeUnmount:S,onUnmounted:S}),gt=t=>1===t.length?t[0]:t;function vt(t,e,n){const r="object"==typeof e?e:{[e]:n},s=Object.keys(r);return pt(t).forEach((t=>{s.forEach((e=>t.setAttribute(e,r[e])))})),t}const yt=new Map;var Ot;const jt={CSS_BY_NAME:yt,add(t,e){return yt.has(t)||(yt.set(t,e),this.inject()),this},inject(){return(Ot||(vt(Ot=mt("style[riot]")[0]||document.createElement("style"),"type","text/css"),Ot.parentNode||document.head.appendChild(Ot),Ot)).innerHTML=[...yt.values()].join("\n"),this},remove(t){return yt.has(t)&&(yt.delete(t),this.inject()),this}};function Nt(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return function(){for(var e=arguments.length,r=Array(e),s=0;s<e;s++)r[s]=arguments[s];return(r=[...n,...r]).length<t.length?Nt(t,...r):t(...r)}}function xt(t){return function(t,e,n){const r=["is"];return gt(pt(t).map((t=>gt(r.map((e=>t.getAttribute(e)))))))}(t)||t.tagName.toLowerCase()}function Mt(t,e){return Object.assign({},t,C(e))}function Et(t,e){let{slots:n,attributes:r,props:s}=e;return u=function(t){return[...l].reduce(((t,e)=>e(t)||t),t)}(I(i(t)?Object.create(t):t,{mount(e,o,i){return void 0===o&&(o={}),U(e,g,!1),this[y]=i,this[O]=function(t,e){void 0===e&&(e=[]);const n=e.map((e=>Q(t,e))),r={};return Object.assign(r,Object.assign({expressions:n},dt((t=>e=>(n.forEach((n=>n[t](e))),r)))))}(e,r).mount(i),U(this,m,Object.freeze(Object.assign({},function(t,e){return void 0===e&&(e={}),Object.assign({},function(t){return Array.from(t.attributes).reduce(((t,e)=>(t[N(e.name)]=e.value,t)),{})}(t),C(e))}(e,s),k(this[O].expressions)))),this.state=Mt(this.state,o),this[j]=this.template.createDOM(e).clone(),ht(e,this),t.name&&function(t,e){xt(t)!==e&&vt(t,"is",e)}(e,t.name),U(this,b,e),U(this,f,n),this.onBeforeMount(this.props,this.state),this[j].mount(e,this,i),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[y]=e,this[O].update(e));const n=k(this[O].expressions);if(!1!==this.shouldUpdate(n,this.props))return U(this,m,Object.freeze(Object.assign({},this.props,n))),this.state=Mt(this.state,t),this.onBeforeUpdate(this.props,this.state),this[v]||(this[v]=!0,this[j].update(this,this[y])),this.onUpdated(this.props,this.state),this[v]=!1,this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[O].unmount(),this[j].unmount(this,this[y],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>o(t[e]))).forEach((t=>{u[t]=u[t].bind(u)})),u;var u}function At(t){let{css:e,template:n,componentAPI:r,name:s}=t;return e&&s&&jt.add(s,e),Nt(Et)(I(L(r,Object.assign({},bt,{[m]:{},state:{}})),Object.assign({[f]:null,[b]:null},ft,{name:s,css:e,template:n})))}function Tt(t){const{css:n,template:r,exports:s,name:o}=t,i=r?function(t,n){const r=function(t){return void 0===t&&(t={}),Object.entries(C(t)).reduce(((t,e)=>{let[n,r]=e;var s;return t[(s=n,s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Tt(r),t}),{})}(n.exports?n.exports.components:{});return t(lt,w,e,(t=>t===n.name?wt(n):r[t]||a.get(t)))}(r,t):B;return t=>{let{slots:e,attributes:u,props:a}=t;if(s&&s[g])return function(t,e){let{slots:n,attributes:r,props:s,css:o,template:i}=e;const u=L(t({slots:n,attributes:r,props:s}),P);return dt((t=>function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];if(t===h){const[t]=n;U(t,g,!0),ht(t,u)}return u[t](...n),u}))}(s,{slots:e,attributes:u,props:a,css:n,template:r});const c=C(s)||{},l=At({css:n,template:i,componentAPI:c,name:o})({slots:e,attributes:u,props:a});return{mount:(t,e,n)=>l.mount(t,n,e),update:(t,e)=>l.update(e,t),unmount:t=>l.unmount(t)}}}const wt=D(Tt),St={cssManager:jt,DOMBindings:{template:lt,createBinding:ut,createExpression:Q,bindingTypes:e,expressionTypes:w},globals:{DOM_COMPONENT_INSTANCE_PROPERTY:c}};t.__=St,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=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})),Tt)(t)}},t.install=function(t){return o(t),l.has(t),l.add(t),l},t.mount=function(t,e,n){return mt(t).map((t=>function(t,e,n,r){const s=n||xt(t);return a.has(s),a.get(s)({props:e,slots:void 0}).mount(t)}(t,e,n)))},t.pure=function(t){return o(t),t[g]=!0,t},t.register=function(t,e){let{css:n,template:r,exports:s}=e;return a.has(t),a.set(t,Tt({name:t,css:n,template:r,exports:s})),a},t.uninstall=function(t){return l.has(t),l.delete(t),l},t.unmount=function(t,e){return mt(t).map((t=>(t[c]&&t[c].unmount(e),t)))},t.unregister=function(t){return a.has(t),a.delete(t),jt.remove(t),a},t.version="v7.0.2",t.withTypes=t=>t,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc