@ibragim-dev-org/ui-forge-library 1.3.1 → 1.3.2

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.
@@ -1067,7 +1067,6 @@ class UiAlertMessagesService {
1067
1067
  }
1068
1068
  }
1069
1069
  remove(alert) {
1070
- // Cancel any active timer for this alert
1071
1070
  const subscription = this.timerSubscriptions.get(alert.id);
1072
1071
  if (subscription) {
1073
1072
  subscription.unsubscribe();
@@ -1087,6 +1086,12 @@ class UiAlertMessagesService {
1087
1086
  }))
1088
1087
  .subscribe();
1089
1088
  }
1089
+ removeById(id) {
1090
+ const alert = this.$alerts().find((x) => x.id === id);
1091
+ if (alert) {
1092
+ this.remove(alert);
1093
+ }
1094
+ }
1090
1095
  removeAll() {
1091
1096
  this.$alerts.set([]);
1092
1097
  timer(250)
@@ -1118,16 +1123,14 @@ class UiAlertMessagesService {
1118
1123
  }), take(1))
1119
1124
  .subscribe();
1120
1125
  this.$alerts.set([...this.$alerts(), alert]);
1121
- // Create pausable timer with 100ms intervals
1122
1126
  this.timerState.set(alert.id, { paused: false, elapsed: 0 });
1123
- const DURATION = 10000; // 10 seconds
1124
- const CHECK_INTERVAL = 100; // Check every 100ms
1127
+ const DURATION = 10000;
1128
+ const CHECK_INTERVAL = 100;
1125
1129
  const subscription = interval(CHECK_INTERVAL)
1126
1130
  .pipe(takeWhile(() => {
1127
1131
  const state = this.timerState.get(alert.id);
1128
1132
  if (!state)
1129
1133
  return false;
1130
- // Only increment elapsed time if not paused
1131
1134
  if (!state.paused) {
1132
1135
  state.elapsed += CHECK_INTERVAL;
1133
1136
  }