redux-astroglide 0.1.10 → 0.1.11
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/README.md +1 -1
- package/dist/index.es.js +11 -6
- package/dist/index.js +11 -6
- package/dist/index.umd.js +11 -6
- package/dist/plugins/index.es.js +33 -409
- package/dist/plugins/index.js +33 -409
- package/dist/plugins/index.umd.js +33 -409
- package/dist/plugins/persist/index.es.js +33 -410
- package/dist/plugins/persist/index.js +33 -410
- package/dist/plugins/persist/index.umd.js +33 -410
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -239,7 +239,7 @@ const slice = createSlice("Login", {
|
|
|
239
239
|
// Nav/slice.js
|
|
240
240
|
const slice = createSlice("Nav", {
|
|
241
241
|
isOpen: persist("", {
|
|
242
|
-
storageType: localStorage, // default localStorage, must
|
|
242
|
+
storageType: localStorage, // default localStorage, must provide { getItem(key):any, setItem(key, value):void } API (async not allowed)
|
|
243
243
|
}),
|
|
244
244
|
clickCount: set((value) => value + 1),
|
|
245
245
|
});
|
package/dist/index.es.js
CHANGED
|
@@ -3644,6 +3644,9 @@ var configure$1 = function configure(store) {
|
|
|
3644
3644
|
}
|
|
3645
3645
|
return (_slice$actions = slice.actions)[actionName].apply(_slice$actions, _toConsumableArray(params));
|
|
3646
3646
|
};
|
|
3647
|
+
updateAction.toString = function () {
|
|
3648
|
+
return slice.actions[actionName].toString();
|
|
3649
|
+
};
|
|
3647
3650
|
if (!updateAction) {
|
|
3648
3651
|
throw Error("Action ".concat(slice.name, "/").concat(actionName, " not defined"));
|
|
3649
3652
|
}
|
|
@@ -3799,7 +3802,7 @@ var configure = function configure(_ref) {
|
|
|
3799
3802
|
};
|
|
3800
3803
|
findPlugin();
|
|
3801
3804
|
var activePlugins = [];
|
|
3802
|
-
while (foundIndex
|
|
3805
|
+
while (foundIndex != -1) {
|
|
3803
3806
|
activePlugins.push({
|
|
3804
3807
|
data: _objectSpread2({
|
|
3805
3808
|
sliceConfig: sliceConfig,
|
|
@@ -3817,14 +3820,16 @@ var configure = function configure(_ref) {
|
|
|
3817
3820
|
findPlugin();
|
|
3818
3821
|
}
|
|
3819
3822
|
var value = item;
|
|
3820
|
-
activePlugins.
|
|
3821
|
-
var
|
|
3822
|
-
|
|
3823
|
+
for (var _i = 0, _activePlugins = activePlugins; _i < _activePlugins.length; _i++) {
|
|
3824
|
+
var _activePlugins$_i = _activePlugins[_i],
|
|
3825
|
+
data = _activePlugins$_i.data,
|
|
3826
|
+
plugin = _activePlugins$_i.plugin;
|
|
3823
3827
|
value = plugin.getInitialValue(value, _objectSpread2({
|
|
3824
3828
|
config: plugin.config,
|
|
3825
|
-
plugin: plugin
|
|
3829
|
+
plugin: plugin,
|
|
3830
|
+
key: key
|
|
3826
3831
|
}, data));
|
|
3827
|
-
}
|
|
3832
|
+
}
|
|
3828
3833
|
sliceConfig.initialState[key] = value;
|
|
3829
3834
|
pluginData[key] = activePlugins;
|
|
3830
3835
|
});
|
package/dist/index.js
CHANGED
|
@@ -3648,6 +3648,9 @@ var configure$1 = function configure(store) {
|
|
|
3648
3648
|
}
|
|
3649
3649
|
return (_slice$actions = slice.actions)[actionName].apply(_slice$actions, _toConsumableArray(params));
|
|
3650
3650
|
};
|
|
3651
|
+
updateAction.toString = function () {
|
|
3652
|
+
return slice.actions[actionName].toString();
|
|
3653
|
+
};
|
|
3651
3654
|
if (!updateAction) {
|
|
3652
3655
|
throw Error("Action ".concat(slice.name, "/").concat(actionName, " not defined"));
|
|
3653
3656
|
}
|
|
@@ -3803,7 +3806,7 @@ var configure = function configure(_ref) {
|
|
|
3803
3806
|
};
|
|
3804
3807
|
findPlugin();
|
|
3805
3808
|
var activePlugins = [];
|
|
3806
|
-
while (foundIndex
|
|
3809
|
+
while (foundIndex != -1) {
|
|
3807
3810
|
activePlugins.push({
|
|
3808
3811
|
data: _objectSpread2({
|
|
3809
3812
|
sliceConfig: sliceConfig,
|
|
@@ -3821,14 +3824,16 @@ var configure = function configure(_ref) {
|
|
|
3821
3824
|
findPlugin();
|
|
3822
3825
|
}
|
|
3823
3826
|
var value = item;
|
|
3824
|
-
activePlugins.
|
|
3825
|
-
var
|
|
3826
|
-
|
|
3827
|
+
for (var _i = 0, _activePlugins = activePlugins; _i < _activePlugins.length; _i++) {
|
|
3828
|
+
var _activePlugins$_i = _activePlugins[_i],
|
|
3829
|
+
data = _activePlugins$_i.data,
|
|
3830
|
+
plugin = _activePlugins$_i.plugin;
|
|
3827
3831
|
value = plugin.getInitialValue(value, _objectSpread2({
|
|
3828
3832
|
config: plugin.config,
|
|
3829
|
-
plugin: plugin
|
|
3833
|
+
plugin: plugin,
|
|
3834
|
+
key: key
|
|
3830
3835
|
}, data));
|
|
3831
|
-
}
|
|
3836
|
+
}
|
|
3832
3837
|
sliceConfig.initialState[key] = value;
|
|
3833
3838
|
pluginData[key] = activePlugins;
|
|
3834
3839
|
});
|
package/dist/index.umd.js
CHANGED
|
@@ -5702,6 +5702,9 @@
|
|
|
5702
5702
|
}
|
|
5703
5703
|
return (_slice$actions = slice.actions)[actionName].apply(_slice$actions, _toConsumableArray(params));
|
|
5704
5704
|
};
|
|
5705
|
+
updateAction.toString = function () {
|
|
5706
|
+
return slice.actions[actionName].toString();
|
|
5707
|
+
};
|
|
5705
5708
|
if (!updateAction) {
|
|
5706
5709
|
throw Error("Action ".concat(slice.name, "/").concat(actionName, " not defined"));
|
|
5707
5710
|
}
|
|
@@ -5857,7 +5860,7 @@
|
|
|
5857
5860
|
};
|
|
5858
5861
|
findPlugin();
|
|
5859
5862
|
var activePlugins = [];
|
|
5860
|
-
while (foundIndex
|
|
5863
|
+
while (foundIndex != -1) {
|
|
5861
5864
|
activePlugins.push({
|
|
5862
5865
|
data: _objectSpread2$1({
|
|
5863
5866
|
sliceConfig: sliceConfig,
|
|
@@ -5875,14 +5878,16 @@
|
|
|
5875
5878
|
findPlugin();
|
|
5876
5879
|
}
|
|
5877
5880
|
var value = item;
|
|
5878
|
-
activePlugins.
|
|
5879
|
-
var
|
|
5880
|
-
|
|
5881
|
+
for (var _i = 0, _activePlugins = activePlugins; _i < _activePlugins.length; _i++) {
|
|
5882
|
+
var _activePlugins$_i = _activePlugins[_i],
|
|
5883
|
+
data = _activePlugins$_i.data,
|
|
5884
|
+
plugin = _activePlugins$_i.plugin;
|
|
5881
5885
|
value = plugin.getInitialValue(value, _objectSpread2$1({
|
|
5882
5886
|
config: plugin.config,
|
|
5883
|
-
plugin: plugin
|
|
5887
|
+
plugin: plugin,
|
|
5888
|
+
key: key
|
|
5884
5889
|
}, data));
|
|
5885
|
-
}
|
|
5890
|
+
}
|
|
5886
5891
|
sliceConfig.initialState[key] = value;
|
|
5887
5892
|
pluginData[key] = activePlugins;
|
|
5888
5893
|
});
|
package/dist/plugins/index.es.js
CHANGED
|
@@ -37,337 +37,6 @@ function _objectSpread2(target) {
|
|
|
37
37
|
}
|
|
38
38
|
return target;
|
|
39
39
|
}
|
|
40
|
-
function _regeneratorRuntime() {
|
|
41
|
-
_regeneratorRuntime = function () {
|
|
42
|
-
return exports;
|
|
43
|
-
};
|
|
44
|
-
var exports = {},
|
|
45
|
-
Op = Object.prototype,
|
|
46
|
-
hasOwn = Op.hasOwnProperty,
|
|
47
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
48
|
-
obj[key] = desc.value;
|
|
49
|
-
},
|
|
50
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
51
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
52
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
53
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
54
|
-
function define(obj, key, value) {
|
|
55
|
-
return Object.defineProperty(obj, key, {
|
|
56
|
-
value: value,
|
|
57
|
-
enumerable: !0,
|
|
58
|
-
configurable: !0,
|
|
59
|
-
writable: !0
|
|
60
|
-
}), obj[key];
|
|
61
|
-
}
|
|
62
|
-
try {
|
|
63
|
-
define({}, "");
|
|
64
|
-
} catch (err) {
|
|
65
|
-
define = function (obj, key, value) {
|
|
66
|
-
return obj[key] = value;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
70
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
71
|
-
generator = Object.create(protoGenerator.prototype),
|
|
72
|
-
context = new Context(tryLocsList || []);
|
|
73
|
-
return defineProperty(generator, "_invoke", {
|
|
74
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
75
|
-
}), generator;
|
|
76
|
-
}
|
|
77
|
-
function tryCatch(fn, obj, arg) {
|
|
78
|
-
try {
|
|
79
|
-
return {
|
|
80
|
-
type: "normal",
|
|
81
|
-
arg: fn.call(obj, arg)
|
|
82
|
-
};
|
|
83
|
-
} catch (err) {
|
|
84
|
-
return {
|
|
85
|
-
type: "throw",
|
|
86
|
-
arg: err
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.wrap = wrap;
|
|
91
|
-
var ContinueSentinel = {};
|
|
92
|
-
function Generator() {}
|
|
93
|
-
function GeneratorFunction() {}
|
|
94
|
-
function GeneratorFunctionPrototype() {}
|
|
95
|
-
var IteratorPrototype = {};
|
|
96
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
97
|
-
return this;
|
|
98
|
-
});
|
|
99
|
-
var getProto = Object.getPrototypeOf,
|
|
100
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
101
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
102
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
103
|
-
function defineIteratorMethods(prototype) {
|
|
104
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
105
|
-
define(prototype, method, function (arg) {
|
|
106
|
-
return this._invoke(method, arg);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
111
|
-
function invoke(method, arg, resolve, reject) {
|
|
112
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
113
|
-
if ("throw" !== record.type) {
|
|
114
|
-
var result = record.arg,
|
|
115
|
-
value = result.value;
|
|
116
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
117
|
-
invoke("next", value, resolve, reject);
|
|
118
|
-
}, function (err) {
|
|
119
|
-
invoke("throw", err, resolve, reject);
|
|
120
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
121
|
-
result.value = unwrapped, resolve(result);
|
|
122
|
-
}, function (error) {
|
|
123
|
-
return invoke("throw", error, resolve, reject);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
reject(record.arg);
|
|
127
|
-
}
|
|
128
|
-
var previousPromise;
|
|
129
|
-
defineProperty(this, "_invoke", {
|
|
130
|
-
value: function (method, arg) {
|
|
131
|
-
function callInvokeWithMethodAndArg() {
|
|
132
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
133
|
-
invoke(method, arg, resolve, reject);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
141
|
-
var state = "suspendedStart";
|
|
142
|
-
return function (method, arg) {
|
|
143
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
144
|
-
if ("completed" === state) {
|
|
145
|
-
if ("throw" === method) throw arg;
|
|
146
|
-
return doneResult();
|
|
147
|
-
}
|
|
148
|
-
for (context.method = method, context.arg = arg;;) {
|
|
149
|
-
var delegate = context.delegate;
|
|
150
|
-
if (delegate) {
|
|
151
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
152
|
-
if (delegateResult) {
|
|
153
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
154
|
-
return delegateResult;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
158
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
159
|
-
context.dispatchException(context.arg);
|
|
160
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
161
|
-
state = "executing";
|
|
162
|
-
var record = tryCatch(innerFn, self, context);
|
|
163
|
-
if ("normal" === record.type) {
|
|
164
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
165
|
-
return {
|
|
166
|
-
value: record.arg,
|
|
167
|
-
done: context.done
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
175
|
-
var methodName = context.method,
|
|
176
|
-
method = delegate.iterator[methodName];
|
|
177
|
-
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
178
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
179
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
180
|
-
var info = record.arg;
|
|
181
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
182
|
-
}
|
|
183
|
-
function pushTryEntry(locs) {
|
|
184
|
-
var entry = {
|
|
185
|
-
tryLoc: locs[0]
|
|
186
|
-
};
|
|
187
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
188
|
-
}
|
|
189
|
-
function resetTryEntry(entry) {
|
|
190
|
-
var record = entry.completion || {};
|
|
191
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
192
|
-
}
|
|
193
|
-
function Context(tryLocsList) {
|
|
194
|
-
this.tryEntries = [{
|
|
195
|
-
tryLoc: "root"
|
|
196
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
197
|
-
}
|
|
198
|
-
function values(iterable) {
|
|
199
|
-
if (iterable) {
|
|
200
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
201
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
202
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
203
|
-
if (!isNaN(iterable.length)) {
|
|
204
|
-
var i = -1,
|
|
205
|
-
next = function next() {
|
|
206
|
-
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
207
|
-
return next.value = undefined, next.done = !0, next;
|
|
208
|
-
};
|
|
209
|
-
return next.next = next;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return {
|
|
213
|
-
next: doneResult
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
function doneResult() {
|
|
217
|
-
return {
|
|
218
|
-
value: undefined,
|
|
219
|
-
done: !0
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
223
|
-
value: GeneratorFunctionPrototype,
|
|
224
|
-
configurable: !0
|
|
225
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
226
|
-
value: GeneratorFunction,
|
|
227
|
-
configurable: !0
|
|
228
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
229
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
230
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
231
|
-
}, exports.mark = function (genFun) {
|
|
232
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
233
|
-
}, exports.awrap = function (arg) {
|
|
234
|
-
return {
|
|
235
|
-
__await: arg
|
|
236
|
-
};
|
|
237
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
238
|
-
return this;
|
|
239
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
240
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
241
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
242
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
243
|
-
return result.done ? result.value : iter.next();
|
|
244
|
-
});
|
|
245
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
246
|
-
return this;
|
|
247
|
-
}), define(Gp, "toString", function () {
|
|
248
|
-
return "[object Generator]";
|
|
249
|
-
}), exports.keys = function (val) {
|
|
250
|
-
var object = Object(val),
|
|
251
|
-
keys = [];
|
|
252
|
-
for (var key in object) keys.push(key);
|
|
253
|
-
return keys.reverse(), function next() {
|
|
254
|
-
for (; keys.length;) {
|
|
255
|
-
var key = keys.pop();
|
|
256
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
257
|
-
}
|
|
258
|
-
return next.done = !0, next;
|
|
259
|
-
};
|
|
260
|
-
}, exports.values = values, Context.prototype = {
|
|
261
|
-
constructor: Context,
|
|
262
|
-
reset: function (skipTempReset) {
|
|
263
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
264
|
-
},
|
|
265
|
-
stop: function () {
|
|
266
|
-
this.done = !0;
|
|
267
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
268
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
269
|
-
return this.rval;
|
|
270
|
-
},
|
|
271
|
-
dispatchException: function (exception) {
|
|
272
|
-
if (this.done) throw exception;
|
|
273
|
-
var context = this;
|
|
274
|
-
function handle(loc, caught) {
|
|
275
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
276
|
-
}
|
|
277
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
278
|
-
var entry = this.tryEntries[i],
|
|
279
|
-
record = entry.completion;
|
|
280
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
281
|
-
if (entry.tryLoc <= this.prev) {
|
|
282
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
283
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
284
|
-
if (hasCatch && hasFinally) {
|
|
285
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
286
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
287
|
-
} else if (hasCatch) {
|
|
288
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
289
|
-
} else {
|
|
290
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
291
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
abrupt: function (type, arg) {
|
|
297
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
298
|
-
var entry = this.tryEntries[i];
|
|
299
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
300
|
-
var finallyEntry = entry;
|
|
301
|
-
break;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
305
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
306
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
307
|
-
},
|
|
308
|
-
complete: function (record, afterLoc) {
|
|
309
|
-
if ("throw" === record.type) throw record.arg;
|
|
310
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
311
|
-
},
|
|
312
|
-
finish: function (finallyLoc) {
|
|
313
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
314
|
-
var entry = this.tryEntries[i];
|
|
315
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
catch: function (tryLoc) {
|
|
319
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
320
|
-
var entry = this.tryEntries[i];
|
|
321
|
-
if (entry.tryLoc === tryLoc) {
|
|
322
|
-
var record = entry.completion;
|
|
323
|
-
if ("throw" === record.type) {
|
|
324
|
-
var thrown = record.arg;
|
|
325
|
-
resetTryEntry(entry);
|
|
326
|
-
}
|
|
327
|
-
return thrown;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
throw new Error("illegal catch attempt");
|
|
331
|
-
},
|
|
332
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
333
|
-
return this.delegate = {
|
|
334
|
-
iterator: values(iterable),
|
|
335
|
-
resultName: resultName,
|
|
336
|
-
nextLoc: nextLoc
|
|
337
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
338
|
-
}
|
|
339
|
-
}, exports;
|
|
340
|
-
}
|
|
341
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
342
|
-
try {
|
|
343
|
-
var info = gen[key](arg);
|
|
344
|
-
var value = info.value;
|
|
345
|
-
} catch (error) {
|
|
346
|
-
reject(error);
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
if (info.done) {
|
|
350
|
-
resolve(value);
|
|
351
|
-
} else {
|
|
352
|
-
Promise.resolve(value).then(_next, _throw);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
function _asyncToGenerator(fn) {
|
|
356
|
-
return function () {
|
|
357
|
-
var self = this,
|
|
358
|
-
args = arguments;
|
|
359
|
-
return new Promise(function (resolve, reject) {
|
|
360
|
-
var gen = fn.apply(self, args);
|
|
361
|
-
function _next(value) {
|
|
362
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
363
|
-
}
|
|
364
|
-
function _throw(err) {
|
|
365
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
366
|
-
}
|
|
367
|
-
_next(undefined);
|
|
368
|
-
});
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
40
|
function _classCallCheck(instance, Constructor) {
|
|
372
41
|
if (!(instance instanceof Constructor)) {
|
|
373
42
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -510,71 +179,25 @@ var localStorage = (window || {}).localStorage;
|
|
|
510
179
|
var isLocalStorageAvaialble = !!localStorage;
|
|
511
180
|
var PERSISTENCE_KEY = "astroglide-persist";
|
|
512
181
|
var defaultStorageType = localStorage;
|
|
513
|
-
var getPersistedStore =
|
|
514
|
-
var
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}, _callee);
|
|
533
|
-
}));
|
|
534
|
-
return function getPersistedStore() {
|
|
535
|
-
return _ref.apply(this, arguments);
|
|
536
|
-
};
|
|
537
|
-
}();
|
|
538
|
-
var storePersistedValue = /*#__PURE__*/function () {
|
|
539
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, namespace, value) {
|
|
540
|
-
var storage,
|
|
541
|
-
store,
|
|
542
|
-
_args2 = arguments;
|
|
543
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
544
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
545
|
-
case 0:
|
|
546
|
-
storage = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : localStorage;
|
|
547
|
-
_context2.next = 3;
|
|
548
|
-
return getPersistedStore(storage);
|
|
549
|
-
case 3:
|
|
550
|
-
store = _context2.sent;
|
|
551
|
-
console.log("namespace: ", namespace);
|
|
552
|
-
if (namespace) {
|
|
553
|
-
store[namespace] = store[namespace] || {};
|
|
554
|
-
store[namespace][key] = value;
|
|
555
|
-
} else {
|
|
556
|
-
store[key] = value;
|
|
557
|
-
}
|
|
558
|
-
_context2.prev = 6;
|
|
559
|
-
_context2.next = 9;
|
|
560
|
-
return storage.setItem(PERSISTENCE_KEY, JSON.stringify(store));
|
|
561
|
-
case 9:
|
|
562
|
-
_context2.next = 14;
|
|
563
|
-
break;
|
|
564
|
-
case 11:
|
|
565
|
-
_context2.prev = 11;
|
|
566
|
-
_context2.t0 = _context2["catch"](6);
|
|
567
|
-
console.error(_context2.t0);
|
|
568
|
-
case 14:
|
|
569
|
-
case "end":
|
|
570
|
-
return _context2.stop();
|
|
571
|
-
}
|
|
572
|
-
}, _callee2, null, [[6, 11]]);
|
|
573
|
-
}));
|
|
574
|
-
return function storePersistedValue(_x, _x2, _x3) {
|
|
575
|
-
return _ref2.apply(this, arguments);
|
|
576
|
-
};
|
|
577
|
-
}();
|
|
182
|
+
var getPersistedStore = function getPersistedStore() {
|
|
183
|
+
var storage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultStorageType;
|
|
184
|
+
return JSON.parse(storage.getItem(PERSISTENCE_KEY) || "{}");
|
|
185
|
+
};
|
|
186
|
+
var storePersistedValue = function storePersistedValue(key, namespace, value) {
|
|
187
|
+
var storage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : localStorage;
|
|
188
|
+
var store = getPersistedStore(storage);
|
|
189
|
+
if (namespace) {
|
|
190
|
+
store[namespace] = store[namespace] || {};
|
|
191
|
+
store[namespace][key] = value;
|
|
192
|
+
} else {
|
|
193
|
+
store[key] = value;
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
storage.setItem(PERSISTENCE_KEY, JSON.stringify(store));
|
|
197
|
+
} catch (e) {
|
|
198
|
+
console.error(e);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
578
201
|
var getPersistedValue = function getPersistedValue(key, namespace, _storage) {
|
|
579
202
|
var _scope2;
|
|
580
203
|
var storage = _storage || defaultStorageType;
|
|
@@ -586,35 +209,36 @@ var getPersistedValue = function getPersistedValue(key, namespace, _storage) {
|
|
|
586
209
|
return (_scope2 = scope) === null || _scope2 === void 0 ? void 0 : _scope2[key];
|
|
587
210
|
};
|
|
588
211
|
var index = (function () {
|
|
589
|
-
var
|
|
590
|
-
|
|
591
|
-
storageType =
|
|
212
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
213
|
+
_ref$storageType = _ref.storageType,
|
|
214
|
+
storageType = _ref$storageType === void 0 ? defaultStorageType : _ref$storageType;
|
|
592
215
|
if (!isLocalStorageAvaialble && !storageType) {
|
|
593
216
|
console.warn("localStorage is not available! You must provide your own storage to persist"); // eslint-disable-line no-console
|
|
594
217
|
}
|
|
595
218
|
|
|
596
219
|
defaultStorageType = storageType;
|
|
597
220
|
return {
|
|
598
|
-
setup: function setup(plugin,
|
|
599
|
-
var sliceConfig =
|
|
221
|
+
setup: function setup(plugin, _ref2) {
|
|
222
|
+
var sliceConfig = _ref2.sliceConfig;
|
|
600
223
|
return {
|
|
601
224
|
namespace: sliceConfig.name,
|
|
602
225
|
storageType: storageType
|
|
603
226
|
};
|
|
604
227
|
},
|
|
605
|
-
getInitialValue: function getInitialValue(value,
|
|
606
|
-
var sliceConfig =
|
|
607
|
-
key =
|
|
608
|
-
var existingPersistedValue = getPersistedValue(key, sliceConfig.name);
|
|
228
|
+
getInitialValue: function getInitialValue(value, _ref3) {
|
|
229
|
+
var sliceConfig = _ref3.sliceConfig,
|
|
230
|
+
key = _ref3.key;
|
|
231
|
+
var existingPersistedValue = getPersistedValue(key, sliceConfig.name, storageType);
|
|
609
232
|
if (existingPersistedValue !== undefined) {
|
|
610
233
|
return existingPersistedValue;
|
|
611
234
|
}
|
|
612
235
|
return value;
|
|
613
236
|
},
|
|
614
|
-
update: function update(value,
|
|
615
|
-
var key =
|
|
616
|
-
sliceConfig =
|
|
617
|
-
|
|
237
|
+
update: function update(value, _ref4) {
|
|
238
|
+
var key = _ref4.key,
|
|
239
|
+
sliceConfig = _ref4.sliceConfig;
|
|
240
|
+
// debugger;
|
|
241
|
+
storePersistedValue(key, sliceConfig.name, value, storageType !== undefined ? storageType : this.config.storageType || defaultStorageType);
|
|
618
242
|
return value;
|
|
619
243
|
}
|
|
620
244
|
};
|