@varlet/ui 3.7.2-alpha.1733245375527 → 3.7.2

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.
@@ -280,7 +280,7 @@ import './tooltip/style/index.mjs'
280
280
  import './uploader/style/index.mjs'
281
281
  import './watermark/style/index.mjs'
282
282
 
283
- const version = '3.7.2-alpha.1733245375527'
283
+ const version = '3.7.2'
284
284
 
285
285
  function install(app) {
286
286
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -186,7 +186,7 @@ export * from './tooltip/index.mjs'
186
186
  export * from './uploader/index.mjs'
187
187
  export * from './watermark/index.mjs'
188
188
 
189
- const version = '3.7.2-alpha.1733245375527'
189
+ const version = '3.7.2'
190
190
 
191
191
  function install(app) {
192
192
  ActionSheet.install && app.use(ActionSheet)
@@ -65,11 +65,10 @@ function usePopover(options) {
65
65
  const { zIndex } = useZIndex(() => show.value, 1);
66
66
  useStack(() => show.value, zIndex);
67
67
  let popoverInstance = null;
68
- let reference;
68
+ let reference = void 0;
69
69
  let enterPopover = false;
70
- let enterHost = false;
70
+ let enterReference = false;
71
71
  useEventListener(() => window, "keydown", handleKeydown);
72
- onWindowResize(resize);
73
72
  watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
74
73
  watch(() => options.disabled, close);
75
74
  watch(
@@ -80,22 +79,25 @@ function usePopover(options) {
80
79
  }
81
80
  }
82
81
  );
82
+ onWindowResize(resize);
83
83
  onMounted(createPopperInstance);
84
84
  onUnmounted(destroyPopperInstance);
85
85
  function createPopperInstance() {
86
86
  const reference2 = getReference();
87
87
  popoverInstance = createPopper(reference2, popover.value, getPopperOptions());
88
- reference2.addEventListener("mouseenter", handleHostMouseenter);
89
- reference2.addEventListener("mouseleave", handleHostMouseleave);
88
+ reference2.addEventListener("mouseenter", handleReferenceMouseenter);
89
+ reference2.addEventListener("mouseleave", handleReferenceMouseleave);
90
90
  reference2.addEventListener("click", handleReferenceClick);
91
91
  document.addEventListener("click", handleClickOutside);
92
92
  }
93
93
  function destroyPopperInstance() {
94
94
  const reference2 = getReference();
95
+ if (reference2) {
96
+ reference2.removeEventListener("mouseenter", handleReferenceMouseenter);
97
+ reference2.removeEventListener("mouseleave", handleReferenceMouseleave);
98
+ reference2.removeEventListener("click", handleReferenceClick);
99
+ }
95
100
  popoverInstance.destroy();
96
- reference2.removeEventListener("mouseenter", handleHostMouseenter);
97
- reference2.removeEventListener("mouseleave", handleHostMouseleave);
98
- reference2.removeEventListener("click", handleReferenceClick);
99
101
  document.removeEventListener("click", handleClickOutside);
100
102
  }
101
103
  function computeReferenceSize() {
@@ -141,19 +143,19 @@ function usePopover(options) {
141
143
  return "left";
142
144
  }
143
145
  }
144
- function handleHostMouseenter() {
146
+ function handleReferenceMouseenter() {
145
147
  if (options.trigger !== "hover") {
146
148
  return;
147
149
  }
148
- enterHost = true;
150
+ enterReference = true;
149
151
  open();
150
152
  }
151
- function handleHostMouseleave() {
153
+ function handleReferenceMouseleave() {
152
154
  return __async(this, null, function* () {
153
155
  if (options.trigger !== "hover") {
154
156
  return;
155
157
  }
156
- enterHost = false;
158
+ enterReference = false;
157
159
  yield doubleRaf();
158
160
  if (enterPopover) {
159
161
  return;
@@ -174,7 +176,7 @@ function usePopover(options) {
174
176
  }
175
177
  enterPopover = false;
176
178
  yield doubleRaf();
177
- if (enterHost) {
179
+ if (enterReference) {
178
180
  return;
179
181
  }
180
182
  close();