@dao42/d42paas-front 0.7.39 → 0.7.43

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/editor.d.ts CHANGED
@@ -1,353 +1,593 @@
1
- /*!-----------------------------------------------------------
2
- * Copyright (c) dao42. All rights reserved.
3
- * Type definitions for @dao42/d42paas-front
4
- * Released under the MIT license
5
- *-----------------------------------------------------------*/
6
-
7
- /*---------------------------------------------------------------------------------------------
8
- * Copyright (c) Microsoft Corporation. All rights reserved.
9
- * Licensed under the MIT License. See License.txt in the project root for license information.
10
- *--------------------------------------------------------------------------------------------*/
11
-
12
- export type componentType = 'Tree' | 'Editor' | 'Console' | 'Browser' | 'Shell';
13
-
14
- export type Mode = 'tsdoc' | 'singleFile' | 'IDE';
15
-
16
- export type PlaygroundStatus = 'EMPTY' | 'ACTIVE' | 'INACTIVE';
17
-
18
- export type Replay = 'stop' | 'disabled' | 'pause';
19
-
20
- export type DockerStatus = 'RUNNING' | 'STOP';
21
-
22
- type MessageType = {
23
- PlaygroundStatus?: PlaygroundStatus;
24
- dockerStatus?: DockerStatus;
25
- userList?: UserInfo[];
26
- followingUser: UserInfo;
27
- };
28
-
29
- type ErrorType = {
30
- message: {
31
- content: string;
32
- playgroundId: string;
33
- timestamp: number;
34
- };
35
- };
36
-
37
- /**
38
- * Userinfo type
39
- */
40
- interface UserInfo {
41
- playgroundId?: string;
42
- operation?: any;
43
- uuid?: string;
44
- color?: string;
45
- name?: string;
46
- username?: string;
47
- userId?: string;
48
- role?: string;
49
- avatar?: string;
50
- onlineCount?: number;
51
- }
52
-
53
- type ReplayType = {
54
- userId?: UserInfo['userId'];
55
- timestamp: number;
56
- };
57
-
58
- type TreeProps = {
59
- dropBgColor?: string;
60
- dropTextColor?: string;
61
- hoverBgColor?: string;
62
- hoverTextColor?: string;
63
- bgColor?: string;
64
- fontColor?: string;
65
- onClick?: (arg: { path: string; uri: string }) => void;
66
- };
67
-
68
- export type MenuTagProps = {
69
- menuStyle?: {
70
- backgroundColor?: string;
71
- textColor?: string;
72
- hoverBgColor?: string;
73
- hoverTextColor?: string;
74
- iconColor?: string;
75
- hoverIconColor?: string;
76
- };
77
- };
78
-
79
- export type EditorTheme = {
80
- theme?: {
81
- marginViewOverlays?: string;
82
- lineNumbers?: string;
83
- activeLineNumber?: string;
84
- };
85
- };
86
-
87
- export type ShellProps = {
88
- fontSize?: number;
89
- fontFamily?: string;
90
- lineHeight?: number;
91
- cursorBlink?: boolean;
92
- cursorWidth?: number;
93
- cursorStyle?: string;
94
- rightClickSelectsWord?: boolean;
95
- theme?: {
96
- background?: string;
97
- };
98
- };
99
-
100
- export type OutputBrowserProp = {
101
- url?: string;
102
- showURL?: boolean;
103
- freshIconColor?: string;
104
- inputColor?: string;
105
- openIconColor?: string;
106
- };
107
-
108
- /**
109
- * Passing the values to init the playground.
110
- */
111
- export interface Options {
112
- debug?: boolean;
113
-
114
- /**
115
- *
116
- * Error listener to the aplication.
117
- * @param error
118
- */
119
- onError?: (error: ErrorType) => void;
120
-
121
- /**
122
- *
123
- * Message listener to the aplication.
124
- * @param MessageType
125
- */
126
- onMessage?: (message: MessageType) => void;
127
-
128
- serviceWorkerOrigin?: string;
129
-
130
- /**
131
- *
132
- * init the playground with the mode.
133
- *
134
- */
135
- mode?: Mode;
136
-
137
- /**
138
- *
139
- * init the playground with the paasDomain.
140
- *
141
- */
142
- paasDomain: string;
143
-
144
- /**
145
- *
146
- * init the playground ticket needed.
147
- *
148
- */
149
- ticket: string;
150
-
151
- /**
152
- *
153
- * to init the playground with this id.
154
- *
155
- */
156
- playgroundId: string;
157
-
158
- /**
159
- *
160
- * userId for the playground.
161
- *
162
- */
163
- userId: string;
164
-
165
- /**
166
- *
167
- * tenantId for the playground.
168
- *
169
- */
170
- tenantId: string;
171
-
172
- /**
173
- *
174
- * username for the playground.
175
- *
176
- */
177
- username?: string;
178
-
179
- /**
180
- *
181
- * avatarUrl for the playground but not necessarily.
182
- *
183
- */
184
- avatarUrl?: string;
185
-
186
- /**
187
- *
188
- * this argument is to ingnore replaying patterns.
189
- *
190
- */
191
- ignoreReplayers?: string[];
192
-
193
- components?: UserComponent[];
194
-
195
- /**
196
- * @deprecated to fix the issue of the playground.
197
- *
198
- * render?: () => TComponentArgs[]; keyof D42_FrontType['CRDT'][]
199
- */
200
- }
201
-
202
- export interface UserComponent extends ComponentArgs {
203
- item: componentType;
204
- }
205
-
206
- /**
207
- *
208
- * @interface ComponentArgs
209
- * @desc
210
- *
211
- */
212
- export interface ComponentArgs {
213
- /**
214
- *
215
- * the DOM for the component.
216
- * @type {(string | HTMLElement | Element)}
217
- *
218
- */
219
- container: string | HTMLElement | Element;
220
-
221
- props?: any;
222
- }
223
-
224
- /**
225
- * This is the entry point for the application.
226
- */
227
- export class DaoPaaS {
228
- constructor(options: Options);
229
-
230
- get playgroundStatus(): PlaygroundStatus;
231
-
232
- get dockerStatus(): DockerStatus;
233
-
234
- get userList(): UserInfo[];
235
-
236
- /**
237
- *
238
- * Replaying method for global calling.
239
- * @param {unFollowUser} args
240
- *
241
- */
242
-
243
- unFollowUser(user: UserInfo, callback: (userInfo: UserInfo) => void): void;
244
-
245
- /**
246
- *
247
- * Replaying method for global calling.
248
- * @param {followUser} args
249
- *
250
- */
251
- followUser(userId: string, callback: (userInfo: UserInfo) => void): void;
252
-
253
- /**
254
- *
255
- * Replaying method for global calling.
256
- * @param {ReplayType} args
257
- *
258
- */
259
- replay(param: ReplayType): void;
260
-
261
- /**
262
- *
263
- * Recording method for global calling.
264
- * @param {boolean} arg
265
- *
266
- */
267
- record(arg?: boolean): void;
268
-
269
- /**
270
- *
271
- * async method to set Replayers.
272
- * @param {keyof D42_FrontType['CRDT'][]} arg
273
- *
274
- */
275
- setReplayers(arg: string[]): void;
276
-
277
- /**
278
- *
279
- * Here you can switch language services by calling this method.
280
- * @param {boolean} arg
281
- *
282
- */
283
- switchLspServer(arg: boolean): void;
284
-
285
- /**
286
- *
287
- * Active the playground handler.
288
- *
289
- */
290
- activePlayground(): void;
291
-
292
- /**
293
- *
294
- * Run the playground handler.
295
- *
296
- */
297
- runPlayground(): void;
298
-
299
- /**
300
- *
301
- * Stop the playground.
302
- *
303
- */
304
- stopPlayground(): void;
305
-
306
- /**
307
- *
308
- * Editor component.
309
- * @param ComponentArgs
310
- * CSS.Properties<string | number>
311
- */
312
- Editor(args: ComponentArgs & MenuTagProps & EditorTheme): void;
313
-
314
- /**
315
- *
316
- * Page component.
317
- * @param ComponentArgs
318
- *
319
- */
320
- Page(args: ComponentArgs): void;
321
-
322
- /**
323
- *
324
- * Tree component.
325
- * @param ComponentArgs
326
- *
327
- */
328
- Tree(args: ComponentArgs & TreeProps): void;
329
-
330
- /**
331
- *
332
- * Shell component.
333
- * @param ComponentArgs
334
- *
335
- */
336
- Shell(args: ComponentArgs & ShellProps): void;
337
-
338
- /**
339
- *
340
- * Browser component.
341
- * @param ComponentArgs
342
- *
343
- */
344
- Browser(args: ComponentArgs & OutputBrowserProp): void;
345
-
346
- /**
347
- *
348
- * Console component.
349
- * @param ComponentArgs
350
- *
351
- */
352
- Console(args: ComponentArgs & ShellProps): void;
353
- }
1
+ /*!-----------------------------------------------------------
2
+ * Copyright (c) dao42. All rights reserved.
3
+ * Type definitions for @dao42/d42paas-front
4
+ * Released under the MIT license
5
+ *-----------------------------------------------------------*/
6
+
7
+ import { Extend } from 'schema-utils/declarations/validate';
8
+
9
+ /*---------------------------------------------------------------------------------------------
10
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11
+ * Licensed under the MIT License. See License.txt in the project root for license information.
12
+ *--------------------------------------------------------------------------------------------*/
13
+
14
+ export type ComponentType = 'Tree' | 'Editor' | 'Console' | 'Browser' | 'Shell';
15
+
16
+ export type Mode = 'tsdoc' | 'singleFile' | 'IDE';
17
+
18
+ export type PlaygroundStatus = 'EMPTY' | 'ACTIVE' | 'INACTIVE';
19
+
20
+ export type DockerStatus = 'RUNNING' | 'STOP';
21
+
22
+ // export type Replay = 'stop' | 'disabled' | 'pause';
23
+ interface MessageType {
24
+ playgroundStatus?: PlaygroundStatus;
25
+ dockerStatus?: DockerStatus;
26
+ userList?: UserInfo[];
27
+ followingUser?: UserInfo;
28
+ }
29
+
30
+ interface ErrorType {
31
+ /**
32
+ * The error message block
33
+ */
34
+ message: {
35
+ /**
36
+ * The error message content
37
+ */
38
+ content: string;
39
+
40
+ /**
41
+ * The error playground you started
42
+ */
43
+ playgroundId: string;
44
+
45
+ /**
46
+ * The error timestamp
47
+ */
48
+ timestamp: number;
49
+ };
50
+ }
51
+
52
+ /**
53
+ * Userinfo type
54
+ */
55
+ interface UserInfo {
56
+ playgroundId?: string;
57
+ operation?: any;
58
+ uuid?: string;
59
+ color?: string;
60
+ name?: string;
61
+ username?: string;
62
+ userId?: string;
63
+ role?: string;
64
+ avatar?: string;
65
+ onlineCount?: number;
66
+ }
67
+
68
+ // interface ReplayType {
69
+ // /**
70
+ // * The userId of the user who started the replay
71
+ // */
72
+ // userId?: UserInfo['userId'];
73
+
74
+ // /**
75
+ // * The timestamp of the replay
76
+ // */
77
+ // timestamp: number;
78
+ // }
79
+
80
+ interface TreeProps {
81
+ /**
82
+ * The background color of the tree
83
+ */
84
+ bgColor?: string;
85
+
86
+ /**
87
+ * The text color of the tree
88
+ */
89
+ fontColor?: string;
90
+
91
+ /**
92
+ * The drop background color
93
+ */
94
+ dropBgColor?: string;
95
+
96
+ /**
97
+ * The drop Text color
98
+ */
99
+ dropTextColor?: string;
100
+
101
+ /**
102
+ * The hover background color
103
+ */
104
+ hoverBgColor?: string;
105
+
106
+ /**
107
+ * The hover Text color
108
+ */
109
+ hoverTextColor?: string;
110
+
111
+ /**
112
+ * The tree item will fire the event when you click on it
113
+ *
114
+ * @param The path of the item
115
+ * @param The uri of the item
116
+ * @event
117
+ */
118
+ onClick?: (arg: { path: string; uri: string }) => void;
119
+ }
120
+
121
+ interface MenuTagProps {
122
+ /**
123
+ * The style of the menu tag block
124
+ */
125
+ menuStyle?: {
126
+ /**
127
+ * The background color
128
+ */
129
+ backgroundColor?: string;
130
+
131
+ /**
132
+ * The text color
133
+ */
134
+ textColor?: string;
135
+
136
+ /**
137
+ * The hover background color
138
+ */
139
+ hoverBgColor?: string;
140
+
141
+ /**
142
+ * The hover text color
143
+ */
144
+ hoverTextColor?: string;
145
+
146
+ /**
147
+ * The icon color
148
+ */
149
+ iconColor?: string;
150
+
151
+ /**
152
+ * The icon hover color
153
+ */
154
+ hoverIconColor?: string;
155
+ };
156
+ }
157
+
158
+ interface EditorProps extends MenuTagProps {
159
+ /**
160
+ * The Theme of the editor block
161
+ */
162
+ theme?: {
163
+ /**
164
+ * The color of the margin view overlay
165
+ */
166
+ marginViewOverlays?: string;
167
+
168
+ /**
169
+ * The line number color
170
+ */
171
+ lineNumbers?: string;
172
+
173
+ /**
174
+ * The active line number color
175
+ */
176
+ activeLineNumber?: string;
177
+ };
178
+ }
179
+
180
+ interface ConsoleOrShellProps {
181
+ /**
182
+ * The font size of the shell
183
+ */
184
+ fontSize?: number;
185
+
186
+ /**
187
+ * The font family of the shell
188
+ */
189
+ fontFamily?: string;
190
+
191
+ /**
192
+ * The line height of the shell
193
+ */
194
+ lineHeight?: number;
195
+
196
+ /**
197
+ * The cursor color of the shell
198
+ */
199
+ cursorBlink?: boolean;
200
+
201
+ /**
202
+ * The cursor width of the shell
203
+ */
204
+ cursorWidth?: number;
205
+
206
+ /**
207
+ * The cursor style of the shell
208
+ */
209
+ cursorStyle?: string;
210
+
211
+ /**
212
+ * if the shell can be right click to open the context menu
213
+ */
214
+ rightClickSelectsWord?: boolean;
215
+
216
+ /**
217
+ * The theme of the shell block
218
+ */
219
+ theme?: {
220
+ /**
221
+ * The background color
222
+ */
223
+ background?: string;
224
+ };
225
+ }
226
+
227
+ export interface BrowserProp {
228
+ /**
229
+ * The url of the browser
230
+ */
231
+ url?: string;
232
+
233
+ /**
234
+ * if the browser can show the url
235
+ */
236
+ showURL?: boolean;
237
+
238
+ /**
239
+ * The fresh icon color
240
+ */
241
+ freshIconColor?: string;
242
+
243
+ /**
244
+ * The input text color
245
+ */
246
+ inputColor?: string;
247
+
248
+ /**
249
+ * The open icon color
250
+ */
251
+ openIconColor?: string;
252
+ }
253
+
254
+ /**
255
+ * The Component props type collection
256
+ */
257
+ export type ComponentPropsType =
258
+ | EditorProps
259
+ | TreeProps
260
+ | BrowserProp
261
+ | ConsoleOrShellProps;
262
+
263
+ /**
264
+ * Passing the values to init the playground.
265
+ * @category PaaS Options [Required]
266
+ */
267
+ export interface Options {
268
+ /**
269
+ * @ignore
270
+ *
271
+ */
272
+ debug?: boolean;
273
+
274
+ /**
275
+ *
276
+ * Error listener to the application.
277
+ * @param The error message block
278
+ * @event
279
+ */
280
+ onError?: (error: ErrorType) => void;
281
+
282
+ /**
283
+ *
284
+ * Message listener to the application.
285
+ * @param MessageType
286
+ * @event
287
+ */
288
+ onMessage?: (message: MessageType) => void;
289
+
290
+ /**
291
+ * The service worker origin
292
+ */
293
+ serviceWorkerOrigin: string;
294
+
295
+ /**
296
+ *
297
+ * init the playground with the mode.
298
+ *
299
+ */
300
+ mode?: Mode;
301
+
302
+ /**
303
+ *
304
+ * init the playground with the paasDomain.
305
+ *
306
+ */
307
+ paasDomain: string;
308
+
309
+ /**
310
+ *
311
+ * init the playground ticket needed.
312
+ *
313
+ */
314
+ ticket: string;
315
+
316
+ /**
317
+ *
318
+ * to init the playground with this id.
319
+ *
320
+ */
321
+ playgroundId: string;
322
+
323
+ /**
324
+ *
325
+ * userId for the playground.
326
+ *
327
+ */
328
+ userId: string;
329
+
330
+ /**
331
+ *
332
+ * tenantId for the playground.
333
+ *
334
+ */
335
+ tenantId: string;
336
+
337
+ /**
338
+ *
339
+ * username for the playground.
340
+ *
341
+ */
342
+ username?: string;
343
+
344
+ /**
345
+ *
346
+ * avatarUrl for the playground but not necessarily.
347
+ *
348
+ */
349
+ avatarUrl?: string;
350
+
351
+ /**
352
+ *
353
+ * this argument is to ingnore replaying patterns.
354
+ *
355
+ */
356
+ ignoreReplayers?: string[];
357
+
358
+ /**
359
+ *
360
+ * Here you can map the components to the playground.
361
+ *
362
+ * @category ComponentsMapper
363
+ *
364
+ */
365
+ components?: Component<ComponentPropsType>[];
366
+
367
+ /**
368
+ * @deprecated to fix the issue of the playground.
369
+ *
370
+ * render?: () => TComponent[]; keyof D42_FrontType['CRDT'][]
371
+ */
372
+ }
373
+
374
+ /**
375
+ *
376
+ * @interface Component
377
+ * @desc The props of the component.
378
+ *
379
+ */
380
+ export interface Component<T> {
381
+ /**
382
+ *
383
+ * The DOM for the component.
384
+ * @type {(string | HTMLElement | Element)}
385
+ *
386
+ */
387
+ container: string | HTMLElement | Element;
388
+
389
+ item: ComponentType;
390
+ /**
391
+ * The component props
392
+ */
393
+ props?: T;
394
+ }
395
+
396
+ /**
397
+ * * This is the entry point for the application.
398
+ *
399
+ * * like:
400
+ *
401
+ *
402
+ * ```ts
403
+ let options = {...};
404
+ let Dao = new DaoPaaS(options);
405
+ ```
406
+ *
407
+ * See {@link Options} for more details.
408
+ */
409
+ export class DaoPaaS {
410
+ constructor(options: Options);
411
+
412
+ get playgroundStatus(): PlaygroundStatus;
413
+
414
+ get dockerStatus(): DockerStatus;
415
+
416
+ get userList(): UserInfo[];
417
+
418
+ /**
419
+ *
420
+ * Replaying method for global calling.
421
+ * @param {unFollowUser} args
422
+ *
423
+ */
424
+
425
+ unFollowUser(user: UserInfo, callback: (userInfo: UserInfo) => void): void;
426
+
427
+ /**
428
+ *
429
+ * Replaying method for global calling.
430
+ * @param {followUser} args
431
+ *
432
+ */
433
+ followUser(userId: string, callback: (userInfo: UserInfo) => void): void;
434
+
435
+ /**
436
+ *
437
+ * Replaying method for global calling.
438
+ * @param {ReplayType} args
439
+ *
440
+ */
441
+ replay(userId: Pick<UserInfo, 'userId'>): void;
442
+
443
+ /**
444
+ *
445
+ * Recording method for global calling.
446
+ * @param {boolean} arg
447
+ *
448
+ */
449
+ record(arg?: boolean): void;
450
+
451
+ /**
452
+ *
453
+ * async method to set Replayers.
454
+ * @param {keyof D42_FrontType['CRDT'][]} arg
455
+ *
456
+ */
457
+ setReplayers(arg: string[]): void;
458
+
459
+ /**
460
+ *
461
+ * Here you can switch language services by calling this method.
462
+ * @param {boolean} arg
463
+ *
464
+ */
465
+ switchLspServer(arg: boolean): void;
466
+
467
+ /**
468
+ *
469
+ * Active the playground handler.
470
+ *
471
+ */
472
+ activePlayground(): void;
473
+
474
+ /**
475
+ *
476
+ * Run the playground handler.
477
+ *
478
+ */
479
+ runPlayground(): void;
480
+
481
+ /**
482
+ *
483
+ * Stop the playground.
484
+ *
485
+ */
486
+ stopPlayground(): void;
487
+
488
+ /**
489
+ * Editor component.
490
+ *
491
+ *
492
+ * ```ts
493
+ * Dao.Editor({
494
+ * container: '#editor',
495
+ * item: 'editor',
496
+ * props: {...EditorProps}
497
+ * });
498
+ ```
499
+ *
500
+ * @category Components
501
+ *
502
+ *
503
+ */
504
+ Editor(args: Component<EditorProps>): void;
505
+
506
+ /**
507
+ *
508
+ * Page component.
509
+ * @ignore
510
+ * @category Components
511
+ * @param Component
512
+ *
513
+ */
514
+ Page(args: Component<TreeProps>): void;
515
+
516
+ /**
517
+ *
518
+ * Tree component.
519
+ *
520
+ * ```ts
521
+ * Dao.Tree({
522
+ * container: '#tree',
523
+ * item: 'tree',
524
+ * props: {...TreeProps}
525
+ * });
526
+ ```
527
+ *
528
+ *
529
+ * @category Components
530
+ * @param Component
531
+ *
532
+ */
533
+ Tree(args: Component<TreeProps>): void;
534
+
535
+ /**
536
+ *
537
+ * Shell component.
538
+ *
539
+ *
540
+ * ```ts
541
+ * Dao.Shell({
542
+ * container: '#shell',
543
+ * item: 'shell',
544
+ * props: {...ConsoleOrShellProps}
545
+ * });
546
+ ```
547
+ *
548
+ *
549
+ * @category Components
550
+ * @param Component
551
+ *
552
+ */
553
+ Shell(args: Component<ConsoleOrShellProps>): void;
554
+
555
+ /**
556
+ *
557
+ * Browser component.
558
+ *
559
+ * ```ts
560
+ * Dao.Browser({
561
+ * container: '#browser',
562
+ * item: 'browser',
563
+ * props: {...BrowserProp}
564
+ * });
565
+ ```
566
+ *
567
+ *
568
+ * @category Components
569
+ * @param Component
570
+ *
571
+ */
572
+ Browser(args: Component<BrowserProp>): void;
573
+
574
+ /**
575
+ *
576
+ * Console component.
577
+ *
578
+ *
579
+ * ```ts
580
+ * Dao.Console({
581
+ * container: '#console',
582
+ * item: 'console',
583
+ * props: {...ConsoleOrShellProps}
584
+ * });
585
+ ```
586
+ *
587
+ *
588
+ * @category Components
589
+ * @param Component
590
+ *
591
+ */
592
+ Console(args: Component<ConsoleOrShellProps>): void;
593
+ }