@univerjs/core 0.25.1 → 1.0.0-alpha.1

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 (36) hide show
  1. package/lib/cjs/facade.js +32 -8
  2. package/lib/cjs/index.js +2697 -1892
  3. package/lib/es/facade.js +32 -8
  4. package/lib/es/index.js +2684 -1892
  5. package/lib/facade.js +32 -8
  6. package/lib/index.js +2684 -1892
  7. package/lib/types/bases/base-data-model.d.ts +33 -0
  8. package/lib/types/bases/empty-snapshot.d.ts +27 -0
  9. package/lib/types/bases/index.d.ts +18 -0
  10. package/lib/types/bases/typedef.d.ts +642 -0
  11. package/lib/types/common/const.d.ts +0 -1
  12. package/lib/types/common/equal.d.ts +0 -15
  13. package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +11 -2
  14. package/lib/types/docs/data-model/text-x/build-utils/drawings.d.ts +0 -1
  15. package/lib/types/docs/data-model/text-x/utils.d.ts +5 -1
  16. package/lib/types/docs/data-model/types.d.ts +6 -0
  17. package/lib/types/docs/paragraph-id.d.ts +24 -0
  18. package/lib/types/facade/f-univer.d.ts +20 -0
  19. package/lib/types/facade/f-util.d.ts +1 -1
  20. package/lib/types/index.d.ts +32 -16
  21. package/lib/types/services/config/config.service.d.ts +2 -3
  22. package/lib/types/services/locale/locale.service.d.ts +1 -1
  23. package/lib/types/services/resource-loader/resource-loader.service.d.ts +2 -1
  24. package/lib/types/services/resource-manager/resource-manager.service.d.ts +1 -4
  25. package/lib/types/services/resource-manager/type.d.ts +1 -1
  26. package/lib/types/services/theme/theme.service.d.ts +2 -2
  27. package/lib/types/shared/index.d.ts +1 -0
  28. package/lib/types/shared/locale.d.ts +3 -0
  29. package/lib/types/{docs/data-model/text-x/build-utils/__test__/text-x.d.ts → shared/random-id.d.ts} +2 -1
  30. package/lib/types/shared/tools.d.ts +0 -1
  31. package/lib/types/sheets/typedef.d.ts +20 -32
  32. package/lib/types/types/const/const.d.ts +1 -1
  33. package/lib/types/types/interfaces/i-document-data.d.ts +98 -8
  34. package/lib/umd/facade.js +1 -1
  35. package/lib/umd/index.js +11 -10
  36. package/package.json +7 -8
package/lib/facade.js CHANGED
@@ -77,7 +77,7 @@ var FBaseInitialable = class extends Disposable {
77
77
  };
78
78
 
79
79
  //#endregion
80
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
80
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
81
81
  function __decorateParam(paramIndex, decorator) {
82
82
  return function(target, key) {
83
83
  decorator(target, key, paramIndex);
@@ -85,7 +85,7 @@ function __decorateParam(paramIndex, decorator) {
85
85
  }
86
86
 
87
87
  //#endregion
88
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
88
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
89
89
  function __decorate(decorators, target, key, desc) {
90
90
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
91
91
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -209,7 +209,7 @@ let FBlob = _FBlob = class FBlob extends FBase {
209
209
  FBlob = _FBlob = __decorate([__decorateParam(1, Inject(Injector))], FBlob);
210
210
 
211
211
  //#endregion
212
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
212
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
213
213
  function _typeof(o) {
214
214
  "@babel/helpers - typeof";
215
215
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -220,7 +220,7 @@ function _typeof(o) {
220
220
  }
221
221
 
222
222
  //#endregion
223
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
223
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
224
224
  function toPrimitive(t, r) {
225
225
  if ("object" != _typeof(t) || !t) return t;
226
226
  var e = t[Symbol.toPrimitive];
@@ -233,14 +233,14 @@ function toPrimitive(t, r) {
233
233
  }
234
234
 
235
235
  //#endregion
236
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
236
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
237
237
  function toPropertyKey(t) {
238
238
  var i = toPrimitive(t, "string");
239
239
  return "symbol" == _typeof(i) ? i : i + "";
240
240
  }
241
241
 
242
242
  //#endregion
243
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
243
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
244
244
  function _defineProperty(e, r, t) {
245
245
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
246
246
  value: t,
@@ -951,7 +951,7 @@ var FEventRegistry = class {
951
951
  registerEventHandler(event, handler) {
952
952
  const current = this._eventHandlerMap.get(event);
953
953
  if (current) current.add(handler);
954
- else this._eventHandlerMap.set(event, new Set([handler]));
954
+ else this._eventHandlerMap.set(event, /* @__PURE__ */ new Set([handler]));
955
955
  if (this._ensureEventRegistry(event).getData().length) this._initEventHandler(event);
956
956
  return toDisposable(() => {
957
957
  var _this$_eventHandlerMa, _this$_eventHandlerRe, _this$_eventHandlerRe2;
@@ -1111,7 +1111,7 @@ var FUtil = class FUtil {
1111
1111
  *
1112
1112
  * @example
1113
1113
  * ```ts
1114
- * const key = univerAPI.Util.tools.generateRandomId(6);
1114
+ * const key = univerAPI.Util.tools.isDate();
1115
1115
  * console.log(key);
1116
1116
  * ```
1117
1117
  */
@@ -1385,6 +1385,30 @@ let FUniver = _FUniver = class FUniver extends Disposable {
1385
1385
  this._injector.get(LocaleService).setLocale(locale);
1386
1386
  }
1387
1387
  /**
1388
+ * Get the current locale.
1389
+ * @returns {string} The current locale identifier.
1390
+ * @example
1391
+ * ```ts
1392
+ * const currentLocale = univerAPI.getCurrentLocale();
1393
+ * console.log(currentLocale);
1394
+ * ```
1395
+ */
1396
+ getCurrentLocale() {
1397
+ return this._injector.get(LocaleService).getCurrentLocale();
1398
+ }
1399
+ /**
1400
+ * Get the locales for the current locale.
1401
+ * @returns {ILanguagePack | undefined} The locales object for the current locale, it returns undefined if the locales is not loaded.
1402
+ * @example
1403
+ * ```ts
1404
+ * const locales = univerAPI.getLocales();
1405
+ * console.log(locales);
1406
+ * ```
1407
+ */
1408
+ getLocales() {
1409
+ return this._injector.get(LocaleService).getLocales();
1410
+ }
1411
+ /**
1388
1412
  * Register a callback that will be triggered before invoking a command.
1389
1413
  * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {})` instead.
1390
1414
  * @param {CommandListener} callback The callback.