@complat/react-spectra-editor 0.10.13-alpha.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.
Files changed (109) hide show
  1. package/LICENSE +662 -0
  2. package/README.md +37 -0
  3. package/dist/actions/edit_peak.js +25 -0
  4. package/dist/actions/forecast.js +41 -0
  5. package/dist/actions/integration.js +33 -0
  6. package/dist/actions/jcamp.js +41 -0
  7. package/dist/actions/layout.js +17 -0
  8. package/dist/actions/manager.js +49 -0
  9. package/dist/actions/meta.js +17 -0
  10. package/dist/actions/multiplicity.js +57 -0
  11. package/dist/actions/scan.js +33 -0
  12. package/dist/actions/shift.js +25 -0
  13. package/dist/actions/status.js +33 -0
  14. package/dist/actions/submit.js +41 -0
  15. package/dist/actions/threshold.js +33 -0
  16. package/dist/actions/ui.js +50 -0
  17. package/dist/app.js +125 -0
  18. package/dist/components/cmd_bar/01_viewer.js +133 -0
  19. package/dist/components/cmd_bar/02_zoom.js +119 -0
  20. package/dist/components/cmd_bar/03_peak.js +176 -0
  21. package/dist/components/cmd_bar/04_integration.js +273 -0
  22. package/dist/components/cmd_bar/05_multiplicity.js +228 -0
  23. package/dist/components/cmd_bar/06_undo_redo.js +137 -0
  24. package/dist/components/cmd_bar/common.js +104 -0
  25. package/dist/components/cmd_bar/index.js +113 -0
  26. package/dist/components/cmd_bar/r01_layout.js +351 -0
  27. package/dist/components/cmd_bar/r02_scan.js +226 -0
  28. package/dist/components/cmd_bar/r03_threshold.js +209 -0
  29. package/dist/components/cmd_bar/r04_submit.js +349 -0
  30. package/dist/components/cmd_bar/r05_submit_btn.js +147 -0
  31. package/dist/components/cmd_bar/r06_predict_btn.js +307 -0
  32. package/dist/components/cmd_bar/tri_btn.js +202 -0
  33. package/dist/components/common/chem.js +115 -0
  34. package/dist/components/common/comps.js +29 -0
  35. package/dist/components/common/draw.js +41 -0
  36. package/dist/components/d3_line/index.js +236 -0
  37. package/dist/components/d3_line/line_focus.js +765 -0
  38. package/dist/components/d3_rect/index.js +200 -0
  39. package/dist/components/d3_rect/rect_focus.js +301 -0
  40. package/dist/components/forecast/comps.js +337 -0
  41. package/dist/components/forecast/ir_comps.js +224 -0
  42. package/dist/components/forecast/ir_viewer.js +172 -0
  43. package/dist/components/forecast/nmr_comps.js +253 -0
  44. package/dist/components/forecast/nmr_viewer.js +170 -0
  45. package/dist/components/forecast/section_loading.js +95 -0
  46. package/dist/components/forecast_viewer.js +190 -0
  47. package/dist/components/panel/compare.js +370 -0
  48. package/dist/components/panel/index.js +191 -0
  49. package/dist/components/panel/info.js +335 -0
  50. package/dist/components/panel/multiplicity.js +405 -0
  51. package/dist/components/panel/multiplicity_coupling.js +195 -0
  52. package/dist/components/panel/multiplicity_select.js +114 -0
  53. package/dist/components/panel/peaks.js +296 -0
  54. package/dist/constants/action_type.js +140 -0
  55. package/dist/constants/list_layout.js +23 -0
  56. package/dist/constants/list_shift.js +480 -0
  57. package/dist/constants/list_ui.js +33 -0
  58. package/dist/fn.js +31 -0
  59. package/dist/helpers/brush.js +109 -0
  60. package/dist/helpers/calc.js +10 -0
  61. package/dist/helpers/carbonFeatures.js +47 -0
  62. package/dist/helpers/cfg.js +89 -0
  63. package/dist/helpers/chem.js +594 -0
  64. package/dist/helpers/compass.js +91 -0
  65. package/dist/helpers/converter.js +74 -0
  66. package/dist/helpers/extractParams.js +77 -0
  67. package/dist/helpers/extractPeaksEdit.js +69 -0
  68. package/dist/helpers/focus.js +15 -0
  69. package/dist/helpers/format.js +403 -0
  70. package/dist/helpers/init.js +80 -0
  71. package/dist/helpers/integration.js +30 -0
  72. package/dist/helpers/mount.js +112 -0
  73. package/dist/helpers/multiplicity.js +44 -0
  74. package/dist/helpers/multiplicity_calc.js +117 -0
  75. package/dist/helpers/multiplicity_complat.js +126 -0
  76. package/dist/helpers/multiplicity_manual.js +94 -0
  77. package/dist/helpers/multiplicity_verify_basic.js +196 -0
  78. package/dist/helpers/shift.js +48 -0
  79. package/dist/helpers/zoom.js +32 -0
  80. package/dist/index.js +705 -0
  81. package/dist/layer_content.js +125 -0
  82. package/dist/layer_init.js +231 -0
  83. package/dist/layer_prism.js +186 -0
  84. package/dist/reducers/index.js +89 -0
  85. package/dist/reducers/reducer_edit_peak.js +111 -0
  86. package/dist/reducers/reducer_forecast.js +113 -0
  87. package/dist/reducers/reducer_integration.js +136 -0
  88. package/dist/reducers/reducer_jcamp.js +74 -0
  89. package/dist/reducers/reducer_layout.js +27 -0
  90. package/dist/reducers/reducer_manager.js +20 -0
  91. package/dist/reducers/reducer_meta.js +30 -0
  92. package/dist/reducers/reducer_multiplicity.js +131 -0
  93. package/dist/reducers/reducer_scan.js +55 -0
  94. package/dist/reducers/reducer_shift.js +99 -0
  95. package/dist/reducers/reducer_simulation.js +30 -0
  96. package/dist/reducers/reducer_status.js +41 -0
  97. package/dist/reducers/reducer_submit.js +54 -0
  98. package/dist/reducers/reducer_threshold.js +34 -0
  99. package/dist/reducers/reducer_ui.js +46 -0
  100. package/dist/reducers/undo_redo_config.js +24 -0
  101. package/dist/sagas/index.js +50 -0
  102. package/dist/sagas/saga_edit_peak.js +84 -0
  103. package/dist/sagas/saga_manager.js +116 -0
  104. package/dist/sagas/saga_meta.js +46 -0
  105. package/dist/sagas/saga_multiplicity.js +387 -0
  106. package/dist/sagas/saga_ui.js +392 -0
  107. package/dist/third_party/jAnalyzer.js +596 -0
  108. package/dist/third_party/peakInterval.js +107 -0
  109. package/package.json +77 -0
@@ -0,0 +1,392 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _effects = require('redux-saga/effects');
8
+
9
+ var _action_type = require('../constants/action_type');
10
+
11
+ var _list_ui = require('../constants/list_ui');
12
+
13
+ var _list_layout = require('../constants/list_layout');
14
+
15
+ var _marked = /*#__PURE__*/regeneratorRuntime.mark(selectUiSweep),
16
+ _marked2 = /*#__PURE__*/regeneratorRuntime.mark(scrollUiWheel),
17
+ _marked3 = /*#__PURE__*/regeneratorRuntime.mark(clickUiTarget);
18
+
19
+ var getUiSt = function getUiSt(state) {
20
+ return state.ui;
21
+ };
22
+
23
+ var calcPeaks = function calcPeaks(payload) {
24
+ var xExtent = payload.xExtent,
25
+ yExtent = payload.yExtent,
26
+ dataPks = payload.dataPks;
27
+
28
+ if (!dataPks) return [];
29
+ var xL = xExtent.xL,
30
+ xU = xExtent.xU;
31
+ var yL = yExtent.yL,
32
+ yU = yExtent.yU;
33
+
34
+ var peaks = dataPks.filter(function (p) {
35
+ return xL <= p.x && p.x <= xU && yL <= p.y && p.y <= yU;
36
+ });
37
+ return peaks;
38
+ };
39
+
40
+ function selectUiSweep(action) {
41
+ var uiSt, payload, peaks, newPayload;
42
+ return regeneratorRuntime.wrap(function selectUiSweep$(_context) {
43
+ while (1) {
44
+ switch (_context.prev = _context.next) {
45
+ case 0:
46
+ _context.next = 2;
47
+ return (0, _effects.select)(getUiSt);
48
+
49
+ case 2:
50
+ uiSt = _context.sent;
51
+ payload = action.payload;
52
+ _context.t0 = uiSt.sweepType;
53
+ _context.next = _context.t0 === _list_ui.LIST_UI_SWEEP_TYPE.ZOOMIN ? 7 : _context.t0 === _list_ui.LIST_UI_SWEEP_TYPE.ZOOMRESET ? 10 : _context.t0 === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_ADD ? 13 : _context.t0 === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_SWEEP_ADD ? 16 : 25;
54
+ break;
55
+
56
+ case 7:
57
+ _context.next = 9;
58
+ return (0, _effects.put)({
59
+ type: _action_type.UI.SWEEP.SELECT_ZOOMIN,
60
+ payload: payload
61
+ });
62
+
63
+ case 9:
64
+ return _context.abrupt('break', 26);
65
+
66
+ case 10:
67
+ _context.next = 12;
68
+ return (0, _effects.put)({
69
+ type: _action_type.UI.SWEEP.SELECT_ZOOMRESET,
70
+ payload: payload
71
+ });
72
+
73
+ case 12:
74
+ return _context.abrupt('break', 26);
75
+
76
+ case 13:
77
+ _context.next = 15;
78
+ return (0, _effects.put)({
79
+ type: _action_type.UI.SWEEP.SELECT_INTEGRATION,
80
+ payload: payload
81
+ });
82
+
83
+ case 15:
84
+ return _context.abrupt('break', 26);
85
+
86
+ case 16:
87
+ peaks = calcPeaks(payload); // eslint-disable-line
88
+
89
+ if (!(peaks.length === 0)) {
90
+ _context.next = 19;
91
+ break;
92
+ }
93
+
94
+ return _context.abrupt('break', 26);
95
+
96
+ case 19:
97
+ newPayload = Object.assign({}, payload, { peaks: peaks }); // eslint-disable-line
98
+
99
+ _context.next = 22;
100
+ return (0, _effects.put)({
101
+ type: _action_type.UI.SWEEP.SELECT_INTEGRATION,
102
+ payload: newPayload
103
+ });
104
+
105
+ case 22:
106
+ _context.next = 24;
107
+ return (0, _effects.put)({
108
+ type: _action_type.UI.SWEEP.SELECT_MULTIPLICITY,
109
+ payload: newPayload
110
+ });
111
+
112
+ case 24:
113
+ return _context.abrupt('break', 26);
114
+
115
+ case 25:
116
+ return _context.abrupt('break', 26);
117
+
118
+ case 26:
119
+ return _context.abrupt('return', null);
120
+
121
+ case 27:
122
+ case 'end':
123
+ return _context.stop();
124
+ }
125
+ }
126
+ }, _marked);
127
+ }
128
+
129
+ var getLayoutSt = function getLayoutSt(state) {
130
+ return state.layout;
131
+ };
132
+
133
+ function scrollUiWheel(action) {
134
+ var layoutSt, payload, xExtent, yExtent, direction, yL, yU, yeL, yeU, scale, nextExtent, nyeL, nyeU, h, nytL, nytU;
135
+ return regeneratorRuntime.wrap(function scrollUiWheel$(_context2) {
136
+ while (1) {
137
+ switch (_context2.prev = _context2.next) {
138
+ case 0:
139
+ _context2.next = 2;
140
+ return (0, _effects.select)(getLayoutSt);
141
+
142
+ case 2:
143
+ layoutSt = _context2.sent;
144
+ payload = action.payload;
145
+ xExtent = payload.xExtent, yExtent = payload.yExtent, direction = payload.direction;
146
+ yL = yExtent.yL, yU = yExtent.yU;
147
+ yeL = yL + (yU - yL) * 0.1, yeU = yU - (yU - yL) * 0.1;
148
+ scale = direction ? 0.8 : 1.25;
149
+ nextExtent = { xExtent: false, yExtent: false };
150
+ nyeL = 0, nyeU = 1, h = 1, nytL = 0, nytU = 1;
151
+ _context2.t0 = layoutSt;
152
+ _context2.next = _context2.t0 === _list_layout.LIST_LAYOUT.IR ? 13 : _context2.t0 === _list_layout.LIST_LAYOUT.RAMAN ? 13 : _context2.t0 === _list_layout.LIST_LAYOUT.MS ? 20 : _context2.t0 === _list_layout.LIST_LAYOUT.UVVIS ? 27 : _context2.t0 === _list_layout.LIST_LAYOUT.HPLC_UVVIS ? 27 : _context2.t0 === _list_layout.LIST_LAYOUT.TGA ? 27 : _context2.t0 === _list_layout.LIST_LAYOUT.XRD ? 27 : 27;
153
+ break;
154
+
155
+ case 13:
156
+ nyeL = yeL + (yeU - yeL) * (1 - scale);
157
+ nyeU = yeU;
158
+
159
+ h = nyeU - nyeL;
160
+ nytL = nyeL - 0.125 * h;
161
+ nytU = nyeU + 0.125 * h;
162
+
163
+ nextExtent = { xExtent: xExtent, yExtent: { yL: nytL, yU: nytU } };
164
+ return _context2.abrupt('break', 34);
165
+
166
+ case 20:
167
+ nyeL = 0;
168
+ nyeU = yeL + (yeU - yeL) * scale;
169
+
170
+ h = nyeU - nyeL;
171
+ nytL = nyeL - 0.125 * h;
172
+ nytU = nyeU + 0.125 * h;
173
+
174
+ nextExtent = { xExtent: xExtent, yExtent: { yL: nytL, yU: nytU } };
175
+ return _context2.abrupt('break', 34);
176
+
177
+ case 27:
178
+ nyeL = yeL;
179
+ nyeU = yeL + (yeU - yeL) * scale;
180
+
181
+ h = nyeU - nyeL;
182
+ nytL = nyeL - 0.125 * h;
183
+ nytU = nyeU + 0.125 * h;
184
+
185
+ nextExtent = { xExtent: xExtent, yExtent: { yL: nytL, yU: nytU } };
186
+ return _context2.abrupt('break', 34);
187
+
188
+ case 34:
189
+ _context2.next = 36;
190
+ return (0, _effects.put)({
191
+ type: _action_type.UI.SWEEP.SELECT_ZOOMIN,
192
+ payload: nextExtent
193
+ });
194
+
195
+ case 36:
196
+ case 'end':
197
+ return _context2.stop();
198
+ }
199
+ }
200
+ }, _marked2);
201
+ }
202
+
203
+ var getUiSweepType = function getUiSweepType(state) {
204
+ return state.ui.sweepType;
205
+ };
206
+
207
+ function clickUiTarget(action) {
208
+ var payload, onPeak, uiSweepType, xExtent, xL, xU;
209
+ return regeneratorRuntime.wrap(function clickUiTarget$(_context3) {
210
+ while (1) {
211
+ switch (_context3.prev = _context3.next) {
212
+ case 0:
213
+ payload = action.payload, onPeak = action.onPeak;
214
+ _context3.next = 3;
215
+ return (0, _effects.select)(getUiSweepType);
216
+
217
+ case 3:
218
+ uiSweepType = _context3.sent;
219
+
220
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_ADD && !onPeak)) {
221
+ _context3.next = 9;
222
+ break;
223
+ }
224
+
225
+ _context3.next = 7;
226
+ return (0, _effects.put)({
227
+ type: _action_type.EDITPEAK.ADD_POSITIVE,
228
+ payload: payload
229
+ });
230
+
231
+ case 7:
232
+ _context3.next = 54;
233
+ break;
234
+
235
+ case 9:
236
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_DELETE && onPeak)) {
237
+ _context3.next = 14;
238
+ break;
239
+ }
240
+
241
+ _context3.next = 12;
242
+ return (0, _effects.put)({
243
+ type: _action_type.EDITPEAK.ADD_NEGATIVE,
244
+ payload: payload
245
+ });
246
+
247
+ case 12:
248
+ _context3.next = 54;
249
+ break;
250
+
251
+ case 14:
252
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.ANCHOR_SHIFT && onPeak)) {
253
+ _context3.next = 19;
254
+ break;
255
+ }
256
+
257
+ _context3.next = 17;
258
+ return (0, _effects.put)({
259
+ type: _action_type.SHIFT.SET_PEAK,
260
+ payload: payload
261
+ });
262
+
263
+ case 17:
264
+ _context3.next = 54;
265
+ break;
266
+
267
+ case 19:
268
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_RM && onPeak)) {
269
+ _context3.next = 24;
270
+ break;
271
+ }
272
+
273
+ _context3.next = 22;
274
+ return (0, _effects.put)({
275
+ type: _action_type.INTEGRATION.RM_ONE,
276
+ payload: payload
277
+ });
278
+
279
+ case 22:
280
+ _context3.next = 54;
281
+ break;
282
+
283
+ case 24:
284
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_RM && onPeak)) {
285
+ _context3.next = 29;
286
+ break;
287
+ }
288
+
289
+ _context3.next = 27;
290
+ return (0, _effects.put)({
291
+ type: _action_type.INTEGRATION.RM_ONE,
292
+ payload: payload
293
+ });
294
+
295
+ case 27:
296
+ _context3.next = 54;
297
+ break;
298
+
299
+ case 29:
300
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_SET_REF && onPeak)) {
301
+ _context3.next = 34;
302
+ break;
303
+ }
304
+
305
+ _context3.next = 32;
306
+ return (0, _effects.put)({
307
+ type: _action_type.INTEGRATION.SET_REF,
308
+ payload: payload
309
+ });
310
+
311
+ case 32:
312
+ _context3.next = 54;
313
+ break;
314
+
315
+ case 34:
316
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_CLICK && onPeak)) {
317
+ _context3.next = 46;
318
+ break;
319
+ }
320
+
321
+ xExtent = payload.xExtent, xL = payload.xL, xU = payload.xU;
322
+
323
+ if (!xExtent) {
324
+ _context3.next = 41;
325
+ break;
326
+ }
327
+
328
+ _context3.next = 39;
329
+ return (0, _effects.put)({
330
+ type: _action_type.MULTIPLICITY.ONE_CLICK_BY_UI,
331
+ payload: xExtent
332
+ });
333
+
334
+ case 39:
335
+ _context3.next = 44;
336
+ break;
337
+
338
+ case 41:
339
+ if (!(xL && xU)) {
340
+ _context3.next = 44;
341
+ break;
342
+ }
343
+
344
+ _context3.next = 44;
345
+ return (0, _effects.put)({
346
+ type: _action_type.MULTIPLICITY.ONE_CLICK_BY_UI,
347
+ payload: { xL: xL, xU: xU }
348
+ });
349
+
350
+ case 44:
351
+ _context3.next = 54;
352
+ break;
353
+
354
+ case 46:
355
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_ADD)) {
356
+ _context3.next = 51;
357
+ break;
358
+ }
359
+
360
+ _context3.next = 49;
361
+ return (0, _effects.put)({
362
+ type: _action_type.MULTIPLICITY.PEAK_ADD_BY_UI_SAG,
363
+ payload: payload
364
+ });
365
+
366
+ case 49:
367
+ _context3.next = 54;
368
+ break;
369
+
370
+ case 51:
371
+ if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_RM && onPeak)) {
372
+ _context3.next = 54;
373
+ break;
374
+ }
375
+
376
+ _context3.next = 54;
377
+ return (0, _effects.put)({
378
+ type: _action_type.MULTIPLICITY.PEAK_RM_BY_UI,
379
+ payload: payload
380
+ });
381
+
382
+ case 54:
383
+ case 'end':
384
+ return _context3.stop();
385
+ }
386
+ }
387
+ }, _marked3);
388
+ }
389
+
390
+ var managerSagas = [(0, _effects.takeEvery)(_action_type.UI.CLICK_TARGET, clickUiTarget), (0, _effects.takeEvery)(_action_type.UI.SWEEP.SELECT, selectUiSweep), (0, _effects.takeEvery)(_action_type.UI.WHEEL.SCROLL, scrollUiWheel)];
391
+
392
+ exports.default = managerSagas;