@univerjs/core 0.5.3 → 0.5.4

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 (30) hide show
  1. package/lib/cjs/index.js +9 -8
  2. package/lib/es/index.js +10234 -7967
  3. package/lib/types/common/error.d.ts +3 -0
  4. package/lib/types/docs/data-model/rich-text-builder.d.ts +1340 -0
  5. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +2 -1
  6. package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +2 -2
  7. package/lib/types/facade/f-blob.d.ts +12 -12
  8. package/lib/types/facade/f-doc.d.ts +7 -0
  9. package/lib/types/facade/f-enum.d.ts +51 -0
  10. package/lib/types/facade/f-event.d.ts +168 -13
  11. package/lib/types/facade/f-univer.d.ts +95 -20
  12. package/lib/types/facade/f-usermanager.d.ts +4 -3
  13. package/lib/types/facade/f-util.d.ts +16 -23
  14. package/lib/types/index.d.ts +3 -1
  15. package/lib/types/services/image-io/image-io.service.d.ts +12 -0
  16. package/lib/types/shared/check-if-move.d.ts +1 -1
  17. package/lib/types/shared/rectangle.d.ts +267 -12
  18. package/lib/types/sheets/column-manager.d.ts +3 -1
  19. package/lib/types/sheets/row-manager.d.ts +3 -1
  20. package/lib/types/sheets/typedef.d.ts +8 -0
  21. package/lib/types/sheets/workbook.d.ts +11 -1
  22. package/lib/types/sheets/worksheet.d.ts +11 -1
  23. package/lib/types/types/const/const.d.ts +9 -0
  24. package/lib/types/types/interfaces/i-document-data.d.ts +2 -52
  25. package/lib/types/types/interfaces/i-drawing.d.ts +93 -0
  26. package/lib/types/types/interfaces/i-slide-data.d.ts +2 -1
  27. package/lib/types/types/interfaces/i-style-data.d.ts +12 -0
  28. package/lib/types/types/interfaces/index.d.ts +1 -0
  29. package/lib/umd/index.js +9 -8
  30. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  import { addCustomDecorationTextX, deleteCustomDecorationTextX } from './custom-decoration';
2
2
  import { copyCustomRange, getCustomRangesInterestsWithSelection, isIntersecting } from './custom-range';
3
3
  import { isSegmentIntersects, makeSelection, normalizeSelection } from './selection';
4
- import { addCustomRangeTextX, deleteCustomRangeTextX, deleteSelectionTextX } from './text-x-utils';
4
+ import { addCustomRangeTextX, deleteCustomRangeTextX, deleteSelectionTextX, retainSelectionTextX } from './text-x-utils';
5
5
  export declare class BuildTextUtils {
6
6
  static customRange: {
7
7
  add: typeof addCustomRangeTextX;
@@ -19,6 +19,7 @@ export declare class BuildTextUtils {
19
19
  makeSelection: typeof makeSelection;
20
20
  normalizeSelection: typeof normalizeSelection;
21
21
  delete: typeof deleteSelectionTextX;
22
+ retain: typeof retainSelectionTextX;
22
23
  };
23
24
  static range: {
24
25
  isIntersects: typeof isSegmentIntersects;
@@ -1,4 +1,3 @@
1
- import { IAccessor } from '@wendellhu/redi';
2
1
  import { ITextRange, ITextRangeParam } from '../../../../sheets/typedef';
3
2
  import { CustomRangeType, IDocumentBody } from '../../../../types/interfaces';
4
3
  import { DocumentDataModel } from '../../document-data-model';
@@ -11,7 +10,7 @@ export interface IDeleteCustomRangeParam {
11
10
  documentDataModel: DocumentDataModel;
12
11
  insert?: Nullable<IDocumentBody>;
13
12
  }
14
- export declare function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCustomRangeParam): false | TextXSelection;
13
+ export declare function deleteCustomRangeTextX(params: IDeleteCustomRangeParam): false | TextXSelection;
15
14
  export interface IAddCustomRangeTextXParam {
16
15
  ranges: ITextRange[];
17
16
  segmentId?: string;
@@ -25,6 +24,7 @@ export declare function addCustomRangeTextX(param: IAddCustomRangeTextXParam): f
25
24
  selections?: ITextRange[];
26
25
  });
27
26
  export declare function deleteSelectionTextX(selections: ITextRange[], body: IDocumentBody, memoryCursor?: number, insertBody?: Nullable<IDocumentBody>, keepBullet?: boolean): Array<TextXAction>;
27
+ export declare function retainSelectionTextX(selections: ITextRange[], body: IDocumentBody, memoryCursor?: number): TextXAction[];
28
28
  export interface IReplaceSelectionTextXParams {
29
29
  /**
30
30
  * range to be replaced.
@@ -21,7 +21,7 @@ export declare class FBlob extends FBase {
21
21
  * @returns a new blob by copying the current blob
22
22
  * @example
23
23
  * ```ts
24
- * const blob = UniverApi.newBlob(blob);
24
+ * const blob = univerAPI.newBlob(blob);
25
25
  * const newBlob = blob.copyBlob();
26
26
  * console.log(newBlob);
27
27
  * ```
@@ -33,29 +33,29 @@ export declare class FBlob extends FBase {
33
33
  * @returns a new blob by converting the current blob to the specified content type
34
34
  * @example
35
35
  * ```ts
36
- * const blob = UniverApi.newBlob(blob);
36
+ * const blob = univerAPI.newBlob(blob);
37
37
  * const newBlob = blob.getBlob();
38
38
  * ```
39
39
  */
40
40
  getAs(contentType: string): FBlob;
41
41
  /**
42
- * get the blob as a string
42
+ * Get the blob as a string.
43
43
  * @returns
44
44
  * @example
45
45
  * ```ts
46
- * const blob = UniverApi.newBlob(blob);
46
+ * const blob = univerAPI.newBlob(blob);
47
47
  * const newBlob = blob.getDataAsString();
48
48
  * console.log(newBlob);
49
49
  * ```
50
50
  */
51
51
  getDataAsString(): Promise<string>;
52
52
  /**
53
- * get the blob as a string
53
+ * Get the blob as a string.
54
54
  * @param charset the charset
55
55
  * @returns the blob content as a string
56
56
  * @example
57
57
  * ```ts
58
- * const blob = UniverApi.newBlob(blob);
58
+ * const blob = univerAPI.newBlob(blob);
59
59
  * const newBlob = blob.getDataAsString('iso-8859-1');
60
60
  * console.log(newBlob);
61
61
  * ```
@@ -66,7 +66,7 @@ export declare class FBlob extends FBase {
66
66
  * @returns the blob content as a byte array
67
67
  * @example
68
68
  * ```ts
69
- * const blob = UniverApi.newBlob(blob);
69
+ * const blob = univerAPI.newBlob(blob);
70
70
  * const newBlob = blob.getBytes();
71
71
  * console.log(newBlob);
72
72
  * ```
@@ -78,7 +78,7 @@ export declare class FBlob extends FBase {
78
78
  * @returns the blob object
79
79
  * @example
80
80
  * ```ts
81
- * const blob = UniverApi.newBlob();
81
+ * const blob = univerAPI.newBlob();
82
82
  * const bytes = new Uint8Array(10);
83
83
  * blob.setBytes(bytes);
84
84
  * ```
@@ -90,7 +90,7 @@ export declare class FBlob extends FBase {
90
90
  * @returns the blob object
91
91
  * @example
92
92
  * ```ts
93
- * const blob = UniverApi.newBlob();
93
+ * const blob = univerAPI.newBlob();
94
94
  * blob.setDataFromString('Hello, World!');
95
95
  * ```
96
96
  */
@@ -102,7 +102,7 @@ export declare class FBlob extends FBase {
102
102
  * @returns the blob object
103
103
  * @example
104
104
  * ```ts
105
- * const blob = UniverApi.newBlob();
105
+ * const blob = univerAPI.newBlob();
106
106
  * blob.setDataFromString('Hello, World!', 'text/plain');
107
107
  * ```
108
108
  */
@@ -112,7 +112,7 @@ export declare class FBlob extends FBase {
112
112
  * @returns the content type
113
113
  * @example
114
114
  * ```ts
115
- * const blob = UniverApi.newBlob(blob);
115
+ * const blob = univerAPI.newBlob(blob);
116
116
  * const newBlob = blob.getContentType();
117
117
  * console.log(newBlob);
118
118
  * ```
@@ -124,7 +124,7 @@ export declare class FBlob extends FBase {
124
124
  * @returns the blob object
125
125
  * @example
126
126
  * ```ts
127
- * const blob = UniverApi.newBlob(blob);
127
+ * const blob = univerAPI.newBlob(blob);
128
128
  * const newBlob = blob.setContentType('text/plain');
129
129
  * console.log(newBlob);
130
130
  * ```
@@ -0,0 +1,7 @@
1
+ import { DocumentDataModel } from '../docs';
2
+ import { Injector } from '../common/di';
3
+ import { FBaseInitialable } from './f-base';
4
+ export declare class FDoc extends FBaseInitialable {
5
+ protected doc: DocumentDataModel;
6
+ constructor(doc: DocumentDataModel, _injector: Injector);
7
+ }
@@ -1,5 +1,7 @@
1
1
  import { UniverInstanceType } from '../common/unit';
2
+ import { CommandType } from '../services/command/command.service';
2
3
  import { LifecycleStages } from '../services/lifecycle/lifecycle';
4
+ import { BaselineOffset, BooleanNumber, HorizontalAlign, TextDecoration, TextDirection, VerticalAlign } from '../types/enum';
3
5
  import { DataValidationErrorStyle } from '../types/enum/data-validation-error-style';
4
6
  import { DataValidationOperator } from '../types/enum/data-validation-operator';
5
7
  import { DataValidationRenderMode } from '../types/enum/data-validation-render-mode';
@@ -10,11 +12,60 @@ export declare class FEnum {
10
12
  static get(): FEnum;
11
13
  static extend(source: any): void;
12
14
  constructor();
15
+ /**
16
+ * Defines different types of Univer instances
17
+ */
13
18
  get UniverInstanceType(): typeof UniverInstanceType;
19
+ /**
20
+ * Represents different stages in the lifecycle
21
+ */
14
22
  get LifecycleStages(): typeof LifecycleStages;
23
+ /**
24
+ * Different types of data validation
25
+ */
15
26
  get DataValidationType(): typeof DataValidationType;
27
+ /**
28
+ * Different error display styles
29
+ */
16
30
  get DataValidationErrorStyle(): typeof DataValidationErrorStyle;
31
+ /**
32
+ * Different validation rendering modes
33
+ */
17
34
  get DataValidationRenderMode(): typeof DataValidationRenderMode;
35
+ /**
36
+ * Different validation operators
37
+ */
18
38
  get DataValidationOperator(): typeof DataValidationOperator;
39
+ /**
40
+ * Different validation states
41
+ */
19
42
  get DataValidationStatus(): typeof DataValidationStatus;
43
+ /**
44
+ * Different types of commands
45
+ */
46
+ get CommandType(): typeof CommandType;
47
+ /**
48
+ * Different baseline offsets for text baseline positioning
49
+ */
50
+ get BaselineOffset(): typeof BaselineOffset;
51
+ /**
52
+ * Boolean number representations
53
+ */
54
+ get BooleanNumber(): typeof BooleanNumber;
55
+ /**
56
+ * Different horizontal text alignment options
57
+ */
58
+ get HorizontalAlign(): typeof HorizontalAlign;
59
+ /**
60
+ * Different text decoration styles
61
+ */
62
+ get TextDecoration(): typeof TextDecoration;
63
+ /**
64
+ * Different text direction options
65
+ */
66
+ get TextDirection(): typeof TextDirection;
67
+ /**
68
+ * Different vertical text alignment options
69
+ */
70
+ get VerticalAlign(): typeof VerticalAlign;
20
71
  }
@@ -1,33 +1,188 @@
1
1
  import { UniverInstanceType } from '../common/unit';
2
+ import { CommandType } from '../services/command/command.service';
2
3
  import { LifecycleStages } from '../services/lifecycle/lifecycle';
3
- import { IWorkbookData } from '../sheets/typedef';
4
4
  import { IDocumentData } from '../types/interfaces';
5
- export interface ISheetCreateParam {
6
- unitId: string;
7
- type: UniverInstanceType.UNIVER_SHEET;
8
- data: IWorkbookData;
5
+ import { FDoc } from './f-doc';
6
+ /**
7
+ * Base interface for all event parameters
8
+ * @interface IEventBase
9
+ */
10
+ export interface IEventBase {
11
+ /** Flag to cancel the event if supported */
12
+ cancel?: boolean;
9
13
  }
10
- export interface IDocumentCreateParam {
14
+ /**
15
+ * Event interface triggered when a document is created
16
+ * @interface IDocCreatedParam
17
+ * @augments {IEventBase}
18
+ */
19
+ export interface IDocCreatedParam extends IEventBase {
20
+ /** Unique identifier of the document unit */
11
21
  unitId: string;
22
+ /** Type identifier for document instances */
12
23
  type: UniverInstanceType.UNIVER_DOC;
13
- data: IDocumentData;
24
+ /** The created document instance */
25
+ doc: FDoc;
26
+ /** Reference to the document unit */
27
+ unit: FDoc;
14
28
  }
15
- export interface ILifeCycleChangedParam {
29
+ /**
30
+ * Event interface triggered when a document is disposed
31
+ * @interface IDocDisposedEvent
32
+ * @augments {IEventBase}
33
+ */
34
+ export interface IDocDisposedEvent extends IEventBase {
35
+ /** Unique identifier of the disposed document unit */
36
+ unitId: string;
37
+ /** Type identifier for document instances */
38
+ unitType: UniverInstanceType.UNIVER_DOC;
39
+ /** Final state snapshot of the disposed document */
40
+ snapshot: IDocumentData;
41
+ }
42
+ /**
43
+ * Event interface for lifecycle stage changes
44
+ * @interface ILifeCycleChangedEvent
45
+ * @augments {IEventBase}
46
+ */
47
+ export interface ILifeCycleChangedEvent extends IEventBase {
48
+ /** Current stage of the lifecycle */
16
49
  stage: LifecycleStages;
17
50
  }
18
- export interface IEventBase {
19
- cancel?: boolean;
51
+ /**
52
+ * Event interface for command execution
53
+ * @interface ICommandEvent
54
+ * @augments {IEventBase}
55
+ */
56
+ export interface ICommandEvent extends IEventBase {
57
+ /** Parameters passed to the command */
58
+ params: any;
59
+ /** Unique identifier of the command */
60
+ id: string;
61
+ /** Type of the command */
62
+ type: CommandType;
20
63
  }
21
- export type IUnitCreateEvent = IEventBase & (ISheetCreateParam | IDocumentCreateParam);
22
- export type ILifeCycleChangedEvent = IEventBase & ILifeCycleChangedParam;
23
64
  export declare class FEventName {
24
65
  static _instance: FEventName | null;
25
66
  static get(): FEventName;
26
67
  static extend(source: any): void;
27
68
  constructor();
28
- get UnitCreated(): "UnitCreated";
69
+ /**
70
+ * Event fired when a document is created
71
+ * @see {@link IDocCreatedParam}
72
+ * @example
73
+ * ```ts
74
+ * univerAPI.addEvent(univerAPI.event.DocCreated, (params) => {
75
+ * const { unitId, type, doc, unit } = params;
76
+ * console.log('doc created', params);
77
+ * });
78
+ * ```
79
+ */
80
+ get DocCreated(): "DocCreated";
81
+ /**
82
+ * Event fired when a document is disposed
83
+ * @see {@link IDocDisposedEvent}
84
+ * @example
85
+ * ```ts
86
+ * univerAPI.addEvent(univerAPI.event.DocDisposed, (params) => {
87
+ * const { unitId, unitType, snapshot } = params;
88
+ * console.log('doc disposed', params);
89
+ * });
90
+ * ```
91
+ */
92
+ get DocDisposed(): "DocDisposed";
93
+ /**
94
+ * Event fired when life cycle is changed
95
+ * @see {@link ILifeCycleChangedEvent}
96
+ * @example
97
+ * ```ts
98
+ * univerAPI.addEvent(univerAPI.event.LifeCycleChanged, (params) => {
99
+ * const { stage } = params;
100
+ * console.log('life cycle changed', params);
101
+ * });
102
+ * ```
103
+ */
29
104
  get LifeCycleChanged(): "LifeCycleChanged";
105
+ /**
106
+ * Event fired when a redo command is executed
107
+ * @see {@link ICommandEvent}
108
+ * @example
109
+ * ```ts
110
+ * univerAPI.addEvent(univerAPI.event.Redo, (event) => {
111
+ * const { params, id, type } = event;
112
+ * console.log('command executed', event);
113
+ * });
114
+ * ```
115
+ */
116
+ get Redo(): "Redo";
117
+ /**
118
+ * Event fired when an undo command is executed
119
+ * @see {@link ICommandEvent}
120
+ * @example
121
+ * ```ts
122
+ * univerAPI.addEvent(univerAPI.event.Undo, (event) => {
123
+ * const { params, id, type } = event;
124
+ * console.log('command executed', event);
125
+ * });
126
+ * ```
127
+ */
128
+ get Undo(): "Undo";
129
+ /**
130
+ * Event fired before a redo command is executed
131
+ * @see {@link ICommandEvent}
132
+ * @example
133
+ * ```ts
134
+ * univerAPI.addEvent(univerAPI.event.BeforeRedo, (event) => {
135
+ * const { params, id, type } = event;
136
+ * console.log('command executed', event);
137
+ * });
138
+ * ```
139
+ */
140
+ get BeforeRedo(): "BeforeRedo";
141
+ /**
142
+ * Event fired before an undo command is executed
143
+ * @see {@link ICommandEvent}
144
+ * @example
145
+ * ```ts
146
+ * univerAPI.addEvent(univerAPI.event.BeforeUndo, (event) => {
147
+ * const { params, id, type } = event;
148
+ * console.log('command executed', event);
149
+ * });
150
+ * ```
151
+ */
152
+ get BeforeUndo(): "BeforeUndo";
153
+ /**
154
+ * Event fired when a command is executed
155
+ * @see {@link ICommandEvent}
156
+ * @example
157
+ * ```ts
158
+ * univerAPI.addEvent(univerAPI.event.CommandExecuted, (event) => {
159
+ * const { params, id, type } = event;
160
+ * console.log('command executed', event);
161
+ * });
162
+ * ```
163
+ */
164
+ get CommandExecuted(): "CommandExecuted";
165
+ /**
166
+ * Event fired before a command is executed
167
+ * @see {@link ICommandEvent}
168
+ * @example
169
+ * ```ts
170
+ * univerAPI.addEvent(univerAPI.event.BeforeCommandExecute, (event) => {
171
+ * const { params, id, type } = event;
172
+ * console.log('command executed', event);
173
+ * });
174
+ * ```
175
+ */
176
+ get BeforeCommandExecute(): "BeforeCommandExecute";
30
177
  }
31
178
  export interface IEventParamConfig {
32
179
  LifeCycleChanged: ILifeCycleChangedEvent;
180
+ DocDisposed: IDocDisposedEvent;
181
+ DocCreated: IDocCreatedParam;
182
+ Redo: ICommandEvent;
183
+ Undo: ICommandEvent;
184
+ BeforeRedo: ICommandEvent;
185
+ BeforeUndo: ICommandEvent;
186
+ CommandExecuted: ICommandEvent;
187
+ BeforeCommandExecute: ICommandEvent;
33
188
  }
@@ -1,7 +1,10 @@
1
1
  import { IDisposable, Injector } from '../common/di';
2
2
  import { CommandListener, IExecutionOptions, ICommandService } from '../services/command/command.service';
3
3
  import { LifecycleStages } from '../services/lifecycle/lifecycle';
4
+ import { IDocumentData, IParagraphStyle, ITextDecoration, ITextStyle } from '../types/interfaces';
4
5
  import { IEventParamConfig, FEventName } from './f-event';
6
+ import { Registry } from '../common/registry';
7
+ import { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue } from '../docs/data-model/rich-text-builder';
5
8
  import { IUniverInstanceService } from '../services/instance/instance.service';
6
9
  import { LifecycleService } from '../services/lifecycle/lifecycle.service';
7
10
  import { ColorBuilder } from '../shared';
@@ -11,6 +14,7 @@ import { FBlob } from './f-blob';
11
14
  import { FEnum } from './f-enum';
12
15
  import { FHooks } from './f-hooks';
13
16
  import { FUserManager } from './f-usermanager';
17
+ import { FUtil } from './f-util';
14
18
  export declare class FUniver extends FBaseInitialable {
15
19
  protected readonly _injector: Injector;
16
20
  protected readonly _commandService: ICommandService;
@@ -18,38 +22,34 @@ export declare class FUniver extends FBaseInitialable {
18
22
  protected readonly _lifecycleService: LifecycleService;
19
23
  /**
20
24
  * Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.
21
- *
22
25
  * @static
23
- *
24
26
  * @param {Univer | Injector} wrapped - The Univer instance or injector instance.
25
27
  * @returns {FUniver} - The FUniver instance.
26
28
  */
27
29
  static newAPI(wrapped: Univer | Injector): FUniver;
28
- private _eventRegistry;
29
- private _ensureEventRegistry;
30
+ protected _eventRegistry: Map<string, Registry<(param: any) => void>>;
31
+ protected _ensureEventRegistry(event: string): Registry<(param: any) => void>;
30
32
  constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService);
33
+ private _initUnitEvent;
34
+ protected _eventListend(key: string): Registry<(param: any) => void> | undefined;
31
35
  /**
32
36
  * Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
33
- *
34
37
  * @param unitId The unit id of the UniverSheet.
35
38
  * @returns Whether the Univer instance is disposed successfully.
36
39
  */
37
40
  disposeUnit(unitId: string): boolean;
38
41
  /**
39
42
  * Get the current lifecycle stage.
40
- *
41
43
  * @returns {LifecycleStages} - The current lifecycle stage.
42
44
  */
43
45
  getCurrentLifecycleStage(): LifecycleStages;
44
46
  /**
45
47
  * Undo an editing on the currently focused document.
46
- *
47
48
  * @returns {Promise<boolean>} undo result
48
49
  */
49
50
  undo(): Promise<boolean>;
50
51
  /**
51
52
  * Redo an editing on the currently focused document.
52
- *
53
53
  * @returns {Promise<boolean>} redo result
54
54
  */
55
55
  redo(): Promise<boolean>;
@@ -89,19 +89,9 @@ export declare class FUniver extends FBaseInitialable {
89
89
  * @returns {FHooks} FHooks instance
90
90
  */
91
91
  getHooks(): FHooks;
92
- /**
93
- * Create a new blob.
94
- *
95
- * @returns {FBlob} The new blob instance
96
- * @example
97
- * ```ts
98
- * const blob = UniverApi.newBlob();
99
- * ```
100
- */
101
- newBlob(): FBlob;
102
- newColor(): ColorBuilder;
103
92
  get Enum(): FEnum;
104
93
  get Event(): FEventName;
94
+ get Util(): FUtil;
105
95
  /**
106
96
  * Add an event listener
107
97
  * @param event key of event
@@ -118,7 +108,7 @@ export declare class FUniver extends FBaseInitialable {
118
108
  /**
119
109
  * Fire an event, used in internal only.
120
110
  * @param event {string} key of event
121
- * @param params {any} parmas of event
111
+ * @param params {any} params of event
122
112
  * @returns {boolean} should cancel
123
113
  * @example
124
114
  * ```ts
@@ -126,5 +116,90 @@ export declare class FUniver extends FBaseInitialable {
126
116
  * ```
127
117
  */
128
118
  protected fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined;
119
+ /**
120
+ * Get the callback map corresponding to the event
121
+ * @param event
122
+ * @returns {number} The number of callbacks
123
+ */
124
+ protected hasEventCallback(event: keyof IEventParamConfig): boolean;
129
125
  getUserManager(): FUserManager;
126
+ /**
127
+ * Create a new blob.
128
+ * @returns {FBlob} The new blob instance
129
+ * @example
130
+ * ```ts
131
+ * const blob = univerApi.newBlob();
132
+ * ```
133
+ */
134
+ newBlob(): FBlob;
135
+ /**
136
+ * Create a new color.
137
+ * @returns {ColorBuilder} The new color instance
138
+ * @example
139
+ * ```ts
140
+ * const color = univerApi.newColor();
141
+ * ```
142
+ */
143
+ newColor(): ColorBuilder;
144
+ /**
145
+ * Create a new rich text.
146
+ * @param data
147
+ * @returns {RichTextBuilder} The new rich text instance
148
+ * @example
149
+ * ```ts
150
+ * const richText = univerApi.newRichText();
151
+ * ```
152
+ */
153
+ newRichText(data?: IDocumentData): RichTextBuilder;
154
+ /**
155
+ * Create a new rich text value.
156
+ * @param data - The rich text data
157
+ * @returns {RichTextValue} The new rich text value instance
158
+ * @example
159
+ * ```ts
160
+ * const richTextValue = univerApi.newRichTextValue();
161
+ * ```
162
+ */
163
+ newRichTextValue(data: IDocumentData): RichTextValue;
164
+ /**
165
+ * Create a new paragraph style.
166
+ * @param style - The paragraph style
167
+ * @returns {ParagraphStyleBuilder} The new paragraph style instance
168
+ * @example
169
+ * ```ts
170
+ * const paragraphStyle = univerApi.newParagraphStyle();
171
+ * ```
172
+ */
173
+ newParagraphStyle(style?: IParagraphStyle): ParagraphStyleBuilder;
174
+ /**
175
+ * Create a new paragraph style value.
176
+ * @param style - The paragraph style
177
+ * @returns {ParagraphStyleValue} The new paragraph style value instance
178
+ * @example
179
+ * ```ts
180
+ * const paragraphStyleValue = univerApi.newParagraphStyleValue();
181
+ * ```
182
+ */
183
+ newParagraphStyleValue(style?: IParagraphStyle): ParagraphStyleValue;
184
+ /**
185
+ * Create a new text style.
186
+ * @param style - The text style
187
+ * @returns {TextStyleBuilder} The new text style instance
188
+ * @example
189
+ * ```ts
190
+ * const textStyle = univerApi.newTextStyle();
191
+ * ```
192
+ */
193
+ newTextStyle(style?: ITextStyle): TextStyleBuilder;
194
+ /**
195
+ * Create a new text style value.
196
+ * @param style - The text style
197
+ * @returns {TextStyleValue} The new text style value instance
198
+ * @example
199
+ * ```ts
200
+ * const textStyleValue = univerApi.newTextStyleValue();
201
+ * ```
202
+ */
203
+ newTextStyleValue(style?: ITextStyle): TextStyleValue;
204
+ newTextDecoration(decoration?: ITextDecoration): TextDecorationBuilder;
130
205
  }
@@ -6,10 +6,11 @@ export declare class FUserManager extends FBase {
6
6
  private readonly _userManagerService;
7
7
  constructor(_injector: Injector, _userManagerService: UserManagerService);
8
8
  /**
9
- * Get current user info
9
+ * Get current user info.
10
+ * @returns {IUser} Current user info.
10
11
  * @example
11
- * ```
12
- * univerAPI.getUserManager().getCurrentUser()
12
+ * ```typescript
13
+ * univerAPI.getUserManager().getCurrentUser();
13
14
  * ```
14
15
  */
15
16
  getCurrentUser(): IUser;
@@ -1,25 +1,18 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
1
+ import { Rectangle, Tools } from '../shared';
16
2
  export declare class FUtil {
17
- static Range: {
18
- new (): Range;
19
- prototype: Range;
20
- readonly START_TO_START: 0;
21
- readonly START_TO_END: 1;
22
- readonly END_TO_END: 2;
23
- readonly END_TO_START: 3;
24
- };
3
+ static _instance: FUtil | null;
4
+ static get(): FUtil;
5
+ static extend(source: any): void;
6
+ /**
7
+ * Rectangle utils, including range operations likes merge, subtract, split
8
+ */
9
+ get rectangle(): typeof Rectangle;
10
+ /**
11
+ * Number format utils, including parse and strigify about date, price, etc
12
+ */
13
+ get numfmt(): import('../shared/types/numfmt.type').INumfmt;
14
+ /**
15
+ * common tools
16
+ */
17
+ get tools(): typeof Tools;
25
18
  }
@@ -20,7 +20,8 @@ export { isBooleanString } from './common/boolean';
20
20
  export { createInternalEditorID, DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, isInternalEditorID, } from './common/const';
21
21
  export * from './common/di';
22
22
  export { shallowEqual } from './common/equal';
23
- export { CustomCommandExecutionError } from './common/error';
23
+ export { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue } from './docs/data-model/rich-text-builder';
24
+ export { CanceledError, CustomCommandExecutionError } from './common/error';
24
25
  export { throttle } from './common/function';
25
26
  export type { IAsyncInterceptor, ICellInterceptor, IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
26
27
  export { AsyncInterceptorManager, composeInterceptors, createAsyncInterceptorKey, createInterceptorKey, InterceptorEffectEnum, InterceptorManager } from './common/interceptor';
@@ -33,6 +34,7 @@ export { FHooks } from './facade/f-hooks';
33
34
  export { FBlob, type IFBlobSource } from './facade/f-blob';
34
35
  export { FEventName, type IEventBase, type IEventParamConfig } from './facade/f-event';
35
36
  export { FEnum } from './facade/f-enum';
37
+ export { FUtil } from './facade/f-util';
36
38
  export { isNumeric, isSafeNumeric } from './common/number';
37
39
  export { Registry, RegistryAsMap } from './common/registry';
38
40
  export { requestImmediateMacroTask } from './common/request-immediate-macro-task';