@vue-interface/tooltip 0.8.1 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Tooltip.vue.d.ts +4 -0
- package/dist/TooltipPlugin.d.ts +2 -0
- package/dist/tooltip.css +1 -0
- package/dist/tooltip.es.js +1105 -0
- package/dist/tooltip.umd.js +5 -0
- package/package.json +38 -36
- package/src/Popper.js +33 -21
- package/src/Tooltip.vue +2 -1
- package/src/TooltipPlugin.ts +73 -0
- package/tailwindcss/index.js +18 -20
- package/.eslintrc.js +0 -53
- package/babel.config.js +0 -5
- package/dist/Tooltip.common.js +0 -6496
- package/dist/Tooltip.common.js.map +0 -1
- package/dist/Tooltip.css +0 -193
- package/dist/Tooltip.css.map +0 -1
- package/dist/Tooltip.umd.js +0 -6506
- package/dist/Tooltip.umd.js.map +0 -1
- package/dist/Tooltip.umd.min.js +0 -2
- package/dist/Tooltip.umd.min.js.map +0 -1
- package/dist/demo.html +0 -10
- package/docs/.vuepress/config.js +0 -44
- package/docs/.vuepress/dist/404.html +0 -19
- package/docs/.vuepress/dist/assets/css/0.styles.275ee968.css +0 -1
- package/docs/.vuepress/dist/assets/img/search.83621669.svg +0 -1
- package/docs/.vuepress/dist/assets/js/10.5d93d289.js +0 -1
- package/docs/.vuepress/dist/assets/js/11.97ab3884.js +0 -1
- package/docs/.vuepress/dist/assets/js/2.f3d148c3.js +0 -1
- package/docs/.vuepress/dist/assets/js/3.81681fff.js +0 -1
- package/docs/.vuepress/dist/assets/js/4.82fa7382.js +0 -1
- package/docs/.vuepress/dist/assets/js/5.3dae6ad4.js +0 -1
- package/docs/.vuepress/dist/assets/js/6.6a04f815.js +0 -1
- package/docs/.vuepress/dist/assets/js/7.c033cb49.js +0 -1
- package/docs/.vuepress/dist/assets/js/8.6d6eb599.js +0 -1
- package/docs/.vuepress/dist/assets/js/9.eaefe866.js +0 -1
- package/docs/.vuepress/dist/assets/js/app.7ed065d3.js +0 -13
- package/docs/.vuepress/dist/examples/index.html +0 -21
- package/docs/.vuepress/dist/examples/test.html +0 -17
- package/docs/.vuepress/dist/index.html +0 -53
- package/docs/.vuepress/dist/options.html +0 -41
- package/docs/.vuepress/dist/tailwindcss.html +0 -85
- package/docs/README.md +0 -23
- package/docs/examples/README.md +0 -3
- package/docs/options.md +0 -46
- package/docs/tailwindcss.md +0 -76
- package/index.html +0 -50
- package/index.js +0 -5
- package/main.js +0 -8
- package/postcss.config.js +0 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/TooltipPlugin.js +0 -87
- package/src/css/Tooltip.css +0 -2
- package/tailwind.config.js +0 -12
- package/vue.config.js +0 -14
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
(function(H,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],C):(H=typeof globalThis<"u"?globalThis:H||self,C(H.Tooltip={},H.Vue))})(this,function(H,C){"use strict";var j="top",N="bottom",L="right",B="left",ve="auto",ae=[j,N,L,B],ee="start",ie="end",dt="clippingParents",Me="viewport",se="popper",vt="reference",Ve=ae.reduce(function(t,e){return t.concat([e+"-"+ee,e+"-"+ie])},[]),Ie=[].concat(ae,[ve]).reduce(function(t,e){return t.concat([e,e+"-"+ee,e+"-"+ie])},[]),ht="beforeRead",mt="read",gt="afterRead",yt="beforeMain",bt="main",wt="afterMain",xt="beforeWrite",Ot="write",Et="afterWrite",Ae=[ht,mt,gt,yt,bt,wt,xt,Ot,Et];function W(t){return t?(t.nodeName||"").toLowerCase():null}function M(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Y(t){var e=M(t).Element;return t instanceof e||t instanceof Element}function $(t){var e=M(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Pe(t){if(typeof ShadowRoot>"u")return!1;var e=M(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function At(t){var e=t.state;Object.keys(e.elements).forEach(function(r){var n=e.styles[r]||{},o=e.attributes[r]||{},a=e.elements[r];!$(a)||!W(a)||(Object.assign(a.style,n),Object.keys(o).forEach(function(f){var s=o[f];s===!1?a.removeAttribute(f):a.setAttribute(f,s===!0?"":s)}))})}function Pt(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow),function(){Object.keys(e.elements).forEach(function(n){var o=e.elements[n],a=e.attributes[n]||{},f=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:r[n]),s=f.reduce(function(i,c){return i[c]="",i},{});!$(o)||!W(o)||(Object.assign(o.style,s),Object.keys(a).forEach(function(i){o.removeAttribute(i)}))})}}const Dt={name:"applyStyles",enabled:!0,phase:"write",fn:At,effect:Pt,requires:["computeStyles"]};function V(t){return t.split("-")[0]}var z=Math.max,he=Math.min,te=Math.round;function De(){var t=navigator.userAgentData;return t!=null&&t.brands?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function qe(){return!/^((?!chrome|android).)*safari/i.test(De())}function re(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!1);var n=t.getBoundingClientRect(),o=1,a=1;e&&$(t)&&(o=t.offsetWidth>0&&te(n.width)/t.offsetWidth||1,a=t.offsetHeight>0&&te(n.height)/t.offsetHeight||1);var f=Y(t)?M(t):window,s=f.visualViewport,i=!qe()&&r,c=(n.left+(i&&s?s.offsetLeft:0))/o,p=(n.top+(i&&s?s.offsetTop:0))/a,h=n.width/o,b=n.height/a;return{width:h,height:b,top:p,right:c+h,bottom:p+b,left:c,x:c,y:p}}function Se(t){var e=re(t),r=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-r)<=1&&(r=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:n}}function We(t,e){var r=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(r&&Pe(r)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function I(t){return M(t).getComputedStyle(t)}function St(t){return["table","td","th"].indexOf(W(t))>=0}function _(t){return((Y(t)?t.ownerDocument:t.document)||window.document).documentElement}function me(t){return W(t)==="html"?t:t.assignedSlot||t.parentNode||(Pe(t)?t.host:null)||_(t)}function He(t){return!$(t)||I(t).position==="fixed"?null:t.offsetParent}function Tt(t){var e=/firefox/i.test(De()),r=/Trident/i.test(De());if(r&&$(t)){var n=I(t);if(n.position==="fixed")return null}var o=me(t);for(Pe(o)&&(o=o.host);$(o)&&["html","body"].indexOf(W(o))<0;){var a=I(o);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||e&&a.willChange==="filter"||e&&a.filter&&a.filter!=="none")return o;o=o.parentNode}return null}function pe(t){for(var e=M(t),r=He(t);r&&St(r)&&I(r).position==="static";)r=He(r);return r&&(W(r)==="html"||W(r)==="body"&&I(r).position==="static")?e:r||Tt(t)||e}function Te(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function fe(t,e,r){return z(t,he(e,r))}function Rt(t,e,r){var n=fe(t,e,r);return n>r?r:n}function _e(){return{top:0,right:0,bottom:0,left:0}}function Fe(t){return Object.assign({},_e(),t)}function Xe(t,e){return e.reduce(function(r,n){return r[n]=t,r},{})}var jt=function(e,r){return e=typeof e=="function"?e(Object.assign({},r.rects,{placement:r.placement})):e,Fe(typeof e!="number"?e:Xe(e,ae))};function Bt(t){var e,r=t.state,n=t.name,o=t.options,a=r.elements.arrow,f=r.modifiersData.popperOffsets,s=V(r.placement),i=Te(s),c=[B,L].indexOf(s)>=0,p=c?"height":"width";if(!(!a||!f)){var h=jt(o.padding,r),b=Se(a),l=i==="y"?j:B,x=i==="y"?N:L,m=r.rects.reference[p]+r.rects.reference[i]-f[i]-r.rects.popper[p],v=f[i]-r.rects.reference[i],w=pe(a),A=w?i==="y"?w.clientHeight||0:w.clientWidth||0:0,E=m/2-v/2,u=h[l],g=A-b[p]-h[x],d=A/2-b[p]/2+E,O=fe(u,d,g),P=i;r.modifiersData[n]=(e={},e[P]=O,e.centerOffset=O-d,e)}}function $t(t){var e=t.state,r=t.options,n=r.element,o=n===void 0?"[data-popper-arrow]":n;if(o!=null&&!(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o))){if(process.env.NODE_ENV!=="production"&&($(o)||console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).',"To use an SVG arrow, wrap it in an HTMLElement that will be used as","the arrow."].join(" "))),!We(e.elements.popper,o)){process.env.NODE_ENV!=="production"&&console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper',"element."].join(" "));return}e.elements.arrow=o}}const kt={name:"arrow",enabled:!0,phase:"main",fn:Bt,effect:$t,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ne(t){return t.split("-")[1]}var Ct={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Nt(t){var e=t.x,r=t.y,n=window,o=n.devicePixelRatio||1;return{x:te(e*o)/o||0,y:te(r*o)/o||0}}function Ye(t){var e,r=t.popper,n=t.popperRect,o=t.placement,a=t.variation,f=t.offsets,s=t.position,i=t.gpuAcceleration,c=t.adaptive,p=t.roundOffsets,h=t.isFixed,b=f.x,l=b===void 0?0:b,x=f.y,m=x===void 0?0:x,v=typeof p=="function"?p({x:l,y:m}):{x:l,y:m};l=v.x,m=v.y;var w=f.hasOwnProperty("x"),A=f.hasOwnProperty("y"),E=B,u=j,g=window;if(c){var d=pe(r),O="clientHeight",P="clientWidth";if(d===M(r)&&(d=_(r),I(d).position!=="static"&&s==="absolute"&&(O="scrollHeight",P="scrollWidth")),d=d,o===j||(o===B||o===L)&&a===ie){u=N;var D=h&&d===g&&g.visualViewport?g.visualViewport.height:d[O];m-=D-n.height,m*=i?1:-1}if(o===B||(o===j||o===N)&&a===ie){E=L;var S=h&&d===g&&g.visualViewport?g.visualViewport.width:d[P];l-=S-n.width,l*=i?1:-1}}var y=Object.assign({position:s},c&&Ct),T=p===!0?Nt({x:l,y:m}):{x:l,y:m};if(l=T.x,m=T.y,i){var R;return Object.assign({},y,(R={},R[u]=A?"0":"",R[E]=w?"0":"",R.transform=(g.devicePixelRatio||1)<=1?"translate("+l+"px, "+m+"px)":"translate3d("+l+"px, "+m+"px, 0)",R))}return Object.assign({},y,(e={},e[u]=A?m+"px":"",e[E]=w?l+"px":"",e.transform="",e))}function Lt(t){var e=t.state,r=t.options,n=r.gpuAcceleration,o=n===void 0?!0:n,a=r.adaptive,f=a===void 0?!0:a,s=r.roundOffsets,i=s===void 0?!0:s;if(process.env.NODE_ENV!=="production"){var c=I(e.elements.popper).transitionProperty||"";f&&["transform","top","right","bottom","left"].some(function(h){return c.indexOf(h)>=0})&&console.warn(["Popper: Detected CSS transitions on at least one of the following",'CSS properties: "transform", "top", "right", "bottom", "left".',`
|
|
2
|
+
|
|
3
|
+
`,'Disable the "computeStyles" modifier\'s `adaptive` option to allow',"for smooth transitions, or remove these properties from the CSS","transition declaration on the popper element if only transitioning","opacity or background-color for example.",`
|
|
4
|
+
|
|
5
|
+
`,"We recommend using the popper element as a wrapper around an inner","element that can have any CSS property transitioned for animations."].join(" "))}var p={placement:V(e.placement),variation:ne(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Ye(Object.assign({},p,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:f,roundOffsets:i})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Ye(Object.assign({},p,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:i})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Mt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Lt,data:{}};var ge={passive:!0};function Vt(t){var e=t.state,r=t.instance,n=t.options,o=n.scroll,a=o===void 0?!0:o,f=n.resize,s=f===void 0?!0:f,i=M(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return a&&c.forEach(function(p){p.addEventListener("scroll",r.update,ge)}),s&&i.addEventListener("resize",r.update,ge),function(){a&&c.forEach(function(p){p.removeEventListener("scroll",r.update,ge)}),s&&i.removeEventListener("resize",r.update,ge)}}const It={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Vt,data:{}};var qt={left:"right",right:"left",bottom:"top",top:"bottom"};function ye(t){return t.replace(/left|right|bottom|top/g,function(e){return qt[e]})}var Wt={start:"end",end:"start"};function ze(t){return t.replace(/start|end/g,function(e){return Wt[e]})}function Re(t){var e=M(t),r=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:r,scrollTop:n}}function je(t){return re(_(t)).left+Re(t).scrollLeft}function Ht(t,e){var r=M(t),n=_(t),o=r.visualViewport,a=n.clientWidth,f=n.clientHeight,s=0,i=0;if(o){a=o.width,f=o.height;var c=qe();(c||!c&&e==="fixed")&&(s=o.offsetLeft,i=o.offsetTop)}return{width:a,height:f,x:s+je(t),y:i}}function _t(t){var e,r=_(t),n=Re(t),o=(e=t.ownerDocument)==null?void 0:e.body,a=z(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),f=z(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-n.scrollLeft+je(t),i=-n.scrollTop;return I(o||r).direction==="rtl"&&(s+=z(r.clientWidth,o?o.clientWidth:0)-a),{width:a,height:f,x:s,y:i}}function Be(t){var e=I(t),r=e.overflow,n=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+n)}function Ue(t){return["html","body","#document"].indexOf(W(t))>=0?t.ownerDocument.body:$(t)&&Be(t)?t:Ue(me(t))}function ce(t,e){var r;e===void 0&&(e=[]);var n=Ue(t),o=n===((r=t.ownerDocument)==null?void 0:r.body),a=M(n),f=o?[a].concat(a.visualViewport||[],Be(n)?n:[]):n,s=e.concat(f);return o?s:s.concat(ce(me(f)))}function $e(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Ft(t,e){var r=re(t,!1,e==="fixed");return r.top=r.top+t.clientTop,r.left=r.left+t.clientLeft,r.bottom=r.top+t.clientHeight,r.right=r.left+t.clientWidth,r.width=t.clientWidth,r.height=t.clientHeight,r.x=r.left,r.y=r.top,r}function Ge(t,e,r){return e===Me?$e(Ht(t,r)):Y(e)?Ft(e,r):$e(_t(_(t)))}function Xt(t){var e=ce(me(t)),r=["absolute","fixed"].indexOf(I(t).position)>=0,n=r&&$(t)?pe(t):t;return Y(n)?e.filter(function(o){return Y(o)&&We(o,n)&&W(o)!=="body"}):[]}function Yt(t,e,r,n){var o=e==="clippingParents"?Xt(t):[].concat(e),a=[].concat(o,[r]),f=a[0],s=a.reduce(function(i,c){var p=Ge(t,c,n);return i.top=z(p.top,i.top),i.right=he(p.right,i.right),i.bottom=he(p.bottom,i.bottom),i.left=z(p.left,i.left),i},Ge(t,f,n));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function Je(t){var e=t.reference,r=t.element,n=t.placement,o=n?V(n):null,a=n?ne(n):null,f=e.x+e.width/2-r.width/2,s=e.y+e.height/2-r.height/2,i;switch(o){case j:i={x:f,y:e.y-r.height};break;case N:i={x:f,y:e.y+e.height};break;case L:i={x:e.x+e.width,y:s};break;case B:i={x:e.x-r.width,y:s};break;default:i={x:e.x,y:e.y}}var c=o?Te(o):null;if(c!=null){var p=c==="y"?"height":"width";switch(a){case ee:i[c]=i[c]-(e[p]/2-r[p]/2);break;case ie:i[c]=i[c]+(e[p]/2-r[p]/2);break}}return i}function le(t,e){e===void 0&&(e={});var r=e,n=r.placement,o=n===void 0?t.placement:n,a=r.strategy,f=a===void 0?t.strategy:a,s=r.boundary,i=s===void 0?dt:s,c=r.rootBoundary,p=c===void 0?Me:c,h=r.elementContext,b=h===void 0?se:h,l=r.altBoundary,x=l===void 0?!1:l,m=r.padding,v=m===void 0?0:m,w=Fe(typeof v!="number"?v:Xe(v,ae)),A=b===se?vt:se,E=t.rects.popper,u=t.elements[x?A:b],g=Yt(Y(u)?u:u.contextElement||_(t.elements.popper),i,p,f),d=re(t.elements.reference),O=Je({reference:d,element:E,strategy:"absolute",placement:o}),P=$e(Object.assign({},E,O)),D=b===se?P:d,S={top:g.top-D.top+w.top,bottom:D.bottom-g.bottom+w.bottom,left:g.left-D.left+w.left,right:D.right-g.right+w.right},y=t.modifiersData.offset;if(b===se&&y){var T=y[o];Object.keys(S).forEach(function(R){var G=[L,N].indexOf(R)>=0?1:-1,J=[j,N].indexOf(R)>=0?"y":"x";S[R]+=T[J]*G})}return S}function zt(t,e){e===void 0&&(e={});var r=e,n=r.placement,o=r.boundary,a=r.rootBoundary,f=r.padding,s=r.flipVariations,i=r.allowedAutoPlacements,c=i===void 0?Ie:i,p=ne(n),h=p?s?Ve:Ve.filter(function(x){return ne(x)===p}):ae,b=h.filter(function(x){return c.indexOf(x)>=0});b.length===0&&(b=h,process.env.NODE_ENV!=="production"&&console.error(["Popper: The `allowedAutoPlacements` option did not allow any","placements. Ensure the `placement` option matches the variation","of the allowed placements.",'For example, "auto" cannot be used to allow "bottom-start".','Use "auto-start" instead.'].join(" ")));var l=b.reduce(function(x,m){return x[m]=le(t,{placement:m,boundary:o,rootBoundary:a,padding:f})[V(m)],x},{});return Object.keys(l).sort(function(x,m){return l[x]-l[m]})}function Ut(t){if(V(t)===ve)return[];var e=ye(t);return[ze(t),e,ze(e)]}function Gt(t){var e=t.state,r=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var o=r.mainAxis,a=o===void 0?!0:o,f=r.altAxis,s=f===void 0?!0:f,i=r.fallbackPlacements,c=r.padding,p=r.boundary,h=r.rootBoundary,b=r.altBoundary,l=r.flipVariations,x=l===void 0?!0:l,m=r.allowedAutoPlacements,v=e.options.placement,w=V(v),A=w===v,E=i||(A||!x?[ye(v)]:Ut(v)),u=[v].concat(E).reduce(function(oe,X){return oe.concat(V(X)===ve?zt(e,{placement:X,boundary:p,rootBoundary:h,padding:c,flipVariations:x,allowedAutoPlacements:m}):X)},[]),g=e.rects.reference,d=e.rects.popper,O=new Map,P=!0,D=u[0],S=0;S<u.length;S++){var y=u[S],T=V(y),R=ne(y)===ee,G=[j,N].indexOf(T)>=0,J=G?"width":"height",k=le(e,{placement:y,boundary:p,rootBoundary:h,altBoundary:b,padding:c}),q=G?R?L:B:R?N:j;g[J]>d[J]&&(q=ye(q));var be=ye(q),K=[];if(a&&K.push(k[T]<=0),s&&K.push(k[q]<=0,k[be]<=0),K.every(function(oe){return oe})){D=y,P=!1;break}O.set(y,K)}if(P)for(var we=x?3:1,ke=function(X){var de=u.find(function(Oe){var Q=O.get(Oe);if(Q)return Q.slice(0,X).every(function(Ce){return Ce})});if(de)return D=de,"break"},ue=we;ue>0;ue--){var xe=ke(ue);if(xe==="break")break}e.placement!==D&&(e.modifiersData[n]._skip=!0,e.placement=D,e.reset=!0)}}const Jt={name:"flip",enabled:!0,phase:"main",fn:Gt,requiresIfExists:["offset"],data:{_skip:!1}};function Ke(t,e,r){return r===void 0&&(r={x:0,y:0}),{top:t.top-e.height-r.y,right:t.right-e.width+r.x,bottom:t.bottom-e.height+r.y,left:t.left-e.width-r.x}}function Qe(t){return[j,L,N,B].some(function(e){return t[e]>=0})}function Kt(t){var e=t.state,r=t.name,n=e.rects.reference,o=e.rects.popper,a=e.modifiersData.preventOverflow,f=le(e,{elementContext:"reference"}),s=le(e,{altBoundary:!0}),i=Ke(f,n),c=Ke(s,o,a),p=Qe(i),h=Qe(c);e.modifiersData[r]={referenceClippingOffsets:i,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":h})}const Qt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Kt};function Zt(t,e,r){var n=V(t),o=[B,j].indexOf(n)>=0?-1:1,a=typeof r=="function"?r(Object.assign({},e,{placement:t})):r,f=a[0],s=a[1];return f=f||0,s=(s||0)*o,[B,L].indexOf(n)>=0?{x:s,y:f}:{x:f,y:s}}function er(t){var e=t.state,r=t.options,n=t.name,o=r.offset,a=o===void 0?[0,0]:o,f=Ie.reduce(function(p,h){return p[h]=Zt(h,e.rects,a),p},{}),s=f[e.placement],i=s.x,c=s.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=i,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=f}const tr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:er};function rr(t){var e=t.state,r=t.name;e.modifiersData[r]=Je({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const nr={name:"popperOffsets",enabled:!0,phase:"read",fn:rr,data:{}};function or(t){return t==="x"?"y":"x"}function ar(t){var e=t.state,r=t.options,n=t.name,o=r.mainAxis,a=o===void 0?!0:o,f=r.altAxis,s=f===void 0?!1:f,i=r.boundary,c=r.rootBoundary,p=r.altBoundary,h=r.padding,b=r.tether,l=b===void 0?!0:b,x=r.tetherOffset,m=x===void 0?0:x,v=le(e,{boundary:i,rootBoundary:c,padding:h,altBoundary:p}),w=V(e.placement),A=ne(e.placement),E=!A,u=Te(w),g=or(u),d=e.modifiersData.popperOffsets,O=e.rects.reference,P=e.rects.popper,D=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,S=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),y=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,T={x:0,y:0};if(!!d){if(a){var R,G=u==="y"?j:B,J=u==="y"?N:L,k=u==="y"?"height":"width",q=d[u],be=q+v[G],K=q-v[J],we=l?-P[k]/2:0,ke=A===ee?O[k]:P[k],ue=A===ee?-P[k]:-O[k],xe=e.elements.arrow,oe=l&&xe?Se(xe):{width:0,height:0},X=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:_e(),de=X[G],Oe=X[J],Q=fe(0,O[k],oe[k]),Ce=E?O[k]/2-we-Q-de-S.mainAxis:ke-Q-de-S.mainAxis,Tr=E?-O[k]/2+we+Q+Oe+S.mainAxis:ue+Q+Oe+S.mainAxis,Ne=e.elements.arrow&&pe(e.elements.arrow),Rr=Ne?u==="y"?Ne.clientTop||0:Ne.clientLeft||0:0,ot=(R=y==null?void 0:y[u])!=null?R:0,jr=q+Ce-ot-Rr,Br=q+Tr-ot,at=fe(l?he(be,jr):be,q,l?z(K,Br):K);d[u]=at,T[u]=at-q}if(s){var it,$r=u==="x"?j:B,kr=u==="x"?N:L,Z=d[g],Ee=g==="y"?"height":"width",st=Z+v[$r],pt=Z-v[kr],Le=[j,B].indexOf(w)!==-1,ft=(it=y==null?void 0:y[g])!=null?it:0,ct=Le?st:Z-O[Ee]-P[Ee]-ft+S.altAxis,lt=Le?Z+O[Ee]+P[Ee]-ft-S.altAxis:pt,ut=l&&Le?Rt(ct,Z,lt):fe(l?ct:st,Z,l?lt:pt);d[g]=ut,T[g]=ut-Z}e.modifiersData[n]=T}}const ir={name:"preventOverflow",enabled:!0,phase:"main",fn:ar,requiresIfExists:["offset"]};function sr(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function pr(t){return t===M(t)||!$(t)?Re(t):sr(t)}function fr(t){var e=t.getBoundingClientRect(),r=te(e.width)/t.offsetWidth||1,n=te(e.height)/t.offsetHeight||1;return r!==1||n!==1}function cr(t,e,r){r===void 0&&(r=!1);var n=$(e),o=$(e)&&fr(e),a=_(e),f=re(t,o,r),s={scrollLeft:0,scrollTop:0},i={x:0,y:0};return(n||!n&&!r)&&((W(e)!=="body"||Be(a))&&(s=pr(e)),$(e)?(i=re(e,!0),i.x+=e.clientLeft,i.y+=e.clientTop):a&&(i.x=je(a))),{x:f.left+s.scrollLeft-i.x,y:f.top+s.scrollTop-i.y,width:f.width,height:f.height}}function lr(t){var e=new Map,r=new Set,n=[];t.forEach(function(a){e.set(a.name,a)});function o(a){r.add(a.name);var f=[].concat(a.requires||[],a.requiresIfExists||[]);f.forEach(function(s){if(!r.has(s)){var i=e.get(s);i&&o(i)}}),n.push(a)}return t.forEach(function(a){r.has(a.name)||o(a)}),n}function ur(t){var e=lr(t);return Ae.reduce(function(r,n){return r.concat(e.filter(function(o){return o.phase===n}))},[])}function dr(t){var e;return function(){return e||(e=new Promise(function(r){Promise.resolve().then(function(){e=void 0,r(t())})})),e}}function F(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return[].concat(r).reduce(function(o,a){return o.replace(/%s/,a)},t)}var U='Popper: modifier "%s" provided an invalid %s property, expected %s but got %s',vr='Popper: modifier "%s" requires "%s", but "%s" modifier is not available',Ze=["name","enabled","phase","fn","effect","requires","options"];function hr(t){t.forEach(function(e){[].concat(Object.keys(e),Ze).filter(function(r,n,o){return o.indexOf(r)===n}).forEach(function(r){switch(r){case"name":typeof e.name!="string"&&console.error(F(U,String(e.name),'"name"','"string"','"'+String(e.name)+'"'));break;case"enabled":typeof e.enabled!="boolean"&&console.error(F(U,e.name,'"enabled"','"boolean"','"'+String(e.enabled)+'"'));break;case"phase":Ae.indexOf(e.phase)<0&&console.error(F(U,e.name,'"phase"',"either "+Ae.join(", "),'"'+String(e.phase)+'"'));break;case"fn":typeof e.fn!="function"&&console.error(F(U,e.name,'"fn"','"function"','"'+String(e.fn)+'"'));break;case"effect":e.effect!=null&&typeof e.effect!="function"&&console.error(F(U,e.name,'"effect"','"function"','"'+String(e.fn)+'"'));break;case"requires":e.requires!=null&&!Array.isArray(e.requires)&&console.error(F(U,e.name,'"requires"','"array"','"'+String(e.requires)+'"'));break;case"requiresIfExists":Array.isArray(e.requiresIfExists)||console.error(F(U,e.name,'"requiresIfExists"','"array"','"'+String(e.requiresIfExists)+'"'));break;case"options":case"data":break;default:console.error('PopperJS: an invalid property has been provided to the "'+e.name+'" modifier, valid properties are '+Ze.map(function(n){return'"'+n+'"'}).join(", ")+'; but "'+r+'" was provided.')}e.requires&&e.requires.forEach(function(n){t.find(function(o){return o.name===n})==null&&console.error(F(vr,String(e.name),n,n))})})})}function mr(t,e){var r=new Set;return t.filter(function(n){var o=e(n);if(!r.has(o))return r.add(o),!0})}function gr(t){var e=t.reduce(function(r,n){var o=r[n.name];return r[n.name]=o?Object.assign({},o,n,{options:Object.assign({},o.options,n.options),data:Object.assign({},o.data,n.data)}):n,r},{});return Object.keys(e).map(function(r){return e[r]})}var et="Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.",yr="Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.",tt={placement:"bottom",modifiers:[],strategy:"absolute"};function rt(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return!e.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function br(t){t===void 0&&(t={});var e=t,r=e.defaultModifiers,n=r===void 0?[]:r,o=e.defaultOptions,a=o===void 0?tt:o;return function(s,i,c){c===void 0&&(c=a);var p={placement:"bottom",orderedModifiers:[],options:Object.assign({},tt,a),modifiersData:{},elements:{reference:s,popper:i},attributes:{},styles:{}},h=[],b=!1,l={state:p,setOptions:function(w){var A=typeof w=="function"?w(p.options):w;m(),p.options=Object.assign({},a,p.options,A),p.scrollParents={reference:Y(s)?ce(s):s.contextElement?ce(s.contextElement):[],popper:ce(i)};var E=ur(gr([].concat(n,p.options.modifiers)));if(p.orderedModifiers=E.filter(function(y){return y.enabled}),process.env.NODE_ENV!=="production"){var u=mr([].concat(E,p.options.modifiers),function(y){var T=y.name;return T});if(hr(u),V(p.options.placement)===ve){var g=p.orderedModifiers.find(function(y){var T=y.name;return T==="flip"});g||console.error(['Popper: "auto" placements require the "flip" modifier be',"present and enabled to work."].join(" "))}var d=I(i),O=d.marginTop,P=d.marginRight,D=d.marginBottom,S=d.marginLeft;[O,P,D,S].some(function(y){return parseFloat(y)})&&console.warn(['Popper: CSS "margin" styles cannot be used to apply padding',"between the popper and its reference element or boundary.","To replicate margin, use the `offset` modifier, as well as","the `padding` option in the `preventOverflow` and `flip`","modifiers."].join(" "))}return x(),l.update()},forceUpdate:function(){if(!b){var w=p.elements,A=w.reference,E=w.popper;if(!rt(A,E)){process.env.NODE_ENV!=="production"&&console.error(et);return}p.rects={reference:cr(A,pe(E),p.options.strategy==="fixed"),popper:Se(E)},p.reset=!1,p.placement=p.options.placement,p.orderedModifiers.forEach(function(y){return p.modifiersData[y.name]=Object.assign({},y.data)});for(var u=0,g=0;g<p.orderedModifiers.length;g++){if(process.env.NODE_ENV!=="production"&&(u+=1,u>100)){console.error(yr);break}if(p.reset===!0){p.reset=!1,g=-1;continue}var d=p.orderedModifiers[g],O=d.fn,P=d.options,D=P===void 0?{}:P,S=d.name;typeof O=="function"&&(p=O({state:p,options:D,name:S,instance:l})||p)}}},update:dr(function(){return new Promise(function(v){l.forceUpdate(),v(p)})}),destroy:function(){m(),b=!0}};if(!rt(s,i))return process.env.NODE_ENV!=="production"&&console.error(et),l;l.setOptions(c).then(function(v){!b&&c.onFirstUpdate&&c.onFirstUpdate(v)});function x(){p.orderedModifiers.forEach(function(v){var w=v.name,A=v.options,E=A===void 0?{}:A,u=v.effect;if(typeof u=="function"){var g=u({state:p,name:w,instance:l,options:E}),d=function(){};h.push(g||d)}})}function m(){h.forEach(function(v){return v()}),h=[]}return l}}var wr=[It,nr,Mt,Dt,tr,Jt,ir,kt,Qt],xr=br({defaultModifiers:wr});const Or={mixins:[{props:{offset:Array,popper:Object,show:Boolean,target:{type:HTMLElement,required:!0},top:Boolean,bottom:Boolean,left:Boolean,right:Boolean},data(){return{currentShow:!1,popperInstance:null}},methods:{open(){this.currentShow=!0},close(){this.currentShow=!1}},computed:{placement(){return this.bottom?"bottom":this.left?"left":this.right?"right":"top"},tooltipClasses(){return{show:this.currentShow,[`bs-tooltip-${this.placement}`]:!0}}},mounted(){this.popperInstance=xr(this.target,this.$el,Object.assign({placement:this.placement,modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"arrow",options:{element:this.$refs.arrow}}]},this.popper)),this.$nextTick(()=>{this.currentShow=this.show})},beforeDestroy(){this.popperInstance&&this.popperInstance.destroy()}}]},Nr="",Er=(t,e)=>{const r=t.__vccOpts||t;for(const[n,o]of e)r[n]=o;return r},Ar={ref:"arrow",class:"tooltip-arrow"},Pr={ref:"inner",class:"tooltip-inner"};function Dr(t,e,r,n,o,a){return C.openBlock(),C.createElementBlock("div",{class:C.normalizeClass(["tooltip",t.tooltipClasses]),role:"tooltip"},[C.createElementVNode("div",Ar,null,512),C.createElementVNode("div",Pr,[C.renderSlot(t.$slots,"default")],512)],2)}const nt=Er(Or,[["render",Dr]]);function Sr(t,e={}){function r(n,o={}){const a=document.createElement("template"),f=n.getAttribute("data-tooltip")||"",s=C.h(nt,Object.assign({target:n,show:!0},o),()=>f);C.render(s,a);const[i]=[...a.children];return document.body.append(i),{el:i,vnode:s,close(){var c;(c=s.component)==null||c.ctx.close(),setTimeout(()=>i.remove(),150)}}}t.mixin({created(){console.log("created")}}),t.directive("tooltip",(n,o)=>{n.getAttribute("data-tooltip")||n.setAttribute("data-tooltip",n.getAttribute("title")),n.removeAttribute("title"),n.addEventListener("mouseover",a=>{clearTimeout(n.timer),n.tooltip||(n.timer=setTimeout(()=>{n.tooltip=r(n,{top:o.modifiers.top,bottom:o.modifiers.bottom,left:o.modifiers.left,right:o.modifiers.right})},1e3))}),n.addEventListener("mouseout",a=>{clearTimeout(n.timer),n.tooltip&&(n.timer=setTimeout(()=>{n.tooltip&&n.tooltip.close(),n.tooltip=null},1e3))})})}H.Tooltip=nt,H.TooltipPlugin=Sr,Object.defineProperties(H,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-interface/tooltip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"description": "A Vue tooltip component.",
|
|
5
|
-
"
|
|
5
|
+
"files": [
|
|
6
|
+
"index.js",
|
|
7
|
+
"dist",
|
|
8
|
+
"src",
|
|
9
|
+
"tailwindcss"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/tooltip.umd.js",
|
|
12
|
+
"module": "./dist/tooltip.es.js",
|
|
13
|
+
"browserslist": "last 2 versions, > 0.5%, ie >= 11",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"browser": {
|
|
17
|
+
"default": "./index.ts"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
6
21
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"lint": "vue-cli-service lint",
|
|
11
|
-
"fix": "vue-cli-service lint --fix",
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "vite build",
|
|
24
|
+
"preview": "vite preview",
|
|
12
25
|
"pre-release": "npm run build; git add . -A; git commit -m 'pre-release commit'",
|
|
13
26
|
"release-patch": "npm run pre-release && npm version patch -m \"%s\" && npm run release;",
|
|
14
27
|
"release-minor": "npm run pre-release && npm version minor -m \"%s\" && npm run release;",
|
|
15
28
|
"release-major": "npm run pre-release && npm version major -m \"%s\" && npm run release;",
|
|
16
|
-
"release": "git add . -A; git commit; git push --tags origin; npm publish;"
|
|
17
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
18
|
-
"docs:dev": "./node_modules/.bin/vuepress dev docs",
|
|
19
|
-
"docs:build": "./node_modules/.bin/vuepress build docs"
|
|
29
|
+
"release": "git add . -A; git commit; git push --tags origin; npm publish;"
|
|
20
30
|
},
|
|
21
31
|
"repository": {
|
|
22
32
|
"type": "git",
|
|
@@ -36,33 +46,25 @@
|
|
|
36
46
|
},
|
|
37
47
|
"homepage": "https://github.com/vue-interface/tooltip/docs#readme",
|
|
38
48
|
"dependencies": {
|
|
39
|
-
"@popperjs/core": "^2.4.4"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"@vue-interface/triggerable": "^0.9.0",
|
|
44
|
-
"@vue-interface/utils": "^0.9.16",
|
|
45
|
-
"@vue-interface/variant": "^1.0.12",
|
|
46
|
-
"core-js": "^3.6.4",
|
|
47
|
-
"vue": "^2.6.11"
|
|
49
|
+
"@popperjs/core": "^2.4.4"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"vue": "^3.0.0"
|
|
48
53
|
},
|
|
49
54
|
"devDependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@vue
|
|
52
|
-
"
|
|
53
|
-
"@vue/cli-plugin-babel": "^4.0",
|
|
54
|
-
"@vue/cli-plugin-eslint": "^4.0",
|
|
55
|
-
"@vue/cli-service": "^4.0",
|
|
56
|
-
"@vuepress/plugin-register-components": "^1.5.0",
|
|
55
|
+
"@rollup/plugin-babel": "^6.0.0",
|
|
56
|
+
"@vitejs/plugin-vue": "^3.0.1",
|
|
57
|
+
"autoprefixer": "^10.4.2",
|
|
57
58
|
"babel-eslint": "^10.1.0",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
59
|
+
"babel-preset-vue": "^2.0.2",
|
|
60
|
+
"change-case": "^4.1.2",
|
|
61
|
+
"eslint": "^8.27.0",
|
|
62
|
+
"eslint-plugin-vue": "^9.7.0",
|
|
63
|
+
"pascalcase": "^2.0.0",
|
|
64
|
+
"postcss": "^8.4.6",
|
|
65
|
+
"tailwindcss": "^3.0.18",
|
|
66
|
+
"vite": "^3.0.0",
|
|
67
|
+
"vite-plugin-dts": "^1.7.1",
|
|
68
|
+
"vue": "^3.2.37"
|
|
67
69
|
}
|
|
68
70
|
}
|
package/src/Popper.js
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import { createPopper } from '@popperjs/core';
|
|
2
|
-
import { prefix } from '@vue-interface/utils';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
|
|
6
5
|
props: {
|
|
7
6
|
offset: Array,
|
|
8
7
|
|
|
9
|
-
placement: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: 'top',
|
|
12
|
-
validate: value => {
|
|
13
|
-
return [
|
|
14
|
-
'bs-tooltip-auto',
|
|
15
|
-
'bs-tooltip-top',
|
|
16
|
-
'bs-tooltip-bottom',
|
|
17
|
-
'bs-tooltip-left',
|
|
18
|
-
'bs-tooltip-right',
|
|
19
|
-
].indexOf(prefix(value, 'bs-tooltip')) > -1;
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
|
|
23
8
|
popper: Object,
|
|
24
9
|
|
|
25
10
|
show: Boolean,
|
|
@@ -27,12 +12,20 @@ export default {
|
|
|
27
12
|
target: {
|
|
28
13
|
type: HTMLElement,
|
|
29
14
|
required: true
|
|
30
|
-
}
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
top: Boolean,
|
|
18
|
+
|
|
19
|
+
bottom: Boolean,
|
|
20
|
+
|
|
21
|
+
left: Boolean,
|
|
22
|
+
|
|
23
|
+
right: Boolean,
|
|
31
24
|
},
|
|
32
25
|
|
|
33
26
|
data() {
|
|
34
27
|
return {
|
|
35
|
-
currentShow:
|
|
28
|
+
currentShow: false,
|
|
36
29
|
popperInstance: null
|
|
37
30
|
};
|
|
38
31
|
},
|
|
@@ -50,22 +43,37 @@ export default {
|
|
|
50
43
|
},
|
|
51
44
|
|
|
52
45
|
computed: {
|
|
46
|
+
placement() {
|
|
47
|
+
if(this.bottom) {
|
|
48
|
+
return 'bottom';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if(this.left) {
|
|
52
|
+
return 'left';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if(this.right) {
|
|
56
|
+
return 'right';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return 'top';
|
|
60
|
+
},
|
|
53
61
|
tooltipClasses() {
|
|
54
62
|
return {
|
|
55
63
|
show: this.currentShow,
|
|
56
|
-
[
|
|
64
|
+
[`bs-tooltip-${this.placement}`]: true
|
|
57
65
|
};
|
|
58
66
|
}
|
|
59
67
|
},
|
|
60
68
|
|
|
61
69
|
mounted() {
|
|
62
70
|
this.popperInstance = createPopper(this.target, this.$el, Object.assign({
|
|
63
|
-
placement: this.placement
|
|
71
|
+
placement: this.placement,
|
|
64
72
|
modifiers: [
|
|
65
73
|
{
|
|
66
74
|
name: 'offset',
|
|
67
75
|
options: {
|
|
68
|
-
offset:
|
|
76
|
+
offset: [0, 6]
|
|
69
77
|
},
|
|
70
78
|
},
|
|
71
79
|
{
|
|
@@ -76,10 +84,14 @@ export default {
|
|
|
76
84
|
},
|
|
77
85
|
],
|
|
78
86
|
}, this.popper));
|
|
87
|
+
|
|
88
|
+
this.$nextTick(() => {
|
|
89
|
+
this.currentShow = this.show;
|
|
90
|
+
});
|
|
79
91
|
},
|
|
80
92
|
|
|
81
93
|
beforeDestroy() {
|
|
82
94
|
this.popperInstance && this.popperInstance.destroy();
|
|
83
|
-
}
|
|
95
|
+
}
|
|
84
96
|
|
|
85
97
|
};
|
package/src/Tooltip.vue
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { App, VNode } from 'vue';
|
|
2
|
+
import { h, render } from 'vue';
|
|
3
|
+
import Tooltip from './Tooltip.vue';
|
|
4
|
+
|
|
5
|
+
export default function(app: App, options = {}) {
|
|
6
|
+
|
|
7
|
+
function createTooltip(target: HTMLElement, args: Record<string,any> = {}): {el: Element, vnode: VNode, close: Function} {
|
|
8
|
+
const container = document.createElement('template');
|
|
9
|
+
const title = target.getAttribute('data-tooltip') || '';
|
|
10
|
+
|
|
11
|
+
const vnode = h(Tooltip, Object.assign({
|
|
12
|
+
target,
|
|
13
|
+
show: true
|
|
14
|
+
}, args), () => title);
|
|
15
|
+
|
|
16
|
+
render(vnode, container);
|
|
17
|
+
|
|
18
|
+
const [el] = [...container.children];
|
|
19
|
+
|
|
20
|
+
document.body.append(el);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
el,
|
|
24
|
+
vnode,
|
|
25
|
+
close() {
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
vnode.component?.ctx.close();
|
|
28
|
+
|
|
29
|
+
setTimeout(() => el.remove(), 150);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
app.mixin({
|
|
35
|
+
created() {
|
|
36
|
+
console.log('created');
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
app.directive('tooltip', (target, binding) => {
|
|
41
|
+
if(!target.getAttribute('data-tooltip')) {
|
|
42
|
+
target.setAttribute('data-tooltip', target.getAttribute('title'));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
target.removeAttribute('title');
|
|
46
|
+
|
|
47
|
+
target.addEventListener('mouseover', (e: Event) => {
|
|
48
|
+
clearTimeout(target.timer);
|
|
49
|
+
|
|
50
|
+
if(!target.tooltip) {
|
|
51
|
+
target.timer = setTimeout(() => {
|
|
52
|
+
target.tooltip = createTooltip(target, {
|
|
53
|
+
top: binding.modifiers.top,
|
|
54
|
+
bottom: binding.modifiers.bottom,
|
|
55
|
+
left: binding.modifiers.left,
|
|
56
|
+
right: binding.modifiers.right,
|
|
57
|
+
});
|
|
58
|
+
}, 1000);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
target.addEventListener('mouseout', (e: Event) => {
|
|
63
|
+
clearTimeout(target.timer);
|
|
64
|
+
|
|
65
|
+
if(target.tooltip) {
|
|
66
|
+
target.timer = setTimeout(() => {
|
|
67
|
+
target.tooltip && target.tooltip.close();
|
|
68
|
+
target.tooltip = null;
|
|
69
|
+
}, 1000);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
package/tailwindcss/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const plugin = require('tailwindcss/plugin');
|
|
2
2
|
const { colors } = require('tailwindcss/defaultTheme');
|
|
3
|
-
const { divide, flatten, resetText, quote } = require('@vue-interface/tailwindcss/utils');
|
|
4
3
|
|
|
5
4
|
module.exports = plugin(function({ addComponents, theme }) {
|
|
6
5
|
const tooltipTop = {
|
|
@@ -13,8 +12,8 @@ module.exports = plugin(function({ addComponents, theme }) {
|
|
|
13
12
|
},
|
|
14
13
|
|
|
15
14
|
'.bs-tooltip-top .tooltip-arrow::before': {
|
|
16
|
-
top:
|
|
17
|
-
borderWidth: `${theme('tooltip.arrow.height')} ${
|
|
15
|
+
top: 'calc(100% - 2px)',
|
|
16
|
+
borderWidth: `${theme('tooltip.arrow.height')} calc(${theme('tooltip.arrow.width')} / 2) 0`,
|
|
18
17
|
borderTopColor: theme('tooltip.arrow.color'),
|
|
19
18
|
}
|
|
20
19
|
};
|
|
@@ -29,8 +28,8 @@ module.exports = plugin(function({ addComponents, theme }) {
|
|
|
29
28
|
},
|
|
30
29
|
|
|
31
30
|
'.bs-tooltip-bottom .tooltip-arrow::before': {
|
|
32
|
-
bottom:
|
|
33
|
-
borderWidth: `0 ${
|
|
31
|
+
bottom: 'calc(100% - 2px)',
|
|
32
|
+
borderWidth: `0 calc(${theme('tooltip.arrow.width')} / 2) ${theme('tooltip.arrow.height')}`,
|
|
34
33
|
borderBottomColor: theme('tooltip.arrow.color'),
|
|
35
34
|
},
|
|
36
35
|
};
|
|
@@ -47,8 +46,8 @@ module.exports = plugin(function({ addComponents, theme }) {
|
|
|
47
46
|
},
|
|
48
47
|
|
|
49
48
|
'.bs-tooltip-left .tooltip-arrow::before': {
|
|
50
|
-
left:
|
|
51
|
-
borderWidth:
|
|
49
|
+
left: 'calc(100% - 2px)',
|
|
50
|
+
borderWidth: `calc(${theme('tooltip.arrow.width')} / 2) 0 calc(${theme('tooltip.arrow.width')} / 2) ${theme('tooltip.arrow.height')}`,
|
|
52
51
|
borderLeftColor: theme('tooltip.arrow.color')
|
|
53
52
|
}
|
|
54
53
|
};
|
|
@@ -65,17 +64,15 @@ module.exports = plugin(function({ addComponents, theme }) {
|
|
|
65
64
|
},
|
|
66
65
|
|
|
67
66
|
'.bs-tooltip-right .tooltip-arrow::before': {
|
|
68
|
-
right:
|
|
69
|
-
borderWidth:
|
|
67
|
+
right: 'calc(100% - 2px)',
|
|
68
|
+
borderWidth: `calc(${theme('tooltip.arrow.width')} / 2) ${theme('tooltip.arrow.height')} calc(${theme('tooltip.arrow.width')} / 2) 0`,
|
|
70
69
|
borderRightColor: theme('tooltip.arrow.color'),
|
|
71
70
|
}
|
|
72
71
|
};
|
|
73
72
|
|
|
74
73
|
const tooltip = {
|
|
75
|
-
':root': flatten(theme('tooltip'), '--tooltip-'),
|
|
76
|
-
|
|
77
74
|
// Base class
|
|
78
|
-
'.tooltip':
|
|
75
|
+
'.tooltip': {
|
|
79
76
|
position: 'absolute',
|
|
80
77
|
zIndex: theme('tooltip.zIndex'),
|
|
81
78
|
display: 'block',
|
|
@@ -86,7 +83,8 @@ module.exports = plugin(function({ addComponents, theme }) {
|
|
|
86
83
|
// Allow breaking very long words so they don't overflow the tooltip's bounds
|
|
87
84
|
wordWrap: 'break-word',
|
|
88
85
|
opacity: 0,
|
|
89
|
-
|
|
86
|
+
transition: theme('tooltip.transition')
|
|
87
|
+
},
|
|
90
88
|
|
|
91
89
|
'.tooltip.show': { opacity: theme('tooltip.opacity') },
|
|
92
90
|
|
|
@@ -99,7 +97,7 @@ module.exports = plugin(function({ addComponents, theme }) {
|
|
|
99
97
|
|
|
100
98
|
'.tooltip .tooltip-arrow::before': {
|
|
101
99
|
position: 'absolute',
|
|
102
|
-
content:
|
|
100
|
+
content: '""',
|
|
103
101
|
borderColor: 'transparent',
|
|
104
102
|
borderStyle: 'solid',
|
|
105
103
|
},
|
|
@@ -141,23 +139,23 @@ module.exports = plugin(function({ addComponents, theme }) {
|
|
|
141
139
|
theme: {
|
|
142
140
|
tooltip: theme => {
|
|
143
141
|
return {
|
|
144
|
-
fontSize:
|
|
142
|
+
fontSize: '.875rem',
|
|
145
143
|
maxWidth: '200px',
|
|
146
144
|
color: theme('colors.white', colors.white),
|
|
147
145
|
backgroundColor: theme('colors.black', colors.black),
|
|
148
|
-
borderRadius:
|
|
146
|
+
borderRadius: '.25rem',
|
|
149
147
|
opacity: .9,
|
|
150
|
-
paddingY:
|
|
151
|
-
paddingX:
|
|
148
|
+
paddingY: '.25rem',
|
|
149
|
+
paddingX: '.5rem',
|
|
152
150
|
margin: 0,
|
|
153
151
|
zIndex: theme('interface.zIndex.tooltip', 1070),
|
|
152
|
+
transition: 'opacity .15s ease-out',
|
|
154
153
|
|
|
155
154
|
arrow: {
|
|
156
155
|
width: '.8rem',
|
|
157
156
|
height: '.4rem',
|
|
158
157
|
color: theme('colors.black', colors.black),
|
|
159
|
-
}
|
|
160
|
-
|
|
158
|
+
}
|
|
161
159
|
};
|
|
162
160
|
}
|
|
163
161
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'plugin:vue/recommended'
|
|
4
|
-
],
|
|
5
|
-
parserOptions: {
|
|
6
|
-
'parser': 'babel-eslint'
|
|
7
|
-
},
|
|
8
|
-
// add your custom rules here
|
|
9
|
-
rules: {
|
|
10
|
-
'vue/no-v-html': 0,
|
|
11
|
-
'vue/require-default-prop': 0,
|
|
12
|
-
"vue/max-attributes-per-line": ["error", {
|
|
13
|
-
"singleline": 5,
|
|
14
|
-
"multiline": {
|
|
15
|
-
"max": 1,
|
|
16
|
-
"allowFirstLine": true
|
|
17
|
-
}
|
|
18
|
-
}],
|
|
19
|
-
"vue/html-indent": ["error", 4, {
|
|
20
|
-
"attribute": 1,
|
|
21
|
-
"baseIndent": 1,
|
|
22
|
-
"closeBracket": 1,
|
|
23
|
-
"alignAttributesVertically": false,
|
|
24
|
-
"ignores": []
|
|
25
|
-
}],
|
|
26
|
-
"vue/html-closing-bracket-newline": ["error", {
|
|
27
|
-
"singleline": "never",
|
|
28
|
-
"multiline": "never"
|
|
29
|
-
}],
|
|
30
|
-
// Ensure no space after keywords like if.
|
|
31
|
-
'keyword-spacing': ["error", {
|
|
32
|
-
"overrides": {
|
|
33
|
-
"if": { "after": false },
|
|
34
|
-
"for": { "after": false },
|
|
35
|
-
"while": { "after": false }
|
|
36
|
-
}
|
|
37
|
-
}],
|
|
38
|
-
// Use alternative brace style
|
|
39
|
-
'brace-style': ['error', 'stroustrup'],
|
|
40
|
-
// No spaces before parens
|
|
41
|
-
'space-before-function-paren': ['error', 'never'],
|
|
42
|
-
// Indent for tabs because spaces suck
|
|
43
|
-
'indent': ['error', 4],
|
|
44
|
-
// Semi colons always where they need to be
|
|
45
|
-
'semi': [2,'always'],
|
|
46
|
-
// allow paren-less arrow functions
|
|
47
|
-
'arrow-parens': 0,
|
|
48
|
-
// allow async-await
|
|
49
|
-
'generator-star-spacing': 0,
|
|
50
|
-
// allow debugger during development
|
|
51
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
|
|
52
|
-
}
|
|
53
|
-
}
|