@univerjs/core 0.22.1 → 0.23.0-insiders.20260522-ee0b0a4

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.
package/lib/cjs/index.js CHANGED
@@ -405,6 +405,11 @@ var CanceledError = class extends CustomCommandExecutionError {
405
405
  * See the License for the specific language governing permissions and
406
406
  * limitations under the License.
407
407
  */
408
+ /**
409
+ * A no-op (no operation) function that does nothing.
410
+ * Use this as a default placeholder for callbacks or optional handlers.
411
+ */
412
+ function noop() {}
408
413
  function throttle(fn, wait = 16) {
409
414
  let lastTime = 0;
410
415
  let timer = null;
@@ -481,16 +486,17 @@ function createInterceptorKey(key) {
481
486
  const composeInterceptors = (interceptors) => function(initialValue, context) {
482
487
  let index = -1;
483
488
  let value = initialValue;
484
- for (let i = 0; i <= interceptors.length; i++) {
489
+ let nextCalled = false;
490
+ const next = (nextValue) => {
491
+ nextCalled = true;
492
+ return nextValue;
493
+ };
494
+ for (let i = 0; i < interceptors.length; i++) {
485
495
  if (i <= index) throw new Error("[SheetInterceptorService]: next() called multiple times!");
486
496
  index = i;
487
- if (i === interceptors.length) return value;
488
497
  const interceptor = interceptors[i];
489
- let nextCalled = false;
490
- value = interceptor.handler(value, context, (nextValue) => {
491
- nextCalled = true;
492
- return nextValue;
493
- });
498
+ nextCalled = false;
499
+ value = interceptor.handler(value, context, next);
494
500
  if (!nextCalled) break;
495
501
  }
496
502
  return value;
@@ -3337,6 +3343,9 @@ let CommandService = class CommandService extends Disposable {
3337
3343
  disposed() {
3338
3344
  return this._disposed;
3339
3345
  }
3346
+ _warnCommandSkippedAfterDisposed(id) {
3347
+ this._logService.warn("[CommandService]", `command "${id}" skipped because CommandService is disposed.`);
3348
+ }
3340
3349
  hasCommand(commandId) {
3341
3350
  return this._commandRegistry.hasCommand(commandId);
3342
3351
  }
@@ -3382,6 +3391,10 @@ let CommandService = class CommandService extends Disposable {
3382
3391
  throw new Error("[CommandService]: could not add a collab mutation listener twice.");
3383
3392
  }
3384
3393
  async executeCommand(id, params, options) {
3394
+ if (this._disposed) {
3395
+ this._warnCommandSkippedAfterDisposed(id);
3396
+ return false;
3397
+ }
3385
3398
  try {
3386
3399
  const item = this._commandRegistry.getCommand(id);
3387
3400
  if (item) {
@@ -3394,6 +3407,11 @@ let CommandService = class CommandService extends Disposable {
3394
3407
  const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
3395
3408
  const _options = options !== null && options !== void 0 ? options : {};
3396
3409
  this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
3410
+ if (this._disposed) {
3411
+ stackItemDisposable.dispose();
3412
+ this._warnCommandSkippedAfterDisposed(id);
3413
+ return false;
3414
+ }
3397
3415
  const result = await this._execute(command, params, _options);
3398
3416
  if (_options.syncOnly) {
3399
3417
  if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
@@ -3411,6 +3429,10 @@ let CommandService = class CommandService extends Disposable {
3411
3429
  }
3412
3430
  }
3413
3431
  syncExecuteCommand(id, params, options) {
3432
+ if (this._disposed) {
3433
+ this._warnCommandSkippedAfterDisposed(id);
3434
+ return false;
3435
+ }
3414
3436
  try {
3415
3437
  const item = this._commandRegistry.getCommand(id);
3416
3438
  if (item) {
@@ -3431,6 +3453,11 @@ let CommandService = class CommandService extends Disposable {
3431
3453
  const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
3432
3454
  const _options = options !== null && options !== void 0 ? options : {};
3433
3455
  this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
3456
+ if (this._disposed) {
3457
+ stackItemDisposable.dispose();
3458
+ this._warnCommandSkippedAfterDisposed(id);
3459
+ return false;
3460
+ }
3434
3461
  const result = this._syncExecute(command, params, _options);
3435
3462
  if (_options.syncOnly) {
3436
3463
  if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
@@ -3602,7 +3629,12 @@ function afterTime(ms) {
3602
3629
  }
3603
3630
  function convertObservableToBehaviorSubject(observable, initValue) {
3604
3631
  const subject = new rxjs.BehaviorSubject(initValue);
3605
- observable.subscribe(subject);
3632
+ const subscription = observable.subscribe(subject);
3633
+ const originalComplete = subject.complete.bind(subject);
3634
+ subject.complete = () => {
3635
+ subscription.unsubscribe();
3636
+ originalComplete();
3637
+ };
3606
3638
  return subject;
3607
3639
  }
3608
3640
 
@@ -14758,7 +14790,7 @@ const IURLImageService = (0, _wendellhu_redi.createIdentifier)("core.url-image.s
14758
14790
  //#endregion
14759
14791
  //#region package.json
14760
14792
  var name = "@univerjs/core";
14761
- var version = "0.22.1";
14793
+ var version = "0.23.0-insiders.20260522-ee0b0a4";
14762
14794
 
14763
14795
  //#endregion
14764
14796
  //#region src/sheets/empty-snapshot.ts
@@ -17641,6 +17673,8 @@ var LocaleService = class extends Disposable {
17641
17673
  super();
17642
17674
  _defineProperty(this, "_currentLocale$", new rxjs.BehaviorSubject("zhCN"));
17643
17675
  _defineProperty(this, "currentLocale$", this._currentLocale$.asObservable());
17676
+ _defineProperty(this, "_direction$", new rxjs.BehaviorSubject("ltr"));
17677
+ _defineProperty(this, "direction$", this._direction$.asObservable());
17644
17678
  _defineProperty(this, "_locales", null);
17645
17679
  _defineProperty(this, "localeChanged$", new rxjs.Subject());
17646
17680
  _defineProperty(
@@ -17687,6 +17721,7 @@ var LocaleService = class extends Disposable {
17687
17721
  this.disposeWithMe(toDisposable(() => {
17688
17722
  this._locales = null;
17689
17723
  this._currentLocale$.complete();
17724
+ this._direction$.complete();
17690
17725
  this.localeChanged$.complete();
17691
17726
  }));
17692
17727
  }
@@ -17710,6 +17745,12 @@ var LocaleService = class extends Disposable {
17710
17745
  getCurrentLocale() {
17711
17746
  return this._currentLocale;
17712
17747
  }
17748
+ setDirection(direction) {
17749
+ this._direction$.next(direction);
17750
+ }
17751
+ getDirection() {
17752
+ return this._direction$.value;
17753
+ }
17713
17754
  resolveKeyPath(obj, keys) {
17714
17755
  const currentKey = keys.shift();
17715
17756
  if (currentKey && obj && currentKey in obj) {
@@ -18737,9 +18778,23 @@ var RTree = class {
18737
18778
  * See the License for the specific language governing permissions and
18738
18779
  * limitations under the License.
18739
18780
  */
18781
+ /**
18782
+ * Returns a Promise that resolves after the specified number of milliseconds.
18783
+ * Use this to pause execution for a given duration.
18784
+ *
18785
+ * @param ms The number of milliseconds to wait before resolving.
18786
+ * @returns A Promise that resolves after `ms` milliseconds.
18787
+ */
18740
18788
  function awaitTime(ms) {
18741
18789
  return new Promise((resolve) => setTimeout(resolve, ms));
18742
18790
  }
18791
+ /**
18792
+ * Returns a Promise that resolves after the specified number of animation frames.
18793
+ * Use this to wait for the browser to complete one or more rendering cycles.
18794
+ *
18795
+ * @param frames The number of animation frames to wait before resolving. Defaults to `1`.
18796
+ * @returns A Promise that resolves after `frames` animation frames.
18797
+ */
18743
18798
  function delayAnimationFrame(frames = 1) {
18744
18799
  return new Promise((resolve) => {
18745
18800
  let count = 0;
@@ -18957,8 +19012,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
18957
19012
  const { r, g, b } = new ColorKit(this._injector.get(ThemeService).getColorFromTheme("primary.500")).toRgb();
18958
19013
  return {
18959
19014
  ...config,
18960
- defaultBackgroundColor: (_config$defaultBackgr = config.defaultBackgroundColor) !== null && _config$defaultBackgr !== void 0 ? _config$defaultBackgr : `rgba(${r}, ${g}, ${b}, 0.08)`,
18961
- defaultStripeColor: (_config$defaultStripe = config.defaultStripeColor) !== null && _config$defaultStripe !== void 0 ? _config$defaultStripe : `rgba(${r}, ${g}, ${b}, 0.25)`
19015
+ defaultBackgroundColor: (_config$defaultBackgr = config.defaultBackgroundColor) !== null && _config$defaultBackgr !== void 0 ? _config$defaultBackgr : `rgba(${r}, ${g}, ${b}, 0.025)`,
19016
+ defaultStripeColor: (_config$defaultStripe = config.defaultStripeColor) !== null && _config$defaultStripe !== void 0 ? _config$defaultStripe : `rgba(${r}, ${g}, ${b}, 0.08)`
18962
19017
  };
18963
19018
  }
18964
19019
  /**
@@ -19891,11 +19946,12 @@ var Univer = class {
19891
19946
  _defineProperty(this, "_injector", void 0);
19892
19947
  _defineProperty(this, "_disposingCallbacks", new DisposableCollection());
19893
19948
  const injector = this._injector = createUniverInjector(parentInjector, config === null || config === void 0 ? void 0 : config.override);
19894
- const { theme, darkMode, locale, locales, logLevel, logCommandExecution } = config;
19949
+ const { theme, darkMode, locale, locales, direction, logLevel, logCommandExecution } = config;
19895
19950
  if (theme) this._injector.get(ThemeService).setTheme(theme);
19896
19951
  if (darkMode) this._injector.get(ThemeService).setDarkMode(darkMode);
19897
19952
  if (locales) this._injector.get(LocaleService).load(locales);
19898
19953
  if (locale) this._injector.get(LocaleService).setLocale(locale);
19954
+ if (direction) this._injector.get(LocaleService).setDirection(direction);
19899
19955
  if (logLevel) this._injector.get(ILogService).setLogLevel(logLevel);
19900
19956
  if (logCommandExecution !== void 0) this._injector.get(IConfigService).setConfig(COMMAND_LOG_EXECUTION_CONFIG_KEY, logCommandExecution);
19901
19957
  this._init(injector);
@@ -20598,6 +20654,7 @@ exports.mixinClass = mixinClass;
20598
20654
  exports.moveMatrixArray = moveMatrixArray;
20599
20655
  exports.moveRangeByOffset = moveRangeByOffset;
20600
20656
  exports.nameCharacterCheck = nameCharacterCheck;
20657
+ exports.noop = noop;
20601
20658
  exports.normalizeBody = normalizeBody;
20602
20659
  exports.normalizeTextRuns = normalizeTextRuns;
20603
20660
  exports.numberToABC = numberToABC;
@@ -20644,12 +20701,6 @@ exports.sortRulesFactory = sortRulesFactory;
20644
20701
  exports.spliceArray = spliceArray;
20645
20702
  exports.splitIntoGrid = splitIntoGrid;
20646
20703
  exports.takeAfter = takeAfter;
20647
- Object.defineProperty(exports, 'textDiff', {
20648
- enumerable: true,
20649
- get: function () {
20650
- return fast_diff.default;
20651
- }
20652
- });
20653
20704
  exports.throttle = throttle;
20654
20705
  exports.toDisposable = toDisposable;
20655
20706
  exports.touchDependencies = touchDependencies;
package/lib/es/index.js CHANGED
@@ -8,7 +8,7 @@ import * as json1 from "ot-json1";
8
8
  import { debounceTime as debounceTime$1, filter as filter$1, first, map as map$1 } from "rxjs/operators";
9
9
  import * as numfmt from "numfmt";
10
10
  import RBush, { default as RBush$1 } from "rbush";
11
- import textDiff from "fast-diff";
11
+ import fastDiff from "fast-diff";
12
12
  import { defaultTheme } from "@univerjs/themes";
13
13
  import KDBush from "kdbush";
14
14
 
@@ -371,6 +371,11 @@ var CanceledError = class extends CustomCommandExecutionError {
371
371
  * See the License for the specific language governing permissions and
372
372
  * limitations under the License.
373
373
  */
374
+ /**
375
+ * A no-op (no operation) function that does nothing.
376
+ * Use this as a default placeholder for callbacks or optional handlers.
377
+ */
378
+ function noop() {}
374
379
  function throttle(fn, wait = 16) {
375
380
  let lastTime = 0;
376
381
  let timer = null;
@@ -447,16 +452,17 @@ function createInterceptorKey(key) {
447
452
  const composeInterceptors = (interceptors) => function(initialValue, context) {
448
453
  let index = -1;
449
454
  let value = initialValue;
450
- for (let i = 0; i <= interceptors.length; i++) {
455
+ let nextCalled = false;
456
+ const next = (nextValue) => {
457
+ nextCalled = true;
458
+ return nextValue;
459
+ };
460
+ for (let i = 0; i < interceptors.length; i++) {
451
461
  if (i <= index) throw new Error("[SheetInterceptorService]: next() called multiple times!");
452
462
  index = i;
453
- if (i === interceptors.length) return value;
454
463
  const interceptor = interceptors[i];
455
- let nextCalled = false;
456
- value = interceptor.handler(value, context, (nextValue) => {
457
- nextCalled = true;
458
- return nextValue;
459
- });
464
+ nextCalled = false;
465
+ value = interceptor.handler(value, context, next);
460
466
  if (!nextCalled) break;
461
467
  }
462
468
  return value;
@@ -3303,6 +3309,9 @@ let CommandService = class CommandService extends Disposable {
3303
3309
  disposed() {
3304
3310
  return this._disposed;
3305
3311
  }
3312
+ _warnCommandSkippedAfterDisposed(id) {
3313
+ this._logService.warn("[CommandService]", `command "${id}" skipped because CommandService is disposed.`);
3314
+ }
3306
3315
  hasCommand(commandId) {
3307
3316
  return this._commandRegistry.hasCommand(commandId);
3308
3317
  }
@@ -3348,6 +3357,10 @@ let CommandService = class CommandService extends Disposable {
3348
3357
  throw new Error("[CommandService]: could not add a collab mutation listener twice.");
3349
3358
  }
3350
3359
  async executeCommand(id, params, options) {
3360
+ if (this._disposed) {
3361
+ this._warnCommandSkippedAfterDisposed(id);
3362
+ return false;
3363
+ }
3351
3364
  try {
3352
3365
  const item = this._commandRegistry.getCommand(id);
3353
3366
  if (item) {
@@ -3360,6 +3373,11 @@ let CommandService = class CommandService extends Disposable {
3360
3373
  const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
3361
3374
  const _options = options !== null && options !== void 0 ? options : {};
3362
3375
  this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
3376
+ if (this._disposed) {
3377
+ stackItemDisposable.dispose();
3378
+ this._warnCommandSkippedAfterDisposed(id);
3379
+ return false;
3380
+ }
3363
3381
  const result = await this._execute(command, params, _options);
3364
3382
  if (_options.syncOnly) {
3365
3383
  if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
@@ -3377,6 +3395,10 @@ let CommandService = class CommandService extends Disposable {
3377
3395
  }
3378
3396
  }
3379
3397
  syncExecuteCommand(id, params, options) {
3398
+ if (this._disposed) {
3399
+ this._warnCommandSkippedAfterDisposed(id);
3400
+ return false;
3401
+ }
3380
3402
  try {
3381
3403
  const item = this._commandRegistry.getCommand(id);
3382
3404
  if (item) {
@@ -3397,6 +3419,11 @@ let CommandService = class CommandService extends Disposable {
3397
3419
  const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
3398
3420
  const _options = options !== null && options !== void 0 ? options : {};
3399
3421
  this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
3422
+ if (this._disposed) {
3423
+ stackItemDisposable.dispose();
3424
+ this._warnCommandSkippedAfterDisposed(id);
3425
+ return false;
3426
+ }
3400
3427
  const result = this._syncExecute(command, params, _options);
3401
3428
  if (_options.syncOnly) {
3402
3429
  if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
@@ -3568,7 +3595,12 @@ function afterTime(ms) {
3568
3595
  }
3569
3596
  function convertObservableToBehaviorSubject(observable, initValue) {
3570
3597
  const subject = new BehaviorSubject(initValue);
3571
- observable.subscribe(subject);
3598
+ const subscription = observable.subscribe(subject);
3599
+ const originalComplete = subject.complete.bind(subject);
3600
+ subject.complete = () => {
3601
+ subscription.unsubscribe();
3602
+ originalComplete();
3603
+ };
3572
3604
  return subject;
3573
3605
  }
3574
3606
 
@@ -11690,7 +11722,7 @@ const replaceSelectionTextX = (params) => {
11690
11722
  const body = (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.getBody();
11691
11723
  if (!body) return false;
11692
11724
  const oldBody = selection.collapsed ? null : getBodySlice(body, selection.startOffset, selection.endOffset);
11693
- const diffs = textDiff(oldBody ? oldBody.dataStream : "", insertBody.dataStream);
11725
+ const diffs = fastDiff(oldBody ? oldBody.dataStream : "", insertBody.dataStream);
11694
11726
  let cursor = 0;
11695
11727
  const actions = diffs.map(([type, text]) => {
11696
11728
  switch (type) {
@@ -11740,7 +11772,7 @@ const replaceSelectionTextRuns = (params) => {
11740
11772
  const body = (_doc$getSelfOrHeaderF2 = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF2 === void 0 ? void 0 : _doc$getSelfOrHeaderF2.getBody();
11741
11773
  if (!body) return false;
11742
11774
  const oldBody = selection.collapsed ? null : getBodySlice(body, selection.startOffset, selection.endOffset);
11743
- const diffs = textDiff(oldBody ? oldBody.dataStream : "", insertBody.dataStream);
11775
+ const diffs = fastDiff(oldBody ? oldBody.dataStream : "", insertBody.dataStream);
11744
11776
  let cursor = 0;
11745
11777
  const actions = diffs.map(([type, text]) => {
11746
11778
  switch (type) {
@@ -14724,7 +14756,7 @@ const IURLImageService = createIdentifier("core.url-image.service");
14724
14756
  //#endregion
14725
14757
  //#region package.json
14726
14758
  var name = "@univerjs/core";
14727
- var version = "0.22.1";
14759
+ var version = "0.23.0-insiders.20260522-ee0b0a4";
14728
14760
 
14729
14761
  //#endregion
14730
14762
  //#region src/sheets/empty-snapshot.ts
@@ -17607,6 +17639,8 @@ var LocaleService = class extends Disposable {
17607
17639
  super();
17608
17640
  _defineProperty(this, "_currentLocale$", new BehaviorSubject("zhCN"));
17609
17641
  _defineProperty(this, "currentLocale$", this._currentLocale$.asObservable());
17642
+ _defineProperty(this, "_direction$", new BehaviorSubject("ltr"));
17643
+ _defineProperty(this, "direction$", this._direction$.asObservable());
17610
17644
  _defineProperty(this, "_locales", null);
17611
17645
  _defineProperty(this, "localeChanged$", new Subject());
17612
17646
  _defineProperty(
@@ -17653,6 +17687,7 @@ var LocaleService = class extends Disposable {
17653
17687
  this.disposeWithMe(toDisposable(() => {
17654
17688
  this._locales = null;
17655
17689
  this._currentLocale$.complete();
17690
+ this._direction$.complete();
17656
17691
  this.localeChanged$.complete();
17657
17692
  }));
17658
17693
  }
@@ -17676,6 +17711,12 @@ var LocaleService = class extends Disposable {
17676
17711
  getCurrentLocale() {
17677
17712
  return this._currentLocale;
17678
17713
  }
17714
+ setDirection(direction) {
17715
+ this._direction$.next(direction);
17716
+ }
17717
+ getDirection() {
17718
+ return this._direction$.value;
17719
+ }
17679
17720
  resolveKeyPath(obj, keys) {
17680
17721
  const currentKey = keys.shift();
17681
17722
  if (currentKey && obj && currentKey in obj) {
@@ -18703,9 +18744,23 @@ var RTree = class {
18703
18744
  * See the License for the specific language governing permissions and
18704
18745
  * limitations under the License.
18705
18746
  */
18747
+ /**
18748
+ * Returns a Promise that resolves after the specified number of milliseconds.
18749
+ * Use this to pause execution for a given duration.
18750
+ *
18751
+ * @param ms The number of milliseconds to wait before resolving.
18752
+ * @returns A Promise that resolves after `ms` milliseconds.
18753
+ */
18706
18754
  function awaitTime(ms) {
18707
18755
  return new Promise((resolve) => setTimeout(resolve, ms));
18708
18756
  }
18757
+ /**
18758
+ * Returns a Promise that resolves after the specified number of animation frames.
18759
+ * Use this to wait for the browser to complete one or more rendering cycles.
18760
+ *
18761
+ * @param frames The number of animation frames to wait before resolving. Defaults to `1`.
18762
+ * @returns A Promise that resolves after `frames` animation frames.
18763
+ */
18709
18764
  function delayAnimationFrame(frames = 1) {
18710
18765
  return new Promise((resolve) => {
18711
18766
  let count = 0;
@@ -18923,8 +18978,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
18923
18978
  const { r, g, b } = new ColorKit(this._injector.get(ThemeService).getColorFromTheme("primary.500")).toRgb();
18924
18979
  return {
18925
18980
  ...config,
18926
- defaultBackgroundColor: (_config$defaultBackgr = config.defaultBackgroundColor) !== null && _config$defaultBackgr !== void 0 ? _config$defaultBackgr : `rgba(${r}, ${g}, ${b}, 0.08)`,
18927
- defaultStripeColor: (_config$defaultStripe = config.defaultStripeColor) !== null && _config$defaultStripe !== void 0 ? _config$defaultStripe : `rgba(${r}, ${g}, ${b}, 0.25)`
18981
+ defaultBackgroundColor: (_config$defaultBackgr = config.defaultBackgroundColor) !== null && _config$defaultBackgr !== void 0 ? _config$defaultBackgr : `rgba(${r}, ${g}, ${b}, 0.025)`,
18982
+ defaultStripeColor: (_config$defaultStripe = config.defaultStripeColor) !== null && _config$defaultStripe !== void 0 ? _config$defaultStripe : `rgba(${r}, ${g}, ${b}, 0.08)`
18928
18983
  };
18929
18984
  }
18930
18985
  /**
@@ -19857,11 +19912,12 @@ var Univer = class {
19857
19912
  _defineProperty(this, "_injector", void 0);
19858
19913
  _defineProperty(this, "_disposingCallbacks", new DisposableCollection());
19859
19914
  const injector = this._injector = createUniverInjector(parentInjector, config === null || config === void 0 ? void 0 : config.override);
19860
- const { theme, darkMode, locale, locales, logLevel, logCommandExecution } = config;
19915
+ const { theme, darkMode, locale, locales, direction, logLevel, logCommandExecution } = config;
19861
19916
  if (theme) this._injector.get(ThemeService).setTheme(theme);
19862
19917
  if (darkMode) this._injector.get(ThemeService).setDarkMode(darkMode);
19863
19918
  if (locales) this._injector.get(LocaleService).load(locales);
19864
19919
  if (locale) this._injector.get(LocaleService).setLocale(locale);
19920
+ if (direction) this._injector.get(LocaleService).setDirection(direction);
19865
19921
  if (logLevel) this._injector.get(ILogService).setLogLevel(logLevel);
19866
19922
  if (logCommandExecution !== void 0) this._injector.get(IConfigService).setConfig(COMMAND_LOG_EXECUTION_CONFIG_KEY, logCommandExecution);
19867
19923
  this._init(injector);
@@ -19992,4 +20048,4 @@ function createUniverInjector(parentInjector, override) {
19992
20048
  installShims();
19993
20049
 
19994
20050
  //#endregion
19995
- export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PRESET_LIST_TYPE, PRINT_CHART_COMPONENT_KEY, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextValue, RxDisposable, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TabStopAlignment, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createREGEXFromWildChar, createRowColIter, createSheetGapTestConfig, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBodySlice, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getDisplayValueFromCell, getDocsUpdateBody, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphsSlice, getPlainText, getReverseDirection, getSectionBreakSlice, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, normalizeBody, normalizeTextRuns, numberToABC, numberToListABC, numfmt, queryObjectMatrix, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, textDiff, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, willLoseNumericPrecision };
20051
+ export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PRESET_LIST_TYPE, PRINT_CHART_COMPONENT_KEY, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextValue, RxDisposable, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TabStopAlignment, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createREGEXFromWildChar, createRowColIter, createSheetGapTestConfig, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBodySlice, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getDisplayValueFromCell, getDocsUpdateBody, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphsSlice, getPlainText, getReverseDirection, getSectionBreakSlice, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBody, normalizeTextRuns, numberToABC, numberToListABC, numfmt, queryObjectMatrix, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, willLoseNumericPrecision };