x-next 0.0.0-alpha.1 → 0.0.0-alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +24 -2
- package/dist/_hooks/use-overflow.d.ts +5 -0
- package/dist/_hooks/use-popup-manager.d.ts +11 -0
- package/dist/_props/css.d.ts +13 -0
- package/dist/_props/global.d.ts +1 -0
- package/dist/_utils/config.d.ts +9 -0
- package/dist/_utils/convert-case.d.ts +3 -0
- package/dist/_utils/dom.d.ts +10 -0
- package/dist/_utils/helpers.d.ts +12 -0
- package/dist/_utils/icon.d.ts +59 -0
- package/{framework/es/util.d.ts → dist/_utils/is.d.ts} +22 -36
- package/dist/_utils/keyboard.d.ts +24 -0
- package/dist/_utils/number.d.ts +0 -0
- package/dist/_utils/vue-eco.d.ts +28 -0
- package/dist/components.d.ts +1 -0
- package/dist/componets/button/index.vue.d.ts +162 -0
- package/dist/componets/button/install.d.ts +4 -0
- package/dist/componets/button/props.d.ts +45 -0
- package/dist/componets/dialog/index.vue.d.ts +221 -0
- package/dist/componets/dialog/props.d.ts +83 -0
- package/dist/componets/dialog/use-props.d.ts +33 -0
- package/dist/componets/dialog/use.d.ts +3 -0
- package/dist/componets/dialog/warp.d.ts +2 -0
- package/dist/componets/message/index.vue.d.ts +387 -0
- package/dist/componets/message/props.d.ts +31 -0
- package/dist/componets/message/warp.d.ts +3 -0
- package/dist/componets/message-box/index.d.ts +3 -0
- package/dist/componets/message-box/props.d.ts +52 -0
- package/dist/componets/message-box/warp.d.ts +2 -0
- package/dist/componets/notification/index.vue.d.ts +160 -0
- package/dist/componets/notification/props.d.ts +54 -0
- package/dist/componets/notification/warp.d.ts +3 -0
- package/dist/componets/space/index.d.ts +42 -0
- package/dist/componets/tag-cloud/index.d.ts +0 -0
- package/dist/componets/trend-chart/components/trend-chart-curve.d.ts +114 -0
- package/dist/componets/trend-chart/components/trend-chart-grid.d.ts +55 -0
- package/dist/componets/trend-chart/components/trend-chart-labels.d.ts +22 -0
- package/dist/componets/trend-chart/components/trend-chart.d.ts +270 -0
- package/dist/componets/trend-chart/helpers/genPath.d.ts +8 -0
- package/dist/componets/trend-chart/helpers/genPoints.d.ts +3 -0
- package/dist/componets/trend-chart/helpers/getPadding.d.ts +7 -0
- package/dist/componets/trend-chart/helpers/validatePadding.d.ts +2 -0
- package/dist/componets/trend-chart/index.d.ts +2 -0
- package/dist/componets/trend-chart/props.d.ts +206 -0
- package/dist/directives/clipboard/cache.d.ts +8 -0
- package/dist/directives/clipboard/clipboard.d.ts +18 -0
- package/dist/directives/clipboard/convert.d.ts +3 -0
- package/dist/directives/clipboard/index.d.ts +3 -0
- package/dist/directives/clipboard/plugin.d.ts +2 -0
- package/dist/directives/clipboard/textarea.d.ts +3 -0
- package/dist/icons/animation/animation-loading.vue.d.ts +55 -0
- package/dist/icons/default/check-circle-fill.vue.d.ts +55 -0
- package/dist/icons/default/close-circle-fill.vue.d.ts +55 -0
- package/dist/icons/default/exclamation-circle-fill.vue.d.ts +55 -0
- package/dist/icons/default/info-circle-fill.vue.d.ts +55 -0
- package/dist/icons/default/minus-circle-fill.vue.d.ts +55 -0
- package/dist/icons/index.d.ts +7 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.es.js +1431 -0
- package/dist/index.umd.js +1 -0
- package/dist/style.css +1 -0
- package/global.d.ts +8 -0
- package/package.json +68 -61
- package/LICENSE +0 -21
- package/framework/es/client.io.js +0 -2
- package/framework/es/client.io.js.map +0 -1
- package/framework/es/exception.d.ts +0 -25
- package/framework/es/index.d.ts +0 -2
- package/framework/es/types.d.ts +0 -33
- package/framework/es/websocket.d.ts +0 -118
- package/framework/umd/client.io.js +0 -2
- package/framework/umd/client.io.js.map +0 -1
- package/framework/umd/exception.d.ts +0 -25
- package/framework/umd/index.d.ts +0 -2
- package/framework/umd/types.d.ts +0 -33
- package/framework/umd/util.d.ts +0 -36
- package/framework/umd/websocket.d.ts +0 -118
- package/index.d.ts +0 -159
@@ -0,0 +1 @@
|
|
1
|
+
(function(g,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(g=typeof globalThis<"u"?globalThis:g||self,t(g.index={},g.Vue))})(this,function(g,t){"use strict";var $t=Object.defineProperty;var Tt=(g,t,V)=>t in g?$t(g,t,{enumerable:!0,configurable:!0,writable:!0,value:V}):g[t]=V;var $=(g,t,V)=>Tt(g,typeof t!="symbol"?t+"":t,V);const V="X",ke="x",v=e=>e?ke+"-"+e:e||"",T=e=>V+e,B=e=>{const n=v(e);return{block:n,element:r=>`${n}--${r}`,modifier:r=>`${n}-${r}`,is:r=>`${n}-is-${r}`}},z=Object.prototype.toString;function ee(e){return z.call(e)==="[object Array]"}function te(e){return z.call(e)==="[object Object]"}const ne=e=>z.call(e)==="[object Promise]";function le(e){return z.call(e)==="[object String]"}function pe(e){return z.call(e)==="[object Number]"&&e===e}function p(e){return typeof e=="function"}function I(){return typeof window<"u"}const M=e=>e;var O;(function(e){e[e.ELEMENT=1]="ELEMENT",e[e.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",e[e.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",e[e.COMPONENT=6]="COMPONENT",e[e.TEXT_CHILDREN=8]="TEXT_CHILDREN",e[e.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",e[e.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",e[e.TELEPORT=64]="TELEPORT",e[e.SUSPENSE=128]="SUSPENSE",e[e.COMPONENT_SHOULD_KEEP_ALIVE=256]="COMPONENT_SHOULD_KEEP_ALIVE",e[e.COMPONENT_KEPT_ALIVE=512]="COMPONENT_KEPT_ALIVE"})(O||(O={}));const he=e=>!!(e&&e.shapeFlag&O.ELEMENT),Ne=(e,n)=>!!(e&&e.shapeFlag&O.COMPONENT),Ee=(e,n)=>!!(e&&e.shapeFlag&8),Be=(e,n)=>!!(e&&e.shapeFlag&O.ARRAY_CHILDREN),be=(e,n)=>!!(e&&e.shapeFlag&O.SLOTS_CHILDREN),P=(e,n=!1)=>{var l,o;const a=[];for(const r of e??[])he(r)||Ne(r)||n&&Ee(r,r.children)?a.push(r):Be(r,r.children)?a.push(...P(r.children,n)):be(r,r.children)?a.push(...P((o=(l=r.children).default)===null||o===void 0?void 0:o.call(l),n)):ee(r)&&a.push(...P(r,n));return a},we={disabled:Boolean,block:Boolean,loading:Boolean,loadingFill:{type:Boolean,default:!1},debounce:{type:Number,default:0},shape:{type:M(String),default:void 0},link:{type:Boolean,default:!1},type:{type:M(String),default:void 0},status:{type:M(String),default:void 0},plain:{type:Boolean,default:!1},size:{type:M(String),default:"medium"},border:{type:Boolean,default:!0}},Ve=e=>le(e)?e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(""):"",Oe=(e,n="px")=>{if(e===void 0)return"";const l=typeof e=="number"?`${e}`:e;return["px","%","vh","vw","calc"].some(a=>l.includes(a))?l:l+n};function S(e){return t.defineComponent({name:v(`Icon${Ve(e)}`),props:{size:{type:[Number,String],default:void 0},rotate:{type:Number,default:void 0},spin:{type:Boolean,default:!1},color:{type:String,default:void 0},fillColor:{type:Array,default:void 0}},setup(n){const l="x-icon",o=t.computed(()=>{const r={};return n.size&&(r.fontSize=Oe(n.size)),n.rotate&&(r.transform=`rotate(${n.rotate}deg)`),n.color&&(r.color=n.color),r});return{cls:t.computed(()=>[l,{[`${l}-loading`]:n.spin}]),styles:o}}})}const Se=S("animation-loading"),N=(e,n)=>{const l=e.__vccOpts||e;for(const[o,a]of n)l[o]=a;return l};function $e(e,n,l,o,a,r){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.styles)},n[0]||(n[0]=[t.createElementVNode("svg",{viewBox:"0 0 50 50",class:"icon-loading-svg"},[t.createElementVNode("circle",{cx:"25",cy:"25",r:"20",class:"path",fill:"none",stroke:"currentColor"})],-1)]),6)}const Te=N(Se,[["render",$e],["__scopeId","data-v-62d46830"]]),ze=t.defineComponent({name:T("Button"),components:{AnimationLoading:Te},props:we,emits:["click"],setup(e){const n=t.reactive({clicked:!1,isDebounce:!1}),l=B("button"),o=t.computed(()=>[l.block,e.type&&l.modifier(e.type),e.status&&l.modifier(e.status),e.disabled&&l.is("disabled"),e.block&&l.modifier("block"),e.plain&&l.is("plain"),e.shape&&l.modifier(e.shape),e.link&&l.modifier("is-link"),e.size&&l.modifier(e.size),!e.border&&l.modifier("is-hide-border"),r.value&&l.modifier("is-loading")]),a=()=>{e.debounce>0&&!n.isDebounce&&(n.isDebounce=!0,setTimeout(()=>{n.isDebounce=!1},e.debounce))},r=t.computed(()=>e.loading||n.clicked||n.isDebounce),f=t.getCurrentInstance(),s=(u,C)=>{const c=u(C);ne(c)&&(n.clicked=!0,c.finally(()=>{n.clicked=!1}))};return{cn:l,cls:o,handleClick:async u=>{var c,i,d,k;if((i=(c=u.target).blur)==null||i.call(c),r.value)return;a();const C=(k=(d=f==null?void 0:f.vnode)==null?void 0:d.props)==null?void 0:k.onClick;ee(C)?C.forEach(h=>s(h,u)):p(C)&&s(C,u)},isLoading:r}}}),Me=["disabled"];function Le(e,n,l,o,a,r){const f=t.resolveComponent("AnimationLoading");return t.openBlock(),t.createElementBlock("button",{class:t.normalizeClass(e.cls),type:"button",disabled:e.disabled,onClick:n[0]||(n[0]=(...s)=>e.handleClick&&e.handleClick(...s))},[t.withDirectives(t.createElementVNode("span",{class:t.normalizeClass([e.cn.element("loading")])},[t.createVNode(f)],2),[[t.vShow,e.isLoading]]),e.$slots.prefix?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([e.cn.element("prefix")])},[t.renderSlot(e.$slots,"prefix")],2)):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default"),e.$slots.suffix?(t.openBlock(),t.createElementBlock("span",{key:1,class:t.normalizeClass([e.cn.element("suffix")])},[t.renderSlot(e.$slots,"suffix")],2)):t.createCommentVNode("",!0)],10,Me)}const E=N(ze,[["render",Le]]);E.install=function(e){e.component(E.name,E)};const R=Object.freeze(Object.defineProperty({__proto__:null,Button:E},Symbol.toStringTag,{value:"Module"})),Ae=["px","%","vh","vw","calc"],oe=(e,n="px")=>{if(e===void 0)return"";const l=String(e);return Ae.some(o=>l.includes(o))?l:l+n},De=1e3,Ie=3e3,Pe=1;class je{constructor(){$(this,"popupStack",{popup:new Set,dialog:new Set,message:new Set});$(this,"getNextZIndex",n=>(n==="message"?Array.from(this.popupStack.message).pop()||Ie:Array.from(this.popupStack.popup).pop()||De)+Pe);$(this,"add",n=>{const l=this.getNextZIndex(n);return this.popupStack[n].add(l),n==="dialog"&&this.popupStack.popup.add(l),l});$(this,"delete",(n,l)=>{this.popupStack[l].delete(n),l==="dialog"&&this.popupStack.popup.delete(n)});$(this,"isLastDialog",n=>this.popupStack.dialog.size>1?n===Array.from(this.popupStack.dialog).pop():!0)}}const U=new je;function W(e,{visible:n,runOnMounted:l}={}){const o=t.ref(0),a=()=>{o.value=U.add(e)},r=()=>{U.delete(o.value,e)},f=()=>e==="dialog"?U.isLastDialog(o.value):!1;return t.watch(()=>n==null?void 0:n.value,s=>{s?a():r()},{immediate:!0}),l&&(t.onMounted(()=>{a()}),t.onBeforeUnmount(()=>{r()})),{zIndex:t.readonly(o),open:a,close:r,isLastDialog:f}}const re=e=>e.replace(/^./,n=>n.toLowerCase()).replace(/-(\w)/g,(n,l)=>{var o;return(o=l==null?void 0:l.toUpperCase())!==null&&o!==void 0?o:""}),se=()=>{},He=(e,n)=>{var l;if(I)return(l=document.querySelector(e))!==null&&l!==void 0?l:void 0},Fe=e=>{if(e.tagName==="BODY")return window.innerWidth-(document.documentElement.offsetWidth||document.body.offsetWidth);const{borderLeftWidth:n,borderRightWidth:l}=window.getComputedStyle(e),o=Number(n.replace("px",""))+Number(l.replace("px",""));return e.offsetWidth-(e.clientWidth+o)},Re=e=>e.tagName==="BODY"?document.documentElement.scrollHeight>window.innerHeight:e.scrollHeight>e.offsetHeight,Ue=(e,n)=>{var l;if(!I||!e||!n)return"";let o=re(n);o==="float"&&(o="cssFloat");try{const a=e.style[o];if(a)return a;const r=(l=document.defaultView)===null||l===void 0?void 0:l.getComputedStyle(e,"");return r?r[o]:""}catch{return e.style[o]}},L=(e,n,l)=>{if(!(!e||!n))if(te(n))Object.entries(n).forEach(([o,a])=>L(e,o,a));else{const o=re(n);e.style[o]=l}},Z=(e,n)=>{if(le(e)){const l=e[0]==="#"?`[id='${e.slice(1)}']`:e;return He(l)}return e},We=I?(e,n,l,o=!1)=>{e.addEventListener(n,l,o)}:se,Ze=I?(e,n,l,o=!1)=>{e.removeEventListener(n,l,o)}:se,Ke=(e,n)=>{let l=!1;const o={overflow:"",width:""},a=s=>s.tagName==="BODY",r=()=>{if(e.value){const s=e.value;if(!l&&s.style.overflow!=="hidden"){const m=Fe(s);if(m>0||Re(s)){o.overflow=s.style.overflow,o.width=s.style.width;let u=0;a(s)&&(u=s.getBoundingClientRect().left||0),L(s,{width:`calc(100% - ${Math.ceil(m-u)}px)`,overflow:"hidden"}),l=!0}}}},f=()=>{if(e.value&&l){const s=e.value;L(s,{overflow:o.overflow,width:o.width}),l=!1}};return t.watch(()=>n==null?void 0:n.value,s=>{e.value&&!a(e.value)&&(s&&L(s,{position:"absolute"}),Ue(e.value,"position")==="static"&&L(e.value,{position:"relative"}))}),{setOverflowHidden:r,resetOverflow:f}},Xe={ENTER:"Enter",ESC:"Escape",BACKSPACE:"Backspace",TAB:"Tab",SPACE:" ",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight"},Ye={renderTo:{type:M([String,Object]),default:"body"},disabled:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},top:{type:[String,Number],default:"3vh"},center:{type:Boolean,default:!1},width:{type:[String,Number],default:0},height:{type:[String,Number],default:0},minWidth:{type:[String,Number],default:0},minHeight:{type:[String,Number],default:0},title:{type:String,default:""},mask:{type:Boolean,default:!0},destroyOnClosed:{type:Boolean,default:!0},onBeforeCancel:{type:Function},maskToClose:{type:Boolean,default:!0},escToClose:{type:Boolean,default:!0},fullscreen:{type:Boolean,default:!1},messageBox:{type:Boolean,default:!1},popupClass:{type:String,default:void 0},showClose:{type:Boolean,default:!0},showHeaderBottomLine:{type:Boolean,default:!1}},Ge=["width","minWidth","height","minHeight"],qe=t.defineComponent({name:T("Dialog"),inheritAttrs:!1,props:Ye,emits:["closed","close","open","opened","update:modelValue"],setup(e,{emit:n}){const l=B("dialog"),o=l.block,a=B("message-box"),r=a.block,f=t.computed(()=>[o,e.messageBox&&"is-message-box",e.popupClass&&e.popupClass]),s=t.computed(()=>Z(e.renderTo)),m=t.ref(),u=t.computed(()=>e.disabled||!s.value),C=t.computed(()=>({zIndex:h.value})),c=t.computed(()=>{const y={};return e.fullscreen||(!e.center&&e.top&&(y.top=oe(e.top)),Ge.forEach(b=>{e[b]&&(y[b]=oe(e[b]))})),y}),i=t.ref(!1),d=t.computed(()=>e.modelValue),k=t.computed(()=>d.value||i.value),{zIndex:h,isLastDialog:w}=W("dialog",{visible:d}),{setOverflowHidden:Nt,resetOverflow:ue}=Ke(s,m),Ce=(y,b)=>{n("update:modelValue",!1),n("close",e.messageBox?y:void 0,e.messageBox?b:void 0)},Et=()=>{i.value=!1,ue(),n("closed")},Bt=()=>{n("opened")},H=t.reactive({ok:!1,cancel:!1}),D=(y,b)=>{let F=!0;if(H[y]=!0,p(e.onBeforeCancel)&&(F=e.onBeforeCancel(y)??!1),ne(F)){F.then(St=>{H[y]=!1,St&&Ce(y,b)});return}H[y]=!1,F&&Ce(y,b)},bt=()=>{e.maskToClose&&e.mask&&D("cancel")},wt=y=>{D("cancel",y)},Vt=y=>{D("ok",y)};let Q=!1;const ye=y=>{e.escToClose&&y.key===Xe.ESC&&w()&&D("cancel")},Ot=()=>{e.escToClose&&!Q&&(Q=!0,We(document.documentElement,"keydown",ye))},ge=()=>{Q=!1,Ze(document.documentElement,"keydown",ye)};return t.onBeforeUnmount(()=>{ue(),ge()}),t.watch(()=>d.value,y=>{y?(n("open"),Nt(),i.value=!0,Ot()):ge()},{immediate:!0}),{cls:f,ns:o,cn:l,cnOMB:a,messageBoxNs:r,containerStyle:c,dialogStyle:C,dialogRef:m,teleportContainer:s,teleportDisabled:u,modelVisible:d,mergeVisible:k,interceptClose:D,afterLeave:Et,afterEnter:Bt,handleMaskClick:bt,handleCancel:wt,handleOk:Vt,loadingObj:H}}});function xe(e,n,l,o,a,r){return t.openBlock(),t.createBlock(t.Teleport,{to:e.teleportContainer,disabled:e.teleportDisabled},[!e.destroyOnClosed||e.mergeVisible?t.withDirectives((t.openBlock(),t.createElementBlock("div",{key:0,ref:"dialogRef",class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.dialogStyle)},[t.createVNode(t.Transition,{name:"x-fade-in-standard",appear:""},{default:t.withCtx(()=>[e.mask?t.withDirectives((t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass([e.cn.element("mask")])},null,2)),[[t.vShow,e.modelVisible]]):t.createCommentVNode("",!0)]),_:1}),t.createElementVNode("div",{class:t.normalizeClass([e.cn.element("wrapper"),{"is-center":e.center}]),onClick:n[1]||(n[1]=t.withModifiers((...f)=>e.handleMaskClick&&e.handleMaskClick(...f),["self"]))},[t.createVNode(t.Transition,{name:"x-zoom-in",appear:"",onAfterEnter:e.afterEnter,onAfterLeave:e.afterLeave},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass([e.cn.element("container"),{"is-fullscreen":e.fullscreen}]),style:t.normalizeStyle(e.containerStyle)},[t.createElementVNode("div",{class:t.normalizeClass([e.messageBox?e.cnOMB.element("header"):e.cn.element("header"),e.showHeaderBottomLine&&"is-bottom-line"])},[t.renderSlot(e.$slots,"title",{},()=>[t.createElementVNode("div",{class:t.normalizeClass([e.cn.element("header-title")])},t.toDisplayString(e.title),3)])],2),t.createElementVNode("div",{class:t.normalizeClass([e.messageBox?e.cnOMB.element("body"):e.cn.element("body")])},[t.renderSlot(e.$slots,"default")],2),t.createElementVNode("div",{class:t.normalizeClass([e.messageBox?e.cnOMB.element("footer"):e.cn.element("footer")])},[t.renderSlot(e.$slots,"footer",{cancel:e.handleCancel,ok:e.handleOk,loadingObj:e.loadingObj})],2),e.showClose?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([e.cn.element("close-icon"),e.messageBox&&e.cnOMB.element("close-icon")]),onClick:n[0]||(n[0]=f=>e.interceptClose("cancel"))},null,2)):t.createCommentVNode("",!0)],6),[[t.vShow,e.modelVisible]])]),_:3},8,["onAfterEnter","onAfterLeave"])],2)],6)),[[t.vShow,e.mergeVisible]]):t.createCommentVNode("",!0)],8,["to","disabled"])}const ae=N(qe,[["render",xe]]),ie=t.defineComponent({name:T("Space"),props:{direction:{type:String,default:"horizontal"},size:{type:[Number,String],default:"small"},align:{type:String,default:"center"},fill:{type:Boolean,default:!1}},setup(e,{slots:n}){const l=B("space"),o=t.computed(()=>[l.block,l.element(e.direction),e.fill&&"is-fill",l.element(`${e.direction}-${e.align}`)]);function a(f){if(pe(f))return f;switch(f){case"mini":return 4;case"small":return 8;case"medium":return 16;case"large":return 24;default:return 8}}const r=f=>{const s={};if(f)return s;const m=`${a(e.size)}px`,u=`${a(e.size)}px`;return e.direction==="horizontal"&&(s.marginRight=m),e.direction==="vertical"&&(s.marginBottom=u),s};return()=>{var s;const f=P((s=n.default)==null?void 0:s.call(n),!0).filter(m=>m.type!==t.Comment);return t.createVNode("div",{class:[o.value]},[f.map((m,u)=>{var c;const C=n.split&&u>0;return t.createVNode(t.Fragment,{key:`space-item-${u}`},[C&&t.createVNode("div",{className:l.element("split"),style:r(!1)},[(c=n.split)==null?void 0:c.call(n)]),t.createVNode("div",{className:l.element("item"),style:r(u===f.length-1)},[m])])})])}}});function ce(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const de=B("dialog"),_e=e=>{const n=document.createElement("div"),l=()=>{t.render(null,n)},o=c=>{if(c==="cancel")return e.beforeOnCancel?e.beforeOnCancel():!0;if(c==="ok")return e.beforeOnOk?e.beforeOnOk():!0},a=(c,i)=>{c==="cancel"&&e.onCancel&&e.onCancel(i),c==="ok"&&e.onOk&&e.onOk(i)},r=c=>{if(t.isVNode(c))return c;if(p(c)){const i=c();return t.isVNode(i)?i:null}return t.createVNode("div",{className:de.element("header-title")},[t.createTextVNode(" "),c,t.createTextVNode(" ")])},f=c=>{if(t.isVNode(c))return c;if(p(c)){const i=c();return t.isVNode(i)?i:null}return t.createVNode("div",{className:de.element("content")},[t.createTextVNode(" "),e.content,t.createTextVNode(" ")])},s=()=>()=>t.createVNode(t.Fragment,null,[e.title&&r(e.title)]),m=()=>()=>t.createVNode(t.Fragment,null,[e.content&&f(e.content)]),u=()=>{if(t.isVNode(e.footer)||p(e.footer))return e.footer;const c=(e==null?void 0:e.cancelText)||"取消",i=(e==null?void 0:e.okText)||"确认";return d=>t.createVNode(ie,{size:12},{default:()=>{var k,h;return[!e.hideCancel&&t.createVNode(E,{size:"small",onClick:d.cancel,loading:(k=d.loadingObj)==null?void 0:k.cancel},ce(c)?c:{default:()=>[c]}),!e.hideOk&&t.createVNode(E,{type:"primary",size:"small",onClick:d.ok,loading:(h=d.loadingObj)==null?void 0:h.ok},ce(i)?i:{default:()=>[i]})]}})},C=t.createVNode(ae,{width:(e==null?void 0:e.width)??368,height:(e==null?void 0:e.height)??"auto",modelValue:!0,renderTo:e==null?void 0:e.renderTo,center:e!=null&&e.top?!1:(e==null?void 0:e.center)??!0,top:(e==null?void 0:e.top)??0,mask:(e==null?void 0:e.mask)??!0,maskToClose:(e==null?void 0:e.maskToClose)??!0,popupClass:e.popupClass,onClose:a,onBeforeCancel:o,"onUpdate:modelValue":()=>{C.component.props.modelValue=!1},onClosed:l,onOpened:()=>{}},{title:s(),default:m(),footer:u()});t.render(C,n)},Je=["success","warning","error","strong","info"],Qe=S("close-circle-fill");function ve(e,n,l,o,a,r){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.styles)},n[0]||(n[0]=[t.createElementVNode("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"4","stroke-linecap":"butt","stroke-linejoin":"miter",filter:""},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm4.955-27.771-4.95 4.95-4.95-4.95a1 1 0 0 0-1.414 0l-1.414 1.414a1 1 0 0 0 0 1.414l4.95 4.95-4.95 4.95a1 1 0 0 0 0 1.414l1.414 1.414a1 1 0 0 0 1.414 0l4.95-4.95 4.95 4.95a1 1 0 0 0 1.414 0l1.414-1.414a1 1 0 0 0 0-1.414l-4.95-4.95 4.95-4.95a1 1 0 0 0 0-1.414l-1.414-1.414a1 1 0 0 0-1.414 0Z",fill:"currentColor",stroke:"none"})],-1)]),6)}const K=N(Qe,[["render",ve]]),et=S("check-circle-fill");function tt(e,n,l,o,a,r){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.styles)},n[0]||(n[0]=[t.createElementVNode("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"4","stroke-linecap":"butt","stroke-linejoin":"miter",filter:""},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm10.207-24.379a1 1 0 0 0 0-1.414l-1.414-1.414a1 1 0 0 0-1.414 0L22 26.172l-4.878-4.88a1 1 0 0 0-1.415 0l-1.414 1.415a1 1 0 0 0 0 1.414l7 7a1 1 0 0 0 1.414 0l11.5-11.5Z",fill:"currentColor",stroke:"none"})],-1)]),6)}const X=N(et,[["render",tt]]),nt=S("exclamation-circle-fill");function lt(e,n,l,o,a,r){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.styles)},n[0]||(n[0]=[t.createElementVNode("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"4","stroke-linecap":"butt","stroke-linejoin":"miter",filter:""},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm-2-11a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v2Zm4-18a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V15Z",fill:"currentColor",stroke:"none"})],-1)]),6)}const Y=N(nt,[["render",lt]]),ot=S("info-circle-fill");function rt(e,n,l,o,a,r){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.styles)},n[0]||(n[0]=[t.createElementVNode("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"4","stroke-linecap":"butt","stroke-linejoin":"miter",filter:""},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm2-30a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2Zm0 17h1a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1v-8a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v11Z",fill:"currentColor",stroke:"none"})],-1)]),6)}const G=N(ot,[["render",rt]]),st=S("minus-circle-fill");function at(e,n,l,o,a,r){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.styles)},n[0]||(n[0]=[t.createElementVNode("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"4","stroke-linecap":"butt","stroke-linejoin":"miter",filter:""},[t.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm-7-22a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H17Z",fill:"currentColor",stroke:"none"})],-1)]),6)}const q=N(st,[["render",at]]),it=t.defineComponent({name:T("Message"),components:{CloseCircleFill:K,CheckCircleFill:X,ExclamationCircleFill:Y,InfoCircleFill:G,MinusCircleFill:q},props:{id:{type:String,default:""},message:{type:[String,Number,Object],default:""},type:{type:String,default:"success"},duration:{type:Number,default:1500},center:{type:Boolean,default:!1},onClose:{type:Function,default:()=>{}},offset:{type:Number,default:20},zIndex:{type:Number,default:0},showClose:{type:Boolean,default:!1},useHTML:Boolean,popupClass:{type:String,default:void 0}},emits:["destroy"],setup(e){const n=B("message"),l=t.computed(()=>[n.block,n.modifier(e.type),e.center&&n.modifier("center"),e.showClose&&!e.center&&n.element("show-close"),e.popupClass&&e.popupClass]),o=t.ref(!1);let a=null;const r=()=>{a=setTimeout(()=>{o.value=!1},e.duration)};t.onMounted(()=>{o.value=!0,e.duration!==0&&r()}),t.onUnmounted(()=>{clearTimeout(a)});const{zIndex:f}=W("message",{runOnMounted:!0}),s=t.computed(()=>({top:`${e.offset}px`,zIndex:f.value}));return{cn:n,cls:l,styles:s,visible:o,handleClose:()=>{o.value=!1}}}}),ct=["innerHTML"],dt={key:1};function ft(e,n,l,o,a,r){const f=t.resolveComponent("CheckCircleFill"),s=t.resolveComponent("ExclamationCircleFill"),m=t.resolveComponent("MinusCircleFill"),u=t.resolveComponent("CloseCircleFill"),C=t.resolveComponent("InfoCircleFill");return t.openBlock(),t.createBlock(t.Transition,{name:"x-message-slide-top",onBeforeLeave:e.onClose,onAfterLeave:n[1]||(n[1]=c=>e.$emit("destroy"))},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.styles)},[e.$slots.icon?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([e.cn.element("icon"),e.cn.modifier(`icon-${e.type}`)])},[t.renderSlot(e.$slots,"icon",{},()=>[e.type==="success"?(t.openBlock(),t.createBlock(f,{key:0})):e.type==="warning"?(t.openBlock(),t.createBlock(s,{key:1})):e.type==="strong"?(t.openBlock(),t.createBlock(m,{key:2})):e.type==="error"?(t.openBlock(),t.createBlock(u,{key:3})):e.type==="info"?(t.openBlock(),t.createBlock(C,{key:4})):t.createCommentVNode("",!0)])],2)),t.renderSlot(e.$slots,"default",{},()=>[e.useHTML?(t.openBlock(),t.createElementBlock("span",{key:0,innerHTML:e.message},null,8,ct)):(t.openBlock(),t.createElementBlock("span",dt,t.toDisplayString(e.message),1)),e.showClose?(t.openBlock(),t.createElementBlock("span",{key:2,class:t.normalizeClass([e.cn.element("close-icon")]),onClick:n[0]||(n[0]=(...c)=>e.handleClose&&e.handleClose(...c))},null,2)):t.createCommentVNode("",!0)])],6),[[t.vShow,e.visible]])]),_:3},8,["onBeforeLeave"])}const mt=N(it,[["render",ft]]),x=new WeakMap,j=e=>{(typeof e=="string"||t.isVNode(e))&&(e={message:e});const n=Z(e.renderTo||"body");x.has(n)||x.set(n,[]);const l=x.get(n);let o=e.offset||20;l.forEach(c=>{var i;o+=((i=c.el)==null?void 0:i.offsetHeight)+20});const a=e.onClose;let r={};r={...e,onClose:()=>{var d;const c=l.findIndex(k=>k===m);if(c<0)return;const i=((d=m.el)==null?void 0:d.offsetHeight)+20;l.slice(c+1).forEach(k=>{var w;const h=(w=k.component)==null?void 0:w.props.offset;k.component.props.offset=h-i}),l.splice(c,1),a&&a(m)},onDestroy:()=>{t.render(null,u)},offset:o};const m=t.createVNode(mt,r,p(r.message)||t.isVNode(r.message)?{default:p(r.message)?r.message:()=>r.message}:null),u=document.createElement("div");return t.render(m,u),n.tagName==="BODY"?m.el.style.position="fixed":(n.style.position="relative",m.el.style.position="absolute"),n.appendChild(u.firstElementChild),l.push(m),{close:()=>{m.component.proxy.handleClose()}}};(()=>{Je.forEach(e=>{j[e]=n=>te(n)?j({type:e,...n}):j({message:n,type:e})})})();const ut=["info","success","warning","strong","error"];function fe(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const _=B("message-box"),J=e=>{const n=document.createElement("div"),l=()=>{t.render(null,n)},o=i=>{if(i==="cancel")return e.beforeOnCancel?e.beforeOnCancel():!0;if(i==="ok")return e.beforeOnOk?e.beforeOnOk():!0},a=(i,d)=>{i==="cancel"&&e.onCancel&&e.onCancel(d),i==="ok"&&e.onOk&&e.onOk(d)},r=i=>{let d;switch(i){case"warning":d=t.createVNode(Y,{size:"22px",color:"#f6c64b"},null);break;case"strong":d=t.createVNode(q,{size:"22px",color:"#ff7125"},null);break;case"error":d=t.createVNode(K,{size:"22px",color:"#e24f48"},null);break;case"success":d=t.createVNode(X,{size:"22px",color:"#68d1ab"},null);break;case"info":d=t.createVNode(G,{size:"22px",color:"#2355f5"},null);break}return t.createVNode("div",{className:_.element("icon")},[d])},f=i=>{if(t.isVNode(i))return i;if(p(i)){const d=i();return t.isVNode(d)?d:null}return t.createVNode("div",{className:_.element("title")},[t.createTextVNode(" "),i,t.createTextVNode(" ")])},s=i=>{if(t.isVNode(i))return i;if(p(i)){const d=i();return t.isVNode(d)?d:null}return t.createVNode("div",{className:_.element("content")},[t.createTextVNode(" "),e.content,t.createTextVNode(" ")])},m=()=>()=>t.createVNode(t.Fragment,null,[r(e.type||"success"),e.title&&f(e.title)]),u=()=>()=>t.createVNode(t.Fragment,null,[e.content&&s(e.content)]),C=()=>{if(t.isVNode(e.footer)||p(e.footer))return e.footer;const i=(e==null?void 0:e.cancelText)||"取消",d=(e==null?void 0:e.okText)||"确认";return k=>t.createVNode(ie,{size:12},{default:()=>{var h,w;return[!e.hideCancel&&t.createVNode(E,{size:"small",onClick:k.cancel,loading:(h=k.loadingObj)==null?void 0:h.cancel},fe(i)?i:{default:()=>[i]}),!e.hideOk&&t.createVNode(E,{type:"primary",size:"small",onClick:k.ok,loading:(w=k.loadingObj)==null?void 0:w.ok},fe(d)?d:{default:()=>[d]})]}})},c=t.createVNode(ae,{messageBox:!0,width:(e==null?void 0:e.width)??358,height:(e==null?void 0:e.height)??"auto",modelValue:!0,renderTo:e==null?void 0:e.renderTo,center:e!=null&&e.top?!1:(e==null?void 0:e.center)??!0,top:(e==null?void 0:e.top)??0,mask:(e==null?void 0:e.mask)??!0,maskToClose:(e==null?void 0:e.maskToClose)??!0,popupClass:e.popupClass,onClose:a,onBeforeCancel:o,"onUpdate:modelValue":()=>{c.component.props.modelValue=!1},onClosed:l,onOpened:()=>{}},{title:m(),default:u(),footer:C()});t.render(c,n)};(()=>{ut.forEach(e=>{J[e]=(n,l)=>{const o=[],a=[];let r=()=>!0,f=()=>!0;return setTimeout(()=>{J({title:n,content:l,type:e,beforeOnCancel:f,beforeOnOk:r,onOk:()=>{o.forEach(s=>p(s)&&s())},onCancel:()=>{a.forEach(s=>p(s)&&s())}})},0),{ok(...s){return s.length===1&&o.push(s[0]),s.length===2&&(r=s[0],o.push(s[1])),this},cancel(...s){return s.length===1&&a.push(s[0]),s.length===2&&(f=s[0],a.push(s[1])),this}}}})})();const Ct={position:{type:String,default:"top-right"},offset:{type:Number,default:0},title:{type:String,default:""},type:{type:String,default:"info"},message:{type:String,default:void 0},duration:{type:Number,default:3e3},showClose:{type:Boolean,default:!0},onClose:{type:Function,default:()=>{}},renderToBody:{type:Boolean,default:!1}},yt=t.defineComponent({name:T("Notification"),props:Ct,emits:["close","destroy"],setup(e){const n=B("notification"),l=n.block,o=t.computed(()=>[l,n.modifier(r.value.ver)]),{zIndex:a}=W("message",{runOnMounted:!0}),r=t.computed(()=>{const d=e.position.split("-");return{hor:d[1],ver:d[0]}}),f=t.computed(()=>`x-notification-slide-${r.value.hor}`),s=t.computed(()=>{const d={};return d.position=e.renderToBody?"fixed":"absolute",d.zIndex=a.value,d[r.value.hor]="20px",d[r.value.ver]=`${e.offset}px`,d}),m=t.ref(!1);let u=0;const C=()=>{setTimeout(()=>{m.value=!1},e.duration)},c=t.computed(()=>e.type==="info"?G:e.type==="warning"?Y:e.type==="strong"?q:e.type==="success"?X:e.type==="error"?K:""),i=()=>{m.value=!1};return t.onMounted(()=>{e.duration!==0&&C(),m.value=!0}),t.onUnmounted(()=>{clearTimeout(u)}),{ns:l,cn:n,cls:o,animationClsName:f,positionStyle:s,visible:m,positionPropMap:r,currentIcon:c,handleClose:i}}});function gt(e,n,l,o,a,r){return t.openBlock(),t.createBlock(t.Transition,{name:e.animationClsName,onBeforeLeave:n[1]||(n[1]=f=>e.$emit("close")),onAfterLeave:n[2]||(n[2]=f=>e.$emit("destroy"))},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(e.cls),style:t.normalizeStyle(e.positionStyle)},[t.createElementVNode("div",{class:t.normalizeClass([e.cn.element("header")])},[t.createElementVNode("div",{class:t.normalizeClass([e.cn.element("icon"),e.cn.modifier(`icon-${e.type}`)])},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.currentIcon)))],2),t.createElementVNode("div",null,[t.createElementVNode("div",{class:t.normalizeClass([e.cn.element("title")])},t.toDisplayString(e.title),3),t.createElementVNode("div",{class:t.normalizeClass([e.cn.element("message")])},[t.renderSlot(e.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(e.message),1)])],2)])],2),e.showClose?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([e.cn.element("close-icon")]),onClick:n[0]||(n[0]=t.withModifiers((...f)=>e.handleClose&&e.handleClose(...f),["self"]))},null,2)):t.createCommentVNode("",!0)],6),[[t.vShow,e.visible]])]),_:3},8,["name"])}const kt=N(yt,[["render",gt]]),A=new WeakMap,pt=e=>{const n=Z(e.renderTo||"body"),l=document.createElement("div");A.get(n)||A.set(n,{}),A.get(n)[e.position]||(A.get(n)[e.position]=[]);const o=A.get(n)[e.position];let a=e.offset||20;o.forEach(C=>{var c;a+=((c=C.el)==null?void 0:c.offsetHeight)+20});const r=n.tagName==="BODY";r||(n.style.position="relative",n.style.overflowX="hidden");const f=e.onClose,s=()=>{var i;const C=o.findIndex(d=>d===u);if(C<0)return;const c=((i=u.el)==null?void 0:i.offsetHeight)+20;o.slice(C+1).forEach(d=>{var h;const k=(h=d.component)==null?void 0:h.props.offset;d.component.props.offset=k-c}),o.splice(C,1),f&&f(u)},m=()=>{t.render(null,l)},u=t.createVNode(kt,{message:e.message,title:e.title,type:e.type,offset:a,renderToBody:r,position:e.position,duration:e.duration??3e3,showClose:e.showClose??!0,onClose:s,onDestroy:m},p(e.message)||t.isVNode(e.message)?{default:p(e.message)?e.message:()=>e.message}:null);t.render(u,l),o.push(u),n==null||n.appendChild(l.firstChild)},me=function(e){Object.keys(R).forEach(n=>{const l=R[n];e.component(n,R[n]),l.install&&e.use(l)})},ht={install:me};g.Button=E,g.Dialog=_e,g.Message=j,g.MessageBox=J,g.Notification=pt,g.default=ht,g.install=me,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.x-fade-in-standard-enter-from,.x-fade-in-standard-appear-from{opacity:0}.x-fade-in-standard-enter-to,.x-fade-in-standard-appear-to{opacity:1}.x-fade-in-standard-enter-active,.x-fade-in-standard-appear-active{transition:opacity .3s ease}.x-fade-in-standard-leave-from{opacity:1}.x-fade-in-standard-leave-to{opacity:0}.x-fade-in-standard-leave-active{transition:opacity .3s ease}.x-fade-in-enter-from,.x-fade-in-appear-from{opacity:0}.x-fade-in-enter-to,.x-fade-in-appear-to{opacity:1}.x-fade-in-enter-active,.x-fade-in-appear-active{transition:opacity .2s ease}.x-fade-in-leave-from{opacity:1}.x-fade-in-leave-to{opacity:0}.x-fade-in-leave-active{transition:opacity .2s ease}.x-zoom-in-enter-from,.x-zoom-in-appear-from{transform:scale(.5);opacity:0}.x-zoom-in-enter-to,.x-zoom-in-appear-to{transform:scale(1);opacity:1}.x-zoom-in-enter-active,.x-zoom-in-appear-active{transition:opacity .3s ease,transform .3s ease}.x-zoom-in-leave-from{transform:scale(1);opacity:1}.x-zoom-in-leave-to{transform:scale(.5);opacity:0}.x-zoom-in-leave-active{transition:opacity .3s ease,transform .3s ease}.x-zoom-in-fade-out-enter-from,.x-zoom-in-fade-out-appear-from{transform:scale(.5);opacity:0}.x-zoom-in-fade-out-enter-to,.x-zoom-in-fade-out-appear-to{transform:scale(1);opacity:1}.x-zoom-in-fade-out-enter-active,.x-zoom-in-fade-out-appear-active{transition:opacity .3s cubic-bezier(.3,1.3,.3,1),transform .3s cubic-bezier(.3,1.3,.3,1)}.x-zoom-in-fade-out-leave-from{transform:scale(1);opacity:1}.x-zoom-in-fade-out-leave-to{transform:scale(.5);opacity:0}.x-zoom-in-fade-out-leave-active{transition:opacity .3s cubic-bezier(.3,1.3,.3,1),transform .3s cubic-bezier(.3,1.3,.3,1)}.x-zoom-in-big-enter-from,.x-zoom-in-big-appear-from{transform:scale(.5);opacity:0}.x-zoom-in-big-enter-to,.x-zoom-in-big-appear-to{transform:scale(1);opacity:1}.x-zoom-in-big-enter-active,.x-zoom-in-big-appear-active{transition:opacity .2s linear,transform .2s linear}.x-zoom-in-big-leave-from{transform:scale(1);opacity:1}.x-zoom-in-big-leave-to{transform:scale(.2);opacity:0}.x-zoom-in-big-leave-active{transition:opacity .2s linear,transform .2s linear}.x-zoom-in-left-enter-from,.x-zoom-in-left-appear-from{transform:scale(.1);opacity:.1}.x-zoom-in-left-enter-to,.x-zoom-in-left-appear-to{transform:scale(1);opacity:1}.x-zoom-in-left-enter-active,.x-zoom-in-left-appear-active{transform-origin:0 50%;transition:opacity .3s linear,transform .3s ease-in-out}.x-zoom-in-left-leave-from{transform:scale(1);opacity:1}.x-zoom-in-left-leave-to{transform:scale(.1);opacity:.1}.x-zoom-in-left-leave-active{transform-origin:0 50%;transition:opacity .3s linear,transform .3s ease-in-out}.x-zoom-in-top-enter-from,.x-zoom-in-top-appear-from{transform:scaleY(.8) translateZ(0);opacity:0}.x-zoom-in-top-enter-to,.x-zoom-in-top-appear-to{transform:scaleY(1) translateZ(0);opacity:1}.x-zoom-in-top-enter-active,.x-zoom-in-top-appear-active{transform-origin:0 0;transition:transform .3s ease-in-out,opacity .3s ease-in-out}.x-zoom-in-top-leave-from{transform:scaleY(1) translateZ(0);opacity:1}.x-zoom-in-top-leave-to{transform:scaleY(.8) translateZ(0);opacity:0}.x-zoom-in-top-leave-active{transform-origin:0 0;transition:transform .3s ease-in-out,opacity .3s ease-in-out}.x-zoom-in-bottom-enter-from,.x-zoom-in-bottom-appear-from{transform:scaleY(.8) translateZ(0);opacity:0}.x-zoom-in-bottom-enter-to,.x-zoom-in-bottom-appear-to{transform:scaleY(1) translateZ(0);opacity:1}.x-zoom-in-bottom-enter-active,.x-zoom-in-bottom-appear-active{transform-origin:100% 100%;transition:transform .3s ease-in-out,opacity .3s ease-in-out}.x-zoom-in-bottom-leave-from{transform:scaleY(1) translateZ(0);opacity:1}.x-zoom-in-bottom-leave-to{transform:scaleY(.8) translateZ(0);opacity:0}.x-zoom-in-bottom-leave-active{transform-origin:100% 100%;transition:transform .3s ease-in-out,opacity .3s ease-in-out}.x-icon{display:flex;justify-content:center;align-items:center}.x-icon svg{fill:currentcolor;width:1em;height:1em}[opacity~=".1"]{opacity:.1}[opacity~=".2"]{opacity:.2}[opacity~=".3"]{opacity:.3}[opacity~=".4"]{opacity:.4}[opacity~=".5"]{opacity:.5}[opacity~=".6"]{opacity:.6}[opacity~=".7"]{opacity:.7}[opacity~=".8"]{opacity:.8}[opacity~=".9"]{opacity:.9}:root{--x-primary: rgb(0 86 255 / 100%);--x-success: rgb(36 195 65 / 100%);--x-danger: rgb(241 37 37 / 100%);--x-strong: rgb(255 113 37 / 100%);--x-warning: rgb(255 199 0 / 100%);--x-primary-1: rgb(0 70 208 / 100%);--x-primary-3: rgb(0 77 229 / 100%);--x-primary-6: rgb(0 77 229 / 30%);--x-primary-8: rgb(0 86 255 / 18%);--x-primary-9: rgb(0 86 255 / 5%);--x-success-1: rgb(36 195 65 / 100%);--x-success-8: rgb(46 212 169 / 18%);--x-success-9: rgb(46 212 169 / 5%);--x-danger-1: rgb(191 23 23 / 100%);--x-danger-3: rgb(216 33 33 / 100%);--x-dander-6: rgb(191 23 23 / 30%);--x-danger-8: rgb(241 37 37 / 18%);--x-danger-9: rgb(241 37 37 / 5%);--x-strong-8: rgb(255 113 37 / 18%);--x-strong-9: rgb(255 113 37 / 5%);--x-warning-8: rgb(255 196 32 / 18%);--x-warning-9: rgb(255 196 32 / 5%);--x-color-1: rgb(36 41 52 / 100%);--x-color-2: rgb(100 107 122 / 100%);--x-color-3: rgb(156 166 185 / 100%);--x-color-4: rgb(188 196 214 / 100%);--x-color-5: rgb(225 228 232 / 100%);--x-color-6: rgb(237 241 246 / 100%);--x-color-7: rgb(245 247 251 / 100%);--x-color-white: rgb(255 255 255 / 100%);--x-font-size: 14px;--x-text-color: var(--x-color-2);--x-border-color: var(--x-color-5);--x-background-color: var(--x-color-7);--x-text-gray: rgb(36 41 52 / 100%);--x-text-gray-1: rgb(100 107 122 / 100%);--x-text-gray-2: rgb(156 166 185 / 100%);--x-disabled-color: rgb(156 166 185 / 100%);--x-disabled-bgc: rgb(250 251 253 / 100%);--x-disabled-bc: rgb(225 228 232 / 100%);--x-hover-bgc: rgb(248 250 255 / 100%);--x-hover-color: var(--x-primary);--x-hover-bc: rgb(188 196 214 / 100%);--x-select-color: var(--x-primary);--x-select-bgc: rgb(248 250 255 / 100%);--x-select-bc: var(--x-primary);--x-focus-bc: var(--x-primary);--x-bgc: rgb(245 247 251 / 100%);--x-fs-small: 12px;--x-fs: 14px;--x-fs-large: 16px;--x-split-color: rgb(237 241 246 / 100%);--x-bc: rgb(237 241 246 / 100%);--x-size-mini: 24px;--x-size-small: 30px;--x-size-medium: 34px;--x-size-large: 38px;--x-size-huge: 42px}.x-button{--x-button-width: auto;--x-button-font-weight: 400;--x-button-opacity: 1;--x-button-border-color: var(--x-border-color);--x-button-background-color: var(--x-background-color);--x-button-color: var(--x-text-color);--x-button-mini-height: var(--x-size-mini);--x-button-mini-font-size: 12px;--x-button-mini-padding: 0 8px;--x-button-mini-border-radius: 4px;--x-button-small-height: var(--x-size-small);--x-button-small-font-size: 14px;--x-button-small-padding: 0 10px;--x-button-small-border-radius: 4px;--x-button-medium-height: var(--x-size-medium);--x-button-medium-font-size: 15px;--x-button-medium-padding: 0 14px;--x-button-medium-border-radius: 4px;--x-button-large-height: var(--x-size-large);--x-button-large-font-size: 16px;--x-button-large-padding: 0 20px;--x-button-large-border-radius: 6px;--x-button-huge-height: var(--x-size-huge);--x-button-huge-font-size: 17px;--x-button-huge-padding: 0 28px;--x-button-huge-border-radius: 4px}.x-button{position:relative;display:inline-flex;justify-content:center;align-items:center;overflow:hidden;margin:0;border-style:solid;border-width:1px;border-color:var(--x-button-border-color);border-radius:var(--x-button-border-radius);padding:var(--x-button-padding);width:var(--x-button-width);height:var(--x-button-height);font-size:var(--x-button-font-size);font-weight:var(--x-button-font-weight);white-space:nowrap;color:var(--x-button-color);background-color:var(--x-button-background-color);opacity:var(--x-button-opacity);outline:none;transition:all .15s linear;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-user-select:none;user-select:none;vertical-align:bottom;cursor:pointer}.x-button:before{content:"";position:absolute;top:50%;left:50%;width:100%;height:100%;background:#ffffff4d;border-radius:50%;transform:scale(0);transform-origin:center;opacity:0;transition:opacity .2s}.x-button:active:before{transform:scale(3);opacity:1;transition:opacity .1s}.x-button{--x-button-background-color: #fff;--x-button-color: var(--x-text-color);--x-button-border-color: var(--x-border-color)}.x-button:not(.is-disabled):hover{--x-button-background-color: var(--x-background-color);--x-button-color: var(--x-text-color);--x-button-border-color: var(--x-border-color)}.x-button:not(.is-disabled):active{--x-button-background-color: var(--x-background-color);--x-button-color: var(--x-text-color);--x-button-border-color: var(--x-color-4)}.x-button--prefix{margin-right:4px}.x-button--suffix{margin-left:4px}.x-button-is-disabled{--x-button-opacity: .4;cursor:not-allowed}.x-button-block{display:flex;width:100%}.x-button.-loading{--x-button-opacity: .76}.x-button-mini{--x-button-height: var(--x-button-mini-height);--x-button-font-size: var(--x-button-mini-font-size);--x-button-padding: var(--x-button-mini-padding);--x-button-border-radius: var(--x-button-mini-border-radius)}.x-button-small{--x-button-height: var(--x-button-small-height);--x-button-font-size: var(--x-button-small-font-size);--x-button-padding: var(--x-button-small-padding);--x-button-border-radius: var(--x-button-small-border-radius)}.x-button-medium{--x-button-height: var(--x-button-medium-height);--x-button-font-size: var(--x-button-medium-font-size);--x-button-padding: var(--x-button-medium-padding);--x-button-border-radius: var(--x-button-medium-border-radius)}.x-button-large{--x-button-height: var(--x-button-large-height);--x-button-font-size: var(--x-button-large-font-size);--x-button-padding: var(--x-button-large-padding);--x-button-border-radius: var(--x-button-large-border-radius)}.x-button-huge{--x-button-height: var(--x-button-huge-height);--x-button-font-size: var(--x-button-huge-font-size);--x-button-padding: var(--x-button-huge-padding);--x-button-border-radius: var(--x-button-huge-border-radius)}.x-button.-plain{--x-button-font-weight: 500}.x-button.-plain.x-button--primary{--x-button-background-color: var(--x-primary-9);--x-button-color: var(--x-primary);--x-button-border-color: var(--x-primary)}.x-button.-plain.x-button--primary:not(.is-disabled):hover{--x-button-background-color: var(--x-primary);--x-button-color: #fff;--x-button-border-color: var(--x-primary)}.x-button.-plain.x-button--primary:not(.is-disabled):active{--x-button-background-color: var(--x-primary-1);--x-button-color: #fff;--x-button-border-color: var(--x-primary-1)}.x-button.-plain.x-button--success.x-button--success{--x-button-background-color: var(--x-success-9);--x-button-color: var(--x-success);--x-button-border-color: var(--x-success)}.x-button.-plain.x-button--success.x-button--success:not(.is-disabled):hover{--x-button-background-color: var(--x-success);--x-button-color: #fff;--x-button-border-color: var(--x-success)}.x-button.-plain.x-button--success.x-button--success:not(.is-disabled):active{--x-button-background-color: var(--x-success-1);--x-button-color: #fff;--x-button-border-color: var(--x-success)}.x-button.-plain.x-button--warning{--x-button-background-color: var(--x-warning-9);--x-button-color: var(--x-warning);--x-button-border-color: var(--x-warning)}.x-button.-plain.x-button--warning:not(.is-disabled):hover{--x-button-background-color: var(--x-warning);--x-button-color: #fff;--x-button-border-color: var(--x-warning)}.x-button.-plain.x-button--warning:not(.is-disabled):active{--x-button-background-color: var(--x-warning);--x-button-color: #fff;--x-button-border-color: var(--x-warning)}.x-button.-plain.x-button--strong{--x-button-background-color: var(--x-strong-9);--x-button-color: var(--x-strong);--x-button-border-color: var(--x-strong)}.x-button.-plain.x-button--strong:not(.is-disabled):hover{--x-button-background-color: var(--x-strong);--x-button-color: #fff;--x-button-border-color: var(--x-strong)}.x-button.-plain.x-button--strong:not(.is-disabled):active{--x-button-background-color: var(--x-strong);--x-button-color: #fff;--x-button-border-color: var(--x-strong)}.x-button.-plain.x-button--danger{--x-button-background-color: var(--x-danger-9);--x-button-color: var(--x-danger);--x-button-border-color: var(--x-danger)}.x-button.-plain.x-button--danger:not(.is-disabled):hover{--x-button-background-color: var(--x-danger);--x-button-color: #fff;--x-button-border-color: var(--x-danger)}.x-button.-plain.x-button--danger:not(.is-disabled):active{--x-button-background-color: var(--x-danger-1);--x-button-color: #fff;--x-button-border-color: var(--x-danger-1)}.x-button.-round{--x-button-padding: 0 38px;--x-button-border-radius: 24px;height:var(--x-button-height)}.x-button.-circle{--x-button-padding: 0;--x-button-border-radius: 100%;width:var(--x-button-height);height:var(--x-button-height)}.x-button-text{--x-button-font-weight: 500;border-color:transparent;padding:2px;height:auto;color:var(--x-button-color);background:transparent}.x-button-text.x-button--primary{--x-button-background-color: var(--x-primary);--x-button-color: var(--x-primary);--x-button-border-color: var(--x-primary)}.x-button-text.x-button--primary:not(.is-disabled):hover{--x-button-background-color: var(--x-primary-3);--x-button-color: var(--x-primary-3);--x-button-border-color: var(--x-primary-3)}.x-button-text.x-button--primary:not(.is-disabled):active{--x-button-background-color: var(--x-primary-1);--x-button-color: var(--x-primary-1);--x-button-border-color: var(--x-primary-1)}.x-button-text.x-button--success{--x-button-background-color: var(--x-success);--x-button-color: var(--x-success);--x-button-border-color: var(--x-success)}.x-button-text.x-button--success:not(.is-disabled):hover{--x-button-background-color: var(--x-success);--x-button-color: var(--x-success);--x-button-border-color: var(--x-success)}.x-button-text.x-button--success:not(.is-disabled):active{--x-button-background-color: var(--x-success);--x-button-color: var(--x-success);--x-button-border-color: var(--x-success)}.x-button-text.x-button--warning{--x-button-background-color: var(--x-warning);--x-button-color: var(--x-warning);--x-button-border-color: var(--x-warning)}.x-button-text.x-button--warning:not(.is-disabled):hover{--x-button-background-color: var(--x-warning);--x-button-color: var(--x-warning);--x-button-border-color: var(--x-warning)}.x-button-text.x-button--warning:not(.is-disabled):active{--x-button-background-color: var(--x-warning);--x-button-color: var(--x-warning);--x-button-border-color: var(--x-warning)}.x-button-text.x-button--strong{--x-button-background-color: var(--x-strong);--x-button-color: var(--x-strong);--x-button-border-color: var(--x-strong)}.x-button-text.x-button--strong:not(.is-disabled):hover{--x-button-background-color: var(--x-strong);--x-button-color: var(--x-strong);--x-button-border-color: var(--x-strong)}.x-button-text.x-button--strong:not(.is-disabled):active{--x-button-background-color: var(--x-strong);--x-button-color: var(--x-strong);--x-button-border-color: var(--x-strong)}.x-button-text.x-button--danger{--x-button-background-color: var(--x-danger);--x-button-color: var(--x-danger);--x-button-border-color: var(--x-danger)}.x-button-text.x-button--danger:not(.is-disabled):hover{--x-button-background-color: var(--x-danger-3);--x-button-color: var(--x-danger-3);--x-button-border-color: var(--x-danger-3)}.x-button-text.x-button--danger:not(.is-disabled):active{--x-button-background-color: var(--x-danger-1);--x-button-color: var(--x-danger-1);--x-button-border-color: var(--x-danger-1)}.x-button.-hide-border{--x-button-font-weight: 500}.x-button.-hide-border.x-button--primary{--x-button-background-color: var(--x-primary-9);--x-button-color: var(--x-primary);--x-button-border-color: transparent}.x-button.-hide-border.x-button--primary:not(.is-disabled):hover{--x-button-background-color: var(--x-primary-9);--x-button-color: var(--x-primary);--x-button-border-color: var(--x-primary-6)}.x-button.-hide-border.x-button--primary:not(.is-disabled):active{--x-button-background-color: var(--x-primary-9);--x-button-color: var(--x-primary);--x-button-border-color: var(--x-primary-1)}.x-button.-hide-border.x-button--danger{--x-button-background-color: var(--x-danger-9);--x-button-color: var(--x-danger);--x-button-border-color: transparent}.x-button.-hide-border.x-button--danger:not(.is-disabled):hover{--x-button-background-color: var(--x-danger-9);--x-button-color: var(--x-danger);--x-button-border-color: var(--x-danger-6)}.x-button.-hide-border.x-button--danger:not(.is-disabled):active{--x-button-background-color: var(--x-danger-9);--x-button-color: var(--x-danger);--x-button-border-color: var(--x-danger-1)}.x-button.-hide-border.x-button--success{--x-button-background-color: var(--x-success-9);--x-button-color: var(--x-success);--x-button-border-color: transparent}.x-button.-hide-border.x-button--success:not(.is-disabled):hover{--x-button-background-color: var(--x-success-9);--x-button-color: var(--x-success);--x-button-border-color: var(--x-success-6)}.x-button.-hide-border.x-button--success:not(.is-disabled):active{--x-button-background-color: var(--x-success-9);--x-button-color: var(--x-success);--x-button-border-color: var(--x-success-1)}.x-button.-hide-border.x-button--warning{--x-button-background-color: var(--x-warning-9);--x-button-color: var(--x-warning);--x-button-border-color: transparent}.x-button.-hide-border.x-button--warning:not(.is-disabled):hover{--x-button-background-color: var(--x-warning-9);--x-button-color: var(--x-warning);--x-button-border-color: var(--x-warning-6)}.x-button.-hide-border.x-button--warning:not(.is-disabled):active{--x-button-background-color: var(--x-warning-9);--x-button-color: var(--x-warning);--x-button-border-color: var(--x-warning-1)}.x-button.-hide-border.x-button--strong{--x-button-background-color: var(--x-strong-9);--x-button-color: var(--x-strong);--x-button-border-color: transparent}.x-button.-hide-border.x-button--strong:not(.is-disabled):hover{--x-button-background-color: var(--x-strong-9);--x-button-color: var(--x-strong);--x-button-border-color: var(--x-strong-6)}.x-button.-hide-border.x-button--strong:not(.is-disabled):active{--x-button-background-color: var(--x-strong-9);--x-button-color: var(--x-strong);--x-button-border-color: var(--x-strong-1)}.x-button-primary{--x-button-background-color: var(--x-primary);--x-button-color: #fff;--x-button-border-color: var(--x-primary)}.x-button-primary:not(.is-disabled):hover{--x-button-background-color: var(--x-primary-3);--x-button-color: #fff;--x-button-border-color: var(--x-primary-3)}.x-button-primary:not(.is-disabled):active{--x-button-background-color: var(--x-primary-1);--x-button-color: #fff;--x-button-border-color: var(--x-primary-1)}.x-button-success{--x-button-background-color: var(--x-success);--x-button-color: #fff;--x-button-border-color: var(--x-success)}.x-button-success:not(.is-disabled):hover{--x-button-background-color: var(--x-success);--x-button-color: #fff;--x-button-border-color: var(--x-success)}.x-button-success:not(.is-disabled):active{--x-button-background-color: var(--x-success);--x-button-color: #fff;--x-button-border-color: var(--x-success)}.x-button-danger{--x-button-background-color: var(--x-danger);--x-button-color: #fff;--x-button-border-color: var(--x-danger)}.x-button-danger:not(.is-disabled):hover{--x-button-background-color: var(--x-danger-3);--x-button-color: #fff;--x-button-border-color: var(--x-danger-3)}.x-button-danger:not(.is-disabled):active{--x-button-background-color: var(--x-danger-1);--x-button-color: #fff;--x-button-border-color: var(--x-danger-1)}.x-button-strong{--x-button-background-color: var(--x-strong);--x-button-color: #fff;--x-button-border-color: var(--x-strong)}.x-button-strong:not(.is-disabled):hover{--x-button-background-color: var(--x-strong);--x-button-color: #fff;--x-button-border-color: var(--x-strong)}.x-button-strong:not(.is-disabled):active{--x-button-background-color: var(--x-strong);--x-button-color: #fff;--x-button-border-color: var(--x-strong)}.x-button-warning{--x-button-background-color: var(--x-warning);--x-button-color: #fff;--x-button-border-color: var(--x-warning)}.x-button-warning:not(.is-disabled):hover{--x-button-background-color: var(--x-warning);--x-button-color: #fff;--x-button-border-color: var(--x-warning)}.x-button-warning:not(.is-disabled):active{--x-button-background-color: var(--x-warning);--x-button-color: #fff;--x-button-border-color: var(--x-warning)}.x-button--loading{display:flex;margin-right:4px}.x-button-group{display:flex;width:min-content}.x-button-group>.x-button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.x-button-group>.x-button:last-child{margin-left:-1px;border-left-color:#ffffff80;border-top-left-radius:0;border-bottom-left-radius:0}.x-button-group>.x-button:not(:first-child,:last-child){margin-left:-1px;border-right-color:#ffffff80;border-left-color:#ffffff80;border-radius:0}.x-dialog{--x-mask-background-color: rgb(29 33 41 / 60%);--x-dialog-radius: 6px}.x-dialog{position:fixed;top:0;right:0;bottom:0;left:0}.x-dialog--mask{position:absolute;top:0;right:0;bottom:0;left:0;background-color:var(--x-mask-background-color)}.x-dialog--wrapper{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;text-align:center}.x-dialog--wrapper.is-center{display:flex;justify-content:center;align-items:center}.x-dialog--container{position:relative;display:inline-block;overflow:hidden;border-radius:var(--x-dialog-radius);background-color:#fff;transition:top .3s}.x-dialog--container.is-fullscreen{display:inline-flex;border-radius:0;width:100%;height:100%;flex-direction:column;vertical-align:middle}.x-dialog--container.is-fullscreen .x-dialog--footer{margin-top:auto}.x-dialog--header{position:relative;padding:30px 48px 0 25px;text-align:left;box-sizing:border-box}.x-dialog--header-title{overflow:hidden;font-size:18px;font-weight:700;text-overflow:ellipsis;white-space:nowrap;line-height:1}.x-dialog--header.is-bottom-line{border-bottom:1px solid var(--x-split-color);padding-bottom:20px}.x-dialog--body{padding:20px 25px;box-sizing:border-box;text-align:left}.x-dialog--footer{display:flex;justify-content:flex-end;padding:0 18px 18px 25px}.x-dialog--close-icon{position:absolute;top:20px;right:18px;width:16px;height:16px;cursor:pointer;transition:background-color .5s ease}.x-dialog--close-icon:hover{background-color:#d5d9da;transition:background-color .5s ease}.x-dialog--close-icon:hover:before,.x-dialog--close-icon:hover:after{background-color:#fff;transition:background-color .5s ease}.x-dialog--close-icon:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(45deg);width:1px;height:100%;background-color:#9ca6b9;transition:background-color .5s ease}.x-dialog--close-icon:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-45deg);width:1px;height:100%;background-color:#9ca6b9;transition:background-color .5s ease}.x-message{--x-message-height: 36px;--x-message-width: 360px;--x-border-radius: 4px;--x-border-color: var(--x-info-border-color);--x-success-background-color: #f2f9ec;--x-success-color: #7ebf50;--x-warning-background-color: #fdf6ec;--x-warning-color: #e6a23c;--x-strong-background-color: #fff5f0;--x-strong-color: #ff7125;--x-error-background-color: #fef0f0;--x-error-color: #f56c6c;--x-info-background-color: #f4f4f5;--x-info-color: var(--x-primary);position:fixed;left:50%;display:flex;align-items:center;border-radius:var(--x-border-radius);padding:12px 16px 12px 12px;background-color:#fff;font-weight:500;color:#000000e0;transition:all .3s ease;box-sizing:border-box;transform:translate(-50%);box-shadow:0 6px 16px #00000014,0 3px 6px -4px #0000001f,0 9px 28px 8px #0000000d}.x-message--icon{margin-right:6px;font-size:18px}.x-message--show-close{justify-content:space-between}.x-message--close-icon{position:relative;display:inline-block;border-radius:100%;width:16px;height:16px;cursor:pointer}.x-message--close-icon:hover{background-color:#c5c9d4}.x-message--close-icon:hover:before,.x-message--close-icon:hover:after{height:70%;background-color:#fff}.x-message--close-icon:before{position:absolute;top:50%;left:50%;width:1px;height:70%;background-color:#bfc5d2;transition:background-color .2s;content:"";transform:translate(-50%,-50%) rotate(45deg)}.x-message--close-icon:after{position:absolute;top:50%;left:50%;width:1px;height:70%;background-color:#bfc5d2;transition:background-color .2s;content:"";transform:translate(-50%,-50%) rotate(-45deg)}.x-message-icon-success{color:var(--x-success-color)}.x-message-icon-warning{color:var(--x-warning-color)}.x-message-icon-strong{color:var(--x-strong-color)}.x-message-icon-error{color:var(--x-error-color)}.x-message-icon-info{color:var(--x-info-color)}.x-message-center{justify-content:center}.x-message-slide-top-enter-from,.x-message-slide-top-leave-to{opacity:0;transform:translate(-50%,-100%)}.x-message-slide-top-enter-to{opacity:1;transform:translate(-50%)}.x-message-box--header{padding:25px 0 15px;line-height:1;display:flex;justify-content:center;align-items:center}.x-message-box--body{padding:0 25px;box-sizing:border-box;text-align:center}.x-message-box--footer{padding:20px 0;box-sizing:border-box}.x-message-box--icon{margin-right:4px}.x-message-box--title{font-size:18px;font-weight:600;color:#242934;line-height:1}.x-message-box--content{font-size:14px;font-weight:400;color:#363636;line-height:1.5}.x-message-box--close-icon{top:28px;right:20px}.x-notification{position:relative;border-radius:8px;padding:15px;width:338px;background:#fff;box-shadow:0 6px 16px #00000014,0 3px 6px -4px #0000001f,0 9px 28px 8px #0000000d;box-sizing:border-box}.x-notification-top{transition:top .2s,transform .2s ease,opacity .2s}.x-notification-bottom{transition:bottom .2s,transform .2s ease,opacity .2s}.x-notification--icon{font-size:22px;margin-right:8px}.x-notification-icon-info{color:var(--x-primary)}.x-notification-icon-success{color:var(--x-success)}.x-notification-icon-warning{color:var(--x-warning)}.x-notification-icon-strong{color:var(--x-strong)}.x-notification-icon-error{color:var(--x-danger)}.x-notification--header{display:inline-flex}.x-notification--title{font-size:18px;font-weight:600;color:#242934;line-height:22px;height:22px}.x-notification--message{box-sizing:border-box;margin-top:12px;font-size:14px;font-weight:400;color:#363636;line-height:1}.x-notification--close-icon{position:absolute;top:20px;right:20px;width:14px;height:14px;cursor:pointer}.x-notification--close-icon:hover{background-color:#d5d9da;transition:background-color .5s ease}.x-notification--close-icon:hover:before,.x-notification--close-icon:hover:after{background-color:#fff;transition:background-color .5s ease}.x-notification--close-icon:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(45deg);width:1px;height:100%;background-color:#9ca6b9}.x-notification--close-icon:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-45deg);width:1px;height:100%;background-color:#9ca6b9}.x-notification-slide-right-enter-from{transform:translate(100%)}.x-notification-slide-right-enter-to{transform:translate(0)}.x-notification-slide-left-enter-from{transform:translate(-100%)}.x-notification-slide-left-enter-to{transform:translate(0)}.x-notification-slide-right-leave-from,.x-notification-slide-left-leave-from{opacity:1}.x-notification-slide-right-leave-to,.x-notification-slide-left-leave-to{opacity:0}.x-space{display:inline-flex;vertical-align:bottom}.x-space--horizontal-center{align-items:center}.x-space--horizontal-start{align-items:flex-start}.x-space--horizontal-end{align-items:flex-end}.x-space--horizontal-baseline{align-items:baseline}.x-space--vertical{flex-direction:column}.x-space--split{color:var(--bn-color-5)}.x-space-is-fill{display:flex}body{margin:0}.icon-loading-svg[data-v-62d46830]{animation:animated-loading-rotate-62d46830 1.5s infinite ease-in-out}.icon-loading-svg>.path[data-v-62d46830]{stroke:#fffc;stroke-width:5;animation:animated-loading-62d46830 1.5s infinite ease-in-out}@keyframes animated-loading-62d46830{0%{stroke-dasharray:1,125;stroke-dashoffset:0}50%{stroke-dasharray:95,31;stroke-dashoffset:-31px}to{stroke-dasharray:6,120;stroke-dashoffset:-120px}}@keyframes animated-loading-rotate-62d46830{to{transform:rotate(1turn)}}
|
package/global.d.ts
ADDED
package/package.json
CHANGED
@@ -1,65 +1,72 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
"name": "x-next",
|
3
|
+
"private": false,
|
4
|
+
"version": "0.0.0-alpha.11",
|
5
|
+
"description": "An amazing Vue3 UI library.",
|
6
|
+
"type": "module",
|
7
|
+
"main": "./dist/index.umd.js",
|
8
|
+
"module": "./dist/index.es.js",
|
9
|
+
"types": "./dist/index.d.ts",
|
10
|
+
"scripts": {
|
11
|
+
"dev": "vite",
|
12
|
+
"build": "vue-tsc && vite build",
|
13
|
+
"preview": "vite preview",
|
14
|
+
"generate:web-types": "vue-docgen src",
|
15
|
+
"publish": "npm publish --access=public"
|
16
|
+
},
|
17
|
+
"exports": {
|
18
|
+
".": {
|
19
|
+
"import": "./dist/index.es.js",
|
20
|
+
"require": "./dist/index.umd.js",
|
21
|
+
"types": "./dist/index.d.ts"
|
11
22
|
},
|
12
|
-
"
|
13
|
-
|
23
|
+
"./global": {
|
24
|
+
"types": "./global.d.ts"
|
14
25
|
},
|
15
|
-
"
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
"/framework",
|
62
|
-
"README.md",
|
63
|
-
"index.d.ts"
|
64
|
-
]
|
26
|
+
"./style.css": "./dist/style.css"
|
27
|
+
},
|
28
|
+
"repository": {
|
29
|
+
"type": "git",
|
30
|
+
"url": "git+https://github.com/ztes/x-next.git"
|
31
|
+
},
|
32
|
+
"bugs": {
|
33
|
+
"url": "https://github.com/ztes/x-next/issues"
|
34
|
+
},
|
35
|
+
"dependencies": {
|
36
|
+
"dayjs": "^1.11.13"
|
37
|
+
},
|
38
|
+
"devDependencies": {
|
39
|
+
"@types/node": "^20.16.15",
|
40
|
+
"@vitejs/plugin-vue": "^5.1.4",
|
41
|
+
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
42
|
+
"i": "^0.3.7",
|
43
|
+
"npm": "^10.9.0",
|
44
|
+
"prettier": "^3.3.3",
|
45
|
+
"prettier-plugin-packagejson": "^2.5.3",
|
46
|
+
"sass": "^1.80.3",
|
47
|
+
"typescript": "^5.6.3",
|
48
|
+
"vite": "^5.4.10",
|
49
|
+
"vite-plugin-dts": "^4.3.0",
|
50
|
+
"vue": "^3.5.12",
|
51
|
+
"vue-docgen-api": "^4.79.2",
|
52
|
+
"vue-docgen-cli": "^4.79.0",
|
53
|
+
"vue-tsc": "^2.1.6"
|
54
|
+
},
|
55
|
+
"publishConfig": {
|
56
|
+
"access": "public"
|
57
|
+
},
|
58
|
+
"keywords": [
|
59
|
+
"vue",
|
60
|
+
"vue 3",
|
61
|
+
"component"
|
62
|
+
],
|
63
|
+
"author": {
|
64
|
+
"email": "xy@ztes.com",
|
65
|
+
"name": "XuYu"
|
66
|
+
},
|
67
|
+
"license": "MIT",
|
68
|
+
"files": [
|
69
|
+
"dist",
|
70
|
+
"global.d.ts"
|
71
|
+
]
|
65
72
|
}
|
package/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2020 Pudon
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
@@ -1,2 +0,0 @@
|
|
1
|
-
function consoleLog(e,t,n,c){console.log("".concat("\n"," %c ").concat(e," %c ").concat(t," ").concat("\n"),"color: ".concat(n,"; background: ").concat(c,"; padding:5px 0;border-radius:3px 0 0 3px;"),"color:#666666;background: #f1f5fa; padding:5px 0;border-radius:0 3px 3px 0;")}function now(){return"".concat((new Date).getHours()<10?"0"+(new Date).getHours():(new Date).getHours(),":").concat((new Date).getMinutes()<10?"0"+(new Date).getMinutes():(new Date).getMinutes(),":").concat((new Date).getSeconds()<10?"0"+(new Date).getSeconds():(new Date).getSeconds())}function jsonStringify2Parse(t){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return JSON.parse(JSON.stringify('{"value":'.concat(t)))}return{}}var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var WebSocketBucketState,Exception=function(c){function e(e,t){var n=c.call(this,t)||this;return n.name="Client.io Error",n.message="Error message",n.name=e||n.name,n.message=t||n.message,n.stack=(new Error).stack,n}return __extends(e,c),e}(Error),WebSocketBucket=(!function(e){e.CONNECTING="CONNECTING",e.OPEN="OPEN",e.CLOSING="CLOSING",e.CLOSED="CLOSED",e.FAIL="FAIL"}(WebSocketBucketState=WebSocketBucketState||{}),function(){function k(){this.bucketName=k.DEFAULT_NAME,this.buckets=new Map,this.bucketName=k.DEFAULT_NAME}return k.create=function(e){var c,o,t,n=e.url,a=e.name,r=e.heartbeat,s=e.heartRate,s=void 0===s?3e3:s,i=e.restartTime,i=void 0===i?5e3:i,u=e.restartTimes,u=void 0===u?0:u,f=e.restartedTimes,g=void 0===f?0:f,f=e.receive,e=e.send;if(/(ws|wss):\/\/\s*/.test(n))return c=a||k.getBucketName(a),t=new WebSocket(n),o=-1,t.onopen=function(e){consoleLog("".concat(c," ▶ SUCCESS"),"◔ ".concat(now()),"#ffffff","#1bc800"),k.setBucketKeyValue("restartedTimes",0,c),k.bindMessage(a)},t.onerror=function(e){consoleLog("".concat(c," ▶ ERROR"),"◔ ".concat(now()," ▶ ").concat(c),"#ffffff","#c80000")},t.onclose=function(e){consoleLog("".concat(c," ▶ CLOSE"),"◔ ".concat(now()," ▶ ").concat(c),"#ffffff","#000000"),clearInterval(o);var t=k.getBucket(c),n=(t.restartedTimes!==g?g=t.restartedTimes+1:g+=1,Math.pow(2,g-1)*t.restartTime);consoleLog("".concat(c," ▶ REBOOT WAITING"),"◔ ".concat(now()," ▶ ").concat(c," RESTART IN ").concat(Math.round(n/1e3)," SECONDS"),"#ffffff","#00c8b4"),setTimeout(function(){t.restartedTimes=g,k.create(t)},n)},"function"==typeof r&&(o=setInterval(function(){r(function(e){k.sendMessage(e,c)})},s)),t={name:c,client:t,url:n,heartbeat:r,heartRate:s,heartRateTimer:o,restartTime:i,restartTimes:u,restartedTimes:g,receive:f,send:e,receiveMessageCallbacks:new Map},k.getInstance().buckets.set(c,t),k.getBucketClient(c);throw new Error("传入的url必须是ws或wss地址")},k.getBucket=function(e){e=k.getBucketName(e);if(!k.getInstance().buckets.has(e))throw new Exception("名称为".concat(e,"是WebSocket实例不存在"),k.NO_BUCKET);var t=k.getInstance().buckets.get(e);if(t&&t.client instanceof WebSocket)return t;throw new Exception("名称为".concat(e,"是WebSocket实例不存在"),k.NO_BUCKET_CLIENT)},k.setBucketKeyValue=function(e,t,n){var c=k.getBucket(n);if(!c||"object"!=typeof c||!Reflect.has(c,e))throw new Exception("名称为".concat(k.getBucketName(n),"的WebSocket Bucket不存在").concat(e,"属性"),k.NO_BUCKET_KEY);c[e]=t,k.getInstance().buckets.set(n,c)},k.getBucketClient=function(e){try{return k.getBucket(e).client}catch(e){console.log("Exception",e)}},k.getBucketName=function(e){return e||k.getInstance().bucketName},k.getBucketClientState=function(e){try{switch(k.getBucketClient(e).readyState){case WebSocket.CONNECTING:return WebSocketBucketState.CONNECTING;case WebSocket.OPEN:return WebSocketBucketState.OPEN;case WebSocket.CLOSING:return WebSocketBucketState.CLOSING;case WebSocket.CLOSED:return WebSocketBucketState.CLOSED;default:return WebSocketBucketState.FAIL}}catch(e){return WebSocketBucketState.FAIL}},k.wsErrorEventListener=function(t,e){void 0===e&&(e=void 0);try{k.getBucketClient(e).onerror=function(e){"function"==typeof t?t(e):console.warn("监听ws报错的回调函数wsError不存在")}}catch(e){console.warn("".concat(e))}},k.wsCloseEventListener=function(t,e){void 0===e&&(e=void 0);try{k.getBucketClient(e).onclose=function(e){"function"==typeof t?t(e):console.warn("监听ws关闭的回调函数wsClose不存在")}}catch(e){console.warn("".concat(e))}},k.wsOpenEventListener=function(t,e){void 0===e&&(e=void 0);try{k.getBucketClient(e).onopen=function(e){"function"==typeof t?t(e):console.warn("wsOpenEventListener缺少回调函数")}}catch(e){console.warn("".concat(e))}},k.sendMessage=function(e,t,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),["CONNECTING","CLOSING","CLOSED"].includes(k.getBucketClientState(t=void 0===t?void 0:t)))n||console.warn("BUCKET:".concat(k.getBucketName(t),"|STATUS:").concat(k.getBucketClientState(t),"|无法进行消息发送"));else try{var c=k.getBucket(t).send;"function"==typeof c&&(e=c(e)),k.getBucketClient(t).send(e)}catch(e){console.warn("".concat(e))}},k.bindMessage=function(e){0<k.getBucket(e).receiveMessageCallbacks.size&&k.registerOnMessage(e)},k.receiveMessage=function(e,t){try{var n;"function"==typeof e?(n="".concat(e),k.getBucket(t).receiveMessageCallbacks.get(n)||k.getBucket(t).receiveMessageCallbacks.set(n,e)):console.warn("receiveMessage缺少回调"),k.registerOnMessage(t)}catch(e){console.warn("".concat(e))}},k.registerOnMessage=function(n){k.getBucketClient(n).onmessage=function(t){var e=k.getBucket(n).receive;"function"==typeof e&&(t=e(t,function(e){k.sendMessage(e,n)})),k.getBucket(n).receiveMessageCallbacks.forEach(function(e){try{e(t)}catch(e){console.warn("".concat(e))}})}},k.getInstance=function(){var e=k.instance;return e=e&&e instanceof k?e:k.instance=new k},k.NO_BUCKET="10001",k.NO_BUCKET_CLIENT="10002",k.NO_BUCKET_KEY="10003",k.DEFAULT_NAME="DEFAULT_BUCKET",k}());export{WebSocketBucket,jsonStringify2Parse};
|
2
|
-
//# sourceMappingURL=client.io.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"client.io.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Exception Class
|
3
|
-
* throw diy Exception
|
4
|
-
* https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Error
|
5
|
-
* 目前原生的错误类型
|
6
|
-
* Error [一般错误类型]
|
7
|
-
* SyntaxError [语法错误]
|
8
|
-
* ReferenceError [不存在的变量]
|
9
|
-
* RangeError [超出有效范围]
|
10
|
-
* TypeError [非预期类型]
|
11
|
-
* URIError [URI参数错误]
|
12
|
-
* EvalError [eval函数没有正确执行]
|
13
|
-
* example:: throw new Exception() catch(error) error.message,error.name,error.code,error.stack
|
14
|
-
* NewException extends Exception diy yourself Exception;
|
15
|
-
*/
|
16
|
-
export declare class Exception extends Error {
|
17
|
-
name: string;
|
18
|
-
message: string;
|
19
|
-
/**
|
20
|
-
* Error constructor
|
21
|
-
* @param {String} name 自定义错误名称
|
22
|
-
* @param {String|Number} message 自定义错误提示
|
23
|
-
*/
|
24
|
-
constructor(name?: string, message?: string);
|
25
|
-
}
|
package/framework/es/index.d.ts
DELETED
package/framework/es/types.d.ts
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
export declare type WebSocketUrl = `ws://${string}` | `wss://${string}`;
|
2
|
-
export declare type Heartbeat = (callback: HeartbeatCallback) => void;
|
3
|
-
export declare type HeartbeatCallback = (msg: string) => void;
|
4
|
-
export declare type ReceiveInterceptor = (event: MessageEvent<any>, send: (msg: SendMsg) => void) => any;
|
5
|
-
export declare type SendInterceptor = (event: any) => any;
|
6
|
-
export declare type WebSocketBucketCreate = {
|
7
|
-
url: WebSocketUrl;
|
8
|
-
name?: string;
|
9
|
-
heartbeat?: Heartbeat;
|
10
|
-
heartRate?: Millisecond;
|
11
|
-
restartTime?: Millisecond;
|
12
|
-
restartTimes?: number;
|
13
|
-
restartedTimes?: number;
|
14
|
-
receive?: ReceiveInterceptor;
|
15
|
-
send?: SendInterceptor;
|
16
|
-
};
|
17
|
-
export declare type WebSocketBucketOptions = {
|
18
|
-
name: string;
|
19
|
-
client: WebSocket;
|
20
|
-
url: WebSocketUrl;
|
21
|
-
heartbeat?: Heartbeat;
|
22
|
-
heartRate: Millisecond;
|
23
|
-
heartRateTimer: number;
|
24
|
-
restartTime: Millisecond;
|
25
|
-
restartTimes: number;
|
26
|
-
restartedTimes: number;
|
27
|
-
receive?: ReceiveInterceptor;
|
28
|
-
send?: SendInterceptor;
|
29
|
-
receiveMessageCallbacks: Map<string, (event: MessageEvent<any>) => void>;
|
30
|
-
[key: string]: unknown;
|
31
|
-
};
|
32
|
-
export declare type Millisecond = number;
|
33
|
-
export declare type SendMsg = string | ArrayBufferLike | Blob | ArrayBufferView;
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import { SendMsg, WebSocketBucketCreate, WebSocketBucketOptions } from './types';
|
2
|
-
declare enum WebSocketBucketState {
|
3
|
-
CONNECTING = "CONNECTING",
|
4
|
-
OPEN = "OPEN",
|
5
|
-
CLOSING = "CLOSING",
|
6
|
-
CLOSED = "CLOSED",
|
7
|
-
FAIL = "FAIL"
|
8
|
-
}
|
9
|
-
/**
|
10
|
-
* @class WebSocketBucket
|
11
|
-
* @public
|
12
|
-
* @classdesc WebSocket快速部署开发,可同开多个WebSocket,并分别命名,可对多个Client进行监听,每一个Bucket为Client运行所必需的空间环境。
|
13
|
-
* @example
|
14
|
-
* WebSocketBucket.create({url:'wss://ws.demo.com/socket-io'})
|
15
|
-
* WebSocketBucket.sendMessage('Hello World')
|
16
|
-
*/
|
17
|
-
export declare class WebSocketBucket {
|
18
|
-
static NO_BUCKET: string;
|
19
|
-
static NO_BUCKET_CLIENT: string;
|
20
|
-
static NO_BUCKET_KEY: string;
|
21
|
-
static DEFAULT_NAME: string;
|
22
|
-
client: WebSocket | undefined;
|
23
|
-
buckets: Map<string, WebSocketBucketOptions>;
|
24
|
-
bucketName: string;
|
25
|
-
static instance: WebSocketBucket;
|
26
|
-
constructor();
|
27
|
-
/**
|
28
|
-
* create
|
29
|
-
* 创建一个Bucket空间
|
30
|
-
* @param url {string} 服务地址(SSL)
|
31
|
-
* @param name {string} 实例名称
|
32
|
-
* @param heartbeat {function} (sendMessage,instanceName)=>void 心跳执行函数 send {Function} 消息发送函数
|
33
|
-
* @param heartRate 心跳频率 毫秒
|
34
|
-
* @param restartTime 重启时间,按照通用方式,例如第一次3秒后重连如果没连上第二次就3*2=6秒后重连,如果还没有连上第三次就是3*2*2=12秒后重连,以此类推直到重连上为止,一旦重连上重连等待时间就会自动回到3秒这个初始值
|
35
|
-
* @param restartTimes 重启次数,0为不限制,>0为最大重启次数
|
36
|
-
* @param restartedTimes 已重启次数
|
37
|
-
* @param receive 接收拦截器
|
38
|
-
* @param send 发送拦截器
|
39
|
-
*/
|
40
|
-
static create({ url, name, heartbeat, heartRate, restartTime, restartTimes, restartedTimes, receive, send, }: WebSocketBucketCreate): WebSocket | undefined;
|
41
|
-
/**
|
42
|
-
* readBucket
|
43
|
-
* 读取Bucket空间
|
44
|
-
* @param name
|
45
|
-
* @return WebSocketBucketOptions
|
46
|
-
*/
|
47
|
-
static getBucket(name: string | undefined): WebSocketBucketOptions;
|
48
|
-
/**
|
49
|
-
* setBucketKeyValue
|
50
|
-
* 设置Bucket属性值
|
51
|
-
* @param key
|
52
|
-
* @param value
|
53
|
-
* @param name
|
54
|
-
*/
|
55
|
-
static setBucketKeyValue(key: string, value: number, name: string): void;
|
56
|
-
/**
|
57
|
-
* 获取Bucket客户端
|
58
|
-
* @param name
|
59
|
-
*/
|
60
|
-
static getBucketClient(name: string | undefined): WebSocket | undefined;
|
61
|
-
/**
|
62
|
-
* 获取Bucket空间名称
|
63
|
-
* @param name
|
64
|
-
*/
|
65
|
-
static getBucketName(name: string | undefined): string;
|
66
|
-
/**
|
67
|
-
* 获取Bucket客户端状态
|
68
|
-
* @param name
|
69
|
-
*/
|
70
|
-
static getBucketClientState(name: string | undefined): WebSocketBucketState;
|
71
|
-
/**
|
72
|
-
* 监听WebSocket报错
|
73
|
-
* @param callback
|
74
|
-
* @param name
|
75
|
-
*/
|
76
|
-
static wsErrorEventListener(callback: (event: Event) => void, name?: undefined): void;
|
77
|
-
/**
|
78
|
-
* 监听WebSocket关闭
|
79
|
-
* @param callback
|
80
|
-
* @param name
|
81
|
-
*/
|
82
|
-
static wsCloseEventListener(callback: (event: CloseEvent) => void, name?: undefined): void;
|
83
|
-
/**
|
84
|
-
* 监听WebSocket打开
|
85
|
-
* @param callback
|
86
|
-
* @param name
|
87
|
-
*/
|
88
|
-
static wsOpenEventListener(callback: (event: Event) => void, name?: undefined): void;
|
89
|
-
/**
|
90
|
-
* 发送消息
|
91
|
-
* @param msg 消息
|
92
|
-
* @param name Bucket名称
|
93
|
-
* @param isCloseWarn 是否关闭警告
|
94
|
-
*/
|
95
|
-
static sendMessage(msg?: SendMsg, name?: string | undefined, isCloseWarn?: boolean): void;
|
96
|
-
/**
|
97
|
-
* 绑定消息
|
98
|
-
* @param name
|
99
|
-
*/
|
100
|
-
static bindMessage(name: string | undefined): void;
|
101
|
-
/**
|
102
|
-
* 接收消息
|
103
|
-
* @param callback 接收消息的回调函数
|
104
|
-
* @param name Bucket名称
|
105
|
-
*/
|
106
|
-
static receiveMessage(callback: (event: MessageEvent<any>) => void, name?: string): void;
|
107
|
-
/**
|
108
|
-
* 注册消息接收事件
|
109
|
-
* @param name
|
110
|
-
*/
|
111
|
-
static registerOnMessage(name?: string): void;
|
112
|
-
/**
|
113
|
-
* 获取单例实例
|
114
|
-
* @description 采用单例方式有利于减少内存占用
|
115
|
-
*/
|
116
|
-
static getInstance(): WebSocketBucket;
|
117
|
-
}
|
118
|
-
export {};
|
@@ -1,2 +0,0 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Transform={})}(this,function(e){"use strict";function g(e,t,n,c){console.log("".concat("\n"," %c ").concat(e," %c ").concat(t," ").concat("\n"),"color: ".concat(n,"; background: ").concat(c,"; padding:5px 0;border-radius:3px 0 0 3px;"),"color:#666666;background: #f1f5fa; padding:5px 0;border-radius:0 3px 3px 0;")}function d(){return"".concat((new Date).getHours()<10?"0"+(new Date).getHours():(new Date).getHours(),":").concat((new Date).getMinutes()<10?"0"+(new Date).getMinutes():(new Date).getMinutes(),":").concat((new Date).getSeconds()<10?"0"+(new Date).getSeconds():(new Date).getSeconds())}var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};var t,o=function(c){var e=o,t=c;if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}function o(e,t){var n=c.call(this,t)||this;return n.name="Client.io Error",n.message="Error message",n.name=e||n.name,n.message=t||n.message,n.stack=(new Error).stack,n}return r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n),o}(Error),n=((n=t=t||{}).CONNECTING="CONNECTING",n.OPEN="OPEN",n.CLOSING="CLOSING",n.CLOSED="CLOSED",n.FAIL="FAIL",k.create=function(e){var c,o,t,n=e.url,r=e.name,a=e.heartbeat,s=e.heartRate,s=void 0===s?3e3:s,i=e.restartTime,i=void 0===i?5e3:i,u=e.restartTimes,u=void 0===u?0:u,f=e.restartedTimes,l=void 0===f?0:f,f=e.receive,e=e.send;if(/(ws|wss):\/\/\s*/.test(n))return c=r||k.getBucketName(r),t=new WebSocket(n),o=-1,t.onopen=function(e){g("".concat(c," ▶ SUCCESS"),"◔ ".concat(d()),"#ffffff","#1bc800"),k.setBucketKeyValue("restartedTimes",0,c),k.bindMessage(r)},t.onerror=function(e){g("".concat(c," ▶ ERROR"),"◔ ".concat(d()," ▶ ").concat(c),"#ffffff","#c80000")},t.onclose=function(e){g("".concat(c," ▶ CLOSE"),"◔ ".concat(d()," ▶ ").concat(c),"#ffffff","#000000"),clearInterval(o);var t=k.getBucket(c),n=(t.restartedTimes!==l?l=t.restartedTimes+1:l+=1,Math.pow(2,l-1)*t.restartTime);g("".concat(c," ▶ REBOOT WAITING"),"◔ ".concat(d()," ▶ ").concat(c," RESTART IN ").concat(Math.round(n/1e3)," SECONDS"),"#ffffff","#00c8b4"),setTimeout(function(){t.restartedTimes=l,k.create(t)},n)},"function"==typeof a&&(o=setInterval(function(){a(function(e){k.sendMessage(e,c)})},s)),t={name:c,client:t,url:n,heartbeat:a,heartRate:s,heartRateTimer:o,restartTime:i,restartTimes:u,restartedTimes:l,receive:f,send:e,receiveMessageCallbacks:new Map},k.getInstance().buckets.set(c,t),k.getBucketClient(c);throw new Error("传入的url必须是ws或wss地址")},k.getBucket=function(e){e=k.getBucketName(e);if(!k.getInstance().buckets.has(e))throw new o("名称为".concat(e,"是WebSocket实例不存在"),k.NO_BUCKET);var t=k.getInstance().buckets.get(e);if(t&&t.client instanceof WebSocket)return t;throw new o("名称为".concat(e,"是WebSocket实例不存在"),k.NO_BUCKET_CLIENT)},k.setBucketKeyValue=function(e,t,n){var c=k.getBucket(n);if(!c||"object"!=typeof c||!Reflect.has(c,e))throw new o("名称为".concat(k.getBucketName(n),"的WebSocket Bucket不存在").concat(e,"属性"),k.NO_BUCKET_KEY);c[e]=t,k.getInstance().buckets.set(n,c)},k.getBucketClient=function(e){try{return k.getBucket(e).client}catch(e){console.log("Exception",e)}},k.getBucketName=function(e){return e||k.getInstance().bucketName},k.getBucketClientState=function(e){try{switch(k.getBucketClient(e).readyState){case WebSocket.CONNECTING:return t.CONNECTING;case WebSocket.OPEN:return t.OPEN;case WebSocket.CLOSING:return t.CLOSING;case WebSocket.CLOSED:return t.CLOSED;default:return t.FAIL}}catch(e){return t.FAIL}},k.wsErrorEventListener=function(t,e){void 0===e&&(e=void 0);try{k.getBucketClient(e).onerror=function(e){"function"==typeof t?t(e):console.warn("监听ws报错的回调函数wsError不存在")}}catch(e){console.warn("".concat(e))}},k.wsCloseEventListener=function(t,e){void 0===e&&(e=void 0);try{k.getBucketClient(e).onclose=function(e){"function"==typeof t?t(e):console.warn("监听ws关闭的回调函数wsClose不存在")}}catch(e){console.warn("".concat(e))}},k.wsOpenEventListener=function(t,e){void 0===e&&(e=void 0);try{k.getBucketClient(e).onopen=function(e){"function"==typeof t?t(e):console.warn("wsOpenEventListener缺少回调函数")}}catch(e){console.warn("".concat(e))}},k.sendMessage=function(e,t,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),["CONNECTING","CLOSING","CLOSED"].includes(k.getBucketClientState(t=void 0===t?void 0:t)))n||console.warn("BUCKET:".concat(k.getBucketName(t),"|STATUS:").concat(k.getBucketClientState(t),"|无法进行消息发送"));else try{var c=k.getBucket(t).send;"function"==typeof c&&(e=c(e)),k.getBucketClient(t).send(e)}catch(e){console.warn("".concat(e))}},k.bindMessage=function(e){0<k.getBucket(e).receiveMessageCallbacks.size&&k.registerOnMessage(e)},k.receiveMessage=function(e,t){try{var n;"function"==typeof e?(n="".concat(e),k.getBucket(t).receiveMessageCallbacks.get(n)||k.getBucket(t).receiveMessageCallbacks.set(n,e)):console.warn("receiveMessage缺少回调"),k.registerOnMessage(t)}catch(e){console.warn("".concat(e))}},k.registerOnMessage=function(n){k.getBucketClient(n).onmessage=function(t){var e=k.getBucket(n).receive;"function"==typeof e&&(t=e(t,function(e){k.sendMessage(e,n)})),k.getBucket(n).receiveMessageCallbacks.forEach(function(e){try{e(t)}catch(e){console.warn("".concat(e))}})}},k.getInstance=function(){var e=k.instance;return e=e&&e instanceof k?e:k.instance=new k},k.NO_BUCKET="10001",k.NO_BUCKET_CLIENT="10002",k.NO_BUCKET_KEY="10003",k.DEFAULT_NAME="DEFAULT_BUCKET",k);function k(){this.bucketName=k.DEFAULT_NAME,this.buckets=new Map,this.bucketName=k.DEFAULT_NAME}e.WebSocketBucket=n,e.jsonStringify2Parse=function(t){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return JSON.parse(JSON.stringify('{"value":'.concat(t)))}return{}},Object.defineProperty(e,"__esModule",{value:!0})});
|
2
|
-
//# sourceMappingURL=client.io.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"client.io.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Exception Class
|
3
|
-
* throw diy Exception
|
4
|
-
* https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Error
|
5
|
-
* 目前原生的错误类型
|
6
|
-
* Error [一般错误类型]
|
7
|
-
* SyntaxError [语法错误]
|
8
|
-
* ReferenceError [不存在的变量]
|
9
|
-
* RangeError [超出有效范围]
|
10
|
-
* TypeError [非预期类型]
|
11
|
-
* URIError [URI参数错误]
|
12
|
-
* EvalError [eval函数没有正确执行]
|
13
|
-
* example:: throw new Exception() catch(error) error.message,error.name,error.code,error.stack
|
14
|
-
* NewException extends Exception diy yourself Exception;
|
15
|
-
*/
|
16
|
-
export declare class Exception extends Error {
|
17
|
-
name: string;
|
18
|
-
message: string;
|
19
|
-
/**
|
20
|
-
* Error constructor
|
21
|
-
* @param {String} name 自定义错误名称
|
22
|
-
* @param {String|Number} message 自定义错误提示
|
23
|
-
*/
|
24
|
-
constructor(name?: string, message?: string);
|
25
|
-
}
|
package/framework/umd/index.d.ts
DELETED
package/framework/umd/types.d.ts
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
export declare type WebSocketUrl = `ws://${string}` | `wss://${string}`;
|
2
|
-
export declare type Heartbeat = (callback: HeartbeatCallback) => void;
|
3
|
-
export declare type HeartbeatCallback = (msg: string) => void;
|
4
|
-
export declare type ReceiveInterceptor = (event: MessageEvent<any>, send: (msg: SendMsg) => void) => any;
|
5
|
-
export declare type SendInterceptor = (event: any) => any;
|
6
|
-
export declare type WebSocketBucketCreate = {
|
7
|
-
url: WebSocketUrl;
|
8
|
-
name?: string;
|
9
|
-
heartbeat?: Heartbeat;
|
10
|
-
heartRate?: Millisecond;
|
11
|
-
restartTime?: Millisecond;
|
12
|
-
restartTimes?: number;
|
13
|
-
restartedTimes?: number;
|
14
|
-
receive?: ReceiveInterceptor;
|
15
|
-
send?: SendInterceptor;
|
16
|
-
};
|
17
|
-
export declare type WebSocketBucketOptions = {
|
18
|
-
name: string;
|
19
|
-
client: WebSocket;
|
20
|
-
url: WebSocketUrl;
|
21
|
-
heartbeat?: Heartbeat;
|
22
|
-
heartRate: Millisecond;
|
23
|
-
heartRateTimer: number;
|
24
|
-
restartTime: Millisecond;
|
25
|
-
restartTimes: number;
|
26
|
-
restartedTimes: number;
|
27
|
-
receive?: ReceiveInterceptor;
|
28
|
-
send?: SendInterceptor;
|
29
|
-
receiveMessageCallbacks: Map<string, (event: MessageEvent<any>) => void>;
|
30
|
-
[key: string]: unknown;
|
31
|
-
};
|
32
|
-
export declare type Millisecond = number;
|
33
|
-
export declare type SendMsg = string | ArrayBufferLike | Blob | ArrayBufferView;
|