@elice/material-exercise 1.240718.0-trasncript.2 → 1.240718.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/assets/empty.png.js +2 -1
- package/cjs/components/material-exercise/MaterialExercise.d.ts +1 -1
- package/cjs/components/material-exercise/MaterialExercise.js +75 -111
- package/cjs/components/material-exercise/MaterialExercise.styled.js +14 -18
- package/cjs/components/material-exercise/MaterialExerciseMobile.d.ts +1 -1
- package/cjs/components/material-exercise/MaterialExerciseMobile.js +7 -17
- package/cjs/components/material-exercise/context/ExerciseProvider.js +58 -68
- package/cjs/components/material-exercise/context/ExerciseProviderNoImage.js +30 -39
- package/cjs/components/material-exercise/context/context.js +1 -5
- package/cjs/components/material-exercise/context/recoil.js +293 -542
- package/cjs/components/material-exercise/context/subjects.js +4 -4
- package/cjs/components/material-exercise/context/types.d.ts +2 -2
- package/cjs/components/material-exercise/exercise-code-history/ExerciseCodeHistory.js +78 -100
- package/cjs/components/material-exercise/exercise-code-history/ExerciseCodeHistory.styled.js +8 -12
- package/cjs/components/material-exercise/exercise-file/ExerciseFile.js +27 -30
- package/cjs/components/material-exercise/exercise-file-editor/ExerciseFileEditor.js +149 -225
- package/cjs/components/material-exercise/exercise-file-editor/ExerciseFileReadOnlyBanner.js +13 -20
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabs.js +29 -49
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.d.ts +2 -1
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.js +4 -10
- package/cjs/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/ExerciseFileTabsFileTreeButton.js +36 -53
- package/cjs/components/material-exercise/exercise-file-tree/ExerciseFileTree.js +211 -353
- package/cjs/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.d.ts +2 -1
- package/cjs/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.js +4 -10
- package/cjs/components/material-exercise/exercise-file-viewer/ExerciseFileViewer.js +15 -18
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenu.js +12 -21
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +11 -12
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +80 -123
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuDropdown.js +67 -100
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuReset.js +22 -40
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.js +117 -144
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +13 -17
- package/cjs/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdown.js +19 -32
- package/cjs/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.d.ts +2 -1
- package/cjs/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.js +4 -10
- package/cjs/components/material-exercise/exercise-preview/ExercisePreview.js +24 -31
- package/cjs/components/material-exercise/exercise-preview/ExercisePreviewDisplayModeButton.js +6 -13
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpane.js +35 -51
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpaneEditorPerference.js +6 -14
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpaneEnvironment.js +78 -90
- package/cjs/components/material-exercise/exercise-room/ExerciseRoom.js +12 -25
- package/cjs/components/material-exercise/exercise-room/ExerciseRoom.styled.js +12 -18
- package/cjs/components/material-exercise/exercise-room/ExerciseRoomDetail.js +349 -504
- package/cjs/components/material-exercise/exercise-room/ExerciseRoomList.js +132 -197
- package/cjs/components/material-exercise/exercise-room/helpers/exerciseRoomPermissionStringConvertor.js +2 -2
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunner.js +142 -205
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerContext.js +1 -5
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerController.js +16 -25
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +86 -118
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +19 -33
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +82 -95
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +52 -68
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js +87 -136
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusIndicator.js +2 -6
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusMessage.js +15 -21
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerTimer.js +23 -36
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.js +248 -402
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.styled.js +8 -12
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistoryOutput.js +50 -74
- package/cjs/components/shared/exercise-menu-button/ExerciseMenuButton.js +23 -32
- package/cjs/components/shared/exercise-shimmer/ExerciseFileShimmer.js +38 -44
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTabShimmer.js +20 -26
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTabsShimmer.js +8 -14
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTreeListItemShimmer.js +22 -28
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTreeListShimmer.js +9 -24
- package/cjs/components/shared/exercise-version-list/ExerciseVersionList.js +5 -6
- package/cjs/components/shared/exercise-version-list/ExerciseVersionList.styled.js +1 -5
- package/cjs/components/shared/exercise-version-list/ExerciseVersionListItem.js +10 -10
- package/cjs/components/shared/exercise-version-list/ExerciseVersionListItem.styled.js +5 -13
- package/cjs/components/shared/file-icon/FileIcon.js +16 -23
- package/cjs/components/shared/file-tabs/FileTab.js +33 -47
- package/cjs/components/shared/file-tabs/FileTab.styled.js +15 -23
- package/cjs/components/shared/file-tabs/FileTabs.js +39 -66
- package/cjs/components/shared/file-tabs/FileTabs.styled.js +2 -6
- package/cjs/components/shared/file-tabs/util.js +14 -27
- package/cjs/components/shared/file-tree/FileTree.js +10 -20
- package/cjs/components/shared/file-tree/FileTreeConfig.js +40 -46
- package/cjs/components/shared/file-tree/FileTreeList.js +40 -43
- package/cjs/components/shared/file-tree/FileTreeListItemContent.js +99 -128
- package/cjs/components/shared/file-tree/FileTreeListItemContent.styled.js +21 -29
- package/cjs/components/shared/file-tree/FileTreeListItemContentInput.js +96 -106
- package/cjs/components/shared/file-tree/FileTreeListItemContentInput.styled.js +6 -10
- package/cjs/components/shared/file-tree/FileTreeListItemContentMenu.js +91 -133
- package/cjs/components/shared/file-tree/FileTreeListItems.js +137 -149
- package/cjs/components/shared/file-tree/FileTreeListItems.styled.js +2 -6
- package/cjs/components/shared/file-tree/FileTreeToolbar.styled.js +1 -5
- package/cjs/components/shared/file-tree/context/FileTreeContext.d.ts +1 -1
- package/cjs/components/shared/file-tree/context/FileTreeContext.js +79 -101
- package/cjs/components/shared/file-tree/file-tree-toolbar/FileTreeToolbar.js +54 -59
- package/cjs/components/shared/file-tree/utils/fileTreeFiles.js +20 -24
- package/cjs/components/shared/file-tree/utils/fileTreeGenerator.js +146 -193
- package/cjs/components/shared/file-tree/utils/fileTreeInput.js +0 -11
- package/cjs/components/shared/file-tree/utils/fileTreeItem.js +1 -1
- package/cjs/components/shared/file-tree/utils/fileTreePath.js +6 -5
- package/cjs/components/shared/file-viewer/FileViewer.js +46 -76
- package/cjs/components/shared/file-viewer/FileViewerCsv.js +167 -262
- package/cjs/components/shared/file-viewer/FileViewerImage.js +12 -16
- package/cjs/components/shared/file-viewer/FileViewerIpynb.js +11 -27
- package/cjs/components/shared/file-viewer/FileViewerNonViewable.js +47 -65
- package/cjs/components/shared/file-viewer/FileViewerText.js +11 -23
- package/cjs/components/shared/material-modal/MaterialModal.js +11 -20
- package/cjs/components/shared/material-modal/MaterialModal.styled.js +5 -9
- package/cjs/components/shared/monaco-editor/MonacoEditor.js +74 -102
- package/cjs/components/shared/monaco-editor/MonacoEditorLazy.js +7 -15
- package/cjs/components/shared/monaco-editor/MonacoEditorMobile.js +34 -49
- package/cjs/components/shared/monaco-editor/MonacoEditorPerferenceForm.js +194 -249
- package/cjs/components/shared/monaco-editor/constants/grammars/index.js +28 -82
- package/cjs/components/shared/monaco-editor/constants/monaco/preferences.js +5 -5
- package/cjs/components/shared/monaco-editor/constants/themes/index.js +17 -49
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventChange.js +10 -11
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventCursor.js +14 -15
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventScroll.js +8 -9
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoMarkers.js +30 -34
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoOptions.js +7 -9
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoTheme.js +6 -6
- package/cjs/components/shared/monaco-editor/editor-languages/css/formatter.js +10 -33
- package/cjs/components/shared/monaco-editor/editor-languages/css/index.js +2 -3
- package/cjs/components/shared/monaco-editor/editor-languages/html/formatter.js +10 -33
- package/cjs/components/shared/monaco-editor/editor-languages/html/index.js +2 -3
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/dts/_helper.js +1 -1
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/formatter.js +10 -37
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/index.js +5 -6
- package/cjs/components/shared/monaco-editor/hooks/useEditorOptions.js +5 -11
- package/cjs/components/shared/monaco-editor/utils/emmet/abbreviationActions.js +12 -10
- package/cjs/components/shared/monaco-editor/utils/emmet/registerProvider.js +6 -12
- package/cjs/components/shared/monaco-editor/utils/grammar/index.js +24 -67
- package/cjs/components/shared/monaco-editor/utils/grammar/onigasm.js +6 -25
- package/cjs/components/shared/monaco-editor/utils/grammar/textmate.js +37 -70
- package/cjs/components/shared/monaco-editor/utils/monacoLanguage.js +7 -8
- package/cjs/components/shared/monaco-editor/utils/monacoPreference.js +4 -6
- package/cjs/components/shared/monaco-editor/utils/prettier/config.js +2 -2
- package/cjs/components/shared/monaco-editor/utils/prettier/index.js +7 -27
- package/cjs/components/shared/monaco-editor/utils/theme/convert.js +14 -24
- package/cjs/components/shared/monaco-editor/utils/theme/index.js +3 -22
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursor.js +56 -77
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorManager.js +68 -82
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorWidget.js +93 -120
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelection.js +132 -155
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelectionManager.js +92 -104
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/styles.js +2 -2
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/configCompat.js +6 -1
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/data.js +2 -2
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/emmetHelper.js +158 -177
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/utils.js +3 -3
- package/cjs/components/shared/no-vnc/NoVnc.js +78 -118
- package/cjs/components/shared/no-vnc/NoVncLazy.js +7 -15
- package/cjs/components/shared/preview-container/PreviewContainer.js +13 -18
- package/cjs/components/shared/web-browser/WebBrowser.js +52 -74
- package/cjs/components/shared/xterm/Xterm.js +57 -82
- package/cjs/components/shared/xterm/XtermLazy.js +7 -15
- package/cjs/constants/arduino.js +10 -10
- package/cjs/constants/color.js +1 -1
- package/cjs/constants/shortcutKeyMap.js +1 -3
- package/cjs/constants/stylesheets.js +5 -7
- package/cjs/hooks/useArduino.js +141 -282
- package/cjs/hooks/useExerciseFile.js +22 -24
- package/cjs/hooks/useExericseShortcut.js +4 -6
- package/cjs/hooks/useMaterialExerciseFileUrl.js +33 -55
- package/cjs/hooks/useRunnerRoomWebSocket.js +27 -51
- package/cjs/hooks/useStdioTextConcator.js +11 -15
- package/cjs/hooks/useStdioWebSocket.js +28 -32
- package/cjs/hooks/useUsercodeEditWebSocket.js +158 -238
- package/cjs/hooks/useUsercodeHistory.js +63 -115
- package/cjs/utils/arduino.js +11 -23
- package/cjs/utils/exerciseFile.js +10 -8
- package/cjs/utils/runner.js +17 -33
- package/es/assets/empty.png.js +2 -1
- package/es/components/material-exercise/MaterialExercise.d.ts +1 -1
- package/es/components/material-exercise/MaterialExercise.js +75 -107
- package/es/components/material-exercise/MaterialExercise.styled.js +14 -14
- package/es/components/material-exercise/MaterialExerciseMobile.d.ts +1 -1
- package/es/components/material-exercise/MaterialExerciseMobile.js +7 -13
- package/es/components/material-exercise/context/ExerciseProvider.js +58 -63
- package/es/components/material-exercise/context/ExerciseProviderNoImage.js +30 -35
- package/es/components/material-exercise/context/context.js +1 -1
- package/es/components/material-exercise/context/recoil.js +290 -535
- package/es/components/material-exercise/context/subjects.js +4 -4
- package/es/components/material-exercise/context/types.d.ts +2 -2
- package/es/components/material-exercise/exercise-code-history/ExerciseCodeHistory.js +78 -95
- package/es/components/material-exercise/exercise-code-history/ExerciseCodeHistory.styled.js +8 -8
- package/es/components/material-exercise/exercise-file/ExerciseFile.js +27 -25
- package/es/components/material-exercise/exercise-file-editor/ExerciseFileEditor.js +149 -221
- package/es/components/material-exercise/exercise-file-editor/ExerciseFileReadOnlyBanner.js +13 -15
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabs.js +29 -44
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.d.ts +2 -1
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.js +4 -6
- package/es/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/ExerciseFileTabsFileTreeButton.js +36 -48
- package/es/components/material-exercise/exercise-file-tree/ExerciseFileTree.js +211 -348
- package/es/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.d.ts +2 -1
- package/es/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.js +4 -6
- package/es/components/material-exercise/exercise-file-viewer/ExerciseFileViewer.js +15 -14
- package/es/components/material-exercise/exercise-menu/ExerciseMenu.js +12 -16
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +11 -12
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +80 -119
- package/es/components/material-exercise/exercise-menu/ExerciseMenuDropdown.js +67 -96
- package/es/components/material-exercise/exercise-menu/ExerciseMenuReset.js +23 -41
- package/es/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.js +120 -143
- package/es/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +13 -13
- package/es/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdown.js +19 -28
- package/es/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.d.ts +2 -1
- package/es/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.js +4 -6
- package/es/components/material-exercise/exercise-preview/ExercisePreview.js +24 -26
- package/es/components/material-exercise/exercise-preview/ExercisePreviewDisplayModeButton.js +7 -14
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpane.js +35 -47
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpaneEditorPerference.js +6 -10
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpaneEnvironment.js +78 -85
- package/es/components/material-exercise/exercise-room/ExerciseRoom.js +12 -21
- package/es/components/material-exercise/exercise-room/ExerciseRoom.styled.js +12 -14
- package/es/components/material-exercise/exercise-room/ExerciseRoomDetail.js +349 -498
- package/es/components/material-exercise/exercise-room/ExerciseRoomList.js +133 -193
- package/es/components/material-exercise/exercise-room/helpers/exerciseRoomPermissionStringConvertor.js +2 -2
- package/es/components/material-exercise/exercise-runner/ExerciseRunner.js +142 -200
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerContext.js +1 -1
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerController.js +16 -20
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +85 -112
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +20 -30
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +82 -90
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +52 -63
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js +87 -131
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusIndicator.js +2 -2
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusMessage.js +15 -17
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerTimer.js +23 -31
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.js +250 -399
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.styled.js +8 -8
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistoryOutput.js +49 -68
- package/es/components/shared/exercise-menu-button/ExerciseMenuButton.js +24 -29
- package/es/components/shared/exercise-shimmer/ExerciseFileShimmer.js +38 -40
- package/es/components/shared/exercise-shimmer/ExerciseFileTabShimmer.js +20 -22
- package/es/components/shared/exercise-shimmer/ExerciseFileTabsShimmer.js +8 -10
- package/es/components/shared/exercise-shimmer/ExerciseFileTreeListItemShimmer.js +22 -24
- package/es/components/shared/exercise-shimmer/ExerciseFileTreeListShimmer.js +9 -19
- package/es/components/shared/exercise-version-list/ExerciseVersionList.js +5 -6
- package/es/components/shared/exercise-version-list/ExerciseVersionList.styled.js +1 -1
- package/es/components/shared/exercise-version-list/ExerciseVersionListItem.js +10 -10
- package/es/components/shared/exercise-version-list/ExerciseVersionListItem.styled.js +5 -9
- package/es/components/shared/file-icon/FileIcon.js +16 -19
- package/es/components/shared/file-tabs/FileTab.js +33 -43
- package/es/components/shared/file-tabs/FileTab.styled.js +15 -19
- package/es/components/shared/file-tabs/FileTabs.js +40 -62
- package/es/components/shared/file-tabs/FileTabs.styled.js +2 -2
- package/es/components/shared/file-tabs/util.js +14 -27
- package/es/components/shared/file-tree/FileTree.js +10 -16
- package/es/components/shared/file-tree/FileTreeConfig.js +39 -39
- package/es/components/shared/file-tree/FileTreeList.js +40 -38
- package/es/components/shared/file-tree/FileTreeListItemContent.js +99 -124
- package/es/components/shared/file-tree/FileTreeListItemContent.styled.js +21 -25
- package/es/components/shared/file-tree/FileTreeListItemContentInput.js +96 -102
- package/es/components/shared/file-tree/FileTreeListItemContentInput.styled.js +6 -6
- package/es/components/shared/file-tree/FileTreeListItemContentMenu.js +91 -129
- package/es/components/shared/file-tree/FileTreeListItems.js +137 -149
- package/es/components/shared/file-tree/FileTreeListItems.styled.js +2 -2
- package/es/components/shared/file-tree/FileTreeToolbar.styled.js +1 -1
- package/es/components/shared/file-tree/context/FileTreeContext.d.ts +1 -1
- package/es/components/shared/file-tree/context/FileTreeContext.js +79 -97
- package/es/components/shared/file-tree/file-tree-toolbar/FileTreeToolbar.js +54 -55
- package/es/components/shared/file-tree/utils/fileTreeFiles.js +20 -20
- package/es/components/shared/file-tree/utils/fileTreeGenerator.js +146 -193
- package/es/components/shared/file-tree/utils/fileTreeInput.js +1 -11
- package/es/components/shared/file-tree/utils/fileTreeItem.js +1 -1
- package/es/components/shared/file-tree/utils/fileTreePath.js +6 -5
- package/es/components/shared/file-viewer/FileViewer.js +46 -69
- package/es/components/shared/file-viewer/FileViewerCsv.js +167 -257
- package/es/components/shared/file-viewer/FileViewerImage.js +12 -12
- package/es/components/shared/file-viewer/FileViewerIpynb.js +11 -21
- package/es/components/shared/file-viewer/FileViewerNonViewable.js +47 -60
- package/es/components/shared/file-viewer/FileViewerText.js +11 -19
- package/es/components/shared/material-modal/MaterialModal.js +11 -20
- package/es/components/shared/material-modal/MaterialModal.styled.js +5 -5
- package/es/components/shared/monaco-editor/MonacoEditor.js +72 -95
- package/es/components/shared/monaco-editor/MonacoEditorLazy.js +7 -11
- package/es/components/shared/monaco-editor/MonacoEditorMobile.js +32 -43
- package/es/components/shared/monaco-editor/MonacoEditorPerferenceForm.js +194 -244
- package/es/components/shared/monaco-editor/constants/grammars/index.js +28 -82
- package/es/components/shared/monaco-editor/constants/monaco/preferences.js +5 -5
- package/es/components/shared/monaco-editor/constants/themes/index.js +17 -49
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventChange.js +10 -11
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventCursor.js +14 -15
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventScroll.js +8 -9
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoMarkers.js +30 -34
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoOptions.js +7 -9
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoTheme.js +6 -6
- package/es/components/shared/monaco-editor/editor-languages/css/formatter.js +10 -33
- package/es/components/shared/monaco-editor/editor-languages/html/formatter.js +10 -33
- package/es/components/shared/monaco-editor/editor-languages/typescript/dts/_helper.js +1 -1
- package/es/components/shared/monaco-editor/editor-languages/typescript/formatter.js +10 -37
- package/es/components/shared/monaco-editor/editor-languages/typescript/index.js +3 -3
- package/es/components/shared/monaco-editor/hooks/useEditorOptions.js +5 -11
- package/es/components/shared/monaco-editor/utils/emmet/abbreviationActions.js +12 -10
- package/es/components/shared/monaco-editor/utils/emmet/registerProvider.js +6 -12
- package/es/components/shared/monaco-editor/utils/grammar/index.js +24 -67
- package/es/components/shared/monaco-editor/utils/grammar/onigasm.js +6 -25
- package/es/components/shared/monaco-editor/utils/grammar/textmate.js +35 -67
- package/es/components/shared/monaco-editor/utils/monacoLanguage.js +5 -5
- package/es/components/shared/monaco-editor/utils/monacoPreference.js +4 -6
- package/es/components/shared/monaco-editor/utils/prettier/config.js +2 -2
- package/es/components/shared/monaco-editor/utils/prettier/index.js +7 -27
- package/es/components/shared/monaco-editor/utils/theme/convert.js +13 -19
- package/es/components/shared/monaco-editor/utils/theme/index.js +3 -22
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursor.js +56 -77
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorManager.js +68 -82
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorWidget.js +93 -120
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelection.js +130 -152
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelectionManager.js +92 -104
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/styles.js +2 -2
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/configCompat.js +6 -1
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/data.js +2 -2
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/emmetHelper.js +156 -171
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/utils.js +3 -3
- package/es/components/shared/no-vnc/NoVnc.js +71 -99
- package/es/components/shared/no-vnc/NoVncLazy.js +7 -11
- package/es/components/shared/preview-container/PreviewContainer.js +14 -15
- package/es/components/shared/web-browser/WebBrowser.js +52 -69
- package/es/components/shared/xterm/Xterm.js +57 -77
- package/es/components/shared/xterm/XtermLazy.js +7 -11
- package/es/constants/arduino.js +10 -10
- package/es/constants/color.js +1 -1
- package/es/constants/shortcutKeyMap.js +1 -3
- package/es/constants/stylesheets.js +5 -7
- package/es/hooks/useArduino.js +141 -278
- package/es/hooks/useExerciseFile.js +22 -24
- package/es/hooks/useExericseShortcut.js +4 -6
- package/es/hooks/useMaterialExerciseFileUrl.js +34 -52
- package/es/hooks/useRunnerRoomWebSocket.js +27 -51
- package/es/hooks/useStdioTextConcator.js +11 -11
- package/es/hooks/useStdioWebSocket.js +28 -32
- package/es/hooks/useUsercodeEditWebSocket.js +157 -232
- package/es/hooks/useUsercodeHistory.js +63 -115
- package/es/utils/arduino.js +12 -24
- package/es/utils/exerciseFile.js +10 -8
- package/es/utils/runner.js +17 -33
- package/package.json +15 -11
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -519
- package/cjs/components/index.js +0 -25
- package/cjs/components/locales/index.js +0 -13
- package/cjs/components/material-exercise/context/index.js +0 -57
- package/cjs/components/material-exercise/exercise-code-history/index.js +0 -7
- package/cjs/components/material-exercise/exercise-code-history/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file/index.js +0 -7
- package/cjs/components/material-exercise/exercise-file-editor/index.js +0 -7
- package/cjs/components/material-exercise/exercise-file-editor/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/index.js +0 -7
- package/cjs/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file-tabs/index.js +0 -9
- package/cjs/components/material-exercise/exercise-file-tabs/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file-tree/index.js +0 -9
- package/cjs/components/material-exercise/exercise-file-tree/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file-viewer/index.js +0 -7
- package/cjs/components/material-exercise/exercise-menu/index.js +0 -7
- package/cjs/components/material-exercise/exercise-menu/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-multilang-dropdown/index.js +0 -9
- package/cjs/components/material-exercise/exercise-preview/index.js +0 -7
- package/cjs/components/material-exercise/exercise-preview/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-rightpane/index.js +0 -7
- package/cjs/components/material-exercise/exercise-rightpane/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-room/helpers/index.js +0 -7
- package/cjs/components/material-exercise/exercise-room/index.js +0 -7
- package/cjs/components/material-exercise/exercise-room/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-runner/index.js +0 -7
- package/cjs/components/material-exercise/exercise-runner/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-submit-history/index.js +0 -7
- package/cjs/components/material-exercise/exercise-submit-history/locales/index.js +0 -13
- package/cjs/components/material-exercise/index.js +0 -9
- package/cjs/components/shared/exercise-menu-button/index.js +0 -7
- package/cjs/components/shared/exercise-shimmer/index.js +0 -15
- package/cjs/components/shared/exercise-version-list/index.js +0 -9
- package/cjs/components/shared/file-icon/index.js +0 -7
- package/cjs/components/shared/file-tabs/index.js +0 -7
- package/cjs/components/shared/file-tree/context/index.js +0 -9
- package/cjs/components/shared/file-tree/file-tree-toolbar/index.js +0 -7
- package/cjs/components/shared/file-tree/file-tree-toolbar/locales/index.js +0 -13
- package/cjs/components/shared/file-tree/index.js +0 -7
- package/cjs/components/shared/file-tree/locales/index.js +0 -13
- package/cjs/components/shared/file-tree/utils/index.js +0 -20
- package/cjs/components/shared/file-viewer/index.js +0 -7
- package/cjs/components/shared/file-viewer/locales/index.js +0 -21
- package/cjs/components/shared/material-modal/index.js +0 -7
- package/cjs/components/shared/monaco-editor/constants/index.js +0 -13
- package/cjs/components/shared/monaco-editor/constants/monaco/index.js +0 -11
- package/cjs/components/shared/monaco-editor/editor-hooks/index.js +0 -17
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/dts/index.js +0 -11
- package/cjs/components/shared/monaco-editor/hooks/index.js +0 -7
- package/cjs/components/shared/monaco-editor/index.js +0 -21
- package/cjs/components/shared/monaco-editor/locales/index.js +0 -13
- package/cjs/components/shared/monaco-editor/utils/emmet/index.js +0 -9
- package/cjs/components/shared/monaco-editor/utils/index.js +0 -9
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/index.js +0 -12
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/index.js +0 -11
- package/cjs/components/shared/no-vnc/index.js +0 -7
- package/cjs/components/shared/preview-container/index.js +0 -9
- package/cjs/components/shared/web-browser/index.js +0 -7
- package/cjs/components/shared/xterm/index.js +0 -7
- package/cjs/components/shared/xterm/locales/index.js +0 -13
- package/cjs/constants/index.js +0 -7
- package/cjs/hooks/index.js +0 -20
- package/cjs/utils/index.js +0 -10
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -499
- package/es/components/index.js +0 -8
- package/es/components/locales/index.js +0 -4
- package/es/components/material-exercise/context/index.js +0 -5
- package/es/components/material-exercise/exercise-code-history/index.js +0 -1
- package/es/components/material-exercise/exercise-code-history/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file/index.js +0 -1
- package/es/components/material-exercise/exercise-file-editor/index.js +0 -1
- package/es/components/material-exercise/exercise-file-editor/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/index.js +0 -1
- package/es/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file-tabs/index.js +0 -2
- package/es/components/material-exercise/exercise-file-tabs/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file-tree/index.js +0 -2
- package/es/components/material-exercise/exercise-file-tree/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file-viewer/index.js +0 -1
- package/es/components/material-exercise/exercise-menu/index.js +0 -1
- package/es/components/material-exercise/exercise-menu/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-multilang-dropdown/index.js +0 -2
- package/es/components/material-exercise/exercise-preview/index.js +0 -1
- package/es/components/material-exercise/exercise-preview/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-rightpane/index.js +0 -1
- package/es/components/material-exercise/exercise-rightpane/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-room/helpers/index.js +0 -1
- package/es/components/material-exercise/exercise-room/index.js +0 -1
- package/es/components/material-exercise/exercise-room/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-runner/index.js +0 -1
- package/es/components/material-exercise/exercise-runner/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-submit-history/index.js +0 -1
- package/es/components/material-exercise/exercise-submit-history/locales/index.js +0 -4
- package/es/components/material-exercise/index.js +0 -2
- package/es/components/shared/exercise-menu-button/index.js +0 -1
- package/es/components/shared/exercise-shimmer/index.js +0 -5
- package/es/components/shared/exercise-version-list/index.js +0 -2
- package/es/components/shared/file-icon/index.js +0 -1
- package/es/components/shared/file-tabs/index.js +0 -1
- package/es/components/shared/file-tree/context/index.js +0 -1
- package/es/components/shared/file-tree/file-tree-toolbar/index.js +0 -1
- package/es/components/shared/file-tree/file-tree-toolbar/locales/index.js +0 -4
- package/es/components/shared/file-tree/index.js +0 -1
- package/es/components/shared/file-tree/locales/index.js +0 -4
- package/es/components/shared/file-tree/utils/index.js +0 -5
- package/es/components/shared/file-viewer/index.js +0 -1
- package/es/components/shared/file-viewer/locales/index.js +0 -8
- package/es/components/shared/material-modal/index.js +0 -1
- package/es/components/shared/monaco-editor/constants/index.js +0 -2
- package/es/components/shared/monaco-editor/constants/monaco/index.js +0 -1
- package/es/components/shared/monaco-editor/editor-hooks/index.js +0 -6
- package/es/components/shared/monaco-editor/editor-languages/typescript/dts/index.js +0 -3
- package/es/components/shared/monaco-editor/hooks/index.js +0 -1
- package/es/components/shared/monaco-editor/index.js +0 -6
- package/es/components/shared/monaco-editor/locales/index.js +0 -4
- package/es/components/shared/monaco-editor/utils/emmet/index.js +0 -1
- package/es/components/shared/monaco-editor/utils/index.js +0 -2
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/index.js +0 -3
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/index.js +0 -2
- package/es/components/shared/no-vnc/index.js +0 -1
- package/es/components/shared/preview-container/index.js +0 -1
- package/es/components/shared/web-browser/index.js +0 -1
- package/es/components/shared/xterm/index.js +0 -1
- package/es/components/shared/xterm/locales/index.js +0 -4
- package/es/constants/index.js +0 -1
- package/es/hooks/index.js +0 -7
- package/es/utils/index.js +0 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
4
3
|
var apiClient = require('@elice/api-client');
|
|
5
4
|
var types = require('@elice/types');
|
|
6
5
|
var websocket = require('@elice/websocket');
|
|
@@ -14,218 +13,109 @@ var monacoPreference = require('../../shared/monaco-editor/utils/monacoPreferenc
|
|
|
14
13
|
var preferences = require('../../shared/monaco-editor/constants/monaco/preferences.js');
|
|
15
14
|
var recoilTypes = require('./recoilTypes.js');
|
|
16
15
|
|
|
17
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
18
|
-
|
|
19
|
-
var isEqual__default = /*#__PURE__*/_interopDefaultCompat(isEqual);
|
|
20
|
-
|
|
21
16
|
//
|
|
22
17
|
//
|
|
23
18
|
//
|
|
24
|
-
|
|
19
|
+
const KEY_PREFIX = 'MaterialExercise/Exercise/Global';
|
|
25
20
|
//
|
|
26
21
|
// =============== entities ===============
|
|
27
22
|
//
|
|
28
23
|
/**
|
|
29
24
|
* Lecture.
|
|
30
25
|
*/
|
|
31
|
-
|
|
32
|
-
key:
|
|
26
|
+
const exerciseLectureState = recoil.atomFamily({
|
|
27
|
+
key: `${KEY_PREFIX}/Lecture`,
|
|
33
28
|
default: null,
|
|
34
|
-
effects:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return apiClient.getOrgLectureGet({
|
|
54
|
-
lectureId: lectureId
|
|
55
|
-
}).then(function (res) {
|
|
56
|
-
return res.lecture;
|
|
57
|
-
}).catch(function () {
|
|
58
|
-
return null;
|
|
59
|
-
});
|
|
60
|
-
case 6:
|
|
61
|
-
_context.t1 = _context.sent;
|
|
62
|
-
(0, _context.t0)(_context.t1);
|
|
63
|
-
case 8:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
66
|
-
}
|
|
67
|
-
}, _callee);
|
|
68
|
-
}));
|
|
69
|
-
return function get() {
|
|
70
|
-
return _ref2.apply(this, arguments);
|
|
71
|
-
};
|
|
72
|
-
}();
|
|
73
|
-
if (trigger === 'get') {
|
|
29
|
+
effects: lectureId => [({
|
|
30
|
+
setSelf,
|
|
31
|
+
trigger,
|
|
32
|
+
onSet
|
|
33
|
+
}) => {
|
|
34
|
+
const get = async () => {
|
|
35
|
+
if (!lectureId) {
|
|
36
|
+
setSelf(null);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
setSelf(await apiClient.getOrgLectureGet({
|
|
40
|
+
lectureId: lectureId
|
|
41
|
+
}).then(res => res.lecture).catch(() => null));
|
|
42
|
+
};
|
|
43
|
+
if (trigger === 'get') {
|
|
44
|
+
void get();
|
|
45
|
+
}
|
|
46
|
+
onSet((_prevValue, _newValue, isReset) => {
|
|
47
|
+
if (isReset) {
|
|
74
48
|
void get();
|
|
75
49
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
void get();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}];
|
|
82
|
-
}
|
|
50
|
+
});
|
|
51
|
+
}]
|
|
83
52
|
});
|
|
84
53
|
/**
|
|
85
54
|
* Material exercise.
|
|
86
55
|
*/
|
|
87
|
-
|
|
88
|
-
key:
|
|
56
|
+
const exerciseState = recoil.atomFamily({
|
|
57
|
+
key: `${KEY_PREFIX}/Exercise`,
|
|
89
58
|
default: null,
|
|
90
|
-
effects:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
_lecturePageId: res.lecturePageId,
|
|
114
|
-
_orderNo: res.orderNo
|
|
115
|
-
};
|
|
116
|
-
}).catch(function (err) {
|
|
117
|
-
throw err;
|
|
118
|
-
})]);
|
|
119
|
-
}).then(function (_ref5) {
|
|
120
|
-
var _ref6 = _rollupPluginBabelHelpers.slicedToArray(_ref5, 2),
|
|
121
|
-
materialExercise = _ref6[0],
|
|
122
|
-
lecturePageResolve = _ref6[1];
|
|
123
|
-
return Object.assign(Object.assign({}, materialExercise), lecturePageResolve);
|
|
124
|
-
}).catch(function () {
|
|
125
|
-
return null;
|
|
126
|
-
});
|
|
127
|
-
case 3:
|
|
128
|
-
_context2.t1 = _context2.sent;
|
|
129
|
-
(0, _context2.t0)(_context2.t1);
|
|
130
|
-
case 5:
|
|
131
|
-
case "end":
|
|
132
|
-
return _context2.stop();
|
|
133
|
-
}
|
|
134
|
-
}, _callee2);
|
|
135
|
-
}));
|
|
136
|
-
return function get() {
|
|
137
|
-
return _ref4.apply(this, arguments);
|
|
138
|
-
};
|
|
139
|
-
}();
|
|
140
|
-
if (trigger === 'get') {
|
|
141
|
-
void get();
|
|
142
|
-
}
|
|
143
|
-
}];
|
|
144
|
-
}
|
|
59
|
+
effects: materialExerciseId => [({
|
|
60
|
+
setSelf,
|
|
61
|
+
trigger
|
|
62
|
+
}) => {
|
|
63
|
+
const get = async () => {
|
|
64
|
+
setSelf(await apiClient.getOrgMaterialExerciseGet({
|
|
65
|
+
materialExerciseId
|
|
66
|
+
}).then(res => res.materialExercise).then(materialExercise => Promise.all([materialExercise, apiClient.getOrgLecturePageResolve({
|
|
67
|
+
materialId: materialExercise.id,
|
|
68
|
+
materialType: types.enums.LectureMaterialType.Exercise
|
|
69
|
+
}).then(res => ({
|
|
70
|
+
_courseId: res.courseId,
|
|
71
|
+
_lectureId: res.lectureId,
|
|
72
|
+
_lecturePageId: res.lecturePageId,
|
|
73
|
+
_orderNo: res.orderNo
|
|
74
|
+
})).catch(err => {
|
|
75
|
+
throw err;
|
|
76
|
+
})])).then(([materialExercise, lecturePageResolve]) => Object.assign(Object.assign({}, materialExercise), lecturePageResolve)).catch(() => null));
|
|
77
|
+
};
|
|
78
|
+
if (trigger === 'get') {
|
|
79
|
+
void get();
|
|
80
|
+
}
|
|
81
|
+
}]
|
|
145
82
|
});
|
|
146
83
|
/**
|
|
147
84
|
* Material exercise room.
|
|
148
85
|
*/
|
|
149
|
-
|
|
150
|
-
key:
|
|
86
|
+
const exerciseRoomState = recoil.atomFamily({
|
|
87
|
+
key: `${KEY_PREFIX}/ExerciseRoom`,
|
|
151
88
|
default: null,
|
|
152
|
-
effects:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
160
|
-
case 0:
|
|
161
|
-
if (exerciseRoomId) {
|
|
162
|
-
_context3.next = 2;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
return _context3.abrupt("return", null);
|
|
166
|
-
case 2:
|
|
167
|
-
_context3.t0 = setSelf;
|
|
168
|
-
_context3.next = 5;
|
|
169
|
-
return apiClient.getOrgMaterialExerciseExerciseRoomGet({
|
|
170
|
-
exerciseRoomId: exerciseRoomId
|
|
171
|
-
}).then(function (res) {
|
|
172
|
-
return res.exerciseRoom;
|
|
173
|
-
}).catch(function () {
|
|
174
|
-
return null;
|
|
175
|
-
});
|
|
176
|
-
case 5:
|
|
177
|
-
_context3.t1 = _context3.sent;
|
|
178
|
-
(0, _context3.t0)(_context3.t1);
|
|
179
|
-
case 7:
|
|
180
|
-
case "end":
|
|
181
|
-
return _context3.stop();
|
|
182
|
-
}
|
|
183
|
-
}, _callee3);
|
|
184
|
-
}));
|
|
185
|
-
return function get() {
|
|
186
|
-
return _ref8.apply(this, arguments);
|
|
187
|
-
};
|
|
188
|
-
}();
|
|
189
|
-
if (trigger === 'get') {
|
|
190
|
-
void get();
|
|
89
|
+
effects: exerciseRoomId => [({
|
|
90
|
+
setSelf,
|
|
91
|
+
trigger
|
|
92
|
+
}) => {
|
|
93
|
+
const get = async () => {
|
|
94
|
+
if (!exerciseRoomId) {
|
|
95
|
+
return null;
|
|
191
96
|
}
|
|
192
|
-
|
|
193
|
-
|
|
97
|
+
setSelf(await apiClient.getOrgMaterialExerciseExerciseRoomGet({
|
|
98
|
+
exerciseRoomId
|
|
99
|
+
}).then(res => res.exerciseRoom).catch(() => null));
|
|
100
|
+
};
|
|
101
|
+
if (trigger === 'get') {
|
|
102
|
+
void get();
|
|
103
|
+
}
|
|
104
|
+
}]
|
|
194
105
|
});
|
|
195
106
|
/**
|
|
196
107
|
* User.
|
|
197
108
|
*/
|
|
198
|
-
|
|
199
|
-
key:
|
|
109
|
+
const exerciseUserState = recoil.atom({
|
|
110
|
+
key: `${KEY_PREFIX}/User`,
|
|
200
111
|
default: null,
|
|
201
|
-
effects: [
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
case 0:
|
|
209
|
-
_context4.t0 = setSelf;
|
|
210
|
-
_context4.next = 3;
|
|
211
|
-
return apiClient.getOrgUserGet().then(function (res) {
|
|
212
|
-
return res.user;
|
|
213
|
-
}).catch(function () {
|
|
214
|
-
return null;
|
|
215
|
-
});
|
|
216
|
-
case 3:
|
|
217
|
-
_context4.t1 = _context4.sent;
|
|
218
|
-
(0, _context4.t0)(_context4.t1);
|
|
219
|
-
case 5:
|
|
220
|
-
case "end":
|
|
221
|
-
return _context4.stop();
|
|
222
|
-
}
|
|
223
|
-
}, _callee4);
|
|
224
|
-
}));
|
|
225
|
-
return function get() {
|
|
226
|
-
return _ref10.apply(this, arguments);
|
|
227
|
-
};
|
|
228
|
-
}();
|
|
112
|
+
effects: [({
|
|
113
|
+
setSelf,
|
|
114
|
+
trigger
|
|
115
|
+
}) => {
|
|
116
|
+
const get = async () => {
|
|
117
|
+
setSelf(await apiClient.getOrgUserGet().then(res => res.user).catch(() => null));
|
|
118
|
+
};
|
|
229
119
|
if (trigger === 'get') {
|
|
230
120
|
void get();
|
|
231
121
|
}
|
|
@@ -237,44 +127,29 @@ var exerciseUserState = recoil.atom({
|
|
|
237
127
|
/**
|
|
238
128
|
*
|
|
239
129
|
*/
|
|
240
|
-
|
|
241
|
-
key:
|
|
130
|
+
const exerciseFileTabsOpenedState = recoil.atomFamily({
|
|
131
|
+
key: `${KEY_PREFIX}/FileTabs/Opened`,
|
|
242
132
|
default: recoil.selectorFamily({
|
|
243
|
-
key:
|
|
244
|
-
get:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
openFilelist = (_b = (_a = mulLang === null || mulLang === void 0 ? void 0 : mulLang[mulEnv === null || mulEnv === void 0 ? void 0 : mulEnv.language]) === null || _a === void 0 ? void 0 : _a.initialOpenFilelist) !== null && _b !== void 0 ? _b : [];
|
|
265
|
-
return _context5.abrupt("return", openFilelist);
|
|
266
|
-
case 9:
|
|
267
|
-
return _context5.abrupt("return", (_d = (_c = exercise === null || exercise === void 0 ? void 0 : exercise.readyExerciseImage) === null || _c === void 0 ? void 0 : _c.initialOpenFilelist) !== null && _d !== void 0 ? _d : []);
|
|
268
|
-
case 10:
|
|
269
|
-
case "end":
|
|
270
|
-
return _context5.stop();
|
|
271
|
-
}
|
|
272
|
-
}, _callee5);
|
|
273
|
-
}));
|
|
274
|
-
return function (_x) {
|
|
275
|
-
return _ref13.apply(this, arguments);
|
|
276
|
-
};
|
|
277
|
-
}();
|
|
133
|
+
key: `${KEY_PREFIX}}/FileTabs/Opened/Default`,
|
|
134
|
+
get: ({
|
|
135
|
+
materialExerciseId,
|
|
136
|
+
exerciseRoomId
|
|
137
|
+
}) => async ({
|
|
138
|
+
get
|
|
139
|
+
}) => {
|
|
140
|
+
var _a, _b, _c, _d;
|
|
141
|
+
const exercise = get(exerciseState(materialExerciseId));
|
|
142
|
+
const mulLang = get(exerciseMultilangLanguagesState(materialExerciseId));
|
|
143
|
+
const mulEnv = get(exerciseMultilangEnvironmentState({
|
|
144
|
+
materialExerciseId,
|
|
145
|
+
exerciseRoomId
|
|
146
|
+
}));
|
|
147
|
+
if ((exercise === null || exercise === void 0 ? void 0 : exercise.envType) === types.enums.ExerciseEnvType.MultiLanguage && mulLang && mulEnv) {
|
|
148
|
+
const openFilelist = (_b = (_a = mulLang === null || mulLang === void 0 ? void 0 : mulLang[mulEnv === null || mulEnv === void 0 ? void 0 : mulEnv.language]) === null || _a === void 0 ? void 0 : _a.initialOpenFilelist) !== null && _b !== void 0 ? _b : [];
|
|
149
|
+
return openFilelist;
|
|
150
|
+
} else {
|
|
151
|
+
return (_d = (_c = exercise === null || exercise === void 0 ? void 0 : exercise.readyExerciseImage) === null || _c === void 0 ? void 0 : _c.initialOpenFilelist) !== null && _d !== void 0 ? _d : [];
|
|
152
|
+
}
|
|
278
153
|
}
|
|
279
154
|
})
|
|
280
155
|
});
|
|
@@ -284,56 +159,35 @@ var exerciseFileTabsOpenedState = recoil.atomFamily({
|
|
|
284
159
|
/**
|
|
285
160
|
*
|
|
286
161
|
*/
|
|
287
|
-
|
|
288
|
-
key:
|
|
162
|
+
const exerciseFileTreeOpenedState = recoil.atom({
|
|
163
|
+
key: `${KEY_PREFIX}/FileTree/Opened`,
|
|
289
164
|
default: false
|
|
290
165
|
});
|
|
291
166
|
//
|
|
292
167
|
// =============== preference ===============
|
|
293
168
|
//
|
|
294
|
-
|
|
169
|
+
const EDITOR_ACCOUNT_PREFERENCE_PKEY_MONACO = 'material.exercise.editor.preference';
|
|
295
170
|
/**
|
|
296
171
|
* Editor preference.
|
|
297
172
|
*/
|
|
298
|
-
|
|
299
|
-
key:
|
|
173
|
+
const exerciseEditorPreferenceState = recoil.atom({
|
|
174
|
+
key: `${KEY_PREFIX}/EditorPreference`,
|
|
300
175
|
default: preferences.DEFAULT_MONACO_EDITOR_PREFERENCE,
|
|
301
|
-
effects: [
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
_context6.next = 3;
|
|
312
|
-
return apiClient.getGlobalAccountPreferenceGet({
|
|
313
|
-
pkey: EDITOR_ACCOUNT_PREFERENCE_PKEY_MONACO
|
|
314
|
-
}).then(function (res) {
|
|
315
|
-
return monacoPreference.normalizeMonacoPreference(res.pvalue);
|
|
316
|
-
}).catch(function () {
|
|
317
|
-
return preferences.DEFAULT_MONACO_EDITOR_PREFERENCE;
|
|
318
|
-
});
|
|
319
|
-
case 3:
|
|
320
|
-
_context6.t1 = _context6.sent;
|
|
321
|
-
(0, _context6.t0)(_context6.t1);
|
|
322
|
-
case 5:
|
|
323
|
-
case "end":
|
|
324
|
-
return _context6.stop();
|
|
325
|
-
}
|
|
326
|
-
}, _callee6);
|
|
327
|
-
}));
|
|
328
|
-
return function get() {
|
|
329
|
-
return _ref15.apply(this, arguments);
|
|
330
|
-
};
|
|
331
|
-
}();
|
|
176
|
+
effects: [({
|
|
177
|
+
setSelf,
|
|
178
|
+
trigger,
|
|
179
|
+
onSet
|
|
180
|
+
}) => {
|
|
181
|
+
const get = async () => {
|
|
182
|
+
setSelf(await apiClient.getGlobalAccountPreferenceGet({
|
|
183
|
+
pkey: EDITOR_ACCOUNT_PREFERENCE_PKEY_MONACO
|
|
184
|
+
}).then(res => monacoPreference.normalizeMonacoPreference(res.pvalue)).catch(() => preferences.DEFAULT_MONACO_EDITOR_PREFERENCE));
|
|
185
|
+
};
|
|
332
186
|
if (trigger === 'get') {
|
|
333
187
|
void get();
|
|
334
188
|
}
|
|
335
|
-
onSet(
|
|
336
|
-
if (!
|
|
189
|
+
onSet((newPreference, prevPreference, isReset) => {
|
|
190
|
+
if (!isEqual(newPreference, prevPreference) && !isReset) {
|
|
337
191
|
void apiClient.postGlobalAccountPreferenceEdit({
|
|
338
192
|
pkey: EDITOR_ACCOUNT_PREFERENCE_PKEY_MONACO,
|
|
339
193
|
pvalue: monacoPreference.normalizeMonacoPreference(newPreference)
|
|
@@ -345,70 +199,48 @@ var exerciseEditorPreferenceState = recoil.atom({
|
|
|
345
199
|
//
|
|
346
200
|
// =============== preview ===============
|
|
347
201
|
//
|
|
348
|
-
|
|
202
|
+
const EDITOR_ACCOUNT_PREFERENCE_PKEY_PREVIEW_MODE = 'material.exercise.preview.mode';
|
|
349
203
|
/**
|
|
350
204
|
*
|
|
351
205
|
*/
|
|
352
|
-
|
|
353
|
-
key:
|
|
354
|
-
get:
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
};
|
|
206
|
+
const exercisePreviewTypeState = recoil.selectorFamily({
|
|
207
|
+
key: `${KEY_PREFIX}/Preview/Type`,
|
|
208
|
+
get: materialExerciseId => ({
|
|
209
|
+
get
|
|
210
|
+
}) => {
|
|
211
|
+
const exercise = get(exerciseState(materialExerciseId));
|
|
212
|
+
const readyExerciseImage = exercise === null || exercise === void 0 ? void 0 : exercise.readyExerciseImage;
|
|
213
|
+
switch (true) {
|
|
214
|
+
case Boolean(readyExerciseImage === null || readyExerciseImage === void 0 ? void 0 : readyExerciseImage.isVnc):
|
|
215
|
+
return recoilTypes.ExercisePreviewType.NoVnc;
|
|
216
|
+
case Boolean(readyExerciseImage === null || readyExerciseImage === void 0 ? void 0 : readyExerciseImage.httpPort):
|
|
217
|
+
return recoilTypes.ExercisePreviewType.WebBrowser;
|
|
218
|
+
default:
|
|
219
|
+
return recoilTypes.ExercisePreviewType.None;
|
|
220
|
+
}
|
|
368
221
|
}
|
|
369
222
|
});
|
|
370
223
|
/**
|
|
371
224
|
*
|
|
372
225
|
*/
|
|
373
|
-
|
|
374
|
-
key:
|
|
226
|
+
const exercisePreviewDisplayModeState = recoil.atom({
|
|
227
|
+
key: `${KEY_PREFIX}/Preview/DisplayMode`,
|
|
375
228
|
default: recoilTypes.ExercisePreviewDisplayMode.Mini,
|
|
376
|
-
effects: [
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
_context7.next = 3;
|
|
387
|
-
return apiClient.getGlobalAccountPreferenceGet({
|
|
388
|
-
pkey: EDITOR_ACCOUNT_PREFERENCE_PKEY_PREVIEW_MODE
|
|
389
|
-
}).then(function (res) {
|
|
390
|
-
return Number(res.pvalue) || recoilTypes.ExercisePreviewDisplayMode.Mini;
|
|
391
|
-
}).catch(function () {
|
|
392
|
-
return recoilTypes.ExercisePreviewDisplayMode.Mini;
|
|
393
|
-
});
|
|
394
|
-
case 3:
|
|
395
|
-
_context7.t1 = _context7.sent;
|
|
396
|
-
(0, _context7.t0)(_context7.t1);
|
|
397
|
-
case 5:
|
|
398
|
-
case "end":
|
|
399
|
-
return _context7.stop();
|
|
400
|
-
}
|
|
401
|
-
}, _callee7);
|
|
402
|
-
}));
|
|
403
|
-
return function get() {
|
|
404
|
-
return _ref18.apply(this, arguments);
|
|
405
|
-
};
|
|
406
|
-
}();
|
|
229
|
+
effects: [({
|
|
230
|
+
trigger,
|
|
231
|
+
setSelf,
|
|
232
|
+
onSet
|
|
233
|
+
}) => {
|
|
234
|
+
const get = async () => {
|
|
235
|
+
setSelf(await apiClient.getGlobalAccountPreferenceGet({
|
|
236
|
+
pkey: EDITOR_ACCOUNT_PREFERENCE_PKEY_PREVIEW_MODE
|
|
237
|
+
}).then(res => Number(res.pvalue) || recoilTypes.ExercisePreviewDisplayMode.Mini).catch(() => recoilTypes.ExercisePreviewDisplayMode.Mini));
|
|
238
|
+
};
|
|
407
239
|
if (trigger === 'get') {
|
|
408
240
|
void get();
|
|
409
241
|
}
|
|
410
|
-
onSet(
|
|
411
|
-
if (!
|
|
242
|
+
onSet((newDisplayMode, prevDisplayMode, isReset) => {
|
|
243
|
+
if (!isEqual(newDisplayMode, prevDisplayMode) && !isReset) {
|
|
412
244
|
void apiClient.postGlobalAccountPreferenceEdit({
|
|
413
245
|
pkey: EDITOR_ACCOUNT_PREFERENCE_PKEY_PREVIEW_MODE,
|
|
414
246
|
pvalue: newDisplayMode
|
|
@@ -423,54 +255,53 @@ var exercisePreviewDisplayModeState = recoil.atom({
|
|
|
423
255
|
/**
|
|
424
256
|
*
|
|
425
257
|
*/
|
|
426
|
-
|
|
427
|
-
key:
|
|
258
|
+
const exerciseRunnerSubmittingState = recoil.atom({
|
|
259
|
+
key: `${KEY_PREFIX}/Runner/Submitting`,
|
|
428
260
|
default: false
|
|
429
261
|
});
|
|
430
262
|
/**
|
|
431
263
|
*
|
|
432
264
|
*/
|
|
433
|
-
|
|
434
|
-
key:
|
|
265
|
+
const exerciseRunnerRunningState = recoil.atom({
|
|
266
|
+
key: `${KEY_PREFIX}/Runner/Running`,
|
|
435
267
|
default: false
|
|
436
268
|
});
|
|
437
269
|
/**
|
|
438
270
|
*
|
|
439
271
|
*/
|
|
440
|
-
|
|
441
|
-
key:
|
|
272
|
+
const exerciseRunnerRunTypeState = recoil.atom({
|
|
273
|
+
key: `${KEY_PREFIX}/Runner/RunType`,
|
|
442
274
|
default: null
|
|
443
275
|
});
|
|
444
276
|
/**
|
|
445
277
|
*
|
|
446
278
|
*/
|
|
447
|
-
|
|
448
|
-
key:
|
|
279
|
+
const exerciseRunnerRoomConnectionInfoState = recoil.atom({
|
|
280
|
+
key: `${KEY_PREFIX}/Runner/RoomConnectionInfoState`,
|
|
449
281
|
default: null
|
|
450
282
|
});
|
|
451
283
|
/**
|
|
452
284
|
*
|
|
453
285
|
*/
|
|
454
|
-
|
|
455
|
-
key:
|
|
286
|
+
const exerciseRunnerStdioFilesState = recoil.atom({
|
|
287
|
+
key: `${KEY_PREFIX}/Runner/StdioFiles`,
|
|
456
288
|
default: []
|
|
457
289
|
});
|
|
458
290
|
/**
|
|
459
291
|
*
|
|
460
292
|
*/
|
|
461
|
-
|
|
462
|
-
key:
|
|
463
|
-
get:
|
|
464
|
-
|
|
465
|
-
|
|
293
|
+
const exerciseRunnerWebSocketStatusQuery = recoil.selector({
|
|
294
|
+
key: `${KEY_PREFIX}/Runner/WebsocketState`,
|
|
295
|
+
get: ({
|
|
296
|
+
get
|
|
297
|
+
}) => {
|
|
298
|
+
const states = Object.freeze([get(exerciseWebsocketStates).runnerRoom, get(exerciseWebsocketStates).stdio]);
|
|
466
299
|
// connecting
|
|
467
300
|
if (states.includes(websocket.EliceWebSocket.CLOSED) || states.includes(websocket.EliceWebSocket.CONNECTING)) {
|
|
468
301
|
return websocket.EliceWebSocket.CONNECTING;
|
|
469
302
|
}
|
|
470
303
|
// connected
|
|
471
|
-
else if (states.every(
|
|
472
|
-
return state === WebSocket.OPEN;
|
|
473
|
-
})) {
|
|
304
|
+
else if (states.every(state => state === WebSocket.OPEN)) {
|
|
474
305
|
return websocket.EliceWebSocket.OPEN;
|
|
475
306
|
}
|
|
476
307
|
// reconnecting
|
|
@@ -485,8 +316,8 @@ var exerciseRunnerWebSocketStatusQuery = recoil.selector({
|
|
|
485
316
|
/**
|
|
486
317
|
*
|
|
487
318
|
*/
|
|
488
|
-
|
|
489
|
-
key:
|
|
319
|
+
const exerciseWebsocketStates = recoil.atom({
|
|
320
|
+
key: `${KEY_PREFIX}/Websocket/States`,
|
|
490
321
|
default: {
|
|
491
322
|
runnerRoom: websocket.EliceWebSocket.CLOSED,
|
|
492
323
|
stdio: websocket.EliceWebSocket.CLOSED,
|
|
@@ -496,223 +327,143 @@ var exerciseWebsocketStates = recoil.atom({
|
|
|
496
327
|
/**
|
|
497
328
|
*
|
|
498
329
|
*/
|
|
499
|
-
|
|
500
|
-
key:
|
|
501
|
-
get:
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
};
|
|
330
|
+
const exerciseWebsocketQuery = recoil.selectorFamily({
|
|
331
|
+
key: `${KEY_PREFIX}/Websocket/State`,
|
|
332
|
+
get: key => ({
|
|
333
|
+
get
|
|
334
|
+
}) => {
|
|
335
|
+
return get(exerciseWebsocketStates)[key];
|
|
506
336
|
},
|
|
507
|
-
set:
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
337
|
+
set: key => ({
|
|
338
|
+
get,
|
|
339
|
+
set
|
|
340
|
+
}, newWebSocketState) => {
|
|
341
|
+
set(exerciseWebsocketStates, Object.assign(Object.assign({}, get(exerciseWebsocketStates)), {
|
|
342
|
+
[key]: newWebSocketState
|
|
343
|
+
}));
|
|
513
344
|
}
|
|
514
345
|
});
|
|
515
346
|
//
|
|
516
347
|
// =============== multi language ===============
|
|
517
348
|
//
|
|
518
|
-
|
|
519
|
-
|
|
349
|
+
const MULTILANG_ENVIRONMENT_FILENAME = '.environment.json';
|
|
350
|
+
const MULTILANG_LANGUAGES_FILENAME = '.languages.json';
|
|
520
351
|
/**
|
|
521
352
|
*
|
|
522
353
|
*/
|
|
523
|
-
|
|
524
|
-
key:
|
|
354
|
+
const exerciseMultilangLanguagesState = recoil.atomFamily({
|
|
355
|
+
key: `${KEY_PREFIX}/Multilang/Languages`,
|
|
525
356
|
default: undefined,
|
|
526
|
-
effects:
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
setSelf(undefined);
|
|
554
|
-
return _context8.abrupt("return");
|
|
555
|
-
case 9:
|
|
556
|
-
_context8.t0 = setSelf;
|
|
557
|
-
_context8.next = 12;
|
|
558
|
-
return apiClient.getOrgMaterialExerciseExerciseImageExerciseFileGet({
|
|
559
|
-
exerciseImageId: (_b = (_a = exercise.readyExerciseImage) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 0,
|
|
560
|
-
filename: MULTILANG_LANGUAGES_FILENAME
|
|
561
|
-
}).then(function (res) {
|
|
562
|
-
return res.exerciseFile.content;
|
|
563
|
-
}).then(function (content) {
|
|
564
|
-
return humps.camelizeKeys(JSON.parse(content));
|
|
565
|
-
}).catch(function () {
|
|
566
|
-
return null;
|
|
567
|
-
});
|
|
568
|
-
case 12:
|
|
569
|
-
_context8.t1 = _context8.sent;
|
|
570
|
-
(0, _context8.t0)(_context8.t1);
|
|
571
|
-
case 14:
|
|
572
|
-
case "end":
|
|
573
|
-
return _context8.stop();
|
|
574
|
-
}
|
|
575
|
-
}, _callee8);
|
|
576
|
-
}));
|
|
577
|
-
return function get() {
|
|
578
|
-
return _ref23.apply(this, arguments);
|
|
579
|
-
};
|
|
580
|
-
}();
|
|
581
|
-
if (trigger === 'get') {
|
|
357
|
+
effects: materialExerciseId => [({
|
|
358
|
+
getPromise,
|
|
359
|
+
trigger,
|
|
360
|
+
setSelf,
|
|
361
|
+
onSet
|
|
362
|
+
}) => {
|
|
363
|
+
const get = async () => {
|
|
364
|
+
var _a, _b;
|
|
365
|
+
if (!materialExerciseId) {
|
|
366
|
+
setSelf(undefined);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const exercise = await getPromise(exerciseState(materialExerciseId));
|
|
370
|
+
if (!exercise) {
|
|
371
|
+
setSelf(undefined);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
setSelf(await apiClient.getOrgMaterialExerciseExerciseImageExerciseFileGet({
|
|
375
|
+
exerciseImageId: (_b = (_a = exercise.readyExerciseImage) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 0,
|
|
376
|
+
filename: MULTILANG_LANGUAGES_FILENAME
|
|
377
|
+
}).then(res => res.exerciseFile.content).then(content => humps.camelizeKeys(JSON.parse(content))).catch(() => null));
|
|
378
|
+
};
|
|
379
|
+
if (trigger === 'get') {
|
|
380
|
+
void get();
|
|
381
|
+
}
|
|
382
|
+
onSet((_prevValue, _newValue, isReset) => {
|
|
383
|
+
if (isReset) {
|
|
582
384
|
void get();
|
|
583
385
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
void get();
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
}];
|
|
590
|
-
}
|
|
386
|
+
});
|
|
387
|
+
}]
|
|
591
388
|
});
|
|
592
389
|
/**
|
|
593
390
|
*
|
|
594
391
|
*/
|
|
595
|
-
|
|
596
|
-
key:
|
|
392
|
+
const exerciseMultilangEnvironmentState = recoil.atomFamily({
|
|
393
|
+
key: `${KEY_PREFIX}/Multilang/Environment`,
|
|
597
394
|
default: null,
|
|
598
|
-
effects:
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
619
|
-
case 0:
|
|
620
|
-
return _context9.abrupt("return", getPromise(exerciseMultilangLanguagesState(materialExerciseId)).then(function (languages) {
|
|
621
|
-
if (!languages) {
|
|
622
|
-
throw new Error('err_no_languages');
|
|
623
|
-
}
|
|
624
|
-
var language = Object.keys(languages)[0];
|
|
625
|
-
return {
|
|
626
|
-
language: language
|
|
627
|
-
};
|
|
628
|
-
}).catch(function () {
|
|
629
|
-
return null;
|
|
630
|
-
}));
|
|
631
|
-
case 1:
|
|
632
|
-
case "end":
|
|
633
|
-
return _context9.stop();
|
|
634
|
-
}
|
|
635
|
-
}, _callee9);
|
|
636
|
-
}))));
|
|
637
|
-
case 1:
|
|
638
|
-
case "end":
|
|
639
|
-
return _context10.stop();
|
|
640
|
-
}
|
|
641
|
-
}, _callee10);
|
|
642
|
-
}));
|
|
643
|
-
return function get() {
|
|
644
|
-
return _ref26.apply(this, arguments);
|
|
395
|
+
effects: ({
|
|
396
|
+
materialExerciseId,
|
|
397
|
+
exerciseRoomId
|
|
398
|
+
}) => [({
|
|
399
|
+
trigger,
|
|
400
|
+
getPromise,
|
|
401
|
+
setSelf,
|
|
402
|
+
onSet
|
|
403
|
+
}) => {
|
|
404
|
+
const get = async () => {
|
|
405
|
+
setSelf(apiClient.getOrgMaterialExerciseExerciseRoomUserFileGet({
|
|
406
|
+
exerciseRoomId,
|
|
407
|
+
filename: MULTILANG_ENVIRONMENT_FILENAME
|
|
408
|
+
}).then(res => humps.camelizeKeys(JSON.parse(res.userFile.content))).catch(async () => getPromise(exerciseMultilangLanguagesState(materialExerciseId)).then(languages => {
|
|
409
|
+
if (!languages) {
|
|
410
|
+
throw new Error('err_no_languages');
|
|
411
|
+
}
|
|
412
|
+
const language = Object.keys(languages)[0];
|
|
413
|
+
return {
|
|
414
|
+
language
|
|
645
415
|
};
|
|
646
|
-
}();
|
|
647
|
-
|
|
648
|
-
|
|
416
|
+
}).catch(() => null)));
|
|
417
|
+
};
|
|
418
|
+
if (trigger === 'get') {
|
|
419
|
+
void get();
|
|
420
|
+
}
|
|
421
|
+
onSet((newEnvJson, _, isReset) => {
|
|
422
|
+
if (isReset) {
|
|
423
|
+
return;
|
|
649
424
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
type: 'application/json'
|
|
658
|
-
}),
|
|
659
|
-
path: '',
|
|
660
|
-
overwrite: true
|
|
661
|
-
});
|
|
425
|
+
void apiClient.postOrgMaterialExerciseExerciseRoomUserFileAdd({
|
|
426
|
+
exerciseRoomId,
|
|
427
|
+
userFile: new File([JSON.stringify(newEnvJson)], MULTILANG_ENVIRONMENT_FILENAME, {
|
|
428
|
+
type: 'application/json'
|
|
429
|
+
}),
|
|
430
|
+
path: '',
|
|
431
|
+
overwrite: true
|
|
662
432
|
});
|
|
663
|
-
}
|
|
664
|
-
}
|
|
433
|
+
});
|
|
434
|
+
}]
|
|
665
435
|
});
|
|
666
436
|
//
|
|
667
437
|
// =============== arduino ===============
|
|
668
438
|
//
|
|
669
|
-
|
|
670
|
-
|
|
439
|
+
const ARDUINO_ACCOUNT_PREFERENCE_KEY = 'material.exercise.arduino.preference';
|
|
440
|
+
const DEFAULT_ARDUINO_PREFERENCE = {
|
|
671
441
|
baudRate: 9600,
|
|
672
442
|
port: ''
|
|
673
443
|
};
|
|
674
444
|
/**
|
|
675
445
|
* Arduino preference.
|
|
676
446
|
*/
|
|
677
|
-
|
|
678
|
-
key:
|
|
447
|
+
const exerciseArduinoPreferenceState = recoil.atom({
|
|
448
|
+
key: `${KEY_PREFIX}/Arduino/Preference`,
|
|
679
449
|
default: DEFAULT_ARDUINO_PREFERENCE,
|
|
680
|
-
effects: [
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
pkey: ARDUINO_ACCOUNT_PREFERENCE_KEY
|
|
693
|
-
}).then(function (res) {
|
|
694
|
-
return Object.assign(Object.assign({}, DEFAULT_ARDUINO_PREFERENCE), res.pvalue);
|
|
695
|
-
}).catch(function () {
|
|
696
|
-
return DEFAULT_ARDUINO_PREFERENCE;
|
|
697
|
-
});
|
|
698
|
-
case 3:
|
|
699
|
-
_context11.t1 = _context11.sent;
|
|
700
|
-
(0, _context11.t0)(_context11.t1);
|
|
701
|
-
case 5:
|
|
702
|
-
case "end":
|
|
703
|
-
return _context11.stop();
|
|
704
|
-
}
|
|
705
|
-
}, _callee11);
|
|
706
|
-
}));
|
|
707
|
-
return function get() {
|
|
708
|
-
return _ref29.apply(this, arguments);
|
|
709
|
-
};
|
|
710
|
-
}();
|
|
450
|
+
effects: [({
|
|
451
|
+
trigger,
|
|
452
|
+
setSelf,
|
|
453
|
+
onSet
|
|
454
|
+
}) => {
|
|
455
|
+
const get = async () => {
|
|
456
|
+
setSelf(await apiClient.getGlobalAccountPreferenceGet({
|
|
457
|
+
pkey: ARDUINO_ACCOUNT_PREFERENCE_KEY
|
|
458
|
+
}).then(res => {
|
|
459
|
+
return Object.assign(Object.assign({}, DEFAULT_ARDUINO_PREFERENCE), res.pvalue);
|
|
460
|
+
}).catch(() => DEFAULT_ARDUINO_PREFERENCE));
|
|
461
|
+
};
|
|
711
462
|
if (trigger === 'get') {
|
|
712
463
|
void get();
|
|
713
464
|
}
|
|
714
|
-
onSet(
|
|
715
|
-
if (!
|
|
465
|
+
onSet((newPreference, prevPreference, isReset) => {
|
|
466
|
+
if (!isEqual(newPreference, prevPreference) && !isReset) {
|
|
716
467
|
void apiClient.postGlobalAccountPreferenceEdit({
|
|
717
468
|
pkey: ARDUINO_ACCOUNT_PREFERENCE_KEY,
|
|
718
469
|
pvalue: Object.assign(Object.assign({}, DEFAULT_ARDUINO_PREFERENCE), newPreference)
|
|
@@ -724,45 +475,45 @@ var exerciseArduinoPreferenceState = recoil.atom({
|
|
|
724
475
|
/**
|
|
725
476
|
* Arduino ports.
|
|
726
477
|
*/
|
|
727
|
-
|
|
728
|
-
key:
|
|
478
|
+
const exerciseArduinoPortsState = recoil.atom({
|
|
479
|
+
key: `${KEY_PREFIX}/Arduino/Ports`,
|
|
729
480
|
default: []
|
|
730
481
|
});
|
|
731
482
|
/**
|
|
732
483
|
* Opened arduino port.
|
|
733
484
|
*/
|
|
734
|
-
|
|
735
|
-
key:
|
|
485
|
+
const exerciseArduinoOpenedPortNameState = recoil.atom({
|
|
486
|
+
key: `${KEY_PREFIX}/Arduino/OpenedPortName`,
|
|
736
487
|
default: null
|
|
737
488
|
});
|
|
738
489
|
/**
|
|
739
490
|
* Arduino port open handler.
|
|
740
491
|
*/
|
|
741
|
-
|
|
742
|
-
key:
|
|
743
|
-
default:
|
|
492
|
+
const exerciseArduinoOnSelectPortState = recoil.atom({
|
|
493
|
+
key: `${KEY_PREFIX}/Arduino/OnSelectPort`,
|
|
494
|
+
default: name => {
|
|
744
495
|
// do nothing.
|
|
745
496
|
}
|
|
746
497
|
});
|
|
747
498
|
/**
|
|
748
499
|
* Arduino agent connection status.
|
|
749
500
|
*/
|
|
750
|
-
|
|
751
|
-
key:
|
|
501
|
+
const exerciseArduinoAgentConnectionState = recoil.atom({
|
|
502
|
+
key: `${KEY_PREFIX}/Arduino/AgentConnection`,
|
|
752
503
|
default: 'disconnected'
|
|
753
504
|
});
|
|
754
505
|
/**
|
|
755
506
|
* Arduino upload progress.
|
|
756
507
|
*/
|
|
757
|
-
|
|
758
|
-
key:
|
|
508
|
+
const exerciseArduinoUploadProgressState = recoil.atom({
|
|
509
|
+
key: `${KEY_PREFIX}/Arduino/UploadProgressState`,
|
|
759
510
|
default: 'ready'
|
|
760
511
|
});
|
|
761
512
|
/**
|
|
762
513
|
* Arduino agent modal open status.
|
|
763
514
|
*/
|
|
764
|
-
|
|
765
|
-
key:
|
|
515
|
+
const exerciseArduinoAgentModalState = recoil.atom({
|
|
516
|
+
key: `${KEY_PREFIX}/Arduino/AgentModalState`,
|
|
766
517
|
default: false
|
|
767
518
|
});
|
|
768
519
|
//
|
|
@@ -771,22 +522,22 @@ var exerciseArduinoAgentModalState = recoil.atom({
|
|
|
771
522
|
/**
|
|
772
523
|
*
|
|
773
524
|
*/
|
|
774
|
-
|
|
775
|
-
key:
|
|
525
|
+
const exerciseActiveFilenameState = recoil.atom({
|
|
526
|
+
key: `${KEY_PREFIX}/ActiveFilename`,
|
|
776
527
|
default: null
|
|
777
528
|
});
|
|
778
529
|
/**
|
|
779
530
|
*
|
|
780
531
|
*/
|
|
781
|
-
|
|
782
|
-
key:
|
|
532
|
+
const exerciseRightpaneActiveState = recoil.atom({
|
|
533
|
+
key: `${KEY_PREFIX}/RightpaneActive`,
|
|
783
534
|
default: null
|
|
784
535
|
});
|
|
785
536
|
/**
|
|
786
537
|
*
|
|
787
538
|
*/
|
|
788
|
-
|
|
789
|
-
key:
|
|
539
|
+
const exerciseContainerSizeState = recoil.atom({
|
|
540
|
+
key: `${KEY_PREFIX}/ContainerSize`,
|
|
790
541
|
default: {
|
|
791
542
|
width: 0,
|
|
792
543
|
height: 0
|
|
@@ -795,15 +546,15 @@ var exerciseContainerSizeState = recoil.atom({
|
|
|
795
546
|
/**
|
|
796
547
|
*
|
|
797
548
|
*/
|
|
798
|
-
|
|
799
|
-
key:
|
|
549
|
+
const exerciseAibotInfoEnableState = recoil.atom({
|
|
550
|
+
key: `${KEY_PREFIX}/AibotInfoEnable`,
|
|
800
551
|
default: false
|
|
801
552
|
});
|
|
802
553
|
/**
|
|
803
554
|
*
|
|
804
555
|
*/
|
|
805
|
-
|
|
806
|
-
key:
|
|
556
|
+
const exerciseFileEditorCursorState = recoil.atom({
|
|
557
|
+
key: `${KEY_PREFIX}/FileEditorCursor`,
|
|
807
558
|
default: {
|
|
808
559
|
from: 0,
|
|
809
560
|
to: 0
|
|
@@ -812,15 +563,15 @@ var exerciseFileEditorCursorState = recoil.atom({
|
|
|
812
563
|
/**
|
|
813
564
|
*
|
|
814
565
|
*/
|
|
815
|
-
|
|
816
|
-
key:
|
|
566
|
+
const exerciseFileEditorCursorSelectionValueState = recoil.atom({
|
|
567
|
+
key: `${KEY_PREFIX}/FileEditorCursorSelectionValue`,
|
|
817
568
|
default: null
|
|
818
569
|
});
|
|
819
570
|
/**
|
|
820
571
|
*
|
|
821
572
|
*/
|
|
822
|
-
|
|
823
|
-
key:
|
|
573
|
+
const exerciseMonacoEditorApisState = recoil.atom({
|
|
574
|
+
key: `${KEY_PREFIX}/MonacoEditorApisState`,
|
|
824
575
|
default: null,
|
|
825
576
|
dangerouslyAllowMutability: true
|
|
826
577
|
});
|