@dao42/d42paas-front 0.4.8 → 0.4.9

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.
Files changed (69) hide show
  1. package/package.json +2 -3
  2. package/src/_bundle.tsx +0 -283
  3. package/src/app.tsx +0 -356
  4. package/src/assets/code-brackets.svg +0 -1
  5. package/src/assets/colors.svg +0 -1
  6. package/src/assets/comments.svg +0 -1
  7. package/src/assets/direction.svg +0 -1
  8. package/src/assets/flow.svg +0 -1
  9. package/src/assets/plugin.svg +0 -1
  10. package/src/assets/repo.svg +0 -1
  11. package/src/assets/stackalt.svg +0 -1
  12. package/src/components/Avatar/index.tsx +0 -27
  13. package/src/components/CanvasHelper/index.tsx +0 -89
  14. package/src/components/Console/index.tsx +0 -88
  15. package/src/components/Editor/index copy.tsx +0 -1010
  16. package/src/components/Editor/index.tsx +0 -1011
  17. package/src/components/FileTree/index.tsx +0 -478
  18. package/src/components/LiveContent/index.tsx +0 -221
  19. package/src/components/LiveContent/video.tsx +0 -213
  20. package/src/components/LottieAnim/index.tsx +0 -41
  21. package/src/components/Message/index.tsx +0 -64
  22. package/src/components/Model/index.tsx +0 -42
  23. package/src/components/OutputBrowser/index.tsx +0 -180
  24. package/src/components/Skeleton/index.tsx +0 -41
  25. package/src/components/Tabs/index.tsx +0 -23
  26. package/src/components/Terminal/index.tsx +0 -127
  27. package/src/components/ToolBar/index.tsx +0 -169
  28. package/src/components/XTerm/index.tsx +0 -113
  29. package/src/components/index.tsx +0 -4
  30. package/src/components/loading/index.tsx +0 -284
  31. package/src/enum/FExtension.ts +0 -168
  32. package/src/helpers/collections/IoClient.tsx +0 -314
  33. package/src/helpers/collections/errorCatcher.tsx +0 -0
  34. package/src/helpers/collections/idb.tsx +0 -186
  35. package/src/helpers/collections/localStorage.tsx +0 -13
  36. package/src/helpers/collections/mock.tsx +0 -30
  37. package/src/helpers/collections/playgroundInit.tsx +0 -316
  38. package/src/helpers/collections/replay.tsx +0 -168
  39. package/src/helpers/collections/socket.tsx +0 -6
  40. package/src/helpers/collections/toast.tsx +0 -19
  41. package/src/helpers/collections/userTool.tsx +0 -12
  42. package/src/helpers/collections/util.tsx +0 -4
  43. package/src/helpers/index.tsx +0 -6
  44. package/src/helpers/monaco/monaco-ot-adapter.tsx +0 -476
  45. package/src/hooks/collections/useOT.tsx +0 -39
  46. package/src/hooks/index.tsx +0 -1
  47. package/src/index.html +0 -49
  48. package/src/pages/index.tsx +0 -452
  49. package/src/public/dev.html +0 -35
  50. package/src/public/index.html +0 -50
  51. package/src/public/sdkserver.html +0 -36
  52. package/src/stores/index.tsx +0 -1
  53. package/src/stores/oTStore.tsx +0 -310
  54. package/src/stories/BrowserWindow.tsx +0 -30
  55. package/src/stories/Console.tsx +0 -46
  56. package/src/stories/Editor.tsx +0 -37
  57. package/src/stories/FileTree.tsx +0 -50
  58. package/src/stories/Shell.tsx +0 -53
  59. package/src/stories/introduction.stories.mdx +0 -193
  60. package/src/stories/page.tsx +0 -71
  61. package/src/styles/collections/iconfont.scss +0 -1
  62. package/src/styles/collections/tabs-costumers.scss +0 -20
  63. package/src/styles/collections/tailwind.scss +0 -3
  64. package/src/styles/collections/tree-costumers.scss +0 -53
  65. package/src/styles/collections/utility.scss +0 -10
  66. package/src/styles/collections/xterm-costumers.scss +0 -47
  67. package/src/styles/index.css +0 -21
  68. package/src/types/editor.d.ts +0 -31
  69. package/src/types/index.d.ts +0 -166
@@ -1,452 +0,0 @@
1
- import React, { Suspense, useEffect, useState } from 'react';
2
- import { lazy } from '@loadable/component';
3
- import { useOT } from '~/hooks';
4
- // import * as ot from 'ot';
5
- import styled from '@emotion/styled';
6
- // import { animated, useSpring } from 'react-spring';
7
- import Terminal from '~/components/Terminal';
8
- import Tabs from '~/components/Tabs';
9
- import create from 'zustand';
10
- import { css } from '@emotion/css';
11
- import { Avatar } from '~/components';
12
- import Skeleton from '~/components/Skeleton';
13
- import { oTStore } from '~/stores';
14
- // import { FileTree } from '~/components/FileTree';
15
- import Console from '~/components/Console';
16
- import ToolBar from '~/components/ToolBar';
17
- // import { TreeItemIndex } from 'react-complex-tree/lib/esm/types';
18
- import OutputBrowser from '~/components/OutputBrowser';
19
- import { ITerminalOptions } from 'xterm';
20
- import { replay } from '~/helpers/collections/replay';
21
- import LiveContent from '~/components/LiveContent';
22
- import { userListStore, userStore } from '~/stores/oTStore';
23
-
24
- export enum LanguageIcon {
25
- js = 'javascript',
26
- ts = 'typescript',
27
- typescript = 'typescript',
28
- tsx = 'typescript',
29
- python = 'python',
30
- json = 'json',
31
- ruby = 'ruby',
32
- rb = 'ruby',
33
- java = 'java',
34
- md = 'markdown',
35
- erb = 'erb',
36
- css = 'css',
37
- ru = 'ruby',
38
- ejs = 'html',
39
- html = 'html',
40
- }
41
- const useIndexState = create<{
42
- isFolded: boolean;
43
- setFold: (arg: boolean) => void;
44
- }>((set) => ({
45
- isFolded: false,
46
- setFold: (arg) => set({ isFolded: arg }),
47
- }));
48
-
49
- const LazyEditorComponent = lazy(
50
- async () => (await import('../components/Editor')).Editor,
51
- );
52
- const LazyTreeComponent = lazy(
53
- async () => (await import('../components/FileTree')).FileTree,
54
- );
55
-
56
- /*! purgecss start ignore */
57
-
58
- const MainLayout = styled.div`
59
- width: 100vw;
60
- height: 100vh;
61
- overflow: hidden;
62
- background: #202327;
63
- .lan-iconfont {
64
- font-size: 40px;
65
- }
66
- .replay-button {
67
- margin-left: 20px;
68
- box-shadow: 0 0 5px aliceblue;
69
- padding: 7px;
70
- border-radius: 5px;
71
- font-size: 12px;
72
- background: #fff;
73
- color: #000;
74
- transition: 0.2s all;
75
- &:active {
76
- box-shadow: 0 0 0 aliceblue;
77
- margin-right: 8px;
78
- margin-top: 5px;
79
- }
80
- }
81
- `;
82
- /*! purgecss end ignore */
83
-
84
- const PreviewWrapper = styled.div`
85
- height: 40vh;
86
- color: #333333;
87
- background-color: #eaeaea;
88
- `;
89
-
90
- const TermWrapper = styled.div`
91
- height: calc(100% - 40vh - 51px);
92
- width: 100%;
93
- `;
94
-
95
- const HeaderLayout = styled.header`
96
- width: 100%;
97
- `;
98
-
99
- const ContainerLayout = styled.div`
100
- height: calc(100% - 4.625rem);
101
- section {
102
- height: calc(100% - 0.625rem);
103
- }
104
- `;
105
-
106
- const IDELayout = styled.div`
107
- height: 100%;
108
- `;
109
-
110
- const RunnerLayout = styled.section`
111
- background: #202327;
112
- width: 500px;
113
- `;
114
-
115
- const Index = (props) => {
116
- const tabItems = [
117
- {
118
- eventKey: 'console',
119
- itemName: 'Console',
120
- },
121
- {
122
- eventKey: 'shell',
123
- itemName: 'Shell',
124
- },
125
- ];
126
- const defaultOptions: ITerminalOptions = {
127
- convertEol: true,
128
- fontSize: 12,
129
- fontFamily: 'Monaco, Menlo, monospace',
130
- lineHeight: 1,
131
- cursorBlink: true,
132
- cursorWidth: 1,
133
- cursorStyle: 'block',
134
- rightClickSelectsWord: true,
135
- theme: {
136
- background: '#1E1E1E',
137
- },
138
- };
139
-
140
- // console.log(props);
141
- const isFolded = useIndexState.getState().isFolded;
142
- const playgroundInfo = oTStore((state) => state.playgroundInfo);
143
-
144
- const [active, setActive] = useState('shell');
145
- const [url, setUrl] = useState(playgroundInfo.url);
146
- const { socket } = useOT.getState();
147
- let terminalTabsTimer = 1;
148
- const [consoleComp, setConsoleComp] = useState(<></>);
149
- useEffect(() => {
150
- if (terminalTabsTimer && active === 'console') {
151
- terminalTabsTimer--;
152
- setConsoleComp(<Console options={defaultOptions} fitHook={isFolded} />);
153
- }
154
- }, [active]);
155
-
156
- useEffect(() => {
157
- props.replay && replay();
158
- }, [props.replay]);
159
-
160
- useEffect(() => {
161
- setUrl(playgroundInfo.url);
162
- }, [playgroundInfo]);
163
- useEffect(() => {
164
- props.playgroundId &&
165
- socket?.emit(
166
- 'playgroundInfo',
167
- JSON.stringify({
168
- messageId: '1',
169
- playgroundId: props.playgroundId,
170
- }),
171
- );
172
- // temp code
173
- }, [props.playgroundId]);
174
- // useEffect(() => {
175
- // // fetch('http://smb.dev.paas.dao42.com:9998/PaaS/users')
176
- // // fetch('/paas/users')
177
- // // .then((d) => d.json())
178
- // // .then((d) => {
179
- // // // console.log(d);
180
- // // });
181
- // }, [props.users]);
182
- // console.log();
183
- return (
184
- <>
185
- <MainLayout className="flex flex-col">
186
- {/* 头部 */}
187
- <HeaderComponent />
188
- {/* 内容区 */}
189
- <ContainerLayout className="flex flex-1 mt-2.5 flex-row">
190
- {/* 左侧栏 */}
191
-
192
- <section className="flex flex-row">
193
- <SliderComponent />
194
- <TreeComponent />
195
- {/* 文件树 */}
196
- </section>
197
- {/* 编辑器与终端 */}
198
- <section className="bg-codezone-black rounded-sm mx-3.5 flex-1 flex flex-col">
199
- {playgroundInfo.dockerId ? (
200
- <IDELayout>
201
- {/* <Skeleton count={10} /> */}
202
- <Suspense fallback={<Skeleton count={10} />}>
203
- <LazyEditorComponent />
204
- </Suspense>
205
- </IDELayout>
206
- ) : null}
207
- </section>
208
-
209
- {/* 运行框 */}
210
- <RunnerLayout
211
- // className={`rounded-sm mr-2.5 ${!isFolded ? 'max-w-5/12' : 'w-0'}`}
212
- className={`rounded-sm mr-2.5`}
213
- >
214
- <PreviewWrapper className="mb-2.5 relative">
215
- <OutputBrowser url={url} />
216
- </PreviewWrapper>
217
-
218
- <Tabs
219
- className="mb-1"
220
- appearance="tabs"
221
- activeKey={active}
222
- onSelect={setActive}
223
- tabItems={tabItems}
224
- />
225
- <Suspense fallback={<Skeleton />}>
226
- <TermWrapper>
227
- <div
228
- key="console"
229
- className=""
230
- style={{
231
- display: active === 'console' ? 'block' : 'none',
232
- height: '100%',
233
- width: '100%',
234
- }}
235
- >
236
- {consoleComp}
237
- </div>
238
- <div
239
- key="terminal"
240
- style={{
241
- display: active === 'console' ? 'none' : 'block',
242
- height: '100%',
243
- width: '100%',
244
- }}
245
- >
246
- <Terminal options={defaultOptions} fitHook={isFolded} />
247
- </div>
248
- </TermWrapper>
249
- </Suspense>
250
- </RunnerLayout>
251
- </ContainerLayout>
252
- </MainLayout>
253
- </>
254
- );
255
- };
256
-
257
- const HeaderComponent = () => {
258
- // const { userList } = userListStore.getState();
259
- const userList = userListStore((state) => state.userList);
260
- const appStatus = oTStore((state) => state.appStatus);
261
- const globalData = oTStore((state) => state.globalData);
262
- const { setAppStatus } = oTStore.getState();
263
- const user = userStore.getState().userInfo;
264
- // const [isRecording, setIsRecording] = useState<boolean>(false);
265
- // console.log(userList);
266
- return userList ? (
267
- <HeaderLayout className="relative bg-codezone-black h-16 flex px-9 flex-shrink-0 justify-between">
268
- <div className="flex">
269
- <Avatar
270
- user={user}
271
- onClick={() => {
272
- const minePage = window.open(
273
- '//github.com/login/oauth/authorize?client_id=7333fa72cf5753ba016e&redirect_uri=http://localhost:3000/auth/github',
274
- 'targetWindow',
275
- `toolbar=no,
276
- location=no,
277
- status=no,
278
- menubar=no,
279
- scrollbars=yes,
280
- resizable=yes,
281
- width=500,
282
- height=500`,
283
- );
284
- minePage.addEventListener(
285
- 'load',
286
- () => {
287
- minePage.close();
288
- },
289
- false,
290
- );
291
- }}
292
- />
293
- {/* playgroundInfo */}
294
- <div className="flex" style={{ color: '#fff', marginLeft: 20 }}>
295
- <span className="self-center">{user.name}</span>
296
- <i className="self-center" style={{ margin: '0 10px' }} />
297
- <i
298
- className={`self-center
299
-
300
- devicon-${oTStore
301
- .getState()
302
- .playgroundInfo?.language?.toLowerCase()}-plain
303
- lan-iconfont
304
- colored`}
305
- />
306
-
307
- {/* <span className="self-center mr-2.5">{'{ playground_info }'}</span> */}
308
- {/* <span className="self-center mr-2.5">{'{ playground_info }'}</span> */}
309
- <ToolBar />
310
- {!globalData.isRecording ? (
311
- <button
312
- className="replay-button self-center"
313
- style={{
314
- color: appStatus === 'replay' ? 'rgb(48, 89, 182)' : '#000',
315
- }}
316
- onClick={() => {
317
- if (appStatus !== 'replay') {
318
- replay();
319
- }
320
-
321
- if (appStatus === 'replay') {
322
- replay('pause');
323
- }
324
- }}
325
- >
326
- {appStatus === 'replay'
327
- ? '暂停播放'
328
- : appStatus === 'pause'
329
- ? '继续播放'
330
- : '播放'}
331
- </button>
332
- ) : null}
333
-
334
- {appStatus === 'replay' ? (
335
- <button
336
- className="replay-button self-center"
337
- onClick={() => {
338
- replay('stop');
339
- }}
340
- >
341
- {appStatus === 'replay' ? '停止播放' : null}
342
- </button>
343
- ) : null}
344
-
345
- {appStatus !== 'replay' ? (
346
- <button
347
- className="replay-button self-center"
348
- // style={{
349
- // color: appStatus === 'replay' ? 'rgb(48, 89, 182)' : '#000',
350
- // }}
351
- onClick={() => {
352
- if (!globalData.isRecording) {
353
- oTStore.getState().setGlobalData({
354
- isRecording: true,
355
- });
356
- useOT.getState().socket.emit('globalData', {
357
- isRecording: true,
358
- });
359
- return;
360
- }
361
- // oTStore.getState().setGlobalData({
362
- // isRecording: false,
363
- // });
364
- // useOT.getState().socket.emit('globalData', {
365
- // isRecording: false,
366
- // });
367
- }}
368
- >
369
- {globalData.isRecording ? '重新录制' : '开始录制'}
370
- </button>
371
- ) : null}
372
-
373
- {globalData.isRecording ? (
374
- <button
375
- className="replay-button self-center"
376
- onClick={() => {
377
- oTStore.getState().setGlobalData({
378
- isRecording: false,
379
- });
380
- useOT.getState().socket.emit('globalData', {
381
- isRecording: false,
382
- });
383
- setAppStatus('code');
384
- // replay('stop');
385
- }}
386
- >
387
- 停止录制
388
- </button>
389
- ) : null}
390
- </div>
391
- </div>
392
- <LiveContent />
393
-
394
- <div className="items-center flex relative">
395
- {userListStore.getState().userList.map((item, index) => {
396
- return (
397
- <div className="-ml-2.5 z-0 avatar-hover" key={index}>
398
- <Avatar user={item} />
399
- </div>
400
- );
401
- })}
402
- </div>
403
- </HeaderLayout>
404
- ) : null;
405
- };
406
-
407
- const SliderComponent = () => {
408
- const setFold = useIndexState((state) => state.setFold);
409
- const isFolded = useIndexState((state) => state.isFolded);
410
-
411
- return (
412
- <section className="bg-codezone-black rounded-sm w-14 ml-2.5 flex flex-col pt-5 flex-shrink-0">
413
- <i
414
- onClick={() => setFold(!isFolded)}
415
- className="cursor-pointer text-2xl text-gray-50 self-center mb-6 flex-center d42 snippets"
416
- />
417
- {/* <i className="cursor-pointer text-2xl text-gray-50 self-center mb-6 flex-center d42 Field-time"></i>
418
- <i className="cursor-pointer text-2xl text-gray-50 self-center mb-6 flex-center d42 CodeSandbox"></i>
419
- <i className="cursor-pointer text-2xl text-gray-50 self-center mb-6 flex-center d42 database"></i>
420
- <i className="cursor-pointer text-2xl text-gray-50 self-center mb-6 flex-center d42 cloud-upload"></i>
421
- <i className="cursor-pointer text-2xl text-gray-50 self-center mb-6 flex-center d42 setting"></i> */}
422
- </section>
423
- );
424
- };
425
-
426
- const TreeComponent = () => {
427
- const isFolded = useIndexState.getState().isFolded;
428
- return (
429
- <section
430
- className={`bg-codezone-black rounded-sm ml-2.5 transition-all flex-shrink-0 min-w-52 ${
431
- !isFolded ? 'visible' : 'invisible'
432
- } ${!isFolded ? 'w-52' : 'w-0'}`}
433
- // } ${!isFolded ? 'w-52' : 'w-0'}`}
434
- >
435
- <header
436
- className={css`
437
- margin: 15px;
438
- color: #fff;
439
- visibility: ${!isFolded ? 'visible' : 'hidden'};
440
- `}
441
- >
442
- 文件
443
- </header>
444
- <div style={{ height: 'calc(100% - 52px)' }}>
445
- <Suspense fallback={<Skeleton count={5} />}>
446
- <LazyTreeComponent />
447
- </Suspense>
448
- </div>
449
- </section>
450
- );
451
- };
452
- export default Index;
@@ -1,35 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>DaoPaaS</title>
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.14.0/devicon.min.css" crossorigin="anonymous" />
9
- <script src="https://cdn.tailwindcss.com"></script>
10
- </head>
11
- <body>
12
- <main>
13
- <div class="edit-container"></div>
14
- </main>
15
- <script>
16
- window.onload = () => {
17
- var qs = new URLSearchParams(document.location.search.substring(1));
18
- window.daopaas = new DaoPaaS({
19
- ticket: qs.get('ticket'),
20
- playgroundId: qs.get('playgroundId'),
21
- userId: qs.get('userId'),
22
- tenantId: qs.get('tenantId'),
23
- username: qs.get('username')
24
- });
25
- daopaas.Page({
26
- container: document.querySelector('main'),
27
- // props: {
28
- // playgroundId: search,
29
- // }
30
- }
31
- )
32
- }
33
- </script>
34
- </body>
35
- </html>
@@ -1,50 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>DaoPaaS</title>
8
- <style>
9
- main {
10
- width: 100%;
11
- height: 100vh;
12
- overflow: hidden;
13
- }
14
- .edit-container {
15
- height: 100%;
16
- }
17
- </style>
18
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.14.0/devicon.min.css" crossorigin="anonymous" />
19
- <!-- <script src="https://cdn.tailwindcss.com"></script> -->
20
- <!-- <link rel="stylesheet" href="./style.css" crossorigin="anonymous" /> -->
21
-
22
- </head>
23
- <body>
24
- <main>
25
- <div class="edit-container"></div>
26
- </main>
27
- <!-- <script src="/dist/daoPaaS.js"></script> -->
28
- <script type="module" src="../app.tsx"></script>
29
-
30
- <script>
31
- window.onload = () => {
32
- var qs = new URLSearchParams(document.location.search.substring(1));
33
- window.daopaas = new DaoPaaS({
34
- ticket: qs.get('ticket'),
35
- playgroundId: qs.get('playgroundId'),
36
- userId: qs.get('userId'),
37
- tenantId: qs.get('tenantId'),
38
- username: qs.get('username')
39
- });
40
- daopaas.Page({
41
- container: document.querySelector('main'),
42
- // props: {
43
- // playgroundId: search,
44
- // }
45
- }
46
- )
47
- }
48
- </script>
49
- </body>
50
- </html>
@@ -1,36 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>DaoPaaS</title>
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.14.0/devicon.min.css" crossorigin="anonymous" />
9
- <script src="https://cdn.tailwindcss.com"></script>
10
-
11
- </head>
12
- <body>
13
- <main></main>
14
- <script>
15
- window.onload = () => {
16
- var qs = new URLSearchParams(document.location.search.substring(1));
17
- // console.log(DaoPaaS);
18
- var daopaas = new DaoPaaS({
19
- ticket: qs.get('ticket'),
20
- playgroundId: qs.get('playgroundId'),
21
- userId: qs.get('userId'),
22
- tenantId: qs.get('tenantId'),
23
- username: qs.get('username')
24
- });
25
- daopaas.Page({
26
- container: document.querySelector('main'),
27
- // props: {
28
- // playgroundId: search,
29
- // }
30
- }
31
- )
32
- }
33
-
34
- </script>
35
- </body>
36
- </html>
@@ -1 +0,0 @@
1
- export { oTStore } from './oTStore';