@esportsplus/template 0.16.4 → 0.16.5
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/build/slot/array.js +6 -0
- package/package.json +2 -2
- package/src/slot/array.ts +7 -0
package/build/slot/array.js
CHANGED
|
@@ -51,6 +51,9 @@ class ArraySlot {
|
|
|
51
51
|
array.on('reverse', () => {
|
|
52
52
|
this.schedule({ op: 'reverse' });
|
|
53
53
|
});
|
|
54
|
+
array.on('set', ({ index, item }) => {
|
|
55
|
+
this.schedule({ op: 'set', item, index });
|
|
56
|
+
});
|
|
54
57
|
array.on('shift', () => {
|
|
55
58
|
this.schedule({ op: 'shift' });
|
|
56
59
|
});
|
|
@@ -115,6 +118,9 @@ class ArraySlot {
|
|
|
115
118
|
this.nodes.reverse();
|
|
116
119
|
this.sync();
|
|
117
120
|
break;
|
|
121
|
+
case 'set':
|
|
122
|
+
this.splice(op.index, op.index + 1, [op.item]);
|
|
123
|
+
break;
|
|
118
124
|
case 'shift':
|
|
119
125
|
this.shift();
|
|
120
126
|
break;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"dependencies": {
|
|
4
4
|
"@esportsplus/pipeline": "^1.2.2",
|
|
5
5
|
"@esportsplus/queue": "^0.2.0",
|
|
6
|
-
"@esportsplus/reactivity": "^0.
|
|
6
|
+
"@esportsplus/reactivity": "^0.30.0",
|
|
7
7
|
"@esportsplus/typescript": "^0.28.4",
|
|
8
8
|
"@esportsplus/utilities": "^0.27.2"
|
|
9
9
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"type": "module",
|
|
41
41
|
"types": "./build/index.d.ts",
|
|
42
|
-
"version": "0.16.
|
|
42
|
+
"version": "0.16.5",
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc",
|
|
45
45
|
"test": "vitest run",
|
package/src/slot/array.ts
CHANGED
|
@@ -10,6 +10,7 @@ type ArraySlotOp<T> =
|
|
|
10
10
|
| { items: T[]; op: 'concat' }
|
|
11
11
|
| { deleteCount: number; items: T[]; op: 'splice'; start: number }
|
|
12
12
|
| { items: T[]; op: 'push' }
|
|
13
|
+
| { index: number; item: T; op: 'set' }
|
|
13
14
|
| { items: T[]; op: 'unshift' }
|
|
14
15
|
| { op: 'clear' }
|
|
15
16
|
| { op: 'pop' }
|
|
@@ -78,6 +79,9 @@ class ArraySlot<T> {
|
|
|
78
79
|
array.on('reverse', () => {
|
|
79
80
|
this.schedule({ op: 'reverse' });
|
|
80
81
|
});
|
|
82
|
+
array.on('set', ({ index, item }) => {
|
|
83
|
+
this.schedule({ op: 'set', item, index });
|
|
84
|
+
});
|
|
81
85
|
array.on('shift', () => {
|
|
82
86
|
this.schedule({ op: 'shift' });
|
|
83
87
|
});
|
|
@@ -158,6 +162,9 @@ class ArraySlot<T> {
|
|
|
158
162
|
this.nodes.reverse();
|
|
159
163
|
this.sync();
|
|
160
164
|
break;
|
|
165
|
+
case 'set':
|
|
166
|
+
this.splice(op.index, op.index + 1, [op.item]);
|
|
167
|
+
break;
|
|
161
168
|
case 'shift':
|
|
162
169
|
this.shift();
|
|
163
170
|
break;
|