@univerjs/core 1.0.0-alpha.7 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/lib/cjs/facade.js +7 -139
  2. package/lib/cjs/index.js +832 -929
  3. package/lib/es/facade.js +9 -135
  4. package/lib/es/index.js +826 -932
  5. package/lib/facade.js +9 -135
  6. package/lib/index.js +826 -932
  7. package/lib/types/bases/index.d.ts +3 -2
  8. package/lib/types/bases/record-identity.d.ts +22 -0
  9. package/lib/types/bases/typedef.d.ts +255 -23
  10. package/lib/types/docs/data-model/index.d.ts +1 -1
  11. package/lib/types/docs/data-model/paragraph-style.d.ts +7 -1
  12. package/lib/types/docs/data-model/rich-text-builder.d.ts +28 -9
  13. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -1
  14. package/lib/types/docs/data-model/text-x/utils.d.ts +1 -0
  15. package/lib/types/docs/data-model/types.d.ts +0 -2
  16. package/lib/types/facade/f-event.d.ts +9 -9
  17. package/lib/types/facade/f-univer.d.ts +1 -22
  18. package/lib/types/facade/index.d.ts +0 -1
  19. package/lib/types/services/context/context.d.ts +0 -2
  20. package/lib/types/services/instance/instance.service.d.ts +0 -8
  21. package/lib/types/shared/cache/image-cache.d.ts +1 -1
  22. package/lib/types/shared/common.d.ts +0 -5
  23. package/lib/types/shared/object-matrix.d.ts +0 -14
  24. package/lib/types/shared/rectangle.d.ts +0 -15
  25. package/lib/types/shared/tools.d.ts +0 -2
  26. package/lib/types/sheets/sheet-skeleton.d.ts +3 -7
  27. package/lib/types/sheets/typedef.d.ts +0 -14
  28. package/lib/types/sheets/workbook.d.ts +0 -2
  29. package/lib/types/sheets/worksheet.d.ts +0 -6
  30. package/lib/types/types/const/page-size.d.ts +2 -0
  31. package/lib/types/types/enum/text-style.d.ts +3 -1
  32. package/lib/types/types/enum/theme-color-type.d.ts +0 -4
  33. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +0 -2
  34. package/lib/types/types/interfaces/i-document-data.d.ts +113 -12
  35. package/lib/types/types/interfaces/i-need-check-disposable.d.ts +1 -1
  36. package/lib/types/types/interfaces/i-style-data.d.ts +43 -0
  37. package/lib/umd/facade.js +1 -1
  38. package/lib/umd/index.js +22 -21
  39. package/package.json +4 -4
  40. package/lib/types/facade/f-hooks.d.ts +0 -74
package/lib/es/facade.js CHANGED
@@ -1,5 +1,4 @@
1
- import { AbsoluteRefType, AutoFillSeries, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, CanceledError, ColorType, CommandType, CommonHideTypes, CopyPasteType, DataValidationErrorStyle, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DeveloperMetadataVisibility, Dimension, Direction, Disposable, HorizontalAlign, ICommandService, IUndoRedoService, IUniverInstanceService, ImageSourceType, Inject, Injector, InterpolationPointType, LifecycleService, LifecycleStages, LocaleService, LocaleType, MentionType, NumberUnitType, ParagraphStyleBuilder, ParagraphStyleValue, PresetListType, ProtectionType, Rectangle, RedoCommand, Registry, RelativeDate, RichTextBuilder, RichTextValue, SheetTypes, SpacingRule, TextDecoration, TextDecorationBuilder, TextDirection, TextStyleBuilder, TextStyleValue, ThemeColorType, ThemeService, Tools, UndoCommand, Univer, UniverInstanceType, UserManagerService, VerticalAlign, WrapStrategy, numfmt, toDisposable } from "@univerjs/core";
2
- import { filter } from "rxjs";
1
+ import { AbsoluteRefType, AutoFillSeries, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, CanceledError, ColorType, CommandType, CommonHideTypes, CopyPasteType, DataValidationErrorStyle, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DeveloperMetadataVisibility, Dimension, Direction, Disposable, HorizontalAlign, ICommandService, IUniverInstanceService, ImageSourceType, Inject, Injector, InterpolationPointType, LifecycleService, LifecycleStages, LocaleService, LocaleType, MentionType, NumberUnitType, ParagraphStyleBuilder, ParagraphStyleValue, PresetListType, ProtectionType, Rectangle, RedoCommand, Registry, RelativeDate, RichTextBuilder, RichTextValue, SheetTypes, SpacingRule, TextDecoration, TextDecorationBuilder, TextDirection, TextStyleBuilder, TextStyleValue, ThemeColorType, ThemeService, Tools, UndoCommand, Univer, UniverInstanceType, UserManagerService, VerticalAlign, WrapStrategy, numfmt, toDisposable } from "@univerjs/core";
3
2
 
4
3
  //#region src/facade/f-base.ts
5
4
  /**
@@ -81,7 +80,7 @@ var FBaseInitialable = class extends Disposable {
81
80
  };
82
81
 
83
82
  //#endregion
84
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
83
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
85
84
  function __decorateParam(paramIndex, decorator) {
86
85
  return function(target, key) {
87
86
  decorator(target, key, paramIndex);
@@ -89,7 +88,7 @@ function __decorateParam(paramIndex, decorator) {
89
88
  }
90
89
 
91
90
  //#endregion
92
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
91
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
93
92
  function __decorate(decorators, target, key, desc) {
94
93
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
95
94
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -176,7 +175,7 @@ let FBlob = _FBlob = class FBlob extends FBase {
176
175
  return this;
177
176
  }
178
177
  setDataFromString(data, contentType) {
179
- const blob = new Blob([data], { type: contentType !== null && contentType !== void 0 ? contentType : "text/plain" });
178
+ const blob = new Blob([data], { type: contentType ?? "text/plain" });
180
179
  this._blob = blob;
181
180
  return this;
182
181
  }
@@ -213,7 +212,7 @@ let FBlob = _FBlob = class FBlob extends FBase {
213
212
  FBlob = _FBlob = __decorate([__decorateParam(1, Inject(Injector))], FBlob);
214
213
 
215
214
  //#endregion
216
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
215
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
217
216
  function _typeof(o) {
218
217
  "@babel/helpers - typeof";
219
218
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -224,7 +223,7 @@ function _typeof(o) {
224
223
  }
225
224
 
226
225
  //#endregion
227
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
226
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
228
227
  function toPrimitive(t, r) {
229
228
  if ("object" != _typeof(t) || !t) return t;
230
229
  var e = t[Symbol.toPrimitive];
@@ -237,14 +236,14 @@ function toPrimitive(t, r) {
237
236
  }
238
237
 
239
238
  //#endregion
240
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
239
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
241
240
  function toPropertyKey(t) {
242
241
  var i = toPrimitive(t, "string");
243
242
  return "symbol" == _typeof(i) ? i : i + "";
244
243
  }
245
244
 
246
245
  //#endregion
247
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
246
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
248
247
  function _defineProperty(e, r, t) {
249
248
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
250
249
  value: t,
@@ -890,101 +889,6 @@ var FEventName = class FEventName {
890
889
  };
891
890
  _defineProperty(FEventName, "_instance", void 0);
892
891
 
893
- //#endregion
894
- //#region src/facade/f-hooks.ts
895
- let FHooks = class FHooks extends FBase {
896
- constructor(_injector, _lifecycleService) {
897
- super();
898
- this._injector = _injector;
899
- this._lifecycleService = _lifecycleService;
900
- }
901
- /**
902
- * @param callback
903
- * @returns {IDisposable} A disposable used to remove the listener.
904
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
905
- */
906
- onStarting(callback) {
907
- return toDisposable(this._lifecycleService.lifecycle$.pipe(filter((lifecycle) => lifecycle === LifecycleStages.Starting)).subscribe(callback));
908
- }
909
- /**
910
- * @param callback
911
- * @returns {IDisposable} A disposable used to remove the listener.
912
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
913
- */
914
- onReady(callback) {
915
- return toDisposable(this._lifecycleService.lifecycle$.pipe(filter((lifecycle) => lifecycle === LifecycleStages.Ready)).subscribe(callback));
916
- }
917
- /**
918
- * @param callback
919
- * @returns {IDisposable} A disposable used to remove the listener.
920
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
921
- */
922
- onRendered(callback) {
923
- return toDisposable(this._lifecycleService.lifecycle$.pipe(filter((lifecycle) => lifecycle === LifecycleStages.Rendered)).subscribe(callback));
924
- }
925
- /**
926
- * @param callback
927
- * @returns {IDisposable} A disposable used to remove the listener.
928
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
929
- */
930
- onSteady(callback) {
931
- return toDisposable(this._lifecycleService.lifecycle$.pipe(filter((lifecycle) => lifecycle === LifecycleStages.Steady)).subscribe(callback));
932
- }
933
- /**
934
- * @param callback
935
- * @returns {IDisposable} A disposable used to remove the listener.
936
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {})` as instead
937
- */
938
- onBeforeUndo(callback) {
939
- return this._injector.get(ICommandService).beforeCommandExecuted((command) => {
940
- if (command.id === UndoCommand.id) {
941
- const action = this._injector.get(IUndoRedoService).pitchTopUndoElement();
942
- if (action) callback(action);
943
- }
944
- });
945
- }
946
- /**
947
- * @param callback
948
- * @returns {IDisposable} A disposable used to remove the listener.
949
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, (event) => {})` as instead
950
- */
951
- onUndo(callback) {
952
- return this._injector.get(ICommandService).onCommandExecuted((command) => {
953
- if (command.id === UndoCommand.id) {
954
- const action = this._injector.get(IUndoRedoService).pitchTopUndoElement();
955
- if (action) callback(action);
956
- }
957
- });
958
- }
959
- /**
960
- * @param callback
961
- * @returns {IDisposable} A disposable used to remove the listener.
962
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {})` as instead
963
- */
964
- onBeforeRedo(callback) {
965
- return this._injector.get(ICommandService).beforeCommandExecuted((command) => {
966
- if (command.id === RedoCommand.id) {
967
- const action = this._injector.get(IUndoRedoService).pitchTopRedoElement();
968
- if (action) callback(action);
969
- }
970
- });
971
- }
972
- /**
973
- * @param callback
974
- * @returns {IDisposable} A disposable used to remove the listener.
975
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, (event) => {})` as instead
976
- */
977
- onRedo(callback) {
978
- return this._injector.get(ICommandService).onCommandExecuted((command) => {
979
- if (command.id === RedoCommand.id) {
980
- const action = this._injector.get(IUndoRedoService).pitchTopRedoElement();
981
- if (action) callback(action);
982
- }
983
- });
984
- }
985
- };
986
- FHooks = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, Inject(LifecycleService))], FHooks);
987
-
988
892
  //#endregion
989
893
  //#region src/facade/f-doc.ts
990
894
  let FDoc = class FDoc extends FBaseInitialable {
@@ -1468,28 +1372,6 @@ let FUniver = _FUniver = class FUniver extends Disposable {
1468
1372
  return this._injector.get(LocaleService).getLocales();
1469
1373
  }
1470
1374
  /**
1471
- * Register a callback that will be triggered before invoking a command.
1472
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {})` instead.
1473
- * @param {CommandListener} callback The callback.
1474
- * @returns {IDisposable} The disposable instance.
1475
- */
1476
- onBeforeCommandExecute(callback) {
1477
- return this._commandService.beforeCommandExecuted((command, options) => {
1478
- callback(command, options);
1479
- });
1480
- }
1481
- /**
1482
- * Register a callback that will be triggered when a command is invoked.
1483
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {})` instead.
1484
- * @param {CommandListener} callback The callback.
1485
- * @returns {IDisposable} The disposable instance.
1486
- */
1487
- onCommandExecuted(callback) {
1488
- return this._commandService.onCommandExecuted((command, options) => {
1489
- callback(command, options);
1490
- });
1491
- }
1492
- /**
1493
1375
  * Execute a command with the given id and parameters.
1494
1376
  * @param id Identifier of the command.
1495
1377
  * @param params Parameters of this execution.
@@ -1525,14 +1407,6 @@ let FUniver = _FUniver = class FUniver extends Disposable {
1525
1407
  syncExecuteCommand(id, params, options) {
1526
1408
  return this._commandService.syncExecuteCommand(id, params, options);
1527
1409
  }
1528
- /**
1529
- * Get hooks.
1530
- * @deprecated use `addEvent` instead.
1531
- * @returns {FHooks} FHooks instance
1532
- */
1533
- getHooks() {
1534
- return this._injector.createInstance(FHooks);
1535
- }
1536
1410
  get Enum() {
1537
1411
  return FEnum.get();
1538
1412
  }
@@ -1699,4 +1573,4 @@ FUniver = _FUniver = __decorate([
1699
1573
  ], FUniver);
1700
1574
 
1701
1575
  //#endregion
1702
- export { FBase, FBaseInitialable, FBlob, FEnum, FEventName, FHooks, FUniver, FUtil };
1576
+ export { FBase, FBaseInitialable, FBlob, FEnum, FEventName, FUniver, FUtil };