@univerjs/docs 0.2.11 → 0.2.13

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 (58) hide show
  1. package/lib/cjs/index.js +1 -5
  2. package/lib/es/index.js +180 -4376
  3. package/lib/types/commands/mutations/core-editing.mutation.d.ts +1 -1
  4. package/lib/types/{types/enums/delete-direction.d.ts → controllers/config.schema.d.ts} +5 -3
  5. package/lib/types/controllers/custom-range.controller.d.ts +2 -2
  6. package/lib/types/doc-plugin.d.ts +5 -5
  7. package/lib/types/index.d.ts +8 -50
  8. package/lib/types/services/doc-interceptor/doc-interceptor.service.d.ts +1 -1
  9. package/lib/types/services/doc-selection-manager.service.d.ts +56 -0
  10. package/lib/types/services/doc-state-emit.service.d.ts +27 -0
  11. package/lib/umd/index.js +1 -5
  12. package/package.json +10 -9
  13. package/lib/types/basics/__tests__/plain-text.spec.d.ts +0 -16
  14. package/lib/types/basics/component-tools.d.ts +0 -17
  15. package/lib/types/basics/custom-decoration-factory.d.ts +0 -23
  16. package/lib/types/basics/custom-range-factory.d.ts +0 -23
  17. package/lib/types/basics/custom-range.d.ts +0 -5
  18. package/lib/types/basics/docs-view-key.d.ts +0 -30
  19. package/lib/types/basics/paragraph.d.ts +0 -2
  20. package/lib/types/basics/plain-text.d.ts +0 -9
  21. package/lib/types/basics/replace.d.ts +0 -13
  22. package/lib/types/basics/retain-delete-params.d.ts +0 -6
  23. package/lib/types/basics/selection.d.ts +0 -22
  24. package/lib/types/basics/table.d.ts +0 -16
  25. package/lib/types/commands/commands/__tests__/clipboard.command.spec.d.ts +0 -16
  26. package/lib/types/commands/commands/__tests__/core-editing.command.spec.d.ts +0 -16
  27. package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +0 -34
  28. package/lib/types/commands/commands/__tests__/inline-format.command.spec.d.ts +0 -16
  29. package/lib/types/commands/commands/__tests__/mock-text-selection-render-manager.d.ts +0 -9
  30. package/lib/types/commands/commands/__tests__/replace-content.command.spec.d.ts +0 -16
  31. package/lib/types/commands/commands/auto-format.command.d.ts +0 -7
  32. package/lib/types/commands/commands/break-line.command.d.ts +0 -3
  33. package/lib/types/commands/commands/clipboard.inner.command.d.ts +0 -16
  34. package/lib/types/commands/commands/core-editing.command.d.ts +0 -43
  35. package/lib/types/commands/commands/delete.command.d.ts +0 -19
  36. package/lib/types/commands/commands/ime-input.command.d.ts +0 -9
  37. package/lib/types/commands/commands/inline-format.command.d.ts +0 -17
  38. package/lib/types/commands/commands/list.command.d.ts +0 -42
  39. package/lib/types/commands/commands/paragraph-align.command.d.ts +0 -18
  40. package/lib/types/commands/commands/replace-content.command.d.ts +0 -26
  41. package/lib/types/commands/commands/set-doc-zoom-ratio.command.d.ts +0 -6
  42. package/lib/types/commands/commands/table/doc-table-create.command.d.ts +0 -10
  43. package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +0 -10
  44. package/lib/types/commands/commands/table/doc-table-insert.command.d.ts +0 -34
  45. package/lib/types/commands/commands/table/doc-table-tab.command.d.ts +0 -5
  46. package/lib/types/commands/commands/table/table.d.ts +0 -94
  47. package/lib/types/commands/operations/cursor.operation.d.ts +0 -12
  48. package/lib/types/commands/operations/select-all.operation.d.ts +0 -5
  49. package/lib/types/commands/operations/set-doc-zoom-ratio.operation.d.ts +0 -7
  50. package/lib/types/commands/util.d.ts +0 -9
  51. package/lib/types/controllers/ime-input.controller.d.ts +0 -25
  52. package/lib/types/controllers/move-cursor.controller.d.ts +0 -20
  53. package/lib/types/controllers/normal-input.controller.d.ts +0 -13
  54. package/lib/types/services/doc-auto-format.service.d.ts +0 -37
  55. package/lib/types/services/doc-custom-range.service.d.ts +0 -19
  56. package/lib/types/services/doc-state-change-manager.service.d.ts +0 -34
  57. package/lib/types/services/ime-input-manager.service.d.ts +0 -28
  58. package/lib/types/services/text-selection-manager.service.d.ts +0 -55
@@ -1,9 +0,0 @@
1
- import { DocumentDataModel, IAccessor } from '@univerjs/core';
2
- import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';
3
- /**
4
- * Get the skeleton of the command's target.
5
- * @param accessor The injection accessor.
6
- * @param unitId Unit ID.
7
- */
8
- export declare function getCommandSkeleton(accessor: IAccessor, unitId: string): DocSkeletonManagerService | undefined;
9
- export declare function getRichTextEditPath(docDataModel: DocumentDataModel, segmentId?: string): string[];
@@ -1,25 +0,0 @@
1
- import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
- import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
3
- import { IMEInputManagerService } from '../services/ime-input-manager.service';
4
- import { TextSelectionManagerService } from '../services/text-selection-manager.service';
5
- export declare class IMEInputController extends Disposable {
6
- private readonly _univerInstanceService;
7
- private readonly _renderManagerSrv;
8
- private readonly _textSelectionRenderManager;
9
- private readonly _textSelectionManagerService;
10
- private readonly _imeInputManagerService;
11
- private readonly _commandService;
12
- private _previousIMEContent;
13
- private _isCompositionStart;
14
- private _onStartSubscription;
15
- private _onUpdateSubscription;
16
- private _onEndSubscription;
17
- constructor(_univerInstanceService: IUniverInstanceService, _renderManagerSrv: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _textSelectionManagerService: TextSelectionManagerService, _imeInputManagerService: IMEInputManagerService, _commandService: ICommandService);
18
- dispose(): void;
19
- private _initialize;
20
- private _initialOnCompositionstart;
21
- private _initialOnCompositionUpdate;
22
- private _initialOnCompositionend;
23
- private _updateContent;
24
- private _resetIME;
25
- }
@@ -1,20 +0,0 @@
1
- import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
- import { IRenderManagerService } from '@univerjs/engine-render';
3
- import { TextSelectionManagerService } from '../services/text-selection-manager.service';
4
- export declare class MoveCursorController extends Disposable {
5
- private readonly _univerInstanceService;
6
- private readonly _renderManagerService;
7
- private readonly _textSelectionManagerService;
8
- private readonly _commandService;
9
- private _onInputSubscription;
10
- constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _textSelectionManagerService: TextSelectionManagerService, _commandService: ICommandService);
11
- dispose(): void;
12
- private _commandExecutedListener;
13
- private _handleShiftMoveSelection;
14
- private _handleMoveCursor;
15
- private _getTopOrBottomPosition;
16
- private _getGlyphLeftOffsetInLine;
17
- private _matchPositionByLeftOffset;
18
- private _getNextOrPrevLine;
19
- private _getDocObject;
20
- }
@@ -1,13 +0,0 @@
1
- import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
- import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
3
- export declare class NormalInputController extends Disposable {
4
- private readonly _univerInstanceService;
5
- private readonly _renderManagerService;
6
- private readonly _textSelectionRenderManager;
7
- private readonly _commandService;
8
- private _onInputSubscription;
9
- constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _commandService: ICommandService);
10
- dispose(): void;
11
- private _init;
12
- private _initialNormalInput;
13
- }
@@ -1,37 +0,0 @@
1
- import { DocumentDataModel, ICommandInfo, ICustomRange, IDisposable, IParagraphRange, Nullable, Disposable, IUniverInstanceService } from '@univerjs/core';
2
- import { ITextActiveRange, TextSelectionManagerService } from './text-selection-manager.service';
3
- export interface IAutoFormatContext {
4
- unit: DocumentDataModel;
5
- selection: ITextActiveRange;
6
- /**
7
- * is selection at doc body
8
- */
9
- isBody: boolean;
10
- /**
11
- * selection relative paragraphs
12
- */
13
- paragraphs: IParagraphRange[];
14
- /**
15
- * selection relative custom ranges
16
- */
17
- customRanges: ICustomRange[];
18
- commandId: string;
19
- commandParams: Nullable<object>;
20
- }
21
- export interface IAutoFormat {
22
- id: string;
23
- match: (context: IAutoFormatContext) => boolean;
24
- getMutations: (context: IAutoFormatContext) => ICommandInfo[];
25
- priority?: number;
26
- }
27
- /**
28
- * service for auto-formatting, handle shortcut like `Space` or `Tab`.
29
- */
30
- export declare class DocAutoFormatService extends Disposable {
31
- private readonly _univerInstanceService;
32
- private readonly _textSelectionManagerService;
33
- private _matches;
34
- constructor(_univerInstanceService: IUniverInstanceService, _textSelectionManagerService: TextSelectionManagerService);
35
- registerAutoFormat(match: IAutoFormat): IDisposable;
36
- onAutoFormat(id: string, params: Nullable<object>): ICommandInfo[];
37
- }
@@ -1,19 +0,0 @@
1
- import { ICustomRange, IDisposable } from '@univerjs/core';
2
- export interface ICustomRangeData extends ICustomRange {
3
- data?: string;
4
- }
5
- export interface ICustomRangeHook {
6
- onCopyCustomRange?: (unitId: string, range: ICustomRangeData) => ICustomRange;
7
- }
8
- export declare class DocCustomRangeService {
9
- private _customRangeHooks;
10
- addClipboardHook(hook: ICustomRangeHook): IDisposable;
11
- copyCustomRange(unitId: string, range: ICustomRangeData): {
12
- data?: string;
13
- startIndex: number;
14
- endIndex: number;
15
- rangeId: string;
16
- rangeType: import('@univerjs/core').CustomRangeType;
17
- wholeEntity?: boolean;
18
- };
19
- }
@@ -1,34 +0,0 @@
1
- import { JSONXActions, Nullable, ICommandService, IUndoRedoService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
- import { ITextRangeWithStyle } from '@univerjs/engine-render';
3
- interface IDocChangeState {
4
- actions: JSONXActions;
5
- textRanges: Nullable<ITextRangeWithStyle[]>;
6
- }
7
- export interface IDocStateChangeParams {
8
- commandId: string;
9
- unitId: string;
10
- trigger: Nullable<string>;
11
- redoState: IDocChangeState;
12
- undoState: IDocChangeState;
13
- segmentId?: string;
14
- noHistory?: boolean;
15
- debounce?: boolean;
16
- }
17
- export declare class DocStateChangeManagerService extends RxDisposable {
18
- private _undoRedoService;
19
- private readonly _commandService;
20
- private readonly _univerInstanceService;
21
- private readonly _docStateChange$;
22
- readonly docStateChange$: import('rxjs').Observable<Nullable<IDocStateChangeParams>>;
23
- private _historyStateCache;
24
- private _changeStateCache;
25
- private _historyTimer;
26
- private _changeStateCacheTimer;
27
- constructor(_undoRedoService: IUndoRedoService, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService);
28
- setChangeState(changeState: IDocStateChangeParams): void;
29
- private _initialize;
30
- private _cacheChangeState;
31
- private _pushHistory;
32
- private _emitChangeState;
33
- }
34
- export {};
@@ -1,28 +0,0 @@
1
- import { IDisposable, Nullable } from '@univerjs/core';
2
- import { ITextRangeWithStyle } from '@univerjs/engine-render';
3
- import { IRichTextEditingMutationParams } from '../commands/mutations/core-editing.mutation';
4
- interface ICacheParams {
5
- undoCache: IRichTextEditingMutationParams[];
6
- redoCache: IRichTextEditingMutationParams[];
7
- }
8
- export declare class IMEInputManagerService implements IDisposable {
9
- private _previousActiveRange;
10
- private _undoMutationParamsCache;
11
- private _redoMutationParamsCache;
12
- clearUndoRedoMutationParamsCache(): void;
13
- getUndoRedoMutationParamsCache(): {
14
- undoCache: IRichTextEditingMutationParams[];
15
- redoCache: IRichTextEditingMutationParams[];
16
- };
17
- setUndoRedoMutationParamsCache({ undoCache, redoCache }: ICacheParams): void;
18
- getActiveRange(): Nullable<ITextRangeWithStyle>;
19
- setActiveRange(range: Nullable<ITextRangeWithStyle>): void;
20
- pushUndoRedoMutationParams(undoParams: IRichTextEditingMutationParams, redoParams: IRichTextEditingMutationParams): void;
21
- fetchComposedUndoRedoMutationParams(): {
22
- redoMutationParams: IRichTextEditingMutationParams;
23
- undoMutationParams: IRichTextEditingMutationParams;
24
- previousActiveRange: ITextRangeWithStyle;
25
- } | null;
26
- dispose(): void;
27
- }
28
- export {};
@@ -1,55 +0,0 @@
1
- import { Nullable, ICommandService, RxDisposable } from '@univerjs/core';
2
- import { IDocRange, INodePosition, ISuccinctDocRangeParam, ITextRangeWithStyle, ITextSelectionInnerParam, ITextSelectionStyle, RANGE_DIRECTION, RectRange, TextRange, ITextSelectionRenderManager } from '@univerjs/engine-render';
3
- interface IDocSelectionManagerSearchParam {
4
- unitId: string;
5
- subUnitId: string;
6
- }
7
- export interface ITextActiveRange {
8
- startOffset: number;
9
- endOffset: number;
10
- collapsed: boolean;
11
- startNodePosition: Nullable<INodePosition>;
12
- endNodePosition: Nullable<INodePosition>;
13
- direction: RANGE_DIRECTION;
14
- segmentId: string;
15
- style: ITextSelectionStyle;
16
- segmentPage: number;
17
- }
18
- interface ITextSelectionManagerInsertParam extends IDocSelectionManagerSearchParam, ITextSelectionInnerParam {
19
- }
20
- export declare function serializeDocRange(textRange: IDocRange): ITextRangeWithStyle;
21
- /**
22
- * This service is for text selection.
23
- */
24
- export declare class TextSelectionManagerService extends RxDisposable {
25
- private _textSelectionRenderManager;
26
- private readonly _commandService;
27
- private _currentSelection;
28
- private readonly _textSelectionInfo;
29
- private readonly _textSelection$;
30
- readonly textSelection$: import('rxjs').Observable<Nullable<ITextSelectionManagerInsertParam>>;
31
- constructor(_textSelectionRenderManager: ITextSelectionRenderManager, _commandService: ICommandService);
32
- getCurrentSelection(): Nullable<IDocSelectionManagerSearchParam>;
33
- getCurrentSelectionInfo(): ITextSelectionInnerParam | undefined;
34
- dispose(): void;
35
- refreshSelection(): void;
36
- setCurrentSelection(param: IDocSelectionManagerSearchParam): void;
37
- setCurrentSelectionNotRefresh(param: IDocSelectionManagerSearchParam): void;
38
- getCurrentTextRanges(): Readonly<Nullable<TextRange[]>>;
39
- getCurrentRectRanges(): Readonly<Nullable<RectRange[]>>;
40
- getDocRanges(): (TextRange | RectRange)[];
41
- getActiveTextRange(): Nullable<TextRange>;
42
- getActiveRectRange(): Nullable<RectRange>;
43
- getActiveTextRangeWithStyle(): Nullable<ITextActiveRange>;
44
- add(textRanges: ISuccinctDocRangeParam[], isEditing?: boolean): void;
45
- replaceTextRanges(docRanges: ISuccinctDocRangeParam[], isEditing?: boolean, options?: {
46
- [key: string]: boolean;
47
- }): void;
48
- private _syncSelectionFromRenderService;
49
- private _replaceTextRangesWithNoRefresh;
50
- private _getTextRanges;
51
- private _refresh;
52
- private _replaceByParam;
53
- private _addByParam;
54
- }
55
- export {};