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 5.4.4 to 5.4.5

12

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

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

"@riotjs/compiler": "^5.4.2",
"@riotjs/dom-bindings": "5.1.2",
"@riotjs/dom-bindings": "5.1.3",
"@riotjs/util": "^2.0.4",

@@ -48,4 +48,4 @@ "bianco.attr": "^1.0.0",

"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.4",
"@babel/core": "^7.14.5",
"@babel/preset-env": "^7.14.5",
"@riotjs/babel-preset": "1.0.0",

@@ -68,4 +68,4 @@ "@rollup/plugin-commonjs": "^19.0.0",

"karma-sauce-launcher": "^4.3.6",
"mocha": "^8.4.0",
"rollup": "^2.50.6",
"mocha": "^9.0.0",
"rollup": "^2.51.2",
"rollup-plugin-babel": "^4.4.0",

@@ -72,0 +72,0 @@ "rollup-plugin-riot": "^5.0.0",

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

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