vue-tippy 6.0.0-alpha.58 → 6.0.0-alpha.60
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/vue-tippy.cjs +74 -81
- package/dist/vue-tippy.d.ts +1039 -459
- package/dist/vue-tippy.esm-browser.js +75 -82
- package/dist/vue-tippy.iife.js +74 -81
- package/dist/vue-tippy.iife.prod.js +2 -2
- package/dist/vue-tippy.mjs +75 -82
- package/dist/vue-tippy.prod.cjs +74 -81
- package/package.json +4 -4
- package/src/components/Tippy.ts +79 -91
- package/src/composables/useTippyComponent.ts +6 -6
- package/src/types/index.ts +2 -1
package/dist/vue-tippy.prod.cjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* vue-tippy v6.0.0-alpha.
|
2
|
+
* vue-tippy v6.0.0-alpha.60
|
3
3
|
* (c) 2022
|
4
4
|
* @license MIT
|
5
5
|
*/
|
@@ -4154,7 +4154,7 @@ function useTippyComponent(opts = {}, children) {
|
|
4154
4154
|
instance,
|
4155
4155
|
TippyComponent: vue.h(TippyComponent, {
|
4156
4156
|
...opts,
|
4157
|
-
onVnodeMounted: vnode => {
|
4157
|
+
onVnodeMounted: (vnode) => {
|
4158
4158
|
//@ts-ignore
|
4159
4159
|
instance.value = vnode.component.ctx;
|
4160
4160
|
},
|
@@ -4188,66 +4188,69 @@ function useSingleton(instances, optionalProps) {
|
|
4188
4188
|
};
|
4189
4189
|
}
|
4190
4190
|
|
4191
|
-
// const pluginProps = [
|
4192
|
-
// 'animateFill',
|
4193
|
-
// 'followCursor',
|
4194
|
-
// 'inlinePositioning',
|
4195
|
-
// 'sticky',
|
4196
|
-
// ]
|
4197
|
-
const booleanProps = [
|
4198
|
-
'a11y',
|
4199
|
-
'allowHTML',
|
4200
|
-
'arrow',
|
4201
|
-
'flip',
|
4202
|
-
'flipOnUpdate',
|
4203
|
-
'hideOnClick',
|
4204
|
-
'ignoreAttributes',
|
4205
|
-
'inertia',
|
4206
|
-
'interactive',
|
4207
|
-
'lazy',
|
4208
|
-
'multiple',
|
4209
|
-
'showOnInit',
|
4210
|
-
'touch',
|
4211
|
-
'touchHold',
|
4212
|
-
];
|
4213
|
-
let props = {};
|
4214
|
-
props['hideOnClick'] = {
|
4215
|
-
type: [String, Boolean],
|
4216
|
-
default: tippy.defaultProps.hideOnClick,
|
4217
|
-
};
|
4218
|
-
props['to'] = {};
|
4219
|
-
props['tag'] = {
|
4220
|
-
default: 'span'
|
4221
|
-
};
|
4222
|
-
props['contentTag'] = {
|
4223
|
-
default: 'span'
|
4224
|
-
};
|
4225
|
-
props['contentClass'] = {
|
4226
|
-
default: null
|
4227
|
-
};
|
4228
|
-
Object.keys(tippy.defaultProps).forEach((prop) => {
|
4229
|
-
if (props[prop]) {
|
4230
|
-
return;
|
4231
|
-
}
|
4232
|
-
if (booleanProps.includes(prop)) {
|
4233
|
-
props[prop] = {
|
4234
|
-
// TODO: add SVGElement and DocumentFragment for arrow prop
|
4235
|
-
type: prop === 'arrow' ? [String, Boolean, Function] : Boolean,
|
4236
|
-
default: function () {
|
4237
|
-
return tippy.defaultProps[prop];
|
4238
|
-
},
|
4239
|
-
};
|
4240
|
-
}
|
4241
|
-
else {
|
4242
|
-
props[prop] = {
|
4243
|
-
default: function () {
|
4244
|
-
return tippy.defaultProps[prop];
|
4245
|
-
},
|
4246
|
-
};
|
4247
|
-
}
|
4248
|
-
});
|
4249
4191
|
const TippyComponent = vue.defineComponent({
|
4250
|
-
props
|
4192
|
+
props: {
|
4193
|
+
to: {
|
4194
|
+
type: [String, Function],
|
4195
|
+
},
|
4196
|
+
tag: {
|
4197
|
+
type: String,
|
4198
|
+
default: 'span'
|
4199
|
+
},
|
4200
|
+
contentTag: {
|
4201
|
+
type: String,
|
4202
|
+
default: 'span'
|
4203
|
+
},
|
4204
|
+
contentClass: {
|
4205
|
+
type: String,
|
4206
|
+
default: null
|
4207
|
+
},
|
4208
|
+
appendTo: { default: () => tippy.defaultProps['appendTo'] },
|
4209
|
+
aria: { default: () => tippy.defaultProps['aria'] },
|
4210
|
+
delay: { default: () => tippy.defaultProps['delay'] },
|
4211
|
+
duration: { default: () => tippy.defaultProps['duration'] },
|
4212
|
+
getReferenceClientRect: { default: () => tippy.defaultProps['getReferenceClientRect'] },
|
4213
|
+
hideOnClick: { default: () => tippy.defaultProps['hideOnClick'] },
|
4214
|
+
ignoreAttributes: { default: () => tippy.defaultProps['ignoreAttributes'] },
|
4215
|
+
interactive: { default: () => tippy.defaultProps['interactive'] },
|
4216
|
+
interactiveBorder: { default: () => tippy.defaultProps['interactiveBorder'] },
|
4217
|
+
interactiveDebounce: { default: () => tippy.defaultProps['interactiveDebounce'] },
|
4218
|
+
moveTransition: { default: () => tippy.defaultProps['moveTransition'] },
|
4219
|
+
offset: { default: () => tippy.defaultProps['offset'] },
|
4220
|
+
onAfterUpdate: { default: () => tippy.defaultProps['onAfterUpdate'] },
|
4221
|
+
onBeforeUpdate: { default: () => tippy.defaultProps['onBeforeUpdate'] },
|
4222
|
+
onCreate: { default: () => tippy.defaultProps['onCreate'] },
|
4223
|
+
onDestroy: { default: () => tippy.defaultProps['onDestroy'] },
|
4224
|
+
onHidden: { default: () => tippy.defaultProps['onHidden'] },
|
4225
|
+
onHide: { default: () => tippy.defaultProps['onHide'] },
|
4226
|
+
onMount: { default: () => tippy.defaultProps['onMount'] },
|
4227
|
+
onShow: { default: () => tippy.defaultProps['onShow'] },
|
4228
|
+
onShown: { default: () => tippy.defaultProps['onShown'] },
|
4229
|
+
onTrigger: { default: () => tippy.defaultProps['onTrigger'] },
|
4230
|
+
onUntrigger: { default: () => tippy.defaultProps['onUntrigger'] },
|
4231
|
+
onClickOutside: { default: () => tippy.defaultProps['onClickOutside'] },
|
4232
|
+
placement: { default: () => tippy.defaultProps['placement'] },
|
4233
|
+
plugins: { default: () => tippy.defaultProps['plugins'] },
|
4234
|
+
popperOptions: { default: () => tippy.defaultProps['popperOptions'] },
|
4235
|
+
render: { default: () => tippy.defaultProps['render'] },
|
4236
|
+
showOnCreate: { default: () => tippy.defaultProps['showOnCreate'] },
|
4237
|
+
touch: { default: () => tippy.defaultProps['touch'] },
|
4238
|
+
trigger: { default: () => tippy.defaultProps['trigger'] },
|
4239
|
+
triggerTarget: { default: () => tippy.defaultProps['triggerTarget'] },
|
4240
|
+
animateFill: { default: () => tippy.defaultProps['animateFill'] },
|
4241
|
+
followCursor: { default: () => tippy.defaultProps['followCursor'] },
|
4242
|
+
inlinePositioning: { default: () => tippy.defaultProps['inlinePositioning'] },
|
4243
|
+
sticky: { default: () => tippy.defaultProps['sticky'] },
|
4244
|
+
allowHTML: { default: () => tippy.defaultProps['allowHTML'] },
|
4245
|
+
animation: { default: () => tippy.defaultProps['animation'] },
|
4246
|
+
arrow: { default: () => tippy.defaultProps['arrow'] },
|
4247
|
+
content: { default: () => tippy.defaultProps['content'] },
|
4248
|
+
inertia: { default: () => tippy.defaultProps['inertia'] },
|
4249
|
+
maxWidth: { default: () => tippy.defaultProps['maxWidth'] },
|
4250
|
+
role: { default: () => tippy.defaultProps['role'] },
|
4251
|
+
theme: { default: () => tippy.defaultProps['theme'] },
|
4252
|
+
zIndex: { default: () => tippy.defaultProps['zIndex'] }
|
4253
|
+
},
|
4251
4254
|
emits: ['state'],
|
4252
4255
|
setup(props, { slots, emit, expose }) {
|
4253
4256
|
const elem = vue.ref();
|
@@ -4288,38 +4291,28 @@ const TippyComponent = vue.defineComponent({
|
|
4288
4291
|
if (slots.content)
|
4289
4292
|
tippy.setContent(() => contentElem.value);
|
4290
4293
|
});
|
4291
|
-
let exposed = {
|
4294
|
+
let exposed = vue.reactive({
|
4292
4295
|
elem,
|
4293
4296
|
contentElem,
|
4294
4297
|
mounted,
|
4295
4298
|
...tippy
|
4296
|
-
};
|
4299
|
+
});
|
4297
4300
|
expose(exposed);
|
4298
4301
|
return () => {
|
4299
|
-
|
4300
|
-
elem: elem.value,
|
4301
|
-
contentElem: contentElem.value,
|
4302
|
-
mounted: mounted.value,
|
4303
|
-
...Object.keys(tippy).reduce((acc, key) => {
|
4304
|
-
//@ts-ignore
|
4305
|
-
acc[key] = vue.unref(tippy[key]);
|
4306
|
-
return acc;
|
4307
|
-
}, {})
|
4308
|
-
};
|
4309
|
-
const slot = slots.default ? slots.default(exposedUnref) : [];
|
4302
|
+
const slot = slots.default ? slots.default(exposed) : [];
|
4310
4303
|
return vue.h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
|
4311
4304
|
slot,
|
4312
4305
|
vue.h(props.contentTag, {
|
4313
4306
|
ref: contentElem,
|
4314
4307
|
style: { display: mounted.value ? 'inherit' : 'none' },
|
4315
4308
|
class: props.contentClass
|
4316
|
-
}, slots.content(
|
4309
|
+
}, slots.content(exposed)),
|
4317
4310
|
] : slot);
|
4318
4311
|
};
|
4319
4312
|
},
|
4320
4313
|
});
|
4321
4314
|
|
4322
|
-
const booleanProps
|
4315
|
+
const booleanProps = [
|
4323
4316
|
'a11y',
|
4324
4317
|
'allowHTML',
|
4325
4318
|
'arrow',
|
@@ -4335,10 +4328,10 @@ const booleanProps$1 = [
|
|
4335
4328
|
'touch',
|
4336
4329
|
'touchHold',
|
4337
4330
|
];
|
4338
|
-
let props
|
4331
|
+
let props = {};
|
4339
4332
|
Object.keys(tippy.defaultProps).forEach((prop) => {
|
4340
|
-
if (booleanProps
|
4341
|
-
props
|
4333
|
+
if (booleanProps.includes(prop)) {
|
4334
|
+
props[prop] = {
|
4342
4335
|
type: Boolean,
|
4343
4336
|
default: function () {
|
4344
4337
|
return tippy.defaultProps[prop];
|
@@ -4346,7 +4339,7 @@ Object.keys(tippy.defaultProps).forEach((prop) => {
|
|
4346
4339
|
};
|
4347
4340
|
}
|
4348
4341
|
else {
|
4349
|
-
props
|
4342
|
+
props[prop] = {
|
4350
4343
|
default: function () {
|
4351
4344
|
return tippy.defaultProps[prop];
|
4352
4345
|
},
|
@@ -4354,7 +4347,7 @@ Object.keys(tippy.defaultProps).forEach((prop) => {
|
|
4354
4347
|
}
|
4355
4348
|
});
|
4356
4349
|
const TippySingleton = vue.defineComponent({
|
4357
|
-
props
|
4350
|
+
props,
|
4358
4351
|
setup(props) {
|
4359
4352
|
const instances = vue.ref([]);
|
4360
4353
|
const { singleton } = useSingleton(instances, props);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vue-tippy",
|
3
|
-
"version": "6.0.0-alpha.
|
3
|
+
"version": "6.0.0-alpha.60",
|
4
4
|
"main": "index.js",
|
5
5
|
"module": "dist/vue-tippy.mjs",
|
6
6
|
"unpkg": "dist/vue-tippy.iife.js",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"prepublishOnly": "yarn build && yarn build:dts"
|
50
50
|
},
|
51
51
|
"peerDependencies": {
|
52
|
-
"vue": "^3.
|
52
|
+
"vue": "^3.2.0"
|
53
53
|
},
|
54
54
|
"devDependencies": {
|
55
55
|
"@microsoft/api-extractor": "7.8.1",
|
@@ -59,7 +59,7 @@
|
|
59
59
|
"@rollup/plugin-replace": "^2.3.3",
|
60
60
|
"@types/webpack": "^4.41.21",
|
61
61
|
"@types/webpack-env": "^1.15.2",
|
62
|
-
"@vue/compiler-sfc": "^3.
|
62
|
+
"@vue/compiler-sfc": "^3.2.0",
|
63
63
|
"css-loader": "^4.2.0",
|
64
64
|
"html-webpack-plugin": "^4.3.0",
|
65
65
|
"rollup": "^2.23.0",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"ts-loader": "^8.0.2",
|
72
72
|
"ts-node": "^8.10.2",
|
73
73
|
"typescript": "^4.1.3",
|
74
|
-
"vue": "^3.
|
74
|
+
"vue": "^3.2.0",
|
75
75
|
"vue-loader": "^16.0.0-beta.8",
|
76
76
|
"vue-router": "4",
|
77
77
|
"webpack": "^4.44.1",
|
package/src/components/Tippy.ts
CHANGED
@@ -1,87 +1,88 @@
|
|
1
|
-
import { defineComponent, ref, h,
|
1
|
+
import { defineComponent, ref, h, UnwrapNestedRefs, onMounted, nextTick, watch, unref, reactive, PropType } from 'vue'
|
2
2
|
import { TippyOptions } from '../types'
|
3
3
|
import { useTippy } from '../composables'
|
4
|
-
import tippy
|
5
|
-
declare module '@vue/runtime-core' {
|
6
|
-
interface ComponentCustomProps extends TippyOptions { }
|
7
|
-
}
|
8
|
-
|
9
|
-
// const pluginProps = [
|
10
|
-
// 'animateFill',
|
11
|
-
// 'followCursor',
|
12
|
-
// 'inlinePositioning',
|
13
|
-
// 'sticky',
|
14
|
-
// ]
|
15
|
-
const booleanProps = [
|
16
|
-
'a11y',
|
17
|
-
'allowHTML',
|
18
|
-
'arrow',
|
19
|
-
'flip',
|
20
|
-
'flipOnUpdate',
|
21
|
-
'hideOnClick',
|
22
|
-
'ignoreAttributes',
|
23
|
-
'inertia',
|
24
|
-
'interactive',
|
25
|
-
'lazy',
|
26
|
-
'multiple',
|
27
|
-
'showOnInit',
|
28
|
-
'touch',
|
29
|
-
'touchHold',
|
30
|
-
]
|
31
|
-
|
32
|
-
let props: ComponentObjectPropsOptions = {}
|
33
|
-
|
34
|
-
props['hideOnClick'] = {
|
35
|
-
type: [String, Boolean],
|
36
|
-
default: tippy.defaultProps.hideOnClick,
|
37
|
-
}
|
38
|
-
|
39
|
-
props['to'] = {}
|
40
|
-
|
41
|
-
props['tag'] = {
|
42
|
-
default: 'span'
|
43
|
-
}
|
4
|
+
import tippy from 'tippy.js'
|
44
5
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
Object.keys(tippy.defaultProps).forEach((prop: string) => {
|
55
|
-
if (props[prop]) {
|
56
|
-
return
|
6
|
+
declare module '@vue/runtime-core' {
|
7
|
+
interface ComponentCustomProps extends TippyOptions {
|
8
|
+
to: string | Element
|
9
|
+
tag: string
|
10
|
+
contentTag: string
|
11
|
+
contentClass: string
|
57
12
|
}
|
13
|
+
interface ComponentCustomProperties extends UnwrapNestedRefs<ReturnType<typeof useTippy>> { }
|
14
|
+
}
|
58
15
|
|
59
|
-
if (booleanProps.includes(prop)) {
|
60
|
-
props[prop] = {
|
61
|
-
// TODO: add SVGElement and DocumentFragment for arrow prop
|
62
|
-
type: prop === 'arrow' ? [String, Boolean, Function] : Boolean,
|
63
|
-
default: function () {
|
64
|
-
return tippy.defaultProps[prop as keyof DefaultProps] as Boolean
|
65
|
-
},
|
66
|
-
}
|
67
|
-
} else {
|
68
|
-
props[prop] = {
|
69
|
-
default: function () {
|
70
|
-
return tippy.defaultProps[prop as keyof DefaultProps]
|
71
|
-
},
|
72
|
-
}
|
73
|
-
}
|
74
|
-
})
|
75
16
|
|
76
17
|
const TippyComponent = defineComponent({
|
77
|
-
props
|
18
|
+
props: {
|
19
|
+
to: {
|
20
|
+
type: [String, Function] as PropType<string | Element>,
|
21
|
+
},
|
22
|
+
tag: {
|
23
|
+
type: String,
|
24
|
+
default: 'span'
|
25
|
+
},
|
26
|
+
contentTag: {
|
27
|
+
type: String,
|
28
|
+
default: 'span'
|
29
|
+
},
|
30
|
+
contentClass: {
|
31
|
+
type: String,
|
32
|
+
default: null
|
33
|
+
},
|
34
|
+
appendTo: { default: () => tippy.defaultProps['appendTo'] },
|
35
|
+
aria: { default: () => tippy.defaultProps['aria'] },
|
36
|
+
delay: { default: () => tippy.defaultProps['delay'] },
|
37
|
+
duration: { default: () => tippy.defaultProps['duration'] },
|
38
|
+
getReferenceClientRect: { default: () => tippy.defaultProps['getReferenceClientRect'] },
|
39
|
+
hideOnClick: { default: () => tippy.defaultProps['hideOnClick'] },
|
40
|
+
ignoreAttributes: { default: () => tippy.defaultProps['ignoreAttributes'] },
|
41
|
+
interactive: { default: () => tippy.defaultProps['interactive'] },
|
42
|
+
interactiveBorder: { default: () => tippy.defaultProps['interactiveBorder'] },
|
43
|
+
interactiveDebounce: { default: () => tippy.defaultProps['interactiveDebounce'] },
|
44
|
+
moveTransition: { default: () => tippy.defaultProps['moveTransition'] },
|
45
|
+
offset: { default: () => tippy.defaultProps['offset'] },
|
46
|
+
onAfterUpdate: { default: () => tippy.defaultProps['onAfterUpdate'] },
|
47
|
+
onBeforeUpdate: { default: () => tippy.defaultProps['onBeforeUpdate'] },
|
48
|
+
onCreate: { default: () => tippy.defaultProps['onCreate'] },
|
49
|
+
onDestroy: { default: () => tippy.defaultProps['onDestroy'] },
|
50
|
+
onHidden: { default: () => tippy.defaultProps['onHidden'] },
|
51
|
+
onHide: { default: () => tippy.defaultProps['onHide'] },
|
52
|
+
onMount: { default: () => tippy.defaultProps['onMount'] },
|
53
|
+
onShow: { default: () => tippy.defaultProps['onShow'] },
|
54
|
+
onShown: { default: () => tippy.defaultProps['onShown'] },
|
55
|
+
onTrigger: { default: () => tippy.defaultProps['onTrigger'] },
|
56
|
+
onUntrigger: { default: () => tippy.defaultProps['onUntrigger'] },
|
57
|
+
onClickOutside: { default: () => tippy.defaultProps['onClickOutside'] },
|
58
|
+
placement: { default: () => tippy.defaultProps['placement'] },
|
59
|
+
plugins: { default: () => tippy.defaultProps['plugins'] },
|
60
|
+
popperOptions: { default: () => tippy.defaultProps['popperOptions'] },
|
61
|
+
render: { default: () => tippy.defaultProps['render'] },
|
62
|
+
showOnCreate: { default: () => tippy.defaultProps['showOnCreate'] },
|
63
|
+
touch: { default: () => tippy.defaultProps['touch'] },
|
64
|
+
trigger: { default: () => tippy.defaultProps['trigger'] },
|
65
|
+
triggerTarget: { default: () => tippy.defaultProps['triggerTarget'] },
|
66
|
+
animateFill: { default: () => tippy.defaultProps['animateFill'] },
|
67
|
+
followCursor: { default: () => tippy.defaultProps['followCursor'] },
|
68
|
+
inlinePositioning: { default: () => tippy.defaultProps['inlinePositioning'] },
|
69
|
+
sticky: { default: () => tippy.defaultProps['sticky'] },
|
70
|
+
allowHTML: { default: () => tippy.defaultProps['allowHTML'] },
|
71
|
+
animation: { default: () => tippy.defaultProps['animation'] },
|
72
|
+
arrow: { default: () => tippy.defaultProps['arrow'] },
|
73
|
+
content: { default: () => tippy.defaultProps['content'] },
|
74
|
+
inertia: { default: () => tippy.defaultProps['inertia'] },
|
75
|
+
maxWidth: { default: () => tippy.defaultProps['maxWidth'] },
|
76
|
+
role: { default: () => tippy.defaultProps['role'] },
|
77
|
+
theme: { default: () => tippy.defaultProps['theme'] },
|
78
|
+
zIndex: { default: () => tippy.defaultProps['zIndex'] }
|
79
|
+
},
|
78
80
|
emits: ['state'],
|
79
81
|
setup(props, { slots, emit, expose }) {
|
80
82
|
const elem = ref<Element>()
|
81
83
|
const contentElem = ref<Element>()
|
82
84
|
const mounted = ref(false)
|
83
85
|
|
84
|
-
|
85
86
|
const getOptions = () => {
|
86
87
|
let options = { ...props } as TippyOptions;
|
87
88
|
for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
|
@@ -100,7 +101,7 @@ const TippyComponent = defineComponent({
|
|
100
101
|
if (typeof Element !== 'undefined' && props.to instanceof Element) {
|
101
102
|
target = () => props.to
|
102
103
|
} else if (typeof props.to === 'string' || props.to instanceof String) {
|
103
|
-
target = () => document.querySelector(props.to)
|
104
|
+
target = () => document.querySelector(props.to as any)
|
104
105
|
}
|
105
106
|
}
|
106
107
|
|
@@ -126,41 +127,28 @@ const TippyComponent = defineComponent({
|
|
126
127
|
tippy.setContent(() => contentElem.value)
|
127
128
|
})
|
128
129
|
|
129
|
-
let exposed = {
|
130
|
+
let exposed = reactive({
|
130
131
|
elem,
|
131
132
|
contentElem,
|
132
133
|
mounted,
|
133
134
|
...tippy
|
134
|
-
}
|
135
|
+
})
|
135
136
|
|
136
137
|
expose(exposed)
|
137
138
|
|
138
139
|
return () => {
|
140
|
+
const slot = slots.default ? slots.default(exposed) : []
|
139
141
|
|
140
|
-
|
141
|
-
elem: elem.value,
|
142
|
-
contentElem: contentElem.value,
|
143
|
-
mounted: mounted.value,
|
144
|
-
...Object.keys(tippy).reduce((acc, key) => {
|
145
|
-
//@ts-ignore
|
146
|
-
acc[key] = unref(tippy[key])
|
147
|
-
|
148
|
-
return acc;
|
149
|
-
}, {})
|
150
|
-
}
|
151
|
-
|
152
|
-
const slot = slots.default ? slots.default(exposedUnref) : []
|
153
|
-
|
154
|
-
return h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
|
142
|
+
return h(props.tag as string, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
|
155
143
|
slot,
|
156
144
|
h(
|
157
|
-
props.contentTag,
|
145
|
+
props.contentTag as string,
|
158
146
|
{
|
159
147
|
ref: contentElem,
|
160
148
|
style: { display: mounted.value ? 'inherit' : 'none' },
|
161
149
|
class: props.contentClass
|
162
150
|
},
|
163
|
-
slots.content(
|
151
|
+
slots.content(exposed)
|
164
152
|
),
|
165
153
|
] : slot)
|
166
154
|
}
|
@@ -1,20 +1,20 @@
|
|
1
1
|
import { h, ref } from 'vue'
|
2
|
-
import { TippyOptions } from '../types'
|
3
|
-
import
|
2
|
+
import { TippyComponent, TippyOptions } from '../types'
|
3
|
+
import Tippy from './../components/Tippy'
|
4
4
|
|
5
5
|
export function useTippyComponent(
|
6
6
|
opts: TippyOptions = {},
|
7
7
|
children?: any
|
8
8
|
) {
|
9
|
-
const instance = ref()
|
9
|
+
const instance = ref<TippyComponent>()
|
10
10
|
|
11
11
|
return {
|
12
12
|
instance,
|
13
13
|
TippyComponent: h(
|
14
|
-
|
14
|
+
Tippy,
|
15
15
|
{
|
16
|
-
...opts,
|
17
|
-
onVnodeMounted: vnode => {
|
16
|
+
...opts as any,
|
17
|
+
onVnodeMounted: (vnode:any) => {
|
18
18
|
//@ts-ignore
|
19
19
|
instance.value = vnode.component.ctx
|
20
20
|
},
|
package/src/types/index.ts
CHANGED
@@ -11,9 +11,10 @@ export declare type TippyTarget =
|
|
11
11
|
| null
|
12
12
|
|
13
13
|
export declare type TippyOptions = Partial<
|
14
|
-
Omit<Props, 'content' | 'triggerTarget'> & {
|
14
|
+
Omit<Props, 'content' | 'triggerTarget' | 'getReferenceClientRect'> & {
|
15
15
|
content: TippyContent
|
16
16
|
triggerTarget: TippyTarget
|
17
|
+
getReferenceClientRect: null | (() => DOMRect & any)
|
17
18
|
}
|
18
19
|
>
|
19
20
|
|