@tarojs/components
Version:
Taro 组件库
2 lines • 12.4 kB
JavaScript
let e,t,n=!1,l=!1,o=!1,s=!1;const i="http://www.w3.org/1999/xlink",c={},r=e=>"object"==(e=typeof e)||"function"===e;function f(e){var t,n,l;return null!==(l=null===(n=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===n?void 0:n.getAttribute("content"))&&void 0!==l?l:void 0}const a=(e,t,...n)=>{let l=null,o=null,s=null,i=!1,c=!1;const f=[],a=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?a(l):null!=l&&"boolean"!=typeof l&&((i="function"!=typeof e&&!r(l))&&(l+=""),i&&c?f[f.length-1].t+=l:f.push(i?u(null,l):l),c=i)};if(a(n),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,f,$);const d=u(e,null);return d.l=t,f.length>0&&(d.o=f),d.i=o,d.u=s,d},u=(e,t)=>({$:0,p:e,t,m:null,o:null,l:null,i:null,u:null}),d={},$={forEach:(e,t)=>e.map(p).forEach(t),map:(e,t)=>e.map(p).map(t).map(m)},p=e=>({vattrs:e.l,vchildren:e.o,vkey:e.i,vname:e.u,vtag:e.p,vtext:e.t}),m=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),a(e.vtag,t,...e.vchildren||[])}const t=u(e.vtag,e.vtext);return t.l=e.vattrs,t.o=e.vchildren,t.i=e.vkey,t.u=e.vname,t},y=e=>le(e).h,h=(e,t,n)=>{const l=y(e);return{emit:e=>b(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},b=(e,t,n)=>{const l=$e.ce(t,n);return e.dispatchEvent(l),l},v=new WeakMap,w=e=>"sc-"+e.v,k=(e,t,n,l,o,s)=>{if(n!==l){let c=ie(e,t),f=t.toLowerCase();if("class"===t){const t=e.classList,o=S(n),s=S(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if("ref"===t)l&&l(e);else if(c||"o"!==t[0]||"n"!==t[1]){const a=r(l);if((c||a&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?c=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}let u=!1;f!==(f=f.replace(/^xlink\:?/,""))&&(t=f,u=!0),null==l||!1===l?!1===l&&""!==e.getAttribute(t)||(u?e.removeAttributeNS(i,t):e.removeAttribute(t)):(!c||4&s||o)&&!a&&(l=!0===l?"":l,u?e.setAttributeNS(i,t,l):e.setAttribute(t,l))}else t="-"===t[2]?t.slice(3):ie(ue,f)?f.slice(2):f[2]+t.slice(3),n&&$e.rel(e,t,n,!1),l&&$e.ael(e,t,l,!1)}},g=/\s/,S=e=>e?e.split(g):[],j=(e,t,n,l)=>{const o=11===t.m.nodeType&&t.m.host?t.m.host:t.m,s=e&&e.l||c,i=t.l||c;for(l in s)l in i||k(o,l,s[l],void 0,n,t.$);for(l in i)k(o,l,s[l],i[l],n,t.$)},C=(l,s,i)=>{const c=s.o[i];let r,f,a,u=0;if(n||(o=!0,"slot"===c.p&&(c.$|=c.o?2:1)),null!==c.t)r=c.m=de.createTextNode(c.t);else if(1&c.$)r=c.m=de.createTextNode("");else if(r=c.m=de.createElement(2&c.$?"slot-fb":c.p),j(null,c,!1),c.o)for(u=0;u<c.o.length;++u)f=C(l,c,u),f&&r.appendChild(f);return r["s-hn"]=t,3&c.$&&(r["s-sr"]=!0,r["s-cr"]=e,r["s-sn"]=c.u||"",a=l&&l.o&&l.o[i],a&&a.p===c.p&&l.m&&M(l.m,!1)),r},M=(e,n)=>{$e.$|=1;const l=e.childNodes;for(let e=l.length-1;e>=0;e--){const s=l[e];s["s-hn"]!==t&&s["s-ol"]&&(T(s).insertBefore(s,P(s)),s["s-ol"].remove(),s["s-ol"]=void 0,o=!0),n&&M(s,n)}$e.$&=-2},O=(e,t,n,l,o,s)=>{let i,c=e["s-cr"]&&e["s-cr"].parentNode||e;for(;o<=s;++o)l[o]&&(i=C(null,n,o),i&&(l[o].m=i,c.insertBefore(i,P(t))))},x=(e,t,n,o,s)=>{for(;t<=n;++t)(o=e[t])&&(s=o.m,D(o),l=!0,s["s-ol"]?s["s-ol"].remove():M(s,!0),s.remove())},R=(e,t)=>e.p===t.p&&("slot"===e.p?e.u===t.u:e.i===t.i),P=e=>e&&e["s-ol"]||e,T=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,E=(e,t)=>{const n=t.m=e.m,l=e.o,o=t.o,s=t.t;let i;null===s?("slot"===t.p||j(e,t,!1),null!==l&&null!==o?((e,t,n,l)=>{let o,s,i=0,c=0,r=0,f=0,a=t.length-1,u=t[0],d=t[a],$=l.length-1,p=l[0],m=l[$];for(;i<=a&&c<=$;)if(null==u)u=t[++i];else if(null==d)d=t[--a];else if(null==p)p=l[++c];else if(null==m)m=l[--$];else if(R(u,p))E(u,p),u=t[++i],p=l[++c];else if(R(d,m))E(d,m),d=t[--a],m=l[--$];else if(R(u,m))"slot"!==u.p&&"slot"!==m.p||M(u.m.parentNode,!1),E(u,m),e.insertBefore(u.m,d.m.nextSibling),u=t[++i],m=l[--$];else if(R(d,p))"slot"!==u.p&&"slot"!==m.p||M(d.m.parentNode,!1),E(d,p),e.insertBefore(d.m,u.m),d=t[--a],p=l[++c];else{for(r=-1,f=i;f<=a;++f)if(t[f]&&null!==t[f].i&&t[f].i===p.i){r=f;break}r>=0?(s=t[r],s.p!==p.p?o=C(t&&t[c],n,r):(E(s,p),t[r]=void 0,o=s.m),p=l[++c]):(o=C(t&&t[c],n,c),p=l[++c]),o&&T(u.m).insertBefore(o,P(u.m))}i>a?O(e,null==l[$+1]?null:l[$+1].m,n,l,c,$):c>$&&x(t,i,a)})(n,l,t,o):null!==o?(null!==e.t&&(n.textContent=""),O(n,null,t,o,0,o.length-1)):null!==l&&x(l,0,l.length-1)):(i=n["s-cr"])?i.parentNode.textContent=s:e.t!==s&&(n.data=s)},L=e=>{const t=e.childNodes;let n,l,o,s,i,c;for(l=0,o=t.length;l<o;l++)if(n=t[l],1===n.nodeType){if(n["s-sr"])for(i=n["s-sn"],n.hidden=!1,s=0;s<o;s++)if(c=t[s].nodeType,t[s]["s-hn"]!==n["s-hn"]||""!==i){if(1===c&&i===t[s].getAttribute("slot")){n.hidden=!0;break}}else if(1===c||3===c&&""!==t[s].textContent.trim()){n.hidden=!0;break}L(n)}},N=[],U=e=>{let t,n,o,s,i,c,r=0;const f=e.childNodes,a=f.length;for(;r<a;r++){if(t=f[r],t["s-sr"]&&(n=t["s-cr"])&&n.parentNode)for(o=n.parentNode.childNodes,s=t["s-sn"],c=o.length-1;c>=0;c--)n=o[c],n["s-cn"]||n["s-nr"]||n["s-hn"]===t["s-hn"]||(W(n,s)?(i=N.find((e=>e.k===n)),l=!0,n["s-sn"]=n["s-sn"]||s,i?i.g=t:N.push({g:t,k:n}),n["s-sr"]&&N.map((e=>{W(e.k,n["s-sn"])&&(i=N.find((e=>e.k===n)),i&&!e.g&&(e.g=i.g))}))):N.some((e=>e.k===n))||N.push({k:n}));1===t.nodeType&&U(t)}},W=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,D=e=>{e.l&&e.l.ref&&e.l.ref(null),e.o&&e.o.map(D)},A=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},F=(e,t)=>{if(e.$|=16,!(4&e.$))return A(e,e.j),ge((()=>H(e,t)));e.$|=512},H=(e,t)=>{const n=e.C;let l;return t?(e.$|=256,e.M&&(e.M.map((([e,t])=>B(n,e,t))),e.M=null),l=B(n,"componentWillLoad")):l=B(n,"componentWillUpdate"),G(l,(()=>q(e,n,t)))},q=async(e,t,n)=>{const l=e.h,o=l["s-rc"];n&&(e=>{const t=e.O;((e,t)=>{var n;let l=w(t);const o=ae.get(l);if(e=11===e.nodeType?e:de,o)if("string"==typeof o){let t,s=v.get(e=e.head||e);if(s||v.set(e,s=new Set),!s.has(l)){{t=de.createElement("style"),t.innerHTML=o;const l=null!==(n=$e.R)&&void 0!==n?n:f(de);null!=l&&t.setAttribute("nonce",l),e.insertBefore(t,e.querySelector("link"))}s&&s.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o])})(e.h.getRootNode(),t)})(e);V(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>_(e);0===t.length?n():(Promise.all(t).then(n),e.$|=4,t.length=0)}},V=(s,i)=>{try{i=i.render(),s.$&=-17,s.$|=2,((s,i)=>{const c=s.h,r=s.O,f=s.P||u(null,null),$=(e=>e&&e.p===d)(i)?i:a(null,null,i);if(t=c.tagName,r.T&&($.l=$.l||{},r.T.map((([e,t])=>$.l[t]=c[e]))),$.p=null,$.$|=4,s.P=$,$.m=f.m=c,e=c["s-cr"],n=0!=(1&r.$),l=!1,E(f,$),$e.$|=1,o){let e,t,n,l,o,s;U($.m);let i=0;for(;i<N.length;i++)e=N[i],t=e.k,t["s-ol"]||(n=de.createTextNode(""),n["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=n,t));for(i=0;i<N.length;i++)if(e=N[i],t=e.k,e.g){for(l=e.g.parentNode,o=e.g.nextSibling,n=t["s-ol"];n=n.previousSibling;)if(s=n["s-nr"],s&&s["s-sn"]===t["s-sn"]&&l===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&l!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),l.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}l&&L($.m),$e.$&=-2,N.length=0})(s,i)}catch(e){ce(e,s.h)}return null},_=e=>{const t=e.h,n=e.C,l=e.j;B(n,"componentDidRender"),64&e.$?B(n,"componentDidUpdate"):(e.$|=64,I(t),B(n,"componentDidLoad"),e.L(t),l||z()),e.N(t),e.S&&(e.S(),e.S=void 0),512&e.$&&ke((()=>F(e,!1))),e.$&=-517},z=()=>{I(de.documentElement),ke((()=>b(ue,"appload",{detail:{namespace:"taro-components"}})))},B=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){ce(e)}},G=(e,t)=>e&&e.then?e.then(t):t(),I=e=>e.classList.add("hydrated"),J=(e,t,n)=>{if(t.U){e.watchers&&(t.W=e.watchers);const l=Object.entries(t.U),o=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(o,e,{get(){return((e,t)=>le(this).D.get(t))(0,e)},set(n){((e,t,n,l)=>{const o=le(e),s=o.h,i=o.D.get(t),c=o.$,f=o.C;if(n=((e,t)=>null==e||r(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.U[t][0]),(!(8&c)||void 0===i)&&n!==i&&(!Number.isNaN(i)||!Number.isNaN(n))&&(o.D.set(t,n),f)){if(l.W&&128&c){const e=l.W[t];e&&e.map((e=>{try{f[e](n,i,t)}catch(e){ce(e,s)}}))}2==(18&c)&&F(o,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(o,e,{value(...t){const n=le(this);return n.A.then((()=>n.C[e](...t)))}})})),1&n){const n=new Map;o.attributeChangedCallback=function(e,t,l){$e.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(o.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const o=l[1]||e;return n.set(o,e),512&l[0]&&t.T.push([e,o]),o}))}}return e},K=e=>{B(e,"connectedCallback")},Q=(e,t={})=>{var n;const l=[],o=t.exclude||[],s=ue.customElements,i=de.head,c=i.querySelector("meta[charset]"),r=de.createElement("style"),a=[];let u,d=!0;Object.assign($e,t),$e.F=new URL(t.resourcesUrl||"./",de.baseURI).href,e.map((e=>{e[1].map((t=>{const n={$:t[0],v:t[1],U:t[2],H:t[3]};n.U=t[2],n.H=t[3],n.T=[],n.W={};const i=n.v,c=class extends HTMLElement{constructor(e){super(e),se(e=this,n)}connectedCallback(){u&&(clearTimeout(u),u=null),d?a.push(this):$e.jmp((()=>(e=>{if(0==(1&$e.$)){const t=le(e),n=t.O,l=()=>{};if(1&t.$)X(e,t,n.H),K(t.C);else{t.$|=1,12&n.$&&(e=>{const t=e["s-cr"]=de.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){A(t,t.j=n);break}}n.U&&Object.entries(n.U).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,o)=>{if(0==(32&t.$)){{if(t.$|=32,(o=fe(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(n.W=o.watchers,J(o,n,2),o.isProxied=!0);const e=()=>{};t.$|=8;try{new o(t)}catch(e){ce(e)}t.$&=-9,t.$|=128,e(),K(t.C)}if(o.style){let e=o.style;const t=w(n);if(!ae.has(t)){const l=()=>{};((e,t,n)=>{let l=ae.get(e);me&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,ae.set(e,l)})(t,e,!!(1&n.$)),l()}}}const s=t.j,i=()=>F(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,t,n)}l()}})(this)))}disconnectedCallback(){$e.jmp((()=>(()=>{if(0==(1&$e.$)){const e=le(this),t=e.C;e.q&&(e.q.map((e=>e())),e.q=void 0),B(t,"disconnectedCallback")}})()))}componentOnReady(){return le(this).V}};n._=e[0],o.includes(i)||s.get(i)||(l.push(i),s.define(i,J(c,n,1)))}))}));{r.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",r.setAttribute("data-styles","");const e=null!==(n=$e.R)&&void 0!==n?n:f(de);null!=e&&r.setAttribute("nonce",e),i.insertBefore(r,c?c.nextSibling:i.firstChild)}d=!1,a.length?a.map((e=>e.connectedCallback())):$e.jmp((()=>u=setTimeout(z,30)))},X=(e,t,n)=>{n&&n.map((([n,l,o])=>{const s=Z(e,n),i=Y(t,o),c=ee(n);$e.ael(s,l,i,c),(t.q=t.q||[]).push((()=>$e.rel(s,l,i,c)))}))},Y=(e,t)=>n=>{try{256&e.$?e.C[t](n):(e.M=e.M||[]).push([t,n])}catch(e){ce(e)}},Z=(e,t)=>4&t?de:e,ee=e=>0!=(2&e),te=e=>$e.R=e,ne=new WeakMap,le=e=>ne.get(e),oe=(e,t)=>ne.set(t.C=e,t),se=(e,t)=>{const n={$:0,h:e,O:t,D:new Map};return n.A=new Promise((e=>n.N=e)),n.V=new Promise((e=>n.L=e)),e["s-p"]=[],e["s-rc"]=[],X(e,n,t.H),ne.set(e,n)},ie=(e,t)=>t in e,ce=(e,t)=>(0,console.error)(e,t),re=new Map,fe=e=>{const t=e.v.replace(/-/g,"_"),n=e._,l=re.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(re.set(n,e),e[t])),ce)
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},ae=new Map,ue="undefined"!=typeof window?window:{},de=ue.document||{head:{}},$e={$:0,F:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},pe=e=>Promise.resolve(e),me=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),ye=[],he=[],be=(e,t)=>n=>{e.push(n),s||(s=!0,t&&4&$e.$?ke(we):$e.raf(we))},ve=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){ce(e)}e.length=0},we=()=>{ve(ye),ve(he),(s=ye.length>0)&&$e.raf(we)},ke=e=>pe().then(e),ge=be(he,!0);export{d as H,Q as b,h as c,y as g,a as h,pe as p,oe as r,te as s}