@univerjs-pro/collaboration-client-ui 0.5.1-nightly.202412051606
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/README.md +18 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/fr-FR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +1 -0
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/fr-FR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/index.css +1 -0
- package/lib/types/controllers/clipboard/docs/image/image-paste.controller.d.ts +9 -0
- package/lib/types/controllers/collab-cursor/__tests__/doc-collab-cursor.controller.spec.d.ts +23 -0
- package/lib/types/controllers/collab-cursor/__tests__/serialize-text-ranges.spec.d.ts +1 -0
- package/lib/types/controllers/collab-cursor/__tests__/sheet-collab-cursor.controller.spec.d.ts +1 -0
- package/lib/types/controllers/collab-cursor/collab-cursor.controller.d.ts +22 -0
- package/lib/types/controllers/collab-cursor/doc-collab-cursor-entity.d.ts +37 -0
- package/lib/types/controllers/collab-cursor/doc-collab-cursor-render.controller.d.ts +24 -0
- package/lib/types/controllers/collab-cursor/serialize-text-ranges.d.ts +3 -0
- package/lib/types/controllers/collab-cursor/sheet-collab-cursor-entity.d.ts +38 -0
- package/lib/types/controllers/collab-cursor/sheet-collab-cursor-render.controller.d.ts +21 -0
- package/lib/types/controllers/collab-status/collab-status.controller.d.ts +17 -0
- package/lib/types/controllers/collaboration/__tests__/collaboration.controller.spec.d.ts +4 -0
- package/lib/types/controllers/collaboration/__tests__/mock-text-selection-render-manager.service.d.ts +0 -0
- package/lib/types/controllers/collaboration/__tests__/mocks.d.ts +58 -0
- package/lib/types/controllers/collaboration-client-ui.controller.d.ts +17 -0
- package/lib/types/controllers/config.schema.d.ts +10 -0
- package/lib/types/controllers/entity-ui/collaboration-entity-ui.controller.d.ts +25 -0
- package/lib/types/controllers/url/__tests__/data-loader.controller.spec.d.ts +1 -0
- package/lib/types/controllers/url/web-url.controller.d.ts +18 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/locale/en-US.d.ts +3 -0
- package/lib/types/locale/fa-IR.d.ts +3 -0
- package/lib/types/locale/fr-FR.d.ts +3 -0
- package/lib/types/locale/ru-RU.d.ts +3 -0
- package/lib/types/locale/vi-VN.d.ts +3 -0
- package/lib/types/locale/zh-CN.d.ts +39 -0
- package/lib/types/locale/zh-TW.d.ts +3 -0
- package/lib/types/models/cursor.d.ts +30 -0
- package/lib/types/plugin.d.ts +17 -0
- package/lib/types/services/color-assign/color-assign.service.d.ts +10 -0
- package/lib/types/services/ime-cache-transform/doc-transform-ime-cache.service.d.ts +13 -0
- package/lib/types/services/local-cache/web-local-cache.service.d.ts +27 -0
- package/lib/types/services/single-active-unit/single-active-unit.service.d.ts +26 -0
- package/lib/types/services/state-cache-transform/doc-transform-state-cache.service.d.ts +12 -0
- package/lib/types/services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service.d.ts +13 -0
- package/lib/types/services/text-selection/doc-transform-selections.service.d.ts +8 -0
- package/lib/types/services/url/url.service.d.ts +12 -0
- package/lib/types/services/url/web-url.service.d.ts +10 -0
- package/lib/types/views/components/CollabStatus.d.ts +10 -0
- package/lib/types/views/components/CollabStatus.stories.d.ts +8 -0
- package/lib/types/views/shapes/doc-collab-cursor.d.ts +27 -0
- package/lib/types/views/shapes/sheet-collab-cursor.shape.d.ts +27 -0
- package/lib/types/views/shapes/text-bubble.shape.d.ts +19 -0
- package/lib/umd/index.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { IDisposable, ILocalStorageService, Nullable, ILogService } from '@univerjs/core';
|
|
2
|
+
import { IMessageOptions, IMessageProps } from '@univerjs/design';
|
|
3
|
+
import { HTTPResponse } from '@univerjs/network';
|
|
4
|
+
import { IBeforeCloseService, IMessageService, INotificationService } from '@univerjs/ui';
|
|
5
|
+
import { ICombResponseEvent } from '@univerjs-pro/collaboration';
|
|
6
|
+
import { ICollaborationSocket, ICollaborationSocketService } from '@univerjs-pro/collaboration-client';
|
|
7
|
+
import { Subject } from 'rxjs';
|
|
8
|
+
/**
|
|
9
|
+
* The handler object for a mocked socket connection. You can terminate, send messages / error through this object.
|
|
10
|
+
*/
|
|
11
|
+
export interface IMockCollabSessionSocketHandler extends ICollaborationSocket {
|
|
12
|
+
socket: ICollaborationSocket;
|
|
13
|
+
close$: Subject<CloseEvent>;
|
|
14
|
+
error$: Subject<Event>;
|
|
15
|
+
open$: Subject<Event>;
|
|
16
|
+
message$: Subject<ICombResponseEvent>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This service provides a mocked
|
|
20
|
+
*/
|
|
21
|
+
export declare class MockCollaborationSocketService implements ICollaborationSocketService {
|
|
22
|
+
private readonly _logService;
|
|
23
|
+
private readonly _handlers;
|
|
24
|
+
constructor(_logService: ILogService);
|
|
25
|
+
createSocket(url: string): Nullable<ICollaborationSocket>;
|
|
26
|
+
/** Test scripts could get the session handler from this method to mock network events. */
|
|
27
|
+
getHandler(url: string): Nullable<IMockCollabSessionSocketHandler>;
|
|
28
|
+
}
|
|
29
|
+
export declare class MockBeforeCloseService implements IBeforeCloseService {
|
|
30
|
+
private _onCloseCallbacks;
|
|
31
|
+
private _beforeCloseCallbacks;
|
|
32
|
+
registerBeforeClose(callback: () => string | undefined): IDisposable;
|
|
33
|
+
registerOnClose(callback: () => void): IDisposable;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A mocked local storage service which use in-memory storage.
|
|
37
|
+
*/
|
|
38
|
+
export declare class MockLocalStorageService implements ILocalStorageService {
|
|
39
|
+
private readonly _inMemoryCache;
|
|
40
|
+
getItem<T>(key: string): Promise<T | null>;
|
|
41
|
+
setItem<T>(key: string, value: T): Promise<T>;
|
|
42
|
+
removeItem(_key: string): Promise<void>;
|
|
43
|
+
clear(): Promise<void>;
|
|
44
|
+
key(_index: number): Promise<string | null>;
|
|
45
|
+
keys(): Promise<string[]>;
|
|
46
|
+
iterate<T, U>(_iteratee: (value: T, key: string, iterationNumber: number) => U): Promise<U>;
|
|
47
|
+
}
|
|
48
|
+
export declare class MockMessageService implements IMessageService {
|
|
49
|
+
show(_options: IMessageOptions & Omit<IMessageProps, 'key'>): IDisposable;
|
|
50
|
+
setContainer(_container: HTMLElement): void;
|
|
51
|
+
getContainer(): HTMLElement;
|
|
52
|
+
}
|
|
53
|
+
export declare class MockNotificationService implements INotificationService {
|
|
54
|
+
show(): IDisposable;
|
|
55
|
+
}
|
|
56
|
+
export declare class MockHTTPService {
|
|
57
|
+
get(url: string): Promise<HTTPResponse<any>>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CollaborationUIEventService, ILocalCacheService } from '@univerjs-pro/collaboration-client';
|
|
2
|
+
import { Disposable, LocaleService } from '@univerjs/core';
|
|
3
|
+
import { IBeforeCloseService, IMessageService, INotificationService } from '@univerjs/ui';
|
|
4
|
+
/**
|
|
5
|
+
* This controller is responsible for the general UI of the collaboration client.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CollaborationClientUIController extends Disposable {
|
|
8
|
+
private readonly _beforeCloseService;
|
|
9
|
+
protected readonly _localCacheService: ILocalCacheService;
|
|
10
|
+
private readonly _collaborationUIEventService;
|
|
11
|
+
protected readonly _messageService: IMessageService;
|
|
12
|
+
private readonly _notificationService;
|
|
13
|
+
protected readonly _localeService: LocaleService;
|
|
14
|
+
constructor(_beforeCloseService: IBeforeCloseService, _localCacheService: ILocalCacheService, _collaborationUIEventService: CollaborationUIEventService, _messageService: IMessageService, _notificationService: INotificationService, _localeService: LocaleService);
|
|
15
|
+
private _setupBeforeClosingHandler;
|
|
16
|
+
private _initEvent;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DependencyOverride } from '@univerjs/core';
|
|
2
|
+
export declare const PLUGIN_CONFIG_KEY = "collaboration-client-ui.config";
|
|
3
|
+
export declare const configSymbol: unique symbol;
|
|
4
|
+
export interface IUniverCollaborationClientUIConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Override internal modules with custom implementations.
|
|
7
|
+
*/
|
|
8
|
+
override?: DependencyOverride;
|
|
9
|
+
}
|
|
10
|
+
export declare const defaultPluginConfig: IUniverCollaborationClientUIConfig;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Disposable, LocaleService } from '@univerjs/core';
|
|
2
|
+
import { DocStateChangeManagerService } from '@univerjs/docs-ui';
|
|
3
|
+
import { IMessageService } from '@univerjs/ui';
|
|
4
|
+
import { CollaborationController, CollaborationStatus } from '@univerjs-pro/collaboration-client';
|
|
5
|
+
import { BehaviorSubject } from 'rxjs';
|
|
6
|
+
import { DocTransformIMECacheService } from '../../services/ime-cache-transform/doc-transform-ime-cache.service';
|
|
7
|
+
import { DocTransformStateCacheService } from '../../services/state-cache-transform/doc-transform-state-cache.service';
|
|
8
|
+
import { DocSyncEditingCollabCursorService } from '../../services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service';
|
|
9
|
+
import { DocTransformSelectionsService } from '../../services/text-selection/doc-transform-selections.service';
|
|
10
|
+
/**
|
|
11
|
+
* This controller is responsible for monitoring the collaboration status of the currently focused unit.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CollaborationEntityUIController extends Disposable {
|
|
14
|
+
private readonly _docStateChangeManagerService;
|
|
15
|
+
private readonly _collaborationController;
|
|
16
|
+
private readonly _docTransformIMECacheService;
|
|
17
|
+
private readonly _docTransformStateCacheService;
|
|
18
|
+
private readonly _docTransformSelectionsService;
|
|
19
|
+
private readonly _docSyncEditingCollabCursorService;
|
|
20
|
+
protected readonly _messageService: IMessageService;
|
|
21
|
+
protected readonly _localeService: LocaleService;
|
|
22
|
+
protected readonly _status$: BehaviorSubject<CollaborationStatus>;
|
|
23
|
+
constructor(_docStateChangeManagerService: DocStateChangeManagerService, _collaborationController: CollaborationController, _docTransformIMECacheService: DocTransformIMECacheService, _docTransformStateCacheService: DocTransformStateCacheService, _docTransformSelectionsService: DocTransformSelectionsService, _docSyncEditingCollabCursorService: DocSyncEditingCollabCursorService, _messageService: IMessageService, _localeService: LocaleService);
|
|
24
|
+
private _initEntityListener;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DataLoaderService } from '@univerjs-pro/collaboration-client';
|
|
2
|
+
import { ICommandService, ILogService, RxDisposable } from '@univerjs/core';
|
|
3
|
+
import { IRemoteInstanceService } from '@univerjs/rpc';
|
|
4
|
+
import { IURLService } from '../../services/url/url.service';
|
|
5
|
+
/**
|
|
6
|
+
* This controller loads data when URL changes.
|
|
7
|
+
*/
|
|
8
|
+
export declare class WebUrlController extends RxDisposable {
|
|
9
|
+
private readonly _urlService;
|
|
10
|
+
private readonly _logService;
|
|
11
|
+
private readonly _commandService;
|
|
12
|
+
private readonly _dataLoaderService;
|
|
13
|
+
constructor(_urlService: IURLService, _logService: ILogService, _commandService: ICommandService, _dataLoaderService: DataLoaderService, remoteInstanceService?: IRemoteInstanceService);
|
|
14
|
+
private _init;
|
|
15
|
+
private _setupSubUnitSync;
|
|
16
|
+
private _updateURLWithCurrentState;
|
|
17
|
+
private _updateSubUnitFromURLParams;
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { UniverCollaborationClientUIPlugin } from './plugin';
|
|
2
|
+
export { DesktopCollaborationStatusDisplayController } from './controllers/collab-status/collab-status.controller';
|
|
3
|
+
/** @deprecated Will be removed in the 0.2.19 release */
|
|
4
|
+
export { CollaborationStatusDisplay } from './views/components/CollabStatus';
|
|
5
|
+
export { WebBrowserSingleActiveUnitService } from './services/single-active-unit/single-active-unit.service';
|
|
6
|
+
export { type ISheetCollabCursorShapeProps, SheetCollabCursorShape } from './views/shapes/sheet-collab-cursor.shape';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const locales: {
|
|
2
|
+
'collab-client': {
|
|
3
|
+
tooltip: {
|
|
4
|
+
reconnect: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
collabStatus: {
|
|
8
|
+
fetchMiss: string;
|
|
9
|
+
conflict: string;
|
|
10
|
+
notCollab: string;
|
|
11
|
+
synced: string;
|
|
12
|
+
syncing: string;
|
|
13
|
+
offline: string;
|
|
14
|
+
};
|
|
15
|
+
session: {
|
|
16
|
+
'connection-failed': string;
|
|
17
|
+
'will-retry': string;
|
|
18
|
+
'room-full': string;
|
|
19
|
+
'collaboration-timeout': string;
|
|
20
|
+
};
|
|
21
|
+
conflict: {
|
|
22
|
+
title: string;
|
|
23
|
+
content: string;
|
|
24
|
+
};
|
|
25
|
+
permission: {
|
|
26
|
+
title: string;
|
|
27
|
+
content: string;
|
|
28
|
+
};
|
|
29
|
+
collaboration: {
|
|
30
|
+
'single-unit': {
|
|
31
|
+
warning: string;
|
|
32
|
+
};
|
|
33
|
+
closeRoom: string;
|
|
34
|
+
};
|
|
35
|
+
auth: {
|
|
36
|
+
needGotoLoginAlert: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export default locales;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IRange } from '@univerjs/core';
|
|
2
|
+
import { ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
3
|
+
/**
|
|
4
|
+
* The data structure to store collab cursor info of sheet.
|
|
5
|
+
*/
|
|
6
|
+
export interface ISheetCollabCursor {
|
|
7
|
+
/** Stroke color of this collab cursor */
|
|
8
|
+
color: string;
|
|
9
|
+
/** Position of this cursor */
|
|
10
|
+
range: IRange;
|
|
11
|
+
/** Displayed user name of this cursor */
|
|
12
|
+
name: string;
|
|
13
|
+
/** The serialized range to check if two cursor are on the same position. */
|
|
14
|
+
selection: string;
|
|
15
|
+
/** Worksheet ID */
|
|
16
|
+
sheetID: string;
|
|
17
|
+
/** Background color of this collab cursor */
|
|
18
|
+
backgroundColor?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The data structure to store collab cursor info of doc.
|
|
22
|
+
*/
|
|
23
|
+
export interface IDocCollabCursor {
|
|
24
|
+
/** Background color of this collab cursor */
|
|
25
|
+
color: string;
|
|
26
|
+
/** Displayed user name of this cursor */
|
|
27
|
+
name: string;
|
|
28
|
+
/** The deserialized ranges of collab cursor. */
|
|
29
|
+
ranges: ITextRangeWithStyle[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IUniverCollaborationClientUIConfig } from './controllers/config.schema';
|
|
2
|
+
import { IConfigService, ILogService, Injector, Plugin } from '@univerjs/core';
|
|
3
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
|
+
export declare class UniverCollaborationClientUIPlugin extends Plugin {
|
|
5
|
+
private readonly _config;
|
|
6
|
+
private readonly _logService;
|
|
7
|
+
private readonly _renderManagerService;
|
|
8
|
+
protected _injector: Injector;
|
|
9
|
+
private readonly _configService;
|
|
10
|
+
static pluginName: string;
|
|
11
|
+
constructor(_config: Partial<IUniverCollaborationClientUIConfig> | undefined, _logService: ILogService, _renderManagerService: IRenderManagerService, _injector: Injector, _configService: IConfigService);
|
|
12
|
+
onStarting(): void;
|
|
13
|
+
onRendered(): void;
|
|
14
|
+
private _registerDependencies;
|
|
15
|
+
private _registerRenderDependencies;
|
|
16
|
+
private _initDependencies;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
export declare const BACKGROUND_TOKENS: string[];
|
|
3
|
+
/**
|
|
4
|
+
* This service assign a color to each collaboration member.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ColorAssignService extends Disposable {
|
|
7
|
+
private _assignedColors;
|
|
8
|
+
private _colorIndex;
|
|
9
|
+
assignAColorForMemberID(memberID: string): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IChangeset, ITransformService } from '@univerjs-pro/collaboration';
|
|
2
|
+
import { Injector } from '@univerjs/core';
|
|
3
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
|
+
export declare class DocTransformIMECacheService {
|
|
5
|
+
private readonly _injector;
|
|
6
|
+
private readonly _transformService;
|
|
7
|
+
private readonly _renderManagerService;
|
|
8
|
+
constructor(_injector: Injector, _transformService: ITransformService, _renderManagerService: IRenderManagerService);
|
|
9
|
+
transformIMECache(changeset: IChangeset): void;
|
|
10
|
+
transformRemoteChangeset(changeset: IChangeset): IChangeset;
|
|
11
|
+
private _transformUndoRedoStack;
|
|
12
|
+
private _transformPreviousActiveRange;
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UniverType } from '@univerjs/protocol';
|
|
2
|
+
import { IChangeset, RevisionService } from '@univerjs-pro/collaboration';
|
|
3
|
+
import { ILocalCacheService, IUnitCacheData } from '@univerjs-pro/collaboration-client';
|
|
4
|
+
import { Disposable, IConfigService, ILocalStorageService, IMutationInfo, Nullable } from '@univerjs/core';
|
|
5
|
+
/**
|
|
6
|
+
* This service provide caching to the collaboration controller.
|
|
7
|
+
*/
|
|
8
|
+
export declare class WebLocalCacheService extends Disposable implements ILocalCacheService {
|
|
9
|
+
private readonly _configService;
|
|
10
|
+
private readonly _localStorageService;
|
|
11
|
+
private readonly _revisionService;
|
|
12
|
+
private _cachedData;
|
|
13
|
+
private _saveTaskMap;
|
|
14
|
+
private _disabled;
|
|
15
|
+
constructor(_configService: IConfigService, _localStorageService: ILocalStorageService, _revisionService: RevisionService);
|
|
16
|
+
disableLocalCache(): void;
|
|
17
|
+
enableLocalCache(): void;
|
|
18
|
+
get saveTaskMap(): Map<string, number>;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
loadOfflineData(unitID: string): Promise<Nullable<IUnitCacheData>>;
|
|
21
|
+
saveOfflineData(unitID: string, data: IUnitCacheData): Promise<boolean>;
|
|
22
|
+
updateOfflineData(unitID: string, type: UniverType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[]): void;
|
|
23
|
+
private _scheduleSaving;
|
|
24
|
+
private _getSaveTimeout;
|
|
25
|
+
private _saveCache;
|
|
26
|
+
exhaustSavingTask(): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ISingleActiveUnitService, UnitStatus } from '@univerjs-pro/collaboration-client';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
export declare class WebBrowserSingleActiveUnitService extends Disposable implements ISingleActiveUnitService {
|
|
5
|
+
private _id;
|
|
6
|
+
private _selfUnitIDs;
|
|
7
|
+
private _unitOnClients;
|
|
8
|
+
private _heartbeatTimer;
|
|
9
|
+
private _clearOtherTimers;
|
|
10
|
+
private _unitStatus;
|
|
11
|
+
constructor();
|
|
12
|
+
dispose(): void;
|
|
13
|
+
getUnitStatus$(unitID: string): Observable<UnitStatus>;
|
|
14
|
+
editingUnit(unitID: string): void;
|
|
15
|
+
disposeUnit(unitID: string): void;
|
|
16
|
+
private _init;
|
|
17
|
+
private _handleEvent;
|
|
18
|
+
private _handleJoinEvent;
|
|
19
|
+
private _scheduleClearOtherTimer;
|
|
20
|
+
private _removeClearOtherTimer;
|
|
21
|
+
private _handleLeaveEvent;
|
|
22
|
+
private _handleHeartbeatEvent;
|
|
23
|
+
private _send;
|
|
24
|
+
private _scheduleHeartbeat;
|
|
25
|
+
private _ensureSubject;
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IChangeset, ITransformService } from '@univerjs-pro/collaboration';
|
|
2
|
+
import { Injector } from '@univerjs/core';
|
|
3
|
+
import { DocStateChangeManagerService } from '@univerjs/docs-ui';
|
|
4
|
+
export declare class DocTransformStateCacheService {
|
|
5
|
+
private readonly _injector;
|
|
6
|
+
private readonly _transformService;
|
|
7
|
+
private readonly _docStateChangeManagerService;
|
|
8
|
+
constructor(_injector: Injector, _transformService: ITransformService, _docStateChangeManagerService: DocStateChangeManagerService);
|
|
9
|
+
transformStateCache(changeset: IChangeset): void;
|
|
10
|
+
transformRemoteChangeset(changeset: IChangeset): IChangeset;
|
|
11
|
+
private _transformHistoryAndStateStack;
|
|
12
|
+
}
|
package/lib/types/services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Nullable, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
3
|
+
import { IUpdateCursor } from '@univerjs/protocol';
|
|
4
|
+
export interface ICollabEditingCursor {
|
|
5
|
+
unitID: string;
|
|
6
|
+
memberID: string;
|
|
7
|
+
textRanges: ITextRangeWithStyle[];
|
|
8
|
+
}
|
|
9
|
+
export declare class DocSyncEditingCollabCursorService extends RxDisposable {
|
|
10
|
+
private readonly _collabCursorState$;
|
|
11
|
+
readonly collabCursorState$: import('rxjs').Observable<Nullable<IUpdateCursor>>;
|
|
12
|
+
syncEditingCollabCursor(collabCursor: ICollabEditingCursor): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Injector } from '@univerjs/core';
|
|
2
|
+
import { IChangeset, ITransformService } from '@univerjs-pro/collaboration';
|
|
3
|
+
export declare class DocTransformSelectionsService {
|
|
4
|
+
private readonly _injector;
|
|
5
|
+
private readonly _transformService;
|
|
6
|
+
constructor(_injector: Injector, _transformService: ITransformService);
|
|
7
|
+
transformSelections(changeset: IChangeset): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* This service reads the url from the host platform and return url parts,
|
|
4
|
+
* such as queries, hashes and path.
|
|
5
|
+
*/
|
|
6
|
+
export interface IURLService {
|
|
7
|
+
getParam: (key: string) => string | undefined;
|
|
8
|
+
setParam: (key: string, value: string, useReplace?: boolean) => void;
|
|
9
|
+
removeParam: (key: string, useReplace?: boolean) => void;
|
|
10
|
+
urlChange$: Observable<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare const IURLService: import('@wendellhu/redi').IdentifierDecorator<IURLService>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { IURLService } from './url.service';
|
|
3
|
+
import { RxDisposable } from '@univerjs/core';
|
|
4
|
+
export declare class WebURLService extends RxDisposable implements IURLService {
|
|
5
|
+
readonly urlChange$: Observable<void>;
|
|
6
|
+
constructor();
|
|
7
|
+
setParam(key: string, value: string, useReplace?: boolean): void;
|
|
8
|
+
removeParam(key: string, useReplace?: boolean): void;
|
|
9
|
+
getParam(key: string): string | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { CollaborationStatus } from '@univerjs-pro/collaboration-client';
|
|
3
|
+
export interface IOnlineStatusProps {
|
|
4
|
+
/** The collaboration state of the currently focused unit. */
|
|
5
|
+
status$: Observable<CollaborationStatus>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A component to display collaboration status to users.
|
|
9
|
+
*/
|
|
10
|
+
export declare function CollaborationStatusDisplay(props: Readonly<IOnlineStatusProps>): JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { CollaborationStatusDisplay } from './CollabStatus';
|
|
4
|
+
declare const meta: Meta<typeof CollaborationStatusDisplay>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Playground: {
|
|
7
|
+
render: () => React.JSX.Element;
|
|
8
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Documents, DocumentSkeleton, Scene } from '@univerjs/engine-render';
|
|
2
|
+
import { IDocCollabCursor } from '../../models/cursor';
|
|
3
|
+
/**
|
|
4
|
+
* Render a single collaborated cursor on the canvas.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DocCollabCursor {
|
|
7
|
+
private _cursor;
|
|
8
|
+
private _scene;
|
|
9
|
+
private _docSkeleton;
|
|
10
|
+
private _document;
|
|
11
|
+
private _shapes;
|
|
12
|
+
private _anchor;
|
|
13
|
+
private _textBubble;
|
|
14
|
+
private _anchorDot;
|
|
15
|
+
private _hideTimer;
|
|
16
|
+
private _eventUnsubscribe;
|
|
17
|
+
constructor(_cursor: IDocCollabCursor, _scene: Scene, _docSkeleton: DocumentSkeleton, _document: Documents);
|
|
18
|
+
private set _hover(value);
|
|
19
|
+
dispose(): void;
|
|
20
|
+
private _render;
|
|
21
|
+
private _drawAnchor;
|
|
22
|
+
private _handleHover;
|
|
23
|
+
private _drawTextRange;
|
|
24
|
+
private _drawRectRange;
|
|
25
|
+
private _getAnchorBounding;
|
|
26
|
+
private _getScale;
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IMouseEvent, IPointerEvent, IShapeProps, Shape } from '@univerjs/engine-render';
|
|
2
|
+
import { ISheetCollabCursor } from '../../models/cursor';
|
|
3
|
+
export declare const SHEET_COLLAB_CURSOR_ZINDEX = 1;
|
|
4
|
+
export declare const SHEET_COLLAB_CURSOR_BORDER_WIDTH = 1.5;
|
|
5
|
+
export interface ISheetCollabCursorShapeProps extends IShapeProps, ISheetCollabCursor {
|
|
6
|
+
hovered?: boolean;
|
|
7
|
+
labelPosition?: 'bottom' | 'top';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Render a single collaborated cursor on the canvas.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SheetCollabCursorShape<T extends ISheetCollabCursorShapeProps = ISheetCollabCursorShapeProps> extends Shape<T> {
|
|
13
|
+
private _color;
|
|
14
|
+
private _hovered;
|
|
15
|
+
private _range;
|
|
16
|
+
private _name;
|
|
17
|
+
private _labelPosition;
|
|
18
|
+
private _backgroundColor?;
|
|
19
|
+
constructor(key?: string, props?: T);
|
|
20
|
+
setShapeProps(props: Partial<ISheetCollabCursorShapeProps>): void;
|
|
21
|
+
onMouseMove(position: {
|
|
22
|
+
row: number;
|
|
23
|
+
column: number;
|
|
24
|
+
}): void;
|
|
25
|
+
triggerDblclick(evt: IPointerEvent | IMouseEvent): boolean;
|
|
26
|
+
protected _draw(ctx: CanvasRenderingContext2D): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IShapeProps, UniverRenderingContext, Shape } from '@univerjs/engine-render';
|
|
2
|
+
export declare const COLLAB_CURSOR_LABEL_HEIGHT = 20;
|
|
3
|
+
export declare const COLLAB_CURSOR_LABEL_MAX_WIDTH = 200;
|
|
4
|
+
export declare const COLLAB_CURSOR_LABEL_TEXT_PADDING_LR = 4;
|
|
5
|
+
export declare const COLLAB_CURSOR_LABEL_TEXT_PADDING_TB = 5;
|
|
6
|
+
export interface ITextBubbleShapeProps extends IShapeProps {
|
|
7
|
+
color: string;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Render a single collaborated cursor on the canvas.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TextBubbleShape<T extends ITextBubbleShapeProps = ITextBubbleShapeProps> extends Shape<T> {
|
|
14
|
+
color: string;
|
|
15
|
+
text: string;
|
|
16
|
+
constructor(key: string, props: T);
|
|
17
|
+
static drawWith(ctx: CanvasRenderingContext2D, props: ITextBubbleShapeProps): void;
|
|
18
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
19
|
+
}
|