Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

riot

Package Overview
Dependencies
Maintainers
1
Versions
280
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 6.0.0 to 6.0.1

6

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

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

"dependencies": {
"@riotjs/compiler": "^6.0.0",
"@riotjs/compiler": "^6.0.1",
"@riotjs/dom-bindings": "6.0.0",

@@ -70,3 +70,3 @@ "@riotjs/util": "^2.0.4",

"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-riot": "^5.0.0",
"rollup-plugin-riot": "^6.0.0",
"sinon": "^11.1.1",

@@ -73,0 +73,0 @@ "sinon-chai": "^3.7.0",

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

/* Riot v6.0.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,e){t.firstChild&&(e.appendChild(t.firstChild),n(t,e))}function r(t){o(t.childNodes)}function o(t){Array.from(t).forEach(s)}const s=t=>t&&t.parentNode&&t.parentNode.removeChild(t),i=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),u=new Map,a=Symbol("riot-component"),c=new Set,l="is",h="mount",p="update",d="unmount",m="shouldUpdate",f="onBeforeMount",b="onMounted",g="onBeforeUpdate",O="onUpdated",E="onBeforeUnmount",N="onUnmounted",v="props",T="state",y="slots",_="root",M=Symbol("pure"),j=Symbol("is_updating"),A=Symbol("parent"),S=Symbol("attributes"),x=Symbol("template");var w=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:u,DOM_COMPONENT_INSTANCE_PROPERTY:a,PLUGINS_SET:c,IS_DIRECTIVE:l,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:h,UPDATE_METHOD_KEY:p,UNMOUNT_METHOD_KEY:d,SHOULD_UPDATE_KEY:m,ON_BEFORE_MOUNT_KEY:f,ON_MOUNTED_KEY:b,ON_BEFORE_UPDATE_KEY:g,ON_UPDATED_KEY:O,ON_BEFORE_UNMOUNT_KEY:E,ON_UNMOUNTED_KEY:N,PROPS_KEY:v,STATE_KEY:T,SLOTS_KEY:y,ROOT_KEY:_,IS_PURE_SYMBOL:M,IS_COMPONENT_UPDATING:j,PARENT_KEY_SYMBOL:A,ATTRIBUTES_KEY_SYMBOL:S,TEMPLATE_KEY_SYMBOL:x}),P={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4},U={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const C=Symbol("head"),D=Symbol("tail");function I(t){const e=t.dom.cloneNode(!0),{head:n,tail:r}=function(){const t=document.createTextNode(""),e=document.createTextNode("");return t[C]=!0,e[D]=!0,{head:t,tail:e}}();return{avoidDOMInjection:!0,fragment:e,head:n,tail:r,children:[n,...Array.from(e.childNodes),r]}}function L(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 Y(t,e,n){return Object.entries(e).forEach((e=>{let[r,o]=e;L(t,r,o,n)})),t}function B(t,e){return Object.entries(e).forEach((e=>{let[n,r]=e;t[n]||(t[n]=r)})),t}function K(t){let{head:e,tail:n}=t;const r=R([e],e.nextSibling,(t=>t===n),!1);return r.push(n),r}function R(t,e,n,r){const{nextSibling:o}=e;return r||e[C]||e[D]||t.push(e),!o||n(e)?t:R(t,o,n,r&&!e[D]||o[C])}function k(t,e){return typeof t===e}function $(t){const e=t.ownerSVGElement;return!!e||null===e}function z(t){return"template"===t.tagName.toLowerCase()}function H(t){return k(t,"function")}function F(t){return!G(t)&&t.constructor===Object}function G(t){return null==t}const V=Symbol("unmount"),q={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:o}=this,u=t===V?null:this.evaluate(t),a=u?Array.from(u):[],{newChildrenMap:c,batches:l,futureNodes:h}=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=[],m=[];return t.forEach(((t,r)=>{const f=function(t,e){let{itemName:n,indexName:r,index:o,item:s}=e;return L(t,n,s),r&&L(t,r,o),t}(Object.create(e),{itemName:u,indexName:c,index:r,item:t}),b=a?a(f):r,g=i.get(b),O=[];if(function(t,e){return!!t&&!t(e)}(o,f))return;const E=!g,N=g?g.template:s.clone(),v=N.el||l.cloneNode(),T=h&&E?I(N):N.meta;E?d.push((()=>N.mount(v,f,n,T))):d.push((()=>N.update(f,n))),h?O.push(...E?T.children:K(T)):O.push(v),i.delete(b),m.push(...O),p.set(b,{nodes:O,template:N,context:f,index:r})})),{newChildrenMap:p,batches:d,futureNodes:m}}(a,t,e,this);return((t,e,n,r)=>{const o=e.length;let u=t.length,a=o,c=0,l=0,h=null;for(;c<u||l<a;)if(u===c){const t=a<o?l?n(e[l-1],-0).nextSibling:n(e[a-l],0):r;for(;l<a;)i(n(e[l++],1),t)}else if(a===l)for(;c<u;)h&&h.has(t[c])||s(n(t[c],-1)),c++;else if(t[c]===e[l])c++,l++;else if(t[u-1]===e[a-1])u--,a--;else if(t[c]===e[a-1]&&e[l]===t[u-1]){const r=n(t[--u],-1).nextSibling;i(n(e[l++],1),n(t[c++],-1).nextSibling),i(n(e[--a],1),r),t[u]=e[a]}else{if(!h){h=new Map;let t=l;for(;t<a;)h.set(e[t],t++)}if(h.has(t[c])){const r=h.get(t[c]);if(l<r&&r<a){let o=c,s=1;for(;++o<u&&o<a&&h.get(t[o])===r+s;)s++;if(s>r-l){const o=n(t[c],0);for(;l<r;)i(n(e[l++],1),o)}else p=n(e[l++],1),(d=n(t[c++],-1))&&d.parentNode&&d.parentNode.replaceChild(p,d)}else c++}else s(n(t[c++],-1))}var p,d})(r,h,function(t,e){return(n,r)=>{if(r<0){const n=t[t.length-1];if(n){const{template:r,nodes:o,context:s}=n;o.pop(),o.length||(t.pop(),r.unmount(s,e,null))}}return n}}(Array.from(o.values()),e),n),l.forEach((t=>t())),this.childrenMap=c,this.nodes=h,function(t){const e=t[0],n=t[t.length-1];e&&(e[C]=!0),n&&(n[D]=!0)}(this.nodes),this},unmount(t,e){return this.update(V,e),this}},W={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();i(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 X(t){throw new Error(t)}function Z(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 J(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 Q="undefined"==typeof Element?{}:Element.prototype,tt=Z((t=>Q.hasOwnProperty(t)));function et(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 et(t,{name:n},r)}))}(t,n));!tt(o)&&(function(t){return k(t,"boolean")}(n)||F(n)||H(n))&&(t[o]=n),function(t){return!t&&0!==t}(n)?t.removeAttribute(o):function(t){return!0===t||["string","number"].includes(typeof t)}(n)&&t.setAttribute(o,function(t,e){return!0===e?t:e}(o,n))}const nt=/^on/,rt={handleEvent(t){this[t.type](t)}},ot=new WeakMap;function st(t){return G(t)?"":t}const it=(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 ut={0:et,1:function(t,e,n){let{name:r}=e;const o=r.replace(nt,""),s=ot.get(t)||(t=>{const e=Object.create(rt);return ot.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=st(n)},3:function(t,e,n){t.value=st(n)}};const at={mount(t){return this.value=this.evaluate(t),ct(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(ct(this,e),this.value=e),this},unmount(){return 1===this.type&&ct(this,null),this}};function ct(t,e){return ut[t.type](t.node,t,e,t.value)}function lt(t,e){return Object.assign({},at,e,{node:2===e.type?it(t,e.childNodeIndex):t})}const ht=(t,e)=>t[A]||e,pt={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),J(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,i=ht(t,e);return this.template=n&&Tt(n.html,n.bindings).createDOM(o),this.template&&(r(this.node),this.template.mount(this.node,this.getTemplateScope(t,i),i),this.template.children=Array.from(this.node.childNodes)),dt(this.node),s(this.node),this},update(t,e){if(this.template){const n=ht(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 dt(t){const e=t&&t.firstChild;e&&(i(e,t),dt(t))}function mt(t){return t.reduce(((t,e)=>{let{bindings:n}=e;return t.concat(n)}),[])}const ft={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=function(t,e,n){return void 0===e&&(e=[]),void 0===n&&(n=[]),t?t({slots:e,attributes:n}):Tt(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 bt={1:function(t,e){let{evaluate:n,template:r}=e;const o=document.createTextNode("");return i(o,t),s(t),Object.assign({},W,{node:t,evaluate:n,placeholder:o,template:r.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map((e=>lt(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:r,itemName:o,indexName:u,getKey:a,template:c}=e;const l=document.createTextNode(""),h=t.cloneNode();return i(l,t),s(t),Object.assign({},q,{childrenMap:new Map,node:t,root:h,condition:r,evaluate:n,isTemplateTag:z(h),template:c.createDOM(t),getKey:a,indexName:u,itemName:o,placeholder:l})},3:function(t,e){let{evaluate:n,getComponent:r,slots:o,attributes:s}=e;return Object.assign({},ft,{node:t,evaluate:n,slots:o,attributes:s,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},pt,{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 Ot(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(bt[o]||bt[2])(u,Object.assign({},e,{expressions:n&&!r?gt(a,n):a}))}function Et(t,e){return $(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=z(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}function Nt(t,e){switch(!0){case $(t):n(e,t);break;case z(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const vt=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?Et(t,e):e)}(t,this.html)||document.createDocumentFragment(),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=z(t),c=a?function(t,e,n){const r=Array.from(t.childNodes);return Math.max(r.indexOf(e),r.indexOf(n.head)+1,0)}(u,t,r):null;this.createDOM(t);const l=o||this.dom.cloneNode(!0);return this.el=a?u:t,this.children=a?s||Array.from(l.childNodes):null,!i&&l&&Nt(t,l),this.bindings=this.bindingsData.map((t=>Ot(this.el,t,c))),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 i=this.el;if(!i)return this;switch(this.bindings.forEach((r=>r.unmount(t,e,n))),!0){case i[M]||null===n:break;case Array.isArray(this.children):o(this.children);break;case!n:r(i);break;case!!n:s(i)}return this.el=null,this},clone(){return Object.assign({},this,{meta:{},el:null})}});function Tt(t,e){return void 0===e&&(e=[]),Object.assign({},vt,{html:t,bindingsData:e})}var yt=Object.freeze({__proto__:null,template:Tt,createBinding:Ot,createExpression:lt,bindingTypes:P,expressionTypes:U});function _t(){return this}function Mt(t){return H(t)?t.prototype&&t.prototype.constructor?new t:t():t}function jt(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 At(t,e){return jt("string"==typeof t?(e||document).querySelectorAll(t):t)}const St=t=>1===t.length?t[0]:t;function xt(t,e,n){const r="object"==typeof e?e:{[e]:n},o=Object.keys(r);return jt(t).forEach((t=>{o.forEach((e=>t.setAttribute(e,r[e])))})),t}function wt(t,e){return function(t,e,n){const r="string"==typeof e?[e]:e;return St(jt(t).map((t=>St(r.map((e=>t[n](e)))))))}(t,e,"getAttribute")}const Pt=new Map,Ut=()=>Ct||(xt(Ct=At("style[riot]")[0]||document.createElement("style"),"type","text/css"),Ct.parentNode||document.head.appendChild(Ct),Ct);var Ct,Dt={CSS_BY_NAME:Pt,add(t,e){return Pt.has(t)||(Pt.set(t,e),this.inject()),this},inject(){return Ut().innerHTML=[...Pt.values()].join("\n"),this},remove(t){return Pt.has(t)&&(Pt.delete(t),this.inject()),this}};function It(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),o=0;o<e;o++)r[o]=arguments[o];return(r=[...n,...r]).length<t.length?It(t,...r):t(...r)}}function Lt(t){return wt(t,l)||t.tagName.toLowerCase()}const Yt=Object.freeze({$(t){return At(t,this.root)[0]},$$(t){return At(t,this.root)}}),Bt=Object.freeze({[h]:_t,[p]:_t,[d]:_t}),Kt=Object.freeze({[m]:_t,[f]:_t,[b]:_t,[g]:_t,[O]:_t,[E]:_t,[N]:_t}),Rt=Object.assign({},Bt,{clone:_t,createDOM:_t}),kt=Z(Gt);function $t(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),Mt(n))}const zt=(t,e)=>t[a]=e;function Ht(t){return[h,p,d].reduce(((e,n)=>(e[n]=t(n),e)),{})}function Ft(t,e){const n=function(t){return void 0===t&&(t={}),Object.entries(Mt(t)).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}),{})}(e.exports?e.exports.components:{});return t(Tt,U,P,(t=>t===e.name?kt(e):n[t]||u.get(t)))}function Gt(t){const{css:e,template:n,exports:r,name:o}=t,s=n?Ft(n,t):Rt;return t=>{let{slots:i,attributes:u,props:a}=t;if(r&&r[M])return function(t,e){let{slots:n,attributes:r,props:o,css:s,template:i}=e;i&&X("Pure components can not have html"),s&&X("Pure components do not have css");const u=B(t({slots:n,attributes:r,props:o}),Bt);return Ht((t=>function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(t===h){const[t]=n;t[M]=!0,zt(t,u)}return u[t](...n),u}))}(r,{slots:i,attributes:u,props:a,css:e,template:n});const c=Mt(r)||{},l=Vt({css:e,template:s,componentAPI:c,name:o})({slots:i,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)}}}function Vt(t){let{css:e,template:n,componentAPI:r,name:o}=t;return e&&o&&Dt.add(o,e),It(Wt)(Y(B(r,Object.assign({},Kt,{[v]:{},[T]:{}})),Object.assign({[y]:null,[_]:null},Yt,{name:o,css:e,template:n})))}function qt(t,e){return Object.assign({},t,Mt(e))}function Wt(t,e){let{slots:n,attributes:r,props:o}=e;return s=function(t){return[...c].reduce(((t,e)=>e(t)||t),t)}(Y(F(t)?Object.create(t):t,{mount(e,s,i){return void 0===s&&(s={}),this[A]=i,this[S]=function(t,e){void 0===e&&(e=[]);const n=e.map((e=>lt(t,e))),r={};return Object.assign(r,Object.assign({expressions:n},Ht((t=>e=>(n.forEach((n=>n[t](e))),r)))))}(e,r).mount(i),L(this,v,Object.freeze(Object.assign({},$t(e,o),J(this[S].expressions)))),this.state=qt(this.state,s),this[x]=this.template.createDOM(e).clone(),zt(e,this),t.name&&function(t,e){Lt(t)!==e&&xt(t,l,e)}(e,t.name),L(this,_,e),L(this,y,n),this.onBeforeMount(this.props,this.state),this[x].mount(e,this,i),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[A]=e,this[S].update(e));const n=J(this[S].expressions);if(!1!==this.shouldUpdate(n,this.props))return L(this,v,Object.freeze(Object.assign({},this.props,n))),this.state=qt(this.state,t),this.onBeforeUpdate(this.props,this.state),this[j]||(this[j]=!0,this[x].update(this,this[A])),this.onUpdated(this.props,this.state),this[j]=!1,this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[S].unmount(),this[x].unmount(this,this[A],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>H(t[e]))).forEach((t=>{s[t]=s[t].bind(s)})),s;var s}const{DOM_COMPONENT_INSTANCE_PROPERTY:Xt,COMPONENTS_IMPLEMENTATION_MAP:Zt,PLUGINS_SET:Jt}=w,Qt={cssManager:Dt,DOMBindings:yt,createComponent:Gt,defineComponent:Vt,globals:w};t.__=Qt,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 H(t)||X("Plugins must be of type function"),Jt.has(t)&&X("This plugin was already installed"),Jt.add(t),Jt},t.mount=function(t,e,n){return At(t).map((t=>function(t,e,n){const r=n||Lt(t);return u.has(r)||X(`The component named "${r}" was never registered`),u.get(r)({props:e}).mount(t)}(t,e,n)))},t.pure=function(t){return H(t)||X('riot.pure accepts only arguments of type "function"'),t[M]=!0,t},t.register=function(t,e){let{css:n,template:r,exports:o}=e;return Zt.has(t)&&X(`The component "${t}" was already registered`),Zt.set(t,Gt({name:t,css:n,template:r,exports:o})),Zt},t.uninstall=function(t){return Jt.has(t)||X("This plugin was never installed"),Jt.delete(t),Jt},t.unmount=function(t,e){return At(t).map((t=>(t[Xt]&&t[Xt].unmount(e),t)))},t.unregister=function(t){return Zt.has(t)||X(`The component "${t}" was never registered`),Zt.delete(t),Dt.remove(t),Zt},t.version="v6.0.0",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={});
/* Riot v6.0.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){o(t.childNodes)}function o(t){Array.from(t).forEach(s)}const s=t=>t&&t.parentNode&&t.parentNode.removeChild(t),i=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),u=new Map,a=Symbol("riot-component"),c=new Set,l="is",h="mount",p="update",d="unmount",m="shouldUpdate",f="onBeforeMount",b="onMounted",g="onBeforeUpdate",O="onUpdated",E="onBeforeUnmount",N="onUnmounted",v="props",T="state",y="slots",_="root",M=Symbol("pure"),j=Symbol("is_updating"),A=Symbol("parent"),S=Symbol("attributes"),x=Symbol("template");var w=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:u,DOM_COMPONENT_INSTANCE_PROPERTY:a,PLUGINS_SET:c,IS_DIRECTIVE:l,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:h,UPDATE_METHOD_KEY:p,UNMOUNT_METHOD_KEY:d,SHOULD_UPDATE_KEY:m,ON_BEFORE_MOUNT_KEY:f,ON_MOUNTED_KEY:b,ON_BEFORE_UPDATE_KEY:g,ON_UPDATED_KEY:O,ON_BEFORE_UNMOUNT_KEY:E,ON_UNMOUNTED_KEY:N,PROPS_KEY:v,STATE_KEY:T,SLOTS_KEY:y,ROOT_KEY:_,IS_PURE_SYMBOL:M,IS_COMPONENT_UPDATING:j,PARENT_KEY_SYMBOL:A,ATTRIBUTES_KEY_SYMBOL:S,TEMPLATE_KEY_SYMBOL:x}),P={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4},U={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const C=Symbol("head"),D=Symbol("tail");function I(t){const e=t.dom.cloneNode(!0),{head:n,tail:r}=function(){const t=document.createTextNode(""),e=document.createTextNode("");return t[C]=!0,e[D]=!0,{head:t,tail:e}}();return{avoidDOMInjection:!0,fragment:e,head:n,tail:r,children:[n,...Array.from(e.childNodes),r]}}function L(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 Y(t,e,n){return Object.entries(e).forEach((e=>{let[r,o]=e;L(t,r,o,n)})),t}function B(t,e){return Object.entries(e).forEach((e=>{let[n,r]=e;t[n]||(t[n]=r)})),t}function K(t){let{head:e,tail:n}=t;const r=R([e],e.nextSibling,(t=>t===n),!1);return r.push(n),r}function R(t,e,n,r){const{nextSibling:o}=e;return r||e[C]||e[D]||t.push(e),!o||n(e)?t:R(t,o,n,r&&!e[D]||o[C])}function k(t,e){return typeof t===e}function $(t){const e=t.ownerSVGElement;return!!e||null===e}function z(t){return"template"===t.tagName.toLowerCase()}function H(t){return k(t,"function")}function F(t){return!G(t)&&t.constructor===Object}function G(t){return null==t}const V=Symbol("unmount"),q={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:o}=this,u=t===V?null:this.evaluate(t),a=u?Array.from(u):[],{newChildrenMap:c,batches:l,futureNodes:h}=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=[],m=[];return t.forEach(((t,r)=>{const f=function(t,e){let{itemName:n,indexName:r,index:o,item:s}=e;return L(t,n,s),r&&L(t,r,o),t}(Object.create(e),{itemName:u,indexName:c,index:r,item:t}),b=a?a(f):r,g=i.get(b),O=[];if(function(t,e){return!!t&&!t(e)}(o,f))return;const E=!g,N=g?g.template:s.clone(),v=N.el||l.cloneNode(),T=h&&E?I(N):N.meta;E?d.push((()=>N.mount(v,f,n,T))):d.push((()=>N.update(f,n))),h?O.push(...E?T.children:K(T)):O.push(v),i.delete(b),m.push(...O),p.set(b,{nodes:O,template:N,context:f,index:r})})),{newChildrenMap:p,batches:d,futureNodes:m}}(a,t,e,this);return((t,e,n,r)=>{const o=e.length;let u=t.length,a=o,c=0,l=0,h=null;for(;c<u||l<a;)if(u===c){const t=a<o?l?n(e[l-1],-0).nextSibling:n(e[a-l],0):r;for(;l<a;)i(n(e[l++],1),t)}else if(a===l)for(;c<u;)h&&h.has(t[c])||s(n(t[c],-1)),c++;else if(t[c]===e[l])c++,l++;else if(t[u-1]===e[a-1])u--,a--;else if(t[c]===e[a-1]&&e[l]===t[u-1]){const r=n(t[--u],-1).nextSibling;i(n(e[l++],1),n(t[c++],-1).nextSibling),i(n(e[--a],1),r),t[u]=e[a]}else{if(!h){h=new Map;let t=l;for(;t<a;)h.set(e[t],t++)}if(h.has(t[c])){const r=h.get(t[c]);if(l<r&&r<a){let o=c,s=1;for(;++o<u&&o<a&&h.get(t[o])===r+s;)s++;if(s>r-l){const o=n(t[c],0);for(;l<r;)i(n(e[l++],1),o)}else p=n(e[l++],1),(d=n(t[c++],-1))&&d.parentNode&&d.parentNode.replaceChild(p,d)}else c++}else s(n(t[c++],-1))}var p,d})(r,h,function(t,e){return(n,r)=>{if(r<0){const n=t[t.length-1];if(n){const{template:r,nodes:o,context:s}=n;o.pop(),o.length||(t.pop(),r.unmount(s,e,null))}}return n}}(Array.from(o.values()),e),n),l.forEach((t=>t())),this.childrenMap=c,this.nodes=h,function(t){const e=t[0],n=t[t.length-1];e&&(e[C]=!0),n&&(n[D]=!0)}(this.nodes),this},unmount(t,e){return this.update(V,e),this}},W={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();i(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 X(t){throw new Error(t)}function Z(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 J(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 Q="undefined"==typeof Element?{}:Element.prototype,tt=Z((t=>Q.hasOwnProperty(t)));function et(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 et(t,{name:n},r)}))}(t,n));!tt(o)&&(function(t){return k(t,"boolean")}(n)||F(n)||H(n))&&(t[o]=n),function(t){return!t&&0!==t}(n)?t.removeAttribute(o):function(t){return!0===t||["string","number"].includes(typeof t)}(n)&&t.setAttribute(o,function(t,e){return!0===e?t:e}(o,n))}const nt=/^on/,rt={handleEvent(t){this[t.type](t)}},ot=new WeakMap;function st(t){return G(t)?"":t}const it=(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 ut={0:et,1:function(t,e,n){let{name:r}=e;const o=r.replace(nt,""),s=ot.get(t)||(t=>{const e=Object.create(rt);return ot.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=st(n)},3:function(t,e,n){t.value=st(n)}};const at={mount(t){return this.value=this.evaluate(t),ct(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(ct(this,e),this.value=e),this},unmount(){return 1===this.type&&ct(this,null),this}};function ct(t,e){return ut[t.type](t.node,t,e,t.value)}function lt(t,e){return Object.assign({},at,e,{node:2===e.type?it(t,e.childNodeIndex):t})}const ht=(t,e)=>t[A]||e,pt={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),J(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,i=ht(t,e);return this.template=n&&Tt(n.html,n.bindings).createDOM(o),this.template&&(r(this.node),this.template.mount(this.node,this.getTemplateScope(t,i),i),this.template.children=Array.from(this.node.childNodes)),dt(this.node),s(this.node),this},update(t,e){if(this.template){const n=ht(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 dt(t){const e=t&&t.firstChild;e&&(i(e,t),dt(t))}function mt(t){return t.reduce(((t,e)=>{let{bindings:n}=e;return t.concat(n)}),[])}const ft={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=function(t,e,n){return void 0===e&&(e=[]),void 0===n&&(n=[]),t?t({slots:e,attributes:n}):Tt(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 bt={1:function(t,e){let{evaluate:n,template:r}=e;const o=document.createTextNode("");return i(o,t),s(t),Object.assign({},W,{node:t,evaluate:n,placeholder:o,template:r.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map((e=>lt(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:r,itemName:o,indexName:u,getKey:a,template:c}=e;const l=document.createTextNode(""),h=t.cloneNode();return i(l,t),s(t),Object.assign({},q,{childrenMap:new Map,node:t,root:h,condition:r,evaluate:n,isTemplateTag:z(h),template:c.createDOM(t),getKey:a,indexName:u,itemName:o,placeholder:l})},3:function(t,e){let{evaluate:n,getComponent:r,slots:o,attributes:s}=e;return Object.assign({},ft,{node:t,evaluate:n,slots:o,attributes:s,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},pt,{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 Ot(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(bt[o]||bt[2])(u,Object.assign({},e,{expressions:n&&!r?gt(a,n):a}))}function Et(t,e){return $(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=z(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}function Nt(t,e){switch(!0){case $(t):n(e,t);break;case z(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const vt=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?Et(t,e):e)}(t,this.html)||document.createDocumentFragment(),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=z(t),c=a?function(t,e,n){const r=Array.from(t.childNodes);return Math.max(r.indexOf(e),r.indexOf(n.head)+1,0)}(u,t,r):null;this.createDOM(t);const l=o||this.dom.cloneNode(!0);return this.el=a?u:t,this.children=a?s||Array.from(l.childNodes):null,!i&&l&&Nt(t,l),this.bindings=this.bindingsData.map((t=>Ot(this.el,t,c))),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 i=this.el;if(!i)return this;switch(this.bindings.forEach((r=>r.unmount(t,e,n))),!0){case i[M]||null===n:break;case Array.isArray(this.children):o(this.children);break;case!n:r(i);break;case!!n:s(i)}return this.el=null,this},clone(){return Object.assign({},this,{meta:{},el:null})}});function Tt(t,e){return void 0===e&&(e=[]),Object.assign({},vt,{html:t,bindingsData:e})}var yt=Object.freeze({__proto__:null,template:Tt,createBinding:Ot,createExpression:lt,bindingTypes:P,expressionTypes:U});function _t(){return this}function Mt(t){return H(t)?t.prototype&&t.prototype.constructor?new t:t():t}function jt(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 At(t,e){return jt("string"==typeof t?(e||document).querySelectorAll(t):t)}const St=t=>1===t.length?t[0]:t;function xt(t,e,n){const r="object"==typeof e?e:{[e]:n},o=Object.keys(r);return jt(t).forEach((t=>{o.forEach((e=>t.setAttribute(e,r[e])))})),t}function wt(t,e){return function(t,e,n){const r="string"==typeof e?[e]:e;return St(jt(t).map((t=>St(r.map((e=>t[n](e)))))))}(t,e,"getAttribute")}const Pt=new Map,Ut=()=>Ct||(xt(Ct=At("style[riot]")[0]||document.createElement("style"),"type","text/css"),Ct.parentNode||document.head.appendChild(Ct),Ct);var Ct,Dt={CSS_BY_NAME:Pt,add(t,e){return Pt.has(t)||(Pt.set(t,e),this.inject()),this},inject(){return Ut().innerHTML=[...Pt.values()].join("\n"),this},remove(t){return Pt.has(t)&&(Pt.delete(t),this.inject()),this}};function It(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),o=0;o<e;o++)r[o]=arguments[o];return(r=[...n,...r]).length<t.length?It(t,...r):t(...r)}}function Lt(t){return wt(t,l)||t.tagName.toLowerCase()}const Yt=Object.freeze({$(t){return At(t,this.root)[0]},$$(t){return At(t,this.root)}}),Bt=Object.freeze({[h]:_t,[p]:_t,[d]:_t}),Kt=Object.freeze({[m]:_t,[f]:_t,[b]:_t,[g]:_t,[O]:_t,[E]:_t,[N]:_t}),Rt=Object.assign({},Bt,{clone:_t,createDOM:_t}),kt=Z(Gt);function $t(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),Mt(n))}const zt=(t,e)=>t[a]=e;function Ht(t){return[h,p,d].reduce(((e,n)=>(e[n]=t(n),e)),{})}function Ft(t,e){const n=function(t){return void 0===t&&(t={}),Object.entries(Mt(t)).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}),{})}(e.exports?e.exports.components:{});return t(Tt,U,P,(t=>t===e.name?kt(e):n[t]||u.get(t)))}function Gt(t){const{css:e,template:n,exports:r,name:o}=t,s=n?Ft(n,t):Rt;return t=>{let{slots:i,attributes:u,props:a}=t;if(r&&r[M])return function(t,e){let{slots:n,attributes:r,props:o,css:s,template:i}=e;i&&X("Pure components can not have html"),s&&X("Pure components do not have css");const u=B(t({slots:n,attributes:r,props:o}),Bt);return Ht((t=>function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(t===h){const[t]=n;t[M]=!0,zt(t,u)}return u[t](...n),u}))}(r,{slots:i,attributes:u,props:a,css:e,template:n});const c=Mt(r)||{},l=Vt({css:e,template:s,componentAPI:c,name:o})({slots:i,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)}}}function Vt(t){let{css:e,template:n,componentAPI:r,name:o}=t;return e&&o&&Dt.add(o,e),It(Wt)(Y(B(r,Object.assign({},Kt,{[v]:{},[T]:{}})),Object.assign({[y]:null,[_]:null},Yt,{name:o,css:e,template:n})))}function qt(t,e){return Object.assign({},t,Mt(e))}function Wt(t,e){let{slots:n,attributes:r,props:o}=e;return s=function(t){return[...c].reduce(((t,e)=>e(t)||t),t)}(Y(F(t)?Object.create(t):t,{mount(e,s,i){return void 0===s&&(s={}),this[A]=i,this[S]=function(t,e){void 0===e&&(e=[]);const n=e.map((e=>lt(t,e))),r={};return Object.assign(r,Object.assign({expressions:n},Ht((t=>e=>(n.forEach((n=>n[t](e))),r)))))}(e,r).mount(i),L(this,v,Object.freeze(Object.assign({},$t(e,o),J(this[S].expressions)))),this.state=qt(this.state,s),this[x]=this.template.createDOM(e).clone(),zt(e,this),t.name&&function(t,e){Lt(t)!==e&&xt(t,l,e)}(e,t.name),L(this,_,e),L(this,y,n),this.onBeforeMount(this.props,this.state),this[x].mount(e,this,i),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[A]=e,this[S].update(e));const n=J(this[S].expressions);if(!1!==this.shouldUpdate(n,this.props))return L(this,v,Object.freeze(Object.assign({},this.props,n))),this.state=qt(this.state,t),this.onBeforeUpdate(this.props,this.state),this[j]||(this[j]=!0,this[x].update(this,this[A])),this.onUpdated(this.props,this.state),this[j]=!1,this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[S].unmount(),this[x].unmount(this,this[A],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>H(t[e]))).forEach((t=>{s[t]=s[t].bind(s)})),s;var s}const{DOM_COMPONENT_INSTANCE_PROPERTY:Xt,COMPONENTS_IMPLEMENTATION_MAP:Zt,PLUGINS_SET:Jt}=w,Qt={cssManager:Dt,DOMBindings:yt,createComponent:Gt,defineComponent:Vt,globals:w};t.__=Qt,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 H(t)||X("Plugins must be of type function"),Jt.has(t)&&X("This plugin was already installed"),Jt.add(t),Jt},t.mount=function(t,e,n){return At(t).map((t=>function(t,e,n){const r=n||Lt(t);return u.has(r)||X(`The component named "${r}" was never registered`),u.get(r)({props:e}).mount(t)}(t,e,n)))},t.pure=function(t){return H(t)||X('riot.pure accepts only arguments of type "function"'),t[M]=!0,t},t.register=function(t,e){let{css:n,template:r,exports:o}=e;return Zt.has(t)&&X(`The component "${t}" was already registered`),Zt.set(t,Gt({name:t,css:n,template:r,exports:o})),Zt},t.uninstall=function(t){return Jt.has(t)||X("This plugin was never installed"),Jt.delete(t),Jt},t.unmount=function(t,e){return At(t).map((t=>(t[Xt]&&t[Xt].unmount(e),t)))},t.unregister=function(t){return Zt.has(t)||X(`The component "${t}" was never registered`),Zt.delete(t),Dt.remove(t),Zt},t.version="v6.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={});

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

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