lcd-undobale 9.0.0-alpha.3 → 9.0.0-alpha.4
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/lib/index.d.ts +68 -67
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +234 -2
- package/lib/index.js.map +1 -1
- package/lib/typings.d.ts +3 -0
- package/package.json +3 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,67 +1,68 @@
|
|
|
1
|
-
import { StoreEnhancer } from 'redux';
|
|
2
|
-
import { parse, stringify } from 'flatted';
|
|
3
|
-
export interface Options {
|
|
4
|
-
undoType?: string;
|
|
5
|
-
redoType?: string;
|
|
6
|
-
restType?: string;
|
|
7
|
-
limit?: number;
|
|
8
|
-
strict?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface UndoableState {
|
|
11
|
-
state: {
|
|
12
|
-
[name: string]: any;
|
|
13
|
-
};
|
|
14
|
-
action: {
|
|
15
|
-
[name: string]: any;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export interface GlobalUndoableState {
|
|
19
|
-
past?: UndoableState[];
|
|
20
|
-
present?: UndoableState;
|
|
21
|
-
future?: UndoableState[];
|
|
22
|
-
}
|
|
23
|
-
export interface SaveStateSnapshotOfErrorReturn {
|
|
24
|
-
success: boolean;
|
|
25
|
-
message: string;
|
|
26
|
-
data: {
|
|
27
|
-
ID: string;
|
|
28
|
-
authId: string;
|
|
29
|
-
authName: string;
|
|
30
|
-
bi: string;
|
|
31
|
-
browser: string;
|
|
32
|
-
browserVersion: string;
|
|
33
|
-
deviceType: string;
|
|
34
|
-
eventAction: string;
|
|
35
|
-
eventCategory: string;
|
|
36
|
-
eventLabel: string;
|
|
37
|
-
eventValue: string;
|
|
38
|
-
host: string;
|
|
39
|
-
indexname: string;
|
|
40
|
-
intranetIp: string;
|
|
41
|
-
now: number;
|
|
42
|
-
os: string;
|
|
43
|
-
osName: string;
|
|
44
|
-
osVersion: string;
|
|
45
|
-
page: string;
|
|
46
|
-
pathname: string;
|
|
47
|
-
screen: string;
|
|
48
|
-
sessionId: string;
|
|
49
|
-
ua: string;
|
|
50
|
-
userName: string;
|
|
51
|
-
value: string;
|
|
52
|
-
visitId: string;
|
|
53
|
-
visitorId: string;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export declare function stash(title?: string): Promise<SaveStateSnapshotOfErrorReturn>;
|
|
57
|
-
export declare function saveOfError(title?: string): Promise<SaveStateSnapshotOfErrorReturn>;
|
|
58
|
-
export declare function undo(): {
|
|
59
|
-
type: string;
|
|
60
|
-
};
|
|
61
|
-
export declare function redo(): {
|
|
62
|
-
type: string;
|
|
63
|
-
};
|
|
64
|
-
export declare function rest<S>(payload: S): void;
|
|
65
|
-
export declare function undoable<T extends Function>(reducer: T, optons?: Options): (state: any, action: any) => any;
|
|
66
|
-
export declare function createUndoableEnhancer(optons?: Options): StoreEnhancer;
|
|
67
|
-
export { parse, stringify };
|
|
1
|
+
import { StoreEnhancer } from 'redux';
|
|
2
|
+
import { parse, stringify } from 'flatted';
|
|
3
|
+
export interface Options {
|
|
4
|
+
undoType?: string;
|
|
5
|
+
redoType?: string;
|
|
6
|
+
restType?: string;
|
|
7
|
+
limit?: number;
|
|
8
|
+
strict?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface UndoableState {
|
|
11
|
+
state: {
|
|
12
|
+
[name: string]: any;
|
|
13
|
+
};
|
|
14
|
+
action: {
|
|
15
|
+
[name: string]: any;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface GlobalUndoableState {
|
|
19
|
+
past?: UndoableState[];
|
|
20
|
+
present?: UndoableState;
|
|
21
|
+
future?: UndoableState[];
|
|
22
|
+
}
|
|
23
|
+
export interface SaveStateSnapshotOfErrorReturn {
|
|
24
|
+
success: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
data: {
|
|
27
|
+
ID: string;
|
|
28
|
+
authId: string;
|
|
29
|
+
authName: string;
|
|
30
|
+
bi: string;
|
|
31
|
+
browser: string;
|
|
32
|
+
browserVersion: string;
|
|
33
|
+
deviceType: string;
|
|
34
|
+
eventAction: string;
|
|
35
|
+
eventCategory: string;
|
|
36
|
+
eventLabel: string;
|
|
37
|
+
eventValue: string;
|
|
38
|
+
host: string;
|
|
39
|
+
indexname: string;
|
|
40
|
+
intranetIp: string;
|
|
41
|
+
now: number;
|
|
42
|
+
os: string;
|
|
43
|
+
osName: string;
|
|
44
|
+
osVersion: string;
|
|
45
|
+
page: string;
|
|
46
|
+
pathname: string;
|
|
47
|
+
screen: string;
|
|
48
|
+
sessionId: string;
|
|
49
|
+
ua: string;
|
|
50
|
+
userName: string;
|
|
51
|
+
value: string;
|
|
52
|
+
visitId: string;
|
|
53
|
+
visitorId: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export declare function stash(title?: string): Promise<SaveStateSnapshotOfErrorReturn>;
|
|
57
|
+
export declare function saveOfError(title?: string): Promise<SaveStateSnapshotOfErrorReturn>;
|
|
58
|
+
export declare function undo(): {
|
|
59
|
+
type: string;
|
|
60
|
+
};
|
|
61
|
+
export declare function redo(): {
|
|
62
|
+
type: string;
|
|
63
|
+
};
|
|
64
|
+
export declare function rest<S>(payload: S): void;
|
|
65
|
+
export declare function undoable<T extends Function>(reducer: T, optons?: Options): (state: any, action: any) => any;
|
|
66
|
+
export declare function createUndoableEnhancer(optons?: Options): StoreEnhancer;
|
|
67
|
+
export { parse, stringify };
|
|
68
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CA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ClB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAcD,wBAAsB,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAanF;AAED,wBAAsB,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAczF;AAED,wBAAgB,IAAI;;EAEnB;AAED,wBAAgB,IAAI;;EAEnB;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,QAEjC;AAiDD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,oCAwDxE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,CAUtE;AAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,234 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/regeneratorRuntime";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
+
import { parse, stringify } from 'flatted';
|
|
5
|
+
var cacheOptions = {};
|
|
6
|
+
var globalUndoableState = undefined;
|
|
7
|
+
var reduxStore = undefined;
|
|
8
|
+
var UNDO_TYPE = 'UNDO';
|
|
9
|
+
var REDO_TYPE = 'REDO';
|
|
10
|
+
var REST_TYPE = 'REST';
|
|
11
|
+
function processingTitle(title) {
|
|
12
|
+
return typeof title === 'string' ? title : '';
|
|
13
|
+
}
|
|
14
|
+
export function stash(_x) {
|
|
15
|
+
return _stash.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
function _stash() {
|
|
18
|
+
_stash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(title) {
|
|
19
|
+
var _window, _window$sheinqPluginC;
|
|
20
|
+
var state, res;
|
|
21
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
state = globalUndoableState.present.state;
|
|
25
|
+
_context.next = 3;
|
|
26
|
+
return (_window = window) === null || _window === void 0 ? void 0 : (_window$sheinqPluginC = _window.sheinqPluginCall) === null || _window$sheinqPluginC === void 0 ? void 0 : _window$sheinqPluginC.call(_window, 'snapshot', {
|
|
27
|
+
eventCategory: 'snapshot',
|
|
28
|
+
eventAction: '',
|
|
29
|
+
// action type name
|
|
30
|
+
eventLabel: JSON.stringify({}),
|
|
31
|
+
// meta data json
|
|
32
|
+
eventValue: stringify(state),
|
|
33
|
+
// redux data json
|
|
34
|
+
eventObj: {
|
|
35
|
+
type: 'STASH',
|
|
36
|
+
title: processingTitle(title)
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
case 3:
|
|
40
|
+
res = _context.sent;
|
|
41
|
+
return _context.abrupt("return", res);
|
|
42
|
+
case 5:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
return _stash.apply(this, arguments);
|
|
49
|
+
}
|
|
50
|
+
export function saveOfError(_x2) {
|
|
51
|
+
return _saveOfError.apply(this, arguments);
|
|
52
|
+
}
|
|
53
|
+
function _saveOfError() {
|
|
54
|
+
_saveOfError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(title) {
|
|
55
|
+
var _window2, _window2$sheinqPlugin;
|
|
56
|
+
var preState, currAction, res;
|
|
57
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
58
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
preState = globalUndoableState.past[globalUndoableState.past.length - 1].state;
|
|
61
|
+
currAction = globalUndoableState.present.action;
|
|
62
|
+
_context2.next = 4;
|
|
63
|
+
return (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$sheinqPlugin = _window2.sheinqPluginCall) === null || _window2$sheinqPlugin === void 0 ? void 0 : _window2$sheinqPlugin.call(_window2, 'snapshot', {
|
|
64
|
+
eventCategory: 'snapshot',
|
|
65
|
+
eventAction: currAction.type,
|
|
66
|
+
// action type name
|
|
67
|
+
eventLabel: stringify(currAction),
|
|
68
|
+
// meta data json
|
|
69
|
+
eventValue: stringify(preState),
|
|
70
|
+
// redux data json
|
|
71
|
+
eventObj: {
|
|
72
|
+
type: 'ERROR',
|
|
73
|
+
title: processingTitle(title)
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
case 4:
|
|
77
|
+
res = _context2.sent;
|
|
78
|
+
return _context2.abrupt("return", res);
|
|
79
|
+
case 6:
|
|
80
|
+
case "end":
|
|
81
|
+
return _context2.stop();
|
|
82
|
+
}
|
|
83
|
+
}, _callee2);
|
|
84
|
+
}));
|
|
85
|
+
return _saveOfError.apply(this, arguments);
|
|
86
|
+
}
|
|
87
|
+
export function undo() {
|
|
88
|
+
var _cacheOptions$undoTyp, _cacheOptions;
|
|
89
|
+
return reduxStore.dispatch({
|
|
90
|
+
type: (_cacheOptions$undoTyp = (_cacheOptions = cacheOptions) === null || _cacheOptions === void 0 ? void 0 : _cacheOptions.undoType) !== null && _cacheOptions$undoTyp !== void 0 ? _cacheOptions$undoTyp : UNDO_TYPE
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function redo() {
|
|
94
|
+
var _cacheOptions$redoTyp, _cacheOptions2;
|
|
95
|
+
return reduxStore.dispatch({
|
|
96
|
+
type: (_cacheOptions$redoTyp = (_cacheOptions2 = cacheOptions) === null || _cacheOptions2 === void 0 ? void 0 : _cacheOptions2.redoType) !== null && _cacheOptions$redoTyp !== void 0 ? _cacheOptions$redoTyp : REDO_TYPE
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export function rest(payload) {
|
|
100
|
+
reduxStore.dispatch({
|
|
101
|
+
type: REST_TYPE,
|
|
102
|
+
payload
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function createNextByUndo() {
|
|
106
|
+
var _globalUndoableState = globalUndoableState,
|
|
107
|
+
past = _globalUndoableState.past,
|
|
108
|
+
present = _globalUndoableState.present,
|
|
109
|
+
future = _globalUndoableState.future;
|
|
110
|
+
var previous = past[past.length - 1];
|
|
111
|
+
var newPast = past.slice(0, past.length - 1);
|
|
112
|
+
return {
|
|
113
|
+
past: newPast,
|
|
114
|
+
present: previous,
|
|
115
|
+
future: [present, ...future]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function createNextByRedo() {
|
|
119
|
+
var _globalUndoableState2 = globalUndoableState,
|
|
120
|
+
past = _globalUndoableState2.past,
|
|
121
|
+
present = _globalUndoableState2.present,
|
|
122
|
+
future = _globalUndoableState2.future;
|
|
123
|
+
var next = future[0];
|
|
124
|
+
var newFuture = future.slice(1);
|
|
125
|
+
return {
|
|
126
|
+
past: [...past, present],
|
|
127
|
+
present: next,
|
|
128
|
+
future: newFuture
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function createNextByCurrent(nextState, action) {
|
|
132
|
+
var _cacheOptions$limit, _cacheOptions3;
|
|
133
|
+
var _globalUndoableState3 = globalUndoableState,
|
|
134
|
+
past = _globalUndoableState3.past,
|
|
135
|
+
present = _globalUndoableState3.present;
|
|
136
|
+
var pastState = past.length === ((_cacheOptions$limit = (_cacheOptions3 = cacheOptions) === null || _cacheOptions3 === void 0 ? void 0 : _cacheOptions3.limit) !== null && _cacheOptions$limit !== void 0 ? _cacheOptions$limit : 1) ? past.slice(1, past.length) : past;
|
|
137
|
+
return {
|
|
138
|
+
past: [...pastState, present],
|
|
139
|
+
present: {
|
|
140
|
+
state: nextState,
|
|
141
|
+
action
|
|
142
|
+
},
|
|
143
|
+
future: []
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function nextUndoableState(type, nextState, action) {
|
|
147
|
+
switch (type) {
|
|
148
|
+
case UNDO_TYPE:
|
|
149
|
+
return createNextByUndo();
|
|
150
|
+
case REDO_TYPE:
|
|
151
|
+
return createNextByRedo();
|
|
152
|
+
default:
|
|
153
|
+
return createNextByCurrent(nextState, action);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export function undoable(reducer, optons) {
|
|
157
|
+
// 以一个空的 action 调用 reducer 来产生初始的 state
|
|
158
|
+
|
|
159
|
+
cacheOptions = optons;
|
|
160
|
+
var domainState = reducer(undefined, {});
|
|
161
|
+
var initialState = domainState;
|
|
162
|
+
if (globalUndoableState === undefined) {
|
|
163
|
+
globalUndoableState = {
|
|
164
|
+
past: [],
|
|
165
|
+
present: {
|
|
166
|
+
state: domainState,
|
|
167
|
+
action: {}
|
|
168
|
+
},
|
|
169
|
+
future: []
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// 返回一个可以执行撤销和重做的新的reducer
|
|
174
|
+
return function nextReducer() {
|
|
175
|
+
var _cacheOptions$undoTyp2, _cacheOptions4, _cacheOptions$redoTyp2, _cacheOptions5, _cacheOptions$restTyp, _cacheOptions6;
|
|
176
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
177
|
+
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
178
|
+
var _globalUndoableState4 = globalUndoableState,
|
|
179
|
+
past = _globalUndoableState4.past,
|
|
180
|
+
present = _globalUndoableState4.present,
|
|
181
|
+
future = _globalUndoableState4.future;
|
|
182
|
+
var noStep = array => array.length === 0;
|
|
183
|
+
switch (action.type) {
|
|
184
|
+
case `${(_cacheOptions$undoTyp2 = (_cacheOptions4 = cacheOptions) === null || _cacheOptions4 === void 0 ? void 0 : _cacheOptions4.undoType) !== null && _cacheOptions$undoTyp2 !== void 0 ? _cacheOptions$undoTyp2 : UNDO_TYPE}`:
|
|
185
|
+
{
|
|
186
|
+
if (noStep(past)) return state;
|
|
187
|
+
var previous = past[past.length - 1];
|
|
188
|
+
globalUndoableState = nextUndoableState(UNDO_TYPE);
|
|
189
|
+
return previous.state;
|
|
190
|
+
}
|
|
191
|
+
case `${(_cacheOptions$redoTyp2 = (_cacheOptions5 = cacheOptions) === null || _cacheOptions5 === void 0 ? void 0 : _cacheOptions5.redoType) !== null && _cacheOptions$redoTyp2 !== void 0 ? _cacheOptions$redoTyp2 : REDO_TYPE}`:
|
|
192
|
+
{
|
|
193
|
+
if (noStep(future)) return state;
|
|
194
|
+
var next = future[0];
|
|
195
|
+
globalUndoableState = nextUndoableState(REDO_TYPE);
|
|
196
|
+
return next.state;
|
|
197
|
+
}
|
|
198
|
+
case `${(_cacheOptions$restTyp = (_cacheOptions6 = cacheOptions) === null || _cacheOptions6 === void 0 ? void 0 : _cacheOptions6.restType) !== null && _cacheOptions$restTyp !== void 0 ? _cacheOptions$restTyp : REST_TYPE}`:
|
|
199
|
+
{
|
|
200
|
+
globalUndoableState = {
|
|
201
|
+
past: [],
|
|
202
|
+
present: {
|
|
203
|
+
state: action.payload,
|
|
204
|
+
action: {}
|
|
205
|
+
},
|
|
206
|
+
future: []
|
|
207
|
+
};
|
|
208
|
+
return _objectSpread(_objectSpread({}, state), action.payload);
|
|
209
|
+
}
|
|
210
|
+
default:
|
|
211
|
+
{
|
|
212
|
+
// 将其他 action 委托给原始的 reducer 处理
|
|
213
|
+
var newPresent = reducer(present.state, action);
|
|
214
|
+
globalUndoableState = nextUndoableState('', newPresent, action);
|
|
215
|
+
if (present.state === newPresent) {
|
|
216
|
+
return state;
|
|
217
|
+
}
|
|
218
|
+
return newPresent;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export function createUndoableEnhancer(optons) {
|
|
224
|
+
return function undoableEnhancer(createStore) {
|
|
225
|
+
return function (reducer, initialState, enhancer) {
|
|
226
|
+
reduxStore = createStore(undoable(reducer, optons), initialState, enhancer);
|
|
227
|
+
return _objectSpread(_objectSpread({}, reduxStore), {}, {
|
|
228
|
+
replaceReducer: _ => reduxStore.replaceReducer(undoable(_))
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
export { parse, stringify };
|
|
234
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { Store, StoreEnhancer } from 'redux';\nimport { parse, stringify } from 'flatted';\n\nexport interface Options {\n undoType?: string;\n redoType?: string;\n restType?: string;\n limit?: number;\n strict?: boolean;\n}\n\nexport interface UndoableState {\n state: {\n [name: string]: any;\n };\n action: {\n [name: string]: any;\n };\n}\n\nexport interface GlobalUndoableState {\n past?: UndoableState[];\n present?: UndoableState;\n future?: UndoableState[];\n}\n\nexport interface SaveStateSnapshotOfErrorReturn {\n success: boolean;\n message: string;\n data: {\n ID: string;\n authId: string;\n authName: string;\n bi: string;\n browser: string;\n browserVersion: string;\n deviceType: string;\n eventAction: string;\n eventCategory: string;\n eventLabel: string;\n eventValue: string;\n host: string;\n indexname: string;\n intranetIp: string;\n now: number;\n os: string;\n osName: string;\n osVersion: string;\n page: string;\n pathname: string;\n screen: string;\n sessionId: string;\n ua: string;\n userName: string;\n value: string;\n visitId: string;\n visitorId: string;\n };\n}\n\nlet cacheOptions: Options = {};\nlet globalUndoableState: GlobalUndoableState = undefined;\nlet reduxStore: Store = undefined;\n\nconst UNDO_TYPE = 'UNDO';\nconst REDO_TYPE = 'REDO';\nconst REST_TYPE = 'REST';\n\nfunction processingTitle(title?: string) {\n return typeof title === 'string' ? title : '';\n}\n\nexport async function stash(title?: string): Promise<SaveStateSnapshotOfErrorReturn> {\n const state = globalUndoableState.present.state;\n const res = await window?.sheinqPluginCall?.('snapshot', {\n eventCategory: 'snapshot',\n eventAction: '', // action type name\n eventLabel: JSON.stringify({}), // meta data json\n eventValue: stringify(state), // redux data json\n eventObj: {\n type: 'STASH',\n title: processingTitle(title),\n },\n });\n return res;\n}\n\nexport async function saveOfError(title?: string): Promise<SaveStateSnapshotOfErrorReturn> {\n const preState = globalUndoableState.past[globalUndoableState.past.length - 1].state;\n const currAction = globalUndoableState.present.action;\n const res = await window?.sheinqPluginCall?.('snapshot', {\n eventCategory: 'snapshot',\n eventAction: currAction.type, // action type name\n eventLabel: stringify(currAction), // meta data json\n eventValue: stringify(preState), // redux data json\n eventObj: {\n type: 'ERROR',\n title: processingTitle(title),\n },\n });\n return res;\n}\n\nexport function undo() {\n return reduxStore.dispatch({ type: cacheOptions?.undoType ?? UNDO_TYPE });\n}\n\nexport function redo() {\n return reduxStore.dispatch({ type: cacheOptions?.redoType ?? REDO_TYPE });\n}\n\nexport function rest<S>(payload: S) {\n reduxStore.dispatch({ type: REST_TYPE, payload });\n}\n\nfunction createNextByUndo() {\n const { past, present, future } = globalUndoableState;\n const previous = past[past.length - 1];\n const newPast = past.slice(0, past.length - 1);\n\n return {\n past: newPast,\n present: previous,\n future: [present, ...future],\n };\n}\n\nfunction createNextByRedo() {\n const { past, present, future } = globalUndoableState;\n const next = future[0];\n const newFuture = future.slice(1);\n return {\n past: [...past, present],\n present: next,\n future: newFuture,\n };\n}\n\nfunction createNextByCurrent(nextState, action) {\n const { past, present } = globalUndoableState;\n const pastState = past.length === (cacheOptions?.limit ?? 1) ? past.slice(1, past.length) : past;\n return {\n past: [...pastState, present],\n present: {\n state: nextState,\n action,\n },\n future: [],\n };\n}\n\nfunction nextUndoableState(type: string, nextState?: any, action?: any) {\n switch (type) {\n case UNDO_TYPE:\n return createNextByUndo();\n case REDO_TYPE:\n return createNextByRedo();\n default:\n return createNextByCurrent(nextState, action);\n }\n}\n\nexport function undoable<T extends Function>(reducer: T, optons?: Options) {\n // 以一个空的 action 调用 reducer 来产生初始的 state\n\n cacheOptions = optons;\n\n const domainState = reducer(undefined, {});\n const initialState = domainState;\n if (globalUndoableState === undefined) {\n globalUndoableState = {\n past: [],\n present: { state: domainState, action: {} },\n future: [],\n };\n }\n\n // 返回一个可以执行撤销和重做的新的reducer\n return function nextReducer(state = initialState, action) {\n const { past, present, future } = globalUndoableState;\n\n const noStep = array => array.length === 0;\n\n switch (action.type) {\n case `${cacheOptions?.undoType ?? UNDO_TYPE}`: {\n if (noStep(past)) return state;\n const previous = past[past.length - 1];\n globalUndoableState = nextUndoableState(UNDO_TYPE);\n return previous.state;\n }\n case `${cacheOptions?.redoType ?? REDO_TYPE}`: {\n if (noStep(future)) return state;\n const next = future[0];\n globalUndoableState = nextUndoableState(REDO_TYPE);\n return next.state;\n }\n\n case `${cacheOptions?.restType ?? REST_TYPE}`: {\n globalUndoableState = {\n past: [],\n present: { state: action.payload, action: {} },\n future: [],\n };\n return { ...state, ...action.payload };\n }\n\n default: {\n // 将其他 action 委托给原始的 reducer 处理\n const newPresent = reducer(present.state, action);\n globalUndoableState = nextUndoableState('', newPresent, action);\n\n if (present.state === newPresent) {\n return state;\n }\n return newPresent;\n }\n }\n };\n}\n\nexport function createUndoableEnhancer(optons?: Options): StoreEnhancer {\n return function undoableEnhancer(createStore) {\n return function(reducer, initialState, enhancer) {\n reduxStore = createStore(undoable(reducer, optons), initialState, enhancer);\n return {\n ...reduxStore,\n replaceReducer: _ => reduxStore.replaceReducer(undoable(_)),\n };\n };\n } as any;\n}\n\nexport { parse, stringify };\n"],"names":["cacheOptions","globalUndoableState","undefined","reduxStore","processingTitle","title","stash","state","present","window","sheinqPluginCall","eventCategory","eventAction","eventLabel","JSON","stringify","eventValue","eventObj","type","_b","saveOfError","preState","past","length","currAction","action","undo","dispatch","undoType","redo","redoType","rest","payload","nextUndoableState","nextState","future","previous","slice","next","newFuture","createNextByRedo","pastState","limit","createNextByCurrent","undoable","reducer","optons","domainState","initialState","noStep","array","restType","newPresent","createUndoableEnhancer","createStore","enhancer","replaceReducer","_"],"mappings":"8JA4DA,IAAIA,EAAwB,GACxBC,OAA2CC,EAC3CC,OAAoBD,EAMxB,SAASE,EAAgBC,GACvB,MAAwB,iBAAVA,EAAqBA,EAAQ,YAGvBC,EAAMD,yGAEd,OADNE,EAAQN,EAAoBO,QAAQD,0BACxBE,iBAAAA,cAAAA,OAAQC,4CAARD,OAA2B,WAAY,CACvDE,cAAe,WACfC,YAAa,GACbC,WAAYC,KAAKC,UAAU,IAC3BC,WAAYD,EAAUR,GACtBU,SAAU,CACRC,KAAM,QACNb,MAAOD,EAAgBC,cAG3B,SAVYc,0BAaQC,EAAYf,2GAGpB,OAFNgB,EAAWpB,EAAoBqB,KAAKrB,EAAoBqB,KAAKC,OAAS,GAAGhB,MACzEiB,EAAavB,EAAoBO,QAAQiB,2BAC7BhB,iBAAAA,cAAAA,OAAQC,4CAARD,OAA2B,WAAY,CACvDE,cAAe,WACfC,YAAaY,EAAWN,KACxBL,WAAYE,EAAUS,GACtBR,WAAYD,EAAUM,GACtBJ,SAAU,CACRC,KAAM,QACNb,MAAOD,EAAgBC,cAG3B,SAVYc,0BAaEO,UACd,OAAOvB,EAAWwB,SAAS,CAAET,eAAMlB,MAAAA,SAAAA,EAAc4B,wBAxCjC,kBA2CFC,UACd,OAAO1B,EAAWwB,SAAS,CAAET,eAAMlB,MAAAA,SAAAA,EAAc8B,wBA3CjC,kBA8CFC,EAAQC,GACtB7B,EAAWwB,SAAS,CAAET,KA9CN,OA8CuBc,YAuCzC,SAASC,EAAkBf,EAAcgB,EAAiBT,GACxD,OAAQP,GACN,IAzFc,OA0FZ,OAtCII,EAA0BrB,OAApBO,EAAoBP,UAAXkC,EAAWlC,SAC5BmC,EAAWd,EAAKA,EAAKC,OAAS,GAG7B,CACLD,KAHcA,EAAKe,MAAM,EAAGf,EAAKC,OAAS,GAI1Cf,QAAS4B,EACTD,UAAS3B,GA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HK,EAAK/B,MAGd,IAAK,cAAGP,MAAAA,SAAAA,EAAcmD,wBAnIV,QAyIV,OALAlD,EAAsB,CACpBqB,KAAM,GACNd,QAAS,CAAED,MAAOkB,EAAOO,QAASP,OAAQ,IAC1CU,OAAQ,WAEE5B,GAAUkB,EAAOO,SAG/B,QAEE,IAAMoB,EAAaP,EAAQrC,EAAQD,MAAOkB,GAG1C,OAFAxB,EAAsBgC,EAAkB,GAAImB,EAAY3B,GAEpDjB,EAAQD,QAAU6C,EACb7C,EAEF6C,aAMCC,EAAuBP,GACrC,OAAO,SAA0BQ,GAC/B,OAAO,SAAST,EAASG,EAAcO,GAErC,OADApD,EAAamD,EAAYV,EAASC,EAASC,GAASE,EAAcO,UAE7DpD,IACHqD,eAAgB,SAAAC,GAAK,OAAAtD,EAAWqD,eAAeZ,EAASa"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["parse","stringify","cacheOptions","globalUndoableState","undefined","reduxStore","UNDO_TYPE","REDO_TYPE","REST_TYPE","processingTitle","title","stash","_x","_stash","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_window","_window$sheinqPluginC","state","res","wrap","_callee$","_context","prev","next","present","window","sheinqPluginCall","call","eventCategory","eventAction","eventLabel","JSON","eventValue","eventObj","type","sent","abrupt","stop","saveOfError","_x2","_saveOfError","_callee2","_window2","_window2$sheinqPlugin","preState","currAction","_callee2$","_context2","past","length","action","undo","_cacheOptions$undoTyp","_cacheOptions","dispatch","undoType","redo","_cacheOptions$redoTyp","_cacheOptions2","redoType","rest","payload","createNextByUndo","_globalUndoableState","future","previous","newPast","slice","createNextByRedo","_globalUndoableState2","newFuture","createNextByCurrent","nextState","_cacheOptions$limit","_cacheOptions3","_globalUndoableState3","pastState","limit","nextUndoableState","undoable","reducer","optons","domainState","initialState","nextReducer","_cacheOptions$undoTyp2","_cacheOptions4","_cacheOptions$redoTyp2","_cacheOptions5","_cacheOptions$restTyp","_cacheOptions6","_globalUndoableState4","noStep","array","restType","_objectSpread","newPresent","createUndoableEnhancer","undoableEnhancer","createStore","enhancer","replaceReducer","_"],"sources":["../index.ts"],"sourcesContent":["import { Store, StoreEnhancer } from 'redux';\nimport { parse, stringify } from 'flatted';\n\nexport interface Options {\n undoType?: string;\n redoType?: string;\n restType?: string;\n limit?: number;\n strict?: boolean;\n}\n\nexport interface UndoableState {\n state: {\n [name: string]: any;\n };\n action: {\n [name: string]: any;\n };\n}\n\nexport interface GlobalUndoableState {\n past?: UndoableState[];\n present?: UndoableState;\n future?: UndoableState[];\n}\n\nexport interface SaveStateSnapshotOfErrorReturn {\n success: boolean;\n message: string;\n data: {\n ID: string;\n authId: string;\n authName: string;\n bi: string;\n browser: string;\n browserVersion: string;\n deviceType: string;\n eventAction: string;\n eventCategory: string;\n eventLabel: string;\n eventValue: string;\n host: string;\n indexname: string;\n intranetIp: string;\n now: number;\n os: string;\n osName: string;\n osVersion: string;\n page: string;\n pathname: string;\n screen: string;\n sessionId: string;\n ua: string;\n userName: string;\n value: string;\n visitId: string;\n visitorId: string;\n };\n}\n\nlet cacheOptions: Options = {};\nlet globalUndoableState: GlobalUndoableState = undefined;\nlet reduxStore: Store = undefined;\n\nconst UNDO_TYPE = 'UNDO';\nconst REDO_TYPE = 'REDO';\nconst REST_TYPE = 'REST';\n\nfunction processingTitle(title?: string) {\n return typeof title === 'string' ? title : '';\n}\n\nexport async function stash(title?: string): Promise<SaveStateSnapshotOfErrorReturn> {\n const state = globalUndoableState.present.state;\n const res = await window?.sheinqPluginCall?.('snapshot', {\n eventCategory: 'snapshot',\n eventAction: '', // action type name\n eventLabel: JSON.stringify({}), // meta data json\n eventValue: stringify(state), // redux data json\n eventObj: {\n type: 'STASH',\n title: processingTitle(title),\n },\n });\n return res;\n}\n\nexport async function saveOfError(title?: string): Promise<SaveStateSnapshotOfErrorReturn> {\n const preState = globalUndoableState.past[globalUndoableState.past.length - 1].state;\n const currAction = globalUndoableState.present.action;\n const res = await window?.sheinqPluginCall?.('snapshot', {\n eventCategory: 'snapshot',\n eventAction: currAction.type, // action type name\n eventLabel: stringify(currAction), // meta data json\n eventValue: stringify(preState), // redux data json\n eventObj: {\n type: 'ERROR',\n title: processingTitle(title),\n },\n });\n return res;\n}\n\nexport function undo() {\n return reduxStore.dispatch({ type: cacheOptions?.undoType ?? UNDO_TYPE });\n}\n\nexport function redo() {\n return reduxStore.dispatch({ type: cacheOptions?.redoType ?? REDO_TYPE });\n}\n\nexport function rest<S>(payload: S) {\n reduxStore.dispatch({ type: REST_TYPE, payload });\n}\n\nfunction createNextByUndo() {\n const { past, present, future } = globalUndoableState;\n const previous = past[past.length - 1];\n const newPast = past.slice(0, past.length - 1);\n\n return {\n past: newPast,\n present: previous,\n future: [present, ...future],\n };\n}\n\nfunction createNextByRedo() {\n const { past, present, future } = globalUndoableState;\n const next = future[0];\n const newFuture = future.slice(1);\n return {\n past: [...past, present],\n present: next,\n future: newFuture,\n };\n}\n\nfunction createNextByCurrent(nextState, action) {\n const { past, present } = globalUndoableState;\n const pastState = past.length === (cacheOptions?.limit ?? 1) ? past.slice(1, past.length) : past;\n return {\n past: [...pastState, present],\n present: {\n state: nextState,\n action,\n },\n future: [],\n };\n}\n\nfunction nextUndoableState(type: string, nextState?: any, action?: any) {\n switch (type) {\n case UNDO_TYPE:\n return createNextByUndo();\n case REDO_TYPE:\n return createNextByRedo();\n default:\n return createNextByCurrent(nextState, action);\n }\n}\n\nexport function undoable<T extends Function>(reducer: T, optons?: Options) {\n // 以一个空的 action 调用 reducer 来产生初始的 state\n\n cacheOptions = optons;\n\n const domainState = reducer(undefined, {});\n const initialState = domainState;\n if (globalUndoableState === undefined) {\n globalUndoableState = {\n past: [],\n present: { state: domainState, action: {} },\n future: [],\n };\n }\n\n // 返回一个可以执行撤销和重做的新的reducer\n return function nextReducer(state = initialState, action) {\n const { past, present, future } = globalUndoableState;\n\n const noStep = array => array.length === 0;\n\n switch (action.type) {\n case `${cacheOptions?.undoType ?? UNDO_TYPE}`: {\n if (noStep(past)) return state;\n const previous = past[past.length - 1];\n globalUndoableState = nextUndoableState(UNDO_TYPE);\n return previous.state;\n }\n case `${cacheOptions?.redoType ?? REDO_TYPE}`: {\n if (noStep(future)) return state;\n const next = future[0];\n globalUndoableState = nextUndoableState(REDO_TYPE);\n return next.state;\n }\n\n case `${cacheOptions?.restType ?? REST_TYPE}`: {\n globalUndoableState = {\n past: [],\n present: { state: action.payload, action: {} },\n future: [],\n };\n return { ...state, ...action.payload };\n }\n\n default: {\n // 将其他 action 委托给原始的 reducer 处理\n const newPresent = reducer(present.state, action);\n globalUndoableState = nextUndoableState('', newPresent, action);\n\n if (present.state === newPresent) {\n return state;\n }\n return newPresent;\n }\n }\n };\n}\n\nexport function createUndoableEnhancer(optons?: Options): StoreEnhancer {\n return function undoableEnhancer(createStore) {\n return function(reducer, initialState, enhancer) {\n reduxStore = createStore(undoable(reducer, optons), initialState, enhancer);\n return {\n ...reduxStore,\n replaceReducer: _ => reduxStore.replaceReducer(undoable(_)),\n };\n };\n } as any;\n}\n\nexport { parse, stringify };\n"],"mappings":";;;AACA,SAASA,KAAK,EAAEC,SAAS,QAAQ,SAAS;AA2D1C,IAAIC,YAAqB,GAAG,CAAC,CAAC;AAC9B,IAAIC,mBAAwC,GAAGC,SAAS;AACxD,IAAIC,UAAiB,GAAGD,SAAS;AAEjC,IAAME,SAAS,GAAG,MAAM;AACxB,IAAMC,SAAS,GAAG,MAAM;AACxB,IAAMC,SAAS,GAAG,MAAM;AAExB,SAASC,eAAeA,CAACC,KAAc,EAAE;EACvC,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,EAAE;AAC/C;AAEA,gBAAsBC,KAAKA,CAAAC,EAAA;EAAA,OAAAC,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAa1B,SAAAF,OAAA;EAAAA,MAAA,GAAAG,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAbM,SAAAC,QAAqBT,KAAc;IAAA,IAAAU,OAAA,EAAAC,q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C5C,OAAO,UAASnB,OAAO,EAAEG,YAAY,EAAEiB,QAAQ,EAAE;MAC/CpG,UAAU,GAAGmG,WAAW,CAACpB,QAAQ,CAACC,OAAO,EAAEC,MAAM,CAAC,EAAEE,YAAY,EAAEiB,QAAQ,CAAC;MAC3E,OAAAL,aAAA,CAAAA,aAAA,KACK/F,UAAU;QACbqG,cAAc,EAAEC,CAAC,IAAItG,UAAU,CAACqG,cAAc,CAACtB,QAAQ,CAACuB,CAAC,CAAC;MAAC;IAE/D,CAAC;EACH,CAAC;AACH;AAEA,SAAS3G,KAAK,EAAEC,SAAS"}
|
package/lib/typings.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lcd-undobale",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.4",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "10015448 <519495771@qq.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
"redux": "^4.0.1"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@babel/runtime": "7.20.0",
|
|
28
29
|
"flatted": "3.0.1",
|
|
29
30
|
"tslib": "^2.3.0"
|
|
30
31
|
},
|
|
31
32
|
"gitHead": "f34305f0d8a335e0953d3a5df8a32a8d5507a6f0",
|
|
32
33
|
"scripts": {
|
|
33
|
-
"build": "
|
|
34
|
+
"build": "lecp",
|
|
34
35
|
"test": "jest",
|
|
35
36
|
"test:w": "jest --watch"
|
|
36
37
|
}
|