@oscarpalmer/mora 0.20.0 → 0.22.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.js +11 -24
- package/dist/effect.js +17 -26
- package/dist/helpers/is.js +14 -21
- package/dist/helpers/proxy.js +34 -47
- package/dist/helpers/value.js +20 -46
- package/dist/index.js +4 -17
- package/dist/mora.full.js +8 -2
- package/dist/subscription.js +20 -28
- package/dist/value/array.js +94 -173
- package/dist/value/computed.js +34 -56
- package/dist/value/reactive.js +29 -53
- package/dist/value/signal.js +20 -32
- package/dist/value/store.js +30 -59
- package/package.json +12 -18
- package/src/helpers/value.ts +1 -1
- package/src/index.ts +0 -1
- package/src/value/array.ts +13 -3
- package/types/value/array.d.ts +1 -0
- package/dist/batch.cjs +0 -32
- package/dist/effect.cjs +0 -30
- package/dist/helpers/is.cjs +0 -40
- package/dist/helpers/proxy.cjs +0 -56
- package/dist/helpers/value.cjs +0 -54
- package/dist/index.cjs +0 -21
- package/dist/node_modules/@oscarpalmer/atoms/dist/internal/is.cjs +0 -17
- package/dist/node_modules/@oscarpalmer/atoms/dist/internal/is.js +0 -17
- package/dist/subscription.cjs +0 -32
- package/dist/value/array.cjs +0 -181
- package/dist/value/computed.cjs +0 -60
- package/dist/value/reactive.cjs +0 -55
- package/dist/value/signal.cjs +0 -36
- package/dist/value/store.cjs +0 -63
- package/types/batch.d.cts +0 -79
- package/types/effect.d.cts +0 -16
- package/types/helpers/is.d.cts +0 -258
- package/types/helpers/proxy.d.cts +0 -243
- package/types/helpers/value.d.cts +0 -71
- package/types/index.d.cts +0 -280
- package/types/subscription.d.cts +0 -71
- package/types/value/array.d.cts +0 -160
- package/types/value/computed.d.cts +0 -81
- package/types/value/reactive.d.cts +0 -68
- package/types/value/signal.d.cts +0 -87
- package/types/value/store.d.cts +0 -136
package/dist/value/reactive.cjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
|
-
const subscription = require("../subscription.cjs");
|
|
7
|
-
class Reactive {
|
|
8
|
-
constructor(name, value, options) {
|
|
9
|
-
__publicField(this, "state", {
|
|
10
|
-
computeds: /* @__PURE__ */ new Set(),
|
|
11
|
-
effects: /* @__PURE__ */ new Set(),
|
|
12
|
-
equal: Object.is,
|
|
13
|
-
subscriptions: /* @__PURE__ */ new Map(),
|
|
14
|
-
value: void 0
|
|
15
|
-
});
|
|
16
|
-
this.state.value = value;
|
|
17
|
-
if (typeof options === "object" && typeof options.equal === "function") {
|
|
18
|
-
this.state.equal = options.equal;
|
|
19
|
-
}
|
|
20
|
-
Object.defineProperty(this, "$mora", {
|
|
21
|
-
value: name
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get the value _(without reactivity)_
|
|
26
|
-
*/
|
|
27
|
-
peek() {
|
|
28
|
-
return this.state.value;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Subscribe to changes
|
|
32
|
-
*/
|
|
33
|
-
subscribe(callback) {
|
|
34
|
-
return subscription.subscribe(this.state, callback);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* JSON representation of the value
|
|
38
|
-
*/
|
|
39
|
-
toJSON() {
|
|
40
|
-
return this.get();
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* String representation of the value
|
|
44
|
-
*/
|
|
45
|
-
toString() {
|
|
46
|
-
return String(this.get());
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Unsubscribe from changes
|
|
50
|
-
*/
|
|
51
|
-
unsubscribe(callback) {
|
|
52
|
-
subscription.unsubscribe(this.state, callback);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.Reactive = Reactive;
|
package/dist/value/signal.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const helpers_is = require("../helpers/is.cjs");
|
|
4
|
-
const helpers_value = require("../helpers/value.cjs");
|
|
5
|
-
const value_reactive = require("./reactive.cjs");
|
|
6
|
-
class Signal extends value_reactive.Reactive {
|
|
7
|
-
constructor(value, options) {
|
|
8
|
-
super(helpers_is.signalName, value, options);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @inheritdoc
|
|
12
|
-
*/
|
|
13
|
-
get() {
|
|
14
|
-
return helpers_value.getValue(this.state);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Set the value
|
|
18
|
-
*/
|
|
19
|
-
set(value) {
|
|
20
|
-
if (!this.state.equal(this.state.value, value)) {
|
|
21
|
-
this.state.value = value;
|
|
22
|
-
helpers_value.emitValue(this.state);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Update the value _(based on the current value)_
|
|
27
|
-
*/
|
|
28
|
-
update(callback) {
|
|
29
|
-
this.set(callback(this.state.value));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function signal(value, options) {
|
|
33
|
-
return new Signal(value, options);
|
|
34
|
-
}
|
|
35
|
-
exports.Signal = Signal;
|
|
36
|
-
exports.signal = signal;
|
package/dist/value/store.cjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __typeError = (msg) => {
|
|
3
|
-
throw TypeError(msg);
|
|
4
|
-
};
|
|
5
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
6
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
7
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
8
|
-
var _keyed;
|
|
9
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
10
|
-
const is = require("../node_modules/@oscarpalmer/atoms/dist/internal/is.cjs");
|
|
11
|
-
const helpers_is = require("../helpers/is.cjs");
|
|
12
|
-
const helpers_proxy = require("../helpers/proxy.cjs");
|
|
13
|
-
const helpers_value = require("../helpers/value.cjs");
|
|
14
|
-
const subscription = require("../subscription.cjs");
|
|
15
|
-
const value_reactive = require("./reactive.cjs");
|
|
16
|
-
class Store extends value_reactive.Reactive {
|
|
17
|
-
constructor(value, options) {
|
|
18
|
-
super(
|
|
19
|
-
helpers_is.storeName,
|
|
20
|
-
new Proxy(value, {
|
|
21
|
-
set: (target, property, value2) => helpers_proxy.setValueInProxy(target, property, value2, this.state, false)
|
|
22
|
-
}),
|
|
23
|
-
options
|
|
24
|
-
);
|
|
25
|
-
__privateAdd(this, _keyed, /* @__PURE__ */ new Map());
|
|
26
|
-
}
|
|
27
|
-
get(key) {
|
|
28
|
-
return is.isKey(key) ? helpers_proxy.getReactiveValueInProxy(this, __privateGet(this, _keyed), key, false).get() : helpers_value.getValue(this.state);
|
|
29
|
-
}
|
|
30
|
-
peek(key) {
|
|
31
|
-
return is.isKey(key) ? this.state.value[key] : { ...this.state.value };
|
|
32
|
-
}
|
|
33
|
-
set(first, second) {
|
|
34
|
-
if (is.isKey(first)) {
|
|
35
|
-
this.state.value[first] = second;
|
|
36
|
-
} else if (first == null || is.isPlainObject(first)) {
|
|
37
|
-
helpers_proxy.setProxyValue(this.state.value, first ?? {});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
subscribe(first, second) {
|
|
41
|
-
if (is.isKey(first) && typeof second === "function") {
|
|
42
|
-
return helpers_proxy.getReactiveValueInProxy(this, __privateGet(this, _keyed), first, false).subscribe(
|
|
43
|
-
second
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return typeof first === "function" ? subscription.subscribe(this.state, first) : subscription.noop;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Update the value _(based on the current value)_
|
|
50
|
-
*/
|
|
51
|
-
update(callback) {
|
|
52
|
-
const updated = callback({ ...this.state.value });
|
|
53
|
-
if (updated == null || is.isPlainObject(updated)) {
|
|
54
|
-
helpers_proxy.setProxyValue(this.state.value, updated ?? {});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
_keyed = new WeakMap();
|
|
59
|
-
function store(value, options) {
|
|
60
|
-
return new Store(is.isPlainObject(value) ? value : {}, options);
|
|
61
|
-
}
|
|
62
|
-
exports.Store = Store;
|
|
63
|
-
exports.store = store;
|
package/types/batch.d.cts
DELETED
|
@@ -1,79 +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<GenericCallback, Subscription>;
|
|
56
|
-
value: Value;
|
|
57
|
-
};
|
|
58
|
-
declare class Subscription {
|
|
59
|
-
state: ReactiveState<unknown, never>;
|
|
60
|
-
callback: GenericCallback;
|
|
61
|
-
constructor(state: ReactiveState<unknown, never>, callback: GenericCallback);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Unsubscribe from changes
|
|
65
|
-
*/
|
|
66
|
-
export type Unsubscribe = () => void;
|
|
67
|
-
export declare function flushHandlers(): void;
|
|
68
|
-
/**
|
|
69
|
-
* Start batching effects _(use `stopBatch` to flush and run batched effects)_
|
|
70
|
-
*/
|
|
71
|
-
export declare function startBatch(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Stop batching effects and flush _(run)_ them
|
|
74
|
-
*/
|
|
75
|
-
export declare function stopBatch(): void;
|
|
76
|
-
export declare const batchedHandlers: Set<Effect | Subscription>;
|
|
77
|
-
export declare let batchDepth: number;
|
|
78
|
-
|
|
79
|
-
export {};
|
package/types/effect.d.cts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export type GenericCallback = (...args: any[]) => any;
|
|
4
|
-
export declare class Effect {
|
|
5
|
-
private readonly $mora;
|
|
6
|
-
private readonly state;
|
|
7
|
-
constructor(callback: GenericCallback);
|
|
8
|
-
}
|
|
9
|
-
export declare function runEffect(effect: Effect): void;
|
|
10
|
-
/**
|
|
11
|
-
* Create an effect
|
|
12
|
-
*/
|
|
13
|
-
export declare function effect(callback: GenericCallback): Effect;
|
|
14
|
-
export declare let activeEffect: Effect | undefined;
|
|
15
|
-
|
|
16
|
-
export {};
|
package/types/helpers/is.d.cts
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export type GenericCallback = (...args: any[]) => any;
|
|
4
|
-
/**
|
|
5
|
-
* A useful key type
|
|
6
|
-
*/
|
|
7
|
-
export type Key = number | string;
|
|
8
|
-
/**
|
|
9
|
-
* A generic object
|
|
10
|
-
*/
|
|
11
|
-
export type PlainObject = Record<PropertyKey, unknown>;
|
|
12
|
-
declare class Effect {
|
|
13
|
-
private readonly $mora;
|
|
14
|
-
private readonly state;
|
|
15
|
-
constructor(callback: GenericCallback);
|
|
16
|
-
}
|
|
17
|
-
declare class Computed<Value> extends Reactive<Value> {
|
|
18
|
-
private readonly effect;
|
|
19
|
-
constructor(callback: () => Value, options?: ReactiveOptions<Value>);
|
|
20
|
-
/**
|
|
21
|
-
* @inheritdoc
|
|
22
|
-
*/
|
|
23
|
-
get(): Value;
|
|
24
|
-
}
|
|
25
|
-
declare abstract class Reactive<Value, Equal = Value> {
|
|
26
|
-
protected readonly state: ReactiveState<Value, Equal>;
|
|
27
|
-
constructor(name: string, value: Value, options?: ReactiveOptions<Equal>);
|
|
28
|
-
/**
|
|
29
|
-
* Get the value
|
|
30
|
-
*/
|
|
31
|
-
abstract get(): Value;
|
|
32
|
-
/**
|
|
33
|
-
* Get the value _(without reactivity)_
|
|
34
|
-
*/
|
|
35
|
-
peek(): Value;
|
|
36
|
-
/**
|
|
37
|
-
* Subscribe to changes
|
|
38
|
-
*/
|
|
39
|
-
subscribe(callback: (value: Value) => void): Unsubscribe;
|
|
40
|
-
/**
|
|
41
|
-
* JSON representation of the value
|
|
42
|
-
*/
|
|
43
|
-
toJSON(): Value;
|
|
44
|
-
/**
|
|
45
|
-
* String representation of the value
|
|
46
|
-
*/
|
|
47
|
-
toString(): string;
|
|
48
|
-
/**
|
|
49
|
-
* Unsubscribe from changes
|
|
50
|
-
*/
|
|
51
|
-
unsubscribe(callback: (value: Value) => void): void;
|
|
52
|
-
}
|
|
53
|
-
export type ReactiveOptions<Value> = {
|
|
54
|
-
/**
|
|
55
|
-
* Method to compare values for equality
|
|
56
|
-
*/
|
|
57
|
-
equal?: (first: Value, second: Value) => boolean;
|
|
58
|
-
};
|
|
59
|
-
export type ReactiveState<Value, Equal> = {
|
|
60
|
-
computeds: Set<Computed<unknown>>;
|
|
61
|
-
effects: Set<Effect>;
|
|
62
|
-
equal: (first: Equal, second: Equal) => boolean;
|
|
63
|
-
subscriptions: Map<GenericCallback, Subscription>;
|
|
64
|
-
value: Value;
|
|
65
|
-
};
|
|
66
|
-
declare class Subscription {
|
|
67
|
-
state: ReactiveState<unknown, never>;
|
|
68
|
-
callback: GenericCallback;
|
|
69
|
-
constructor(state: ReactiveState<unknown, never>, callback: GenericCallback);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Unsubscribe from changes
|
|
73
|
-
*/
|
|
74
|
-
export type Unsubscribe = () => void;
|
|
75
|
-
declare class ReactiveArray<Item> extends Reactive<Item[], Item> {
|
|
76
|
-
#private;
|
|
77
|
-
/**
|
|
78
|
-
* The length of the array
|
|
79
|
-
*/
|
|
80
|
-
get length(): number;
|
|
81
|
-
/**
|
|
82
|
-
* Set the length of the array
|
|
83
|
-
*/
|
|
84
|
-
set length(value: number);
|
|
85
|
-
constructor(value: Item[], options?: ReactiveOptions<Item>);
|
|
86
|
-
/**
|
|
87
|
-
* Clear the array
|
|
88
|
-
*/
|
|
89
|
-
clear(): void;
|
|
90
|
-
/**
|
|
91
|
-
* @inheritdoc
|
|
92
|
-
*/
|
|
93
|
-
get(): Item[];
|
|
94
|
-
/**
|
|
95
|
-
* Get the value at an index
|
|
96
|
-
*/
|
|
97
|
-
get(index: number): Item | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* Get the length of the array
|
|
100
|
-
*/
|
|
101
|
-
get(property: "length"): number;
|
|
102
|
-
/**
|
|
103
|
-
* Create a computed, filtered array
|
|
104
|
-
*/
|
|
105
|
-
filter(callback: (item: Item, index: number, array: Item[]) => boolean): Computed<Item[]>;
|
|
106
|
-
/**
|
|
107
|
-
* Create a computed, mapped array
|
|
108
|
-
*/
|
|
109
|
-
map<Mapped>(callback: (item: Item, index: number, array: Item[]) => Mapped): Computed<Mapped[]>;
|
|
110
|
-
/**
|
|
111
|
-
* @inheritdoc
|
|
112
|
-
*/
|
|
113
|
-
peek(): Item[];
|
|
114
|
-
/**
|
|
115
|
-
* Get the length of the array _(without reactivity)_
|
|
116
|
-
*/
|
|
117
|
-
peek(length: true): number;
|
|
118
|
-
/**
|
|
119
|
-
* Remove and return the last item of the array
|
|
120
|
-
*/
|
|
121
|
-
pop(): Item | undefined;
|
|
122
|
-
/**
|
|
123
|
-
* Add items to the end of the array
|
|
124
|
-
*/
|
|
125
|
-
push(...items: Item[]): number;
|
|
126
|
-
/**
|
|
127
|
-
* Set the value
|
|
128
|
-
*/
|
|
129
|
-
set(value?: Item[]): void;
|
|
130
|
-
/**
|
|
131
|
-
* Set the value at an index
|
|
132
|
-
*/
|
|
133
|
-
set(index: number, value: Item): void;
|
|
134
|
-
/**
|
|
135
|
-
* Set the length of the array
|
|
136
|
-
*/
|
|
137
|
-
set(property: "length", value: number): void;
|
|
138
|
-
/**
|
|
139
|
-
* Remove and return the first item of the array
|
|
140
|
-
*/
|
|
141
|
-
shift(): Item | undefined;
|
|
142
|
-
/**
|
|
143
|
-
* Remove and return items from the array _(and optionally add new items)_
|
|
144
|
-
*/
|
|
145
|
-
splice(from: number, to?: number, ...items: Item[]): Item[];
|
|
146
|
-
/**
|
|
147
|
-
* @inheritdoc
|
|
148
|
-
*/
|
|
149
|
-
subscribe(callback: (value: Item[]) => void): Unsubscribe;
|
|
150
|
-
/**
|
|
151
|
-
* Subscribe to changes at a specific index
|
|
152
|
-
*/
|
|
153
|
-
subscribe(index: number, callback: (value: Item | undefined) => void): Unsubscribe;
|
|
154
|
-
/**
|
|
155
|
-
* Add items to the beginning of the array
|
|
156
|
-
*/
|
|
157
|
-
unshift(...items: Item[]): number;
|
|
158
|
-
/**
|
|
159
|
-
* Update the value _(based on the current value)_
|
|
160
|
-
*/
|
|
161
|
-
update(callback: (value: Item[]) => Item[]): void;
|
|
162
|
-
}
|
|
163
|
-
declare class Signal<Value> extends Reactive<Value> {
|
|
164
|
-
constructor(value: Value, options?: ReactiveOptions<Value>);
|
|
165
|
-
/**
|
|
166
|
-
* @inheritdoc
|
|
167
|
-
*/
|
|
168
|
-
get(): Value;
|
|
169
|
-
/**
|
|
170
|
-
* Set the value
|
|
171
|
-
*/
|
|
172
|
-
set(value: Value): void;
|
|
173
|
-
/**
|
|
174
|
-
* Update the value _(based on the current value)_
|
|
175
|
-
*/
|
|
176
|
-
update(callback: (value: Value) => Value): void;
|
|
177
|
-
}
|
|
178
|
-
declare class Store<Value extends PlainObject> extends Reactive<Value, Value> {
|
|
179
|
-
#private;
|
|
180
|
-
constructor(value: Value, options?: ReactiveOptions<Value>);
|
|
181
|
-
/**
|
|
182
|
-
* @inheritdoc
|
|
183
|
-
*/
|
|
184
|
-
get(): Value;
|
|
185
|
-
/**
|
|
186
|
-
* Get a value by key _(without reactivity)_
|
|
187
|
-
*/
|
|
188
|
-
get(key: keyof Value): Value[keyof Value];
|
|
189
|
-
/**
|
|
190
|
-
* Get a value by key _(without reactivity)_
|
|
191
|
-
*/
|
|
192
|
-
get(key: Key): unknown;
|
|
193
|
-
/**
|
|
194
|
-
* Get the value _(without reactivity)_
|
|
195
|
-
*/
|
|
196
|
-
peek(): Value;
|
|
197
|
-
/**
|
|
198
|
-
* Get a value by key _(without reactivity)_
|
|
199
|
-
*/
|
|
200
|
-
peek(key: keyof Value): Value[keyof Value];
|
|
201
|
-
/**
|
|
202
|
-
* Get a value by key _(without reactivity)_
|
|
203
|
-
*/
|
|
204
|
-
peek(key: Key): unknown;
|
|
205
|
-
/**
|
|
206
|
-
* Set the value
|
|
207
|
-
*/
|
|
208
|
-
set(value?: Value): void;
|
|
209
|
-
/**
|
|
210
|
-
* Set a value by key
|
|
211
|
-
*/
|
|
212
|
-
set(key: keyof Value, value: Value[keyof Value]): void;
|
|
213
|
-
/**
|
|
214
|
-
* Set a value by key
|
|
215
|
-
*/
|
|
216
|
-
set(key: Key, value: unknown): void;
|
|
217
|
-
/**
|
|
218
|
-
* @inheritdoc
|
|
219
|
-
*/
|
|
220
|
-
subscribe(callback: (value: Value) => void): Unsubscribe;
|
|
221
|
-
/**
|
|
222
|
-
* Subscribe to changes for a specific key
|
|
223
|
-
*/
|
|
224
|
-
subscribe<Key extends keyof Value>(key: Key, callback: (value: Value[Key] | undefined) => void): Unsubscribe;
|
|
225
|
-
/**
|
|
226
|
-
* Subscribe to changes for a specific key
|
|
227
|
-
*/
|
|
228
|
-
subscribe(key: Key, callback: (value: unknown) => void): Unsubscribe;
|
|
229
|
-
/**
|
|
230
|
-
* Update the value _(based on the current value)_
|
|
231
|
-
*/
|
|
232
|
-
update(callback: (value: Value) => Value): void;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Is the value a reactive array?
|
|
236
|
-
*/
|
|
237
|
-
export declare function isArray(value: unknown): value is ReactiveArray<unknown>;
|
|
238
|
-
/**
|
|
239
|
-
* Is the value a computed signal?
|
|
240
|
-
*/
|
|
241
|
-
export declare function isComputed(value: unknown): value is Computed<unknown>;
|
|
242
|
-
/**
|
|
243
|
-
* Is the value an effect?
|
|
244
|
-
*/
|
|
245
|
-
export declare function isEffect(value: unknown): value is Effect;
|
|
246
|
-
export declare function isReactive(value: unknown): value is Reactive<unknown>;
|
|
247
|
-
/**
|
|
248
|
-
* Is the value a signal?
|
|
249
|
-
*/
|
|
250
|
-
export declare function isSignal(value: unknown): value is Signal<unknown>;
|
|
251
|
-
export declare function isStore(value: unknown): value is Store<PlainObject>;
|
|
252
|
-
export declare const arrayName = "array";
|
|
253
|
-
export declare const computedName = "computed";
|
|
254
|
-
export declare const effectName = "effect";
|
|
255
|
-
export declare const signalName = "signal";
|
|
256
|
-
export declare const storeName = "store";
|
|
257
|
-
|
|
258
|
-
export {};
|