@univerjs/core 0.2.7 → 0.2.9

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 (112) hide show
  1. package/lib/cjs/index.js +8 -8
  2. package/lib/es/index.js +987 -185
  3. package/lib/types/common/equal.d.ts +15 -4
  4. package/lib/types/common/interceptor.d.ts +1 -2
  5. package/lib/types/{types/interfaces/i-freeze.d.ts → common/mixin.d.ts} +9 -5
  6. package/lib/types/common/unit.d.ts +2 -2
  7. package/lib/types/docs/data-model/document-data-model.d.ts +2 -4
  8. package/lib/types/docs/data-model/empty-snapshot.d.ts +0 -1
  9. package/lib/types/docs/data-model/json-x/json-x.d.ts +0 -1
  10. package/lib/types/docs/data-model/preset-list-type.d.ts +0 -1
  11. package/lib/types/docs/data-model/replacement.d.ts +0 -1
  12. package/lib/types/docs/data-model/text-x/action-iterator.d.ts +0 -1
  13. package/lib/types/docs/data-model/text-x/action-types.d.ts +0 -1
  14. package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +0 -1
  15. package/lib/types/docs/data-model/text-x/apply-utils/delete-apply.d.ts +0 -1
  16. package/lib/types/docs/data-model/text-x/apply-utils/insert-apply.d.ts +0 -1
  17. package/lib/types/docs/data-model/text-x/apply-utils/update-apply.d.ts +0 -1
  18. package/lib/types/docs/data-model/text-x/apply.d.ts +0 -1
  19. package/lib/types/docs/data-model/text-x/text-x.d.ts +0 -1
  20. package/lib/types/docs/data-model/text-x/transform-utils.d.ts +0 -1
  21. package/lib/types/docs/data-model/text-x/utils.d.ts +0 -1
  22. package/lib/types/index.d.ts +5 -2
  23. package/lib/types/observer/observable.d.ts +0 -1
  24. package/lib/types/services/__tests__/index.d.ts +0 -1
  25. package/lib/types/services/authz-io/authz-io-local.service.d.ts +2 -3
  26. package/lib/types/services/authz-io/type.d.ts +0 -1
  27. package/lib/types/services/command/command.service.d.ts +0 -1
  28. package/lib/types/services/config/config.service.d.ts +0 -1
  29. package/lib/types/services/context/context.service.d.ts +0 -1
  30. package/lib/types/services/error/error.service.d.ts +0 -1
  31. package/lib/types/services/instance/instance.service.d.ts +0 -1
  32. package/lib/types/services/lifecycle/lifecycle.d.ts +5 -1
  33. package/lib/types/services/lifecycle/lifecycle.service.d.ts +0 -1
  34. package/lib/types/services/locale/locale.service.d.ts +0 -1
  35. package/lib/types/services/log/log.service.d.ts +0 -1
  36. package/lib/types/services/permission/permission.service.d.ts +0 -1
  37. package/lib/types/services/permission/type.d.ts +2 -3
  38. package/lib/types/services/plugin/plugin-override.d.ts +0 -1
  39. package/lib/types/services/plugin/plugin.d.ts +0 -1
  40. package/lib/types/services/plugin/plugin.service.d.ts +0 -1
  41. package/lib/types/services/resource-loader/resource-loader.service.d.ts +3 -6
  42. package/lib/types/services/resource-loader/type.d.ts +4 -7
  43. package/lib/types/services/resource-manager/resource-manager.service.d.ts +4 -5
  44. package/lib/types/services/resource-manager/type.d.ts +9 -6
  45. package/lib/types/services/snapshot/__tests__/snapshot-mock.d.ts +1 -2
  46. package/lib/types/services/snapshot/snapshot-server.service.d.ts +0 -1
  47. package/lib/types/services/snapshot/snapshot-transform.d.ts +1 -2
  48. package/lib/types/services/snapshot/snapshot-utils.d.ts +1 -4
  49. package/lib/types/services/theme/theme.service.d.ts +0 -1
  50. package/lib/types/services/undoredo/undoredo.service.d.ts +1 -2
  51. package/lib/types/services/user-manager/const.d.ts +0 -1
  52. package/lib/types/shared/after-init-apply.d.ts +0 -1
  53. package/lib/types/shared/check-if-move.d.ts +1 -2
  54. package/lib/types/shared/clipboard.d.ts +0 -1
  55. package/lib/types/shared/color/color.d.ts +1 -2
  56. package/lib/types/shared/common.d.ts +2 -5
  57. package/lib/types/shared/compare.d.ts +0 -1
  58. package/lib/types/shared/doc-tool.d.ts +0 -1
  59. package/lib/types/shared/index.d.ts +1 -0
  60. package/lib/types/shared/lifecycle.d.ts +0 -1
  61. package/lib/types/shared/lru/lru-map.d.ts +0 -1
  62. package/lib/types/shared/numfmt.d.ts +2 -0
  63. package/lib/types/shared/object-matrix-query.d.ts +1 -2
  64. package/lib/types/shared/object-matrix.d.ts +7 -2
  65. package/lib/types/shared/range.d.ts +1 -2
  66. package/lib/types/shared/rectangle.d.ts +1 -2
  67. package/lib/types/shared/rxjs.d.ts +0 -1
  68. package/lib/types/shared/tools.d.ts +1 -3
  69. package/lib/types/shared/types.d.ts +4 -13
  70. package/lib/types/{types/interfaces/i-service-data.d.ts → sheets/__tests__/cell-data.spec.d.ts} +1 -2
  71. package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +1 -2
  72. package/lib/types/sheets/column-manager.d.ts +2 -3
  73. package/lib/types/sheets/empty-snapshot.d.ts +1 -2
  74. package/lib/types/sheets/range.d.ts +2 -2
  75. package/lib/types/sheets/row-manager.d.ts +1 -2
  76. package/lib/types/sheets/sheet-snapshot-utils.d.ts +1 -2
  77. package/lib/types/sheets/styles.d.ts +2 -2
  78. package/lib/types/sheets/typedef.d.ts +451 -0
  79. package/lib/types/sheets/util.d.ts +3 -0
  80. package/lib/types/sheets/view-model.d.ts +2 -3
  81. package/lib/types/sheets/workbook.d.ts +13 -5
  82. package/lib/types/sheets/worksheet.d.ts +11 -2
  83. package/lib/types/slides/slide-model.d.ts +0 -2
  84. package/lib/types/types/const/const.d.ts +1 -1
  85. package/lib/types/types/enum/locale-type.d.ts +3 -1
  86. package/lib/types/types/enum/text-style.d.ts +1 -1
  87. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +2 -3
  88. package/lib/types/types/interfaces/i-cell-validation-data.d.ts +0 -1
  89. package/lib/types/types/interfaces/i-data-validation.d.ts +1 -2
  90. package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +0 -1
  91. package/lib/types/types/interfaces/i-document-data.d.ts +2 -5
  92. package/lib/types/types/interfaces/i-placeholder.d.ts +0 -1
  93. package/lib/types/types/interfaces/i-shape-properties.d.ts +0 -1
  94. package/lib/types/types/interfaces/i-slide-data.d.ts +5 -4
  95. package/lib/types/types/interfaces/i-style-data.d.ts +0 -1
  96. package/lib/types/types/interfaces/index.d.ts +0 -11
  97. package/lib/types/univer.d.ts +14 -3
  98. package/lib/umd/index.js +8 -8
  99. package/package.json +7 -6
  100. package/lib/types/common/type-util.d.ts +0 -16
  101. package/lib/types/common/type-utils.d.ts +0 -16
  102. package/lib/types/types/interfaces/i-cell-data.d.ts +0 -67
  103. package/lib/types/types/interfaces/i-column-data.d.ts +0 -15
  104. package/lib/types/types/interfaces/i-extra-model-data.d.ts +0 -27
  105. package/lib/types/types/interfaces/i-range.d.ts +0 -208
  106. package/lib/types/types/interfaces/i-row-data.d.ts +0 -27
  107. package/lib/types/types/interfaces/i-selection-data.d.ts +0 -59
  108. package/lib/types/types/interfaces/i-univer-data.d.ts +0 -14
  109. package/lib/types/types/interfaces/i-workbook-data.d.ts +0 -40
  110. package/lib/types/types/interfaces/i-worksheet-data.d.ts +0 -55
  111. package/lib/types/types/interfaces/i-worksheet-order-data.d.ts +0 -17
  112. /package/lib/types/{types/interfaces/__tests__/i-cell-data.spec.d.ts → services/__tests__/resources.spec.d.ts} +0 -0
@@ -1,5 +1,3 @@
1
- import { IRange, IUnitRange } from '../types/interfaces';
2
-
3
1
  /**
4
2
  * Copyright 2023-present DreamNum Inc.
5
3
  *
@@ -15,6 +13,19 @@ import { IRange, IUnitRange } from '../types/interfaces';
15
13
  * See the License for the specific language governing permissions and
16
14
  * limitations under the License.
17
15
  */
18
- export declare const isRangesEqual: (oldRanges: IRange[], ranges: IRange[]) => boolean;
19
- export declare const isUnitRangesEqual: (oldRanges: IUnitRange[], ranges: IUnitRange[]) => boolean;
16
+ /**
17
+ * Copyright 2023-present DreamNum Inc.
18
+ *
19
+ * Licensed under the Apache License, Version 2.0 (the "License");
20
+ * you may not use this file except in compliance with the License.
21
+ * You may obtain a copy of the License at
22
+ *
23
+ * http://www.apache.org/licenses/LICENSE-2.0
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */
20
31
  export declare function shallowEqual(objA: any, objB: any): boolean;
@@ -1,5 +1,4 @@
1
- import { Nullable } from './type-util';
2
-
1
+ import { Nullable } from '../shared/types';
3
2
  export type InterceptorHandler<M = unknown, C = unknown> = (value: Nullable<M>, context: C, next: (value: Nullable<M>) => Nullable<M>) => Nullable<M>;
4
3
  export interface IInterceptor<M, C> {
5
4
  priority?: number;
@@ -13,9 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export interface IFreeze {
17
- xSplit: number;
18
- ySplit: number;
19
- startRow: number;
20
- startColumn: number;
16
+ interface IMixinProperty<T> {
17
+ [fnName: string]: (this: T, ...args: any[]) => any;
21
18
  }
19
+ /**
20
+ * Mixin some methods to targetObject as prototype, the static methods will not be mixed in
21
+ * @param {T} targetClassPrototype The target class to mixin
22
+ * @param {IMixinProperty<T>} mixin The mixin object which contains the methods to mixin.
23
+ */
24
+ export declare function mixinClass<T>(targetClassPrototype: T, mixin: IMixinProperty<T>): void;
25
+ export {};
@@ -1,12 +1,12 @@
1
1
  import { UniverType } from '@univerjs/protocol';
2
2
  import { Observable } from 'rxjs';
3
3
  import { Disposable } from '../shared';
4
-
5
4
  export { UniverType as UniverInstanceType } from '@univerjs/protocol';
6
5
  export type UnitType = UniverType | number;
7
- export declare abstract class UnitModel<_D = object, T extends UnitType = UnitType> extends Disposable {
6
+ export declare abstract class UnitModel<D = object, T extends UnitType = UnitType> extends Disposable {
8
7
  abstract readonly type: T;
9
8
  abstract getUnitId(): string;
10
9
  abstract name$: Observable<string>;
11
10
  abstract setName(name: string): void;
11
+ abstract getSnapshot(): D;
12
12
  }
@@ -1,11 +1,10 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
2
  import { Nullable } from '../../shared';
3
- import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle, IDrawings } from '../../types/interfaces/i-document-data';
3
+ import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle, IDrawings, IListData } from '../../types/interfaces/i-document-data';
4
4
  import { IPaddingData } from '../../types/interfaces/i-style-data';
5
5
  import { UnitModel, UniverInstanceType } from '../../common/unit';
6
6
  import { SliceBodyType } from './text-x/utils';
7
7
  import { JSONXActions } from './json-x/json-x';
8
-
9
8
  export declare const DEFAULT_DOC: {
10
9
  id: string;
11
10
  documentStyle: {};
@@ -30,9 +29,8 @@ declare class DocumentDataModelSimple extends UnitModel<IDocumentData, UniverIns
30
29
  get zoomRatio(): number;
31
30
  resetDrawing(drawings: IDrawings, drawingsOrder: string[]): void;
32
31
  getBody(): IDocumentBody | undefined;
33
- getShouldRenderLoopImmediately(): boolean;
34
- getContainer(): string | undefined;
35
32
  getSnapshot(): IDocumentData;
33
+ getBulletPresetList(): Record<string, IListData>;
36
34
  updateDocumentId(unitId: string): void;
37
35
  updateDocumentRenderConfig(config: IDocumentRenderConfig): void;
38
36
  updateDocumentStyle(config: IDocumentStyle): void;
@@ -1,4 +1,3 @@
1
1
  import { LocaleType } from '../../types/enum/locale-type';
2
2
  import { IDocumentData } from '../../types/interfaces';
3
-
4
3
  export declare function getEmptySnapshot(unitID?: string, locale?: LocaleType, title?: string): IDocumentData;
@@ -2,7 +2,6 @@ import { Doc, JSONOp, Path } from 'ot-json1';
2
2
  import { IDocumentBody, IDocumentData } from '../../../types/interfaces';
3
3
  import { TPriority } from '../text-x/text-x';
4
4
  import { TextXAction } from '../text-x/action-types';
5
-
6
5
  import * as json1 from 'ot-json1';
7
6
  export interface ISubType {
8
7
  name: string;
@@ -1,5 +1,4 @@
1
1
  import { IListData } from '../../types/interfaces/i-document-data';
2
-
3
2
  export declare enum QuickListType {
4
3
  ORDER_LIST_QUICK_1 = "1.",
5
4
  ORDER_LIST_QUICK_2 = "a)",
@@ -1,3 +1,2 @@
1
1
  import { IDocumentBody } from '../../types/interfaces/i-document-data';
2
-
3
2
  export declare function replaceInDocumentBody(body: IDocumentBody, query: string, target: string): IDocumentBody;
@@ -1,5 +1,4 @@
1
1
  import { TextXAction, TextXActionType } from './action-types';
2
-
3
2
  export declare class ActionIterator {
4
3
  private _actions;
5
4
  private _index;
@@ -1,6 +1,5 @@
1
1
  import { UpdateDocsAttributeType } from '../../../shared/command-enum';
2
2
  import { IDocumentBody } from '../../../types/interfaces/i-document-data';
3
-
4
3
  export declare enum TextXActionType {
5
4
  RETAIN = "r",
6
5
  INSERT = "i",
@@ -1,5 +1,4 @@
1
1
  import { ICustomBlock, ICustomDecoration, ICustomRange, ICustomTable, IDocumentBody, IParagraph, ISectionBreak, ITextRun } from '../../../../types/interfaces';
2
-
3
2
  export declare function normalizeTextRuns(textRuns: ITextRun[]): ITextRun[];
4
3
  /**
5
4
  * Inserting styled text content into the current document model.
@@ -1,3 +1,2 @@
1
1
  import { IDocumentBody } from '../../../../types/interfaces';
2
-
3
2
  export declare function updateAttributeByDelete(body: IDocumentBody, textLength: number, currentIndex: number): IDocumentBody;
@@ -1,3 +1,2 @@
1
1
  import { IDocumentBody } from '../../../../types/interfaces';
2
-
3
2
  export declare function updateAttributeByInsert(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
@@ -1,5 +1,4 @@
1
1
  import { UpdateDocsAttributeType } from '../../../../shared';
2
2
  import { IDocumentBody, ITextRun } from '../../../../types/interfaces';
3
-
4
3
  export declare function updateAttribute(body: IDocumentBody, updateBody: IDocumentBody, textLength: number, currentIndex: number, coverType: UpdateDocsAttributeType): IDocumentBody;
5
4
  export declare function coverTextRuns(updateDataTextRuns: ITextRun[], removeTextRuns: ITextRun[], coverType: UpdateDocsAttributeType): ITextRun[];
@@ -1,4 +1,3 @@
1
1
  import { IDocumentBody } from '../../../types/interfaces';
2
2
  import { TextXAction } from './action-types';
3
-
4
3
  export declare function textXApply(doc: IDocumentBody, actions: TextXAction[]): IDocumentBody;
@@ -1,7 +1,6 @@
1
1
  import { UpdateDocsAttributeType } from '../../../shared/command-enum';
2
2
  import { IDocumentBody } from '../../../types/interfaces/i-document-data';
3
3
  import { TextXAction } from './action-types';
4
-
5
4
  export type TPriority = 'left' | 'right';
6
5
  export declare class TextX {
7
6
  static id: string;
@@ -1,3 +1,2 @@
1
1
  import { IDocumentBody, IRetainAction } from '@univerjs/core';
2
-
3
2
  export declare function transformBody(thisAction: IRetainAction, otherAction: IRetainAction, priority?: boolean): IDocumentBody;
@@ -1,7 +1,6 @@
1
1
  import { UpdateDocsAttributeType } from '../../../shared/command-enum';
2
2
  import { ICustomDecoration, IDocumentBody } from '../../../types/interfaces/i-document-data';
3
3
  import { IRetainAction } from './action-types';
4
-
5
4
  export declare enum SliceBodyType {
6
5
  copy = 0,
7
6
  cut = 1
@@ -19,7 +19,7 @@ export { type UnitType, UnitModel, UniverInstanceType } from './common/unit';
19
19
  export { Registry, RegistryAsMap } from './common/registry';
20
20
  export { CustomCommandExecutionError } from './common/error';
21
21
  export { Univer } from './univer';
22
- export { shallowEqual, isRangesEqual, isUnitRangesEqual } from './common/equal';
22
+ export { shallowEqual } from './common/equal';
23
23
  export { isNumeric, isSafeNumeric } from './common/number';
24
24
  export { isBooleanString } from './common/boolean';
25
25
  export { dedupe, remove, rotate, groupBy, makeArray } from './common/array';
@@ -76,10 +76,12 @@ export * from './types/interfaces';
76
76
  export { UniverInstanceService } from './services/instance/instance.service';
77
77
  export { LifecycleInitializerService } from './services/lifecycle/lifecycle.service';
78
78
  export { ConfigService } from './services/config/config.service';
79
+ export { isRangesEqual, isUnitRangesEqual } from './sheets/util';
79
80
  export { Range } from './sheets/range';
80
81
  export { Styles } from './sheets/styles';
81
82
  export { DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, mergeWorksheetSnapshotWithDefault, } from './sheets/sheet-snapshot-utils';
82
83
  export { SheetViewModel } from './sheets/view-model';
84
+ export * from './sheets/typedef';
83
85
  export { getWorksheetUID, Workbook } from './sheets/workbook';
84
86
  export { Worksheet, extractPureTextFromCell } from './sheets/worksheet';
85
87
  export { SlideDataModel } from './slides/slide-model';
@@ -102,7 +104,7 @@ export { DataValidationImeMode } from './types/enum/data-validation-ime-mode';
102
104
  export { DataValidationOperator } from './types/enum/data-validation-operator';
103
105
  export { DataValidationType } from './types/enum/data-validation-type';
104
106
  export { DataValidationStatus } from './types/enum/data-validation-status';
105
- export type { IPermissionTypes, WorkbookPermissionPointConstructor } from './services/permission/type';
107
+ export type { IPermissionTypes, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor, RangePermissionPointConstructor } from './services/permission/type';
106
108
  export { PermissionService } from './services/permission/permission.service';
107
109
  export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
108
110
  export { IAuthzIoService } from './services/authz-io/type';
@@ -112,4 +114,5 @@ export { normalizeBody, getCustomRangeSlice, getCustomDecorationSlice } from './
112
114
  export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/delete-apply';
113
115
  export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
114
116
  export { nameCharacterCheck } from './shared/name';
117
+ export { mixinClass } from './common/mixin';
115
118
  export * from './common/di';
@@ -1,5 +1,4 @@
1
1
  import { Observer as RxObserver, Subscription, Observable, Subject } from 'rxjs';
2
-
3
2
  /**
4
3
  * A class serves as a medium between the observable and its observers
5
4
  */
@@ -1,6 +1,5 @@
1
1
  import { ICommandService, Univer } from '@univerjs/core';
2
2
  import { Dependency } from '../../common/di';
3
-
4
3
  export declare const createTestBed: (dependencies?: Dependency[]) => {
5
4
  univer: Univer;
6
5
  get: {
@@ -2,7 +2,6 @@ import { IActionInfo, IAllowedRequest, IBatchAllowedResponse, ICollaborator, ICr
2
2
  import { IResourceManagerService } from '../resource-manager/type';
3
3
  import { UserManagerService } from '../user-manager/user-manager.service';
4
4
  import { IAuthzIoService } from './type';
5
-
6
5
  /**
7
6
  * Do not use the mock implementation in a production environment as it is a minimal version.
8
7
  */
@@ -15,8 +14,8 @@ export declare class AuthzIoLocalService implements IAuthzIoService {
15
14
  private _getRole;
16
15
  private _initSnapshot;
17
16
  create(config: ICreateRequest): Promise<string>;
18
- allowed(config: IAllowedRequest): Promise<IActionInfo[]>;
19
- batchAllowed(config: IAllowedRequest[]): Promise<IBatchAllowedResponse['objectActions']>;
17
+ allowed(_config: IAllowedRequest): Promise<IActionInfo[]>;
18
+ batchAllowed(_config: IAllowedRequest[]): Promise<IBatchAllowedResponse['objectActions']>;
20
19
  list(config: IListPermPointRequest): Promise<IPermissionPoint[]>;
21
20
  listCollaborators(): Promise<ICollaborator[]>;
22
21
  listRoles(): Promise<{
@@ -1,6 +1,5 @@
1
1
  import { ILogContext } from '@univerjs/core';
2
2
  import { IAllowedRequest, IAllowedResponse, IBatchAllowedResponse, ICreateCollaboratorRequest, ICreateRequest, ICreateResponse, IDeleteCollaboratorRequest, IListCollaboratorRequest, IListCollaboratorResponse, IListPermPointRequest, IListPermPointResponse, IListRolesRequest, IListRolesResponse, IPutCollaboratorsRequest, IUpdateCollaboratorRequest, IUpdatePermPointRequest } from '@univerjs/protocol';
3
-
4
3
  export interface IAuthzIoService {
5
4
  create(config: ICreateRequest, context?: ILogContext): Promise<ICreateResponse['objectID']>;
6
5
  allowed(config: IAllowedRequest, context?: ILogContext): Promise<IAllowedResponse['actions']>;
@@ -2,7 +2,6 @@ import { IAccessor, IDisposable, Injector } from '../../common/di';
2
2
  import { Disposable } from '../../shared/lifecycle';
3
3
  import { IContextService } from '../context/context.service';
4
4
  import { ILogService } from '../log/log.service';
5
-
6
5
  export declare enum CommandType {
7
6
  /** Command could generate some operations or mutations. */
8
7
  COMMAND = 0,
@@ -1,5 +1,4 @@
1
1
  import { Nullable } from '../../shared/types';
2
-
3
2
  /**
4
3
  * IConfig provides universal configuration for the whole application.
5
4
  */
@@ -1,6 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { Disposable } from '../../shared/lifecycle';
3
-
4
3
  export interface IContextService {
5
4
  readonly contextChanged$: Observable<{
6
5
  [key: string]: boolean;
@@ -1,5 +1,4 @@
1
1
  import { Disposable } from '../../shared/lifecycle';
2
-
3
2
  export interface IError {
4
3
  errorKey: string;
5
4
  }
@@ -6,7 +6,6 @@ import { Disposable } from '../../shared/lifecycle';
6
6
  import { Workbook } from '../../sheets/workbook';
7
7
  import { IContextService } from '../context/context.service';
8
8
  import { UnitModel, UnitType, UniverInstanceType } from '../../common/unit';
9
-
10
9
  export type UnitCtor = new (...args: any[]) => UnitModel;
11
10
  export interface ICreateUnitOptions {
12
11
  /**
@@ -1,5 +1,4 @@
1
1
  import { Ctor, DependencyIdentifier } from '../../common/di';
2
-
3
2
  /**
4
3
  * This enum defines multiple lifecycle stages in Univer SDK.
5
4
  */
@@ -36,6 +35,8 @@ export declare const LifecycleToModules: Map<LifecycleStages, DependencyIdentifi
36
35
  * @param identifier The dependency identifier of the class. Usually, it is the class itself unless you bind this class
37
36
  * with another injection identifier.
38
37
  *
38
+ * @deprecated This API does not work as expected and will be removed in future versions. Please call
39
+ * `this._injector.get(YourDependency)` in plugins' lifecycle hooks instead.
39
40
  *
40
41
  * @example
41
42
  * // Ignore the `\` below. This is JSDoc's bug.
@@ -57,6 +58,9 @@ export declare function OnLifecycle(lifecycleStage: LifecycleStages, identifier:
57
58
  * @param identifier The dependencies' identifier. **Beware** that if the dependency (e.g. a class) is bound to an
58
59
  * identifier, you should register the identifier instead of the dependency itself.
59
60
  *
61
+ * @deprecated This API does not work as expected and will be removed in future versions. Please call
62
+ * `this._injector.get(YourDependency)` in plugins' lifecycle hooks instead.
63
+ *
60
64
  * @example
61
65
  * runOnLifecycle(LifecycleStages.Ready, MyService);
62
66
  *
@@ -3,7 +3,6 @@ import { Injector } from '../../common/di';
3
3
  import { Disposable } from '../../shared/lifecycle';
4
4
  import { ILogService } from '../log/log.service';
5
5
  import { LifecycleStages } from './lifecycle';
6
-
7
6
  /**
8
7
  * This service controls the lifecycle of a Univer instance. Other modules can
9
8
  * inject this service to read the current lifecycle stage or subscribe to
@@ -2,7 +2,6 @@ import { Subject } from 'rxjs';
2
2
  import { Disposable } from '../../shared/lifecycle';
3
3
  import { ILanguagePack, ILocales, LanguageValue } from '../../shared/locale';
4
4
  import { LocaleType } from '../../types/enum/locale-type';
5
-
6
5
  /**
7
6
  * This service provides i18n and timezone / location features to other modules.
8
7
  */
@@ -1,5 +1,4 @@
1
1
  import { Disposable } from '../../shared/lifecycle';
2
-
3
2
  export declare enum LogLevel {
4
3
  SILENT = 0,
5
4
  ERROR = 1,
@@ -1,7 +1,6 @@
1
1
  import { Observable, BehaviorSubject } from 'rxjs';
2
2
  import { Disposable } from '../../shared';
3
3
  import { IPermissionPoint, IPermissionService } from './type';
4
-
5
4
  export declare class PermissionService extends Disposable implements IPermissionService {
6
5
  private _permissionPointMap;
7
6
  private _permissionPointUpdate$;
@@ -1,8 +1,7 @@
1
1
  import { BehaviorSubject, Observable } from 'rxjs';
2
2
  import { UnitAction, UnitObject } from '@univerjs/protocol';
3
- import { Nullable } from '../../common/type-utils';
4
- import { IRange } from '../../types/interfaces';
5
-
3
+ import { IRange } from '../../sheets/typedef';
4
+ import { Nullable } from '../../shared/types';
6
5
  export declare enum PermissionStatus {
7
6
  INIT = "init",
8
7
  FETCHING = "fetching",
@@ -1,5 +1,4 @@
1
1
  import { Dependency, DependencyIdentifier, DependencyItem } from '../../common/di';
2
-
3
2
  export type NullableDependencyPair<T> = [DependencyIdentifier<T>, DependencyItem<T> | null];
4
3
  /**
5
4
  * Overrides the dependencies defined in the plugin. Only dependencies that are identified by `IdentifierDecorator` can be overridden.
@@ -1,7 +1,6 @@
1
1
  import { Ctor, Injector } from '../../common/di';
2
2
  import { Disposable } from '../../shared';
3
3
  import { UniverInstanceType } from '../../common/unit';
4
-
5
4
  export declare const DependentOnSymbol: unique symbol;
6
5
  export type PluginCtor<T extends Plugin = Plugin> = Ctor<T> & {
7
6
  type: UniverInstanceType;
@@ -4,7 +4,6 @@ import { UniverInstanceType } from '../../common/unit';
4
4
  import { LifecycleInitializerService, LifecycleService } from '../lifecycle/lifecycle.service';
5
5
  import { ILogService } from '../log/log.service';
6
6
  import { Plugin, PluginCtor, PluginRegistry, PluginStore } from './plugin';
7
-
8
7
  /**
9
8
  * Use this decorator to declare dependencies among plugins. If a dependent plugin is not registered yet,
10
9
  * Univer will automatically register it with no configuration.
@@ -1,16 +1,13 @@
1
- import { Workbook } from '../../sheets/workbook';
2
- import { IWorkbookData } from '../../types/interfaces';
3
1
  import { IResourceManagerService } from '../resource-manager/type';
4
2
  import { IUniverInstanceService } from '../instance/instance.service';
5
3
  import { Disposable } from '../../shared/lifecycle';
6
- import { DocumentDataModel } from '../../docs';
7
4
  import { IResourceLoaderService } from './type';
8
-
9
5
  export declare class ResourceLoaderService extends Disposable implements IResourceLoaderService {
10
6
  private readonly _resourceManagerService;
11
7
  private readonly _univerInstanceService;
12
8
  constructor(_resourceManagerService: IResourceManagerService, _univerInstanceService: IUniverInstanceService);
13
9
  private _init;
14
- saveWorkbook: (workbook: Workbook) => IWorkbookData;
15
- saveDoc(doc: DocumentDataModel): import('../../types/interfaces').IDocumentData;
10
+ saveUnit<T = object>(unitId: string): ({
11
+ resources: import('../resource-manager/type').IResources;
12
+ } & T) | null;
16
13
  }
@@ -1,10 +1,7 @@
1
- import { Workbook } from '../../sheets/workbook';
2
- import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
3
- import { IDocumentData } from '../../types/interfaces';
4
- import { DocumentDataModel } from '../../docs';
5
-
1
+ import { IResources } from '../resource-manager/type';
6
2
  export interface IResourceLoaderService {
7
- saveWorkbook: (workbook: Workbook) => IWorkbookData;
8
- saveDoc: (doc: DocumentDataModel) => IDocumentData;
3
+ saveUnit<T = object>(unitId: string): T & {
4
+ resources: IResources;
5
+ } | null;
9
6
  }
10
7
  export declare const IResourceLoaderService: import('../../common/di').IdentifierDecorator<IResourceLoaderService>;
@@ -1,22 +1,21 @@
1
1
  import { Disposable } from '../../shared/lifecycle';
2
- import { Resources } from '../../types/interfaces/i-workbook-data';
3
2
  import { UniverInstanceType } from '../../common/unit';
3
+ import { IResources } from '../resource-manager/type';
4
4
  import { IResourceHook, IResourceManagerService, IResourceName } from './type';
5
-
6
5
  export declare class ResourceManagerService extends Disposable implements IResourceManagerService {
7
6
  private _resourceMap;
8
7
  private _register$;
9
8
  register$: import('rxjs').Observable<IResourceHook<any>>;
10
9
  getAllResourceHooks(): IResourceHook<any>[];
11
- getResources(unitId: string): Resources;
12
- getResources(unitId: string, type: UniverInstanceType): Resources;
10
+ getResources(unitId: string): IResources;
11
+ getResources(unitId: string, type: UniverInstanceType): IResources;
13
12
  getResourcesByType(unitId: string, type: UniverInstanceType): {
14
13
  name: `SHEET_${string}_PLUGIN` | `DOC_${string}_PLUGIN`;
15
14
  data: string;
16
15
  }[];
17
16
  registerPluginResource<T = unknown>(hook: IResourceHook<T>): import('@wendellhu/redi').IDisposable;
18
17
  disposePluginResource(pluginName: IResourceName): void;
19
- loadResources(unitId: string, resources?: Resources): void;
18
+ loadResources(unitId: string, resources?: IResources): void;
20
19
  unloadResources(unitId: string): void;
21
20
  dispose(): void;
22
21
  }
@@ -1,8 +1,11 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { UniverInstanceType } from '@univerjs/core';
3
3
  import { IDisposable } from '../../common/di';
4
- import { Resources } from '../../types/interfaces/i-workbook-data';
5
-
4
+ export type IResources = Array<{
5
+ id?: string;
6
+ name: string;
7
+ data: string;
8
+ }>;
6
9
  type IBusinessName = 'SHEET' | 'DOC';
7
10
  export type IResourceName = `${IBusinessName}_${string}_PLUGIN`;
8
11
  export interface IResourceHook<T = any> {
@@ -21,10 +24,10 @@ export interface IResourceManagerService {
21
24
  /**
22
25
  * @deprecated You should get resource with type specified.
23
26
  */
24
- getResources(unitId: string): Resources;
25
- getResources(unitId: string, type: UniverInstanceType): Resources;
26
- getResourcesByType: (unitId: string, type: UniverInstanceType) => Resources;
27
- loadResources: (unitId: string, resources?: Resources) => void;
27
+ getResources(unitId: string): IResources;
28
+ getResources(unitId: string, type: UniverInstanceType): IResources;
29
+ getResourcesByType: (unitId: string, type: UniverInstanceType) => IResources;
30
+ loadResources: (unitId: string, resources?: IResources) => void;
28
31
  unloadResources(unitId: string): void;
29
32
  }
30
33
  export declare const IResourceManagerService: import('@univerjs/core').IdentifierDecorator<IResourceManagerService>;
@@ -1,8 +1,7 @@
1
1
  import { IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, ISaveChangesetRequest, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotRequest, ISaveSnapshotResponse, ISheetBlock, ISnapshot } from '@univerjs/protocol';
2
- import { IWorkbookData } from '../../../types/interfaces/i-workbook-data';
3
2
  import { ILogContext } from '../../log/context';
4
3
  import { ISnapshotServerService } from '../snapshot-server.service';
5
-
4
+ import { IWorkbookData } from '../../../sheets/typedef';
6
5
  export declare const testSnapshot: () => ISnapshot;
7
6
  export declare const testSheetBlocks: () => ISheetBlock[];
8
7
  export declare const testWorkbookData: () => IWorkbookData;
@@ -1,6 +1,5 @@
1
1
  import { IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, ISaveChangesetRequest, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotRequest, ISaveSnapshotResponse } from '@univerjs/protocol';
2
2
  import { ILogContext } from '../log/context';
3
-
4
3
  /**
5
4
  * It provides implementations for server side controllers to load or save
6
5
  * or load snapshots. This service should be implemented by the host environment.
@@ -1,9 +1,8 @@
1
1
  import { ISheetBlock, ISnapshot } from '@univerjs/protocol';
2
2
  import { ILogContext } from '../log/context';
3
- import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
4
3
  import { IDocumentData } from '../../types/interfaces/i-document-data';
4
+ import { IWorkbookData } from '../../sheets/typedef';
5
5
  import { ISnapshotServerService } from './snapshot-server.service';
6
-
7
6
  export declare function generateTempDocumentSnapshot(_context: ILogContext, document: IDocumentData, unitID: string, rev: number): Promise<{
8
7
  snapshot: ISnapshot;
9
8
  }>;
@@ -1,10 +1,7 @@
1
1
  import { ISheetBlock } from '@univerjs/protocol';
2
- import { IWorksheetData } from '../../types/interfaces/i-worksheet-data';
3
- import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
4
2
  import { IDocumentData } from '../../types/interfaces/i-document-data';
5
- import { ICellData } from '../../types/interfaces/i-cell-data';
6
3
  import { IObjectMatrixPrimitiveType } from '../../shared/object-matrix';
7
-
4
+ import { ICellData, IWorkbookData, IWorksheetData } from '../../sheets/typedef';
8
5
  export declare const textEncoder: TextEncoder;
9
6
  export declare const textDecoder: TextDecoder;
10
7
  /**
@@ -1,6 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { Disposable } from '../../shared/lifecycle';
3
-
4
3
  export interface IStyleSheet {
5
4
  [key: string]: string;
6
5
  }
@@ -4,8 +4,7 @@ import { Disposable } from '../../shared/lifecycle';
4
4
  import { IMutationInfo, CommandType, ICommandService } from '../command/command.service';
5
5
  import { IContextService } from '../context/context.service';
6
6
  import { IUniverInstanceService } from '../instance/instance.service';
7
- import { Nullable } from '../../common/type-util';
8
-
7
+ import { Nullable } from '../../shared/types';
9
8
  export interface IUndoRedoItem {
10
9
  /** unitID maps to unitId for UniverSheet / UniverDoc / UniverSlide */
11
10
  unitID: string;
@@ -1,4 +1,3 @@
1
1
  import { IUser, UnitRole } from '@univerjs/protocol';
2
-
3
2
  export declare const createDefaultUser: (type?: UnitRole) => IUser;
4
3
  export declare const isDevRole: (userId: string, type: UnitRole) => boolean;
@@ -1,3 +1,2 @@
1
1
  import { ICommandService } from '../services/command/command.service';
2
-
3
2
  export declare const afterInitApply: (commandService: ICommandService) => Promise<void>;
@@ -1,6 +1,5 @@
1
- import { Nullable } from '../common/type-util';
2
1
  import { ITransformState } from '../types/interfaces/i-document-data';
3
-
2
+ import { Nullable } from './types';
4
3
  export declare const MOVE_BUFFER_VALUE = 2;
5
4
  export declare const ROTATE_BUFFER_VALUE = 1;
6
5
  export declare function checkIfMove(transform: Nullable<ITransformState>, previousTransform: Nullable<ITransformState>): boolean;
@@ -1,5 +1,4 @@
1
1
  import { IDocumentBody, ITextRun } from '../types/interfaces';
2
-
3
2
  export declare function getBodySliceHtml(body: IDocumentBody, startIndex: number, endIndex: number): string;
4
3
  export declare function convertBodyToHtml(body: IDocumentBody, withParagraphInfo?: boolean): string;
5
4
  export declare function covertTextRunToHtml(dataStream: string, textRun: ITextRun): string;
@@ -1,6 +1,5 @@
1
- import { Nullable } from '../../common/type-util';
2
1
  import { ColorType, ThemeColors, ThemeColorType } from '../../types/enum';
3
-
2
+ import { Nullable } from '../types';
4
3
  export declare class ColorBuilder {
5
4
  private _themeValue;
6
5
  private _themeColors;