@univerjs-pro/collaboration-client 0.5.0-alpha.0 → 0.5.0-beta.0

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 (84) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/cjs/locale/en-US.js +1 -1
  3. package/lib/cjs/locale/fa-IR.js +1 -1
  4. package/lib/cjs/locale/ru-RU.js +1 -1
  5. package/lib/cjs/locale/vi-VN.js +1 -1
  6. package/lib/cjs/locale/zh-CN.js +1 -1
  7. package/lib/cjs/locale/zh-TW.js +1 -1
  8. package/lib/es/index.js +1 -1
  9. package/lib/es/locale/en-US.js +1 -1
  10. package/lib/es/locale/fa-IR.js +1 -1
  11. package/lib/es/locale/ru-RU.js +1 -1
  12. package/lib/es/locale/vi-VN.js +1 -1
  13. package/lib/es/locale/zh-CN.js +1 -1
  14. package/lib/es/locale/zh-TW.js +1 -1
  15. package/lib/types/config/config.d.ts +49 -0
  16. package/lib/types/controllers/collab-cursor/__tests__/doc-collab-cursor.controller.spec.d.ts +23 -0
  17. package/lib/types/controllers/collab-cursor/__tests__/serialize-text-ranges.spec.d.ts +1 -0
  18. package/lib/types/controllers/collab-cursor/__tests__/sheet-collab-cursor.controller.spec.d.ts +1 -0
  19. package/lib/types/controllers/collab-cursor/collab-cursor.controller.d.ts +22 -0
  20. package/lib/types/controllers/collab-cursor/doc-collab-cursor-entity.d.ts +38 -0
  21. package/lib/types/controllers/collab-cursor/doc-collab-cursor-render.controller.d.ts +24 -0
  22. package/lib/types/controllers/collab-cursor/serialize-text-ranges.d.ts +3 -0
  23. package/lib/types/controllers/collab-cursor/sheet-collab-cursor-entity.d.ts +39 -0
  24. package/lib/types/controllers/collab-cursor/sheet-collab-cursor-render.controller.d.ts +21 -0
  25. package/lib/types/controllers/collab-status/collab-status.controller.d.ts +18 -0
  26. package/lib/types/controllers/collaboration/__tests__/collaboration.controller.spec.d.ts +4 -0
  27. package/lib/types/controllers/collaboration/__tests__/mock-text-selection-render-manager.service.d.ts +0 -0
  28. package/lib/types/controllers/collaboration/__tests__/mocks.d.ts +58 -0
  29. package/lib/types/controllers/collaboration/collaboration-entity.d.ts +91 -0
  30. package/lib/types/controllers/collaboration/collaboration-state.d.ts +303 -0
  31. package/lib/types/controllers/collaboration/collaboration.controller.d.ts +24 -0
  32. package/lib/types/controllers/collaboration/utils/changeset-utils.d.ts +18 -0
  33. package/lib/types/controllers/collaboration/utils/empty.d.ts +2 -0
  34. package/lib/types/controllers/config.schema.d.ts +33 -0
  35. package/lib/types/controllers/data-loader/__tests__/data-loader.controller.spec.d.ts +1 -0
  36. package/lib/types/controllers/data-loader/data-loader.controller.d.ts +22 -0
  37. package/lib/types/controllers/file-name/file-name.controller.d.ts +12 -0
  38. package/lib/types/controllers/telemetry.d.ts +11 -0
  39. package/lib/types/index.d.ts +35 -890
  40. package/lib/types/locale/en-US.d.ts +3 -0
  41. package/lib/types/locale/fa-IR.d.ts +3 -0
  42. package/lib/types/locale/ru-RU.d.ts +3 -0
  43. package/lib/types/locale/vi-VN.d.ts +3 -0
  44. package/lib/types/locale/zh-CN.d.ts +39 -0
  45. package/lib/types/locale/zh-TW.d.ts +3 -0
  46. package/lib/types/models/cursor.d.ts +30 -0
  47. package/lib/types/plugin.d.ts +18 -0
  48. package/lib/types/services/auth-server/auth-server.service.d.ts +10 -0
  49. package/lib/types/services/auth-server/authz-io-http.service.d.ts +30 -0
  50. package/lib/types/services/auth-server/domain-request.service.d.ts +6 -0
  51. package/lib/types/services/auth-server/util.d.ts +1 -0
  52. package/lib/types/services/collaboration-session/collaboration-session.d.ts +59 -0
  53. package/lib/types/services/collaboration-session/collaboration-session.service.d.ts +75 -0
  54. package/lib/types/services/color-assign/color-assign.service.d.ts +10 -0
  55. package/lib/types/services/comment/comment.service.d.ts +6 -0
  56. package/lib/types/services/image-remote/image-io.service.d.ts +34 -0
  57. package/lib/types/services/ime-cache-transform/doc-transform-ime-cache.service.d.ts +13 -0
  58. package/lib/types/services/local-cache/local-cache.service.d.ts +37 -0
  59. package/lib/types/services/member/member.service.d.ts +77 -0
  60. package/lib/types/services/permission/permission.service.d.ts +12 -0
  61. package/lib/types/services/range-selection/sheet-transform-selections.service.d.ts +13 -0
  62. package/lib/types/services/single-active-unit/single-active-unit.service.d.ts +39 -0
  63. package/lib/types/services/snapshot-server/snapshot-server.service.d.ts +21 -0
  64. package/lib/types/services/socket/collaboration-socket.service.d.ts +34 -0
  65. package/lib/types/services/socket/serialize.d.ts +3 -0
  66. package/lib/types/services/state-cache-transform/doc-transform-state-cache.service.d.ts +12 -0
  67. package/lib/types/services/sync-editing-collab-cursor/doc-sync-editing-collab-cursor.service.d.ts +13 -0
  68. package/lib/types/services/text-selection/doc-transform-selections.service.d.ts +8 -0
  69. package/lib/types/services/undoredo/collaborative-undoredo.service.d.ts +19 -0
  70. package/lib/types/services/url/url.service.d.ts +12 -0
  71. package/lib/types/services/url/web-url.service.d.ts +10 -0
  72. package/lib/types/views/components/CollabStatus.d.ts +10 -0
  73. package/lib/types/views/components/CollabStatus.stories.d.ts +8 -0
  74. package/lib/types/views/shapes/doc-collab-cursor.d.ts +27 -0
  75. package/lib/types/views/shapes/sheet-collab-cursor.shape.d.ts +27 -0
  76. package/lib/types/views/shapes/text-bubble.shape.d.ts +19 -0
  77. package/lib/umd/index.js +1 -1
  78. package/lib/umd/locale/en-US.js +1 -1
  79. package/lib/umd/locale/fa-IR.js +1 -1
  80. package/lib/umd/locale/ru-RU.js +1 -1
  81. package/lib/umd/locale/vi-VN.js +1 -1
  82. package/lib/umd/locale/zh-CN.js +1 -1
  83. package/lib/umd/locale/zh-TW.js +1 -1
  84. package/package.json +23 -24
@@ -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,19 @@
1
+ import { IUndoRedoService, ICommandService, IContextService, ILogService, IUniverInstanceService, LocalUndoRedoService } from '@univerjs/core';
2
+ import { IChangeset, ITransformService } from '@univerjs-pro/collaboration';
3
+ /**
4
+ * `LocalUndoRedoService` cannot transform mutations in the undo redo stack under collaboration conditions.
5
+ */
6
+ export interface ICollaborativeUndoRedoService extends IUndoRedoService {
7
+ transformUndoRedo: (unitID: string, changeset: IChangeset) => void;
8
+ }
9
+ export declare class CollaborativeUndoRedoService extends LocalUndoRedoService implements ICollaborativeUndoRedoService {
10
+ private readonly _transformService;
11
+ private readonly _logService;
12
+ constructor(_currentUniverSheet: IUniverInstanceService, _commandService: ICommandService, _contextService: IContextService, _transformService: ITransformService, _logService: ILogService);
13
+ transformUndoRedo(unitID: string, changesets: IChangeset): void;
14
+ private _clearUndo;
15
+ private _clearRedo;
16
+ private _substituteUndoStack;
17
+ private _substituteRedoStack;
18
+ private _transformStack;
19
+ }
@@ -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 { RxDisposable } from '@univerjs/core';
2
+ import { Observable } from 'rxjs';
3
+ import { IURLService } from './url.service';
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 '../../controllers/collaboration/collaboration-state';
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
+ }