@theia/collaboration 1.46.0-next.241

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.
Files changed (43) hide show
  1. package/README.md +34 -0
  2. package/lib/browser/collaboration-color-service.d.ts +27 -0
  3. package/lib/browser/collaboration-color-service.d.ts.map +1 -0
  4. package/lib/browser/collaboration-color-service.js +76 -0
  5. package/lib/browser/collaboration-color-service.js.map +1 -0
  6. package/lib/browser/collaboration-file-system-provider.d.ts +37 -0
  7. package/lib/browser/collaboration-file-system-provider.d.ts.map +1 -0
  8. package/lib/browser/collaboration-file-system-provider.js +107 -0
  9. package/lib/browser/collaboration-file-system-provider.js.map +1 -0
  10. package/lib/browser/collaboration-frontend-contribution.d.ts +43 -0
  11. package/lib/browser/collaboration-frontend-contribution.d.ts.map +1 -0
  12. package/lib/browser/collaboration-frontend-contribution.js +334 -0
  13. package/lib/browser/collaboration-frontend-contribution.js.map +1 -0
  14. package/lib/browser/collaboration-frontend-module.d.ts +4 -0
  15. package/lib/browser/collaboration-frontend-module.d.ts.map +1 -0
  16. package/lib/browser/collaboration-frontend-module.js +38 -0
  17. package/lib/browser/collaboration-frontend-module.js.map +1 -0
  18. package/lib/browser/collaboration-instance.d.ts +94 -0
  19. package/lib/browser/collaboration-instance.d.ts.map +1 -0
  20. package/lib/browser/collaboration-instance.js +806 -0
  21. package/lib/browser/collaboration-instance.js.map +1 -0
  22. package/lib/browser/collaboration-utils.d.ts +8 -0
  23. package/lib/browser/collaboration-utils.d.ts.map +1 -0
  24. package/lib/browser/collaboration-utils.js +63 -0
  25. package/lib/browser/collaboration-utils.js.map +1 -0
  26. package/lib/browser/collaboration-workspace-service.d.ts +12 -0
  27. package/lib/browser/collaboration-workspace-service.d.ts.map +1 -0
  28. package/lib/browser/collaboration-workspace-service.js +67 -0
  29. package/lib/browser/collaboration-workspace-service.js.map +1 -0
  30. package/lib/package.spec.d.ts +1 -0
  31. package/lib/package.spec.d.ts.map +1 -0
  32. package/lib/package.spec.js +26 -0
  33. package/lib/package.spec.js.map +1 -0
  34. package/package.json +58 -0
  35. package/src/browser/collaboration-color-service.ts +77 -0
  36. package/src/browser/collaboration-file-system-provider.ts +117 -0
  37. package/src/browser/collaboration-frontend-contribution.ts +327 -0
  38. package/src/browser/collaboration-frontend-module.ts +37 -0
  39. package/src/browser/collaboration-instance.ts +819 -0
  40. package/src/browser/collaboration-utils.ts +59 -0
  41. package/src/browser/collaboration-workspace-service.ts +69 -0
  42. package/src/browser/style/index.css +22 -0
  43. package/src/package.spec.ts +28 -0
@@ -0,0 +1,59 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { URI } from '@theia/core';
18
+ import { inject, injectable } from '@theia/core/shared/inversify';
19
+ import { CollaborationWorkspaceService } from './collaboration-workspace-service';
20
+
21
+ @injectable()
22
+ export class CollaborationUtils {
23
+
24
+ @inject(CollaborationWorkspaceService)
25
+ protected readonly workspaceService: CollaborationWorkspaceService;
26
+
27
+ getProtocolPath(uri?: URI): string | undefined {
28
+ if (!uri) {
29
+ return undefined;
30
+ }
31
+ const path = uri.path.toString();
32
+ const roots = this.workspaceService.tryGetRoots();
33
+ for (const root of roots) {
34
+ const rootUri = root.resource.path.toString() + '/';
35
+ if (path.startsWith(rootUri)) {
36
+ return root.name + '/' + path.substring(rootUri.length);
37
+ }
38
+ }
39
+ return undefined;
40
+ }
41
+
42
+ getResourceUri(path?: string): URI | undefined {
43
+ if (!path) {
44
+ return undefined;
45
+ }
46
+ const parts = path.split('/');
47
+ const root = parts[0];
48
+ const rest = parts.slice(1);
49
+ const stat = this.workspaceService.tryGetRoots().find(e => e.name === root);
50
+ if (stat) {
51
+ const uriPath = stat.resource.path.join(...rest);
52
+ const uri = stat.resource.withPath(uriPath);
53
+ return uri;
54
+ } else {
55
+ return undefined;
56
+ }
57
+ }
58
+
59
+ }
@@ -0,0 +1,69 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { nls } from '@theia/core';
18
+ import { injectable } from '@theia/core/shared/inversify';
19
+ import { Disposable } from '@theia/core/shared/vscode-languageserver-protocol';
20
+ import { FileStat } from '@theia/filesystem/lib/common/files';
21
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
22
+ import { Workspace, ProtocolBroadcastConnection } from 'open-collaboration-protocol';
23
+ import { CollaborationURI } from './collaboration-file-system-provider';
24
+
25
+ @injectable()
26
+ export class CollaborationWorkspaceService extends WorkspaceService {
27
+
28
+ protected collabWorkspace?: Workspace;
29
+ protected connection?: ProtocolBroadcastConnection;
30
+
31
+ async setHostWorkspace(workspace: Workspace, connection: ProtocolBroadcastConnection): Promise<Disposable> {
32
+ this.collabWorkspace = workspace;
33
+ this.connection = connection;
34
+ await this.setWorkspace({
35
+ isDirectory: false,
36
+ isFile: true,
37
+ isReadonly: false,
38
+ isSymbolicLink: false,
39
+ name: nls.localize('theia/collaboration/collaborationWorkspace', 'Collaboration Workspace'),
40
+ resource: CollaborationURI.create(this.collabWorkspace)
41
+ });
42
+ return Disposable.create(() => {
43
+ this.collabWorkspace = undefined;
44
+ this.connection = undefined;
45
+ this.setWorkspace(undefined);
46
+ });
47
+ }
48
+
49
+ protected override async computeRoots(): Promise<FileStat[]> {
50
+ if (this.collabWorkspace) {
51
+ return this.collabWorkspace.folders.map(e => this.entryToStat(e));
52
+ } else {
53
+ return super.computeRoots();
54
+ }
55
+ }
56
+
57
+ protected entryToStat(entry: string): FileStat {
58
+ const uri = CollaborationURI.create(this.collabWorkspace!, entry);
59
+ return {
60
+ resource: uri,
61
+ name: entry,
62
+ isDirectory: true,
63
+ isFile: false,
64
+ isReadonly: false,
65
+ isSymbolicLink: false
66
+ };
67
+ }
68
+
69
+ }
@@ -0,0 +1,22 @@
1
+ .theia-collaboration-selection-marker {
2
+ position: absolute;
3
+ content: " ";
4
+ border-right: solid 2px;
5
+ border-top: solid 2px;
6
+ border-bottom: solid 2px;
7
+ height: 100%;
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ .theia-collaboration-selection-marker::after {
12
+ position: absolute;
13
+ transform: translateY(-100%);
14
+ padding: 0 4px;
15
+ border-radius: 4px 4px 4px 0px;
16
+ }
17
+
18
+ .theia-collaboration-selection-marker.theia-collaboration-selection-inverted::after {
19
+ transform: translateY(100%);
20
+ margin-top: -2px;
21
+ border-radius: 0px 4px 4px 4px;
22
+ }
@@ -0,0 +1,28 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /* note: this bogus test file is required so that
18
+ we are able to run mocha unit tests on this
19
+ package, without having any actual unit tests in it.
20
+ This way a coverage report will be generated,
21
+ showing 0% coverage, instead of no report.
22
+ This file can be removed once we have real unit
23
+ tests in place. */
24
+
25
+ describe('request package', () => {
26
+
27
+ it('should support code coverage statistics', () => true);
28
+ });