@oscarpalmer/abydon 0.13.0 → 0.14.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/types/index.d.cts DELETED
@@ -1,302 +0,0 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- /**
4
- * A generic key type
5
- */
6
- export type Key = number | string;
7
- export type GenericCallback = (...args: any[]) => any;
8
- type Key$1 = number | string;
9
- /**
10
- * A generic object
11
- */
12
- export type PlainObject = Record<PropertyKey, unknown>;
13
- export declare class Effect {
14
- private readonly $mora;
15
- private readonly state;
16
- constructor(callback: GenericCallback);
17
- }
18
- /**
19
- * Create an effect
20
- */
21
- export declare function effect(callback: GenericCallback): Effect;
22
- export declare class Computed<Value> extends Reactive<Value> {
23
- private readonly effect;
24
- constructor(callback: () => Value, options?: ReactiveOptions<Value>);
25
- /**
26
- * @inheritdoc
27
- */
28
- get(): Value;
29
- }
30
- /**
31
- * Create a computed value
32
- */
33
- export declare function computed<Value>(callback: () => Value, options?: ReactiveOptions<Value>): Computed<Value>;
34
- export declare abstract class Reactive<Value, Equal = Value> {
35
- protected readonly state: ReactiveState<Value, Equal>;
36
- constructor(name: string, value: Value, options?: ReactiveOptions<Equal>);
37
- /**
38
- * Get the value
39
- */
40
- abstract get(): Value;
41
- /**
42
- * Get the value _(without reactivity)_
43
- */
44
- peek(): Value;
45
- /**
46
- * Subscribe to changes
47
- */
48
- subscribe(callback: (value: Value) => void): Unsubscribe;
49
- /**
50
- * JSON representation of the value
51
- */
52
- toJSON(): Value;
53
- /**
54
- * String representation of the value
55
- */
56
- toString(): string;
57
- /**
58
- * Unsubscribe from changes
59
- */
60
- unsubscribe(callback: (value: Value) => void): void;
61
- }
62
- export type ReactiveOptions<Value> = {
63
- /**
64
- * Method to compare values for equality
65
- */
66
- equal?: (first: Value, second: Value) => boolean;
67
- };
68
- export type ReactiveState<Value, Equal> = {
69
- computeds: Set<Computed<unknown>>;
70
- effects: Set<Effect>;
71
- equal: (first: Equal, second: Equal) => boolean;
72
- subscriptions: Map<GenericCallback, Subscription>;
73
- value: Value;
74
- };
75
- declare class Subscription {
76
- state: ReactiveState<unknown, never>;
77
- callback: GenericCallback;
78
- constructor(state: ReactiveState<unknown, never>, callback: GenericCallback);
79
- }
80
- /**
81
- * Unsubscribe from changes
82
- */
83
- export type Unsubscribe = () => void;
84
- /**
85
- * Start batching effects _(use `stopBatch` to flush and run batched effects)_
86
- */
87
- export declare function startBatch(): void;
88
- /**
89
- * Stop batching effects and flush _(run)_ them
90
- */
91
- export declare function stopBatch(): void;
92
- export declare class ReactiveArray<Item> extends Reactive<Item[], Item> {
93
- #private;
94
- /**
95
- * The length of the array
96
- */
97
- get length(): number;
98
- /**
99
- * Set the length of the array
100
- */
101
- set length(value: number);
102
- constructor(value: Item[], options?: ReactiveOptions<Item>);
103
- /**
104
- * Clear the array
105
- */
106
- clear(): void;
107
- /**
108
- * @inheritdoc
109
- */
110
- get(): Item[];
111
- /**
112
- * Get the value at an index
113
- */
114
- get(index: number): Item | undefined;
115
- /**
116
- * Get the length of the array
117
- */
118
- get(property: "length"): number;
119
- /**
120
- * Create a computed, filtered array
121
- */
122
- filter(callback: (item: Item, index: number, array: Item[]) => boolean): Computed<Item[]>;
123
- /**
124
- * Create a computed, mapped array
125
- */
126
- map<Mapped>(callback: (item: Item, index: number, array: Item[]) => Mapped): Computed<Mapped[]>;
127
- /**
128
- * @inheritdoc
129
- */
130
- peek(): Item[];
131
- peek(index: number): Item | undefined;
132
- /**
133
- * Get the length of the array _(without reactivity)_
134
- */
135
- peek(length: true): number;
136
- /**
137
- * Remove and return the last item of the array
138
- */
139
- pop(): Item | undefined;
140
- /**
141
- * Add items to the end of the array
142
- */
143
- push(...items: Item[]): number;
144
- /**
145
- * Set the value
146
- */
147
- set(value?: Item[]): void;
148
- /**
149
- * Set the value at an index
150
- */
151
- set(index: number, value: Item): void;
152
- /**
153
- * Set the length of the array
154
- */
155
- set(property: "length", value: number): void;
156
- /**
157
- * Remove and return the first item of the array
158
- */
159
- shift(): Item | undefined;
160
- /**
161
- * Remove and return items from the array _(and optionally add new items)_
162
- */
163
- splice(from: number, to?: number, ...items: Item[]): Item[];
164
- /**
165
- * @inheritdoc
166
- */
167
- subscribe(callback: (value: Item[]) => void): Unsubscribe;
168
- /**
169
- * Subscribe to changes at a specific index
170
- */
171
- subscribe(index: number, callback: (value: Item | undefined) => void): Unsubscribe;
172
- /**
173
- * Add items to the beginning of the array
174
- */
175
- unshift(...items: Item[]): number;
176
- /**
177
- * Update the value _(based on the current value)_
178
- */
179
- update(callback: (value: Item[]) => Item[]): void;
180
- }
181
- /**
182
- * Create a reactive array
183
- */
184
- export declare function array<Item>(value: Item[], options?: ReactiveOptions<Item>): ReactiveArray<Item>;
185
- export declare class Signal<Value> extends Reactive<Value> {
186
- constructor(value: Value, options?: ReactiveOptions<Value>);
187
- /**
188
- * @inheritdoc
189
- */
190
- get(): Value;
191
- /**
192
- * Set the value
193
- */
194
- set(value: Value): void;
195
- /**
196
- * Update the value _(based on the current value)_
197
- */
198
- update(callback: (value: Value) => Value): void;
199
- }
200
- /**
201
- * Create a reactive value
202
- */
203
- export declare function signal<Value>(value: Value, options?: ReactiveOptions<Value>): Signal<Value>;
204
- export declare class Store<Value extends PlainObject> extends Reactive<Value, Value> {
205
- #private;
206
- constructor(value: Value, options?: ReactiveOptions<Value>);
207
- /**
208
- * @inheritdoc
209
- */
210
- get(): Value;
211
- /**
212
- * Get a value by key _(without reactivity)_
213
- */
214
- get(key: keyof Value): Value[keyof Value];
215
- /**
216
- * Get a value by key _(without reactivity)_
217
- */
218
- get(key: Key$1): unknown;
219
- /**
220
- * Get the value _(without reactivity)_
221
- */
222
- peek(): Value;
223
- /**
224
- * Get a value by key _(without reactivity)_
225
- */
226
- peek(key: keyof Value): Value[keyof Value];
227
- /**
228
- * Get a value by key _(without reactivity)_
229
- */
230
- peek(key: Key$1): unknown;
231
- /**
232
- * Set the value
233
- */
234
- set(value?: Value): void;
235
- /**
236
- * Set a value by key
237
- */
238
- set(key: keyof Value, value: Value[keyof Value]): void;
239
- /**
240
- * Set a value by key
241
- */
242
- set(key: Key$1, value: unknown): void;
243
- /**
244
- * @inheritdoc
245
- */
246
- subscribe(callback: (value: Value) => void): Unsubscribe;
247
- /**
248
- * Subscribe to changes for a specific key
249
- */
250
- subscribe<Key extends keyof Value>(key: Key, callback: (value: Value[Key] | undefined) => void): Unsubscribe;
251
- /**
252
- * Subscribe to changes for a specific key
253
- */
254
- subscribe(key: Key$1, callback: (value: unknown) => void): Unsubscribe;
255
- /**
256
- * Update the value _(based on the current value)_
257
- */
258
- update(callback: (value: Value) => Value): void;
259
- }
260
- /**
261
- * Create a reactive store
262
- */
263
- export declare function store<Value extends PlainObject>(value: Value, options?: ReactiveOptions<Value>): Store<Value>;
264
- /**
265
- * Is the value a reactive array?
266
- */
267
- export declare function isArray(value: unknown): value is ReactiveArray<unknown>;
268
- /**
269
- * Is the value a computed signal?
270
- */
271
- export declare function isComputed(value: unknown): value is Computed<unknown>;
272
- /**
273
- * Is the value an effect?
274
- */
275
- export declare function isEffect(value: unknown): value is Effect;
276
- export declare function isReactive(value: unknown): value is Reactive<unknown>;
277
- /**
278
- * Is the value a signal?
279
- */
280
- export declare function isSignal(value: unknown): value is Signal<unknown>;
281
- export declare class Fragment {
282
- private readonly $fragment;
283
- private readonly data;
284
- get identifier(): Key | undefined;
285
- constructor(strings: TemplateStringsArray, expressions: unknown[]);
286
- /**
287
- * Appends the fragment to the given element
288
- */
289
- appendTo(element: Element): void;
290
- /**
291
- * Gets a list of the fragment's nodes
292
- */
293
- get(): ChildNode[];
294
- identify(identifier: Key): Fragment;
295
- /**
296
- * Removes the fragment from the DOM
297
- */
298
- remove(): void;
299
- }
300
- export declare function html(strings: TemplateStringsArray, ...values: unknown[]): Fragment;
301
-
302
- export {};
@@ -1,107 +0,0 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- /**
4
- * A generic key type
5
- */
6
- export type Key = number | string;
7
- export type GenericCallback = (...args: any[]) => any;
8
- declare class Effect {
9
- private readonly $mora;
10
- private readonly state;
11
- constructor(callback: GenericCallback);
12
- }
13
- declare class Computed<Value> extends Reactive<Value> {
14
- private readonly effect;
15
- constructor(callback: () => Value, options?: ReactiveOptions<Value>);
16
- /**
17
- * @inheritdoc
18
- */
19
- get(): Value;
20
- }
21
- declare abstract class Reactive<Value, Equal = Value> {
22
- protected readonly state: ReactiveState<Value, Equal>;
23
- constructor(name: string, value: Value, options?: ReactiveOptions<Equal>);
24
- /**
25
- * Get the value
26
- */
27
- abstract get(): Value;
28
- /**
29
- * Get the value _(without reactivity)_
30
- */
31
- peek(): Value;
32
- /**
33
- * Subscribe to changes
34
- */
35
- subscribe(callback: (value: Value) => void): Unsubscribe;
36
- /**
37
- * JSON representation of the value
38
- */
39
- toJSON(): Value;
40
- /**
41
- * String representation of the value
42
- */
43
- toString(): string;
44
- /**
45
- * Unsubscribe from changes
46
- */
47
- unsubscribe(callback: (value: Value) => void): void;
48
- }
49
- export type ReactiveOptions<Value> = {
50
- /**
51
- * Method to compare values for equality
52
- */
53
- equal?: (first: Value, second: Value) => boolean;
54
- };
55
- export type ReactiveState<Value, Equal> = {
56
- computeds: Set<Computed<unknown>>;
57
- effects: Set<Effect>;
58
- equal: (first: Equal, second: Equal) => boolean;
59
- subscriptions: Map<GenericCallback, Subscription>;
60
- value: Value;
61
- };
62
- declare class Subscription {
63
- state: ReactiveState<unknown, never>;
64
- callback: GenericCallback;
65
- constructor(state: ReactiveState<unknown, never>, callback: GenericCallback);
66
- }
67
- /**
68
- * Unsubscribe from changes
69
- */
70
- export type Unsubscribe = () => void;
71
- declare class Fragment {
72
- private readonly $fragment;
73
- private readonly data;
74
- get identifier(): Key | undefined;
75
- constructor(strings: TemplateStringsArray, expressions: unknown[]);
76
- /**
77
- * Appends the fragment to the given element
78
- */
79
- appendTo(element: Element): void;
80
- /**
81
- * Gets a list of the fragment's nodes
82
- */
83
- get(): ChildNode[];
84
- identify(identifier: Key): Fragment;
85
- /**
86
- * Removes the fragment from the DOM
87
- */
88
- remove(): void;
89
- }
90
- export type FragmentData = {
91
- expressions: unknown[];
92
- identifier?: Key;
93
- items: FragmentItem[];
94
- mora: MoraData;
95
- strings: TemplateStringsArray;
96
- values: unknown[];
97
- };
98
- export type FragmentItem = {
99
- fragments?: Fragment[];
100
- nodes: ChildNode[];
101
- };
102
- export type MoraData = {
103
- subscribers: Set<() => void>;
104
- values: Set<Reactive<unknown>>;
105
- };
106
-
107
- export {};
@@ -1,109 +0,0 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- /**
4
- * A generic key type
5
- */
6
- export type Key = number | string;
7
- export type GenericCallback = (...args: any[]) => any;
8
- declare class Effect {
9
- private readonly $mora;
10
- private readonly state;
11
- constructor(callback: GenericCallback);
12
- }
13
- declare class Computed<Value> extends Reactive<Value> {
14
- private readonly effect;
15
- constructor(callback: () => Value, options?: ReactiveOptions<Value>);
16
- /**
17
- * @inheritdoc
18
- */
19
- get(): Value;
20
- }
21
- declare abstract class Reactive<Value, Equal = Value> {
22
- protected readonly state: ReactiveState<Value, Equal>;
23
- constructor(name: string, value: Value, options?: ReactiveOptions<Equal>);
24
- /**
25
- * Get the value
26
- */
27
- abstract get(): Value;
28
- /**
29
- * Get the value _(without reactivity)_
30
- */
31
- peek(): Value;
32
- /**
33
- * Subscribe to changes
34
- */
35
- subscribe(callback: (value: Value) => void): Unsubscribe;
36
- /**
37
- * JSON representation of the value
38
- */
39
- toJSON(): Value;
40
- /**
41
- * String representation of the value
42
- */
43
- toString(): string;
44
- /**
45
- * Unsubscribe from changes
46
- */
47
- unsubscribe(callback: (value: Value) => void): void;
48
- }
49
- export type ReactiveOptions<Value> = {
50
- /**
51
- * Method to compare values for equality
52
- */
53
- equal?: (first: Value, second: Value) => boolean;
54
- };
55
- export type ReactiveState<Value, Equal> = {
56
- computeds: Set<Computed<unknown>>;
57
- effects: Set<Effect>;
58
- equal: (first: Equal, second: Equal) => boolean;
59
- subscriptions: Map<GenericCallback, Subscription>;
60
- value: Value;
61
- };
62
- declare class Subscription {
63
- state: ReactiveState<unknown, never>;
64
- callback: GenericCallback;
65
- constructor(state: ReactiveState<unknown, never>, callback: GenericCallback);
66
- }
67
- /**
68
- * Unsubscribe from changes
69
- */
70
- export type Unsubscribe = () => void;
71
- declare class Fragment {
72
- private readonly $fragment;
73
- private readonly data;
74
- get identifier(): Key | undefined;
75
- constructor(strings: TemplateStringsArray, expressions: unknown[]);
76
- /**
77
- * Appends the fragment to the given element
78
- */
79
- appendTo(element: Element): void;
80
- /**
81
- * Gets a list of the fragment's nodes
82
- */
83
- get(): ChildNode[];
84
- identify(identifier: Key): Fragment;
85
- /**
86
- * Removes the fragment from the DOM
87
- */
88
- remove(): void;
89
- }
90
- export type FragmentData = {
91
- expressions: unknown[];
92
- identifier?: Key;
93
- items: FragmentItem[];
94
- mora: MoraData;
95
- strings: TemplateStringsArray;
96
- values: unknown[];
97
- };
98
- export type FragmentItem = {
99
- fragments?: Fragment[];
100
- nodes: ChildNode[];
101
- };
102
- export type MoraData = {
103
- subscribers: Set<() => void>;
104
- values: Set<Reactive<unknown>>;
105
- };
106
- type HTMLOrSVGElement$1 = HTMLElement | SVGElement;
107
- export declare function mapAttributes(data: FragmentData, element: HTMLOrSVGElement$1): void;
108
-
109
- export {};
@@ -1,109 +0,0 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- /**
4
- * A generic key type
5
- */
6
- export type Key = number | string;
7
- export type GenericCallback = (...args: any[]) => any;
8
- declare class Effect {
9
- private readonly $mora;
10
- private readonly state;
11
- constructor(callback: GenericCallback);
12
- }
13
- declare class Computed<Value> extends Reactive<Value> {
14
- private readonly effect;
15
- constructor(callback: () => Value, options?: ReactiveOptions<Value>);
16
- /**
17
- * @inheritdoc
18
- */
19
- get(): Value;
20
- }
21
- declare abstract class Reactive<Value, Equal = Value> {
22
- protected readonly state: ReactiveState<Value, Equal>;
23
- constructor(name: string, value: Value, options?: ReactiveOptions<Equal>);
24
- /**
25
- * Get the value
26
- */
27
- abstract get(): Value;
28
- /**
29
- * Get the value _(without reactivity)_
30
- */
31
- peek(): Value;
32
- /**
33
- * Subscribe to changes
34
- */
35
- subscribe(callback: (value: Value) => void): Unsubscribe;
36
- /**
37
- * JSON representation of the value
38
- */
39
- toJSON(): Value;
40
- /**
41
- * String representation of the value
42
- */
43
- toString(): string;
44
- /**
45
- * Unsubscribe from changes
46
- */
47
- unsubscribe(callback: (value: Value) => void): void;
48
- }
49
- export type ReactiveOptions<Value> = {
50
- /**
51
- * Method to compare values for equality
52
- */
53
- equal?: (first: Value, second: Value) => boolean;
54
- };
55
- export type ReactiveState<Value, Equal> = {
56
- computeds: Set<Computed<unknown>>;
57
- effects: Set<Effect>;
58
- equal: (first: Equal, second: Equal) => boolean;
59
- subscriptions: Map<GenericCallback, Subscription>;
60
- value: Value;
61
- };
62
- declare class Subscription {
63
- state: ReactiveState<unknown, never>;
64
- callback: GenericCallback;
65
- constructor(state: ReactiveState<unknown, never>, callback: GenericCallback);
66
- }
67
- /**
68
- * Unsubscribe from changes
69
- */
70
- export type Unsubscribe = () => void;
71
- declare class Fragment {
72
- private readonly $fragment;
73
- private readonly data;
74
- get identifier(): Key | undefined;
75
- constructor(strings: TemplateStringsArray, expressions: unknown[]);
76
- /**
77
- * Appends the fragment to the given element
78
- */
79
- appendTo(element: Element): void;
80
- /**
81
- * Gets a list of the fragment's nodes
82
- */
83
- get(): ChildNode[];
84
- identify(identifier: Key): Fragment;
85
- /**
86
- * Removes the fragment from the DOM
87
- */
88
- remove(): void;
89
- }
90
- export type FragmentData = {
91
- expressions: unknown[];
92
- identifier?: Key;
93
- items: FragmentItem[];
94
- mora: MoraData;
95
- strings: TemplateStringsArray;
96
- values: unknown[];
97
- };
98
- export type FragmentItem = {
99
- fragments?: Fragment[];
100
- nodes: ChildNode[];
101
- };
102
- export type MoraData = {
103
- subscribers: Set<() => void>;
104
- values: Set<Reactive<unknown>>;
105
- };
106
- type HTMLOrSVGElement$1 = HTMLElement | SVGElement;
107
- export declare function setAttribute(data: FragmentData, element: HTMLOrSVGElement$1, name: string, value: unknown): void;
108
-
109
- export {};
@@ -1,7 +0,0 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- type HTMLOrSVGElement$1 = HTMLElement | SVGElement;
4
- export declare function mapEvent(element: HTMLOrSVGElement$1, name: string, value: unknown): void;
5
- export declare function removeEvents(element: HTMLOrSVGElement$1): void;
6
-
7
- export {};