@ibragim-dev-org/ui-forge-library 1.1.2 → 1.1.4

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 { input, effect, Directive, Injectable, EventEmitter, Output, Input, PLATFORM_ID, Inject, Pipe, Attribute, ChangeDetectionStrategy, Component, model, signal, computed, viewChild, untracked, output, Injector, afterRenderEffect, contentChildren, contentChild, ViewChildren } from '@angular/core';
2
+ import { input, effect, Directive, Injectable, EventEmitter, Output, Input, PLATFORM_ID, Inject, Pipe, Attribute, ChangeDetectionStrategy, Component, signal, model, computed, viewChild, untracked, output, Injector, afterRenderEffect, contentChildren, contentChild, ViewChildren } from '@angular/core';
3
3
  import { isPlatformBrowser, DOCUMENT, NgStyle } from '@angular/common';
4
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import { fromEvent, tap, debounceTime, asyncScheduler, Subscription, timer, switchMap, scheduled, filter, take, BehaviorSubject, Subject, takeUntil } from 'rxjs';
@@ -539,7 +539,7 @@ class CountryService {
539
539
  class ThemeService {
540
540
  document;
541
541
  themes = {};
542
- activeTheme;
542
+ $activeTheme = signal('', ...(ngDevMode ? [{ debugName: "$activeTheme" }] : []));
543
543
  constructor(document) {
544
544
  this.document = document;
545
545
  }
@@ -551,31 +551,23 @@ class ThemeService {
551
551
  */
552
552
  init(themes, activeTheme) {
553
553
  this.themes = themes;
554
- this.activeTheme = activeTheme;
554
+ this.$activeTheme.set(activeTheme);
555
555
  this.update();
556
556
  }
557
- /**
558
- * Returns the name of the currently active theme.
559
- *
560
- * @returns The active theme name
561
- */
562
- getActive() {
563
- return this.activeTheme;
564
- }
565
557
  /**
566
558
  * Sets a new active theme by name and applies its styles.
567
559
  *
568
560
  * @param name - The name of the theme to activate
569
561
  */
570
562
  set(name) {
571
- this.activeTheme = name;
563
+ this.$activeTheme.set(name);
572
564
  this.update();
573
565
  }
574
566
  /**
575
567
  * Applies the current theme's styles to the document body using CSS variables.
576
568
  */
577
569
  update() {
578
- const theme = this.themes[this.activeTheme];
570
+ const theme = this.themes[this.$activeTheme()];
579
571
  Object.entries(theme).forEach(([key, value]) => {
580
572
  this.document.body.style.setProperty(key, value);
581
573
  });
@@ -1798,8 +1790,7 @@ class UiDropdownService extends UiPopupService {
1798
1790
  if (fetchedParameters.hasAttachedWidth) {
1799
1791
  attachedWidth = attachedRef.clientWidth;
1800
1792
  }
1801
- // Reset old outside listeners before opening a new dropdown to avoid stale close callbacks.
1802
- if (this.popupInstances.length) {
1793
+ if (fetchedParameters.removePrevious && this.popupInstances.length) {
1803
1794
  this.destroyOutsideClickSubscription$.next();
1804
1795
  }
1805
1796
  if (fetchedParameters.removePrevious && this.popupInstances.length) {
@@ -1831,8 +1822,7 @@ class UiDropdownService extends UiPopupService {
1831
1822
  */
1832
1823
  openAtMousePosition(component, event, id, parameters = {}) {
1833
1824
  const fetchedParameters = this.fetchDropDownParameters(parameters);
1834
- // Reset old outside listeners before opening a new dropdown to avoid stale close callbacks.
1835
- if (this.popupInstances.length) {
1825
+ if (fetchedParameters.removePrevious && this.popupInstances.length) {
1836
1826
  this.destroyOutsideClickSubscription$.next();
1837
1827
  }
1838
1828
  if (fetchedParameters.removePrevious && this.popupInstances.length) {