code7-leia 0.1.78 → 0.1.80

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.
@@ -15,314 +15,11 @@ var fa = require('react-icons/fa');
15
15
  var unorm = _interopDefault(require('unorm'));
16
16
  var md = require('react-icons/md');
17
17
  var reactDropzone = require('react-dropzone');
18
- var effects = require('redux-saga/effects');
19
- var axios = _interopDefault(require('axios'));
20
18
  var pi = require('react-icons/pi');
21
19
  var redux = require('redux');
22
20
  require('redux-persist');
23
21
  var immer = require('immer');
24
22
 
25
- function _regeneratorRuntime() {
26
- _regeneratorRuntime = function () {
27
- return e;
28
- };
29
- var t,
30
- e = {},
31
- r = Object.prototype,
32
- n = r.hasOwnProperty,
33
- o = Object.defineProperty || function (t, e, r) {
34
- t[e] = r.value;
35
- },
36
- i = "function" == typeof Symbol ? Symbol : {},
37
- a = i.iterator || "@@iterator",
38
- c = i.asyncIterator || "@@asyncIterator",
39
- u = i.toStringTag || "@@toStringTag";
40
- function define(t, e, r) {
41
- return Object.defineProperty(t, e, {
42
- value: r,
43
- enumerable: !0,
44
- configurable: !0,
45
- writable: !0
46
- }), t[e];
47
- }
48
- try {
49
- define({}, "");
50
- } catch (t) {
51
- define = function (t, e, r) {
52
- return t[e] = r;
53
- };
54
- }
55
- function wrap(t, e, r, n) {
56
- var i = e && e.prototype instanceof Generator ? e : Generator,
57
- a = Object.create(i.prototype),
58
- c = new Context(n || []);
59
- return o(a, "_invoke", {
60
- value: makeInvokeMethod(t, r, c)
61
- }), a;
62
- }
63
- function tryCatch(t, e, r) {
64
- try {
65
- return {
66
- type: "normal",
67
- arg: t.call(e, r)
68
- };
69
- } catch (t) {
70
- return {
71
- type: "throw",
72
- arg: t
73
- };
74
- }
75
- }
76
- e.wrap = wrap;
77
- var h = "suspendedStart",
78
- l = "suspendedYield",
79
- f = "executing",
80
- s = "completed",
81
- y = {};
82
- function Generator() {}
83
- function GeneratorFunction() {}
84
- function GeneratorFunctionPrototype() {}
85
- var p = {};
86
- define(p, a, function () {
87
- return this;
88
- });
89
- var d = Object.getPrototypeOf,
90
- v = d && d(d(values([])));
91
- v && v !== r && n.call(v, a) && (p = v);
92
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
93
- function defineIteratorMethods(t) {
94
- ["next", "throw", "return"].forEach(function (e) {
95
- define(t, e, function (t) {
96
- return this._invoke(e, t);
97
- });
98
- });
99
- }
100
- function AsyncIterator(t, e) {
101
- function invoke(r, o, i, a) {
102
- var c = tryCatch(t[r], t, o);
103
- if ("throw" !== c.type) {
104
- var u = c.arg,
105
- h = u.value;
106
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
107
- invoke("next", t, i, a);
108
- }, function (t) {
109
- invoke("throw", t, i, a);
110
- }) : e.resolve(h).then(function (t) {
111
- u.value = t, i(u);
112
- }, function (t) {
113
- return invoke("throw", t, i, a);
114
- });
115
- }
116
- a(c.arg);
117
- }
118
- var r;
119
- o(this, "_invoke", {
120
- value: function (t, n) {
121
- function callInvokeWithMethodAndArg() {
122
- return new e(function (e, r) {
123
- invoke(t, n, e, r);
124
- });
125
- }
126
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
127
- }
128
- });
129
- }
130
- function makeInvokeMethod(e, r, n) {
131
- var o = h;
132
- return function (i, a) {
133
- if (o === f) throw new Error("Generator is already running");
134
- if (o === s) {
135
- if ("throw" === i) throw a;
136
- return {
137
- value: t,
138
- done: !0
139
- };
140
- }
141
- for (n.method = i, n.arg = a;;) {
142
- var c = n.delegate;
143
- if (c) {
144
- var u = maybeInvokeDelegate(c, n);
145
- if (u) {
146
- if (u === y) continue;
147
- return u;
148
- }
149
- }
150
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
151
- if (o === h) throw o = s, n.arg;
152
- n.dispatchException(n.arg);
153
- } else "return" === n.method && n.abrupt("return", n.arg);
154
- o = f;
155
- var p = tryCatch(e, r, n);
156
- if ("normal" === p.type) {
157
- if (o = n.done ? s : l, p.arg === y) continue;
158
- return {
159
- value: p.arg,
160
- done: n.done
161
- };
162
- }
163
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
164
- }
165
- };
166
- }
167
- function maybeInvokeDelegate(e, r) {
168
- var n = r.method,
169
- o = e.iterator[n];
170
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
171
- var i = tryCatch(o, e.iterator, r.arg);
172
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
173
- var a = i.arg;
174
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
175
- }
176
- function pushTryEntry(t) {
177
- var e = {
178
- tryLoc: t[0]
179
- };
180
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
181
- }
182
- function resetTryEntry(t) {
183
- var e = t.completion || {};
184
- e.type = "normal", delete e.arg, t.completion = e;
185
- }
186
- function Context(t) {
187
- this.tryEntries = [{
188
- tryLoc: "root"
189
- }], t.forEach(pushTryEntry, this), this.reset(!0);
190
- }
191
- function values(e) {
192
- if (e || "" === e) {
193
- var r = e[a];
194
- if (r) return r.call(e);
195
- if ("function" == typeof e.next) return e;
196
- if (!isNaN(e.length)) {
197
- var o = -1,
198
- i = function next() {
199
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
200
- return next.value = t, next.done = !0, next;
201
- };
202
- return i.next = i;
203
- }
204
- }
205
- throw new TypeError(typeof e + " is not iterable");
206
- }
207
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
208
- value: GeneratorFunctionPrototype,
209
- configurable: !0
210
- }), o(GeneratorFunctionPrototype, "constructor", {
211
- value: GeneratorFunction,
212
- configurable: !0
213
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
214
- var e = "function" == typeof t && t.constructor;
215
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
216
- }, e.mark = function (t) {
217
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
218
- }, e.awrap = function (t) {
219
- return {
220
- __await: t
221
- };
222
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
223
- return this;
224
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
225
- void 0 === i && (i = Promise);
226
- var a = new AsyncIterator(wrap(t, r, n, o), i);
227
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
228
- return t.done ? t.value : a.next();
229
- });
230
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
231
- return this;
232
- }), define(g, "toString", function () {
233
- return "[object Generator]";
234
- }), e.keys = function (t) {
235
- var e = Object(t),
236
- r = [];
237
- for (var n in e) r.push(n);
238
- return r.reverse(), function next() {
239
- for (; r.length;) {
240
- var t = r.pop();
241
- if (t in e) return next.value = t, next.done = !1, next;
242
- }
243
- return next.done = !0, next;
244
- };
245
- }, e.values = values, Context.prototype = {
246
- constructor: Context,
247
- reset: function (e) {
248
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
249
- },
250
- stop: function () {
251
- this.done = !0;
252
- var t = this.tryEntries[0].completion;
253
- if ("throw" === t.type) throw t.arg;
254
- return this.rval;
255
- },
256
- dispatchException: function (e) {
257
- if (this.done) throw e;
258
- var r = this;
259
- function handle(n, o) {
260
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
261
- }
262
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
263
- var i = this.tryEntries[o],
264
- a = i.completion;
265
- if ("root" === i.tryLoc) return handle("end");
266
- if (i.tryLoc <= this.prev) {
267
- var c = n.call(i, "catchLoc"),
268
- u = n.call(i, "finallyLoc");
269
- if (c && u) {
270
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
271
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
272
- } else if (c) {
273
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
274
- } else {
275
- if (!u) throw new Error("try statement without catch or finally");
276
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
277
- }
278
- }
279
- }
280
- },
281
- abrupt: function (t, e) {
282
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
283
- var o = this.tryEntries[r];
284
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
285
- var i = o;
286
- break;
287
- }
288
- }
289
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
290
- var a = i ? i.completion : {};
291
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
292
- },
293
- complete: function (t, e) {
294
- if ("throw" === t.type) throw t.arg;
295
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
296
- },
297
- finish: function (t) {
298
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
299
- var r = this.tryEntries[e];
300
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
301
- }
302
- },
303
- catch: function (t) {
304
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
305
- var r = this.tryEntries[e];
306
- if (r.tryLoc === t) {
307
- var n = r.completion;
308
- if ("throw" === n.type) {
309
- var o = n.arg;
310
- resetTryEntry(r);
311
- }
312
- return o;
313
- }
314
- }
315
- throw new Error("illegal catch attempt");
316
- },
317
- delegateYield: function (e, r, n) {
318
- return this.delegate = {
319
- iterator: values(e),
320
- resultName: r,
321
- nextLoc: n
322
- }, "next" === this.method && (this.arg = t), y;
323
- }
324
- }, e;
325
- }
326
23
  function _extends() {
327
24
  _extends = Object.assign ? Object.assign.bind() : function (target) {
328
25
  for (var i = 1; i < arguments.length; i++) {
@@ -986,48 +683,18 @@ var SharedPropsProvider = function SharedPropsProvider(_ref) {
986
683
  }, children);
987
684
  };
988
685
 
989
- var url = 'http://localhost:5000';
990
- axios.defaults.baseURL = "" + url;
991
- var api = /*#__PURE__*/axios.create();
992
-
993
686
  var Types = {
994
687
  GET_FILES_REQUEST: '@files/GET_FILES_REQUEST',
995
688
  GET_FILES_SUCCESS: '@files/GET_FILES_SUCCESS'
996
689
  };
997
690
 
998
- var _marked = /*#__PURE__*/_regeneratorRuntime().mark(getFiles);
999
- function getFiles(id) {
1000
- var _yield$call, data;
1001
- return _regeneratorRuntime().wrap(function getFiles$(_context) {
1002
- while (1) switch (_context.prev = _context.next) {
1003
- case 0:
1004
- _context.next = 2;
1005
- return effects.call(api.get, "/files/" + id);
1006
- case 2:
1007
- _yield$call = _context.sent;
1008
- data = _yield$call.data;
1009
- _context.next = 6;
1010
- return effects.put(getFilesActionSuccess(data.files));
1011
- case 6:
1012
- case "end":
1013
- return _context.stop();
1014
- }
1015
- }, _marked);
1016
- }
1017
-
1018
- function getFilesAction(id) {
691
+ var getFilesAction = function getFilesAction(payload) {
692
+ console.log('------------getFilesAction------------->', payload);
1019
693
  return {
1020
694
  type: Types.GET_FILES_REQUEST,
1021
- payload: getFiles(id)
1022
- };
1023
- }
1024
- function getFilesActionSuccess(data) {
1025
- console.log('------------getFilesActionSuccess------------->', data);
1026
- return {
1027
- type: Types.GET_FILES_SUCCESS,
1028
- payload: data
695
+ payload: payload
1029
696
  };
1030
- }
697
+ };
1031
698
 
1032
699
  var FileArea = function FileArea() {
1033
700
  var _useState = React.useState([]),
@@ -1293,12 +960,12 @@ var Leia = function Leia(props) {
1293
960
  })))));
1294
961
  };
1295
962
 
1296
- var initState = {
963
+ var INITIAL_STATE = {
1297
964
  files: []
1298
965
  };
1299
966
  function filesReducer(state, action) {
1300
967
  if (state === void 0) {
1301
- state = initState;
968
+ state = INITIAL_STATE;
1302
969
  }
1303
970
  console.log('action: ', action);
1304
971
  return immer.produce(state, function (draft) {
@@ -1313,10 +980,6 @@ function filesReducer(state, action) {
1313
980
  });
1314
981
  }
1315
982
 
1316
- // import { FileData } from '../interface/FileData'
1317
- // const rootReducer = combineReducers({
1318
- // files: FilesReducer as unknown as [FileData],
1319
- // });
1320
983
  var store = /*#__PURE__*/redux.createStore(filesReducer);
1321
984
 
1322
985
  function Code7(props) {