@quenty/rodux-undo 8.9.4 → 8.9.5-canary.11a5dcf.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/CHANGELOG.md +8 -0
- package/package.json +4 -4
- package/src/Shared/UndoableReducer.lua +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.9.5-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rodux-undo@8.9.4...@quenty/rodux-undo@8.9.5-canary.11a5dcf.0) (2025-05-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/rodux-undo
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [8.9.4](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rodux-undo@8.9.3...@quenty/rodux-undo@8.9.4) (2025-04-10)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/rodux-undo
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/rodux-undo",
|
|
3
|
-
"version": "8.9.
|
|
3
|
+
"version": "8.9.5-canary.11a5dcf.0",
|
|
4
4
|
"description": "Undo stack for rodux",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "
|
|
29
|
-
"@quenty/table": "
|
|
28
|
+
"@quenty/loader": "10.8.4-canary.11a5dcf.0",
|
|
29
|
+
"@quenty/table": "3.7.5-canary.11a5dcf.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
|
|
35
35
|
}
|
|
@@ -14,15 +14,15 @@ local function insert(state, reduced)
|
|
|
14
14
|
local _end = math.min(#state.past, start + HISTORY_LIMIT)
|
|
15
15
|
|
|
16
16
|
local newPast = {}
|
|
17
|
-
for i=start, _end do
|
|
17
|
+
for i = start, _end do
|
|
18
18
|
newPast[#newPast + 1] = state.past[i]
|
|
19
19
|
end
|
|
20
20
|
newPast[#newPast + 1] = state.present
|
|
21
21
|
|
|
22
22
|
return {
|
|
23
|
-
past = newPast
|
|
24
|
-
present = reduced
|
|
25
|
-
future = {}
|
|
23
|
+
past = newPast,
|
|
24
|
+
present = reduced,
|
|
25
|
+
future = {},
|
|
26
26
|
}
|
|
27
27
|
end
|
|
28
28
|
|
|
@@ -34,39 +34,39 @@ return function(reducer)
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
local newPast = {}
|
|
37
|
-
for i=1, #state.past - 1 do
|
|
37
|
+
for i = 1, #state.past - 1 do
|
|
38
38
|
newPast[#newPast + 1] = state.past[i]
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
return {
|
|
42
|
-
past = newPast
|
|
43
|
-
present = state.past[#state.past]
|
|
44
|
-
future = Table.mergeLists(state.future, { state.present })
|
|
42
|
+
past = newPast,
|
|
43
|
+
present = state.past[#state.past],
|
|
44
|
+
future = Table.mergeLists(state.future, { state.present }),
|
|
45
45
|
}
|
|
46
|
-
end
|
|
46
|
+
end,
|
|
47
47
|
redo = function(state, _action)
|
|
48
48
|
if #state.future == 0 then
|
|
49
49
|
return state
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
local newFuture = {}
|
|
53
|
-
for i=1, #state.future - 1 do
|
|
53
|
+
for i = 1, #state.future - 1 do
|
|
54
54
|
newFuture[#newFuture + 1] = state.future[i]
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
return {
|
|
58
|
-
past = Table.mergeLists(state.past, { state.present })
|
|
59
|
-
present = state.future[#state.future]
|
|
60
|
-
future = newFuture
|
|
58
|
+
past = Table.mergeLists(state.past, { state.present }),
|
|
59
|
+
present = state.future[#state.future],
|
|
60
|
+
future = newFuture,
|
|
61
61
|
}
|
|
62
|
-
end
|
|
62
|
+
end,
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return function(state, action)
|
|
66
66
|
state = state or {
|
|
67
|
-
past = {}
|
|
68
|
-
present = reducer(nil, {})
|
|
69
|
-
future = {}
|
|
67
|
+
past = {},
|
|
68
|
+
present = reducer(nil, {}),
|
|
69
|
+
future = {},
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
if not action.type then
|
|
@@ -82,5 +82,5 @@ return function(reducer)
|
|
|
82
82
|
|
|
83
83
|
return insert(state, reduced)
|
|
84
84
|
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
85
|
+
end
|
|
86
|
+
end
|