reactronic 0.24.264 → 0.24.266
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type GetMergedItemKey<T = unknown> = (item: T) => string | undefined;
|
|
2
2
|
export type MergeListReader<T> = {
|
|
3
3
|
readonly isStrict: boolean;
|
|
4
4
|
readonly count: number;
|
|
@@ -24,12 +24,13 @@ export type MergeListReader<T> = {
|
|
|
24
24
|
};
|
|
25
25
|
export type MergedItem<T> = {
|
|
26
26
|
readonly instance: T;
|
|
27
|
+
readonly index: number;
|
|
27
28
|
readonly next?: MergedItem<T>;
|
|
28
29
|
readonly prev?: MergedItem<T>;
|
|
29
30
|
aux?: MergedItem<T>;
|
|
30
31
|
};
|
|
31
32
|
export declare class MergeList<T> implements MergeListReader<T> {
|
|
32
|
-
readonly getKey:
|
|
33
|
+
readonly getKey: GetMergedItemKey<T>;
|
|
33
34
|
private strict;
|
|
34
35
|
private map;
|
|
35
36
|
private tag;
|
|
@@ -38,7 +39,7 @@ export declare class MergeList<T> implements MergeListReader<T> {
|
|
|
38
39
|
private removed;
|
|
39
40
|
private lastNotFoundKey;
|
|
40
41
|
private strictNextItem?;
|
|
41
|
-
constructor(getKey:
|
|
42
|
+
constructor(getKey: GetMergedItemKey<T>, strict?: boolean);
|
|
42
43
|
get isStrict(): boolean;
|
|
43
44
|
set isStrict(value: boolean);
|
|
44
45
|
get count(): number;
|
|
@@ -57,6 +57,7 @@ export class MergeList {
|
|
|
57
57
|
item.status = tag;
|
|
58
58
|
this.strictNextItem = item.next;
|
|
59
59
|
this.removed.exclude(item);
|
|
60
|
+
item.index = this.current.count;
|
|
60
61
|
this.current.include(item);
|
|
61
62
|
if (resolution)
|
|
62
63
|
resolution.isDuplicate = false;
|
|
@@ -79,10 +80,11 @@ export class MergeList {
|
|
|
79
80
|
tag = ~this.tag + 1;
|
|
80
81
|
this.tag = ~tag;
|
|
81
82
|
}
|
|
82
|
-
const item = new
|
|
83
|
+
const item = new MergedItemImpl(instance, tag);
|
|
83
84
|
this.map.set(key, item);
|
|
84
85
|
this.lastNotFoundKey = undefined;
|
|
85
86
|
this.strictNextItem = undefined;
|
|
87
|
+
item.index = this.current.count;
|
|
86
88
|
this.current.include(item);
|
|
87
89
|
this.added.aux(item);
|
|
88
90
|
return item;
|
|
@@ -203,12 +205,13 @@ export class MergeList {
|
|
|
203
205
|
t.status = t.tag;
|
|
204
206
|
}
|
|
205
207
|
static createItem(instance) {
|
|
206
|
-
return new
|
|
208
|
+
return new MergedItemImpl(instance, 0);
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
|
-
class
|
|
211
|
+
class MergedItemImpl {
|
|
210
212
|
constructor(instance, tag) {
|
|
211
213
|
this.instance = instance;
|
|
214
|
+
this.index = -1;
|
|
212
215
|
this.tag = tag;
|
|
213
216
|
this.status = ~tag;
|
|
214
217
|
this.next = undefined;
|