@ship-ui/core 0.14.23 → 0.15.0

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Renderer2, ChangeDetectionStrategy, Component, signal, DestroyRef, InjectionToken, input, computed, viewChild, effect, HostListener, NgModule, Injectable, model, output, ApplicationRef, createComponent, isSignal, OutputEmitterRef, contentChild, contentChildren, afterNextRender, assertInInjectionContext, Injector, HostBinding, TemplateRef, runInInjectionContext, Directive, ChangeDetectorRef, viewChildren, ViewContainerRef, EnvironmentInjector } from '@angular/core';
2
+ import { inject, ElementRef, Renderer2, ChangeDetectionStrategy, Component, signal, DestroyRef, InjectionToken, input, computed, viewChild, effect, HostListener, NgModule, Injectable, DOCUMENT, model, output, ApplicationRef, createComponent, isSignal, OutputEmitterRef, contentChild, contentChildren, afterNextRender, assertInInjectionContext, Injector, HostBinding, TemplateRef, runInInjectionContext, Directive, ChangeDetectorRef, viewChildren, ViewContainerRef, EnvironmentInjector } from '@angular/core';
3
3
  import { DatePipe, NgTemplateOutlet } from '@angular/common';
4
4
  import { NgModel } from '@angular/forms';
5
5
  import { SIGNAL } from '@angular/core/primitives/signals';
@@ -355,6 +355,7 @@ const DEFAULT_OPTIONS$1 = {
355
355
  };
356
356
  class ShipDialogComponent {
357
357
  constructor() {
358
+ this.#document = inject(DOCUMENT);
358
359
  this.#shConfig = inject(SHIP_CONFIG, { optional: true });
359
360
  this.dialogRef = viewChild('dialogRef', ...(ngDevMode ? [{ debugName: "dialogRef" }] : []));
360
361
  this.isOpen = model(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
@@ -380,7 +381,7 @@ class ShipDialogComponent {
380
381
  }, {
381
382
  signal: this.abortController?.signal,
382
383
  });
383
- document.addEventListener('keydown', (e) => {
384
+ this.#document.addEventListener('keydown', (e) => {
384
385
  if (e.key === 'Escape' && !this.defaultOptionMerge().closeOnEsc) {
385
386
  e.preventDefault();
386
387
  }
@@ -397,6 +398,7 @@ class ShipDialogComponent {
397
398
  }
398
399
  }, ...(ngDevMode ? [{ debugName: "isOpenEffect" }] : []));
399
400
  }
401
+ #document;
400
402
  #shConfig;
401
403
  ngOnDestroy() {
402
404
  this.abortController?.abort();
@@ -452,13 +454,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
452
454
 
453
455
  class ShipDialogService {
454
456
  constructor() {
455
- this.#bodyEl = typeof document !== 'undefined' ? document.querySelector('body') : null;
457
+ this.#document = inject(DOCUMENT);
458
+ this.#bodyEl = this.#document.querySelector('body');
456
459
  this.#appRef = inject(ApplicationRef);
457
460
  this.compRef = null;
458
461
  this.insertedCompRef = null;
459
462
  this.closedFieldSub = null;
460
463
  this.compClosedSub = null;
461
464
  }
465
+ #document;
462
466
  #bodyEl;
463
467
  #appRef;
464
468
  open(component, options) {
@@ -515,12 +519,12 @@ class ShipDialogService {
515
519
  };
516
520
  }
517
521
  #createEl() {
518
- const wrapperEl = document.createElement('sh-dialog-ref');
522
+ const wrapperEl = this.#document.createElement('sh-dialog-ref');
519
523
  wrapperEl.id = 'sh-dialog-ref';
520
- if (!document.getElementById('sh-dialog-ref')) {
524
+ if (!this.#document.getElementById('sh-dialog-ref')) {
521
525
  this.#bodyEl?.append(wrapperEl);
522
526
  }
523
- return document.getElementById('sh-dialog-ref');
527
+ return this.#document.getElementById('sh-dialog-ref');
524
528
  }
525
529
  #cleanupRefs() {
526
530
  if (this.insertedCompRef) {
@@ -550,7 +554,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
550
554
  class ShipButtonGroupComponent {
551
555
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipButtonGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
552
556
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.6", type: ShipButtonGroupComponent, isStandalone: true, selector: "sh-button-group", ngImport: i0, template: `
553
- <ng-content></ng-content>
557
+ <ng-content />
554
558
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
555
559
  }
556
560
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipButtonGroupComponent, decorators: [{
@@ -559,7 +563,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
559
563
  selector: 'sh-button-group',
560
564
  imports: [],
561
565
  template: `
562
- <ng-content></ng-content>
566
+ <ng-content />
563
567
  `,
564
568
  changeDetection: ChangeDetectionStrategy.OnPush,
565
569
  }]
@@ -590,7 +594,7 @@ class ShipCardComponent {
590
594
  #shConfig;
591
595
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
592
596
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.6", type: ShipCardComponent, isStandalone: true, selector: "sh-card", host: { properties: { "class": "class()" } }, ngImport: i0, template: `
593
- <ng-content></ng-content>
597
+ <ng-content />
594
598
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
595
599
  }
596
600
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipCardComponent, decorators: [{
@@ -599,7 +603,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
599
603
  selector: 'sh-card',
600
604
  imports: [],
601
605
  template: `
602
- <ng-content></ng-content>
606
+ <ng-content />
603
607
  `,
604
608
  changeDetection: ChangeDetectionStrategy.OnPush,
605
609
  host: {
@@ -641,14 +645,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
641
645
 
642
646
  class ShipChipComponent {
643
647
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
644
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.6", type: ShipChipComponent, isStandalone: true, selector: "sh-chip", host: { classAttribute: "sh-sheet" }, ngImport: i0, template: '<div><ng-content></ng-content></div>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
648
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.6", type: ShipChipComponent, isStandalone: true, selector: "sh-chip", host: { classAttribute: "sh-sheet" }, ngImport: i0, template: '<div><ng-content /></div>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
645
649
  }
646
650
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipChipComponent, decorators: [{
647
651
  type: Component,
648
652
  args: [{
649
653
  selector: 'sh-chip',
650
654
  imports: [],
651
- template: '<div><ng-content></ng-content></div>',
655
+ template: '<div><ng-content /></div>',
652
656
  changeDetection: ChangeDetectionStrategy.OnPush,
653
657
  host: {
654
658
  class: 'sh-sheet',
@@ -661,6 +665,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
661
665
  // - Add alpha support
662
666
  class ShipColorPickerComponent {
663
667
  constructor() {
668
+ this.#document = inject(DOCUMENT);
664
669
  this.canvasRef = viewChild.required('colorCanvas');
665
670
  this.canvasData = signal(null, ...(ngDevMode ? [{ debugName: "canvasData" }] : []));
666
671
  this.showDarkColors = input(false, ...(ngDevMode ? [{ debugName: "showDarkColors" }] : []));
@@ -706,6 +711,7 @@ class ShipColorPickerComponent {
706
711
  }, ...(ngDevMode ? [{ debugName: "renderingTypeEffect" }] : []));
707
712
  this.initColor = null;
708
713
  }
714
+ #document;
709
715
  onResize() {
710
716
  this.setCanvasSize();
711
717
  }
@@ -771,22 +777,22 @@ class ShipColorPickerComponent {
771
777
  this.isDragging.set(true);
772
778
  this.updateColorAndMarker(event);
773
779
  });
774
- document.addEventListener('mousemove', (event) => {
780
+ this.#document.addEventListener('mousemove', (event) => {
775
781
  if (this.isDragging()) {
776
782
  event.preventDefault();
777
783
  this.updateColorAndMarker(event, true);
778
784
  }
779
785
  });
780
- document.addEventListener('mouseup', () => this.isDragging.set(false));
786
+ this.#document.addEventListener('mouseup', () => this.isDragging.set(false));
781
787
  canvas.addEventListener('touchstart', (_) => this.isDragging.set(true));
782
- document.addEventListener('touchmove', (event) => {
788
+ this.#document.addEventListener('touchmove', (event) => {
783
789
  if (this.isDragging()) {
784
790
  event.preventDefault();
785
791
  this.updateColorAndMarker(event.touches[0], true);
786
792
  }
787
793
  });
788
- document.addEventListener('touchend', () => this.isDragging.set(false));
789
- document.addEventListener('touchcancel', () => this.isDragging.set(false));
794
+ this.#document.addEventListener('touchend', () => this.isDragging.set(false));
795
+ this.#document.addEventListener('touchcancel', () => this.isDragging.set(false));
790
796
  }
791
797
  setCanvasSize() {
792
798
  const canvas = this.canvasRef()?.nativeElement;
@@ -1011,6 +1017,7 @@ const DEFAULT_OPTIONS = {
1011
1017
  };
1012
1018
  class ShipPopoverComponent {
1013
1019
  constructor() {
1020
+ this.#document = inject(DOCUMENT);
1014
1021
  this.#BASE_SPACE = 4;
1015
1022
  this.SUPPORTS_ANCHOR = typeof CSS !== 'undefined' && CSS.supports('position-anchor', '--abc') && CSS.supports('anchor-name', '--abc');
1016
1023
  this.asMultiLayer = input(false, ...(ngDevMode ? [{ debugName: "asMultiLayer" }] : []));
@@ -1039,7 +1046,7 @@ class ShipPopoverComponent {
1039
1046
  signal: this.openAbort?.signal,
1040
1047
  };
1041
1048
  popoverEl?.showPopover();
1042
- document.addEventListener('keydown', (e) => {
1049
+ this.#document.addEventListener('keydown', (e) => {
1043
1050
  if (e.key === 'Escape' && !this.defaultOptionMerge().closeOnEsc) {
1044
1051
  e.preventDefault();
1045
1052
  }
@@ -1061,6 +1068,7 @@ class ShipPopoverComponent {
1061
1068
  }
1062
1069
  }, ...(ngDevMode ? [{ debugName: "openEffect" }] : []));
1063
1070
  }
1071
+ #document;
1064
1072
  #BASE_SPACE;
1065
1073
  toggleIsOpen(event) {
1066
1074
  event.preventDefault();
@@ -1083,7 +1091,7 @@ class ShipPopoverComponent {
1083
1091
  }
1084
1092
  parent = parent.parentElement;
1085
1093
  }
1086
- return document.documentElement;
1094
+ return this.#document.documentElement;
1087
1095
  }
1088
1096
  #calculateMenuPosition() {
1089
1097
  const triggerRect = this.triggerRef()?.nativeElement.getBoundingClientRect();
@@ -1118,12 +1126,13 @@ class ShipPopoverComponent {
1118
1126
  }
1119
1127
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipPopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1120
1128
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.1.6", type: ShipPopoverComponent, isStandalone: true, selector: "sh-popover", inputs: { asMultiLayer: { classPropertyName: "asMultiLayer", publicName: "asMultiLayer", isSignal: true, isRequired: false, transformFunction: null }, disableOpenByClick: { classPropertyName: "disableOpenByClick", publicName: "disableOpenByClick", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", closed: "closed" }, host: { properties: { "class.multi-layer": "asMultiLayer()" } }, viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerRef"], descendants: true, isSignal: true }, { propertyName: "popoverRef", first: true, predicate: ["popoverRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
1121
- <div class="trigger" #triggerRef [style.anchor-name]="id()" (click)="toggleIsOpen($event)">
1129
+ <div class="trigger" #triggerRef (click)="toggleIsOpen($event)">
1122
1130
  <div class="trigger-wrapper">
1123
1131
  <ng-content select="[trigger]" />
1124
1132
  <ng-content select="button" />
1125
1133
  <ng-content select="[shButton]" />
1126
1134
  </div>
1135
+ <div class="trigger-anchor" [style.anchor-name]="id()"></div>
1127
1136
  </div>
1128
1137
 
1129
1138
  <div popover #popoverRef class="popover" [style.position-anchor]="id()" [style]="menuStyle()">
@@ -1138,12 +1147,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
1138
1147
  selector: 'sh-popover',
1139
1148
  imports: [],
1140
1149
  template: `
1141
- <div class="trigger" #triggerRef [style.anchor-name]="id()" (click)="toggleIsOpen($event)">
1150
+ <div class="trigger" #triggerRef (click)="toggleIsOpen($event)">
1142
1151
  <div class="trigger-wrapper">
1143
1152
  <ng-content select="[trigger]" />
1144
1153
  <ng-content select="button" />
1145
1154
  <ng-content select="[shButton]" />
1146
1155
  </div>
1156
+ <div class="trigger-anchor" [style.anchor-name]="id()"></div>
1147
1157
  </div>
1148
1158
 
1149
1159
  <div popover #popoverRef class="popover" [style.position-anchor]="id()" [style]="menuStyle()">
@@ -4000,6 +4010,7 @@ function watchHostClass(className) {
4000
4010
  }
4001
4011
  class ShipSidenavComponent {
4002
4012
  constructor() {
4013
+ this.#document = inject(DOCUMENT);
4003
4014
  this.#selfRef = inject(ElementRef);
4004
4015
  this.openWidth = 280;
4005
4016
  this.openWidthTreshold = this.openWidth * 0.5;
@@ -4044,16 +4055,17 @@ class ShipSidenavComponent {
4044
4055
  return this.isOpen() ? `translateX(${this.openWidth}px)` : `translateX(0px)`;
4045
4056
  }, ...(ngDevMode ? [{ debugName: "draggingStyle" }] : []));
4046
4057
  this.draggingEffect = effect(() => {
4047
- if (typeof document === 'undefined' || this.disableDrag())
4058
+ if (this.disableDrag())
4048
4059
  return;
4049
4060
  if (this.isDragging()) {
4050
- document.body.classList.add('dragging');
4061
+ this.#document.body.classList.add('dragging');
4051
4062
  }
4052
4063
  else {
4053
- document.body.classList.remove('dragging');
4064
+ this.#document.body.classList.remove('dragging');
4054
4065
  }
4055
4066
  }, ...(ngDevMode ? [{ debugName: "draggingEffect" }] : []));
4056
4067
  }
4068
+ #document;
4057
4069
  #selfRef;
4058
4070
  #closestParent;
4059
4071
  #closestParentRect;
@@ -4150,7 +4162,7 @@ class ShipSidenavComponent {
4150
4162
  </div>
4151
4163
 
4152
4164
  <main>
4153
- <ng-content></ng-content>
4165
+ <ng-content />
4154
4166
  </main>
4155
4167
  </div>
4156
4168
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
@@ -4191,7 +4203,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
4191
4203
  </div>
4192
4204
 
4193
4205
  <main>
4194
- <ng-content></ng-content>
4206
+ <ng-content />
4195
4207
  </main>
4196
4208
  </div>
4197
4209
  `,
@@ -4296,6 +4308,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
4296
4308
 
4297
4309
  class ShipSortableDirective {
4298
4310
  constructor() {
4311
+ this.#document = inject(DOCUMENT);
4299
4312
  this.#selfEl = inject((ElementRef));
4300
4313
  this.#renderer = inject(Renderer2);
4301
4314
  this.#placeholderEl = signal(null, ...(ngDevMode ? [{ debugName: "#placeholderEl" }] : []));
@@ -4378,6 +4391,7 @@ class ShipSortableDirective {
4378
4391
  }
4379
4392
  });
4380
4393
  }
4394
+ #document;
4381
4395
  #selfEl;
4382
4396
  #renderer;
4383
4397
  #placeholderEl;
@@ -4389,7 +4403,7 @@ class ShipSortableDirective {
4389
4403
  dragStart(e) {
4390
4404
  if (e.target && e.dataTransfer) {
4391
4405
  const targetElement = e.target;
4392
- const currentTarget = document.elementFromPoint(e.clientX, e.clientY);
4406
+ const currentTarget = this.#document.elementFromPoint(e.clientX, e.clientY);
4393
4407
  const isSortingHandle = currentTarget?.hasAttribute('sort-handle') || currentTarget?.closest('[sort-handle]') !== null;
4394
4408
  let draggedElement;
4395
4409
  if (isSortingHandle) {
@@ -4980,7 +4994,7 @@ class ShipToggleCardComponent {
4980
4994
 
4981
4995
  <div class="collapsable">
4982
4996
  <div class="content">
4983
- <ng-content></ng-content>
4997
+ <ng-content />
4984
4998
  </div>
4985
4999
  </div>
4986
5000
  `, isInline: true, dependencies: [{ kind: "component", type: ShipIconComponent, selector: "sh-icon" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
@@ -5001,7 +5015,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
5001
5015
 
5002
5016
  <div class="collapsable">
5003
5017
  <div class="content">
5004
- <ng-content></ng-content>
5018
+ <ng-content />
5005
5019
  </div>
5006
5020
  </div>
5007
5021
  `,
@@ -5040,6 +5054,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
5040
5054
 
5041
5055
  class ShipTooltipComponent {
5042
5056
  constructor() {
5057
+ this.#document = inject(DOCUMENT);
5043
5058
  this.#BASE_SPACE = 4;
5044
5059
  this.SUPPORTS_ANCHOR = CSS.supports('position-anchor', '--abc') && CSS.supports('anchor-name', '--abc');
5045
5060
  this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
@@ -5081,10 +5096,11 @@ class ShipTooltipComponent {
5081
5096
  this.calculateMenuPosition();
5082
5097
  const scrollableParent = this.#findScrollableParent(this.tooltipRef()?.nativeElement);
5083
5098
  scrollableParent.addEventListener('scroll', () => this.calculateMenuPosition(), { signal });
5084
- document.addEventListener('resize', () => this.calculateMenuPosition(), { signal });
5099
+ this.#document.addEventListener('resize', () => this.calculateMenuPosition(), { signal });
5085
5100
  }, ...(ngDevMode ? [{ debugName: "calcPositionEffect" }] : []));
5086
5101
  this.scrollableStyles = ['scroll', 'auto'];
5087
5102
  }
5103
+ #document;
5088
5104
  #BASE_SPACE;
5089
5105
  #findScrollableParent(element) {
5090
5106
  let parent = element.parentElement;
@@ -5095,7 +5111,7 @@ class ShipTooltipComponent {
5095
5111
  }
5096
5112
  parent = parent.parentElement;
5097
5113
  }
5098
- return document.documentElement;
5114
+ return this.#document.documentElement;
5099
5115
  }
5100
5116
  eventClose($event) {
5101
5117
  $event.stopPropagation();
@@ -5339,7 +5355,7 @@ class ShipVirtualScrollComponent {
5339
5355
  <div class="viewport" #viewport (scroll)="onScroll()">
5340
5356
  <div class="total-height" [style.height]="totalHeight() + 'px'"></div>
5341
5357
  <div class="items-container" [style.transform]="'translateY(' + translateY() + 'px)'">
5342
- <ng-content></ng-content>
5358
+ <ng-content />
5343
5359
  </div>
5344
5360
  </div>
5345
5361
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
@@ -5353,7 +5369,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
5353
5369
  <div class="viewport" #viewport (scroll)="onScroll()">
5354
5370
  <div class="total-height" [style.height]="totalHeight() + 'px'"></div>
5355
5371
  <div class="items-container" [style.transform]="'translateY(' + translateY() + 'px)'">
5356
- <ng-content></ng-content>
5372
+ <ng-content />
5357
5373
  </div>
5358
5374
  </div>
5359
5375
  `,
@@ -5490,9 +5506,9 @@ class ShipTooltipWrapper {
5490
5506
  this.#positionAbort?.abort();
5491
5507
  }
5492
5508
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipTooltipWrapper, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5493
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: ShipTooltipWrapper, isStandalone: true, selector: "ship-tooltip-wrapper", inputs: { positionAnchorName: { classPropertyName: "positionAnchorName", publicName: "positionAnchorName", isSignal: true, isRequired: true, transformFunction: null }, anchorEl: { classPropertyName: "anchorEl", publicName: "anchorEl", isSignal: true, isRequired: true, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tooltip" }, properties: { "attr.popover": "\"auto\"", "style.position-anchor": "positionAnchorName()", "class.below": "isBelow()" } }, ngImport: i0, template: `
5509
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: ShipTooltipWrapper, isStandalone: true, selector: "ship-tooltip-wrapper", inputs: { positionAnchorName: { classPropertyName: "positionAnchorName", publicName: "positionAnchorName", isSignal: true, isRequired: true, transformFunction: null }, anchorEl: { classPropertyName: "anchorEl", publicName: "anchorEl", isSignal: true, isRequired: true, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tooltip" }, properties: { "attr.popover": "\"manual\"", "style.position-anchor": "positionAnchorName()", "class.below": "isBelow()" } }, ngImport: i0, template: `
5494
5510
  <div class="tooltip-content">
5495
- <ng-content></ng-content>
5511
+ <ng-content />
5496
5512
  </div>
5497
5513
  `, isInline: true }); }
5498
5514
  }
@@ -5503,12 +5519,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
5503
5519
  standalone: true,
5504
5520
  template: `
5505
5521
  <div class="tooltip-content">
5506
- <ng-content></ng-content>
5522
+ <ng-content />
5507
5523
  </div>
5508
5524
  `,
5509
5525
  host: {
5510
5526
  role: 'tooltip',
5511
- '[attr.popover]': '"auto"',
5527
+ '[attr.popover]': '"manual"',
5512
5528
  '[style.position-anchor]': 'positionAnchorName()',
5513
5529
  '[class.below]': 'isBelow()',
5514
5530
  },
@@ -5523,6 +5539,7 @@ class ShipTooltipDirective {
5523
5539
  this.#environmentInjector = inject(EnvironmentInjector);
5524
5540
  this.#renderer = inject(Renderer2);
5525
5541
  this.#projectedViewRef = null;
5542
+ this.DEBOUNCE_DELAY = 500;
5526
5543
  this.anchorName = `--${generateUniqueId()}`;
5527
5544
  this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
5528
5545
  }
@@ -5532,14 +5549,31 @@ class ShipTooltipDirective {
5532
5549
  #renderer;
5533
5550
  #projectedViewRef;
5534
5551
  onMouseEnter() {
5535
- if (openRef?.component !== this) {
5552
+ if (openRef?.component.anchorName !== this.anchorName) {
5536
5553
  this.cleanupTooltip();
5537
5554
  }
5555
+ this.cancelCleanupTimer();
5538
5556
  queueMicrotask(() => this.showTooltip());
5539
5557
  }
5558
+ onMouseLeave() {
5559
+ this.startCleanupTimer();
5560
+ }
5540
5561
  ngOnDestroy() {
5562
+ this.cancelCleanupTimer();
5541
5563
  this.cleanupTooltip();
5542
5564
  }
5565
+ startCleanupTimer() {
5566
+ this.cancelCleanupTimer();
5567
+ this.debounceTimer = setTimeout(() => {
5568
+ this.cleanupTooltip();
5569
+ }, this.DEBOUNCE_DELAY);
5570
+ }
5571
+ cancelCleanupTimer() {
5572
+ if (this.debounceTimer) {
5573
+ clearTimeout(this.debounceTimer);
5574
+ this.debounceTimer = null;
5575
+ }
5576
+ }
5543
5577
  showTooltip() {
5544
5578
  if (openRef?.wrapperComponentRef || !this.shTooltip())
5545
5579
  return;
@@ -5567,12 +5601,19 @@ class ShipTooltipDirective {
5567
5601
  openRef.wrapperComponentRef.setInput('anchorEl', this.#elementRef);
5568
5602
  openRef.wrapperComponentRef?.setInput('isOpen', this.isOpen);
5569
5603
  openRef.wrapperComponentRef.changeDetectorRef.detectChanges();
5604
+ openRef.wrapperComponentRef.location.nativeElement.addEventListener('mouseenter', () => {
5605
+ this.cancelCleanupTimer();
5606
+ });
5607
+ openRef.wrapperComponentRef.location.nativeElement.addEventListener('mouseleave', () => {
5608
+ this.startCleanupTimer();
5609
+ });
5570
5610
  setTimeout(() => {
5571
5611
  this.isOpen.set(true);
5572
5612
  });
5573
5613
  }
5574
5614
  cleanupTooltip() {
5575
5615
  if (openRef?.wrapperComponentRef) {
5616
+ openRef.component.cancelCleanupTimer();
5576
5617
  openRef.wrapperComponentRef.destroy();
5577
5618
  openRef.component.isOpen.set(false);
5578
5619
  openRef = null;
@@ -5583,7 +5624,7 @@ class ShipTooltipDirective {
5583
5624
  }
5584
5625
  }
5585
5626
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
5586
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.6", type: ShipTooltipDirective, isStandalone: true, selector: "[shTooltip]", inputs: { shTooltip: { classPropertyName: "shTooltip", publicName: "shTooltip", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()" }, properties: { "style.anchor-name": "anchorName", "class.active": "isOpen()" }, classAttribute: "tooltip" }, ngImport: i0 }); }
5627
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.6", type: ShipTooltipDirective, isStandalone: true, selector: "[shTooltip]", inputs: { shTooltip: { classPropertyName: "shTooltip", publicName: "shTooltip", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" }, properties: { "style.anchor-name": "anchorName", "class.active": "isOpen()" }, classAttribute: "tooltip" }, ngImport: i0 }); }
5587
5628
  }
5588
5629
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipTooltipDirective, decorators: [{
5589
5630
  type: Directive,
@@ -5599,6 +5640,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
5599
5640
  }], propDecorators: { onMouseEnter: [{
5600
5641
  type: HostListener,
5601
5642
  args: ['mouseenter']
5643
+ }], onMouseLeave: [{
5644
+ type: HostListener,
5645
+ args: ['mouseleave']
5602
5646
  }] } });
5603
5647
 
5604
5648
  /*