@elice/material-exercise 1.260429.0-improvetimerpopoverui.0 → 1.260430.1
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/cjs/components/material-exercise/context/index.js +0 -7
- package/cjs/components/material-exercise/context/recoil.d.ts +0 -44
- package/cjs/components/material-exercise/context/recoil.js +0 -108
- package/cjs/components/material-exercise/context/recoilTypes.d.ts +0 -7
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenu.d.ts +1 -1
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenu.js +1 -18
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +2 -4
- package/cjs/components/material-exercise/exercise-menu/locales/en.json.js +1 -1
- package/cjs/components/material-exercise/exercise-menu/locales/ko.json.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunner.js +27 -57
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerController.js +34 -7
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.d.ts +1 -1
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +13 -219
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.d.ts +2 -2
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionCancel.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionCancel.js +44 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionGrade.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionGrade.js +68 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionRun.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionRun.js +54 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionSyncRequest.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionSyncRequest.js +44 -0
- package/cjs/components/material-exercise/exercise-runner/action/index.d.ts +5 -0
- package/cjs/components/material-exercise/exercise-runner/action/index.js +15 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionCancel.d.ts +14 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionCancel.js +52 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionGrade.d.ts +16 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionGrade.js +74 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionRun.d.ts +14 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionRun.js +65 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionSyncRequest.d.ts +15 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionSyncRequest.js +68 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialog.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialog.js +156 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogNativeMock.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogNativeMock.js +188 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogSteps.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogSteps.js +132 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionCompile.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionCompile.js +88 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionUpload.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionUpload.js +103 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerButtonGroup.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerButtonGroup.js +24 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerStatusMessage.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerStatusMessage.js +201 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoErrorDialog.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoErrorDialog.js +125 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialog.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialog.js +179 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogButton.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogButton.js +29 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.js +94 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProvider.d.ts +16 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProvider.js +105 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.d.ts +12 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.js +94 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.d.ts +7 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.js +95 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.d.ts +7 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.js +70 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/_context.d.ts +35 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/_context.js +18 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/index.d.ts +6 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/index.js +13 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/useArduinoRunIntent.d.ts +9 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/useArduinoRunIntent.js +38 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/useArduinoTerminalWriter.d.ts +10 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/useArduinoTerminalWriter.js +33 -0
- package/cjs/components/material-exercise/exercise-runner/locales/en.json.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/locales/ja.json.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/locales/ko.json.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/locales/th.json.js +1 -1
- package/cjs/components/shared/monaco-editor/utils/prettier/config.d.ts +1 -1
- package/cjs/components/shared/monaco-editor/utils/prettier/config.js +1 -1
- package/cjs/hooks/index.d.ts +0 -1
- package/cjs/hooks/index.js +0 -2
- package/es/components/material-exercise/context/index.js +1 -1
- package/es/components/material-exercise/context/recoil.d.ts +0 -44
- package/es/components/material-exercise/context/recoil.js +1 -102
- package/es/components/material-exercise/context/recoilTypes.d.ts +0 -7
- package/es/components/material-exercise/exercise-menu/ExerciseMenu.d.ts +1 -1
- package/es/components/material-exercise/exercise-menu/ExerciseMenu.js +2 -18
- package/es/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +3 -3
- package/es/components/material-exercise/exercise-menu/locales/en.json.js +1 -1
- package/es/components/material-exercise/exercise-menu/locales/ko.json.js +1 -1
- package/es/components/material-exercise/exercise-runner/ExerciseRunner.js +28 -58
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerController.js +34 -7
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.d.ts +1 -1
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +13 -214
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.d.ts +2 -2
- package/es/components/material-exercise/exercise-runner/action/ControllerActionCancel.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionCancel.js +40 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionGrade.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionGrade.js +64 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionRun.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionRun.js +50 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionSyncRequest.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionSyncRequest.js +40 -0
- package/es/components/material-exercise/exercise-runner/action/index.d.ts +5 -0
- package/es/components/material-exercise/exercise-runner/action/index.js +5 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionCancel.d.ts +14 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionCancel.js +46 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionGrade.d.ts +16 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionGrade.js +68 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionRun.d.ts +14 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionRun.js +59 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionSyncRequest.d.ts +15 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionSyncRequest.js +62 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialog.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialog.js +141 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogNativeMock.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogNativeMock.js +177 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogSteps.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogSteps.js +122 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionCompile.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionCompile.js +80 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionUpload.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionUpload.js +95 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerButtonGroup.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerButtonGroup.js +20 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerStatusMessage.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerStatusMessage.js +197 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoErrorDialog.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoErrorDialog.js +112 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialog.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialog.js +161 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogButton.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogButton.js +25 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.js +84 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProvider.d.ts +16 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProvider.js +97 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.d.ts +12 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.js +86 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.d.ts +7 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.js +87 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.d.ts +7 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.js +62 -0
- package/es/components/material-exercise/exercise-runner/arduino/_context.d.ts +35 -0
- package/es/components/material-exercise/exercise-runner/arduino/_context.js +15 -0
- package/es/components/material-exercise/exercise-runner/arduino/index.d.ts +6 -0
- package/es/components/material-exercise/exercise-runner/arduino/index.js +4 -0
- package/es/components/material-exercise/exercise-runner/arduino/useArduinoRunIntent.d.ts +9 -0
- package/es/components/material-exercise/exercise-runner/arduino/useArduinoRunIntent.js +32 -0
- package/es/components/material-exercise/exercise-runner/arduino/useArduinoTerminalWriter.d.ts +10 -0
- package/es/components/material-exercise/exercise-runner/arduino/useArduinoTerminalWriter.js +27 -0
- package/es/components/material-exercise/exercise-runner/locales/en.json.js +1 -1
- package/es/components/material-exercise/exercise-runner/locales/ja.json.js +1 -1
- package/es/components/material-exercise/exercise-runner/locales/ko.json.js +1 -1
- package/es/components/material-exercise/exercise-runner/locales/th.json.js +1 -1
- package/es/components/shared/monaco-editor/utils/prettier/config.d.ts +1 -1
- package/es/components/shared/monaco-editor/utils/prettier/config.js +1 -1
- package/es/hooks/index.d.ts +0 -1
- package/es/hooks/index.js +0 -1
- package/package.json +15 -11
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.d.ts +0 -3
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +0 -33
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.d.ts +0 -3
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +0 -178
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.d.ts +0 -3
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +0 -169
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.d.ts +0 -3
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +0 -120
- package/cjs/constants/arduino.d.ts +0 -35
- package/cjs/constants/arduino.js +0 -73
- package/cjs/hooks/useArduino.d.ts +0 -14
- package/cjs/hooks/useArduino.js +0 -589
- package/cjs/typings/arduino.d.ts +0 -77
- package/cjs/utils/arduino.d.ts +0 -43
- package/cjs/utils/arduino.js +0 -82
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.d.ts +0 -3
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +0 -29
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.d.ts +0 -3
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +0 -170
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.d.ts +0 -3
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +0 -161
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.d.ts +0 -3
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +0 -112
- package/es/constants/arduino.d.ts +0 -35
- package/es/constants/arduino.js +0 -62
- package/es/hooks/useArduino.d.ts +0 -14
- package/es/hooks/useArduino.js +0 -583
- package/es/typings/arduino.d.ts +0 -77
- package/es/utils/arduino.d.ts +0 -43
- package/es/utils/arduino.js +0 -75
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var intl = require('@elice/intl');
|
|
9
|
+
var muiElements = require('@elice/mui-elements');
|
|
10
|
+
var proRegularSvgIcons = require('@fortawesome/pro-regular-svg-icons');
|
|
11
|
+
var material = require('@mui/material');
|
|
12
|
+
var Box = require('@mui/material/Box');
|
|
13
|
+
var Button = require('@mui/material/Button');
|
|
14
|
+
var Checkbox = require('@mui/material/Checkbox');
|
|
15
|
+
var Dialog = require('@mui/material/Dialog');
|
|
16
|
+
var DialogActions = require('@mui/material/DialogActions');
|
|
17
|
+
var DialogContent = require('@mui/material/DialogContent');
|
|
18
|
+
var DialogTitle = require('@mui/material/DialogTitle');
|
|
19
|
+
var FormControlLabel = require('@mui/material/FormControlLabel');
|
|
20
|
+
var Stack = require('@mui/material/Stack');
|
|
21
|
+
var Typography = require('@mui/material/Typography');
|
|
22
|
+
var _context = require('./_context.js');
|
|
23
|
+
var ArduinoHelpDialogChecklist = require('./ArduinoHelpDialogChecklist.js');
|
|
24
|
+
|
|
25
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
26
|
+
|
|
27
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
28
|
+
var Box__default = /*#__PURE__*/_interopDefaultCompat(Box);
|
|
29
|
+
var Button__default = /*#__PURE__*/_interopDefaultCompat(Button);
|
|
30
|
+
var Checkbox__default = /*#__PURE__*/_interopDefaultCompat(Checkbox);
|
|
31
|
+
var Dialog__default = /*#__PURE__*/_interopDefaultCompat(Dialog);
|
|
32
|
+
var DialogActions__default = /*#__PURE__*/_interopDefaultCompat(DialogActions);
|
|
33
|
+
var DialogContent__default = /*#__PURE__*/_interopDefaultCompat(DialogContent);
|
|
34
|
+
var DialogTitle__default = /*#__PURE__*/_interopDefaultCompat(DialogTitle);
|
|
35
|
+
var FormControlLabel__default = /*#__PURE__*/_interopDefaultCompat(FormControlLabel);
|
|
36
|
+
var Stack__default = /*#__PURE__*/_interopDefaultCompat(Stack);
|
|
37
|
+
var Typography__default = /*#__PURE__*/_interopDefaultCompat(Typography);
|
|
38
|
+
|
|
39
|
+
//
|
|
40
|
+
//
|
|
41
|
+
//
|
|
42
|
+
var STORAGE_KEY = 'elice-material-exercise-arduino-help-modal-closed';
|
|
43
|
+
var STORAGE_VALUE = 'true';
|
|
44
|
+
var ARDUINO_FAQ_URL = 'https://eli.so/arduino-faq';
|
|
45
|
+
//
|
|
46
|
+
//
|
|
47
|
+
//
|
|
48
|
+
var ArduinoHelpDialog = function ArduinoHelpDialog() {
|
|
49
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
50
|
+
var _useArduinoBridge = _context.useArduinoBridge(),
|
|
51
|
+
isHelpDialogOpen = _useArduinoBridge.isHelpDialogOpen,
|
|
52
|
+
openHelpDialog = _useArduinoBridge.openHelpDialog,
|
|
53
|
+
closeHelpDialog = _useArduinoBridge.closeHelpDialog;
|
|
54
|
+
var _React$useState = React__default.default.useState(false),
|
|
55
|
+
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
56
|
+
wasAutoOpened = _React$useState2[0],
|
|
57
|
+
setWasAutoOpened = _React$useState2[1];
|
|
58
|
+
var _React$useState3 = React__default.default.useState(false),
|
|
59
|
+
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
60
|
+
dontShowAgain = _React$useState4[0],
|
|
61
|
+
setDontShowAgain = _React$useState4[1];
|
|
62
|
+
//
|
|
63
|
+
// Auto-popup once on first visit (localStorage flag survives reloads).
|
|
64
|
+
//
|
|
65
|
+
React__default.default.useEffect(function () {
|
|
66
|
+
var isClosed = localStorage.getItem(STORAGE_KEY) === STORAGE_VALUE;
|
|
67
|
+
if (!isClosed) {
|
|
68
|
+
openHelpDialog();
|
|
69
|
+
setWasAutoOpened(true);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
+
[]);
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
var handleClose = function handleClose() {
|
|
78
|
+
if (dontShowAgain) {
|
|
79
|
+
localStorage.setItem(STORAGE_KEY, STORAGE_VALUE);
|
|
80
|
+
}
|
|
81
|
+
closeHelpDialog();
|
|
82
|
+
setWasAutoOpened(false);
|
|
83
|
+
setDontShowAgain(false);
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
var renderDialogManual = function renderDialogManual() {
|
|
89
|
+
return jsxRuntime.jsx(material.Card, {
|
|
90
|
+
variant: "outlined",
|
|
91
|
+
children: jsxRuntime.jsx(material.CardActionArea, {
|
|
92
|
+
component: "a",
|
|
93
|
+
href: ARDUINO_FAQ_URL,
|
|
94
|
+
target: "_blank",
|
|
95
|
+
rel: "noopener noreferrer",
|
|
96
|
+
sx: {
|
|
97
|
+
p: 1.5
|
|
98
|
+
},
|
|
99
|
+
children: jsxRuntime.jsxs(Stack__default.default, {
|
|
100
|
+
direction: "row",
|
|
101
|
+
spacing: 1.5,
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
children: [jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
104
|
+
icon: proRegularSvgIcons.faBookAlt
|
|
105
|
+
}), jsxRuntime.jsxs(Box__default.default, {
|
|
106
|
+
sx: {
|
|
107
|
+
flex: 1,
|
|
108
|
+
minWidth: 0
|
|
109
|
+
},
|
|
110
|
+
children: [jsxRuntime.jsx(Typography__default.default, {
|
|
111
|
+
variant: "body2",
|
|
112
|
+
fontWeight: 700,
|
|
113
|
+
children: intl$1.formatMessage({
|
|
114
|
+
id: 'exerciseRunner.arduino.help.manual.title'
|
|
115
|
+
})
|
|
116
|
+
}), jsxRuntime.jsx(Typography__default.default, {
|
|
117
|
+
variant: "caption",
|
|
118
|
+
color: "text.secondary",
|
|
119
|
+
children: intl$1.formatMessage({
|
|
120
|
+
id: 'exerciseRunner.arduino.help.manual.detail'
|
|
121
|
+
})
|
|
122
|
+
})]
|
|
123
|
+
}), jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
124
|
+
icon: proRegularSvgIcons.faArrowRight
|
|
125
|
+
})]
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
//
|
|
131
|
+
//
|
|
132
|
+
//
|
|
133
|
+
return jsxRuntime.jsxs(Dialog__default.default, {
|
|
134
|
+
fullWidth: true,
|
|
135
|
+
open: isHelpDialogOpen,
|
|
136
|
+
maxWidth: "sm",
|
|
137
|
+
onClose: handleClose,
|
|
138
|
+
children: [jsxRuntime.jsx(DialogTitle__default.default, {
|
|
139
|
+
children: intl$1.formatMessage({
|
|
140
|
+
id: 'exerciseRunner.arduino.help.title'
|
|
141
|
+
})
|
|
142
|
+
}), jsxRuntime.jsx(DialogContent__default.default, {
|
|
143
|
+
children: jsxRuntime.jsxs(Stack__default.default, {
|
|
144
|
+
spacing: 2.5,
|
|
145
|
+
children: [jsxRuntime.jsx(Typography__default.default, {
|
|
146
|
+
variant: "body2",
|
|
147
|
+
color: "text.secondary",
|
|
148
|
+
children: intl$1.formatMessage({
|
|
149
|
+
id: 'exerciseRunner.arduino.help.greeting'
|
|
150
|
+
})
|
|
151
|
+
}), jsxRuntime.jsx(ArduinoHelpDialogChecklist.default, {}), renderDialogManual()]
|
|
152
|
+
})
|
|
153
|
+
}), jsxRuntime.jsxs(DialogActions__default.default, {
|
|
154
|
+
sx: {
|
|
155
|
+
justifyContent: 'space-between'
|
|
156
|
+
},
|
|
157
|
+
children: [wasAutoOpened ? jsxRuntime.jsx(FormControlLabel__default.default, {
|
|
158
|
+
control: jsxRuntime.jsx(Checkbox__default.default, {
|
|
159
|
+
size: "small",
|
|
160
|
+
checked: dontShowAgain,
|
|
161
|
+
onChange: function onChange(e) {
|
|
162
|
+
return setDontShowAgain(e.target.checked);
|
|
163
|
+
}
|
|
164
|
+
}),
|
|
165
|
+
label: intl$1.formatMessage({
|
|
166
|
+
id: 'exerciseRunner.arduino.help.dontShowAgain'
|
|
167
|
+
})
|
|
168
|
+
}) : jsxRuntime.jsx(Box__default.default, {}), jsxRuntime.jsx(Button__default.default, {
|
|
169
|
+
color: "inherit",
|
|
170
|
+
onClick: handleClose,
|
|
171
|
+
children: intl$1.formatMessage({
|
|
172
|
+
id: 'exerciseRunner.arduino.help.close'
|
|
173
|
+
})
|
|
174
|
+
})]
|
|
175
|
+
})]
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
exports.default = ArduinoHelpDialog;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var icons = require('@elice/icons');
|
|
7
|
+
var intl = require('@elice/intl');
|
|
8
|
+
var _context = require('./_context.js');
|
|
9
|
+
var ExerciseMenuButton = require('../../../shared/exercise-menu-button/ExerciseMenuButton.js');
|
|
10
|
+
|
|
11
|
+
//
|
|
12
|
+
//
|
|
13
|
+
//
|
|
14
|
+
var ArduinoHelpDialogButton = function ArduinoHelpDialogButton() {
|
|
15
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
16
|
+
var _useArduinoBridge = _context.useArduinoBridge(),
|
|
17
|
+
isHelpDialogOpen = _useArduinoBridge.isHelpDialogOpen,
|
|
18
|
+
openHelpDialog = _useArduinoBridge.openHelpDialog;
|
|
19
|
+
return jsxRuntime.jsx(ExerciseMenuButton.default, {
|
|
20
|
+
icon: icons.eilStatusInfo,
|
|
21
|
+
title: intl$1.formatMessage({
|
|
22
|
+
id: 'exerciseRunner.arduino.help.button'
|
|
23
|
+
}),
|
|
24
|
+
active: isHelpDialogOpen,
|
|
25
|
+
onClick: openHelpDialog
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.default = ArduinoHelpDialogButton;
|
package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var intl = require('@elice/intl');
|
|
7
|
+
var Box = require('@mui/material/Box');
|
|
8
|
+
var Stack = require('@mui/material/Stack');
|
|
9
|
+
var Typography = require('@mui/material/Typography');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var Box__default = /*#__PURE__*/_interopDefaultCompat(Box);
|
|
14
|
+
var Stack__default = /*#__PURE__*/_interopDefaultCompat(Stack);
|
|
15
|
+
var Typography__default = /*#__PURE__*/_interopDefaultCompat(Typography);
|
|
16
|
+
|
|
17
|
+
//
|
|
18
|
+
//
|
|
19
|
+
//
|
|
20
|
+
var CHECKLIST_STEPS = [1, 2, 3, 4];
|
|
21
|
+
//
|
|
22
|
+
//
|
|
23
|
+
//
|
|
24
|
+
var ArduinoHelpDialogChecklist = function ArduinoHelpDialogChecklist() {
|
|
25
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
var renderStepBadge = function renderStepBadge(step) {
|
|
30
|
+
return jsxRuntime.jsx(Box__default.default, {
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
sx: {
|
|
33
|
+
width: 24,
|
|
34
|
+
height: 24,
|
|
35
|
+
borderRadius: '50%',
|
|
36
|
+
display: 'flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
fontSize: 13,
|
|
40
|
+
fontWeight: 700,
|
|
41
|
+
bgcolor: 'primary.main',
|
|
42
|
+
color: 'primary.contrastText',
|
|
43
|
+
flexShrink: 0
|
|
44
|
+
},
|
|
45
|
+
children: step
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
var renderItem = function renderItem(step) {
|
|
52
|
+
var title = intl$1.formatMessage({
|
|
53
|
+
id: "exerciseRunner.arduino.help.checklist.".concat(step, ".title")
|
|
54
|
+
});
|
|
55
|
+
var body = intl$1.formatMessage({
|
|
56
|
+
id: "exerciseRunner.arduino.help.checklist.".concat(step, ".body")
|
|
57
|
+
});
|
|
58
|
+
return jsxRuntime.jsxs(Stack__default.default, {
|
|
59
|
+
direction: "row",
|
|
60
|
+
spacing: 1.5,
|
|
61
|
+
alignItems: "flex-start",
|
|
62
|
+
children: [renderStepBadge(step), jsxRuntime.jsxs(Box__default.default, {
|
|
63
|
+
sx: {
|
|
64
|
+
flex: 1,
|
|
65
|
+
pt: 0.25
|
|
66
|
+
},
|
|
67
|
+
children: [jsxRuntime.jsx(Typography__default.default, {
|
|
68
|
+
variant: "body2",
|
|
69
|
+
fontWeight: 700,
|
|
70
|
+
children: title
|
|
71
|
+
}), jsxRuntime.jsx(Typography__default.default, {
|
|
72
|
+
variant: "caption",
|
|
73
|
+
color: "text.secondary",
|
|
74
|
+
sx: {
|
|
75
|
+
display: 'block',
|
|
76
|
+
mt: 0.25
|
|
77
|
+
},
|
|
78
|
+
children: body
|
|
79
|
+
})]
|
|
80
|
+
})]
|
|
81
|
+
}, step);
|
|
82
|
+
};
|
|
83
|
+
//
|
|
84
|
+
//
|
|
85
|
+
//
|
|
86
|
+
return jsxRuntime.jsx(Stack__default.default, {
|
|
87
|
+
spacing: 1.5,
|
|
88
|
+
children: CHECKLIST_STEPS.map(function (step) {
|
|
89
|
+
return renderItem(step);
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
exports.default = ArduinoHelpDialogChecklist;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { XtermApis } from "../../../shared/xterm/Xterm";
|
|
3
|
+
export interface ArduinoBridgeApi {
|
|
4
|
+
handleIncomingHex: (dataUrl: string) => void;
|
|
5
|
+
sendText: (text: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ArduinoBridgeProviderProps {
|
|
8
|
+
xtermRef: React.RefObject<XtermApis | null>;
|
|
9
|
+
apiRef: React.MutableRefObject<ArduinoBridgeApi | null>;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface ArduinoBridgeProviderGateProps extends ArduinoBridgeProviderProps {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const _default: ({ enabled, children, ...rest }: ArduinoBridgeProviderGateProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var tslib = require('tslib');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var mcuBridge = require('@elice/mcu-bridge');
|
|
10
|
+
var _context = require('./_context.js');
|
|
11
|
+
var ArduinoConnectionGuideDialog = require('./ArduinoConnectionGuideDialog.js');
|
|
12
|
+
var ArduinoErrorDialog = require('./ArduinoErrorDialog.js');
|
|
13
|
+
var ArduinoHelpDialog = require('./ArduinoHelpDialog.js');
|
|
14
|
+
var ArduinoProviderApiBinder = require('./ArduinoProviderApiBinder.js');
|
|
15
|
+
var ArduinoProviderFlashWriter = require('./ArduinoProviderFlashWriter.js');
|
|
16
|
+
var ArduinoProviderSessionWriter = require('./ArduinoProviderSessionWriter.js');
|
|
17
|
+
var useArduinoRunIntent = require('./useArduinoRunIntent.js');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
20
|
+
|
|
21
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
22
|
+
|
|
23
|
+
//
|
|
24
|
+
//
|
|
25
|
+
//
|
|
26
|
+
var ArduinoBridgeProvider = function ArduinoBridgeProvider(_ref) {
|
|
27
|
+
var xtermRef = _ref.xtermRef,
|
|
28
|
+
apiRef = _ref.apiRef,
|
|
29
|
+
children = _ref.children;
|
|
30
|
+
var _useFlash = mcuBridge.useFlash(),
|
|
31
|
+
isFlashing = _useFlash.isFlashing;
|
|
32
|
+
var _useArduinoRunIntent = useArduinoRunIntent.useArduinoRunIntent(),
|
|
33
|
+
pendingIntent = _useArduinoRunIntent.pendingIntent,
|
|
34
|
+
pendingIntentRef = _useArduinoRunIntent.pendingIntentRef,
|
|
35
|
+
setRunIntent = _useArduinoRunIntent.setRunIntent,
|
|
36
|
+
clearRunIntent = _useArduinoRunIntent.clearRunIntent;
|
|
37
|
+
var permissionPhase = mcuBridge.usePermissionPhase();
|
|
38
|
+
var _React$useState = React__default.default.useState(null),
|
|
39
|
+
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
40
|
+
connectionIntent = _React$useState2[0],
|
|
41
|
+
setConnectionIntent = _React$useState2[1];
|
|
42
|
+
var _React$useState3 = React__default.default.useState(false),
|
|
43
|
+
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
44
|
+
isHelpDialogOpen = _React$useState4[0],
|
|
45
|
+
setHelpDialogOpen = _React$useState4[1];
|
|
46
|
+
var openHelpDialog = React__default.default.useCallback(function () {
|
|
47
|
+
return setHelpDialogOpen(true);
|
|
48
|
+
}, []);
|
|
49
|
+
var closeHelpDialog = React__default.default.useCallback(function () {
|
|
50
|
+
return setHelpDialogOpen(false);
|
|
51
|
+
}, []);
|
|
52
|
+
React.useEffect(function () {
|
|
53
|
+
mcuBridge.setupMCUBridge([mcuBridge.ArduinoUnoDriver, mcuBridge.ArduinoMegaDriver]);
|
|
54
|
+
}, []);
|
|
55
|
+
// Clear the variant tag once the picker resolves so it can't bleed into
|
|
56
|
+
// an unrelated future connect flow.
|
|
57
|
+
React.useEffect(function () {
|
|
58
|
+
if (permissionPhase === 'granted') {
|
|
59
|
+
setConnectionIntent(null);
|
|
60
|
+
}
|
|
61
|
+
}, [permissionPhase]);
|
|
62
|
+
//
|
|
63
|
+
//
|
|
64
|
+
//
|
|
65
|
+
return jsxRuntime.jsxs(_context.ArduinoBridgeContext.Provider, {
|
|
66
|
+
value: {
|
|
67
|
+
setPendingIntent: setRunIntent,
|
|
68
|
+
isPending: pendingIntent !== null,
|
|
69
|
+
isFlashing: isFlashing,
|
|
70
|
+
connectionIntent: connectionIntent,
|
|
71
|
+
setConnectionIntent: setConnectionIntent,
|
|
72
|
+
isHelpDialogOpen: isHelpDialogOpen,
|
|
73
|
+
openHelpDialog: openHelpDialog,
|
|
74
|
+
closeHelpDialog: closeHelpDialog
|
|
75
|
+
},
|
|
76
|
+
children: [children, jsxRuntime.jsx(ArduinoProviderSessionWriter.default, {
|
|
77
|
+
xtermRef: xtermRef
|
|
78
|
+
}), jsxRuntime.jsx(ArduinoProviderFlashWriter.default, {
|
|
79
|
+
xtermRef: xtermRef
|
|
80
|
+
}), jsxRuntime.jsx(ArduinoProviderApiBinder.default, {
|
|
81
|
+
apiRef: apiRef,
|
|
82
|
+
xtermRef: xtermRef,
|
|
83
|
+
pendingIntentRef: pendingIntentRef,
|
|
84
|
+
clearRunIntent: clearRunIntent
|
|
85
|
+
}), jsxRuntime.jsx(ArduinoConnectionGuideDialog.default, {}), jsxRuntime.jsx(ArduinoHelpDialog.default, {}), jsxRuntime.jsx(ArduinoErrorDialog.default, {})]
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
//
|
|
89
|
+
//
|
|
90
|
+
//
|
|
91
|
+
var ArduinoBridgeProvider$1 = (function (_a) {
|
|
92
|
+
var enabled = _a.enabled,
|
|
93
|
+
children = _a.children,
|
|
94
|
+
rest = tslib.__rest(_a, ["enabled", "children"]);
|
|
95
|
+
if (!enabled) {
|
|
96
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
97
|
+
children: children
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return jsxRuntime.jsx(ArduinoBridgeProvider, Object.assign({}, rest, {
|
|
101
|
+
children: children
|
|
102
|
+
}));
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
exports.default = ArduinoBridgeProvider$1;
|
package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { XtermApis } from "../../../shared/xterm/Xterm";
|
|
3
|
+
import type { ArduinoBridgeIntent } from './_context';
|
|
4
|
+
import type { ArduinoBridgeApi } from './ArduinoProvider';
|
|
5
|
+
export interface ArduinoProviderApiBinderProps {
|
|
6
|
+
apiRef: React.MutableRefObject<ArduinoBridgeApi | null>;
|
|
7
|
+
xtermRef: React.RefObject<XtermApis | null>;
|
|
8
|
+
pendingIntentRef: React.MutableRefObject<ArduinoBridgeIntent | null>;
|
|
9
|
+
clearRunIntent: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const ArduinoProviderApiBinder: React.FC<ArduinoProviderApiBinderProps>;
|
|
12
|
+
export default ArduinoProviderApiBinder;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var intl = require('@elice/intl');
|
|
7
|
+
var mcuBridge = require('@elice/mcu-bridge');
|
|
8
|
+
var useArduinoTerminalWriter = require('./useArduinoTerminalWriter.js');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
|
+
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
//
|
|
17
|
+
function decodeHexDataUrl(dataUrl) {
|
|
18
|
+
var base64 = dataUrl.includes(',') ? dataUrl.split(',')[1] : dataUrl;
|
|
19
|
+
var binary = atob(base64);
|
|
20
|
+
var bytes = new Uint8Array(binary.length);
|
|
21
|
+
for (var i = 0; i < binary.length; i += 1) {
|
|
22
|
+
bytes[i] = binary.charCodeAt(i);
|
|
23
|
+
}
|
|
24
|
+
return bytes;
|
|
25
|
+
}
|
|
26
|
+
//
|
|
27
|
+
//
|
|
28
|
+
//
|
|
29
|
+
var ArduinoProviderApiBinder = function ArduinoProviderApiBinder(_ref) {
|
|
30
|
+
var apiRef = _ref.apiRef,
|
|
31
|
+
xtermRef = _ref.xtermRef,
|
|
32
|
+
pendingIntentRef = _ref.pendingIntentRef,
|
|
33
|
+
clearRunIntent = _ref.clearRunIntent;
|
|
34
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
35
|
+
var session = mcuBridge.useSession();
|
|
36
|
+
var _useFlash = mcuBridge.useFlash(),
|
|
37
|
+
flash = _useFlash.flash;
|
|
38
|
+
var _useArduinoTerminalWr = useArduinoTerminalWriter.useArduinoTerminalWriter({
|
|
39
|
+
xtermRef: xtermRef
|
|
40
|
+
}),
|
|
41
|
+
writeSystemMessage = _useArduinoTerminalWr.writeSystemMessage;
|
|
42
|
+
//
|
|
43
|
+
// Expose imperative API to the parent runner via ref.
|
|
44
|
+
//
|
|
45
|
+
React__default.default.useEffect(function () {
|
|
46
|
+
apiRef.current = {
|
|
47
|
+
handleIncomingHex: function handleIncomingHex(dataUrl) {
|
|
48
|
+
var intent = pendingIntentRef.current;
|
|
49
|
+
clearRunIntent();
|
|
50
|
+
if (intent !== 'upload') {
|
|
51
|
+
if (intent === 'compile') {
|
|
52
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
53
|
+
id: 'exerciseRunner.arduino.terminal.compile.done'
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!session) {
|
|
59
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
60
|
+
id: 'exerciseRunner.arduino.terminal.board.notConnected'
|
|
61
|
+
}));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
65
|
+
id: 'exerciseRunner.arduino.terminal.compile.done'
|
|
66
|
+
}));
|
|
67
|
+
var bytes;
|
|
68
|
+
try {
|
|
69
|
+
bytes = decodeHexDataUrl(dataUrl);
|
|
70
|
+
} catch (_a) {
|
|
71
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
72
|
+
id: 'exerciseRunner.arduino.terminal.firmware.readFail'
|
|
73
|
+
}));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
void flash(bytes)["catch"](function () {
|
|
77
|
+
// Error already surfaced through the progress writer.
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
sendText: function sendText(text) {
|
|
81
|
+
if (!session) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
void session.writeText(text);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return function () {
|
|
88
|
+
apiRef.current = null;
|
|
89
|
+
};
|
|
90
|
+
}, [apiRef, session, flash, pendingIntentRef, clearRunIntent, writeSystemMessage, intl$1]);
|
|
91
|
+
return null;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
exports.default = ArduinoProviderApiBinder;
|
package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { XtermApis } from "../../../shared/xterm/Xterm";
|
|
3
|
+
export interface ArduinoProviderFlashWriterProps {
|
|
4
|
+
xtermRef: React.RefObject<XtermApis | null>;
|
|
5
|
+
}
|
|
6
|
+
declare const ArduinoProviderFlashWriter: React.FC<ArduinoProviderFlashWriterProps>;
|
|
7
|
+
export default ArduinoProviderFlashWriter;
|
package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var intl = require('@elice/intl');
|
|
7
|
+
var mcuBridge = require('@elice/mcu-bridge');
|
|
8
|
+
var useArduinoTerminalWriter = require('./useArduinoTerminalWriter.js');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
|
+
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
//
|
|
17
|
+
var UPLOAD_PROGRESS_THROTTLE_MS = 200;
|
|
18
|
+
var ArduinoProviderFlashWriter = function ArduinoProviderFlashWriter(_ref) {
|
|
19
|
+
var xtermRef = _ref.xtermRef;
|
|
20
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
21
|
+
var _useFlash = mcuBridge.useFlash(),
|
|
22
|
+
progress = _useFlash.progress;
|
|
23
|
+
var _useArduinoTerminalWr = useArduinoTerminalWriter.useArduinoTerminalWriter({
|
|
24
|
+
xtermRef: xtermRef
|
|
25
|
+
}),
|
|
26
|
+
writeSystemMessage = _useArduinoTerminalWr.writeSystemMessage;
|
|
27
|
+
var lastStageRef = React__default.default.useRef(null);
|
|
28
|
+
var lastUploadWriteAtRef = React__default.default.useRef(0);
|
|
29
|
+
//
|
|
30
|
+
// Translate flash progress into terminal messages.
|
|
31
|
+
//
|
|
32
|
+
React__default.default.useEffect(function () {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if (!progress) {
|
|
35
|
+
lastStageRef.current = null;
|
|
36
|
+
lastUploadWriteAtRef.current = 0;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
var stage = progress.stage,
|
|
40
|
+
percent = progress.percent;
|
|
41
|
+
var isStageChange = lastStageRef.current !== stage;
|
|
42
|
+
lastStageRef.current = stage;
|
|
43
|
+
switch (stage) {
|
|
44
|
+
case 'start':
|
|
45
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
46
|
+
id: 'exerciseRunner.arduino.terminal.upload.start'
|
|
47
|
+
}));
|
|
48
|
+
return;
|
|
49
|
+
case 'upload':
|
|
50
|
+
{
|
|
51
|
+
var now = Date.now();
|
|
52
|
+
if (!isStageChange && now - lastUploadWriteAtRef.current < UPLOAD_PROGRESS_THROTTLE_MS) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
lastUploadWriteAtRef.current = now;
|
|
56
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
57
|
+
id: 'exerciseRunner.arduino.terminal.upload.progress'
|
|
58
|
+
}, {
|
|
59
|
+
percent: percent
|
|
60
|
+
}));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
case 'verify':
|
|
64
|
+
if (isStageChange) {
|
|
65
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
66
|
+
id: 'exerciseRunner.arduino.terminal.upload.verifying'
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
case 'done':
|
|
71
|
+
if (isStageChange) {
|
|
72
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
73
|
+
id: 'exerciseRunner.arduino.terminal.upload.done'
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
case 'error':
|
|
78
|
+
if (isStageChange) {
|
|
79
|
+
writeSystemMessage(intl$1.formatMessage({
|
|
80
|
+
id: 'exerciseRunner.arduino.terminal.upload.error'
|
|
81
|
+
}, {
|
|
82
|
+
error: (_b = (_a = progress.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : intl$1.formatMessage({
|
|
83
|
+
id: 'exerciseRunner.arduino.terminal.upload.errorUnknown'
|
|
84
|
+
})
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
default:
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}, [progress, writeSystemMessage, intl$1]);
|
|
92
|
+
return null;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.default = ArduinoProviderFlashWriter;
|
package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { XtermApis } from "../../../shared/xterm/Xterm";
|
|
3
|
+
export interface ArduinoProviderSessionWriterProps {
|
|
4
|
+
xtermRef: React.RefObject<XtermApis | null>;
|
|
5
|
+
}
|
|
6
|
+
declare const ArduinoProviderSessionWriter: React.FC<ArduinoProviderSessionWriterProps>;
|
|
7
|
+
export default ArduinoProviderSessionWriter;
|