vueless 0.0.790 → 0.0.792

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,10 +1,11 @@
1
1
  import tippy from "tippy.js";
2
2
  import { merge } from "lodash-es";
3
+ import { toValue, computed, watch } from "vue";
3
4
 
4
5
  import { vuelessConfig } from "../../utils/ui.ts";
5
6
  import { isCSR, isSSR } from "../../utils/helper.ts";
6
7
 
7
- import type { DefaultProps } from "tippy.js";
8
+ import type { DefaultProps, Instance as TippyInstance, Props as TippyProps } from "tippy.js";
8
9
  import type {
9
10
  TippyTargetElement,
10
11
  DirectiveBindingContent,
@@ -49,6 +50,16 @@ function onMounted(
49
50
  ) {
50
51
  tippy(el, merge(settings, bindings.value || {}));
51
52
  }
53
+
54
+ const localBindings = computed(() => toValue(bindings));
55
+
56
+ watch(
57
+ localBindings,
58
+ () => {
59
+ updateTippyProps(el._tippy, localBindings.value.value);
60
+ },
61
+ { deep: true },
62
+ );
52
63
  }
53
64
 
54
65
  function onUpdated(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
@@ -59,13 +70,7 @@ function onUpdated(
59
70
  ): void {
60
71
  if (!el._tippy || isSSR) return;
61
72
 
62
- if (typeof bindings.value === "string") {
63
- el._tippy.setProps(merge(settings, { content: bindings.value }));
64
-
65
- return;
66
- }
67
-
68
- el._tippy.setProps(merge(settings, bindings.value || {}));
73
+ updateTippyProps(el._tippy, bindings.value);
69
74
  }
70
75
 
71
76
  function onUnmounted(el: TippyTargetElement) {
@@ -74,6 +79,18 @@ function onUnmounted(el: TippyTargetElement) {
74
79
  el._tippy.destroy();
75
80
  }
76
81
 
82
+ function updateTippyProps(tippyInstance: TippyInstance | undefined, props: string | TippyProps) {
83
+ if (!tippyInstance || isSSR) return;
84
+
85
+ if (typeof props === "string") {
86
+ tippyInstance.setProps(merge(settings, { content: props }));
87
+
88
+ return;
89
+ }
90
+
91
+ tippyInstance.setProps(merge(settings, props || {}));
92
+ }
93
+
77
94
  export default {
78
95
  mounted: onMounted,
79
96
  updated: onUpdated,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.790",
3
+ "version": "0.0.792",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -43,14 +43,12 @@ const DefaultTemplate: StoryFn<UInputFileArgs> = (args: UInputFileArgs) => ({
43
43
  data() {
44
44
  return {
45
45
  files: [],
46
- error: args.error || "",
47
46
  };
48
47
  },
49
48
  template: `
50
49
  <UInputFile
51
50
  v-bind="args"
52
51
  v-model="files"
53
- v-model:error="error"
54
52
  >
55
53
  ${args.slotTemplate || getSlotsFragment("")}
56
54
  </UInputFile>