@elice/material-exercise 1.260515.1 → 1.260517.0-codegenexercisecli.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/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/index.d.ts +1 -1
- 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/index.d.ts +1 -1
- 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
|
|
@@ -2,4 +2,4 @@ export { default as MaterialExercise } from './MaterialExercise';
|
|
|
2
2
|
export type { MaterialExerciseProps, MaterialExerciseApis } from './MaterialExercise';
|
|
3
3
|
export { default as MaterialExerciseMobile } from './MaterialExerciseMobile';
|
|
4
4
|
export type { MaterialExerciseMobileProps } from './MaterialExerciseMobile';
|
|
5
|
-
export type { MaterialExerciseCommonApis, MaterialExerciseCommonApiSendTextToTerminal, MaterialExerciseCommonProps, MaterialExerciseCommonPropExerciseImageEmptyOptions, MaterialExerciseCommonPropOnCodeHelpRequest, MaterialExerciseCommonPropOnCodeEditorChange, MaterialExerciseCommonPropOnStdioError, MaterialExerciseCommonPropOnDefaultExerciseRoomIdSet, MaterialExerciseCommonPropOnExerciseRoomIdChange, MaterialExerciseCommonPropOnRunningDone, MaterialExerciseCommonPropOnSubmit, MaterialExerciseCommonPropOnError, } from './context/types';
|
|
5
|
+
export type { MaterialExerciseCommonApis, MaterialExerciseCommonApiSendTextToTerminal, MaterialExerciseCommonProps, MaterialExerciseCommonPropExerciseImageEmptyOptions, MaterialExerciseCommonPropOnActiveFilenameChange, MaterialExerciseCommonPropOnCodeHelpRequest, MaterialExerciseCommonPropOnCodeEditorChange, MaterialExerciseCommonPropOnStdioError, MaterialExerciseCommonPropOnDefaultExerciseRoomIdSet, MaterialExerciseCommonPropOnExerciseRoomIdChange, MaterialExerciseCommonPropOnRunningDone, MaterialExerciseCommonPropOnSubmit, MaterialExerciseCommonPropOnError, } from './context/types';
|
|
@@ -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,4 +2,4 @@ export { default as MaterialExercise } from './MaterialExercise';
|
|
|
2
2
|
export type { MaterialExerciseProps, MaterialExerciseApis } from './MaterialExercise';
|
|
3
3
|
export { default as MaterialExerciseMobile } from './MaterialExerciseMobile';
|
|
4
4
|
export type { MaterialExerciseMobileProps } from './MaterialExerciseMobile';
|
|
5
|
-
export type { MaterialExerciseCommonApis, MaterialExerciseCommonApiSendTextToTerminal, MaterialExerciseCommonProps, MaterialExerciseCommonPropExerciseImageEmptyOptions, MaterialExerciseCommonPropOnCodeHelpRequest, MaterialExerciseCommonPropOnCodeEditorChange, MaterialExerciseCommonPropOnStdioError, MaterialExerciseCommonPropOnDefaultExerciseRoomIdSet, MaterialExerciseCommonPropOnExerciseRoomIdChange, MaterialExerciseCommonPropOnRunningDone, MaterialExerciseCommonPropOnSubmit, MaterialExerciseCommonPropOnError, } from './context/types';
|
|
5
|
+
export type { MaterialExerciseCommonApis, MaterialExerciseCommonApiSendTextToTerminal, MaterialExerciseCommonProps, MaterialExerciseCommonPropExerciseImageEmptyOptions, MaterialExerciseCommonPropOnActiveFilenameChange, MaterialExerciseCommonPropOnCodeHelpRequest, MaterialExerciseCommonPropOnCodeEditorChange, MaterialExerciseCommonPropOnStdioError, MaterialExerciseCommonPropOnDefaultExerciseRoomIdSet, MaterialExerciseCommonPropOnExerciseRoomIdChange, MaterialExerciseCommonPropOnRunningDone, MaterialExerciseCommonPropOnSubmit, MaterialExerciseCommonPropOnError, } from './context/types';
|
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.1",
|
|
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-
|
|
43
|
-
"@elice/material-shared-
|
|
42
|
+
"@elice/material-shared-types": "1.260517.0-codegenexercisecli.1",
|
|
43
|
+
"@elice/material-shared-utils": "1.260517.0-codegenexercisecli.1"
|
|
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-
|
|
119
|
-
"@elice/material-shared-
|
|
118
|
+
"@elice/material-shared-types": "1.260517.0-codegenexercisecli.1",
|
|
119
|
+
"@elice/material-shared-utils": "1.260517.0-codegenexercisecli.1"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
122
|
"start": "run-s watch",
|