@oscarpalmer/mora 0.38.0 → 0.39.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/batch.d.mts +1 -3
- package/dist/batch.mjs +3 -4
- package/dist/constants.d.mts +16 -10
- package/dist/constants.mjs +12 -6
- package/dist/effect.d.mts +2 -3
- package/dist/effect.mjs +27 -8
- package/dist/helpers/is.d.mts +1 -3
- package/dist/helpers/is.mjs +8 -5
- package/dist/helpers/misc.d.mts +8 -4
- package/dist/helpers/misc.mjs +66 -4
- package/dist/helpers/proxy.d.mts +3 -4
- package/dist/helpers/proxy.mjs +26 -11
- package/dist/helpers/subscription.d.mts +1 -3
- package/dist/helpers/subscription.mjs +15 -7
- package/dist/helpers/value.d.mts +4 -5
- package/dist/helpers/value.mjs +18 -13
- package/dist/models.d.mts +38 -5
- package/dist/mora.full.mjs +555 -276
- package/dist/value/array.d.mts +1 -3
- package/dist/value/array.mjs +46 -22
- package/dist/value/computed.d.mts +1 -3
- package/dist/value/computed.mjs +17 -11
- package/dist/value/readonly.d.mts +2 -5
- package/dist/value/readonly.mjs +24 -16
- package/dist/value/signal.d.mts +1 -3
- package/dist/value/signal.mjs +9 -6
- package/dist/value/store.d.mts +1 -3
- package/dist/value/store.mjs +9 -6
- package/package.json +5 -12
- package/src/batch.ts +8 -4
- package/src/constants.ts +26 -16
- package/src/effect.ts +37 -7
- package/src/helpers/is.ts +18 -8
- package/src/helpers/misc.ts +121 -2
- package/src/helpers/proxy.ts +59 -9
- package/src/helpers/subscription.ts +34 -4
- package/src/helpers/value.ts +48 -15
- package/src/models.ts +42 -3
- package/src/value/array.ts +100 -21
- package/src/value/computed.ts +29 -10
- package/src/value/readonly.ts +38 -33
- package/src/value/signal.ts +11 -5
- package/src/value/store.ts +11 -5
- package/types/batch.d.ts +0 -11
- package/types/constants.d.ts +0 -16
- package/types/effect.d.ts +0 -13
- package/types/helpers/is.d.ts +0 -43
- package/types/helpers/proxy.d.ts +0 -11
- package/types/helpers/value.d.ts +0 -4
- package/types/index.d.ts +0 -9
- package/types/models.d.ts +0 -56
- package/types/subscription.d.ts +0 -11
- package/types/value/array.d.ts +0 -137
- package/types/value/computed.d.ts +0 -14
- package/types/value/reactive.d.ts +0 -36
- package/types/value/signal.d.ts +0 -26
- package/types/value/store.d.ts +0 -94
package/dist/models.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { PROPERTY_LENGTH, SYMBOL_EFFECT, SYMBOL_STATE } from "./constants.mjs";
|
|
1
|
+
import { PROPERTY_LENGTH, SYMBOL_EFFECT, SYMBOL_READONLY, SYMBOL_STATE } from "./constants.mjs";
|
|
2
2
|
import { Subscription, Subscriptions } from "@oscarpalmer/atoms/subscription";
|
|
3
3
|
import { GenericCallback, Key, PlainObject } from "@oscarpalmer/atoms/models";
|
|
4
|
-
//#region src/models.d.ts
|
|
5
4
|
export type Active = {
|
|
6
5
|
computed?: ComputedEffect;
|
|
7
6
|
effect?: EffectState;
|
|
@@ -17,9 +16,20 @@ export type ComputedEffect = {
|
|
|
17
16
|
instance: EffectState;
|
|
18
17
|
notify: boolean;
|
|
19
18
|
};
|
|
20
|
-
export type Effect = {
|
|
19
|
+
export type Effect = {
|
|
20
|
+
/**
|
|
21
|
+
* Is the effect active?
|
|
22
|
+
*/
|
|
23
|
+
get active(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Stop the effect
|
|
26
|
+
*/
|
|
27
|
+
stop(): void;
|
|
28
|
+
};
|
|
21
29
|
export type EffectState = {
|
|
30
|
+
active: boolean;
|
|
22
31
|
callback: GenericCallback;
|
|
32
|
+
name: string;
|
|
23
33
|
};
|
|
24
34
|
export type InternalArray = {
|
|
25
35
|
[SYMBOL_STATE]: ReactiveProxyState;
|
|
@@ -27,8 +37,14 @@ export type InternalArray = {
|
|
|
27
37
|
export type InternalComputed = {
|
|
28
38
|
[SYMBOL_EFFECT]: ComputedEffect;
|
|
29
39
|
} & Computed<unknown> & InternalStateful;
|
|
40
|
+
export type InternalEffect = {
|
|
41
|
+
[SYMBOL_STATE]: EffectState;
|
|
42
|
+
} & Effect;
|
|
43
|
+
export type InternalReactive = {
|
|
44
|
+
[SYMBOL_STATE]: SignalState;
|
|
45
|
+
} & Reactive<unknown>;
|
|
30
46
|
export type InternalReadonly = {
|
|
31
|
-
|
|
47
|
+
[SYMBOL_READONLY]: ReadonlyState;
|
|
32
48
|
} & InternalStateful & ReadonlySignal<unknown>;
|
|
33
49
|
export type InternalSignal = InternalStateful & Signal<unknown>;
|
|
34
50
|
export type InternalStateful = {
|
|
@@ -38,6 +54,14 @@ export type InternalStore = {
|
|
|
38
54
|
[SYMBOL_STATE]: ReactiveProxyState;
|
|
39
55
|
} & ReactiveStore<PlainObject>;
|
|
40
56
|
export type Reactive<Value> = {
|
|
57
|
+
/**
|
|
58
|
+
* Is the signal active?
|
|
59
|
+
*/
|
|
60
|
+
get active(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Deactivate the signal, preventing further updates
|
|
63
|
+
*/
|
|
64
|
+
deactivate(): void;
|
|
41
65
|
/**
|
|
42
66
|
* Get the value
|
|
43
67
|
*
|
|
@@ -264,14 +288,17 @@ export type ReactiveOptions<Value> = {
|
|
|
264
288
|
equal?: (first: Value, second: Value) => boolean;
|
|
265
289
|
};
|
|
266
290
|
export type ReactiveProxyState = {
|
|
291
|
+
derived?: Set<Computed<unknown>>;
|
|
267
292
|
isArray: boolean;
|
|
268
293
|
length?: Signal<number>;
|
|
269
294
|
mapped?: Map<string, InternalComputed>;
|
|
270
295
|
} & SignalState;
|
|
271
296
|
export type ReactiveState<Value = unknown, Item = Value> = {
|
|
297
|
+
active: boolean;
|
|
272
298
|
computeds?: Set<ComputedEffect>;
|
|
273
299
|
effects?: Set<EffectState>;
|
|
274
300
|
equal?: (first: Item, second: Item) => boolean;
|
|
301
|
+
name: string;
|
|
275
302
|
promise?: Promise<unknown>;
|
|
276
303
|
promises?: Map<Key, Promise<never>>;
|
|
277
304
|
subscriptions?: Subscriptions<GenericCallback>;
|
|
@@ -407,6 +434,12 @@ export type ReadonlySignal<Value> = {
|
|
|
407
434
|
get frozen(): boolean;
|
|
408
435
|
} & Reactive<Value>;
|
|
409
436
|
export type ReadonlySignalValue<Value> = Value extends unknown[] ? Readonly<Value> : Value extends PlainObject ? Readonly<Value> : Value;
|
|
437
|
+
export type ReadonlyState = {
|
|
438
|
+
active: boolean;
|
|
439
|
+
name: string;
|
|
440
|
+
subscriptions?: Set<Subscription>;
|
|
441
|
+
value?: unknown;
|
|
442
|
+
};
|
|
410
443
|
export type Signal<Value> = {
|
|
411
444
|
/**
|
|
412
445
|
* Get a readonly version of the signal
|
|
@@ -447,4 +480,4 @@ export type StoredSubscription = {
|
|
|
447
480
|
};
|
|
448
481
|
export type Subscriber<Value> = (value: Value, subscription: Subscription) => void;
|
|
449
482
|
export type SubscriptionType = "copy" | "frozen" | "original" | "readonly";
|
|
450
|
-
|
|
483
|
+
export {};
|