@oscarpalmer/abydon 0.13.0 → 0.15.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/abydon.full.js +790 -763
- package/dist/constants.js +10 -0
- package/dist/fragment.js +38 -17
- package/dist/fragments.js +74 -0
- package/dist/helpers/dom.js +4 -4
- package/dist/helpers/index.js +4 -1
- package/dist/index.js +5 -1
- package/dist/node/attribute/index.js +19 -14
- package/dist/node/attribute/value.js +10 -12
- package/dist/node/event.js +7 -9
- package/dist/node/index.js +9 -4
- package/dist/node/value.js +84 -64
- package/dist/parse.js +7 -7
- package/package.json +14 -16
- package/src/constants.ts +20 -0
- package/src/fragment.ts +92 -29
- package/src/fragments.ts +134 -0
- package/src/helpers/dom.ts +3 -3
- package/src/helpers/index.ts +10 -0
- package/src/index.ts +16 -1
- package/src/models.ts +18 -4
- package/src/node/attribute/index.ts +24 -19
- package/src/node/attribute/value.ts +31 -28
- package/src/node/event.ts +11 -12
- package/src/node/index.ts +15 -6
- package/src/node/value.ts +186 -116
- package/src/parse.ts +10 -3
- package/types/constants.d.ts +9 -0
- package/types/fragment.d.ts +26 -8
- package/types/fragments.d.ts +13 -0
- package/types/helpers/index.d.ts +2 -0
- package/types/index.d.ts +5 -1
- package/types/models.d.ts +16 -4
- package/types/fragment.d.cts +0 -27
- package/types/helpers/dom.d.cts +0 -7
- package/types/helpers/index.d.cts +0 -29
- package/types/index.d.cts +0 -302
- package/types/models.d.cts +0 -107
- package/types/node/attribute/index.d.cts +0 -109
- package/types/node/attribute/value.d.cts +0 -109
- package/types/node/event.d.cts +0 -7
- package/types/node/index.d.cts +0 -108
- package/types/node/value.d.cts +0 -108
- package/types/parse.d.cts +0 -108
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactiveArray } from '@oscarpalmer/mora';
|
|
2
|
+
import type { Fragment } from './fragment';
|
|
3
|
+
import type { FragmentsState } from './models';
|
|
4
|
+
export declare class Fragments {
|
|
5
|
+
#private;
|
|
6
|
+
/**
|
|
7
|
+
* Fragment items
|
|
8
|
+
*/
|
|
9
|
+
get items(): ReactiveArray<Fragment>;
|
|
10
|
+
constructor(items: ReactiveArray<unknown>, identify: (item: unknown) => unknown, fragment: (item: unknown) => Fragment);
|
|
11
|
+
}
|
|
12
|
+
export declare function handleFragments(item: Fragments | FragmentsState, remove: boolean): void;
|
|
13
|
+
export declare function initializeFragments(state: FragmentsState): void;
|
package/types/helpers/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Fragment } from '../fragment';
|
|
2
|
+
import type { Fragments } from '../fragments';
|
|
2
3
|
export declare function compareArrays(first: unknown[], second: unknown[]): 'added' | 'dissimilar' | 'removed';
|
|
3
4
|
export declare function isFragment(value: unknown): value is Fragment;
|
|
5
|
+
export declare function isFragments(value: unknown): value is Fragments;
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import '@oscarpalmer/mora';
|
|
2
|
+
import type { ReactiveArray } from '@oscarpalmer/mora';
|
|
2
3
|
import { Fragment } from './fragment';
|
|
3
|
-
|
|
4
|
+
import { Fragments } from './fragments';
|
|
5
|
+
export declare function fragments<Item>(array: ReactiveArray<Item>, identify: (item: Item) => unknown, fragment: (item: Item) => Fragment): Fragments;
|
|
6
|
+
export declare function html(strings: TemplateStringsArray, ...values: unknown[]): unknown;
|
|
4
7
|
export * from '@oscarpalmer/mora';
|
|
5
8
|
export type { Fragment } from './fragment';
|
|
9
|
+
export type { Fragments } from './fragments';
|
package/types/models.d.ts
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Reactive } from '@oscarpalmer/mora';
|
|
1
|
+
import type { Reactive, ReactiveArray, Unsubscribe } from '@oscarpalmer/mora';
|
|
3
2
|
import type { Fragment } from './fragment';
|
|
3
|
+
export type FragmentConfiguration = {
|
|
4
|
+
identifier?: unknown;
|
|
5
|
+
ignoreCache?: boolean;
|
|
6
|
+
};
|
|
4
7
|
export type FragmentData = {
|
|
5
8
|
expressions: unknown[];
|
|
6
|
-
identifier?: Key;
|
|
7
9
|
items: FragmentItem[];
|
|
8
10
|
mora: MoraData;
|
|
9
11
|
strings: TemplateStringsArray;
|
|
12
|
+
template?: string;
|
|
10
13
|
values: unknown[];
|
|
11
14
|
};
|
|
12
15
|
export type FragmentItem = {
|
|
13
16
|
fragments?: Fragment[];
|
|
14
|
-
nodes
|
|
17
|
+
nodes?: ChildNode[];
|
|
18
|
+
text?: Text;
|
|
19
|
+
};
|
|
20
|
+
export type FragmentsState = {
|
|
21
|
+
array: ReactiveArray<unknown>;
|
|
22
|
+
fragment: (item: unknown) => Fragment;
|
|
23
|
+
identify: (item: unknown) => unknown;
|
|
24
|
+
instances: Record<string, Fragment>;
|
|
25
|
+
mapped: ReactiveArray<Fragment>;
|
|
26
|
+
subscriber: Unsubscribe | undefined;
|
|
15
27
|
};
|
|
16
28
|
type MoraData = {
|
|
17
29
|
subscribers: Set<() => void>;
|
package/types/fragment.d.cts
DELETED
|
@@ -1,27 +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 declare class Fragment {
|
|
8
|
-
private readonly $fragment;
|
|
9
|
-
private readonly data;
|
|
10
|
-
get identifier(): Key | undefined;
|
|
11
|
-
constructor(strings: TemplateStringsArray, expressions: unknown[]);
|
|
12
|
-
/**
|
|
13
|
-
* Appends the fragment to the given element
|
|
14
|
-
*/
|
|
15
|
-
appendTo(element: Element): void;
|
|
16
|
-
/**
|
|
17
|
-
* Gets a list of the fragment's nodes
|
|
18
|
-
*/
|
|
19
|
-
get(): ChildNode[];
|
|
20
|
-
identify(identifier: Key): Fragment;
|
|
21
|
-
/**
|
|
22
|
-
* Removes the fragment from the DOM
|
|
23
|
-
*/
|
|
24
|
-
remove(): void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export {};
|
package/types/helpers/dom.d.cts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
export declare function createNodes(value: unknown): ChildNode[];
|
|
4
|
-
export declare function removeNodes(nodes: ChildNode[]): void;
|
|
5
|
-
export declare function replaceNodes(from: ChildNode[], to: ChildNode[]): void;
|
|
6
|
-
|
|
7
|
-
export {};
|
|
@@ -1,29 +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
|
-
declare class Fragment {
|
|
8
|
-
private readonly $fragment;
|
|
9
|
-
private readonly data;
|
|
10
|
-
get identifier(): Key | undefined;
|
|
11
|
-
constructor(strings: TemplateStringsArray, expressions: unknown[]);
|
|
12
|
-
/**
|
|
13
|
-
* Appends the fragment to the given element
|
|
14
|
-
*/
|
|
15
|
-
appendTo(element: Element): void;
|
|
16
|
-
/**
|
|
17
|
-
* Gets a list of the fragment's nodes
|
|
18
|
-
*/
|
|
19
|
-
get(): ChildNode[];
|
|
20
|
-
identify(identifier: Key): Fragment;
|
|
21
|
-
/**
|
|
22
|
-
* Removes the fragment from the DOM
|
|
23
|
-
*/
|
|
24
|
-
remove(): void;
|
|
25
|
-
}
|
|
26
|
-
export declare function compareArrays(first: unknown[], second: unknown[]): "added" | "dissimilar" | "removed";
|
|
27
|
-
export declare function isFragment(value: unknown): value is Fragment;
|
|
28
|
-
|
|
29
|
-
export {};
|
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 {};
|
package/types/models.d.cts
DELETED
|
@@ -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 {};
|