@alwatr/signal 5.2.2 → 6.0.0

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.
package/dist/type.d.ts CHANGED
@@ -93,7 +93,7 @@ export interface SignalConfig {
93
93
  * 'user-profile-signal'
94
94
  * 'app-theme-signal'
95
95
  */
96
- signalId: string;
96
+ name: string;
97
97
  /**
98
98
  * An optional callback function that will be executed when the signal's `destroy` method is called.
99
99
  * This is useful for cleaning up additional resources used by the signal,
@@ -122,7 +122,7 @@ export interface IReadonlySignal<T> {
122
122
  /**
123
123
  * The unique identifier for this signal instance. Useful for debugging.
124
124
  */
125
- readonly signalId: string;
125
+ readonly name: string;
126
126
  /**
127
127
  * The current value of the signal.
128
128
  */
@@ -207,7 +207,7 @@ export interface EffectSignalConfig {
207
207
  * 'user-profile-signal'
208
208
  * 'app-theme-signal'
209
209
  */
210
- signalId?: string;
210
+ name?: string;
211
211
  /**
212
212
  * An array of dependency signals (`StateSignal` or `ComputedSignal` instances).
213
213
  * The effect's `run` function will be executed whenever any of these signals change.
@@ -246,7 +246,7 @@ export interface IEffectSignal {
246
246
  /**
247
247
  * The unique identifier for this signal instance.
248
248
  */
249
- signalId: string;
249
+ name: string;
250
250
  /**
251
251
  * Permanently disposes of the effect, unsubscribing from all dependencies
252
252
  * and stopping any future executions. This is crucial for preventing memory leaks
@@ -270,9 +270,9 @@ export interface DebounceSignalConfig extends Omit<DebouncerConfig<never>, 'func
270
270
  /**
271
271
  * A unique identifier for the signal. This is crucial for debugging and differentiating signals.
272
272
  *
273
- * @default `${sourceSignal.signalId}-debounced`
273
+ * @default `${sourceSignal.name}-debounced`
274
274
  */
275
- signalId?: string;
275
+ name?: string;
276
276
  /**
277
277
  * An optional callback executed when the signal's `destroy` method is called.
278
278
  * Useful for cleaning up resources tied to the debounced signal.
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,OAA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AS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB"}
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@alwatr/signal",
3
3
  "description": "Alwatr Signal is a powerful, lightweight, and modern reactive programming library. It is inspired by the best concepts from major reactive libraries but engineered to be faster and more efficient than all of them. It provides a robust and elegant way to manage application state through a system of signals, offering fine-grained reactivity, predictability, and excellent performance.",
4
- "version": "5.2.2",
4
+ "version": "6.0.0",
5
5
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
6
  "bugs": "https://github.com/Alwatr/flux/issues",
7
7
  "dependencies": {
8
- "@alwatr/debounce": "^1.1.2",
9
- "@alwatr/delay": "^6.0.5",
10
- "@alwatr/logger": "^6.0.1"
8
+ "@alwatr/debounce": "^1.1.3",
9
+ "@alwatr/delay": "^6.0.6",
10
+ "@alwatr/logger": "^6.0.3"
11
11
  },
12
12
  "devDependencies": {
13
- "@alwatr/nano-build": "^6.2.0",
13
+ "@alwatr/nano-build": "^6.2.1",
14
14
  "@alwatr/prettier-config": "^5.0.3",
15
15
  "@alwatr/tsconfig-base": "^6.0.1",
16
- "@alwatr/type-helper": "^6.0.2",
16
+ "@alwatr/type-helper": "^6.1.0",
17
17
  "@jest/globals": "^30.1.2",
18
- "@types/node": "^22.18.3",
18
+ "@types/node": "^22.18.6",
19
19
  "jest": "^30.1.3",
20
20
  "typescript": "^5.9.2"
21
21
  },
@@ -68,5 +68,5 @@
68
68
  },
69
69
  "type": "module",
70
70
  "types": "./dist/main.d.ts",
71
- "gitHead": "c166edf9ae27929a21678ea65d23556cb7d9286a"
71
+ "gitHead": "ca38674339f4836ffcce1e1801c7ccb6b58c90f2"
72
72
  }
@@ -9,13 +9,13 @@ describe('ComputedSignal', () => {
9
9
  let dep2;
10
10
  /** @type {ComputedSignal<number>} */
11
11
  let signal;
12
- const signalId = 'test-computed-signal';
12
+ const name = 'test-computed-signal';
13
13
 
14
14
  beforeEach(() => {
15
- dep1 = new StateSignal({signalId: 'dep1', initialValue: 1});
16
- dep2 = new StateSignal({signalId: 'dep2', initialValue: 2});
15
+ dep1 = new StateSignal({name: 'dep1', initialValue: 1});
16
+ dep2 = new StateSignal({name: 'dep2', initialValue: 2});
17
17
  signal = new ComputedSignal({
18
- signalId,
18
+ name,
19
19
  deps: [dep1, dep2],
20
20
  get: () => dep1.get() + dep2.get(),
21
21
  });
@@ -27,10 +27,10 @@ describe('ComputedSignal', () => {
27
27
  dep2.destroy();
28
28
  });
29
29
 
30
- it('should be defined and have the correct signalId and initial value', () => {
30
+ it('should be defined and have the correct name and initial value', () => {
31
31
  expect(ComputedSignal).toBeDefined();
32
32
  expect(signal).toBeInstanceOf(ComputedSignal);
33
- expect(signal.signalId).toBe(signalId);
33
+ expect(signal.name).toBe(name);
34
34
  expect(signal.get()).toBe(3); // 1 + 2
35
35
  });
36
36
 
@@ -120,7 +120,7 @@ describe('ComputedSignal', () => {
120
120
 
121
121
  it('should handle no dependencies', () => {
122
122
  const noDepSignal = new ComputedSignal({
123
- signalId: 'no-dep',
123
+ name: 'no-dep',
124
124
  deps: [],
125
125
  get: () => 42,
126
126
  });
@@ -9,7 +9,7 @@ describe('EffectSignal', () => {
9
9
  let effectSignal;
10
10
 
11
11
  beforeEach(() => {
12
- depSignal = new StateSignal({signalId: 'dep', initialValue: 0});
12
+ depSignal = new StateSignal({name: 'dep', initialValue: 0});
13
13
  });
14
14
 
15
15
  afterEach(() => {
@@ -79,7 +79,7 @@ describe('EffectSignal', () => {
79
79
  });
80
80
 
81
81
  it('should handle multiple dependencies', async () => {
82
- const depSignal2 = new StateSignal({signalId: 'dep2', initialValue: 'a'});
82
+ const depSignal2 = new StateSignal({name: 'dep2', initialValue: 'a'});
83
83
  const runFn = jest.fn();
84
84
  effectSignal = new EffectSignal({
85
85
  deps: [depSignal, depSignal2],
@@ -5,20 +5,20 @@ import {delay} from '@alwatr/delay';
5
5
  describe('EventSignal', () => {
6
6
  /** @type {EventSignal<unknown>} */
7
7
  let signal;
8
- const signalId = 'test-event-signal';
8
+ const name = 'test-event-signal';
9
9
 
10
10
  beforeEach(() => {
11
- signal = new EventSignal({signalId});
11
+ signal = new EventSignal({name});
12
12
  });
13
13
 
14
14
  afterEach(() => {
15
15
  signal.destroy();
16
16
  });
17
17
 
18
- it('should be defined and have the correct signalId', () => {
18
+ it('should be defined and have the correct name', () => {
19
19
  expect(EventSignal).toBeDefined();
20
20
  expect(signal).toBeInstanceOf(EventSignal);
21
- expect(signal.signalId).toBe(signalId);
21
+ expect(signal.name).toBe(name);
22
22
  });
23
23
 
24
24
  it('should dispatch an event and notify a subscriber with the correct payload', async () => {
@@ -85,7 +85,7 @@ describe('EventSignal', () => {
85
85
  });
86
86
 
87
87
  it('should handle dispatching without a payload (void)', async () => {
88
- const voidSignal = new EventSignal({signalId: 'void-signal'});
88
+ const voidSignal = new EventSignal({name: 'void-signal'});
89
89
  const callback = jest.fn();
90
90
  voidSignal.subscribe(callback);
91
91
 
@@ -162,25 +162,41 @@ describe('EventSignal', () => {
162
162
  await expect(secondPromise).resolves.toBe(payload);
163
163
  });
164
164
 
165
+ it('should multiple dispatch calls notify subscribers each time', async () => {
166
+ const callback = jest.fn();
167
+ signal.subscribe(callback);
168
+
169
+ signal.dispatch(1);
170
+ signal.dispatch(2);
171
+ signal.dispatch(3);
172
+
173
+ await delay.nextMacrotask();
174
+
175
+ expect(callback).toHaveBeenCalledTimes(3);
176
+ expect(callback).toHaveBeenNthCalledWith(1, 1);
177
+ expect(callback).toHaveBeenNthCalledWith(2, 2);
178
+ expect(callback).toHaveBeenNthCalledWith(3, 3);
179
+ });
180
+
165
181
  describe('destroyed signal', () => {
166
182
  beforeEach(() => {
167
183
  signal.destroy();
168
184
  });
169
185
 
170
186
  it('should throw an error when dispatch is called on a destroyed signal', () => {
171
- expect(() => signal.dispatch('test')).toThrow(`Cannot interact with a destroyed signal (id: ${signalId})`);
187
+ expect(() => signal.dispatch('test')).toThrow(`Cannot interact with a destroyed signal (id: ${name})`);
172
188
  });
173
189
 
174
190
  it('should throw an error when subscribe is called on a destroyed signal', () => {
175
- expect(() => signal.subscribe(jest.fn())).toThrow(`Cannot interact with a destroyed signal (id: ${signalId})`);
191
+ expect(() => signal.subscribe(jest.fn())).toThrow(`Cannot interact with a destroyed signal (id: ${name})`);
176
192
  });
177
193
 
178
194
  it('should throw an error when untilNext is called on a destroyed signal', () => {
179
- expect(() => signal.untilNext()).toThrow(`Cannot interact with a destroyed signal (id: ${signalId})`);
195
+ expect(() => signal.untilNext()).toThrow(`Cannot interact with a destroyed signal (id: ${name})`);
180
196
  });
181
197
 
182
198
  it('should not notify any listeners after being destroyed', async () => {
183
- const localSignal = new EventSignal({signalId: 'local'});
199
+ const localSignal = new EventSignal({name: 'local'});
184
200
  const callback = jest.fn();
185
201
  localSignal.subscribe(callback);
186
202
 
@@ -5,20 +5,20 @@ import {delay} from '@alwatr/delay';
5
5
  describe('StateSignal', () => {
6
6
  /** @type {StateSignal<number>} */
7
7
  let signal;
8
- const signalId = 'test-state-signal';
8
+ const name = 'test-state-signal';
9
9
 
10
10
  beforeEach(() => {
11
- signal = new StateSignal({signalId, initialValue: 0});
11
+ signal = new StateSignal({name, initialValue: 0});
12
12
  });
13
13
 
14
14
  afterEach(() => {
15
15
  signal.destroy();
16
16
  });
17
17
 
18
- it('should be defined and have the correct signalId and initial value', () => {
18
+ it('should be defined and have the correct name and initial value', () => {
19
19
  expect(StateSignal).toBeDefined();
20
20
  expect(signal).toBeInstanceOf(StateSignal);
21
- expect(signal.signalId).toBe(signalId);
21
+ expect(signal.name).toBe(name);
22
22
  expect(signal.get()).toBe(0);
23
23
  });
24
24
 
@@ -154,7 +154,7 @@ describe('StateSignal', () => {
154
154
  it('should notify subscribers multiple times for object values when they change', async () => {
155
155
  const callback = jest.fn();
156
156
  const value = {a: 1};
157
- const signal = new StateSignal({signalId: 'object-signal', initialValue: value});
157
+ const signal = new StateSignal({name: 'object-signal', initialValue: value});
158
158
 
159
159
  signal.subscribe(callback, {receivePrevious: false});
160
160
 
@@ -221,23 +221,23 @@ describe('StateSignal', () => {
221
221
  });
222
222
 
223
223
  it('should throw an error when set is called on a destroyed signal', () => {
224
- expect(() => signal.set(1)).toThrow(`Cannot interact with a destroyed signal (id: ${signalId})`);
224
+ expect(() => signal.set(1)).toThrow(`Cannot interact with a destroyed signal (id: ${name})`);
225
225
  });
226
226
 
227
227
  it('should throw an error when subscribe is called on a destroyed signal', () => {
228
- expect(() => signal.subscribe(jest.fn())).toThrow(`Cannot interact with a destroyed signal (id: ${signalId})`);
228
+ expect(() => signal.subscribe(jest.fn())).toThrow(`Cannot interact with a destroyed signal (id: ${name})`);
229
229
  });
230
230
 
231
231
  it('should throw an error when untilNext is called on a destroyed signal', () => {
232
- expect(() => signal.untilNext()).toThrow(`Cannot interact with a destroyed signal (id: ${signalId})`);
232
+ expect(() => signal.untilNext()).toThrow(`Cannot interact with a destroyed signal (id: ${name})`);
233
233
  });
234
234
 
235
235
  it('should throw an error when accessing value on a destroyed signal', () => {
236
- expect(() => signal.get()).toThrow(`Cannot interact with a destroyed signal (id: ${signalId})`);
236
+ expect(() => signal.get()).toThrow(`Cannot interact with a destroyed signal (id: ${name})`);
237
237
  });
238
238
 
239
239
  it('should not notify any listeners after being destroyed', async () => {
240
- const localSignal = new StateSignal({signalId: 'local', initialValue: 0});
240
+ const localSignal = new StateSignal({name: 'local', initialValue: 0});
241
241
  const callback = jest.fn();
242
242
  localSignal.subscribe(callback, {receivePrevious: false});
243
243
 
@@ -6,7 +6,7 @@ describe('createDebouncedSignal', () => {
6
6
  let debouncedSignal;
7
7
  /** @type {StateSignal<number>} */
8
8
  let sourceSignal;
9
- const signalId = 'test-debounce-signal';
9
+ const name = 'test-debounce-signal';
10
10
  /**
11
11
  * @type {import("jest-mock").Mock<import("jest-mock").UnknownFunction>}
12
12
  */
@@ -15,7 +15,7 @@ describe('createDebouncedSignal', () => {
15
15
  beforeEach(() => {
16
16
  mockFunc = jest.fn();
17
17
  jest.useFakeTimers();
18
- sourceSignal = new StateSignal({signalId, initialValue: 0});
18
+ sourceSignal = new StateSignal({name, initialValue: 0});
19
19
  });
20
20
 
21
21
  afterEach(() => {
@@ -28,7 +28,7 @@ describe('createDebouncedSignal', () => {
28
28
  it('should create a debounced signal with default config', () => {
29
29
  debouncedSignal = createDebouncedSignal(sourceSignal, {delay: 100});
30
30
  expect(debouncedSignal.get()).toBe(0);
31
- expect(debouncedSignal.signalId).toBe(`${signalId}-debounced`);
31
+ expect(debouncedSignal.name).toBe(`${name}-debounced`);
32
32
  });
33
33
 
34
34
  it('should debounce updates with trailing edge', async () => {
@@ -81,9 +81,9 @@ describe('createDebouncedSignal', () => {
81
81
  expect(onDestroyMock).toHaveBeenCalled();
82
82
  });
83
83
 
84
- it('should use custom signalId if provided', () => {
85
- debouncedSignal = createDebouncedSignal(sourceSignal, {delay: 100, signalId: 'custom-debounced'});
86
- expect(debouncedSignal.signalId).toBe('custom-debounced');
84
+ it('should use custom name if provided', () => {
85
+ debouncedSignal = createDebouncedSignal(sourceSignal, {delay: 100, name: 'custom-debounced'});
86
+ expect(debouncedSignal.name).toBe('custom-debounced');
87
87
  });
88
88
 
89
89
  it('should handle multiple rapid updates correctly', async () => {