touchstudy-core 0.1.37 → 0.1.39
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/dist/index.js +207 -11
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +207 -11
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
@@ -153,11 +153,165 @@ var Role;
|
|
153
153
|
})(Role || (Role = {}));
|
154
154
|
|
155
155
|
// A type of promise-like that resolves synchronously and supports only one observer
|
156
|
+
const _Pact = /*#__PURE__*/(function() {
|
157
|
+
function _Pact() {}
|
158
|
+
_Pact.prototype.then = function(onFulfilled, onRejected) {
|
159
|
+
const result = new _Pact();
|
160
|
+
const state = this.s;
|
161
|
+
if (state) {
|
162
|
+
const callback = state & 1 ? onFulfilled : onRejected;
|
163
|
+
if (callback) {
|
164
|
+
try {
|
165
|
+
_settle(result, 1, callback(this.v));
|
166
|
+
} catch (e) {
|
167
|
+
_settle(result, 2, e);
|
168
|
+
}
|
169
|
+
return result;
|
170
|
+
} else {
|
171
|
+
return this;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
this.o = function(_this) {
|
175
|
+
try {
|
176
|
+
const value = _this.v;
|
177
|
+
if (_this.s & 1) {
|
178
|
+
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
179
|
+
} else if (onRejected) {
|
180
|
+
_settle(result, 1, onRejected(value));
|
181
|
+
} else {
|
182
|
+
_settle(result, 2, value);
|
183
|
+
}
|
184
|
+
} catch (e) {
|
185
|
+
_settle(result, 2, e);
|
186
|
+
}
|
187
|
+
};
|
188
|
+
return result;
|
189
|
+
};
|
190
|
+
return _Pact;
|
191
|
+
})();
|
192
|
+
|
193
|
+
// Settles a pact synchronously
|
194
|
+
function _settle(pact, state, value) {
|
195
|
+
if (!pact.s) {
|
196
|
+
if (value instanceof _Pact) {
|
197
|
+
if (value.s) {
|
198
|
+
if (state & 1) {
|
199
|
+
state = value.s;
|
200
|
+
}
|
201
|
+
value = value.v;
|
202
|
+
} else {
|
203
|
+
value.o = _settle.bind(null, pact, state);
|
204
|
+
return;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
if (value && value.then) {
|
208
|
+
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
209
|
+
return;
|
210
|
+
}
|
211
|
+
pact.s = state;
|
212
|
+
pact.v = value;
|
213
|
+
const observer = pact.o;
|
214
|
+
if (observer) {
|
215
|
+
observer(pact);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
function _isSettledPact(thenable) {
|
221
|
+
return thenable instanceof _Pact && thenable.s & 1;
|
222
|
+
}
|
156
223
|
|
157
224
|
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
158
225
|
|
159
226
|
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
160
227
|
|
228
|
+
// Asynchronously implement a generic for loop
|
229
|
+
function _for(test, update, body) {
|
230
|
+
var stage;
|
231
|
+
for (;;) {
|
232
|
+
var shouldContinue = test();
|
233
|
+
if (_isSettledPact(shouldContinue)) {
|
234
|
+
shouldContinue = shouldContinue.v;
|
235
|
+
}
|
236
|
+
if (!shouldContinue) {
|
237
|
+
return result;
|
238
|
+
}
|
239
|
+
if (shouldContinue.then) {
|
240
|
+
stage = 0;
|
241
|
+
break;
|
242
|
+
}
|
243
|
+
var result = body();
|
244
|
+
if (result && result.then) {
|
245
|
+
if (_isSettledPact(result)) {
|
246
|
+
result = result.s;
|
247
|
+
} else {
|
248
|
+
stage = 1;
|
249
|
+
break;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
if (update) {
|
253
|
+
var updateValue = update();
|
254
|
+
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
255
|
+
stage = 2;
|
256
|
+
break;
|
257
|
+
}
|
258
|
+
}
|
259
|
+
}
|
260
|
+
var pact = new _Pact();
|
261
|
+
var reject = _settle.bind(null, pact, 2);
|
262
|
+
(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
|
263
|
+
return pact;
|
264
|
+
function _resumeAfterBody(value) {
|
265
|
+
result = value;
|
266
|
+
do {
|
267
|
+
if (update) {
|
268
|
+
updateValue = update();
|
269
|
+
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
270
|
+
updateValue.then(_resumeAfterUpdate).then(void 0, reject);
|
271
|
+
return;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
shouldContinue = test();
|
275
|
+
if (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {
|
276
|
+
_settle(pact, 1, result);
|
277
|
+
return;
|
278
|
+
}
|
279
|
+
if (shouldContinue.then) {
|
280
|
+
shouldContinue.then(_resumeAfterTest).then(void 0, reject);
|
281
|
+
return;
|
282
|
+
}
|
283
|
+
result = body();
|
284
|
+
if (_isSettledPact(result)) {
|
285
|
+
result = result.v;
|
286
|
+
}
|
287
|
+
} while (!result || !result.then);
|
288
|
+
result.then(_resumeAfterBody).then(void 0, reject);
|
289
|
+
}
|
290
|
+
function _resumeAfterTest(shouldContinue) {
|
291
|
+
if (shouldContinue) {
|
292
|
+
result = body();
|
293
|
+
if (result && result.then) {
|
294
|
+
result.then(_resumeAfterBody).then(void 0, reject);
|
295
|
+
} else {
|
296
|
+
_resumeAfterBody(result);
|
297
|
+
}
|
298
|
+
} else {
|
299
|
+
_settle(pact, 1, result);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
function _resumeAfterUpdate() {
|
303
|
+
if (shouldContinue = test()) {
|
304
|
+
if (shouldContinue.then) {
|
305
|
+
shouldContinue.then(_resumeAfterTest).then(void 0, reject);
|
306
|
+
} else {
|
307
|
+
_resumeAfterTest(shouldContinue);
|
308
|
+
}
|
309
|
+
} else {
|
310
|
+
_settle(pact, 1, result);
|
311
|
+
}
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
161
315
|
// Asynchronously call a function and send errors to recovery continuation
|
162
316
|
function _catch(body, recover) {
|
163
317
|
try {
|
@@ -1614,6 +1768,8 @@ var problem_analysis = "문제 분석";
|
|
1614
1768
|
var class_information = "수업정보";
|
1615
1769
|
var teachers = "교사";
|
1616
1770
|
var lessons = "수업";
|
1771
|
+
var update_class = "수업 업데이트";
|
1772
|
+
var create_class = "수업 만들기";
|
1617
1773
|
var lang_ko = {
|
1618
1774
|
problem_solving: problem_solving,
|
1619
1775
|
my_story: my_story,
|
@@ -1920,7 +2076,9 @@ var lang_ko = {
|
|
1920
2076
|
problem_analysis: problem_analysis,
|
1921
2077
|
class_information: class_information,
|
1922
2078
|
teachers: teachers,
|
1923
|
-
lessons: lessons
|
2079
|
+
lessons: lessons,
|
2080
|
+
update_class: update_class,
|
2081
|
+
create_class: create_class
|
1924
2082
|
};
|
1925
2083
|
|
1926
2084
|
var problem_solving$1 = "Problem Solving";
|
@@ -2275,6 +2433,8 @@ var problem_analysis$1 = "Problem analysis";
|
|
2275
2433
|
var class_information$1 = "Class Information";
|
2276
2434
|
var teachers$1 = "Teachers";
|
2277
2435
|
var lessons$1 = "Lessons";
|
2436
|
+
var update_class$1 = "Update class";
|
2437
|
+
var create_class$1 = "Create class";
|
2278
2438
|
var lang_en = {
|
2279
2439
|
problem_solving: problem_solving$1,
|
2280
2440
|
my_story: my_story$1,
|
@@ -2616,7 +2776,9 @@ var lang_en = {
|
|
2616
2776
|
problem_analysis: problem_analysis$1,
|
2617
2777
|
class_information: class_information$1,
|
2618
2778
|
teachers: teachers$1,
|
2619
|
-
lessons: lessons$1
|
2779
|
+
lessons: lessons$1,
|
2780
|
+
update_class: update_class$1,
|
2781
|
+
create_class: create_class$1
|
2620
2782
|
};
|
2621
2783
|
|
2622
2784
|
i18n.use(initReactI18next).init({
|
@@ -9229,19 +9391,53 @@ var useExamResult = function useExamResult(searchParam, navigate, examSessionId,
|
|
9229
9391
|
var canvas = document.querySelector("#canvas");
|
9230
9392
|
var headerCanvas = document.querySelector("#header-canvas");
|
9231
9393
|
if (!canvas || !headerCanvas) return Promise.resolve();
|
9232
|
-
var doc = new jsPDF(
|
9233
|
-
|
9234
|
-
|
9394
|
+
var doc = new jsPDF({
|
9395
|
+
orientation: "p",
|
9396
|
+
unit: "px",
|
9397
|
+
format: "a4"
|
9398
|
+
});
|
9399
|
+
var WIDTH_PAPER = doc.internal.pageSize.width;
|
9400
|
+
var HEIGHT_PAPER = doc.internal.pageSize.height;
|
9401
|
+
var line = 0;
|
9402
|
+
var imgWidth = WIDTH_PAPER;
|
9403
|
+
var chartWidth = WIDTH_PAPER - 20;
|
9235
9404
|
return Promise.resolve(html2canvas(headerCanvas)).then(function (header) {
|
9405
|
+
function _temp11() {
|
9406
|
+
doc.save("download.pdf");
|
9407
|
+
}
|
9236
9408
|
var imgHeaderHeight = header.height * imgWidth / header.width;
|
9237
9409
|
var imgHeaderData = header.toDataURL('image/png');
|
9238
9410
|
doc.addImage(imgHeaderData, 'PNG', 0, 0, imgWidth, imgHeaderHeight);
|
9239
|
-
|
9240
|
-
|
9241
|
-
|
9242
|
-
|
9243
|
-
|
9244
|
-
|
9411
|
+
line += imgHeaderHeight;
|
9412
|
+
if (line > HEIGHT_PAPER) {
|
9413
|
+
doc.addPage();
|
9414
|
+
line = 20;
|
9415
|
+
}
|
9416
|
+
var _temp10 = function () {
|
9417
|
+
if (canvas && canvas.childElementCount > 0) {
|
9418
|
+
var _index = 0;
|
9419
|
+
var _temp9 = _for(function () {
|
9420
|
+
return _index < canvas.childElementCount;
|
9421
|
+
}, function () {
|
9422
|
+
return _index++;
|
9423
|
+
}, function () {
|
9424
|
+
var chart = canvas.children.item(_index);
|
9425
|
+
return Promise.resolve(html2canvas(chart)).then(function (chartCanvas) {
|
9426
|
+
var imgBodyHeight = chartCanvas.height * chartWidth / chartCanvas.width;
|
9427
|
+
var imgBodyData = chartCanvas.toDataURL('image/png');
|
9428
|
+
line += 10;
|
9429
|
+
if (line + imgBodyHeight > HEIGHT_PAPER) {
|
9430
|
+
doc.addPage();
|
9431
|
+
line = 20;
|
9432
|
+
}
|
9433
|
+
doc.addImage(imgBodyData, 'PNG', 10, line, chartWidth, imgBodyHeight);
|
9434
|
+
line += imgBodyHeight;
|
9435
|
+
});
|
9436
|
+
});
|
9437
|
+
if (_temp9 && _temp9.then) return _temp9.then(function () {});
|
9438
|
+
}
|
9439
|
+
}();
|
9440
|
+
return _temp10 && _temp10.then ? _temp10.then(_temp11) : _temp11(_temp10);
|
9245
9441
|
});
|
9246
9442
|
} catch (e) {
|
9247
9443
|
return Promise.reject(e);
|