omi/dist/omi.min.js

2 lines
14 KiB
JavaScript

!function(){"use strict";function e(){}function t(t,n){var o,i,r,l,a=q;for(l=arguments.length;l-- >2;)P.push(arguments[l]);n&&null!=n.children&&(P.length||P.push(n.children),delete n.children);while(P.length)if((i=P.pop())&&void 0!==i.pop)for(l=i.length;l--;)P.push(i[l]);else"boolean"==typeof i&&(i=null),(r="function"!=typeof t)&&(null==i?i="":"number"==typeof i?i+="":"string"!=typeof i&&(r=!1)),r&&o?a[a.length-1]+=i:a===q?a=[i]:a.push(i),o=r;var s=new e;return s.nodeName=D.isWeb?t:B[t],s.attributes=null==n?void 0:n,a&&"string"==typeof a[0]&&!D.isWeb?s.attributes?s.attributes.value=a[0]:s.attributes={value:a[0]}:s.children=a,s.key=null==n?void 0:n.key,void 0!==D.vnode&&D.vnode(s),s}function n(e,t){for(var n in t)e[n]=t[n];return e}function o(e,o){return t(e.nodeName,n(n({},e.attributes),o),arguments.length>2?[].slice.call(arguments,2):e.children)}function i(e){1==G.push(e)&&(D.debounceRendering||X)(r)}function r(){var e,t=G;G=[];var n;while(e=t.pop())n=e.base,L(e);t.length||D.componentChange&&D.componentChange(e,n)}function l(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&a(e,t.nodeName):n||e._componentConstructor===t.nodeName}function a(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function s(e){var t=n({},e.attributes);t.children=e.children;var o=e.nodeName.defaultProps;if(void 0!==o)for(var i in o)void 0===t[i]&&(t[i]=o[i]);return t}function c(e,t){var n=t?D.doc.createElementNS("http://www.w3.org/2000/svg",e):D.doc.createElement(e);return n.__n=e,n}function u(e){for(var t=e.replace(/\/\*(.|\s)*?\*\//g," ").replace(/\s+/g," "),n={},o=t.match(/ ?(.*?) ?{([^}]*)}/)||[i,r,t],i=o[0],r=o[1],l=o[2],a=l.split(";").map(function(e){return e.split(":").map(function(e){return e&&e.trim()})}),s=a,s=Array.isArray(s),s=0,s=s||s[Symbol.iterator]();;){var c;if(s){if(s>=s.length)break;c=s[s++]}else{if(s=s.next(),s.done)break;c=s.value}var u=c,p=u[0],d=u[1];n[function(e){return e.replace(/\W+\w/g,function(e){return e.slice(-1).toUpperCase()})}(p)]=d}return n}function p(e){var t=e.parentNode;t&&t.removeChild(e)}function d(e,t,n,o,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&o(e);else if("class"!==t||i)if("style"===t)if(D.isWeb){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var r in n)r in o||(e.style[r]="");for(var r in o)e.style[r]="number"==typeof o[r]&&!1===z.test(r)?o[r]+"px":o[r]}}else{var l=n,a=o;"string"==typeof n&&(l=u(n)),"string"==typeof o&&(a=u(o));var s={},c=!1;if(l){for(var p in l)"object"!=typeof a||p in a||(s[p]="",c=!0);for(var d in a)a[d]!==l[d]&&(s[d]=a[d],c=!0);c&&e.setStyles(s)}else e.setStyles(a)}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var m=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,f,m):e.removeEventListener(t,f,m),(e.__l||(e.__l={}))[t]=o}else if("list"!==t&&"type"!==t&&!i&&t in e)v(e,t,null==o?"":o),null!=o&&!1!==o||e.removeAttribute(t);else{var w=i&&t!==(t=t.replace(/^xlink:?/,""));null==o||!1===o?w?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(w?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function v(e,t,n){try{e[t]=n}catch(e){}}function f(e){return this.__l[e.type](D.event&&D.event(e)||e)}function m(){var e;while(e=F.pop())D.afterMount&&D.afterMount(e),e.componentDidMount&&e.componentDidMount(),e.installed&&e.installed()}function w(e,t,n,o,i,r){J++||(K=null!=i&&void 0!==i.ownerSVGElement,Q=null!=e&&!("__preactattr_"in e));var l=h(e,t,n,o,r);return i&&l.parentNode!==i&&i.appendChild(l),--J||(Q=!1,r||m()),l}function h(e,t,n,o,i){var r=e,l=K;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||i)?e.nodeValue!=t&&(e.nodeValue=t):(r=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(r,e),b(e,!0))),r.t=!0,r;var s=t.nodeName;if("function"==typeof s)return O(e,t,n,o);if(K="svg"===s||"foreignObject"!==s&&K,s+="",(!e||!a(e,s))&&(r=c(s,K),e)){while(e.firstChild)r.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(r,e),b(e,!0)}var u=r.firstChild,p=r.t,d=t.children;if(null==p){p=r.t={};for(var v=r.attributes,f=v.length;f--;)p[v[f].name]=v[f].value}return!Q&&d&&1===d.length&&"string"==typeof d[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=d[0]&&(u.nodeValue=d[0]):(d&&d.length||null!=u)&&_(r,d,n,o,Q||null!=p.dangerouslySetInnerHTML),g(r,t.attributes,p),K=l,r}function _(e,t,n,o,i){var r,a,s,c,u,d=e.childNodes,v=[],f={},m=0,w=0,_=d.length,y=0,g=t?t.length:0;if(0!==_)for(var C=0;C<_;C++){var x=d[C],k=x.t,N=g&&k?x._component?x._component.__k:k.key:null;null!=N?(m++,f[N]=x):(k||(void 0!==x.splitText?!i||x.nodeValue.trim():i))&&(v[y++]=x)}if(0!==g)for(var C=0;C<g;C++){c=t[C],u=null;var N=c.key;if(null!=N)m&&void 0!==f[N]&&(u=f[N],f[N]=void 0,m--);else if(!u&&w<y)for(r=w;r<y;r++)if(void 0!==v[r]&&l(a=v[r],c,i)){u=a,v[r]=void 0,r===y-1&&y--,r===w&&w++;break}u=h(u,c,n,o),s=d[C],u&&u!==e&&u!==s&&(null==s?e.appendChild(u):u===s.nextSibling?p(s):e.insertBefore(u,s))}if(m)for(var C in f)void 0!==f[C]&&b(f[C],!1);while(w<=y)void 0!==(u=v[y--])&&b(u,!1)}function b(e,t){var n=e._component;n?j(n):(null!=e.t&&e.t.ref&&e.t.ref(null),!1!==t&&null!=e.t||p(e),y(e))}function y(e){e=e.lastChild;while(e){var t=e.previousSibling;b(e,!0),e=t}}function g(e,t,n){var o;for(o in n)t&&null!=t[o]||null==n[o]||d(e,o,n[o],n[o]=void 0,K);for(o in t)"children"===o||"innerHTML"===o||o in n&&t[o]===("value"===o||"checked"===o?e[o]:n[o])||d(e,o,n[o],n[o]=t[o],K)}function C(e){var t=e.constructor.name;(Y[t]||(Y[t]=[])).push(e)}function x(e,t,n){var o,i=Y[e.name];if(e.prototype&&e.prototype.render?(o=new e(t,n),$.call(o,t,n)):(o=new $(t,n),o.constructor=e,o.render=k),o.$store=D.$store,window&&window.Omi&&window.Omi.instances.push(o),i)for(var r=i.length;r--;)if(i[r].constructor===e){o.__b=i[r].__b,i.splice(r,1);break}return o}function k(e,t,n){return this.constructor(e,n)}function N(e){for(var t=0,n=D.styleCache.length;t<n;t++){var o=D.styleCache[t];if(o.ctor===e)return o.attrName}var i="static_"+Z;return D.styleCache.push({ctor:e,attrName:i}),Z++,i}function S(e,t){return t="["+t.toLowerCase()+"]",e=e.replace(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//g,""),e=e.replace(RegExp("([^\r\n,{}:]+)(:[^\r\n,{}]+)?(,(?=[^{}]*{)|s*{)","g"),function(e,n,o,i){return void 0===o&&(o=""),n.match(/^\s*(@media|\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/)?n+o+i:n.replace(/(\s*)$/,"")+t+o+i})}function U(e,t){t=t.toLowerCase();var n=document.getElementById(t),o=document.getElementsByTagName("head")[0];n&&n.parentNode===o&&o.removeChild(n);var i=document.createElement("style");o.appendChild(i),i.setAttribute("type","text/css"),i.setAttribute("id",t),window.ActiveXObject?i.styleSheet.cssText=e:i.textContent=e}function E(e){var t=document.getElementsByTagName("head")[0],n=document.createElement("style");t.appendChild(n),n.setAttribute("type","text/css"),window.ActiveXObject?n.styleSheet.cssText=e:n.textContent=e}function M(e,t,n,o){D.scopedStyle?(W(n,e),(t=S(t,n))!==o.r&&U(t,n)):t!==o.r&&E(t),o.r=t}function T(e,t,n){D.scopedStyle?(W(n,e),D.staticStyleRendered||U(S(t,n),n)):D.staticStyleRendered||E(t)}function W(e,t){"string"!=typeof t&&(t.attributes=t.attributes||{},t.attributes[e]="",t.children.forEach(function(t){return W(e,t)}))}function A(e,t,n,o,r){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||r?(e.componentWillMount&&e.componentWillMount(),e.install&&e.install()):e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.__c||(e.__c=e.context),e.context=o),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==n&&(1!==n&&!1===D.syncComponentUpdates&&e.base?i(e):L(e,1,r)),e.__r&&e.__r(e))}function L(e,t,o,i){if(!e.__x){var r,l,a,c=e.props,u=e.state,p=e.context,d=e.__p||c,v=e.__s||u,f=e.__c||p,h=e.base,_=e.__b,y=h||_,g=e._component,C=!1;if(h&&(e.props=d,e.state=v,e.context=f,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(c,u,p)?C=!0:e.componentWillUpdate?e.componentWillUpdate(c,u,p):e.beforeUpdate&&e.beforeUpdate(c,u,p),e.props=c,e.state=u,e.context=p),e.__p=e.__s=e.__c=e.__b=null,!C){r=e.render(c,u,p),e.staticStyle&&T(r,e.staticStyle(),"_style_"+N(e.constructor)),e.style&&M(r,e.style(),"_style_"+e.s,e),e.getChildContext&&(p=n(n({},p),e.getChildContext()));var k,S,U=r&&r.nodeName;if("function"==typeof U){var E=s(r);l=g,l&&l.constructor===U&&E.key==l.__k?A(l,E,1,p,!1):(k=l,e._component=l=x(U,E,p),l.__b=l.__b||_,l.__u=e,A(l,E,0,p,!1),L(l,1,o,!0)),S=l.base}else a=y,k=g,k&&(a=e._component=null),(y||1===t)&&(a&&(a._component=null),S=w(a,r,p,o||!h,y&&y.parentNode,!0));if(y&&S!==y&&l!==g){var W=y.parentNode;W&&S!==W&&(W.replaceChild(S,y),k||(y._component=null,b(y,!1)))}if(k&&j(k),e.base=S,S&&!i){var O=e,R=e;while(R=R.__u)(O=R).base=S;S._component=O,S._componentConstructor=O.constructor}}if(!h||o?F.unshift(e):C||(e.componentDidUpdate&&e.componentDidUpdate(d,v,f),e.afterUpdate&&e.afterUpdate(d,v,f),D.afterUpdate&&D.afterUpdate(e)),null!=e.__h)while(e.__h.length)e.__h.pop().call(e);J||i||m()}}function O(e,t,n,o){var i=e&&e._component,r=i,l=e,a=i&&e._componentConstructor===t.nodeName,c=a,u=s(t);while(i&&!c&&(i=i.__u))c=i.constructor===t.nodeName;return i&&c&&(!o||i._component)?(A(i,u,3,n,o),e=i.base):(r&&!a&&(j(r),e=l=null),i=x(t.nodeName,u,n),e&&!i.__b&&(i.__b=e,l=null),A(i,u,1,n,o),e=i.base,l&&e!==l&&(l._component=null,b(l,!1))),e}function j(e){D.beforeUnmount&&D.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.uninstall&&e.uninstall(),e.base=null;var n=e._component;n?j(n):t&&(t.t&&t.t.ref&&t.t.ref(null),e.__b=t,p(t),C(e),y(t)),e.__r&&e.__r(null)}function R(){return ee++}function $(e,t){this.context=t,this.props=e,this.state=this.state||{},this.s=R(),this.r=null,this.$store=null}function V(e,t,n){if(n=Object.assign({store:{}},n),"undefined"!=typeof window){if(D.staticStyleRendered=!1,t="string"==typeof t?document.querySelector(t):t,n.merge&&(n.merge="string"==typeof n.merge?document.querySelector(n.merge):n.merge),n.empty)while(t.firstChild)t.removeChild(t.firstChild);if(n.store.ssrData=D.root.x,D.$store=n.store,e instanceof $){window&&window.Omi&&window.Omi.instances.push(e),e.$store=n.store,e.componentWillMount&&e.componentWillMount(),e.install&&e.install();var o=e.render(e.props,e.state,e.context);return e.staticStyle&&T(o,e.staticStyle(),"_style_"+N(e.constructor)),e.style&&M(o,e.style(),"_style_"+e.s,e),e.base=w(n.merge,o,{},!1,t,!1),e.componentDidMount&&e.componentDidMount(),e.installed&&e.installed(),D.staticStyleRendered=!0,e.base}var i=w(n.merge,e,{},!1,t,!1);return D.staticStyleRendered=!0,i}e instanceof $&&n&&(e.$store=n.store)}var D={scopedStyle:!0,$store:null,isWeb:!0,staticStyleRendered:!1,doc:"object"==typeof document?document:null,root:function(){return"object"==typeof global&&global&&global.Math===Math&&global.Array===Array?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:function(){return this}()}(),styleCache:[]},P=[],q=[],B={br:"view",hr:"view",p:"view",h1:"view",h2:"view",h3:"view",h4:"view",h5:"view",h6:"view",abbr:"view",address:"view",b:"view",bdi:"view",bdo:"view",blockquote:"view",cite:"view",code:"view",del:"view",ins:"view",dfn:"view",em:"view",strong:"view",samp:"view",kbd:"view",var:"view",i:"view",mark:"view",pre:"view",q:"view",ruby:"view",rp:"view",rt:"view",s:"view",small:"view",sub:"view",sup:"view",time:"view",u:"view",wbr:"view",form:"form",input:"input",textarea:"textarea",button:"button",select:"picker",option:"view",optgroup:"view",label:"label",fieldset:"view",datalist:"picker",legend:"view",output:"view",iframe:"view",img:"image",canvas:"canvas",figure:"view",figcaption:"view",audio:"audio",source:"audio",video:"video",track:"video",a:"navigator",nav:"view",link:"navigator",ul:"view",ol:"view",li:"view",dl:"view",dt:"view",dd:"view",menu:"view",command:"view",table:"view",caption:"view",th:"view",td:"view",tr:"view",thead:"view",tbody:"view",tfoot:"view",col:"view",colgroup:"view",div:"view",main:"view",span:"text",header:"view",footer:"view",section:"view",article:"view",aside:"view",details:"view",dialog:"view",summary:"view",progress:"progress",meter:"progress",head:"view",meta:"view",base:"text",map:"map",area:"navigator",script:"view",noscript:"view",embed:"view",object:"view",param:"view",view:"view","scroll-view":"scroll-view",swiper:"swiper",icon:"icon",text:"text",checkbox:"checkbox",radio:"radio",picker:"picker","picker-view":"picker-view",slider:"slider",switch:"switch",navigator:"navigator",image:"image","contact-button":"contact-button",block:"block"},H="function"==typeof Promise;if("object"!=typeof document&&"undefined"!=typeof global&&global.v)if("android"===global.v.platform)H=!0;else{var I=global.v.systemVersion&&global.v.systemVersion.split(".")[0]||0;I>8&&(H=!0)}var X=H?Promise.resolve().then.bind(Promise.resolve()):setTimeout,z=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,G=[],F=[],J=0,K=!1,Q=!1,Y={},Z=0,ee=0;n($.prototype,{setState:function(e,t){var o=this.state;this.__s||(this.__s=n({},o)),n(o,"function"==typeof e?e(o,this.props):e),t&&(this.__h=this.__h||[]).push(t),i(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),L(this,2),D.componentChange&&D.componentChange(this,this.base)},update:function(e){this.forceUpdate(e)},render:function(){}});var te=[];D.root.Omi={h:t,createElement:t,cloneElement:o,Component:$,render:V,rerender:r,options:D,instances:te},D.root.Omi.version="3.0.6";var ne={h:t,createElement:t,cloneElement:o,Component:$,render:V,rerender:r,options:D,instances:te};"undefined"!=typeof module?module.exports=ne:self.Omi=ne}();
//# sourceMappingURL=omi.min.js.map