From 20a71c4f09b17da8ad47a7fef55442dda25ec837 Mon Sep 17 00:00:00 2001 From: Phuc H Date: Wed, 20 Mar 2024 09:23:38 +0700 Subject: [PATCH] feat(chore): run build and increase version, update readme --- README.md | 6 +- demo/dist/assets/index-4bf509f2.js | 27 +++ demo/dist/assets/index-4d71a3e1.js | 17 -- demo/dist/assets/index-9285e695.css | 1 - demo/dist/assets/index-fc8bc19e.css | 1 + demo/dist/index.html | 4 +- dist/main.es.js | 254 ++++++++++++++++++++++++---- dist/main.umd.js | 4 +- package.json | 2 +- 9 files changed, 263 insertions(+), 53 deletions(-) create mode 100644 demo/dist/assets/index-4bf509f2.js delete mode 100644 demo/dist/assets/index-4d71a3e1.js delete mode 100644 demo/dist/assets/index-9285e695.css create mode 100644 demo/dist/assets/index-fc8bc19e.css diff --git a/README.md b/README.md index d3daaa4..7261849 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ A Vue component that creates autocomplete functionality for your input fields, b ![Demo NextHint](https://res.cloudinary.com/veseylab/image/upload/v1708086865/nexthint/wuotjrvsld7xya72qhij.gif) + +### From version 1.0.4, NextHint support swipe to complete on mobile: +![Demo NextHint on mobile](https://res.cloudinary.com/veseylab/image/upload/v1710901223/nexthint/dsun6kcueojxubou7rbx.gif) + # Installation Currently, this package only works with Vue 3. @@ -34,6 +38,6 @@ The event @change will be trigger every time user enter something, you can handl # License ❤️ -This package is totally free to use. However, if you want to use Magicmouse.js in your commercial projects, I required you to do a good thing for the poor people in your place. You can do whatever you think it's "a good thing", like buy them some food, give them some money,..etc... +This package is totally free to use. However, if you want to use Magicmouse.js in your commercial projects, I require you to do a good thing for the poor people in your place. You can do whatever you think is "a good thing", like buy them some food, give them some money,..etc... I'm not requiring you to take a photo or do anything to prove it, just do it and you will feel great about yourself :) Let's make the world better place. \ No newline at end of file diff --git a/demo/dist/assets/index-4bf509f2.js b/demo/dist/assets/index-4bf509f2.js new file mode 100644 index 0000000..f13727e --- /dev/null +++ b/demo/dist/assets/index-4bf509f2.js @@ -0,0 +1,27 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&o(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();/** +* @vue/shared v3.4.19 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function Fe(e,t){const n=new Set(e.split(","));return t?o=>n.has(o.toLowerCase()):o=>n.has(o)}const U=Object.freeze({}),vt=Object.freeze([]),re=()=>{},Pr=()=>!1,Ut=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),un=e=>e.startsWith("onUpdate:"),z=Object.assign,po=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Us=Object.prototype.hasOwnProperty,L=(e,t)=>Us.call(e,t),P=Array.isArray,tt=e=>bn(e)==="[object Map]",Ir=e=>bn(e)==="[object Set]",I=e=>typeof e=="function",Y=e=>typeof e=="string",St=e=>typeof e=="symbol",B=e=>e!==null&&typeof e=="object",ho=e=>(B(e)||I(e))&&I(e.then)&&I(e.catch),Ar=Object.prototype.toString,bn=e=>Ar.call(e),mo=e=>bn(e).slice(8,-1),$r=e=>bn(e)==="[object Object]",go=e=>Y(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,$t=Fe(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Bs=Fe("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),_n=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Ks=/-(\w)/g,wt=_n(e=>e.replace(Ks,(t,n)=>n?n.toUpperCase():"")),Ws=/\B([A-Z])/g,We=_n(e=>e.replace(Ws,"-$1").toLowerCase()),yn=_n(e=>e.charAt(0).toUpperCase()+e.slice(1)),Ze=_n(e=>e?`on${yn(e)}`:""),Ge=(e,t)=>!Object.is(e,t),gt=(e,t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},Kn=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let Wo;const bo=()=>Wo||(Wo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function _o(e){if(P(e)){const t={};for(let n=0;n{if(n){const o=n.split(qs);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function yo(e){let t="";if(Y(e))t=e;else if(P(e))for(let n=0;nY(e)?e:e==null?"":P(e)||B(e)&&(e.toString===Ar||!I(e.toString))?JSON.stringify(e,Rr,2):String(e),Rr=(e,t)=>t&&t.__v_isRef?Rr(e,t.value):tt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],s)=>(n[jn(o,s)+" =>"]=r,n),{})}:Ir(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>jn(n))}:St(t)?jn(t):B(t)&&!P(t)&&!$r(t)?String(t):t,jn=(e,t="")=>{var n;return St(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/** +* @vue/reactivity v3.4.19 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function Ct(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let he;class ri{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=he,!t&&he&&(this.index=(he.scopes||(he.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const n=he;try{return he=this,t()}finally{he=n}}else Ct("cannot run an inactive effect scope.")}on(){he=this}off(){he=this.parent}stop(t){if(this._active){let n,o;for(n=0,o=this.effects.length;n=4))break}this._dirtyLevel===1&&(this._dirtyLevel=0),Ye()}return this._dirtyLevel>=4}set dirty(t){this._dirtyLevel=t?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=Ke,n=nt;try{return Ke=!0,nt=this,this._runnings++,qo(this),this.fn()}finally{zo(this),this._runnings--,nt=n,Ke=t}}stop(){var t;this.active&&(qo(this),zo(this),(t=this.onStop)==null||t.call(this),this.active=!1)}}function li(e){return e.value}function qo(e){e._trackId++,e._depsLength=0}function zo(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t{const n=new Map;return n.cleanup=e,n.computed=t,n},qn=new WeakMap,ot=Symbol("iterate"),zn=Symbol("Map key iterate");function ie(e,t,n){if(Ke&&nt){let o=qn.get(e);o||qn.set(e,o=new Map);let r=o.get(n);r||o.set(n,r=Vr(()=>o.delete(n))),Nr(nt,r,{target:e,type:t,key:n})}}function Pe(e,t,n,o,r,s){const i=qn.get(e);if(!i)return;let c=[];if(t==="clear")c=[...i.values()];else if(n==="length"&&P(e)){const u=Number(o);i.forEach((d,h)=>{(h==="length"||!St(h)&&h>=u)&&c.push(d)})}else switch(n!==void 0&&c.push(i.get(n)),t){case"add":P(e)?go(n)&&c.push(i.get("length")):(c.push(i.get(ot)),tt(e)&&c.push(i.get(zn)));break;case"delete":P(e)||(c.push(i.get(ot)),tt(e)&&c.push(i.get(zn)));break;case"set":tt(e)&&c.push(i.get(ot));break}xo();for(const u of c)u&&Hr(u,4,{target:e,type:t,key:n,newValue:o,oldValue:r,oldTarget:s});wo()}const ci=Fe("__proto__,__v_isRef,__isVue"),Dr=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(St)),Jo=ui();function ui(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const o=R(this);for(let s=0,i=this.length;s{e[t]=function(...n){Je(),xo();const o=R(this)[t].apply(this,n);return wo(),Ye(),o}}),e}function fi(e){const t=R(this);return ie(t,"has",e),t.hasOwnProperty(e)}class kr{constructor(t=!1,n=!1){this._isReadonly=t,this._shallow=n}get(t,n,o){const r=this._isReadonly,s=this._shallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return s;if(n==="__v_raw")return o===(r?s?zr:qr:s?Gr:Wr).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const i=P(t);if(!r){if(i&&L(Jo,n))return Reflect.get(Jo,n,o);if(n==="hasOwnProperty")return fi}const c=Reflect.get(t,n,o);return(St(n)?Dr.has(n):ci(n))||(r||ie(t,"get",n),s)?c:te(c)?i&&go(n)?c:c.value:B(c)?r?Jr(c):jt(c):c}}class Ur extends kr{constructor(t=!1){super(!1,t)}set(t,n,o,r){let s=t[n];if(!this._shallow){const u=qe(s);if(!st(o)&&!qe(o)&&(s=R(s),o=R(o)),!P(t)&&te(s)&&!te(o))return u?!1:(s.value=o,!0)}const i=P(t)&&go(n)?Number(n)e,vn=e=>Reflect.getPrototypeOf(e);function Jt(e,t,n=!1,o=!1){e=e.__v_raw;const r=R(e),s=R(t);n||(Ge(t,s)&&ie(r,"get",t),ie(r,"get",s));const{has:i}=vn(r),c=o?Co:n?So:Nt;if(i.call(r,t))return c(e.get(t));if(i.call(r,s))return c(e.get(s));e!==r&&e.get(t)}function Yt(e,t=!1){const n=this.__v_raw,o=R(n),r=R(e);return t||(Ge(e,r)&&ie(o,"has",e),ie(o,"has",r)),e===r?n.has(e):n.has(e)||n.has(r)}function Xt(e,t=!1){return e=e.__v_raw,!t&&ie(R(e),"iterate",ot),Reflect.get(e,"size",e)}function Yo(e){e=R(e);const t=R(this);return vn(t).has.call(t,e)||(t.add(e),Pe(t,"add",e,e)),this}function Xo(e,t){t=R(t);const n=R(this),{has:o,get:r}=vn(n);let s=o.call(n,e);s?Kr(n,o,e):(e=R(e),s=o.call(n,e));const i=r.call(n,e);return n.set(e,t),s?Ge(t,i)&&Pe(n,"set",e,t,i):Pe(n,"add",e,t),this}function Qo(e){const t=R(this),{has:n,get:o}=vn(t);let r=n.call(t,e);r?Kr(t,n,e):(e=R(e),r=n.call(t,e));const s=o?o.call(t,e):void 0,i=t.delete(e);return r&&Pe(t,"delete",e,void 0,s),i}function Zo(){const e=R(this),t=e.size!==0,n=tt(e)?new Map(e):new Set(e),o=e.clear();return t&&Pe(e,"clear",void 0,void 0,n),o}function Qt(e,t){return function(o,r){const s=this,i=s.__v_raw,c=R(i),u=t?Co:e?So:Nt;return!e&&ie(c,"iterate",ot),i.forEach((d,h)=>o.call(r,u(d),u(h),s))}}function Zt(e,t,n){return function(...o){const r=this.__v_raw,s=R(r),i=tt(s),c=e==="entries"||e===Symbol.iterator&&i,u=e==="keys"&&i,d=r[e](...o),h=n?Co:t?So:Nt;return!t&&ie(s,"iterate",u?zn:ot),{next(){const{value:a,done:b}=d.next();return b?{value:a,done:b}:{value:c?[h(a[0]),h(a[1])]:h(a),done:b}},[Symbol.iterator](){return this}}}}function He(e){return function(...t){{const n=t[0]?`on key "${t[0]}" `:"";console.warn(`${yn(e)} operation ${n}failed: target is readonly.`,R(this))}return e==="delete"?!1:e==="clear"?void 0:this}}function mi(){const e={get(s){return Jt(this,s)},get size(){return Xt(this)},has:Yt,add:Yo,set:Xo,delete:Qo,clear:Zo,forEach:Qt(!1,!1)},t={get(s){return Jt(this,s,!1,!0)},get size(){return Xt(this)},has:Yt,add:Yo,set:Xo,delete:Qo,clear:Zo,forEach:Qt(!1,!0)},n={get(s){return Jt(this,s,!0)},get size(){return Xt(this,!0)},has(s){return Yt.call(this,s,!0)},add:He("add"),set:He("set"),delete:He("delete"),clear:He("clear"),forEach:Qt(!0,!1)},o={get(s){return Jt(this,s,!0,!0)},get size(){return Xt(this,!0)},has(s){return Yt.call(this,s,!0)},add:He("add"),set:He("set"),delete:He("delete"),clear:He("clear"),forEach:Qt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{e[s]=Zt(s,!1,!1),n[s]=Zt(s,!0,!1),t[s]=Zt(s,!1,!0),o[s]=Zt(s,!0,!0)}),[e,n,t,o]}const[gi,bi,_i,yi]=mi();function xn(e,t){const n=t?e?yi:_i:e?bi:gi;return(o,r,s)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(L(n,r)&&r in o?n:o,r,s)}const vi={get:xn(!1,!1)},xi={get:xn(!1,!0)},wi={get:xn(!0,!1)},Ci={get:xn(!0,!0)};function Kr(e,t,n){const o=R(n);if(o!==n&&t.call(e,o)){const r=mo(e);console.warn(`Reactive ${r} contains both the raw and reactive versions of the same object${r==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Wr=new WeakMap,Gr=new WeakMap,qr=new WeakMap,zr=new WeakMap;function Si(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ei(e){return e.__v_skip||!Object.isExtensible(e)?0:Si(mo(e))}function jt(e){return qe(e)?e:wn(e,!1,ai,vi,Wr)}function Oi(e){return wn(e,!1,pi,xi,Gr)}function Jr(e){return wn(e,!0,di,wi,qr)}function yt(e){return wn(e,!0,hi,Ci,zr)}function wn(e,t,n,o,r){if(!B(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;const s=r.get(e);if(s)return s;const i=Ei(e);if(i===0)return e;const c=new Proxy(e,i===2?o:n);return r.set(e,c),c}function rt(e){return qe(e)?rt(e.__v_raw):!!(e&&e.__v_isReactive)}function qe(e){return!!(e&&e.__v_isReadonly)}function st(e){return!!(e&&e.__v_isShallow)}function Jn(e){return rt(e)||qe(e)}function R(e){const t=e&&e.__v_raw;return t?R(t):e}function Yr(e){return Object.isExtensible(e)&&fn(e,"__v_skip",!0),e}const Nt=e=>B(e)?jt(e):e,So=e=>B(e)?Jr(e):e,Ti="Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free";class Xr{constructor(t,n,o,r){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new vo(()=>t(this._value),()=>tn(this,this.effect._dirtyLevel===2?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=o}get value(){const t=R(this);return(!t._cacheable||t.effect.dirty)&&Ge(t._value,t._value=t.effect.run())&&tn(t,4),Qr(t),t.effect._dirtyLevel>=2&&(Ct(Ti),tn(t,2)),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function Pi(e,t,n=!1){let o,r;const s=I(e);s?(o=e,r=()=>{Ct("Write operation failed: computed value is readonly")}):(o=e.get,r=e.set);const i=new Xr(o,r,s||!r,n);return t&&!n&&(i.effect.onTrack=t.onTrack,i.effect.onTrigger=t.onTrigger),i}function Qr(e){var t;Ke&&nt&&(e=R(e),Nr(nt,(t=e.dep)!=null?t:e.dep=Vr(()=>e.dep=void 0,e instanceof Xr?e:void 0),{target:e,type:"get",key:"value"}))}function tn(e,t=4,n){e=R(e);const o=e.dep;o&&Hr(o,t,{target:e,type:"set",key:"value",newValue:n})}function te(e){return!!(e&&e.__v_isRef===!0)}function at(e){return Ii(e,!1)}function Ii(e,t){return te(e)?e:new Ai(e,t)}class Ai{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:R(t),this._value=n?t:Nt(t)}get value(){return Qr(this),this._value}set value(t){const n=this.__v_isShallow||st(t)||qe(t);t=n?t:R(t),Ge(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:Nt(t),tn(this,4,t))}}function Eo(e){return te(e)?e.value:e}const $i={get:(e,t,n)=>Eo(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return te(r)&&!te(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function Zr(e){return rt(e)?e:new Proxy(e,$i)}/** +* @vue/runtime-core v3.4.19 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/const it=[];function nn(e){it.push(e)}function on(){it.pop()}function w(e,...t){Je();const n=it.length?it[it.length-1].component:null,o=n&&n.appContext.config.warnHandler,r=Mi();if(o)Re(o,n,11,[e+t.join(""),n&&n.proxy,r.map(({vnode:s})=>`at <${In(n,s.type)}>`).join(` +`),r]);else{const s=[`[Vue warn]: ${e}`,...t];r.length&&s.push(` +`,...Ri(r)),console.warn(...s)}Ye()}function Mi(){let e=it[it.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const o=e.component&&e.component.parent;e=o&&o.vnode}return t}function Ri(e){const t=[];return e.forEach((n,o)=>{t.push(...o===0?[]:[` +`],...Fi(n))}),t}function Fi({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",o=e.component?e.component.parent==null:!1,r=` at <${In(e.component,e.type,o)}`,s=">"+n;return e.props?[r,...Li(e.props),s]:[r+s]}function Li(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(o=>{t.push(...es(o,e[o]))}),n.length>3&&t.push(" ..."),t}function es(e,t,n){return Y(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:te(t)?(t=es(e,R(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):I(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=R(t),n?t:[`${e}=`,t])}const Oo={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."};function Re(e,t,n,o){try{return o?e(...o):e()}catch(r){Bt(r,t,n)}}function xe(e,t,n,o){if(I(e)){const s=Re(e,t,n,o);return s&&ho(s)&&s.catch(i=>{Bt(i,t,n)}),s}const r=[];for(let s=0;s>>1,r=oe[o],s=Vt(r);sOe&&oe.splice(t,1)}function rs(e){P(e)?xt.push(...e):(!Me||!Me.includes(e,e.allowRecurse?Ve+1:Ve))&&xt.push(e),os()}function er(e,t,n=Ht?Oe+1:0){for(t=t||new Map;nVt(n)-Vt(o));if(xt.length=0,Me){Me.push(...t);return}for(Me=t,e=e||new Map,Ve=0;Vee.id==null?1/0:e.id,Di=(e,t)=>{const n=Vt(e)-Vt(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function is(e){Yn=!1,Ht=!0,e=e||new Map,oe.sort(Di);const t=n=>Po(e,n);try{for(Oe=0;OeNi){const o=t.ownerInstance,r=o&&js(o.type);return Bt(`Maximum recursive updates exceeded${r?` in component <${r}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}else e.set(t,n+1)}}let lt=!1;const bt=new Set;bo().__VUE_HMR_RUNTIME__={createRecord:Nn(ls),rerender:Nn(Bi),reload:Nn(Ki)};const dt=new Map;function ki(e){const t=e.type.__hmrId;let n=dt.get(t);n||(ls(t,e.type),n=dt.get(t)),n.instances.add(e)}function Ui(e){dt.get(e.type.__hmrId).instances.delete(e)}function ls(e,t){return dt.has(e)?!1:(dt.set(e,{initialDef:Mt(t),instances:new Set}),!0)}function Mt(e){return Ns(e)?e.__vccOpts:e}function Bi(e,t){const n=dt.get(e);n&&(n.initialDef.render=t,[...n.instances].forEach(o=>{t&&(o.render=t,Mt(o.type).render=t),o.renderCache=[],lt=!0,o.effect.dirty=!0,o.update(),lt=!1}))}function Ki(e,t){const n=dt.get(e);if(!n)return;t=Mt(t),tr(n.initialDef,t);const o=[...n.instances];for(const r of o){const s=Mt(r.type);bt.has(s)||(s!==n.initialDef&&tr(s,t),bt.add(s)),r.appContext.propsCache.delete(r.type),r.appContext.emitsCache.delete(r.type),r.appContext.optionsCache.delete(r.type),r.ceReload?(bt.add(s),r.ceReload(t.styles),bt.delete(s)):r.parent?(r.parent.effect.dirty=!0,Cn(r.parent.update)):r.appContext.reload?r.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required.")}rs(()=>{for(const r of o)bt.delete(Mt(r.type))})}function tr(e,t){z(e,t);for(const n in e)n!=="__file"&&!(n in t)&&delete e[n]}function Nn(e){return(t,n)=>{try{return e(t,n)}catch(o){console.error(o),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let Te,It=[],Xn=!1;function Kt(e,...t){Te?Te.emit(e,...t):Xn||It.push({event:e,args:t})}function cs(e,t){var n,o;Te=e,Te?(Te.enabled=!0,It.forEach(({event:r,args:s})=>Te.emit(r,...s)),It=[]):typeof window<"u"&&window.HTMLElement&&!((o=(n=window.navigator)==null?void 0:n.userAgent)!=null&&o.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(s=>{cs(s,t)}),setTimeout(()=>{Te||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Xn=!0,It=[])},3e3)):(Xn=!0,It=[])}function Wi(e,t){Kt("app:init",e,t,{Fragment:_e,Text:Wt,Comment:me,Static:Ft})}function Gi(e){Kt("app:unmount",e)}const qi=Io("component:added"),us=Io("component:updated"),zi=Io("component:removed"),Ji=e=>{Te&&typeof Te.cleanupBuffer=="function"&&!Te.cleanupBuffer(e)&&zi(e)};function Io(e){return t=>{Kt(e,t.appContext.app,t.uid,t.parent?t.parent.uid:void 0,t)}}const Yi=fs("perf:start"),Xi=fs("perf:end");function fs(e){return(t,n,o)=>{Kt(e,t.appContext.app,t.uid,t,n,o)}}function Qi(e,t,n){Kt("component:emit",e.appContext.app,e,t,n)}function Zi(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||U;{const{emitsOptions:h,propsOptions:[a]}=e;if(h)if(!(t in h))(!a||!(Ze(t)in a))&&w(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${Ze(t)}" prop.`);else{const b=h[t];I(b)&&(b(...n)||w(`Invalid event arguments: event validation failed for event "${t}".`))}}let r=n;const s=t.startsWith("update:"),i=s&&t.slice(7);if(i&&i in o){const h=`${i==="modelValue"?"model":i}Modifiers`,{number:a,trim:b}=o[h]||U;b&&(r=n.map(E=>Y(E)?E.trim():E)),a&&(r=n.map(Kn))}Qi(e,t,r);{const h=t.toLowerCase();h!==t&&o[Ze(h)]&&w(`Event "${h}" is emitted in component ${In(e,e.type)} but the handler is registered for "${t}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${We(t)}" instead of "${t}".`)}let c,u=o[c=Ze(t)]||o[c=Ze(wt(t))];!u&&s&&(u=o[c=Ze(We(t))]),u&&xe(u,e,6,r);const d=o[c+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[c])return;e.emitted[c]=!0,xe(d,e,6,r)}}function as(e,t,n=!1){const o=t.emitsCache,r=o.get(e);if(r!==void 0)return r;const s=e.emits;let i={},c=!1;if(!I(e)){const u=d=>{const h=as(d,t,!0);h&&(c=!0,z(i,h))};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}return!s&&!c?(B(e)&&o.set(e,null),null):(P(s)?s.forEach(u=>i[u]=null):z(i,s),B(e)&&o.set(e,i),i)}function Sn(e,t){return!e||!Ut(t)?!1:(t=t.slice(2).replace(/Once$/,""),L(e,t[0].toLowerCase()+t.slice(1))||L(e,We(t))||L(e,t))}let se=null,ds=null;function an(e){const t=se;return se=e,ds=e&&e.type.__scopeId||null,t}function el(e,t=se,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&pr(-1);const s=an(t);let i;try{i=e(...r)}finally{an(s),o._d&&pr(1)}return us(t),i};return o._n=!0,o._c=!0,o._d=!0,o}let Qn=!1;function dn(){Qn=!0}function Hn(e){const{type:t,vnode:n,proxy:o,withProxy:r,props:s,propsOptions:[i],slots:c,attrs:u,emit:d,render:h,renderCache:a,data:b,setupState:E,ctx:M,inheritAttrs:$}=e;let X,q;const le=an(e);Qn=!1;try{if(n.shapeFlag&4){const W=r||o,de=E.__isScriptSetup?new Proxy(W,{get(F,ne,N){return w(`Property '${String(ne)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(F,ne,N)}}):W;X=ye(h.call(de,W,a,s,E,b,M)),q=u}else{const W=t;u===s&&dn(),X=ye(W.length>1?W(s,{get attrs(){return dn(),u},slots:c,emit:d}):W(s,null)),q=t.props?u:tl(u)}}catch(W){Lt.length=0,Bt(W,e,1),X=we(me)}let K=X,D;if(X.patchFlag>0&&X.patchFlag&2048&&([K,D]=ps(X)),q&&$!==!1){const W=Object.keys(q),{shapeFlag:de}=K;if(W.length){if(de&7)i&&W.some(un)&&(q=nl(q,i)),K=ze(K,q);else if(!Qn&&K.type!==me){const F=Object.keys(u),ne=[],N=[];for(let Q=0,pe=F.length;Q renders non-element root node that cannot be animated."),K.transition=n.transition),D?D(K):X=K,an(le),X}const ps=e=>{const t=e.children,n=e.dynamicChildren,o=Ao(t,!1);if(o){if(o.patchFlag>0&&o.patchFlag&2048)return ps(o)}else return[e,void 0];const r=t.indexOf(o),s=n?n.indexOf(o):-1,i=c=>{t[r]=c,n&&(s>-1?n[s]=c:c.patchFlag>0&&(e.dynamicChildren=[...n,c]))};return[ye(o),i]};function Ao(e,t=!0){let n;for(let o=0;o0&&n.patchFlag&2048)return Ao(n.children)}}else return}return n}const tl=e=>{let t;for(const n in e)(n==="class"||n==="style"||Ut(n))&&((t||(t={}))[n]=e[n]);return t},nl=(e,t)=>{const n={};for(const o in e)(!un(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n},nr=e=>e.shapeFlag&7||e.type===me;function ol(e,t,n){const{props:o,children:r,component:s}=e,{props:i,children:c,patchFlag:u}=t,d=s.emitsOptions;if((r||c)&<||t.dirs||t.transition)return!0;if(n&&u>=0){if(u&1024)return!0;if(u&16)return o?or(o,i,d):!!i;if(u&8){const h=t.dynamicProps;for(let a=0;ae.__isSuspense;function ll(e,t){t&&t.pendingBranch?P(e)?t.effects.push(...e):t.effects.push(e):rs(e)}const cl=Symbol.for("v-scx"),ul=()=>{{const e=sn(cl);return e||w("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),e}};function fl(e,t){return $o(e,null,t)}const en={};function ct(e,t,n){return I(t)||w("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),$o(e,t,n)}function $o(e,t,{immediate:n,deep:o,flush:r,once:s,onTrack:i,onTrigger:c}=U){if(t&&s){const F=t;t=(...ne)=>{F(...ne),de()}}o!==void 0&&typeof o=="number"&&w('watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.'),t||(n!==void 0&&w('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),o!==void 0&&w('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),s!==void 0&&w('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const u=F=>{w("Invalid watch source: ",F,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},d=ee,h=F=>o===!0?F:et(F,o===!1?1:void 0);let a,b=!1,E=!1;if(te(e)?(a=()=>e.value,b=st(e)):rt(e)?(a=()=>h(e),b=!0):P(e)?(E=!0,b=e.some(F=>rt(F)||st(F)),a=()=>e.map(F=>{if(te(F))return F.value;if(rt(F))return h(F);if(I(F))return Re(F,d,2);u(F)})):I(e)?t?a=()=>Re(e,d,2):a=()=>(M&&M(),xe(e,d,3,[$])):(a=re,u(e)),t&&o){const F=a;a=()=>et(F())}let M,$=F=>{M=D.onStop=()=>{Re(F,d,4),M=D.onStop=void 0}},X;if(Tn)if($=re,t?n&&xe(t,d,3,[a(),E?[]:void 0,$]):a(),r==="sync"){const F=ul();X=F.__watcherHandles||(F.__watcherHandles=[])}else return re;let q=E?new Array(e.length).fill(en):en;const le=()=>{if(!(!D.active||!D.dirty))if(t){const F=D.run();(o||b||(E?F.some((ne,N)=>Ge(ne,q[N])):Ge(F,q)))&&(M&&M(),xe(t,d,3,[F,q===en?void 0:E&&q[0]===en?[]:q,$]),q=F)}else D.run()};le.allowRecurse=!!t;let K;r==="sync"?K=le:r==="post"?K=()=>ae(le,d&&d.suspense):(le.pre=!0,d&&(le.id=d.uid),K=()=>Cn(le));const D=new vo(a,re,K),W=Fr(),de=()=>{D.stop(),W&&po(W.effects,D)};return D.onTrack=i,D.onTrigger=c,t?n?le():q=D.run():r==="post"?ae(D.run.bind(D),d&&d.suspense):D.run(),X&&X.push(de),de}function al(e,t,n){const o=this.proxy,r=Y(e)?e.includes(".")?hs(o,e):()=>o[e]:e.bind(o,o);let s;I(t)?s=t:(s=t.handler,n=t);const i=Gt(this),c=$o(r,s.bind(o),n);return i(),c}function hs(e,t){const n=t.split(".");return()=>{let o=e;for(let r=0;r0){if(n>=t)return e;n++}if(o=o||new Set,o.has(e))return e;if(o.add(e),te(e))et(e.value,t,n,o);else if(P(e))for(let r=0;r{et(r,t,n,o)});else if($r(e))for(const r in e)et(e[r],t,n,o);return e}function ms(e){Bs(e)&&w("Do not use built-in directive ids as custom directive id: "+e)}function dl(e,t){if(se===null)return w("withDirectives can only be used inside render functions."),e;const n=Pn(se)||se.proxy,o=e.dirs||(e.dirs=[]);for(let r=0;rz({name:e.name},t,{setup:e}))():e}const rn=e=>!!e.type.__asyncLoader,Mo=e=>e.type.__isKeepAlive;function pl(e,t){bs(e,"a",t)}function hl(e,t){bs(e,"da",t)}function bs(e,t,n=ee){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(En(t,o,n),n){let r=n.parent;for(;r&&r.parent;)Mo(r.parent.vnode)&&ml(o,t,n,r),r=r.parent}}function ml(e,t,n,o){const r=En(t,e,o,!0);_s(()=>{po(o[t],r)},n)}function En(e,t,n=ee,o=!1){if(n){const r=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;Je();const c=Gt(n),u=xe(t,n,e,i);return c(),Ye(),u});return o?r.unshift(s):r.push(s),s}else{const r=Ze(Oo[e].replace(/ hook$/,""));w(`${r} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const Le=e=>(t,n=ee)=>(!Tn||e==="sp")&&En(e,(...o)=>t(...o),n),gl=Le("bm"),Ro=Le("m"),bl=Le("bu"),_l=Le("u"),yl=Le("bum"),_s=Le("um"),vl=Le("sp"),xl=Le("rtg"),wl=Le("rtc");function Cl(e,t=ee){En("ec",e,t)}const Zn=e=>e?Rs(e)?Pn(e)||e.proxy:Zn(e.parent):null,ut=z(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>yt(e.props),$attrs:e=>yt(e.attrs),$slots:e=>yt(e.slots),$refs:e=>yt(e.refs),$parent:e=>Zn(e.parent),$root:e=>Zn(e.root),$emit:e=>e.emit,$options:e=>Lo(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,Cn(e.update)}),$nextTick:e=>e.n||(e.n=ns.bind(e.proxy)),$watch:e=>al.bind(e)}),Fo=e=>e==="_"||e==="$",Vn=(e,t)=>e!==U&&!e.__isScriptSetup&&L(e,t),ys={get({_:e},t){const{ctx:n,setupState:o,data:r,props:s,accessCache:i,type:c,appContext:u}=e;if(t==="__isVue")return!0;let d;if(t[0]!=="$"){const E=i[t];if(E!==void 0)switch(E){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return s[t]}else{if(Vn(o,t))return i[t]=1,o[t];if(r!==U&&L(r,t))return i[t]=2,r[t];if((d=e.propsOptions[0])&&L(d,t))return i[t]=3,s[t];if(n!==U&&L(n,t))return i[t]=4,n[t];eo&&(i[t]=0)}}const h=ut[t];let a,b;if(h)return t==="$attrs"?(ie(e,"get",t),dn()):t==="$slots"&&ie(e,"get",t),h(e);if((a=c.__cssModules)&&(a=a[t]))return a;if(n!==U&&L(n,t))return i[t]=4,n[t];if(b=u.config.globalProperties,L(b,t))return b[t];se&&(!Y(t)||t.indexOf("__v")!==0)&&(r!==U&&Fo(t[0])&&L(r,t)?w(`Property ${JSON.stringify(t)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):e===se&&w(`Property ${JSON.stringify(t)} was accessed during render but is not defined on instance.`))},set({_:e},t,n){const{data:o,setupState:r,ctx:s}=e;return Vn(r,t)?(r[t]=n,!0):r.__isScriptSetup&&L(r,t)?(w(`Cannot mutate - + + diff --git a/dist/main.es.js b/dist/main.es.js index 251138b..2c2bfde 100644 --- a/dist/main.es.js +++ b/dist/main.es.js @@ -1,38 +1,234 @@ -(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".vue-tab-complete-wrapper{position:relative}.vue-tab-complete-wrapper input{z-index:10;padding:.5rem;padding-left:14px;width:100%;height:100%;color:#fff;border-color:#ced7d0;caret-color:#63666c}.vue-tab-complete-wrapper .input-overlay{position:absolute;left:.75rem;top:50%;transform:translateY(-50%)}.vue-tab-complete-wrapper .input-overlay .result-query{padding-top:.25rem;padding-bottom:.25rem;margin-left:.125rem;color:#000}.vue-tab-complete-wrapper .input-overlay .result-suggest{color:#9ca3af}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); -import { defineComponent as _, ref as m, computed as a, watch as f, openBlock as h, createElementBlock as g, withDirectives as y, createElementVNode as n, vModelText as x, toDisplayString as u } from "vue"; -const R = { class: "vue-tab-complete-wrapper" }, w = ["placeholder"], b = { class: "input-overlay" }, D = { class: "result-query" }, N = { class: "result-suggest" }, C = /* @__PURE__ */ _({ +(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".vue-tab-complete-wrapper{position:relative}.vue-tab-complete-wrapper input{z-index:10;padding:.5rem;padding-left:14px;width:100%;height:100%;color:#fff;border-color:#ced7d0;caret-color:#63666c}.vue-tab-complete-wrapper .input-overlay{position:absolute;left:.75rem;top:50%;transform:translateY(-50%)}.vue-tab-complete-wrapper .input-overlay .result-query{padding-top:.25rem;padding-bottom:.25rem;margin-left:.125rem;color:#000}.vue-tab-complete-wrapper .input-overlay .result-suggest{color:#9ca3af}.vue-tab-complete-wrapper .input-overlay .result-suggest .swiper{position:relative;margin-left:.8rem;font-size:.8rem;color:#cfd0d1}.vue-tab-complete-wrapper .input-overlay .result-suggest .swiper svg{position:absolute;top:-2px;right:-60%;width:18px;height:18px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); +import { onMounted as D, nextTick as Q, getCurrentScope as X, onScopeDispose as z, unref as V, getCurrentInstance as j, reactive as W, computed as y, ref as g, watch as b, watchEffect as F, defineComponent as G, openBlock as O, createElementBlock as R, withDirectives as K, createElementVNode as _, vModelText as U, toDisplayString as H, createTextVNode as A, createCommentVNode as $ } from "vue"; +function B(e) { + return X() ? (z(e), !0) : !1; +} +function C(e) { + return typeof e == "function" ? e() : V(e); +} +const J = typeof window < "u" && typeof document < "u"; +typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope; +const Z = Object.prototype.toString, ee = (e) => Z.call(e) === "[object Object]", M = () => { +}; +function te(e) { + return e || j(); +} +function ne(e, t = !0, n) { + te() ? D(e, n) : t ? e() : Q(e); +} +function oe(e) { + var t; + const n = C(e); + return (t = n == null ? void 0 : n.$el) != null ? t : n; +} +const k = J ? window : void 0; +function S(...e) { + let t, n, c, o; + if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, c, o] = e, t = k) : [t, n, c, o] = e, !t) + return M; + Array.isArray(n) || (n = [n]), Array.isArray(c) || (c = [c]); + const d = [], l = () => { + d.forEach((p) => p()), d.length = 0; + }, s = (p, i, f, v) => (p.addEventListener(i, f, v), () => p.removeEventListener(i, f, v)), r = b( + () => [oe(t), C(o)], + ([p, i]) => { + if (l(), !p) + return; + const f = ee(i) ? { ...i } : i; + d.push( + ...n.flatMap((v) => c.map((x) => s(p, v, x, f))) + ); + }, + { immediate: !0, flush: "post" } + ), a = () => { + r(), l(); + }; + return B(a), a; +} +function se() { + const e = g(!1), t = j(); + return t && D(() => { + e.value = !0; + }, t), e; +} +function re(e) { + const t = se(); + return y(() => (t.value, !!e())); +} +function ie(e, t = {}) { + const { window: n = k } = t, c = re(() => n && "matchMedia" in n && typeof n.matchMedia == "function"); + let o; + const d = g(!1), l = (a) => { + d.value = a.matches; + }, s = () => { + o && ("removeEventListener" in o ? o.removeEventListener("change", l) : o.removeListener(l)); + }, r = F(() => { + c.value && (s(), o = n.matchMedia(C(e)), "addEventListener" in o ? o.addEventListener("change", l) : o.addListener(l), d.value = o.matches); + }); + return B(() => { + r(), s(), o = void 0; + }), d; +} +function ue(e, t = {}) { + const { + threshold: n = 50, + onSwipe: c, + onSwipeEnd: o, + onSwipeStart: d, + passive: l = !0, + window: s = k + } = t, r = W({ x: 0, y: 0 }), a = W({ x: 0, y: 0 }), p = y(() => r.x - a.x), i = y(() => r.y - a.y), { max: f, abs: v } = Math, x = y(() => f(v(p.value), v(i.value)) >= n), w = g(!1), N = y(() => x.value ? v(p.value) > v(i.value) ? p.value > 0 ? "left" : "right" : i.value > 0 ? "up" : "down" : "none"), T = (u) => [u.touches[0].clientX, u.touches[0].clientY], P = (u, h) => { + r.x = u, r.y = h; + }, I = (u, h) => { + a.x = u, a.y = h; + }; + let m; + const L = ce(s == null ? void 0 : s.document); + l ? m = L ? { passive: !0 } : { capture: !1 } : m = L ? { passive: !1, capture: !0 } : { capture: !0 }; + const Y = (u) => { + w.value && (o == null || o(u, N.value)), w.value = !1; + }, q = [ + S(e, "touchstart", (u) => { + if (u.touches.length !== 1) + return; + m.capture && !m.passive && u.preventDefault(); + const [h, E] = T(u); + P(h, E), I(h, E), d == null || d(u); + }, m), + S(e, "touchmove", (u) => { + if (u.touches.length !== 1) + return; + const [h, E] = T(u); + I(h, E), !w.value && x.value && (w.value = !0), w.value && (c == null || c(u)); + }, m), + S(e, ["touchend", "touchcancel"], Y, m) + ]; + return { + isPassiveEventSupported: L, + isSwiping: w, + direction: N, + coordsStart: r, + coordsEnd: a, + lengthX: p, + lengthY: i, + stop: () => q.forEach((u) => u()) + }; +} +function ce(e) { + if (!e) + return !1; + let t = !1; + const n = { + get passive() { + return t = !0, !1; + } + }; + return e.addEventListener("x", M, n), e.removeEventListener("x", M), t; +} +function le(e = {}) { + const { + window: t = k, + initialWidth: n = Number.POSITIVE_INFINITY, + initialHeight: c = Number.POSITIVE_INFINITY, + listenOrientation: o = !0, + includeScrollbar: d = !0 + } = e, l = g(n), s = g(c), r = () => { + t && (d ? (l.value = t.innerWidth, s.value = t.innerHeight) : (l.value = t.document.documentElement.clientWidth, s.value = t.document.documentElement.clientHeight)); + }; + if (r(), ne(r), S("resize", r, { passive: !0 }), o) { + const a = ie("(orientation: portrait)"); + b(a, () => r()); + } + return { width: l, height: s }; +} +const ae = ["placeholder"], de = { class: "input-overlay" }, pe = { class: "result-query" }, fe = { class: "result-suggest" }, ve = { + key: 0, + class: "swiper" +}, he = /* @__PURE__ */ _( + "svg", + { + xmlns: "http://www.w3.org/2000/svg", + fill: "none", + viewBox: "0 0 24 24", + "stroke-width": "1.5", + stroke: "currentColor" + }, + [ + /* @__PURE__ */ _("path", { + "stroke-linecap": "round", + "stroke-linejoin": "round", + d: "M17.25 8.25 21 12m0 0-3.75 3.75M21 12H3" + }) + ], + -1 + /* HOISTED */ +), me = /* @__PURE__ */ G({ __name: "NextHint", props: { - suggestions: { default: () => [] }, - placeholder: { default: "" } + suggestions: { type: Array, required: !0, default: () => [] }, + placeholder: { type: String, required: !0, default: "" } }, emits: ["change"], - setup(r, { emit: c }) { - const o = r, i = c, e = m(""), s = a(() => e.value === "" ? null : o.suggestions.find((l) => l.toLowerCase().startsWith(e.value.toLowerCase()))), p = a(() => { - var t; - return e.value === "" || s.value === null ? null : (t = s.value) == null ? void 0 : t.substring(e.value.length); - }), d = (t) => { - t.key === "Tab" && (t.preventDefault(), s.value && (e.value = s.value)); + setup(e, { emit: t }) { + const n = e, c = t, o = g(null), { width: d } = le(), { direction: l } = ue(o), s = g(""), r = y(() => s.value === "" ? null : n.suggestions.find((f) => f.toLowerCase().startsWith(s.value.toLowerCase()))), a = y(() => { + var i; + return s.value === "" || r.value === null ? null : (i = r.value) == null ? void 0 : i.substring(s.value.length); + }), p = (i) => { + i.key === "Tab" && (i.preventDefault(), r.value && (s.value = r.value)); }; - return f(e, () => { - i("change", e.value); - }), (t, l) => (h(), g("div", R, [ - y(n("input", { - "onUpdate:modelValue": l[0] || (l[0] = (v) => e.value = v), - type: "text", - class: "vue-tab-complete-input", - onKeydown: d, - placeholder: o.placeholder - }, null, 40, w), [ - [x, e.value] - ]), - n("div", b, [ - n("span", D, u(e.value), 1), - n("span", N, u(p.value), 1) - ]) - ])); + return b(s, () => { + c("change", s.value); + }), b(l, (i) => { + i === "right" && r.value && (s.value = r.value); + }), (i, f) => (O(), R( + "div", + { + ref_key: "nexthintRef", + ref: o, + class: "vue-tab-complete-wrapper" + }, + [ + K(_("input", { + "onUpdate:modelValue": f[0] || (f[0] = (v) => s.value = v), + type: "text", + class: "vue-tab-complete-input", + onKeydown: p, + placeholder: n.placeholder + }, null, 40, ae), [ + [U, s.value] + ]), + _("div", de, [ + _( + "span", + pe, + H(s.value), + 1 + /* TEXT */ + ), + _("span", fe, [ + A( + H(a.value) + " ", + 1 + /* TEXT */ + ), + a.value && V(d) < 768 ? (O(), R("span", ve, [ + A(" swipe "), + he + ])) : $("v-if", !0) + ]) + ]) + ], + 512 + /* NEED_PATCH */ + )); } }); +const ye = (e, t) => { + const n = e.__vccOpts || e; + for (const [c, o] of t) + n[c] = o; + return n; +}, _e = /* @__PURE__ */ ye(me, [["__file", "/opt/lampp/htdocs/phuc/vue-nexthint/src/NextHint.vue"]]); export { - C as NextHint + _e as NextHint }; diff --git a/dist/main.umd.js b/dist/main.umd.js index 04219e3..17a00d4 100644 --- a/dist/main.umd.js +++ b/dist/main.umd.js @@ -1,2 +1,2 @@ -(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".vue-tab-complete-wrapper{position:relative}.vue-tab-complete-wrapper input{z-index:10;padding:.5rem;padding-left:14px;width:100%;height:100%;color:#fff;border-color:#ced7d0;caret-color:#63666c}.vue-tab-complete-wrapper .input-overlay{position:absolute;left:.75rem;top:50%;transform:translateY(-50%)}.vue-tab-complete-wrapper .input-overlay .result-query{padding-top:.25rem;padding-bottom:.25rem;margin-left:.125rem;color:#000}.vue-tab-complete-wrapper .input-overlay .result-suggest{color:#9ca3af}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); -(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.VueNextHint={},n.Vue))})(this,function(n,e){"use strict";const v="",i={class:"vue-tab-complete-wrapper"},r=["placeholder"],u={class:"input-overlay"},c={class:"result-query"},d={class:"result-suggest"},p=e.defineComponent({__name:"NextHint",props:{suggestions:{default:()=>[]},placeholder:{default:""}},emits:["change"],setup(f,{emit:m}){const a=f,_=m,t=e.ref(""),l=e.computed(()=>t.value===""?null:a.suggestions.find(o=>o.toLowerCase().startsWith(t.value.toLowerCase()))),h=e.computed(()=>{var s;return t.value===""||l.value===null?null:(s=l.value)==null?void 0:s.substring(t.value.length)}),y=s=>{s.key==="Tab"&&(s.preventDefault(),l.value&&(t.value=l.value))};return e.watch(t,()=>{_("change",t.value)}),(s,o)=>(e.openBlock(),e.createElementBlock("div",i,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=g=>t.value=g),type:"text",class:"vue-tab-complete-input",onKeydown:y,placeholder:a.placeholder},null,40,r),[[e.vModelText,t.value]]),e.createElementVNode("div",u,[e.createElementVNode("span",c,e.toDisplayString(t.value),1),e.createElementVNode("span",d,e.toDisplayString(h.value),1)])]))}}),x="";n.NextHint=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}); +(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".vue-tab-complete-wrapper{position:relative}.vue-tab-complete-wrapper input{z-index:10;padding:.5rem;padding-left:14px;width:100%;height:100%;color:#fff;border-color:#ced7d0;caret-color:#63666c}.vue-tab-complete-wrapper .input-overlay{position:absolute;left:.75rem;top:50%;transform:translateY(-50%)}.vue-tab-complete-wrapper .input-overlay .result-query{padding-top:.25rem;padding-bottom:.25rem;margin-left:.125rem;color:#000}.vue-tab-complete-wrapper .input-overlay .result-suggest{color:#9ca3af}.vue-tab-complete-wrapper .input-overlay .result-suggest .swiper{position:relative;margin-left:.8rem;font-size:.8rem;color:#cfd0d1}.vue-tab-complete-wrapper .input-overlay .result-suggest .swiper svg{position:absolute;top:-2px;right:-60%;width:18px;height:18px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); +(function(y,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(y=typeof globalThis<"u"?globalThis:y||self,e(y.VueNextHint={},y.Vue))})(this,function(y,e){"use strict";const ee="";function T(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function N(t){return typeof t=="function"?t():e.unref(t)}const L=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const I=Object.prototype.toString,O=t=>I.call(t)==="[object Object]",b=()=>{};function W(t){return t||e.getCurrentInstance()}function H(t,n=!0,o){W()?e.onMounted(t,o):n?t():e.nextTick(t)}function R(t){var n;const o=N(t);return(n=o==null?void 0:o.$el)!=null?n:o}const _=L?window:void 0;function x(...t){let n,o,a,s;if(typeof t[0]=="string"||Array.isArray(t[0])?([o,a,s]=t,n=_):[n,o,a,s]=t,!n)return b;Array.isArray(o)||(o=[o]),Array.isArray(a)||(a=[a]);const p=[],u=()=>{p.forEach(f=>f()),p.length=0},r=(f,c,h,m)=>(f.addEventListener(c,h,m),()=>f.removeEventListener(c,h,m)),i=e.watch(()=>[R(n),N(s)],([f,c])=>{if(u(),!f)return;const h=O(c)?{...c}:c;p.push(...o.flatMap(m=>a.map(E=>r(f,m,E,h))))},{immediate:!0,flush:"post"}),d=()=>{i(),u()};return T(d),d}function D(){const t=e.ref(!1),n=e.getCurrentInstance();return n&&e.onMounted(()=>{t.value=!0},n),t}function j(t){const n=D();return e.computed(()=>(n.value,!!t()))}function A(t,n={}){const{window:o=_}=n,a=j(()=>o&&"matchMedia"in o&&typeof o.matchMedia=="function");let s;const p=e.ref(!1),u=d=>{p.value=d.matches},r=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",u):s.removeListener(u))},i=e.watchEffect(()=>{a.value&&(r(),s=o.matchMedia(N(t)),"addEventListener"in s?s.addEventListener("change",u):s.addListener(u),p.value=s.matches)});return T(()=>{i(),r(),s=void 0}),p}function B(t,n={}){const{threshold:o=50,onSwipe:a,onSwipeEnd:s,onSwipeStart:p,passive:u=!0,window:r=_}=n,i=e.reactive({x:0,y:0}),d=e.reactive({x:0,y:0}),f=e.computed(()=>i.x-d.x),c=e.computed(()=>i.y-d.y),{max:h,abs:m}=Math,E=e.computed(()=>h(m(f.value),m(c.value))>=o),w=e.ref(!1),M=e.computed(()=>E.value?m(f.value)>m(c.value)?f.value>0?"left":"right":c.value>0?"up":"down":"none"),V=l=>[l.touches[0].clientX,l.touches[0].clientY],$=(l,v)=>{i.x=l,i.y=v},C=(l,v)=>{d.x=l,d.y=v};let g;const k=P(r==null?void 0:r.document);u?g=k?{passive:!0}:{capture:!1}:g=k?{passive:!1,capture:!0}:{capture:!0};const J=l=>{w.value&&(s==null||s(l,M.value)),w.value=!1},Z=[x(t,"touchstart",l=>{if(l.touches.length!==1)return;g.capture&&!g.passive&&l.preventDefault();const[v,S]=V(l);$(v,S),C(v,S),p==null||p(l)},g),x(t,"touchmove",l=>{if(l.touches.length!==1)return;const[v,S]=V(l);C(v,S),!w.value&&E.value&&(w.value=!0),w.value&&(a==null||a(l))},g),x(t,["touchend","touchcancel"],J,g)];return{isPassiveEventSupported:k,isSwiping:w,direction:M,coordsStart:i,coordsEnd:d,lengthX:f,lengthY:c,stop:()=>Z.forEach(l=>l())}}function P(t){if(!t)return!1;let n=!1;const o={get passive(){return n=!0,!1}};return t.addEventListener("x",b,o),t.removeEventListener("x",b),n}function Y(t={}){const{window:n=_,initialWidth:o=Number.POSITIVE_INFINITY,initialHeight:a=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:p=!0}=t,u=e.ref(o),r=e.ref(a),i=()=>{n&&(p?(u.value=n.innerWidth,r.value=n.innerHeight):(u.value=n.document.documentElement.clientWidth,r.value=n.document.documentElement.clientHeight))};if(i(),H(i),x("resize",i,{passive:!0}),s){const d=A("(orientation: portrait)");e.watch(d,()=>i())}return{width:u,height:r}}const q=["placeholder"],Q={class:"input-overlay"},X={class:"result-query"},z={class:"result-suggest"},F={key:0,class:"swiper"},G=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 8.25 21 12m0 0-3.75 3.75M21 12H3"})],-1),K=e.defineComponent({__name:"NextHint",props:{suggestions:{type:Array,required:!0,default:()=>[]},placeholder:{type:String,required:!0,default:""}},emits:["change"],setup(t,{emit:n}){const o=t,a=n,s=e.ref(null),{width:p}=Y(),{direction:u}=B(s),r=e.ref(""),i=e.computed(()=>r.value===""?null:o.suggestions.find(h=>h.toLowerCase().startsWith(r.value.toLowerCase()))),d=e.computed(()=>{var c;return r.value===""||i.value===null?null:(c=i.value)==null?void 0:c.substring(r.value.length)}),f=c=>{c.key==="Tab"&&(c.preventDefault(),i.value&&(r.value=i.value))};return e.watch(r,()=>{a("change",r.value)}),e.watch(u,c=>{c==="right"&&i.value&&(r.value=i.value)}),(c,h)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"nexthintRef",ref:s,class:"vue-tab-complete-wrapper"},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":h[0]||(h[0]=m=>r.value=m),type:"text",class:"vue-tab-complete-input",onKeydown:f,placeholder:o.placeholder},null,40,q),[[e.vModelText,r.value]]),e.createElementVNode("div",Q,[e.createElementVNode("span",X,e.toDisplayString(r.value),1),e.createElementVNode("span",z,[e.createTextVNode(e.toDisplayString(d.value)+" ",1),d.value&&e.unref(p)<768?(e.openBlock(),e.createElementBlock("span",F,[e.createTextVNode(" swipe "),G])):e.createCommentVNode("v-if",!0)])])],512))}}),te="",U=((t,n)=>{const o=t.__vccOpts||t;for(const[a,s]of n)o[a]=s;return o})(K,[["__file","/opt/lampp/htdocs/phuc/vue-nexthint/src/NextHint.vue"]]);y.NextHint=U,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}); diff --git a/package.json b/package.json index d9617a6..67a3ee4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-nexthint", - "version": "1.0.3", + "version": "1.0.4", "description": "A Vue component that creates autocomplete functionality for your input fields, but works as tab suggestions instead of dropdown.", "author": { "name": "Phuc Hong.",