@ibragim-dev-org/ui-forge-library 1.1.3 → 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,
|
|
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
|
|
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.
|
|
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
|
|
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
|
});
|