@elice/material-runbox-legacy 1.240718.0-trasncript.1 → 1.240718.0-trasncript.2
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/_virtual/_rollupPluginBabelHelpers.js +383 -0
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacy.js +22 -20
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacy.styled.js +5 -1
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyContent.js +250 -171
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyContent.styled.js +10 -6
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyRunnerRoomWrapper.js +80 -43
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyStdioWrapper.js +63 -30
- package/cjs/components/material-runbox-legacy/index.js +7 -0
- package/cjs/components/material-runbox-legacy/locales/index.js +13 -0
- package/cjs/components/material-runbox-legacy/websocket.js +2 -2
- package/es/_virtual/_rollupPluginBabelHelpers.js +374 -0
- package/es/components/material-runbox-legacy/MaterialRunboxLegacy.js +22 -20
- package/es/components/material-runbox-legacy/MaterialRunboxLegacy.styled.js +1 -1
- package/es/components/material-runbox-legacy/MaterialRunboxLegacyContent.js +246 -171
- package/es/components/material-runbox-legacy/MaterialRunboxLegacyContent.styled.js +6 -6
- package/es/components/material-runbox-legacy/MaterialRunboxLegacyRunnerRoomWrapper.js +76 -43
- package/es/components/material-runbox-legacy/MaterialRunboxLegacyStdioWrapper.js +59 -30
- package/es/components/material-runbox-legacy/index.js +1 -0
- package/es/components/material-runbox-legacy/locales/index.js +4 -0
- package/es/components/material-runbox-legacy/websocket.js +2 -2
- package/package.json +9 -12
|
@@ -1,32 +1,46 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import MaterialRunboxLegacyContent from './MaterialRunboxLegacyContent.js';
|
|
3
5
|
import { WSMaterialRunboxLegacyRunnerRoom, WSMaterialRunboxLegacyStdio } from './websocket.js';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
isRunboxJoinError,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
var RECONNECT_DELAY = 500;
|
|
8
|
+
var MaterialRunboxLegacyStdioWrapper = function MaterialRunboxLegacyStdioWrapper(_ref) {
|
|
9
|
+
var isRunboxJoinError = _ref.isRunboxJoinError,
|
|
10
|
+
reconnectRunnerRoomWebSocket = _ref.reconnectRunnerRoomWebSocket;
|
|
11
|
+
var _React$useState = React.useState(''),
|
|
12
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
13
|
+
roomToken = _React$useState2[0],
|
|
14
|
+
setRoomToken = _React$useState2[1];
|
|
15
|
+
var _React$useState3 = React.useState(''),
|
|
16
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
17
|
+
wsUri = _React$useState4[0],
|
|
18
|
+
setWsUri = _React$useState4[1];
|
|
19
|
+
var _React$useState5 = React.useState(null),
|
|
20
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
21
|
+
runboxUrl = _React$useState6[0],
|
|
22
|
+
setRunboxUrl = _React$useState6[1];
|
|
23
|
+
var _React$useState7 = React.useState(false),
|
|
24
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
25
|
+
isRunboxTerminated = _React$useState8[0],
|
|
26
|
+
setRunboxTerminated = _React$useState8[1];
|
|
27
|
+
var _WSMaterialRunboxLega = WSMaterialRunboxLegacyRunnerRoom.useControls(),
|
|
28
|
+
closeRunnerRoom = _WSMaterialRunboxLega.close;
|
|
29
|
+
var runnerRoomWsStatus = WSMaterialRunboxLegacyRunnerRoom.useReadyState();
|
|
18
30
|
/**
|
|
19
31
|
* Reconnect runbox.
|
|
20
32
|
*/
|
|
21
|
-
|
|
33
|
+
var reconnect = function reconnect() {
|
|
22
34
|
setRunboxUrl(null);
|
|
23
35
|
setRunboxTerminated(false);
|
|
24
|
-
setTimeout(
|
|
36
|
+
setTimeout(function () {
|
|
37
|
+
return void reconnectRunnerRoomWebSocket();
|
|
38
|
+
}, RECONNECT_DELAY);
|
|
25
39
|
};
|
|
26
40
|
//
|
|
27
41
|
//
|
|
28
42
|
//
|
|
29
|
-
WSMaterialRunboxLegacyRunnerRoom.useMessage(message
|
|
43
|
+
WSMaterialRunboxLegacyRunnerRoom.useMessage(function (message) {
|
|
30
44
|
switch (message.type) {
|
|
31
45
|
case 'ROOM_PREPARED':
|
|
32
46
|
setRoomToken(message.data.roomToken);
|
|
@@ -38,13 +52,11 @@ const MaterialRunboxLegacyStdioWrapper = ({
|
|
|
38
52
|
setRunboxTerminated(true);
|
|
39
53
|
break;
|
|
40
54
|
}
|
|
41
|
-
}, {
|
|
42
|
-
camelize: true
|
|
43
55
|
});
|
|
44
56
|
//
|
|
45
57
|
// Remove runbox url, when websocket is not open state.
|
|
46
58
|
//
|
|
47
|
-
React.useEffect(()
|
|
59
|
+
React.useEffect(function () {
|
|
48
60
|
if (runnerRoomWsStatus !== WebSocket.OPEN) {
|
|
49
61
|
setRunboxUrl(null);
|
|
50
62
|
}
|
|
@@ -52,19 +64,36 @@ const MaterialRunboxLegacyStdioWrapper = ({
|
|
|
52
64
|
//
|
|
53
65
|
//
|
|
54
66
|
//
|
|
55
|
-
|
|
56
|
-
return
|
|
67
|
+
var isReady = Boolean(wsUri) && Boolean(roomToken);
|
|
68
|
+
return jsx(WSMaterialRunboxLegacyStdio.Provider, {
|
|
57
69
|
enable: isReady,
|
|
58
|
-
endpoint:
|
|
59
|
-
tokenProvider:
|
|
70
|
+
endpoint: "".concat(wsUri, "/client/stdio"),
|
|
71
|
+
tokenProvider: function () {
|
|
72
|
+
var _tokenProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
73
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
74
|
+
while (1) switch (_context.prev = _context.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
return _context.abrupt("return", roomToken);
|
|
77
|
+
case 1:
|
|
78
|
+
case "end":
|
|
79
|
+
return _context.stop();
|
|
80
|
+
}
|
|
81
|
+
}, _callee);
|
|
82
|
+
}));
|
|
83
|
+
function tokenProvider() {
|
|
84
|
+
return _tokenProvider.apply(this, arguments);
|
|
85
|
+
}
|
|
86
|
+
return tokenProvider;
|
|
87
|
+
}(),
|
|
60
88
|
maxRetries: 5,
|
|
61
|
-
heartAttack: true
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
89
|
+
heartAttack: true,
|
|
90
|
+
children: isReady ? jsx(MaterialRunboxLegacyContent, {
|
|
91
|
+
runboxUrl: runboxUrl,
|
|
92
|
+
isRunboxJoinError: isRunboxJoinError,
|
|
93
|
+
isRunboxTerminated: isRunboxTerminated,
|
|
94
|
+
reconnect: reconnect
|
|
95
|
+
}) : null
|
|
96
|
+
});
|
|
68
97
|
};
|
|
69
98
|
|
|
70
99
|
export { MaterialRunboxLegacyStdioWrapper as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MaterialRunboxLegacy } from './MaterialRunboxLegacy.js';
|
|
@@ -4,10 +4,10 @@ import { EliceWebSocketReact } from '@elice/websocket';
|
|
|
4
4
|
* Websocket instance for material runbox runner room.
|
|
5
5
|
* - endpoint: `/runner_room`
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
var WSMaterialRunboxLegacyRunnerRoom = new EliceWebSocketReact();
|
|
8
8
|
/**
|
|
9
9
|
* Websocket instance for material runbox stdio.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
var WSMaterialRunboxLegacyStdio = new EliceWebSocketReact();
|
|
12
12
|
|
|
13
13
|
export { WSMaterialRunboxLegacyRunnerRoom, WSMaterialRunboxLegacyStdio };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-runbox-legacy",
|
|
3
|
-
"version": "1.240718.0-trasncript.
|
|
3
|
+
"version": "1.240718.0-trasncript.2",
|
|
4
4
|
"description": "User view and editing components of Elice material runbox legacy",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,10 +17,8 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "run-s watch",
|
|
19
19
|
"prebuild": "run-s clean",
|
|
20
|
-
"build": "
|
|
21
|
-
"
|
|
22
|
-
"build:cjs": "rollup -c ../../rollup.config.ts --configPlugin typescript -f cjs",
|
|
23
|
-
"watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -w",
|
|
20
|
+
"build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs",
|
|
21
|
+
"watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs -w",
|
|
24
22
|
"lint": "eslint --ext .ts,.tsx ./src --max-warnings=0",
|
|
25
23
|
"clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
|
|
26
24
|
},
|
|
@@ -45,15 +43,15 @@
|
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
45
|
"@elice/api-client": "^1.240619.0",
|
|
48
|
-
"@elice/blocks": "^1.
|
|
46
|
+
"@elice/blocks": "^1.240529.0",
|
|
49
47
|
"@elice/design-tokens": "^1.220803.0",
|
|
50
48
|
"@elice/icons": "^1.230814.0",
|
|
51
49
|
"@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
|
|
52
50
|
"@elice/intl": "0.240425.0-rc.2",
|
|
53
|
-
"@elice/markdown": "^1.
|
|
54
|
-
"@elice/material-shared-types": "1.240718.0-trasncript.
|
|
55
|
-
"@elice/material-shared-utils": "1.240718.0-trasncript.
|
|
56
|
-
"@elice/types": "
|
|
51
|
+
"@elice/markdown": "^1.240124.0",
|
|
52
|
+
"@elice/material-shared-types": "1.240718.0-trasncript.2",
|
|
53
|
+
"@elice/material-shared-utils": "1.240718.0-trasncript.2",
|
|
54
|
+
"@elice/types": "1.240709.0",
|
|
57
55
|
"@elice/websocket": "^1.220815.0",
|
|
58
56
|
"@types/classnames": "^2.3.1",
|
|
59
57
|
"@types/react": "~17.0.9",
|
|
@@ -61,6 +59,5 @@
|
|
|
61
59
|
"react": "^17.0.2",
|
|
62
60
|
"react-use": "^17.2.4",
|
|
63
61
|
"styled-components": "^5.3.0"
|
|
64
|
-
}
|
|
65
|
-
"gitHead": "8d0acefda30430959f8f115ad467d2449f86d8a7"
|
|
62
|
+
}
|
|
66
63
|
}
|