@univerjs/core 0.5.4 → 0.5.5-experimental.20250123-34738ff

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 (74) hide show
  1. package/lib/cjs/index.js +11 -10
  2. package/lib/es/index.js +12167 -11289
  3. package/lib/types/common/const.d.ts +1 -0
  4. package/lib/types/docs/data-model/document-data-model.d.ts +4 -3
  5. package/lib/types/docs/data-model/rich-text-builder.d.ts +68 -13
  6. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -0
  7. package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +1 -0
  8. package/lib/types/docs/data-model/text-x/utils.d.ts +48 -1
  9. package/lib/types/facade/f-base.d.ts +17 -0
  10. package/lib/types/facade/f-blob.d.ts +3 -0
  11. package/lib/types/facade/f-doc.d.ts +4 -0
  12. package/lib/types/facade/f-enum.d.ts +93 -1
  13. package/lib/types/facade/f-event.d.ts +28 -18
  14. package/lib/types/facade/f-hooks.d.ts +11 -24
  15. package/lib/types/facade/f-univer.d.ts +35 -20
  16. package/lib/types/facade/f-usermanager.d.ts +3 -0
  17. package/lib/types/facade/f-util.d.ts +9 -0
  18. package/lib/types/index.d.ts +2 -3
  19. package/lib/types/services/config/config.service.d.ts +1 -1
  20. package/lib/types/services/context/context.d.ts +1 -0
  21. package/lib/types/shared/index.d.ts +1 -1
  22. package/lib/types/shared/numfmt.d.ts +2 -2
  23. package/lib/types/shared/types/numfmt.type.d.ts +1 -1
  24. package/lib/umd/index.js +11 -10
  25. package/package.json +5 -5
  26. package/LICENSE +0 -176
  27. package/lib/types/common/__tests__/array.spec.d.ts +0 -16
  28. package/lib/types/common/__tests__/interceptor.spec.d.ts +0 -16
  29. package/lib/types/common/__tests__/url.spec.d.ts +0 -16
  30. package/lib/types/docs/data-model/__tests__/replacement.spec.d.ts +0 -16
  31. package/lib/types/docs/data-model/json-x/__tests__/json-x.spec.d.ts +0 -16
  32. package/lib/types/docs/data-model/text-x/__tests__/action-iterator.spec.d.ts +0 -16
  33. package/lib/types/docs/data-model/text-x/__tests__/apply-consistency.spec.d.ts +0 -16
  34. package/lib/types/docs/data-model/text-x/__tests__/apply-utils.spec.d.ts +0 -16
  35. package/lib/types/docs/data-model/text-x/__tests__/apply.spec.d.ts +0 -16
  36. package/lib/types/docs/data-model/text-x/__tests__/common.spec.d.ts +0 -16
  37. package/lib/types/docs/data-model/text-x/__tests__/compose.spec.d.ts +0 -16
  38. package/lib/types/docs/data-model/text-x/__tests__/delete-apply.spec.d.ts +0 -16
  39. package/lib/types/docs/data-model/text-x/__tests__/invert.spec.d.ts +0 -16
  40. package/lib/types/docs/data-model/text-x/__tests__/text-x.spec.d.ts +0 -16
  41. package/lib/types/docs/data-model/text-x/__tests__/transform-custom-decorations.spec.d.ts +0 -16
  42. package/lib/types/docs/data-model/text-x/__tests__/transform-custom-range.spec.d.ts +0 -16
  43. package/lib/types/docs/data-model/text-x/__tests__/transform-paragraph.spec.d.ts +0 -16
  44. package/lib/types/docs/data-model/text-x/__tests__/transform-position.spec.d.ts +0 -16
  45. package/lib/types/docs/data-model/text-x/__tests__/transform-textrun.spec.d.ts +0 -16
  46. package/lib/types/docs/data-model/text-x/__tests__/transform.spec.d.ts +0 -16
  47. package/lib/types/docs/data-model/text-x/__tests__/utils.spec.d.ts +0 -16
  48. package/lib/types/observer/__tests__/observable.spec.d.ts +0 -16
  49. package/lib/types/services/__tests__/index.d.ts +0 -18
  50. package/lib/types/services/__tests__/permission.spec.d.ts +0 -16
  51. package/lib/types/services/__tests__/resources.spec.d.ts +0 -16
  52. package/lib/types/services/command/__tests__/command.service.spec.d.ts +0 -16
  53. package/lib/types/services/context/__tests__/context.service.spec.d.ts +0 -16
  54. package/lib/types/services/lifecycle/__tests__/lifecycle.service.spec.d.ts +0 -16
  55. package/lib/types/services/locale/__tests__/locale.service.spec.d.ts +0 -16
  56. package/lib/types/services/plugin/__tests__/plugin-override.spec.d.ts +0 -16
  57. package/lib/types/shared/__tests__/array-search.spec.d.ts +0 -16
  58. package/lib/types/shared/__tests__/common.spec.d.ts +0 -16
  59. package/lib/types/shared/__tests__/compose.spec.d.ts +0 -16
  60. package/lib/types/shared/__tests__/doc-tool.spec.d.ts +0 -16
  61. package/lib/types/shared/__tests__/name.spec.d.ts +0 -16
  62. package/lib/types/shared/__tests__/object-matrix.spec.d.ts +0 -16
  63. package/lib/types/shared/__tests__/range.spec.d.ts +0 -16
  64. package/lib/types/shared/__tests__/rectangle.spec.d.ts +0 -16
  65. package/lib/types/shared/__tests__/ref-alias.spec.d.ts +0 -16
  66. package/lib/types/shared/__tests__/rxjs.spec.d.ts +0 -16
  67. package/lib/types/shared/lru/__tests__/lru-map.spec.d.ts +0 -16
  68. package/lib/types/sheets/__tests__/cell-data.spec.d.ts +0 -16
  69. package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +0 -14
  70. package/lib/types/sheets/__tests__/ranges.spec.d.ts +0 -16
  71. package/lib/types/sheets/__tests__/span-mode.spec.d.ts +0 -16
  72. package/lib/types/sheets/__tests__/styles.spec.d.ts +0 -16
  73. package/lib/types/sheets/__tests__/workbook.spec.d.ts +0 -16
  74. package/lib/types/sheets/__tests__/worksheet.spec.d.ts +0 -16
@@ -2,56 +2,43 @@ import { IDisposable, Injector } from '../common/di';
2
2
  import { IUndoRedoItem } from '../services/undoredo/undoredo.service';
3
3
  import { LifecycleService } from '../services/lifecycle/lifecycle.service';
4
4
  import { FBase } from './f-base';
5
+ /**
6
+ * @hideconstructor
7
+ */
5
8
  export declare class FHooks extends FBase {
6
9
  protected readonly _injector: Injector;
7
10
  private readonly _lifecycleService;
8
11
  constructor(_injector: Injector, _lifecycleService: LifecycleService);
9
12
  /**
10
- * The onStarting event is fired when lifecycle stage is Starting.
11
- * @param callback Callback function that will be called when the event is fired
12
- * @returns A disposable object that can be used to unsubscribe from the event
13
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged)` as instead
13
14
  */
14
15
  onStarting(callback: () => void): IDisposable;
15
16
  /**
16
- * The onReady event is fired when lifecycle stage is Ready.
17
- * @param callback Callback function that will be called when the event is fired
18
- * @returns A disposable object that can be used to unsubscribe from the event
17
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged)` as instead
19
18
  */
20
19
  onReady(callback: () => void): IDisposable;
21
20
  /**
22
- * The onRendered event is fired when lifecycle stage is Rendered.
23
- * @param callback Callback function that will be called when the event is fired
24
- * @returns A disposable object that can be used to unsubscribe from the event
21
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged, () => {})` as instead
25
22
  */
26
23
  onRendered(callback: () => void): IDisposable;
27
24
  /**
28
- * The onSteady event is fired when lifecycle stage is Steady.
29
- * @param callback Callback function that will be called when the event is fired
30
- * @returns A disposable object that can be used to unsubscribe from the event
25
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged, () => {})` as instead
31
26
  */
32
27
  onSteady(callback: () => void): IDisposable;
33
28
  /**
34
- * Hook that fires before an undo operation is executed.
35
- * @param callback Function to be called when the event is triggered
36
- * @returns A disposable object that can be used to unsubscribe from the event
29
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, () => {})` as instead
37
30
  */
38
31
  onBeforeUndo(callback: (action: IUndoRedoItem) => void): IDisposable;
39
32
  /**
40
- * Hook that fires after an undo operation is executed.
41
- * @param callback Function to be called when the event is triggered
42
- * @returns A disposable object that can be used to unsubscribe from the event
33
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, () => {})` as instead
43
34
  */
44
35
  onUndo(callback: (action: IUndoRedoItem) => void): IDisposable;
45
36
  /**
46
- * Hook that fires before a redo operation is executed.
47
- * @param callback Function to be called when the event is triggered
48
- * @returns A disposable object that can be used to unsubscribe from the event
37
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, () => {})` as instead
49
38
  */
50
39
  onBeforeRedo(callback: (action: IUndoRedoItem) => void): IDisposable;
51
40
  /**
52
- * Hook that fires after a redo operation is executed.
53
- * @param callback Function to be called when the event is triggered
54
- * @returns A disposable object that can be used to unsubscribe from the event
41
+ * @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, () => {})` as instead
55
42
  */
56
43
  onRedo(callback: (action: IUndoRedoItem) => void): IDisposable;
57
44
  }
@@ -15,6 +15,12 @@ import { FEnum } from './f-enum';
15
15
  import { FHooks } from './f-hooks';
16
16
  import { FUserManager } from './f-usermanager';
17
17
  import { FUtil } from './f-util';
18
+ /**
19
+ * The root Facade API object to interact with Univer. Please use `newAPI` static method
20
+ * to create a new instance.
21
+ *
22
+ * @hideconstructor
23
+ */
18
24
  export declare class FUniver extends FBaseInitialable {
19
25
  protected readonly _injector: Injector;
20
26
  protected readonly _commandService: ICommandService;
@@ -94,21 +100,21 @@ export declare class FUniver extends FBaseInitialable {
94
100
  get Util(): FUtil;
95
101
  /**
96
102
  * Add an event listener
97
- * @param event key of event
98
- * @param callback callback when event triggered
103
+ * @param {string} event key of event
104
+ * @param {(params: IEventParamConfig[typeof event]) => void} callback callback when event triggered
99
105
  * @returns {Disposable} The Disposable instance, for remove the listener
100
106
  * @example
101
107
  * ```ts
102
108
  * univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
103
- * console.log('unit created', params);
109
+ * console.log('unit created', params);
104
110
  * });
105
111
  * ```
106
112
  */
107
113
  addEvent(event: keyof IEventParamConfig, callback: (params: IEventParamConfig[typeof event]) => void): IDisposable;
108
114
  /**
109
115
  * Fire an event, used in internal only.
110
- * @param event {string} key of event
111
- * @param params {any} params of event
116
+ * @param {string} event key of event
117
+ * @param {any} params params of event
112
118
  * @returns {boolean} should cancel
113
119
  * @example
114
120
  * ```ts
@@ -118,7 +124,7 @@ export declare class FUniver extends FBaseInitialable {
118
124
  protected fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined;
119
125
  /**
120
126
  * Get the callback map corresponding to the event
121
- * @param event
127
+ * @param {keyof IEventParamConfig} event
122
128
  * @returns {number} The number of callbacks
123
129
  */
124
130
  protected hasEventCallback(event: keyof IEventParamConfig): boolean;
@@ -128,7 +134,7 @@ export declare class FUniver extends FBaseInitialable {
128
134
  * @returns {FBlob} The new blob instance
129
135
  * @example
130
136
  * ```ts
131
- * const blob = univerApi.newBlob();
137
+ * const blob = univerAPI.newBlob();
132
138
  * ```
133
139
  */
134
140
  newBlob(): FBlob;
@@ -137,69 +143,78 @@ export declare class FUniver extends FBaseInitialable {
137
143
  * @returns {ColorBuilder} The new color instance
138
144
  * @example
139
145
  * ```ts
140
- * const color = univerApi.newColor();
146
+ * const color = univerAPI.newColor();
141
147
  * ```
142
148
  */
143
149
  newColor(): ColorBuilder;
144
150
  /**
145
151
  * Create a new rich text.
146
- * @param data
152
+ * @param {IDocumentData} data
147
153
  * @returns {RichTextBuilder} The new rich text instance
148
154
  * @example
149
155
  * ```ts
150
- * const richText = univerApi.newRichText();
156
+ * const richText = univerAPI.newRichText();
151
157
  * ```
152
158
  */
153
159
  newRichText(data?: IDocumentData): RichTextBuilder;
154
160
  /**
155
161
  * Create a new rich text value.
156
- * @param data - The rich text data
162
+ * @param {IDocumentData} data - The rich text data
157
163
  * @returns {RichTextValue} The new rich text value instance
158
164
  * @example
159
165
  * ```ts
160
- * const richTextValue = univerApi.newRichTextValue();
166
+ * const richTextValue = univerAPI.newRichTextValue();
161
167
  * ```
162
168
  */
163
169
  newRichTextValue(data: IDocumentData): RichTextValue;
164
170
  /**
165
171
  * Create a new paragraph style.
166
- * @param style - The paragraph style
172
+ * @param {IParagraphStyle} style - The paragraph style
167
173
  * @returns {ParagraphStyleBuilder} The new paragraph style instance
168
174
  * @example
169
175
  * ```ts
170
- * const paragraphStyle = univerApi.newParagraphStyle();
176
+ * const paragraphStyle = univerAPI.newParagraphStyle();
171
177
  * ```
172
178
  */
173
179
  newParagraphStyle(style?: IParagraphStyle): ParagraphStyleBuilder;
174
180
  /**
175
181
  * Create a new paragraph style value.
176
- * @param style - The paragraph style
182
+ * @param {IParagraphStyle} style - The paragraph style
177
183
  * @returns {ParagraphStyleValue} The new paragraph style value instance
178
184
  * @example
179
185
  * ```ts
180
- * const paragraphStyleValue = univerApi.newParagraphStyleValue();
186
+ * const paragraphStyleValue = univerAPI.newParagraphStyleValue();
181
187
  * ```
182
188
  */
183
189
  newParagraphStyleValue(style?: IParagraphStyle): ParagraphStyleValue;
184
190
  /**
185
191
  * Create a new text style.
186
- * @param style - The text style
192
+ * @param {ITextStyle} style - The text style
187
193
  * @returns {TextStyleBuilder} The new text style instance
188
194
  * @example
189
195
  * ```ts
190
- * const textStyle = univerApi.newTextStyle();
196
+ * const textStyle = univerAPI.newTextStyle();
191
197
  * ```
192
198
  */
193
199
  newTextStyle(style?: ITextStyle): TextStyleBuilder;
194
200
  /**
195
201
  * Create a new text style value.
196
- * @param style - The text style
202
+ * @param {ITextStyle} style - The text style
197
203
  * @returns {TextStyleValue} The new text style value instance
198
204
  * @example
199
205
  * ```ts
200
- * const textStyleValue = univerApi.newTextStyleValue();
206
+ * const textStyleValue = univerAPI.newTextStyleValue();
201
207
  * ```
202
208
  */
203
209
  newTextStyleValue(style?: ITextStyle): TextStyleValue;
210
+ /**
211
+ * Create a new text decoration.
212
+ * @param {ITextDecoration} decoration - The text decoration
213
+ * @returns {TextDecorationBuilder} The new text decoration instance
214
+ * @example
215
+ * ```ts
216
+ * const decoration = univerAPI.newTextDecoration();
217
+ * ```
218
+ */
204
219
  newTextDecoration(decoration?: ITextDecoration): TextDecorationBuilder;
205
220
  }
@@ -1,6 +1,9 @@
1
1
  import { IUser, UserManagerService } from '../services/user-manager/user-manager.service';
2
2
  import { Injector } from '../common/di';
3
3
  import { FBase } from './f-base';
4
+ /**
5
+ * @hideconstructor
6
+ */
4
7
  export declare class FUserManager extends FBase {
5
8
  protected readonly _injector: Injector;
6
9
  private readonly _userManagerService;
@@ -1,7 +1,16 @@
1
1
  import { Rectangle, Tools } from '../shared';
2
+ /**
3
+ * @ignore
4
+ */
2
5
  export declare class FUtil {
6
+ /**
7
+ * @ignore
8
+ */
3
9
  static _instance: FUtil | null;
4
10
  static get(): FUtil;
11
+ /**
12
+ * @ignore
13
+ */
5
14
  static extend(source: any): void;
6
15
  /**
7
16
  * Rectangle utils, including range operations likes merge, subtract, split
@@ -17,7 +17,7 @@ export { debounce, get, merge, mergeWith, set } from 'lodash-es';
17
17
  export { textDiff } from './shared/text-diff';
18
18
  export { dedupe, groupBy, makeArray, remove, rotate } from './common/array';
19
19
  export { isBooleanString } from './common/boolean';
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';
20
+ export * from './common/const';
21
21
  export * from './common/di';
22
22
  export { shallowEqual } from './common/equal';
23
23
  export { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue } from './docs/data-model/rich-text-builder';
@@ -53,8 +53,7 @@ export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/de
53
53
  export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
54
54
  export { TextX } from './docs/data-model/text-x/text-x';
55
55
  export type { TPriority } from './docs/data-model/text-x/text-x';
56
- export { composeBody, getBodySlice, SliceBodyType } from './docs/data-model/text-x/utils';
57
- export { getCustomDecorationSlice, getCustomRangeSlice, normalizeBody } from './docs/data-model/text-x/utils';
56
+ export { composeBody, getBodySlice, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getParagraphsSlice, getSectionBreakSlice, getTableSlice, getTextRunSlice, normalizeBody, SliceBodyType, } from './docs/data-model/text-x/utils';
58
57
  export { EventState, EventSubject, fromEventSubject, type IEventObserver } from './observer/observable';
59
58
  export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
60
59
  export { IAuthzIoService } from './services/authz-io/type';
@@ -19,7 +19,7 @@ interface IConfigOptions {
19
19
  merge?: boolean;
20
20
  }
21
21
  export interface IConfigService {
22
- getConfig<T>(id: string): Nullable<T>;
22
+ getConfig<T>(id: string | symbol): Nullable<T>;
23
23
  setConfig(id: string | symbol, value: unknown, options?: IConfigOptions): void;
24
24
  deleteConfig(id: string): boolean;
25
25
  subscribeConfigValue$<T = unknown>(key: string): Observable<T>;
@@ -23,6 +23,7 @@ export declare const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
23
23
  export declare const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORMULA";
24
24
  /** The focusing state of the formula editor (Fx bar). */
25
25
  export declare const FOCUSING_FX_BAR_EDITOR = "FOCUSING_FX_BAR_EDITOR";
26
+ /** The focusing state of the cell editor. */
26
27
  export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
27
28
  export declare const FOCUSING_EDITOR_STANDALONE = "FOCUSING_EDITOR_INPUT_FORMULA";
28
29
  /** The focusing state of the editor in side panel, such as Chart Editor Panel. */
@@ -30,7 +30,7 @@ export * from './hash-algorithm';
30
30
  export * from './lifecycle';
31
31
  export * from './locale';
32
32
  export { LRUHelper, LRUMap } from './lru/lru-map';
33
- export { numfmt } from './numfmt';
33
+ export { type INumfmtLocalTag, numfmt } from './numfmt';
34
34
  export * from './object-matrix';
35
35
  export { queryObjectMatrix } from './object-matrix-query';
36
36
  export { moveRangeByOffset, splitIntoGrid } from './range';
@@ -1,3 +1,3 @@
1
- import { INumfmt } from './types/numfmt.type';
1
+ import { INumfmt, LocaleTag } from './types/numfmt.type';
2
2
  declare const numfmt: INumfmt;
3
- export { numfmt };
3
+ export { LocaleTag as INumfmtLocalTag, numfmt };
@@ -181,7 +181,7 @@ interface Formatter {
181
181
  dateInfo: DateInfo;
182
182
  (value: number): string;
183
183
  }
184
- type LocaleTag = 'zh-CN' | 'zh' | 'zh-TW' | 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'el' | 'hu' | 'is' | 'id' | 'it' | 'ja' | 'ko' | 'nb' | 'pl' | 'pt' | 'ru' | 'sk' | 'es' | 'sv' | 'th' | 'tr';
184
+ export type LocaleTag = 'zh-CN' | 'zh-TW' | 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'el' | 'hu' | 'is' | 'id' | 'it' | 'ja' | 'ko' | 'nb' | 'pl' | 'pt' | 'ru' | 'sk' | 'es' | 'sv' | 'th' | 'tr' | 'vi';
185
185
  export interface ParsedReturnType {
186
186
  /**
187
187
  * The parsed value. For dates, this will be an Excel style serial date unless the nativeDate option is used.