@elice/material-exercise 1.260515.0 → 1.260517.0-codegenexercisecli.0
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/MaterialExercise.js +5 -1
- package/cjs/components/material-exercise/context/ExerciseProvider.js +9 -0
- package/cjs/components/material-exercise/context/types.d.ts +10 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionPreflightDialogSteps.js +2 -2
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProvider.js +19 -14
- package/es/components/material-exercise/MaterialExercise.js +7 -3
- package/es/components/material-exercise/context/ExerciseProvider.js +9 -0
- package/es/components/material-exercise/context/types.d.ts +10 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionPreflightDialogSteps.js +2 -2
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProvider.js +19 -14
- package/package.json +5 -5
|
@@ -147,6 +147,7 @@ var MaterialExercise = React.forwardRef(function (props, ref) {
|
|
|
147
147
|
var exercisePreviewType = recoil.useRecoilValue(recoil$1.exercisePreviewTypeState(props.materialExerciseId));
|
|
148
148
|
var exercisePreviewDisplayMode = recoil.useRecoilValue(recoil$1.exercisePreviewDisplayModeState);
|
|
149
149
|
var exerciseMonacoEditorApis = recoil.useRecoilValue(recoil$1.exerciseMonacoEditorApisState);
|
|
150
|
+
var _setActiveFilename = recoil.useSetRecoilState(recoil$1.exerciseActiveFilenameState);
|
|
150
151
|
/**
|
|
151
152
|
* File tree
|
|
152
153
|
*/
|
|
@@ -284,9 +285,12 @@ var MaterialExercise = React.forwardRef(function (props, ref) {
|
|
|
284
285
|
},
|
|
285
286
|
openRunnerRooms: function openRunnerRooms() {
|
|
286
287
|
return subjects.exerciseRunnerRoomsOpen$.next();
|
|
288
|
+
},
|
|
289
|
+
setActiveFilename: function setActiveFilename(filename) {
|
|
290
|
+
return _setActiveFilename(filename);
|
|
287
291
|
}
|
|
288
292
|
};
|
|
289
|
-
}, [exerciseMonacoEditorApis]);
|
|
293
|
+
}, [exerciseMonacoEditorApis, _setActiveFilename]);
|
|
290
294
|
//
|
|
291
295
|
//
|
|
292
296
|
//
|
|
@@ -140,6 +140,15 @@ var ExerciseProvider = function ExerciseProvider(_a) {
|
|
|
140
140
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
141
|
[width, height]);
|
|
142
142
|
//
|
|
143
|
+
// forward active filename changes to host
|
|
144
|
+
//
|
|
145
|
+
React__default.default.useEffect(function () {
|
|
146
|
+
var _a;
|
|
147
|
+
(_a = contextProps.onActiveFilenameChange) === null || _a === void 0 ? void 0 : _a.call(contextProps, activeFilename);
|
|
148
|
+
},
|
|
149
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
150
|
+
[activeFilename]);
|
|
151
|
+
//
|
|
143
152
|
// update
|
|
144
153
|
//
|
|
145
154
|
React__default.default.useEffect(function () {
|
|
@@ -18,6 +18,7 @@ export interface MaterialExerciseCommonApis {
|
|
|
18
18
|
sendTextToRunner: MaterialExerciseCommonApiSendTextToTerminal;
|
|
19
19
|
getMonacoEditorApis: MaterialExerciseCommonApiGetMonacoEditorApis;
|
|
20
20
|
openRunnerRooms: MaterialExerciseCommonAPiOpenRunnerRooms;
|
|
21
|
+
setActiveFilename: MaterialExerciseCommonApiSetActiveFilename;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Send text to terminal.
|
|
@@ -31,6 +32,10 @@ export type MaterialExerciseCommonApiGetMonacoEditorApis = () => MonacoEditorApi
|
|
|
31
32
|
* Open runner rooms.
|
|
32
33
|
*/
|
|
33
34
|
export type MaterialExerciseCommonAPiOpenRunnerRooms = () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Set the currently active file in the editor.
|
|
37
|
+
*/
|
|
38
|
+
export type MaterialExerciseCommonApiSetActiveFilename = (filename: string) => void;
|
|
34
39
|
/**
|
|
35
40
|
* [External]
|
|
36
41
|
* Common exposed props for `MaterialExercise*` components.
|
|
@@ -64,6 +69,7 @@ export interface MaterialExerciseCommonProps {
|
|
|
64
69
|
onReferenceDocsToggle?: () => void;
|
|
65
70
|
onCodeHelpRequest?: MaterialExerciseCommonPropOnCodeHelpRequest;
|
|
66
71
|
onCodeEditorChange?: MaterialExerciseCommonPropOnCodeEditorChange;
|
|
72
|
+
onActiveFilenameChange?: MaterialExerciseCommonPropOnActiveFilenameChange;
|
|
67
73
|
onStdioError?: MaterialExerciseCommonPropOnStdioError;
|
|
68
74
|
onDefaultExerciseRoomIdSet?: MaterialExerciseCommonPropOnDefaultExerciseRoomIdSet;
|
|
69
75
|
onExerciseRoomIdChange?: MaterialExerciseCommonPropOnExerciseRoomIdChange;
|
|
@@ -94,6 +100,10 @@ export type MaterialExerciseCommonPropOnCodeEditorChange = (payload: {
|
|
|
94
100
|
content: string;
|
|
95
101
|
selectedContent: string;
|
|
96
102
|
}) => void;
|
|
103
|
+
/**
|
|
104
|
+
* On active file change.
|
|
105
|
+
*/
|
|
106
|
+
export type MaterialExerciseCommonPropOnActiveFilenameChange = (filename: string | null) => void;
|
|
97
107
|
/**
|
|
98
108
|
* On stdio error.
|
|
99
109
|
*/
|
|
@@ -38,13 +38,13 @@ var ArduinoConnectionPreflightDialogSteps = function ArduinoConnectionPreflightD
|
|
|
38
38
|
mx: 0.25,
|
|
39
39
|
borderRadius: 0.5,
|
|
40
40
|
bgcolor: function bgcolor(theme) {
|
|
41
|
-
return theme.palette.background.
|
|
41
|
+
return theme.palette.background.gray;
|
|
42
42
|
},
|
|
43
43
|
border: function border(theme) {
|
|
44
44
|
return "1px solid ".concat(theme.palette.divider);
|
|
45
45
|
},
|
|
46
46
|
color: function color(theme) {
|
|
47
|
-
return theme.palette.
|
|
47
|
+
return theme.palette.primary.main;
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
children: text
|
|
@@ -6,6 +6,7 @@ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabel
|
|
|
6
6
|
var tslib = require('tslib');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var React = require('react');
|
|
9
|
+
var intl = require('@elice/intl');
|
|
9
10
|
var mcuBridge = require('@elice/mcu-bridge');
|
|
10
11
|
var overlayKit = require('overlay-kit');
|
|
11
12
|
var _context = require('./_context.js');
|
|
@@ -33,6 +34,7 @@ var ArduinoBridgeProvider = function ArduinoBridgeProvider(_ref) {
|
|
|
33
34
|
var xtermRef = _ref.xtermRef,
|
|
34
35
|
apiRef = _ref.apiRef,
|
|
35
36
|
children = _ref.children;
|
|
37
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
36
38
|
var _useFlash = mcuBridge.useFlash(),
|
|
37
39
|
isFlashing = _useFlash.isFlashing;
|
|
38
40
|
var _useConnection = mcuBridge.useConnection(),
|
|
@@ -101,19 +103,22 @@ var ArduinoBridgeProvider = function ArduinoBridgeProvider(_ref) {
|
|
|
101
103
|
var isOpen = _ref4.isOpen,
|
|
102
104
|
close = _ref4.close,
|
|
103
105
|
unmount = _ref4.unmount;
|
|
104
|
-
return jsxRuntime.jsx(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
return jsxRuntime.jsx(intl.RawEliceIntlProvider, {
|
|
107
|
+
value: intl$1,
|
|
108
|
+
children: jsxRuntime.jsx(ArduinoConnectionPreflightDialog.default, {
|
|
109
|
+
open: isOpen,
|
|
110
|
+
intent: intent,
|
|
111
|
+
onClose: function onClose() {
|
|
112
|
+
return close(false);
|
|
113
|
+
},
|
|
114
|
+
onConfirm: function onConfirm() {
|
|
115
|
+
return close(true);
|
|
116
|
+
},
|
|
117
|
+
onTransitionExited: unmount,
|
|
118
|
+
onSaveDontShowAgain: function onSaveDontShowAgain() {
|
|
119
|
+
sessionStorage.setItem(PREFLIGHT_DISMISS_KEY, PREFLIGHT_DISMISS_VALUE);
|
|
120
|
+
}
|
|
121
|
+
})
|
|
117
122
|
});
|
|
118
123
|
});
|
|
119
124
|
case 2:
|
|
@@ -131,7 +136,7 @@ var ArduinoBridgeProvider = function ArduinoBridgeProvider(_ref) {
|
|
|
131
136
|
return function (_x) {
|
|
132
137
|
return _ref2.apply(this, arguments);
|
|
133
138
|
};
|
|
134
|
-
}(), []);
|
|
139
|
+
}(), [intl$1]);
|
|
135
140
|
//
|
|
136
141
|
// setup the MCU Bridge once on mount
|
|
137
142
|
//
|
|
@@ -7,7 +7,7 @@ import { base } from '@elice/design-tokens';
|
|
|
7
7
|
import { eilClassroom } from '@elice/icons';
|
|
8
8
|
import { IntlComponentBuilder, RawEliceIntlProvider } from '@elice/intl';
|
|
9
9
|
import { withForwardRefMaterial } from '@elice/material-shared-utils';
|
|
10
|
-
import { useRecoilValue } from 'recoil';
|
|
10
|
+
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
|
11
11
|
import { MATERIAL_RESIZABLE_COMMON_PROPS, MATERIAL_DIVIDER_BORDER_VALUE } from '../../constants/stylesheets.js';
|
|
12
12
|
import ExerciseProvider from './context/ExerciseProvider.js';
|
|
13
13
|
import messageEn from '../locales/en.json.js';
|
|
@@ -22,7 +22,7 @@ import ExerciseMultilangDropdownLazy from './exercise-multilang-dropdown/Exercis
|
|
|
22
22
|
import ExerciseMenu from './exercise-menu/ExerciseMenu.js';
|
|
23
23
|
import ExerciseFile from './exercise-file/ExerciseFile.js';
|
|
24
24
|
import { ExerciseContext } from './context/context.js';
|
|
25
|
-
import { exerciseContainerSizeState, exerciseState, exerciseFileTreeOpenedState, exercisePreviewTypeState, exercisePreviewDisplayModeState, exerciseMonacoEditorApisState } from './context/recoil.js';
|
|
25
|
+
import { exerciseContainerSizeState, exerciseState, exerciseFileTreeOpenedState, exercisePreviewTypeState, exercisePreviewDisplayModeState, exerciseMonacoEditorApisState, exerciseActiveFilenameState } from './context/recoil.js';
|
|
26
26
|
import { exerciseRunnerRoomsOpen$, exerciseRunnerTextSend$ } from './context/subjects.js';
|
|
27
27
|
import { ExercisePreviewType, ExercisePreviewDisplayMode } from './context/recoilTypes.js';
|
|
28
28
|
|
|
@@ -138,6 +138,7 @@ var MaterialExercise = forwardRef(function (props, ref) {
|
|
|
138
138
|
var exercisePreviewType = useRecoilValue(exercisePreviewTypeState(props.materialExerciseId));
|
|
139
139
|
var exercisePreviewDisplayMode = useRecoilValue(exercisePreviewDisplayModeState);
|
|
140
140
|
var exerciseMonacoEditorApis = useRecoilValue(exerciseMonacoEditorApisState);
|
|
141
|
+
var _setActiveFilename = useSetRecoilState(exerciseActiveFilenameState);
|
|
141
142
|
/**
|
|
142
143
|
* File tree
|
|
143
144
|
*/
|
|
@@ -275,9 +276,12 @@ var MaterialExercise = forwardRef(function (props, ref) {
|
|
|
275
276
|
},
|
|
276
277
|
openRunnerRooms: function openRunnerRooms() {
|
|
277
278
|
return exerciseRunnerRoomsOpen$.next();
|
|
279
|
+
},
|
|
280
|
+
setActiveFilename: function setActiveFilename(filename) {
|
|
281
|
+
return _setActiveFilename(filename);
|
|
278
282
|
}
|
|
279
283
|
};
|
|
280
|
-
}, [exerciseMonacoEditorApis]);
|
|
284
|
+
}, [exerciseMonacoEditorApis, _setActiveFilename]);
|
|
281
285
|
//
|
|
282
286
|
//
|
|
283
287
|
//
|
|
@@ -131,6 +131,15 @@ var ExerciseProvider = function ExerciseProvider(_a) {
|
|
|
131
131
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132
132
|
[width, height]);
|
|
133
133
|
//
|
|
134
|
+
// forward active filename changes to host
|
|
135
|
+
//
|
|
136
|
+
React.useEffect(function () {
|
|
137
|
+
var _a;
|
|
138
|
+
(_a = contextProps.onActiveFilenameChange) === null || _a === void 0 ? void 0 : _a.call(contextProps, activeFilename);
|
|
139
|
+
},
|
|
140
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
|
+
[activeFilename]);
|
|
142
|
+
//
|
|
134
143
|
// update
|
|
135
144
|
//
|
|
136
145
|
React.useEffect(function () {
|
|
@@ -18,6 +18,7 @@ export interface MaterialExerciseCommonApis {
|
|
|
18
18
|
sendTextToRunner: MaterialExerciseCommonApiSendTextToTerminal;
|
|
19
19
|
getMonacoEditorApis: MaterialExerciseCommonApiGetMonacoEditorApis;
|
|
20
20
|
openRunnerRooms: MaterialExerciseCommonAPiOpenRunnerRooms;
|
|
21
|
+
setActiveFilename: MaterialExerciseCommonApiSetActiveFilename;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Send text to terminal.
|
|
@@ -31,6 +32,10 @@ export type MaterialExerciseCommonApiGetMonacoEditorApis = () => MonacoEditorApi
|
|
|
31
32
|
* Open runner rooms.
|
|
32
33
|
*/
|
|
33
34
|
export type MaterialExerciseCommonAPiOpenRunnerRooms = () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Set the currently active file in the editor.
|
|
37
|
+
*/
|
|
38
|
+
export type MaterialExerciseCommonApiSetActiveFilename = (filename: string) => void;
|
|
34
39
|
/**
|
|
35
40
|
* [External]
|
|
36
41
|
* Common exposed props for `MaterialExercise*` components.
|
|
@@ -64,6 +69,7 @@ export interface MaterialExerciseCommonProps {
|
|
|
64
69
|
onReferenceDocsToggle?: () => void;
|
|
65
70
|
onCodeHelpRequest?: MaterialExerciseCommonPropOnCodeHelpRequest;
|
|
66
71
|
onCodeEditorChange?: MaterialExerciseCommonPropOnCodeEditorChange;
|
|
72
|
+
onActiveFilenameChange?: MaterialExerciseCommonPropOnActiveFilenameChange;
|
|
67
73
|
onStdioError?: MaterialExerciseCommonPropOnStdioError;
|
|
68
74
|
onDefaultExerciseRoomIdSet?: MaterialExerciseCommonPropOnDefaultExerciseRoomIdSet;
|
|
69
75
|
onExerciseRoomIdChange?: MaterialExerciseCommonPropOnExerciseRoomIdChange;
|
|
@@ -94,6 +100,10 @@ export type MaterialExerciseCommonPropOnCodeEditorChange = (payload: {
|
|
|
94
100
|
content: string;
|
|
95
101
|
selectedContent: string;
|
|
96
102
|
}) => void;
|
|
103
|
+
/**
|
|
104
|
+
* On active file change.
|
|
105
|
+
*/
|
|
106
|
+
export type MaterialExerciseCommonPropOnActiveFilenameChange = (filename: string | null) => void;
|
|
97
107
|
/**
|
|
98
108
|
* On stdio error.
|
|
99
109
|
*/
|
|
@@ -28,13 +28,13 @@ var ArduinoConnectionPreflightDialogSteps = function ArduinoConnectionPreflightD
|
|
|
28
28
|
mx: 0.25,
|
|
29
29
|
borderRadius: 0.5,
|
|
30
30
|
bgcolor: function bgcolor(theme) {
|
|
31
|
-
return theme.palette.background.
|
|
31
|
+
return theme.palette.background.gray;
|
|
32
32
|
},
|
|
33
33
|
border: function border(theme) {
|
|
34
34
|
return "1px solid ".concat(theme.palette.divider);
|
|
35
35
|
},
|
|
36
36
|
color: function color(theme) {
|
|
37
|
-
return theme.palette.
|
|
37
|
+
return theme.palette.primary.main;
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
children: text
|
|
@@ -2,6 +2,7 @@ import { slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator,
|
|
|
2
2
|
import { __rest } from 'tslib';
|
|
3
3
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
|
+
import { useRawEliceIntl, RawEliceIntlProvider } from '@elice/intl';
|
|
5
6
|
import { useFlash, useConnection, setupMCUBridge, ArduinoUnoDriver, ArduinoMegaDriver } from '@elice/mcu-bridge';
|
|
6
7
|
import { overlay } from 'overlay-kit';
|
|
7
8
|
import { ArduinoBridgeContext } from './_context.js';
|
|
@@ -25,6 +26,7 @@ var ArduinoBridgeProvider = function ArduinoBridgeProvider(_ref) {
|
|
|
25
26
|
var xtermRef = _ref.xtermRef,
|
|
26
27
|
apiRef = _ref.apiRef,
|
|
27
28
|
children = _ref.children;
|
|
29
|
+
var intl = useRawEliceIntl();
|
|
28
30
|
var _useFlash = useFlash(),
|
|
29
31
|
isFlashing = _useFlash.isFlashing;
|
|
30
32
|
var _useConnection = useConnection(),
|
|
@@ -93,19 +95,22 @@ var ArduinoBridgeProvider = function ArduinoBridgeProvider(_ref) {
|
|
|
93
95
|
var isOpen = _ref4.isOpen,
|
|
94
96
|
close = _ref4.close,
|
|
95
97
|
unmount = _ref4.unmount;
|
|
96
|
-
return jsx(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
return jsx(RawEliceIntlProvider, {
|
|
99
|
+
value: intl,
|
|
100
|
+
children: jsx(ArduinoConnectionPreflightDialog, {
|
|
101
|
+
open: isOpen,
|
|
102
|
+
intent: intent,
|
|
103
|
+
onClose: function onClose() {
|
|
104
|
+
return close(false);
|
|
105
|
+
},
|
|
106
|
+
onConfirm: function onConfirm() {
|
|
107
|
+
return close(true);
|
|
108
|
+
},
|
|
109
|
+
onTransitionExited: unmount,
|
|
110
|
+
onSaveDontShowAgain: function onSaveDontShowAgain() {
|
|
111
|
+
sessionStorage.setItem(PREFLIGHT_DISMISS_KEY, PREFLIGHT_DISMISS_VALUE);
|
|
112
|
+
}
|
|
113
|
+
})
|
|
109
114
|
});
|
|
110
115
|
});
|
|
111
116
|
case 2:
|
|
@@ -123,7 +128,7 @@ var ArduinoBridgeProvider = function ArduinoBridgeProvider(_ref) {
|
|
|
123
128
|
return function (_x) {
|
|
124
129
|
return _ref2.apply(this, arguments);
|
|
125
130
|
};
|
|
126
|
-
}(), []);
|
|
131
|
+
}(), [intl]);
|
|
127
132
|
//
|
|
128
133
|
// setup the MCU Bridge once on mount
|
|
129
134
|
//
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-exercise",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.260517.0-codegenexercisecli.0",
|
|
4
4
|
"description": "User view and editing components of Elice material exercise",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"overlay-kit": "^1.8.0",
|
|
40
40
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
41
41
|
"react-use": "^17.0.0",
|
|
42
|
-
"@elice/material-shared-types": "1.
|
|
43
|
-
"@elice/material-shared-utils": "1.
|
|
42
|
+
"@elice/material-shared-types": "1.260517.0-codegenexercisecli.0",
|
|
43
|
+
"@elice/material-shared-utils": "1.260517.0-codegenexercisecli.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@novnc/novnc": "^1.3.0",
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
"rollup": "^4.0.0",
|
|
116
116
|
"typescript": "~5.9.3",
|
|
117
117
|
"vite": "^4.4.9",
|
|
118
|
-
"@elice/material-shared-types": "1.
|
|
119
|
-
"@elice/material-shared-utils": "1.
|
|
118
|
+
"@elice/material-shared-types": "1.260517.0-codegenexercisecli.0",
|
|
119
|
+
"@elice/material-shared-utils": "1.260517.0-codegenexercisecli.0"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
122
|
"start": "run-s watch",
|