@@ -10,20 +10,18 @@ import type { VitePressPluginTwoslashOptions } from 'vitepress-plugin-twoslash'
10
10
export { defaultHoverInfoProcessor }
11
11
12
12
export function rendererFloatingVue ( options : VitePressPluginTwoslashOptions & RendererRichOptions = { } ) : TwoslashRenderer {
13
+ const classCopyIgnore = 'vp-copy-ignore'
14
+ const classFloatingPanel = 'twoslash-floating'
15
+ const classCode = 'vp-code'
16
+ const classMarkdown = 'vp-doc'
17
+ const floatingVueTheme = 'twoslash'
18
+ const floatingVueThemeQuery = 'twoslash-query'
19
+ const floatingVueThemeCompletion = 'twoslash-completion'
20
+
13
21
const hoverBasicProps = {
14
22
'class' : 'twoslash-hover' ,
15
- 'popper-class' : 'vp-code shiki floating-vue-twoslash vp-copy-ignore' ,
16
- 'placement' : 'bottom-start' ,
17
- 'theme' : 'twoslash' ,
18
- ':arrow-padding' : '8' ,
19
- ':auto-boundary-max-size' : 'true' ,
20
- }
21
- const hoverPresistedProps = {
22
- ...hoverBasicProps ,
23
- ':shown' : 'true' ,
24
- ':triggers' : '["click"]' ,
25
- ':popper-triggers' : '["click"]' ,
26
- ':auto-hide' : 'false' ,
23
+ 'popper-class' : [ 'shiki' , classFloatingPanel , classCopyIgnore , classCode ] . join ( ' ' ) ,
24
+ 'theme' : floatingVueTheme ,
27
25
}
28
26
29
27
function compose ( parts : { token : Element | Text , popup : Element } ) : Element [ ] {
@@ -50,7 +48,7 @@ export function rendererFloatingVue(options: VitePressPluginTwoslashOptions & Re
50
48
}
51
49
52
50
const rich = rendererRich ( {
53
- classExtra : 'vp-copy-ignore' ,
51
+ classExtra : classCopyIgnore ,
54
52
...options ,
55
53
renderMarkdown,
56
54
renderMarkdownInline,
@@ -62,31 +60,27 @@ export function rendererFloatingVue(options: VitePressPluginTwoslashOptions & Re
62
60
hoverCompose : compose ,
63
61
queryToken : {
64
62
tagName : 'v-menu' ,
65
- properties : hoverPresistedProps ,
63
+ properties : {
64
+ ...hoverBasicProps ,
65
+ theme : floatingVueThemeQuery ,
66
+ } ,
66
67
} ,
67
68
queryCompose : compose ,
68
69
popupDocs : {
69
- class : ' twoslash-popup-docs vp-doc' ,
70
+ class : ` twoslash-popup-docs ${ classMarkdown } ` ,
70
71
} ,
71
72
popupDocsTags : {
72
- class : ' twoslash-popup-docs twoslash-popup-docs-tags vp-doc' ,
73
+ class : ` twoslash-popup-docs twoslash-popup-docs-tags ${ classMarkdown } ` ,
73
74
} ,
74
75
completionCompose ( { popup, cursor } ) {
75
76
return [
76
77
< Element > {
77
78
type : 'element' ,
78
79
tagName : 'v-menu' ,
79
80
properties : {
80
- 'popper-class' : 'vp-code shiki floating-vue-twoslash-compeltion vp-copy-ignore' ,
81
- 'placement' : 'bottom-start' ,
82
- 'theme' : 'twoslash' ,
83
- ':distance' : '0' ,
84
- ':arrow-overflow' : 'true' ,
85
- ':auto-boundary-max-size' : 'true' ,
81
+ 'popper-class' : [ 'shiki twoslash-completion' , classCopyIgnore , classFloatingPanel ] ,
82
+ 'theme' : floatingVueThemeCompletion ,
86
83
':shown' : 'true' ,
87
- ':triggers' : '["click"]' ,
88
- ':popper-triggers' : '["click"]' ,
89
- ':auto-hide' : 'false' ,
90
84
} ,
91
85
children : [
92
86
cursor ,
0 commit comments