@ship-ui/core 0.14.5 → 0.14.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.
@@ -1,6 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Renderer2, ChangeDetectionStrategy, Component, signal, DestroyRef, input, computed, viewChild, effect, HostListener, NgModule, Injectable, InjectionToken, model, output, ApplicationRef, createComponent, isSignal, OutputEmitterRef, contentChildren, afterNextRender, assertInInjectionContext, Injector, HostBinding, contentChild, TemplateRef, runInInjectionContext, Directive, ChangeDetectorRef, viewChildren, ViewContainerRef, EnvironmentInjector } from '@angular/core';
3
- import { SHIP_CONFIG as SHIP_CONFIG$1 } from 'ship-ui';
2
+ import { inject, ElementRef, Renderer2, ChangeDetectionStrategy, Component, signal, DestroyRef, InjectionToken, input, computed, viewChild, effect, HostListener, NgModule, Injectable, model, output, ApplicationRef, createComponent, isSignal, OutputEmitterRef, contentChildren, afterNextRender, assertInInjectionContext, Injector, HostBinding, contentChild, TemplateRef, runInInjectionContext, Directive, ChangeDetectorRef, viewChildren, ViewContainerRef, EnvironmentInjector } from '@angular/core';
4
3
  import { DatePipe, NgTemplateOutlet } from '@angular/common';
5
4
  import { SIGNAL } from '@angular/core/primitives/signals';
6
5
 
@@ -56,10 +55,12 @@ function classMutationSignal() {
56
55
  return classListSignal.asReadonly();
57
56
  }
58
57
 
58
+ const SHIP_CONFIG = new InjectionToken('Ship UI Config');
59
+
59
60
  const POSSIBLE_VARIANTS = ['simple', 'outlined', 'flat', 'raised'];
60
61
  class ShipAlertComponent {
61
62
  constructor() {
62
- this.#shConfig = inject(SHIP_CONFIG$1, { optional: true });
63
+ this.#shConfig = inject(SHIP_CONFIG, { optional: true });
63
64
  this.variant = signal(this.#shConfig?.alertVariant ?? '', ...(ngDevMode ? [{ debugName: "variant" }] : []));
64
65
  this._el = inject(ElementRef); // Used by alert container
65
66
  this.alertService = input(null, ...(ngDevMode ? [{ debugName: "alertService" }] : []));
@@ -67,10 +68,11 @@ class ShipAlertComponent {
67
68
  this.currentClasses = classMutationSignal();
68
69
  this.activeClass = computed(() => {
69
70
  const variant = this.variant();
71
+ const _current = `${this.currentClasses()} sh-sheet`;
70
72
  if (!variant)
71
- return this.currentClasses();
73
+ return _current;
72
74
  const hasVariant = POSSIBLE_VARIANTS.find((x) => this.currentClasses().includes(x));
73
- return hasVariant ? this.currentClasses() : `${this.currentClasses()} ${variant}`;
75
+ return hasVariant ? _current : `${_current} ${variant}`;
74
76
  }, ...(ngDevMode ? [{ debugName: "activeClass" }] : []));
75
77
  }
76
78
  #shConfig;
@@ -80,7 +82,7 @@ class ShipAlertComponent {
80
82
  }
81
83
  }
82
84
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ShipAlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
83
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: ShipAlertComponent, isStandalone: true, selector: "sh-alert", inputs: { alertService: { classPropertyName: "alertService", publicName: "alertService", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "sh-sheet" }, ngImport: i0, template: `
85
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: ShipAlertComponent, isStandalone: true, selector: "sh-alert", inputs: { alertService: { classPropertyName: "alertService", publicName: "alertService", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "activeClass()" } }, ngImport: i0, template: `
84
86
  <div class="alert">
85
87
  <div #ref class="icon" [style.display]="!ref.children.length ? 'none' : 'block'">
86
88
  <ng-content select="[icon]" />
@@ -168,7 +170,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
168
170
  `,
169
171
  changeDetection: ChangeDetectionStrategy.OnPush,
170
172
  host: {
171
- class: 'sh-sheet',
173
+ '[class]': 'activeClass()',
172
174
  },
173
175
  }]
174
176
  }] });
@@ -340,8 +342,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
340
342
  }]
341
343
  }] });
342
344
 
343
- const SHIP_CONFIG = new InjectionToken('Ship UI Config');
344
-
345
345
  const DEFAULT_OPTIONS$1 = {
346
346
  class: 'default',
347
347
  width: undefined,