@jupyter/collaboration-extension 1.0.0-alpha.3 → 1.0.0-alpha.5

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.
@@ -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>;
@@ -5,13 +5,14 @@
5
5
  * @module collaboration-extension
6
6
  */
7
7
  import { DOMUtils } from '@jupyterlab/apputils';
8
- import { CollaboratorsPanel, IGlobalAwareness, IUserMenu, RendererUserMenu, UserInfoPanel, UserMenu } from '@jupyter/collaboration';
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
- autoStart: true,
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
- autoStart: true,
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/yjs');
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,11 +98,13 @@ 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, ITranslator],
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');
107
+ const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyter_collaboration');
104
108
  const userPanel = new SidePanel();
105
109
  userPanel.id = DOMUtils.createDomID();
106
110
  userPanel.title.icon = usersIcon;
@@ -119,3 +123,18 @@ export const rtcPanelPlugin = {
119
123
  userPanel.addWidget(collaboratorsPanel);
120
124
  }
121
125
  };
126
+ export const userEditorCursors = {
127
+ id: '@jupyter/collaboration-extension:userEditorCursors',
128
+ description: 'Add CodeMirror extension to display remote user cursors and selections.',
129
+ autoStart: true,
130
+ requires: [IEditorExtensionRegistry],
131
+ activate: (app, extensions) => {
132
+ extensions.addExtension({
133
+ name: 'remote-user-cursors',
134
+ factory(options) {
135
+ const { awareness, ysource: ytext } = options.model.sharedModel;
136
+ return EditorExtensionRegistry.createImmutableExtension(remoteUserCursors({ awareness, ytext }));
137
+ }
138
+ });
139
+ }
140
+ };
@@ -24,7 +24,6 @@ export const defaultFileBrowser = {
24
24
  ISettingRegistry
25
25
  ],
26
26
  activate: async (app, fileBrowserFactory, translator, router, tree, labShell, settingRegistry) => {
27
- console.debug('@jupyter/collaboration-extension:defaultFileBrowser: activated');
28
27
  const { commands } = app;
29
28
  const trans = translator.load('jupyter_collaboration');
30
29
  const drive = new YDrive(app.serviceManager.user, trans);
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",
3
+ "version": "1.0.0-alpha.5",
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": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension",
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.3",
56
- "@jupyter/docprovider": "^1.0.0-alpha.3",
57
- "@jupyterlab/application": "^4.0.0-alpha.19",
58
- "@jupyterlab/apputils": "^4.0.0-alpha.19",
59
- "@jupyterlab/coreutils": "^6.0.0-alpha.19",
60
- "@jupyterlab/filebrowser": "^4.0.0-alpha.19",
61
- "@jupyterlab/services": "^7.0.0-alpha.19",
62
- "@jupyterlab/settingregistry": "^4.0.0-alpha.19",
63
- "@jupyterlab/statedb": "^4.0.0-alpha.19",
64
- "@jupyterlab/translation": "^4.0.0-alpha.19",
65
- "@jupyterlab/ui-components": "^4.0.0-alpha.34",
66
- "@lumino/commands": "^2.0.0-beta.1",
67
- "@lumino/widgets": "^2.0.0-beta.1",
56
+ "@jupyter/collaboration": "^1.0.0-alpha.5",
57
+ "@jupyter/docprovider": "^1.0.0-alpha.5",
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.19",
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": "~4.7.3"
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
  }