sure-ui
Version:
A Component Library for Vue 3
3 lines (2 loc) • 15.7 kB
JavaScript
/*! Sure UI v0.0.0-dev.1 */(function(w,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(w=typeof globalThis<"u"?globalThis:w||self,L(w.SureUI={}))})(this,function(w){"use strict";const L=Symbol("INSTALLED_KEY"),xt="0.0.0-dev.1",ht=(t=[])=>({version:xt,install:n=>{n[L]||(n[L]=!0,t.forEach(s=>n.use(s)))}});function K(t){if(z(t)){const e={};for(let n=0;n<t.length;n++){const s=t[n],r=H(s)?Ut(s):K(s);if(r)for(const c in r)e[c]=r[c]}return e}else{if(H(t))return t;if(Z(t))return t}}const Bt=/;(?![^(]*\))/g,Pt=/:(.+)/;function Ut(t){const e={};return t.split(Bt).forEach(n=>{if(n){const s=n.split(Pt);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function J(t){let e="";if(H(t))e=t;else if(z(t))for(let n=0;n<t.length;n++){const s=J(t[n]);s&&(e+=s+" ")}else if(Z(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const Wt=[],Kt=()=>{},Jt=/^on[^a-z]/,Zt=t=>Jt.test(t),_t=Object.assign,z=Array.isArray,Y=t=>typeof t=="function",H=t=>typeof t=="string",Z=t=>t!==null&&typeof t=="object",Gt=(t,e)=>{if(t.install=n=>{for(const s of[t,...Object.values(e??{})])n.component(s.name,s)},e)for(const[n,s]of Object.entries(e))t[n]=s;return t},qt=t=>t,pt=t=>t===void 0||typeof t>"u",Qt=t=>typeof t=="string",Xt=t=>typeof t=="number",te=t=>pt(Element)?!1:t instanceof Element;window?.matchMedia("(prefers-color-scheme: dark)").matches,/Mac|iPhone|iPad|iPod/ig.test(navigator.userAgent);function ee(t,e="px"){if(!t)return"";if(Qt(t))return t;if(Xt(t))return`${t}${e}`}let ne;function se(t,e=ne){e&&e.active&&e.effects.push(t)}const ie=t=>{const e=new Set(t);return e.w=0,e.n=0,e},gt=t=>(t.w&F)>0,mt=t=>(t.n&F)>0,re=({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=F},oe=t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const r=e[s];gt(r)&&!mt(r)?r.delete(t):e[n++]=r,r.w&=~F,r.n&=~F}e.length=n}};let B=0,F=1;const rt=30;let C;class ue{constructor(e,n=null,s){this.fn=e,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,se(this,s)}run(){if(!this.active)return this.fn();let e=C,n=G;for(;e;){if(e===this)return;e=e.parent}try{return this.parent=C,C=this,G=!0,F=1<<++B,B<=rt?re(this):yt(this),this.fn()}finally{B<=rt&&oe(this),F=1<<--B,C=this.parent,G=n,this.parent=void 0,this.deferStop&&this.stop()}}stop(){C===this?this.deferStop=!0:this.active&&(yt(this),this.onStop&&this.onStop(),this.active=!1)}}function yt(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let G=!0;function ce(t,e){let n=!1;B<=rt?mt(t)||(t.n|=F,n=!gt(t)):n=!t.has(C),n&&(t.add(C),C.deps.push(t))}function le(t,e){const n=z(t)?t:[...t];for(const s of n)s.computed&&$t(s);for(const s of n)s.computed||$t(s)}function $t(t,e){(t!==C||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}function St(t){return vt(t)?St(t.__v_raw):!!(t&&t.__v_isReactive)}function vt(t){return!!(t&&t.__v_isReadonly)}function wt(t){return St(t)||vt(t)}function q(t){const e=t&&t.__v_raw;return e?q(e):t}function ae(t){G&&C&&(t=q(t),ce(t.dep||(t.dep=ie())))}function fe(t,e){t=q(t),t.dep&&le(t.dep)}function Mt(t){return!!(t&&t.__v_isRef===!0)}function Dt(t){return Mt(t)?t.value:t}class de{constructor(e,n,s,r){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new ue(e,()=>{this._dirty||(this._dirty=!0,fe(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=s}get value(){const e=q(this);return ae(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function he(t,e,n=!1){let s,r;const c=Y(t);return c?(s=t,r=Kt):(s=t.get,r=t.set),new de(s,r,c||!r,n)}let T=null,_e=null;const pe=t=>t.__isSuspense;function ge(t){return Y(t)?{setup:t,name:t.name}:t}const me=t=>!!t.type.__asyncLoader,ye=Symbol();function $e(t,e,n={},s,r){if(T.isCE||T.parent&&me(T.parent)&&T.parent.isCE)return ot("slot",e==="default"?null:{name:e},s&&s());let c=t[e];c&&c._c&&(c._d=!1),Et();const _=c&&kt(c(n)),h=De(Q,{key:n.key||`_${e}`},_||(s?s():[]),_&&t._===1?64:-2);return!r&&h.scopeId&&(h.slotScopeIds=[h.scopeId+"-s"]),c&&c._c&&(c._d=!0),h}function kt(t){return t.some(e=>Tt(e)?!(e.type===Ct||e.type===Q&&!kt(e.children)):!0)?t:null}const Se=t=>t.__isTeleport,Q=Symbol(void 0),ve=Symbol(void 0),Ct=Symbol(void 0),X=[];let k=null;function Et(t=!1){X.push(k=t?null:[])}function we(){X.pop(),k=X[X.length-1]||null}function It(t){return t.dynamicChildren=k||Wt,we(),k&&k.push(t),t}function Me(t,e,n,s,r,c){return It(Ft(t,e,n,s,r,c,!0))}function De(t,e,n,s,r){return It(ot(t,e,n,s,r,!0))}function Tt(t){return t?t.__v_isVNode===!0:!1}const Ot="__vInternal",bt=({key:t})=>t??null,tt=({ref:t,ref_key:e,ref_for:n})=>t!=null?H(t)||Mt(t)||Y(t)?{i:T,r:t,k:e,f:!!n}:t:null;function Ft(t,e=null,n=null,s=0,r=null,c=t===Q?0:1,_=!1,h=!1){const m={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&bt(e),ref:e&&tt(e),scopeId:_e,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:c,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null};return h?(ct(m,n),c&128&&t.normalize(m)):n&&(m.shapeFlag|=H(n)?8:16),!_&&k&&(m.patchFlag>0||c&6)&&m.patchFlag!==32&&k.push(m),m}const ot=ke;function ke(t,e=null,n=null,s=0,r=null,c=!1){if((!t||t===ye)&&(t=Ct),Tt(t)){const h=ut(t,e,!0);return n&&ct(h,n),!c&&k&&(h.shapeFlag&6?k[k.indexOf(t)]=h:k.push(h)),h.patchFlag|=-2,h}if(Oe(t)&&(t=t.__vccOpts),e){e=Ce(e);let{class:h,style:m}=e;h&&!H(h)&&(e.class=J(h)),Z(m)&&(wt(m)&&!z(m)&&(m=_t({},m)),e.style=K(m))}const _=H(t)?1:pe(t)?128:Se(t)?64:Z(t)?4:Y(t)?2:0;return Ft(t,e,n,s,r,_,c,!0)}function Ce(t){return t?wt(t)||Ot in t?_t({},t):t:null}function ut(t,e,n=!1){const{props:s,ref:r,patchFlag:c,children:_}=t,h=e?Ie(s||{},e):s;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:h,key:h&&bt(h),ref:e&&e.ref?n&&r?z(r)?r.concat(tt(e)):[r,tt(e)]:tt(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:_,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Q?c===-1?16:c|16:c,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&ut(t.ssContent),ssFallback:t.ssFallback&&ut(t.ssFallback),el:t.el,anchor:t.anchor}}function Ee(t=" ",e=0){return ot(ve,null,t,e)}function ct(t,e){let n=0;const{shapeFlag:s}=t;if(e==null)e=null;else if(z(e))n=16;else if(typeof e=="object")if(s&65){const r=e.default;r&&(r._c&&(r._d=!1),ct(t,r()),r._c&&(r._d=!0));return}else{n=32;const r=e._;!r&&!(Ot in e)?e._ctx=T:r===3&&T&&(T.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Y(e)?(e={default:e,_ctx:T},n=32):(e=String(e),s&64?(n=16,e=[Ee(e)]):n=8);t.children=e,t.shapeFlag|=n}function Ie(...t){const e={};for(let n=0;n<t.length;n++){const s=t[n];for(const r in s)if(r==="class")e.class!==s.class&&(e.class=J([e.class,s.class]));else if(r==="style")e.style=K([e.style,s.style]);else if(Zt(r)){const c=e[r],_=s[r];_&&c!==_&&!(z(c)&&c.includes(_))&&(e[r]=c?[].concat(c,_):_)}else r!==""&&(e[r]=s[r])}return e}let Te=!1;function Oe(t){return Y(t)&&"__vccOpts"in t}const be=(t,e)=>he(t,e,Te),Rt={size:{type:qt([Number,String])},color:{type:String},loading:{type:Boolean}};var Fe=ge({...{name:"SureIcon",inheritAttrs:!1},props:Rt,setup(t){const e=t,n=be(()=>!e.size&&!e.color?{}:{fontSize:pt(e.size)?void 0:ee(e.size),"--color":e.color}),s=e.loading?"sure-icon sure-icon-loading":"sure-icon";return(r,c)=>(Et(),Me("i",{class:J(Dt(s)),style:K(Dt(n))},[$e(r.$slots,"default")],6))}}),Re=(t,e)=>{const n=t.__vccOpts||t;for(const[s,r]of e)n[s]=r;return n},Ae=Re(Fe,[["__file","icon.vue"]]);const At=Gt(Ae);var Ne=[At],lt=ht([...Ne]),Nt;const Lt=typeof window<"u";Lt&&((Nt=window?.navigator)==null?void 0:Nt.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const R=new Map;let zt;Lt&&(document.addEventListener("mousedown",t=>zt=t),document.addEventListener("mouseup",t=>{for(const e of R.values())for(const{documentHandler:n}of e)n(t,zt)}));function Ht(t,e){let n=[];return Array.isArray(e.arg)?n=e.arg:te(e.arg)&&n.push(e.arg),function(s,r){const c=e.instance.popperRef,_=s.target,h=r?.target,m=!e||!e.instance,E=!_||!h,j=t.contains(_)||t.contains(h),D=t===_,et=n.length&&n.some(O=>O?.contains(_))||n.length&&n.includes(h),I=c&&(c.contains(_)||c.contains(h));m||E||j||D||et||I||e.value(s,r)}}const Le={beforeMount(t,e){R.has(t)||R.set(t,[]),R.get(t).push({documentHandler:Ht(t,e),bindingFn:e.value})},updated(t,e){R.has(t)||R.set(t,[]);const n=R.get(t),s=n.findIndex(c=>c.bindingFn===e.oldValue),r={documentHandler:Ht(t,e),bindingFn:e.value};s>=0?n.splice(s,1,r):n.push(r)},unmounted(t){R.delete(t)}},ze=t=>({focus:()=>{var e,n;(n=(e=t.value)==null?void 0:e.focus)==null||n.call(e)}});var He=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Vt={exports:{}};(function(t,e){(function(n,s){t.exports=s()})(He,function(){var n=1e3,s=6e4,r=36e5,c="millisecond",_="second",h="minute",m="hour",E="day",j="week",D="month",et="quarter",I="year",O="date",Yt="Invalid Date",xe=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Be=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Pe={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},at=function(d,u,i){var l=String(d);return!l||l.length>=u?d:""+Array(u+1-l.length).join(i)+d},Ue={s:at,z:function(d){var u=-d.utcOffset(),i=Math.abs(u),l=Math.floor(i/60),o=i%60;return(u<=0?"+":"-")+at(l,2,"0")+":"+at(o,2,"0")},m:function d(u,i){if(u.date()<i.date())return-d(i,u);var l=12*(i.year()-u.year())+(i.month()-u.month()),o=u.clone().add(l,D),f=i-o<0,a=u.clone().add(l+(f?-1:1),D);return+(-(l+(i-o)/(f?o-a:a-o))||0)},a:function(d){return d<0?Math.ceil(d)||0:Math.floor(d)},p:function(d){return{M:D,y:I,w:j,d:E,D:O,h:m,m:h,s:_,ms:c,Q:et}[d]||String(d||"").toLowerCase().replace(/s$/,"")},u:function(d){return d===void 0}},P="en",V={};V[P]=Pe;var ft=function(d){return d instanceof st},nt=function d(u,i,l){var o;if(!u)return P;if(typeof u=="string"){var f=u.toLowerCase();V[f]&&(o=f),i&&(V[f]=i,o=f);var a=u.split("-");if(!o&&a.length>1)return d(a[0])}else{var p=u.name;V[p]=u,o=p}return!l&&o&&(P=o),o||!l&&P},S=function(d,u){if(ft(d))return d.clone();var i=typeof u=="object"?u:{};return i.date=d,i.args=arguments,new st(i)},g=Ue;g.l=nt,g.i=ft,g.w=function(d,u){return S(d,{locale:u.$L,utc:u.$u,x:u.$x,$offset:u.$offset})};var st=function(){function d(i){this.$L=nt(i.locale,null,!0),this.parse(i)}var u=d.prototype;return u.parse=function(i){this.$d=function(l){var o=l.date,f=l.utc;if(o===null)return new Date(NaN);if(g.u(o))return new Date;if(o instanceof Date)return new Date(o);if(typeof o=="string"&&!/Z$/i.test(o)){var a=o.match(xe);if(a){var p=a[2]-1||0,$=(a[7]||"0").substring(0,3);return f?new Date(Date.UTC(a[1],p,a[3]||1,a[4]||0,a[5]||0,a[6]||0,$)):new Date(a[1],p,a[3]||1,a[4]||0,a[5]||0,a[6]||0,$)}}return new Date(o)}(i),this.$x=i.x||{},this.init()},u.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},u.$utils=function(){return g},u.isValid=function(){return this.$d.toString()!==Yt},u.isSame=function(i,l){var o=S(i);return this.startOf(l)<=o&&o<=this.endOf(l)},u.isAfter=function(i,l){return S(i)<this.startOf(l)},u.isBefore=function(i,l){return this.endOf(l)<S(i)},u.$g=function(i,l,o){return g.u(i)?this[l]:this.set(o,i)},u.unix=function(){return Math.floor(this.valueOf()/1e3)},u.valueOf=function(){return this.$d.getTime()},u.startOf=function(i,l){var o=this,f=!!g.u(l)||l,a=g.p(i),p=function(x,M){var N=g.w(o.$u?Date.UTC(o.$y,M,x):new Date(o.$y,M,x),o);return f?N:N.endOf(E)},$=function(x,M){return g.w(o.toDate()[x].apply(o.toDate("s"),(f?[0,0,0,0]:[23,59,59,999]).slice(M)),o)},y=this.$W,v=this.$M,A=this.$D,b="set"+(this.$u?"UTC":"");switch(a){case I:return f?p(1,0):p(31,11);case D:return f?p(1,v):p(0,v+1);case j:var U=this.$locale().weekStart||0,W=(y<U?y+7:y)-U;return p(f?A-W:A+(6-W),v);case E:case O:return $(b+"Hours",0);case m:return $(b+"Minutes",1);case h:return $(b+"Seconds",2);case _:return $(b+"Milliseconds",3);default:return this.clone()}},u.endOf=function(i){return this.startOf(i,!1)},u.$set=function(i,l){var o,f=g.p(i),a="set"+(this.$u?"UTC":""),p=(o={},o[E]=a+"Date",o[O]=a+"Date",o[D]=a+"Month",o[I]=a+"FullYear",o[m]=a+"Hours",o[h]=a+"Minutes",o[_]=a+"Seconds",o[c]=a+"Milliseconds",o)[f],$=f===E?this.$D+(l-this.$W):l;if(f===D||f===I){var y=this.clone().set(O,1);y.$d[p]($),y.init(),this.$d=y.set(O,Math.min(this.$D,y.daysInMonth())).$d}else p&&this.$d[p]($);return this.init(),this},u.set=function(i,l){return this.clone().$set(i,l)},u.get=function(i){return this[g.p(i)]()},u.add=function(i,l){var o,f=this;i=Number(i);var a=g.p(l),p=function(v){var A=S(f);return g.w(A.date(A.date()+Math.round(v*i)),f)};if(a===D)return this.set(D,this.$M+i);if(a===I)return this.set(I,this.$y+i);if(a===E)return p(1);if(a===j)return p(7);var $=(o={},o[h]=s,o[m]=r,o[_]=n,o)[a]||1,y=this.$d.getTime()+i*$;return g.w(y,this)},u.subtract=function(i,l){return this.add(-1*i,l)},u.format=function(i){var l=this,o=this.$locale();if(!this.isValid())return o.invalidDate||Yt;var f=i||"YYYY-MM-DDTHH:mm:ssZ",a=g.z(this),p=this.$H,$=this.$m,y=this.$M,v=o.weekdays,A=o.months,b=function(M,N,dt,it){return M&&(M[N]||M(l,f))||dt[N].slice(0,it)},U=function(M){return g.s(p%12||12,M,"0")},W=o.meridiem||function(M,N,dt){var it=M<12?"AM":"PM";return dt?it.toLowerCase():it},x={YY:String(this.$y).slice(-2),YYYY:this.$y,M:y+1,MM:g.s(y+1,2,"0"),MMM:b(o.monthsShort,y,A,3),MMMM:b(A,y),D:this.$D,DD:g.s(this.$D,2,"0"),d:String(this.$W),dd:b(o.weekdaysMin,this.$W,v,2),ddd:b(o.weekdaysShort,this.$W,v,3),dddd:v[this.$W],H:String(p),HH:g.s(p,2,"0"),h:U(1),hh:U(2),a:W(p,$,!0),A:W(p,$,!1),m:String($),mm:g.s($,2,"0"),s:String(this.$s),ss:g.s(this.$s,2,"0"),SSS:g.s(this.$ms,3,"0"),Z:a};return f.replace(Be,function(M,N){return N||x[M]||a.replace(":","")})},u.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},u.diff=function(i,l,o){var f,a=g.p(l),p=S(i),$=(p.utcOffset()-this.utcOffset())*s,y=this-p,v=g.m(this,p);return v=(f={},f[I]=v/12,f[D]=v,f[et]=v/3,f[j]=(y-$)/6048e5,f[E]=(y-$)/864e5,f[m]=y/r,f[h]=y/s,f[_]=y/n,f)[a]||y,o?v:g.a(v)},u.daysInMonth=function(){return this.endOf(D).$D},u.$locale=function(){return V[this.$L]},u.locale=function(i,l){if(!i)return this.$L;var o=this.clone(),f=nt(i,l,!0);return f&&(o.$L=f),o},u.clone=function(){return g.w(this.$d,this)},u.toDate=function(){return new Date(this.valueOf())},u.toJSON=function(){return this.isValid()?this.toISOString():null},u.toISOString=function(){return this.$d.toISOString()},u.toString=function(){return this.$d.toUTCString()},d}(),jt=st.prototype;return S.prototype=jt,[["$ms",c],["$s",_],["$m",h],["$H",m],["$W",E],["$M",D],["$y",I],["$D",O]].forEach(function(d){jt[d[1]]=function(u){return this.$g(u,d[0],d[1])}}),S.extend=function(d,u){return d.$i||(d(u,st,S),d.$i=!0),S},S.locale=nt,S.isDayjs=ft,S.unix=function(d){return S(1e3*d)},S.en=V[P],S.Ls=V,S.p={},S})})(Vt);var Ve=Vt.exports;const Ye=lt.install,je=lt.version;w.ClickOutside=Le,w.INSTALLED_KEY=L,w.SureIcon=At,w.dayjs=Ve,w.default=lt,w.iconProps=Rt,w.install=Ye,w.makeInstaller=ht,w.useFocus=ze,w.version=je,Object.defineProperty(w,"__esModule",{value:!0})});
//# sourceMappingURL=index.full.min.js.map