-
Notifications
You must be signed in to change notification settings - Fork 0
/
mithril-ext.min.js
1 lines (1 loc) · 2.12 KB
/
mithril-ext.min.js
1
!function(){var t=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","webkitLineClamp"]),e=()=>{},r=Symbol("OLD"),i=(t,e)=>{var r,i,o,a;if(t.attrs={},r=e.attrs){for(o in r)(a=r[o])!==m.DELETE&&("attrs"===o?(i=a,delete r[o]):t.attrs[o]=a);if(i)for(o in i)(a=i[o])===m.DELETE||Object.hasOwn(o)||(t.attrs[o]=a)}t.children=e.children||[],t.key=e.key};Object.assign(window.m,{DELETE:Symbol("DELETE"),class(...t){var e,r,i;for(r of(e=[],t))if(Array.isArray(r))e.push(m.class(...r));else if(r instanceof Object)for(i in r)r[i]&&e.push(i);else e.push(r);return e.join(" ")},style(...e){var r,i,o,a;for(i of(r={},e))if(Array.isArray(i)&&(i=m.style(...i)),i instanceof Object)for(o in i)a=i[o],t.has(o)||o.startsWith("--")||isNaN(a)?r[o]=a:r[o]=a+"px";return r},bind(t,e=t,r=t){var i,o;for(i in t)t.__lookupGetter__(i)||"function"==typeof(o=t[i])&&"bound "!==o.name&&"class "!==o.name&&(r[i]=o.bind(e));return r},async fetch(t,e,r="text"){var i,o;if("string"==typeof e&&([e,r]=[,e]),!(i=await fetch(t,e)).ok)throw Error(`${i.statusText}: ${i.url}`);return"yml"===r&&(r="yaml"),o="yaml"===r?"text":r,i=await i[o](),"yaml"===r&&window.jsyaml?jsyaml.safeLoad(i):i},comp(t){var{oninit:o=e,oncreate:a=e,onbeforeupdate:s=e,onupdate:n=e,onremove:l=e}=t;return{...t,oninit(t){m.bind(this),i(this,t),o.call(this),s.call(this)},oncreate(t){this.dom=t.dom,a.call(this),n.call(this),this[r]={dom:this.dom}},onbeforeupdate(t){var e=this[r];e.attrs=this.attrs,e.children=this.children,i(this,t),s.call(this,e)},onupdate(t){var e=this[r];e.dom=this.dom,this.dom=t.dom,n.call(this,e)},onremove(){l.call(this),delete this.dom}}}})}();