@dao42/d42paas-front 0.4.1 → 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/dist/1569.js +1 -1
- package/dist/1585.js +1 -1
- package/dist/1593.js +1 -1
- package/dist/1594.js +1 -1
- package/dist/162.js +1 -1
- package/dist/1649.js +1 -1
- package/dist/1742.js +1 -1
- package/dist/1941.js +1 -1
- package/dist/2014.js +1 -1
- package/dist/2088.js +1 -1
- package/dist/2235.js +3 -3
- package/dist/2271.js +1 -1
- package/dist/2287.js +3 -3
- package/dist/2388.js +1 -1
- package/dist/2583.js +1 -1
- package/dist/2862.js +1 -1
- package/dist/2906.js +1 -1
- package/dist/300.js +1 -1
- package/dist/3008.js +1 -1
- package/dist/317.js +1 -1
- package/dist/3315.js +1 -1
- package/dist/3399.js +1 -1
- package/dist/3504.js +1 -1
- package/dist/3553.js +2 -2
- package/dist/3673.js +1 -1
- package/dist/3780.js +1 -1
- package/dist/3855.js +1 -1
- package/dist/4035.js +1 -1
- package/dist/4073.js +1 -1
- package/dist/4246.js +1 -1
- package/dist/4366.js +1 -1
- package/dist/4369.js +1 -1
- package/dist/4454.js +1 -1
- package/dist/4511.js +2 -2
- package/dist/4558.js +1 -1
- package/dist/4610.js +1 -1
- package/dist/471.js +1 -1
- package/dist/4858.js +1 -1
- package/dist/4896.js +1 -1
- package/dist/491.js +1 -1
- package/dist/5257.js +1 -1
- package/dist/5454.js +1 -1
- package/dist/5524.js +1 -1
- package/dist/5669.js +2 -2
- package/dist/5881.js +1 -1
- package/dist/5900.js +2 -2
- package/dist/5924.js +1 -1
- package/dist/5925.js +1 -1
- package/dist/5972.js +1 -1
- package/dist/5974.js +1 -1
- package/dist/6022.js +2 -2
- package/dist/6120.js +1 -1
- package/dist/615.js +1 -1
- package/dist/6162.js +1 -1
- package/dist/6175.js +1 -1
- package/dist/622.js +1 -1
- package/dist/6223.js +1 -1
- package/dist/6330.js +1 -1
- package/dist/6331.js +1 -1
- package/dist/6354.js +2 -2
- package/dist/6751.js +2 -2
- package/dist/6792.js +1 -1
- package/dist/6844.js +1 -1
- package/dist/7125.js +1 -1
- package/dist/7127.js +1 -1
- package/dist/7135.js +2 -2
- package/dist/7148.js +1 -1
- package/dist/7447.js +1 -1
- package/dist/7453.js +2 -2
- package/dist/7483.js +1 -1
- package/dist/7604.js +1 -1
- package/dist/7971.js +1 -1
- package/dist/8147.js +1 -1
- package/dist/8308.js +1 -1
- package/dist/8309.js +1 -1
- package/dist/8327.js +1 -1
- package/dist/849.js +1 -1
- package/dist/8677.js +1 -1
- package/dist/868.js +1 -1
- package/dist/8947.js +1 -1
- package/dist/930.js +1 -1
- package/dist/9342.js +2 -2
- package/dist/9482.js +1 -1
- package/dist/9538.js +1 -1
- package/dist/9741.js +2 -2
- package/dist/9909.js +1 -1
- package/dist/9953.js +2 -2
- package/dist/daoPaaS.js +3 -3
- package/dist/index.d.ts +31 -31
- package/dist/index.html +16 -16
- package/package.json +163 -161
- 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,288 @@
|
|
|
1
|
+
import { Client } from 'ot';
|
|
2
|
+
import qs from 'qs';
|
|
3
|
+
import create from 'zustand';
|
|
4
|
+
import { daopaasDB, GenerateDB, SetDB } from '~/helpers/collections/idb';
|
|
5
|
+
import { persist } from 'zustand/middleware';
|
|
6
|
+
// import { get, set } from 'idb-keyval';
|
|
7
|
+
|
|
8
|
+
// Web-worker 待补充
|
|
9
|
+
export interface T_UserInfo {
|
|
10
|
+
playgroundId?: string;
|
|
11
|
+
operation?: any;
|
|
12
|
+
uuid?: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
role?: string;
|
|
17
|
+
avatar?: string;
|
|
18
|
+
onlineCount?: number;
|
|
19
|
+
userId?: string;
|
|
20
|
+
// [x: string]:
|
|
21
|
+
// | string
|
|
22
|
+
// | number
|
|
23
|
+
// | qs.ParsedQs
|
|
24
|
+
// | string[]
|
|
25
|
+
// | number[]
|
|
26
|
+
// | qs.ParsedQs[];
|
|
27
|
+
// [x: string]: string | qs.ParsedQs | string[] | qs.ParsedQs[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface T_File {
|
|
31
|
+
valueAndPos?: string;
|
|
32
|
+
path?: string;
|
|
33
|
+
value?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface T_Query {
|
|
37
|
+
playgroundId?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type T_PlaygroundStatus = 'EMPTY' | 'ACTIVE' | 'INACTIVE';
|
|
41
|
+
export type T_DockerStatus = 'RUNNING' | 'STOP';
|
|
42
|
+
|
|
43
|
+
export interface T_PlaygroundInfo {
|
|
44
|
+
fileTree?: unknown;
|
|
45
|
+
framework?: string;
|
|
46
|
+
frameworkVersion?: string;
|
|
47
|
+
language?: string;
|
|
48
|
+
languageVersion?: string;
|
|
49
|
+
needBrowser?: boolean;
|
|
50
|
+
needConsole?: boolean;
|
|
51
|
+
needRunButton?: boolean;
|
|
52
|
+
url?: string;
|
|
53
|
+
version?: string;
|
|
54
|
+
frameWork?: string;
|
|
55
|
+
frameWorkVersion?: string;
|
|
56
|
+
status?: string;
|
|
57
|
+
runStatus?: string;
|
|
58
|
+
terminalHistory?: string;
|
|
59
|
+
messageId?: string;
|
|
60
|
+
playgroundId?: string;
|
|
61
|
+
result?: string;
|
|
62
|
+
lspUrl?: string;
|
|
63
|
+
ticket?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// const IDBStorage = {
|
|
67
|
+
// getItem: async (name: string): Promise<string | null> => {
|
|
68
|
+
// // Exit early on server
|
|
69
|
+
// if (typeof indexedDB === 'undefined') {
|
|
70
|
+
// return null;
|
|
71
|
+
// }
|
|
72
|
+
|
|
73
|
+
// return (await get(name)) || null;
|
|
74
|
+
// },
|
|
75
|
+
// setItem: async (name: string, value: string): Promise<void> => {
|
|
76
|
+
// // Exit early on server
|
|
77
|
+
// if (typeof indexedDB === 'undefined') {
|
|
78
|
+
// return null;
|
|
79
|
+
// }
|
|
80
|
+
// set(name, value);
|
|
81
|
+
// },
|
|
82
|
+
// };
|
|
83
|
+
|
|
84
|
+
export type StateType = {
|
|
85
|
+
appStatus: 'code' | 'replay' | 'recording' | 'pause';
|
|
86
|
+
isRecording: boolean;
|
|
87
|
+
lspServerDisabled: boolean;
|
|
88
|
+
setAppStatus: (arg: StateType['appStatus']) => void;
|
|
89
|
+
setGlobalData: (arg: Pick<StateType, 'isRecording'>) => void;
|
|
90
|
+
switchLspServer: (arg: boolean) => void;
|
|
91
|
+
client?: Client;
|
|
92
|
+
userInfo: T_UserInfo;
|
|
93
|
+
senders: T_UserInfo[];
|
|
94
|
+
doc?: T_File;
|
|
95
|
+
// TODO :FIXED any
|
|
96
|
+
fileTree?: any;
|
|
97
|
+
CRDTInfo: D42_FrontType.CRDT;
|
|
98
|
+
serverAck: number;
|
|
99
|
+
customAck: number;
|
|
100
|
+
revision: number;
|
|
101
|
+
// TO FIXED any
|
|
102
|
+
dockerInfo: any;
|
|
103
|
+
globalData: Pick<StateType, 'isRecording'>;
|
|
104
|
+
|
|
105
|
+
playgroundInfo: T_PlaygroundInfo;
|
|
106
|
+
playgroundStatus: T_PlaygroundStatus;
|
|
107
|
+
dockerStatus: T_DockerStatus;
|
|
108
|
+
fromServer: boolean;
|
|
109
|
+
setFromServer: (arg: boolean) => void;
|
|
110
|
+
queryObject: T_Query;
|
|
111
|
+
setIsRecording: (arg: boolean) => void;
|
|
112
|
+
fileSaved: boolean;
|
|
113
|
+
setFileSaved: (arg: boolean) => void;
|
|
114
|
+
switchDoc?: (arg: T_File) => void;
|
|
115
|
+
switchDocTree?: (arg: any) => void;
|
|
116
|
+
setUserInfo: (arg: T_UserInfo) => void;
|
|
117
|
+
setSenders: (arg: T_UserInfo[]) => void;
|
|
118
|
+
setCRDTInfo: (arg: D42_FrontType.CRDT) => void;
|
|
119
|
+
setServerAck: () => void;
|
|
120
|
+
setCustomAck: () => void;
|
|
121
|
+
setVersion: (arg: number) => void;
|
|
122
|
+
setPlaygroundInfo: (arg: unknown) => void;
|
|
123
|
+
setDockerInfo: (arg: unknown) => void;
|
|
124
|
+
setPlaygroundStatus: (arg: T_PlaygroundStatus) => void;
|
|
125
|
+
setDockerStatus: (arg: T_DockerStatus) => void;
|
|
126
|
+
setQueryObject: (arg: unknown) => void;
|
|
127
|
+
setClientInstance: (arg: number) => void;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// console.log();
|
|
131
|
+
|
|
132
|
+
const QUERY_ARGUMENTS = (qs.parse(location.search.slice(1)) as unknown) as any;
|
|
133
|
+
const user = localStorage.getItem('userInfo');
|
|
134
|
+
// const localUser = user ? JSON.parse(user) : {};
|
|
135
|
+
|
|
136
|
+
export const oTStore = create<Omit<StateType, 'userInfo' | 'setUserInfo'>>(
|
|
137
|
+
(set) => ({
|
|
138
|
+
appStatus: 'code',
|
|
139
|
+
setAppStatus: (arg) => set(() => ({ appStatus: arg })),
|
|
140
|
+
fromServer: false,
|
|
141
|
+
setFromServer: (arg: boolean) => set(() => ({ fromServer: arg })),
|
|
142
|
+
client: null,
|
|
143
|
+
senders: [],
|
|
144
|
+
doc: {},
|
|
145
|
+
fileTree: {
|
|
146
|
+
data: {
|
|
147
|
+
type: 'DIRECTORY',
|
|
148
|
+
name: '/',
|
|
149
|
+
children: [],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
isRecording: false,
|
|
153
|
+
CRDTInfo: ({
|
|
154
|
+
operation: [],
|
|
155
|
+
userInfo: {},
|
|
156
|
+
evtType: '',
|
|
157
|
+
timestamp: '',
|
|
158
|
+
} as unknown) as D42_FrontType.CRDT,
|
|
159
|
+
serverAck: 0,
|
|
160
|
+
customAck: 0,
|
|
161
|
+
revision: 0,
|
|
162
|
+
dockerInfo: {},
|
|
163
|
+
playgroundInfo: {
|
|
164
|
+
data: {
|
|
165
|
+
fileTree: {},
|
|
166
|
+
framework: '',
|
|
167
|
+
frameworkVersion: null,
|
|
168
|
+
language: '',
|
|
169
|
+
languageVersion: null,
|
|
170
|
+
needBrowser: true,
|
|
171
|
+
needConsole: true,
|
|
172
|
+
needRunButton: true,
|
|
173
|
+
url: '',
|
|
174
|
+
version: '',
|
|
175
|
+
terminalHistory: '',
|
|
176
|
+
},
|
|
177
|
+
messageId: '',
|
|
178
|
+
playgroundId: QUERY_ARGUMENTS.playgroundId,
|
|
179
|
+
result: '',
|
|
180
|
+
},
|
|
181
|
+
playgroundStatus: 'EMPTY',
|
|
182
|
+
dockerStatus: 'STOP',
|
|
183
|
+
queryObject: {},
|
|
184
|
+
globalData: {
|
|
185
|
+
isRecording: false,
|
|
186
|
+
},
|
|
187
|
+
fileSaved: true,
|
|
188
|
+
lspServerDisabled: false,
|
|
189
|
+
switchLspServer: (arg) => set(() => ({ lspServerDisabled: arg })),
|
|
190
|
+
setIsRecording: (arg) => set(() => ({ isRecording: arg })),
|
|
191
|
+
setFileSaved: (arg) => set(() => ({ fileSaved: arg })),
|
|
192
|
+
switchDoc: (arg) => set(() => ({ doc: arg })),
|
|
193
|
+
switchDocTree: (arg) => set(() => ({ fileTree: arg })),
|
|
194
|
+
|
|
195
|
+
setSenders: (arg) => set(() => ({ senders: arg })),
|
|
196
|
+
setCRDTInfo: (arg) => set(() => ({ CRDTInfo: arg })),
|
|
197
|
+
setServerAck: () =>
|
|
198
|
+
set(({ serverAck }) => {
|
|
199
|
+
return {
|
|
200
|
+
serverAck: serverAck + 1,
|
|
201
|
+
};
|
|
202
|
+
}),
|
|
203
|
+
setCustomAck: () =>
|
|
204
|
+
set(({ customAck }) => {
|
|
205
|
+
return {
|
|
206
|
+
customAck: customAck + 1,
|
|
207
|
+
};
|
|
208
|
+
}),
|
|
209
|
+
setGlobalData: (arg) =>
|
|
210
|
+
set(({ appStatus }) => {
|
|
211
|
+
if (
|
|
212
|
+
arg.hasOwnProperty('isRecording') &&
|
|
213
|
+
arg.isRecording &&
|
|
214
|
+
(appStatus === 'replay' || appStatus === 'pause')
|
|
215
|
+
) {
|
|
216
|
+
throw 'dError: 回放中无法录制!';
|
|
217
|
+
// throw '录制过程中无法回放!';
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
globalData: arg,
|
|
221
|
+
};
|
|
222
|
+
}),
|
|
223
|
+
setVersion: (arg) => set(() => ({ revision: arg })),
|
|
224
|
+
setPlaygroundInfo: (arg) => set(() => ({ playgroundInfo: arg })),
|
|
225
|
+
setDockerInfo: (arg) => set(() => ({ dockerInfo: arg })),
|
|
226
|
+
setPlaygroundStatus: (arg) => set(() => ({ playgroundStatus: arg })),
|
|
227
|
+
setDockerStatus: (arg) => set(() => ({ dockerStatus: arg })),
|
|
228
|
+
setQueryObject: (arg) => set(() => ({ queryObject: arg })),
|
|
229
|
+
setClientInstance: (arg) => set(() => ({ client: new Client(arg) })),
|
|
230
|
+
}),
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
export const userStore = create<Pick<StateType, 'userInfo' | 'setUserInfo'>>(
|
|
234
|
+
persist(
|
|
235
|
+
(set) => ({
|
|
236
|
+
userInfo: {
|
|
237
|
+
...QUERY_ARGUMENTS,
|
|
238
|
+
},
|
|
239
|
+
setUserInfo: (arg) => set(() => ({ userInfo: arg })),
|
|
240
|
+
}),
|
|
241
|
+
{
|
|
242
|
+
name: 'userInfo',
|
|
243
|
+
getStorage: () => localStorage,
|
|
244
|
+
},
|
|
245
|
+
),
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
export const userListStore = create<{
|
|
249
|
+
userList: T_UserInfo[];
|
|
250
|
+
setUserList: (arg: T_UserInfo[]) => void;
|
|
251
|
+
}>(
|
|
252
|
+
persist(
|
|
253
|
+
(set) => ({
|
|
254
|
+
userList: [],
|
|
255
|
+
setUserList: (arg) => set(() => ({ userList: arg })),
|
|
256
|
+
}),
|
|
257
|
+
{
|
|
258
|
+
name: 'userList',
|
|
259
|
+
getStorage: () => ({
|
|
260
|
+
getItem: async (name: string): Promise<any> => {
|
|
261
|
+
// Exit early on server
|
|
262
|
+
if (typeof indexedDB === 'undefined') {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
// (await daopaasDB).getAll(name);
|
|
266
|
+
// const john = await get(name);
|
|
267
|
+
// debugger;
|
|
268
|
+
return (await daopaasDB).getAll(name) || null;
|
|
269
|
+
},
|
|
270
|
+
setItem: async (name: string, value: string): Promise<void> => {
|
|
271
|
+
// Exit early on server
|
|
272
|
+
if (typeof indexedDB === 'undefined') {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
(await daopaasDB).put(
|
|
276
|
+
'users',
|
|
277
|
+
JSON.parse(value).state[name],
|
|
278
|
+
'userList',
|
|
279
|
+
);
|
|
280
|
+
// set(name, value);
|
|
281
|
+
},
|
|
282
|
+
removeItem: async () => {
|
|
283
|
+
console.log();
|
|
284
|
+
},
|
|
285
|
+
}),
|
|
286
|
+
},
|
|
287
|
+
),
|
|
288
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Meta } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import BrowserWindow from '~/components/OutputBrowser';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: '组件/BrowserWindow',
|
|
9
|
+
component: BrowserWindow,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
url: {
|
|
15
|
+
description: '输出窗口预览链接',
|
|
16
|
+
defaultValue: 'http://',
|
|
17
|
+
type: 'string',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
} as Meta;
|
|
21
|
+
|
|
22
|
+
export const Primary = (args) => (
|
|
23
|
+
<div style={{ backgroundColor: '#b4e0df', height: '100%' }}>
|
|
24
|
+
<BrowserWindow {...args} />
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
Primary.args = {
|
|
29
|
+
url: 'http://localhost:8080',
|
|
30
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Meta } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import Console from '~/components/Console';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: '组件/Console',
|
|
9
|
+
component: Console,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
options: {
|
|
15
|
+
description: 'Console 配置',
|
|
16
|
+
type: 'ITerminalOptions',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
} as Meta;
|
|
20
|
+
|
|
21
|
+
export const Primary = (args) => (
|
|
22
|
+
<div
|
|
23
|
+
style={{
|
|
24
|
+
height: '70vh',
|
|
25
|
+
width: '80vw',
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<Console {...args} />
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
Primary.args = {
|
|
33
|
+
options: {
|
|
34
|
+
convertEol: true,
|
|
35
|
+
fontSize: 12,
|
|
36
|
+
fontFamily: 'Monaco, Menlo, monospace',
|
|
37
|
+
lineHeight: 1,
|
|
38
|
+
cursorBlink: true,
|
|
39
|
+
cursorWidth: 1,
|
|
40
|
+
cursorStyle: 'block',
|
|
41
|
+
rightClickSelectsWord: true,
|
|
42
|
+
theme: {
|
|
43
|
+
background: '#1E1E1E',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Button.stories.js | Button.stories.jsx
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { Meta } from '@storybook/react';
|
|
6
|
+
|
|
7
|
+
import { Editor } from '~/components';
|
|
8
|
+
|
|
9
|
+
import '../styles/index.scss';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: '组件/Editor',
|
|
13
|
+
component: Editor,
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'fullscreen',
|
|
16
|
+
},
|
|
17
|
+
} as Meta;
|
|
18
|
+
|
|
19
|
+
export const Primary = (args) => <Editor {...args} />;
|
|
20
|
+
// export const Primary = (args) => <FileTree {...args} />;
|
|
21
|
+
Primary.args = {
|
|
22
|
+
doc: '',
|
|
23
|
+
// users: []
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Primary.storyName = 'Editor';
|
|
27
|
+
// export const LoggedIn = Primary.bind({
|
|
28
|
+
// // user: {},
|
|
29
|
+
// doc: '',
|
|
30
|
+
// });
|
|
31
|
+
|
|
32
|
+
// LoggedIn.args = {
|
|
33
|
+
// user: {},
|
|
34
|
+
// };
|
|
35
|
+
|
|
36
|
+
// export const LoggedOut = Template.bind({});
|
|
37
|
+
// LoggedOut.args = {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Meta } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { FileTree } from '~/components/FileTree';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: '组件/FileTree',
|
|
9
|
+
component: FileTree,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
onCustomSelect: {
|
|
15
|
+
description: '用户自定义选择操作方法',
|
|
16
|
+
defaultValue: `null`,
|
|
17
|
+
type: 'Function',
|
|
18
|
+
},
|
|
19
|
+
onCustomExpand: {
|
|
20
|
+
description: '用户自定义展开操作方法',
|
|
21
|
+
defaultValue: `null`,
|
|
22
|
+
type: 'Function',
|
|
23
|
+
},
|
|
24
|
+
onCustomCollapse: {
|
|
25
|
+
description: '用户自定义折叠操作方法',
|
|
26
|
+
defaultValue: `null`,
|
|
27
|
+
type: 'Function',
|
|
28
|
+
},
|
|
29
|
+
onCustomFocus: {
|
|
30
|
+
description: '用户自定义聚焦操作方法',
|
|
31
|
+
defaultValue: `null`,
|
|
32
|
+
type: 'Function',
|
|
33
|
+
},
|
|
34
|
+
onCustomUpload: {
|
|
35
|
+
description: '用户自定义上传操作方法',
|
|
36
|
+
defaultValue: `null`,
|
|
37
|
+
type: 'Function',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
} as Meta;
|
|
41
|
+
|
|
42
|
+
export const Primary = (args) => <FileTree {...args} />;
|
|
43
|
+
|
|
44
|
+
Primary.args = {
|
|
45
|
+
onCustomSelect: null,
|
|
46
|
+
onCustomExpand: null,
|
|
47
|
+
onCustomCollapse: null,
|
|
48
|
+
onCustomFocus: null,
|
|
49
|
+
onCustomUpload: null,
|
|
50
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Meta } from '@storybook/react';
|
|
4
|
+
import Shell from '~/components/Terminal';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: '组件/Shell',
|
|
8
|
+
component: Shell,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
options: {
|
|
14
|
+
description: 'Shell 配置',
|
|
15
|
+
type: 'ITerminalOptions',
|
|
16
|
+
},
|
|
17
|
+
postUser: {
|
|
18
|
+
description: '当前操作者',
|
|
19
|
+
type: 'T_UserInfo',
|
|
20
|
+
},
|
|
21
|
+
corTime: {
|
|
22
|
+
description: '操作发生时的时间戳',
|
|
23
|
+
type: 'number',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
} as Meta;
|
|
27
|
+
|
|
28
|
+
export const Primary = (args) => (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
height: '70vh',
|
|
32
|
+
width: '80vw',
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Shell {...args} />
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
Primary.args = {
|
|
40
|
+
options: {
|
|
41
|
+
convertEol: true,
|
|
42
|
+
fontSize: 12,
|
|
43
|
+
fontFamily: 'Monaco, Menlo, monospace',
|
|
44
|
+
lineHeight: 1,
|
|
45
|
+
cursorBlink: true,
|
|
46
|
+
cursorWidth: 1,
|
|
47
|
+
cursorStyle: 'block',
|
|
48
|
+
rightClickSelectsWord: true,
|
|
49
|
+
theme: {
|
|
50
|
+
background: '#1E1E1E',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
|
2
|
+
import Code from '../assets/code-brackets.svg';
|
|
3
|
+
import Colors from '../assets/colors.svg';
|
|
4
|
+
import Comments from '../assets/comments.svg';
|
|
5
|
+
import Direction from '../assets/direction.svg';
|
|
6
|
+
import Flow from '../assets/flow.svg';
|
|
7
|
+
import Plugin from '../assets/plugin.svg';
|
|
8
|
+
import Repo from '../assets/repo.svg';
|
|
9
|
+
import StackAlt from '../assets/stackalt.svg';
|
|
10
|
+
import '../styles/index.scss';
|
|
11
|
+
// import { LottieAnim } from '../components/LottieAnim';
|
|
12
|
+
// import * as LottiePlayer from "@lottiefiles/lottie-player";
|
|
13
|
+
// require("@lottiefiles/lottie-player");
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<Meta title="使用说明/Introduction" />
|
|
17
|
+
|
|
18
|
+
<style>{`
|
|
19
|
+
.subheading {
|
|
20
|
+
--mediumdark: '#999999';
|
|
21
|
+
font-weight: 900;
|
|
22
|
+
font-size: 13px;
|
|
23
|
+
color: #999;
|
|
24
|
+
letter-spacing: 6px;
|
|
25
|
+
line-height: 24px;
|
|
26
|
+
text-transform: uppercase;
|
|
27
|
+
margin-bottom: 12px;
|
|
28
|
+
margin-top: 40px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.link-list {
|
|
32
|
+
display: grid;
|
|
33
|
+
grid-template-columns: 1fr;
|
|
34
|
+
grid-template-rows: 1fr 1fr;
|
|
35
|
+
row-gap: 10px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (min-width: 620px) {
|
|
39
|
+
.link-list {
|
|
40
|
+
row-gap: 20px;
|
|
41
|
+
column-gap: 20px;
|
|
42
|
+
grid-template-columns: 1fr 1fr;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@media all and (-ms-high-contrast:none) {
|
|
47
|
+
.link-list {
|
|
48
|
+
display: -ms-grid;
|
|
49
|
+
-ms-grid-columns: 1fr 1fr;
|
|
50
|
+
-ms-grid-rows: 1fr 1fr;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.link-item {
|
|
55
|
+
display: block;
|
|
56
|
+
padding: 20px 30px 20px 15px;
|
|
57
|
+
border: 1px solid #00000010;
|
|
58
|
+
border-radius: 5px;
|
|
59
|
+
transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
|
|
60
|
+
color: #333333;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: flex-start;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.link-item:hover {
|
|
66
|
+
border-color: #1EA7FD50;
|
|
67
|
+
transform: translate3d(0, -3px, 0);
|
|
68
|
+
box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.link-item:active {
|
|
72
|
+
border-color: #1EA7FD;
|
|
73
|
+
transform: translate3d(0, 0, 0);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.link-item strong {
|
|
77
|
+
font-weight: 700;
|
|
78
|
+
display: block;
|
|
79
|
+
margin-bottom: 2px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.link-item img {
|
|
83
|
+
height: 40px;
|
|
84
|
+
width: 40px;
|
|
85
|
+
margin-right: 15px;
|
|
86
|
+
flex: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.link-item span {
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
line-height: 20px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tip {
|
|
95
|
+
display: inline-block;
|
|
96
|
+
border-radius: 1em;
|
|
97
|
+
font-size: 11px;
|
|
98
|
+
line-height: 12px;
|
|
99
|
+
font-weight: 700;
|
|
100
|
+
background: #E7FDD8;
|
|
101
|
+
color: #66BF3C;
|
|
102
|
+
padding: 4px 12px;
|
|
103
|
+
margin-right: 10px;
|
|
104
|
+
vertical-align: top;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.tip-wrapper {
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
line-height: 20px;
|
|
110
|
+
margin-top: 40px;
|
|
111
|
+
margin-bottom: 40px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.tip-wrapper code {
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
display: inline-block;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
`}</style>
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# PaaS SDK
|
|
124
|
+
<!-- ## 使用示例 -->
|
|
125
|
+
### 依赖安装
|
|
126
|
+
|
|
127
|
+
#### yarn
|
|
128
|
+
yarn add @dao42/d42paas-front
|
|
129
|
+
|
|
130
|
+
#### npm
|
|
131
|
+
npm install @dao42/d42paas-front
|
|
132
|
+
|
|
133
|
+
### 初始化
|
|
134
|
+
```javascript
|
|
135
|
+
import DaoPaaS from '@dao42/d42paas-front';
|
|
136
|
+
var dao_paas = new DaoPaaS({
|
|
137
|
+
ticket,
|
|
138
|
+
playgroundId,
|
|
139
|
+
userId,
|
|
140
|
+
tenantId,
|
|
141
|
+
username
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
Editor 组件
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
<div className="link-list">
|
|
148
|
+
<a className="link-item" href="?path=/story/组件-editor--primary">
|
|
149
|
+
<img src={Direction} alt="direction" />
|
|
150
|
+
<span>
|
|
151
|
+
<strong>Editor</strong>
|
|
152
|
+
{/* 核心编辑功能 */}
|
|
153
|
+
dao_paas.Editor()
|
|
154
|
+
</span>
|
|
155
|
+
</a>
|
|
156
|
+
<a className="link-item" href="?path=/story/组件-fileTree--primary">
|
|
157
|
+
<img src={Direction} alt="direction" />
|
|
158
|
+
<span>
|
|
159
|
+
<strong>FileTree</strong>
|
|
160
|
+
{/* 核心编辑功能 */}
|
|
161
|
+
dao_paas.FileTree()
|
|
162
|
+
</span>
|
|
163
|
+
</a>
|
|
164
|
+
<a className="link-item" href="?path=/story/组件-browserWindow--primary">
|
|
165
|
+
<img src={Direction} alt="direction" />
|
|
166
|
+
<span>
|
|
167
|
+
<strong>BrowserWindow</strong>
|
|
168
|
+
{/* 核心编辑功能 */}
|
|
169
|
+
dao_paas.BrowserWindow()
|
|
170
|
+
</span>
|
|
171
|
+
</a>
|
|
172
|
+
<a className="link-item" href="?path=/story/组件-shell--primary">
|
|
173
|
+
<img src={Direction} alt="direction" />
|
|
174
|
+
<span>
|
|
175
|
+
<strong>Shell</strong>
|
|
176
|
+
{/* 核心编辑功能 */}
|
|
177
|
+
dao_paas.Shell()
|
|
178
|
+
</span>
|
|
179
|
+
</a>
|
|
180
|
+
<a className="link-item" href="?path=/story/组件-console--primary">
|
|
181
|
+
<img src={Direction} alt="direction" />
|
|
182
|
+
<span>
|
|
183
|
+
<strong>Console</strong>
|
|
184
|
+
{/* 核心编辑功能 */}
|
|
185
|
+
dao_paas.Console()
|
|
186
|
+
</span>
|
|
187
|
+
</a>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div className="tip-wrapper">
|
|
191
|
+
<span className="tip">Tip</span>Edit the Markdown in{' '}
|
|
192
|
+
<code>src/client/PaaS/stories/Introduction.stories.mdx</code>
|
|
193
|
+
</div>
|