wave-ui 4.0.0 → 4.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-ui",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "A UI framework for Vue.js 3 (and 2) with only the bright side. :sunny:",
5
5
  "author": "Antoni Andre <antoniandre.web@gmail.com>",
6
6
  "homepage": "https://antoniandre.github.io/wave-ui",
@@ -1,7 +1,7 @@
1
1
  <template lang="pug">
2
2
  slot(name="activator")
3
3
  slot(v-if="!$slots.activator")
4
- teleport(:to="teleportTarget" :disabled="!teleportTarget")
4
+ teleport(v-if="detachableDomReady" :to="teleportTarget" :disabled="!teleportTarget")
5
5
  transition(:name="transitionName" appear @after-leave="onAfterLeave")
6
6
  .w-menu(
7
7
  v-if="custom && detachableVisible"
@@ -1,7 +1,7 @@
1
1
  <template lang="pug">
2
2
  slot(name="activator")
3
3
  slot(v-if="!$slots.activator")
4
- teleport(:to="teleportTarget" :disabled="!teleportTarget")
4
+ teleport(v-if="detachableDomReady" :to="teleportTarget" :disabled="!teleportTarget")
5
5
  transition(:name="transitionName" appear @after-leave="onAfterLeave")
6
6
  .w-tooltip(
7
7
  v-if="detachableVisible"
@@ -44,6 +44,11 @@ export default {
44
44
  },
45
45
 
46
46
  data: () => ({
47
+ /**
48
+ * When false (SSR + first hydrated paint), the Teleport subtree is not rendered so HTML matches.
49
+ * Set true in mounted(), then the menu/tooltip portal attaches — avoids Nuxt/Vue hydration mismatches.
50
+ */
51
+ detachableDomReady: false,
47
52
  // The event listeners handlers have to be removed the exact same way they have been attached.
48
53
  // Since the handler functions have variables that change after hot-reload, keep them exactly
49
54
  // as is in an array so we can delete them on destroy.
@@ -464,29 +469,32 @@ export default {
464
469
  },
465
470
 
466
471
  mounted () {
467
- if (this.activator) {
468
- // External activator: attach via document-level delegation.
469
- this.bindActivatorEvents()
470
- }
471
- else {
472
- // Slot-based activator: auto-attach DOM listeners to the slot's root element on next tick
473
- // so the slot content is guaranteed to be in the DOM.
474
- this.$nextTick(() => {
475
- // Re-check activator prop (might have resolved from a Vue ref after the tick).
476
- if (this.activator) this.bindActivatorEvents()
477
- else this._attachActivatorListeners()
478
-
479
- if (this.modelValue && !this.disable) this.open({ target: this.activatorEl })
480
- })
481
- }
472
+ this.detachableDomReady = true
473
+ this.$nextTick(() => {
474
+ if (this.activator) {
475
+ // External activator: attach via document-level delegation.
476
+ this.bindActivatorEvents()
477
+ }
478
+ else {
479
+ // Slot-based activator: auto-attach DOM listeners to the slot's root element on next tick
480
+ // so the slot content is guaranteed to be in the DOM.
481
+ this.$nextTick(() => {
482
+ // Re-check activator prop (might have resolved from a Vue ref after the tick).
483
+ if (this.activator) this.bindActivatorEvents()
484
+ else this._attachActivatorListeners()
485
+
486
+ if (this.modelValue && !this.disable) this.open({ target: this.activatorEl })
487
+ })
488
+ }
482
489
 
483
- // Unwrap the overlay if any.
484
- if (this.overlay) this.overlayEl = this.$refs.overlay?.$el
490
+ // Unwrap the overlay if any.
491
+ if (this.overlay) this.overlayEl = this.$refs.overlay?.$el
485
492
 
486
- if (this.modelValue && this.activator && !this.disable) {
487
- this.toggle({ type: this.shouldShowOnClick ? 'click' : 'mouseenter', target: this.activatorEl })
488
- }
489
- else if (this.modelValue && !this.disable) this.open({ target: this.activatorEl })
493
+ if (this.modelValue && this.activator && !this.disable) {
494
+ this.toggle({ type: this.shouldShowOnClick ? 'click' : 'mouseenter', target: this.activatorEl })
495
+ }
496
+ else if (this.modelValue && !this.disable) this.open({ target: this.activatorEl })
497
+ })
490
498
  },
491
499
 
492
500
  unmounted () {