@oscarpalmer/mora 0.18.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.
Files changed (44) hide show
  1. package/dist/helpers/is.cjs +7 -1
  2. package/dist/helpers/is.js +8 -2
  3. package/dist/helpers/proxy.cjs +43 -0
  4. package/dist/helpers/proxy.js +43 -0
  5. package/dist/helpers/value.cjs +22 -26
  6. package/dist/helpers/value.js +22 -26
  7. package/dist/index.cjs +2 -0
  8. package/dist/index.js +3 -1
  9. package/dist/mora.full.js +127 -59
  10. package/dist/node_modules/@oscarpalmer/atoms/dist/internal/is.cjs +17 -0
  11. package/dist/node_modules/@oscarpalmer/atoms/dist/internal/is.js +17 -0
  12. package/dist/value/array.cjs +15 -20
  13. package/dist/value/array.js +16 -21
  14. package/dist/value/computed.cjs +5 -5
  15. package/dist/value/computed.js +5 -5
  16. package/dist/value/reactive.cjs +5 -1
  17. package/dist/value/reactive.js +5 -1
  18. package/dist/value/signal.cjs +5 -5
  19. package/dist/value/signal.js +6 -6
  20. package/dist/value/store.cjs +36 -0
  21. package/dist/value/store.js +36 -0
  22. package/package.json +1 -1
  23. package/src/helpers/is.ts +1 -1
  24. package/src/helpers/proxy.ts +0 -1
  25. package/types/helpers/is.d.ts +3 -0
  26. package/types/helpers/proxy.d.ts +5 -0
  27. package/types/helpers/value.d.ts +3 -4
  28. package/types/index.d.ts +1 -0
  29. package/types/subscription.d.ts +4 -4
  30. package/types/value/array.d.ts +4 -4
  31. package/types/value/computed.d.ts +4 -4
  32. package/types/value/reactive.d.ts +11 -4
  33. package/types/value/signal.d.ts +3 -3
  34. package/types/value/store.d.ts +45 -0
  35. package/types/batch.d.cts +0 -72
  36. package/types/effect.d.cts +0 -16
  37. package/types/helpers/is.d.cts +0 -169
  38. package/types/helpers/value.d.cts +0 -65
  39. package/types/index.d.cts +0 -189
  40. package/types/subscription.d.cts +0 -64
  41. package/types/value/array.d.cts +0 -137
  42. package/types/value/computed.d.cts +0 -74
  43. package/types/value/reactive.d.cts +0 -61
  44. package/types/value/signal.d.cts +0 -80
@@ -1,74 +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>;
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);
21
- /**
22
- * @inheritdoc
23
- */
24
- get(): Value;
25
- }
26
- /**
27
- * Create a computed value
28
- */
29
- export declare function computed<Value>(callback: () => Value): Computed<Value>;
30
- declare abstract class Reactive<Value> {
31
- protected readonly state: ReactiveState<Value>;
32
- constructor(name: string, value: Value);
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 ReactiveState<Value> = {
59
- computeds: Set<Computed<unknown>>;
60
- effects: Set<Effect>;
61
- subscriptions: Map<(value: Value) => void, Subscription<Value>>;
62
- value: Value;
63
- };
64
- declare class Subscription<Value> {
65
- state: ReactiveState<Value>;
66
- callback: GenericCallback;
67
- constructor(state: ReactiveState<Value>, callback: GenericCallback);
68
- }
69
- /**
70
- * Unsubscribe from changes
71
- */
72
- export type Unsubscribe = () => void;
73
-
74
- export {};
@@ -1,61 +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);
12
- /**
13
- * @inheritdoc
14
- */
15
- get(): Value;
16
- }
17
- export declare abstract class Reactive<Value> {
18
- protected readonly state: ReactiveState<Value>;
19
- constructor(name: string, value: Value);
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 ReactiveState<Value> = {
46
- computeds: Set<Computed<unknown>>;
47
- effects: Set<Effect>;
48
- subscriptions: Map<(value: Value) => void, Subscription<Value>>;
49
- value: Value;
50
- };
51
- declare class Subscription<Value> {
52
- state: ReactiveState<Value>;
53
- callback: GenericCallback;
54
- constructor(state: ReactiveState<Value>, callback: GenericCallback);
55
- }
56
- /**
57
- * Unsubscribe from changes
58
- */
59
- export type Unsubscribe = () => void;
60
-
61
- export {};
@@ -1,80 +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);
12
- /**
13
- * @inheritdoc
14
- */
15
- get(): Value;
16
- }
17
- declare abstract class Reactive<Value> {
18
- protected readonly state: ReactiveState<Value>;
19
- constructor(name: string, value: Value);
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 ReactiveState<Value> = {
46
- computeds: Set<Computed<unknown>>;
47
- effects: Set<Effect>;
48
- subscriptions: Map<(value: Value) => void, Subscription<Value>>;
49
- value: Value;
50
- };
51
- declare class Subscription<Value> {
52
- state: ReactiveState<Value>;
53
- callback: GenericCallback;
54
- constructor(state: ReactiveState<Value>, callback: GenericCallback);
55
- }
56
- /**
57
- * Unsubscribe from changes
58
- */
59
- export type Unsubscribe = () => void;
60
- export declare class Signal<Value> extends Reactive<Value> {
61
- constructor(value: Value);
62
- /**
63
- * @inheritdoc
64
- */
65
- get(): Value;
66
- /**
67
- * Set the value
68
- */
69
- set(value: Value): void;
70
- /**
71
- * Update the value
72
- */
73
- update(callback: (value: Value) => Value): void;
74
- }
75
- /**
76
- * Create a reactive value
77
- */
78
- export declare function signal<Value>(value: Value): Signal<Value>;
79
-
80
- export {};