@shikijs/vitepress-twoslash 3.14.0 → 3.15.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.
Files changed (2) hide show
  1. package/dist/client.mjs +35 -0
  2. package/package.json +4 -4
package/dist/client.mjs CHANGED
@@ -9,6 +9,38 @@ const TwoslashFloatingVue = {
9
9
  if (path.some((el) => el?.classList?.contains?.("vp-code-group") || el?.classList?.contains?.("tabs")))
10
10
  recomputeAllPoppers();
11
11
  }, { passive: true });
12
+ if (!isMobile) {
13
+ let isDragging = false;
14
+ window.addEventListener("mousedown", () => {
15
+ isDragging = true;
16
+ }, { passive: true });
17
+ window.addEventListener("mouseup", () => {
18
+ isDragging = false;
19
+ }, { passive: true });
20
+ const _component = app.component;
21
+ app.component = function(...rest) {
22
+ const comp = _component.apply(this, rest);
23
+ if (rest.length >= 2 && rest[0] === "VMenu") {
24
+ try {
25
+ const PopperVue = rest[1].components.Popper;
26
+ const PopperTs = PopperVue.extends;
27
+ const _show = PopperTs.methods.show;
28
+ PopperTs.methods.show = function(...args) {
29
+ if (!isDragging)
30
+ return _show.apply(this, args);
31
+ };
32
+ const _hide = PopperTs.methods.hide;
33
+ PopperTs.methods.hide = function(...args) {
34
+ if (!isDragging)
35
+ return _hide.apply(this, args);
36
+ };
37
+ } catch (e) {
38
+ console.error("Failed to patch FloatingVue", e);
39
+ }
40
+ }
41
+ return comp;
42
+ };
43
+ }
12
44
  }
13
45
  app.use(FloatingVue, {
14
46
  ...options,
@@ -23,6 +55,7 @@ const TwoslashFloatingVue = {
23
55
  delay: 0,
24
56
  handleResize: false,
25
57
  autoHide: true,
58
+ noAutoFocus: true,
26
59
  instantMove: true,
27
60
  flip: false,
28
61
  arrowPadding: 8,
@@ -34,6 +67,7 @@ const TwoslashFloatingVue = {
34
67
  triggers: ["click"],
35
68
  popperTriggers: ["click"],
36
69
  autoHide: false,
70
+ noAutoFocus: true,
37
71
  ...options.themes?.["twoslash-query"] ?? {}
38
72
  },
39
73
  "twoslash-completion": {
@@ -41,6 +75,7 @@ const TwoslashFloatingVue = {
41
75
  triggers: ["click"],
42
76
  popperTriggers: ["click"],
43
77
  autoHide: false,
78
+ noAutoFocus: true,
44
79
  distance: 0,
45
80
  arrowOverflow: true,
46
81
  ...options.themes?.["twoslash-completion"] ?? {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/vitepress-twoslash",
3
3
  "type": "module",
4
- "version": "3.14.0",
4
+ "version": "3.15.0",
5
5
  "description": "Enable Twoslash support in VitePress",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -44,9 +44,9 @@
44
44
  "ohash": "^2.0.11",
45
45
  "twoslash": "^0.3.4",
46
46
  "twoslash-vue": "^0.3.4",
47
- "vue": "^3.5.22",
48
- "@shikijs/twoslash": "3.14.0",
49
- "shiki": "3.14.0"
47
+ "vue": "^3.5.23",
48
+ "@shikijs/twoslash": "3.15.0",
49
+ "shiki": "3.15.0"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "unbuild",