@vue-interface/tooltip 1.0.0-beta.8 → 2.0.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.js DELETED
@@ -1,193 +0,0 @@
1
- import { defineComponent as $, openBlock as A, createElementBlock as S, normalizeClass as N, createElementVNode as _, renderSlot as O, createTextVNode as L, toDisplayString as j, h as B, render as C } from "vue";
2
- import { createPopper as P } from "@popperjs/core";
3
- const I = $({
4
- props: {
5
- offset: {
6
- type: Array,
7
- default: void 0
8
- },
9
- popper: {
10
- type: Object,
11
- default: void 0
12
- },
13
- target: {
14
- type: Element,
15
- required: !0
16
- },
17
- title: {
18
- type: String,
19
- default: void 0
20
- },
21
- show: Boolean,
22
- top: Boolean,
23
- bottom: Boolean,
24
- left: Boolean,
25
- right: Boolean
26
- },
27
- data() {
28
- return {
29
- currentShow: !1,
30
- popperInstance: null
31
- };
32
- },
33
- computed: {
34
- computedPlacement() {
35
- return this.placement ? this.placement : this.bottom ? "bottom" : this.left ? "left" : this.right ? "right" : "top";
36
- },
37
- tooltipClasses() {
38
- return {
39
- show: this.currentShow,
40
- [`bs-tooltip-${this.computedPlacement}`]: !0
41
- };
42
- }
43
- },
44
- mounted() {
45
- this.popperInstance = P(this.target, this.$el, Object.assign({
46
- placement: this.computedPlacement,
47
- modifiers: [
48
- {
49
- name: "offset",
50
- options: {
51
- offset: [0, 6]
52
- }
53
- },
54
- {
55
- name: "arrow",
56
- options: {
57
- element: this.$refs.arrow
58
- }
59
- }
60
- ]
61
- }, this.popper)), this.$nextTick(() => {
62
- this.currentShow = this.show;
63
- });
64
- },
65
- beforeUnmount() {
66
- this.popperInstance && this.popperInstance.destroy();
67
- },
68
- methods: {
69
- open() {
70
- this.currentShow = !0;
71
- },
72
- close() {
73
- this.currentShow = !1;
74
- }
75
- }
76
- }), R = $({
77
- mixins: [
78
- I
79
- ]
80
- });
81
- const k = (s, d) => {
82
- const p = s.__vccOpts || s;
83
- for (const [a, n] of d)
84
- p[a] = n;
85
- return p;
86
- }, F = {
87
- ref: "arrow",
88
- class: "tooltip-arrow"
89
- }, M = {
90
- ref: "inner",
91
- class: "tooltip-inner"
92
- };
93
- function U(s, d, p, a, n, m) {
94
- return A(), S("div", {
95
- class: N(["tooltip", s.tooltipClasses]),
96
- role: "tooltip"
97
- }, [
98
- _("div", F, null, 512),
99
- _("div", M, [
100
- O(s.$slots, "default", {}, () => [
101
- L(j(s.title), 1)
102
- ])
103
- ], 512)
104
- ], 2);
105
- }
106
- const q = /* @__PURE__ */ k(R, [["render", U]]);
107
- function W(s, d = {}) {
108
- const p = /* @__PURE__ */ new Map(), a = Object.assign({
109
- delay: void 0,
110
- prefix: "data-tooltip",
111
- triggers: {
112
- open: ["mouseover:350"],
113
- close: ["mouseout:100"]
114
- }
115
- }, d), n = a.prefix.replace(/[-]+$/, ""), m = new RegExp(`^${n}-`);
116
- function w(e) {
117
- return Array.from(e.attributes).map((t) => [t.name, t.value]).filter(([t]) => t === "title" || t.match(m)).map(([t, o]) => [t.replace(new RegExp(m), ""), o]).reduce((t, o) => Object.assign(t, { [o[0]]: o[1] }), {});
118
- }
119
- function T(e, t = {}, o) {
120
- const i = document.createElement("template"), r = B(q, Object.assign({
121
- target: e,
122
- show: !0
123
- }, t));
124
- C(r, i);
125
- const [l] = [...i.children];
126
- return document.body.append(l), () => {
127
- var u;
128
- p.delete(o), (u = r.component) == null || u.ctx.close(), setTimeout(() => l.remove(), 150);
129
- };
130
- }
131
- function h(e, t = {}) {
132
- var b, v;
133
- const o = Object.assign({
134
- title: e.getAttribute(n)
135
- }, t, w(e));
136
- if (!o.title || e.hasAttribute(`${n}-id`))
137
- return;
138
- const i = Math.random().toString(36).slice(2, 7);
139
- let r, l;
140
- e.setAttribute(`${n}-id`, i), e.removeAttribute("title");
141
- function u(c = 0) {
142
- clearTimeout(l), r || (l = setTimeout(() => {
143
- document.contains(e) && (r = T(e, o, i), p.set(i, r));
144
- }, c));
145
- }
146
- function f(c = 0) {
147
- clearTimeout(l), r && (l = setTimeout(() => {
148
- r && r(), r = null;
149
- }, c));
150
- }
151
- function g(c, E) {
152
- const [x, y] = c.split(":");
153
- e.addEventListener(x, () => E(Number(y || 0)));
154
- }
155
- (((b = e.getAttribute(`${n}-trigger-open`)) == null ? void 0 : b.split(",")) || a.triggers.open).map((c) => g(c, u)), (((v = e.getAttribute(`${n}-trigger-close`)) == null ? void 0 : v.split(",")) || a.triggers.close).map((c) => g(c, f));
156
- }
157
- s.mixin({
158
- mounted() {
159
- let e = this.$el;
160
- this.$el instanceof Text && (e = this.$el.parentNode), e instanceof HTMLElement && h(e);
161
- const t = document.createTreeWalker(
162
- e,
163
- NodeFilter.SHOW_ALL,
164
- (i) => i instanceof Element ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
165
- );
166
- for (; t.nextNode(); )
167
- t.currentNode instanceof Element && h(t.currentNode);
168
- new MutationObserver((i) => {
169
- for (const { removedNodes: r } of i)
170
- for (const l of r)
171
- for (const u of l.querySelectorAll(`[${n}-id]`)) {
172
- const f = p.get(
173
- u.getAttribute(`${n}-id`)
174
- );
175
- f && f();
176
- }
177
- }).observe(e, { childList: !0 });
178
- }
179
- }), s.directive("tooltip", {
180
- created(e, t) {
181
- h(e, Object.assign({}, t.modifiers, t.value));
182
- },
183
- beforeUnmount(e) {
184
- const t = e.getAttribute(`${n}-id`), o = p.get(t);
185
- console.log("beforeUnmount"), o && o();
186
- }
187
- });
188
- }
189
- export {
190
- q as Tooltip,
191
- W as TooltipPlugin
192
- };
193
- //# sourceMappingURL=tooltip.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tooltip.js","sources":["../src/Popper.ts","../src/Tooltip.vue","../src/TooltipPlugin.ts"],"sourcesContent":["import { createPopper } from '@popperjs/core';\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n\n props: {\n offset: {\n type: Array,\n default: undefined\n },\n\n popper: {\n type: Object,\n default: undefined\n },\n\n target: {\n type: Element,\n required: true\n },\n\n title: {\n type: String,\n default: undefined\n },\n \n show: Boolean,\n \n top: Boolean,\n\n bottom: Boolean,\n\n left: Boolean,\n\n right: Boolean,\n },\n\n // props: {\n // // offset: {\n // // type: Array,\n // // default: undefined\n // // },\n\n // // popper: {\n // // type: Object,\n // // default: undefined\n // // },\n\n // // show: Boolean,\n\n // // target: {\n // // type: HTMLElement,\n // // required: true\n // // },\n\n // // title: {\n // // type: String,\n // // default: undefined\n // // },\n\n // // placement: {\n // // type: String,\n // // default: undefined\n // // },\n\n // // top: Boolean,\n\n // // bottom: Boolean,\n\n // // left: Boolean,\n\n // // right: Boolean,\n // },\n \n data() {\n return {\n currentShow: false,\n popperInstance: null\n };\n },\n\n computed: {\n computedPlacement() {\n if(this.placement) {\n return this.placement;\n }\n\n if(this.bottom) {\n return 'bottom';\n }\n\n if(this.left) {\n return 'left';\n }\n\n if(this.right) {\n return 'right';\n }\n\n return 'top';\n },\n tooltipClasses() {\n return {\n show: this.currentShow,\n [`bs-tooltip-${this.computedPlacement}`]: true\n };\n }\n },\n\n mounted() {\n this.popperInstance = createPopper(this.target, this.$el, Object.assign({\n placement: this.computedPlacement,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 6]\n },\n },\n {\n name: 'arrow',\n options: {\n element: this.$refs.arrow,\n },\n },\n ],\n }, this.popper));\n\n this.$nextTick(() => {\n this.currentShow = this.show;\n });\n },\n\n beforeUnmount() {\n this.popperInstance && this.popperInstance.destroy();\n },\n\n methods: {\n\n open() {\n this.currentShow = true;\n },\n\n close() {\n this.currentShow = false;\n }\n\n }\n\n});","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport Popper from './Popper';\n\nexport default defineComponent({\n mixins: [\n Popper\n ]\n});\n</script>\n\n<template>\n <div\n class=\"tooltip\"\n :class=\"tooltipClasses\"\n role=\"tooltip\">\n <div\n ref=\"arrow\"\n class=\"tooltip-arrow\" />\n <div\n ref=\"inner\"\n class=\"tooltip-inner\">\n <slot>{{ title }}</slot>\n </div>\n </div>\n</template>\n\n<style>\n.tooltip:not(.show) {\n z-index: -1;\n}\n</style>","import type { App } from 'vue';\nimport { h, render } from 'vue';\nimport Tooltip from './Tooltip.vue';\n\ntype TooltipPluginOptions = {\n delay?: number,\n prefix: string,\n triggers: {\n open: string[],\n close: string[],\n }\n}\n\nexport default function (app: App, opts: Partial<TooltipPluginOptions> = {}) {\n const tooltips: Map<string,Function> = new Map;\n\n const options: TooltipPluginOptions = Object.assign({\n delay: undefined,\n prefix: 'data-tooltip',\n triggers: {\n open: ['mouseover:350'],\n close: ['mouseout:100'],\n }\n }, opts);\n\n const prefix = options.prefix.replace(/[-]+$/, '');\n const prefixRegExp = new RegExp(`^${prefix}\\-`);\n\n function getAttributes(el: Element): Record<string,any> {\n return Array.from(el.attributes)\n .map(a => [a.name, a.value])\n .filter(([key]) => key === 'title' || key.match(prefixRegExp))\n .map(([key, value]) => [key.replace(new RegExp(prefixRegExp), ''), value])\n .reduce((carry, attr) => Object.assign(carry, { [attr[0]]: attr[1] }), {});\n }\n\n function createTooltip(target: Element, props: Record<string,any> = {}, hash: string): Function {\n const container = document.createElement('template');\n \n const vnode = h(Tooltip, Object.assign({\n target,\n show: true\n }, props));\n \n render(vnode, container);\n \n const [el] = [...container.children];\n \n document.body.append(el);\n \n return () => {\n tooltips.delete(hash);\n\n // @ts-ignore\n vnode.component?.ctx.close();\n \n // @todo: Make the animation rate (150) dynamic. Should get value \n // from the CSS transition duration.\n setTimeout(() => el.remove(), 150);\n };\n }\n\n function init(target: Element, props = {}) {\n const properties: Record<string,any> = Object.assign({\n title: target.getAttribute(prefix)\n }, props, getAttributes(target));\n\n // If the properties don't have a title, ignore this target.\n if(!properties.title || target.hasAttribute(`${prefix}-id`)) {\n return;\n }\n\n // Create a unique \"hash\" to show the node has been initialized.\n // This prevents double initializing on the same element.\n const hash = Math.random().toString(36).slice(2, 7);\n \n // Create the instance vars.\n let tooltip: Function|null, timer: number;\n\n //target.setAttribute(prefix, properties.title);\n target.setAttribute(`${prefix}-id`, hash);\n target.removeAttribute('title');\n\n function open(delay = 0) {\n clearTimeout(timer);\n\n if(!tooltip) {\n timer = setTimeout(() => {\n // Do a check before creating the tooltip to ensure the dom\n // element still exists. Its possible for the element to\n // be removed after the timeout delay runs.\n if(document.contains(target)) {\n tooltip = createTooltip(target, properties, hash);\n tooltips.set(hash, tooltip);\n }\n }, delay);\n }\n }\n\n function close(delay = 0) {\n clearTimeout(timer);\n\n if(tooltip) {\n timer = setTimeout(() => {\n tooltip && tooltip();\n tooltip = null;\n }, delay);\n } \n }\n\n function addEventListener(trigger: string, fn: Function) {\n const [ event, delayString ] = trigger.split(':');\n\n target.addEventListener(event, () => fn(Number(delayString || 0)));\n }\n\n (target.getAttribute(`${prefix}-trigger-open`)?.split(',') || options.triggers.open)\n .map(trigger => addEventListener(trigger, open));\n \n (target.getAttribute(`${prefix}-trigger-close`)?.split(',') || options.triggers.close)\n .map(trigger => addEventListener(trigger, close));\n }\n \n app.mixin({\n mounted() {\n let el = this.$el;\n\n if(this.$el instanceof Text) {\n el = this.$el.parentNode;\n }\n\n if(el instanceof HTMLElement) {\n init(el);\n }\n\n // Create the tree walker.\n const walker = document.createTreeWalker(\n el,\n NodeFilter.SHOW_ALL,\n (node: Node) => {\n if(!(node instanceof Element)) {\n return NodeFilter.FILTER_REJECT;\n }\n \n return NodeFilter.FILTER_ACCEPT;\n }\n );\n\n // Step through and alert all child nodes\n while(walker.nextNode()) {\n if(walker.currentNode instanceof Element) {\n init(<Element> walker.currentNode);\n }\n }\n\n const observer = new MutationObserver((changes) => {\n for(const { removedNodes } of changes) {\n for(const node of removedNodes) {\n for(const el of (node as Element).querySelectorAll(`[${prefix}-id]`)) {\n const tooltip = tooltips.get(\n el.getAttribute(`${prefix}-id`) as string\n );\n\n tooltip && tooltip();\n }\n } \n }\n });\n\n observer.observe(el, { childList: true });\n }\n });\n\n app.directive('tooltip', {\n created(target, binding) {\n init(target, Object.assign({}, binding.modifiers, binding.value));\n },\n beforeUnmount(target) {\n const id = target.getAttribute(`${prefix}-id`);\n const tooltip = tooltips.get(id);\n\n console.log('beforeUnmount');\n\n tooltip && tooltip();\n }\n });\n}"],"names":["Popper","defineComponent","createPopper","_sfc_main","_hoisted_1","_hoisted_2","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","TooltipPlugin","app","opts","tooltips","options","prefix","prefixRegExp","getAttributes","el","a","key","value","carry","attr","createTooltip","target","props","hash","container","vnode","h","Tooltip","render","_a","init","properties","tooltip","timer","open","delay","close","addEventListener","trigger","fn","event","delayString","_b","walker","node","changes","removedNodes","binding","id"],"mappings":";;AAGA,MAAAA,IAAeC,EAAgB;AAAA,EAE3B,OAAO;AAAA,IACH,QAAQ;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IACb;AAAA,IAEA,QAAQ;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IACb;AAAA,IAEA,QAAQ;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,IACd;AAAA,IAEA,OAAO;AAAA,MACH,MAAM;AAAA,MACN,SAAS;AAAA,IACb;AAAA,IAEA,MAAM;AAAA,IAEN,KAAK;AAAA,IAEL,QAAQ;AAAA,IAER,MAAM;AAAA,IAEN,OAAO;AAAA,EACX;AAAA,EAuCA,OAAO;AACI,WAAA;AAAA,MACH,aAAa;AAAA,MACb,gBAAgB;AAAA,IAAA;AAAA,EAExB;AAAA,EAEA,UAAU;AAAA,IACN,oBAAoB;AAChB,aAAG,KAAK,YACG,KAAK,YAGb,KAAK,SACG,WAGR,KAAK,OACG,SAGR,KAAK,QACG,UAGJ;AAAA,IACX;AAAA,IACA,iBAAiB;AACN,aAAA;AAAA,QACH,MAAM,KAAK;AAAA,QACX,CAAC,cAAc,KAAK,sBAAsB;AAAA,MAAA;AAAA,IAElD;AAAA,EACJ;AAAA,EAEA,UAAU;AACN,SAAK,iBAAiB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ACN,UAAIO,IAAK,KAAK;AAEX,MAAA,KAAK,eAAe,SACnBA,IAAK,KAAK,IAAI,aAGfA,aAAc,eACbgB,EAAKhB,CAAE;AAIX,YAAM6B,IAAS,SAAS;AAAA,QACpB7B;AAAA,QACA,WAAW;AAAA,QACX,CAAC8B,MACQA,aAAgB,UAId,WAAW,gBAHP,WAAW;AAAA,MAI1B;AAIE,aAAAD,EAAO;AACN,QAAAA,EAAO,uBAAuB,WAC7Bb,EAAea,EAAO,WAAW;AAkBzC,MAdiB,IAAI,iBAAiB,CAACE,MAAY;AACrC,mBAAA,EAAE,cAAAC,EAAa,KAAKD;AAC1B,qBAAUD,KAAQE;AACd,uBAAUhC,KAAO8B,EAAiB,iBAAiB,IAAIjC,OAAY,GAAG;AAClE,oBAAMqB,IAAUvB,EAAS;AAAA,gBACrBK,EAAG,aAAa,GAAGH,MAAW;AAAA,cAAA;AAGlC,cAAAqB,KAAWA,EAAQ;AAAA,YACvB;AAAA,MAER,CACH,EAEQ,QAAQlB,GAAI,EAAE,WAAW,GAAM,CAAA;AAAA,IAC5C;AAAA,EAAA,CACH,GAEDP,EAAI,UAAU,WAAW;AAAA,IACrB,QAAQc,GAAQ0B,GAAS;AAChB,MAAAjB,EAAAT,GAAQ,OAAO,OAAO,CAAA,GAAI0B,EAAQ,WAAWA,EAAQ,KAAK,CAAC;AAAA,IACpE;AAAA,IACA,cAAc1B,GAAQ;AAClB,YAAM2B,IAAK3B,EAAO,aAAa,GAAGV,MAAW,GACvCqB,IAAUvB,EAAS,IAAIuC,CAAE;AAE/B,cAAQ,IAAI,eAAe,GAE3BhB,KAAWA,EAAQ;AAAA,IACvB;AAAA,EAAA,CACH;AACL;"}
@@ -1,2 +0,0 @@
1
- (function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("@popperjs/core")):typeof define=="function"&&define.amd?define(["exports","vue","@popperjs/core"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l.Tooltip={},l.Vue,l.PopperjsCore))})(this,function(l,o,w){"use strict";const E=o.defineComponent({props:{offset:{type:Array,default:void 0},popper:{type:Object,default:void 0},target:{type:Element,required:!0},title:{type:String,default:void 0},show:Boolean,top:Boolean,bottom:Boolean,left:Boolean,right:Boolean},data(){return{currentShow:!1,popperInstance:null}},computed:{computedPlacement(){return this.placement?this.placement:this.bottom?"bottom":this.left?"left":this.right?"right":"top"},tooltipClasses(){return{show:this.currentShow,[`bs-tooltip-${this.computedPlacement}`]:!0}}},mounted(){this.popperInstance=w.createPopper(this.target,this.$el,Object.assign({placement:this.computedPlacement,modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"arrow",options:{element:this.$refs.arrow}}]},this.popper)),this.$nextTick(()=>{this.currentShow=this.show})},beforeUnmount(){this.popperInstance&&this.popperInstance.destroy()},methods:{open(){this.currentShow=!0},close(){this.currentShow=!1}}}),y=o.defineComponent({mixins:[E]}),I="",x=(c,m)=>{const a=c.__vccOpts||c;for(const[d,i]of m)a[d]=i;return a},A={ref:"arrow",class:"tooltip-arrow"},S={ref:"inner",class:"tooltip-inner"};function j(c,m,a,d,i,g){return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["tooltip",c.tooltipClasses]),role:"tooltip"},[o.createElementVNode("div",A,null,512),o.createElementVNode("div",S,[o.renderSlot(c.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(c.title),1)])],512)],2)}const T=x(y,[["render",j]]);function N(c,m={}){const a=new Map,d=Object.assign({delay:void 0,prefix:"data-tooltip",triggers:{open:["mouseover:350"],close:["mouseout:100"]}},m),i=d.prefix.replace(/[-]+$/,""),g=new RegExp(`^${i}-`);function O(e){return Array.from(e.attributes).map(t=>[t.name,t.value]).filter(([t])=>t==="title"||t.match(g)).map(([t,n])=>[t.replace(new RegExp(g),""),n]).reduce((t,n)=>Object.assign(t,{[n[0]]:n[1]}),{})}function P(e,t={},n){const s=document.createElement("template"),r=o.h(T,Object.assign({target:e,show:!0},t));o.render(r,s);const[p]=[...s.children];return document.body.append(p),()=>{var f;a.delete(n),(f=r.component)==null||f.ctx.close(),setTimeout(()=>p.remove(),150)}}function b(e,t={}){var $,v;const n=Object.assign({title:e.getAttribute(i)},t,O(e));if(!n.title||e.hasAttribute(`${i}-id`))return;const s=Math.random().toString(36).slice(2,7);let r,p;e.setAttribute(`${i}-id`,s),e.removeAttribute("title");function f(u=0){clearTimeout(p),r||(p=setTimeout(()=>{document.contains(e)&&(r=P(e,n,s),a.set(s,r))},u))}function h(u=0){clearTimeout(p),r&&(p=setTimeout(()=>{r&&r(),r=null},u))}function _(u,C){const[L,B]=u.split(":");e.addEventListener(L,()=>C(Number(B||0)))}((($=e.getAttribute(`${i}-trigger-open`))==null?void 0:$.split(","))||d.triggers.open).map(u=>_(u,f)),(((v=e.getAttribute(`${i}-trigger-close`))==null?void 0:v.split(","))||d.triggers.close).map(u=>_(u,h))}c.mixin({mounted(){let e=this.$el;this.$el instanceof Text&&(e=this.$el.parentNode),e instanceof HTMLElement&&b(e);const t=document.createTreeWalker(e,NodeFilter.SHOW_ALL,s=>s instanceof Element?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);for(;t.nextNode();)t.currentNode instanceof Element&&b(t.currentNode);new MutationObserver(s=>{for(const{removedNodes:r}of s)for(const p of r)for(const f of p.querySelectorAll(`[${i}-id]`)){const h=a.get(f.getAttribute(`${i}-id`));h&&h()}}).observe(e,{childList:!0})}}),c.directive("tooltip",{created(e,t){b(e,Object.assign({},t.modifiers,t.value))},beforeUnmount(e){const t=e.getAttribute(`${i}-id`),n=a.get(t);console.log("beforeUnmount"),n&&n()}})}l.Tooltip=T,l.TooltipPlugin=N,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
- //# sourceMappingURL=tooltip.umd.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tooltip.umd.cjs","sources":["../src/Popper.ts","../src/Tooltip.vue","../src/TooltipPlugin.ts"],"sourcesContent":["import { createPopper } from '@popperjs/core';\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n\n props: {\n offset: {\n type: Array,\n default: undefined\n },\n\n popper: {\n type: Object,\n default: undefined\n },\n\n target: {\n type: Element,\n required: true\n },\n\n title: {\n type: String,\n default: undefined\n },\n \n show: Boolean,\n \n top: Boolean,\n\n bottom: Boolean,\n\n left: Boolean,\n\n right: Boolean,\n },\n\n // props: {\n // // offset: {\n // // type: Array,\n // // default: undefined\n // // },\n\n // // popper: {\n // // type: Object,\n // // default: undefined\n // // },\n\n // // show: Boolean,\n\n // // target: {\n // // type: HTMLElement,\n // // required: true\n // // },\n\n // // title: {\n // // type: String,\n // // default: undefined\n // // },\n\n // // placement: {\n // // type: String,\n // // default: undefined\n // // },\n\n // // top: Boolean,\n\n // // bottom: Boolean,\n\n // // left: Boolean,\n\n // // right: Boolean,\n // },\n \n data() {\n return {\n currentShow: false,\n popperInstance: null\n };\n },\n\n computed: {\n computedPlacement() {\n if(this.placement) {\n return this.placement;\n }\n\n if(this.bottom) {\n return 'bottom';\n }\n\n if(this.left) {\n return 'left';\n }\n\n if(this.right) {\n return 'right';\n }\n\n return 'top';\n },\n tooltipClasses() {\n return {\n show: this.currentShow,\n [`bs-tooltip-${this.computedPlacement}`]: true\n };\n }\n },\n\n mounted() {\n this.popperInstance = createPopper(this.target, this.$el, Object.assign({\n placement: this.computedPlacement,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 6]\n },\n },\n {\n name: 'arrow',\n options: {\n element: this.$refs.arrow,\n },\n },\n ],\n }, this.popper));\n\n this.$nextTick(() => {\n this.currentShow = this.show;\n });\n },\n\n beforeUnmount() {\n this.popperInstance && this.popperInstance.destroy();\n },\n\n methods: {\n\n open() {\n this.currentShow = true;\n },\n\n close() {\n this.currentShow = false;\n }\n\n }\n\n});","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport Popper from './Popper';\n\nexport default defineComponent({\n mixins: [\n Popper\n ]\n});\n</script>\n\n<template>\n <div\n class=\"tooltip\"\n :class=\"tooltipClasses\"\n role=\"tooltip\">\n <div\n ref=\"arrow\"\n class=\"tooltip-arrow\" />\n <div\n ref=\"inner\"\n class=\"tooltip-inner\">\n <slot>{{ title }}</slot>\n </div>\n </div>\n</template>\n\n<style>\n.tooltip:not(.show) {\n z-index: -1;\n}\n</style>","import type { App } from 'vue';\nimport { h, render } from 'vue';\nimport Tooltip from './Tooltip.vue';\n\ntype TooltipPluginOptions = {\n delay?: number,\n prefix: string,\n triggers: {\n open: string[],\n close: string[],\n }\n}\n\nexport default function (app: App, opts: Partial<TooltipPluginOptions> = {}) {\n const tooltips: Map<string,Function> = new Map;\n\n const options: TooltipPluginOptions = Object.assign({\n delay: undefined,\n prefix: 'data-tooltip',\n triggers: {\n open: ['mouseover:350'],\n close: ['mouseout:100'],\n }\n }, opts);\n\n const prefix = options.prefix.replace(/[-]+$/, '');\n const prefixRegExp = new RegExp(`^${prefix}\\-`);\n\n function getAttributes(el: Element): Record<string,any> {\n return Array.from(el.attributes)\n .map(a => [a.name, a.value])\n .filter(([key]) => key === 'title' || key.match(prefixRegExp))\n .map(([key, value]) => [key.replace(new RegExp(prefixRegExp), ''), value])\n .reduce((carry, attr) => Object.assign(carry, { [attr[0]]: attr[1] }), {});\n }\n\n function createTooltip(target: Element, props: Record<string,any> = {}, hash: string): Function {\n const container = document.createElement('template');\n \n const vnode = h(Tooltip, Object.assign({\n target,\n show: true\n }, props));\n \n render(vnode, container);\n \n const [el] = [...container.children];\n \n document.body.append(el);\n \n return () => {\n tooltips.delete(hash);\n\n // @ts-ignore\n vnode.component?.ctx.close();\n \n // @todo: Make the animation rate (150) dynamic. Should get value \n // from the CSS transition duration.\n setTimeout(() => el.remove(), 150);\n };\n }\n\n function init(target: Element, props = {}) {\n const properties: Record<string,any> = Object.assign({\n title: target.getAttribute(prefix)\n }, props, getAttributes(target));\n\n // If the properties don't have a title, ignore this target.\n if(!properties.title || target.hasAttribute(`${prefix}-id`)) {\n return;\n }\n\n // Create a unique \"hash\" to show the node has been initialized.\n // This prevents double initializing on the same element.\n const hash = Math.random().toString(36).slice(2, 7);\n \n // Create the instance vars.\n let tooltip: Function|null, timer: number;\n\n //target.setAttribute(prefix, properties.title);\n target.setAttribute(`${prefix}-id`, hash);\n target.removeAttribute('title');\n\n function open(delay = 0) {\n clearTimeout(timer);\n\n if(!tooltip) {\n timer = setTimeout(() => {\n // Do a check before creating the tooltip to ensure the dom\n // element still exists. Its possible for the element to\n // be removed after the timeout delay runs.\n if(document.contains(target)) {\n tooltip = createTooltip(target, properties, hash);\n tooltips.set(hash, tooltip);\n }\n }, delay);\n }\n }\n\n function close(delay = 0) {\n clearTimeout(timer);\n\n if(tooltip) {\n timer = setTimeout(() => {\n tooltip && tooltip();\n tooltip = null;\n }, delay);\n } \n }\n\n function addEventListener(trigger: string, fn: Function) {\n const [ event, delayString ] = trigger.split(':');\n\n target.addEventListener(event, () => fn(Number(delayString || 0)));\n }\n\n (target.getAttribute(`${prefix}-trigger-open`)?.split(',') || options.triggers.open)\n .map(trigger => addEventListener(trigger, open));\n \n (target.getAttribute(`${prefix}-trigger-close`)?.split(',') || options.triggers.close)\n .map(trigger => addEventListener(trigger, close));\n }\n \n app.mixin({\n mounted() {\n let el = this.$el;\n\n if(this.$el instanceof Text) {\n el = this.$el.parentNode;\n }\n\n if(el instanceof HTMLElement) {\n init(el);\n }\n\n // Create the tree walker.\n const walker = document.createTreeWalker(\n el,\n NodeFilter.SHOW_ALL,\n (node: Node) => {\n if(!(node instanceof Element)) {\n return NodeFilter.FILTER_REJECT;\n }\n \n return NodeFilter.FILTER_ACCEPT;\n }\n );\n\n // Step through and alert all child nodes\n while(walker.nextNode()) {\n if(walker.currentNode instanceof Element) {\n init(<Element> walker.currentNode);\n }\n }\n\n const observer = new MutationObserver((changes) => {\n for(const { removedNodes } of changes) {\n for(const node of removedNodes) {\n for(const el of (node as Element).querySelectorAll(`[${prefix}-id]`)) {\n const tooltip = tooltips.get(\n el.getAttribute(`${prefix}-id`) as string\n );\n\n tooltip && tooltip();\n }\n } \n }\n });\n\n observer.observe(el, { childList: true });\n }\n });\n\n app.directive('tooltip', {\n created(target, binding) {\n init(target, Object.assign({}, binding.modifiers, binding.value));\n },\n beforeUnmount(target) {\n const id = target.getAttribute(`${prefix}-id`);\n const tooltip = tooltips.get(id);\n\n console.log('beforeUnmount');\n\n tooltip && tooltip();\n }\n });\n}"],"names":["Popper","defineComponent","createPopper","_sfc_main","_hoisted_1","_hoisted_2","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","TooltipPlugin","app","opts","tooltips","options","prefix","prefixRegExp","getAttributes","el","a","key","value","carry","attr","createTooltip","target","props","hash","container","vnode","h","Tooltip","render","_a","init","properties","tooltip","timer","open","delay","close","addEventListener","trigger","fn","event","delayString","_b","walker","node","changes","removedNodes","binding","id"],"mappings":"wTAGA,MAAAA,EAAeC,kBAAgB,CAE3B,MAAO,CACH,OAAQ,CACJ,KAAM,MACN,QAAS,MACb,EAEA,OAAQ,CACJ,KAAM,OACN,QAAS,MACb,EAEA,OAAQ,CACJ,KAAM,QACN,SAAU,EACd,EAEA,MAAO,CACH,KAAM,OACN,QAAS,MACb,EAEA,KAAM,QAEN,IAAK,QAEL,OAAQ,QAER,KAAM,QAEN,MAAO,OACX,EAuCA,MAAO,CACI,MAAA,CACH,YAAa,GACb,eAAgB,IAAA,CAExB,EAEA,SAAU,CACN,mBAAoB,CAChB,OAAG,KAAK,UACG,KAAK,UAGb,KAAK,OACG,SAGR,KAAK,KACG,OAGR,KAAK,MACG,QAGJ,KACX,EACA,gBAAiB,CACN,MAAA,CACH,KAAM,KAAK,YACX,CAAC,cAAc,KAAK,qBAAsB,EAAA,CAElD,CACJ,EAEA,SAAU,CACN,KAAK,eAAiBC,EAAAA,aAAa,KAAK,OAAQ,KAAK,IAAK,OAAO,OAAO,CACpE,UAAW,KAAK,kBAChB,UAAW,CACP,CACI,KAAM,SACN,QAAS,C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AER,CACH,EAEQ,QAAQlB,EAAI,CAAE,UAAW,EAAM,CAAA,CAC5C,CAAA,CACH,EAEDP,EAAI,UAAU,UAAW,CACrB,QAAQc,EAAQ0B,EAAS,CAChBjB,EAAAT,EAAQ,OAAO,OAAO,CAAA,EAAI0B,EAAQ,UAAWA,EAAQ,KAAK,CAAC,CACpE,EACA,cAAc1B,EAAQ,CAClB,MAAM2B,EAAK3B,EAAO,aAAa,GAAGV,MAAW,EACvCqB,EAAUvB,EAAS,IAAIuC,CAAE,EAE/B,QAAQ,IAAI,eAAe,EAE3BhB,GAAWA,EAAQ,CACvB,CAAA,CACH,CACL"}
package/dist/vite.d.ts DELETED
@@ -1,5 +0,0 @@
1
- declare module '*.vue' {
2
- import { DefineComponent } from 'vue';
3
- const component: DefineComponent;
4
- export default component;
5
- }
package/src/Popper.ts DELETED
@@ -1,150 +0,0 @@
1
- import { createPopper } from '@popperjs/core';
2
- import { defineComponent } from 'vue';
3
-
4
- export default defineComponent({
5
-
6
- props: {
7
- offset: {
8
- type: Array,
9
- default: undefined
10
- },
11
-
12
- popper: {
13
- type: Object,
14
- default: undefined
15
- },
16
-
17
- target: {
18
- type: Element,
19
- required: true
20
- },
21
-
22
- title: {
23
- type: String,
24
- default: undefined
25
- },
26
-
27
- show: Boolean,
28
-
29
- top: Boolean,
30
-
31
- bottom: Boolean,
32
-
33
- left: Boolean,
34
-
35
- right: Boolean,
36
- },
37
-
38
- // props: {
39
- // // offset: {
40
- // // type: Array,
41
- // // default: undefined
42
- // // },
43
-
44
- // // popper: {
45
- // // type: Object,
46
- // // default: undefined
47
- // // },
48
-
49
- // // show: Boolean,
50
-
51
- // // target: {
52
- // // type: HTMLElement,
53
- // // required: true
54
- // // },
55
-
56
- // // title: {
57
- // // type: String,
58
- // // default: undefined
59
- // // },
60
-
61
- // // placement: {
62
- // // type: String,
63
- // // default: undefined
64
- // // },
65
-
66
- // // top: Boolean,
67
-
68
- // // bottom: Boolean,
69
-
70
- // // left: Boolean,
71
-
72
- // // right: Boolean,
73
- // },
74
-
75
- data() {
76
- return {
77
- currentShow: false,
78
- popperInstance: null
79
- };
80
- },
81
-
82
- computed: {
83
- computedPlacement() {
84
- if(this.placement) {
85
- return this.placement;
86
- }
87
-
88
- if(this.bottom) {
89
- return 'bottom';
90
- }
91
-
92
- if(this.left) {
93
- return 'left';
94
- }
95
-
96
- if(this.right) {
97
- return 'right';
98
- }
99
-
100
- return 'top';
101
- },
102
- tooltipClasses() {
103
- return {
104
- show: this.currentShow,
105
- [`bs-tooltip-${this.computedPlacement}`]: true
106
- };
107
- }
108
- },
109
-
110
- mounted() {
111
- this.popperInstance = createPopper(this.target, this.$el, Object.assign({
112
- placement: this.computedPlacement,
113
- modifiers: [
114
- {
115
- name: 'offset',
116
- options: {
117
- offset: [0, 6]
118
- },
119
- },
120
- {
121
- name: 'arrow',
122
- options: {
123
- element: this.$refs.arrow,
124
- },
125
- },
126
- ],
127
- }, this.popper));
128
-
129
- this.$nextTick(() => {
130
- this.currentShow = this.show;
131
- });
132
- },
133
-
134
- beforeUnmount() {
135
- this.popperInstance && this.popperInstance.destroy();
136
- },
137
-
138
- methods: {
139
-
140
- open() {
141
- this.currentShow = true;
142
- },
143
-
144
- close() {
145
- this.currentShow = false;
146
- }
147
-
148
- }
149
-
150
- });
@@ -1,162 +0,0 @@
1
- const plugin = require('tailwindcss/plugin');
2
- const { colors } = require('tailwindcss/defaultTheme');
3
-
4
- module.exports = plugin(function({ addComponents, theme }) {
5
- const tooltipTop = {
6
- '.bs-tooltip-top': {
7
- padding: `${theme('tooltip.arrow.height')} 0`,
8
- },
9
-
10
- '.bs-tooltip-top .tooltip-arrow': {
11
- bottom: '1px',
12
- },
13
-
14
- '.bs-tooltip-top .tooltip-arrow::before': {
15
- bottom: '1px',
16
- borderWidth: `${theme('tooltip.arrow.height')} calc(${theme('tooltip.arrow.width')} / 2) 0`,
17
- borderTopColor: theme('tooltip.arrow.color'),
18
- }
19
- };
20
-
21
- const tooltipBottom = {
22
- '.bs-tooltip-bottom': {
23
- padding: `${theme('tooltip.arrow.height')} 0`,
24
- },
25
-
26
- '.bs-tooltip-bottom .tooltip-arrow': {
27
- top: '1px'
28
- },
29
-
30
- '.bs-tooltip-bottom .tooltip-arrow::before': {
31
- top: '1px',
32
- borderWidth: `0 calc(${theme('tooltip.arrow.width')} / 2) ${theme('tooltip.arrow.height')}`,
33
- borderBottomColor: theme('tooltip.arrow.color'),
34
- },
35
- };
36
-
37
- const tooltipLeft = {
38
- '.bs-tooltip-left': {
39
- padding: `0 ${theme('tooltip.arrow.height')}`
40
- },
41
-
42
- '.bs-tooltip-left .tooltip-arrow': {
43
- right: '1px',
44
- width: theme('tooltip.arrow.height'),
45
- height: theme('tooltip.arrow.width')
46
- },
47
-
48
- '.bs-tooltip-left .tooltip-arrow::before': {
49
- right: '1px',
50
- borderWidth: `calc(${theme('tooltip.arrow.width')} / 2) 0 calc(${theme('tooltip.arrow.width')} / 2) ${theme('tooltip.arrow.height')}`,
51
- borderLeftColor: theme('tooltip.arrow.color')
52
- }
53
- };
54
-
55
- const tooltipRight = {
56
- '.bs-tooltip-right': {
57
- padding: `0 ${theme('tooltip.arrow.height')}`
58
- },
59
-
60
- '.bs-tooltip-right .tooltip-arrow': {
61
- left: '1px',
62
- width: theme('tooltip.arrow.height'),
63
- height: theme('tooltip.arrow.width'),
64
- },
65
-
66
- '.bs-tooltip-right .tooltip-arrow::before': {
67
- left: '1px',
68
- borderWidth: `calc(${theme('tooltip.arrow.width')} / 2) ${theme('tooltip.arrow.height')} calc(${theme('tooltip.arrow.width')} / 2) 0`,
69
- borderRightColor: theme('tooltip.arrow.color'),
70
- }
71
- };
72
-
73
- const tooltip = {
74
- // Base class
75
- '.tooltip': {
76
- position: 'absolute',
77
- zIndex: theme('tooltip.zIndex'),
78
- display: 'block',
79
- margin: theme('tooltip.margin'),
80
- // Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
81
- // So reset our font and text properties to avoid inheriting weird values.
82
- fontSize: theme('tooltip.fontSize'),
83
- // Allow breaking very long words so they don't overflow the tooltip's bounds
84
- wordWrap: 'break-word',
85
- opacity: 0,
86
- transition: theme('tooltip.transition')
87
- },
88
-
89
- '.tooltip.show': { opacity: theme('tooltip.opacity') },
90
-
91
- '.tooltip .tooltip-arrow': {
92
- position: 'absolute',
93
- display: 'block',
94
- width: theme('tooltip.arrow.width'),
95
- height: theme('tooltip.arrow.height'),
96
- },
97
-
98
- '.tooltip .tooltip-arrow::before': {
99
- position: 'absolute',
100
- content: '""',
101
- borderColor: 'transparent',
102
- borderStyle: 'solid',
103
- },
104
-
105
- ...tooltipTop,
106
- ...tooltipBottom,
107
- ...tooltipLeft,
108
- ...tooltipRight,
109
-
110
- '.bs-tooltip-auto[x-placement^="top"]': {
111
- ...tooltipTop
112
- },
113
-
114
- '.bs-tooltip-auto[x-placement^="bottom"]': {
115
- ...tooltipBottom
116
- },
117
-
118
- '.bs-tooltip-auto[x-placement^="left"]': {
119
- ...tooltipLeft
120
- },
121
-
122
- '.bs-tooltip-auto[x-placement^="right"]': {
123
- ...tooltipRight
124
- },
125
-
126
- // Wrapper for the tooltip content
127
- '.tooltip-inner': {
128
- maxWidth: theme('tooltip.maxWidth'),
129
- padding: `${theme('tooltip.paddingY')} ${theme('tooltip.paddingX')}`,
130
- color: theme('tooltip.color'),
131
- textAlign: 'center',
132
- backgroundColor: theme('tooltip.backgroundColor'),
133
- borderRadius: theme('tooltip.borderRadius')
134
- }
135
- };
136
-
137
- addComponents(tooltip);
138
- }, {
139
- theme: {
140
- tooltip: theme => {
141
- return {
142
- fontSize: '.875rem',
143
- maxWidth: '200px',
144
- color: theme('colors.white', colors.white),
145
- backgroundColor: theme('colors.black', colors.black),
146
- borderRadius: '.25rem',
147
- opacity: .9,
148
- paddingY: '.25rem',
149
- paddingX: '.5rem',
150
- margin: 0,
151
- zIndex: theme('interface.zIndex.tooltip', 1070),
152
- transition: 'opacity .15s ease-out',
153
-
154
- arrow: {
155
- width: '.8rem',
156
- height: '.4rem',
157
- color: theme('colors.black', colors.black),
158
- }
159
- };
160
- }
161
- }
162
- });
@@ -1,12 +0,0 @@
1
- const plugin = require('tailwindcss/plugin');
2
- const { colors } = require('tailwindcss/defaultTheme');
3
-
4
- module.exports = () => [
5
- 'tooltip',
6
- 'tooltip-arrow',
7
- 'tooltip-inner',
8
- 'bs-tooltip-top',
9
- 'bs-tooltip-left',
10
- 'bs-tooltip-right',
11
- 'bs-tooltip-bottom',
12
- ]