@ship-ui/core 0.15.5 → 0.15.7

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.
@@ -369,13 +369,15 @@ class ShipDialogComponent {
369
369
  this.abortController = null;
370
370
  this.isOpenEffect = effect(() => {
371
371
  const dialogEl = this.dialogRef()?.nativeElement;
372
+ if (!dialogEl)
373
+ return;
372
374
  if (this.abortController) {
373
375
  this.abortController.abort();
374
376
  }
375
377
  this.abortController = new AbortController();
376
378
  if (this.isOpen()) {
377
- dialogEl?.showModal();
378
- dialogEl?.addEventListener('close', () => {
379
+ dialogEl.showModal();
380
+ dialogEl.addEventListener('close', () => {
379
381
  this.isOpen.set(false);
380
382
  this.closed.emit();
381
383
  }, {
@@ -393,8 +395,8 @@ class ShipDialogComponent {
393
395
  });
394
396
  }
395
397
  else {
396
- this.closed.emit();
397
- dialogEl?.close();
398
+ dialogEl.close();
399
+ queueMicrotask(() => this.closed.emit());
398
400
  }
399
401
  }, ...(ngDevMode ? [{ debugName: "isOpenEffect" }] : []));
400
402
  }
@@ -406,22 +408,25 @@ class ShipDialogComponent {
406
408
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
407
409
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: ShipDialogComponent, isStandalone: true, selector: "sh-dialog", inputs: { 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" }, viewQueries: [{ propertyName: "dialogRef", first: true, predicate: ["dialogRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
408
410
  @let options = this.defaultOptionMerge();
409
- <dialog
410
- shDialog
411
- #dialogRef
412
- [class]="options.class"
413
- [style.width]="options.width ?? ''"
414
- [style.max-width]="options.maxWidth ?? ''"
415
- [style.max-height]="options.maxHeight ?? ''"
416
- [style.height]="options.height ?? ''">
417
- <div class="content">
418
- <ng-content />
419
- </div>
420
411
 
421
- @if (this.defaultOptionMerge().closeOnOutsideClick) {
422
- <div class="closeable-overlay" (click)="isOpen.set(false)"></div>
423
- }
424
- </dialog>
412
+ @if (isOpen()) {
413
+ <dialog
414
+ shDialog
415
+ #dialogRef
416
+ [class]="options.class"
417
+ [style.width]="options.width ?? ''"
418
+ [style.max-width]="options.maxWidth ?? ''"
419
+ [style.max-height]="options.maxHeight ?? ''"
420
+ [style.height]="options.height ?? ''">
421
+ <div class="content">
422
+ <ng-content />
423
+ </div>
424
+
425
+ @if (this.defaultOptionMerge().closeOnOutsideClick) {
426
+ <div class="closeable-overlay" (click)="isOpen.set(false)"></div>
427
+ }
428
+ </dialog>
429
+ }
425
430
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
426
431
  }
427
432
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipDialogComponent, decorators: [{
@@ -431,22 +436,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
431
436
  imports: [],
432
437
  template: `
433
438
  @let options = this.defaultOptionMerge();
434
- <dialog
435
- shDialog
436
- #dialogRef
437
- [class]="options.class"
438
- [style.width]="options.width ?? ''"
439
- [style.max-width]="options.maxWidth ?? ''"
440
- [style.max-height]="options.maxHeight ?? ''"
441
- [style.height]="options.height ?? ''">
442
- <div class="content">
443
- <ng-content />
444
- </div>
445
439
 
446
- @if (this.defaultOptionMerge().closeOnOutsideClick) {
447
- <div class="closeable-overlay" (click)="isOpen.set(false)"></div>
448
- }
449
- </dialog>
440
+ @if (isOpen()) {
441
+ <dialog
442
+ shDialog
443
+ #dialogRef
444
+ [class]="options.class"
445
+ [style.width]="options.width ?? ''"
446
+ [style.max-width]="options.maxWidth ?? ''"
447
+ [style.max-height]="options.maxHeight ?? ''"
448
+ [style.height]="options.height ?? ''">
449
+ <div class="content">
450
+ <ng-content />
451
+ </div>
452
+
453
+ @if (this.defaultOptionMerge().closeOnOutsideClick) {
454
+ <div class="closeable-overlay" (click)="isOpen.set(false)"></div>
455
+ }
456
+ </dialog>
457
+ }
450
458
  `,
451
459
  changeDetection: ChangeDetectionStrategy.OnPush,
452
460
  }]