UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

8 lines (7 loc) 8.04 kB
"use strict"; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ var t;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=window,i=e.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,n="$lit$",o=`lit$${(Math.random()+"").slice(9)}$`,l="?"+o,r=`<${l}>`,h=document,d=()=>h.createComment(""),$=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u="[ \t\n\f\r]",A=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,c=/-->/g,_=/>/g,v=RegExp(`>|${u}(?:([^\\s"'>=/]+)(${u}*=${u}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,m=/^(?:script|style|textarea|title)$/i,f=(b=1,(t,...e)=>({_$litType$:b,strings:t,values:e})),y=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),H=new WeakMap,N=h.createTreeWalker(h,129,null,!1);var b;class S{constructor({strings:t,_$litType$:e},h){let $;this.parts=[];let a=0,u=0;const f=t.length-1,y=this.parts,[x,H]=((t,e)=>{const i=t.length-1,l=[];let h,d=2===e?"<svg>":"",$=A;for(let s=0;s<i;s++){const e=t[s];let i,a,u=-1,f=0;for(;f<e.length&&($.lastIndex=f,a=$.exec(e),null!==a);)f=$.lastIndex,$===A?"!--"===a[1]?$=c:void 0!==a[1]?$=_:void 0!==a[2]?(m.test(a[2])&&(h=RegExp("</"+a[2],"g")),$=v):void 0!==a[3]&&($=v):$===v?">"===a[0]?($=null!=h?h:A,u=-1):void 0===a[1]?u=-2:(u=$.lastIndex-a[2].length,i=a[1],$=void 0===a[3]?v:'"'===a[3]?g:p):$===g||$===p?$=v:$===c||$===_?$=A:($=v,h=void 0);const y=$===v&&t[s+1].startsWith("/>")?" ":"";d+=$===A?e+r:u>=0?(l.push(i),e.slice(0,u)+n+e.slice(u)+o+y):e+o+(-2===u?(l.push(void 0),s):y)}const a=d+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==s?s.createHTML(a):a,l]})(t,e);if(this.el=S.createElement(x,h),N.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==($=N.nextNode())&&y.length<f;){if(1===$.nodeType){if($.hasAttributes()){const t=[];for(const e of $.getAttributeNames())if(e.endsWith(n)||e.startsWith(o)){const i=H[u++];if(t.push(e),void 0!==i){const t=$.getAttribute(i.toLowerCase()+n).split(o),e=/([.?@])?(.*)/.exec(i);y.push({type:1,index:a,name:e[2],strings:t,ctor:"."===e[1]?E:"?"===e[1]?B:"@"===e[1]?P:w})}else y.push({type:6,index:a})}for(const e of t)$.removeAttribute(e)}if(m.test($.tagName)){const t=$.textContent.split(o),e=t.length-1;if(e>0){$.textContent=i?i.emptyScript:"";for(let i=0;i<e;i++)$.append(t[i],d()),N.nextNode(),y.push({type:2,index:++a});$.append(t[e],d())}}}else if(8===$.nodeType)if($.data===l)y.push({type:2,index:a});else{let t=-1;for(;-1!==(t=$.data.indexOf(o,t+1));)y.push({type:7,index:a}),t+=o.length-1}a++}}static createElement(t,e){const i=h.createElement("template");return i.innerHTML=t,i}}function T(t,e,i=t,s){var n,o,l,r;if(e===y)return e;let h=void 0!==s?null===(n=i._$Co)||void 0===n?void 0:n[s]:i._$Cl;const d=$(e)?void 0:e._$litDirective$;return(null==h?void 0:h.constructor)!==d&&(null===(o=null==h?void 0:h._$AO)||void 0===o||o.call(h,!1),void 0===d?h=void 0:(h=new d(t),h._$AT(t,i,s)),void 0!==s?(null!==(l=(r=i)._$Co)&&void 0!==l?l:r._$Co=[])[s]=h:i._$Cl=h),void 0!==h&&(e=T(t,h._$AS(t,e.values),h,s)),e}class C{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:s}=this._$AD,n=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:h).importNode(i,!0);N.currentNode=n;let o=N.nextNode(),l=0,r=0,d=s[0];for(;void 0!==d;){if(l===d.index){let e;2===d.type?e=new M(o,o.nextSibling,this,t):1===d.type?e=new d.ctor(o,d.name,d.strings,this,t):6===d.type&&(e=new U(o,this,t)),this.u.push(e),d=s[++r]}l!==(null==d?void 0:d.index)&&(o=N.nextNode(),l++)}return n}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class M{constructor(t,e,i,s){var n;this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cm=null===(n=null==s?void 0:s.isConnected)||void 0===n||n}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=T(this,t,e),$(t)?t===x||null==t||""===t?(this._$AH!==x&&this._$AR(),this._$AH=x):t!==this._$AH&&t!==y&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>a(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}g(t){this._$AH!==x&&$(this._$AH)?this._$AA.nextSibling.data=t:this.T(h.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.p(i);else{const t=new C(n,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=H.get(t.strings);return void 0===e&&H.set(t.strings,e=new S(t)),e}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new M(this.S(d()),this.S(d()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class w{constructor(t,e,i,s,n){this.type=1,this._$AH=x,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=T(this,t,e,0),o=!$(t)||t!==this._$AH&&t!==y,o&&(this._$AH=t);else{const s=t;let l,r;for(t=n[0],l=0;l<n.length-1;l++)r=T(this,s[i+l],e,l),r===y&&(r=this._$AH[l]),o||(o=!$(r)||r!==this._$AH[l]),r===x?t=x:t!==x&&(t+=(null!=r?r:"")+n[l+1]),this._$AH[l]=r}o&&!s&&this.j(t)}j(t){t===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class E extends w{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===x?void 0:t}}const I=i?i.emptyScript:"";class B extends w{constructor(){super(...arguments),this.type=4}j(t){t&&t!==x?this.element.setAttribute(this.name,I):this.element.removeAttribute(this.name)}}class P extends w{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=T(this,t,e,0))&&void 0!==i?i:x)===y)return;const s=this._$AH,n=t===x&&s!==x||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==x&&(s===x||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class U{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){T(this,t)}}const R=e.litHtmlPolyfillSupport;null==R||R(S,M),(null!==(t=e.litHtmlVersions)&&void 0!==t?t:e.litHtmlVersions=[]).push("2.7.0");exports.html=f,exports.noChange=y,exports.nothing=x,exports.render=(t,e,i)=>{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let l=o._$litPart$;if(void 0===l){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=l=new M(e.insertBefore(d(),t),t,void 0,null!=i?i:{})}return l._$AI(t),l};