vueless 0.0.772 → 0.0.773
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/directives/tooltip/vTooltip.ts +26 -28
- package/package.json +1 -1
- package/plugin-vite.js +6 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import tippy from "tippy.js";
|
|
1
2
|
import { merge } from "lodash-es";
|
|
2
3
|
|
|
3
4
|
import { vuelessConfig } from "../../utils/ui.ts";
|
|
4
|
-
import { isSSR } from "../../utils/helper.ts";
|
|
5
|
+
import { isCSR, isSSR } from "../../utils/helper.ts";
|
|
5
6
|
|
|
6
7
|
import type { DefaultProps } from "tippy.js";
|
|
7
8
|
import type {
|
|
@@ -12,13 +13,20 @@ import type {
|
|
|
12
13
|
|
|
13
14
|
let settings: Partial<DefaultProps> = {};
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
if (isCSR) {
|
|
17
|
+
import("tippy.js/dist/tippy.css");
|
|
18
|
+
import("tippy.js/themes/light.css");
|
|
19
|
+
import("tippy.js/animations/shift-away.css");
|
|
20
|
+
|
|
21
|
+
const defaultSettings = {
|
|
22
|
+
arrow: true,
|
|
23
|
+
theme: "light",
|
|
24
|
+
animation: "shift-away",
|
|
25
|
+
};
|
|
20
26
|
|
|
21
|
-
settings = merge(defaultSettings, vuelessConfig.directives?.tooltip || {}) as DefaultProps;
|
|
27
|
+
settings = merge(defaultSettings, vuelessConfig.directives?.tooltip || {}) as DefaultProps;
|
|
28
|
+
tippy.setDefaultProps(settings);
|
|
29
|
+
}
|
|
22
30
|
|
|
23
31
|
function onMounted(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
|
|
24
32
|
function onMounted(el: TippyTargetElement, bindings: DirectiveBindingProps): void;
|
|
@@ -28,29 +36,19 @@ function onMounted(
|
|
|
28
36
|
): void {
|
|
29
37
|
if (isSSR) return;
|
|
30
38
|
|
|
31
|
-
(
|
|
32
|
-
|
|
33
|
-
await import("tippy.js/themes/light.css");
|
|
34
|
-
await import("tippy.js/animations/shift-away.css");
|
|
35
|
-
|
|
36
|
-
const { default: tippy } = await import("tippy.js");
|
|
37
|
-
|
|
38
|
-
tippy.setDefaultProps(settings);
|
|
39
|
+
if (typeof bindings.value === "string" && bindings.value.length) {
|
|
40
|
+
tippy(el, merge(settings, { content: bindings.value }));
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})();
|
|
45
|
+
if (
|
|
46
|
+
typeof bindings.value !== "string" &&
|
|
47
|
+
bindings.value.content &&
|
|
48
|
+
String(bindings.value.content).length
|
|
49
|
+
) {
|
|
50
|
+
tippy(el, merge(settings, bindings.value || {}));
|
|
51
|
+
}
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
function onUpdated(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
|
package/package.json
CHANGED
package/plugin-vite.js
CHANGED
|
@@ -66,7 +66,12 @@ export const Vueless = function (options = {}) {
|
|
|
66
66
|
"process.env": {},
|
|
67
67
|
},
|
|
68
68
|
optimizeDeps: {
|
|
69
|
-
include: [
|
|
69
|
+
include: [
|
|
70
|
+
...(!isVuelessEnv ? ["vueless/preset-tailwind"] : []),
|
|
71
|
+
...(!isVuelessEnv
|
|
72
|
+
? ["vueless/directives/tooltip/vTooltip.ts"]
|
|
73
|
+
: ["./src/directives/tooltip/vTooltip.ts"]),
|
|
74
|
+
],
|
|
70
75
|
},
|
|
71
76
|
}),
|
|
72
77
|
|