@jupyter/collaboration-extension 1.0.0-alpha.4 → 1.0.0-alpha.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/lib/collaboration.d.ts +1 -0
- package/lib/collaboration.js +29 -8
- package/lib/index.js +3 -2
- package/package.json +36 -18
package/lib/collaboration.d.ts
CHANGED
|
@@ -20,3 +20,4 @@ export declare const rtcGlobalAwarenessPlugin: JupyterFrontEndPlugin<IAwareness>
|
|
|
20
20
|
* Jupyter plugin adding the RTC information to the application left panel if collaborative flag enabled.
|
|
21
21
|
*/
|
|
22
22
|
export declare const rtcPanelPlugin: JupyterFrontEndPlugin<void>;
|
|
23
|
+
export declare const userEditorCursors: JupyterFrontEndPlugin<void>;
|
package/lib/collaboration.js
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* @module collaboration-extension
|
|
6
6
|
*/
|
|
7
7
|
import { DOMUtils } from '@jupyterlab/apputils';
|
|
8
|
-
import {
|
|
8
|
+
import { EditorExtensionRegistry, IEditorExtensionRegistry } from '@jupyterlab/codemirror';
|
|
9
|
+
import { CollaboratorsPanel, IGlobalAwareness, IUserMenu, remoteUserCursors, RendererUserMenu, UserInfoPanel, UserMenu } from '@jupyter/collaboration';
|
|
9
10
|
import { SidePanel, usersIcon } from '@jupyterlab/ui-components';
|
|
10
11
|
import { MenuBar } from '@lumino/widgets';
|
|
11
12
|
import { URLExt } from '@jupyterlab/coreutils';
|
|
12
13
|
import { ServerConnection } from '@jupyterlab/services';
|
|
13
14
|
import { IStateDB } from '@jupyterlab/statedb';
|
|
14
|
-
import { ITranslator } from '@jupyterlab/translation';
|
|
15
|
+
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
15
16
|
import * as Y from 'yjs';
|
|
16
17
|
import { Awareness } from 'y-protocols/awareness';
|
|
17
18
|
import { WebsocketProvider } from 'y-websocket';
|
|
@@ -20,7 +21,7 @@ import { WebsocketProvider } from 'y-websocket';
|
|
|
20
21
|
*/
|
|
21
22
|
export const userMenuPlugin = {
|
|
22
23
|
id: '@jupyter/collaboration-extension:userMenu',
|
|
23
|
-
|
|
24
|
+
description: 'Provide connected user menu.',
|
|
24
25
|
requires: [],
|
|
25
26
|
provides: IUserMenu,
|
|
26
27
|
activate: (app) => {
|
|
@@ -34,6 +35,7 @@ export const userMenuPlugin = {
|
|
|
34
35
|
*/
|
|
35
36
|
export const menuBarPlugin = {
|
|
36
37
|
id: '@jupyter/collaboration-extension:userMenuBar',
|
|
38
|
+
description: 'Add user menu to the interface.',
|
|
37
39
|
autoStart: true,
|
|
38
40
|
requires: [IUserMenu],
|
|
39
41
|
activate: async (app, menu) => {
|
|
@@ -57,7 +59,7 @@ export const menuBarPlugin = {
|
|
|
57
59
|
*/
|
|
58
60
|
export const rtcGlobalAwarenessPlugin = {
|
|
59
61
|
id: '@jupyter/collaboration-extension:rtcGlobalAwareness',
|
|
60
|
-
|
|
62
|
+
description: 'Add global awareness to share working document of users.',
|
|
61
63
|
requires: [IStateDB],
|
|
62
64
|
provides: IGlobalAwareness,
|
|
63
65
|
activate: (app, state) => {
|
|
@@ -65,7 +67,7 @@ export const rtcGlobalAwarenessPlugin = {
|
|
|
65
67
|
const ydoc = new Y.Doc();
|
|
66
68
|
const awareness = new Awareness(ydoc);
|
|
67
69
|
const server = ServerConnection.makeSettings();
|
|
68
|
-
const url = URLExt.join(server.wsUrl, 'api/
|
|
70
|
+
const url = URLExt.join(server.wsUrl, 'api/collaboration/room');
|
|
69
71
|
new WebsocketProvider(url, 'JupyterLab:globalAwareness', ydoc, {
|
|
70
72
|
awareness: awareness
|
|
71
73
|
});
|
|
@@ -96,12 +98,16 @@ export const rtcGlobalAwarenessPlugin = {
|
|
|
96
98
|
*/
|
|
97
99
|
export const rtcPanelPlugin = {
|
|
98
100
|
id: '@jupyter/collaboration-extension:rtcPanel',
|
|
101
|
+
description: 'Add side panel to display all currently connected users.',
|
|
99
102
|
autoStart: true,
|
|
100
|
-
requires: [IGlobalAwareness
|
|
103
|
+
requires: [IGlobalAwareness],
|
|
104
|
+
optional: [ITranslator],
|
|
101
105
|
activate: (app, awareness, translator) => {
|
|
102
106
|
const { user } = app.serviceManager;
|
|
103
|
-
const trans = translator.load('jupyter_collaboration');
|
|
104
|
-
const userPanel = new SidePanel(
|
|
107
|
+
const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyter_collaboration');
|
|
108
|
+
const userPanel = new SidePanel({
|
|
109
|
+
alignment: 'justify'
|
|
110
|
+
});
|
|
105
111
|
userPanel.id = DOMUtils.createDomID();
|
|
106
112
|
userPanel.title.icon = usersIcon;
|
|
107
113
|
userPanel.title.caption = trans.__('Collaboration');
|
|
@@ -119,3 +125,18 @@ export const rtcPanelPlugin = {
|
|
|
119
125
|
userPanel.addWidget(collaboratorsPanel);
|
|
120
126
|
}
|
|
121
127
|
};
|
|
128
|
+
export const userEditorCursors = {
|
|
129
|
+
id: '@jupyter/collaboration-extension:userEditorCursors',
|
|
130
|
+
description: 'Add CodeMirror extension to display remote user cursors and selections.',
|
|
131
|
+
autoStart: true,
|
|
132
|
+
requires: [IEditorExtensionRegistry],
|
|
133
|
+
activate: (app, extensions) => {
|
|
134
|
+
extensions.addExtension({
|
|
135
|
+
name: 'remote-user-cursors',
|
|
136
|
+
factory(options) {
|
|
137
|
+
const { awareness, ysource: ytext } = options.model.sharedModel;
|
|
138
|
+
return EditorExtensionRegistry.createImmutableExtension(remoteUserCursors({ awareness, ytext }));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @module collaboration-extension
|
|
6
6
|
*/
|
|
7
7
|
import { defaultFileBrowser } from './filebrowser';
|
|
8
|
-
import { userMenuPlugin, menuBarPlugin, rtcGlobalAwarenessPlugin, rtcPanelPlugin } from './collaboration';
|
|
8
|
+
import { userMenuPlugin, menuBarPlugin, rtcGlobalAwarenessPlugin, rtcPanelPlugin, userEditorCursors } from './collaboration';
|
|
9
9
|
/**
|
|
10
10
|
* Export the plugins as default.
|
|
11
11
|
*/
|
|
@@ -14,6 +14,7 @@ const plugins = [
|
|
|
14
14
|
userMenuPlugin,
|
|
15
15
|
menuBarPlugin,
|
|
16
16
|
rtcGlobalAwarenessPlugin,
|
|
17
|
-
rtcPanelPlugin
|
|
17
|
+
rtcPanelPlugin,
|
|
18
|
+
userEditorCursors
|
|
18
19
|
];
|
|
19
20
|
export default plugins;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter/collaboration-extension",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"description": "JupyterLab - Real-Time Collaboration Extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
|
|
41
|
-
"build:lib": "tsc",
|
|
42
|
-
"build:prod": "
|
|
41
|
+
"build:lib": "tsc --sourceMap",
|
|
42
|
+
"build:lib:prod": "tsc",
|
|
43
|
+
"build:prod": "jlpm run clean && jlpm run build:lib:prod && jlpm run build:labextension",
|
|
43
44
|
"build:labextension": "jupyter labextension build .",
|
|
44
45
|
"build:labextension:dev": "jupyter labextension build --development True .",
|
|
45
46
|
"clean": "jlpm run clean:lib",
|
|
@@ -52,29 +53,30 @@
|
|
|
52
53
|
"watch:labextension": "jupyter labextension watch ."
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
|
-
"@jupyter/collaboration": "^1.0.0-alpha.
|
|
56
|
-
"@jupyter/docprovider": "^1.0.0-alpha.
|
|
57
|
-
"@jupyterlab/application": "^4.0.0-alpha.
|
|
58
|
-
"@jupyterlab/apputils": "^4.0.0-alpha.
|
|
59
|
-
"@jupyterlab/
|
|
60
|
-
"@jupyterlab/
|
|
61
|
-
"@jupyterlab/
|
|
62
|
-
"@jupyterlab/
|
|
63
|
-
"@jupyterlab/
|
|
64
|
-
"@jupyterlab/
|
|
65
|
-
"@jupyterlab/
|
|
66
|
-
"@
|
|
67
|
-
"@lumino/
|
|
56
|
+
"@jupyter/collaboration": "^1.0.0-alpha.6",
|
|
57
|
+
"@jupyter/docprovider": "^1.0.0-alpha.6",
|
|
58
|
+
"@jupyterlab/application": "^4.0.0-alpha.22",
|
|
59
|
+
"@jupyterlab/apputils": "^4.0.0-alpha.22",
|
|
60
|
+
"@jupyterlab/codemirror": "^4.0.0-alpha.22",
|
|
61
|
+
"@jupyterlab/coreutils": "^6.0.0-alpha.22",
|
|
62
|
+
"@jupyterlab/filebrowser": "^4.0.0-alpha.22",
|
|
63
|
+
"@jupyterlab/services": "^7.0.0-alpha.22",
|
|
64
|
+
"@jupyterlab/settingregistry": "^4.0.0-alpha.22",
|
|
65
|
+
"@jupyterlab/statedb": "^4.0.0-alpha.22",
|
|
66
|
+
"@jupyterlab/translation": "^4.0.0-alpha.22",
|
|
67
|
+
"@jupyterlab/ui-components": "^4.0.0-alpha.37",
|
|
68
|
+
"@lumino/commands": "^2.0.0",
|
|
69
|
+
"@lumino/widgets": "^2.0.0",
|
|
68
70
|
"y-protocols": "^1.0.5",
|
|
69
71
|
"y-websocket": "^1.3.15",
|
|
70
72
|
"yjs": "^13.5.40"
|
|
71
73
|
},
|
|
72
74
|
"devDependencies": {
|
|
73
|
-
"@jupyterlab/builder": "^4.0.0-alpha.
|
|
75
|
+
"@jupyterlab/builder": "^4.0.0-alpha.22",
|
|
74
76
|
"@types/react": "^18.0.27",
|
|
75
77
|
"npm-run-all": "^4.1.5",
|
|
76
78
|
"rimraf": "^4.1.2",
|
|
77
|
-
"typescript": "~
|
|
79
|
+
"typescript": "~5.0.2"
|
|
78
80
|
},
|
|
79
81
|
"publishConfig": {
|
|
80
82
|
"access": "public"
|
|
@@ -93,6 +95,14 @@
|
|
|
93
95
|
"@jupyterlab/filebrowser-extension:defaultFileBrowser"
|
|
94
96
|
],
|
|
95
97
|
"sharedPackages": {
|
|
98
|
+
"@codemirror/state": {
|
|
99
|
+
"bundled": false,
|
|
100
|
+
"singleton": true
|
|
101
|
+
},
|
|
102
|
+
"@codemirror/view": {
|
|
103
|
+
"bundled": false,
|
|
104
|
+
"singleton": true
|
|
105
|
+
},
|
|
96
106
|
"@jupyter/collaboration": {
|
|
97
107
|
"bundled": true,
|
|
98
108
|
"singleton": true
|
|
@@ -104,6 +114,14 @@
|
|
|
104
114
|
"@jupyter/ydoc": {
|
|
105
115
|
"bundled": false,
|
|
106
116
|
"singleton": true
|
|
117
|
+
},
|
|
118
|
+
"y-protocols": {
|
|
119
|
+
"bundled": false,
|
|
120
|
+
"singleton": true
|
|
121
|
+
},
|
|
122
|
+
"yjs": {
|
|
123
|
+
"bundled": false,
|
|
124
|
+
"singleton": true
|
|
107
125
|
}
|
|
108
126
|
}
|
|
109
127
|
}
|