@dao42/d42paas-front 0.4.5 → 0.4.6
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/package.json +3 -2
- package/src/app.tsx +250 -0
- package/src/assets/code-brackets.svg +1 -0
- package/src/assets/colors.svg +1 -0
- package/src/assets/comments.svg +1 -0
- package/src/assets/direction.svg +1 -0
- package/src/assets/flow.svg +1 -0
- package/src/assets/plugin.svg +1 -0
- package/src/assets/repo.svg +1 -0
- package/src/assets/stackalt.svg +1 -0
- package/src/components/Avatar/index.tsx +27 -0
- package/src/components/CanvasHelper/index.tsx +89 -0
- package/src/components/Console/index.tsx +88 -0
- package/src/components/Editor/index.tsx +979 -0
- package/src/components/FileTree/index.tsx +477 -0
- package/src/components/LiveContent/index.tsx +221 -0
- package/src/components/LiveContent/video.tsx +213 -0
- package/src/components/LottieAnim/index.tsx +41 -0
- package/src/components/Message/index.tsx +64 -0
- package/src/components/Model/index.tsx +42 -0
- package/src/components/OutputBrowser/index.tsx +180 -0
- package/src/components/Skeleton/index.tsx +41 -0
- package/src/components/Tabs/index.tsx +23 -0
- package/src/components/Terminal/index.tsx +127 -0
- package/src/components/ToolBar/index.tsx +169 -0
- package/src/components/XTerm/index.tsx +113 -0
- package/src/components/index.tsx +4 -0
- package/src/components/loading/index.tsx +282 -0
- package/src/enum/FExtension.ts +168 -0
- package/src/helpers/collections/IoClient.tsx +314 -0
- package/src/helpers/collections/errorCatcher.tsx +0 -0
- package/src/helpers/collections/idb.tsx +186 -0
- package/src/helpers/collections/localStorage.tsx +13 -0
- package/src/helpers/collections/mock.tsx +30 -0
- package/src/helpers/collections/playgroundInit.tsx +311 -0
- package/src/helpers/collections/replay.tsx +168 -0
- package/src/helpers/collections/socket.tsx +6 -0
- package/src/helpers/collections/toast.tsx +19 -0
- package/src/helpers/collections/userTool.tsx +12 -0
- package/src/helpers/collections/util.tsx +4 -0
- package/src/helpers/index.tsx +6 -0
- package/src/helpers/monaco/monaco-ot-adapter.tsx +476 -0
- package/src/hooks/collections/useOT.tsx +38 -0
- package/src/hooks/index.tsx +1 -0
- package/src/pages/index.tsx +450 -0
- package/src/public/dev.html +35 -0
- package/src/public/index.html +45 -0
- package/src/public/sdkserver.html +35 -0
- package/src/stores/index.tsx +1 -0
- package/src/stores/oTStore.tsx +288 -0
- package/src/stories/BrowserWindow.tsx +30 -0
- package/src/stories/Console.tsx +46 -0
- package/src/stories/Editor.tsx +37 -0
- package/src/stories/FileTree.tsx +50 -0
- package/src/stories/Shell.tsx +53 -0
- package/src/stories/introduction.stories.mdx +193 -0
- package/src/stories/page.tsx +71 -0
- package/src/styles/collections/iconfont.scss +1 -0
- package/src/styles/collections/tabs-costumers.scss +20 -0
- package/src/styles/collections/tailwind.scss +3 -0
- package/src/styles/collections/tree-costumers.scss +53 -0
- package/src/styles/collections/utility.scss +10 -0
- package/src/styles/collections/xterm-costumers.scss +47 -0
- package/src/styles/index.scss +19 -0
- package/src/types/editor.d.ts +31 -0
- package/src/types/index.d.ts +158 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
import Index from '~/pages';
|
|
4
|
+
import { ArgsTable, Story } from '@storybook/addon-docs';
|
|
5
|
+
import '../styles/index.scss';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: '组件/Page',
|
|
9
|
+
component: Index,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
playgroundId: {
|
|
15
|
+
description: 'playgroundInfo获取hook',
|
|
16
|
+
// default: 1,
|
|
17
|
+
// control: 'string',
|
|
18
|
+
table: {
|
|
19
|
+
category: '初始化参数',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
// backgroundColor: {
|
|
23
|
+
// description: 'hi',
|
|
24
|
+
// control: 'color',
|
|
25
|
+
// // table: {
|
|
26
|
+
// // category: '初始化参数',
|
|
27
|
+
// // },
|
|
28
|
+
// },
|
|
29
|
+
primary: {
|
|
30
|
+
table: {
|
|
31
|
+
category: 'Colors',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
// borderWidth: { control: { type: 'number', min: 0, max: 10 } },
|
|
35
|
+
|
|
36
|
+
// backgroundColor: {
|
|
37
|
+
// control: 'color',
|
|
38
|
+
// table: {
|
|
39
|
+
// category: 'Colors',
|
|
40
|
+
// // Assigns the argTypes to a specific subcategory
|
|
41
|
+
// subcategory: 'Button colors',
|
|
42
|
+
// },
|
|
43
|
+
// },
|
|
44
|
+
// primary: {
|
|
45
|
+
// table: {
|
|
46
|
+
// category: 'Colors',
|
|
47
|
+
// subcategory: 'Button style',
|
|
48
|
+
// },
|
|
49
|
+
// },
|
|
50
|
+
// // Assigns the argType to the Events category
|
|
51
|
+
// onClick: {
|
|
52
|
+
// table: {
|
|
53
|
+
// category: 'Events',
|
|
54
|
+
// subcategory: 'Button Events',
|
|
55
|
+
// },
|
|
56
|
+
// },
|
|
57
|
+
// // Assigns the argType to the Sizes category
|
|
58
|
+
// size: {
|
|
59
|
+
// table: {
|
|
60
|
+
// category: 'Sizes',
|
|
61
|
+
// },
|
|
62
|
+
// },
|
|
63
|
+
},
|
|
64
|
+
} as Meta;
|
|
65
|
+
|
|
66
|
+
export const Primary = (args) => <Index {...args} />;
|
|
67
|
+
|
|
68
|
+
Primary.args = {
|
|
69
|
+
playgroundId: '329382550470393856',
|
|
70
|
+
// users: []
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url(//at.alicdn.com/t/font_2833282_wku3pmhjs9.css);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.rs-nav.rs-nav-tabs.rs-nav-horizontal {
|
|
2
|
+
border: none;
|
|
3
|
+
.rs-nav-item {
|
|
4
|
+
border: none;
|
|
5
|
+
&.rs-nav-item-active {
|
|
6
|
+
border: 0;
|
|
7
|
+
border-radius: 0;
|
|
8
|
+
border-bottom-width: 1px;
|
|
9
|
+
background-color: #1e1e1e;
|
|
10
|
+
color: #eaeaea;
|
|
11
|
+
}
|
|
12
|
+
&:hover, &:focus {
|
|
13
|
+
border-radius: 0;
|
|
14
|
+
background-color: #1a1a1a;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
.rs-nav-bar {
|
|
18
|
+
border: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
div.rct-tree-root {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
background-color: #15171c;
|
|
5
|
+
color: #ffffff;
|
|
6
|
+
overflow: auto;
|
|
7
|
+
|
|
8
|
+
.rct-tree-item-li {
|
|
9
|
+
.rct-tree-item-title-container {
|
|
10
|
+
.rct-tree-item-arrow {
|
|
11
|
+
flex-shrink: 0;
|
|
12
|
+
}
|
|
13
|
+
.rct-tree-item-avatar {
|
|
14
|
+
width: 20px;
|
|
15
|
+
height: 20px;
|
|
16
|
+
margin-left: 10px;
|
|
17
|
+
background-color: white;
|
|
18
|
+
right: 5px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.rct-tree-root-focus {
|
|
24
|
+
outline: none;
|
|
25
|
+
.rct-tree-item-li-selected {
|
|
26
|
+
.rct-tree-item-title-container-selected {
|
|
27
|
+
background-color: #4b6eaf;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:not(.rct-tree-root-focus) {
|
|
33
|
+
.rct-tree-item-title-container-focused {
|
|
34
|
+
border: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.rct-tree-item-li-selected {
|
|
38
|
+
.rct-tree-item-title-container-selected {
|
|
39
|
+
background-color: #4b6eaf;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
&::-webkit-scrollbar {
|
|
44
|
+
background-color: #1e1e1e;
|
|
45
|
+
width: 6px;
|
|
46
|
+
height: 6px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&::-webkit-scrollbar-thumb {
|
|
50
|
+
background-color: #575757;
|
|
51
|
+
border-radius: 4px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.xterm {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
|
|
5
|
+
.xterm-viewport {
|
|
6
|
+
width: calc(100% + 10px) !important;
|
|
7
|
+
//height: 100%;
|
|
8
|
+
overflow-y: hidden;
|
|
9
|
+
|
|
10
|
+
&::-webkit-scrollbar {
|
|
11
|
+
background-color: #1e1e1e;
|
|
12
|
+
width: 6px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&::-webkit-scrollbar-thumb {
|
|
16
|
+
background-color: #575757;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.xterm-screen {
|
|
22
|
+
width: 100% !important;
|
|
23
|
+
height: 100% !important;
|
|
24
|
+
overflow-y: auto;
|
|
25
|
+
overflow-x: hidden;
|
|
26
|
+
|
|
27
|
+
.xterm-helpers {
|
|
28
|
+
.xterm-helper-user-label {
|
|
29
|
+
position: absolute;
|
|
30
|
+
height: 20px;
|
|
31
|
+
padding: 0 4px;
|
|
32
|
+
transform: translateY(-20px);
|
|
33
|
+
color: #ffffff;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&::-webkit-scrollbar {
|
|
38
|
+
background-color: #1e1e1e;
|
|
39
|
+
width: 6px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&::-webkit-scrollbar-thumb {
|
|
43
|
+
background-color: #575757;
|
|
44
|
+
border-radius: 4px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import "./collections/tailwind.scss";
|
|
2
|
+
@import 'rsuite/dist/rsuite.min.css';
|
|
3
|
+
@import 'xterm/css/xterm.css';
|
|
4
|
+
@import 'react-complex-tree/lib/style.css';
|
|
5
|
+
|
|
6
|
+
@import "./collections/utility.scss";
|
|
7
|
+
@import "./collections/iconfont.scss";
|
|
8
|
+
@import "./collections/tabs-costumers.scss";
|
|
9
|
+
@import "./collections/tree-costumers.scss";
|
|
10
|
+
@import "./collections/xterm-costumers.scss";
|
|
11
|
+
|
|
12
|
+
// $black: #15171C;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
.editor-layout {
|
|
16
|
+
height: 100%;
|
|
17
|
+
flex-flow: 1;
|
|
18
|
+
min-height: 300px;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// export = DaoPaaS;
|
|
2
|
+
// export as namespace DaoPaaS;
|
|
3
|
+
|
|
4
|
+
interface TConstructor {
|
|
5
|
+
ticket: string;
|
|
6
|
+
playgroundId: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
tenantId: string;
|
|
9
|
+
username?: string;
|
|
10
|
+
avatar?: string;
|
|
11
|
+
avatarUrl?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type TReplay = 'stop' | 'disabled' | 'pause';
|
|
15
|
+
|
|
16
|
+
interface TComponentArgs {
|
|
17
|
+
container: string | HTMLElement | Element;
|
|
18
|
+
props?: any;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class DaoPaaS {
|
|
22
|
+
constructor(args: TConstructor): void;
|
|
23
|
+
replay(args: TReplay): void;
|
|
24
|
+
record(arg: boolean): void;
|
|
25
|
+
switchLspServer(arg: boolean): void;
|
|
26
|
+
|
|
27
|
+
/* Components */
|
|
28
|
+
Editor(args: TComponentArgs): void;
|
|
29
|
+
Page(args: TComponentArgs): void;
|
|
30
|
+
Tree(args: TComponentArgs): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/// <reference types="@emotion/react/types/css-prop" />
|
|
2
|
+
/// <reference types="socket.io-client/build/typed-events" />
|
|
3
|
+
|
|
4
|
+
import { Socket } from 'socket.io-client';
|
|
5
|
+
import { TreeItemIndex } from 'react-complex-tree/lib/esm/types';
|
|
6
|
+
import { TextOperation } from 'ot';
|
|
7
|
+
|
|
8
|
+
type WindowType = typeof window;
|
|
9
|
+
// type FileExtraType = 'Add' | 'Get';
|
|
10
|
+
// type EvtType = 'file' | 'editor';
|
|
11
|
+
|
|
12
|
+
export type UserInfo = {
|
|
13
|
+
avatar?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
uuid?: string;
|
|
16
|
+
role?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
declare global {
|
|
20
|
+
interface Window extends WindowType {
|
|
21
|
+
xtermFitAddon: { fit: () => void };
|
|
22
|
+
io: unknown;
|
|
23
|
+
clearCache: () => void;
|
|
24
|
+
Toast: unknown;
|
|
25
|
+
ot: unknown;
|
|
26
|
+
MonacoEnvironment: any;
|
|
27
|
+
}
|
|
28
|
+
interface D42 extends Window {
|
|
29
|
+
log: typeof window.log;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare let LOCAL_IP_HOST: string;
|
|
33
|
+
|
|
34
|
+
declare let d42: D42;
|
|
35
|
+
declare module 'lottie-web';
|
|
36
|
+
// declare module TreeItemIndex;
|
|
37
|
+
namespace D42_FrontType {
|
|
38
|
+
const io: unknown;
|
|
39
|
+
interface SocketType {
|
|
40
|
+
Socket: Socket<DefaultEventsMap, DefaultEventsMap>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
// CRDT
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
type FileExtraType = 'Add' | 'Get' | 'Update' | 'Edit';
|
|
54
|
+
type EvtType = 'File' | 'Editor' | 'Selection' | 'Position';
|
|
55
|
+
|
|
56
|
+
interface CRDT {
|
|
57
|
+
timestamp: string | number;
|
|
58
|
+
userInfo: Pick<UserInfo, 'uuid' | 'role'>;
|
|
59
|
+
editor?: {
|
|
60
|
+
operation?: TextOperation[];
|
|
61
|
+
// selection?: TextSelection;
|
|
62
|
+
selection?: any;
|
|
63
|
+
revision?: number;
|
|
64
|
+
evtType?: EvtType;
|
|
65
|
+
// doc?: {
|
|
66
|
+
// action: FileExtraType;
|
|
67
|
+
// path: string | number;
|
|
68
|
+
// redisKey?: string;
|
|
69
|
+
// value?: string;
|
|
70
|
+
// };
|
|
71
|
+
extraInfo?: any;
|
|
72
|
+
};
|
|
73
|
+
file?: {
|
|
74
|
+
action?: FileExtraType;
|
|
75
|
+
path: string;
|
|
76
|
+
redisKey?: string;
|
|
77
|
+
value?: string;
|
|
78
|
+
};
|
|
79
|
+
selection?: array[];
|
|
80
|
+
terminal?: {
|
|
81
|
+
doc?: {
|
|
82
|
+
action: FileExtraType;
|
|
83
|
+
value?: string;
|
|
84
|
+
};
|
|
85
|
+
extraInfo?: any;
|
|
86
|
+
};
|
|
87
|
+
console?: {
|
|
88
|
+
doc?: {
|
|
89
|
+
action: FileExtraType;
|
|
90
|
+
value?: string;
|
|
91
|
+
};
|
|
92
|
+
extraInfo?: any;
|
|
93
|
+
};
|
|
94
|
+
media?: {
|
|
95
|
+
extraInfo?: {
|
|
96
|
+
segmentId: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface ReplaySource {
|
|
102
|
+
timestamp: string | number;
|
|
103
|
+
userInfo?: Pick<UserInfo, 'uuid' | 'role'>;
|
|
104
|
+
editor?: {
|
|
105
|
+
[key: string]: {
|
|
106
|
+
operation?: TextOperation[];
|
|
107
|
+
// selection?: TextSelection;
|
|
108
|
+
selection?: any;
|
|
109
|
+
revision?: number;
|
|
110
|
+
evtType?: EvtType;
|
|
111
|
+
// doc?: {
|
|
112
|
+
// action: FileExtraType;
|
|
113
|
+
// path: string | number;
|
|
114
|
+
// redisKey?: string;
|
|
115
|
+
// value?: string;
|
|
116
|
+
// };
|
|
117
|
+
extraInfo?: any;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
file?: {
|
|
121
|
+
[key: string]: {
|
|
122
|
+
action: FileExtraType;
|
|
123
|
+
path: string | number;
|
|
124
|
+
redisKey?: string;
|
|
125
|
+
value?: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
selection?: {
|
|
129
|
+
[key: string]: [][];
|
|
130
|
+
};
|
|
131
|
+
terminal?: {
|
|
132
|
+
[key: string]: {
|
|
133
|
+
doc?: {
|
|
134
|
+
action: FileExtraType;
|
|
135
|
+
value?: string;
|
|
136
|
+
};
|
|
137
|
+
extraInfo?: any;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
console?: {
|
|
141
|
+
[key: string]: {
|
|
142
|
+
doc?: {
|
|
143
|
+
action: FileExtraType;
|
|
144
|
+
value?: string;
|
|
145
|
+
};
|
|
146
|
+
extraInfo?: any;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
media?: {
|
|
150
|
+
[key: string]: {
|
|
151
|
+
extraInfo?: {
|
|
152
|
+
segmentId: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|