litos-ui 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base.d.ts +2 -2
- package/lib/base.js +2 -1
- package/lib/browser.d.ts +2 -0
- package/lib/button/index.js +10 -11
- package/lib/color_picker/index.d.ts +0 -1
- package/lib/color_picker/index.js +15 -15
- package/lib/form/form_inner.js +25 -25
- package/lib/form/form_item.js +1 -1
- package/lib/form/index.js +1 -1
- package/lib/icon/arrow_left.d.ts +5 -0
- package/lib/icon/arrow_left.js +13 -0
- package/lib/icon/arrow_right.d.ts +5 -0
- package/lib/icon/arrow_right.js +13 -0
- package/lib/icon/arrow_up.d.ts +6 -0
- package/lib/icon/arrow_up.js +16 -0
- package/lib/icon/base.js +13 -13
- package/lib/icon/theme_default.d.ts +6 -0
- package/lib/icon/theme_default.js +16 -0
- package/lib/index-116dRdDj.js +4 -0
- package/lib/index-BUyxD_nH.js +4 -0
- package/lib/{index-1Gw78Uze.js → index-Bl8lRTJd.js} +1 -1
- package/lib/index-DJ70Xyma.js +4 -0
- package/lib/index.d.ts +18 -1
- package/lib/index.js +82 -60
- package/lib/input/index.d.ts +1 -1
- package/lib/input/index.js +14 -14
- package/lib/list/index.js +1 -1
- package/lib/litos-ui.css +1 -1
- package/lib/litos-ui.min.js +1 -1
- package/lib/message/index.js +27 -27
- package/lib/polygon/index.js +1 -1
- package/lib/popover/index.d.ts +34 -0
- package/lib/popover/index.js +153 -0
- package/lib/radio/index.d.ts +1 -0
- package/lib/radio/index.js +61 -49
- package/lib/select_ori/index.js +1 -1
- package/lib/switch/index.d.ts +2 -5
- package/lib/switch/index.js +45 -48
- package/lib/tabbar/index.js +1 -1
- package/lib/theme/index.d.ts +12 -0
- package/lib/theme/index.js +95 -0
- package/lib/theme/theme_color.d.ts +9 -0
- package/lib/theme/theme_color.js +40 -0
- package/lib/utils/clickoutside.d.ts +5 -0
- package/lib/utils/clickoutside.js +22 -0
- package/lib/utils/index.d.ts +88 -0
- package/lib/utils/index.js +139 -0
- package/lib/utils/transition.js +58 -0
- package/package.json +69 -68
- package/styles/animation.css +13 -0
- package/styles/container.css +51 -0
- package/styles/scrollbar.css +23 -0
- package/styles/transition.css +33 -0
- package/lib/event.d.ts +0 -30
- package/lib/index-CPpMuwU3.js +0 -4
- package/lib/transition.d.ts +0 -15
- package/lib/transition.js +0 -52
- package/lib/util.d.ts +0 -42
- package/lib/util.js +0 -67
- /package/lib/{event.js → utils/event.js} +0 -0
package/lib/litos-ui.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var me=Object.defineProperty;var zt=g=>{throw TypeError(g)};var pe=(g,p,v)=>p in g?me(g,p,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[p]=v;var l=(g,p,v)=>pe(g,typeof p!="symbol"?p+"":p,v),be=(g,p,v)=>p.has(g)||zt("Cannot "+v);var Ft=(g,p,v)=>p.has(g)?zt("Cannot add the same private member more than once"):p instanceof WeakSet?p.add(g):p.set(g,v);var D=(g,p,v)=>(be(g,p,"access private method"),v);(function(){"use strict";var Q,L,X,tt;const g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",p="0123456789";function v(i,r=!0){return i==null?!0:(r&&typeof i=="string"?i.trim().length:i.length)===0}function Bt(i,r){r={isPositive:!1,isFloat:!0,...r};const t=r.isPositive?"[+]?":"[+-]?",e=r.isFloat?"([0-9]*[.])?[0-9]+":"[0-9]+";return new RegExp("^"+t+e+"$").test(i)}function E(i){if(typeof i=="object"&&i.min!=null&&i.max!=null){const r=Math.random(),t=i.hasEnd?1:0,e=r*(i.max-i.min+t)+i.min;return i.isInteger!==!1?Math.floor(e):e}else{if(typeof i=="object"&&i.length==null)throw new Error("random_length_cannot_null");let r=typeof i=="object"?i.length:i,t=g;typeof i=="object"&&i.hasLetter===!1&&(t=p);const e=Array.from({length:r},()=>t.charAt(E({min:0,max:t.length-1,hasEnd:!0}))).join("");return typeof i=="object"&&i.firstIsZero===!1&&e.indexOf("0")===0?E(i):e}}let Dt=-1,et={prefix:"l"};function m(i,r){const t=`${et.prefix}-${i.baseName}`;customElements.get(t)||customElements.define(t,i)}function Pt(){return`${et.prefix}-${++Dt}`}function _(i,r,t){if(i==null)return r;switch(typeof r){case"boolean":return i===""||i==="true"||i==="1"||i===t;case"number":return Number(i);default:return i}}function y(i){const r=i.attributes;for(const t of r){const{name:e,value:s}=t;if(e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("_")||e.startsWith("$"))continue;const a=e.split("-").map((c,d)=>d===0?c:c[0].toUpperCase()+c.slice(1)).join(""),o=_(s,i[a],e);i[a]=o,e==="value"&&(i._resetValue=o)}}function k(i,r){let t=" ";return r===!0?t=` ${i}`:typeof r=="string"&&!v(r)&&(t=` ${i}="${r}"`),t}function qt(i){return i.map(t=>k(t[0],t[1])).join("")}function jt(i,r){for(const t of r){const e=t[1],s=t[0];e===!0?i.setAttribute(s,""):typeof e=="string"&&!v(e)&&i.setAttribute(s,e)}}function st(i,r){return typeof i=="string"?(r||document).querySelectorAll(i):[i]}function z(i,r){return st(i,r)}function S(i,r={},t){let e;if(i.startsWith("<")&&i.endsWith(">")?e=new DOMParser().parseFromString(i,"text/html").body.firstElementChild:e=document.createElement(i),e&&r)for(const s in r){const n=r[s];s==="class"?e.className=A(n):s==="style"?e.style.cssText=H(n):s==="textContent"&&n?e.textContent=n:s==="innerHTML"&&n?e.innerHTML=n:s==="outerHTML"&&n?e.outerHTML=n:n===!0?e.setAttribute(s,""):typeof n=="string"&&e.setAttribute(s,n)}return e}function f(i,r){const t=st(i,r);return t.length>0?t[0]:void 0}function x(i,r){i.classList.add(r)}function M(i,r){i.classList.remove(r)}function O(i,r){return i.classList.contains(r)}function Wt(i,r){O(i,r)?M(i,r):x(i,r)}function N(i,r,t,e){i.addEventListener(r,t,e)}function T(i,r,t,e){i.removeEventListener(r,t,e)}function P(i,r){for(let t=0,e=i.length;t<e&&r(i[t],t)!==!0;t++);}function K(i,r,t){const e=i.getAttribute(r);if(t==null)return e;const s=typeof t;return e==null?t:s==="bigint"||s==="number"?e===""?t:Number(e):s==="boolean"?e===""||e==="1"||e==="true"||e===r:s==="object"?e===""?t:JSON.parse(e):e}function Ot(i,r=null,t="horizontal"){r==null&&(r=i.offsetParent);const e=r.getBoundingClientRect(),s=i.getBoundingClientRect();let n=t==="horizontal"?s.left:s.top,a=t==="horizontal"?s.right:s.bottom,o=t==="horizontal"?e.left:e.top,c=t==="horizontal"?e.right:e.bottom;return n>=o&&a<=c}function A(i){let r="";if(Array.isArray(i))for(let t=0,e=i.length;t<e;t++){const s=i[t];s&&(r+=`${s} `)}else if(typeof i=="string")r=i;else for(const t in i)i[t]&&(r+=`${t} `);return r.trim()}function H(i){let r="";if(Array.isArray(i))for(let t=0,e=i.length;t<e;t++){const s=i[t];s&&(r+=`${s};`)}else if(typeof i=="string")r=i;else for(const t in i){const e=i[t];e&&(r+=`${t}:${e};`)}return r}function Kt(i,r,t){i.style.setProperty("display","none");const e=[];for(let s=0,n=r.length;s<n;s++){const a=r[s];i.style.setProperty(a[0],a[1]),e.push(`${a[0]} ${t}`)}i.style.removeProperty("display"),requestAnimationFrame(()=>{for(let s=0,n=r.length;s<n;s++){const a=r[s];i.style.removeProperty(a[0])}})}function Ut(i,r,t){for(let e=0,s=r.length;e<s;e++){const n=r[e];i.style.setProperty(n[0],n[1])}i.addEventListener("transitionend",()=>{i.style.display="none";for(let e=0,s=r.length;e<s;e++){const n=r[e];i.style.removeProperty(n[0])}t!=null&&t()},{once:!0})}class w extends HTMLElement{constructor(t=!0){super();l(this,"rendered",!1);t&&this.attachShadow({mode:"open"})}static get observedAttributes(){return[]}attributeChangedCallback(t,e,s){}get shadow(){return this.shadowRoot}get root(){return this.shadowRoot||this}createStyle(t){const e=document.createElement("style");e.textContent=t.trim(),this.root.appendChild(e)}createLink(t){const e=document.createElement("link");e.rel="stylesheet",e.href=t,this.root.appendChild(e)}loadStyle(t){{let e=document.querySelector("#litos-ui-style");e?this.createLink(e.href):queueMicrotask(()=>{e=document.querySelector("#litos-ui-style"),e&&this.createLink(e.href)})}}loadExternalStyle(t){}loadStyleText(t){this.createStyle(t)}getAttr(t,e){return K(this,t,e)}appendToRoot(t){if(t)if(typeof t=="string"){let e=document.createElement("div");e.innerHTML=t,this.root.append(...e.children),e=void 0}else t.length?this.root.append(...t):this.root.append(t)}connectedCallback(){this.appendToRoot(this.render()),this.rendered=!0}disconnectedCallback(){}render(){}}l(w,"baseName","base-component");class b extends w{constructor(){super();l(this,"useLink");l(this,"viewBox");this.useLink=!1,this.viewBox="0 0 1024 1024"}connectedCallback(){this.loadStyle(["icon"]),this.render()}render(){const t=this.createEl("svg"),e=this.getAttr("useLink",this.useLink),s=this.getAttr("viewBox",this.viewBox);t.classList.add("l-icon"),e||t.setAttribute("viewBox",s);const n=this.renderChildren();if(typeof n=="string")if(n===""){const a=this.children,o=[];for(let c=0,d=a.length;c<d;c++){const h=a[c];o.push(h.outerHTML),t.appendChild(h)}t.innerHTML=o.join("")}else t.innerHTML=n;else t.append(n);this.shadow.appendChild(t)}renderChildren(){return""}createEl(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}l(b,"baseName","base-icon");let U=(Q=class extends b{renderChildren(){return'<path d="M520.665 64.564a29.244 29.244 0 0 0-7.071-.894c-16.211 0-29.35 13.14-29.35 29.35 0 15.83 12.538 28.696 28.223 29.293v.073c.375 0 .751-.014 1.127-.014 216.493 0 389.629 173.942 389.629 390.433 0 216.496-173.136 388.827-389.63 388.827s-389.63-172.333-389.63-388.829c0-.27.01-.536.01-.804h-.01c0-16.209-13.141-29.35-29.35-29.35s-29.35 13.139-29.35 29.35c0 .055.007.11.007.164-.001.214-.007.425-.007.64 0 247.609 200.722 448.331 448.33 448.331 247.607 0 448.33-200.722 448.33-448.33-.002-245.242-196.917-444.456-441.258-448.24z" fill="currentColor"></path>'}},l(Q,"baseName","loading-icon"),Q);const q=2,Yt=.16,Gt=.05,Jt=.05,Zt=.15,Qt=/rgba?\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)/,it=/^#(?:([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})|([0-9A-Fa-f]{1})([0-9A-Fa-f]{1})([0-9A-Fa-f]{1}))$/;function Xt(i){return i.r!=null&&i.g!=null&&i.b!=null}function rt(i){return i.h!=null&&i.s!=null&&i.v!=null}function te(i){let r=i.match(Qt);if(r!=null){const t=parseInt(r[1].trim()),e=parseInt(r[2].trim()),s=parseInt(r[3].trim());if(isNaN(t)||isNaN(e)||isNaN(s))throw new Error("Invalid RGB color.");let n=1;return r[4]!=null&&(n=parseFloat(r[4].trim()),isNaN(n)&&(n=1)),{r:t,g:e,b:s,a:n}}}function ee(i){const r=i.match(it);if(r!=null){const t=r[4]!==void 0,e=parseInt(t?r[4]+r[4]:r[1],16),s=parseInt(t?r[5]+r[5]:r[2],16),n=parseInt(t?r[6]+r[6]:r[3],16);return{r:e,g:s,b:n}}}function Y(i){if(typeof i=="string"){let r=ee(i);if(r==null&&(r=te(i)),r!=null)return r;throw new Error("Invalid color string")}else{if(Xt(i))return i;if(rt(i))return ie(i);throw new Error("Invalid color")}}function se(i){if(rt(i))return i;const r=Y(i),t=r.r/255,e=r.g/255,s=r.b/255;let n=Math.max(t,e,s),a=Math.min(t,e,s),o=n-a,c=n,d=n===0?0:o/n,h=0;if(n===a)h=0;else switch(n){case t:h=((e-s)/o+(e<s?6:0))/6;break;case e:h=((s-t)/o+2)/6;break;case s:h=((t-e)/o+4)/6;break}return h=h*360,{h,s:d,v:c}}function ie(i){let r=i.s,t=i.v;r>1&&(r/=100),t>1&&(t/=100);const e=i.h;var s=Math.floor(e/60)%6,n=e/60-Math.floor(e/60),a=t*(1-r),o=t*(1-n*r),c=t*(1-(1-n)*r);let d=0,h=0,C=0;switch(s){case 0:d=t,h=c,C=a;break;case 1:d=o,h=t,C=a;break;case 2:d=a,h=t,C=c;break;case 3:d=a,h=o,C=t;break;case 4:d=c,h=a,C=t;break;case 5:d=t,h=a,C=o;break}return d=Math.round(d*255),h=Math.round(h*255),C=Math.round(C*255),{r:d,g:h,b:C}}function re(i,r,t){let e;return Math.round(i.h)>=60&&Math.round(i.h)<=240?e=t?Math.round(i.h)-q*r:Math.round(i.h)+q*r:e=t?Math.round(i.h)+q*r:Math.round(i.h)-q*r,e<0?e+=360:e>=360&&(e-=360),e}function ne(i,r,t){if(i.h===0&&i.s===0)return i.s;let e;return t?e=i.s-Yt*r:e=i.s+Gt*r,e>1&&(e=1),e<.06&&(e=.06),Number(e.toFixed(2))}function ae(i,r,t){let e;return t?e=i.v+Jt*r:e=i.v-Zt*r,e>1&&(e=1),Number(e.toFixed(2))}function nt(i){const r=t=>t.toString(16).padStart(2,"0");return`#${r(i.r)}${r(i.g)}${r(i.b)}`.toUpperCase()}function le(i){return typeof i=="string"&&it.test(i)?i:nt(Y(i))}function at(i,r=1,t=!0){const e=se(i);return le({h:re(e,r,t),s:ne(e,r,t),v:ae(e,r,t)})}m(U);class lt extends w{constructor(){super();l(this,"htmlType","button");l(this,"_handleClick",t=>{const e=t.target,s=K(e,"html-type");if(s==="reset"||s==="submit"){const n=this._getForm();n&&(s==="reset"?n.reset():s==="submit"&&n.submit())}});y(this)}static get observedAttributes(){return["loading","color"]}attributeChangedCallback(t,e,s){const n=f(".l-button",this.root);if(n){if(t==="loading")_(s,!1,t)?(x(n,"l-btn-loading"),n.disabled=!0,n.innerHTML=this.loadingBody()):(M(n,"l-btn-loading"),n.disabled=this.getAttr("disabled",!1),n.innerHTML="<slot></slot>");else if(t==="color"){const a=this.getAttr("text",!1),o=this.getAttr("ghost",!1);n.style.cssText=this.applyColor(s,a,o)}}}connectedCallback(){this.loadStyle(["button"]),this.loadExternalStyle(["animation"]),this.render(),(this.htmlType==="reset"||this.htmlType==="submit")&&N(this,"click",this._handleClick)}disconnectedCallback(){super.disconnectedCallback(),(this.htmlType==="reset"||this.htmlType==="submit")&&T(this,"click",this._handleClick)}render(){const t=this.getAttr("type","normal"),e=document.createElement("button"),s=this.getAttr("loading",!1),n=this.getAttr("shape","default"),a=this.getAttr("text",!1),o=this.getAttr("ghost",!1),c=["l-btn",`l-btn-${t}`,this.getAttr("block",!1)?"l-btn-block":"",n==="round"?"l-btn-round":"",n==="circle"?"l-btn-circle":"",o?"l-btn-ghost":"",a?"l-btn-text":"",s?"l-btn-loading":""];e.className=A(c),e.disabled=this.getAttr("disabled",!1)||s,e.type=this.getAttr("html-type","button");const d=this.applyColor(this.getAttr("color"),a,o);d&&(e.style.cssText=d),s?e.innerHTML=this.loadingBody():e.innerHTML="<slot></slot>",e.setAttribute("part","default"),this.root.appendChild(e)}loadingBody(){const t=this.getAttr("loading-text",""),e=['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];return t===""?e.push("<slot></slot>"):e.push(`<span>${t}</span>`),e.join("")}applyColor(t,e=!1,s=!1){if(!t)return"";const n=at(t,1,!0),a=at(t,3,!1);return H({"--l-btn-border-color":e?"transparent":t,"--l-btn-text-color":s||e?t:"#ffffff","--l-btn-hover-text-color":s||e?n:"#ffffff","--l-btn-background":s||e?"transparent":t,"--l-btn-active-text-color":s||e?a:"#ffffff","--l-btn-hover-border-color":e?"transparent":n,"--l-btn-hover-background":s||e?"transparent":n,"--l-btn-active-background":s||e?"transparent":a,"--l-btn-active-border-color":e?"transparent":a})}_getForm(){let t=this.parentElement,e;for(;t!=null;){const s=t.tagName;if(s==="L-FORM"){e=t;break}if(s==="BODY")break;t=t.parentElement}return t=null,e}}l(lt,"baseName","button");let u;function I(i,r,t){u==null&&(u=new Map),u.has(i)||u.set(i,new Map([[r,new Set]])),u.get(i).has(r)||u.get(i).set(r,new Set),u.get(i).get(r).add(t)}function F(i,r,t){var e,s,n,a,o,c;(s=(e=u==null?void 0:u.get(i))==null?void 0:e.get(r))==null||s.delete(t),((a=(n=u==null?void 0:u.get(i))==null?void 0:n.get(r))==null?void 0:a.size)==0&&((o=u.get(i))==null||o.delete(r)),((c=u==null?void 0:u.get(i))==null?void 0:c.size)==0&&u.delete(i),(u==null?void 0:u.size)==0&&(u=void 0)}function ot(i){i==null?u!=null&&(u.clear(),u=void 0):u!=null&&(u.delete(i),u.size===0&&(u=void 0))}function $(i,r,...t){var s;const e=(s=u==null?void 0:u.get(i))==null?void 0:s.get(r);if(e!=null)for(const n of e)n(...t)}class B extends w{constructor(t=!0){super();l(this,"disabled",!1);l(this,"name");l(this,"formAttrs",{});l(this,"formItemAttrs",{});l(this,"_value","");l(this,"_resetValue");l(this,"_firstPushValue",!0);l(this,"_reseting",!1);l(this,"_formAttributeChanged",(t,e,s)=>{s===this.formAttrs.formId?this.formAttrs[t]=e:this.formItemAttrs[t]=e,t==="disabled"&&this._changeDisabled()});l(this,"_resetFieldValue",()=>{this._reseting=!0,this.reset()});this._firstPushValue=t}set value(t){this.setValue(t)}get value(){return this.getValue()}setValue(t){this._value=t,this.pushValueChange()}getValue(){return this._value}static get observedAttributes(){return["disabled"]}attributeChangedCallback(t,e,s){if(t==="disabled"){const n=_(s,!1,t);n!==this.disabled&&(this._changeDisabled(),this.disabled=n)}else this.attributeChange(t,e,s)}attributeChange(t,e,s){}connectedCallback(){const t=this._getForm();this.formAttrs=t.formAttr,this.formItemAttrs=t.formItemAttr,this.formAttrs.id&&(I(this.formAttrs.id,"attributeChanged",this._formAttributeChanged),I(this.formAttrs.id,"reset",this._resetFieldValue),this._firstPushValue&&this.pushValueChange()),this.formItemAttrs.id&&I(this.formItemAttrs.id,"attributeChanged",this._formAttributeChanged),super.connectedCallback()}disconnectedCallback(){this.formAttrs.id&&(F(this.formAttrs.id,"attributeChanged",this._formAttributeChanged),F(this.formAttrs.id,"reset",this._resetFieldValue)),this.formItemAttrs.id&&F(this.formItemAttrs.id,"attributeChanged",this._formAttributeChanged)}isDisabled(){return this.disabled===!0||this.formItemAttrs.disabled===!0?!0:this.formAttrs.disabled||!1}getName(){return this.name?this.name:this.formItemAttrs.name}_getForm(){let t=this.parentElement,e={},s={};for(;t!=null;){const n=t.tagName;if(n==="L-FORM"){const a=t.sharedAttrs;for(let o=0;o<a.length;o++){const c=a[o];e[c]=t[c]}break}if(n==="BODY")break;if(n==="L-FORM-ITEM"){const a=t.sharedAttrs;for(let o=0;o<a.length;o++){const c=a[o];s[c]=t[c]}}t=t.parentElement}return t=null,{formAttr:e,formItemAttr:s}}_changeDisabled(){}pushValueChange(){const t=this.getName();this.formAttrs.id&&t&&$(this.formAttrs.id,"valueChange",t,this._value,!this._reseting),this._reseting=!1}reset(){this.value=this._resetValue||""}}class ct extends B{constructor(){super();l(this,"type","text");l(this,"placeholder");l(this,"autosize",!1);l(this,"allowInput");l(this,"parser");l(this,"width");l(this,"block",!1);l(this,"error",!1);l(this,"$input");l(this,"_input",t=>{const e=t.target;let s=e.value;if(this.allowInput!=null){let n=this.allowInput.indexOf("."),a=n===-1?n:parseInt(this.allowInput.substring(n+1));s=this._numberInputParse(s,{integer:this.allowInput.includes("integer"),negative:this.allowInput.startsWith("-"),precition:a}),s=String(s),e.value=s}this.parser!=null&&(s=this.parser(s),e.value=s),this.setValue(s)});l(this,"_validateChange",(t,e)=>{const s=this.getName();if(s){const n=t===!0?!1:t[s]!=null;(e==null||e===s&&this.error!=n)&&(this.error=n,this._updateError()),Object.keys(t)[0]===s&&this.focus()}});y(this)}set value(t){this.setValue(t),this.$input!=null&&(this.$input.value=this.value)}get value(){return this.getValue()}static get observedAttributes(){return["disabled","error"]}connectedCallback(){super.connectedCallback(),this.loadStyle(["input"])}disconnectedCallback(){super.disconnectedCallback(),this.formAttrs.id&&F(this.formAttrs.id,"validateChange",this._validateChange),T(this.$input,"input",this._input),this.$input=void 0}attributeChange(t,e,s){if(t==="error"){const n=_(s,!1,t);n!==this.error&&(this.error=n,this._updateError())}}render(){let t=k("value",this.value);const e=k("placeholder",this.placeholder),s=k("disabled",this.isDisabled()),n=A({"l-input":!0,"is-autosize":this.autosize,"is-error":this.error}),a=this.getName(),o=k("name",a),c=`${t}${o}${e}${s}`;this.shadow.innerHTML=`<input part="default" type="${this.type}" class="${n}"${c}></input>`,this.$input=f("input",this.root),N(this.$input,"input",this._input),this.style.cssText=H(this._getStyleObj())+this.getAttr("style",""),a&&this.formAttrs.id&&I(this.formAttrs.id,"validateChange",this._validateChange)}setParser(t){this.parser=t}focus(){var t;(t=this.$input)==null||t.focus()}_changeDisabled(){this.$input!=null&&(this.$input.disabled=this.isDisabled())}_numberInputParse(t,e){let s=t,n=e.negative?"-?":"";if(e.integer){const o=s.match(new RegExp(`^(${n}\\d*)`));return o!=null?o[1]:s.substring(0,s.length-1)}const a=s.match(new RegExp(`(${n}\\d+\\.\\d{0,${e.precition}})|(${n}\\d*)`));return a!=null?s=a[1]||a[2]:s="",a!=null?a[1]||a[2]:""}_getStyleObj(){const t={};return this._isBlock()&&(t["--l-input-width"]="100%"),this.width&&(t["--l-input-width"]=this.width),t}_isBlock(){if(this.block===!0||this.formItemAttrs.innerBlock===!0||this.formAttrs.innerBlock===!0)return!0}_updateError(){this.$input&&(this.error?x(this.$input,"is-error"):M(this.$input,"is-error"))}}l(ct,"baseName","input");class ht extends b{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>'}}l(ht,"baseName","arrow-down-icon");class dt extends b{renderChildren(){return'<path fill="currentColor" d="M512 320 192 704h639.936z"></path>'}}l(dt,"baseName","caret-top-icon");class ut extends b{renderChildren(){return'<path fill="currentColor" d="m192 384 320 384 320-384z"></path>'}}l(ut,"baseName","caret-bottom-icon");class ft extends b{constructor(){super();l(this,"_t");l(this,"_start");this.useLink=!0,this._t=void 0,this._start=0}renderChildren(){return""}render(){super.render()}disconnectedCallback(){this._t!=null&&(cancelAnimationFrame(this._t),this._t=void 0)}connectedCallback(){super.connectedCallback();const t=this.getAttribute("name");this._start=Date.now(),t&&this._loadIcon(t)}_loadIcon(t){Date.now()-this._start>=1e4||(this._t=requestAnimationFrame(()=>{const s=document.querySelector(`#${t}`);if(s==null){this._loadIcon(t);return}this._t=void 0;let n=s.getAttribute("viewBox");n||(n="0 0 1024 1024");const a=this.shadow.querySelector("svg");a!=null&&(a.setAttribute("viewBox",n),a.innerHTML=s.innerHTML)}))}}l(ft,"baseName","font-icon");class mt extends b{renderChildren(){return'<path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"></path>'}}l(mt,"baseName","search-icon");class pt extends b{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"></path>'}}l(pt,"baseName","sun-icon");class bt extends b{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"></path>'}}l(bt,"baseName","moon-icon");class gt extends b{constructor(){super()}renderChildren(){return'<path d="M1039.92888889 967.11111111L1039.92888889 56.88888889c0-40.15900445-32.65877333-72.81777778-72.81777778-72.81777778l-910.22222222 0c-40.15900445 0-72.81777778 32.65877333-72.81777778 72.81777778l0 910.22222222c0 40.15900445 32.65877333 72.81777778 72.81777778 72.81777778L967.11111111 1039.92888889c40.15900445 0 72.81777778-32.65877333 72.81777778-72.81777778zM56.88888889 56.88888889L967.11111111 56.88888889l0 910.22222222-910.22222221 0.07281778L56.88888889 56.88888889z"></path><path d="M876.08888889 349.17944888a36.40888889 36.40888889 0 0 0-36.40888889-36.40888889l-120.47701333 1e-8L719.20298668 184.32a36.40888889 36.40888889 0 0 0-72.81777779 0l0 164.85944889a36.40888889 36.40888889 0 0 0 36.40888889 36.40888889L839.68 385.58833778a36.40888889 36.40888889 0 0 0 36.40888889-36.4088889z m-156.88590221 473.27914667L719.20298667 694.04444445 839.68 694.04444445a36.40888889 36.40888889 0 1 0 0-72.81777778l-156.88590222 0a36.40888889 36.40888889 0 0 0-36.40888889 36.40888888l0 164.82304a36.40888889 36.40888889 0 1 0 72.81777779 0zM366.36444445 349.17944888L366.36444445 184.32a36.40888889 36.40888889 0 1 0-72.81777778 0l0 128.45055999-120.51342222 1e-8a36.40888889 36.40888889 0 1 0 0 72.81777778L329.95555555 385.58833778a36.40888889 36.40888889 0 0 0 36.4088889-36.4088889z m0 473.27914667L366.36444445 657.63555555a36.40888889 36.40888889 0 0 0-36.4088889-36.40888888l-156.9223111-1e-8a36.40888889 36.40888889 0 1 0 0 72.81777779L293.54666667 694.04444445l0 128.4141511a36.40888889 36.40888889 0 1 0 72.81777778 0z"></path>'}}l(gt,"baseName","reduction-icon");class vt extends b{constructor(){super()}renderChildren(){return'<path d="M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"></path>'}}l(vt,"baseName","refresh-left-icon");class Ct extends b{renderChildren(){return'<path d="M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"></path>'}}l(Ct,"baseName","refresh-right-icon");class $t extends b{renderChildren(){return'<path d="M384 96a32 32 0 0 1 64 0v786.752a32 32 0 0 1-54.592 22.656L95.936 608a32 32 0 0 1 0-45.312h.128a32 32 0 0 1 45.184 0L384 805.632zm192 45.248a32 32 0 0 1 54.592-22.592L928.064 416a32 32 0 0 1 0 45.312h-.128a32 32 0 0 1-45.184 0L640 218.496V928a32 32 0 1 1-64 0V141.248z"></path>'}}l($t,"baseName","sort-icon");class _t extends b{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path fill="currentColor" d="M12 23a11 11 0 100-22 11 11 0 000 22zM8.82 7.4L12 10.6l3.18-3.19 1.42 1.42L13.4 12l3.19 3.18-1.42 1.42L12 13.4 8.82 16.6 7.4 15.18 10.6 12 7.4 8.82 8.82 7.4z"></path>'}}l(_t,"baseName","mask-close-icon");class yt extends b{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 0C228.693333 0 0 228.693333 0 512s228.693333 512 512 512 512-228.693333 512-512S795.306667 0 512 0z m307.2 368.64L467.626667 730.453333c0 3.413333-3.413333 3.413333-3.413334 6.826667-13.653333 13.653333-37.546667 13.653333-51.2 0l-177.493333-177.493333c-13.653333-13.653333-13.653333-37.546667 0-51.2 13.653333-13.653333 37.546667-13.653333 51.2 0l150.186667 153.6 334.506666-341.333334c13.653333-13.653333 37.546667-13.653333 51.2 0 10.24 10.24 10.24 34.133333-3.413333 47.786667z m0 0"></path>'}}l(yt,"baseName","success-icon");class kt extends b{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 1024C229.234 1024 0 794.766 0 512S229.234 0 512 0s512 229.234 512 512-229.234 512-512 512z m-64.853-734.52l19.484 244.906 1.309 16.156c1.251 15.93 15.018 28.644 30.72 28.644h25.571c15.56 0 29.298-12.601 30.663-28.132l1.422-16.668 21.334-244.907c3.214-36.978-24.434-66.844-61.725-66.844h-6.627c-37.462 0-65.138 29.923-62.18 66.844zM512 801.393a66.788 66.788 0 1 0 0-133.575 66.788 66.788 0 0 0 0 133.575z"></path>'}}l(kt,"baseName","warn-icon");class xt extends b{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 64a448 448 0 110 896.064A448 448 0 01512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 01-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 017.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"></path>'}}l(xt,"baseName","info-icon"),m(_t),m(yt),m(kt),m(xt);const V=[],At=[["opacity","0"],["transform","translate3d(-50%, -100%, 0)"]];function Mt(i){const r=V.findIndex(n=>n.id===i);if(r===-1)return;const t=V.splice(r,1)[0];if(t==null)return;Ut(t,At,()=>{t.remove()});const e=15+t.offsetHeight,s=V.length;if(s!==0)for(let n=r;n<s;n++){const a=V[n],o=parseInt(a.style.top,10)-e;a.style.setProperty("top",`${o}px`)}}function oe(i){const r=document.createElement("div");r.id=i.id;const t=i.type||"info";let e=`l-message l-message-${t}`;i.customClass&&(e+=" "+i.customClass),r.className=e,r.style.setProperty("top",`${i.offset}px`),r.style.setProperty("z-index",`${i.zindex||1e3}`),i.width&&r.style.setProperty("width",i.width);let s=t;return s==="error"&&(s="mask-close"),r.innerHTML=['<div class="l-message-container">',`<l-${s}-icon class="l-message-icon"></l-${s}-icon>`,`<span class="l-message-content">${i.message}</span>`,"</div>"].join(""),r}const j=i=>{const r=V.reduce((a,o)=>a+o.offsetHeight+15,15),t=Pt(),e=typeof i=="string"?{message:i}:i;e.id=t,e.offset=r;const s=oe(e);V.push(s),document.body.appendChild(s),Kt(s,At,void 0);let n=e.duration;return n==null&&(n=3e3),n!==0&&setTimeout(()=>{Mt(t)},n),t};for(const i of["info","success","error","warn","show"])j[i]=r=>{const t=typeof r=="string"?{message:r}:r;return i!=="show"?t.type=i:t.type==null&&(t.type="info"),j(t)};j.close=Mt;const G={mobile:"请输入正确的手机号",same:"两次输入不一致",required:"%s为必填字段"},J="请输入正确的数据",R={same:/^same:(.+)$/i,mobile:/^1[345678]\d{9}$/,required:/^\S{1}.*/},Z={same(i,r){return r===i},pattern(i,r){return r==null?!1:i.test(String(r))}};class wt extends Error{constructor(r,t,e){super(e),this.name="ValidateError",this.key=t,this.detail=r}}class ce{constructor(r){this.rules={},this.addSchemas(r)}addSchemas(r){for(let t of r)this.rules[t.key]=this._parseSchemaRules(t)}addSchema(r){this.rules[r.key]=this._parseSchemaRules(r)}async validate(r,t=!1){return new Promise((e,s)=>{const n={};let a,o;for(let c in this.rules){let d=this._validateRule(this.rules[c],r[c],r);if(d!==""&&(d=d.replace("%s",c),n[c]=d,a=c,o=d,t))break}a==null?e(!0):s(new wt(n,a,o))})}async validateKey(r,t,e){return new Promise((s,n)=>{let a=this.rules[r];if(a==null){s({key:r,value:t});return}let o=this._validateRule(a,t,e);o!==""?(o=o.replace("%s",r),n(new wt({[r]:o},r,o))):s({key:r,value:t})})}_validateRule(r,t,e){let s="";for(let n of r)if(n.rule==="required"?(t==null||!Z.pattern(R.required,t))&&(s=n.message):typeof n.rule=="function"?n.rule(t)||(s=n.message):n.sameKey!=null?e!=null&&(Z.same(t,e[n.sameKey])||(s=n.message)):Z.pattern(n.rule,t)||(s=n.message),s!=="")break;return s}_parseSchemaRules(r){let t=[],e=r.rules;if(r.required===!0&&t.push(...this._parseStringRule("required",r.message)),e!=null)if(typeof e=="string")t=t.concat(this._parseStringRule(e,r.message));else if(e instanceof Array)for(let s of e)typeof s=="string"?t.push(...this._parseStringRule(s,r.message)):s instanceof RegExp||typeof s=="function"?t.push({rule:s,message:r.message||J}):typeof s.rule=="string"?t.push(...this._parseStringRule(s.rule,s.message)):t.push({rule:s.rule,message:s.message||J});else t.push({rule:e,message:J});return t}_parseStringRule(r,t){let e=[],s=r.split("|");for(let n of s){let a=t,o=null,c;if(r==="required")o="required",a=a||t||G.required;else if(R.same.test(n)){if(n.match(R.same)!=null){o=R.same;let h=n.match(R.same);h!=null&&(c=h[1]),a=a||G.same}}else Object.hasOwn(R,n)&&(o=R[n],a=a||G[n]);e.push({rule:o,message:a,sameKey:c})}return e}}class Et extends w{constructor(){super();l(this,"inline",!1);l(this,"labelPosition","right");l(this,"labelWidth");l(this,"id");l(this,"disabled",!1);l(this,"sharedAttrs",["disabled","id","innerBlock"]);l(this,"validator");l(this,"innerBlock",!1);l(this,"novalidate",!1);l(this,"_data");l(this,"emit");l(this,"ruleChange",t=>{this.validator.addSchema(t)});l(this,"_valueChange",(t,e,s=!0)=>{this._data==null&&(this._data={});const n=Object.hasOwn(this._data,t);this._data[t]=e,!this.novalidate&&n&&s&&this.validator.validateKey(t,e,this._data).then(()=>{$(this.id,"validateChange",!0,t)}).catch(a=>{$(this.id,"validateChange",a.detail,t)})});y(this),this.id==null&&(this.id=`l-f${E(3)}-${E(6)}`),this.validator=new ce([]),this.emit=new CustomEvent("submit")}static get observedAttributes(){return["disabled","label-position"]}attributeChangedCallback(t,e,s){if(t==="disabled"){const n=_(s,!1,t);n!==this.disabled&&($(this.id,"attributeChanged",t,n,this.id),this.disabled=n)}else if(t==="label-position"){const n=f("form",this.root);n&&(n.className=A(["l-form",this.inline?"l-form-inline":void 0,`l-form--${s}`]))}}connectedCallback(){this.loadStyle(["form"]),super.connectedCallback(),I(this.id,"ruleChange",this.ruleChange),I(this.id,"valueChange",this._valueChange)}disconnectedCallback(){ot(this.id),this.validator=void 0}render(){const t=A(["l-form",this.inline?"l-form-inline":void 0,`l-form--${this.labelPosition}`]),e=H({"--l-form-label-width":this.labelWidth?this.labelWidth:""});this.shadow.innerHTML=`<form class="${t}" style="${e}"><slot></slot></form>`}validateField(t){const e=[];if(this._data!=null){if(Array.isArray(t))for(let s=0,n=t.length;s<n;s++){const a=t[s];e.push(this.validator.validateKey(a,this._data[a],this._data))}else e.push(this.validator.validateKey(t,this._data[t],this._data));Promise.allSettled(e).then(s=>{for(let n=0,a=s.length;n<a;n++){const o=s[n];o.status==="rejected"?$(this.id,"validateChange",o.reason.detail,o.reason.key):$(this.id,"validateChange",!0,o.value.key)}})}}clearValidate(){$(this.id,"validateChange",!0)}reset(){this.clearValidate(),$(this.id,"reset")}submit(){this.novalidate?this.dispatchEvent(this.emit):this.validate().then(t=>{t&&this.dispatchEvent(this.emit)})}async validate(){if(this._data!=null)try{return await this.validator.validate(this._data),$(this.id,"validateChange",!0),Promise.resolve(!0)}catch(t){return $(this.id,"validateChange",t.detail),Promise.resolve(!1)}return Promise.resolve(!0)}getData(){return{...this._data}}}l(Et,"baseName","form");class Lt extends w{constructor(){super();l(this,"disabled",!1);l(this,"sharedAttrs",["disabled","id","name","innerBlock"]);l(this,"required",!1);l(this,"error");l(this,"label");l(this,"id");l(this,"verify");l(this,"validity");l(this,"pattern");l(this,"name");l(this,"innerBlock",!1);l(this,"labelPosition","right");l(this,"formId");l(this,"_validateChange",(t,e)=>{const s=t===!0?void 0:t[this.name];(e==null||e===this.name&&this.error!=s)&&(this.error=s,this._updateError())});y(this),this.id==null&&(this.id=`l-fi${E(3)}-${E(6)}`)}static get observedAttributes(){return["error","label","disabled"]}attributeChangedCallback(t,e,s){if(t==="error")s!=this.error&&(this.error=s,this._updateError());else if(t==="label")this.label=s,this._updateLabel();else if(t==="disabled"){const n=_(s,!1,t);n!==this.disabled&&($(this.id,"attributeChanged",t,n,this.id),this.disabled=n)}}connectedCallback(){var t;if(super.connectedCallback(),this.loadStyle(["form"]),this.formId=this._getFormId(),this.name&&this.formId){let e=((t=this.verify)==null?void 0:t.split("|"))||[];this.pattern&&e.push(new RegExp(this.pattern));const s={key:this.name,required:this.required,message:this.validity,rules:e};$(this.formId,"ruleChange",s),I(this.formId,"validateChange",this._validateChange)}}disconnectedCallback(){ot(this.id),this.formId&&F(this.formId,"validateChange",this._validateChange)}setRules(t){const e={...t,key:this.name};e.required!=null&&this.required&&(e.required=!0),this.formId&&$(this.formId,"ruleChange",e)}setError(t){this.error=t}render(){const t=["l-form-item",this.required?"is-required":void 0,this.error?"is-error":void 0,`l-form-item--${this.labelPosition}`],e=this.label!=null?`<label class="l-form-item__label">${this.label}</label>`:"",s=this.error?`<div class="l-form-item__error">${this.error}</div>`:"";this.shadow.innerHTML=[`<div class="${A(t)}">${e}`,'<div class="l-form-item__content">',`<slot></slot>${s}</div></div>`].join("")}_updateError(){if(!this.rendered)return;let t=f(".l-form-item__error",this.root);if(t)this.error?t.textContent=this.error:t.remove();else if(this.error){t=document.createElement("div"),t.className="l-form-item__error",t.textContent=this.error;const s=f(".l-form-item__content",this.root);s&&s.appendChild(t)}const e=f(".l-form-item",this.root);e&&(this.error?x(e,"is-error"):M(e,"is-error"))}_updateLabel(){if(!this.rendered)return;let t=f(".l-form-item__label",this.root);if(t==null){if(this.label!=null){t=document.createElement("div"),t.className="l-form-item__label",t.textContent=this.label;const e=f(".l-form-item",this.root);e&&e.appendChild(t)}}else this.label!=null?t.textContent=this.label:t.remove()}_getFormId(){let t=this.parentElement,e;for(;t!=null;){const s=t.tagName;if(s==="L-FORM"){e=t.id;break}if(s==="BODY")break;t=t.parentElement}return t=null,e}}l(Lt,"baseName","form-item");class St extends B{constructor(){super(!1);l(this,"type");l(this,"label");l(this,"checked",!1);l(this,"_changeEvent");l(this,"_radioChange",t=>{const e=t.target;let s=e.parentElement;for(;s!=null&&!O(s,"l-radio");)s=s.parentElement;const n=f(".is-checked",this.root);n&&M(n,"is-checked"),this.value=e.value,s&&x(s,"is-checked"),this.dispatchEvent(this._changeEvent)});y(this),this._changeEvent=new CustomEvent("change")}setItems(t){this._removeEvents(),this.root.innerHTML=this._renderItems(t),this._initEvents()}connectedCallback(){super.connectedCallback(),this.loadStyle(["radio"]),this._initEvents()}disconnectedCallback(){super.disconnectedCallback(),this._removeEvents()}attributeChange(t,e,s){if(t==="checked"){const n=_(s,!1,t);this.checked=n,this.value=n;const a=f(".l-radio",this.root);if(a&&!O(a,"is-checked")){x(a,"is-checked");const o=f("input",a);o&&(o.checked=!0)}}}render(){this.getName()||(this.name=`la${E(3)}_${E(6)}`);const t=[],e=f('[slot="label"]',this),s=z("[radio-value]",this);e!=null||this.label?(this.value=this._isChecked(),e?t.push(this._renderItem("slot",void 0,this._isChecked(),"label")):t.push(this._renderItem(this.label,void 0,this._isChecked(),"label"))):s.length>0&&(P(s,n=>{const a=n.cloneNode(!0),o=K(n,"radio-value");t.push(this._renderItem(a.outerHTML,o,this.value===o))}),this.pushValueChange()),this.root.innerHTML=t.join("")}_renderItems(t){const e=[];for(let s=0,n=t.length;s<n;s++){const a=t[s];e.push(this._renderItem(a.label,a.value,this.value===a.value,a.labelPart))}return e.join("")}_renderItem(t,e,s=!1,n=void 0){const a=A({"l-radio":!0,"l-radio--disabled":this.isDisabled(),"l-radio--button":this.type==="button","is-checked":s}),o=k("disabled",this.isDisabled()),c=k("checked",s),d=k("value",e),C=`${k("name",this.getName())}${d}${o}${c}`,ue=k("part",n),W=[`<label class="${a}">`,`<input type="radio" class="l-radio__input"${C} />`];this.type!=="button"&&W.push('<span class="l-radio__inner"></span>');let fe=t==="slot"?'<slot name="label"></slot>':t;return W.push(`<div class="l-radio__label"${ue}>${fe}</div>`),W.push("</label>"),W.join("")}_isChecked(){return this.checked}_initEvents(){P(z("input",this.root),t=>{N(t,"change",this._radioChange)})}_removeEvents(){P(z("input",this.root),t=>{T(t,"change",this._radioChange)})}}l(St,"baseName","radio"),m(U);class Nt extends w{constructor(){super();l(this,"finish",!1);l(this,"infinite",!0);l(this,"observer");l(this,"loadMoreEmit");l(this,"$more");y(this),this.loadMoreEmit=new CustomEvent("load-more")}static get observedAttributes(){return["finish"]}attributeChangedCallback(t,e,s){if(t==="finish"){const n=_(s,!1,t);this.finish!==n&&(this.finish=n,this._finishChange())}}connectedCallback(){this.loadStyle(["list"]),this.loadExternalStyle(["animation"]),super.connectedCallback(),this.infinite&&(this.observer=new IntersectionObserver(t=>{t[0].isIntersecting&&!this.finish&&this.dispatchEvent(this.loadMoreEmit)}),this.$more=f(".l-list-loadmore",this.root),!this.finish&&this.$more&&this.observer.observe(this.$more))}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.$more&&(this.observer.unobserve(this.$more),this.$more=void 0),this.observer.disconnect(),this.observer=void 0),this.loadMoreEmit=void 0}render(){const t=["<slot></slot>"];this.infinite&&(t.push('<div class="l-list-loadmore">'),this.finish||t.push('<l-loading-icon class="l-list-icon l-rotate-anim"></l-loading-icon>'),t.push(`<span class="l-list-loadmore-text">${this._loadingText()}</span></div>`)),this.root.innerHTML=t.join("")}_loadingText(){return this.finish?"已经到底啦!":"加载中……"}_finishChange(){if(this.$more){this.observer&&(this.finish?this.observer.unobserve(this.$more):this.observer.observe(this.$more));const t=f(".l-list-loadmore-text",this.$more);t&&(t.textContent=this._loadingText());let e=f(".l-list-icon",this.$more);this.finish?e&&e.remove():e==null&&(e=document.createElement("l-loading-icon"),e.className="l-list-icon l-rotate-anim",this.$more.prepend(e))}}}l(Nt,"baseName","list");class Tt extends w{constructor(){super();l(this,"shape","triangle-top");l(this,"background");y(this)}connectedCallback(){this.loadStyle(["polygon"]),super.connectedCallback()}render(){const t=A(["l-polygon",this.shape?`l-polygon-${this.shape}`:""]),e=H([this.background?`--l-polygen-background: ${this.background}`:""]);this.root.innerHTML=`<div part="default" class="${t}" style="${e}"></div>`}}l(Tt,"baseName","polygon");class It extends B{constructor(){super();l(this,"$select");l(this,"changeEmit");l(this,"_handleChange",t=>{const e=t.target.value;super.setValue(e),this.dispatchEvent(this.changeEmit)});y(this),this.changeEmit=new CustomEvent("change")}connectedCallback(){this.loadStyle(["input"]),super.connectedCallback(),this.$select=f("select",this.root),this.value&&(this.$select.value=this.value),N(this.$select,"change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.$select&&T(this.$select,"change",this._handleChange),this.changeEmit=void 0,this.$select=void 0}render(){let t=this.innerHTML.trim();const e=qt([["name",this.getName()],["disabled",this.isDisabled()]]);this.root.innerHTML=`<select class="l-input"${e}>${t}</select>`}_changeDisabled(){this.$select&&(this.$select.disabled=this.isDisabled())}setOptions(t){if(!this.$select)return;const e=t.map(s=>`<option value="${s.value}">${s.label}</option>`);this.$select.innerHTML=e.join("")}appendOptions(t){if(!this.$select)return;const e=document.createDocumentFragment();for(let s=0,n=t.length;s<n;s++){const a=t[s],o=document.createElement("option");o.value=a.value,o.innerHTML=a.label,e.appendChild(o)}this.$select.appendChild(e)}reset(){super.reset(),this.$select&&(this.$select.value=this.value)}setValue(t){super.setValue(t),this.$select&&(this.$select.value=this.value)}}l(It,"baseName","select-ori");class Rt extends B{constructor(){super(!1);l(this,"actionRender");l(this,"checkedText");l(this,"uncheckedText");l(this,"_changeEmit");l(this,"_$root");l(this,"_handleClick",t=>{this.isDisabled()||(this.setValue(!this.value),this.dispatchEvent(this._changeEmit))});y(this);const t=this.value?_(this.value,!1,"value"):!1;this._resetValue=t,this.value=t,this._changeEmit=new CustomEvent("change")}connectedCallback(){this.loadStyle(["switch"]),super.connectedCallback(),this.pushValueChange(),this._$root=f(".l-switch",this.root),this._renderAction(),N(this._$root,"click",this._handleClick)}disconnectedCallback(){super.disconnectedCallback(),this._$root&&T(this._$root,"click",this._handleClick),this.actionRender=void 0}render(){const t=document.createElement("div");t.className=A({"l-switch":!0,"l-switch--disabled":this.isDisabled(),"l-switch--checked":this.value});const e=['<div class="l-switch-action"></div>'];if(this.checkedText||this.uncheckedText){const s=this.value?this.checkedText||"":this.uncheckedText||"";e.push(`<span class="l-switch-text">${s}</span>`)}return t.innerHTML=e.join(""),t}setValue(t){if(super.setValue(t),this._$root){Wt(this._$root,"l-switch--checked");const e=f(".l-switch-text",this._$root);e&&(e.textContent=this.value?this.checkedText||"":this.uncheckedText||""),this._renderAction()}}setActionRender(t){this.actionRender=t,this._renderAction()}_renderAction(){if(!this._$root)return;const t=f(".l-switch-action",this._$root);if(this.actionRender){const e=this.actionRender({checked:this.value});typeof e=="string"?t.innerHTML=e:t.innerHTML=e.outerHTML}else{const e=f('[slot="checked-action"]',this),s=f('[slot="unchecked-action"]',this);this.value&&e?t.innerHTML='<slot name="checked-action"></slot>':!this.value&&s&&(t.innerHTML='<slot name="unchecked-action"></slot>')}}}l(Rt,"baseName","switch");class Ht extends B{constructor(){super();l(this,"$picker");l(this,"_value","#000000");l(this,"_changeEmit");l(this,"_handleChange",t=>{super.setValue(t.target.value),this.dispatchEvent(this._changeEmit)});y(this),this._changeEmit=new CustomEvent("change")}setValue(t){super.setValue(t),this.$picker&&(this.$picker.value=t)}connectedCallback(){this.loadStyle(["input","color_picker"]),super.connectedCallback(),this.$picker=f("input",this.root),N(this.$picker,"change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.$picker&&(T(this.$picker,"change",this._handleChange),this.$picker=void 0)}render(){const t=document.createElement("input");return jt(t,[["value",this.value],["disabled",this.isDisabled()],["name",this.getName()],["type","color"],["class","l-input l-color-picker"]]),t}_changeDisabled(){this.$picker&&(this.$picker.disabled=this.isDisabled())}}l(Ht,"baseName","color-picker");function he(i,r,t){let e=i.target,s="";do if(t&&t.isSameNode(e)||e.tagName==="BODY"||(e.getAttribute&&(s=e.getAttribute(r)||""),s===""&&(e=e.parentNode),!e))break;while(s==="");return[s!=="__stop__"&&s!=="",s,e]}class Vt extends w{constructor(){super();Ft(this,L);l(this,"type","nav");l(this,"name");l(this,"justifyContent");l(this,"gap");l(this,"$line");l(this,"_handleClick",t=>{const[e,s]=he(t,"l-name",this.root);e&&s!==this.name&&(this.name=s,this.dispatchEvent(new CustomEvent("change",{detail:{name:s}})),this._updateActive(),this._updateLine())});y(this),this.root}connectedCallback(){this.loadStyle(["tabbar"]),x(this,`l-tabbar--${this.type}`),!v(this.gap)&&!this.gap.startsWith("0")&&x(this,"l-tabbar-gap"),super.connectedCallback(),this._init()}static get observedAttributes(){return["name","type","justify-content","gap"]}attributeChangedCallback(t,e,s){if(t==="name"){const n=_(s,void 0);this.name=n,this._updateActive(),this._updateLine()}else if(t==="type"){const n=_(s,"nav");if(n!==this.type&&(M(this,`l-tabbar--${this.type}`),this.type=n,M(this,`l-tabbar--${n}`),n==="card")){let a=f(".l-tabbar-card-border",this.root);a||(a=S("div",{class:"l-tabbar-card-border"}),this.root.appendChild(a))}}else{const n=_(s,void 0);this[t]=n;const a=f(".l-tabbar-wrapper",this.root);a&&(a.style.cssText=D(this,L,X).call(this)),t==="gap"&&(!v(this.gap)&&!this.gap.startsWith("0")?x(this,"l-tabbar-gap"):M(this,"l-tabbar-gap"))}}disconnectedCallback(){super.disconnectedCallback(),this._destroy()}render(){const t=z("[l-name]",this),e=document.createDocumentFragment(),s=document.createElement("div");if(s.className="l-tabbar-wrapper",s.style.cssText=D(this,L,X).call(this),s.setAttribute("part","default"),t.length>0&&P(t,n=>{const a=n.getAttribute("l-name");if(a){const o=n.cloneNode(!0);o.classList.add("l-tabbar-item"),a===this.name&&o.classList.add("active");const c=f("[l-icon]",o),d=z(":not([l-icon])",o);if(c){const h=S("div",{class:["l-tabbar-item-icon",d.length===0?"only":void 0]});h.appendChild(c.cloneNode(!0)),c.replaceWith(h)}s.appendChild(o)}}),e.appendChild(s),this.type==="card"){const n=S("div",{class:"l-tabbar-card-border"});e.appendChild(n)}return e}setItems(t){const e=f(".l-tabbar-wrapper",this.root);e&&(e.innerHTML="",e.appendChild(D(this,L,tt).call(this,t)))}addItems(t){const e=f(".l-tabbar-wrapper",this.root);e&&e.appendChild(D(this,L,tt).call(this,t))}_init(){N(this.root,"click",this._handleClick),setTimeout(()=>{this._updateLine()},300)}_destroy(){T(this.root,"click",this._handleClick),this.$line=void 0}_updateActive(){const t=f(".active",this.root);t&&M(t,"active");const e=f(`[l-name="${this.name}"]`,this.root);e&&x(e,"active")}_updateLine(){queueMicrotask(()=>{if(!this.name||this.type==="nav"||!this.rendered)return;const t=f(".active",this.root);if(!t)return;const e=t.offsetLeft;if(!this.$line){const s=S("div",{class:"l-tabbar--bar-line"});this.root.appendChild(s),this.$line=f(".l-tabbar--bar-line",this.root)}this.$line.style.cssText=`width:${t.offsetWidth}px;left:${e}px`,Ot(t,this)||this.scrollTo({left:e,behavior:"smooth"})})}}L=new WeakSet,X=function(){const t={};if(v(this.justifyContent)||(t["justify-content"]=this.justifyContent),!v(this.gap)){let e=this.gap;Bt(e,{isPositive:!0})&&(e=`${e}px`),t["--l-tabbar-item-gap"]=e}return H(t)},tt=function(t){const e=document.createDocumentFragment();for(let s=0,n=t.length;s<n;s++){const a=t[s],o=S("div",{class:A(["l-tabbar-item",this.name===a.name?"active":void 0]),"l-name":a.name}),c=a.icon;if(c){const h=S("div",{class:"l-tabbar-item-icon"});let C=typeof c=="string"?c:c();typeof C=="string"?h.innerHTML=C:h.appendChild(C),o.appendChild(h)}const d=a.text;if(d){let h=typeof d=="string"?d:d();typeof h=="string"?o.appendChild(S(h)):o.appendChild(h)}e.appendChild(o)}return e},l(Vt,"baseName","tabbar"),m(Vt),m(Ht),m(Rt),m(It),m(Tt),m(Nt),m(St),m(Et),m(Lt),m(lt),m(ct),m(b),m(ht),m(dt),m(ut),m(ft),m(U),m(mt),m(pt),m(bt),m(gt),m(vt),m(Ct),m($t),globalThis.LMessage=j;function de(){const i=document.currentScript.src,r=i.lastIndexOf("/"),e=`${i.slice(0,r+1)}litos-ui.css`,s=document.createElement("link");s.rel="stylesheet",s.href=e,s.id="litos-ui-style",document.head.appendChild(s)}de()})();
|
|
1
|
+
var ms=Object.defineProperty;var _e=p=>{throw TypeError(p)};var ps=(p,g,v)=>g in p?ms(p,g,{enumerable:!0,configurable:!0,writable:!0,value:v}):p[g]=v;var a=(p,g,v)=>ps(p,typeof g!="symbol"?g+"":g,v),_t=(p,g,v)=>g.has(p)||_e("Cannot "+v);var b=(p,g,v)=>(_t(p,g,"read from private field"),v?v.call(p):g.get(p)),x=(p,g,v)=>g.has(p)?_e("Cannot add the same private member more than once"):g instanceof WeakSet?g.add(p):g.set(p,v),wt=(p,g,v,it)=>(_t(p,g,"write to private field"),it?it.call(p,v):g.set(p,v),v),$=(p,g,v)=>(_t(p,g,"access private method"),v);(function(){"use strict";var yt,tt,J,ut,q,xt,Mt,z,k,we,Et,xe,Me,Ee,W,Le,Se,ot,Ae,ct,V,Ne,Te,ht,O,K,et,Ie,He;const p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",g="0123456789";function v(s,r=!0){return s==null?!0:(r&&typeof s=="string"?s.trim().length:s.length)===0}function it(s,r){r={isPositive:!1,isFloat:!0,...r};const t=r.isPositive?"[+]?":"[+-]?",e=r.isFloat?"([0-9]*[.])?[0-9]+":"[0-9]+";return new RegExp("^"+t+e+"$").test(s)}function B(s){if(typeof s=="object"&&s.min!=null&&s.max!=null){const r=Math.random(),t=s.hasEnd?1:0,e=r*(s.max-s.min+t)+s.min;return s.isInteger!==!1?Math.floor(e):e}else{if(typeof s=="object"&&s.length==null)throw new Error("random_length_cannot_null");let r=typeof s=="object"?s.length:s,t=p;typeof s=="object"&&s.hasLetter===!1&&(t=g);const e=Array.from({length:r},()=>t.charAt(B({min:0,max:t.length-1,hasEnd:!0}))).join("");return typeof s=="object"&&s.firstIsZero===!1&&e.indexOf("0")===0?B(s):e}}function Lt(s,r){return typeof s=="string"?(r||document).querySelectorAll(s):[s]}function X(s,r){return Lt(s,r)}function L(s,r={},t){let e;if(s.startsWith("<")&&s.endsWith(">")?e=new DOMParser().parseFromString(s,"text/html").body.firstElementChild:e=document.createElement(s),e&&r)for(const i in r){const n=r[i];i==="class"?e.className=F(n):i==="style"?e.style.cssText=Y(n):i==="textContent"&&n?e.textContent=n:i==="innerHTML"&&n?e.innerHTML=n:i==="outerHTML"&&n?e.outerHTML=n:n===!0?e.setAttribute(i,""):typeof n=="string"&&e.setAttribute(i,n)}return e}function St(s,r={},t){return L(s,r)}function u(s,r){const t=Lt(s,r);return t.length>0?t[0]:void 0}function S(s,r){s.classList.add(r)}function I(s,r){s.classList.remove(r)}function At(s,r){return s.classList.contains(r)}function _(s,r,t,e){s.addEventListener(r,t,e)}function w(s,r,t,e){s.removeEventListener(r,t,e)}function rt(s,r){for(let t=0,e=s.length;t<e&&r(s[t],t)!==!0;t++);}function ft(s,r,t){const e=s.getAttribute(r);if(t==null)return e;const i=typeof t;return e==null?t:i==="bigint"||i==="number"?e===""?t:Number(e):i==="boolean"?e===""||e==="1"||e==="true"||e===r:i==="object"?e===""?t:JSON.parse(e):e}function ze(s,r=null,t="horizontal"){r==null&&(r=s.offsetParent);const e=r.getBoundingClientRect(),i=s.getBoundingClientRect();let n=t==="horizontal"?i.left:i.top,l=t==="horizontal"?i.right:i.bottom,o=t==="horizontal"?e.left:e.top,c=t==="horizontal"?e.right:e.bottom;return n>=o&&l<=c}function F(s){let r="";if(Array.isArray(s))for(let t=0,e=s.length;t<e;t++){const i=s[t];i&&(r+=`${i} `)}else if(typeof s=="string")r=s;else for(const t in s)s[t]&&(r+=`${t} `);return r.trim()}function Y(s){let r="";if(Array.isArray(s))for(let t=0,e=s.length;t<e;t++){const i=s[t];i&&(r+=`${i};`)}else if(typeof s=="string")r=s;else for(const t in s){const e=s[t];e&&(r+=`${t}:${e};`)}return r}function nt(s,r,t="set"){for(let e=0,i=r.length;e<i;e++){const n=r[e];t==="set"?s.style.setProperty(n[0],n[1]):s.style.removeProperty(n[0])}}function Nt(s,r,t="enter",e){const i=t==="enter"?"from":"to";let n="",l="";const o=[];if(typeof r=="string")n=`${r}-${t}-${i}`,l=`${r}-${t}-active`;else for(let c=0,h=r.length;c<h;c++){const d=r[c];d.length>=3&&o.push(`${d[0]} ${d[2]}`)}t==="enter"?n?(s.classList.add(n),setTimeout(()=>{s.classList.add(l),requestAnimationFrame(()=>{s.classList.remove(n)})},0)):(nt(s,r,"set"),setTimeout(()=>{o.length>0&&s.style.setProperty("transition",o.join(", ")),requestAnimationFrame(()=>{nt(s,r,"remove")})},0)):n?(s.classList.add(l),requestAnimationFrame(()=>{s.classList.add(n)})):(o.length>0&&s.style.setProperty("transition",o.join(", ")),requestAnimationFrame(()=>{nt(s,r,"set")})),s.addEventListener("transitionend",()=>{n?(s.classList.remove(l),requestAnimationFrame(()=>{s.classList.remove(n)})):(s.style.removeProperty("transition"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{nt(s,r,"remove")})})),e&&e()},{once:!0})}let Ve=-1,Tt={prefix:"l"};function f(s,r){const t=Array.isArray(s)?s:[s];for(const e of t){const i=`${Tt.prefix}-${e.baseName}`;customElements.get(i)||customElements.define(i,e)}}function It(){return`${Tt.prefix}-${++Ve}`}function A(s,r,t){if(s==null)return r;switch(typeof r){case"boolean":return s===""||s==="true"||s==="1"||s===t;case"number":return Number(s);default:return s}}function M(s){const r=s.attributes;for(const t of r){const{name:e,value:i}=t;if(e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("_")||e.startsWith("$"))continue;const l=e.split("-").map((c,h)=>h===0?c:c[0].toUpperCase()+c.slice(1)).join(""),o=A(i,s[l],e);s[l]=o,e==="value"&&(s._resetValue=o)}}function H(s,r){let t=" ";return r===!0?t=` ${s}`:typeof r=="string"&&!v(r)&&(t=` ${s}="${r}"`),t}function Fe(s){return s.map(t=>H(t[0],t[1])).join("")}function Re(s,r){for(const t of r){const e=t[1],i=t[0];e===!0?s.setAttribute(i,""):typeof e=="string"&&!v(e)&&s.setAttribute(i,e)}}function mt(s,r,t,e,i=10){let n=0;return t==="top"?n=r.height+i:t==="bottom"?n=-(s.height+i):(t==="left"||t==="right")&&(e===""?n=r.height/2-s.height/2:e==="end"&&(n=r.height-s.height)),n}function pt(s,r,t,e,i=10){let n=0;return t==="left"?n=r.width+i:t==="right"?n=-(s.width+i):(t==="top"||t==="bottom")&&(e===""?n=r.width/2-s.width/2:e==="end"&&(n=r.width-s.width)),n}function Be(s,r,t,e,i,n,l,o,c=10,h="absolute"){const d=window.innerHeight+n-10,y=window.innerWidth+i-10;let R=s.top+n-o;R+r.height>d&&(t==="left"||t==="right"?e="end":t="top",o=mt(s,r,t,e,c),R=s.top+n-o),R<n&&(t==="left"||t==="right"?e="start":t="bottom");let T=s.left+i-l;return T+r.width>y&&(t==="top"||t==="bottom"?e="end":t="left",l=pt(s,r,t,e,c),T=s.left+i-l),T<i&&(t==="top"||t==="bottom"?e="start":t="right"),h==="fixed"&&(o=mt(s,r,t,e,c),l=pt(s,r,t,e,c),T=s.left+i-l,R=s.top+n-o),{x:T,y:R,mainAlign:t,crossAlign:e}}class N extends HTMLElement{constructor(t=!0){super();a(this,"rendered",!1);t&&this.attachShadow({mode:"open"})}static get observedAttributes(){return[]}attributeChangedCallback(t,e,i){}get shadow(){return this.shadowRoot}get root(){return this.shadowRoot||this}createStyle(t){const e=document.createElement("style");e.textContent=t.trim(),this.root.appendChild(e)}createLink(t){const e=document.createElement("link");e.rel="stylesheet",e.href=t,this.root.appendChild(e)}loadStyle(t){{let e=document.querySelector("#litos-ui-style");e?this.createLink(e.href):queueMicrotask(()=>{e=document.querySelector("#litos-ui-style"),e&&this.createLink(e.href)})}}loadExternalStyle(t){}loadStyleText(t){this.createStyle(t)}getAttr(t,e){return ft(this,t,e)}appendToRoot(t){if(t)if(typeof t=="string"){let e=document.createElement("div");e.innerHTML=t,this.root.append(...e.children),e=void 0}else t.length?this.root.append(...t):this.root.append(t)}connectedCallback(){this.appendToRoot(this.render()),this.rendered=!0}disconnectedCallback(){this.root.innerHTML="",this.rendered=!1}render(){}}a(N,"baseName","base-component");class C extends N{constructor(){super();a(this,"useLink");a(this,"viewBox");this.useLink=!1,this.viewBox="0 0 1024 1024"}connectedCallback(){this.loadStyle(["icon"]),this.render(),this.rendered=!0}render(){const t=this.createEl("svg"),e=this.getAttr("useLink",this.useLink),i=this.getAttr("viewBox",this.viewBox);t.classList.add("l-icon"),e||t.setAttribute("viewBox",i);const n=this.renderChildren();if(typeof n=="string")if(n===""){const l=this.children,o=[];for(let c=0,h=l.length;c<h;c++){const d=l[c];o.push(d.outerHTML)}t.innerHTML=o.join("")}else t.innerHTML=n;else t.append(n);this.shadow.appendChild(t)}renderChildren(){return""}createEl(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}a(C,"baseName","base-icon");let bt=(yt=class extends C{renderChildren(){return'<path d="M520.665 64.564a29.244 29.244 0 0 0-7.071-.894c-16.211 0-29.35 13.14-29.35 29.35 0 15.83 12.538 28.696 28.223 29.293v.073c.375 0 .751-.014 1.127-.014 216.493 0 389.629 173.942 389.629 390.433 0 216.496-173.136 388.827-389.63 388.827s-389.63-172.333-389.63-388.829c0-.27.01-.536.01-.804h-.01c0-16.209-13.141-29.35-29.35-29.35s-29.35 13.139-29.35 29.35c0 .055.007.11.007.164-.001.214-.007.425-.007.64 0 247.609 200.722 448.331 448.33 448.331 247.607 0 448.33-200.722 448.33-448.33-.002-245.242-196.917-444.456-441.258-448.24z" fill="currentColor"></path>'}},a(yt,"baseName","loading-icon"),yt);const at=2,qe=.16,Pe=.05,je=.05,De=.15,We=/rgba?\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)/,Ht=/^#(?:([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})|([0-9A-Fa-f]{1})([0-9A-Fa-f]{1})([0-9A-Fa-f]{1}))$/;function Oe(s){return s.r!=null&&s.g!=null&&s.b!=null}function zt(s){return s.h!=null&&s.s!=null&&s.v!=null}function Ke(s){let r=s.match(We);if(r!=null){const t=parseInt(r[1].trim()),e=parseInt(r[2].trim()),i=parseInt(r[3].trim());if(isNaN(t)||isNaN(e)||isNaN(i))throw new Error("Invalid RGB color.");let n=1;return r[4]!=null&&(n=parseFloat(r[4].trim()),isNaN(n)&&(n=1)),{r:t,g:e,b:i,a:n}}}function Ye(s){const r=s.match(Ht);if(r!=null){const t=r[4]!==void 0,e=parseInt(t?r[4]+r[4]:r[1],16),i=parseInt(t?r[5]+r[5]:r[2],16),n=parseInt(t?r[6]+r[6]:r[3],16);return{r:e,g:i,b:n}}}function gt(s){if(typeof s=="string"){let r=Ye(s);if(r==null&&(r=Ke(s)),r!=null)return r;throw new Error("Invalid color string")}else{if(Oe(s))return s;if(zt(s))return Ge(s);throw new Error("Invalid color")}}function Ue(s){if(zt(s))return s;const r=gt(s),t=r.r/255,e=r.g/255,i=r.b/255;let n=Math.max(t,e,i),l=Math.min(t,e,i),o=n-l,c=n,h=n===0?0:o/n,d=0;if(n===l)d=0;else switch(n){case t:d=((e-i)/o+(e<i?6:0))/6;break;case e:d=((i-t)/o+2)/6;break;case i:d=((t-e)/o+4)/6;break}return d=d*360,{h:d,s:h,v:c}}function Ge(s){let r=s.s,t=s.v;r>1&&(r/=100),t>1&&(t/=100);const e=s.h;var i=Math.floor(e/60)%6,n=e/60-Math.floor(e/60),l=t*(1-r),o=t*(1-n*r),c=t*(1-(1-n)*r);let h=0,d=0,y=0;switch(i){case 0:h=t,d=c,y=l;break;case 1:h=o,d=t,y=l;break;case 2:h=l,d=t,y=c;break;case 3:h=l,d=o,y=t;break;case 4:h=c,d=l,y=t;break;case 5:h=t,d=l,y=o;break}return h=Math.round(h*255),d=Math.round(d*255),y=Math.round(y*255),{r:h,g:d,b:y}}function Je(s,r,t){let e;return Math.round(s.h)>=60&&Math.round(s.h)<=240?e=t?Math.round(s.h)-at*r:Math.round(s.h)+at*r:e=t?Math.round(s.h)+at*r:Math.round(s.h)-at*r,e<0?e+=360:e>=360&&(e-=360),e}function Xe(s,r,t){if(s.h===0&&s.s===0)return s.s;let e;return t?e=s.s-qe*r:e=s.s+Pe*r,e>1&&(e=1),e<.06&&(e=.06),Number(e.toFixed(2))}function Ze(s,r,t){let e;return t?e=s.v+je*r:e=s.v-De*r,e>1&&(e=1),Number(e.toFixed(2))}function Vt(s){const r=t=>t.toString(16).padStart(2,"0");return`#${r(s.r)}${r(s.g)}${r(s.b)}`.toUpperCase()}function Qe(s){return typeof s=="string"&&Ht.test(s)?s:Vt(gt(s))}function U(s,r=1,t=!0){const e=Ue(s);return Qe({h:Je(e,r,t),s:Xe(e,r,t),v:Ze(e,r,t)})}f(bt);class Ft extends N{constructor(){super();a(this,"htmlType","button");a(this,"_handleClick",t=>{const e=t.target,i=ft(e,"html-type");if(i==="reset"||i==="submit"){const n=this._getForm();n&&(i==="reset"?n.reset():i==="submit"&&n.submit())}});M(this)}static get observedAttributes(){return["loading","color","disabled"]}attributeChangedCallback(t,e,i){const n=u(".l-button",this.root);if(n)if(t==="loading")A(i,!1,t)?(S(n,"l-btn-loading"),n.disabled=!0,n.innerHTML=this.loadingBody()):(I(n,"l-btn-loading"),n.disabled=this.getAttr("disabled",!1),n.innerHTML="<slot></slot>");else if(t==="color"){const l=this.getAttr("text",!1),o=this.getAttr("ghost",!1);n.style.cssText=this.applyColor(i,l,o)}else t==="disabled"&&(n.disabled=this.getAttr("disabled",!1))}connectedCallback(){this.loadStyle(["button"]),this.loadExternalStyle(["animation"]),this.render(),(this.htmlType==="reset"||this.htmlType==="submit")&&_(this,"click",this._handleClick)}disconnectedCallback(){super.disconnectedCallback(),(this.htmlType==="reset"||this.htmlType==="submit")&&w(this,"click",this._handleClick)}render(){const t=this.getAttr("type","normal"),e=document.createElement("button"),i=this.getAttr("loading",!1),n=this.getAttr("shape","default"),l=this.getAttr("text",!1),o=this.getAttr("ghost",!1),c=["l-btn",`l-btn-${t}`,this.getAttr("block",!1)?"l-btn-block":"",n==="round"?"l-btn-round":"",n==="circle"?"l-btn-circle":"",o?"l-btn-ghost":"",l?"l-btn-text":"",i?"l-btn-loading":""];e.className=F(c),e.disabled=this.getAttr("disabled",!1)||i,e.type=this.getAttr("html-type","button");const h=this.applyColor(this.getAttr("color"),l,o);h&&(e.style.cssText=h),i?e.innerHTML=this.loadingBody():e.innerHTML="<slot></slot>",e.setAttribute("part","default"),this.root.appendChild(e)}loadingBody(){const t=this.getAttr("loading-text",""),e=['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];return t===""?e.push("<slot></slot>"):e.push(`<span>${t}</span>`),e.join("")}applyColor(t,e=!1,i=!1){if(!t)return"";const n=U(t,1,!0),l=U(t,3,!1);return Y({"--l-btn-border-color":e?"transparent":t,"--l-btn-text-color":i||e?t:"#ffffff","--l-btn-hover-text-color":i||e?n:"#ffffff","--l-btn-background":i||e?"transparent":t,"--l-btn-active-text-color":i||e?l:"#ffffff","--l-btn-hover-border-color":e?"transparent":n,"--l-btn-hover-background":i||e?"transparent":n,"--l-btn-active-background":i||e?"transparent":l,"--l-btn-active-border-color":e?"transparent":l})}_getForm(){let t=this.parentElement,e;for(;t!=null;){const i=t.tagName;if(i==="L-FORM"){e=t;break}if(i==="BODY")break;t=t.parentElement}return t=null,e}}a(Ft,"baseName","button");let m;function P(s,r,t){m==null&&(m=new Map),m.has(s)||m.set(s,new Map([[r,new Set]])),m.get(s).has(r)||m.get(s).set(r,new Set),m.get(s).get(r).add(t)}function Z(s,r,t){var e,i,n,l,o,c;(i=(e=m==null?void 0:m.get(s))==null?void 0:e.get(r))==null||i.delete(t),((l=(n=m==null?void 0:m.get(s))==null?void 0:n.get(r))==null?void 0:l.size)==0&&((o=m.get(s))==null||o.delete(r)),((c=m==null?void 0:m.get(s))==null?void 0:c.size)==0&&m.delete(s),(m==null?void 0:m.size)==0&&(m=void 0)}function Rt(s){s==null?m!=null&&(m.clear(),m=void 0):m!=null&&(m.delete(s),m.size===0&&(m=void 0))}function E(s,r,...t){var i;const e=(i=m==null?void 0:m.get(s))==null?void 0:i.get(r);if(e!=null)for(const n of e)n(...t)}class Q extends N{constructor(t=!0){super();a(this,"disabled",!1);a(this,"name");a(this,"formAttrs",{});a(this,"formItemAttrs",{});a(this,"_value","");a(this,"_resetValue");a(this,"_firstPushValue",!0);a(this,"_reseting",!1);a(this,"_formAttributeChanged",(t,e,i)=>{i===this.formAttrs.formId?this.formAttrs[t]=e:this.formItemAttrs[t]=e,t==="disabled"&&this._changeDisabled()});a(this,"_resetFieldValue",()=>{this._reseting=!0,this.reset()});this._firstPushValue=t}set value(t){this.setValue(t)}get value(){return this.getValue()}setValue(t){this._value=t,this.pushValueChange()}getValue(){return this._value}static get observedAttributes(){return["disabled"]}attributeChangedCallback(t,e,i){if(t==="disabled"){const n=A(i,!1,t);n!==this.disabled&&(this._changeDisabled(),this.disabled=n)}else this.attributeChange(t,e,i)}attributeChange(t,e,i){}connectedCallback(){const t=this._getForm();this.formAttrs=t.formAttr,this.formItemAttrs=t.formItemAttr,this.formAttrs.id&&(P(this.formAttrs.id,"attributeChanged",this._formAttributeChanged),P(this.formAttrs.id,"reset",this._resetFieldValue),this._firstPushValue&&this.pushValueChange()),this.formItemAttrs.id&&P(this.formItemAttrs.id,"attributeChanged",this._formAttributeChanged),super.connectedCallback()}disconnectedCallback(){this.formAttrs.id&&(Z(this.formAttrs.id,"attributeChanged",this._formAttributeChanged),Z(this.formAttrs.id,"reset",this._resetFieldValue)),this.formItemAttrs.id&&Z(this.formItemAttrs.id,"attributeChanged",this._formAttributeChanged),super.disconnectedCallback()}isDisabled(){return this.disabled===!0||this.formItemAttrs.disabled===!0?!0:this.formAttrs.disabled||!1}getName(){return this.name?this.name:this.formItemAttrs.name}_getForm(){let t=this.parentElement,e={},i={};for(;t!=null;){const n=t.tagName;if(n==="L-FORM"){const l=t.sharedAttrs;for(let o=0;o<l.length;o++){const c=l[o];e[c]=t[c]}break}if(n==="BODY")break;if(n==="L-FORM-ITEM"){const l=t.sharedAttrs;for(let o=0;o<l.length;o++){const c=l[o];i[c]=t[c]}}t=t.parentElement}return t=null,{formAttr:e,formItemAttr:i}}_changeDisabled(){}pushValueChange(){const t=this.getName();this.formAttrs.id&&t&&E(this.formAttrs.id,"valueChange",t,this._value,!this._reseting),this._reseting=!1}reset(){this.value=this._resetValue||""}}class Bt extends Q{constructor(){super();a(this,"type","text");a(this,"placeholder");a(this,"autosize",!1);a(this,"allowInput");a(this,"parser");a(this,"width");a(this,"block",!1);a(this,"error",!1);a(this,"$input");a(this,"_input",t=>{const e=t.target;let i=e.value;if(this.allowInput!=null){let n=this.allowInput.indexOf("."),l=n===-1?n:parseInt(this.allowInput.substring(n+1));i=this._numberInputParse(i,{integer:this.allowInput.includes("integer"),negative:this.allowInput.startsWith("-"),precition:l}),i=String(i),e.value=i}this.parser!=null&&(i=this.parser(i),e.value=i),this.setValue(i)});a(this,"_validateChange",(t,e)=>{const i=this.getName();if(i){const n=t===!0?!1:t[i]!=null;(e==null||e===i&&this.error!=n)&&(this.error=n,this._updateError()),Object.keys(t)[0]===i&&this.focus()}});M(this)}set value(t){this.setValue(t),this.$input!=null&&(this.$input.value=this.value)}get value(){return this.getValue()}static get observedAttributes(){return["disabled","error"]}connectedCallback(){super.connectedCallback(),this.loadStyle(["input"])}disconnectedCallback(){super.disconnectedCallback(),this.formAttrs.id&&Z(this.formAttrs.id,"validateChange",this._validateChange),w(this.$input,"input",this._input),this.$input=void 0}attributeChange(t,e,i){if(t==="error"){const n=A(i,!1,t);n!==this.error&&(this.error=n,this._updateError())}}render(){let t=H("value",this.value);const e=H("placeholder",this.placeholder),i=H("disabled",this.isDisabled()),n=F({"l-input":!0,"is-autosize":this.autosize,"is-error":this.error}),l=this.getName(),o=H("name",l),c=`${t}${o}${e}${i}`;this.shadow.innerHTML=`<input part="default" type="${this.type}" class="${n}"${c}></input>`,this.$input=u("input",this.root),_(this.$input,"input",this._input),this.style.cssText=Y(this._getStyleObj())+this.getAttr("style",""),l&&this.formAttrs.id&&P(this.formAttrs.id,"validateChange",this._validateChange)}setParser(t){this.parser=t}focus(){var t;(t=this.$input)==null||t.focus()}_changeDisabled(){this.$input!=null&&(this.$input.disabled=this.isDisabled())}_numberInputParse(t,e){let i=t,n=e.negative?"-?":"";if(e.integer){const o=i.match(new RegExp(`^(${n}\\d*)`));return o!=null?o[1]:i.substring(0,i.length-1)}const l=i.match(new RegExp(`(${n}\\d+\\.\\d{0,${e.precition}})|(${n}\\d*)`));return l!=null?i=l[1]||l[2]:i="",l!=null?l[1]||l[2]:""}_getStyleObj(){const t={};return this._isBlock()&&(t["--l-input-width"]="100%"),this.width&&(t["--l-input-width"]=this.width),t}_isBlock(){if(this.block===!0||this.formItemAttrs.innerBlock===!0||this.formAttrs.innerBlock===!0)return!0}_updateError(){this.$input&&(this.error?S(this.$input,"is-error"):I(this.$input,"is-error"))}}a(Bt,"componentName","input");class qt extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>'}}a(qt,"baseName","arrow-down-icon");class Pt extends C{renderChildren(){return'<path fill="currentColor" d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>'}}a(Pt,"baseName","arrow-left-icon");class jt extends C{renderChildren(){return'<path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>'}}a(jt,"baseName","arrow-right-icon");class Dt extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"></path>'}}a(Dt,"baseName","arrow-up-icon");class Wt extends C{renderChildren(){return'<path fill="currentColor" d="M512 320 192 704h639.936z"></path>'}}a(Wt,"baseName","caret-top-icon");class Ot extends C{renderChildren(){return'<path fill="currentColor" d="m192 384 320 384 320-384z"></path>'}}a(Ot,"baseName","caret-bottom-icon");class Kt extends C{constructor(){super();a(this,"_t");a(this,"_start");this.useLink=!0,this._t=void 0,this._start=0}renderChildren(){return""}render(){super.render()}disconnectedCallback(){this._t!=null&&(cancelAnimationFrame(this._t),this._t=void 0)}connectedCallback(){super.connectedCallback();const t=this.getAttribute("name");this._start=Date.now(),t&&this._loadIcon(t)}_loadIcon(t){Date.now()-this._start>=1e4||(this._t=requestAnimationFrame(()=>{const i=document.querySelector(`#${t}`);if(i==null){this._loadIcon(t);return}this._t=void 0;let n=i.getAttribute("viewBox");n||(n="0 0 1024 1024");const l=this.shadow.querySelector("svg");l!=null&&(l.setAttribute("viewBox",n),l.innerHTML=i.innerHTML)}))}}a(Kt,"baseName","font-icon");class Yt extends C{renderChildren(){return'<path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"></path>'}}a(Yt,"baseName","search-icon");class Ut extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"></path>'}}a(Ut,"baseName","sun-icon");class Gt extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"></path>'}}a(Gt,"baseName","moon-icon");class Jt extends C{constructor(){super()}renderChildren(){return'<path d="M1039.92888889 967.11111111L1039.92888889 56.88888889c0-40.15900445-32.65877333-72.81777778-72.81777778-72.81777778l-910.22222222 0c-40.15900445 0-72.81777778 32.65877333-72.81777778 72.81777778l0 910.22222222c0 40.15900445 32.65877333 72.81777778 72.81777778 72.81777778L967.11111111 1039.92888889c40.15900445 0 72.81777778-32.65877333 72.81777778-72.81777778zM56.88888889 56.88888889L967.11111111 56.88888889l0 910.22222222-910.22222221 0.07281778L56.88888889 56.88888889z"></path><path d="M876.08888889 349.17944888a36.40888889 36.40888889 0 0 0-36.40888889-36.40888889l-120.47701333 1e-8L719.20298668 184.32a36.40888889 36.40888889 0 0 0-72.81777779 0l0 164.85944889a36.40888889 36.40888889 0 0 0 36.40888889 36.40888889L839.68 385.58833778a36.40888889 36.40888889 0 0 0 36.40888889-36.4088889z m-156.88590221 473.27914667L719.20298667 694.04444445 839.68 694.04444445a36.40888889 36.40888889 0 1 0 0-72.81777778l-156.88590222 0a36.40888889 36.40888889 0 0 0-36.40888889 36.40888888l0 164.82304a36.40888889 36.40888889 0 1 0 72.81777779 0zM366.36444445 349.17944888L366.36444445 184.32a36.40888889 36.40888889 0 1 0-72.81777778 0l0 128.45055999-120.51342222 1e-8a36.40888889 36.40888889 0 1 0 0 72.81777778L329.95555555 385.58833778a36.40888889 36.40888889 0 0 0 36.4088889-36.4088889z m0 473.27914667L366.36444445 657.63555555a36.40888889 36.40888889 0 0 0-36.4088889-36.40888888l-156.9223111-1e-8a36.40888889 36.40888889 0 1 0 0 72.81777779L293.54666667 694.04444445l0 128.4141511a36.40888889 36.40888889 0 1 0 72.81777778 0z"></path>'}}a(Jt,"baseName","reduction-icon");class Xt extends C{constructor(){super()}renderChildren(){return'<path d="M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"></path>'}}a(Xt,"baseName","refresh-left-icon");class Zt extends C{renderChildren(){return'<path d="M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"></path>'}}a(Zt,"baseName","refresh-right-icon");class Qt extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10m0-1.5v-17a8.5 8.5 0 0 1 0 17"/>'}}a(Qt,"baseName","theme-default-icon");class te extends C{renderChildren(){return'<path d="M384 96a32 32 0 0 1 64 0v786.752a32 32 0 0 1-54.592 22.656L95.936 608a32 32 0 0 1 0-45.312h.128a32 32 0 0 1 45.184 0L384 805.632zm192 45.248a32 32 0 0 1 54.592-22.592L928.064 416a32 32 0 0 1 0 45.312h-.128a32 32 0 0 1-45.184 0L640 218.496V928a32 32 0 1 1-64 0V141.248z"></path>'}}a(te,"baseName","sort-icon");class ee extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path fill="currentColor" d="M12 23a11 11 0 100-22 11 11 0 000 22zM8.82 7.4L12 10.6l3.18-3.19 1.42 1.42L13.4 12l3.19 3.18-1.42 1.42L12 13.4 8.82 16.6 7.4 15.18 10.6 12 7.4 8.82 8.82 7.4z"></path>'}}a(ee,"baseName","mask-close-icon");class se extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 0C228.693333 0 0 228.693333 0 512s228.693333 512 512 512 512-228.693333 512-512S795.306667 0 512 0z m307.2 368.64L467.626667 730.453333c0 3.413333-3.413333 3.413333-3.413334 6.826667-13.653333 13.653333-37.546667 13.653333-51.2 0l-177.493333-177.493333c-13.653333-13.653333-13.653333-37.546667 0-51.2 13.653333-13.653333 37.546667-13.653333 51.2 0l150.186667 153.6 334.506666-341.333334c13.653333-13.653333 37.546667-13.653333 51.2 0 10.24 10.24 10.24 34.133333-3.413333 47.786667z m0 0"></path>'}}a(se,"baseName","success-icon");class ie extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 1024C229.234 1024 0 794.766 0 512S229.234 0 512 0s512 229.234 512 512-229.234 512-512 512z m-64.853-734.52l19.484 244.906 1.309 16.156c1.251 15.93 15.018 28.644 30.72 28.644h25.571c15.56 0 29.298-12.601 30.663-28.132l1.422-16.668 21.334-244.907c3.214-36.978-24.434-66.844-61.725-66.844h-6.627c-37.462 0-65.138 29.923-62.18 66.844zM512 801.393a66.788 66.788 0 1 0 0-133.575 66.788 66.788 0 0 0 0 133.575z"></path>'}}a(ie,"baseName","warn-icon");class re extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 64a448 448 0 110 896.064A448 448 0 01512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 01-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 017.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"></path>'}}a(re,"baseName","info-icon"),f(ee),f(se),f(ie),f(re);const G=[],ne=[["opacity","0","0.3s"],["transform","translate3d(-50%, -100%, 0)","0.3s"]];function ae(s){const r=G.findIndex(n=>n.id===s);if(r===-1)return;const t=G.splice(r,1)[0];if(t==null)return;Nt(t,ne,"leave",()=>{t.remove()});const e=15+t.offsetHeight,i=G.length;if(i!==0)for(let n=r;n<i;n++){const l=G[n],o=parseInt(l.style.top,10)-e;l.style.setProperty("top",`${o}px`)}}function ts(s){const r=document.createElement("div");r.id=s.id;const t=s.type||"info";let e=`l-message l-message-${t}`;s.customClass&&(e+=" "+s.customClass),r.className=e,r.style.setProperty("top",`${s.offset}px`),r.style.setProperty("z-index",`${s.zindex||1e3}`),s.width&&r.style.setProperty("width",s.width);let i=t;return i==="error"&&(i="mask-close"),r.innerHTML=['<div class="l-message-container">',`<l-${i}-icon class="l-message-icon"></l-${i}-icon>`,`<span class="l-message-content">${s.message}</span>`,"</div>"].join(""),r}const lt=s=>{const r=G.reduce((l,o)=>l+o.offsetHeight+15,15),t=It(),e=typeof s=="string"?{message:s}:s;e.id=t,e.offset=r;const i=ts(e);G.push(i),document.body.appendChild(i),Nt(i,ne,"enter");let n=e.duration;return n==null&&(n=3e3),n!==0&&setTimeout(()=>{ae(t)},n),t};for(const s of["info","success","error","warn","show"])lt[s]=r=>{const t=typeof r=="string"?{message:r}:r;return s!=="show"?t.type=s:t.type==null&&(t.type="info"),lt(t)};lt.close=ae;const vt={mobile:"请输入正确的手机号",same:"两次输入不一致",required:"%s为必填字段"},Ct="请输入正确的数据",j={same:/^same:(.+)$/i,mobile:/^1[345678]\d{9}$/,required:/^\S{1}.*/},$t={same(s,r){return r===s},pattern(s,r){return r==null?!1:s.test(String(r))}};class le extends Error{constructor(r,t,e){super(e),this.name="ValidateError",this.key=t,this.detail=r}}class es{constructor(r){this.rules={},this.addSchemas(r)}addSchemas(r){for(let t of r)this.rules[t.key]=this._parseSchemaRules(t)}addSchema(r){this.rules[r.key]=this._parseSchemaRules(r)}async validate(r,t=!1){return new Promise((e,i)=>{const n={};let l,o;for(let c in this.rules){let h=this._validateRule(this.rules[c],r[c],r);if(h!==""&&(h=h.replace("%s",c),n[c]=h,l=c,o=h,t))break}l==null?e(!0):i(new le(n,l,o))})}async validateKey(r,t,e){return new Promise((i,n)=>{let l=this.rules[r];if(l==null){i({key:r,value:t});return}let o=this._validateRule(l,t,e);o!==""?(o=o.replace("%s",r),n(new le({[r]:o},r,o))):i({key:r,value:t})})}_validateRule(r,t,e){let i="";for(let n of r)if(n.rule==="required"?(t==null||!$t.pattern(j.required,t))&&(i=n.message):typeof n.rule=="function"?n.rule(t)||(i=n.message):n.sameKey!=null?e!=null&&($t.same(t,e[n.sameKey])||(i=n.message)):$t.pattern(n.rule,t)||(i=n.message),i!=="")break;return i}_parseSchemaRules(r){let t=[],e=r.rules;if(r.required===!0&&t.push(...this._parseStringRule("required",r.message)),e!=null)if(typeof e=="string")t=t.concat(this._parseStringRule(e,r.message));else if(e instanceof Array)for(let i of e)typeof i=="string"?t.push(...this._parseStringRule(i,r.message)):i instanceof RegExp||typeof i=="function"?t.push({rule:i,message:r.message||Ct}):typeof i.rule=="string"?t.push(...this._parseStringRule(i.rule,i.message)):t.push({rule:i.rule,message:i.message||Ct});else t.push({rule:e,message:Ct});return t}_parseStringRule(r,t){let e=[],i=r.split("|");for(let n of i){let l=t,o=null,c;if(r==="required")o="required",l=l||t||vt.required;else if(j.same.test(n)){if(n.match(j.same)!=null){o=j.same;let d=n.match(j.same);d!=null&&(c=d[1]),l=l||vt.same}}else Object.hasOwn(j,n)&&(o=j[n],l=l||vt[n]);e.push({rule:o,message:l,sameKey:c})}return e}}class oe extends N{constructor(){super();a(this,"inline",!1);a(this,"labelPosition","right");a(this,"labelWidth");a(this,"id");a(this,"disabled",!1);a(this,"sharedAttrs",["disabled","id","innerBlock"]);a(this,"validator");a(this,"innerBlock",!1);a(this,"novalidate",!1);a(this,"_data");a(this,"emit");a(this,"ruleChange",t=>{this.validator.addSchema(t)});a(this,"_valueChange",(t,e,i=!0)=>{this._data==null&&(this._data={});const n=Object.hasOwn(this._data,t);this._data[t]=e,!this.novalidate&&n&&i&&this.validator.validateKey(t,e,this._data).then(()=>{E(this.id,"validateChange",!0,t)}).catch(l=>{E(this.id,"validateChange",l.detail,t)})});M(this),this.id==null&&(this.id=`l-f${B(3)}-${B(6)}`),this.validator=new es([]),this.emit=new CustomEvent("submit")}static get observedAttributes(){return["disabled","label-position"]}attributeChangedCallback(t,e,i){if(t==="disabled"){const n=A(i,!1,t);n!==this.disabled&&(E(this.id,"attributeChanged",t,n,this.id),this.disabled=n)}else if(t==="label-position"){const n=u("form",this.root);n&&(n.className=F(["l-form",this.inline?"l-form-inline":void 0,`l-form--${i}`]))}}connectedCallback(){this.loadStyle(["form"]),super.connectedCallback(),P(this.id,"ruleChange",this.ruleChange),P(this.id,"valueChange",this._valueChange)}disconnectedCallback(){Rt(this.id),this.validator=void 0}render(){const t=F(["l-form",this.inline?"l-form-inline":void 0,`l-form--${this.labelPosition}`]),e=Y({"--l-form-label-width":this.labelWidth?this.labelWidth:""});this.shadow.innerHTML=`<form class="${t}" style="${e}"><slot></slot></form>`}validateField(t){const e=[];if(this._data!=null){if(Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const l=t[i];e.push(this.validator.validateKey(l,this._data[l],this._data))}else e.push(this.validator.validateKey(t,this._data[t],this._data));Promise.allSettled(e).then(i=>{for(let n=0,l=i.length;n<l;n++){const o=i[n];o.status==="rejected"?E(this.id,"validateChange",o.reason.detail,o.reason.key):E(this.id,"validateChange",!0,o.value.key)}})}}clearValidate(){E(this.id,"validateChange",!0)}reset(){this.clearValidate(),E(this.id,"reset")}submit(){this.novalidate?this.dispatchEvent(this.emit):this.validate().then(t=>{t&&this.dispatchEvent(this.emit)})}async validate(){if(this._data!=null)try{return await this.validator.validate(this._data),E(this.id,"validateChange",!0),Promise.resolve(!0)}catch(t){return E(this.id,"validateChange",t.detail),Promise.resolve(!1)}return Promise.resolve(!0)}getData(){return{...this._data}}}a(oe,"baseName","form");class ce extends N{constructor(){super();a(this,"disabled",!1);a(this,"sharedAttrs",["disabled","id","name","innerBlock"]);a(this,"required",!1);a(this,"error");a(this,"label");a(this,"id");a(this,"verify");a(this,"validity");a(this,"pattern");a(this,"name");a(this,"innerBlock",!1);a(this,"labelPosition","right");a(this,"formId");a(this,"_validateChange",(t,e)=>{const i=t===!0?void 0:t[this.name];(e==null||e===this.name&&this.error!=i)&&(this.error=i,this._updateError())});M(this),this.id==null&&(this.id=`l-fi${B(3)}-${B(6)}`)}static get observedAttributes(){return["error","label","disabled"]}attributeChangedCallback(t,e,i){if(t==="error")i!=this.error&&(this.error=i,this._updateError());else if(t==="label")this.label=i,this._updateLabel();else if(t==="disabled"){const n=A(i,!1,t);n!==this.disabled&&(E(this.id,"attributeChanged",t,n,this.id),this.disabled=n)}}connectedCallback(){var t;if(super.connectedCallback(),this.loadStyle(["form"]),this.formId=this._getFormId(),this.name&&this.formId){let e=((t=this.verify)==null?void 0:t.split("|"))||[];this.pattern&&e.push(new RegExp(this.pattern));const i={key:this.name,required:this.required,message:this.validity,rules:e};E(this.formId,"ruleChange",i),P(this.formId,"validateChange",this._validateChange)}}disconnectedCallback(){Rt(this.id),this.formId&&Z(this.formId,"validateChange",this._validateChange)}setRules(t){const e={...t,key:this.name};e.required!=null&&this.required&&(e.required=!0),this.formId&&E(this.formId,"ruleChange",e)}setError(t){this.error=t}render(){const t=["l-form-item",this.required?"is-required":void 0,this.error?"is-error":void 0,`l-form-item--${this.labelPosition}`],e=this.label!=null?`<label class="l-form-item__label">${this.label}</label>`:"",i=this.error?`<div class="l-form-item__error">${this.error}</div>`:"";this.shadow.innerHTML=[`<div class="${F(t)}">${e}`,'<div class="l-form-item__content">',`<slot></slot>${i}</div></div>`].join("")}_updateError(){if(!this.rendered)return;let t=u(".l-form-item__error",this.root);if(t)this.error?t.textContent=this.error:t.remove();else if(this.error){t=document.createElement("div"),t.className="l-form-item__error",t.textContent=this.error;const i=u(".l-form-item__content",this.root);i&&i.appendChild(t)}const e=u(".l-form-item",this.root);e&&(this.error?S(e,"is-error"):I(e,"is-error"))}_updateLabel(){if(!this.rendered)return;let t=u(".l-form-item__label",this.root);if(t==null){if(this.label!=null){t=document.createElement("div"),t.className="l-form-item__label",t.textContent=this.label;const e=u(".l-form-item",this.root);e&&e.appendChild(t)}}else this.label!=null?t.textContent=this.label:t.remove()}_getFormId(){let t=this.parentElement,e;for(;t!=null;){const i=t.tagName;if(i==="L-FORM"){e=t.id;break}if(i==="BODY")break;t=t.parentElement}return t=null,e}}a(ce,"baseName","form-item");class he extends Q{constructor(){super(!1);a(this,"type");a(this,"label");a(this,"checked",!1);a(this,"_changeEvent");a(this,"_radioChange",t=>{const e=t.target;let i=e.parentElement;for(;i!=null&&!At(i,"l-radio");)i=i.parentElement;const n=u(".is-checked",this.root);n&&I(n,"is-checked"),this.value=e.value,i&&S(i,"is-checked"),this.dispatchEvent(this._changeEvent)});M(this),this._changeEvent=new CustomEvent("change")}setItems(t){this._removeEvents(),this.root.innerHTML=this._renderItems(t),this._initEvents()}connectedCallback(){super.connectedCallback(),this.loadStyle(["radio"]),this._initEvents()}disconnectedCallback(){super.disconnectedCallback(),this._removeEvents()}attributeChange(t,e,i){if(t==="checked"){const n=A(i,!1,t);this.checked=n,this.value=n;const l=u(".l-radio",this.root);if(l&&!At(l,"is-checked")){S(l,"is-checked");const o=u("input",l);o&&(o.checked=!0)}}}render(){this.getName()||(this.name=`la${B(3)}_${B(6)}`);const t=[],e=u('[slot="label"]',this),i=X("[radio-value]",this);e!=null||this.label?(this.value=this._isChecked(),e?t.push(this._renderItem("slot",void 0,this._isChecked(),"label")):t.push(this._renderItem(this.label,void 0,this._isChecked(),"label"))):i.length>0&&(rt(i,n=>{const l=n.cloneNode(!0),o=ft(n,"radio-value");t.push(this._renderItem(l.outerHTML,o,this.value===o))}),this.pushValueChange()),this.root.innerHTML=t.join("")}setValue(t){super.setValue(t);let e="";typeof t!="boolean"&&(e=`[l-value="${t}"]`);const i=u(".is-checked",this.root);i&&I(i,"is-checked");const n=u(`label${e}`,this.root);if(n){const l=u("input",n);typeof t=="boolean"?(t?S(n,"is-checked"):I(n,"is-checked"),l.checked=t):(S(n,"is-checked"),l.checked=!0)}}_renderItems(t){const e=[];for(let i=0,n=t.length;i<n;i++){const l=t[i];e.push(this._renderItem(l.label,l.value,this.value===l.value,l.labelPart))}return e.join("")}_renderItem(t,e,i=!1,n=void 0){const l=F({"l-radio":!0,"l-radio--disabled":this.isDisabled(),"l-radio--button":this.type==="button","is-checked":i}),o=H("disabled",this.isDisabled()),c=H("checked",i),h=H("value",e),y=`${H("name",this.getName())}${h}${o}${c}`,R=H("part",n),dt=H("l-value",e),T=[`<label class="${l}"${dt}>`,`<input type="radio" class="l-radio__input"${y} />`];this.type!=="button"&&T.push('<span class="l-radio__inner"></span>');let st=t==="slot"?'<slot name="label"></slot>':t;return T.push(`<div class="l-radio__label"${R}>${st}</div>`),T.push("</label>"),T.join("")}_isChecked(){return this.checked}_initEvents(){rt(X("input",this.root),t=>{_(t,"change",this._radioChange)})}_removeEvents(){rt(X("input",this.root),t=>{w(t,"change",this._radioChange)})}}a(he,"baseName","radio"),f(bt);class de extends N{constructor(){super();a(this,"finish",!1);a(this,"infinite",!0);a(this,"observer");a(this,"loadMoreEmit");a(this,"$more");M(this),this.loadMoreEmit=new CustomEvent("load-more")}static get observedAttributes(){return["finish"]}attributeChangedCallback(t,e,i){if(t==="finish"){const n=A(i,!1,t);this.finish!==n&&(this.finish=n,this._finishChange())}}connectedCallback(){this.loadStyle(["list"]),this.loadExternalStyle(["animation"]),super.connectedCallback(),this.infinite&&(this.observer=new IntersectionObserver(t=>{t[0].isIntersecting&&!this.finish&&this.dispatchEvent(this.loadMoreEmit)}),this.$more=u(".l-list-loadmore",this.root),!this.finish&&this.$more&&this.observer.observe(this.$more))}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.$more&&(this.observer.unobserve(this.$more),this.$more=void 0),this.observer.disconnect(),this.observer=void 0),this.loadMoreEmit=void 0}render(){const t=["<slot></slot>"];this.infinite&&(t.push('<div class="l-list-loadmore">'),this.finish||t.push('<l-loading-icon class="l-list-icon l-rotate-anim"></l-loading-icon>'),t.push(`<span class="l-list-loadmore-text">${this._loadingText()}</span></div>`)),this.root.innerHTML=t.join("")}_loadingText(){return this.finish?"已经到底啦!":"加载中……"}_finishChange(){if(this.$more){this.observer&&(this.finish?this.observer.unobserve(this.$more):this.observer.observe(this.$more));const t=u(".l-list-loadmore-text",this.$more);t&&(t.textContent=this._loadingText());let e=u(".l-list-icon",this.$more);this.finish?e&&e.remove():e==null&&(e=document.createElement("l-loading-icon"),e.className="l-list-icon l-rotate-anim",this.$more.prepend(e))}}}a(de,"baseName","list");class ue extends N{constructor(){super();a(this,"shape","triangle-top");a(this,"background");M(this)}connectedCallback(){this.loadStyle(["polygon"]),super.connectedCallback()}render(){const t=F(["l-polygon",this.shape?`l-polygon-${this.shape}`:""]),e=Y([this.background?`--l-polygen-background: ${this.background}`:""]);this.root.innerHTML=`<div part="default" class="${t}" style="${e}"></div>`}}a(ue,"baseName","polygon");class fe extends Q{constructor(){super();a(this,"$select");a(this,"changeEmit");a(this,"_handleChange",t=>{const e=t.target.value;super.setValue(e),this.dispatchEvent(this.changeEmit)});M(this),this.changeEmit=new CustomEvent("change")}connectedCallback(){this.loadStyle(["input"]),super.connectedCallback(),this.$select=u("select",this.root),this.value&&(this.$select.value=this.value),_(this.$select,"change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.$select&&w(this.$select,"change",this._handleChange),this.changeEmit=void 0,this.$select=void 0}render(){let t=this.innerHTML.trim();const e=Fe([["name",this.getName()],["disabled",this.isDisabled()]]);this.root.innerHTML=`<select class="l-input"${e}>${t}</select>`}_changeDisabled(){this.$select&&(this.$select.disabled=this.isDisabled())}setOptions(t){if(!this.$select)return;const e=t.map(i=>`<option value="${i.value}">${i.label}</option>`);this.$select.innerHTML=e.join("")}appendOptions(t){if(!this.$select)return;const e=document.createDocumentFragment();for(let i=0,n=t.length;i<n;i++){const l=t[i],o=document.createElement("option");o.value=l.value,o.innerHTML=l.label,e.appendChild(o)}this.$select.appendChild(e)}reset(){super.reset(),this.$select&&(this.$select.value=this.value)}setValue(t){super.setValue(t),this.$select&&(this.$select.value=this.value)}}a(fe,"baseName","select-ori");class me extends Q{constructor(){super(!1);x(this,J);a(this,"actionRender");a(this,"checkedText");a(this,"uncheckedText");x(this,tt,t=>{this.isDisabled()||(this.setValue(!this.value),this.dispatchEvent(new CustomEvent("change")))});M(this);const t=this.value?A(this.value,!1,"value"):!1;this._resetValue=t,this.value=t}connectedCallback(){this.loadStyle(["switch"]),super.connectedCallback(),this.pushValueChange(),$(this,J,ut).call(this),_(this,"click",b(this,tt))}disconnectedCallback(){super.disconnectedCallback(),w(this,"click",b(this,tt)),this.actionRender=void 0}render(){this.isDisabled()&&this.classList.add("l-switch--disabled"),this.value&&this.classList.add("l-switch--checked");const t=['<div class="l-switch-action" part="action"></div>'];if(this.checkedText||this.uncheckedText){const e=this.value?this.checkedText||"":this.uncheckedText||"";t.push(`<span class="l-switch-text">${e}</span>`)}return t.join("")}setValue(t){super.setValue(t),t?S(this,"l-switch--checked"):I(this,"l-switch--checked");const e=u(".l-switch-text",this.root);e&&(e.textContent=this.value?this.checkedText||"":this.uncheckedText||""),$(this,J,ut).call(this)}setActionRender(t){this.actionRender=t,$(this,J,ut).call(this)}}tt=new WeakMap,J=new WeakSet,ut=function(){const t=u(".l-switch-action",this.root);if(t)if(this.actionRender){const e=this.actionRender({checked:this.value});typeof e=="string"?t.innerHTML=e:t.innerHTML=e.outerHTML}else{const e=u('[slot="checked-action"]',this),i=u('[slot="unchecked-action"]',this);this.value&&e?t.innerHTML='<slot name="checked-action"></slot>':!this.value&&i&&(t.innerHTML='<slot name="unchecked-action"></slot>')}},a(me,"baseName","switch");class pe extends Q{constructor(){super();a(this,"$picker");a(this,"_value","#000000");a(this,"_handleChange",t=>{const e=t.target.value;super.setValue(e),this.dispatchEvent(new CustomEvent("change",{detail:e}))});M(this)}setValue(t){super.setValue(t),this.$picker&&(this.$picker.value=t)}connectedCallback(){this.loadStyle(["input","color_picker"]),super.connectedCallback(),this.$picker=u("input",this.root),_(this.$picker,"change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.$picker&&(w(this.$picker,"change",this._handleChange),this.$picker=void 0)}render(){const t=document.createElement("input");return Re(t,[["value",this.value],["disabled",this.isDisabled()],["name",this.getName()],["type","color"],["class","l-input l-color-picker"]]),t}_changeDisabled(){this.$picker&&(this.$picker.disabled=this.isDisabled())}}a(pe,"baseName","color-picker");function ss(s,r,t){let e=s.target,i="";do if(t&&t.isSameNode(e)||e.tagName==="BODY"||(e.getAttribute&&(i=e.getAttribute(r)||""),i===""&&(e=e.parentNode),!e))break;while(i==="");return[i!=="__stop__"&&i!=="",i,e]}class be extends N{constructor(){super();x(this,q);a(this,"type","nav");a(this,"name");a(this,"justifyContent");a(this,"gap");a(this,"$line");a(this,"_handleClick",t=>{const[e,i]=ss(t,"l-name",this.root);e&&i!==this.name&&(this.name=i,this.dispatchEvent(new CustomEvent("change",{detail:{name:i}})),this._updateActive(),this._updateLine())});M(this),this.root}connectedCallback(){this.loadStyle(["tabbar"]),S(this,`l-tabbar--${this.type}`),!v(this.gap)&&!this.gap.startsWith("0")&&S(this,"l-tabbar-gap"),super.connectedCallback(),this._init()}static get observedAttributes(){return["name","type","justify-content","gap"]}attributeChangedCallback(t,e,i){if(t==="name"){const n=A(i,void 0);this.name=n,this._updateActive(),this._updateLine()}else if(t==="type"){const n=A(i,"nav");if(n!==this.type&&(I(this,`l-tabbar--${this.type}`),this.type=n,I(this,`l-tabbar--${n}`),n==="card")){let l=u(".l-tabbar-card-border",this.root);l||(l=L("div",{class:"l-tabbar-card-border"}),this.root.appendChild(l))}}else{const n=A(i,void 0);this[t]=n;const l=u(".l-tabbar-wrapper",this.root);l&&(l.style.cssText=$(this,q,xt).call(this)),t==="gap"&&(!v(this.gap)&&!this.gap.startsWith("0")?S(this,"l-tabbar-gap"):I(this,"l-tabbar-gap"))}}disconnectedCallback(){super.disconnectedCallback(),this._destroy()}render(){const t=X("[l-name]",this),e=document.createDocumentFragment(),i=document.createElement("div");if(i.className="l-tabbar-wrapper",i.style.cssText=$(this,q,xt).call(this),i.setAttribute("part","default"),t.length>0&&rt(t,n=>{const l=n.getAttribute("l-name");if(l){const o=n.cloneNode(!0);o.classList.add("l-tabbar-item"),l===this.name&&o.classList.add("active");const c=u("[l-icon]",o),h=X(":not([l-icon])",o);if(c){const d=L("div",{class:["l-tabbar-item-icon",h.length===0?"only":void 0]});d.appendChild(c.cloneNode(!0)),c.replaceWith(d)}i.appendChild(o)}}),e.appendChild(i),this.type==="card"){const n=L("div",{class:"l-tabbar-card-border"});e.appendChild(n)}return e}setItems(t){const e=u(".l-tabbar-wrapper",this.root);e&&(e.innerHTML="",e.appendChild($(this,q,Mt).call(this,t)))}addItems(t){const e=u(".l-tabbar-wrapper",this.root);e&&e.appendChild($(this,q,Mt).call(this,t))}_init(){_(this.root,"click",this._handleClick),setTimeout(()=>{this._updateLine()},300)}_destroy(){w(this.root,"click",this._handleClick),this.$line=void 0}_updateActive(){const t=u(".active",this.root);t&&I(t,"active");const e=u(`[l-name="${this.name}"]`,this.root);e&&S(e,"active")}_updateLine(){queueMicrotask(()=>{if(!this.name||this.type==="nav"||!this.rendered)return;const t=u(".active",this.root);if(!t)return;const e=t.offsetLeft;if(!this.$line){const i=L("div",{class:"l-tabbar--bar-line"});this.root.appendChild(i),this.$line=u(".l-tabbar--bar-line",this.root)}this.$line.style.cssText=`width:${t.offsetWidth}px;left:${e}px`,ze(t,this)||this.scrollTo({left:e,behavior:"smooth"})})}}q=new WeakSet,xt=function(){const t={};if(v(this.justifyContent)||(t["justify-content"]=this.justifyContent),!v(this.gap)){let e=this.gap;it(e,{isPositive:!0})&&(e=`${e}px`),t["--l-tabbar-item-gap"]=e}return Y(t)},Mt=function(t){const e=document.createDocumentFragment();for(let i=0,n=t.length;i<n;i++){const l=t[i],o=L("div",{class:F(["l-tabbar-item",this.name===l.name?"active":void 0]),"l-name":l.name}),c=l.icon;if(c){const d=L("div",{class:"l-tabbar-item-icon"});let y=typeof c=="string"?c:c();typeof y=="string"?d.innerHTML=y:d.appendChild(y),o.appendChild(d)}const h=l.text;if(h){let d=typeof h=="string"?h:h();typeof d=="string"?o.appendChild(L(d)):o.appendChild(d)}e.appendChild(o)}return e},a(be,"baseName","tabbar");function ge(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"auto"}async function is(s,r=!0){return new Promise(t=>{const e=document.documentElement.classList;s==null&&(s=ge());function i(){s==="light"?(e.add("light"),e.remove("dark")):s==="dark"?(e.add("dark"),e.remove("light")):e.remove("light","dark")}r&&document.startViewTransition?document.startViewTransition(()=>{i(),t(s)}):(i(),t(s))})}function rs(){let s=document.documentElement.className.match(/light|dark/);return s!=null&&(s=s[0]),s==null&&(s=localStorage.getItem("web-theme-appearance")),s==null&&(s=ge()),s}async function ns(s,r=!0,t=!0){return r===!0&&localStorage.setItem("web-theme-appearance",s??"auto"),is(s,t)}function as(s){const r=document.documentElement,t=r.className.match(/color-([0-9a-fA-F]{6})/);if(t==null){let e=getComputedStyle(r).getPropertyValue("--nt-primary-color");return e===""&&(e=localStorage.getItem("web-theme-color")),e||s}return`#${t[1]}`}async function ls(s){const r=[`--nt-primary-color: ${s};`,`--l-primary-color: ${s};`,`--nt-primary-color-dark1: ${U(s,1,!1)};`,`--l-primary-color-dark1: ${U(s,1,!1)};`];for(let e=1;e<=5;e++)r.push(`--nt-primary-color-light${e}: ${U(s,e)};`),r.push(`--l-primary-color-light${e}: ${U(s,e)};`);let t=document.getElementById("color-theme-style");return t==null&&(t=document.createElement("style"),t.id="color-theme-style",document.head.appendChild(t)),t.innerHTML=`:root{${r.join("")}}`,s}function os(s,r=!0){return r===!0&&localStorage.setItem("web-theme-color",s),ls(s)}const cs=[{value:"auto",text:"跟随系统",icon:"l-theme-default-icon"},{value:"light",text:"浅色模式",icon:"l-sun-icon"},{value:"dark",text:"深色模式",icon:"l-moon-icon"}];class ve extends N{constructor(){super();x(this,k);a(this,"type","button");a(this,"label","text");a(this,"theme");x(this,z);x(this,W,async t=>{let e;if(this.type==="button")e=this.theme==="dark"?"auto":"dark";else{const i=t.target.value;this.type!=="switch"?e=i:e=i?"dark":"light"}await ns(e),this.theme=e,this.type==="button"&&$(this,k,Et).call(this,b(this,z)),this.dispatchEvent(new CustomEvent("change",{detail:e}))});M(this),this.theme=rs()}connectedCallback(){this.loadStyle(["theme"]),super.connectedCallback(),$(this,k,Le).call(this)}disconnectedCallback(){super.disconnectedCallback(),$(this,k,Se).call(this)}render(){switch(this.type){case"select":return $(this,k,xe).call(this);case"radio":return $(this,k,Ee).call(this);case"switch":return $(this,k,Me).call(this);default:return $(this,k,we).call(this)}}}z=new WeakMap,k=new WeakSet,we=function(){const t=L("l-button",{class:"l-theme-btn l-theme-inner"});return $(this,k,Et).call(this,t),t},Et=function(t){const e=this.theme==="auto"?"sun":"moon";t.innerHTML=`<l-${e}-icon></l-${e}-icon>`},xe=function(){const t=L("l-select-ori",{class:"l-theme-inner"});t.value=this.theme;const e=['<option value="auto">跟随系统</option>','<option value="light">浅色模式</option>','<option value="dark">深色模式</option>'];return t.innerHTML=e.join(""),t},Me=function(){const t=L("l-switch",{class:"l-theme-switch l-theme-inner"});return t.value=this.theme==="dark",t.innerHTML='<l-sun-icon slot="unchecked-action"></l-sun-icon><l-moon-icon slot="checked-action"></l-moon-icon>',t},Ee=function(){const t=L("l-radio",{class:"l-theme-inner"});t.value=this.theme,t.type="button";const e=cs.map(i=>this.label==="icon"?`<${i.icon} radio-value="${i.value}"></${i.icon}>`:`<span radio-value="${i.value}">${i.text}</span>`);return t.innerHTML=e.join(""),t},W=new WeakMap,Le=function(){wt(this,z,u(".l-theme-inner",this.root)),this.type==="button"?_(b(this,z),"click",b(this,W)):_(b(this,z),"change",b(this,W))},Se=function(){b(this,z)&&(this.type==="button"?w(b(this,z),"click",b(this,W)):w(b(this,z),"change",b(this,W)),wt(this,z,void 0))},a(ve,"baseName","theme");class Ce extends N{constructor(){super();x(this,ot);a(this,"color");x(this,ct,async t=>{const e=t.detail;this.color=e,await os(e),this.dispatchEvent(new CustomEvent("change",{detail:e}))});this.color=as()||"#722ed1"}connectedCallback(){super.connectedCallback(),$(this,ot,Ae).call(this)}render(){const t=document.createElement("l-color-picker");return t.value=this.color,t}}ot=new WeakSet,Ae=function(){const t=u("l-color-picker",this.root);t&&_(t,"change",b(this,ct))},ct=new WeakMap,a(Ce,"baseName","theme-color");const D=new Map;function $e(s){for(const r of D.values())for(const t of r)hs(s,t)}function hs(s,r){const t=s.target,e=!t,i=r.el.contains(t),n=r.el===t;e||i||n||r.handler(s)}function ds(s,r){D.has(s)||D.set(s,[]);const t=D.get(s);t&&t.push({el:s,handler:r}),D.size===1&&document.addEventListener("click",$e,!0)}function us(s){D.delete(s),D.size===0&&document.removeEventListener("click",$e,!0)}class ye extends N{constructor(){super();x(this,V);a(this,"inline",!1);a(this,"placement","top");a(this,"content");a(this,"showArrow",!0);a(this,"trigger","hover");a(this,"disabled",!1);a(this,"isShow",!1);a(this,"width");a(this,"destroyOnHide",!1);a(this,"offset");a(this,"position","absolute");a(this,"theme","default");a(this,"_t");x(this,ht,t=>{t.target.id!==this.id&&this.hide()});x(this,O,t=>{this.show(t.target)});x(this,K,()=>{this.hide()});x(this,et,t=>{this.trigger==="click"?this.toggle(t.target):this.trigger==="focus"&&this.show(t.target)});M(this),this.id||(this.id=`${It()}-popover`),this.style.display=this.inline?"inline-block":"block"}connectedCallback(){this.loadStyle(["popover"]),super.connectedCallback(),this.renderContent(),$(this,V,Ne).call(this)}disconnectedCallback(){super.disconnectedCallback(),$(this,V,Te).call(this)}render(){const t=document.createElement("slot");return t.setAttribute("name","trigger"),t}renderContent(){if(!this.isShow)return;let t=u(".l-popover--content",this.root);if(t){t.style.removeProperty("display");return}if(t=St("div",{class:["l-popover--content",`l-popover-${this.placement}`,this.theme==="tooltip"?"l-popover-tooltip":void 0]}),this.offset&&(t.style.cssText="--l-popover-offset: ${this.offset}px;"),t.part="content",t.innerHTML=this.content?this.content:"<slot></slot>",this.showArrow){const e=St("div",{class:"l-popover--arrow"});t.appendChild(e)}this.trigger==="hover"&&(_(t,"mouseenter",b(this,O)),_(t,"mouseleave",b(this,K))),this.root.appendChild(t)}hideContent(){const t=u(".l-popover--content",this.root);t&&(this.destroyOnHide?(this.trigger==="hover"&&(w(t,"mouseenter",b(this,O)),w(t,"mouseleave",b(this,K))),this.root.removeChild(t)):t.style.display="none")}show(t){if(!this.disabled){if(this.isShow){$(this,V,Ie).call(this);return}this.isShow=!0,this.renderContent(),$(this,V,He).call(this,t)}}hide(){this._t=setTimeout(()=>{this.isShow=!1,this.hideContent()},50)}toggle(t){this.isShow?this.hide():this.show(t)}}V=new WeakSet,Ne=function(){const t=u('[slot="trigger"]',this);t&&(this.trigger==="hover"?(_(t,"mouseenter",b(this,O)),_(t,"mouseleave",b(this,K))):(this.trigger==="click"||this.trigger==="focus")&&(_(t,"click",b(this,et)),ds(t,b(this,ht))))},Te=function(){const t=u('[slot="trigger"]',this);t&&(this.trigger==="hover"?(w(t,"mouseenter",b(this,O)),w(t,"mouseleave",b(this,K))):(this.trigger==="click"||this.trigger==="focus")&&(w(t,"click",b(this,et)),us(t)))},ht=new WeakMap,O=new WeakMap,K=new WeakMap,et=new WeakMap,Ie=function(){this._t&&(clearTimeout(this._t),this._t=void 0)},He=function(t){let e="bottom",i="";const n=this.placement.split("-");n!=null&&(e=n[0],i=n[1]||"");let l;t==null&&(t=u('[slot="trigger"]',this));const o=u(".l-popover--content",this.root);if(o){let c=o.getBoundingClientRect();const h=t.getBoundingClientRect();let d=document.documentElement;const y=d.scrollLeft,R=d.scrollTop;this.width!=null&&(this.width==="trigger"?l=h.width:l=this.width),l!=null&&(c.width=l);const dt=mt(h,c,e,i,this.offset),T=pt(h,c,e,i,this.offset),st=Be(h,c,e,i,y,R,T,dt,this.offset);e=st.mainAlign,i=st.crossAlign,l!=null&&o.style.setProperty("width",`${l}px`);const ke=`l-popover-${e}${i===""?"":"-"+i}`,kt=o.className.split(" ");kt[1]!==ke&&(kt[1]=`${ke}`,o.className=kt.join(" "))}},a(ye,"baseName","popover"),f(ye),f(Qt),f(Ce),f(ve),f(be),f(pe),f(me),f(fe),f(ue),f(de),f(he),f(oe),f(ce),f(Ft),f(Bt),f(C),f(qt),f(Wt),f(Ot),f(Kt),f(bt),f(Yt),f(Ut),f(Gt),f(Jt),f(Xt),f(Zt),f(te),f([Pt,jt,Dt]),globalThis.LMessage=lt;function fs(){const s=document.currentScript.src,r=s.lastIndexOf("/"),e=`${s.slice(0,r+1)}litos-ui.css`,i=document.createElement("link");i.rel="stylesheet",i.href=e,i.id="litos-ui-style",document.head.appendChild(i)}fs()})();
|
package/lib/message/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { regist as a, useId as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { regist as a, useId as y } from "../utils/index.js";
|
|
2
|
+
import { transition as m } from "ph-utils/dom";
|
|
3
|
+
import g from "../icon/mask_close.js";
|
|
4
|
+
import p from "../icon/success.js";
|
|
5
|
+
import h from "../icon/warn.js";
|
|
6
|
+
import $ from "../icon/info.js";
|
|
7
|
+
a(g);
|
|
7
8
|
a(p);
|
|
8
9
|
a(h);
|
|
9
10
|
a($);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
["
|
|
13
|
-
["transform", "translate3d(-50%, -100%, 0)"]
|
|
11
|
+
const i = [], d = [
|
|
12
|
+
["opacity", "0", "0.3s"],
|
|
13
|
+
["transform", "translate3d(-50%, -100%, 0)", "0.3s"]
|
|
14
14
|
];
|
|
15
|
-
function
|
|
16
|
-
const t =
|
|
15
|
+
function u(e) {
|
|
16
|
+
const t = i.findIndex((o) => o.id === e);
|
|
17
17
|
if (t === -1) return;
|
|
18
|
-
const s =
|
|
18
|
+
const s = i.splice(t, 1)[0];
|
|
19
19
|
if (s == null) return;
|
|
20
|
-
|
|
20
|
+
m(s, d, "leave", () => {
|
|
21
21
|
s.remove();
|
|
22
22
|
});
|
|
23
|
-
const
|
|
23
|
+
const r = 15 + s.offsetHeight, n = i.length;
|
|
24
24
|
if (n !== 0)
|
|
25
25
|
for (let o = t; o < n; o++) {
|
|
26
|
-
const c =
|
|
26
|
+
const c = i[o], f = parseInt(c.style.top, 10) - r;
|
|
27
27
|
c.style.setProperty("top", `${f}px`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function v(e) {
|
|
31
31
|
const t = document.createElement("div");
|
|
32
32
|
t.id = e.id;
|
|
33
33
|
const s = e.type || "info";
|
|
34
|
-
let
|
|
35
|
-
e.customClass && (
|
|
34
|
+
let r = `l-message l-message-${s}`;
|
|
35
|
+
e.customClass && (r += " " + e.customClass), t.className = r, t.style.setProperty("top", `${e.offset}px`), t.style.setProperty("z-index", `${e.zindex || 1e3}`), e.width && t.style.setProperty("width", e.width);
|
|
36
36
|
let n = s;
|
|
37
37
|
return n === "error" && (n = "mask-close"), t.innerHTML = [
|
|
38
38
|
'<div class="l-message-container">',
|
|
@@ -42,16 +42,16 @@ function x(e) {
|
|
|
42
42
|
].join(""), t;
|
|
43
43
|
}
|
|
44
44
|
const l = (e) => {
|
|
45
|
-
const t =
|
|
45
|
+
const t = i.reduce(
|
|
46
46
|
(c, f) => c + f.offsetHeight + 15,
|
|
47
47
|
15
|
|
48
|
-
), s =
|
|
49
|
-
|
|
50
|
-
const n =
|
|
51
|
-
|
|
52
|
-
let o =
|
|
48
|
+
), s = y(), r = typeof e == "string" ? { message: e } : e;
|
|
49
|
+
r.id = s, r.offset = t;
|
|
50
|
+
const n = v(r);
|
|
51
|
+
i.push(n), document.body.appendChild(n), m(n, d, "enter");
|
|
52
|
+
let o = r.duration;
|
|
53
53
|
return o == null && (o = 3e3), o !== 0 && setTimeout(() => {
|
|
54
|
-
|
|
54
|
+
u(s);
|
|
55
55
|
}, o), s;
|
|
56
56
|
};
|
|
57
57
|
for (const e of ["info", "success", "error", "warn", "show"])
|
|
@@ -59,7 +59,7 @@ for (const e of ["info", "success", "error", "warn", "show"])
|
|
|
59
59
|
const s = typeof t == "string" ? { message: t } : t;
|
|
60
60
|
return e !== "show" ? s.type = e : s.type == null && (s.type = "info"), l(s);
|
|
61
61
|
};
|
|
62
|
-
l.close =
|
|
62
|
+
l.close = u;
|
|
63
63
|
export {
|
|
64
64
|
l as default
|
|
65
65
|
};
|
package/lib/polygon/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var l = (o, t, s) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var a = (o, t, s) => l(o, typeof t != "symbol" ? t + "" : t, s);
|
|
4
4
|
import { formatClass as n, formatStyle as c } from "ph-utils/dom";
|
|
5
5
|
import i from "../base.js";
|
|
6
|
-
import { initAttr as p } from "../
|
|
6
|
+
import { initAttr as p } from "../utils/index.js";
|
|
7
7
|
class d extends i {
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import BaseComponent from "../base";
|
|
2
|
+
type PlacementProp = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
3
|
+
type TriggerProp = "hover" | "click" | "focus";
|
|
4
|
+
export default class Popover extends BaseComponent {
|
|
5
|
+
#private;
|
|
6
|
+
static baseName: string;
|
|
7
|
+
inline: boolean;
|
|
8
|
+
placement: PlacementProp;
|
|
9
|
+
content?: string;
|
|
10
|
+
showArrow: boolean;
|
|
11
|
+
trigger: TriggerProp;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
isShow: boolean;
|
|
14
|
+
/** 宽度, 'trigger' 表示 popover 的宽度会和它的触发元素一致 */
|
|
15
|
+
width?: string | number;
|
|
16
|
+
/** 隐藏时销毁 DOM 结构 */
|
|
17
|
+
destroyOnHide: boolean;
|
|
18
|
+
/** 浮层偏移量 */
|
|
19
|
+
offset?: number;
|
|
20
|
+
/** 浮层定位方式 */
|
|
21
|
+
position: "absolute" | "fixed";
|
|
22
|
+
theme: "default" | "tooltip";
|
|
23
|
+
private _t?;
|
|
24
|
+
constructor();
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
disconnectedCallback(): void;
|
|
27
|
+
render(): HTMLSlotElement;
|
|
28
|
+
renderContent(): void;
|
|
29
|
+
hideContent(): void;
|
|
30
|
+
show($referece?: HTMLElement): void;
|
|
31
|
+
hide(): void;
|
|
32
|
+
toggle($referece?: HTMLElement): void;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var S = (e) => {
|
|
3
|
+
throw TypeError(e);
|
|
4
|
+
};
|
|
5
|
+
var N = (e, i, t) => i in e ? M(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
|
|
6
|
+
var s = (e, i, t) => N(e, typeof i != "symbol" ? i + "" : i, t), T = (e, i, t) => i.has(e) || S("Cannot " + t);
|
|
7
|
+
var o = (e, i, t) => (T(e, i, "read from private field"), t ? t.call(e) : i.get(e)), d = (e, i, t) => i.has(e) ? S("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t);
|
|
8
|
+
var g = (e, i, t) => (T(e, i, "access private method"), t);
|
|
9
|
+
import j from "../base.js";
|
|
10
|
+
import { initAttr as D, useId as X, getPopoverOffsetY as Y, getPopoverOffsetX as q, impactDetect as z } from "../utils/index.js";
|
|
11
|
+
import { set as F, remove as G } from "../utils/clickoutside.js";
|
|
12
|
+
import { $one as f, $$ as x, on as m, off as u } from "ph-utils/dom";
|
|
13
|
+
var r, A, E, $, h, c, v, L, R;
|
|
14
|
+
class J extends j {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
d(this, r);
|
|
18
|
+
s(this, "inline", !1);
|
|
19
|
+
s(this, "placement", "top");
|
|
20
|
+
s(this, "content");
|
|
21
|
+
s(this, "showArrow", !0);
|
|
22
|
+
s(this, "trigger", "hover");
|
|
23
|
+
s(this, "disabled", !1);
|
|
24
|
+
s(this, "isShow", !1);
|
|
25
|
+
/** 宽度, 'trigger' 表示 popover 的宽度会和它的触发元素一致 */
|
|
26
|
+
s(this, "width");
|
|
27
|
+
/** 隐藏时销毁 DOM 结构 */
|
|
28
|
+
s(this, "destroyOnHide", !1);
|
|
29
|
+
/** 浮层偏移量 */
|
|
30
|
+
s(this, "offset");
|
|
31
|
+
/** 浮层定位方式 */
|
|
32
|
+
s(this, "position", "absolute");
|
|
33
|
+
s(this, "theme", "default");
|
|
34
|
+
s(this, "_t");
|
|
35
|
+
d(this, $, (t) => {
|
|
36
|
+
t.target.id !== this.id && this.hide();
|
|
37
|
+
});
|
|
38
|
+
d(this, h, (t) => {
|
|
39
|
+
this.show(t.target);
|
|
40
|
+
});
|
|
41
|
+
d(this, c, () => {
|
|
42
|
+
this.hide();
|
|
43
|
+
});
|
|
44
|
+
d(this, v, (t) => {
|
|
45
|
+
this.trigger === "click" ? this.toggle(t.target) : this.trigger === "focus" && this.show(t.target);
|
|
46
|
+
});
|
|
47
|
+
D(this), this.id || (this.id = `${X()}-popover`), this.style.display = this.inline ? "inline-block" : "block";
|
|
48
|
+
}
|
|
49
|
+
connectedCallback() {
|
|
50
|
+
this.loadStyle(["popover"]), super.connectedCallback(), this.renderContent(), g(this, r, A).call(this);
|
|
51
|
+
}
|
|
52
|
+
disconnectedCallback() {
|
|
53
|
+
super.disconnectedCallback(), g(this, r, E).call(this);
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
const t = document.createElement("slot");
|
|
57
|
+
return t.setAttribute("name", "trigger"), t;
|
|
58
|
+
}
|
|
59
|
+
renderContent() {
|
|
60
|
+
if (!this.isShow) return;
|
|
61
|
+
let t = f(".l-popover--content", this.root);
|
|
62
|
+
if (t) {
|
|
63
|
+
t.style.removeProperty("display");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (t = x("div", {
|
|
67
|
+
class: [
|
|
68
|
+
"l-popover--content",
|
|
69
|
+
`l-popover-${this.placement}`,
|
|
70
|
+
this.theme === "tooltip" ? "l-popover-tooltip" : void 0
|
|
71
|
+
]
|
|
72
|
+
}), this.offset && (t.style.cssText = "--l-popover-offset: ${this.offset}px;"), t.part = "content", t.innerHTML = this.content ? this.content : "<slot></slot>", this.showArrow) {
|
|
73
|
+
const n = x("div", {
|
|
74
|
+
class: "l-popover--arrow"
|
|
75
|
+
});
|
|
76
|
+
t.appendChild(n);
|
|
77
|
+
}
|
|
78
|
+
this.trigger === "hover" && (m(t, "mouseenter", o(this, h)), m(t, "mouseleave", o(this, c))), this.root.appendChild(t);
|
|
79
|
+
}
|
|
80
|
+
hideContent() {
|
|
81
|
+
const t = f(".l-popover--content", this.root);
|
|
82
|
+
t && (this.destroyOnHide ? (this.trigger === "hover" && (u(t, "mouseenter", o(this, h)), u(t, "mouseleave", o(this, c))), this.root.removeChild(t)) : t.style.display = "none");
|
|
83
|
+
}
|
|
84
|
+
show(t) {
|
|
85
|
+
if (!this.disabled) {
|
|
86
|
+
if (this.isShow) {
|
|
87
|
+
g(this, r, L).call(this);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.isShow = !0, this.renderContent(), g(this, r, R).call(this, t);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
hide() {
|
|
94
|
+
this._t = setTimeout(() => {
|
|
95
|
+
this.isShow = !1, this.hideContent();
|
|
96
|
+
}, 50);
|
|
97
|
+
}
|
|
98
|
+
toggle(t) {
|
|
99
|
+
this.isShow ? this.hide() : this.show(t);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
r = new WeakSet(), A = function() {
|
|
103
|
+
const t = f('[slot="trigger"]', this);
|
|
104
|
+
t && (this.trigger === "hover" ? (m(t, "mouseenter", o(this, h)), m(t, "mouseleave", o(this, c))) : (this.trigger === "click" || this.trigger === "focus") && (m(t, "click", o(this, v)), F(t, o(this, $))));
|
|
105
|
+
}, E = function() {
|
|
106
|
+
const t = f('[slot="trigger"]', this);
|
|
107
|
+
t && (this.trigger === "hover" ? (u(t, "mouseenter", o(this, h)), u(t, "mouseleave", o(this, c))) : (this.trigger === "click" || this.trigger === "focus") && (u(t, "click", o(this, v)), G(t)));
|
|
108
|
+
}, $ = new WeakMap(), h = new WeakMap(), c = new WeakMap(), v = new WeakMap(), L = function() {
|
|
109
|
+
this._t && (clearTimeout(this._t), this._t = void 0);
|
|
110
|
+
}, R = function(t) {
|
|
111
|
+
let n = "bottom", l = "";
|
|
112
|
+
const y = this.placement.split("-");
|
|
113
|
+
y != null && (n = y[0], l = y[1] || "");
|
|
114
|
+
let a;
|
|
115
|
+
t == null && (t = f('[slot="trigger"]', this));
|
|
116
|
+
const p = f(".l-popover--content", this.root);
|
|
117
|
+
if (p) {
|
|
118
|
+
let w = p.getBoundingClientRect();
|
|
119
|
+
const C = t.getBoundingClientRect();
|
|
120
|
+
let k = document.documentElement;
|
|
121
|
+
const _ = k.scrollLeft, H = k.scrollTop;
|
|
122
|
+
this.width != null && (this.width === "trigger" ? a = C.width : a = this.width), a != null && (w.width = a);
|
|
123
|
+
const B = Y(
|
|
124
|
+
C,
|
|
125
|
+
w,
|
|
126
|
+
n,
|
|
127
|
+
l,
|
|
128
|
+
this.offset
|
|
129
|
+
), I = q(
|
|
130
|
+
C,
|
|
131
|
+
w,
|
|
132
|
+
n,
|
|
133
|
+
l,
|
|
134
|
+
this.offset
|
|
135
|
+
), O = z(
|
|
136
|
+
C,
|
|
137
|
+
w,
|
|
138
|
+
n,
|
|
139
|
+
l,
|
|
140
|
+
_,
|
|
141
|
+
H,
|
|
142
|
+
I,
|
|
143
|
+
B,
|
|
144
|
+
this.offset
|
|
145
|
+
);
|
|
146
|
+
n = O.mainAlign, l = O.crossAlign, a != null && p.style.setProperty("width", `${a}px`);
|
|
147
|
+
const P = `l-popover-${n}${l === "" ? "" : "-" + l}`, b = p.className.split(" ");
|
|
148
|
+
b[1] !== P && (b[1] = `${P}`, p.className = b.join(" "));
|
|
149
|
+
}
|
|
150
|
+
}, s(J, "baseName", "popover");
|
|
151
|
+
export {
|
|
152
|
+
J as default
|
|
153
|
+
};
|
package/lib/radio/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export default class Radio extends FormInner {
|
|
|
17
17
|
disconnectedCallback(): void;
|
|
18
18
|
protected attributeChange(name: string, oldValue: string, newValue: string): void;
|
|
19
19
|
render(): void;
|
|
20
|
+
setValue(value: any): void;
|
|
20
21
|
private _renderItems;
|
|
21
22
|
private _renderItem;
|
|
22
23
|
private _isChecked;
|