vueless 0.0.756 → 0.0.757

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.
@@ -1,8 +1,7 @@
1
- import tippy from "tippy.js";
2
1
  import { merge } from "lodash-es";
3
2
 
4
3
  import { vuelessConfig } from "../../utils/ui.ts";
5
- import { isCSR, isSSR } from "../../utils/helper.ts";
4
+ import { isSSR } from "../../utils/helper.ts";
6
5
 
7
6
  import type { DefaultProps } from "tippy.js";
8
7
  import type {
@@ -13,20 +12,13 @@ import type {
13
12
 
14
13
  let settings: Partial<DefaultProps> = {};
15
14
 
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
- };
15
+ const defaultSettings = {
16
+ arrow: true,
17
+ theme: "light",
18
+ animation: "shift-away",
19
+ };
26
20
 
27
- settings = merge(defaultSettings, vuelessConfig.directives?.tooltip || {}) as DefaultProps;
28
- tippy.setDefaultProps(settings);
29
- }
21
+ settings = merge(defaultSettings, vuelessConfig.directives?.tooltip || {}) as DefaultProps;
30
22
 
31
23
  function onMounted(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
32
24
  function onMounted(el: TippyTargetElement, bindings: DirectiveBindingProps): void;
@@ -36,19 +28,29 @@ function onMounted(
36
28
  ): void {
37
29
  if (isSSR) return;
38
30
 
39
- if (typeof bindings.value === "string" && bindings.value.length) {
40
- tippy(el, merge(settings, { content: bindings.value }));
31
+ (async () => {
32
+ await import("tippy.js/dist/tippy.css");
33
+ await import("tippy.js/themes/light.css");
34
+ await import("tippy.js/animations/shift-away.css");
41
35
 
42
- return;
43
- }
36
+ const { default: tippy } = await import("tippy.js");
44
37
 
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
- }
38
+ tippy.setDefaultProps(settings);
39
+
40
+ if (typeof bindings.value === "string" && String(bindings.value).length) {
41
+ tippy(el, merge(settings, { content: bindings.value }));
42
+
43
+ return;
44
+ }
45
+
46
+ if (
47
+ typeof bindings.value === "object" &&
48
+ bindings.value.content &&
49
+ String(bindings.value.content).length
50
+ ) {
51
+ tippy(el, merge(settings, bindings.value || {}));
52
+ }
53
+ })();
52
54
  }
53
55
 
54
56
  function onUpdated(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.756",
3
+ "version": "0.0.757",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [