@univerjs/ui 1.0.0-alpha.6 → 1.0.0-alpha.8

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 (119) hide show
  1. package/lib/cjs/facade.js +9 -41
  2. package/lib/cjs/index.js +1434 -470
  3. package/lib/cjs/locale/ar-SA.js +12 -0
  4. package/lib/cjs/locale/ca-ES.js +12 -0
  5. package/lib/cjs/locale/de-DE.js +12 -0
  6. package/lib/cjs/locale/en-US.js +12 -0
  7. package/lib/cjs/locale/es-ES.js +12 -0
  8. package/lib/cjs/locale/fa-IR.js +12 -0
  9. package/lib/cjs/locale/fr-FR.js +12 -0
  10. package/lib/cjs/locale/id-ID.js +12 -0
  11. package/lib/cjs/locale/it-IT.js +12 -0
  12. package/lib/cjs/locale/ja-JP.js +12 -0
  13. package/lib/cjs/locale/ko-KR.js +12 -0
  14. package/lib/cjs/locale/pl-PL.js +12 -0
  15. package/lib/cjs/locale/pt-BR.js +12 -0
  16. package/lib/cjs/locale/ru-RU.js +12 -0
  17. package/lib/cjs/locale/sk-SK.js +12 -0
  18. package/lib/cjs/locale/vi-VN.js +12 -0
  19. package/lib/cjs/locale/zh-CN.js +12 -0
  20. package/lib/cjs/locale/zh-HK.js +12 -0
  21. package/lib/cjs/locale/zh-TW.js +12 -0
  22. package/lib/es/facade.js +11 -43
  23. package/lib/es/index.js +1431 -475
  24. package/lib/es/locale/ar-SA.js +12 -0
  25. package/lib/es/locale/ca-ES.js +12 -0
  26. package/lib/es/locale/de-DE.js +12 -0
  27. package/lib/es/locale/en-US.js +12 -0
  28. package/lib/es/locale/es-ES.js +12 -0
  29. package/lib/es/locale/fa-IR.js +12 -0
  30. package/lib/es/locale/fr-FR.js +12 -0
  31. package/lib/es/locale/id-ID.js +12 -0
  32. package/lib/es/locale/it-IT.js +12 -0
  33. package/lib/es/locale/ja-JP.js +12 -0
  34. package/lib/es/locale/ko-KR.js +12 -0
  35. package/lib/es/locale/pl-PL.js +12 -0
  36. package/lib/es/locale/pt-BR.js +12 -0
  37. package/lib/es/locale/ru-RU.js +12 -0
  38. package/lib/es/locale/sk-SK.js +12 -0
  39. package/lib/es/locale/vi-VN.js +12 -0
  40. package/lib/es/locale/zh-CN.js +12 -0
  41. package/lib/es/locale/zh-HK.js +12 -0
  42. package/lib/es/locale/zh-TW.js +12 -0
  43. package/lib/facade.js +11 -43
  44. package/lib/index.css +224 -6
  45. package/lib/index.js +1431 -475
  46. package/lib/locale/ar-SA.js +12 -0
  47. package/lib/locale/ca-ES.js +12 -0
  48. package/lib/locale/de-DE.js +12 -0
  49. package/lib/locale/en-US.js +12 -0
  50. package/lib/locale/es-ES.js +12 -0
  51. package/lib/locale/fa-IR.js +12 -0
  52. package/lib/locale/fr-FR.js +12 -0
  53. package/lib/locale/id-ID.js +12 -0
  54. package/lib/locale/it-IT.js +12 -0
  55. package/lib/locale/ja-JP.js +12 -0
  56. package/lib/locale/ko-KR.js +12 -0
  57. package/lib/locale/pl-PL.js +12 -0
  58. package/lib/locale/pt-BR.js +12 -0
  59. package/lib/locale/ru-RU.js +12 -0
  60. package/lib/locale/sk-SK.js +12 -0
  61. package/lib/locale/vi-VN.js +12 -0
  62. package/lib/locale/zh-CN.js +12 -0
  63. package/lib/locale/zh-HK.js +12 -0
  64. package/lib/locale/zh-TW.js +12 -0
  65. package/lib/types/commands/operations/open-feature-search.operation.d.ts +17 -0
  66. package/lib/types/controllers/feature-search/feature-search.controller.d.ts +20 -0
  67. package/lib/types/controllers/ui/ui.controller.d.ts +1 -1
  68. package/lib/types/facade/f-univer.d.ts +0 -8
  69. package/lib/types/facade/index.d.ts +0 -2
  70. package/lib/types/index.d.ts +4 -4
  71. package/lib/types/locale/en-US.d.ts +12 -0
  72. package/lib/types/menu/feature-search.menu.d.ts +18 -0
  73. package/lib/types/{controllers/menus/menus.d.ts → menu/history.menu.d.ts} +2 -2
  74. package/lib/types/{controllers/shortcut-display/menu.d.ts → menu/shortcut-panel.menu.d.ts} +2 -2
  75. package/lib/types/services/contextmenu/contextmenu-host.service.d.ts +5 -1
  76. package/lib/types/services/menu/menu-manager.service.d.ts +11 -0
  77. package/lib/types/services/menu/types.d.ts +1 -0
  78. package/lib/types/services/parts/parts.service.d.ts +3 -0
  79. package/lib/types/services/shortcut/shortcut.service.d.ts +21 -1
  80. package/lib/types/services/workbench/workbench.service.d.ts +30 -0
  81. package/lib/types/utils/embed-boundary.d.ts +2 -0
  82. package/lib/types/views/components/feature-search/FeatureSearch.d.ts +29 -0
  83. package/lib/types/views/components/ribbon/RibbonGrid.d.ts +23 -0
  84. package/lib/types/views/components/ribbon/ToolbarItem.d.ts +10 -1
  85. package/lib/types/views/components/ribbon/ribbon-grid-layout.d.ts +27 -0
  86. package/lib/types/views/components/ribbon/ribbon-menu/RibbonGridMenu.d.ts +21 -0
  87. package/lib/types/views/components/sidebar/Sidebar.d.ts +0 -2
  88. package/lib/types/views/components/workbench-skeleton/WorkbenchSkeleton.d.ts +22 -0
  89. package/lib/types/views/custom-label/CustomLabel.d.ts +1 -0
  90. package/lib/types/views/emoji-picker/EmojiPicker.d.ts +7 -3
  91. package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
  92. package/lib/types/views/emoji-picker/index.d.ts +0 -1
  93. package/lib/types/views/index.d.ts +1 -0
  94. package/lib/types/views/symbol-picker/SymbolPicker.d.ts +31 -0
  95. package/lib/types/views/symbol-picker/index.d.ts +18 -0
  96. package/lib/types/views/symbol-picker/symbols.d.ts +23 -0
  97. package/lib/umd/facade.js +1 -1
  98. package/lib/umd/index.js +16 -13
  99. package/lib/umd/locale/ar-SA.js +1 -1
  100. package/lib/umd/locale/ca-ES.js +1 -1
  101. package/lib/umd/locale/de-DE.js +1 -1
  102. package/lib/umd/locale/en-US.js +1 -1
  103. package/lib/umd/locale/es-ES.js +1 -1
  104. package/lib/umd/locale/fa-IR.js +1 -1
  105. package/lib/umd/locale/fr-FR.js +1 -1
  106. package/lib/umd/locale/id-ID.js +1 -1
  107. package/lib/umd/locale/it-IT.js +1 -1
  108. package/lib/umd/locale/ja-JP.js +1 -1
  109. package/lib/umd/locale/ko-KR.js +1 -1
  110. package/lib/umd/locale/pl-PL.js +1 -1
  111. package/lib/umd/locale/pt-BR.js +1 -1
  112. package/lib/umd/locale/ru-RU.js +1 -1
  113. package/lib/umd/locale/sk-SK.js +1 -1
  114. package/lib/umd/locale/vi-VN.js +1 -1
  115. package/lib/umd/locale/zh-CN.js +1 -1
  116. package/lib/umd/locale/zh-HK.js +1 -1
  117. package/lib/umd/locale/zh-TW.js +1 -1
  118. package/package.json +8 -8
  119. package/lib/types/facade/f-hooks.d.ts +0 -63
package/lib/cjs/index.js CHANGED
@@ -27,6 +27,7 @@ let _univerjs_icons = require("@univerjs/icons");
27
27
  * limitations under the License.
28
28
  */
29
29
  const EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
30
+ const EMBED_CHILD_UNIT_ID_ATTRIBUTE = "data-embed-child-unit-id";
30
31
  function getEmbedBoundaryOwner(target) {
31
32
  var _ref, _getAttributeValue;
32
33
  if (!hasClosest(target)) return;
@@ -36,6 +37,12 @@ function getEmbedBoundaryOwner(target) {
36
37
  function isEmbedBoundaryTarget(target) {
37
38
  return hasClosest(target) && target.closest(`[${"data-embed-interaction-boundary-owner"}]`) != null;
38
39
  }
40
+ function getEmbedChildUnitId(target) {
41
+ var _ref2, _getAttributeValue2;
42
+ if (!hasClosest(target)) return;
43
+ const childRuntime = target.closest(`[${EMBED_CHILD_UNIT_ID_ATTRIBUTE}]`);
44
+ return (_ref2 = (_getAttributeValue2 = getAttributeValue(target, "data-embed-child-unit-id")) !== null && _getAttributeValue2 !== void 0 ? _getAttributeValue2 : getAttributeValue(childRuntime, "data-embed-child-unit-id")) !== null && _ref2 !== void 0 ? _ref2 : void 0;
45
+ }
39
46
  function keepInteractionInsideSameEmbedBoundary(event) {
40
47
  const owner = getEmbedBoundaryOwner(event.currentTarget);
41
48
  if (!owner) return;
@@ -51,7 +58,7 @@ function getAttributeValue(target, name) {
51
58
  }
52
59
 
53
60
  //#endregion
54
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
61
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
55
62
  function _typeof(o) {
56
63
  "@babel/helpers - typeof";
57
64
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -62,7 +69,7 @@ function _typeof(o) {
62
69
  }
63
70
 
64
71
  //#endregion
65
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
72
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
66
73
  function toPrimitive(t, r) {
67
74
  if ("object" != _typeof(t) || !t) return t;
68
75
  var e = t[Symbol.toPrimitive];
@@ -75,14 +82,14 @@ function toPrimitive(t, r) {
75
82
  }
76
83
 
77
84
  //#endregion
78
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
85
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
79
86
  function toPropertyKey(t) {
80
87
  var i = toPrimitive(t, "string");
81
88
  return "symbol" == _typeof(i) ? i : i + "";
82
89
  }
83
90
 
84
91
  //#endregion
85
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
92
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
86
93
  function _defineProperty(e, r, t) {
87
94
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
88
95
  value: t,
@@ -93,7 +100,7 @@ function _defineProperty(e, r, t) {
93
100
  }
94
101
 
95
102
  //#endregion
96
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
103
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
97
104
  function __decorateParam(paramIndex, decorator) {
98
105
  return function(target, key) {
99
106
  decorator(target, key, paramIndex);
@@ -101,7 +108,7 @@ function __decorateParam(paramIndex, decorator) {
101
108
  }
102
109
 
103
110
  //#endregion
104
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
111
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
105
112
  function __decorate(decorators, target, key, desc) {
106
113
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
107
114
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -458,12 +465,13 @@ var ZIndexManager = class {
458
465
  //#region src/common/menu-hidden-observable.ts
459
466
  function getMenuHiddenObservable(accessor, targetUniverType, matchUnitId, needHideUnitId) {
460
467
  const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
468
+ const getUnitType = (unitId) => _univerjs_core.SHEET_EDITOR_UNITS.includes(unitId) ? _univerjs_core.UniverInstanceType.UNIVER_SHEET : univerInstanceService.getUnitType(unitId);
461
469
  return new rxjs.Observable((subscriber) => {
462
470
  const subscription = univerInstanceService.focused$.subscribe((unitId) => {
463
471
  if (unitId == null) return subscriber.next(true);
464
472
  if (matchUnitId && matchUnitId !== unitId) return subscriber.next(true);
465
473
  if (needHideUnitId && (Array.isArray(needHideUnitId) ? needHideUnitId.includes(unitId) : needHideUnitId === unitId)) return subscriber.next(true);
466
- const univerType = univerInstanceService.getUnitType(unitId);
474
+ const univerType = getUnitType(unitId);
467
475
  subscriber.next(univerType !== targetUniverType);
468
476
  });
469
477
  const focusedUniverInstance = univerInstanceService.getFocusedUnit();
@@ -471,7 +479,7 @@ function getMenuHiddenObservable(accessor, targetUniverType, matchUnitId, needHi
471
479
  const currentUnit = univerInstanceService.getCurrentUnitOfType(targetUniverType);
472
480
  subscriber.next(currentUnit == null);
473
481
  } else {
474
- const univerType = univerInstanceService.getUnitType(focusedUniverInstance.getUnitId());
482
+ const univerType = getUnitType(focusedUniverInstance.getUnitId());
475
483
  subscriber.next(univerType !== targetUniverType);
476
484
  }
477
485
  return () => subscription.unsubscribe();
@@ -830,18 +838,47 @@ var PlatformService = class {
830
838
  }
831
839
  };
832
840
 
841
+ //#endregion
842
+ //#region src/services/runtime-scope/ui-runtime-scope.service.ts
843
+ const IUIRuntimeScopeService = (0, _univerjs_core.createIdentifier)("ui.runtime-scope.service");
844
+ var UIRuntimeScopeService = class extends _univerjs_core.Disposable {
845
+ constructor(..._args) {
846
+ super(..._args);
847
+ _defineProperty(this, "_scopes", /* @__PURE__ */ new Map());
848
+ }
849
+ register(scope) {
850
+ this._scopes.set(scope.unitId, scope);
851
+ return (0, _univerjs_core.toDisposable)(() => {
852
+ if (this._scopes.get(scope.unitId) === scope) this._scopes.delete(scope.unitId);
853
+ });
854
+ }
855
+ get(unitId) {
856
+ return unitId ? this._scopes.get(unitId) : void 0;
857
+ }
858
+ };
859
+
833
860
  //#endregion
834
861
  //#region src/services/shortcut/shortcut.service.ts
835
862
  /**
863
+ * Defines whether a Univer shortcut should yield to the browser's native behavior
864
+ * when the keyboard event originates from an editable text element.
865
+ */
866
+ let NativeTextEditorShortcutBehavior = /* @__PURE__ */ function(NativeTextEditorShortcutBehavior) {
867
+ NativeTextEditorShortcutBehavior[NativeTextEditorShortcutBehavior["ALLOW_NATIVE"] = 0] = "ALLOW_NATIVE";
868
+ NativeTextEditorShortcutBehavior[NativeTextEditorShortcutBehavior["OVERRIDE_NATIVE"] = 1] = "OVERRIDE_NATIVE";
869
+ return NativeTextEditorShortcutBehavior;
870
+ }({});
871
+ /**
836
872
  * The dependency injection identifier of the {@link IShortcutService}.
837
873
  */
838
874
  const IShortcutService = (0, _univerjs_core.createIdentifier)("ui.shortcut.service");
839
875
  let ShortcutService = class ShortcutService extends _univerjs_core.Disposable {
840
- constructor(_commandService, _platformService, _contextService, _layoutService) {
876
+ constructor(_commandService, _platformService, _contextService, _runtimeScopeService, _layoutService) {
841
877
  super();
842
878
  this._commandService = _commandService;
843
879
  this._platformService = _platformService;
844
880
  this._contextService = _contextService;
881
+ this._runtimeScopeService = _runtimeScopeService;
845
882
  this._layoutService = _layoutService;
846
883
  _defineProperty(this, "_shortCutMapping", /* @__PURE__ */ new Map());
847
884
  _defineProperty(this, "_commandIDMapping", /* @__PURE__ */ new Map());
@@ -911,25 +948,29 @@ let ShortcutService = class ShortcutService extends _univerjs_core.Disposable {
911
948
  _resolveKeyboardEvent(e) {
912
949
  const candidate = this.dispatch(e);
913
950
  if (candidate) {
914
- this._commandService.executeCommand(candidate.id, candidate.staticParameters);
951
+ var _this$_getRuntimeServ, _this$_getRuntimeServ2;
952
+ (_this$_getRuntimeServ = (_this$_getRuntimeServ2 = this._getRuntimeService(e, _univerjs_core.ICommandService)) === null || _this$_getRuntimeServ2 === void 0 ? void 0 : _this$_getRuntimeServ2.executeCommand(candidate.id, candidate.staticParameters)) !== null && _this$_getRuntimeServ !== void 0 || this._commandService.executeCommand(candidate.id, candidate.staticParameters);
915
953
  e.preventDefault();
916
954
  }
917
955
  }
918
956
  dispatch(e) {
957
+ var _this$_getRuntimeServ3;
919
958
  if (this._forceEscaped || this._forceDisabled) return;
920
959
  if (this._layoutService && !this._layoutService.checkElementInCurrentContainers(e.target)) return;
921
960
  const binding = this._deriveBindingFromEvent(e);
922
961
  if (binding === null) return;
923
- if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding)) return;
924
962
  const shortcuts = this._shortCutMapping.get(binding);
925
963
  if (shortcuts === void 0) return;
926
- return Array.from(shortcuts).sort((s1, s2) => {
964
+ const contextService = (_this$_getRuntimeServ3 = this._getRuntimeService(e, _univerjs_core.IContextService)) !== null && _this$_getRuntimeServ3 !== void 0 ? _this$_getRuntimeServ3 : this._contextService;
965
+ const candidateShortcut = Array.from(shortcuts).sort((s1, s2) => {
927
966
  var _s2$priority, _s1$priority;
928
967
  return ((_s2$priority = s2.priority) !== null && _s2$priority !== void 0 ? _s2$priority : 0) - ((_s1$priority = s1.priority) !== null && _s1$priority !== void 0 ? _s1$priority : 0);
929
968
  }).find((s) => {
930
- var _s$preconditions, _s$preconditions2;
931
- return (_s$preconditions = (_s$preconditions2 = s.preconditions) === null || _s$preconditions2 === void 0 ? void 0 : _s$preconditions2.call(s, this._contextService)) !== null && _s$preconditions !== void 0 ? _s$preconditions : true;
969
+ var _s$eventPreconditions, _s$eventPreconditions2, _s$preconditions, _s$preconditions2;
970
+ return ((_s$eventPreconditions = (_s$eventPreconditions2 = s.eventPreconditions) === null || _s$eventPreconditions2 === void 0 ? void 0 : _s$eventPreconditions2.call(s, e)) !== null && _s$eventPreconditions !== void 0 ? _s$eventPreconditions : true) && ((_s$preconditions = (_s$preconditions2 = s.preconditions) === null || _s$preconditions2 === void 0 ? void 0 : _s$preconditions2.call(s, contextService)) !== null && _s$preconditions !== void 0 ? _s$preconditions : true);
932
971
  });
972
+ if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding) && (candidateShortcut === null || candidateShortcut === void 0 ? void 0 : candidateShortcut.nativeTextEditorBehavior) !== 1) return;
973
+ return candidateShortcut;
933
974
  }
934
975
  _getBindingFromItem(item) {
935
976
  if (this._platformService.isMac && item.mac) return item.mac;
@@ -952,12 +993,18 @@ let ShortcutService = class ShortcutService extends _univerjs_core.Disposable {
952
993
  if (!(target instanceof HTMLElement)) return false;
953
994
  return (target.isContentEditable || target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) && isEmbedBoundaryTarget(target);
954
995
  }
996
+ _getRuntimeService(event, identifier) {
997
+ const childUnitId = getEmbedChildUnitId(event.target);
998
+ const runtimeScope = this._runtimeScopeService.get(childUnitId);
999
+ return (runtimeScope === null || runtimeScope === void 0 ? void 0 : runtimeScope.has(identifier)) ? runtimeScope.get(identifier) : void 0;
1000
+ }
955
1001
  };
956
1002
  ShortcutService = __decorate([
957
1003
  __decorateParam(0, _univerjs_core.ICommandService),
958
1004
  __decorateParam(1, IPlatformService),
959
1005
  __decorateParam(2, _univerjs_core.IContextService),
960
- __decorateParam(3, (0, _univerjs_core.Optional)(ILayoutService))
1006
+ __decorateParam(3, IUIRuntimeScopeService),
1007
+ __decorateParam(4, (0, _univerjs_core.Optional)(ILayoutService))
961
1008
  ], ShortcutService);
962
1009
 
963
1010
  //#endregion
@@ -1073,6 +1120,7 @@ let RibbonStartGroup = /* @__PURE__ */ function(RibbonStartGroup) {
1073
1120
  RibbonStartGroup["HISTORY"] = "ribbon.start.history";
1074
1121
  RibbonStartGroup["FORMAT"] = "ribbon.start.format";
1075
1122
  RibbonStartGroup["LAYOUT"] = "ribbon.start.layout";
1123
+ RibbonStartGroup["NUMBER"] = "ribbon.start.number";
1076
1124
  RibbonStartGroup["OTHERS"] = "ribbon.start.others";
1077
1125
  return RibbonStartGroup;
1078
1126
  }({});
@@ -1151,7 +1199,8 @@ let MenuManagerService = _MenuManagerService = class MenuManagerService extends
1151
1199
  ["ribbon.start.history"]: { order: 0 },
1152
1200
  ["ribbon.start.format"]: { order: 1 },
1153
1201
  ["ribbon.start.layout"]: { order: 2 },
1154
- ["ribbon.start.others"]: { order: 3 }
1202
+ ["ribbon.start.number"]: { order: 3 },
1203
+ ["ribbon.start.others"]: { order: 4 }
1155
1204
  },
1156
1205
  ["ribbon.insert"]: {
1157
1206
  order: 1,
@@ -1299,7 +1348,8 @@ let MenuManagerService = _MenuManagerService = class MenuManagerService extends
1299
1348
  quickLayout: value.quickLayout,
1300
1349
  quickColumns: value.quickColumns,
1301
1350
  quickLayoutVariant: value.quickLayoutVariant,
1302
- tiny: value.tiny
1351
+ tiny: value.tiny,
1352
+ gridLayout: value.gridLayout
1303
1353
  };
1304
1354
  if (value.menuItemFactory) {
1305
1355
  const item = this._injector.invoke(value.menuItemFactory);
@@ -1410,6 +1460,10 @@ ShortcutPanelController = __decorate([
1410
1460
  __decorateParam(2, _univerjs_core.ICommandService)
1411
1461
  ], ShortcutPanelController);
1412
1462
 
1463
+ //#endregion
1464
+ //#region src/services/dialog/dialog.service.ts
1465
+ const IDialogService = (0, _univerjs_core.createIdentifier)("univer.ui.dialog-service");
1466
+
1413
1467
  //#endregion
1414
1468
  //#region src/services/menu/menu.ts
1415
1469
  let MenuItemType = /* @__PURE__ */ function(MenuItemType) {
@@ -1428,7 +1482,372 @@ function isMenuButtonSelectorItem(v) {
1428
1482
  }
1429
1483
 
1430
1484
  //#endregion
1431
- //#region src/controllers/menus/menus.ts
1485
+ //#region src/services/ribbon/ribbon.service.ts
1486
+ const IRibbonService = (0, _univerjs_core.createIdentifier)("univer.ribbon-service");
1487
+ function isSameHiddenMap(previous, current) {
1488
+ return previous.length === current.length && previous.every((hidden, index) => hidden === current[index]);
1489
+ }
1490
+ let DesktopRibbonService = class DesktopRibbonService extends _univerjs_core.Disposable {
1491
+ constructor(_menuManagerService, _univerInstanceService) {
1492
+ super();
1493
+ this._menuManagerService = _menuManagerService;
1494
+ this._univerInstanceService = _univerInstanceService;
1495
+ _defineProperty(this, "_ribbon$", new rxjs.BehaviorSubject([]));
1496
+ _defineProperty(this, "ribbon$", this._ribbon$.asObservable());
1497
+ _defineProperty(this, "_activatedTab$", new rxjs.BehaviorSubject("ribbon.start"));
1498
+ _defineProperty(this, "activatedTab$", this._activatedTab$.asObservable());
1499
+ _defineProperty(this, "_collapsedIds$", new rxjs.BehaviorSubject([]));
1500
+ _defineProperty(this, "collapsedIds$", this._collapsedIds$.asObservable());
1501
+ _defineProperty(this, "_fakeToolbarVisible$", new rxjs.BehaviorSubject(false));
1502
+ _defineProperty(this, "fakeToolbarVisible$", this._fakeToolbarVisible$.asObservable());
1503
+ _defineProperty(this, "_visibleContextualTabs", /* @__PURE__ */ new Set());
1504
+ _defineProperty(this, "_contextualTabs", /* @__PURE__ */ new Set());
1505
+ _defineProperty(this, "_lastNonContextualActivatedTab", "ribbon.start");
1506
+ _defineProperty(this, "_hiddenSubscription", null);
1507
+ this._initRibbonSubscription();
1508
+ }
1509
+ setActivatedTab(tab) {
1510
+ if (!this._isContextualTab(tab)) this._lastNonContextualActivatedTab = tab;
1511
+ this._activatedTab$.next(tab);
1512
+ }
1513
+ showContextualTab(tab, options) {
1514
+ this._visibleContextualTabs.add(tab);
1515
+ this._updateRibbon();
1516
+ if (options === null || options === void 0 ? void 0 : options.activate) this.setActivatedTab(tab);
1517
+ }
1518
+ hideContextualTab(tab) {
1519
+ if (!this._visibleContextualTabs.delete(tab)) return;
1520
+ this._updateRibbon();
1521
+ }
1522
+ hideAllContextualTabs() {
1523
+ if (this._visibleContextualTabs.size === 0) return;
1524
+ this._visibleContextualTabs.clear();
1525
+ this._updateRibbon();
1526
+ }
1527
+ setCollapsedIds(ids) {
1528
+ this._collapsedIds$.next(ids);
1529
+ }
1530
+ setFakeToolbarVisible(visible) {
1531
+ this._fakeToolbarVisible$.next(visible);
1532
+ }
1533
+ _initRibbonSubscription() {
1534
+ this.disposeWithMe((0, rxjs.combineLatest)([this._menuManagerService.menuChanged$.pipe((0, rxjs_operators.startWith)(void 0)), this._univerInstanceService.focused$.pipe((0, rxjs_operators.startWith)(void 0), (0, rxjs_operators.distinctUntilChanged)())]).subscribe(() => {
1535
+ this._updateRibbon();
1536
+ }));
1537
+ }
1538
+ _updateRibbon() {
1539
+ var _this$_hiddenSubscrip;
1540
+ const ribbon = this._filterContextualTabs(this._menuManagerService.getMenuByPositionKey("ribbon"));
1541
+ const hiddenObservableMap = [];
1542
+ const hiddenKeyMap = [];
1543
+ for (const group of ribbon) if (group.children) {
1544
+ for (const item of group.children) if (item.children) for (const child of item.children) {
1545
+ var _child$item;
1546
+ if ((_child$item = child.item) === null || _child$item === void 0 ? void 0 : _child$item.hidden$) {
1547
+ hiddenObservableMap.push(child.item.hidden$);
1548
+ hiddenKeyMap.push(child.key);
1549
+ }
1550
+ }
1551
+ }
1552
+ (_this$_hiddenSubscrip = this._hiddenSubscription) === null || _this$_hiddenSubscrip === void 0 || _this$_hiddenSubscrip.unsubscribe();
1553
+ this._hiddenSubscription = null;
1554
+ if (hiddenObservableMap.length === 0) {
1555
+ this._setRibbon(ribbon);
1556
+ return;
1557
+ }
1558
+ this._hiddenSubscription = (0, rxjs.combineLatest)(hiddenObservableMap.map((hidden$) => hidden$.pipe((0, rxjs_operators.startWith)(false)))).pipe((0, rxjs_operators.distinctUntilChanged)(isSameHiddenMap)).subscribe((hiddenMap) => {
1559
+ const newRibbon = [];
1560
+ const hiddenPathMap = hiddenMap.map((hidden, index) => {
1561
+ if (hidden) return hiddenKeyMap[index];
1562
+ return null;
1563
+ }).filter((item) => !!item);
1564
+ for (const group of ribbon) {
1565
+ var _group$children, _newGroup$children2;
1566
+ const newGroup = {
1567
+ ...group,
1568
+ children: []
1569
+ };
1570
+ if ((_group$children = group.children) === null || _group$children === void 0 ? void 0 : _group$children.length) for (const item of group.children) {
1571
+ var _item$children;
1572
+ const newItem = {
1573
+ ...item,
1574
+ children: []
1575
+ };
1576
+ let shouldAddItem = true;
1577
+ if ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) {
1578
+ var _newItem$children2;
1579
+ for (const child of item.children) if (!hiddenPathMap.includes(child.key)) {
1580
+ var _newItem$children;
1581
+ (_newItem$children = newItem.children) === null || _newItem$children === void 0 || _newItem$children.push(child);
1582
+ }
1583
+ if ((_newItem$children2 = newItem.children) === null || _newItem$children2 === void 0 ? void 0 : _newItem$children2.every((child) => {
1584
+ var _child$children;
1585
+ return ((_child$children = child.children) === null || _child$children === void 0 ? void 0 : _child$children.length) === 0;
1586
+ })) shouldAddItem = false;
1587
+ }
1588
+ if (shouldAddItem) {
1589
+ var _newGroup$children;
1590
+ (_newGroup$children = newGroup.children) === null || _newGroup$children === void 0 || _newGroup$children.push(newItem);
1591
+ }
1592
+ }
1593
+ if (((_newGroup$children2 = newGroup.children) === null || _newGroup$children2 === void 0 ? void 0 : _newGroup$children2.length) && newGroup.children.every((item) => {
1594
+ var _item$children2;
1595
+ return (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length;
1596
+ })) newRibbon.push(newGroup);
1597
+ }
1598
+ this._setRibbon(newRibbon);
1599
+ });
1600
+ }
1601
+ _filterContextualTabs(ribbon) {
1602
+ this._contextualTabs.clear();
1603
+ ribbon.forEach((group) => {
1604
+ if (group.contextual) this._contextualTabs.add(group.key);
1605
+ });
1606
+ return ribbon.filter((group) => !group.contextual || this._visibleContextualTabs.has(group.key));
1607
+ }
1608
+ _setRibbon(ribbon) {
1609
+ const activatedTab = this._activatedTab$.getValue();
1610
+ const activeGroup = ribbon.find((group) => group.key === activatedTab);
1611
+ if (!activeGroup && this._contextualTabs.has(activatedTab)) {
1612
+ var _ref, _ribbon$find;
1613
+ const fallbackTab = (_ref = (_ribbon$find = ribbon.find((group) => group.key === this._lastNonContextualActivatedTab && !group.contextual)) !== null && _ribbon$find !== void 0 ? _ribbon$find : ribbon.find((group) => group.key === "ribbon.start")) !== null && _ref !== void 0 ? _ref : ribbon[0];
1614
+ if (fallbackTab) this._activatedTab$.next(fallbackTab.key);
1615
+ } else if (!activeGroup && ribbon.some((group) => group.key === "ribbon.start")) {
1616
+ const fallbackTab = ribbon.find((group) => group.key === "ribbon.start");
1617
+ this._activatedTab$.next(fallbackTab.key);
1618
+ if (!fallbackTab.contextual) this._lastNonContextualActivatedTab = fallbackTab.key;
1619
+ } else if (activeGroup && !activeGroup.contextual) this._lastNonContextualActivatedTab = activeGroup.key;
1620
+ this._ribbon$.next(ribbon);
1621
+ }
1622
+ _isContextualTab(tab) {
1623
+ return this._contextualTabs.has(tab) || this._ribbon$.getValue().some((group) => group.key === tab && group.contextual);
1624
+ }
1625
+ dispose() {
1626
+ var _this$_hiddenSubscrip2;
1627
+ (_this$_hiddenSubscrip2 = this._hiddenSubscription) === null || _this$_hiddenSubscrip2 === void 0 || _this$_hiddenSubscrip2.unsubscribe();
1628
+ this._hiddenSubscription = null;
1629
+ this._ribbon$.next([]);
1630
+ this._ribbon$.complete();
1631
+ this._activatedTab$.complete();
1632
+ this._collapsedIds$.complete();
1633
+ this._fakeToolbarVisible$.complete();
1634
+ super.dispose();
1635
+ }
1636
+ };
1637
+ DesktopRibbonService = __decorate([__decorateParam(0, IMenuManagerService), __decorateParam(1, _univerjs_core.IUniverInstanceService)], DesktopRibbonService);
1638
+
1639
+ //#endregion
1640
+ //#region src/utils/di.ts
1641
+ function unwrap(o) {
1642
+ if (typeof o === "function") return o();
1643
+ return o;
1644
+ }
1645
+ function useObservableRef(observable, defaultValue) {
1646
+ const ref = (0, react.useRef)(defaultValue);
1647
+ (0, react.useEffect)(() => {
1648
+ if (observable) {
1649
+ const sub = unwrap(observable).subscribe((value) => {
1650
+ ref.current = value;
1651
+ });
1652
+ return () => sub.unsubscribe();
1653
+ }
1654
+ }, [observable]);
1655
+ return ref;
1656
+ }
1657
+
1658
+ //#endregion
1659
+ //#region src/views/components/feature-search/FeatureSearch.tsx
1660
+ const FEATURE_SEARCH_COMPONENT = "FeatureSearch";
1661
+ const FEATURE_SEARCH_DIALOG_ID = "FEATURE_SEARCH_DIALOG";
1662
+ function resolveParams(item, value) {
1663
+ const params = typeof item.params === "function" ? item.params() : item.params;
1664
+ return params !== null && params !== void 0 ? params : value === void 0 ? void 0 : { value };
1665
+ }
1666
+ function resolveOptionParams(option) {
1667
+ const params = typeof option.params === "function" ? option.params(option.value) : option.params;
1668
+ return params !== null && params !== void 0 ? params : option.value === void 0 ? void 0 : { value: option.value };
1669
+ }
1670
+ function deduplicate(items) {
1671
+ return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && _univerjs_core.Tools.diffValue(candidate.params, item.params)) === index);
1672
+ }
1673
+ function FeatureSearch() {
1674
+ const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
1675
+ const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
1676
+ const commandService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ICommandService);
1677
+ const dialogService = (0, _wendellhu_redi_react_bindings.useDependency)(IDialogService);
1678
+ const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
1679
+ const ribbonService = (0, _wendellhu_redi_react_bindings.useDependency)(IRibbonService);
1680
+ const items = (0, _wendellhu_redi_react_bindings.useObservable)((0, react.useMemo)(() => {
1681
+ function getItemTitle(item) {
1682
+ var _ref, _item$title;
1683
+ const titleKey = (_ref = (_item$title = item.title) !== null && _item$title !== void 0 ? _item$title : item.tooltip) !== null && _ref !== void 0 ? _ref : item.description;
1684
+ return titleKey ? localeService.t(titleKey) : "";
1685
+ }
1686
+ function collectCandidates(schemas, path, keyPath, ancestors = [], parentTitle) {
1687
+ return schemas.flatMap((schema, index) => {
1688
+ var _schema$title;
1689
+ const schemaTitle = localeService.t((_schema$title = schema.title) !== null && _schema$title !== void 0 ? _schema$title : "");
1690
+ const schemaPath = schemaTitle ? [...path, schemaTitle] : path;
1691
+ const schemaKeyPath = [...keyPath, `${schema.key}:${index}`];
1692
+ const result = [];
1693
+ if (schema.item) result.push({
1694
+ key: `${schemaKeyPath.join("/")}:item`,
1695
+ item: schema.item,
1696
+ path: schemaPath,
1697
+ ancestors,
1698
+ parentTitle
1699
+ });
1700
+ if (schema.headerActionItem) result.push({
1701
+ key: `${schemaKeyPath.join("/")}:header`,
1702
+ item: schema.headerActionItem,
1703
+ path: schemaPath,
1704
+ ancestors,
1705
+ parentTitle
1706
+ });
1707
+ if (schema.children) result.push(...collectCandidates(schema.children, schemaPath, schemaKeyPath, schema.item ? [...ancestors, schema.item] : ancestors, schema.item ? getItemTitle(schema.item) : parentTitle));
1708
+ return result;
1709
+ });
1710
+ }
1711
+ function observeCandidate(candidate) {
1712
+ var _item$hidden$$pipe, _item$hidden$, _item$disabled$$pipe, _item$disabled$, _item$value$$pipe, _item$value$;
1713
+ const { item } = candidate;
1714
+ const hasOptions = item.type === 1 || item.type === 2;
1715
+ const selections = hasOptions ? item.selections : void 0;
1716
+ const selections$ = (0, rxjs.isObservable)(selections) ? selections.pipe((0, rxjs_operators.startWith)([])) : (0, rxjs.of)(selections !== null && selections !== void 0 ? selections : []);
1717
+ return (0, rxjs.combineLatest)([
1718
+ candidate.ancestors.length ? (0, rxjs.combineLatest)(candidate.ancestors.map((ancestor) => {
1719
+ var _ancestor$hidden$$pip, _ancestor$hidden$;
1720
+ return (_ancestor$hidden$$pip = (_ancestor$hidden$ = ancestor.hidden$) === null || _ancestor$hidden$ === void 0 ? void 0 : _ancestor$hidden$.pipe((0, rxjs_operators.startWith)(true))) !== null && _ancestor$hidden$$pip !== void 0 ? _ancestor$hidden$$pip : (0, rxjs.of)(false);
1721
+ })).pipe((0, rxjs_operators.map)((states) => states.some(Boolean))) : (0, rxjs.of)(false),
1722
+ candidate.ancestors.length ? (0, rxjs.combineLatest)(candidate.ancestors.map((ancestor) => {
1723
+ var _ancestor$disabled$$p, _ancestor$disabled$;
1724
+ return (_ancestor$disabled$$p = (_ancestor$disabled$ = ancestor.disabled$) === null || _ancestor$disabled$ === void 0 ? void 0 : _ancestor$disabled$.pipe((0, rxjs_operators.startWith)(true))) !== null && _ancestor$disabled$$p !== void 0 ? _ancestor$disabled$$p : (0, rxjs.of)(false);
1725
+ })).pipe((0, rxjs_operators.map)((states) => states.some(Boolean))) : (0, rxjs.of)(false),
1726
+ (_item$hidden$$pipe = (_item$hidden$ = item.hidden$) === null || _item$hidden$ === void 0 ? void 0 : _item$hidden$.pipe((0, rxjs_operators.startWith)(true))) !== null && _item$hidden$$pipe !== void 0 ? _item$hidden$$pipe : (0, rxjs.of)(false),
1727
+ (_item$disabled$$pipe = (_item$disabled$ = item.disabled$) === null || _item$disabled$ === void 0 ? void 0 : _item$disabled$.pipe((0, rxjs_operators.startWith)(true))) !== null && _item$disabled$$pipe !== void 0 ? _item$disabled$$pipe : (0, rxjs.of)(false),
1728
+ (_item$value$$pipe = (_item$value$ = item.value$) === null || _item$value$ === void 0 ? void 0 : _item$value$.pipe((0, rxjs_operators.startWith)(void 0))) !== null && _item$value$$pipe !== void 0 ? _item$value$$pipe : (0, rxjs.of)(void 0),
1729
+ selections$
1730
+ ]).pipe((0, rxjs_operators.map)(([ancestorHidden, ancestorDisabled, hidden, disabled, value, options]) => {
1731
+ if (ancestorHidden || ancestorDisabled || hidden || disabled) return [];
1732
+ const title = getItemTitle(item);
1733
+ const path = candidate.path.join(" / ");
1734
+ const result = [];
1735
+ if (title && item.type !== 1 && item.type !== 3) {
1736
+ var _item$description, _item$commandId;
1737
+ result.push({
1738
+ key: candidate.key,
1739
+ title,
1740
+ parentTitle: candidate.parentTitle,
1741
+ description: localeService.t((_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : ""),
1742
+ path,
1743
+ commandId: (_item$commandId = item.commandId) !== null && _item$commandId !== void 0 ? _item$commandId : item.id,
1744
+ params: resolveParams(item, value),
1745
+ getParams: () => resolveParams(item, value)
1746
+ });
1747
+ }
1748
+ if (hasOptions) options.forEach((option, index) => {
1749
+ var _ref2, _ref3, _ref4, _option$commandId, _ref5, _ref6, _option$id;
1750
+ if (option.disabled || typeof option.label !== "string") return;
1751
+ const commandId = (_ref2 = (_ref3 = (_ref4 = (_option$commandId = option.commandId) !== null && _option$commandId !== void 0 ? _option$commandId : option.id) !== null && _ref4 !== void 0 ? _ref4 : item.selectionsCommandId) !== null && _ref3 !== void 0 ? _ref3 : item.commandId) !== null && _ref2 !== void 0 ? _ref2 : item.id;
1752
+ result.push({
1753
+ key: `${candidate.key}:option:${(_ref5 = (_ref6 = (_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : option.commandId) !== null && _ref6 !== void 0 ? _ref6 : option.value) !== null && _ref5 !== void 0 ? _ref5 : index}`,
1754
+ title: localeService.t(option.label),
1755
+ parentTitle: title,
1756
+ description: "",
1757
+ path,
1758
+ commandId,
1759
+ params: resolveOptionParams(option),
1760
+ getParams: () => resolveOptionParams(option)
1761
+ });
1762
+ });
1763
+ return result;
1764
+ }));
1765
+ }
1766
+ return (0, rxjs.combineLatest)([ribbonService.ribbon$, (0, rxjs.merge)((0, rxjs.of)(void 0), menuManagerService.menuChanged$, localeService.localeChanged$)]).pipe((0, rxjs_operators.switchMap)(([ribbon]) => {
1767
+ const candidates = [...collectCandidates(ribbon, [localeService.t("ui.featureSearch.ribbon")], ["ribbon"]), ...collectCandidates(menuManagerService.getMenuByPositionKey("contextMenu"), [localeService.t("ui.featureSearch.contextMenu")], ["contextMenu"])];
1768
+ if (candidates.length === 0) return (0, rxjs.of)([]);
1769
+ return (0, rxjs.combineLatest)(candidates.map(observeCandidate)).pipe((0, rxjs_operators.map)((items) => deduplicate(items.flat())));
1770
+ }));
1771
+ }, [
1772
+ localeService,
1773
+ menuManagerService,
1774
+ ribbonService
1775
+ ]), []);
1776
+ async function execute(item) {
1777
+ layoutService.focus();
1778
+ if (await commandService.executeCommand(item.commandId, item.getParams())) dialogService.close(FEATURE_SEARCH_DIALOG_ID);
1779
+ }
1780
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.Command, {
1781
+ label: localeService.t("ui.featureSearch.title"),
1782
+ loop: true,
1783
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.CommandInput, {
1784
+ autoFocus: true,
1785
+ placeholder: localeService.t("ui.featureSearch.placeholder")
1786
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.CommandList, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.CommandEmpty, { children: localeService.t("ui.featureSearch.empty") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.CommandGroup, { children: items.map((item) => {
1787
+ var _item$parentTitle;
1788
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.CommandItem, {
1789
+ value: item.key,
1790
+ keywords: [
1791
+ (_item$parentTitle = item.parentTitle) !== null && _item$parentTitle !== void 0 ? _item$parentTitle : "",
1792
+ item.title,
1793
+ item.description,
1794
+ item.path
1795
+ ],
1796
+ onSelect: () => execute(item),
1797
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1798
+ className: "univer-flex univer-min-w-0 univer-flex-1 univer-items-center univer-gap-1",
1799
+ children: [item.parentTitle && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1800
+ className: "univer-shrink-0",
1801
+ children: item.parentTitle
1802
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1803
+ className: "univer-text-gray-400",
1804
+ children: "/"
1805
+ })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1806
+ className: "univer-truncate",
1807
+ children: item.title
1808
+ })]
1809
+ }), item.path && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1810
+ className: "univer-max-w-1/2 univer-truncate univer-text-xs univer-text-gray-400",
1811
+ children: item.path
1812
+ })]
1813
+ }, item.key);
1814
+ }) })] })]
1815
+ });
1816
+ }
1817
+
1818
+ //#endregion
1819
+ //#region src/commands/operations/open-feature-search.operation.ts
1820
+ const OpenFeatureSearchOperation = {
1821
+ id: "ui.operation.open-feature-search",
1822
+ type: _univerjs_core.CommandType.OPERATION,
1823
+ handler: (accessor) => {
1824
+ const dialogService = accessor.get(IDialogService);
1825
+ const localeService = accessor.get(_univerjs_core.LocaleService);
1826
+ dialogService.open({
1827
+ id: FEATURE_SEARCH_DIALOG_ID,
1828
+ width: 560,
1829
+ title: { title: localeService.t("ui.featureSearch.title") },
1830
+ children: { label: FEATURE_SEARCH_COMPONENT },
1831
+ onClose: () => dialogService.close(FEATURE_SEARCH_DIALOG_ID)
1832
+ });
1833
+ return true;
1834
+ }
1835
+ };
1836
+
1837
+ //#endregion
1838
+ //#region src/menu/feature-search.menu.ts
1839
+ function FeatureSearchMenuItemFactory() {
1840
+ return {
1841
+ id: OpenFeatureSearchOperation.id,
1842
+ title: "ui.featureSearch.title",
1843
+ tooltip: "ui.featureSearch.title",
1844
+ icon: "FeatureSearchIcon",
1845
+ type: 0
1846
+ };
1847
+ }
1848
+
1849
+ //#endregion
1850
+ //#region src/menu/history.menu.ts
1432
1851
  const undoRedoDisableFactory$ = (accessor, isUndo) => {
1433
1852
  const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
1434
1853
  const contextService = accessor.get(_univerjs_core.IContextService);
@@ -1461,13 +1880,13 @@ function RedoMenuItemFactory(accessor) {
1461
1880
  }
1462
1881
 
1463
1882
  //#endregion
1464
- //#region src/controllers/shortcut-display/menu.ts
1883
+ //#region src/menu/shortcut-panel.menu.ts
1465
1884
  function ShortcutPanelMenuItemFactory() {
1466
1885
  return {
1467
1886
  id: ToggleShortcutPanelOperation.id,
1468
1887
  title: "ui.toggle-shortcut-panel",
1469
1888
  tooltip: "ui.toggle-shortcut-panel",
1470
- icon: "ShortcutIcon",
1889
+ icon: "KeyboardIcon",
1471
1890
  type: 0
1472
1891
  };
1473
1892
  }
@@ -1478,17 +1897,33 @@ const menuSchema = {
1478
1897
  ["ribbon.start.history"]: {
1479
1898
  [_univerjs_core.UndoCommand.id]: {
1480
1899
  order: 0,
1900
+ gridLayout: {
1901
+ row: 1,
1902
+ column: 1,
1903
+ iconSize: 18
1904
+ },
1481
1905
  menuItemFactory: UndoMenuItemFactory
1482
1906
  },
1483
1907
  [_univerjs_core.RedoCommand.id]: {
1484
1908
  order: 1,
1909
+ gridLayout: {
1910
+ row: 2,
1911
+ column: 1,
1912
+ iconSize: 18
1913
+ },
1485
1914
  menuItemFactory: RedoMenuItemFactory
1486
1915
  }
1487
1916
  },
1488
- ["ribbon.start.others"]: { [ToggleShortcutPanelOperation.id]: {
1489
- order: 1,
1490
- menuItemFactory: ShortcutPanelMenuItemFactory
1491
- } }
1917
+ ["ribbon.start.others"]: {
1918
+ [ToggleShortcutPanelOperation.id]: {
1919
+ order: 1,
1920
+ menuItemFactory: ShortcutPanelMenuItemFactory
1921
+ },
1922
+ [OpenFeatureSearchOperation.id]: {
1923
+ order: 2,
1924
+ menuItemFactory: FeatureSearchMenuItemFactory
1925
+ }
1926
+ }
1492
1927
  };
1493
1928
 
1494
1929
  //#endregion
@@ -1514,6 +1949,7 @@ var UIPartsService = class extends _univerjs_core.Disposable {
1514
1949
  constructor(..._args) {
1515
1950
  super(..._args);
1516
1951
  _defineProperty(this, "_componentsByPart", /* @__PURE__ */ new Map());
1952
+ _defineProperty(this, "_disabledUIParts", /* @__PURE__ */ new Map());
1517
1953
  _defineProperty(this, "_componentRegistered$", new rxjs.Subject());
1518
1954
  _defineProperty(this, "componentRegistered$", this._componentRegistered$.asObservable());
1519
1955
  _defineProperty(this, "_uiVisible", /* @__PURE__ */ new Map());
@@ -1523,21 +1959,56 @@ var UIPartsService = class extends _univerjs_core.Disposable {
1523
1959
  dispose() {
1524
1960
  super.dispose();
1525
1961
  this._componentsByPart.clear();
1962
+ this._disabledUIParts.clear();
1526
1963
  this._uiVisible.clear();
1527
1964
  this._componentRegistered$.complete();
1528
1965
  this._uiVisibleChange$.complete();
1529
1966
  }
1530
1967
  setUIVisible(part, visible) {
1968
+ const wasVisible = this.isUIVisible(part);
1531
1969
  this._uiVisible.set(part, visible);
1532
- this._uiVisibleChange$.next({
1970
+ const isVisible = this.isUIVisible(part);
1971
+ if (wasVisible !== isVisible) this._uiVisibleChange$.next({
1533
1972
  ui: part,
1534
- visible
1973
+ visible: isVisible
1535
1974
  });
1536
1975
  }
1537
1976
  isUIVisible(part) {
1538
- var _this$_uiVisible$get;
1539
- return (_this$_uiVisible$get = this._uiVisible.get(part)) !== null && _this$_uiVisible$get !== void 0 ? _this$_uiVisible$get : true;
1540
- }
1977
+ var _this$_uiVisible$get, _this$_disabledUIPart;
1978
+ return ((_this$_uiVisible$get = this._uiVisible.get(part)) !== null && _this$_uiVisible$get !== void 0 ? _this$_uiVisible$get : true) && !((_this$_disabledUIPart = this._disabledUIParts.get(part)) === null || _this$_disabledUIPart === void 0 ? void 0 : _this$_disabledUIPart.size);
1979
+ }
1980
+ registerDisabledUIParts(parts, disabled$) {
1981
+ const uniqueParts = [...new Set(parts)];
1982
+ const registration = Symbol("disabled-ui-parts");
1983
+ let disabled = false;
1984
+ const update = (nextDisabled) => {
1985
+ if (disabled === nextDisabled) return;
1986
+ disabled = nextDisabled;
1987
+ uniqueParts.forEach((part) => {
1988
+ var _this$_disabledUIPart2;
1989
+ const wasVisible = this.isUIVisible(part);
1990
+ const registrations = (_this$_disabledUIPart2 = this._disabledUIParts.get(part)) !== null && _this$_disabledUIPart2 !== void 0 ? _this$_disabledUIPart2 : /* @__PURE__ */ new Set();
1991
+ if (disabled) {
1992
+ registrations.add(registration);
1993
+ this._disabledUIParts.set(part, registrations);
1994
+ } else {
1995
+ registrations.delete(registration);
1996
+ if (registrations.size === 0) this._disabledUIParts.delete(part);
1997
+ }
1998
+ const isVisible = this.isUIVisible(part);
1999
+ if (wasVisible !== isVisible) this._uiVisibleChange$.next({
2000
+ ui: part,
2001
+ visible: isVisible
2002
+ });
2003
+ });
2004
+ };
2005
+ const subscription = disabled$.subscribe(update);
2006
+ const disposable = (0, _univerjs_core.toDisposable)(() => {
2007
+ subscription.unsubscribe();
2008
+ update(false);
2009
+ });
2010
+ return this.disposeWithMe(disposable);
2011
+ }
1541
2012
  registerComponent(part, componentFactory) {
1542
2013
  const componentType = componentFactory();
1543
2014
  const components = (this._componentsByPart.get(part) || this._componentsByPart.set(part, /* @__PURE__ */ new Set()).get(part)).add(componentType);
@@ -1553,25 +2024,6 @@ var UIPartsService = class extends _univerjs_core.Disposable {
1553
2024
  }
1554
2025
  };
1555
2026
 
1556
- //#endregion
1557
- //#region src/utils/di.ts
1558
- function unwrap(o) {
1559
- if (typeof o === "function") return o();
1560
- return o;
1561
- }
1562
- function useObservableRef(observable, defaultValue) {
1563
- const ref = (0, react.useRef)(defaultValue);
1564
- (0, react.useEffect)(() => {
1565
- if (observable) {
1566
- const sub = unwrap(observable).subscribe((value) => {
1567
- ref.current = value;
1568
- });
1569
- return () => sub.unsubscribe();
1570
- }
1571
- }, [observable]);
1572
- return ref;
1573
- }
1574
-
1575
2027
  //#endregion
1576
2028
  //#region src/services/dom/canvas-dom-layer.service.ts
1577
2029
  function shouldForwardFloatDomEvents(layer) {
@@ -2168,160 +2620,6 @@ var RibbonOverrideService = class extends _univerjs_core.Disposable {
2168
2620
  }
2169
2621
  };
2170
2622
 
2171
- //#endregion
2172
- //#region src/services/ribbon/ribbon.service.ts
2173
- const IRibbonService = (0, _univerjs_core.createIdentifier)("univer.ribbon-service");
2174
- function isSameHiddenMap(previous, current) {
2175
- return previous.length === current.length && previous.every((hidden, index) => hidden === current[index]);
2176
- }
2177
- let DesktopRibbonService = class DesktopRibbonService extends _univerjs_core.Disposable {
2178
- constructor(_menuManagerService, _univerInstanceService) {
2179
- super();
2180
- this._menuManagerService = _menuManagerService;
2181
- this._univerInstanceService = _univerInstanceService;
2182
- _defineProperty(this, "_ribbon$", new rxjs.BehaviorSubject([]));
2183
- _defineProperty(this, "ribbon$", this._ribbon$.asObservable());
2184
- _defineProperty(this, "_activatedTab$", new rxjs.BehaviorSubject("ribbon.start"));
2185
- _defineProperty(this, "activatedTab$", this._activatedTab$.asObservable());
2186
- _defineProperty(this, "_collapsedIds$", new rxjs.BehaviorSubject([]));
2187
- _defineProperty(this, "collapsedIds$", this._collapsedIds$.asObservable());
2188
- _defineProperty(this, "_fakeToolbarVisible$", new rxjs.BehaviorSubject(false));
2189
- _defineProperty(this, "fakeToolbarVisible$", this._fakeToolbarVisible$.asObservable());
2190
- _defineProperty(this, "_visibleContextualTabs", /* @__PURE__ */ new Set());
2191
- _defineProperty(this, "_contextualTabs", /* @__PURE__ */ new Set());
2192
- _defineProperty(this, "_lastNonContextualActivatedTab", "ribbon.start");
2193
- _defineProperty(this, "_hiddenSubscription", null);
2194
- this._initRibbonSubscription();
2195
- }
2196
- setActivatedTab(tab) {
2197
- if (!this._isContextualTab(tab)) this._lastNonContextualActivatedTab = tab;
2198
- this._activatedTab$.next(tab);
2199
- }
2200
- showContextualTab(tab, options) {
2201
- this._visibleContextualTabs.add(tab);
2202
- this._updateRibbon();
2203
- if (options === null || options === void 0 ? void 0 : options.activate) this.setActivatedTab(tab);
2204
- }
2205
- hideContextualTab(tab) {
2206
- if (!this._visibleContextualTabs.delete(tab)) return;
2207
- this._updateRibbon();
2208
- }
2209
- hideAllContextualTabs() {
2210
- if (this._visibleContextualTabs.size === 0) return;
2211
- this._visibleContextualTabs.clear();
2212
- this._updateRibbon();
2213
- }
2214
- setCollapsedIds(ids) {
2215
- this._collapsedIds$.next(ids);
2216
- }
2217
- setFakeToolbarVisible(visible) {
2218
- this._fakeToolbarVisible$.next(visible);
2219
- }
2220
- _initRibbonSubscription() {
2221
- this.disposeWithMe((0, rxjs.combineLatest)([this._menuManagerService.menuChanged$.pipe((0, rxjs_operators.startWith)(void 0)), this._univerInstanceService.focused$.pipe((0, rxjs_operators.startWith)(void 0), (0, rxjs_operators.distinctUntilChanged)())]).subscribe(() => {
2222
- this._updateRibbon();
2223
- }));
2224
- }
2225
- _updateRibbon() {
2226
- var _this$_hiddenSubscrip;
2227
- const ribbon = this._filterContextualTabs(this._menuManagerService.getMenuByPositionKey("ribbon"));
2228
- const hiddenObservableMap = [];
2229
- const hiddenKeyMap = [];
2230
- for (const group of ribbon) if (group.children) {
2231
- for (const item of group.children) if (item.children) for (const child of item.children) {
2232
- var _child$item;
2233
- if ((_child$item = child.item) === null || _child$item === void 0 ? void 0 : _child$item.hidden$) {
2234
- hiddenObservableMap.push(child.item.hidden$);
2235
- hiddenKeyMap.push(child.key);
2236
- }
2237
- }
2238
- }
2239
- if (hiddenObservableMap.length === 0) {
2240
- this._setRibbon(ribbon);
2241
- return;
2242
- }
2243
- (_this$_hiddenSubscrip = this._hiddenSubscription) === null || _this$_hiddenSubscrip === void 0 || _this$_hiddenSubscrip.unsubscribe();
2244
- this._hiddenSubscription = (0, rxjs.combineLatest)(hiddenObservableMap).pipe((0, rxjs_operators.startWith)(new Array(hiddenObservableMap.length).fill(false)), (0, rxjs_operators.distinctUntilChanged)(isSameHiddenMap)).subscribe((hiddenMap) => {
2245
- const newRibbon = [];
2246
- const hiddenPathMap = hiddenMap.map((hidden, index) => {
2247
- if (hidden) return hiddenKeyMap[index];
2248
- return null;
2249
- }).filter((item) => !!item);
2250
- for (const group of ribbon) {
2251
- var _group$children, _newGroup$children2;
2252
- const newGroup = {
2253
- ...group,
2254
- children: []
2255
- };
2256
- if ((_group$children = group.children) === null || _group$children === void 0 ? void 0 : _group$children.length) for (const item of group.children) {
2257
- var _item$children;
2258
- const newItem = {
2259
- ...item,
2260
- children: []
2261
- };
2262
- let shouldAddItem = true;
2263
- if ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) {
2264
- var _newItem$children2;
2265
- for (const child of item.children) if (!hiddenPathMap.includes(child.key)) {
2266
- var _newItem$children;
2267
- (_newItem$children = newItem.children) === null || _newItem$children === void 0 || _newItem$children.push(child);
2268
- }
2269
- if ((_newItem$children2 = newItem.children) === null || _newItem$children2 === void 0 ? void 0 : _newItem$children2.every((child) => {
2270
- var _child$children;
2271
- return ((_child$children = child.children) === null || _child$children === void 0 ? void 0 : _child$children.length) === 0;
2272
- })) shouldAddItem = false;
2273
- }
2274
- if (shouldAddItem) {
2275
- var _newGroup$children;
2276
- (_newGroup$children = newGroup.children) === null || _newGroup$children === void 0 || _newGroup$children.push(newItem);
2277
- }
2278
- }
2279
- if (((_newGroup$children2 = newGroup.children) === null || _newGroup$children2 === void 0 ? void 0 : _newGroup$children2.length) && newGroup.children.every((item) => {
2280
- var _item$children2;
2281
- return (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length;
2282
- })) newRibbon.push(newGroup);
2283
- }
2284
- this._setRibbon(newRibbon);
2285
- });
2286
- }
2287
- _filterContextualTabs(ribbon) {
2288
- this._contextualTabs.clear();
2289
- ribbon.forEach((group) => {
2290
- if (group.contextual) this._contextualTabs.add(group.key);
2291
- });
2292
- return ribbon.filter((group) => !group.contextual || this._visibleContextualTabs.has(group.key));
2293
- }
2294
- _setRibbon(ribbon) {
2295
- const activatedTab = this._activatedTab$.getValue();
2296
- const activeGroup = ribbon.find((group) => group.key === activatedTab);
2297
- if (!activeGroup && this._contextualTabs.has(activatedTab)) {
2298
- var _ref, _ribbon$find;
2299
- const fallbackTab = (_ref = (_ribbon$find = ribbon.find((group) => group.key === this._lastNonContextualActivatedTab && !group.contextual)) !== null && _ribbon$find !== void 0 ? _ribbon$find : ribbon.find((group) => group.key === "ribbon.start")) !== null && _ref !== void 0 ? _ref : ribbon[0];
2300
- if (fallbackTab) this._activatedTab$.next(fallbackTab.key);
2301
- } else if (!activeGroup && ribbon.some((group) => group.key === "ribbon.start")) {
2302
- const fallbackTab = ribbon.find((group) => group.key === "ribbon.start");
2303
- this._activatedTab$.next(fallbackTab.key);
2304
- if (!fallbackTab.contextual) this._lastNonContextualActivatedTab = fallbackTab.key;
2305
- } else if (activeGroup && !activeGroup.contextual) this._lastNonContextualActivatedTab = activeGroup.key;
2306
- this._ribbon$.next(ribbon);
2307
- }
2308
- _isContextualTab(tab) {
2309
- return this._contextualTabs.has(tab) || this._ribbon$.getValue().some((group) => group.key === tab && group.contextual);
2310
- }
2311
- dispose() {
2312
- var _this$_hiddenSubscrip2;
2313
- (_this$_hiddenSubscrip2 = this._hiddenSubscription) === null || _this$_hiddenSubscrip2 === void 0 || _this$_hiddenSubscrip2.unsubscribe();
2314
- this._hiddenSubscription = null;
2315
- this._ribbon$.next([]);
2316
- this._ribbon$.complete();
2317
- this._activatedTab$.complete();
2318
- this._collapsedIds$.complete();
2319
- this._fakeToolbarVisible$.complete();
2320
- super.dispose();
2321
- }
2322
- };
2323
- DesktopRibbonService = __decorate([__decorateParam(0, IMenuManagerService), __decorateParam(1, _univerjs_core.IUniverInstanceService)], DesktopRibbonService);
2324
-
2325
2623
  //#endregion
2326
2624
  //#region src/views/components/ComponentContainer.tsx
2327
2625
  function ComponentContainer(props) {
@@ -2436,79 +2734,113 @@ function DefaultMenu({ ribbon, activatedTab, onSelectTab }) {
2436
2734
  }
2437
2735
 
2438
2736
  //#endregion
2439
- //#region src/views/components/ribbon/ToolbarButton.tsx
2440
- /**
2441
- * Copyright 2023-present DreamNum Co., Ltd.
2442
- *
2443
- * Licensed under the Apache License, Version 2.0 (the "License");
2444
- * you may not use this file except in compliance with the License.
2445
- * You may obtain a copy of the License at
2446
- *
2447
- * http://www.apache.org/licenses/LICENSE-2.0
2448
- *
2449
- * Unless required by applicable law or agreed to in writing, software
2450
- * distributed under the License is distributed on an "AS IS" BASIS,
2451
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2452
- * See the License for the specific language governing permissions and
2453
- * limitations under the License.
2454
- */
2455
- const toolbarButtonClassName = `
2456
- univer-box-border univer-flex univer-h-6 univer-min-w-6 univer-cursor-pointer univer-items-center
2457
- univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-p-0
2458
- univer-text-gray-900 univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
2459
- dark:!univer-text-white dark:hover:!univer-bg-gray-700 dark:disabled:!univer-text-gray-600
2460
- disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
2461
- hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
2462
- `;
2463
- const toolbarButtonVariants = (0, _univerjs_design.cva)(toolbarButtonClassName, {
2464
- variants: {
2465
- noIcon: {
2466
- true: "univer-px-2",
2467
- false: ""
2468
- },
2469
- active: {
2470
- true: "!univer-bg-gray-200 dark:!univer-bg-gray-500",
2471
- false: ""
2737
+ //#region src/views/components/ribbon/ribbon-menu/RibbonGridMenu.tsx
2738
+ function RibbonGridMenu({ ribbon, activatedTab, onSelectTab }) {
2739
+ const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
2740
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2741
+ "data-testid": "ribbon-grid-menu",
2742
+ "data-u-comp": "ribbon-grid-menu",
2743
+ 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",
2744
+ role: "tablist",
2745
+ children: ribbon.map((group) => {
2746
+ const isActive = activatedTab === group.key;
2747
+ const title = localeService.t(group.title || group.key);
2748
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2749
+ type: "button",
2750
+ role: "tab",
2751
+ "aria-selected": isActive,
2752
+ title,
2753
+ onClick: () => onSelectTab(group),
2754
+ className: (0, _univerjs_design.clsx)("univer-relative univer-flex univer-h-9 univer-cursor-pointer univer-items-center univer-whitespace-nowrap univer-border-0 univer-border-b-[3px] univer-bg-transparent univer-px-3 univer-text-base 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-white", isActive ? "univer-border-primary-600 univer-text-primary-700 dark:!univer-text-primary-300" : "univer-border-transparent"),
2755
+ children: title
2756
+ }, group.key);
2757
+ })
2758
+ });
2759
+ }
2760
+
2761
+ //#endregion
2762
+ //#region src/views/components/ribbon/ribbon-grid-layout.ts
2763
+ const RIBBON_GRID_ROWS = 2;
2764
+ function placeRibbonGridItems(items) {
2765
+ const occupied = /* @__PURE__ */ new Set();
2766
+ const placements = /* @__PURE__ */ new Map();
2767
+ const fallbackItems = [];
2768
+ for (const item of items) {
2769
+ var _layout$rowSpan, _layout$columnSpan, _layout$showLabel;
2770
+ const layout = item.gridLayout;
2771
+ if (!layout) {
2772
+ fallbackItems.push({ item });
2773
+ continue;
2472
2774
  }
2473
- },
2474
- defaultVariants: {
2475
- noIcon: false,
2476
- active: false
2477
- }
2478
- });
2479
- /**
2480
- * Button Component
2481
- */
2482
- function ToolbarButton(props) {
2483
- const { children, className, style, disabled = false, active = false, noIcon, onClick, onDoubleClick, ...restProps } = props;
2484
- const handleClick = (e) => {
2485
- if (disabled) {
2486
- e.preventDefault();
2487
- return;
2775
+ const rowSpan = (_layout$rowSpan = layout.rowSpan) !== null && _layout$rowSpan !== void 0 ? _layout$rowSpan : 1;
2776
+ const columnSpan = (_layout$columnSpan = layout.columnSpan) !== null && _layout$columnSpan !== void 0 ? _layout$columnSpan : 1;
2777
+ const cells = getCells(layout.row, layout.column, rowSpan, columnSpan);
2778
+ if (!isValidGridGeometry(layout, rowSpan, cells)) {
2779
+ fallbackItems.push({ item });
2780
+ continue;
2488
2781
  }
2489
- onClick && onClick(e);
2490
- };
2491
- const handleDoubleClick = (e) => {
2492
- if (disabled) {
2493
- e.preventDefault();
2494
- return;
2782
+ const placement = {
2783
+ item,
2784
+ row: layout.row,
2785
+ column: layout.column,
2786
+ rowSpan,
2787
+ columnSpan,
2788
+ showLabel: (_layout$showLabel = layout.showLabel) !== null && _layout$showLabel !== void 0 ? _layout$showLabel : false,
2789
+ width: layout.width,
2790
+ iconSize: layout.iconSize
2791
+ };
2792
+ if (cells.some((cell) => occupied.has(cell))) {
2793
+ fallbackItems.push({
2794
+ item,
2795
+ layout: placement
2796
+ });
2797
+ continue;
2495
2798
  }
2496
- onDoubleClick && onDoubleClick(e);
2497
- };
2498
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2499
- type: "button",
2500
- className: toolbarButtonVariants({
2501
- noIcon,
2502
- active,
2503
- className
2504
- }),
2505
- style,
2506
- disabled,
2507
- onClick: handleClick,
2508
- onDoubleClick: handleDoubleClick,
2509
- ...restProps,
2510
- children
2511
- });
2799
+ cells.forEach((cell) => occupied.add(cell));
2800
+ placements.set(item, placement);
2801
+ }
2802
+ for (const { item, layout } of fallbackItems) {
2803
+ var _layout$rowSpan2, _layout$columnSpan2, _layout$showLabel2;
2804
+ const rowSpan = (_layout$rowSpan2 = layout === null || layout === void 0 ? void 0 : layout.rowSpan) !== null && _layout$rowSpan2 !== void 0 ? _layout$rowSpan2 : 1;
2805
+ const columnSpan = (_layout$columnSpan2 = layout === null || layout === void 0 ? void 0 : layout.columnSpan) !== null && _layout$columnSpan2 !== void 0 ? _layout$columnSpan2 : 1;
2806
+ const { row, column, cells } = findFirstAvailableCells(occupied, rowSpan, columnSpan);
2807
+ cells.forEach((cell) => occupied.add(cell));
2808
+ placements.set(item, {
2809
+ item,
2810
+ row,
2811
+ column,
2812
+ rowSpan,
2813
+ columnSpan,
2814
+ showLabel: (_layout$showLabel2 = layout === null || layout === void 0 ? void 0 : layout.showLabel) !== null && _layout$showLabel2 !== void 0 ? _layout$showLabel2 : false,
2815
+ width: layout === null || layout === void 0 ? void 0 : layout.width,
2816
+ iconSize: layout === null || layout === void 0 ? void 0 : layout.iconSize
2817
+ });
2818
+ }
2819
+ return items.map((item) => placements.get(item));
2820
+ }
2821
+ function isValidGridGeometry(layout, rowSpan, cells) {
2822
+ 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);
2823
+ }
2824
+ function findFirstAvailableCells(occupied, rowSpan, columnSpan) {
2825
+ for (let column = 1;; column++) for (let row = 1; row + rowSpan - 1 <= RIBBON_GRID_ROWS; row++) {
2826
+ const cells = getCells(row, column, rowSpan, columnSpan);
2827
+ if (cells.every((cell) => !occupied.has(cell))) return {
2828
+ row,
2829
+ column,
2830
+ cells
2831
+ };
2832
+ }
2833
+ }
2834
+ function getCells(row, column, rowSpan, columnSpan) {
2835
+ if (![
2836
+ row,
2837
+ column,
2838
+ rowSpan,
2839
+ columnSpan
2840
+ ].every(Number.isInteger) || Math.min(row, column, rowSpan, columnSpan) < 1) return [];
2841
+ const cells = [];
2842
+ for (let currentRow = row; currentRow < row + rowSpan; currentRow++) for (let currentColumn = column; currentColumn < column + columnSpan; currentColumn++) cells.push(`${currentRow}:${currentColumn}`);
2843
+ return cells;
2512
2844
  }
2513
2845
 
2514
2846
  //#endregion
@@ -2518,7 +2850,7 @@ function ToolbarButton(props) {
2518
2850
  * @param props
2519
2851
  */
2520
2852
  function CustomLabel(props) {
2521
- const { className, title, icon, label, value, value$ } = props;
2853
+ const { className, iconSize, title, icon, label, value, value$ } = props;
2522
2854
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
2523
2855
  const componentManager = (0, _wendellhu_redi_react_bindings.useDependency)(ComponentManager);
2524
2856
  const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
@@ -2538,6 +2870,10 @@ function CustomLabel(props) {
2538
2870
  const Icon = iconManager.get(realIcon);
2539
2871
  if (Icon) nodes.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
2540
2872
  className: "univer-text-base",
2873
+ style: iconSize ? {
2874
+ width: iconSize,
2875
+ height: iconSize
2876
+ } : void 0,
2541
2877
  extend: { colorChannel1: isValid ? String(realValue) : "var(--univer-primary-600)" }
2542
2878
  }, index++));
2543
2879
  }
@@ -2608,6 +2944,82 @@ function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
2608
2944
  ]), null, true);
2609
2945
  }
2610
2946
 
2947
+ //#endregion
2948
+ //#region src/views/components/ribbon/ToolbarButton.tsx
2949
+ /**
2950
+ * Copyright 2023-present DreamNum Co., Ltd.
2951
+ *
2952
+ * Licensed under the Apache License, Version 2.0 (the "License");
2953
+ * you may not use this file except in compliance with the License.
2954
+ * You may obtain a copy of the License at
2955
+ *
2956
+ * http://www.apache.org/licenses/LICENSE-2.0
2957
+ *
2958
+ * Unless required by applicable law or agreed to in writing, software
2959
+ * distributed under the License is distributed on an "AS IS" BASIS,
2960
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2961
+ * See the License for the specific language governing permissions and
2962
+ * limitations under the License.
2963
+ */
2964
+ const toolbarButtonClassName = `
2965
+ univer-box-border univer-flex univer-h-6 univer-min-w-6 univer-cursor-pointer univer-items-center
2966
+ univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-p-0
2967
+ univer-text-gray-900 univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
2968
+ dark:!univer-text-white dark:hover:!univer-bg-gray-700 dark:disabled:!univer-text-gray-600
2969
+ disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
2970
+ hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
2971
+ `;
2972
+ const toolbarButtonVariants = (0, _univerjs_design.cva)(toolbarButtonClassName, {
2973
+ variants: {
2974
+ noIcon: {
2975
+ true: "univer-px-2",
2976
+ false: ""
2977
+ },
2978
+ active: {
2979
+ true: "!univer-bg-gray-200 dark:!univer-bg-gray-500",
2980
+ false: ""
2981
+ }
2982
+ },
2983
+ defaultVariants: {
2984
+ noIcon: false,
2985
+ active: false
2986
+ }
2987
+ });
2988
+ /**
2989
+ * Button Component
2990
+ */
2991
+ function ToolbarButton(props) {
2992
+ const { children, className, style, disabled = false, active = false, noIcon, onClick, onDoubleClick, ...restProps } = props;
2993
+ const handleClick = (e) => {
2994
+ if (disabled) {
2995
+ e.preventDefault();
2996
+ return;
2997
+ }
2998
+ onClick && onClick(e);
2999
+ };
3000
+ const handleDoubleClick = (e) => {
3001
+ if (disabled) {
3002
+ e.preventDefault();
3003
+ return;
3004
+ }
3005
+ onDoubleClick && onDoubleClick(e);
3006
+ };
3007
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3008
+ type: "button",
3009
+ className: toolbarButtonVariants({
3010
+ noIcon,
3011
+ active,
3012
+ className
3013
+ }),
3014
+ style,
3015
+ disabled,
3016
+ onClick: handleClick,
3017
+ onDoubleClick: handleDoubleClick,
3018
+ ...restProps,
3019
+ children
3020
+ });
3021
+ }
3022
+
2611
3023
  //#endregion
2612
3024
  //#region src/views/components/ribbon/TooltipButtonWrapper.tsx
2613
3025
  const TooltipWrapperContext = (0, react.createContext)({
@@ -2664,12 +3076,31 @@ const TooltipWrapper = (0, react.forwardRef)((props, ref) => {
2664
3076
  function DropdownWrapper(props) {
2665
3077
  const { children, overlay, disabled, align = "start" } = props;
2666
3078
  const { dropdownVisible, setDropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
3079
+ const triggerRef = (0, react.useRef)(null);
3080
+ const overlayRef = (0, react.useRef)(null);
3081
+ (0, react.useEffect)(() => {
3082
+ if (disabled) setDropdownVisible(false);
3083
+ }, [disabled, setDropdownVisible]);
3084
+ (0, react.useEffect)(() => {
3085
+ var _triggerRef$current;
3086
+ const ownerDocument = (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.ownerDocument;
3087
+ if (!dropdownVisible || !ownerDocument) return;
3088
+ const handlePointerDown = (event) => {
3089
+ var _triggerRef$current2, _overlayRef$current;
3090
+ const target = event.target;
3091
+ if (!target || ((_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : _triggerRef$current2.contains(target)) || ((_overlayRef$current = overlayRef.current) === null || _overlayRef$current === void 0 ? void 0 : _overlayRef$current.contains(target))) return;
3092
+ setDropdownVisible(false);
3093
+ };
3094
+ ownerDocument.addEventListener("pointerdown", handlePointerDown, true);
3095
+ return () => ownerDocument.removeEventListener("pointerdown", handlePointerDown, true);
3096
+ }, [dropdownVisible, setDropdownVisible]);
2667
3097
  function handleVisibleChange(visible) {
2668
3098
  setDropdownVisible(visible);
2669
3099
  }
2670
3100
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
2671
3101
  align,
2672
3102
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3103
+ ref: overlayRef,
2673
3104
  className: "univer-grid univer-gap-2",
2674
3105
  children: overlay
2675
3106
  }),
@@ -2677,6 +3108,7 @@ function DropdownWrapper(props) {
2677
3108
  open: dropdownVisible,
2678
3109
  onOpenChange: handleVisibleChange,
2679
3110
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3111
+ ref: triggerRef,
2680
3112
  className: "univer-h-full",
2681
3113
  onClick: (e) => e.stopPropagation(),
2682
3114
  children
@@ -2717,6 +3149,9 @@ function getOptionKey(option) {
2717
3149
  }
2718
3150
  function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, onOptionSelect }) {
2719
3151
  const { dropdownVisible, setDropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
3152
+ (0, react.useEffect)(() => {
3153
+ if (disabled) setDropdownVisible(false);
3154
+ }, [disabled, setDropdownVisible]);
2720
3155
  const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
2721
3156
  const resolveMenuItems = () => menuId ? menuManagerService.getMenuByPositionKey(menuId) : [];
2722
3157
  const menuItems = (0, _wendellhu_redi_react_bindings.useObservable)(() => menuManagerService.menuChanged$.pipe((0, rxjs.map)(resolveMenuItems), (0, rxjs.startWith)(resolveMenuItems())), resolveMenuItems(), false, [menuId, menuManagerService]);
@@ -2737,7 +3172,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
2737
3172
  return menuItems.filter((item) => {
2738
3173
  var _item$key;
2739
3174
  if (!item.children) return !hiddenStates[item.key];
2740
- return !hiddenStates[((_item$key = item.key) === null || _item$key === void 0 ? void 0 : _item$key.toString()) || ""];
3175
+ const itemKey = ((_item$key = item.key) === null || _item$key === void 0 ? void 0 : _item$key.toString()) || "";
3176
+ return !hiddenStates[itemKey];
2741
3177
  });
2742
3178
  }, [menuItems, hiddenStates]);
2743
3179
  function handleVisibleChange(visible) {
@@ -2760,11 +3196,16 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
2760
3196
  children
2761
3197
  });
2762
3198
  if (options === null || options === void 0 ? void 0 : options.length) {
3199
+ var _options$0$label;
3200
+ const isSingleCustomPanel = options.length === 1 && typeof options[0].label === "object" && ((_options$0$label = options[0].label) === null || _options$0$label === void 0 ? void 0 : _options$0$label.hoverable) === false;
2763
3201
  const items = options.map((option) => {
2764
- var _option$label3;
3202
+ var _option$label3, _option$label4;
2765
3203
  return {
2766
3204
  type: "item",
2767
- className: (0, _univerjs_design.clsx)({ "focus:univer-bg-white": typeof option.label !== "string" && ((_option$label3 = option.label) === null || _option$label3 === void 0 ? void 0 : _option$label3.hoverable) === false }),
3205
+ className: (0, _univerjs_design.clsx)({
3206
+ "focus:univer-bg-white": typeof option.label !== "string" && ((_option$label3 = option.label) === null || _option$label3 === void 0 ? void 0 : _option$label3.hoverable) === false,
3207
+ "!univer-p-0": typeof option.label !== "string" && ((_option$label4 = option.label) === null || _option$label4 === void 0 ? void 0 : _option$label4.hoverable) === false
3208
+ }),
2768
3209
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuLabel, {
2769
3210
  icon: option.icon,
2770
3211
  value,
@@ -2803,6 +3244,7 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
2803
3244
  }
2804
3245
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DropdownMenu, {
2805
3246
  align: "start",
3247
+ className: (0, _univerjs_design.clsx)({ "!univer-p-0": isSingleCustomPanel }),
2806
3248
  items,
2807
3249
  disabled,
2808
3250
  open: dropdownVisible,
@@ -2940,7 +3382,8 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
2940
3382
  layoutService.focus();
2941
3383
  commandService.executeCommand(commandId, params);
2942
3384
  };
2943
- const { tooltip, shortcut, icon, title, label, id, commandId, type, slot, params } = props;
3385
+ const { tooltip, shortcut, icon, title, label, id, commandId, type, slot, params, grid, large, showLabel, iconSize, iconColor, fullWidth } = props;
3386
+ const gridLabel = title !== null && title !== void 0 ? title : tooltip;
2944
3387
  const shortcutDisplay = useToolbarShortcutDisplay({
2945
3388
  id,
2946
3389
  commandId,
@@ -2972,6 +3415,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
2972
3415
  const selectionsCommandId = props.selectionsCommandId;
2973
3416
  const bId = commandId !== null && commandId !== void 0 ? commandId : id;
2974
3417
  const sId = (_ref = selectionsCommandId !== null && selectionsCommandId !== void 0 ? selectionsCommandId : commandId) !== null && _ref !== void 0 ? _ref : id;
3418
+ const titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
2975
3419
  function handleSelect(option) {
2976
3420
  if (disabled) return;
2977
3421
  let commandId = sId;
@@ -2993,17 +3437,24 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
2993
3437
  if (menuType === 2) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2994
3438
  "data-u-command": id,
2995
3439
  "data-disabled": disabled,
2996
- className: toolbarButtonSelectorRootVariants({ disabled }),
3440
+ className: (0, _univerjs_design.clsx)(toolbarButtonSelectorRootVariants({ disabled }), {
3441
+ "univer-box-border univer-h-full univer-min-w-14 univer-flex-col !univer-pr-0": grid && large,
3442
+ "univer-box-border univer-h-full": grid && !large
3443
+ }),
2997
3444
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2998
- className: toolbarButtonSelectorMainVariants({
3445
+ className: (0, _univerjs_design.clsx)(toolbarButtonSelectorMainVariants({
2999
3446
  active: activated,
3000
3447
  disabled
3448
+ }), {
3449
+ "univer-h-full univer-w-full univer-flex-col univer-justify-center univer-rounded univer-px-1 univer-pb-4 [&>svg]:univer-size-8": grid && large,
3450
+ "[&>svg]:univer-size-4": grid && !large
3001
3451
  }),
3002
3452
  onClick: handleClick,
3003
3453
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
3004
3454
  icon: iconToDisplay,
3005
- title,
3006
- value,
3455
+ iconSize,
3456
+ title: titleToDisplay,
3457
+ value: iconColor !== null && iconColor !== void 0 ? iconColor : value,
3007
3458
  label,
3008
3459
  onChange: handleSelectionsValueChange
3009
3460
  })
@@ -3015,9 +3466,12 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
3015
3466
  disabled,
3016
3467
  onOptionSelect: handleSelect,
3017
3468
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3018
- className: toolbarButtonSelectorTriggerVariants({
3469
+ className: (0, _univerjs_design.clsx)(toolbarButtonSelectorTriggerVariants({
3019
3470
  disabled,
3020
3471
  active: activated
3472
+ }), {
3473
+ "!univer-top-auto univer-bottom-0 univer-h-4 univer-w-full univer-rounded-b univer-rounded-t-none": grid && large,
3474
+ "univer-h-full": grid && !large
3021
3475
  }),
3022
3476
  "data-disabled": disabled,
3023
3477
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})
@@ -3031,31 +3485,70 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
3031
3485
  options,
3032
3486
  disabled,
3033
3487
  onOptionSelect: handleSelect,
3034
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3488
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3035
3489
  "data-u-command": id,
3036
- className: toolbarSelectorRootVariants({
3490
+ className: (0, _univerjs_design.clsx)(toolbarSelectorRootVariants({
3037
3491
  disabled,
3038
3492
  active: activated
3039
- }),
3040
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
3493
+ }), {
3494
+ "univer-box-border univer-h-full univer-min-w-14 univer-flex-col univer-justify-center univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-8": grid && large,
3495
+ "univer-box-border univer-h-full": grid && !large,
3496
+ "univer-bg-white dark:!univer-bg-gray-800": grid && !large && !icon,
3497
+ "[&>svg]:univer-size-4": grid && !large
3498
+ }, grid && !large && !icon && _univerjs_design.borderClassName),
3499
+ children: grid && large ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
3041
3500
  icon: iconToDisplay,
3042
- title,
3501
+ iconSize
3502
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3503
+ className: (0, _univerjs_design.clsx)(toolbarSelectorTriggerVariants({ disabled }), "univer-h-4 univer-justify-center univer-gap-0.5"),
3504
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
3505
+ title: titleToDisplay,
3506
+ value,
3507
+ label,
3508
+ onChange: handleSelectionsValueChange
3509
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})]
3510
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
3511
+ icon: iconToDisplay,
3512
+ iconSize,
3513
+ title: titleToDisplay,
3043
3514
  value,
3044
3515
  label,
3045
3516
  onChange: handleSelectionsValueChange
3046
3517
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3047
- className: toolbarSelectorTriggerVariants({ disabled }),
3518
+ className: (0, _univerjs_design.clsx)(toolbarSelectorTriggerVariants({ disabled }), { "univer-ml-auto rtl:univer-ml-0 rtl:univer-mr-auto": grid && !large && !icon }),
3048
3519
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})
3049
- })]
3520
+ })] })
3050
3521
  })
3051
3522
  });
3052
3523
  }
3053
3524
  function renderButtonType() {
3054
3525
  var _label$name;
3055
3526
  const isCustomComponent = componentManager.get(typeof label === "string" ? label : (_label$name = label === null || label === void 0 ? void 0 : label.name) !== null && _label$name !== void 0 ? _label$name : "");
3527
+ const buttonClassName = (0, _univerjs_design.clsx)(grid && !large && "univer-h-full univer-min-w-8 [&>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-8" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0");
3528
+ const buttonStyle = grid && large ? {
3529
+ textAlign: "center",
3530
+ whiteSpace: "normal"
3531
+ } : void 0;
3532
+ if (isCustomComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3533
+ "data-u-command": id,
3534
+ className: toolbarButtonVariants({
3535
+ noIcon: !icon,
3536
+ active: activated,
3537
+ className: buttonClassName
3538
+ }),
3539
+ style: buttonStyle,
3540
+ "aria-disabled": disabled,
3541
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
3542
+ className: grid && fullWidth ? "!univer-w-full" : void 0,
3543
+ title: grid && showLabel ? gridLabel : title,
3544
+ value,
3545
+ label
3546
+ })
3547
+ });
3056
3548
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
3057
3549
  "data-u-command": id,
3058
- className: "univer-text-sm",
3550
+ className: buttonClassName,
3551
+ style: buttonStyle,
3059
3552
  noIcon: !icon,
3060
3553
  active: activated,
3061
3554
  disabled,
@@ -3065,11 +3558,11 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
3065
3558
  executeCommand((_props$commandId = props.commandId) !== null && _props$commandId !== void 0 ? _props$commandId : props.id, commandParams !== null && commandParams !== void 0 ? commandParams : typeof value === "undefined" ? void 0 : { value });
3066
3559
  },
3067
3560
  onDoubleClick: () => props.subId && executeCommand(props.subId),
3068
- children: isCustomComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
3069
- title,
3070
- value,
3071
- label
3072
- }) : icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, { icon }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, { title })
3561
+ children: icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
3562
+ icon,
3563
+ iconSize,
3564
+ title: grid && (large || showLabel) ? gridLabel : void 0
3565
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, { title })
3073
3566
  });
3074
3567
  }
3075
3568
  function renderItem() {
@@ -3090,6 +3583,51 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
3090
3583
  });
3091
3584
  });
3092
3585
 
3586
+ //#endregion
3587
+ //#region src/views/components/ribbon/RibbonGrid.tsx
3588
+ function RibbonGrid({ groups, title, className, ...props }) {
3589
+ const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
3590
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3591
+ ...props,
3592
+ "data-testid": "ribbon-grid-toolbar",
3593
+ "data-u-comp": "ribbon-grid-toolbar",
3594
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-[88px] univer-overflow-x-auto univer-overflow-y-hidden univer-bg-gray-50 univer-px-2 univer-text-sm dark:!univer-bg-gray-900", _univerjs_design.borderBottomClassName, _univerjs_design.scrollbarClassName, className),
3595
+ role: "toolbar",
3596
+ "aria-label": localeService.t(title),
3597
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarDropdownProvider, { children: groups.map((group) => {
3598
+ var _group$children;
3599
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3600
+ "data-u-comp": "ribbon-grid-group",
3601
+ className: "univer-relative univer-box-border univer-flex univer-min-w-16 univer-shrink-0 univer-flex-col univer-px-2",
3602
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3603
+ "data-testid": "ribbon-grid-group-grid",
3604
+ className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-2 univer-content-center univer-gap-x-1 univer-gap-y-2 univer-py-2 [&>div>span>span]:univer-h-full",
3605
+ children: placeRibbonGridItems((_group$children = group.children) !== null && _group$children !== void 0 ? _group$children : []).map((placement) => placement.item.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3606
+ className: (0, _univerjs_design.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"),
3607
+ style: {
3608
+ gridRow: `${placement.row} / span ${placement.rowSpan}`,
3609
+ gridColumn: `${placement.column} / span ${placement.columnSpan}`,
3610
+ width: placement.width
3611
+ },
3612
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
3613
+ ...placement.item.item,
3614
+ grid: true,
3615
+ large: placement.rowSpan > 1,
3616
+ showLabel: placement.showLabel,
3617
+ iconSize: placement.iconSize,
3618
+ fullWidth: placement.width !== void 0
3619
+ })
3620
+ }, placement.item.key))
3621
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3622
+ "data-testid": "ribbon-grid-group-divider",
3623
+ className: (0, _univerjs_design.clsx)("univer-pointer-events-none univer-absolute univer-bottom-1.5 univer-right-0 univer-top-3.5 !univer-border-gray-300 univer-opacity-50 rtl:univer-left-0 rtl:univer-right-auto", _univerjs_design.borderRightClassName),
3624
+ "aria-hidden": "true"
3625
+ })]
3626
+ }, group.key);
3627
+ }) })
3628
+ });
3629
+ }
3630
+
3093
3631
  //#endregion
3094
3632
  //#region src/views/components/ribbon/Ribbon.tsx
3095
3633
  function Ribbon(props) {
@@ -3160,7 +3698,7 @@ function Ribbon(props) {
3160
3698
  activatedTab
3161
3699
  ]);
3162
3700
  (0, react.useEffect)(() => {
3163
- if (hideToolbar) {
3701
+ if (hideToolbar || ribbonType === "grid") {
3164
3702
  toolbarItemRefs.current = {};
3165
3703
  ribbonService.setCollapsedIds([]);
3166
3704
  ribbonService.setFakeToolbarVisible(false);
@@ -3200,7 +3738,8 @@ function Ribbon(props) {
3200
3738
  hideToolbar,
3201
3739
  ribbon,
3202
3740
  activatedTab,
3203
- ribbonService
3741
+ ribbonService,
3742
+ ribbonType
3204
3743
  ]);
3205
3744
  const fakeToolbar = (0, react.useMemo)(() => {
3206
3745
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3238,7 +3777,7 @@ function Ribbon(props) {
3238
3777
  ...embedRibbonOverrideAttributes,
3239
3778
  className: (0, _univerjs_design.clsx)("univer-relative univer-select-none", headerClassName, {
3240
3779
  "univer-hidden": toolbarOnly,
3241
- "univer-h-9": !toolbarOnly && (ribbonType === "classic" || headerMenuComponents && headerMenuComponents.size > 0)
3780
+ "univer-h-9": !toolbarOnly && (ribbonType === "classic" || ribbonType === "grid" || headerMenuComponents && headerMenuComponents.size > 0)
3242
3781
  }),
3243
3782
  children: [
3244
3783
  !toolbarOnly && (ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.placeholderTitle) && ribbon.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3253,13 +3792,23 @@ function Ribbon(props) {
3253
3792
  activatedTab,
3254
3793
  onSelectTab: handleSelectTab
3255
3794
  }),
3795
+ !toolbarOnly && ribbonType === "grid" && ribbon.length >= 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RibbonGridMenu, {
3796
+ ribbon,
3797
+ activatedTab,
3798
+ onSelectTab: handleSelectTab
3799
+ }),
3256
3800
  headerMenu && headerMenuComponents && headerMenuComponents.size > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3257
3801
  className: "univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-flex-row univer-items-center univer-gap-2 rtl:univer-left-2 rtl:univer-right-auto [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",
3258
3802
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerMenuComponents })
3259
3803
  })
3260
3804
  ]
3261
3805
  }),
3262
- !hideToolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3806
+ !hideToolbar && ribbonType === "grid" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RibbonGrid, {
3807
+ ...embedRibbonOverrideAttributes,
3808
+ groups: activeGroup.allGroups,
3809
+ title: activatedTabTitle
3810
+ }),
3811
+ !hideToolbar && ribbonType !== "grid" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3263
3812
  ...embedRibbonOverrideAttributes,
3264
3813
  className: (0, _univerjs_design.clsx)("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3 univer-text-sm", {
3265
3814
  "univer-grid-cols-[1fr] univer-justify-center": ribbonType === "classic" || ribbon.length === 1,
@@ -3311,7 +3860,7 @@ function Ribbon(props) {
3311
3860
  })] }, activatedTab)
3312
3861
  })]
3313
3862
  }),
3314
- fakeToolbar
3863
+ ribbonType !== "grid" && fakeToolbar
3315
3864
  ] })
3316
3865
  });
3317
3866
  }
@@ -3373,6 +3922,33 @@ var ThemeSwitcherService = class extends _univerjs_core.Disposable {
3373
3922
  }
3374
3923
  };
3375
3924
 
3925
+ //#endregion
3926
+ //#region src/services/workbench/workbench.service.ts
3927
+ const IWorkbenchService = (0, _univerjs_core.createIdentifier)("univer.ui.workbench.service");
3928
+ var WorkbenchService = class extends _univerjs_core.Disposable {
3929
+ constructor(..._args) {
3930
+ super(..._args);
3931
+ _defineProperty(this, "_tokens", /* @__PURE__ */ new Set());
3932
+ _defineProperty(this, "_skeletonVisible$", new rxjs.BehaviorSubject(false));
3933
+ _defineProperty(this, "skeletonVisible$", this._skeletonVisible$.asObservable());
3934
+ }
3935
+ acquireSkeleton() {
3936
+ const token = Symbol("workbench-skeleton");
3937
+ this._tokens.add(token);
3938
+ if (this._tokens.size === 1) this._skeletonVisible$.next(true);
3939
+ const disposable = (0, _univerjs_core.toDisposable)(() => {
3940
+ if (!this._tokens.delete(token) || this._tokens.size > 0) return;
3941
+ this._skeletonVisible$.next(false);
3942
+ });
3943
+ return this.disposeWithMe(disposable);
3944
+ }
3945
+ dispose() {
3946
+ super.dispose();
3947
+ this._tokens.clear();
3948
+ this._skeletonVisible$.complete();
3949
+ }
3950
+ };
3951
+
3376
3952
  //#endregion
3377
3953
  //#region src/services/contextmenu/contextmenu.service.ts
3378
3954
  const IContextMenuService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.service");
@@ -3409,25 +3985,6 @@ var ContextMenuService = class extends _univerjs_core.Disposable {
3409
3985
  }
3410
3986
  };
3411
3987
 
3412
- //#endregion
3413
- //#region src/services/runtime-scope/ui-runtime-scope.service.ts
3414
- const IUIRuntimeScopeService = (0, _univerjs_core.createIdentifier)("ui.runtime-scope.service");
3415
- var UIRuntimeScopeService = class extends _univerjs_core.Disposable {
3416
- constructor(..._args) {
3417
- super(..._args);
3418
- _defineProperty(this, "_scopes", /* @__PURE__ */ new Map());
3419
- }
3420
- register(scope) {
3421
- this._scopes.set(scope.unitId, scope);
3422
- return (0, _univerjs_core.toDisposable)(() => {
3423
- if (this._scopes.get(scope.unitId) === scope) this._scopes.delete(scope.unitId);
3424
- });
3425
- }
3426
- get(unitId) {
3427
- return unitId ? this._scopes.get(unitId) : void 0;
3428
- }
3429
- };
3430
-
3431
3988
  //#endregion
3432
3989
  //#region src/services/contextmenu/contextmenu-host.service.ts
3433
3990
  const IContextMenuHostService = (0, _univerjs_core.createIdentifier)("ui.contextmenu.host.service");
@@ -3435,31 +3992,37 @@ var ContextMenuHostService = class extends _univerjs_core.Disposable {
3435
3992
  constructor(..._args) {
3436
3993
  super(..._args);
3437
3994
  _defineProperty(this, "_menuMap", /* @__PURE__ */ new Map());
3438
- _defineProperty(this, "_activeMenuId", null);
3995
+ _defineProperty(this, "_activeMenuId$", new rxjs.BehaviorSubject(null));
3996
+ _defineProperty(this, "activeMenuId$", this._activeMenuId$.asObservable());
3439
3997
  }
3440
3998
  get activeMenuId() {
3441
- return this._activeMenuId;
3999
+ return this._activeMenuId$.value;
3442
4000
  }
3443
4001
  registerMenu(menuId, hide) {
3444
4002
  this._menuMap.set(menuId, hide);
3445
4003
  return (0, _univerjs_core.toDisposable)(() => {
3446
4004
  this._menuMap.delete(menuId);
3447
- if (this._activeMenuId === menuId) this._activeMenuId = null;
4005
+ if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
3448
4006
  });
3449
4007
  }
3450
4008
  activateMenu(menuId) {
3451
4009
  this.hideActiveMenu(menuId);
3452
- this._activeMenuId = menuId;
4010
+ this._activeMenuId$.next(menuId);
3453
4011
  }
3454
4012
  deactivateMenu(menuId) {
3455
- if (this._activeMenuId === menuId) this._activeMenuId = null;
4013
+ if (this.activeMenuId === menuId) this._activeMenuId$.next(null);
3456
4014
  }
3457
4015
  hideActiveMenu(exceptMenuId) {
3458
- if (!this._activeMenuId || this._activeMenuId === exceptMenuId) return;
3459
- const hide = this._menuMap.get(this._activeMenuId);
3460
- this._activeMenuId = null;
4016
+ const activeMenuId = this.activeMenuId;
4017
+ if (!activeMenuId || activeMenuId === exceptMenuId) return;
4018
+ const hide = this._menuMap.get(activeMenuId);
4019
+ this._activeMenuId$.next(null);
3461
4020
  hide === null || hide === void 0 || hide();
3462
4021
  }
4022
+ dispose() {
4023
+ this._activeMenuId$.complete();
4024
+ super.dispose();
4025
+ }
3463
4026
  };
3464
4027
 
3465
4028
  //#endregion
@@ -3496,10 +4059,10 @@ function useScrollYOverContainer(element, container) {
3496
4059
  (0, react.useEffect)(() => {
3497
4060
  if (!(0, _univerjs_design.isBrowser)() || !element || !container) return;
3498
4061
  updater();
3499
- const resizeObserver = (0, _univerjs_design.resizeObserverCtor)(updater);
4062
+ const resizeObserver = new ResizeObserver(updater);
3500
4063
  resizeObserver.observe(element);
3501
4064
  return () => {
3502
- resizeObserver.unobserve(element);
4065
+ resizeObserver.disconnect();
3503
4066
  };
3504
4067
  }, [element, container]);
3505
4068
  }
@@ -3678,11 +4241,12 @@ function QuickTileMenuItem(props) {
3678
4241
  const activated = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem === null || menuItem === void 0 ? void 0 : menuItem.activated$, false);
3679
4242
  if (!menuItem || hidden) return null;
3680
4243
  const Icon = menuItem.icon ? iconManager.get(menuItem.icon) : null;
4244
+ const active = resolveMenuItemActiveState(menuItem.id, activated, activeItemIds);
3681
4245
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3682
4246
  type: "button",
3683
4247
  className: quickTileMenuButtonVariants({
3684
4248
  disabled,
3685
- active: resolveMenuItemActiveState(menuItem.id, activated, activeItemIds)
4249
+ active
3686
4250
  }),
3687
4251
  disabled,
3688
4252
  onClick: () => {
@@ -4433,6 +4997,9 @@ function ContextMenuMenuItem(props) {
4433
4997
  setInputValue(value);
4434
4998
  }, [value]);
4435
4999
  (0, react.useEffect)(() => () => clearSubmenuCloseTimer(), [clearSubmenuCloseTimer]);
5000
+ (0, react.useEffect)(() => {
5001
+ if (disabled) closeSubmenu();
5002
+ }, [closeSubmenu, disabled]);
4436
5003
  (0, react.useEffect)(() => {
4437
5004
  if (!submenuVisible) {
4438
5005
  setSubmenuPositionReady(false);
@@ -4452,9 +5019,10 @@ function ContextMenuMenuItem(props) {
4452
5019
  const left = useLeft ? leftLeft : rightLeft;
4453
5020
  setSubmenuPlacement(useLeft ? "left" : "right");
4454
5021
  const maxTop = window.innerHeight - menuViewportPadding - submenuRect.height;
5022
+ const top = maxTop < menuViewportPadding ? menuViewportPadding : Math.min(Math.max(menuItemRect.top, menuViewportPadding), maxTop);
4455
5023
  setSubmenuPosition({
4456
5024
  left,
4457
- top: maxTop < menuViewportPadding ? menuViewportPadding : Math.min(Math.max(menuItemRect.top, menuViewportPadding), maxTop)
5025
+ top
4458
5026
  });
4459
5027
  setSubmenuPositionReady(true);
4460
5028
  };
@@ -4475,7 +5043,8 @@ function ContextMenuMenuItem(props) {
4475
5043
  const hiddenById = menuItem.id != null && hiddenItemIds.includes(menuItem.id) || hiddenItemIds.includes(menuKey);
4476
5044
  if (hidden || hiddenById) return null;
4477
5045
  const onChange = (v) => {
4478
- setInputValue((0, _univerjs_core.isRealNum)(v) && typeof v === "string" ? Number.parseInt(v) : v);
5046
+ const newValue = (0, _univerjs_core.isRealNum)(v) && typeof v === "string" ? Number.parseInt(v) : v;
5047
+ setInputValue(newValue);
4479
5048
  };
4480
5049
  const onSubmenuOptionSelect = (option) => {
4481
5050
  onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect(option);
@@ -5016,7 +5585,7 @@ function Sidebar() {
5016
5585
  children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5017
5586
  ref: closeButtonRef,
5018
5587
  type: "button",
5019
- className: "focus:univer-ring-primary-500/50 univer-cursor-pointer univer-appearance-none univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-text-gray-500 focus:univer-outline-none focus:univer-ring-2 dark:!univer-text-gray-300",
5588
+ className: "focus:univer-ring-primary-500/50 univer-flex univer-size-6 univer-cursor-pointer univer-appearance-none univer-items-center univer-justify-center univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-text-gray-500 focus:univer-outline-none focus:univer-ring-2 dark:!univer-text-gray-300",
5020
5589
  onClick: handleClose,
5021
5590
  "aria-label": localeService.t("ui.sidebar.close"),
5022
5591
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, {})
@@ -5024,7 +5593,6 @@ function Sidebar() {
5024
5593
  }),
5025
5594
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5026
5595
  className: "univer-box-border univer-cursor-default univer-px-4",
5027
- style: options === null || options === void 0 ? void 0 : options.bodyStyle,
5028
5596
  children: options === null || options === void 0 ? void 0 : options.children
5029
5597
  }),
5030
5598
  (options === null || options === void 0 ? void 0 : options.footer) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", {
@@ -5036,6 +5604,95 @@ function Sidebar() {
5036
5604
  });
5037
5605
  }
5038
5606
 
5607
+ //#endregion
5608
+ //#region src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
5609
+ function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
5610
+ const shimmerClassName = `
5611
+ univer-animate-pulse univer-bg-gray-100 motion-reduce:univer-animate-none
5612
+ dark:!univer-bg-gray-700
5613
+ `;
5614
+ const shimmerStyle = { animationDuration: "1.2s" };
5615
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5616
+ "aria-busy": "true",
5617
+ className: (0, _univerjs_design.clsx)("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-overflow-hidden univer-bg-gray-50 dark:!univer-bg-gray-900", {
5618
+ "univer-absolute univer-inset-0 univer-z-50": overlay,
5619
+ "univer-dark": darkMode
5620
+ }),
5621
+ dir: direction,
5622
+ children: [
5623
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
5624
+ "data-u-comp": "workbench-skeleton-toolbar",
5625
+ className: "univer-flex univer-h-11 univer-shrink-0 univer-items-center univer-gap-2 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-bg-white univer-px-4 dark:!univer-border-gray-700 dark:!univer-bg-gray-800",
5626
+ children: [
5627
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5628
+ "data-u-comp": "workbench-skeleton-shimmer",
5629
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-h-4 univer-w-24 univer-rounded"),
5630
+ style: shimmerStyle
5631
+ }),
5632
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5633
+ "data-u-comp": "workbench-skeleton-shimmer",
5634
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-ml-2 univer-size-6 univer-rounded"),
5635
+ style: shimmerStyle
5636
+ }),
5637
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5638
+ "data-u-comp": "workbench-skeleton-shimmer",
5639
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-size-6 univer-rounded"),
5640
+ style: shimmerStyle
5641
+ })
5642
+ ]
5643
+ }),
5644
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("main", {
5645
+ "data-u-comp": "workbench-skeleton-content",
5646
+ className: "univer-flex univer-min-h-0 univer-min-w-0 univer-flex-1 univer-flex-col univer-gap-4 univer-p-4",
5647
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5648
+ "data-u-comp": "workbench-skeleton-shimmer",
5649
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-h-4 univer-w-1/3 univer-rounded"),
5650
+ style: shimmerStyle
5651
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5652
+ "data-u-comp": "workbench-skeleton-shimmer",
5653
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-flex-1 univer-rounded-md"),
5654
+ style: shimmerStyle
5655
+ })]
5656
+ }),
5657
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
5658
+ "data-u-comp": "workbench-skeleton-footer",
5659
+ className: "univer-flex univer-h-10 univer-shrink-0 univer-items-center univer-justify-between univer-border-0 univer-border-t univer-border-solid univer-border-gray-200 univer-bg-white univer-px-4 dark:!univer-border-gray-700 dark:!univer-bg-gray-800",
5660
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5661
+ className: "univer-flex univer-items-center univer-gap-2",
5662
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5663
+ "data-u-comp": "workbench-skeleton-shimmer",
5664
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-size-5 univer-rounded"),
5665
+ style: shimmerStyle
5666
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5667
+ "data-u-comp": "workbench-skeleton-shimmer",
5668
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-h-5 univer-w-14 univer-rounded"),
5669
+ style: shimmerStyle
5670
+ })]
5671
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5672
+ className: "univer-flex univer-items-center univer-gap-2",
5673
+ children: [
5674
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5675
+ "data-u-comp": "workbench-skeleton-shimmer",
5676
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-size-5 univer-rounded"),
5677
+ style: shimmerStyle
5678
+ }),
5679
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5680
+ "data-u-comp": "workbench-skeleton-shimmer",
5681
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-h-2 univer-w-24 univer-rounded-full"),
5682
+ style: shimmerStyle
5683
+ }),
5684
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5685
+ "data-u-comp": "workbench-skeleton-shimmer",
5686
+ className: (0, _univerjs_design.clsx)(shimmerClassName, "univer-size-5 univer-rounded"),
5687
+ style: shimmerStyle
5688
+ })
5689
+ ]
5690
+ })]
5691
+ })
5692
+ ]
5693
+ });
5694
+ }
5695
+
5039
5696
  //#endregion
5040
5697
  //#region src/views/hooks/update-effect.ts
5041
5698
  /**
@@ -5242,6 +5899,8 @@ function DesktopWorkbenchContent(props) {
5242
5899
  var _uiConfig$popupRootId;
5243
5900
  const { header = true, toolbar = true, footer = true, headerMenu = true, contextMenu = true, ribbonType = "classic", mountContainer, onRendered } = props;
5244
5901
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
5902
+ const lifecycleService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LifecycleService);
5903
+ const workbenchService = (0, _wendellhu_redi_react_bindings.useDependency)(IWorkbenchService);
5245
5904
  const themeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService);
5246
5905
  const themeSwitcherService = (0, _wendellhu_redi_react_bindings.useDependency)(ThemeSwitcherService);
5247
5906
  const contentRef = (0, react.useRef)(null);
@@ -5254,6 +5913,9 @@ function DesktopWorkbenchContent(props) {
5254
5913
  const leftSidebarComponents = useComponentsOfPart("left-sidebar");
5255
5914
  const globalComponents = useComponentsOfPart("global");
5256
5915
  const toolbarComponents = useComponentsOfPart("toolbar");
5916
+ const lifecycleStage = (0, _wendellhu_redi_react_bindings.useObservable)(lifecycleService.lifecycle$, lifecycleService.stage);
5917
+ const externalSkeletonVisible = (0, _wendellhu_redi_react_bindings.useObservable)(workbenchService.skeletonVisible$, void 0, true);
5918
+ const ready = lifecycleStage >= _univerjs_core.LifecycleStages.Ready;
5257
5919
  const popupRootId = (_uiConfig$popupRootId = uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) !== null && _uiConfig$popupRootId !== void 0 ? _uiConfig$popupRootId : "univer-popup-portal";
5258
5920
  (0, react.useLayoutEffect)(() => {
5259
5921
  const sub = themeService.currentTheme$.subscribe((theme) => {
@@ -5269,8 +5931,8 @@ function DesktopWorkbenchContent(props) {
5269
5931
  else document.documentElement.classList.remove("univer-dark");
5270
5932
  }, [darkMode]);
5271
5933
  (0, react.useEffect)(() => {
5272
- if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
5273
- }, [onRendered]);
5934
+ if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
5935
+ }, [ready, onRendered]);
5274
5936
  const locale = (0, _wendellhu_redi_react_bindings.useObservable)(() => localeService.localeChanged$.pipe((0, rxjs.map)(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
5275
5937
  const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
5276
5938
  const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
@@ -5288,61 +5950,68 @@ function DesktopWorkbenchContent(props) {
5288
5950
  direction,
5289
5951
  mountContainer: portalContainer,
5290
5952
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5291
- "data-u-comp": "workbench-layout",
5292
- className: (0, _univerjs_design.clsx)("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
5293
- tabIndex: -1,
5294
- onBlur: (e) => e.stopPropagation(),
5295
- onContextMenu: (e) => e.preventDefault(),
5296
- dir: direction,
5297
- children: [
5298
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5299
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
5300
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: customHeaderComponents }, "custom-header")
5301
- }),
5302
- header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
5303
- "data-u-comp": "headerbar",
5304
- className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
5305
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
5306
- components: toolbarComponents,
5307
- sharedProps: {
5308
- ribbonType,
5309
- headerMenuComponents,
5310
- headerMenu
5311
- }
5312
- }, "toolbar")
5313
- }),
5314
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5315
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
5316
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5317
- className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
5318
- children: [
5319
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5320
- "data-u-comp": "left-sidebar",
5321
- className: "univer-h-full",
5322
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
5323
- }),
5324
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5325
- className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
5326
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", { children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5327
- className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
5328
- ref: contentRef,
5329
- "data-range-selector": true,
5330
- onContextMenu: (e) => e.preventDefault(),
5331
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
5332
- })]
5333
- }),
5334
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5335
- "data-u-comp": "right-sidebar",
5336
- className: "univer-z-[100] univer-h-full",
5337
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
5338
- })
5339
- ]
5340
- }), footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
5341
- components: footerComponents,
5342
- sharedProps: { contextMenu }
5343
- }, "footer") })]
5344
- })
5345
- ]
5953
+ className: "univer-relative univer-h-full univer-min-h-0",
5954
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5955
+ "data-u-comp": "workbench-layout",
5956
+ className: (0, _univerjs_design.clsx)("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
5957
+ tabIndex: -1,
5958
+ onBlur: (e) => e.stopPropagation(),
5959
+ onContextMenu: (e) => e.preventDefault(),
5960
+ dir: direction,
5961
+ children: [
5962
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5963
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
5964
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: customHeaderComponents }, "custom-header")
5965
+ }),
5966
+ header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
5967
+ "data-u-comp": "headerbar",
5968
+ className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
5969
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
5970
+ components: toolbarComponents,
5971
+ sharedProps: {
5972
+ ribbonType,
5973
+ headerMenuComponents,
5974
+ headerMenu
5975
+ }
5976
+ }, "toolbar")
5977
+ }),
5978
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5979
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
5980
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5981
+ className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
5982
+ children: [
5983
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5984
+ "data-u-comp": "left-sidebar",
5985
+ className: "univer-h-full",
5986
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
5987
+ }),
5988
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5989
+ className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
5990
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", { children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5991
+ className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
5992
+ ref: contentRef,
5993
+ "data-range-selector": true,
5994
+ onContextMenu: (e) => e.preventDefault(),
5995
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
5996
+ })]
5997
+ }),
5998
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
5999
+ "data-u-comp": "right-sidebar",
6000
+ className: "univer-z-[100] univer-h-full",
6001
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
6002
+ })
6003
+ ]
6004
+ }), footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
6005
+ components: footerComponents,
6006
+ sharedProps: { contextMenu }
6007
+ }, "footer") })]
6008
+ })
6009
+ ]
6010
+ }), (!ready || externalSkeletonVisible) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkbenchSkeleton, {
6011
+ darkMode,
6012
+ direction,
6013
+ overlay: true
6014
+ })]
5346
6015
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5347
6016
  dir: direction,
5348
6017
  children: [
@@ -5387,6 +6056,9 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
5387
6056
  delete this._renderManagerService;
5388
6057
  }
5389
6058
  _bootstrapWorkbench() {
6059
+ var _this$_injector$get;
6060
+ const initialSkeleton = (_this$_injector$get = this._injector.get(IWorkbenchService, _univerjs_core.Quantity.OPTIONAL)) === null || _this$_injector$get === void 0 ? void 0 : _this$_injector$get.acquireSkeleton();
6061
+ if (initialSkeleton) this.disposeWithMe(initialSkeleton);
5390
6062
  this.disposeWithMe(this.bootstrap(async (contentElement, containerElement) => {
5391
6063
  if (this._layoutService) {
5392
6064
  this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement));
@@ -5397,6 +6069,7 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
5397
6069
  this._renderTimeout = window.setTimeout(() => {
5398
6070
  const allRenders = this._renderManagerService.getRenderAll();
5399
6071
  for (const [key] of allRenders) if (this._changeRenderUnit(key, contentElement)) break;
6072
+ requestAnimationFrame(() => requestAnimationFrame(() => initialSkeleton === null || initialSkeleton === void 0 ? void 0 : initialSkeleton.dispose()));
5400
6073
  this.disposeWithMe(this._instanceService.focused$.subscribe((unit) => {
5401
6074
  if (unit) this._changeRenderUnit(unit, contentElement);
5402
6075
  }));
@@ -5424,9 +6097,9 @@ var SingleUnitUIController = class extends _univerjs_core.Disposable {
5424
6097
  var _this$_instanceServic2;
5425
6098
  if (this._currentRenderId === rendererId) return false;
5426
6099
  if ((_this$_instanceServic2 = this._instanceService.getUnitCreateOptions(rendererId)) === null || _this$_instanceServic2 === void 0 ? void 0 : _this$_instanceServic2.embeddedRender) return false;
5427
- const renderer = this._renderManagerService.getRenderById(rendererId);
6100
+ const renderer = this._renderManagerService.getRenderUnitById(rendererId);
5428
6101
  if (!renderer || !renderer.unitId || (0, _univerjs_core.isInternalEditorID)(renderer.unitId)) return false;
5429
- const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderById(this._currentRenderId) : null;
6102
+ const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderUnitById(this._currentRenderId) : null;
5430
6103
  currentRenderer === null || currentRenderer === void 0 || currentRenderer.deactivate();
5431
6104
  currentRenderer === null || currentRenderer === void 0 || currentRenderer.engine.unmount();
5432
6105
  renderer.engine.mount(contentElement);
@@ -5498,7 +6171,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
5498
6171
  //#endregion
5499
6172
  //#region package.json
5500
6173
  var name = "@univerjs/ui";
5501
- var version = "1.0.0-alpha.6";
6174
+ var version = "1.0.0-alpha.8";
5502
6175
 
5503
6176
  //#endregion
5504
6177
  //#region src/views/color-picker/interface.ts
@@ -5592,7 +6265,7 @@ function ShortcutPanel() {
5592
6265
  if (!shortcutGroups.has(group)) shortcutGroups.set(group, []);
5593
6266
  shortcutGroups.get(group).push(shortcutItem);
5594
6267
  }
5595
- setShortcutItems(Array.from(shortcutGroups.entries()).map(([name, items]) => {
6268
+ const toRender = Array.from(shortcutGroups.entries()).map(([name, items]) => {
5596
6269
  const groupSequence = name.split("_")[0];
5597
6270
  const localeKey = groupTitles.get(name);
5598
6271
  return {
@@ -5600,7 +6273,8 @@ function ShortcutPanel() {
5600
6273
  name: localeService.t(localeKey),
5601
6274
  items: (0, _univerjs_core.dedupeBy)(items, (item) => item.title + item.shortcut)
5602
6275
  };
5603
- }).sort((a, b) => a.sequence - b.sequence));
6276
+ }).sort((a, b) => a.sequence - b.sequence);
6277
+ setShortcutItems(toRender);
5604
6278
  }, [
5605
6279
  shortcutService,
5606
6280
  localeService,
@@ -20500,11 +21174,12 @@ function EmojiPicker(props) {
20500
21174
  };
20501
21175
  }, [localStorageService, recentStorageKey]);
20502
21176
  const handleSelect = (item, options) => {
20503
- var _extraProps$onSelect;
21177
+ var _props$onChange, _extraProps$onSelect;
20504
21178
  const nextRecents = promoteRecentEmoji(recents, item);
20505
21179
  setActiveEmoji(item.emoji);
20506
21180
  setRecents(nextRecents);
20507
21181
  writeRecents(localStorageService, recentStorageKey, nextRecents);
21182
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, item.emoji);
20508
21183
  extraProps === null || extraProps === void 0 || (_extraProps$onSelect = extraProps.onSelect) === null || _extraProps$onSelect === void 0 || _extraProps$onSelect.call(extraProps, item.emoji, options);
20509
21184
  };
20510
21185
  const handleRandom = () => {
@@ -20524,7 +21199,7 @@ function EmojiPicker(props) {
20524
21199
  };
20525
21200
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
20526
21201
  "data-u-comp": EMOJI_PICKER_COMPONENT,
20527
- className: "univer-flex univer-h-[340px] univer-w-[420px] univer-flex-col univer-overflow-hidden univer-rounded-[10px] univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-900",
21202
+ className: (0, _univerjs_design.clsx)("univer-flex univer-h-[340px] univer-w-[420px] univer-flex-col univer-overflow-hidden", !props.embedded && "univer-rounded-[10px] univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-900"),
20528
21203
  children: [
20529
21204
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
20530
21205
  className: "univer-flex univer-items-center univer-gap-1 univer-px-3 univer-pb-2 univer-pt-3",
@@ -20546,7 +21221,7 @@ function EmojiPicker(props) {
20546
21221
  }),
20547
21222
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
20548
21223
  ref: scrollRef,
20549
- className: "univer-relative univer-min-h-0 univer-flex-1 univer-overflow-y-auto univer-px-3",
21224
+ className: (0, _univerjs_design.clsx)("univer-relative univer-min-h-0 univer-flex-1 univer-overflow-y-auto univer-px-3", _univerjs_design.scrollbarClassName),
20550
21225
  onScroll: handleScroll,
20551
21226
  children: renderedSections.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
20552
21227
  className: "univer-flex univer-flex-col univer-gap-1.5 univer-pb-2",
@@ -21297,8 +21972,8 @@ function ZoomInput(props) {
21297
21972
  className: (0, _univerjs_design.clsx)("univer-flex univer-h-6 univer-w-[68px] univer-flex-shrink-0 univer-items-center univer-overflow-hidden univer-rounded-md univer-border univer-border-gray-200 univer-bg-white dark:!univer-border-gray-600 dark:!univer-bg-gray-800", className, { "univer-opacity-60": disabled }),
21298
21973
  onClick: (e) => e.stopPropagation(),
21299
21974
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
21300
- className: "univer-box-border univer-h-6 univer-w-[52px] univer-border-none univer-bg-transparent [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-[52px] [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-px-1 [&_input]:univer-text-center [&_input]:univer-text-xs [&_input]:univer-tabular-nums",
21301
- inputClass: "univer-w-[52px]",
21975
+ className: "univer-box-border univer-h-6 univer-min-w-0 univer-flex-1 univer-border-none univer-bg-transparent [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-full [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-px-1 [&_input]:univer-text-center [&_input]:univer-text-xs [&_input]:univer-tabular-nums",
21976
+ inputClass: "univer-w-full",
21302
21977
  size: "mini",
21303
21978
  value: inputValue,
21304
21979
  disabled,
@@ -21516,6 +22191,234 @@ function Slider(props) {
21516
22191
  });
21517
22192
  }
21518
22193
 
22194
+ //#endregion
22195
+ //#region src/views/symbol-picker/symbols.ts
22196
+ const SYMBOL_CATEGORIES = [
22197
+ {
22198
+ key: "mathematics",
22199
+ titleKey: "ui.symbolPicker.mathematics",
22200
+ symbols: [
22201
+ "+",
22202
+ "−",
22203
+ "×",
22204
+ "÷",
22205
+ "≠",
22206
+ "≈",
22207
+ "<",
22208
+ ">",
22209
+ "≤",
22210
+ "≥",
22211
+ "≪",
22212
+ "≫",
22213
+ "≡",
22214
+ "±",
22215
+ "%",
22216
+ "‰",
22217
+ "‱",
22218
+ "½",
22219
+ "⅓",
22220
+ "⅔",
22221
+ "¼",
22222
+ "¾",
22223
+ "¹",
22224
+ "²",
22225
+ "³",
22226
+ "ⁿ",
22227
+ "₁",
22228
+ "₂",
22229
+ "₃",
22230
+ "|a|",
22231
+ "∟",
22232
+ "∠",
22233
+ "⊿",
22234
+ "△",
22235
+ "∥",
22236
+ "⊥",
22237
+ "∫",
22238
+ "∬",
22239
+ "∭",
22240
+ "∮",
22241
+ "∯",
22242
+ "∰",
22243
+ "∝",
22244
+ "∞",
22245
+ "∼",
22246
+ "≌",
22247
+ "∈",
22248
+ "∉",
22249
+ "⊆",
22250
+ "⊂",
22251
+ "∅",
22252
+ "∩",
22253
+ "∪",
22254
+ "∧",
22255
+ "∨",
22256
+ "⋅",
22257
+ "⋮",
22258
+ "⋰",
22259
+ "⋱",
22260
+ "⋯",
22261
+ "∏",
22262
+ "∑",
22263
+ "∃",
22264
+ "∄",
22265
+ "∀",
22266
+ "∂",
22267
+ "∆",
22268
+ "⊙",
22269
+ "⊕",
22270
+ "%"
22271
+ ]
22272
+ },
22273
+ {
22274
+ key: "greek",
22275
+ titleKey: "ui.symbolPicker.greek",
22276
+ symbols: [
22277
+ "α",
22278
+ "β",
22279
+ "γ",
22280
+ "δ",
22281
+ "ε",
22282
+ "ζ",
22283
+ "η",
22284
+ "θ",
22285
+ "ι",
22286
+ "κ",
22287
+ "λ",
22288
+ "μ",
22289
+ "ν",
22290
+ "ξ",
22291
+ "ο",
22292
+ "π",
22293
+ "ρ",
22294
+ "σ",
22295
+ "τ",
22296
+ "υ",
22297
+ "φ",
22298
+ "χ",
22299
+ "ψ",
22300
+ "ω",
22301
+ "Α",
22302
+ "Β",
22303
+ "Γ",
22304
+ "Δ",
22305
+ "Ε",
22306
+ "Ζ",
22307
+ "Η",
22308
+ "Θ",
22309
+ "Ι",
22310
+ "Κ",
22311
+ "Λ",
22312
+ "Μ",
22313
+ "Ν",
22314
+ "Ξ",
22315
+ "Ο",
22316
+ "Π",
22317
+ "Ρ",
22318
+ "Σ",
22319
+ "Τ",
22320
+ "Υ",
22321
+ "Φ",
22322
+ "Χ",
22323
+ "Ψ",
22324
+ "Ω"
22325
+ ]
22326
+ },
22327
+ {
22328
+ key: "common",
22329
+ titleKey: "ui.symbolPicker.common",
22330
+ symbols: [
22331
+ "kg",
22332
+ "mm",
22333
+ "cm",
22334
+ "m²",
22335
+ "°C",
22336
+ "°",
22337
+ "§",
22338
+ "◎",
22339
+ "©",
22340
+ "®",
22341
+ "{",
22342
+ "⌜",
22343
+ "〚",
22344
+ "№",
22345
+ "$",
22346
+ "¥",
22347
+ "@",
22348
+ "&",
22349
+ "*",
22350
+ "|",
22351
+ "#",
22352
+ "※",
22353
+ "√",
22354
+ "×",
22355
+ "…",
22356
+ "①",
22357
+ "②",
22358
+ "③",
22359
+ "↑",
22360
+ "↓",
22361
+ "←",
22362
+ "→"
22363
+ ]
22364
+ }
22365
+ ];
22366
+
22367
+ //#endregion
22368
+ //#region src/views/symbol-picker/SymbolPicker.tsx
22369
+ const SYMBOL_PICKER_COMPONENT = "ui.symbol-picker";
22370
+ function SymbolPicker(props) {
22371
+ var _props$popup;
22372
+ const extraProps = (_props$popup = props.popup) === null || _props$popup === void 0 ? void 0 : _props$popup.extraProps;
22373
+ const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
22374
+ (0, _wendellhu_redi_react_bindings.useObservable)(localeService.currentLocale$, localeService.getCurrentLocale());
22375
+ const [activeSymbol, setActiveSymbol] = (0, react.useState)(extraProps === null || extraProps === void 0 ? void 0 : extraProps.activeSymbol);
22376
+ const handleSelect = (symbol) => {
22377
+ var _props$onChange, _extraProps$onSelect;
22378
+ setActiveSymbol(symbol);
22379
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, symbol);
22380
+ extraProps === null || extraProps === void 0 || (_extraProps$onSelect = extraProps.onSelect) === null || _extraProps$onSelect === void 0 || _extraProps$onSelect.call(extraProps, symbol, { keepOpen: true });
22381
+ };
22382
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
22383
+ "data-u-comp": SYMBOL_PICKER_COMPONENT,
22384
+ className: (0, _univerjs_design.clsx)("univer-flex univer-h-[340px] univer-w-[420px] univer-flex-col univer-overflow-hidden", !props.embedded && "univer-rounded-[10px] univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-900", props.className),
22385
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
22386
+ className: (0, _univerjs_design.clsx)("univer-min-h-0 univer-flex-1 univer-overflow-y-auto univer-p-4", _univerjs_design.scrollbarClassName),
22387
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
22388
+ className: "univer-flex univer-flex-col univer-gap-5",
22389
+ children: SYMBOL_CATEGORIES.map((category) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SymbolSection, {
22390
+ activeSymbol,
22391
+ category,
22392
+ onSelect: handleSelect
22393
+ }, category.key))
22394
+ })
22395
+ })
22396
+ });
22397
+ }
22398
+ function SymbolSection(props) {
22399
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
22400
+ className: "univer-flex univer-flex-col univer-gap-2",
22401
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
22402
+ className: "univer-text-sm univer-font-semibold univer-text-gray-900 dark:!univer-text-gray-100",
22403
+ children: (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService).t(props.category.titleKey)
22404
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
22405
+ className: "univer-grid univer-grid-cols-10 univer-gap-1",
22406
+ children: props.category.symbols.map((symbol, index) => {
22407
+ const active = props.activeSymbol === symbol;
22408
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
22409
+ type: "button",
22410
+ "aria-label": symbol,
22411
+ "aria-pressed": active,
22412
+ title: symbol,
22413
+ className: (0, _univerjs_design.clsx)("univer-flex univer-size-8 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-lg univer-border-0 univer-bg-transparent univer-p-0 univer-text-lg univer-text-gray-900 dark:!univer-text-gray-100", active ? "univer-bg-primary-50 univer-shadow-sm dark:!univer-bg-gray-800 dark:!univer-shadow-sm" : "hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800"),
22414
+ onClick: () => props.onSelect(symbol),
22415
+ children: symbol
22416
+ }, `${props.category.key}-${symbol}-${index}`);
22417
+ })
22418
+ })]
22419
+ });
22420
+ }
22421
+
21519
22422
  //#endregion
21520
22423
  //#region src/controllers/components.controller.ts
21521
22424
  /**
@@ -21545,9 +22448,11 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
21545
22448
  this.disposeWithMe(this._iconManager.register({
21546
22449
  ExpandIcon: _univerjs_icons.ExpandIcon,
21547
22450
  IncreaseIcon: _univerjs_icons.IncreaseIcon,
22451
+ KeyboardIcon: _univerjs_icons.KeyboardIcon,
21548
22452
  MoreDownIcon: _univerjs_icons.MoreDownIcon,
21549
22453
  RedoIcon: _univerjs_icons.RedoIcon,
21550
22454
  ReduceIcon: _univerjs_icons.ReduceIcon,
22455
+ FeatureSearchIcon: _univerjs_icons.FeatureSearchIcon,
21551
22456
  ShortcutIcon: _univerjs_icons.ShortcutIcon,
21552
22457
  ShrinkIcon: _univerjs_icons.ShrinkIcon,
21553
22458
  UndoIcon: _univerjs_icons.UndoIcon
@@ -21561,7 +22466,9 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
21561
22466
  [FONT_FAMILY_ITEM_COMPONENT, FontFamilyItem],
21562
22467
  [FONT_SIZE_COMPONENT, FontSize],
21563
22468
  [COLOR_PICKER_COMPONENT, _univerjs_design.ColorPicker],
21564
- [EMOJI_PICKER_COMPONENT, EmojiPicker]
22469
+ [EMOJI_PICKER_COMPONENT, EmojiPicker],
22470
+ [SYMBOL_PICKER_COMPONENT, SymbolPicker],
22471
+ [FEATURE_SEARCH_COMPONENT, FeatureSearch]
21565
22472
  ].forEach(([key, comp]) => {
21566
22473
  this.disposeWithMe(this._componentManager.register(key, comp));
21567
22474
  });
@@ -21570,6 +22477,24 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
21570
22477
  };
21571
22478
  ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(IconManager))], ComponentsController);
21572
22479
 
22480
+ //#endregion
22481
+ //#region src/controllers/feature-search/feature-search.controller.ts
22482
+ const FeatureSearchShortcut = {
22483
+ id: OpenFeatureSearchOperation.id,
22484
+ binding: 4096 | 1024 | 80,
22485
+ description: "ui.featureSearch.title",
22486
+ group: "10_global-shortcut",
22487
+ groupTitle: "ui.global-shortcut"
22488
+ };
22489
+ let FeatureSearchController = class FeatureSearchController extends _univerjs_core.Disposable {
22490
+ constructor(commandService, shortcutService) {
22491
+ super();
22492
+ this.disposeWithMe(commandService.registerCommand(OpenFeatureSearchOperation));
22493
+ this.disposeWithMe(shortcutService.registerShortcut(FeatureSearchShortcut));
22494
+ }
22495
+ };
22496
+ FeatureSearchController = __decorate([__decorateParam(0, _univerjs_core.ICommandService), __decorateParam(1, IShortcutService)], FeatureSearchController);
22497
+
21573
22498
  //#endregion
21574
22499
  //#region src/views/components/ribbon/MobileRibbon.tsx
21575
22500
  const toolbarScrollOffset = 168;
@@ -21793,7 +22718,8 @@ function MobileMenu(props) {
21793
22718
  menuManagerService,
21794
22719
  menuType,
21795
22720
  onExecute: onOptionSelect,
21796
- onOpenView: openView
22721
+ onOpenView: openView,
22722
+ inheritedDisabled$: currentView === null || currentView === void 0 ? void 0 : currentView.disabled$
21797
22723
  })
21798
22724
  }), (currentView === null || currentView === void 0 ? void 0 : currentView.kind) === "options" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
21799
22725
  className: "univer-overflow-hidden univer-rounded-2xl univer-bg-white",
@@ -21802,6 +22728,7 @@ function MobileMenu(props) {
21802
22728
  menuItem: currentView.menuItem,
21803
22729
  options: currentView.options,
21804
22730
  currentValue: currentView.currentValue,
22731
+ inheritedDisabled$: currentView.disabled$,
21805
22732
  onExecute: onOptionSelect
21806
22733
  })
21807
22734
  })]
@@ -21809,7 +22736,7 @@ function MobileMenu(props) {
21809
22736
  });
21810
22737
  }
21811
22738
  function MobileSchemaList(props) {
21812
- const { schemas, menuManagerService, menuType, onExecute, onOpenView } = props;
22739
+ const { schemas, menuManagerService, menuType, onExecute, onOpenView, inheritedDisabled$ } = props;
21813
22740
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
21814
22741
  const hiddenGroupStates = useContextGroupHiddenStates(schemas);
21815
22742
  const visibleSchemas = (0, react.useMemo)(() => {
@@ -21827,6 +22754,7 @@ function MobileSchemaList(props) {
21827
22754
  menuType,
21828
22755
  onExecute,
21829
22756
  onOpenView,
22757
+ inheritedDisabled$,
21830
22758
  bordered: index !== visibleSchemas.length - 1
21831
22759
  }, schema.key);
21832
22760
  if (!((_schema$children2 = schema.children) === null || _schema$children2 === void 0 ? void 0 : _schema$children2.length)) return null;
@@ -21841,18 +22769,20 @@ function MobileSchemaList(props) {
21841
22769
  menuType,
21842
22770
  onExecute,
21843
22771
  onOpenView,
22772
+ inheritedDisabled$,
21844
22773
  bordered: childIndex !== schema.children.length - 1
21845
22774
  }, childSchema.key))]
21846
22775
  }, schema.key);
21847
22776
  }) });
21848
22777
  }
21849
22778
  function MobileSchemaRow(props) {
21850
- const { schema, menuManagerService, menuType, onExecute, onOpenView, bordered } = props;
22779
+ const { schema, menuManagerService, menuType, onExecute, onOpenView, inheritedDisabled$, bordered } = props;
21851
22780
  const interaction = useMobileSchemaInteraction({
21852
22781
  schema,
21853
22782
  menuManagerService,
21854
22783
  menuType,
21855
- onOpenView
22784
+ onOpenView,
22785
+ inheritedDisabled$
21856
22786
  });
21857
22787
  if (!interaction || interaction.hidden) return null;
21858
22788
  const { menuItem, disabled, value, currentValueText, hasSubmenu, onPress } = interaction;
@@ -21880,7 +22810,8 @@ function MobileSchemaRow(props) {
21880
22810
  });
21881
22811
  }
21882
22812
  function MobileSelectionOptionsView(props) {
21883
- const { options, menuKey, menuItem, currentValue, onExecute } = props;
22813
+ const { options, menuKey, menuItem, currentValue, inheritedDisabled$, onExecute } = props;
22814
+ const inheritedDisabled = (0, _wendellhu_redi_react_bindings.useObservable)(inheritedDisabled$, false);
21884
22815
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: options.map((option, index) => {
21885
22816
  var _option$value;
21886
22817
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSelectionOptionRow, {
@@ -21888,6 +22819,7 @@ function MobileSelectionOptionsView(props) {
21888
22819
  menuKey,
21889
22820
  menuItem,
21890
22821
  currentValue,
22822
+ disabled: inheritedDisabled,
21891
22823
  bordered: index !== options.length - 1,
21892
22824
  onExecute
21893
22825
  }, `${menuKey}-${String((_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : index)}`);
@@ -21895,15 +22827,17 @@ function MobileSelectionOptionsView(props) {
21895
22827
  }
21896
22828
  function MobileSelectionOptionRow(props) {
21897
22829
  var _option$value2;
21898
- const { option, menuKey, menuItem, currentValue, bordered, onExecute } = props;
22830
+ const { option, menuKey, menuItem, currentValue, disabled, bordered, onExecute } = props;
21899
22831
  const optionValue = (0, _wendellhu_redi_react_bindings.useObservable)(option.value$);
21900
22832
  const displayValue = (_option$value2 = option.value) !== null && _option$value2 !== void 0 ? _option$value2 : optionValue;
21901
22833
  const selected = displayValue === currentValue;
22834
+ const optionDisabled = disabled || Boolean(option.disabled);
21902
22835
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
21903
22836
  type: "button",
21904
22837
  className: (0, _univerjs_design.clsx)("univer-relative univer-flex univer-min-h-[56px] univer-w-full univer-appearance-none univer-items-center univer-gap-3 univer-border-0 univer-bg-white univer-px-4 univer-py-3 univer-text-left univer-transition-colors enabled:hover:univer-bg-gray-50 enabled:active:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-opacity-40", bordered && _univerjs_design.borderBottomClassName),
21905
- disabled: option.disabled,
22838
+ disabled: optionDisabled,
21906
22839
  onClick: () => {
22840
+ if (optionDisabled) return;
21907
22841
  onExecute === null || onExecute === void 0 || onExecute({
21908
22842
  ...option,
21909
22843
  value: displayValue,
@@ -21925,11 +22859,15 @@ function MobileSelectionOptionRow(props) {
21925
22859
  }
21926
22860
  function useMobileSchemaInteraction(props) {
21927
22861
  var _schema$children3;
21928
- const { schema, menuManagerService, menuType, onOpenView } = props;
22862
+ const { schema, menuManagerService, menuType, onOpenView, inheritedDisabled$ } = props;
21929
22863
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
21930
22864
  const menuItem = schema.item;
21931
22865
  const selectorItem = menuItem;
21932
- const disabled = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem === null || menuItem === void 0 ? void 0 : menuItem.disabled$, false);
22866
+ const disabled$ = (0, react.useMemo)(() => {
22867
+ const sources = [inheritedDisabled$, menuItem === null || menuItem === void 0 ? void 0 : menuItem.disabled$].filter((source) => Boolean(source));
22868
+ return sources.length ? (0, rxjs.combineLatest)(sources.map((source) => source.pipe((0, rxjs_operators.startWith)(false)))).pipe((0, rxjs.map)((states) => states.some(Boolean))) : void 0;
22869
+ }, [inheritedDisabled$, menuItem === null || menuItem === void 0 ? void 0 : menuItem.disabled$]);
22870
+ const disabled = (0, _wendellhu_redi_react_bindings.useObservable)(disabled$, false);
21933
22871
  const hidden = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem === null || menuItem === void 0 ? void 0 : menuItem.hidden$, false);
21934
22872
  const value = (0, _wendellhu_redi_react_bindings.useObservable)(menuItem === null || menuItem === void 0 ? void 0 : menuItem.value$);
21935
22873
  const selectionsFromObservable = (0, _wendellhu_redi_react_bindings.useObservable)(selectorItem && (0, rxjs.isObservable)(selectorItem.selections) ? selectorItem.selections : void 0);
@@ -21951,11 +22889,13 @@ function useMobileSchemaInteraction(props) {
21951
22889
  const hasSubmenu = schemaChildren.length > 0 || selections.length > 0 || subMenuItems.length > 0;
21952
22890
  const currentValueText = typeof value === "string" || typeof value === "number" ? String(value) : "";
21953
22891
  const onPress = (onExecute) => {
22892
+ if (disabled) return;
21954
22893
  if (schemaChildren.length > 0) {
21955
22894
  onOpenView({
21956
22895
  kind: "schema",
21957
22896
  title: getMenuSchemaTitle(schema, localeService),
21958
- schemas: schemaChildren
22897
+ schemas: schemaChildren,
22898
+ disabled$
21959
22899
  });
21960
22900
  return;
21961
22901
  }
@@ -21966,7 +22906,8 @@ function useMobileSchemaInteraction(props) {
21966
22906
  options: selections,
21967
22907
  menuItem: selectorItem,
21968
22908
  menuKey: schema.key,
21969
- currentValue: value
22909
+ currentValue: value,
22910
+ disabled$
21970
22911
  });
21971
22912
  return;
21972
22913
  }
@@ -21974,7 +22915,8 @@ function useMobileSchemaInteraction(props) {
21974
22915
  onOpenView({
21975
22916
  kind: "schema",
21976
22917
  title: getMenuSchemaTitle(schema, localeService),
21977
- schemas: subMenuItems
22918
+ schemas: subMenuItems,
22919
+ disabled$
21978
22920
  });
21979
22921
  return;
21980
22922
  }
@@ -22152,6 +23094,8 @@ function mountMobileWorkbench(injector, options, mountContainer, onRendered) {
22152
23094
  function MobileWorkbench(props) {
22153
23095
  const { header = true, toolbar = true, footer = true, headerMenu = true, ribbonType = "classic", contextMenu = true, mountContainer, onRendered } = props;
22154
23096
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
23097
+ const lifecycleService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LifecycleService);
23098
+ const workbenchService = (0, _wendellhu_redi_react_bindings.useDependency)(IWorkbenchService);
22155
23099
  const themeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ThemeService);
22156
23100
  const themeSwitcherService = (0, _wendellhu_redi_react_bindings.useDependency)(ThemeSwitcherService);
22157
23101
  const contentRef = (0, react.useRef)(null);
@@ -22163,9 +23107,12 @@ function MobileWorkbench(props) {
22163
23107
  const globalComponents = useComponentsOfPart("global");
22164
23108
  const toolbarComponents = useComponentsOfPart("toolbar");
22165
23109
  const darkMode = (0, _wendellhu_redi_react_bindings.useObservable)(themeService.darkMode$, themeService.darkMode);
23110
+ const lifecycleStage = (0, _wendellhu_redi_react_bindings.useObservable)(lifecycleService.lifecycle$, lifecycleService.stage);
23111
+ const externalSkeletonVisible = (0, _wendellhu_redi_react_bindings.useObservable)(workbenchService.skeletonVisible$, void 0, true);
23112
+ const ready = lifecycleStage >= _univerjs_core.LifecycleStages.Ready;
22166
23113
  (0, react.useEffect)(() => {
22167
- if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
22168
- }, [onRendered]);
23114
+ if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
23115
+ }, [ready, onRendered]);
22169
23116
  const locale = (0, _wendellhu_redi_react_bindings.useObservable)(() => localeService.localeChanged$.pipe((0, rxjs.map)(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
22170
23117
  const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
22171
23118
  const portalContainer = (0, react.useMemo)(() => document.createElement("div"), []);
@@ -22191,51 +23138,58 @@ function MobileWorkbench(props) {
22191
23138
  direction,
22192
23139
  mountContainer: portalContainer,
22193
23140
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
22194
- "data-u-comp": "app-layout",
22195
- className: (0, _univerjs_design.clsx)("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
22196
- tabIndex: -1,
22197
- onBlur: (e) => e.stopPropagation(),
22198
- onContextMenu: (e) => e.preventDefault(),
22199
- dir: direction,
22200
- children: [header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
22201
- "data-u-comp": "headerbar",
22202
- className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
22203
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
22204
- components: toolbarComponents,
22205
- sharedProps: {
22206
- ribbonType,
22207
- headerMenuComponents,
22208
- headerMenu
22209
- }
22210
- }, "toolbar")
22211
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
22212
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
22213
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
22214
- className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
22215
- children: [
22216
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
22217
- className: "univer-h-full",
22218
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
22219
- }),
22220
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
22221
- className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
22222
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
22223
- className: "univer-w-screen",
22224
- children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header")
22225
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
22226
- ref: contentRef,
22227
- className: "univer-relative univer-overflow-hidden",
22228
- "data-range-selector": true,
22229
- onContextMenu: (e) => e.preventDefault(),
22230
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
22231
- })]
22232
- }),
22233
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
22234
- className: "univer-h-full",
22235
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
22236
- })
22237
- ]
22238
- }), footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: footerComponents }, "footer") })]
23141
+ className: "univer-relative univer-h-full univer-min-h-0",
23142
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
23143
+ "data-u-comp": "app-layout",
23144
+ className: (0, _univerjs_design.clsx)("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
23145
+ tabIndex: -1,
23146
+ onBlur: (e) => e.stopPropagation(),
23147
+ onContextMenu: (e) => e.preventDefault(),
23148
+ dir: direction,
23149
+ children: [header && toolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
23150
+ "data-u-comp": "headerbar",
23151
+ className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
23152
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, {
23153
+ components: toolbarComponents,
23154
+ sharedProps: {
23155
+ ribbonType,
23156
+ headerMenuComponents,
23157
+ headerMenu
23158
+ }
23159
+ }, "toolbar")
23160
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
23161
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
23162
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
23163
+ className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
23164
+ children: [
23165
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
23166
+ className: "univer-h-full",
23167
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
23168
+ }),
23169
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
23170
+ className: (0, _univerjs_design.clsx)("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName),
23171
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
23172
+ className: "univer-w-screen",
23173
+ children: header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerComponents }, "header")
23174
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
23175
+ ref: contentRef,
23176
+ className: "univer-relative univer-overflow-hidden",
23177
+ "data-range-selector": true,
23178
+ onContextMenu: (e) => e.preventDefault(),
23179
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: contentComponents }, "content")
23180
+ })]
23181
+ }),
23182
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
23183
+ className: "univer-h-full",
23184
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {})
23185
+ })
23186
+ ]
23187
+ }), footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: footerComponents }, "footer") })]
23188
+ })]
23189
+ }), (!ready || externalSkeletonVisible) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkbenchSkeleton, {
23190
+ darkMode,
23191
+ direction,
23192
+ overlay: true
22239
23193
  })]
22240
23194
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
22241
23195
  dir: direction,
@@ -22529,7 +23483,7 @@ let BrowserClipboardService = class BrowserClipboardService extends _univerjs_co
22529
23483
  this._notificationService = _notificationService;
22530
23484
  }
22531
23485
  async write(text, html, customData) {
22532
- if (!this.supportClipboard) return this._legacyCopyHtml(text, html);
23486
+ if (!this.supportClipboard || typeof ClipboardItem === "undefined" || typeof navigator.clipboard.write !== "function") return this._legacyCopyHtml(text, html);
22533
23487
  try {
22534
23488
  return await navigator.clipboard.write([new ClipboardItem({
22535
23489
  [PLAIN_TEXT_CLIPBOARD_MIME_TYPE]: new Blob([text], { type: PLAIN_TEXT_CLIPBOARD_MIME_TYPE }),
@@ -22861,10 +23815,6 @@ let DesktopConfirmService = class DesktopConfirmService extends _univerjs_core.D
22861
23815
  };
22862
23816
  DesktopConfirmService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, IUIPartsService)], DesktopConfirmService);
22863
23817
 
22864
- //#endregion
22865
- //#region src/services/dialog/dialog.service.ts
22866
- const IDialogService = (0, _univerjs_core.createIdentifier)("univer.ui.dialog-service");
22867
-
22868
23818
  //#endregion
22869
23819
  //#region src/views/components/dialog-part/DialogPart.tsx
22870
23820
  function DialogPart() {
@@ -23453,6 +24403,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plu
23453
24403
  [IconManager],
23454
24404
  [ComponentsController],
23455
24405
  [ThemeSwitcherService],
24406
+ [IWorkbenchService, { useClass: WorkbenchService }],
23456
24407
  [ZIndexManager],
23457
24408
  [ShortcutPanelService],
23458
24409
  [IUIPartsService, { useClass: UIPartsService }],
@@ -23508,6 +24459,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plu
23508
24459
  }],
23509
24460
  [SharedController],
23510
24461
  [ErrorController],
24462
+ [FeatureSearchController],
23511
24463
  [ShortcutPanelController]
23512
24464
  ], this._config.override));
23513
24465
  (0, _univerjs_core.touchDependencies)(this._injector, [
@@ -23517,7 +24469,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends _univerjs_core.Plu
23517
24469
  ]);
23518
24470
  }
23519
24471
  onReady() {
23520
- (0, _univerjs_core.touchDependencies)(this._injector, [[SharedController]]);
24472
+ (0, _univerjs_core.touchDependencies)(this._injector, [[SharedController], [FeatureSearchController]]);
23521
24473
  }
23522
24474
  onSteady() {
23523
24475
  (0, _univerjs_core.touchDependencies)(this._injector, [[ShortcutPanelController]]);
@@ -23557,6 +24509,7 @@ let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
23557
24509
  [ZIndexManager],
23558
24510
  [ShortcutPanelService],
23559
24511
  [IUIPartsService, { useClass: UIPartsService }],
24512
+ [IWorkbenchService, { useClass: WorkbenchService }],
23560
24513
  [ILayoutService, { useClass: DesktopLayoutService }],
23561
24514
  [IRibbonService, { useClass: DesktopRibbonService }],
23562
24515
  [IRibbonOverrideService, { useClass: RibbonOverrideService }],
@@ -23610,6 +24563,7 @@ let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
23610
24563
  }],
23611
24564
  [SharedController],
23612
24565
  [ErrorController],
24566
+ [FeatureSearchController],
23613
24567
  [ShortcutPanelController]
23614
24568
  ], this._config.override));
23615
24569
  (0, _univerjs_core.touchDependencies)(this._injector, [
@@ -23619,7 +24573,7 @@ let UniverUIPlugin = class UniverUIPlugin extends _univerjs_core.Plugin {
23619
24573
  ]);
23620
24574
  }
23621
24575
  onReady() {
23622
- (0, _univerjs_core.touchDependencies)(this._injector, [[SharedController]]);
24576
+ (0, _univerjs_core.touchDependencies)(this._injector, [[SharedController], [FeatureSearchController]]);
23623
24577
  }
23624
24578
  onSteady() {
23625
24579
  (0, _univerjs_core.touchDependencies)(this._injector, [[ShortcutPanelController]]);
@@ -23785,8 +24739,10 @@ function handleStringToStyle($dom, cssStyle = "") {
23785
24739
  else styleList.bl = 0;
23786
24740
  else if (key === "font-style") if (value === "italic") styleList.it = 1;
23787
24741
  else styleList.it = 0;
23788
- else if (key === "font-family") styleList.ff = extractFontFamily(textTrim(originStr));
23789
- else if (key === "font-size") {
24742
+ else if (key === "font-family") {
24743
+ const fontFamily = extractFontFamily(textTrim(originStr));
24744
+ styleList.ff = fontFamily;
24745
+ } else if (key === "font-size") {
23790
24746
  let fs = Number.parseInt(value);
23791
24747
  if (cssText.indexOf("vertical-align") > -1 && (cssText.indexOf("sub") > -1 || cssText.indexOf("sup") > -1)) fs *= 2;
23792
24748
  if (value.indexOf("px") !== -1) fs = getPtFontSizeByPx(Number.parseInt(value, 10));
@@ -24528,6 +25484,7 @@ Object.defineProperty(exports, 'DesktopUIController', {
24528
25484
  return DesktopUIController;
24529
25485
  }
24530
25486
  });
25487
+ exports.EMBED_CHILD_UNIT_ID_ATTRIBUTE = EMBED_CHILD_UNIT_ID_ATTRIBUTE;
24531
25488
  exports.EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE;
24532
25489
  exports.EMOJI_CATEGORIES = EMOJI_CATEGORIES;
24533
25490
  exports.EMOJI_PICKER_COMPONENT = EMOJI_PICKER_COMPONENT;
@@ -24586,6 +25543,7 @@ exports.ISidebarService = ISidebarService;
24586
25543
  exports.IUIController = IUIController;
24587
25544
  exports.IUIPartsService = IUIPartsService;
24588
25545
  exports.IUIRuntimeScopeService = IUIRuntimeScopeService;
25546
+ exports.IWorkbenchService = IWorkbenchService;
24589
25547
  Object.defineProperty(exports, 'IconManager', {
24590
25548
  enumerable: true,
24591
25549
  get: function () {
@@ -24604,6 +25562,7 @@ Object.defineProperty(exports, 'MenuManagerService', {
24604
25562
  exports.MetaKeys = MetaKeys;
24605
25563
  exports.MobileContextMenu = MobileContextMenu;
24606
25564
  exports.MockMessageService = MockMessageService;
25565
+ exports.NativeTextEditorShortcutBehavior = NativeTextEditorShortcutBehavior;
24607
25566
  exports.PLAIN_TEXT_CLIPBOARD_MIME_TYPE = PLAIN_TEXT_CLIPBOARD_MIME_TYPE;
24608
25567
  exports.PasteCommand = PasteCommand;
24609
25568
  exports.PlatformService = PlatformService;
@@ -24638,6 +25597,8 @@ exports.RibbonOverrideService = RibbonOverrideService;
24638
25597
  exports.RibbonPosition = RibbonPosition;
24639
25598
  exports.RibbonStartGroup = RibbonStartGroup;
24640
25599
  exports.RibbonViewGroup = RibbonViewGroup;
25600
+ exports.SYMBOL_CATEGORIES = SYMBOL_CATEGORIES;
25601
+ exports.SYMBOL_PICKER_COMPONENT = SYMBOL_PICKER_COMPONENT;
24641
25602
  Object.defineProperty(exports, 'SharedController', {
24642
25603
  enumerable: true,
24643
25604
  get: function () {
@@ -24662,6 +25623,7 @@ exports.Sidebar = Sidebar;
24662
25623
  exports.SingleCanvasPopup = SingleCanvasPopup;
24663
25624
  exports.SingleUnitUIController = SingleUnitUIController;
24664
25625
  exports.Slider = Slider;
25626
+ exports.SymbolPicker = SymbolPicker;
24665
25627
  exports.ThemeSwitcherService = ThemeSwitcherService;
24666
25628
  exports.ToggleFullscreenOperation = ToggleFullscreenOperation;
24667
25629
  exports.ToggleShortcutPanelOperation = ToggleShortcutPanelOperation;
@@ -24691,6 +25653,7 @@ Object.defineProperty(exports, 'WithDependency', {
24691
25653
  return _wendellhu_redi_react_bindings.WithDependency;
24692
25654
  }
24693
25655
  });
25656
+ exports.WorkbenchService = WorkbenchService;
24694
25657
  exports.ZIndexManager = ZIndexManager;
24695
25658
  exports.ZoomInput = ZoomInput;
24696
25659
  Object.defineProperty(exports, 'connectDependencies', {
@@ -24708,6 +25671,7 @@ Object.defineProperty(exports, 'connectInjector', {
24708
25671
  exports.getAllEmojis = getAllEmojis;
24709
25672
  exports.getDefaultRecentEmojis = getDefaultRecentEmojis;
24710
25673
  exports.getEmbedBoundaryOwner = getEmbedBoundaryOwner;
25674
+ exports.getEmbedChildUnitId = getEmbedChildUnitId;
24711
25675
  exports.getEmojiLocaleData = getEmojiLocaleData;
24712
25676
  exports.getHeaderFooterMenuHiddenObservable = getHeaderFooterMenuHiddenObservable;
24713
25677
  exports.getLocalizedEmojiTitle = getLocalizedEmojiTitle;