reactronic 0.22.502 → 0.22.504

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.
@@ -9,7 +9,7 @@ export declare abstract class ObservableCollection<T> extends ObservableObject i
9
9
  get isMergeInProgress(): boolean;
10
10
  lookup(key: string): Item<T> | undefined;
11
11
  claim(key: string): Item<T> | undefined;
12
- add(self: T): Item<T>;
12
+ add(instance: T): Item<T>;
13
13
  remove(item: Item<T>): void;
14
14
  move(item: Item<T>, after: Item<T>): void;
15
15
  beginMerge(): void;
@@ -7,7 +7,7 @@ export class ObservableCollection extends ObservableObject {
7
7
  get isMergeInProgress() { return this.impl.isMergeInProgress; }
8
8
  lookup(key) { return this.impl.lookup(key); }
9
9
  claim(key) { return this.impl.claim(key); }
10
- add(self) { return this.impl.add(self); }
10
+ add(instance) { return this.impl.add(instance); }
11
11
  remove(item) { return this.impl.remove(item); }
12
12
  move(item, after) { this.impl.move(item, after); }
13
13
  beginMerge() { this.impl.beginMerge(); }
@@ -7,7 +7,7 @@ export interface CollectionReader<T> {
7
7
  readonly isMergeInProgress: boolean;
8
8
  lookup(key: string): Item<T> | undefined;
9
9
  claim(key: string): Item<T> | undefined;
10
- add(self: T): Item<T>;
10
+ add(instance: T): Item<T>;
11
11
  remove(item: Item<T>): void;
12
12
  move(item: Item<T>, after: Item<T>): void;
13
13
  beginMerge(): void;
@@ -23,7 +23,7 @@ export interface CollectionReader<T> {
23
23
  isCurrent(item: Item<T>): boolean;
24
24
  }
25
25
  export interface Item<T> {
26
- readonly self: T;
26
+ readonly instance: T;
27
27
  readonly prev?: Item<T>;
28
28
  aux?: Item<T>;
29
29
  }
@@ -45,8 +45,8 @@ export declare class Collection<T> implements CollectionReader<T> {
45
45
  lookup(key: string | undefined): Item<T> | undefined;
46
46
  claim(key: string, resolution?: {
47
47
  isDuplicate: boolean;
48
- }): Item<T> | undefined;
49
- add(self: T): Item<T>;
48
+ }, error?: string): Item<T> | undefined;
49
+ add(instance: T): Item<T>;
50
50
  remove(item: Item<T>): void;
51
51
  move(item: Item<T>, after: Item<T>): void;
52
52
  beginMerge(): void;
@@ -61,5 +61,5 @@ export declare class Collection<T> implements CollectionReader<T> {
61
61
  isRemoved(item: Item<T>): boolean;
62
62
  isCurrent(item: Item<T>): boolean;
63
63
  markAsMoved(item: Item<T>): void;
64
- static createItem<T>(self: T): Item<T>;
64
+ static createItem<T>(instance: T): Item<T>;
65
65
  }
@@ -27,7 +27,7 @@ export class Collection {
27
27
  if (key !== undefined && key !== this.lastNotFoundKey) {
28
28
  result = this.map.get(key);
29
29
  if (result) {
30
- if (this.getKey(result.self) !== key) {
30
+ if (this.getKey(result.instance) !== key) {
31
31
  this.lastNotFoundKey = key;
32
32
  result = undefined;
33
33
  }
@@ -37,12 +37,12 @@ export class Collection {
37
37
  }
38
38
  return result;
39
39
  }
40
- claim(key, resolution) {
40
+ claim(key, resolution, error) {
41
41
  const tag = this.tag;
42
42
  if (tag < 0)
43
- throw new Error('merge is not in progress');
43
+ throw new Error(error !== null && error !== void 0 ? error : 'merge is not in progress');
44
44
  let item = this.strictNextItem;
45
- if (key !== (item ? this.getKey(item.self) : undefined))
45
+ if (key !== (item ? this.getKey(item.instance) : undefined))
46
46
  item = this.lookup(key);
47
47
  if (item) {
48
48
  if (item.tag !== tag) {
@@ -58,14 +58,14 @@ export class Collection {
58
58
  else if (resolution)
59
59
  resolution.isDuplicate = true;
60
60
  else
61
- throw new Error(`duplicate item: ${key}`);
61
+ throw new Error(`duplicate collection item: ${key}`);
62
62
  }
63
63
  else if (resolution)
64
64
  resolution.isDuplicate = false;
65
65
  return item;
66
66
  }
67
- add(self) {
68
- const key = this.getKey(self);
67
+ add(instance) {
68
+ const key = this.getKey(instance);
69
69
  if (this.lookup(key) !== undefined)
70
70
  throw new Error(`key is already in use: ${key}`);
71
71
  let tag = this.tag;
@@ -73,7 +73,7 @@ export class Collection {
73
73
  tag = ~this.tag + 1;
74
74
  this.tag = ~tag;
75
75
  }
76
- const item = new ItemImpl(self, tag);
76
+ const item = new ItemImpl(instance, tag);
77
77
  this.map.set(key, item);
78
78
  this.lastNotFoundKey = undefined;
79
79
  this.strictNextItem = undefined;
@@ -111,12 +111,12 @@ export class Collection {
111
111
  if (currentCount > this.removed.count) {
112
112
  const map = this.map;
113
113
  for (const x of this.removed.items())
114
- map.delete(getKey(x.self));
114
+ map.delete(getKey(x.instance));
115
115
  }
116
116
  else {
117
117
  const map = this.map = new Map();
118
118
  for (const x of this.current.items())
119
- map.set(getKey(x.self), x);
119
+ map.set(getKey(x.instance), x);
120
120
  }
121
121
  }
122
122
  else
@@ -126,7 +126,7 @@ export class Collection {
126
126
  this.current.grab(this.removed, true);
127
127
  const getKey = this.getKey;
128
128
  for (const x of this.added.itemsViaAux()) {
129
- this.map.delete(getKey(x.self));
129
+ this.map.delete(getKey(x.instance));
130
130
  this.current.exclude(x);
131
131
  }
132
132
  this.added.reset();
@@ -196,13 +196,13 @@ export class Collection {
196
196
  if (t.tag > 0)
197
197
  t.status = t.tag;
198
198
  }
199
- static createItem(self) {
200
- return new ItemImpl(self, 0);
199
+ static createItem(instance) {
200
+ return new ItemImpl(instance, 0);
201
201
  }
202
202
  }
203
203
  class ItemImpl {
204
- constructor(self, tag) {
205
- this.self = self;
204
+ constructor(instance, tag) {
205
+ this.instance = instance;
206
206
  this.tag = tag;
207
207
  this.status = ~tag;
208
208
  this.next = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.22.502",
3
+ "version": "0.22.504",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",
@@ -31,16 +31,16 @@
31
31
  },
32
32
  "homepage": "https://github.com/nezaboodka/reactronic/blob/master/README.md#readme",
33
33
  "devDependencies": {
34
- "@types/node": "18.7.18",
35
- "@types/react": "18.0.20",
36
- "@typescript-eslint/eslint-plugin": "5.37.0",
37
- "@typescript-eslint/parser": "5.37.0",
34
+ "@types/node": "18.11.9",
35
+ "@types/react": "18.0.25",
36
+ "@typescript-eslint/eslint-plugin": "5.42.1",
37
+ "@typescript-eslint/parser": "5.42.1",
38
38
  "ava": "4.3.3",
39
39
  "c8": "7.12.0",
40
- "eslint": "8.23.1",
40
+ "eslint": "8.27.0",
41
41
  "react": "18.2.0",
42
42
  "ts-node": "10.9.1",
43
- "typescript": "4.8.2"
43
+ "typescript": "4.8.4"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "eslint source/**/*.ts test/**/*.ts react/**/*.tsx && tsc",