@jupyterlite/application-extension 0.1.0-alpha.19 → 0.1.0-alpha.23
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/lib/index.d.ts +9 -0
- package/lib/index.js +29 -29
- package/package.json +13 -13
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
|
|
2
2
|
import { IDocumentProviderFactory } from '@jupyterlab/docprovider';
|
|
3
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
4
|
/**
|
|
4
5
|
* A public namespace for WebRTC options
|
|
5
6
|
*/
|
|
@@ -8,6 +9,14 @@ export declare namespace IWebRtcProvider {
|
|
|
8
9
|
room: string;
|
|
9
10
|
signalingUrls?: string[];
|
|
10
11
|
}
|
|
12
|
+
interface IYjsWebRtcOptions {
|
|
13
|
+
signaling: Array<string>;
|
|
14
|
+
password: string | null;
|
|
15
|
+
awareness: Awareness;
|
|
16
|
+
maxConns: number;
|
|
17
|
+
filterBcConns: boolean;
|
|
18
|
+
peerOpts: any;
|
|
19
|
+
}
|
|
11
20
|
}
|
|
12
21
|
declare const plugins: JupyterFrontEndPlugin<any>[];
|
|
13
22
|
export default plugins;
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { IRouter, ILabShell } from '@jupyterlab/application';
|
|
3
|
+
import { IRouter, ILabShell, } from '@jupyterlab/application';
|
|
4
4
|
import { Clipboard, ICommandPalette, Dialog, showDialog } from '@jupyterlab/apputils';
|
|
5
5
|
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
|
|
6
6
|
import { IDocumentManager } from '@jupyterlab/docmanager';
|
|
7
|
-
import { IDocumentProviderFactory, ProviderMock, getAnonymousUserName, getRandomColor } from '@jupyterlab/docprovider';
|
|
7
|
+
import { IDocumentProviderFactory, ProviderMock, getAnonymousUserName, getRandomColor, } from '@jupyterlab/docprovider';
|
|
8
8
|
import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
|
|
9
9
|
import { IMainMenu } from '@jupyterlab/mainmenu';
|
|
10
10
|
import { ITranslator } from '@jupyterlab/translation';
|
|
@@ -41,7 +41,7 @@ class WebRtcProvider extends WebrtcProvider {
|
|
|
41
41
|
if (currState && !currState.name) {
|
|
42
42
|
this.awareness.setLocalStateField('user', {
|
|
43
43
|
name,
|
|
44
|
-
color
|
|
44
|
+
color,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -92,13 +92,13 @@ class WebRtcProvider extends WebrtcProvider {
|
|
|
92
92
|
: [
|
|
93
93
|
'wss://signaling.yjs.dev',
|
|
94
94
|
'wss://y-webrtc-signaling-eu.herokuapp.com',
|
|
95
|
-
'wss://y-webrtc-signaling-us.herokuapp.com'
|
|
95
|
+
'wss://y-webrtc-signaling-us.herokuapp.com',
|
|
96
96
|
],
|
|
97
97
|
password: null,
|
|
98
98
|
awareness: new Awareness(options.ymodel.ydoc),
|
|
99
99
|
maxConns: 20 + Math.floor(Math.random() * 15),
|
|
100
100
|
filterBcConns: true,
|
|
101
|
-
peerOpts: {} // simple-peer options. See https://github.com/feross/simple-peer#peer--new-peeropts
|
|
101
|
+
peerOpts: {}, // simple-peer options. See https://github.com/feross/simple-peer#peer--new-peeropts
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
WebRtcProvider.yProviderOptions = yProviderOptions;
|
|
@@ -151,11 +151,11 @@ const about = {
|
|
|
151
151
|
buttons: [
|
|
152
152
|
Dialog.createButton({
|
|
153
153
|
label: trans.__('Dismiss'),
|
|
154
|
-
className: 'jp-About-button jp-mod-reject jp-mod-styled'
|
|
155
|
-
})
|
|
156
|
-
]
|
|
154
|
+
className: 'jp-About-button jp-mod-reject jp-mod-styled',
|
|
155
|
+
}),
|
|
156
|
+
],
|
|
157
157
|
});
|
|
158
|
-
}
|
|
158
|
+
},
|
|
159
159
|
});
|
|
160
160
|
if (palette) {
|
|
161
161
|
palette.addItem({ command: CommandIDs.about, category });
|
|
@@ -163,7 +163,7 @@ const about = {
|
|
|
163
163
|
if (menu) {
|
|
164
164
|
menu.helpMenu.addGroup([{ command: CommandIDs.about }], 0);
|
|
165
165
|
}
|
|
166
|
-
}
|
|
166
|
+
},
|
|
167
167
|
};
|
|
168
168
|
/**
|
|
169
169
|
* An alternative document provider plugin
|
|
@@ -184,12 +184,12 @@ const docProviderPlugin = {
|
|
|
184
184
|
? new WebRtcProvider({
|
|
185
185
|
room,
|
|
186
186
|
...options,
|
|
187
|
-
...(signalingUrls && signalingUrls.length ? { signalingUrls } : {})
|
|
187
|
+
...(signalingUrls && signalingUrls.length ? { signalingUrls } : {}),
|
|
188
188
|
})
|
|
189
189
|
: new ProviderMock();
|
|
190
190
|
};
|
|
191
191
|
return factory;
|
|
192
|
-
}
|
|
192
|
+
},
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
195
|
* A plugin providing download commands in the file menu and command palette.
|
|
@@ -237,12 +237,12 @@ const downloadPlugin = {
|
|
|
237
237
|
return showDialog({
|
|
238
238
|
title: trans.__('Cannot Download'),
|
|
239
239
|
body: trans.__('No context found for current widget!'),
|
|
240
|
-
buttons: [Dialog.okButton({ label: trans.__('OK') })]
|
|
240
|
+
buttons: [Dialog.okButton({ label: trans.__('OK') })],
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
const content = await formatContent(context.path);
|
|
244
244
|
downloadContent(content, context.path);
|
|
245
|
-
}
|
|
245
|
+
},
|
|
246
246
|
});
|
|
247
247
|
const category = trans.__('File Operations');
|
|
248
248
|
if (palette) {
|
|
@@ -266,10 +266,10 @@ const downloadPlugin = {
|
|
|
266
266
|
});
|
|
267
267
|
},
|
|
268
268
|
icon: downloadIcon.bindprops({ stylesheet: 'menuItem' }),
|
|
269
|
-
label: trans.__('Download')
|
|
269
|
+
label: trans.__('Download'),
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
}
|
|
272
|
+
},
|
|
273
273
|
};
|
|
274
274
|
/**
|
|
275
275
|
* The main application icon.
|
|
@@ -289,11 +289,11 @@ const liteLogo = {
|
|
|
289
289
|
elementPosition: 'center',
|
|
290
290
|
margin: '2px 2px 2px 8px',
|
|
291
291
|
height: 'auto',
|
|
292
|
-
width: '16px'
|
|
292
|
+
width: '16px',
|
|
293
293
|
});
|
|
294
294
|
logo.id = 'jp-MainLogo';
|
|
295
295
|
labShell.add(logo, 'top', { rank: 0 });
|
|
296
|
-
}
|
|
296
|
+
},
|
|
297
297
|
};
|
|
298
298
|
/**
|
|
299
299
|
* A custom opener plugin to pass the path to documents as
|
|
@@ -321,7 +321,7 @@ const opener = {
|
|
|
321
321
|
if (!paths) {
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
|
-
const files = paths.map(path => decodeURIComponent(path));
|
|
324
|
+
const files = paths.map((path) => decodeURIComponent(path));
|
|
325
325
|
app.restored.then(() => {
|
|
326
326
|
const page = PageConfig.getOption('retroPage');
|
|
327
327
|
const [file] = files;
|
|
@@ -332,19 +332,19 @@ const opener = {
|
|
|
332
332
|
}
|
|
333
333
|
case 'notebooks': {
|
|
334
334
|
docManager.open(file, NOTEBOOK_FACTORY, undefined, {
|
|
335
|
-
ref: '_noref'
|
|
335
|
+
ref: '_noref',
|
|
336
336
|
});
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
339
|
case 'edit': {
|
|
340
340
|
docManager.open(file, EDITOR_FACTORY, undefined, {
|
|
341
|
-
ref: '_noref'
|
|
341
|
+
ref: '_noref',
|
|
342
342
|
});
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
345
|
default: {
|
|
346
346
|
// open all files in the lab interface
|
|
347
|
-
files.forEach(file => docManager.open(file));
|
|
347
|
+
files.forEach((file) => docManager.open(file));
|
|
348
348
|
const url = new URL(URLExt.join(PageConfig.getBaseUrl(), request));
|
|
349
349
|
// only remove the path (to keep extra parameters like the RTC room)
|
|
350
350
|
url.searchParams.delete('path');
|
|
@@ -354,10 +354,10 @@ const opener = {
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
|
-
}
|
|
357
|
+
},
|
|
358
358
|
});
|
|
359
359
|
router.register({ command, pattern: URL_PATTERN });
|
|
360
|
-
}
|
|
360
|
+
},
|
|
361
361
|
};
|
|
362
362
|
/**
|
|
363
363
|
* A custom plugin to share a link to a file.
|
|
@@ -383,8 +383,8 @@ const shareFile = {
|
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
385
385
|
const url = new URL(URLExt.join(PageConfig.getBaseUrl(), 'lab'));
|
|
386
|
-
const models = toArray(filter(widget.selectedItems(), item => item.type !== 'directory'));
|
|
387
|
-
models.forEach(model => {
|
|
386
|
+
const models = toArray(filter(widget.selectedItems(), (item) => item.type !== 'directory'));
|
|
387
|
+
models.forEach((model) => {
|
|
388
388
|
url.searchParams.append('path', model.path);
|
|
389
389
|
});
|
|
390
390
|
if (collaborative) {
|
|
@@ -395,9 +395,9 @@ const shareFile = {
|
|
|
395
395
|
isVisible: () => !!tracker.currentWidget &&
|
|
396
396
|
toArray(tracker.currentWidget.selectedItems()).length >= 1,
|
|
397
397
|
icon: linkIcon.bindprops({ stylesheet: 'menuItem' }),
|
|
398
|
-
label: trans.__('Copy Shareable Link')
|
|
398
|
+
label: trans.__('Copy Shareable Link'),
|
|
399
399
|
});
|
|
400
|
-
}
|
|
400
|
+
},
|
|
401
401
|
};
|
|
402
402
|
const plugins = [
|
|
403
403
|
about,
|
|
@@ -405,6 +405,6 @@ const plugins = [
|
|
|
405
405
|
downloadPlugin,
|
|
406
406
|
liteLogo,
|
|
407
407
|
opener,
|
|
408
|
-
shareFile
|
|
408
|
+
shareFile,
|
|
409
409
|
];
|
|
410
410
|
export default plugins;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlite/application-extension",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.23",
|
|
4
4
|
"description": "JupyterLite - Application Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyterlite/jupyterlite",
|
|
6
6
|
"bugs": {
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
"watch": "tsc -b --watch"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@jupyterlab/application": "~3.2.
|
|
41
|
-
"@jupyterlab/apputils": "~3.2.
|
|
42
|
-
"@jupyterlab/docmanager": "~3.2.
|
|
43
|
-
"@jupyterlab/docprovider": "~3.2.
|
|
44
|
-
"@jupyterlab/filebrowser": "~3.2.
|
|
45
|
-
"@jupyterlab/help-extension": "~3.2.
|
|
46
|
-
"@jupyterlab/mainmenu": "~3.2.
|
|
47
|
-
"@jupyterlab/services": "~6.2.
|
|
48
|
-
"@jupyterlab/translation": "~3.2.
|
|
49
|
-
"@jupyterlab/ui-components": "~3.2.
|
|
50
|
-
"@jupyterlite/ui-components": "^0.1.0-alpha.
|
|
40
|
+
"@jupyterlab/application": "~3.2.9",
|
|
41
|
+
"@jupyterlab/apputils": "~3.2.9",
|
|
42
|
+
"@jupyterlab/docmanager": "~3.2.9",
|
|
43
|
+
"@jupyterlab/docprovider": "~3.2.9",
|
|
44
|
+
"@jupyterlab/filebrowser": "~3.2.9",
|
|
45
|
+
"@jupyterlab/help-extension": "~3.2.9",
|
|
46
|
+
"@jupyterlab/mainmenu": "~3.2.9",
|
|
47
|
+
"@jupyterlab/services": "~6.2.9",
|
|
48
|
+
"@jupyterlab/translation": "~3.2.9",
|
|
49
|
+
"@jupyterlab/ui-components": "~3.2.9",
|
|
50
|
+
"@jupyterlite/ui-components": "^0.1.0-alpha.23",
|
|
51
51
|
"@lumino/algorithm": "^1.6.0",
|
|
52
52
|
"@lumino/coreutils": "^1.8.0",
|
|
53
53
|
"@lumino/widgets": "^1.23.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"jest": "^26.4.2",
|
|
61
61
|
"rimraf": "~3.0.0",
|
|
62
62
|
"ts-jest": "^26.3.0",
|
|
63
|
-
"typescript": "~4.2
|
|
63
|
+
"typescript": "~4.5.2"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|