@vue-interface/tooltip 1.0.0-beta.9 → 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,197 +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
- placement: {
14
- type: String,
15
- default: void 0
16
- },
17
- target: {
18
- type: Element,
19
- required: !0
20
- },
21
- title: {
22
- type: String,
23
- default: void 0
24
- },
25
- show: Boolean,
26
- top: Boolean,
27
- bottom: Boolean,
28
- left: Boolean,
29
- right: Boolean
30
- },
31
- data() {
32
- return {
33
- currentShow: !1,
34
- popperInstance: null
35
- };
36
- },
37
- computed: {
38
- computedPlacement() {
39
- return this.placement ? this.placement : this.bottom ? "bottom" : this.left ? "left" : this.right ? "right" : "top";
40
- },
41
- tooltipClasses() {
42
- return {
43
- show: this.currentShow,
44
- [`bs-tooltip-${this.computedPlacement}`]: !0
45
- };
46
- }
47
- },
48
- mounted() {
49
- this.popperInstance = P(this.target, this.$el, Object.assign({
50
- placement: this.computedPlacement,
51
- modifiers: [
52
- {
53
- name: "offset",
54
- options: {
55
- offset: [0, 6]
56
- }
57
- },
58
- {
59
- name: "arrow",
60
- options: {
61
- element: this.$refs.arrow
62
- }
63
- }
64
- ]
65
- }, this.popper)), this.$nextTick(() => {
66
- this.currentShow = this.show;
67
- });
68
- },
69
- beforeUnmount() {
70
- this.popperInstance && this.popperInstance.destroy();
71
- },
72
- methods: {
73
- open() {
74
- this.currentShow = !0;
75
- },
76
- close() {
77
- this.currentShow = !1;
78
- }
79
- }
80
- }), R = $({
81
- mixins: [
82
- I
83
- ]
84
- });
85
- const k = (s, d) => {
86
- const p = s.__vccOpts || s;
87
- for (const [a, n] of d)
88
- p[a] = n;
89
- return p;
90
- }, F = {
91
- ref: "arrow",
92
- class: "tooltip-arrow"
93
- }, M = {
94
- ref: "inner",
95
- class: "tooltip-inner"
96
- };
97
- function q(s, d, p, a, n, m) {
98
- return A(), S("div", {
99
- class: N(["tooltip", s.tooltipClasses]),
100
- role: "tooltip"
101
- }, [
102
- _("div", F, null, 512),
103
- _("div", M, [
104
- O(s.$slots, "default", {}, () => [
105
- L(j(s.title), 1)
106
- ])
107
- ], 512)
108
- ], 2);
109
- }
110
- const H = /* @__PURE__ */ k(R, [["render", q]]);
111
- function W(s, d = {}) {
112
- const p = /* @__PURE__ */ new Map(), a = Object.assign({
113
- delay: void 0,
114
- prefix: "data-tooltip",
115
- triggers: {
116
- open: ["mouseover:350"],
117
- close: ["mouseout:100"]
118
- }
119
- }, d), n = a.prefix.replace(/[-]+$/, ""), m = new RegExp(`^${n}-`);
120
- function w(e) {
121
- 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] }), {});
122
- }
123
- function T(e, t = {}, o) {
124
- const i = document.createElement("template"), r = B(H, Object.assign({
125
- target: e,
126
- show: !0
127
- }, t));
128
- C(r, i);
129
- const [l] = [...i.children];
130
- return document.body.append(l), () => {
131
- var u;
132
- p.delete(o), (u = r.component) == null || u.ctx.close(), setTimeout(() => l.remove(), 150);
133
- };
134
- }
135
- function h(e, t = {}) {
136
- var b, v;
137
- const o = Object.assign({
138
- title: e.getAttribute(n) || e.getAttribute("title")
139
- }, t, w(e));
140
- if (!o.title || e.hasAttribute(`${n}-id`))
141
- return;
142
- const i = Math.random().toString(36).slice(2, 7);
143
- let r, l;
144
- e.setAttribute(`${n}-id`, i);
145
- function u(c = 0) {
146
- clearTimeout(l), r || (l = setTimeout(() => {
147
- document.contains(e) && (r = T(e, o, i), p.set(i, r));
148
- }, c));
149
- }
150
- function f(c = 0) {
151
- clearTimeout(l), r && (l = setTimeout(() => {
152
- r && r(), r = null;
153
- }, c));
154
- }
155
- function g(c, E) {
156
- const [x, y] = c.split(":");
157
- e.addEventListener(x, () => E(Number(y || 0)));
158
- }
159
- (((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));
160
- }
161
- s.mixin({
162
- mounted() {
163
- let e = this.$el;
164
- this.$el instanceof Text && (e = this.$el.parentNode), e instanceof HTMLElement && h(e);
165
- const t = document.createTreeWalker(
166
- e,
167
- NodeFilter.SHOW_ALL,
168
- (i) => i instanceof Element ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
169
- );
170
- for (; t.nextNode(); )
171
- t.currentNode instanceof Element && h(t.currentNode);
172
- new MutationObserver((i) => {
173
- for (const { removedNodes: r } of i)
174
- for (const l of r)
175
- for (const u of l.querySelectorAll(`[${n}-id]`)) {
176
- const f = p.get(
177
- u.getAttribute(`${n}-id`)
178
- );
179
- f && f();
180
- }
181
- }).observe(e, { childList: !0 });
182
- }
183
- }), s.directive("tooltip", {
184
- beforeMount(e, t) {
185
- h(e, Object.assign({}, t.modifiers, t.value));
186
- },
187
- beforeUnmount(e) {
188
- const t = e.getAttribute(`${n}-id`), o = p.get(t);
189
- o && o();
190
- }
191
- });
192
- }
193
- export {
194
- H as Tooltip,
195
- W as TooltipPlugin
196
- };
197
- //# 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 placement: {\n type: String,\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 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) || target.getAttribute('title')\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 beforeMount(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 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,WAAW;AAAA,MACP,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,EAEA,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,iBAAiBC,EAAa,KAAK,QAAQ,KAAK,KAAK,OAAO,OAAO;AAAA,MACpE,WAAW,KAAK;AAAA,MAChB,WAAW;AAAA,QACP;AAAA,UACI,MAAM;AAAA,UACN,SAAS;AAAA,YACL,QAAQ,CAAC,GAAG,CAAC;AAAA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,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,YAAYc,GAAQ0B,GAAS;AACpB,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,MAAAhB,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 y=o.defineComponent({props:{offset:{type:Array,default:void 0},popper:{type:Object,default:void 0},placement:{type:String,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}}}),E=o.defineComponent({mixins:[y]}),M="",x=(c,m)=>{const a=c.__vccOpts||c;for(const[d,i]of m)a[d]=i;return a},S={ref:"arrow",class:"tooltip-arrow"},A={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",S,null,512),o.createElementVNode("div",A,[o.renderSlot(c.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(c.title),1)])],512)],2)}const T=x(E,[["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)||e.getAttribute("title")},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);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",{beforeMount(e,t){b(e,Object.assign({},t.modifiers,t.value))},beforeUnmount(e){const t=e.getAttribute(`${i}-id`),n=a.get(t);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 placement: {\n type: String,\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 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) || target.getAttribute('title')\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 beforeMount(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 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,UAAW,CACP,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,EAEA,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,CACL,OAAQ,CAAC,EAAG,CAAC,CACjB,CACJ,EACA,CACI,KAAM,QACN,QAAS,CACL,QAAS,KAAK,MAAM,KACxB,CACJ,CACJ,CAAA,EACD,KAAK,MAAM,CAAC,EAEf,KAAK,UAAU,IAAM,CACjB,KAAK,YAAc,KAAK,IAAA,CAC3B,CACL,EAEA,eAAgB,CACP,KAAA,gBAAkB,KAAK,eAAe,QAAQ,CACvD,EAEA,QAAS,CAEL,MAAO,CACH,KAAK,YAAc,EACvB,EAEA,OAAQ,CACJ,KAAK,YAAc,EACvB,CAEJ,CAEJ,CAAC,ECjHDC,EAAeF,kBAAgB,CAC3B,OAAQ,CACJD,C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declare module '*.vue' {
2
- import { DefineComponent } from 'vue';
3
- const component: DefineComponent;
4
- export default component;
5
- }
package/src/Popper.ts DELETED
@@ -1,118 +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
- placement: {
18
- type: String,
19
- default: undefined
20
- },
21
-
22
- target: {
23
- type: Element,
24
- required: true
25
- },
26
-
27
- title: {
28
- type: String,
29
- default: undefined
30
- },
31
-
32
- show: Boolean,
33
-
34
- top: Boolean,
35
-
36
- bottom: Boolean,
37
-
38
- left: Boolean,
39
-
40
- right: Boolean,
41
- },
42
-
43
- data() {
44
- return {
45
- currentShow: false,
46
- popperInstance: null
47
- };
48
- },
49
-
50
- computed: {
51
- computedPlacement() {
52
- if(this.placement) {
53
- return this.placement;
54
- }
55
-
56
- if(this.bottom) {
57
- return 'bottom';
58
- }
59
-
60
- if(this.left) {
61
- return 'left';
62
- }
63
-
64
- if(this.right) {
65
- return 'right';
66
- }
67
-
68
- return 'top';
69
- },
70
- tooltipClasses() {
71
- return {
72
- show: this.currentShow,
73
- [`bs-tooltip-${this.computedPlacement}`]: true
74
- };
75
- }
76
- },
77
-
78
- mounted() {
79
- this.popperInstance = createPopper(this.target, this.$el, Object.assign({
80
- placement: this.computedPlacement,
81
- modifiers: [
82
- {
83
- name: 'offset',
84
- options: {
85
- offset: [0, 6]
86
- },
87
- },
88
- {
89
- name: 'arrow',
90
- options: {
91
- element: this.$refs.arrow,
92
- },
93
- },
94
- ],
95
- }, this.popper));
96
-
97
- this.$nextTick(() => {
98
- this.currentShow = this.show;
99
- });
100
- },
101
-
102
- beforeUnmount() {
103
- this.popperInstance && this.popperInstance.destroy();
104
- },
105
-
106
- methods: {
107
-
108
- open() {
109
- this.currentShow = true;
110
- },
111
-
112
- close() {
113
- this.currentShow = false;
114
- }
115
-
116
- }
117
-
118
- });
@@ -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
- ]