@oscarpalmer/mora 0.11.0 → 0.12.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/computed.cjs CHANGED
@@ -37,7 +37,7 @@ class Computed extends reactive.Reactive {
37
37
  });
38
38
  }
39
39
  /**
40
- * Get the value
40
+ * @inheritdoc
41
41
  */
42
42
  get() {
43
43
  if (exports.activeComputed != null && exports.activeComputed !== this) {
package/dist/computed.js CHANGED
@@ -35,7 +35,7 @@ class Computed extends Reactive {
35
35
  });
36
36
  }
37
37
  /**
38
- * Get the value
38
+ * @inheritdoc
39
39
  */
40
40
  get() {
41
41
  if (activeComputed != null && activeComputed !== this) {
package/dist/index.cjs CHANGED
@@ -11,5 +11,6 @@ exports.computed = computed.computed;
11
11
  exports.effect = effect.effect;
12
12
  exports.isComputed = is.isComputed;
13
13
  exports.isEffect = is.isEffect;
14
+ exports.isReactive = is.isReactive;
14
15
  exports.isSignal = is.isSignal;
15
16
  exports.signal = signal.signal;
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  import { startBatch, stopBatch } from "./batch.js";
2
2
  import { computed } from "./computed.js";
3
3
  import { effect } from "./effect.js";
4
- import { isComputed, isEffect, isSignal } from "./is.js";
4
+ import { isComputed, isEffect, isReactive, isSignal } from "./is.js";
5
5
  import { signal } from "./signal.js";
6
6
  export {
7
7
  computed,
8
8
  effect,
9
9
  isComputed,
10
10
  isEffect,
11
+ isReactive,
11
12
  isSignal,
12
13
  signal,
13
14
  startBatch,
package/dist/mora.full.js CHANGED
@@ -45,6 +45,9 @@ function isMora(value, name) {
45
45
  '$mora' in value &&
46
46
  value.$mora === name);
47
47
  }
48
+ function isReactive(value) {
49
+ return isComputed(value) || isSignal(value);
50
+ }
48
51
  /**
49
52
  * Is the value a signal?
50
53
  */
@@ -176,7 +179,7 @@ class Computed extends Reactive {
176
179
  });
177
180
  }
178
181
  /**
179
- * Get the value
182
+ * @inheritdoc
180
183
  */
181
184
  get() {
182
185
  if (activeComputed != null && activeComputed !== this) {
@@ -203,7 +206,7 @@ class Signal extends Reactive {
203
206
  super('signal', value);
204
207
  }
205
208
  /**
206
- * Get the value
209
+ * @inheritdoc
207
210
  */
208
211
  get() {
209
212
  if (activeComputed != null) {
@@ -246,4 +249,4 @@ function signal(value) {
246
249
  return new Signal(value);
247
250
  }
248
251
 
249
- export { computed, effect, isComputed, isEffect, isSignal, signal, startBatch, stopBatch };
252
+ export { computed, effect, isComputed, isEffect, isReactive, isSignal, signal, startBatch, stopBatch };
package/dist/signal.cjs CHANGED
@@ -9,7 +9,7 @@ class Signal extends reactive.Reactive {
9
9
  super("signal", value);
10
10
  }
11
11
  /**
12
- * Get the value
12
+ * @inheritdoc
13
13
  */
14
14
  get() {
15
15
  if (computed.activeComputed != null) {
package/dist/signal.js CHANGED
@@ -7,7 +7,7 @@ class Signal extends Reactive {
7
7
  super("signal", value);
8
8
  }
9
9
  /**
10
- * Get the value
10
+ * @inheritdoc
11
11
  */
12
12
  get() {
13
13
  if (activeComputed != null) {
package/package.json CHANGED
@@ -54,5 +54,5 @@
54
54
  },
55
55
  "type": "module",
56
56
  "types": "./types/index.d.ts",
57
- "version": "0.11.0"
57
+ "version": "0.12.0"
58
58
  }
package/src/computed.ts CHANGED
@@ -55,7 +55,7 @@ export class Computed<Value> extends Reactive<Value> {
55
55
  }
56
56
 
57
57
  /**
58
- * Get the value
58
+ * @inheritdoc
59
59
  */
60
60
  get(): Value {
61
61
  if (activeComputed != null && activeComputed !== this) {
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export {startBatch, stopBatch} from './batch';
2
2
  export {computed, type Computed} from './computed';
3
3
  export {effect, type Effect} from './effect';
4
- export {isComputed, isEffect, isSignal} from './is';
4
+ export {isComputed, isEffect, isReactive, isSignal} from './is';
5
+ export type {Reactive} from './reactive';
5
6
  export {signal, type Signal} from './signal';
7
+
package/src/reactive.ts CHANGED
@@ -23,6 +23,11 @@ export abstract class Reactive<Value> {
23
23
  });
24
24
  }
25
25
 
26
+ /**
27
+ * Get the value
28
+ */
29
+ abstract get(): Value;
30
+
26
31
  /**
27
32
  * Get the value _(without reactivity)_
28
33
  */
package/src/signal.ts CHANGED
@@ -9,7 +9,7 @@ export class Signal<Value> extends Reactive<Value> {
9
9
  }
10
10
 
11
11
  /**
12
- * Get the value
12
+ * @inheritdoc
13
13
  */
14
14
  get(): Value {
15
15
  if (activeComputed != null) {
package/types/batch.d.cts CHANGED
@@ -10,13 +10,17 @@ declare class Computed<Value> extends Reactive<Value> {
10
10
  private readonly effect;
11
11
  constructor(callback: () => Value);
12
12
  /**
13
- * Get the value
13
+ * @inheritdoc
14
14
  */
15
15
  get(): Value;
16
16
  }
17
17
  declare abstract class Reactive<Value> {
18
18
  protected readonly state: ReactiveState<Value>;
19
19
  constructor(name: string, value: Value);
20
+ /**
21
+ * Get the value
22
+ */
23
+ abstract get(): Value;
20
24
  /**
21
25
  * Get the value _(without reactivity)_
22
26
  */
@@ -19,7 +19,7 @@ export declare class Computed<Value> extends Reactive<Value> {
19
19
  private readonly effect;
20
20
  constructor(callback: () => Value);
21
21
  /**
22
- * Get the value
22
+ * @inheritdoc
23
23
  */
24
24
  get(): Value;
25
25
  }
@@ -30,6 +30,10 @@ export declare function computed<Value>(callback: () => Value): Computed<Value>;
30
30
  declare abstract class Reactive<Value> {
31
31
  protected readonly state: ReactiveState<Value>;
32
32
  constructor(name: string, value: Value);
33
+ /**
34
+ * Get the value
35
+ */
36
+ abstract get(): Value;
33
37
  /**
34
38
  * Get the value _(without reactivity)_
35
39
  */
@@ -13,7 +13,7 @@ export declare class Computed<Value> extends Reactive<Value> {
13
13
  private readonly effect;
14
14
  constructor(callback: () => Value);
15
15
  /**
16
- * Get the value
16
+ * @inheritdoc
17
17
  */
18
18
  get(): Value;
19
19
  }
package/types/index.d.cts CHANGED
@@ -14,7 +14,7 @@ export declare class Computed<Value> extends Reactive<Value> {
14
14
  private readonly effect;
15
15
  constructor(callback: () => Value);
16
16
  /**
17
- * Get the value
17
+ * @inheritdoc
18
18
  */
19
19
  get(): Value;
20
20
  }
@@ -22,9 +22,13 @@ export declare class Computed<Value> extends Reactive<Value> {
22
22
  * Create a computed value
23
23
  */
24
24
  export declare function computed<Value>(callback: () => Value): Computed<Value>;
25
- declare abstract class Reactive<Value> {
25
+ export declare abstract class Reactive<Value> {
26
26
  protected readonly state: ReactiveState<Value>;
27
27
  constructor(name: string, value: Value);
28
+ /**
29
+ * Get the value
30
+ */
31
+ abstract get(): Value;
28
32
  /**
29
33
  * Get the value _(without reactivity)_
30
34
  */
@@ -56,7 +60,7 @@ export type Unsubscribe = () => void;
56
60
  export declare class Signal<Value> extends Reactive<Value> {
57
61
  constructor(value: Value);
58
62
  /**
59
- * Get the value
63
+ * @inheritdoc
60
64
  */
61
65
  get(): Value;
62
66
  /**
@@ -77,6 +81,7 @@ export declare function isComputed(value: unknown): value is Computed<unknown>;
77
81
  * Is the value an effect?
78
82
  */
79
83
  export declare function isEffect(value: unknown): value is Effect;
84
+ export declare function isReactive(value: unknown): value is Reactive<unknown>;
80
85
  /**
81
86
  * Is the value a signal?
82
87
  */
package/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { startBatch, stopBatch } from './batch';
2
2
  export { computed, type Computed } from './computed';
3
3
  export { effect, type Effect } from './effect';
4
- export { isComputed, isEffect, isSignal } from './is';
4
+ export { isComputed, isEffect, isReactive, isSignal } from './is';
5
+ export type { Reactive } from './reactive';
5
6
  export { signal, type Signal } from './signal';
package/types/is.d.cts CHANGED
@@ -10,13 +10,17 @@ declare class Computed<Value> extends Reactive<Value> {
10
10
  private readonly effect;
11
11
  constructor(callback: () => Value);
12
12
  /**
13
- * Get the value
13
+ * @inheritdoc
14
14
  */
15
15
  get(): Value;
16
16
  }
17
17
  declare abstract class Reactive<Value> {
18
18
  protected readonly state: ReactiveState<Value>;
19
19
  constructor(name: string, value: Value);
20
+ /**
21
+ * Get the value
22
+ */
23
+ abstract get(): Value;
20
24
  /**
21
25
  * Get the value _(without reactivity)_
22
26
  */
@@ -48,7 +52,7 @@ export type Unsubscribe = () => void;
48
52
  declare class Signal<Value> extends Reactive<Value> {
49
53
  constructor(value: Value);
50
54
  /**
51
- * Get the value
55
+ * @inheritdoc
52
56
  */
53
57
  get(): Value;
54
58
  /**
@@ -10,13 +10,17 @@ declare class Computed<Value> extends Reactive<Value> {
10
10
  private readonly effect;
11
11
  constructor(callback: () => Value);
12
12
  /**
13
- * Get the value
13
+ * @inheritdoc
14
14
  */
15
15
  get(): Value;
16
16
  }
17
17
  export declare abstract class Reactive<Value> {
18
18
  protected readonly state: ReactiveState<Value>;
19
19
  constructor(name: string, value: Value);
20
+ /**
21
+ * Get the value
22
+ */
23
+ abstract get(): Value;
20
24
  /**
21
25
  * Get the value _(without reactivity)_
22
26
  */
@@ -4,6 +4,10 @@ import { type Subscription, type Unsubscribe } from './subscription';
4
4
  export declare abstract class Reactive<Value> {
5
5
  protected readonly state: ReactiveState<Value>;
6
6
  constructor(name: string, value: Value);
7
+ /**
8
+ * Get the value
9
+ */
10
+ abstract get(): Value;
7
11
  /**
8
12
  * Get the value _(without reactivity)_
9
13
  */
@@ -10,13 +10,17 @@ declare class Computed<Value> extends Reactive<Value> {
10
10
  private readonly effect;
11
11
  constructor(callback: () => Value);
12
12
  /**
13
- * Get the value
13
+ * @inheritdoc
14
14
  */
15
15
  get(): Value;
16
16
  }
17
17
  declare abstract class Reactive<Value> {
18
18
  protected readonly state: ReactiveState<Value>;
19
19
  constructor(name: string, value: Value);
20
+ /**
21
+ * Get the value
22
+ */
23
+ abstract get(): Value;
20
24
  /**
21
25
  * Get the value _(without reactivity)_
22
26
  */
@@ -48,7 +52,7 @@ export type Unsubscribe = () => void;
48
52
  export declare class Signal<Value> extends Reactive<Value> {
49
53
  constructor(value: Value);
50
54
  /**
51
- * Get the value
55
+ * @inheritdoc
52
56
  */
53
57
  get(): Value;
54
58
  /**
package/types/signal.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Reactive } from './reactive';
2
2
  export declare class Signal<Value> extends Reactive<Value> {
3
3
  constructor(value: Value);
4
4
  /**
5
- * Get the value
5
+ * @inheritdoc
6
6
  */
7
7
  get(): Value;
8
8
  /**
@@ -10,13 +10,17 @@ declare class Computed<Value> extends Reactive<Value> {
10
10
  private readonly effect;
11
11
  constructor(callback: () => Value);
12
12
  /**
13
- * Get the value
13
+ * @inheritdoc
14
14
  */
15
15
  get(): Value;
16
16
  }
17
17
  declare abstract class Reactive<Value> {
18
18
  protected readonly state: ReactiveState<Value>;
19
19
  constructor(name: string, value: Value);
20
+ /**
21
+ * Get the value
22
+ */
23
+ abstract get(): Value;
20
24
  /**
21
25
  * Get the value _(without reactivity)_
22
26
  */