@oscarpalmer/mora 0.17.0 → 0.18.1
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/helpers/is.cjs +7 -1
- package/dist/helpers/is.js +8 -2
- package/dist/helpers/proxy.cjs +43 -0
- package/dist/helpers/proxy.js +43 -0
- package/dist/helpers/value.cjs +20 -24
- package/dist/helpers/value.js +20 -24
- package/dist/index.cjs +2 -0
- package/dist/index.js +3 -1
- package/dist/mora.full.js +107 -43
- package/dist/node_modules/@oscarpalmer/atoms/dist/internal/is.cjs +17 -0
- package/dist/node_modules/@oscarpalmer/atoms/dist/internal/is.js +17 -0
- package/dist/value/array.cjs +10 -16
- package/dist/value/array.js +11 -17
- package/dist/value/signal.cjs +1 -1
- package/dist/value/signal.js +2 -2
- package/dist/value/store.cjs +36 -0
- package/dist/value/store.js +36 -0
- package/package.json +1 -1
- package/src/helpers/is.ts +7 -1
- package/src/helpers/proxy.ts +71 -0
- package/src/helpers/value.ts +23 -33
- package/src/index.ts +1 -0
- package/src/value/array.ts +11 -30
- package/src/value/signal.ts +2 -2
- package/src/value/store.ts +90 -0
- package/types/helpers/is.d.ts +3 -0
- package/types/helpers/proxy.d.ts +5 -0
- package/types/helpers/value.d.ts +1 -2
- package/types/index.d.ts +1 -0
- package/types/value/store.d.ts +45 -0
- package/types/batch.d.cts +0 -79
- package/types/effect.d.cts +0 -16
- package/types/helpers/is.d.cts +0 -176
- package/types/helpers/value.d.cts +0 -72
- package/types/index.d.cts +0 -196
- package/types/subscription.d.cts +0 -71
- package/types/value/array.d.cts +0 -144
- package/types/value/computed.d.cts +0 -81
- package/types/value/reactive.d.cts +0 -68
- package/types/value/signal.d.cts +0 -87
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export type GenericCallback = (...args: any[]) => any;
|
|
4
|
-
declare class Effect {
|
|
5
|
-
private readonly $mora;
|
|
6
|
-
private readonly state;
|
|
7
|
-
constructor(callback: GenericCallback);
|
|
8
|
-
}
|
|
9
|
-
export type ComputedEffect = {
|
|
10
|
-
dirty: boolean;
|
|
11
|
-
instance: Effect;
|
|
12
|
-
};
|
|
13
|
-
export type InternalComputed = {
|
|
14
|
-
readonly effect: ComputedEffect;
|
|
15
|
-
readonly state: ReactiveState<unknown, unknown>;
|
|
16
|
-
};
|
|
17
|
-
export declare let activeComputed: Computed<unknown> | undefined;
|
|
18
|
-
export declare class Computed<Value> extends Reactive<Value> {
|
|
19
|
-
private readonly effect;
|
|
20
|
-
constructor(callback: () => Value, options?: ReactiveOptions<Value>);
|
|
21
|
-
/**
|
|
22
|
-
* @inheritdoc
|
|
23
|
-
*/
|
|
24
|
-
get(): Value;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Create a computed value
|
|
28
|
-
*/
|
|
29
|
-
export declare function computed<Value>(callback: () => Value, options?: ReactiveOptions<Value>): Computed<Value>;
|
|
30
|
-
declare abstract class Reactive<Value, Equal = Value> {
|
|
31
|
-
protected readonly state: ReactiveState<Value, Equal>;
|
|
32
|
-
constructor(name: string, value: Value, options?: ReactiveOptions<Equal>);
|
|
33
|
-
/**
|
|
34
|
-
* Get the value
|
|
35
|
-
*/
|
|
36
|
-
abstract get(): Value;
|
|
37
|
-
/**
|
|
38
|
-
* Get the value _(without reactivity)_
|
|
39
|
-
*/
|
|
40
|
-
peek(): Value;
|
|
41
|
-
/**
|
|
42
|
-
* Subscribe to changes
|
|
43
|
-
*/
|
|
44
|
-
subscribe(callback: (value: Value) => void): Unsubscribe;
|
|
45
|
-
/**
|
|
46
|
-
* JSON representation of the value
|
|
47
|
-
*/
|
|
48
|
-
toJSON(): Value;
|
|
49
|
-
/**
|
|
50
|
-
* String representation of the value
|
|
51
|
-
*/
|
|
52
|
-
toString(): string;
|
|
53
|
-
/**
|
|
54
|
-
* Unsubscribe from changes
|
|
55
|
-
*/
|
|
56
|
-
unsubscribe(callback: (value: Value) => void): void;
|
|
57
|
-
}
|
|
58
|
-
export type ReactiveOptions<Value> = {
|
|
59
|
-
/**
|
|
60
|
-
* Method to compare values for equality
|
|
61
|
-
*/
|
|
62
|
-
equal?: (first: Value, second: Value) => boolean;
|
|
63
|
-
};
|
|
64
|
-
export type ReactiveState<Value, Equal> = {
|
|
65
|
-
computeds: Set<Computed<unknown>>;
|
|
66
|
-
effects: Set<Effect>;
|
|
67
|
-
equal: (first: Equal, second: Equal) => boolean;
|
|
68
|
-
subscriptions: Map<(value: Value) => void, Subscription<Value>>;
|
|
69
|
-
value: Value;
|
|
70
|
-
};
|
|
71
|
-
declare class Subscription<Value> {
|
|
72
|
-
state: ReactiveState<Value, never>;
|
|
73
|
-
callback: GenericCallback;
|
|
74
|
-
constructor(state: ReactiveState<Value, never>, callback: GenericCallback);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Unsubscribe from changes
|
|
78
|
-
*/
|
|
79
|
-
export type Unsubscribe = () => void;
|
|
80
|
-
|
|
81
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export type GenericCallback = (...args: any[]) => any;
|
|
4
|
-
declare class Effect {
|
|
5
|
-
private readonly $mora;
|
|
6
|
-
private readonly state;
|
|
7
|
-
constructor(callback: GenericCallback);
|
|
8
|
-
}
|
|
9
|
-
declare class Computed<Value> extends Reactive<Value> {
|
|
10
|
-
private readonly effect;
|
|
11
|
-
constructor(callback: () => Value, options?: ReactiveOptions<Value>);
|
|
12
|
-
/**
|
|
13
|
-
* @inheritdoc
|
|
14
|
-
*/
|
|
15
|
-
get(): Value;
|
|
16
|
-
}
|
|
17
|
-
export declare abstract class Reactive<Value, Equal = Value> {
|
|
18
|
-
protected readonly state: ReactiveState<Value, Equal>;
|
|
19
|
-
constructor(name: string, value: Value, options?: ReactiveOptions<Equal>);
|
|
20
|
-
/**
|
|
21
|
-
* Get the value
|
|
22
|
-
*/
|
|
23
|
-
abstract get(): Value;
|
|
24
|
-
/**
|
|
25
|
-
* Get the value _(without reactivity)_
|
|
26
|
-
*/
|
|
27
|
-
peek(): Value;
|
|
28
|
-
/**
|
|
29
|
-
* Subscribe to changes
|
|
30
|
-
*/
|
|
31
|
-
subscribe(callback: (value: Value) => void): Unsubscribe;
|
|
32
|
-
/**
|
|
33
|
-
* JSON representation of the value
|
|
34
|
-
*/
|
|
35
|
-
toJSON(): Value;
|
|
36
|
-
/**
|
|
37
|
-
* String representation of the value
|
|
38
|
-
*/
|
|
39
|
-
toString(): string;
|
|
40
|
-
/**
|
|
41
|
-
* Unsubscribe from changes
|
|
42
|
-
*/
|
|
43
|
-
unsubscribe(callback: (value: Value) => void): void;
|
|
44
|
-
}
|
|
45
|
-
export type ReactiveOptions<Value> = {
|
|
46
|
-
/**
|
|
47
|
-
* Method to compare values for equality
|
|
48
|
-
*/
|
|
49
|
-
equal?: (first: Value, second: Value) => boolean;
|
|
50
|
-
};
|
|
51
|
-
export type ReactiveState<Value, Equal> = {
|
|
52
|
-
computeds: Set<Computed<unknown>>;
|
|
53
|
-
effects: Set<Effect>;
|
|
54
|
-
equal: (first: Equal, second: Equal) => boolean;
|
|
55
|
-
subscriptions: Map<(value: Value) => void, Subscription<Value>>;
|
|
56
|
-
value: Value;
|
|
57
|
-
};
|
|
58
|
-
declare class Subscription<Value> {
|
|
59
|
-
state: ReactiveState<Value, never>;
|
|
60
|
-
callback: GenericCallback;
|
|
61
|
-
constructor(state: ReactiveState<Value, never>, callback: GenericCallback);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Unsubscribe from changes
|
|
65
|
-
*/
|
|
66
|
-
export type Unsubscribe = () => void;
|
|
67
|
-
|
|
68
|
-
export {};
|
package/types/value/signal.d.cts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export type GenericCallback = (...args: any[]) => any;
|
|
4
|
-
declare class Effect {
|
|
5
|
-
private readonly $mora;
|
|
6
|
-
private readonly state;
|
|
7
|
-
constructor(callback: GenericCallback);
|
|
8
|
-
}
|
|
9
|
-
declare class Computed<Value> extends Reactive<Value> {
|
|
10
|
-
private readonly effect;
|
|
11
|
-
constructor(callback: () => Value, options?: ReactiveOptions<Value>);
|
|
12
|
-
/**
|
|
13
|
-
* @inheritdoc
|
|
14
|
-
*/
|
|
15
|
-
get(): Value;
|
|
16
|
-
}
|
|
17
|
-
declare abstract class Reactive<Value, Equal = Value> {
|
|
18
|
-
protected readonly state: ReactiveState<Value, Equal>;
|
|
19
|
-
constructor(name: string, value: Value, options?: ReactiveOptions<Equal>);
|
|
20
|
-
/**
|
|
21
|
-
* Get the value
|
|
22
|
-
*/
|
|
23
|
-
abstract get(): Value;
|
|
24
|
-
/**
|
|
25
|
-
* Get the value _(without reactivity)_
|
|
26
|
-
*/
|
|
27
|
-
peek(): Value;
|
|
28
|
-
/**
|
|
29
|
-
* Subscribe to changes
|
|
30
|
-
*/
|
|
31
|
-
subscribe(callback: (value: Value) => void): Unsubscribe;
|
|
32
|
-
/**
|
|
33
|
-
* JSON representation of the value
|
|
34
|
-
*/
|
|
35
|
-
toJSON(): Value;
|
|
36
|
-
/**
|
|
37
|
-
* String representation of the value
|
|
38
|
-
*/
|
|
39
|
-
toString(): string;
|
|
40
|
-
/**
|
|
41
|
-
* Unsubscribe from changes
|
|
42
|
-
*/
|
|
43
|
-
unsubscribe(callback: (value: Value) => void): void;
|
|
44
|
-
}
|
|
45
|
-
export type ReactiveOptions<Value> = {
|
|
46
|
-
/**
|
|
47
|
-
* Method to compare values for equality
|
|
48
|
-
*/
|
|
49
|
-
equal?: (first: Value, second: Value) => boolean;
|
|
50
|
-
};
|
|
51
|
-
export type ReactiveState<Value, Equal> = {
|
|
52
|
-
computeds: Set<Computed<unknown>>;
|
|
53
|
-
effects: Set<Effect>;
|
|
54
|
-
equal: (first: Equal, second: Equal) => boolean;
|
|
55
|
-
subscriptions: Map<(value: Value) => void, Subscription<Value>>;
|
|
56
|
-
value: Value;
|
|
57
|
-
};
|
|
58
|
-
declare class Subscription<Value> {
|
|
59
|
-
state: ReactiveState<Value, never>;
|
|
60
|
-
callback: GenericCallback;
|
|
61
|
-
constructor(state: ReactiveState<Value, never>, callback: GenericCallback);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Unsubscribe from changes
|
|
65
|
-
*/
|
|
66
|
-
export type Unsubscribe = () => void;
|
|
67
|
-
export declare class Signal<Value> extends Reactive<Value> {
|
|
68
|
-
constructor(value: Value, options?: ReactiveOptions<Value>);
|
|
69
|
-
/**
|
|
70
|
-
* @inheritdoc
|
|
71
|
-
*/
|
|
72
|
-
get(): Value;
|
|
73
|
-
/**
|
|
74
|
-
* Set the value
|
|
75
|
-
*/
|
|
76
|
-
set(value: Value): void;
|
|
77
|
-
/**
|
|
78
|
-
* Update the value
|
|
79
|
-
*/
|
|
80
|
-
update(callback: (value: Value) => Value): void;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Create a reactive value
|
|
84
|
-
*/
|
|
85
|
-
export declare function signal<Value>(value: Value, options?: ReactiveOptions<Value>): Signal<Value>;
|
|
86
|
-
|
|
87
|
-
export {};
|