@univerjs/ui 1.3.0 → 1.4.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 (79) hide show
  1. package/lib/cjs/facade.js +10 -21
  2. package/lib/cjs/index.js +558 -516
  3. package/lib/cjs/locale/ar-SA.js +2 -4
  4. package/lib/cjs/locale/ca-ES.js +2 -4
  5. package/lib/cjs/locale/de-DE.js +2 -4
  6. package/lib/cjs/locale/en-US.js +2 -4
  7. package/lib/cjs/locale/es-ES.js +2 -4
  8. package/lib/cjs/locale/fa-IR.js +2 -4
  9. package/lib/cjs/locale/fr-FR.js +2 -4
  10. package/lib/cjs/locale/id-ID.js +2 -4
  11. package/lib/cjs/locale/it-IT.js +2 -4
  12. package/lib/cjs/locale/ja-JP.js +2 -4
  13. package/lib/cjs/locale/ko-KR.js +2 -4
  14. package/lib/cjs/locale/pl-PL.js +2 -4
  15. package/lib/cjs/locale/pt-BR.js +2 -4
  16. package/lib/cjs/locale/ru-RU.js +2 -4
  17. package/lib/cjs/locale/sk-SK.js +2 -4
  18. package/lib/cjs/locale/vi-VN.js +2 -4
  19. package/lib/cjs/locale/zh-CN.js +2 -4
  20. package/lib/cjs/locale/zh-HK.js +2 -4
  21. package/lib/cjs/locale/zh-TW.js +2 -4
  22. package/lib/es/facade.js +10 -20
  23. package/lib/es/index.js +472 -425
  24. package/lib/es/locale/ar-SA.js +2 -4
  25. package/lib/es/locale/ca-ES.js +2 -4
  26. package/lib/es/locale/de-DE.js +2 -4
  27. package/lib/es/locale/en-US.js +2 -4
  28. package/lib/es/locale/es-ES.js +2 -4
  29. package/lib/es/locale/fa-IR.js +2 -4
  30. package/lib/es/locale/fr-FR.js +2 -4
  31. package/lib/es/locale/id-ID.js +2 -4
  32. package/lib/es/locale/it-IT.js +2 -4
  33. package/lib/es/locale/ja-JP.js +2 -4
  34. package/lib/es/locale/ko-KR.js +2 -4
  35. package/lib/es/locale/pl-PL.js +2 -4
  36. package/lib/es/locale/pt-BR.js +2 -4
  37. package/lib/es/locale/ru-RU.js +2 -4
  38. package/lib/es/locale/sk-SK.js +2 -4
  39. package/lib/es/locale/vi-VN.js +2 -4
  40. package/lib/es/locale/zh-CN.js +2 -4
  41. package/lib/es/locale/zh-HK.js +2 -4
  42. package/lib/es/locale/zh-TW.js +2 -4
  43. package/lib/facade.js +10 -20
  44. package/lib/index.css +49 -14
  45. package/lib/index.js +472 -425
  46. package/lib/locale/ar-SA.js +2 -4
  47. package/lib/locale/ca-ES.js +2 -4
  48. package/lib/locale/de-DE.js +2 -4
  49. package/lib/locale/en-US.js +2 -4
  50. package/lib/locale/es-ES.js +2 -4
  51. package/lib/locale/fa-IR.js +2 -4
  52. package/lib/locale/fr-FR.js +2 -4
  53. package/lib/locale/id-ID.js +2 -4
  54. package/lib/locale/it-IT.js +2 -4
  55. package/lib/locale/ja-JP.js +2 -4
  56. package/lib/locale/ko-KR.js +2 -4
  57. package/lib/locale/pl-PL.js +2 -4
  58. package/lib/locale/pt-BR.js +2 -4
  59. package/lib/locale/ru-RU.js +2 -4
  60. package/lib/locale/sk-SK.js +2 -4
  61. package/lib/locale/vi-VN.js +2 -4
  62. package/lib/locale/zh-CN.js +2 -4
  63. package/lib/locale/zh-HK.js +2 -4
  64. package/lib/locale/zh-TW.js +2 -4
  65. package/lib/types/menu/shortcut-panel.menu.d.ts +2 -1
  66. package/lib/types/services/menu/menu-manager.service.d.ts +2 -0
  67. package/lib/types/services/menu/menu.d.ts +1 -0
  68. package/lib/types/utils/di.d.ts +6 -10
  69. package/lib/types/views/components/mobile-drawer/MobileDrawer.d.ts +1 -0
  70. package/lib/types/views/components/popup/RectPopup.d.ts +8 -6
  71. package/lib/types/views/components/ribbon/ToolbarButton.d.ts +3 -5
  72. package/lib/types/views/components/ribbon/TooltipButtonWrapper.d.ts +2 -1
  73. package/lib/types/views/components/ribbon/ribbon-grid-layout.d.ts +2 -0
  74. package/lib/types/views/components/ribbon/ribbon-menu/use-ribbon-tabs.d.ts +18 -0
  75. package/lib/types/views/custom-label/CustomLabel.d.ts +1 -0
  76. package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +2 -2
  77. package/lib/types/views/font-family/FontFamily.d.ts +1 -1
  78. package/lib/umd/index.js +23 -22
  79. package/package.json +13 -13
package/lib/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { BaselineOffset, BorderStyleTypes, ColorKit, CommandType, DependentOn, Disposable, DocumentDataModel, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHEET, FOCUSING_UNIVER_EDITOR, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILocalStorageService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LifecycleService, LifecycleStages, LifecycleUnreachableError, LocaleService, NAMED_STYLE_MAP, NamedStyleType, ObjectPermissionService, Optional, Plugin, Quantity, RedoCommand, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommand, UniverInstanceType, UserManagerService, Workbook, createIdentifier, dedupeBy, generateRandomId, getBorderStyleType, isInternalEditorID, isRealNum, merge, mergeOverrideWithDependencies, registerDependencies, remove, throttle, toDisposable, touchDependencies } from "@univerjs/core";
2
- import { BehaviorSubject, EMPTY, Observable, ReplaySubject, Subject, Subscription, animationFrameScheduler, combineLatest, debounceTime, distinctUntilChanged, filter, first, fromEvent, isObservable, map, merge as merge$1, of, scan, startWith, switchMap, throttleTime } from "rxjs";
3
- import { Fragment, cloneElement, createContext, createElement, forwardRef, memo, useCallback, useContext, useDeferredValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
2
+ import { BehaviorSubject, EMPTY, Observable, ReplaySubject, Subject, Subscription, animationFrameScheduler, combineLatest, debounceTime, defer, distinctUntilChanged, filter, first, fromEvent, isObservable, map, merge as merge$1, of, scan, startWith, switchMap, throttleTime } from "rxjs";
3
+ import { Fragment, cloneElement, createContext, createElement, forwardRef, memo, useCallback, useContext, useDeferredValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
4
4
  import { Avatar, Button, Checkbox, ColorPicker, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, ConfigContext, ConfigProvider, Confirm, Dialog, Dropdown, DropdownMenu, FormLayout, Gallery, HoverCard, Input, InputNumber, KBD, MessageType, Messager, MobileActionRowGroup, MobileColorPicker, MobileConfirm, MobileDropdown, MobileDropdownMenu, MobileOverlayContext, MobileSelect, Popup, Radio, RadioGroup, StateIconButton, Toaster, Tooltip, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, isBrowser, message, removeMessage, render, resetButtonClassName, revealFocusedElementInMobileViewport, scrollbarClassName, toast, unmount, useMobileKeyboardViewportLayout } from "@univerjs/design";
5
5
  import { IRenderManagerService, UniverRenderEnginePlugin, ptToPx } from "@univerjs/engine-render";
6
6
  import { distinctUntilChanged as distinctUntilChanged$1, map as map$1, scan as scan$1, startWith as startWith$1, switchMap as switchMap$1 } from "rxjs/operators";
7
- import { RediConsumer, RediContext, RediProvider, WithDependency, connectDependencies, connectInjector, connectInjector as connectInjector$1, useDependency, useDependency as useDependency$1, useInjector, useObservable, useObservable as useObservable$1, useUpdateBinder } from "@wendellhu/redi/react-bindings";
7
+ import { RediConsumer, RediContext, RediProvider, WithDependency, connectDependencies, connectInjector, connectInjector as connectInjector$1, useDependency, useDependency as useDependency$1, useInjector, useUpdateBinder } from "@wendellhu/redi/react-bindings";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { createPortal } from "react-dom";
10
10
  import { ActivityIcon, BrushIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, DatabaseIcon, ExpandIcon, EyeIcon, FeatureSearchIcon, FoodsIcon, FunctionIcon, HomeIcon, IncreaseIcon, InfoIcon, InsertIcon, KeyboardIcon, MoreDownIcon, MoreHorizontalIcon, MoreLeftIcon, MoreRightIcon, MoreVerticalIcon, NatureIcon, ObjectsIcon, PeopleIcon, PlacesIcon, ProtectIcon, RandomIcon, RecentIcon, RedoIcon, ReduceIcon, SearchIcon, ShortcutIcon, ShrinkIcon, SymbolsIcon, UndoIcon } from "@univerjs/icons";
11
11
  import { UnitAction, UnitObject, UnitRole } from "@univerjs/protocol";
12
12
 
13
- //#region src/utils/embed-boundary.ts
13
+ // src/utils/embed-boundary.ts
14
14
  /**
15
15
  * Copyright 2023-present DreamNum Co., Ltd.
16
16
  *
@@ -54,8 +54,7 @@ function getAttributeValue(target, name) {
54
54
  return typeof getAttribute === "function" ? getAttribute.call(target, name) ?? void 0 : void 0;
55
55
  }
56
56
 
57
- //#endregion
58
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
57
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
59
58
  function _typeof(o) {
60
59
  "@babel/helpers - typeof";
61
60
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -65,8 +64,7 @@ function _typeof(o) {
65
64
  }, _typeof(o);
66
65
  }
67
66
 
68
- //#endregion
69
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
67
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
70
68
  function toPrimitive(t, r) {
71
69
  if ("object" != _typeof(t) || !t) return t;
72
70
  var e = t[Symbol.toPrimitive];
@@ -78,15 +76,13 @@ function toPrimitive(t, r) {
78
76
  return ("string" === r ? String : Number)(t);
79
77
  }
80
78
 
81
- //#endregion
82
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
79
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
83
80
  function toPropertyKey(t) {
84
81
  var i = toPrimitive(t, "string");
85
82
  return "symbol" == _typeof(i) ? i : i + "";
86
83
  }
87
84
 
88
- //#endregion
89
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
85
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
90
86
  function _defineProperty(e, r, t) {
91
87
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
92
88
  value: t,
@@ -96,16 +92,14 @@ function _defineProperty(e, r, t) {
96
92
  }) : e[r] = t, e;
97
93
  }
98
94
 
99
- //#endregion
100
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
95
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
101
96
  function __decorateParam(paramIndex, decorator) {
102
97
  return function(target, key) {
103
98
  decorator(target, key, paramIndex);
104
99
  };
105
100
  }
106
101
 
107
- //#endregion
108
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
102
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
109
103
  function __decorate(decorators, target, key, desc) {
110
104
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
111
105
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -113,8 +107,7 @@ function __decorate(decorators, target, key, desc) {
113
107
  return c > 3 && r && Object.defineProperty(target, key, r), r;
114
108
  }
115
109
 
116
- //#endregion
117
- //#region src/services/layout/layout.service.ts
110
+ // src/services/layout/layout.service.ts
118
111
  const FOCUSING_UNIVER = "FOCUSING_UNIVER";
119
112
  const givingBackFocusElements = [
120
113
  "app-layout",
@@ -223,8 +216,7 @@ function getFocusUnitIdFromElement(target) {
223
216
  return target.dataset.uUnitId;
224
217
  }
225
218
 
226
- //#endregion
227
- //#region src/commands/operations/toggle-fullscreen.operation.ts
219
+ // src/commands/operations/toggle-fullscreen.operation.ts
228
220
  const ToggleFullscreenOperation = {
229
221
  id: "base-ui.operation.toggle-fullscreen",
230
222
  type: CommandType.OPERATION,
@@ -247,8 +239,7 @@ const ToggleFullscreenOperation = {
247
239
  }
248
240
  };
249
241
 
250
- //#endregion
251
- //#region src/services/shortcut/shortcut-panel.service.ts
242
+ // src/services/shortcut/shortcut-panel.service.ts
252
243
  /**
253
244
  * Copyright 2023-present DreamNum Co., Ltd.
254
245
  *
@@ -286,13 +277,11 @@ var ShortcutPanelService = class extends Disposable {
286
277
  }
287
278
  };
288
279
 
289
- //#endregion
290
- //#region src/services/sidebar/sidebar.service.ts
280
+ // src/services/sidebar/sidebar.service.ts
291
281
  const ILeftSidebarService = createIdentifier("ui.left-sidebar.service");
292
282
  const ISidebarService = createIdentifier("ui.sidebar.service");
293
283
 
294
- //#endregion
295
- //#region src/commands/operations/toggle-shortcut-panel.operation.ts
284
+ // src/commands/operations/toggle-shortcut-panel.operation.ts
296
285
  const ShortcutPanelComponentName = "ShortcutPanel";
297
286
  const ToggleShortcutPanelOperation = {
298
287
  id: "base-ui.operation.toggle-shortcut-panel",
@@ -315,8 +304,7 @@ const ToggleShortcutPanelOperation = {
315
304
  }
316
305
  };
317
306
 
318
- //#endregion
319
- //#region src/common/component-manager.ts
307
+ // src/common/component-manager.ts
320
308
  let ComponentManager = class ComponentManager extends Disposable {
321
309
  constructor(_logService) {
322
310
  super();
@@ -382,8 +370,7 @@ let ComponentManager = class ComponentManager extends Disposable {
382
370
  };
383
371
  ComponentManager = __decorate([__decorateParam(0, Optional(ILogService))], ComponentManager);
384
372
 
385
- //#endregion
386
- //#region src/common/icon-manager.ts
373
+ // src/common/icon-manager.ts
387
374
  const EmptyIcon = () => null;
388
375
  let IconManager = class IconManager extends Disposable {
389
376
  constructor(_logService) {
@@ -439,8 +426,7 @@ let IconManager = class IconManager extends Disposable {
439
426
  };
440
427
  IconManager = __decorate([__decorateParam(0, ILogService)], IconManager);
441
428
 
442
- //#endregion
443
- //#region src/common/z-index-manager.ts
429
+ // src/common/z-index-manager.ts
444
430
  /**
445
431
  * Copyright 2023-present DreamNum Co., Ltd.
446
432
  *
@@ -478,8 +464,7 @@ var ZIndexManager = class {
478
464
  }
479
465
  };
480
466
 
481
- //#endregion
482
- //#region src/common/menu-hidden-observable.ts
467
+ // src/common/menu-hidden-observable.ts
483
468
  function getMenuHiddenObservable(accessor, targetUniverType, matchUnitId, needHideUnitId) {
484
469
  const univerInstanceService = accessor.get(IUniverInstanceService);
485
470
  const getUnitType = (unitId) => SHEET_EDITOR_UNITS.includes(unitId) ? UniverInstanceType.UNIVER_SHEET : univerInstanceService.getUnitType(unitId);
@@ -521,8 +506,7 @@ function getHeaderFooterMenuHiddenObservable(accessor) {
521
506
  });
522
507
  }
523
508
 
524
- //#endregion
525
- //#region src/common/menu-merge-configs.ts
509
+ // src/common/menu-merge-configs.ts
526
510
  function mergeMenuConfigs(baseConfig, additionalConfig) {
527
511
  if (!additionalConfig || !baseConfig) return baseConfig;
528
512
  [
@@ -551,8 +535,7 @@ function updateReactiveProperty(baseConfig, key, value) {
551
535
  }
552
536
  }
553
537
 
554
- //#endregion
555
- //#region src/services/menu/menu.ts
538
+ // src/services/menu/menu.ts
556
539
  let MenuItemType = /* @__PURE__ */ function(MenuItemType) {
557
540
  /** Button style menu item. */
558
541
  MenuItemType[MenuItemType["BUTTON"] = 0] = "BUTTON";
@@ -568,8 +551,7 @@ function isMenuButtonSelectorItem(v) {
568
551
  return v.type === 2;
569
552
  }
570
553
 
571
- //#endregion
572
- //#region src/services/workbench/workbench.service.ts
554
+ // src/services/workbench/workbench.service.ts
573
555
  const IWorkbenchService = createIdentifier("univer.ui.workbench.service");
574
556
  let WorkbenchService = class WorkbenchService extends Disposable {
575
557
  constructor(univerInstanceService) {
@@ -624,8 +606,7 @@ function isWorkbenchRootUnit(unitId, options) {
624
606
  return !isInternalEditorID(unitId) && !(options === null || options === void 0 ? void 0 : options.skipAutoRender) && !(options === null || options === void 0 ? void 0 : options.embeddedRender);
625
607
  }
626
608
 
627
- //#endregion
628
- //#region src/common/object-permission-menu.ts
609
+ // src/common/object-permission-menu.ts
629
610
  function objectPermissionMenuItemFactory(accessor, id, unitType, objectType) {
630
611
  const instances = accessor.get(IUniverInstanceService);
631
612
  const state$ = combineLatest([accessor.get(IWorkbenchService).rootUnitType$, instances.getCurrentTypeOfUnit$(unitType)]).pipe(switchMap(([rootType, model]) => {
@@ -659,14 +640,12 @@ function objectPermissionMenuItemFactory(accessor, id, unitType, objectType) {
659
640
  };
660
641
  }
661
642
 
662
- //#endregion
663
- //#region src/config/config.ts
643
+ // src/config/config.ts
664
644
  const UI_PLUGIN_CONFIG_KEY = "ui.config";
665
645
  const configSymbol = Symbol(UI_PLUGIN_CONFIG_KEY);
666
646
  const defaultPluginConfig = {};
667
647
 
668
- //#endregion
669
- //#region src/const.ts
648
+ // src/const.ts
670
649
  /**
671
650
  * Copyright 2023-present DreamNum Co., Ltd.
672
651
  *
@@ -688,12 +667,10 @@ const defaultPluginConfig = {};
688
667
  const UNI_DISABLE_CHANGING_FOCUS_KEY = "UNI_DISABLE_CHANGING_FOCUS";
689
668
  const MOBILE_UI_MODE = "MOBILE_UI_MODE";
690
669
 
691
- //#endregion
692
- //#region src/services/message/message.service.ts
670
+ // src/services/message/message.service.ts
693
671
  const IMessageService = createIdentifier("ui.message.service");
694
672
 
695
- //#endregion
696
- //#region src/controllers/error/error.controller.ts
673
+ // src/controllers/error/error.controller.ts
697
674
  const PERMISSION_MESSAGE_ID = "ui.permission-denied";
698
675
  const PERMISSION_MESSAGE_DURATION = 3e3;
699
676
  let ErrorController = class ErrorController extends Disposable {
@@ -738,8 +715,7 @@ ErrorController = __decorate([
738
715
  __decorateParam(3, Inject(LocaleService))
739
716
  ], ErrorController);
740
717
 
741
- //#endregion
742
- //#region src/services/clipboard/clipboard.command.ts
718
+ // src/services/clipboard/clipboard.command.ts
743
719
  const CopyCommandName = "univer.command.copy";
744
720
  const CopyCommand = {
745
721
  id: CopyCommandName,
@@ -772,8 +748,7 @@ const PasteCommand = {
772
748
  };
773
749
  const SheetPasteShortKeyCommandName = "sheet.command.paste-by-short-key";
774
750
 
775
- //#endregion
776
- //#region src/services/shortcut/keycode.ts
751
+ // src/services/shortcut/keycode.ts
777
752
  /**
778
753
  * Copyright 2023-present DreamNum Co., Ltd.
779
754
  *
@@ -943,15 +918,13 @@ let MetaKeys = /* @__PURE__ */ function(MetaKeys) {
943
918
  return MetaKeys;
944
919
  }({});
945
920
 
946
- //#endregion
947
- //#region src/common/lifecycle.ts
921
+ // src/common/lifecycle.ts
948
922
  function fromGlobalEvent(type, listener, options) {
949
923
  window.addEventListener(type, listener, options);
950
924
  return toDisposable(() => window.removeEventListener(type, listener, options));
951
925
  }
952
926
 
953
- //#endregion
954
- //#region src/services/platform/platform.service.ts
927
+ // src/services/platform/platform.service.ts
955
928
  /**
956
929
  * Copyright 2023-present DreamNum Co., Ltd.
957
930
  *
@@ -980,8 +953,7 @@ var PlatformService = class {
980
953
  }
981
954
  };
982
955
 
983
- //#endregion
984
- //#region src/services/runtime-scope/ui-runtime-scope.service.ts
956
+ // src/services/runtime-scope/ui-runtime-scope.service.ts
985
957
  const IUIRuntimeScopeService = createIdentifier("ui.runtime-scope.service");
986
958
  var UIRuntimeScopeService = class extends Disposable {
987
959
  constructor(..._args) {
@@ -999,8 +971,7 @@ var UIRuntimeScopeService = class extends Disposable {
999
971
  }
1000
972
  };
1001
973
 
1002
- //#endregion
1003
- //#region src/services/shortcut/shortcut.service.ts
974
+ // src/services/shortcut/shortcut.service.ts
1004
975
  const MENU_NAVIGATION_KEYS = /* @__PURE__ */ new Set([
1005
976
  13,
1006
977
  32,
@@ -1161,8 +1132,7 @@ ShortcutService = __decorate([
1161
1132
  __decorateParam(4, Optional(ILayoutService))
1162
1133
  ], ShortcutService);
1163
1134
 
1164
- //#endregion
1165
- //#region src/controllers/shared-shortcut.controller.ts
1135
+ // src/controllers/shared-shortcut.controller.ts
1166
1136
  function whenEditorFocused(contextService) {
1167
1137
  return contextService.getContextValue(FOCUSING_UNIVER_EDITOR);
1168
1138
  }
@@ -1256,8 +1226,7 @@ let SharedController = class SharedController extends Disposable {
1256
1226
  };
1257
1227
  SharedController = __decorate([__decorateParam(0, IShortcutService), __decorateParam(1, ICommandService)], SharedController);
1258
1228
 
1259
- //#endregion
1260
- //#region src/services/menu/types.ts
1229
+ // src/services/menu/types.ts
1261
1230
  /**
1262
1231
  * Copyright 2023-present DreamNum Co., Ltd.
1263
1232
  *
@@ -1359,8 +1328,7 @@ let ContextMenuGroup = /* @__PURE__ */ function(ContextMenuGroup) {
1359
1328
  return ContextMenuGroup;
1360
1329
  }({});
1361
1330
 
1362
- //#endregion
1363
- //#region src/services/menu/menu-manager.service.ts
1331
+ // src/services/menu/menu-manager.service.ts
1364
1332
  var _MenuManagerService;
1365
1333
  const IMenuManagerService = createIdentifier("univer.menu-manager-service");
1366
1334
  let MenuManagerService = _MenuManagerService = class MenuManagerService extends Disposable {
@@ -1678,8 +1646,7 @@ function mergeMenuSchemaNode(target, source) {
1678
1646
  return result;
1679
1647
  }
1680
1648
 
1681
- //#endregion
1682
- //#region src/controllers/shortcut-display/shortcut-panel.controller.ts
1649
+ // src/controllers/shortcut-display/shortcut-panel.controller.ts
1683
1650
  const ToggleShortcutPanelShortcut = {
1684
1651
  id: ToggleShortcutPanelOperation.id,
1685
1652
  binding: 4096 | 220,
@@ -1701,12 +1668,10 @@ ShortcutPanelController = __decorate([
1701
1668
  __decorateParam(2, ICommandService)
1702
1669
  ], ShortcutPanelController);
1703
1670
 
1704
- //#endregion
1705
- //#region src/services/dialog/dialog.service.ts
1671
+ // src/services/dialog/dialog.service.ts
1706
1672
  const IDialogService = createIdentifier("univer.ui.dialog-service");
1707
1673
 
1708
- //#endregion
1709
- //#region src/services/ribbon/ribbon.service.ts
1674
+ // src/services/ribbon/ribbon.service.ts
1710
1675
  const IRibbonService = createIdentifier("univer.ribbon-service");
1711
1676
  function isSameHiddenMap(previous, current) {
1712
1677
  return previous.length === current.length && previous.every((hidden, index) => hidden === current[index]);
@@ -1870,12 +1835,44 @@ let DesktopRibbonService = class DesktopRibbonService extends Disposable {
1870
1835
  };
1871
1836
  DesktopRibbonService = __decorate([__decorateParam(0, IMenuManagerService), __decorateParam(1, IUniverInstanceService)], DesktopRibbonService);
1872
1837
 
1873
- //#endregion
1874
- //#region src/utils/di.ts
1838
+ // src/utils/di.ts
1875
1839
  function unwrap(o) {
1876
1840
  if (typeof o === "function") return o();
1877
1841
  return o;
1878
1842
  }
1843
+ function useObservable(observable, defaultValue, shouldHaveSyncValue, deps) {
1844
+ if (typeof observable === "function" && !deps) throw new Error("Expected deps to be provided when observable is a function!");
1845
+ const dependencies = deps ?? [observable];
1846
+ const stateRef = useRef(void 0);
1847
+ const previous = stateRef.current;
1848
+ if (!previous || dependencies.length !== previous.dependencies.length || dependencies.some((value, index) => !Object.is(value, previous.dependencies[index]))) {
1849
+ var _state$source;
1850
+ const state = {
1851
+ dependencies: [...dependencies],
1852
+ source: observable ? unwrap(observable) : null,
1853
+ value: observable && previous ? previous.value : defaultValue,
1854
+ hasSyncValue: false
1855
+ };
1856
+ const subscription = (_state$source = state.source) === null || _state$source === void 0 ? void 0 : _state$source.subscribe((value) => {
1857
+ state.value = value;
1858
+ state.hasSyncValue = true;
1859
+ });
1860
+ subscription === null || subscription === void 0 || subscription.unsubscribe();
1861
+ stateRef.current = state;
1862
+ }
1863
+ const state = stateRef.current;
1864
+ const [, refresh] = useReducer((revision) => revision + 1, 0);
1865
+ useLayoutEffect(() => {
1866
+ var _state$source2;
1867
+ const subscription = (_state$source2 = state.source) === null || _state$source2 === void 0 ? void 0 : _state$source2.subscribe((value) => {
1868
+ state.value = value;
1869
+ refresh();
1870
+ });
1871
+ return () => subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
1872
+ }, [state]);
1873
+ if (shouldHaveSyncValue && !state.hasSyncValue) throw new Error("Expected a synchronous value from the observable.");
1874
+ return state.value;
1875
+ }
1879
1876
  function useObservableRef(observable, defaultValue) {
1880
1877
  const ref = useRef(defaultValue);
1881
1878
  useEffect(() => {
@@ -1889,8 +1886,7 @@ function useObservableRef(observable, defaultValue) {
1889
1886
  return ref;
1890
1887
  }
1891
1888
 
1892
- //#endregion
1893
- //#region src/views/components/feature-search/FeatureSearch.tsx
1889
+ // src/views/components/feature-search/FeatureSearch.tsx
1894
1890
  /**
1895
1891
  * Copyright 2023-present DreamNum Co., Ltd.
1896
1892
  *
@@ -2056,8 +2052,7 @@ function FeatureSearch() {
2056
2052
  });
2057
2053
  }
2058
2054
 
2059
- //#endregion
2060
- //#region src/commands/operations/open-feature-search.operation.ts
2055
+ // src/commands/operations/open-feature-search.operation.ts
2061
2056
  const OpenFeatureSearchOperation = {
2062
2057
  id: "ui.operation.open-feature-search",
2063
2058
  type: CommandType.OPERATION,
@@ -2075,8 +2070,7 @@ const OpenFeatureSearchOperation = {
2075
2070
  }
2076
2071
  };
2077
2072
 
2078
- //#endregion
2079
- //#region src/services/format-painter/format-painter-canvas.ts
2073
+ // src/services/format-painter/format-painter-canvas.ts
2080
2074
  const FORMAT_PAINTER_CURSOR_CSS = `
2081
2075
  /* Keep the brush visible while the render engine updates its usual object/text cursors. */
2082
2076
  canvas[data-format-painter="available"] {
@@ -2154,8 +2148,7 @@ function bindFormatPainterCanvas(canvas, session, options) {
2154
2148
  } };
2155
2149
  }
2156
2150
 
2157
- //#endregion
2158
- //#region src/services/format-painter/format-painter-session.service.ts
2151
+ // src/services/format-painter/format-painter-session.service.ts
2159
2152
  /** One local interaction session; domain commands retain ownership of persisted formatting. */
2160
2153
  var FormatPainterSessionService = class extends Disposable {
2161
2154
  constructor(..._args) {
@@ -2262,8 +2255,7 @@ var FormatPainterSessionService = class extends Disposable {
2262
2255
  }
2263
2256
  };
2264
2257
 
2265
- //#endregion
2266
- //#region src/controllers/format-painter.controller.ts
2258
+ // src/controllers/format-painter.controller.ts
2267
2259
  const ActivateFormatPainterOperation = {
2268
2260
  id: "ui.operation.activate-format-painter",
2269
2261
  type: CommandType.OPERATION,
@@ -2329,8 +2321,7 @@ FormatPainterController = __decorate([
2329
2321
  __decorateParam(3, IUniverInstanceService)
2330
2322
  ], FormatPainterController);
2331
2323
 
2332
- //#endregion
2333
- //#region src/menu/feature-search.menu.ts
2324
+ // src/menu/feature-search.menu.ts
2334
2325
  function FeatureSearchMenuItemFactory() {
2335
2326
  return {
2336
2327
  id: OpenFeatureSearchOperation.id,
@@ -2341,8 +2332,7 @@ function FeatureSearchMenuItemFactory() {
2341
2332
  };
2342
2333
  }
2343
2334
 
2344
- //#endregion
2345
- //#region src/menu/format-painter.menu.ts
2335
+ // src/menu/format-painter.menu.ts
2346
2336
  function FormatPainterMenuItemFactory(accessor) {
2347
2337
  const session = accessor.get(FormatPainterSessionService);
2348
2338
  return {
@@ -2368,8 +2358,7 @@ function ClearFormattingMenuItemFactory(accessor) {
2368
2358
  };
2369
2359
  }
2370
2360
 
2371
- //#endregion
2372
- //#region src/menu/history.menu.ts
2361
+ // src/menu/history.menu.ts
2373
2362
  const undoRedoDisableFactory$ = (accessor, isUndo) => {
2374
2363
  const undoRedoService = accessor.get(IUndoRedoService);
2375
2364
  const contextService = accessor.get(IContextService);
@@ -2401,10 +2390,14 @@ function RedoMenuItemFactory(accessor) {
2401
2390
  };
2402
2391
  }
2403
2392
 
2404
- //#endregion
2405
- //#region src/menu/shortcut-panel.menu.ts
2406
- function ShortcutPanelMenuItemFactory() {
2393
+ // src/menu/shortcut-panel.menu.ts
2394
+ function ShortcutPanelMenuItemFactory(accessor) {
2395
+ const sidebarService = accessor.get(ISidebarService);
2407
2396
  return {
2397
+ activated$: defer(() => sidebarService.sidebarOptions$.pipe(startWith(sidebarService.options), map((options) => {
2398
+ var _options$children;
2399
+ return options.visible === true && ((_options$children = options.children) === null || _options$children === void 0 ? void 0 : _options$children.label) === "ShortcutPanel";
2400
+ }), distinctUntilChanged())),
2408
2401
  id: ToggleShortcutPanelOperation.id,
2409
2402
  title: "ui.toggle-shortcut-panel",
2410
2403
  tooltip: "ui.toggle-shortcut-panel",
@@ -2413,8 +2406,7 @@ function ShortcutPanelMenuItemFactory() {
2413
2406
  };
2414
2407
  }
2415
2408
 
2416
- //#endregion
2417
- //#region src/menu/schema.ts
2409
+ // src/menu/schema.ts
2418
2410
  const menuSchema = {
2419
2411
  ["ribbon.start.history"]: {
2420
2412
  [ActivateFormatPainterOperation.id]: {
@@ -2466,8 +2458,7 @@ const menuSchema = {
2466
2458
  }
2467
2459
  };
2468
2460
 
2469
- //#endregion
2470
- //#region src/services/parts/parts.service.ts
2461
+ // src/services/parts/parts.service.ts
2471
2462
  let BuiltInUIPart = /* @__PURE__ */ function(BuiltInUIPart) {
2472
2463
  BuiltInUIPart["GLOBAL"] = "global";
2473
2464
  BuiltInUIPart["HEADER"] = "header";
@@ -2563,8 +2554,7 @@ var UIPartsService = class extends Disposable {
2563
2554
  }
2564
2555
  };
2565
2556
 
2566
- //#endregion
2567
- //#region src/services/dom/canvas-dom-layer.service.ts
2557
+ // src/services/dom/canvas-dom-layer.service.ts
2568
2558
  function shouldForwardFloatDomEvents(layer) {
2569
2559
  return layer.eventPassThrough !== false;
2570
2560
  }
@@ -2663,8 +2653,7 @@ var CanvasFloatDomPreviewService = class extends Disposable {
2663
2653
  }
2664
2654
  };
2665
2655
 
2666
- //#endregion
2667
- //#region src/views/components/dom/float-dom-layout.ts
2656
+ // src/views/components/dom/float-dom-layout.ts
2668
2657
  const LEGACY_WRAPPER_INSET = 2;
2669
2658
  const LEGACY_CONTENT_INSET = 4;
2670
2659
  function resolveFloatDomLayout(position, contentBox) {
@@ -2690,8 +2679,7 @@ function resolveFloatDomLayout(position, contentBox) {
2690
2679
  };
2691
2680
  }
2692
2681
 
2693
- //#endregion
2694
- //#region src/views/components/dom/FloatDom.tsx
2682
+ // src/views/components/dom/FloatDom.tsx
2695
2683
  function applyFloatDomLayout(wrapper, inner, layout) {
2696
2684
  const { wrapper: wrapperLayout, inner: innerLayout } = layout;
2697
2685
  const wrapperStyle = wrapper.style;
@@ -2871,8 +2859,7 @@ function resolveFloatDomOverflow(props) {
2871
2859
  };
2872
2860
  }
2873
2861
 
2874
- //#endregion
2875
- //#region src/services/popup/canvas-popup.service.ts
2862
+ // src/services/popup/canvas-popup.service.ts
2876
2863
  const ICanvasPopupService = createIdentifier("ui.popup.service");
2877
2864
  var CanvasPopupService = class extends Disposable {
2878
2865
  constructor(..._args) {
@@ -2918,8 +2905,7 @@ var CanvasPopupService = class extends Disposable {
2918
2905
  }
2919
2906
  };
2920
2907
 
2921
- //#endregion
2922
- //#region src/views/hooks/event.ts
2908
+ // src/views/hooks/event.ts
2923
2909
  /**
2924
2910
  * Copyright 2023-present DreamNum Co., Ltd.
2925
2911
  *
@@ -2944,8 +2930,7 @@ function useEvent(func) {
2944
2930
  }), []);
2945
2931
  }
2946
2932
 
2947
- //#endregion
2948
- //#region src/views/components/popup/RectPopup.tsx
2933
+ // src/views/components/popup/RectPopup.tsx
2949
2934
  const RectPopupContext = createContext({ current: void 0 });
2950
2935
  const RectPopupDirectionContext = createContext("vertical");
2951
2936
  /** The popup should have a minimum edge to the boundary. */
@@ -3144,8 +3129,7 @@ RectPopup.calcPopupPosition = calcPopupPosition;
3144
3129
  RectPopup.useContext = () => useContext(RectPopupContext);
3145
3130
  RectPopup.useDirection = () => useContext(RectPopupDirectionContext);
3146
3131
 
3147
- //#endregion
3148
- //#region src/views/components/popup/CanvasPopup.tsx
3132
+ // src/views/components/popup/CanvasPopup.tsx
3149
3133
  const SingleCanvasPopup = ({ popup, children }) => {
3150
3134
  const anchorRect$ = useMemo(() => popup.anchorRect$.pipe(throttleTime(0, animationFrameScheduler), map((anchorRect) => {
3151
3135
  const { bottom, left, right, top } = anchorRect;
@@ -3230,8 +3214,7 @@ function CanvasPopupContent({ popup }) {
3230
3214
  }) : content;
3231
3215
  }
3232
3216
 
3233
- //#endregion
3234
- //#region src/services/ribbon/ribbon-override.service.ts
3217
+ // src/services/ribbon/ribbon-override.service.ts
3235
3218
  const IRibbonOverrideService = createIdentifier("univer.ribbon-override-service");
3236
3219
  var RibbonOverrideService = class extends Disposable {
3237
3220
  constructor(..._args) {
@@ -3257,8 +3240,7 @@ var RibbonOverrideService = class extends Disposable {
3257
3240
  }
3258
3241
  };
3259
3242
 
3260
- //#endregion
3261
- //#region src/views/components/ComponentContainer.tsx
3243
+ // src/views/components/ComponentContainer.tsx
3262
3244
  function ComponentContainer(props) {
3263
3245
  const { components, fallback, sharedProps } = props;
3264
3246
  if (!components || components.size === 0) return fallback ?? null;
@@ -3290,8 +3272,37 @@ function useComponentsOfPart(part, injector) {
3290
3272
  return useMemo(() => uiPartsService.isUIVisible(part) ? uiPartsService.getComponents(part) : /* @__PURE__ */ new Set(), [componentPartUpdateCount]);
3291
3273
  }
3292
3274
 
3293
- //#endregion
3294
- //#region src/views/components/ribbon/ribbon-menu/ClassicMenu.tsx
3275
+ // src/views/components/ribbon/ribbon-menu/use-ribbon-tabs.ts
3276
+ function useRibbonTabs(ribbon, onSelectTab) {
3277
+ const { direction } = useContext(ConfigContext);
3278
+ return (event) => {
3279
+ const tabs = Array.from(event.currentTarget.querySelectorAll("[role=\"tab\"]"));
3280
+ const index = tabs.indexOf(event.target);
3281
+ if (index < 0) return;
3282
+ let next;
3283
+ switch (event.key) {
3284
+ case "Home":
3285
+ next = 0;
3286
+ break;
3287
+ case "End":
3288
+ next = tabs.length - 1;
3289
+ break;
3290
+ case "ArrowLeft":
3291
+ next = (index + (direction === "rtl" ? 1 : -1) + tabs.length) % tabs.length;
3292
+ break;
3293
+ case "ArrowRight":
3294
+ next = (index + (direction === "rtl" ? -1 : 1) + tabs.length) % tabs.length;
3295
+ break;
3296
+ default: return;
3297
+ }
3298
+ event.preventDefault();
3299
+ event.stopPropagation();
3300
+ tabs[next].focus();
3301
+ onSelectTab(ribbon[next]);
3302
+ };
3303
+ }
3304
+
3305
+ // src/views/components/ribbon/ribbon-menu/ClassicMenu.tsx
3295
3306
  /**
3296
3307
  * Copyright 2023-present DreamNum Co., Ltd.
3297
3308
  *
@@ -3309,15 +3320,18 @@ function useComponentsOfPart(part, injector) {
3309
3320
  */
3310
3321
  function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
3311
3322
  const localeService = useDependency(LocaleService);
3323
+ const handleKeyDown = useRibbonTabs(ribbon, onSelectTab);
3312
3324
  return /* @__PURE__ */ jsx("div", {
3313
3325
  className: "univer-flex univer-size-full univer-items-center univer-justify-center univer-gap-1 univer-overflow-x-auto univer-rounded-md univer-bg-gray-50 univer-px-3 dark:!univer-bg-gray-900",
3314
3326
  role: "tablist",
3327
+ onKeyDown: handleKeyDown,
3315
3328
  children: ribbon.map((group) => {
3316
3329
  const isActive = activatedTab === group.key;
3317
3330
  return /* @__PURE__ */ jsx("button", {
3318
3331
  type: "button",
3319
3332
  role: "tab",
3320
3333
  "aria-selected": isActive,
3334
+ tabIndex: isActive ? 0 : -1,
3321
3335
  title: localeService.t(group.title || group.key),
3322
3336
  onClick: () => onSelectTab(group),
3323
3337
  className: clsx("univer-flex univer-cursor-pointer univer-appearance-none univer-items-center univer-gap-1 univer-rounded-sm univer-border-none univer-px-2 univer-py-1 univer-text-sm univer-transition-colors focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-500 dark:focus:!univer-ring-primary-300", isActive ? "univer-bg-primary-50 univer-font-semibold univer-text-primary-600 univer-shadow-sm dark:!univer-bg-primary-900 dark:!univer-text-primary-300" : "univer-bg-transparent univer-text-gray-700 hover:univer-bg-gray-100 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700"),
@@ -3327,8 +3341,7 @@ function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
3327
3341
  });
3328
3342
  }
3329
3343
 
3330
- //#endregion
3331
- //#region src/views/components/ribbon/ribbon-menu/DefaultMenu.tsx
3344
+ // src/views/components/ribbon/ribbon-menu/DefaultMenu.tsx
3332
3345
  const iconMap = {
3333
3346
  ["ribbon.start"]: HomeIcon,
3334
3347
  ["ribbon.insert"]: InsertIcon,
@@ -3390,15 +3403,31 @@ function DefaultMenu({ ribbon, activatedTab, onSelectTab }) {
3390
3403
  });
3391
3404
  }
3392
3405
 
3393
- //#endregion
3394
- //#region src/views/components/ribbon/ribbon-menu/RibbonGridMenu.tsx
3406
+ // src/views/components/ribbon/ribbon-menu/RibbonGridMenu.tsx
3407
+ /**
3408
+ * Copyright 2023-present DreamNum Co., Ltd.
3409
+ *
3410
+ * Licensed under the Apache License, Version 2.0 (the "License");
3411
+ * you may not use this file except in compliance with the License.
3412
+ * You may obtain a copy of the License at
3413
+ *
3414
+ * http://www.apache.org/licenses/LICENSE-2.0
3415
+ *
3416
+ * Unless required by applicable law or agreed to in writing, software
3417
+ * distributed under the License is distributed on an "AS IS" BASIS,
3418
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3419
+ * See the License for the specific language governing permissions and
3420
+ * limitations under the License.
3421
+ */
3395
3422
  function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
3396
3423
  const localeService = useDependency(LocaleService);
3424
+ const handleKeyDown = useRibbonTabs(ribbon, onSelectTab);
3397
3425
  return /* @__PURE__ */ jsx("div", {
3398
3426
  "data-testid": "ribbon-grid-menu",
3399
3427
  "data-u-comp": "ribbon-grid-menu",
3400
3428
  className: "univer-flex univer-h-full univer-items-end univer-justify-start univer-overflow-x-auto univer-bg-gray-50 univer-px-2 dark:!univer-bg-gray-900",
3401
3429
  role: "tablist",
3430
+ onKeyDown: handleKeyDown,
3402
3431
  children: ribbon.map((group) => {
3403
3432
  const isActive = activatedTab === group.key;
3404
3433
  const title = localeService.t(group.title || group.key);
@@ -3406,6 +3435,7 @@ function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
3406
3435
  type: "button",
3407
3436
  role: "tab",
3408
3437
  "aria-selected": isActive,
3438
+ tabIndex: isActive ? 0 : -1,
3409
3439
  title,
3410
3440
  onClick: () => onSelectTab(group),
3411
3441
  className: clsx("univer-relative univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-whitespace-nowrap univer-border-0 univer-border-b-[3px] univer-bg-transparent univer-px-3 univer-text-sm univer-font-semibold univer-text-gray-700 univer-transition-colors hover:univer-text-gray-900 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-500 dark:!univer-text-gray-200 dark:hover:!univer-text-gray-0", isActive ? "univer-border-primary-600 univer-text-primary-700 dark:!univer-text-primary-300" : "univer-border-transparent"),
@@ -3415,8 +3445,7 @@ function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
3415
3445
  });
3416
3446
  }
3417
3447
 
3418
- //#endregion
3419
- //#region src/views/components/ribbon/ribbon-grid-layout.ts
3448
+ // src/views/components/ribbon/ribbon-grid-layout.ts
3420
3449
  const RIBBON_GRID_ROWS = 2;
3421
3450
  function placeRibbonGridItems(items) {
3422
3451
  const occupied = /* @__PURE__ */ new Set();
@@ -3444,6 +3473,7 @@ function placeRibbonGridItems(items) {
3444
3473
  columnSpan,
3445
3474
  showLabel: layout.showLabel ?? false,
3446
3475
  width: layout.width,
3476
+ minWidth: layout.minWidth,
3447
3477
  iconSize: layout.iconSize
3448
3478
  };
3449
3479
  if (cells.some((cell) => occupied.has(cell))) {
@@ -3469,13 +3499,25 @@ function placeRibbonGridItems(items) {
3469
3499
  columnSpan,
3470
3500
  showLabel: (layout === null || layout === void 0 ? void 0 : layout.showLabel) ?? false,
3471
3501
  width: layout === null || layout === void 0 ? void 0 : layout.width,
3502
+ minWidth: layout === null || layout === void 0 ? void 0 : layout.minWidth,
3472
3503
  iconSize: layout === null || layout === void 0 ? void 0 : layout.iconSize
3473
3504
  });
3474
3505
  }
3475
- return items.map((item) => placements.get(item));
3506
+ return items.map((item) => placements.get(item)).sort((a, b) => a.row - b.row || a.column - b.column);
3476
3507
  }
3477
3508
  function isValidGridGeometry(layout, rowSpan, cells) {
3478
- return cells.length > 0 && layout.row + rowSpan - 1 <= RIBBON_GRID_ROWS && (layout.width === void 0 || Number.isFinite(layout.width) && layout.width > 0) && (layout.iconSize === void 0 || Number.isFinite(layout.iconSize) && layout.iconSize > 0);
3509
+ return cells.length > 0 && layout.row + rowSpan - 1 <= RIBBON_GRID_ROWS && (layout.width === void 0 || Number.isFinite(layout.width) && layout.width > 0) && (layout.minWidth === void 0 || Number.isFinite(layout.minWidth) && layout.minWidth > 0 && layout.minWidth <= (layout.width ?? 0)) && (layout.iconSize === void 0 || Number.isFinite(layout.iconSize) && layout.iconSize > 0);
3510
+ }
3511
+ function groupRibbonOverflowItems(items) {
3512
+ const placements = placeRibbonGridItems(items);
3513
+ const groups = [];
3514
+ placements.forEach((placement, index) => {
3515
+ var _placement$item$item, _previous$item$item;
3516
+ const previous = placements[index - 1];
3517
+ if (!previous || placement.row !== previous.row || Boolean((_placement$item$item = placement.item.item) === null || _placement$item$item === void 0 ? void 0 : _placement$item$item.icon) !== Boolean((_previous$item$item = previous.item.item) === null || _previous$item$item === void 0 ? void 0 : _previous$item$item.icon)) groups.push([]);
3518
+ groups[groups.length - 1].push(placement.item);
3519
+ });
3520
+ return groups;
3479
3521
  }
3480
3522
  function findFirstAvailableCells(occupied, rowSpan, columnSpan) {
3481
3523
  for (let column = 1;; column++) for (let row = 1; row + rowSpan - 1 <= RIBBON_GRID_ROWS; row++) {
@@ -3499,8 +3541,7 @@ function getCells(row, column, rowSpan, columnSpan) {
3499
3541
  return cells;
3500
3542
  }
3501
3543
 
3502
- //#endregion
3503
- //#region src/views/components/ribbon/ToolbarButton.tsx
3544
+ // src/views/components/ribbon/ToolbarButton.tsx
3504
3545
  /**
3505
3546
  * Copyright 2023-present DreamNum Co., Ltd.
3506
3547
  *
@@ -3522,7 +3563,8 @@ univer-justify-center univer-rounded univer-border-none univer-bg-transparent un
3522
3563
  univer-text-gray-900 univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
3523
3564
  dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700 dark:disabled:!univer-text-gray-600
3524
3565
  disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
3525
- hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
3566
+ hover:univer-bg-gray-100 univer-whitespace-nowrap univer-w-max
3567
+ focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-600
3526
3568
  [&_svg]:univer-shrink-0
3527
3569
  `;
3528
3570
  const toolbarButtonVariants = cva(toolbarButtonClassName, {
@@ -3576,8 +3618,7 @@ function ToolbarButton(props) {
3576
3618
  });
3577
3619
  }
3578
3620
 
3579
- //#endregion
3580
- //#region src/views/custom-label/CustomLabel.tsx
3621
+ // src/views/custom-label/CustomLabel.tsx
3581
3622
  /**
3582
3623
  * The component to render toolbar item label and menu item label.
3583
3624
  * @param props
@@ -3637,8 +3678,7 @@ function CustomLabel(props) {
3637
3678
  return /* @__PURE__ */ jsx(Fragment$1, { children: nodes });
3638
3679
  }
3639
3680
 
3640
- //#endregion
3641
- //#region src/views/components/ribbon/hook.ts
3681
+ // src/views/components/ribbon/hook.ts
3642
3682
  /**
3643
3683
  * Subscribe to a menu item's status change and return the latest status.
3644
3684
  * @param menuItem The menu item
@@ -3677,8 +3717,7 @@ function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
3677
3717
  return useObservable(shortcut$, null, true);
3678
3718
  }
3679
3719
 
3680
- //#endregion
3681
- //#region src/services/font.service.ts
3720
+ // src/services/font.service.ts
3682
3721
  const IFontService = createIdentifier("univer.font-service");
3683
3722
  let FontCategory = /* @__PURE__ */ function(FontCategory) {
3684
3723
  FontCategory["SANS_SERIF"] = "sans-serif";
@@ -3969,8 +4008,7 @@ let FontService = class FontService {
3969
4008
  };
3970
4009
  FontService = __decorate([__decorateParam(0, IConfigService)], FontService);
3971
4010
 
3972
- //#endregion
3973
- //#region src/views/font-family/use-font-list.ts
4011
+ // src/views/font-family/use-font-list.ts
3974
4012
  function useFontList() {
3975
4013
  const fontService = useDependency(IFontService);
3976
4014
  return {
@@ -3979,8 +4017,7 @@ function useFontList() {
3979
4017
  };
3980
4018
  }
3981
4019
 
3982
- //#endregion
3983
- //#region src/views/font-family/FontFamilyItem.tsx
4020
+ // src/views/font-family/FontFamilyItem.tsx
3984
4021
  const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
3985
4022
  const FontFamilyItem = ({ value, onChange }) => {
3986
4023
  const localeService = useDependency(LocaleService);
@@ -4006,12 +4043,20 @@ const FontFamilyItem = ({ value, onChange }) => {
4006
4043
  });
4007
4044
  };
4008
4045
 
4009
- //#endregion
4010
- //#region src/views/components/ribbon/TooltipButtonWrapper.tsx
4046
+ // src/views/components/ribbon/TooltipButtonWrapper.tsx
4011
4047
  const TooltipWrapperContext = createContext({
4012
4048
  dropdownVisible: false,
4013
- setDropdownVisible: (_visible) => {}
4049
+ setDropdownVisible: (_visible) => {},
4050
+ restoreTriggerFocus: (_event) => {}
4014
4051
  });
4052
+ function ToolbarDropdownButton(props) {
4053
+ const { dropdownVisible } = useContext(TooltipWrapperContext);
4054
+ return /* @__PURE__ */ jsx("button", {
4055
+ ...props,
4056
+ type: "button",
4057
+ "aria-expanded": dropdownVisible
4058
+ });
4059
+ }
4015
4060
  const ToolbarDropdownContext = createContext(null);
4016
4061
  /**
4017
4062
  * Keeps toolbar tooltips controlled while a related popup opens and closes.
@@ -4046,17 +4091,38 @@ function ToolbarDropdownProvider(props) {
4046
4091
  const TooltipWrapper = forwardRef((props, ref) => {
4047
4092
  const { children, dropdownKey, ...tooltipProps } = props;
4048
4093
  const spanRef = useRef(null);
4094
+ const triggerFocusRef = useRef(null);
4049
4095
  const [localDropdownVisible, setLocalDropdownVisible] = useState(false);
4050
4096
  const toolbarDropdownContext = useContext(ToolbarDropdownContext);
4051
4097
  const dropdownVisible = dropdownKey && toolbarDropdownContext ? toolbarDropdownContext.openDropdownKey === dropdownKey : localDropdownVisible;
4052
4098
  const handleChangeDropdownVisible = useCallback((visible) => {
4099
+ if (visible) {
4100
+ var _spanRef$current, _spanRef$current2;
4101
+ const active = (_spanRef$current = spanRef.current) === null || _spanRef$current === void 0 ? void 0 : _spanRef$current.ownerDocument.activeElement;
4102
+ triggerFocusRef.current = active instanceof HTMLElement && ((_spanRef$current2 = spanRef.current) === null || _spanRef$current2 === void 0 ? void 0 : _spanRef$current2.contains(active)) ? active : null;
4103
+ }
4053
4104
  if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(visible ? dropdownKey : null);
4054
4105
  else setLocalDropdownVisible(visible);
4055
4106
  }, [dropdownKey, toolbarDropdownContext]);
4107
+ const restoreTriggerFocus = useCallback((event) => {
4108
+ const trigger = triggerFocusRef.current;
4109
+ triggerFocusRef.current = null;
4110
+ if (!(trigger === null || trigger === void 0 ? void 0 : trigger.isConnected)) return;
4111
+ const active = trigger.ownerDocument.activeElement;
4112
+ if (active === trigger.ownerDocument.body || event.target instanceof HTMLElement && event.target.contains(active)) {
4113
+ event.preventDefault();
4114
+ trigger.focus({ preventScroll: true });
4115
+ }
4116
+ }, []);
4056
4117
  const contextValue = useMemo(() => ({
4057
4118
  dropdownVisible,
4058
- setDropdownVisible: handleChangeDropdownVisible
4059
- }), [dropdownVisible, handleChangeDropdownVisible]);
4119
+ setDropdownVisible: handleChangeDropdownVisible,
4120
+ restoreTriggerFocus
4121
+ }), [
4122
+ dropdownVisible,
4123
+ handleChangeDropdownVisible,
4124
+ restoreTriggerFocus
4125
+ ]);
4060
4126
  useImperativeHandle(ref, () => ({ el: spanRef.current }));
4061
4127
  const content = /* @__PURE__ */ jsx("span", {
4062
4128
  ref: spanRef,
@@ -4074,7 +4140,7 @@ const TooltipWrapper = forwardRef((props, ref) => {
4074
4140
  function DropdownWrapper(props) {
4075
4141
  const { children, overlay, disabled, align, dropdownComponent: DropdownComponent = Dropdown } = props;
4076
4142
  const { direction } = useContext(ConfigContext);
4077
- const { dropdownVisible, setDropdownVisible } = useContext(TooltipWrapperContext);
4143
+ const { dropdownVisible, setDropdownVisible, restoreTriggerFocus } = useContext(TooltipWrapperContext);
4078
4144
  const triggerRef = useRef(null);
4079
4145
  const overlayRef = useRef(null);
4080
4146
  useEffect(() => {
@@ -4111,6 +4177,7 @@ function DropdownWrapper(props) {
4111
4177
  disabled,
4112
4178
  open: dropdownVisible,
4113
4179
  onOpenChange: handleVisibleChange,
4180
+ onCloseAutoFocus: restoreTriggerFocus,
4114
4181
  children: /* @__PURE__ */ jsx("div", {
4115
4182
  ref: triggerRef,
4116
4183
  className: "univer-h-full",
@@ -4152,7 +4219,7 @@ function DropdownMenuLabel({ icon, value, option, preserveStrokeWidth, onOptionS
4152
4219
  });
4153
4220
  }
4154
4221
  function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, preserveStrokeWidth, onOptionSelect, dropdownComponent, dropdownMenuComponent: DropdownMenuComponent = DropdownMenu }) {
4155
- const { dropdownVisible, setDropdownVisible } = useContext(TooltipWrapperContext);
4222
+ const { dropdownVisible, setDropdownVisible, restoreTriggerFocus } = useContext(TooltipWrapperContext);
4156
4223
  const shortcutService = useDependency(IShortcutService);
4157
4224
  const contextService = useDependency(IContextService);
4158
4225
  const instanceService = useDependency(IUniverInstanceService);
@@ -4253,6 +4320,10 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
4253
4320
  if (activeElement === document.body || focusInClosingMenu) layoutService.focus();
4254
4321
  return;
4255
4322
  }
4323
+ if (!editorFocus) {
4324
+ restoreTriggerFocus(event);
4325
+ return;
4326
+ }
4256
4327
  if (!(editorFocus === null || editorFocus === void 0 ? void 0 : editorFocus.element.isConnected) || getEmbedBoundaryOwner(editorFocus.element) !== editorFocus.owner) return;
4257
4328
  const activeElement = editorFocus.element.ownerDocument.activeElement;
4258
4329
  const focusInClosingMenu = event.target instanceof HTMLElement && event.target.contains(activeElement);
@@ -4420,17 +4491,16 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
4420
4491
  }
4421
4492
  }
4422
4493
 
4423
- //#endregion
4424
- //#region src/views/components/ribbon/ToolbarItem.tsx
4494
+ // src/views/components/ribbon/ToolbarItem.tsx
4425
4495
  const toolbarDisabledClassName = "univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600";
4426
- const toolbarButtonSelectorRootVariants = cva("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 rtl:univer-pl-5 rtl:univer-pr-0 dark:hover:!univer-bg-gray-700", {
4496
+ const toolbarButtonSelectorRootVariants = cva("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-7 univer-cursor-pointer univer-items-center univer-rounded univer-pr-6 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 rtl:univer-pl-6 rtl:univer-pr-0 dark:hover:!univer-bg-gray-700", {
4427
4497
  variants: { disabled: {
4428
4498
  true: toolbarDisabledClassName,
4429
4499
  false: "univer-text-gray-900 dark:!univer-text-gray-0"
4430
4500
  } },
4431
4501
  defaultVariants: { disabled: false }
4432
4502
  });
4433
- const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 rtl:univer-rounded-l-none rtl:univer-rounded-r dark:hover:!univer-bg-gray-600", {
4503
+ const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-min-w-7 univer-items-center univer-justify-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 rtl:univer-rounded-l-none rtl:univer-rounded-r dark:hover:!univer-bg-gray-600", {
4434
4504
  variants: {
4435
4505
  active: {
4436
4506
  true: "univer-bg-gray-200 dark:!univer-bg-gray-500",
@@ -4451,7 +4521,7 @@ const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-ma
4451
4521
  disabled: false
4452
4522
  }
4453
4523
  });
4454
- const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 rtl:univer-left-0 rtl:univer-right-auto rtl:univer-rounded-l rtl:univer-rounded-r-none dark:hover:!univer-bg-gray-600", {
4524
+ const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-7 univer-w-6 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 rtl:univer-left-0 rtl:univer-right-auto rtl:univer-rounded-l rtl:univer-rounded-r-none dark:hover:!univer-bg-gray-600", {
4455
4525
  variants: {
4456
4526
  disabled: {
4457
4527
  true: toolbarDisabledClassName,
@@ -4472,7 +4542,7 @@ const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector
4472
4542
  active: false
4473
4543
  }
4474
4544
  });
4475
- const toolbarSelectorRootVariants = cva("univer-toolbar-selector-root univer-animate-in univer-fade-in univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-gap-2 univer-whitespace-nowrap univer-rounded univer-px-1 univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", {
4545
+ const toolbarSelectorRootVariants = cva("univer-toolbar-selector-root univer-animate-in univer-fade-in univer-relative univer-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-whitespace-nowrap univer-rounded univer-px-1 univer-transition-colors focus-within:univer-ring-2 focus-within:univer-ring-inset focus-within:univer-ring-primary-600 hover:univer-bg-gray-100 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-600 dark:hover:!univer-bg-gray-700", {
4476
4546
  variants: {
4477
4547
  disabled: {
4478
4548
  true: toolbarDisabledClassName,
@@ -4547,6 +4617,7 @@ const ToolbarItem = forwardRef((props, ref) => {
4547
4617
  const sId = selectionsCommandId ?? commandId ?? id;
4548
4618
  const customLabelName = typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "";
4549
4619
  const hasCustomLabel = Boolean(componentManager.get(customLabelName));
4620
+ const SelectorTrigger = hasCustomLabel ? ToolbarDropdownButton : "div";
4550
4621
  let titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
4551
4622
  if (overflow) titleToDisplay = hasCustomLabel || iconToDisplay && !showLabel ? void 0 : gridLabel;
4552
4623
  const selectorAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
@@ -4659,12 +4730,15 @@ const ToolbarItem = forwardRef((props, ref) => {
4659
4730
  }), /* @__PURE__ */ jsxs("div", {
4660
4731
  className: clsx(toolbarSelectorTriggerVariants({ disabled }), "univer-h-4 univer-justify-center univer-gap-0.5"),
4661
4732
  children: [/* @__PURE__ */ jsx(CustomLabel, {
4733
+ ariaLabel: selectorAriaLabel,
4662
4734
  title: titleToDisplay,
4663
4735
  value,
4664
4736
  label,
4665
4737
  onChange: handleSelectionsValueChange
4666
4738
  }), /* @__PURE__ */ jsx(MoreDownIcon, { preserveStrokeWidth })]
4667
4739
  })] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CustomLabel, {
4740
+ ariaLabel: selectorAriaLabel,
4741
+ className: fullWidth && hasCustomLabel ? "!univer-w-auto univer-min-w-0 univer-flex-1" : void 0,
4668
4742
  icon: iconToDisplay,
4669
4743
  iconSize,
4670
4744
  preserveStrokeWidth,
@@ -4672,8 +4746,11 @@ const ToolbarItem = forwardRef((props, ref) => {
4672
4746
  value,
4673
4747
  label,
4674
4748
  onChange: handleSelectionsValueChange
4675
- }), /* @__PURE__ */ jsx("div", {
4676
- className: clsx(toolbarSelectorTriggerVariants({ disabled }), { "univer-ml-auto rtl:univer-ml-0 rtl:univer-mr-auto": grid && !large && !icon }),
4749
+ }), /* @__PURE__ */ jsx(SelectorTrigger, {
4750
+ disabled: hasCustomLabel ? disabled : void 0,
4751
+ "aria-label": hasCustomLabel ? selectorAriaLabel : void 0,
4752
+ "aria-haspopup": hasCustomLabel ? slot ? "dialog" : "menu" : void 0,
4753
+ className: clsx(toolbarSelectorTriggerVariants({ disabled }), { "univer-ml-auto rtl:univer-ml-0 rtl:univer-mr-auto": grid && !large && !icon }, "univer-w-6 univer-shrink-0 univer-justify-center", hasCustomLabel && "univer-h-7 univer-cursor-pointer univer-rounded univer-border-0 univer-bg-transparent univer-p-0 univer-text-inherit focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-600"),
4677
4754
  children: /* @__PURE__ */ jsx(MoreDownIcon, { preserveStrokeWidth })
4678
4755
  })] })
4679
4756
  })
@@ -4682,7 +4759,7 @@ const ToolbarItem = forwardRef((props, ref) => {
4682
4759
  function renderButtonType() {
4683
4760
  const isCustomComponent = componentManager.get(typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "");
4684
4761
  const buttonAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
4685
- const buttonClassName = clsx(grid && !large && "[&>svg]:univer-size-4", grid && large ? "univer-h-full univer-min-w-14 univer-flex-col univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0", overflow && "!univer-h-auto univer-min-h-7 univer-w-full univer-justify-start univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-py-1 univer-text-start univer-text-xs focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600");
4762
+ const buttonClassName = clsx(grid && !large && "univer-min-w-7 [&>svg]:univer-size-4", grid && large ? "univer-h-full univer-min-w-14 univer-flex-col univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0", overflow && "!univer-h-auto univer-min-h-7 univer-w-full univer-justify-start univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-py-1 univer-text-start univer-text-xs focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600");
4686
4763
  const buttonStyle = grid && large ? {
4687
4764
  textAlign: "center",
4688
4765
  whiteSpace: "normal"
@@ -4747,8 +4824,7 @@ const ToolbarItem = forwardRef((props, ref) => {
4747
4824
  });
4748
4825
  });
4749
4826
 
4750
- //#endregion
4751
- //#region src/views/components/ribbon/RibbonOverflow.tsx
4827
+ // src/views/components/ribbon/RibbonOverflow.tsx
4752
4828
  /**
4753
4829
  * Copyright 2023-present DreamNum Co., Ltd.
4754
4830
  *
@@ -4825,21 +4901,24 @@ function RibbonOverflow({ groups, grid = false }) {
4825
4901
  children: localeService.t(group.title)
4826
4902
  }), /* @__PURE__ */ jsx("div", {
4827
4903
  className: "univer-flex univer-flex-wrap univer-items-center univer-gap-1",
4828
- children: (group.children ?? [group]).map((child) => {
4829
- var _child$gridLayout, _child$gridLayout2;
4830
- return child.item && /* @__PURE__ */ jsx("div", {
4831
- className: "univer-min-w-0 univer-max-w-full [&>span]:univer-block [&>span]:univer-h-full",
4832
- style: { width: child.item.label && !child.item.icon ? (_child$gridLayout = child.gridLayout) === null || _child$gridLayout === void 0 ? void 0 : _child$gridLayout.width : void 0 },
4833
- children: /* @__PURE__ */ jsx(ToolbarItem, {
4834
- ...child.item,
4835
- grid: true,
4836
- showLabel: (_child$gridLayout2 = child.gridLayout) === null || _child$gridLayout2 === void 0 ? void 0 : _child$gridLayout2.showLabel,
4837
- fullWidth: true,
4838
- overflow: true,
4839
- preserveStrokeWidth: true
4840
- })
4841
- }, child.key);
4842
- })
4904
+ children: (grid ? groupRibbonOverflowItems(group.children ?? [group]) : [group.children ?? [group]]).filter((items) => items.length > 0).map((items) => /* @__PURE__ */ jsx("div", {
4905
+ className: "univer-flex univer-max-w-full univer-flex-wrap univer-items-center univer-gap-1",
4906
+ children: items.map((child) => {
4907
+ var _child$gridLayout, _child$gridLayout2, _child$gridLayout3;
4908
+ return child.item && /* @__PURE__ */ jsx("div", {
4909
+ className: "univer-min-w-0 univer-max-w-full [&>span]:univer-block [&>span]:univer-h-full",
4910
+ style: { maxWidth: child.item.label && !child.item.icon ? ((_child$gridLayout = child.gridLayout) === null || _child$gridLayout === void 0 ? void 0 : _child$gridLayout.minWidth) ?? ((_child$gridLayout2 = child.gridLayout) === null || _child$gridLayout2 === void 0 ? void 0 : _child$gridLayout2.width) : void 0 },
4911
+ children: /* @__PURE__ */ jsx(ToolbarItem, {
4912
+ ...child.item,
4913
+ grid: true,
4914
+ showLabel: (_child$gridLayout3 = child.gridLayout) === null || _child$gridLayout3 === void 0 ? void 0 : _child$gridLayout3.showLabel,
4915
+ fullWidth: true,
4916
+ overflow: true,
4917
+ preserveStrokeWidth: true
4918
+ })
4919
+ }, child.key);
4920
+ })
4921
+ }, items[0].key))
4843
4922
  })]
4844
4923
  }, group.key))
4845
4924
  }) }),
@@ -4867,8 +4946,7 @@ function RibbonOverflow({ groups, grid = false }) {
4867
4946
  });
4868
4947
  }
4869
4948
 
4870
- //#endregion
4871
- //#region src/views/components/ribbon/RibbonGrid.tsx
4949
+ // src/views/components/ribbon/RibbonGrid.tsx
4872
4950
  function RibbonGrid({ groups, title, className, ...props }) {
4873
4951
  const localeService = useDependency(LocaleService);
4874
4952
  const containerRef = useRef(null);
@@ -4879,14 +4957,22 @@ function RibbonGrid({ groups, title, className, ...props }) {
4879
4957
  const container = containerRef.current;
4880
4958
  if (!container) return;
4881
4959
  const measure = () => {
4882
- var _moreRef$current;
4883
4960
  const style = getComputedStyle(container);
4884
- const availableWidth = container.clientWidth - Number.parseFloat(style.paddingLeft || "0") - Number.parseFloat(style.paddingRight || "0");
4885
- const widths = groups.map((group) => {
4886
- var _groupsRef$current$ge;
4887
- return ((_groupsRef$current$ge = groupsRef.current.get(group.key)) === null || _groupsRef$current$ge === void 0 ? void 0 : _groupsRef$current$ge.getBoundingClientRect().width) ?? 0;
4888
- });
4889
- const limit = widths.reduce((sum, width) => sum + width, 0) <= availableWidth ? availableWidth : availableWidth - (((_moreRef$current = moreRef.current) === null || _moreRef$current === void 0 ? void 0 : _moreRef$current.getBoundingClientRect().width) ?? 0);
4961
+ const availableWidth = Number.parseFloat(style.width) - [
4962
+ style.paddingLeft,
4963
+ style.paddingRight,
4964
+ style.borderLeftWidth,
4965
+ style.borderRightWidth
4966
+ ].reduce((sum, width) => sum + Number.parseFloat(width || "0"), 0);
4967
+ const getWidth = (element) => element ? Number.parseFloat(getComputedStyle(element).width) || 0 : 0;
4968
+ const getWidths = () => groups.map((group) => getWidth(groupsRef.current.get(group.key)));
4969
+ container.style.setProperty("--ribbon-grid-density", "0");
4970
+ let widths = getWidths();
4971
+ if (widths.reduce((sum, width) => sum + width, 0) > availableWidth) {
4972
+ container.style.setProperty("--ribbon-grid-density", "1");
4973
+ widths = getWidths();
4974
+ }
4975
+ const limit = widths.reduce((sum, width) => sum + width, 0) <= availableWidth ? availableWidth : availableWidth - getWidth(moreRef.current);
4890
4976
  let used = 0;
4891
4977
  let count = 0;
4892
4978
  for (const width of widths) {
@@ -4896,6 +4982,7 @@ function RibbonGrid({ groups, title, className, ...props }) {
4896
4982
  }
4897
4983
  setVisibleGroupCount(count);
4898
4984
  };
4985
+ measure();
4899
4986
  const observer = new ResizeObserver(measure);
4900
4987
  observer.observe(container);
4901
4988
  groupsRef.current.forEach((element) => observer.observe(element));
@@ -4923,16 +5010,18 @@ function RibbonGrid({ groups, title, className, ...props }) {
4923
5010
  "data-u-comp": "ribbon-grid-group",
4924
5011
  "data-group-key": group.key,
4925
5012
  "aria-hidden": index >= visibleGroupCount || void 0,
5013
+ style: { paddingInline: "calc(8px - 2px * var(--ribbon-grid-density, 0))" },
4926
5014
  className: clsx("univer-relative univer-box-border univer-flex univer-w-max univer-shrink-0 univer-flex-col univer-px-2", index >= visibleGroupCount && "univer-pointer-events-none univer-invisible univer-absolute"),
4927
5015
  children: [/* @__PURE__ */ jsx("div", {
4928
5016
  "data-testid": "ribbon-grid-group-grid",
4929
- className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-[repeat(2,1.5rem)] univer-content-center univer-gap-2 univer-py-2 [&>div>span>span]:univer-h-full",
5017
+ className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-[repeat(2,1.75rem)] univer-content-center univer-gap-y-0 univer-py-2 [&>div>span>span]:univer-h-full",
5018
+ style: { columnGap: "calc(8px - 4px * var(--ribbon-grid-density, 0))" },
4930
5019
  children: placements.map((placement) => placement.item.item && /* @__PURE__ */ jsx("div", {
4931
5020
  className: clsx("univer-flex univer-items-stretch [&>span>button]:univer-h-full [&>span]:univer-h-full", placement.width && "[&>span>span]:univer-w-full [&>span]:univer-w-full [&_[data-u-command]]:univer-w-full"),
4932
5021
  style: {
4933
5022
  gridRow: `${placement.row} / span ${placement.rowSpan}`,
4934
5023
  gridColumn: `${placement.column} / span ${placement.columnSpan}`,
4935
- width: placement.width
5024
+ width: placement.minWidth === void 0 ? placement.width : `calc(${placement.width}px - ${placement.width - placement.minWidth}px * var(--ribbon-grid-density, 0))`
4936
5025
  },
4937
5026
  children: /* @__PURE__ */ jsx(ToolbarItem, {
4938
5027
  ...placement.item.item,
@@ -4963,8 +5052,7 @@ function RibbonGrid({ groups, title, className, ...props }) {
4963
5052
  });
4964
5053
  }
4965
5054
 
4966
- //#endregion
4967
- //#region src/views/components/ribbon/Ribbon.tsx
5055
+ // src/views/components/ribbon/Ribbon.tsx
4968
5056
  function Ribbon(props) {
4969
5057
  const { ribbonType, headerMenuComponents, headerMenu = true, toolbarOnly = false, headerClassName } = props;
4970
5058
  const defaultRibbonService = useDependency(IRibbonService);
@@ -5211,8 +5299,7 @@ function RibbonOverrideConfigProvider(props) {
5211
5299
  });
5212
5300
  }
5213
5301
 
5214
- //#endregion
5215
- //#region src/services/theme-switcher/theme-switcher.service.ts
5302
+ // src/services/theme-switcher/theme-switcher.service.ts
5216
5303
  var ThemeSwitcherService = class extends Disposable {
5217
5304
  constructor(..._args) {
5218
5305
  super(..._args);
@@ -5245,8 +5332,7 @@ var ThemeSwitcherService = class extends Disposable {
5245
5332
  }
5246
5333
  };
5247
5334
 
5248
- //#endregion
5249
- //#region src/services/contextmenu/contextmenu.service.ts
5335
+ // src/services/contextmenu/contextmenu.service.ts
5250
5336
  const IContextMenuService = createIdentifier("ui.contextmenu.service");
5251
5337
  var ContextMenuService = class extends Disposable {
5252
5338
  constructor(..._args) {
@@ -5281,8 +5367,7 @@ var ContextMenuService = class extends Disposable {
5281
5367
  }
5282
5368
  };
5283
5369
 
5284
- //#endregion
5285
- //#region src/services/contextmenu/contextmenu-host.service.ts
5370
+ // src/services/contextmenu/contextmenu-host.service.ts
5286
5371
  const IContextMenuHostService = createIdentifier("ui.contextmenu.host.service");
5287
5372
  var ContextMenuHostService = class extends Disposable {
5288
5373
  constructor(..._args) {
@@ -5321,8 +5406,7 @@ var ContextMenuHostService = class extends Disposable {
5321
5406
  }
5322
5407
  };
5323
5408
 
5324
- //#endregion
5325
- //#region src/views/hooks/prevent-browser-zoom.ts
5409
+ // src/views/hooks/prevent-browser-zoom.ts
5326
5410
  /**
5327
5411
  * Copyright 2023-present DreamNum Co., Ltd.
5328
5412
  *
@@ -5367,8 +5451,7 @@ function preventBrowserZoomInContainers(containers) {
5367
5451
  };
5368
5452
  }
5369
5453
 
5370
- //#endregion
5371
- //#region src/views/menu/desktop/DesignTinyMenuGroup.tsx
5454
+ // src/views/menu/desktop/DesignTinyMenuGroup.tsx
5372
5455
  /**
5373
5456
  * Copyright 2023-present DreamNum Co., Ltd.
5374
5457
  *
@@ -5495,8 +5578,7 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
5495
5578
  });
5496
5579
  }
5497
5580
 
5498
- //#endregion
5499
- //#region src/views/menu/desktop/TinyMenuGroup.tsx
5581
+ // src/views/menu/desktop/TinyMenuGroup.tsx
5500
5582
  /**
5501
5583
  * Copyright 2023-present DreamNum Co., Ltd.
5502
5584
  *
@@ -5647,8 +5729,7 @@ function UIQuickTileMenuGroup(props) {
5647
5729
  });
5648
5730
  }
5649
5731
 
5650
- //#endregion
5651
- //#region src/views/components/context-menu/ContextMenuPanel.tsx
5732
+ // src/views/components/context-menu/ContextMenuPanel.tsx
5652
5733
  const menuViewportPadding = 8;
5653
5734
  const submenuOverlapOffset = 2;
5654
5735
  const submenuVisualGap = 20;
@@ -5746,7 +5827,7 @@ const contextMenuSubmenuPanelVariants = cva("univer-overflow-y-auto univer-overs
5746
5827
  } },
5747
5828
  defaultVariants: { sizeVariant: "default" }
5748
5829
  });
5749
- const contextMenuItemVariants = cva("univer-relative univer-flex univer-border-none univer-bg-transparent univer-text-left univer-text-gray-900 dark:!univer-text-gray-0", {
5830
+ const contextMenuItemVariants = cva("univer-relative univer-flex univer-border-none univer-bg-transparent univer-text-left univer-text-gray-900 rtl:!univer-text-right dark:!univer-text-gray-0", {
5750
5831
  variants: {
5751
5832
  sizeVariant: {
5752
5833
  default: "",
@@ -5759,7 +5840,11 @@ const contextMenuItemVariants = cva("univer-relative univer-flex univer-border-n
5759
5840
  },
5760
5841
  disabled: {
5761
5842
  true: "univer-cursor-not-allowed univer-opacity-60",
5762
- false: "univer-cursor-pointer focus:univer-bg-gray-50 focus:univer-outline-none dark:focus:!univer-bg-gray-600"
5843
+ false: "univer-cursor-pointer focus:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-inset focus-visible:univer-ring-primary-500"
5844
+ },
5845
+ submenuOpen: {
5846
+ true: "univer-bg-gray-50 dark:!univer-bg-gray-600",
5847
+ false: ""
5763
5848
  },
5764
5849
  hoverSuppressed: {
5765
5850
  true: "",
@@ -6084,7 +6169,7 @@ function ContextMenuPanel(props) {
6084
6169
  return /* @__PURE__ */ jsx("div", {
6085
6170
  ref: setMenuElement,
6086
6171
  tabIndex: -1,
6087
- className: clsx(getContextMenuPanelClassName(sizeVariant), borderClassName, scrollbarClassName, hoverSuppressed && "univer-context-menu-hover-suppressed", className),
6172
+ className: clsx(getContextMenuPanelClassName(sizeVariant), borderClassName, scrollbarClassName, hoverSuppressed && "[&_button:hover:not(:focus)]:!univer-bg-transparent", className),
6088
6173
  style: { maxHeight: maxMenuHeight },
6089
6174
  onKeyDown: handleKeyDown,
6090
6175
  onPointerMove: () => {
@@ -6114,6 +6199,7 @@ function ContextMenuMenu(props) {
6114
6199
  const localeService = useDependency(LocaleService);
6115
6200
  const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
6116
6201
  const [activeSubmenuKey, setActiveSubmenuKey] = useState(null);
6202
+ const pointerGraceRef = useRef(null);
6117
6203
  const visibleSchemas = useMemo(() => {
6118
6204
  return menuSchemas.filter((item) => {
6119
6205
  if (!hasRenderableContextMenuSchema(item)) return false;
@@ -6165,6 +6251,7 @@ function ContextMenuMenu(props) {
6165
6251
  rootMenuElement,
6166
6252
  activeSubmenuKey,
6167
6253
  setActiveSubmenuKey,
6254
+ pointerGraceRef,
6168
6255
  onOptionSelect,
6169
6256
  maxMenuHeight,
6170
6257
  hiddenItemIds,
@@ -6186,6 +6273,7 @@ function ContextMenuMenu(props) {
6186
6273
  rootMenuElement,
6187
6274
  activeSubmenuKey,
6188
6275
  setActiveSubmenuKey,
6276
+ pointerGraceRef,
6189
6277
  activeItemIds,
6190
6278
  hiddenItemIds,
6191
6279
  hoverSuppressed,
@@ -6208,6 +6296,7 @@ function ContextMenuMenu(props) {
6208
6296
  rootMenuElement,
6209
6297
  activeSubmenuKey,
6210
6298
  setActiveSubmenuKey,
6299
+ pointerGraceRef,
6211
6300
  activeItemIds,
6212
6301
  hiddenItemIds,
6213
6302
  hoverSuppressed,
@@ -6237,6 +6326,7 @@ function ContextMenuMenu(props) {
6237
6326
  rootMenuElement,
6238
6327
  activeSubmenuKey,
6239
6328
  setActiveSubmenuKey,
6329
+ pointerGraceRef,
6240
6330
  activeItemIds,
6241
6331
  hiddenItemIds,
6242
6332
  hoverSuppressed,
@@ -6252,7 +6342,7 @@ function ContextMenuMenu(props) {
6252
6342
  }
6253
6343
  }
6254
6344
  function ContextMenuMenuItem(props) {
6255
- const { menuKey, menuItem, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
6345
+ const { menuKey, menuItem, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, pointerGraceRef, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
6256
6346
  const localeService = useDependency(LocaleService);
6257
6347
  const direction = useObservable(localeService.direction$);
6258
6348
  const disabled = useObservable(menuItem.disabled$, false);
@@ -6273,6 +6363,7 @@ function ContextMenuMenuItem(props) {
6273
6363
  const menuButtonRef = useRef(null);
6274
6364
  const submenuElementRef = useRef(null);
6275
6365
  const submenuCloseTimerRef = useRef(null);
6366
+ const pendingHoverActionRef = useRef(null);
6276
6367
  const submenuId = useId();
6277
6368
  const selections = useMemo(() => {
6278
6369
  if (menuItem.type !== 1 && menuItem.type !== 2) return [];
@@ -6298,10 +6389,14 @@ function ContextMenuMenuItem(props) {
6298
6389
  const submenuVisible = hasSubmenu && activeSubmenuKey === menuKey;
6299
6390
  const selectionsCommandId = selectorItem.selectionsCommandId;
6300
6391
  const clearSubmenuCloseTimer = useCallback(() => {
6301
- if (submenuCloseTimerRef.current == null) return;
6302
- clearTimeout(submenuCloseTimerRef.current);
6303
- submenuCloseTimerRef.current = null;
6304
- }, []);
6392
+ var _pointerGraceRef$curr;
6393
+ if (submenuCloseTimerRef.current != null) {
6394
+ clearTimeout(submenuCloseTimerRef.current);
6395
+ submenuCloseTimerRef.current = null;
6396
+ }
6397
+ pendingHoverActionRef.current = null;
6398
+ if (((_pointerGraceRef$curr = pointerGraceRef.current) === null || _pointerGraceRef$curr === void 0 ? void 0 : _pointerGraceRef$curr.menuKey) === menuKey) pointerGraceRef.current = null;
6399
+ }, [menuKey, pointerGraceRef]);
6305
6400
  const closeSubmenu = useCallback(() => {
6306
6401
  clearSubmenuCloseTimer();
6307
6402
  setActiveSubmenuKey((currentKey) => currentKey === menuKey ? null : currentKey);
@@ -6314,8 +6409,10 @@ function ContextMenuMenuItem(props) {
6314
6409
  clearSubmenuCloseTimer();
6315
6410
  submenuCloseTimerRef.current = setTimeout(() => {
6316
6411
  var _submenuElementRef$cu;
6317
- submenuCloseTimerRef.current = null;
6318
- if (!((_submenuElementRef$cu = submenuElementRef.current) === null || _submenuElementRef$cu === void 0 ? void 0 : _submenuElementRef$cu.contains(document.activeElement))) closeSubmenu();
6412
+ const pendingHoverAction = pendingHoverActionRef.current;
6413
+ clearSubmenuCloseTimer();
6414
+ if (pendingHoverAction) pendingHoverAction();
6415
+ else if (!((_submenuElementRef$cu = submenuElementRef.current) === null || _submenuElementRef$cu === void 0 ? void 0 : _submenuElementRef$cu.contains(document.activeElement))) closeSubmenu();
6319
6416
  }, 500);
6320
6417
  }, [clearSubmenuCloseTimer, closeSubmenu]);
6321
6418
  useEffect(() => {
@@ -6323,8 +6420,12 @@ function ContextMenuMenuItem(props) {
6323
6420
  }, [value]);
6324
6421
  useEffect(() => () => clearSubmenuCloseTimer(), [clearSubmenuCloseTimer]);
6325
6422
  useEffect(() => {
6326
- if (disabled) closeSubmenu();
6327
- }, [closeSubmenu, disabled]);
6423
+ if (disabled || !submenuVisible) closeSubmenu();
6424
+ }, [
6425
+ closeSubmenu,
6426
+ disabled,
6427
+ submenuVisible
6428
+ ]);
6328
6429
  useEffect(() => {
6329
6430
  const submenuElement = submenuElementRef.current;
6330
6431
  if (!submenuVisible || !submenuElement) return;
@@ -6394,11 +6495,27 @@ function ContextMenuMenuItem(props) {
6394
6495
  clearSubmenuCloseTimer();
6395
6496
  setActiveSubmenuKey((currentKey) => currentKey === menuKey ? null : currentKey);
6396
6497
  };
6498
+ const onPointerHover = (event) => {
6499
+ if (hoverSuppressed || hasSubmenu && disabled) return;
6500
+ const applyHover = () => {
6501
+ clearSubmenuCloseTimer();
6502
+ setKeyboardSubmenuFocusRequested(false);
6503
+ setActiveSubmenuKey(hasSubmenu ? menuKey : null);
6504
+ };
6505
+ const pointerGrace = pointerGraceRef.current;
6506
+ if (pointerGrace && pointerGrace.menuKey !== menuKey && pointerGrace.contains(event)) {
6507
+ pointerGrace.deferHover(applyHover);
6508
+ return;
6509
+ }
6510
+ pointerGrace === null || pointerGrace === void 0 || pointerGrace.cancel();
6511
+ applyHover();
6512
+ };
6397
6513
  const itemClassName = contextMenuItemVariants({
6398
6514
  sizeVariant,
6399
6515
  variant: compact ? headerAction ? "compactHeaderAction" : "compact" : "default",
6400
6516
  disabled,
6401
- hoverSuppressed,
6517
+ hoverSuppressed: hoverSuppressed || activeSubmenuKey !== null && !submenuVisible,
6518
+ submenuOpen: submenuVisible,
6402
6519
  active: resolveMenuItemActiveState(menuItem.id, activated, activeItemIds)
6403
6520
  });
6404
6521
  const contentNode = /* @__PURE__ */ jsxs("span", {
@@ -6418,27 +6535,38 @@ function ContextMenuMenuItem(props) {
6418
6535
  return /* @__PURE__ */ jsxs("div", {
6419
6536
  ref: menuItemElementRef,
6420
6537
  className: "univer-relative",
6421
- onMouseEnter: () => {
6422
- clearSubmenuCloseTimer();
6423
- if (hasSubmenu && !disabled && !hoverSuppressed) {
6424
- setKeyboardSubmenuFocusRequested(false);
6425
- setSubmenuPositionReady(false);
6426
- setActiveSubmenuKey(menuKey);
6427
- return;
6428
- }
6429
- if (!hasSubmenu && !hoverSuppressed) setActiveSubmenuKey(null);
6430
- },
6538
+ onMouseEnter: onPointerHover,
6539
+ onMouseMove: onPointerHover,
6431
6540
  onMouseLeave: (event) => {
6432
- if (hasSubmenu) {
6433
- var _submenuElementRef$cu3, _submenuElementRef$cu4;
6541
+ if (submenuVisible) {
6542
+ var _submenuElementRef$cu3, _submenuElementRef$cu4, _submenuElementRef$cu5;
6434
6543
  if ((_submenuElementRef$cu3 = submenuElementRef.current) === null || _submenuElementRef$cu3 === void 0 ? void 0 : _submenuElementRef$cu3.contains(document.activeElement)) return;
6435
- const nextTarget = event.relatedTarget;
6544
+ const nextTarget = event.relatedTarget instanceof Node ? event.relatedTarget : null;
6436
6545
  if (nextTarget && ((_submenuElementRef$cu4 = submenuElementRef.current) === null || _submenuElementRef$cu4 === void 0 ? void 0 : _submenuElementRef$cu4.contains(nextTarget))) return;
6437
6546
  if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
6438
6547
  closeSubmenu();
6439
6548
  return;
6440
6549
  }
6441
6550
  scheduleSubmenuClose();
6551
+ const submenuRect = (_submenuElementRef$cu5 = submenuElementRef.current) === null || _submenuElementRef$cu5 === void 0 || (_submenuElementRef$cu5 = _submenuElementRef$cu5.firstElementChild) === null || _submenuElementRef$cu5 === void 0 ? void 0 : _submenuElementRef$cu5.getBoundingClientRect();
6552
+ if (submenuRect) {
6553
+ const { clientX: originX, clientY: originY } = event;
6554
+ const edgeX = submenuPlacement === "right" ? submenuRect.left : submenuRect.right;
6555
+ pointerGraceRef.current = {
6556
+ menuKey,
6557
+ contains: ({ clientX, clientY }) => {
6558
+ const progress = (clientX - originX) / (edgeX - originX);
6559
+ return progress >= 0 && progress <= 1 && clientY >= originY + (submenuRect.top - originY) * progress && clientY <= originY + (submenuRect.bottom - originY) * progress;
6560
+ },
6561
+ deferHover: (action) => {
6562
+ pendingHoverActionRef.current = action;
6563
+ },
6564
+ cancel: clearSubmenuCloseTimer
6565
+ };
6566
+ }
6567
+ } else {
6568
+ var _pointerGraceRef$curr2;
6569
+ (_pointerGraceRef$curr2 = pointerGraceRef.current) === null || _pointerGraceRef$curr2 === void 0 || _pointerGraceRef$curr2.deferHover(null);
6442
6570
  }
6443
6571
  },
6444
6572
  children: [renderAsContainer ? /* @__PURE__ */ jsxs("div", {
@@ -6459,21 +6587,23 @@ function ContextMenuMenuItem(props) {
6459
6587
  "aria-expanded": hasSubmenu ? submenuVisible : void 0,
6460
6588
  "aria-controls": hasSubmenu ? submenuId : void 0,
6461
6589
  onKeyDown: (event) => {
6590
+ var _pointerGraceRef$curr3;
6462
6591
  const openDirection = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
6463
6592
  if (!hasSubmenu || event.key !== openDirection) return;
6464
6593
  event.preventDefault();
6465
6594
  event.stopPropagation();
6595
+ (_pointerGraceRef$curr3 = pointerGraceRef.current) === null || _pointerGraceRef$curr3 === void 0 || _pointerGraceRef$curr3.cancel();
6466
6596
  clearSubmenuCloseTimer();
6467
6597
  setKeyboardSubmenuFocusRequested(true);
6468
- setSubmenuPositionReady(false);
6469
6598
  setActiveSubmenuKey(menuKey);
6470
6599
  },
6471
6600
  onClick: (event) => {
6601
+ var _pointerGraceRef$curr4;
6602
+ (_pointerGraceRef$curr4 = pointerGraceRef.current) === null || _pointerGraceRef$curr4 === void 0 || _pointerGraceRef$curr4.cancel();
6472
6603
  clearSubmenuCloseTimer();
6473
6604
  if (hasSubmenu) {
6474
6605
  if (headerAction) {
6475
6606
  setKeyboardSubmenuFocusRequested(event.detail === 0);
6476
- setSubmenuPositionReady(false);
6477
6607
  setActiveSubmenuKey(menuKey);
6478
6608
  return;
6479
6609
  }
@@ -6489,7 +6619,6 @@ function ContextMenuMenuItem(props) {
6489
6619
  return;
6490
6620
  }
6491
6621
  setKeyboardSubmenuFocusRequested(event.detail === 0);
6492
- setSubmenuPositionReady(false);
6493
6622
  setActiveSubmenuKey(menuKey);
6494
6623
  return;
6495
6624
  }
@@ -6529,9 +6658,9 @@ function ContextMenuMenuItem(props) {
6529
6658
  onMenuPointerEnter === null || onMenuPointerEnter === void 0 || onMenuPointerEnter();
6530
6659
  },
6531
6660
  onMouseLeave: (event) => {
6532
- var _submenuElementRef$cu5, _menuItemElementRef$c;
6533
- if ((_submenuElementRef$cu5 = submenuElementRef.current) === null || _submenuElementRef$cu5 === void 0 ? void 0 : _submenuElementRef$cu5.contains(document.activeElement)) return;
6534
- const nextTarget = event.relatedTarget;
6661
+ var _submenuElementRef$cu6, _menuItemElementRef$c;
6662
+ if ((_submenuElementRef$cu6 = submenuElementRef.current) === null || _submenuElementRef$cu6 === void 0 ? void 0 : _submenuElementRef$cu6.contains(document.activeElement)) return;
6663
+ const nextTarget = event.relatedTarget instanceof Node ? event.relatedTarget : null;
6535
6664
  if (nextTarget && ((_menuItemElementRef$c = menuItemElementRef.current) === null || _menuItemElementRef$c === void 0 ? void 0 : _menuItemElementRef$c.contains(nextTarget))) return;
6536
6665
  if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
6537
6666
  closeSubmenu();
@@ -6560,7 +6689,7 @@ function ContextMenuMenuItem(props) {
6560
6689
  const optionSelected = typeof inputValue !== "undefined" && String(inputValue) === String(option.value);
6561
6690
  const optionSelectable = !isNonSelectableLabel(option.label);
6562
6691
  const optionHoverable = !isNonHoverableLabel(option.label);
6563
- const optionClassName = clsx("univer-text-gray-900 dark:!univer-text-gray-0", optionSelectable ? sizeVariant === "paragraph-t" ? "univer-relative univer-box-border univer-flex univer-min-h-10 univer-w-full univer-items-center univer-rounded-lg univer-border-none univer-bg-transparent univer-px-3 univer-text-left univer-text-base" : "univer-relative univer-box-border univer-flex univer-min-h-8 univer-w-full univer-items-center univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm" : "univer-relative univer-box-border univer-block univer-w-full univer-border-none univer-bg-transparent univer-p-0", option.disabled ? "univer-cursor-not-allowed univer-opacity-60" : optionHoverable && "univer-cursor-pointer hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-600");
6692
+ const optionClassName = clsx("univer-text-gray-900 dark:!univer-text-gray-0", optionSelectable ? sizeVariant === "paragraph-t" ? "univer-relative univer-box-border univer-flex univer-min-h-10 univer-w-full univer-items-center univer-rounded-lg univer-border-none univer-bg-transparent univer-px-3 univer-text-left univer-text-base rtl:!univer-text-right" : "univer-relative univer-box-border univer-flex univer-min-h-8 univer-w-full univer-items-center univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm rtl:!univer-text-right" : "univer-relative univer-box-border univer-block univer-w-full univer-border-none univer-bg-transparent univer-p-0", option.disabled ? "univer-cursor-not-allowed univer-opacity-60" : optionHoverable && "univer-cursor-pointer hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-600");
6564
6693
  const optionContentNode = /* @__PURE__ */ jsxs(Fragment$1, { children: [optionSelectable && optionSelected && /* @__PURE__ */ jsx(CheckMarkIcon, { className: clsx("univer-absolute univer-left-0 univer-text-primary-600", sizeVariant === "paragraph-t" ? "univer-size-5" : "univer-size-4") }), /* @__PURE__ */ jsx("span", {
6565
6694
  className: clsx(getContextMenuContentClassName(sizeVariant), optionSelectable && optionSelected && "univer-pl-4"),
6566
6695
  children: /* @__PURE__ */ jsx(CustomLabel, {
@@ -6635,8 +6764,7 @@ function useContextGroupHiddenStates$1(menuSchemas) {
6635
6764
  return useObservable(hiddenStates$, {});
6636
6765
  }
6637
6766
 
6638
- //#endregion
6639
- //#region src/views/components/context-menu/AnchoredContextMenu.tsx
6767
+ // src/views/components/context-menu/AnchoredContextMenu.tsx
6640
6768
  function AnchoredContextMenu(props) {
6641
6769
  const { hostId, visible, anchorRect, menuType, anchorVertical = "bottom", autoFocus, menuOffset = 0, menuManagerService, layoutService, onRequestClose, onOptionSelect } = props;
6642
6770
  const contentRef = useRef(null);
@@ -6751,8 +6879,7 @@ function AnchoredContextMenu(props) {
6751
6879
  });
6752
6880
  }
6753
6881
 
6754
- //#endregion
6755
- //#region src/views/components/context-menu/ContextMenu.tsx
6882
+ // src/views/components/context-menu/ContextMenu.tsx
6756
6883
  const DESKTOP_CONTEXT_MENU_HOST_ID = "desktop-context-menu";
6757
6884
  function DesktopContextMenu() {
6758
6885
  const [visible, setVisible] = useState(false);
@@ -6821,8 +6948,7 @@ function DesktopContextMenu() {
6821
6948
  });
6822
6949
  }
6823
6950
 
6824
- //#endregion
6825
- //#region src/views/components/sidebar/Sidebar.tsx
6951
+ // src/views/components/sidebar/Sidebar.tsx
6826
6952
  function renderSidebarOptions(options) {
6827
6953
  if (!options) return null;
6828
6954
  const { children, footer, header, ...rest } = options;
@@ -7009,8 +7135,7 @@ function Sidebar() {
7009
7135
  });
7010
7136
  }
7011
7137
 
7012
- //#endregion
7013
- //#region src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
7138
+ // src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
7014
7139
  function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
7015
7140
  const shimmerClassName = `
7016
7141
  univer-animate-pulse univer-bg-gray-100 motion-reduce:univer-animate-none
@@ -7098,8 +7223,7 @@ function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
7098
7223
  });
7099
7224
  }
7100
7225
 
7101
- //#endregion
7102
- //#region src/views/hooks/layout.ts
7226
+ // src/views/hooks/layout.ts
7103
7227
  /**
7104
7228
  * These hooks are used for browser layout
7105
7229
  * Prefer to client-side
@@ -7144,8 +7268,7 @@ function useConfigValue(configKey) {
7144
7268
  return useObservable(useMemo(() => configService.subscribeConfigValue$(configKey), [configService]), configService.getConfig(configKey));
7145
7269
  }
7146
7270
 
7147
- //#endregion
7148
- //#region src/views/hooks/update-effect.ts
7271
+ // src/views/hooks/update-effect.ts
7149
7272
  /**
7150
7273
  * Copyright 2023-present DreamNum Co., Ltd.
7151
7274
  *
@@ -7169,8 +7292,7 @@ const useUpdateEffect = (effect, deps) => {
7169
7292
  }, deps);
7170
7293
  };
7171
7294
 
7172
- //#endregion
7173
- //#region src/views/hooks/use-click-out-side.ts
7295
+ // src/views/hooks/use-click-out-side.ts
7174
7296
  function useClickOutSide(ref, opts) {
7175
7297
  const handler = useEvent(opts.handler);
7176
7298
  useEffect(() => {
@@ -7184,8 +7306,7 @@ function useClickOutSide(ref, opts) {
7184
7306
  }, [handler, ref]);
7185
7307
  }
7186
7308
 
7187
- //#endregion
7188
- //#region src/views/hooks/use-debounce.ts
7309
+ // src/views/hooks/use-debounce.ts
7189
7310
  /**
7190
7311
  * Copyright 2023-present DreamNum Co., Ltd.
7191
7312
  *
@@ -7211,8 +7332,7 @@ function useDebounceFn(fn, delay = 300) {
7211
7332
  }, [fn, delay]);
7212
7333
  }
7213
7334
 
7214
- //#endregion
7215
- //#region src/views/hooks/virtual-list.ts
7335
+ // src/views/hooks/virtual-list.ts
7216
7336
  const isNumber = (value) => typeof value === "number";
7217
7337
  function useLatest(value) {
7218
7338
  const ref = useRef(value);
@@ -7342,8 +7462,7 @@ const useVirtualList = (list, options) => {
7342
7462
  }];
7343
7463
  };
7344
7464
 
7345
- //#endregion
7346
- //#region src/views/workbench/Workbench.tsx
7465
+ // src/views/workbench/Workbench.tsx
7347
7466
  function DesktopWorkbench(props) {
7348
7467
  const uiConfig = useConfigValue(UI_PLUGIN_CONFIG_KEY);
7349
7468
  return /* @__PURE__ */ jsx(DesktopWorkbenchContent, {
@@ -7492,8 +7611,7 @@ function FloatingContainer() {
7492
7611
  return createPortal(/* @__PURE__ */ jsx(ComponentContainer, { components: floatingComponents }, "floating"), mountContainer);
7493
7612
  }
7494
7613
 
7495
- //#endregion
7496
- //#region src/controllers/ui/ui-shared.controller.ts
7614
+ // src/controllers/ui/ui-shared.controller.ts
7497
7615
  const STEADY_TIMEOUT = 3e3;
7498
7616
  /**
7499
7617
  * @ignore
@@ -7575,8 +7693,7 @@ var SingleUnitUIController = class extends Disposable {
7575
7693
  }
7576
7694
  };
7577
7695
 
7578
- //#endregion
7579
- //#region src/controllers/ui/ui-desktop.controller.ts
7696
+ // src/controllers/ui/ui-desktop.controller.ts
7580
7697
  let DesktopUIController = class DesktopUIController extends SingleUnitUIController {
7581
7698
  constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService) {
7582
7699
  super(injector, instanceService, layoutService, lifecycleService, renderManagerService);
@@ -7630,17 +7747,14 @@ function createContainer$1(id) {
7630
7747
  return element;
7631
7748
  }
7632
7749
 
7633
- //#endregion
7634
- //#region src/controllers/ui/ui.controller.ts
7750
+ // src/controllers/ui/ui.controller.ts
7635
7751
  const IUIController = createIdentifier("univer.ui.ui-controller");
7636
7752
 
7637
- //#endregion
7638
- //#region package.json
7753
+ // package.json
7639
7754
  var name = "@univerjs/ui";
7640
- var version = "1.3.0";
7755
+ var version = "1.4.0";
7641
7756
 
7642
- //#endregion
7643
- //#region src/views/color-picker/interface.ts
7757
+ // src/views/color-picker/interface.ts
7644
7758
  /**
7645
7759
  * Copyright 2023-present DreamNum Co., Ltd.
7646
7760
  *
@@ -7658,8 +7772,7 @@ var version = "1.3.0";
7658
7772
  */
7659
7773
  const COLOR_PICKER_COMPONENT = "UI_COLOR_PICKER_COMPONENT";
7660
7774
 
7661
- //#endregion
7662
- //#region src/views/CommonLabel.tsx
7775
+ // src/views/CommonLabel.tsx
7663
7776
  /**
7664
7777
  * Copyright 2023-present DreamNum Co., Ltd.
7665
7778
  *
@@ -7690,8 +7803,7 @@ const CommonLabel = (props) => {
7690
7803
  };
7691
7804
  const COMMON_LABEL_COMPONENT = "UI_PLUGIN_COMMON_LABEL_COMPONENT";
7692
7805
 
7693
- //#endregion
7694
- //#region src/views/emoji-picker/emojis.generated.ts
7806
+ // src/views/emoji-picker/emojis.generated.ts
7695
7807
  const emojis = {
7696
7808
  "frequent": [
7697
7809
  {
@@ -23111,8 +23223,7 @@ const emojis = {
23111
23223
  ]
23112
23224
  };
23113
23225
 
23114
- //#endregion
23115
- //#region src/views/emoji-picker/emoji-picker-utils.ts
23226
+ // src/views/emoji-picker/emoji-picker-utils.ts
23116
23227
  const EMOJI_SKIN_TONES = [
23117
23228
  "",
23118
23229
  "🏻",
@@ -23277,8 +23388,7 @@ function getEmojiFamilies() {
23277
23388
  return EMOJI_CATEGORIES.flatMap((category) => emojis[category.key]);
23278
23389
  }
23279
23390
 
23280
- //#endregion
23281
- //#region src/views/emoji-picker/EmojiPicker.tsx
23391
+ // src/views/emoji-picker/EmojiPicker.tsx
23282
23392
  const EMOJI_PICKER_COMPONENT = "ui.emoji-picker";
23283
23393
  const RECENTS_STORAGE_KEY = "univer.ui.recent-emojis";
23284
23394
  const SKIN_TONE_STORAGE_KEY = "univer.ui.emoji-skin-tone";
@@ -23670,8 +23780,7 @@ function CategoryIcon(props) {
23670
23780
  }
23671
23781
  }
23672
23782
 
23673
- //#endregion
23674
- //#region src/views/emoji-picker/MobileEmojiPicker.tsx
23783
+ // src/views/emoji-picker/MobileEmojiPicker.tsx
23675
23784
  function MobileEmojiPicker(props) {
23676
23785
  return /* @__PURE__ */ jsx(EmojiPicker, {
23677
23786
  ...props,
@@ -23679,10 +23788,9 @@ function MobileEmojiPicker(props) {
23679
23788
  });
23680
23789
  }
23681
23790
 
23682
- //#endregion
23683
- //#region src/views/font-family/FontFamily.tsx
23791
+ // src/views/font-family/FontFamily.tsx
23684
23792
  const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
23685
- const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange }) => {
23793
+ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange, ariaLabel }) => {
23686
23794
  const disabledObservableValue = useObservable(disabled$);
23687
23795
  const disabled = Boolean(disabledProp || disabledObservableValue);
23688
23796
  const localeService = useDependency(LocaleService);
@@ -23742,7 +23850,8 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
23742
23850
  className: clsx("univer-w-32 univer-truncate univer-text-sm", className),
23743
23851
  style: { fontFamily: value },
23744
23852
  children: /* @__PURE__ */ jsx("input", {
23745
- className: "univer-block univer-h-6 univer-border-none univer-bg-transparent univer-leading-6 univer-text-gray-900 focus:univer-outline-none dark:!univer-text-gray-0 [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-7 [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-p-0 [&_input]:univer-text-sm",
23853
+ "aria-label": ariaLabel,
23854
+ className: "univer-block univer-h-6 univer-w-full univer-min-w-0 univer-border-none univer-bg-transparent univer-leading-6 univer-text-gray-900 focus:univer-outline-none dark:!univer-text-gray-0 [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-7 [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-p-0 [&_input]:univer-text-sm",
23746
23855
  type: "text",
23747
23856
  value: inputValue,
23748
23857
  onPointerDown: (event) => event.stopPropagation(),
@@ -23754,10 +23863,9 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
23754
23863
  });
23755
23864
  };
23756
23865
 
23757
- //#endregion
23758
- //#region src/views/font-size/FontSize.tsx
23866
+ // src/views/font-size/FontSize.tsx
23759
23867
  const FontSize = (props) => {
23760
- const { value, min, max, onChange, disabled$ } = props;
23868
+ const { value, min, max, onChange, disabled$, ariaLabel } = props;
23761
23869
  const disabled = useObservable(disabled$);
23762
23870
  const [draft, setDraft] = useState(null);
23763
23871
  const inputValue = draft !== null && draft.source === value ? draft.value : Number(value ?? 0);
@@ -23786,6 +23894,7 @@ const FontSize = (props) => {
23786
23894
  className: "univer-h-6 univer-w-7 univer-text-sm",
23787
23895
  onPointerDown: (event) => event.stopPropagation(),
23788
23896
  children: /* @__PURE__ */ jsx(InputNumber, {
23897
+ "aria-label": ariaLabel,
23789
23898
  className: "univer-block univer-h-6 univer-border-none univer-bg-transparent univer-leading-6 [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-7 [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-p-0 [&_input]:univer-text-sm",
23790
23899
  value: inputValue,
23791
23900
  controls: false,
@@ -23797,8 +23906,7 @@ const FontSize = (props) => {
23797
23906
  });
23798
23907
  };
23799
23908
 
23800
- //#endregion
23801
- //#region src/views/font-size/interface.ts
23909
+ // src/views/font-size/interface.ts
23802
23910
  const FONT_SIZE_LIST = [
23803
23911
  {
23804
23912
  label: "9",
@@ -23897,8 +24005,7 @@ const HEADING_LIST = [
23897
24005
  ];
23898
24006
  const FONT_SIZE_COMPONENT = "UI_FONT_SIZE_COMPONENT";
23899
24007
 
23900
- //#endregion
23901
- //#region src/views/HeadingItem.tsx
24008
+ // src/views/HeadingItem.tsx
23902
24009
  const HeadingItem = (props) => {
23903
24010
  var _style$cl;
23904
24011
  const { value, text } = props;
@@ -23915,8 +24022,7 @@ const HeadingItem = (props) => {
23915
24022
  };
23916
24023
  const HEADING_ITEM_COMPONENT = "UI_COMPONENT_HEADING_ITEM";
23917
24024
 
23918
- //#endregion
23919
- //#region src/views/symbol-picker/symbols.ts
24025
+ // src/views/symbol-picker/symbols.ts
23920
24026
  const SYMBOL_CATEGORIES = [
23921
24027
  {
23922
24028
  key: "mathematics",
@@ -24088,8 +24194,7 @@ const SYMBOL_CATEGORIES = [
24088
24194
  }
24089
24195
  ];
24090
24196
 
24091
- //#endregion
24092
- //#region src/views/symbol-picker/SymbolPicker.tsx
24197
+ // src/views/symbol-picker/SymbolPicker.tsx
24093
24198
  const SYMBOL_PICKER_COMPONENT = "ui.symbol-picker";
24094
24199
  function SymbolPicker(props) {
24095
24200
  var _props$popup;
@@ -24144,8 +24249,7 @@ function SymbolSection(props) {
24144
24249
  });
24145
24250
  }
24146
24251
 
24147
- //#endregion
24148
- //#region src/controllers/mobile/components.controller.ts
24252
+ // src/controllers/mobile/components.controller.ts
24149
24253
  /**
24150
24254
  * Copyright 2023-present DreamNum Co., Ltd.
24151
24255
  *
@@ -24198,8 +24302,7 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
24198
24302
  };
24199
24303
  MobileComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], MobileComponentsController);
24200
24304
 
24201
- //#endregion
24202
- //#region src/menu/mobile-schema.ts
24305
+ // src/menu/mobile-schema.ts
24203
24306
  const mobileMenuSchema = { ["ribbon.start.history"]: {
24204
24307
  [UndoCommand.id]: {
24205
24308
  order: 0,
@@ -24221,8 +24324,7 @@ const mobileMenuSchema = { ["ribbon.start.history"]: {
24221
24324
  }
24222
24325
  } };
24223
24326
 
24224
- //#endregion
24225
- //#region src/views/components/ribbon/MobileToolbarItem.tsx
24327
+ // src/views/components/ribbon/MobileToolbarItem.tsx
24226
24328
  const MobileToolbarItem = forwardRef((props, ref) => /* @__PURE__ */ jsx(ToolbarItem, {
24227
24329
  ...props,
24228
24330
  ref,
@@ -24233,8 +24335,7 @@ const MobileToolbarItem = forwardRef((props, ref) => /* @__PURE__ */ jsx(Toolbar
24233
24335
  dropdownMenuComponent: MobileDropdownMenu
24234
24336
  }));
24235
24337
 
24236
- //#endregion
24237
- //#region src/views/components/ribbon/MobileRibbon.tsx
24338
+ // src/views/components/ribbon/MobileRibbon.tsx
24238
24339
  const toolbarScrollOffset = 168;
24239
24340
  function MobileRibbon(props) {
24240
24341
  const { headerMenuComponents, headerMenu = true } = props;
@@ -24500,8 +24601,7 @@ function MobileCompactTopBar(props) {
24500
24601
  }), moreMenu] });
24501
24602
  }
24502
24603
 
24503
- //#endregion
24504
- //#region src/views/menu/mobile/MobileMenu.tsx
24604
+ // src/views/menu/mobile/MobileMenu.tsx
24505
24605
  function MobileMenu(props) {
24506
24606
  var _props$schemas;
24507
24607
  const schemaKey = ((_props$schemas = props.schemas) === null || _props$schemas === void 0 ? void 0 : _props$schemas.map((schema) => schema.key).join("|")) ?? "";
@@ -25073,8 +25173,7 @@ function getLeafItemSchemas(schemas) {
25073
25173
  }, []);
25074
25174
  }
25075
25175
 
25076
- //#endregion
25077
- //#region src/views/mobile-workbench/MobileCanvasLayout.tsx
25176
+ // src/views/mobile-workbench/MobileCanvasLayout.tsx
25078
25177
  const MobileCanvasLayoutContext = createContext(null);
25079
25178
  function MobileCanvasLayoutProvider({ children }) {
25080
25179
  const [panels, setPanels] = useState([]);
@@ -25247,8 +25346,7 @@ function useMobileCanvasViewport(options) {
25247
25346
  ]);
25248
25347
  }
25249
25348
 
25250
- //#endregion
25251
- //#region src/views/components/mobile-drawer/MobileDrawerCoordinator.tsx
25349
+ // src/views/components/mobile-drawer/MobileDrawerCoordinator.tsx
25252
25350
  const MobileDrawerCoordinatorContext = createContext(null);
25253
25351
  function MobileDrawerCoordinatorProvider(props) {
25254
25352
  const entriesRef = useRef([]);
@@ -25296,14 +25394,14 @@ function MobileDrawerCoordinatorProvider(props) {
25296
25394
  });
25297
25395
  }
25298
25396
 
25299
- //#endregion
25300
- //#region src/views/components/mobile-drawer/MobileDrawer.tsx
25397
+ // src/views/components/mobile-drawer/MobileDrawer.tsx
25301
25398
  function assignDrawerRef(ref, element) {
25302
25399
  if (typeof ref === "function") ref(element);
25303
25400
  else if (ref) ref.current = element;
25304
25401
  }
25305
25402
  const MOBILE_DRAWER_COMPACT_PERCENT = 40;
25306
25403
  const MOBILE_DRAWER_EXPANDED_PERCENT = 80;
25404
+ const MOBILE_DIALOG_MAX_PERCENT = 60;
25307
25405
  const MobileDrawerLayoutContext = createContext("modal");
25308
25406
  function resolveMobileDrawerRelease(params) {
25309
25407
  const { snap, deltaY, durationMs, percent } = params;
@@ -25315,7 +25413,7 @@ function resolveMobileDrawerRelease(params) {
25315
25413
  }
25316
25414
  function MobileDrawer(props) {
25317
25415
  var _globalThis$CSS;
25318
- const { snap, expandLabel, collapseLabel, onSnapChange, onClose, children, header, floatingActions, componentName = "mobile-drawer", panelRef, contentRef, layerRef, openMode = "replace", panelClassName, contentClassName, footer, role, ariaLabel, layout: requestedLayout } = props;
25416
+ const { snap, expandLabel, collapseLabel, onSnapChange, onClose, children, header, floatingActions, componentName = "mobile-drawer", panelRef, contentRef, layerRef, openMode = "replace", panelClassName, contentClassName, footer, role, ariaLabel, layout: requestedLayout, autoHeight = false } = props;
25319
25417
  const coordinator = useContext(MobileDrawerCoordinatorContext);
25320
25418
  const registerDrawer = coordinator === null || coordinator === void 0 ? void 0 : coordinator.register;
25321
25419
  const unregisterDrawer = coordinator === null || coordinator === void 0 ? void 0 : coordinator.unregister;
@@ -25358,6 +25456,7 @@ function MobileDrawer(props) {
25358
25456
  const dragRef = useRef(null);
25359
25457
  const drawerPercent = dragPercent ?? (snap === "compact" ? MOBILE_DRAWER_COMPACT_PERCENT : MOBILE_DRAWER_EXPANDED_PERCENT);
25360
25458
  const keyboardLayout = useMobileKeyboardViewportLayout(panelElementRef);
25459
+ const contentMaxHeight = keyboardLayout ? `min(${MOBILE_DIALOG_MAX_PERCENT}${viewportHeightUnit}, ${keyboardLayout.availableHeight}px)` : `${MOBILE_DIALOG_MAX_PERCENT}${viewportHeightUnit}`;
25361
25460
  useLayoutEffect(() => {
25362
25461
  if (!registerDrawer || !unregisterDrawer) return;
25363
25462
  registerDrawer(drawerId, openMode, () => onCloseRef.current());
@@ -25465,13 +25564,15 @@ function MobileDrawer(props) {
25465
25564
  "data-snap": snap,
25466
25565
  className: clsx("univer-absolute univer-inset-x-0 univer-bottom-0 univer-z-20 univer-flex univer-flex-col univer-overflow-hidden univer-rounded-t-[24px] univer-bg-gray-50 univer-shadow-2xl univer-transition-[height] univer-duration-200 dark:!univer-bg-gray-900 [&_input]:!univer-text-base [&_select]:!univer-text-base [&_textarea]:!univer-text-base", "univer-pointer-events-auto", dragPercent != null && "!univer-transition-none", panelClassName),
25467
25566
  style: {
25468
- height: `${drawerPercent}${viewportHeightUnit}`,
25567
+ height: autoHeight ? "auto" : `${drawerPercent}${viewportHeightUnit}`,
25568
+ maxHeight: autoHeight ? contentMaxHeight : void 0,
25569
+ bottom: autoHeight ? keyboardLayout === null || keyboardLayout === void 0 ? void 0 : keyboardLayout.bottom : void 0,
25469
25570
  paddingBottom: "env(safe-area-inset-bottom, 0px)"
25470
25571
  },
25471
25572
  children: [
25472
25573
  /* @__PURE__ */ jsxs("div", {
25473
- className: "univer-relative univer-flex univer-h-14 univer-shrink-0 univer-items-end univer-bg-gray-0 dark:!univer-bg-gray-800",
25474
- children: [/* @__PURE__ */ jsx("button", {
25574
+ className: clsx("univer-relative univer-flex univer-shrink-0 univer-items-end univer-bg-gray-0 dark:!univer-bg-gray-800", autoHeight ? "univer-h-12" : "univer-h-14"),
25575
+ children: [!autoHeight && /* @__PURE__ */ jsx("button", {
25475
25576
  type: "button",
25476
25577
  "aria-label": snap === "compact" ? expandLabel : collapseLabel,
25477
25578
  className: clsx(resetButtonClassName, "univer-absolute univer-left-1/2 univer-top-0 univer-z-10 univer-flex univer-h-6 univer-w-16 -univer-translate-x-1/2 univer-touch-none univer-items-center univer-justify-center"),
@@ -25496,8 +25597,8 @@ function MobileDrawer(props) {
25496
25597
  }),
25497
25598
  /* @__PURE__ */ jsx("div", {
25498
25599
  ref: contentRef,
25499
- className: clsx("univer-flex-1 univer-overflow-y-auto univer-overflow-x-hidden univer-p-3", scrollbarClassName, contentClassName),
25500
- style: { paddingBottom: keyboardLayout ? `calc(0.75rem + ${keyboardLayout.bottom}px)` : void 0 },
25600
+ className: clsx("univer-overflow-y-auto univer-overflow-x-hidden univer-p-3", autoHeight ? "univer-min-h-0 univer-flex-initial" : "univer-flex-1", scrollbarClassName, contentClassName),
25601
+ style: { paddingBottom: !autoHeight && keyboardLayout ? `calc(0.75rem + ${keyboardLayout.bottom}px)` : void 0 },
25501
25602
  children
25502
25603
  }),
25503
25604
  footer
@@ -25507,8 +25608,7 @@ function MobileDrawer(props) {
25507
25608
  });
25508
25609
  }
25509
25610
 
25510
- //#endregion
25511
- //#region src/views/menu/mobile/MobileMenuDrawer.tsx
25611
+ // src/views/menu/mobile/MobileMenuDrawer.tsx
25512
25612
  function MobileMenuDrawer(props) {
25513
25613
  if (!props.visible) return null;
25514
25614
  return /* @__PURE__ */ jsx(MobileMenuDrawerContent, { ...props });
@@ -25581,8 +25681,7 @@ function MobileMenuDrawerContent(props) {
25581
25681
  }), mountContainer);
25582
25682
  }
25583
25683
 
25584
- //#endregion
25585
- //#region src/views/components/context-menu/MobileContextMenu.tsx
25684
+ // src/views/components/context-menu/MobileContextMenu.tsx
25586
25685
  const MOBILE_CONTEXT_MENU_HOST_ID = "mobile-context-menu";
25587
25686
  const MOBILE_CONTEXT_MENU_POINTER_SIZE = 8;
25588
25687
  const MOBILE_CONTEXT_MENU_POINTER_EDGE_GAP = 12;
@@ -25769,8 +25868,7 @@ function MobileContextMenu() {
25769
25868
  });
25770
25869
  }
25771
25870
 
25772
- //#endregion
25773
- //#region src/views/components/sidebar/MobileSidebar.tsx
25871
+ // src/views/components/sidebar/MobileSidebar.tsx
25774
25872
  function MobileSidebar() {
25775
25873
  const localeService = useDependency(LocaleService);
25776
25874
  const sidebarService = useDependency(ISidebarService);
@@ -25852,8 +25950,7 @@ function MobileSidebar() {
25852
25950
  });
25853
25951
  }
25854
25952
 
25855
- //#endregion
25856
- //#region src/views/mobile-workbench/mobile-keyboard-inset-context.ts
25953
+ // src/views/mobile-workbench/mobile-keyboard-inset-context.ts
25857
25954
  /**
25858
25955
  * Copyright 2023-present DreamNum Co., Ltd.
25859
25956
  *
@@ -25871,8 +25968,7 @@ function MobileSidebar() {
25871
25968
  */
25872
25969
  const MobileKeyboardInsetContext = createContext(0);
25873
25970
 
25874
- //#endregion
25875
- //#region src/views/mobile-workbench/MobileWorkbench.tsx
25971
+ // src/views/mobile-workbench/MobileWorkbench.tsx
25876
25972
  const MOBILE_KEYBOARD_THRESHOLD = 80;
25877
25973
  function resolveMobileKeyboardInset(stableHeight, visibleBottom, baselineInset) {
25878
25974
  const keyboardInset = Math.max(0, Math.round(stableHeight - visibleBottom) - baselineInset);
@@ -25908,15 +26004,15 @@ function MobileWorkbench(props) {
25908
26004
  const leftSidebarComponents = useComponentsOfPart("left-sidebar");
25909
26005
  const globalComponents = useComponentsOfPart("global");
25910
26006
  const toolbarComponents = useComponentsOfPart("toolbar");
25911
- const darkMode = useObservable$1(themeService.darkMode$, themeService.darkMode);
25912
- const lifecycleStage = useObservable$1(lifecycleService.lifecycle$, lifecycleService.stage);
25913
- const externalSkeletonVisible = useObservable$1(workbenchService.skeletonVisible$, void 0, true);
26007
+ const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
26008
+ const lifecycleStage = useObservable(lifecycleService.lifecycle$, lifecycleService.stage);
26009
+ const externalSkeletonVisible = useObservable(workbenchService.skeletonVisible$, void 0, true);
25914
26010
  const ready = lifecycleStage >= LifecycleStages.Ready;
25915
26011
  useEffect(() => {
25916
26012
  if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
25917
26013
  }, [ready, onRendered]);
25918
- const locale = useObservable$1(() => localeService.localeChanged$.pipe(map(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
25919
- const direction = useObservable$1(localeService.direction$, localeService.getDirection());
26014
+ const locale = useObservable(() => localeService.localeChanged$.pipe(map(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
26015
+ const direction = useObservable(localeService.direction$, localeService.getDirection());
25920
26016
  const portalContainer = useMemo(() => document.createElement("div"), []);
25921
26017
  useLayoutEffect(() => {
25922
26018
  const sub = themeService.currentTheme$.subscribe((theme) => {
@@ -26114,8 +26210,7 @@ function MobileWorkbench(props) {
26114
26210
  });
26115
26211
  }
26116
26212
 
26117
- //#endregion
26118
- //#region src/controllers/ui/ui-mobile.controller.ts
26213
+ // src/controllers/ui/ui-mobile.controller.ts
26119
26214
  let MobileUIController = class MobileUIController extends SingleUnitUIController {
26120
26215
  constructor(_config, injector, lifecycleService, renderManagerService, layoutService, instanceService, menuManagerService, uiPartsService) {
26121
26216
  super(injector, instanceService, layoutService, lifecycleService, renderManagerService);
@@ -26169,12 +26264,10 @@ function createContainer(id) {
26169
26264
  return element;
26170
26265
  }
26171
26266
 
26172
- //#endregion
26173
- //#region src/services/notification/notification.service.ts
26267
+ // src/services/notification/notification.service.ts
26174
26268
  const INotificationService = createIdentifier("ui.notification.service");
26175
26269
 
26176
- //#endregion
26177
- //#region src/services/before-close/before-close.service.ts
26270
+ // src/services/before-close/before-close.service.ts
26178
26271
  const IBeforeCloseService = createIdentifier("univer.ui.before-close-service");
26179
26272
  let DesktopBeforeCloseService = class DesktopBeforeCloseService extends Disposable {
26180
26273
  constructor(_notificationService, _localeService) {
@@ -26230,8 +26323,7 @@ let DesktopBeforeCloseService = class DesktopBeforeCloseService extends Disposab
26230
26323
  };
26231
26324
  DesktopBeforeCloseService = __decorate([__decorateParam(0, INotificationService), __decorateParam(1, Inject(LocaleService))], DesktopBeforeCloseService);
26232
26325
 
26233
- //#endregion
26234
- //#region src/utils/html.ts
26326
+ // src/utils/html.ts
26235
26327
  function sanitizeParsedHtml(root, options) {
26236
26328
  root.querySelectorAll(options.strippedSelector).forEach((element) => element.remove());
26237
26329
  root.querySelectorAll("*").forEach((element) => {
@@ -26249,8 +26341,7 @@ function parseHtmlDocument(html, options) {
26249
26341
  return doc;
26250
26342
  }
26251
26343
 
26252
- //#endregion
26253
- //#region src/services/clipboard/clipboard-utils.ts
26344
+ // src/services/clipboard/clipboard-utils.ts
26254
26345
  /**
26255
26346
  * Copyright 2023-present DreamNum Co., Ltd.
26256
26347
  *
@@ -26276,8 +26367,7 @@ function supportClipboardAPI() {
26276
26367
  return typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.readText !== "undefined";
26277
26368
  }
26278
26369
 
26279
- //#endregion
26280
- //#region src/services/clipboard/clipboard-interface.service.ts
26370
+ // src/services/clipboard/clipboard-interface.service.ts
26281
26371
  const PLAIN_TEXT_CLIPBOARD_MIME_TYPE = "text/plain";
26282
26372
  const HTML_CLIPBOARD_MIME_TYPE = "text/html";
26283
26373
  const FILE_PNG_CLIPBOARD_MIME_TYPE = "image/png";
@@ -26628,8 +26718,7 @@ function select(element) {
26628
26718
  return selection.toString();
26629
26719
  }
26630
26720
 
26631
- //#endregion
26632
- //#region src/views/components/confirm-part/MobileConfirmPart.tsx
26721
+ // src/views/components/confirm-part/MobileConfirmPart.tsx
26633
26722
  function MobileContextConfirm(props) {
26634
26723
  const { children, onClose, onConfirm } = props;
26635
26724
  const [hooks] = useState({});
@@ -26676,8 +26765,7 @@ function MobileConfirmPart() {
26676
26765
  }, options.id));
26677
26766
  }
26678
26767
 
26679
- //#endregion
26680
- //#region src/services/confirm/mobile-confirm.service.ts
26768
+ // src/services/confirm/mobile-confirm.service.ts
26681
26769
  let MobileConfirmService = class MobileConfirmService extends Disposable {
26682
26770
  constructor(_injector, uiPartsService) {
26683
26771
  super();
@@ -26731,8 +26819,7 @@ let MobileConfirmService = class MobileConfirmService extends Disposable {
26731
26819
  };
26732
26820
  MobileConfirmService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], MobileConfirmService);
26733
26821
 
26734
- //#endregion
26735
- //#region src/views/components/dialog-part/MobileDialogPart.tsx
26822
+ // src/views/components/dialog-part/MobileDialogPart.tsx
26736
26823
  function toMobileDialogOptions(options) {
26737
26824
  const { children, title, footer, ...rest } = options;
26738
26825
  return {
@@ -26793,6 +26880,7 @@ function MobileDialogPart() {
26793
26880
  }), /* @__PURE__ */ jsx(MobileDrawer, {
26794
26881
  layerRef,
26795
26882
  layout: options.layout,
26883
+ autoHeight: options.layout !== "canvas",
26796
26884
  componentName: "mobile-dialog-drawer",
26797
26885
  snap: (snapOverride === null || snapOverride === void 0 ? void 0 : snapOverride.id) === options.id ? snapOverride.snap : defaultSnap,
26798
26886
  expandLabel: localeService.t("ui.sidebar.resize"),
@@ -26827,8 +26915,7 @@ function MobileDialogPart() {
26827
26915
  });
26828
26916
  }
26829
26917
 
26830
- //#endregion
26831
- //#region src/views/components/dialog-part/DialogPart.tsx
26918
+ // src/views/components/dialog-part/DialogPart.tsx
26832
26919
  function DialogItem(props) {
26833
26920
  const dialogRef = useRef(null);
26834
26921
  const openRef = useRef(false);
@@ -26885,8 +26972,7 @@ function DialogPart() {
26885
26972
  return attrs === null || attrs === void 0 ? void 0 : attrs.map((options) => /* @__PURE__ */ jsx(DialogItem, { ...options }, options.id));
26886
26973
  }
26887
26974
 
26888
- //#endregion
26889
- //#region src/services/dialog/desktop-dialog.service.ts
26975
+ // src/services/dialog/desktop-dialog.service.ts
26890
26976
  let DesktopDialogService = class DesktopDialogService extends Disposable {
26891
26977
  constructor(_injector, _uiPartsService) {
26892
26978
  super();
@@ -26940,8 +27026,7 @@ let DesktopDialogService = class DesktopDialogService extends Disposable {
26940
27026
  };
26941
27027
  DesktopDialogService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopDialogService);
26942
27028
 
26943
- //#endregion
26944
- //#region src/services/dialog/mobile-dialog.service.ts
27029
+ // src/services/dialog/mobile-dialog.service.ts
26945
27030
  /**
26946
27031
  * Copyright 2023-present DreamNum Co., Ltd.
26947
27032
  *
@@ -26972,12 +27057,10 @@ let MobileDialogService = class MobileDialogService extends DesktopDialogService
26972
27057
  };
26973
27058
  MobileDialogService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], MobileDialogService);
26974
27059
 
26975
- //#endregion
26976
- //#region src/services/gallery/gallery.service.ts
27060
+ // src/services/gallery/gallery.service.ts
26977
27061
  const IGalleryService = createIdentifier("univer.ui.gallery-service");
26978
27062
 
26979
- //#endregion
26980
- //#region src/views/components/gallery-part/GalleryPart.tsx
27063
+ // src/views/components/gallery-part/GalleryPart.tsx
26981
27064
  /**
26982
27065
  * Copyright 2023-present DreamNum Co., Ltd.
26983
27066
  *
@@ -27000,8 +27083,7 @@ function GalleryPart() {
27000
27083
  return /* @__PURE__ */ jsx(Gallery, { ...gallery });
27001
27084
  }
27002
27085
 
27003
- //#endregion
27004
- //#region src/services/gallery/desktop-gallery.service.ts
27086
+ // src/services/gallery/desktop-gallery.service.ts
27005
27087
  let DesktopGalleryService = class DesktopGalleryService extends Disposable {
27006
27088
  constructor(_injector, _uiPartsService) {
27007
27089
  super();
@@ -27034,8 +27116,7 @@ let DesktopGalleryService = class DesktopGalleryService extends Disposable {
27034
27116
  };
27035
27117
  DesktopGalleryService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopGalleryService);
27036
27118
 
27037
- //#endregion
27038
- //#region src/services/local-file/desktop-local-file.service.ts
27119
+ // src/services/local-file/desktop-local-file.service.ts
27039
27120
  var DesktopLocalFileService = class extends Disposable {
27040
27121
  openFile(options) {
27041
27122
  return new Promise((resolve) => {
@@ -27058,8 +27139,7 @@ var DesktopLocalFileService = class extends Disposable {
27058
27139
  }
27059
27140
  };
27060
27141
 
27061
- //#endregion
27062
- //#region src/services/local-file/local-file.service.ts
27142
+ // src/services/local-file/local-file.service.ts
27063
27143
  /**
27064
27144
  * Copyright 2023-present DreamNum Co., Ltd.
27065
27145
  *
@@ -27080,8 +27160,7 @@ var DesktopLocalFileService = class extends Disposable {
27080
27160
  */
27081
27161
  const ILocalFileService = createIdentifier("univer-ui.local-file.service");
27082
27162
 
27083
- //#endregion
27084
- //#region src/utils/storage-driver.ts
27163
+ // src/utils/storage-driver.ts
27085
27164
  /**
27086
27165
  * Copyright 2023-present DreamNum Co., Ltd.
27087
27166
  *
@@ -27299,8 +27378,7 @@ function createDriver() {
27299
27378
  }
27300
27379
  const browserStorage = createDriver();
27301
27380
 
27302
- //#endregion
27303
- //#region src/services/local-storage/local-storage.service.ts
27381
+ // src/services/local-storage/local-storage.service.ts
27304
27382
  var DesktopLocalStorageService = class {
27305
27383
  getItem(key) {
27306
27384
  return browserStorage.getItem(key);
@@ -27325,8 +27403,7 @@ var DesktopLocalStorageService = class {
27325
27403
  }
27326
27404
  };
27327
27405
 
27328
- //#endregion
27329
- //#region src/views/message/MessageContainer.tsx
27406
+ // src/views/message/MessageContainer.tsx
27330
27407
  /**
27331
27408
  * Copyright 2023-present DreamNum Co., Ltd.
27332
27409
  *
@@ -27353,8 +27430,7 @@ function MessageContainer() {
27353
27430
  });
27354
27431
  }
27355
27432
 
27356
- //#endregion
27357
- //#region src/services/message/desktop-message.service.ts
27433
+ // src/services/message/desktop-message.service.ts
27358
27434
  let messageId = 0;
27359
27435
  let DesktopMessageService = class DesktopMessageService extends Disposable {
27360
27436
  constructor(_injector, _uiPartsService) {
@@ -27386,8 +27462,7 @@ let DesktopMessageService = class DesktopMessageService extends Disposable {
27386
27462
  };
27387
27463
  DesktopMessageService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopMessageService);
27388
27464
 
27389
- //#endregion
27390
- //#region src/views/notification/Notification.tsx
27465
+ // src/views/notification/Notification.tsx
27391
27466
  function Notification() {
27392
27467
  const localeService = useDependency(LocaleService);
27393
27468
  const themeService = useDependency(ThemeService);
@@ -27414,8 +27489,7 @@ const notification = {
27414
27489
  dismiss: (id) => toast.dismiss(id)
27415
27490
  };
27416
27491
 
27417
- //#endregion
27418
- //#region src/services/notification/desktop-notification.service.ts
27492
+ // src/services/notification/desktop-notification.service.ts
27419
27493
  let DesktopNotificationService = class DesktopNotificationService extends Disposable {
27420
27494
  constructor(_injector, _uiPartsService) {
27421
27495
  super();
@@ -27433,8 +27507,7 @@ let DesktopNotificationService = class DesktopNotificationService extends Dispos
27433
27507
  };
27434
27508
  DesktopNotificationService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopNotificationService);
27435
27509
 
27436
- //#endregion
27437
- //#region src/services/presence/unit-presence-ui-adapter.service.ts
27510
+ // src/services/presence/unit-presence-ui-adapter.service.ts
27438
27511
  const IUnitPresenceUIAdapterRegistry = createIdentifier("ui.unit-presence-adapter-registry");
27439
27512
  const EMPTY_ADAPTERS = Object.freeze([]);
27440
27513
  var UnitPresenceUIAdapterRegistry = class extends Disposable {
@@ -27470,8 +27543,7 @@ var UnitPresenceUIAdapterRegistry = class extends Disposable {
27470
27543
  }
27471
27544
  };
27472
27545
 
27473
- //#endregion
27474
- //#region src/services/sidebar/desktop-sidebar.service.ts
27546
+ // src/services/sidebar/desktop-sidebar.service.ts
27475
27547
  var DesktopSidebarService = class extends Disposable {
27476
27548
  constructor(..._args) {
27477
27549
  super(..._args);
@@ -27541,8 +27613,7 @@ var DesktopSidebarService = class extends Disposable {
27541
27613
  }
27542
27614
  };
27543
27615
 
27544
- //#endregion
27545
- //#region src/services/undo-redo/undo-redo-group.service.ts
27616
+ // src/services/undo-redo/undo-redo-group.service.ts
27546
27617
  /**
27547
27618
  * Copyright 2023-present DreamNum Co., Ltd.
27548
27619
  *
@@ -27596,8 +27667,7 @@ let UndoRedoGroupService = class UndoRedoGroupService {
27596
27667
  };
27597
27668
  UndoRedoGroupService = __decorate([__decorateParam(0, IUndoRedoService)], UndoRedoGroupService);
27598
27669
 
27599
- //#endregion
27600
- //#region src/mobile-plugin.ts
27670
+ // src/mobile-plugin.ts
27601
27671
  const DISABLE_AUTO_FOCUS_KEY$1 = "DISABLE_AUTO_FOCUS";
27602
27672
  let UniverMobileUIPlugin = class UniverMobileUIPlugin extends Plugin {
27603
27673
  constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
@@ -27698,8 +27768,7 @@ UniverMobileUIPlugin = __decorate([
27698
27768
  __decorateParam(3, IConfigService)
27699
27769
  ], UniverMobileUIPlugin);
27700
27770
 
27701
- //#endregion
27702
- //#region src/views/components/shortcut-panel/ShortcutPanel.tsx
27771
+ // src/views/components/shortcut-panel/ShortcutPanel.tsx
27703
27772
  /**
27704
27773
  * Copyright 2023-present DreamNum Co., Ltd.
27705
27774
  *
@@ -27777,8 +27846,7 @@ function ShortcutPanel() {
27777
27846
  });
27778
27847
  }
27779
27848
 
27780
- //#endregion
27781
- //#region src/views/font-family/FontFamilyDropdown.tsx
27849
+ // src/views/font-family/FontFamilyDropdown.tsx
27782
27850
  function FontFamilyDropdown(props) {
27783
27851
  const { value, onChange, ariaLabel, className, disabled: disabledProp, disabled$, inputClassName, popupClassName, popupDataComponent, title, onMouseDown, onPointerDown } = props;
27784
27852
  const localeService = useDependency(LocaleService);
@@ -27825,8 +27893,7 @@ function FontFamilyDropdown(props) {
27825
27893
  });
27826
27894
  }
27827
27895
 
27828
- //#endregion
27829
- //#region src/views/slider/ZoomInput.tsx
27896
+ // src/views/slider/ZoomInput.tsx
27830
27897
  function ZoomInput(props) {
27831
27898
  const iconManager = useDependency(IconManager);
27832
27899
  const localeService = useDependency(LocaleService);
@@ -27919,8 +27986,7 @@ function ZoomInput(props) {
27919
27986
  });
27920
27987
  }
27921
27988
 
27922
- //#endregion
27923
- //#region src/views/slider/Slider.tsx
27989
+ // src/views/slider/Slider.tsx
27924
27990
  const SLIDER_WIDTH = 116;
27925
27991
  const DRAG_COMMIT_INTERVAL = 50;
27926
27992
  /**
@@ -28150,8 +28216,7 @@ function Slider(props) {
28150
28216
  });
28151
28217
  }
28152
28218
 
28153
- //#endregion
28154
- //#region src/views/object-permission/ObjectPermissionMembers.tsx
28219
+ // src/views/object-permission/ObjectPermissionMembers.tsx
28155
28220
  function ObjectPermissionMembers({ unitId, value, disabled, onChange }) {
28156
28221
  var _authz$getCfgEnableOb;
28157
28222
  const locale = useDependency(LocaleService);
@@ -28300,8 +28365,7 @@ function ObjectPermissionMembers({ unitId, value, disabled, onChange }) {
28300
28365
  });
28301
28366
  }
28302
28367
 
28303
- //#endregion
28304
- //#region src/views/object-permission/ObjectPermissionButton.tsx
28368
+ // src/views/object-permission/ObjectPermissionButton.tsx
28305
28369
  const OBJECT_PERMISSION_DIALOG = "ui.object-permission-dialog";
28306
28370
  /** Mount outside transient toolbars and context menus, retaining the original target until close. */
28307
28371
  function openObjectPermissionDialog(accessor, props) {
@@ -28598,8 +28662,7 @@ function ObjectPermissionDialog({ target, name, commandId, actions = DEFAULT_ACT
28598
28662
  });
28599
28663
  }
28600
28664
 
28601
- //#endregion
28602
- //#region src/views/object-permission/ObjectPermissionPanel.tsx
28665
+ // src/views/object-permission/ObjectPermissionPanel.tsx
28603
28666
  const OBJECT_PERMISSION_PANEL = "ui.object-permission-panel";
28604
28667
  function openObjectPermissionPanel(accessor, props) {
28605
28668
  if (!accessor.get(ObjectPermissionService).canView(props.target)) return false;
@@ -28731,8 +28794,7 @@ function ObjectPermissionPanel({ unitId, getTargets, expandable }) {
28731
28794
  });
28732
28795
  }
28733
28796
 
28734
- //#endregion
28735
- //#region src/controllers/components.controller.ts
28797
+ // src/controllers/components.controller.ts
28736
28798
  /**
28737
28799
  * Copyright 2023-present DreamNum Co., Ltd.
28738
28800
  *
@@ -28794,8 +28856,7 @@ let ComponentsController = class ComponentsController extends Disposable {
28794
28856
  };
28795
28857
  ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
28796
28858
 
28797
- //#endregion
28798
- //#region src/controllers/feature-search/feature-search.controller.ts
28859
+ // src/controllers/feature-search/feature-search.controller.ts
28799
28860
  const FeatureSearchShortcut = {
28800
28861
  id: OpenFeatureSearchOperation.id,
28801
28862
  binding: 4096 | 1024 | 80,
@@ -28812,8 +28873,7 @@ let FeatureSearchController = class FeatureSearchController extends Disposable {
28812
28873
  };
28813
28874
  FeatureSearchController = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, IShortcutService)], FeatureSearchController);
28814
28875
 
28815
- //#endregion
28816
- //#region src/views/components/confirm-part/ConfirmPart.tsx
28876
+ // src/views/components/confirm-part/ConfirmPart.tsx
28817
28877
  const ContextConfirm = (props) => {
28818
28878
  const { children, onClose, onConfirm } = props;
28819
28879
  const [hooks] = useState({});
@@ -28861,8 +28921,7 @@ function ConfirmPart() {
28861
28921
  }, index));
28862
28922
  }
28863
28923
 
28864
- //#endregion
28865
- //#region src/services/confirm/desktop-confirm.service.ts
28924
+ // src/services/confirm/desktop-confirm.service.ts
28866
28925
  let DesktopConfirmService = class DesktopConfirmService extends Disposable {
28867
28926
  constructor(_injector, _uiPartsService) {
28868
28927
  super();
@@ -28915,8 +28974,7 @@ let DesktopConfirmService = class DesktopConfirmService extends Disposable {
28915
28974
  };
28916
28975
  DesktopConfirmService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IUIPartsService)], DesktopConfirmService);
28917
28976
 
28918
- //#endregion
28919
- //#region src/plugin.ts
28977
+ // src/plugin.ts
28920
28978
  const DISABLE_AUTO_FOCUS_KEY = "DISABLE_AUTO_FOCUS";
28921
28979
  let UniverUIPlugin = class UniverUIPlugin extends Plugin {
28922
28980
  constructor(_config = defaultPluginConfig, _contextService, _injector, _configService) {
@@ -29024,8 +29082,7 @@ UniverUIPlugin = __decorate([
29024
29082
  __decorateParam(3, IConfigService)
29025
29083
  ], UniverUIPlugin);
29026
29084
 
29027
- //#endregion
29028
- //#region src/services/message/__tests__/mock-message.service.ts
29085
+ // src/services/message/__tests__/mock-message.service.ts
29029
29086
  /**
29030
29087
  * This is a mocked message service for testing purposes.
29031
29088
  *
@@ -29041,8 +29098,7 @@ var MockMessageService = class {
29041
29098
  getContainer() {}
29042
29099
  };
29043
29100
 
29044
- //#endregion
29045
- //#region src/services/sidebar/hooks/use-sidebar-click.ts
29101
+ // src/services/sidebar/hooks/use-sidebar-click.ts
29046
29102
  /**
29047
29103
  * Copyright 2023-present DreamNum Co., Ltd.
29048
29104
  *
@@ -29073,8 +29129,7 @@ const useSidebarClick = (cb) => {
29073
29129
  }, [cb, container]);
29074
29130
  };
29075
29131
 
29076
- //#endregion
29077
- //#region src/utils/util.ts
29132
+ // src/utils/util.ts
29078
29133
  /**
29079
29134
  * Copyright 2023-present DreamNum Co., Ltd.
29080
29135
  *
@@ -29095,8 +29150,7 @@ function textTrim(x) {
29095
29150
  return x.replace(/^\s+|\s+$/gm, "");
29096
29151
  }
29097
29152
 
29098
- //#endregion
29099
- //#region src/utils/cell.ts
29153
+ // src/utils/cell.ts
29100
29154
  const PX_TO_PT_RATIO = .75;
29101
29155
  const MAX_FONT_SIZE = 78;
29102
29156
  const MIN_FONT_SIZE = 9;
@@ -29667,8 +29721,7 @@ function extractFontFamily(styleStr) {
29667
29721
  return matches ? (matches[1] || matches[2] || matches[3]).trim() : null;
29668
29722
  }
29669
29723
 
29670
- //#endregion
29671
- //#region src/utils/mobile-canvas-gesture.ts
29724
+ // src/utils/mobile-canvas-gesture.ts
29672
29725
  /** Routes touch browsing separately from the canvas's existing object manipulation. */
29673
29726
  var MobileCanvasGesture = class extends Disposable {
29674
29727
  constructor(_canvas, _options) {
@@ -29882,8 +29935,7 @@ var MobileCanvasGesture = class extends Disposable {
29882
29935
  }
29883
29936
  };
29884
29937
 
29885
- //#endregion
29886
- //#region src/views/components/dom/Print.tsx
29938
+ // src/views/components/dom/Print.tsx
29887
29939
  const PrintFloatDomSingle = memo((props) => {
29888
29940
  const { layer } = props;
29889
29941
  return typeof layer.componentKey === "string" ? /* @__PURE__ */ jsx(RegisteredPrintFloatDomSingle, {
@@ -29965,8 +30017,7 @@ function PrintFloatDomSingleContent(props) {
29965
30017
  });
29966
30018
  }
29967
30019
 
29968
- //#endregion
29969
- //#region src/views/components/hover-track/HoverTrack.tsx
30020
+ // src/views/components/hover-track/HoverTrack.tsx
29970
30021
  const HOVER_TRACK_HOST_CLASS_NAME = "univer-group/hover-track";
29971
30022
  const HOVER_TRACK_MASK = "linear-gradient(currentColor 0 0) content-box, linear-gradient(currentColor 0 0)";
29972
30023
  const HOVER_TRACK_MASK_STYLE = {
@@ -29985,8 +30036,7 @@ function HoverTrack(props) {
29985
30036
  });
29986
30037
  }
29987
30038
 
29988
- //#endregion
29989
- //#region src/views/components/mobile-zoom-indicator/mobile-zoom-indicator.ts
30039
+ // src/views/components/mobile-zoom-indicator/mobile-zoom-indicator.ts
29990
30040
  /**
29991
30041
  * Copyright 2023-present DreamNum Co., Ltd.
29992
30042
  *
@@ -30064,8 +30114,7 @@ var MobileZoomIndicator = class extends Disposable {
30064
30114
  }
30065
30115
  };
30066
30116
 
30067
- //#endregion
30068
- //#region src/views/font-family/MobileFontFamilyDropdown.tsx
30117
+ // src/views/font-family/MobileFontFamilyDropdown.tsx
30069
30118
  function MobileFontFamilyDropdown(props) {
30070
30119
  const localeService = useDependency(LocaleService);
30071
30120
  const disabled = useObservable(props.disabled$);
@@ -30083,8 +30132,7 @@ function MobileFontFamilyDropdown(props) {
30083
30132
  });
30084
30133
  }
30085
30134
 
30086
- //#endregion
30087
- //#region src/views/progress-bar/ProgressBar.tsx
30135
+ // src/views/progress-bar/ProgressBar.tsx
30088
30136
  /**
30089
30137
  * Copyright 2023-present DreamNum Co., Ltd.
30090
30138
  *
@@ -30172,5 +30220,4 @@ function ProgressBar(props) {
30172
30220
  });
30173
30221
  }
30174
30222
 
30175
- //#endregion
30176
30223
  export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomPreviewService, CanvasFloatDomService, CanvasPopup, CanvasPopupService, CommonLabel, ComponentContainer, ComponentManager, DesktopContextMenu as ContextMenu, ContextMenuGroup, ContextMenuHostService, ContextMenuPanel, ContextMenuPosition, ContextMenuService, CopyCommand, CopyShortcutItem, CustomLabel, CutCommand, CutShortcutItem, DISABLE_AUTO_FOCUS_KEY, DesktopBeforeCloseService, DesktopConfirmService, DesktopDialogService, DesktopGalleryService, DesktopLayoutService, DesktopLocalFileService, DesktopLocalStorageService, DesktopMessageService, DesktopNotificationService, DesktopRibbonService, DesktopSidebarService, DesktopUIController, EMBED_CHILD_UNIT_ID_ATTRIBUTE, EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, EMOJI_CATEGORIES, EMOJI_PICKER_COMPONENT, EMOJI_RECENT_LIMIT, EmojiPicker, ErrorController, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE_SVG_XML_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, FloatDom, FloatDomSingle, FloatingObjectToolbarPosition, FontCategory, FontFamily, FontFamilyDropdown, FontFamilyItem, FontService, FontSize, FormatPainterSessionService, HEADING_ITEM_COMPONENT, HEADING_LIST, HOVER_TRACK_HOST_CLASS_NAME, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, HoverTrack, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonOverrideService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IUIRuntimeScopeService, IUnitPresenceUIAdapterRegistry, IWorkbenchService, IconManager, KeyCode, MOBILE_UI_MODE, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileCanvasGesture, MobileContextMenu, MobileDialogService, MobileDrawer, MobileFontFamilyDropdown, MobileKeyboardInsetContext, MobileMenu, MobileZoomIndicator, MockMessageService, NativeTextEditorShortcutBehavior, ObjectPermissionButton, ObjectPermissionPanelButton, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonOverrideService, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SYMBOL_CATEGORIES, SYMBOL_PICKER_COMPONENT, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, SymbolPicker, ThemeSwitcherService, ToggleFullscreenOperation, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UIRuntimeScopeService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoRedoGroupService, UndoShortcutItem, UnitPresenceUIAdapterRegistry, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, WorkbenchService, ZIndexManager, ZoomInput, bindFormatPainterCanvas, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmbedBoundaryOwner, getEmbedChildUnitId, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getMobileCanvasPanDelta, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, isEmbedBoundaryTarget, keepInteractionInsideSameEmbedBoundary, mergeMenuConfigs, objectPermissionMenuItemFactory, openObjectPermissionDialog, openObjectPermissionPanel, parseHtmlDocument, parseHtmlFragment, parseStoredRecentEmojis, preventBrowserZoomInContainers, promoteRecentEmoji, sanitizeParsedHtml, searchEmojis, splitSpanText, supportClipboardAPI, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useMobileCanvasPanel, useMobileCanvasViewport, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };