@ship-ui/core 0.14.11 → 0.14.12

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.
@@ -5533,6 +5533,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
5533
5533
  },
5534
5534
  }]
5535
5535
  }], ctorParameters: () => [] });
5536
+ let openRef = null;
5536
5537
  class ShipTooltipDirective {
5537
5538
  constructor() {
5538
5539
  this.shTooltip = input.required(...(ngDevMode ? [{ debugName: "shTooltip" }] : []));
@@ -5540,7 +5541,6 @@ class ShipTooltipDirective {
5540
5541
  this.#viewContainerRef = inject(ViewContainerRef);
5541
5542
  this.#environmentInjector = inject(EnvironmentInjector);
5542
5543
  this.#renderer = inject(Renderer2);
5543
- this.#wrapperComponentRef = null;
5544
5544
  this.#projectedViewRef = null;
5545
5545
  this.anchorName = `--${generateUniqueId()}`;
5546
5546
  this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
@@ -5549,19 +5549,19 @@ class ShipTooltipDirective {
5549
5549
  #viewContainerRef;
5550
5550
  #environmentInjector;
5551
5551
  #renderer;
5552
- #wrapperComponentRef;
5553
5552
  #projectedViewRef;
5554
5553
  onMouseEnter() {
5555
- this.cleanupTooltip();
5554
+ if (openRef?.component !== this) {
5555
+ this.cleanupTooltip();
5556
+ }
5556
5557
  queueMicrotask(() => this.showTooltip());
5557
5558
  }
5558
5559
  ngOnDestroy() {
5559
5560
  this.cleanupTooltip();
5560
5561
  }
5561
5562
  showTooltip() {
5562
- if (this.#wrapperComponentRef || !this.shTooltip())
5563
+ if (openRef?.wrapperComponentRef || !this.shTooltip())
5563
5564
  return;
5564
- this.isOpen.set(true);
5565
5565
  let nodesToProject;
5566
5566
  const content = this.shTooltip();
5567
5567
  if (typeof content === 'string') {
@@ -5575,20 +5575,26 @@ class ShipTooltipDirective {
5575
5575
  else {
5576
5576
  return;
5577
5577
  }
5578
- this.#wrapperComponentRef = this.#viewContainerRef.createComponent(ShipTooltipWrapper, {
5579
- environmentInjector: this.#environmentInjector,
5580
- projectableNodes: nodesToProject,
5578
+ openRef = {
5579
+ wrapperComponentRef: this.#viewContainerRef.createComponent(ShipTooltipWrapper, {
5580
+ environmentInjector: this.#environmentInjector,
5581
+ projectableNodes: nodesToProject,
5582
+ }),
5583
+ component: this,
5584
+ };
5585
+ openRef.wrapperComponentRef.setInput('positionAnchorName', this.anchorName);
5586
+ openRef.wrapperComponentRef.setInput('anchorEl', this.#elementRef);
5587
+ openRef.wrapperComponentRef?.setInput('isOpen', this.isOpen);
5588
+ openRef.wrapperComponentRef.changeDetectorRef.detectChanges();
5589
+ setTimeout(() => {
5590
+ this.isOpen.set(true);
5581
5591
  });
5582
- this.#wrapperComponentRef.setInput('positionAnchorName', this.anchorName);
5583
- this.#wrapperComponentRef.setInput('anchorEl', this.#elementRef);
5584
- this.#wrapperComponentRef.setInput('isOpen', this.isOpen);
5585
- this.#wrapperComponentRef.changeDetectorRef.detectChanges();
5586
5592
  }
5587
5593
  cleanupTooltip() {
5588
- this.isOpen.set(false);
5589
- if (this.#wrapperComponentRef) {
5590
- this.#wrapperComponentRef.destroy();
5591
- this.#wrapperComponentRef = null;
5594
+ if (openRef?.wrapperComponentRef) {
5595
+ openRef.wrapperComponentRef.destroy();
5596
+ openRef.component.isOpen.set(false);
5597
+ openRef = null;
5592
5598
  }
5593
5599
  if (this.#projectedViewRef) {
5594
5600
  this.#projectedViewRef.destroy();