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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { BaselineOffset, BorderStyleTypes, ColorKit, CommandType, DependentOn, Disposable, DocumentDataModel, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_FX_BAR_EDITOR, FOCUSING_UNIVER_EDITOR, ICommandService, IConfigService, IConfirmService, IContextService, ILocalStorageService, ILogService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LifecycleService, LifecycleStages, LifecycleUnreachableError, LocaleService, NAMED_STYLE_MAP, NamedStyleType, Optional, Plugin, RedoCommand, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommand, UniverInstanceType, Workbook, createIdentifier, dedupeBy, generateRandomId, getBorderStyleType, isInternalEditorID, isRealNum, merge, mergeOverrideWithDependencies, registerDependencies, remove, throttle, toDisposable, touchDependencies } from "@univerjs/core";
1
+ import { BaselineOffset, BorderStyleTypes, ColorKit, CommandType, DependentOn, Disposable, DocumentDataModel, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_FX_BAR_EDITOR, FOCUSING_UNIVER_EDITOR, ICommandService, IConfigService, IConfirmService, IContextService, ILocalStorageService, ILogService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LifecycleService, LifecycleStages, LifecycleUnreachableError, LocaleService, NAMED_STYLE_MAP, NamedStyleType, Optional, Plugin, Quantity, RedoCommand, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommand, UniverInstanceType, Workbook, createIdentifier, dedupeBy, generateRandomId, getBorderStyleType, isInternalEditorID, isRealNum, merge, mergeOverrideWithDependencies, registerDependencies, remove, throttle, toDisposable, touchDependencies } from "@univerjs/core";
2
2
  import { BehaviorSubject, EMPTY, Observable, Subject, animationFrameScheduler, combineLatest, debounceTime, distinctUntilChanged, filter, first, fromEvent, isObservable, map, merge as merge$1, of, scan, startWith, switchMap, throttleTime } from "rxjs";
3
3
  import { Fragment, cloneElement, createContext, createElement, forwardRef, memo, useCallback, useContext, useDeferredValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
4
- import { Button, ColorPicker, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, ConfigContext, ConfigProvider, Confirm, Dialog, Dropdown, DropdownMenu, Gallery, HoverCard, Input, InputNumber, KBD, MessageType, Messager, Popup, Toaster, Tooltip, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, isBrowser, message, removeMessage, render, resetButtonClassName, resizeObserverCtor, scrollbarClassName, toast, unmount } from "@univerjs/design";
4
+ import { Button, ColorPicker, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, ConfigContext, ConfigProvider, Confirm, Dialog, Dropdown, DropdownMenu, Gallery, HoverCard, Input, InputNumber, KBD, MessageType, Messager, Popup, Toaster, Tooltip, borderBottomClassName, borderClassName, borderLeftBottomClassName, borderRightClassName, borderTopClassName, clsx, cva, divideXClassName, divideYClassName, isBrowser, message, removeMessage, render, resetButtonClassName, scrollbarClassName, toast, unmount } from "@univerjs/design";
5
5
  import { IRenderManagerService, UniverRenderEnginePlugin, ptToPx } from "@univerjs/engine-render";
6
6
  import { distinctUntilChanged as distinctUntilChanged$1, map as map$1, scan as scan$1, startWith as startWith$1, switchMap as switchMap$1 } from "rxjs/operators";
7
- import { RediConsumer, RediContext, RediProvider, WithDependency, connectDependencies, connectInjector, useDependency, useDependency as useDependency$1, useInjector, useObservable, useUpdateBinder } from "@wendellhu/redi/react-bindings";
7
+ import { RediConsumer, RediContext, RediProvider, WithDependency, connectDependencies, connectInjector, useDependency, useInjector, useObservable, useUpdateBinder } from "@wendellhu/redi/react-bindings";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { createPortal } from "react-dom";
10
10
  import { ActivityIcon, CheckMarkIcon, CloseIcon, DatabaseIcon, ExpandIcon, EyeIcon, FeatureSearchIcon, FoodsIcon, FunctionIcon, HomeIcon, IncreaseIcon, InfoIcon, InsertIcon, KeyboardIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, MoreVerticalIcon, NatureIcon, ObjectsIcon, PeopleIcon, PlacesIcon, RandomIcon, RecentIcon, RedoIcon, ReduceIcon, SearchIcon, ShortcutIcon, ShrinkIcon, SymbolsIcon, UndoIcon } from "@univerjs/icons";
@@ -28,19 +28,17 @@ import { ActivityIcon, CheckMarkIcon, CloseIcon, DatabaseIcon, ExpandIcon, EyeIc
28
28
  const EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
29
29
  const EMBED_CHILD_UNIT_ID_ATTRIBUTE = "data-embed-child-unit-id";
30
30
  function getEmbedBoundaryOwner(target) {
31
- var _ref, _getAttributeValue;
32
31
  if (!hasClosest(target)) return;
33
32
  const ownerElement = target.closest(`[${EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}]`);
34
- return (_ref = (_getAttributeValue = getAttributeValue(target, "data-embed-interaction-boundary-owner")) !== null && _getAttributeValue !== void 0 ? _getAttributeValue : getAttributeValue(ownerElement, "data-embed-interaction-boundary-owner")) !== null && _ref !== void 0 ? _ref : void 0;
33
+ return getAttributeValue(target, "data-embed-interaction-boundary-owner") ?? getAttributeValue(ownerElement, "data-embed-interaction-boundary-owner") ?? void 0;
35
34
  }
36
35
  function isEmbedBoundaryTarget(target) {
37
36
  return hasClosest(target) && target.closest(`[${"data-embed-interaction-boundary-owner"}]`) != null;
38
37
  }
39
38
  function getEmbedChildUnitId(target) {
40
- var _ref2, _getAttributeValue2;
41
39
  if (!hasClosest(target)) return;
42
40
  const childRuntime = target.closest(`[${EMBED_CHILD_UNIT_ID_ATTRIBUTE}]`);
43
- 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;
41
+ return getAttributeValue(target, "data-embed-child-unit-id") ?? getAttributeValue(childRuntime, "data-embed-child-unit-id") ?? void 0;
44
42
  }
45
43
  function keepInteractionInsideSameEmbedBoundary(event) {
46
44
  const owner = getEmbedBoundaryOwner(event.currentTarget);
@@ -51,13 +49,12 @@ function hasClosest(target) {
51
49
  return !!target && typeof target.closest === "function";
52
50
  }
53
51
  function getAttributeValue(target, name) {
54
- var _getAttribute$call;
55
52
  const getAttribute = target === null || target === void 0 ? void 0 : target.getAttribute;
56
- return typeof getAttribute === "function" ? (_getAttribute$call = getAttribute.call(target, name)) !== null && _getAttribute$call !== void 0 ? _getAttribute$call : void 0 : void 0;
53
+ return typeof getAttribute === "function" ? getAttribute.call(target, name) ?? void 0 : void 0;
57
54
  }
58
55
 
59
56
  //#endregion
60
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
57
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
61
58
  function _typeof(o) {
62
59
  "@babel/helpers - typeof";
63
60
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -68,7 +65,7 @@ function _typeof(o) {
68
65
  }
69
66
 
70
67
  //#endregion
71
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
68
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
72
69
  function toPrimitive(t, r) {
73
70
  if ("object" != _typeof(t) || !t) return t;
74
71
  var e = t[Symbol.toPrimitive];
@@ -81,14 +78,14 @@ function toPrimitive(t, r) {
81
78
  }
82
79
 
83
80
  //#endregion
84
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
81
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
85
82
  function toPropertyKey(t) {
86
83
  var i = toPrimitive(t, "string");
87
84
  return "symbol" == _typeof(i) ? i : i + "";
88
85
  }
89
86
 
90
87
  //#endregion
91
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
88
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
92
89
  function _defineProperty(e, r, t) {
93
90
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
94
91
  value: t,
@@ -99,7 +96,7 @@ function _defineProperty(e, r, t) {
99
96
  }
100
97
 
101
98
  //#endregion
102
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
99
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
103
100
  function __decorateParam(paramIndex, decorator) {
104
101
  return function(target, key) {
105
102
  decorator(target, key, paramIndex);
@@ -107,7 +104,7 @@ function __decorateParam(paramIndex, decorator) {
107
104
  }
108
105
 
109
106
  //#endregion
110
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
107
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
111
108
  function __decorate(decorators, target, key, desc) {
112
109
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
113
110
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -859,6 +856,15 @@ var UIRuntimeScopeService = class extends Disposable {
859
856
  //#endregion
860
857
  //#region src/services/shortcut/shortcut.service.ts
861
858
  /**
859
+ * Defines whether a Univer shortcut should yield to the browser's native behavior
860
+ * when the keyboard event originates from an editable text element.
861
+ */
862
+ let NativeTextEditorShortcutBehavior = /* @__PURE__ */ function(NativeTextEditorShortcutBehavior) {
863
+ NativeTextEditorShortcutBehavior[NativeTextEditorShortcutBehavior["ALLOW_NATIVE"] = 0] = "ALLOW_NATIVE";
864
+ NativeTextEditorShortcutBehavior[NativeTextEditorShortcutBehavior["OVERRIDE_NATIVE"] = 1] = "OVERRIDE_NATIVE";
865
+ return NativeTextEditorShortcutBehavior;
866
+ }({});
867
+ /**
862
868
  * The dependency injection identifier of the {@link IShortcutService}.
863
869
  */
864
870
  const IShortcutService = createIdentifier("ui.shortcut.service");
@@ -911,14 +917,13 @@ let ShortcutService = class ShortcutService extends Disposable {
911
917
  return null;
912
918
  }
913
919
  getShortcutDisplay(shortcut) {
914
- var _KeyCodeToChar;
915
920
  const binding = this._getBindingFromItem(shortcut);
916
921
  if (!binding) return null;
917
922
  const ctrlKey = binding & 4096;
918
923
  const shiftKey = binding & 1024;
919
924
  const altKey = binding & 2048;
920
925
  const macCtrl = binding & 8192;
921
- const body = (_KeyCodeToChar = KeyCodeToChar[binding & 255]) !== null && _KeyCodeToChar !== void 0 ? _KeyCodeToChar : "<->";
926
+ const body = KeyCodeToChar[binding & 255] ?? "<->";
922
927
  if (this._platformService.isMac) return `${ctrlKey ? "⌘+" : ""}${shiftKey ? "⇧+" : ""}${altKey ? "⌥+" : ""}${macCtrl ? "⌃+" : ""}${body}`;
923
928
  return `${ctrlKey ? "Ctrl+" : ""}${shiftKey ? "Shift+" : ""}${altKey ? "Alt+" : ""}${body}`;
924
929
  }
@@ -938,28 +943,25 @@ let ShortcutService = class ShortcutService extends Disposable {
938
943
  _resolveKeyboardEvent(e) {
939
944
  const candidate = this.dispatch(e);
940
945
  if (candidate) {
941
- var _this$_getRuntimeServ, _this$_getRuntimeServ2;
942
- (_this$_getRuntimeServ = (_this$_getRuntimeServ2 = this._getRuntimeService(e, 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);
946
+ var _this$_getRuntimeServ;
947
+ ((_this$_getRuntimeServ = this._getRuntimeService(e, ICommandService)) === null || _this$_getRuntimeServ === void 0 ? void 0 : _this$_getRuntimeServ.executeCommand(candidate.id, candidate.staticParameters)) ?? this._commandService.executeCommand(candidate.id, candidate.staticParameters);
943
948
  e.preventDefault();
944
949
  }
945
950
  }
946
951
  dispatch(e) {
947
- var _this$_getRuntimeServ3;
948
952
  if (this._forceEscaped || this._forceDisabled) return;
949
953
  if (this._layoutService && !this._layoutService.checkElementInCurrentContainers(e.target)) return;
950
954
  const binding = this._deriveBindingFromEvent(e);
951
955
  if (binding === null) return;
952
- if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding)) return;
953
956
  const shortcuts = this._shortCutMapping.get(binding);
954
957
  if (shortcuts === void 0) return;
955
- const contextService = (_this$_getRuntimeServ3 = this._getRuntimeService(e, IContextService)) !== null && _this$_getRuntimeServ3 !== void 0 ? _this$_getRuntimeServ3 : this._contextService;
956
- return Array.from(shortcuts).sort((s1, s2) => {
957
- var _s2$priority, _s1$priority;
958
- 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);
959
- }).find((s) => {
960
- var _s$preconditions, _s$preconditions2;
961
- return (_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;
958
+ const contextService = this._getRuntimeService(e, IContextService) ?? this._contextService;
959
+ const candidateShortcut = Array.from(shortcuts).sort((s1, s2) => (s2.priority ?? 0) - (s1.priority ?? 0)).find((s) => {
960
+ var _s$eventPreconditions, _s$preconditions;
961
+ return (((_s$eventPreconditions = s.eventPreconditions) === null || _s$eventPreconditions === void 0 ? void 0 : _s$eventPreconditions.call(s, e)) ?? true) && (((_s$preconditions = s.preconditions) === null || _s$preconditions === void 0 ? void 0 : _s$preconditions.call(s, contextService)) ?? true);
962
962
  });
963
+ if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding) && (candidateShortcut === null || candidateShortcut === void 0 ? void 0 : candidateShortcut.nativeTextEditorBehavior) !== 1) return;
964
+ return candidateShortcut;
963
965
  }
964
966
  _getBindingFromItem(item) {
965
967
  if (this._platformService.isMac && item.mac) return item.mac;
@@ -1298,7 +1300,7 @@ let MenuManagerService = _MenuManagerService = class MenuManagerService extends
1298
1300
  * @param target default is root menu
1299
1301
  */
1300
1302
  mergeMenu(source, target) {
1301
- const _target = target !== null && target !== void 0 ? target : this._menu;
1303
+ const _target = target ?? this._menu;
1302
1304
  for (const [key, value] of Object.entries(_target)) if (key in source) {
1303
1305
  const targetRecord = _target;
1304
1306
  const sourceRecord = source;
@@ -1365,7 +1367,6 @@ let MenuManagerService = _MenuManagerService = class MenuManagerService extends
1365
1367
  * @returns Menu schema array or empty array if not found
1366
1368
  */
1367
1369
  getMenuByPositionKey(key) {
1368
- var _findKey;
1369
1370
  const findKey = (obj) => {
1370
1371
  if (key in obj) return this._buildMenuSchema(obj[key]);
1371
1372
  for (const k in obj) {
@@ -1376,7 +1377,7 @@ let MenuManagerService = _MenuManagerService = class MenuManagerService extends
1376
1377
  }
1377
1378
  }
1378
1379
  };
1379
- return (_findKey = findKey(this._menu)) !== null && _findKey !== void 0 ? _findKey : [];
1380
+ return findKey(this._menu) ?? [];
1380
1381
  }
1381
1382
  /**
1382
1383
  * Get flat menu schema by position key
@@ -1400,7 +1401,7 @@ let MenuManagerService = _MenuManagerService = class MenuManagerService extends
1400
1401
  };
1401
1402
  MenuManagerService = _MenuManagerService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IConfigService)], MenuManagerService);
1402
1403
  function normalizeMenuOrder(order) {
1403
- return order !== null && order !== void 0 ? order : 0;
1404
+ return order ?? 0;
1404
1405
  }
1405
1406
  function isMenuSchemaRecord(value) {
1406
1407
  return value != null && typeof value === "object" && !Array.isArray(value);
@@ -1598,8 +1599,7 @@ let DesktopRibbonService = class DesktopRibbonService extends Disposable {
1598
1599
  const activatedTab = this._activatedTab$.getValue();
1599
1600
  const activeGroup = ribbon.find((group) => group.key === activatedTab);
1600
1601
  if (!activeGroup && this._contextualTabs.has(activatedTab)) {
1601
- var _ref, _ribbon$find;
1602
- 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];
1602
+ const fallbackTab = ribbon.find((group) => group.key === this._lastNonContextualActivatedTab && !group.contextual) ?? ribbon.find((group) => group.key === "ribbon.start") ?? ribbon[0];
1603
1603
  if (fallbackTab) this._activatedTab$.next(fallbackTab.key);
1604
1604
  } else if (!activeGroup && ribbon.some((group) => group.key === "ribbon.start")) {
1605
1605
  const fallbackTab = ribbon.find((group) => group.key === "ribbon.start");
@@ -1649,12 +1649,10 @@ function useObservableRef(observable, defaultValue) {
1649
1649
  const FEATURE_SEARCH_COMPONENT = "FeatureSearch";
1650
1650
  const FEATURE_SEARCH_DIALOG_ID = "FEATURE_SEARCH_DIALOG";
1651
1651
  function resolveParams(item, value) {
1652
- const params = typeof item.params === "function" ? item.params() : item.params;
1653
- return params !== null && params !== void 0 ? params : value === void 0 ? void 0 : { value };
1652
+ return (typeof item.params === "function" ? item.params() : item.params) ?? (value === void 0 ? void 0 : { value });
1654
1653
  }
1655
1654
  function resolveOptionParams(option) {
1656
- const params = typeof option.params === "function" ? option.params(option.value) : option.params;
1657
- return params !== null && params !== void 0 ? params : option.value === void 0 ? void 0 : { value: option.value };
1655
+ return (typeof option.params === "function" ? option.params(option.value) : option.params) ?? (option.value === void 0 ? void 0 : { value: option.value });
1658
1656
  }
1659
1657
  function deduplicate(items) {
1660
1658
  return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && Tools.diffValue(candidate.params, item.params)) === index);
@@ -1668,14 +1666,12 @@ function FeatureSearch() {
1668
1666
  const ribbonService = useDependency(IRibbonService);
1669
1667
  const items = useObservable(useMemo(() => {
1670
1668
  function getItemTitle(item) {
1671
- var _ref, _item$title;
1672
- const titleKey = (_ref = (_item$title = item.title) !== null && _item$title !== void 0 ? _item$title : item.tooltip) !== null && _ref !== void 0 ? _ref : item.description;
1669
+ const titleKey = item.title ?? item.tooltip ?? item.description;
1673
1670
  return titleKey ? localeService.t(titleKey) : "";
1674
1671
  }
1675
1672
  function collectCandidates(schemas, path, keyPath, ancestors = [], parentTitle) {
1676
1673
  return schemas.flatMap((schema, index) => {
1677
- var _schema$title;
1678
- const schemaTitle = localeService.t((_schema$title = schema.title) !== null && _schema$title !== void 0 ? _schema$title : "");
1674
+ const schemaTitle = localeService.t(schema.title ?? "");
1679
1675
  const schemaPath = schemaTitle ? [...path, schemaTitle] : path;
1680
1676
  const schemaKeyPath = [...keyPath, `${schema.key}:${index}`];
1681
1677
  const result = [];
@@ -1698,48 +1694,44 @@ function FeatureSearch() {
1698
1694
  });
1699
1695
  }
1700
1696
  function observeCandidate(candidate) {
1701
- var _item$hidden$$pipe, _item$hidden$, _item$disabled$$pipe, _item$disabled$, _item$value$$pipe, _item$value$;
1697
+ var _item$hidden$, _item$disabled$, _item$value$;
1702
1698
  const { item } = candidate;
1703
1699
  const hasOptions = item.type === 1 || item.type === 2;
1704
1700
  const selections = hasOptions ? item.selections : void 0;
1705
- const selections$ = isObservable(selections) ? selections.pipe(startWith$1([])) : of(selections !== null && selections !== void 0 ? selections : []);
1701
+ const selections$ = isObservable(selections) ? selections.pipe(startWith$1([])) : of(selections ?? []);
1706
1702
  return combineLatest([
1707
1703
  candidate.ancestors.length ? combineLatest(candidate.ancestors.map((ancestor) => {
1708
- var _ancestor$hidden$$pip, _ancestor$hidden$;
1709
- return (_ancestor$hidden$$pip = (_ancestor$hidden$ = ancestor.hidden$) === null || _ancestor$hidden$ === void 0 ? void 0 : _ancestor$hidden$.pipe(startWith$1(true))) !== null && _ancestor$hidden$$pip !== void 0 ? _ancestor$hidden$$pip : of(false);
1704
+ var _ancestor$hidden$;
1705
+ return ((_ancestor$hidden$ = ancestor.hidden$) === null || _ancestor$hidden$ === void 0 ? void 0 : _ancestor$hidden$.pipe(startWith$1(true))) ?? of(false);
1710
1706
  })).pipe(map$1((states) => states.some(Boolean))) : of(false),
1711
1707
  candidate.ancestors.length ? combineLatest(candidate.ancestors.map((ancestor) => {
1712
- var _ancestor$disabled$$p, _ancestor$disabled$;
1713
- return (_ancestor$disabled$$p = (_ancestor$disabled$ = ancestor.disabled$) === null || _ancestor$disabled$ === void 0 ? void 0 : _ancestor$disabled$.pipe(startWith$1(true))) !== null && _ancestor$disabled$$p !== void 0 ? _ancestor$disabled$$p : of(false);
1708
+ var _ancestor$disabled$;
1709
+ return ((_ancestor$disabled$ = ancestor.disabled$) === null || _ancestor$disabled$ === void 0 ? void 0 : _ancestor$disabled$.pipe(startWith$1(true))) ?? of(false);
1714
1710
  })).pipe(map$1((states) => states.some(Boolean))) : of(false),
1715
- (_item$hidden$$pipe = (_item$hidden$ = item.hidden$) === null || _item$hidden$ === void 0 ? void 0 : _item$hidden$.pipe(startWith$1(true))) !== null && _item$hidden$$pipe !== void 0 ? _item$hidden$$pipe : of(false),
1716
- (_item$disabled$$pipe = (_item$disabled$ = item.disabled$) === null || _item$disabled$ === void 0 ? void 0 : _item$disabled$.pipe(startWith$1(true))) !== null && _item$disabled$$pipe !== void 0 ? _item$disabled$$pipe : of(false),
1717
- (_item$value$$pipe = (_item$value$ = item.value$) === null || _item$value$ === void 0 ? void 0 : _item$value$.pipe(startWith$1(void 0))) !== null && _item$value$$pipe !== void 0 ? _item$value$$pipe : of(void 0),
1711
+ ((_item$hidden$ = item.hidden$) === null || _item$hidden$ === void 0 ? void 0 : _item$hidden$.pipe(startWith$1(true))) ?? of(false),
1712
+ ((_item$disabled$ = item.disabled$) === null || _item$disabled$ === void 0 ? void 0 : _item$disabled$.pipe(startWith$1(true))) ?? of(false),
1713
+ ((_item$value$ = item.value$) === null || _item$value$ === void 0 ? void 0 : _item$value$.pipe(startWith$1(void 0))) ?? of(void 0),
1718
1714
  selections$
1719
1715
  ]).pipe(map$1(([ancestorHidden, ancestorDisabled, hidden, disabled, value, options]) => {
1720
1716
  if (ancestorHidden || ancestorDisabled || hidden || disabled) return [];
1721
1717
  const title = getItemTitle(item);
1722
1718
  const path = candidate.path.join(" / ");
1723
1719
  const result = [];
1724
- if (title && item.type !== 1 && item.type !== 3) {
1725
- var _item$description, _item$commandId;
1726
- result.push({
1727
- key: candidate.key,
1728
- title,
1729
- parentTitle: candidate.parentTitle,
1730
- description: localeService.t((_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : ""),
1731
- path,
1732
- commandId: (_item$commandId = item.commandId) !== null && _item$commandId !== void 0 ? _item$commandId : item.id,
1733
- params: resolveParams(item, value),
1734
- getParams: () => resolveParams(item, value)
1735
- });
1736
- }
1720
+ if (title && item.type !== 1 && item.type !== 3) result.push({
1721
+ key: candidate.key,
1722
+ title,
1723
+ parentTitle: candidate.parentTitle,
1724
+ description: localeService.t(item.description ?? ""),
1725
+ path,
1726
+ commandId: item.commandId ?? item.id,
1727
+ params: resolveParams(item, value),
1728
+ getParams: () => resolveParams(item, value)
1729
+ });
1737
1730
  if (hasOptions) options.forEach((option, index) => {
1738
- var _ref2, _ref3, _ref4, _option$commandId, _ref5, _ref6, _option$id;
1739
1731
  if (option.disabled || typeof option.label !== "string") return;
1740
- 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;
1732
+ const commandId = option.commandId ?? option.id ?? item.selectionsCommandId ?? item.commandId ?? item.id;
1741
1733
  result.push({
1742
- 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}`,
1734
+ key: `${candidate.key}:option:${option.id ?? option.commandId ?? option.value ?? index}`,
1743
1735
  title: localeService.t(option.label),
1744
1736
  parentTitle: title,
1745
1737
  description: "",
@@ -1772,35 +1764,32 @@ function FeatureSearch() {
1772
1764
  children: [/* @__PURE__ */ jsx(CommandInput, {
1773
1765
  autoFocus: true,
1774
1766
  placeholder: localeService.t("ui.featureSearch.placeholder")
1775
- }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: localeService.t("ui.featureSearch.empty") }), /* @__PURE__ */ jsx(CommandGroup, { children: items.map((item) => {
1776
- var _item$parentTitle;
1777
- return /* @__PURE__ */ jsxs(CommandItem, {
1778
- value: item.key,
1779
- keywords: [
1780
- (_item$parentTitle = item.parentTitle) !== null && _item$parentTitle !== void 0 ? _item$parentTitle : "",
1781
- item.title,
1782
- item.description,
1783
- item.path
1784
- ],
1785
- onSelect: () => execute(item),
1786
- children: [/* @__PURE__ */ jsxs("span", {
1787
- className: "univer-flex univer-min-w-0 univer-flex-1 univer-items-center univer-gap-1",
1788
- children: [item.parentTitle && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1789
- className: "univer-shrink-0",
1790
- children: item.parentTitle
1791
- }), /* @__PURE__ */ jsx("span", {
1792
- className: "univer-text-gray-400",
1793
- children: "/"
1794
- })] }), /* @__PURE__ */ jsx("span", {
1795
- className: "univer-truncate",
1796
- children: item.title
1797
- })]
1798
- }), item.path && /* @__PURE__ */ jsx("span", {
1799
- className: "univer-max-w-1/2 univer-truncate univer-text-xs univer-text-gray-400",
1800
- children: item.path
1767
+ }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: localeService.t("ui.featureSearch.empty") }), /* @__PURE__ */ jsx(CommandGroup, { children: items.map((item) => /* @__PURE__ */ jsxs(CommandItem, {
1768
+ value: item.key,
1769
+ keywords: [
1770
+ item.parentTitle ?? "",
1771
+ item.title,
1772
+ item.description,
1773
+ item.path
1774
+ ],
1775
+ onSelect: () => execute(item),
1776
+ children: [/* @__PURE__ */ jsxs("span", {
1777
+ className: "univer-flex univer-min-w-0 univer-flex-1 univer-items-center univer-gap-1",
1778
+ children: [item.parentTitle && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1779
+ className: "univer-shrink-0",
1780
+ children: item.parentTitle
1781
+ }), /* @__PURE__ */ jsx("span", {
1782
+ className: "univer-text-gray-400",
1783
+ children: "/"
1784
+ })] }), /* @__PURE__ */ jsx("span", {
1785
+ className: "univer-truncate",
1786
+ children: item.title
1801
1787
  })]
1802
- }, item.key);
1803
- }) })] })]
1788
+ }), item.path && /* @__PURE__ */ jsx("span", {
1789
+ className: "univer-max-w-1/2 univer-truncate univer-text-xs univer-text-gray-400",
1790
+ children: item.path
1791
+ })]
1792
+ }, item.key)) })] })]
1804
1793
  });
1805
1794
  }
1806
1795
 
@@ -1938,6 +1927,7 @@ var UIPartsService = class extends Disposable {
1938
1927
  constructor(..._args) {
1939
1928
  super(..._args);
1940
1929
  _defineProperty(this, "_componentsByPart", /* @__PURE__ */ new Map());
1930
+ _defineProperty(this, "_disabledUIParts", /* @__PURE__ */ new Map());
1941
1931
  _defineProperty(this, "_componentRegistered$", new Subject());
1942
1932
  _defineProperty(this, "componentRegistered$", this._componentRegistered$.asObservable());
1943
1933
  _defineProperty(this, "_uiVisible", /* @__PURE__ */ new Map());
@@ -1947,20 +1937,54 @@ var UIPartsService = class extends Disposable {
1947
1937
  dispose() {
1948
1938
  super.dispose();
1949
1939
  this._componentsByPart.clear();
1940
+ this._disabledUIParts.clear();
1950
1941
  this._uiVisible.clear();
1951
1942
  this._componentRegistered$.complete();
1952
1943
  this._uiVisibleChange$.complete();
1953
1944
  }
1954
1945
  setUIVisible(part, visible) {
1946
+ const wasVisible = this.isUIVisible(part);
1955
1947
  this._uiVisible.set(part, visible);
1956
- this._uiVisibleChange$.next({
1948
+ const isVisible = this.isUIVisible(part);
1949
+ if (wasVisible !== isVisible) this._uiVisibleChange$.next({
1957
1950
  ui: part,
1958
- visible
1951
+ visible: isVisible
1959
1952
  });
1960
1953
  }
1961
1954
  isUIVisible(part) {
1962
- var _this$_uiVisible$get;
1963
- return (_this$_uiVisible$get = this._uiVisible.get(part)) !== null && _this$_uiVisible$get !== void 0 ? _this$_uiVisible$get : true;
1955
+ var _this$_disabledUIPart;
1956
+ return (this._uiVisible.get(part) ?? true) && !((_this$_disabledUIPart = this._disabledUIParts.get(part)) === null || _this$_disabledUIPart === void 0 ? void 0 : _this$_disabledUIPart.size);
1957
+ }
1958
+ registerDisabledUIParts(parts, disabled$) {
1959
+ const uniqueParts = [...new Set(parts)];
1960
+ const registration = Symbol("disabled-ui-parts");
1961
+ let disabled = false;
1962
+ const update = (nextDisabled) => {
1963
+ if (disabled === nextDisabled) return;
1964
+ disabled = nextDisabled;
1965
+ uniqueParts.forEach((part) => {
1966
+ const wasVisible = this.isUIVisible(part);
1967
+ const registrations = this._disabledUIParts.get(part) ?? /* @__PURE__ */ new Set();
1968
+ if (disabled) {
1969
+ registrations.add(registration);
1970
+ this._disabledUIParts.set(part, registrations);
1971
+ } else {
1972
+ registrations.delete(registration);
1973
+ if (registrations.size === 0) this._disabledUIParts.delete(part);
1974
+ }
1975
+ const isVisible = this.isUIVisible(part);
1976
+ if (wasVisible !== isVisible) this._uiVisibleChange$.next({
1977
+ ui: part,
1978
+ visible: isVisible
1979
+ });
1980
+ });
1981
+ };
1982
+ const subscription = disabled$.subscribe(update);
1983
+ const disposable = toDisposable(() => {
1984
+ subscription.unsubscribe();
1985
+ update(false);
1986
+ });
1987
+ return this.disposeWithMe(disposable);
1964
1988
  }
1965
1989
  registerComponent(part, componentFactory) {
1966
1990
  const componentType = componentFactory();
@@ -1989,6 +2013,7 @@ var CanvasFloatDomService = class extends Disposable {
1989
2013
  constructor(..._args) {
1990
2014
  super(..._args);
1991
2015
  _defineProperty(this, "_domLayerMap", /* @__PURE__ */ new Map());
2016
+ _defineProperty(this, "_scopedRenderRootCount", /* @__PURE__ */ new Map());
1992
2017
  _defineProperty(this, "_domLayers$", new BehaviorSubject([]));
1993
2018
  _defineProperty(this, "domLayers$", this._domLayers$.asObservable());
1994
2019
  }
@@ -2011,6 +2036,20 @@ var CanvasFloatDomService = class extends Disposable {
2011
2036
  this._domLayerMap.set(item.id, item);
2012
2037
  this._notice();
2013
2038
  }
2039
+ hasScopedRenderRoot(unitId) {
2040
+ return this._scopedRenderRootCount.has(unitId);
2041
+ }
2042
+ registerScopedRenderRoot(unitId) {
2043
+ this._scopedRenderRootCount.set(unitId, (this._scopedRenderRootCount.get(unitId) ?? 0) + 1);
2044
+ this._notice();
2045
+ return toDisposable(() => {
2046
+ const count = this._scopedRenderRootCount.get(unitId);
2047
+ if (count == null) return;
2048
+ if (count === 1) this._scopedRenderRootCount.delete(unitId);
2049
+ else this._scopedRenderRootCount.set(unitId, count - 1);
2050
+ this._notice();
2051
+ });
2052
+ }
2014
2053
  removeFloatDom(id) {
2015
2054
  if (this._domLayerMap.delete(id)) this._notice();
2016
2055
  }
@@ -2020,6 +2059,7 @@ var CanvasFloatDomService = class extends Disposable {
2020
2059
  }
2021
2060
  dispose() {
2022
2061
  this._domLayerMap.clear();
2062
+ this._scopedRenderRootCount.clear();
2023
2063
  this._domLayers$.next([]);
2024
2064
  this._domLayers$.complete();
2025
2065
  super.dispose();
@@ -2066,9 +2106,8 @@ var CanvasFloatDomPreviewService = class extends Disposable {
2066
2106
  const LEGACY_WRAPPER_INSET = 2;
2067
2107
  const LEGACY_CONTENT_INSET = 4;
2068
2108
  function resolveFloatDomLayout(position, contentBox) {
2069
- var _contentBox$wrapperIn, _contentBox$contentIn, _position$opacity;
2070
- const wrapperInset = (_contentBox$wrapperIn = contentBox === null || contentBox === void 0 ? void 0 : contentBox.wrapperInset) !== null && _contentBox$wrapperIn !== void 0 ? _contentBox$wrapperIn : LEGACY_WRAPPER_INSET;
2071
- const contentInset = (_contentBox$contentIn = contentBox === null || contentBox === void 0 ? void 0 : contentBox.contentInset) !== null && _contentBox$contentIn !== void 0 ? _contentBox$contentIn : LEGACY_CONTENT_INSET;
2109
+ const wrapperInset = (contentBox === null || contentBox === void 0 ? void 0 : contentBox.wrapperInset) ?? LEGACY_WRAPPER_INSET;
2110
+ const contentInset = (contentBox === null || contentBox === void 0 ? void 0 : contentBox.contentInset) ?? LEGACY_CONTENT_INSET;
2072
2111
  return {
2073
2112
  wrapper: {
2074
2113
  top: position.startY,
@@ -2076,7 +2115,7 @@ function resolveFloatDomLayout(position, contentBox) {
2076
2115
  width: Math.max(position.endX - position.startX - wrapperInset, 0),
2077
2116
  height: Math.max(position.endY - position.startY - wrapperInset, 0),
2078
2117
  transform: `rotate(${position.rotate}deg)`,
2079
- opacity: (_position$opacity = position.opacity) !== null && _position$opacity !== void 0 ? _position$opacity : 1
2118
+ opacity: position.opacity ?? 1
2080
2119
  },
2081
2120
  inner: {
2082
2121
  width: position.width - contentInset,
@@ -2205,17 +2244,20 @@ function FloatDomSingleContent(props) {
2205
2244
  });
2206
2245
  }
2207
2246
  const FloatDom = ({ unitId }) => {
2208
- var _layers$filter;
2209
2247
  const instanceService = useDependency(IUniverInstanceService);
2210
- const layers = useObservable(useDependency(CanvasFloatDomService).domLayers$);
2248
+ const domLayerService = useDependency(CanvasFloatDomService);
2249
+ const layers = useObservable(domLayerService.domLayers$);
2211
2250
  const currentUnitId = resolveFloatDomCurrentUnitId(unitId, useObservable(instanceService.focused$));
2212
- return layers === null || layers === void 0 || (_layers$filter = layers.filter((layer) => shouldRenderFloatDomLayer(layer[1], currentUnitId))) === null || _layers$filter === void 0 ? void 0 : _layers$filter.map((layer) => {
2213
- var _layer$1$domId;
2214
- return /* @__PURE__ */ jsx(FloatDomSingle, {
2215
- id: (_layer$1$domId = layer[1].domId) !== null && _layer$1$domId !== void 0 ? _layer$1$domId : layer[0],
2216
- layer: layer[1]
2217
- }, layer[0]);
2218
- });
2251
+ useEffect(() => {
2252
+ if (typeof unitId !== "string") return;
2253
+ const disposable = domLayerService.registerScopedRenderRoot(unitId);
2254
+ return () => disposable.dispose();
2255
+ }, [domLayerService, unitId]);
2256
+ const visibleLayers = typeof unitId === "string" ? layers === null || layers === void 0 ? void 0 : layers.filter((layer) => layer[1].unitId === unitId) : layers === null || layers === void 0 ? void 0 : layers.filter((layer) => !domLayerService.hasScopedRenderRoot(layer[1].unitId) && shouldRenderFloatDomLayer(layer[1], currentUnitId));
2257
+ return visibleLayers === null || visibleLayers === void 0 ? void 0 : visibleLayers.map((layer) => /* @__PURE__ */ jsx(FloatDomSingle, {
2258
+ id: layer[1].domId ?? layer[0],
2259
+ layer: layer[1]
2260
+ }, layer[0]));
2219
2261
  };
2220
2262
  function resolveFloatDomCurrentUnitId(unitId, focusedUnit) {
2221
2263
  if (typeof unitId === "string") return unitId;
@@ -2227,9 +2269,8 @@ function resolveFloatDomCurrentUnitId(unitId, focusedUnit) {
2227
2269
  return null;
2228
2270
  }
2229
2271
  function resolveFloatDomOverflow(props) {
2230
- var _viewport$bleedWidth;
2231
2272
  const viewport = props.customBlockRenderViewport;
2232
- if (!(Number.isFinite(viewport === null || viewport === void 0 ? void 0 : viewport.bleedWidth) && ((_viewport$bleedWidth = viewport === null || viewport === void 0 ? void 0 : viewport.bleedWidth) !== null && _viewport$bleedWidth !== void 0 ? _viewport$bleedWidth : 0) > 0)) return {
2273
+ if (!(Number.isFinite(viewport === null || viewport === void 0 ? void 0 : viewport.bleedWidth) && ((viewport === null || viewport === void 0 ? void 0 : viewport.bleedWidth) ?? 0) > 0)) return {
2233
2274
  outerOverflow: "hidden",
2234
2275
  innerOverflow: "hidden"
2235
2276
  };
@@ -2353,11 +2394,10 @@ function calcPopupPosition(layout) {
2353
2394
  };
2354
2395
  }
2355
2396
  function RectPopup(props) {
2356
- var _uiConfig$popupRootId;
2357
2397
  const { mask, portal, children, anchorRect$, direction = "vertical", onClickOutside, excludeOutside, excludeRects, onPointerEnter, onPointerLeave, onClick, hidden, onContextMenu, zIndex = 1020, maskZIndex = 100, onMaskClick, noPushMinimumGap, autoRelayout = true } = props;
2358
2398
  const nodeRef = useRef(null);
2359
- const clickOtherFn = useEvent(onClickOutside !== null && onClickOutside !== void 0 ? onClickOutside : (() => {}));
2360
- const contextMenuFn = useEvent(onContextMenu !== null && onContextMenu !== void 0 ? onContextMenu : (() => {}));
2399
+ const clickOtherFn = useEvent(onClickOutside ?? (() => {}));
2400
+ const contextMenuFn = useEvent(onContextMenu ?? (() => {}));
2361
2401
  const positionRef = useRef({
2362
2402
  top: -9999,
2363
2403
  left: -9999
@@ -2366,7 +2406,7 @@ function RectPopup(props) {
2366
2406
  const configService = useDependency(IConfigService);
2367
2407
  const anchorRectRef = useRef(void 0);
2368
2408
  const uiConfig = configService.getConfig(UI_PLUGIN_CONFIG_KEY);
2369
- const popupRootId = (_uiConfig$popupRootId = uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) !== null && _uiConfig$popupRootId !== void 0 ? _uiConfig$popupRootId : "univer-popup-portal";
2409
+ const popupRootId = (uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) ?? "univer-popup-portal";
2370
2410
  const updatePosition = useEvent((position) => {
2371
2411
  requestAnimationFrame(() => {
2372
2412
  if (!nodeRef.current) return;
@@ -2409,11 +2449,10 @@ function RectPopup(props) {
2409
2449
  }, [anchorRect$, direction]);
2410
2450
  useEffect(() => {
2411
2451
  const handleClickOther = (e) => {
2412
- var _excludeRectsRef$curr;
2413
2452
  if (excludeOutside && (excludeOutside.indexOf(e.target) > -1 || excludeOutside.some((item) => item.contains(e.target)))) return;
2414
2453
  const x = e.clientX;
2415
2454
  const y = e.clientY;
2416
- const rects = [...(_excludeRectsRef$curr = excludeRectsRef === null || excludeRectsRef === void 0 ? void 0 : excludeRectsRef.current) !== null && _excludeRectsRef$curr !== void 0 ? _excludeRectsRef$curr : []];
2455
+ const rects = [...(excludeRectsRef === null || excludeRectsRef === void 0 ? void 0 : excludeRectsRef.current) ?? []];
2417
2456
  if (anchorRectRef.current) rects.push(anchorRectRef.current);
2418
2457
  for (const rect of rects) if (x <= rect.right && x >= rect.left && y <= rect.bottom && y >= rect.top) return;
2419
2458
  clickOtherFn(e);
@@ -2473,9 +2512,8 @@ RectPopup.useContext = () => useContext(RectPopupContext);
2473
2512
  //#region src/views/components/popup/CanvasPopup.tsx
2474
2513
  const SingleCanvasPopup = ({ popup, children }) => {
2475
2514
  const anchorRect$ = useMemo(() => popup.anchorRect$.pipe(throttleTime(0, animationFrameScheduler), map((anchorRect) => {
2476
- var _popup$offset;
2477
2515
  const { bottom, left, right, top } = anchorRect;
2478
- const [x = 0, y = 0] = (_popup$offset = popup.offset) !== null && _popup$offset !== void 0 ? _popup$offset : [];
2516
+ const [x = 0, y = 0] = popup.offset ?? [];
2479
2517
  return {
2480
2518
  left: left - x,
2481
2519
  right: right + x,
@@ -2484,8 +2522,8 @@ const SingleCanvasPopup = ({ popup, children }) => {
2484
2522
  };
2485
2523
  })), [popup.anchorRect$, popup.offset]);
2486
2524
  const hiddenRects$ = useMemo(() => {
2487
- var _popup$hiddenRects$$p, _popup$hiddenRects$;
2488
- return (_popup$hiddenRects$$p = (_popup$hiddenRects$ = popup.hiddenRects$) === null || _popup$hiddenRects$ === void 0 ? void 0 : _popup$hiddenRects$.pipe(throttleTime(0, animationFrameScheduler))) !== null && _popup$hiddenRects$$p !== void 0 ? _popup$hiddenRects$$p : of([]);
2525
+ var _popup$hiddenRects$;
2526
+ return ((_popup$hiddenRects$ = popup.hiddenRects$) === null || _popup$hiddenRects$ === void 0 ? void 0 : _popup$hiddenRects$.pipe(throttleTime(0, animationFrameScheduler))) ?? of([]);
2489
2527
  }, [popup.hiddenRects$]);
2490
2528
  const excludeRectsRef = useObservableRef(useMemo(() => {
2491
2529
  var _popup$excludeRects$;
@@ -2577,11 +2615,10 @@ var RibbonOverrideService = class extends Disposable {
2577
2615
  //#region src/views/components/ComponentContainer.tsx
2578
2616
  function ComponentContainer(props) {
2579
2617
  const { components, fallback, sharedProps } = props;
2580
- if (!components || components.size === 0) return fallback !== null && fallback !== void 0 ? fallback : null;
2618
+ if (!components || components.size === 0) return fallback ?? null;
2581
2619
  return Array.from(components.values()).map((component, index) => {
2582
- var _component$displayNam;
2583
2620
  return createElement(component, {
2584
- key: `${(_component$displayNam = component.displayName) !== null && _component$displayNam !== void 0 ? _component$displayNam : index}`,
2621
+ key: `${component.displayName ?? index}`,
2585
2622
  ...sharedProps
2586
2623
  });
2587
2624
  });
@@ -2594,9 +2631,8 @@ function ComponentContainer(props) {
2594
2631
  * component.
2595
2632
  */
2596
2633
  function useComponentsOfPart(part, injector) {
2597
- var _injector$get;
2598
2634
  const injectedUIPartsService = useDependency(IUIPartsService);
2599
- const uiPartsService = (_injector$get = injector === null || injector === void 0 ? void 0 : injector.get(IUIPartsService)) !== null && _injector$get !== void 0 ? _injector$get : injectedUIPartsService;
2635
+ const uiPartsService = (injector === null || injector === void 0 ? void 0 : injector.get(IUIPartsService)) ?? injectedUIPartsService;
2600
2636
  const changeInfo = useObservable(useMemo(() => uiPartsService.uiVisibleChange$.pipe(filter((ui) => ui.ui === part)), [part, uiPartsService]));
2601
2637
  const updateCounterRef = useRef(0);
2602
2638
  return useMemo(() => uiPartsService.isUIVisible(part) ? uiPartsService.getComponents(part) : /* @__PURE__ */ new Set(), [useObservable(() => uiPartsService.componentRegistered$.pipe(filter((key) => key === part), debounceTime(200), map(() => updateCounterRef.current += 1), startWith(updateCounterRef.current += 1)), void 0, void 0, [
@@ -2654,8 +2690,7 @@ function DefaultMenu({ ribbon, activatedTab, onSelectTab }) {
2654
2690
  overlay: /* @__PURE__ */ jsx("div", {
2655
2691
  className: "univer-grid univer-gap-1 univer-px-2 univer-py-1",
2656
2692
  children: ribbon.map((group) => {
2657
- var _iconMap;
2658
- const Icon = (_iconMap = iconMap[group.key]) !== null && _iconMap !== void 0 ? _iconMap : MoreVerticalIcon;
2693
+ const Icon = iconMap[group.key] ?? MoreVerticalIcon;
2659
2694
  return /* @__PURE__ */ jsxs("a", {
2660
2695
  "data-u-comp": "ribbon-group-btn",
2661
2696
  className: "univer-box-border univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-lg univer-px-2 univer-py-1.5 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
@@ -2718,53 +2753,70 @@ function placeRibbonGridItems(items) {
2718
2753
  const occupied = /* @__PURE__ */ new Set();
2719
2754
  const placements = /* @__PURE__ */ new Map();
2720
2755
  const fallbackItems = [];
2721
- let maxExplicitColumn = 0;
2722
2756
  for (const item of items) {
2723
- var _layout$rowSpan, _layout$columnSpan, _layout$showLabel;
2724
2757
  const layout = item.gridLayout;
2725
2758
  if (!layout) {
2726
- fallbackItems.push(item);
2759
+ fallbackItems.push({ item });
2727
2760
  continue;
2728
2761
  }
2729
- const rowSpan = (_layout$rowSpan = layout.rowSpan) !== null && _layout$rowSpan !== void 0 ? _layout$rowSpan : 1;
2730
- const columnSpan = (_layout$columnSpan = layout.columnSpan) !== null && _layout$columnSpan !== void 0 ? _layout$columnSpan : 1;
2762
+ const rowSpan = layout.rowSpan ?? 1;
2763
+ const columnSpan = layout.columnSpan ?? 1;
2731
2764
  const cells = getCells(layout.row, layout.column, rowSpan, columnSpan);
2732
- if (!(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) && cells.every((cell) => !occupied.has(cell)))) {
2733
- fallbackItems.push(item);
2765
+ if (!isValidGridGeometry(layout, rowSpan, cells)) {
2766
+ fallbackItems.push({ item });
2734
2767
  continue;
2735
2768
  }
2736
- cells.forEach((cell) => occupied.add(cell));
2737
- maxExplicitColumn = Math.max(maxExplicitColumn, layout.column + columnSpan - 1);
2738
- placements.set(item, {
2769
+ const placement = {
2739
2770
  item,
2740
2771
  row: layout.row,
2741
2772
  column: layout.column,
2742
2773
  rowSpan,
2743
2774
  columnSpan,
2744
- showLabel: (_layout$showLabel = layout.showLabel) !== null && _layout$showLabel !== void 0 ? _layout$showLabel : false,
2775
+ showLabel: layout.showLabel ?? false,
2745
2776
  width: layout.width,
2746
2777
  iconSize: layout.iconSize
2747
- });
2778
+ };
2779
+ if (cells.some((cell) => occupied.has(cell))) {
2780
+ fallbackItems.push({
2781
+ item,
2782
+ layout: placement
2783
+ });
2784
+ continue;
2785
+ }
2786
+ cells.forEach((cell) => occupied.add(cell));
2787
+ placements.set(item, placement);
2748
2788
  }
2749
- let fallbackRow = 1;
2750
- let fallbackColumn = maxExplicitColumn + 1;
2751
- for (const item of fallbackItems) {
2789
+ for (const { item, layout } of fallbackItems) {
2790
+ const rowSpan = (layout === null || layout === void 0 ? void 0 : layout.rowSpan) ?? 1;
2791
+ const columnSpan = (layout === null || layout === void 0 ? void 0 : layout.columnSpan) ?? 1;
2792
+ const { row, column, cells } = findFirstAvailableCells(occupied, rowSpan, columnSpan);
2793
+ cells.forEach((cell) => occupied.add(cell));
2752
2794
  placements.set(item, {
2753
2795
  item,
2754
- row: fallbackRow,
2755
- column: fallbackColumn,
2756
- rowSpan: 1,
2757
- columnSpan: 1,
2758
- showLabel: false
2796
+ row,
2797
+ column,
2798
+ rowSpan,
2799
+ columnSpan,
2800
+ showLabel: (layout === null || layout === void 0 ? void 0 : layout.showLabel) ?? false,
2801
+ width: layout === null || layout === void 0 ? void 0 : layout.width,
2802
+ iconSize: layout === null || layout === void 0 ? void 0 : layout.iconSize
2759
2803
  });
2760
- fallbackRow += 1;
2761
- if (fallbackRow > RIBBON_GRID_ROWS) {
2762
- fallbackRow = 1;
2763
- fallbackColumn += 1;
2764
- }
2765
2804
  }
2766
2805
  return items.map((item) => placements.get(item));
2767
2806
  }
2807
+ function isValidGridGeometry(layout, rowSpan, cells) {
2808
+ 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);
2809
+ }
2810
+ function findFirstAvailableCells(occupied, rowSpan, columnSpan) {
2811
+ for (let column = 1;; column++) for (let row = 1; row + rowSpan - 1 <= RIBBON_GRID_ROWS; row++) {
2812
+ const cells = getCells(row, column, rowSpan, columnSpan);
2813
+ if (cells.every((cell) => !occupied.has(cell))) return {
2814
+ row,
2815
+ column,
2816
+ cells
2817
+ };
2818
+ }
2819
+ }
2768
2820
  function getCells(row, column, rowSpan, columnSpan) {
2769
2821
  if (![
2770
2822
  row,
@@ -2788,13 +2840,13 @@ function CustomLabel(props) {
2788
2840
  const localeService = useDependency(LocaleService);
2789
2841
  const componentManager = useDependency(ComponentManager);
2790
2842
  const iconManager = useDependency(IconManager);
2791
- const subscribedValue = useObservable(value$ !== null && value$ !== void 0 ? value$ : null, value);
2843
+ const subscribedValue = useObservable(value$ ?? null, value);
2792
2844
  const subscribedIcon = useObservable(isObservable(icon) ? icon : null, "");
2793
- const realIcon = isObservable(icon) ? subscribedIcon : icon !== null && icon !== void 0 ? icon : "";
2845
+ const realIcon = isObservable(icon) ? subscribedIcon : icon ?? "";
2794
2846
  const nodes = [];
2795
2847
  let index = 0;
2796
2848
  const realValue = useMemo(() => {
2797
- return value !== null && value !== void 0 ? value : subscribedValue;
2849
+ return value ?? subscribedValue;
2798
2850
  }, [subscribedValue, value]);
2799
2851
  const isValid = useMemo(() => {
2800
2852
  if (realValue && typeof realValue === "string") return new ColorKit(realValue).isValid;
@@ -2844,7 +2896,6 @@ function CustomLabel(props) {
2844
2896
  * @returns The menu item's status
2845
2897
  */
2846
2898
  function useToolbarItemStatus(menuItem) {
2847
- var _selectionsValue$2;
2848
2899
  const { disabled$, hidden$, activated$, value$ } = menuItem;
2849
2900
  let selectionsValue$;
2850
2901
  if (isMenuButtonSelectorItem(menuItem)) {
@@ -2854,23 +2905,20 @@ function useToolbarItemStatus(menuItem) {
2854
2905
  selectionsValue$ = selections === null || selections === void 0 || (_selections$ = selections[0]) === null || _selections$ === void 0 ? void 0 : _selections$.value$;
2855
2906
  }
2856
2907
  }
2857
- const disabled = useObservable(disabled$ !== null && disabled$ !== void 0 ? disabled$ : null, false);
2858
- const activated = useObservable(activated$ !== null && activated$ !== void 0 ? activated$ : null, false);
2859
- const hidden = useObservable(hidden$ !== null && hidden$ !== void 0 ? hidden$ : null, false);
2908
+ const disabled = useObservable(disabled$ ?? null, false);
2909
+ const activated = useObservable(activated$ ?? null, false);
2910
+ const hidden = useObservable(hidden$ ?? null, false);
2860
2911
  return {
2861
2912
  disabled,
2862
- value: useObservable(useMemo(() => {
2863
- var _selectionsValue$;
2864
- return merge$1(value$ !== null && value$ !== void 0 ? value$ : EMPTY, (_selectionsValue$ = selectionsValue$) !== null && _selectionsValue$ !== void 0 ? _selectionsValue$ : EMPTY);
2865
- }, [selectionsValue$, value$])),
2913
+ value: useObservable(useMemo(() => merge$1(value$ ?? EMPTY, selectionsValue$ ?? EMPTY), [selectionsValue$, value$])),
2866
2914
  activated,
2867
2915
  hidden,
2868
- selectionsValue: useObservable((_selectionsValue$2 = selectionsValue$) !== null && _selectionsValue$2 !== void 0 ? _selectionsValue$2 : null)
2916
+ selectionsValue: useObservable(selectionsValue$ ?? null)
2869
2917
  };
2870
2918
  }
2871
2919
  function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
2872
2920
  const shortcutService = useDependency(IShortcutService);
2873
- const shortcutCommandId = commandId !== null && commandId !== void 0 ? commandId : id;
2921
+ const shortcutCommandId = commandId ?? id;
2874
2922
  return useObservable(useMemo(() => shortcut ? of(shortcut) : shortcutService.shortcutChanged$.pipe(map(() => shortcutService.getShortcutDisplayOfCommand(shortcutCommandId)), startWith(shortcutService.getShortcutDisplayOfCommand(shortcutCommandId))), [
2875
2923
  shortcut,
2876
2924
  shortcutService,
@@ -3078,8 +3126,8 @@ function DropdownMenuLabel({ icon, value, option, onOptionSelect }) {
3078
3126
  });
3079
3127
  }
3080
3128
  function getOptionKey(option) {
3081
- var _ref, _ref2, _option$id, _option$label2;
3082
- return String((_ref = (_ref2 = (_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : option.commandId) !== null && _ref2 !== void 0 ? _ref2 : option.value) !== null && _ref !== void 0 ? _ref : typeof option.label === "string" ? option.label : (_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.name);
3129
+ var _option$label2;
3130
+ return String(option.id ?? option.commandId ?? option.value ?? (typeof option.label === "string" ? option.label : (_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.name));
3083
3131
  }
3084
3132
  function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, onOptionSelect }) {
3085
3133
  const { dropdownVisible, setDropdownVisible } = useContext(TooltipWrapperContext);
@@ -3091,11 +3139,11 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
3091
3139
  const menuItems = useObservable(() => menuManagerService.menuChanged$.pipe(map(resolveMenuItems), startWith(resolveMenuItems())), resolveMenuItems(), false, [menuId, menuManagerService]);
3092
3140
  const hiddenStates = useObservable(useMemo(() => {
3093
3141
  const itemStates = menuItems.map((item) => {
3094
- var _item$item$hidden$, _item$item;
3142
+ var _item$item;
3095
3143
  return (item.children ? combineLatest(item.children.map((subItem) => {
3096
- var _subItem$item$hidden$, _subItem$item;
3097
- return (_subItem$item$hidden$ = (_subItem$item = subItem.item) === null || _subItem$item === void 0 ? void 0 : _subItem$item.hidden$) !== null && _subItem$item$hidden$ !== void 0 ? _subItem$item$hidden$ : of(false);
3098
- })).pipe(map((hiddenValues) => hiddenValues.every(Boolean))) : (_item$item$hidden$ = (_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.hidden$) !== null && _item$item$hidden$ !== void 0 ? _item$item$hidden$ : of(false)).pipe(map((hidden) => [String(item.key), hidden]));
3144
+ var _subItem$item;
3145
+ return ((_subItem$item = subItem.item) === null || _subItem$item === void 0 ? void 0 : _subItem$item.hidden$) ?? of(false);
3146
+ })).pipe(map((hiddenValues) => hiddenValues.every(Boolean))) : ((_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.hidden$) ?? of(false)).pipe(map((hidden) => [String(item.key), hidden]));
3099
3147
  });
3100
3148
  return itemStates.length ? merge$1(...itemStates).pipe(scan((states, [key, hidden]) => ({
3101
3149
  ...states,
@@ -3106,7 +3154,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
3106
3154
  return menuItems.filter((item) => {
3107
3155
  var _item$key;
3108
3156
  if (!item.children) return !hiddenStates[item.key];
3109
- return !hiddenStates[((_item$key = item.key) === null || _item$key === void 0 ? void 0 : _item$key.toString()) || ""];
3157
+ const itemKey = ((_item$key = item.key) === null || _item$key === void 0 ? void 0 : _item$key.toString()) || "";
3158
+ return !hiddenStates[itemKey];
3110
3159
  });
3111
3160
  }, [menuItems, hiddenStates]);
3112
3161
  function handleVisibleChange(visible) {
@@ -3129,15 +3178,15 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
3129
3178
  children
3130
3179
  });
3131
3180
  if (options === null || options === void 0 ? void 0 : options.length) {
3132
- var _options$0$label;
3133
- 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;
3181
+ var _options$0$label, _options$0$label$prop;
3182
+ const isSingleEmbeddedCustomPanel = filteredMenuItems.length === 0 && 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 && ((_options$0$label$prop = options[0].label.props) === null || _options$0$label$prop === void 0 ? void 0 : _options$0$label$prop.embedded) === true;
3134
3183
  const items = options.map((option) => {
3135
- var _option$label3, _option$label4;
3184
+ var _option$label3;
3136
3185
  return {
3137
3186
  type: "item",
3138
3187
  className: clsx({
3139
3188
  "focus:univer-bg-white": typeof option.label !== "string" && ((_option$label3 = option.label) === null || _option$label3 === void 0 ? void 0 : _option$label3.hoverable) === false,
3140
- "!univer-p-0": typeof option.label !== "string" && ((_option$label4 = option.label) === null || _option$label4 === void 0 ? void 0 : _option$label4.hoverable) === false
3189
+ "!univer-p-0": isSingleEmbeddedCustomPanel
3141
3190
  }),
3142
3191
  children: /* @__PURE__ */ jsx(DropdownMenuLabel, {
3143
3192
  icon: option.icon,
@@ -3177,7 +3226,7 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
3177
3226
  }
3178
3227
  return /* @__PURE__ */ jsx(DropdownMenu, {
3179
3228
  align: "start",
3180
- className: clsx({ "!univer-p-0": isSingleCustomPanel }),
3229
+ className: clsx({ "!univer-p-0": isSingleEmbeddedCustomPanel }),
3181
3230
  items,
3182
3231
  disabled,
3183
3232
  open: dropdownVisible,
@@ -3316,7 +3365,7 @@ const ToolbarItem = forwardRef((props, ref) => {
3316
3365
  commandService.executeCommand(commandId, params);
3317
3366
  };
3318
3367
  const { tooltip, shortcut, icon, title, label, id, commandId, type, slot, params, grid, large, showLabel, iconSize, iconColor, fullWidth } = props;
3319
- const gridLabel = title !== null && title !== void 0 ? title : tooltip;
3368
+ const gridLabel = title ?? tooltip;
3320
3369
  const shortcutDisplay = useToolbarShortcutDisplay({
3321
3370
  id,
3322
3371
  commandId,
@@ -3334,8 +3383,8 @@ const ToolbarItem = forwardRef((props, ref) => {
3334
3383
  const iconToDisplay = useObservable(useMemo(() => {
3335
3384
  if (isObservable(icon)) return icon;
3336
3385
  else return new Observable((subscribe) => {
3337
- var _options$find$icon, _options$find;
3338
- const v = (_options$find$icon = options === null || options === void 0 || (_options$find = options.find((o) => o.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.icon) !== null && _options$find$icon !== void 0 ? _options$find$icon : icon;
3386
+ var _options$find;
3387
+ const v = (options === null || options === void 0 || (_options$find = options.find((o) => o.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.icon) ?? icon;
3339
3388
  subscribe.next(v);
3340
3389
  });
3341
3390
  }, [
@@ -3344,17 +3393,16 @@ const ToolbarItem = forwardRef((props, ref) => {
3344
3393
  value
3345
3394
  ]), void 0, true);
3346
3395
  function renderSelectorType(menuType) {
3347
- var _ref;
3348
3396
  const selectionsCommandId = props.selectionsCommandId;
3349
- const bId = commandId !== null && commandId !== void 0 ? commandId : id;
3350
- const sId = (_ref = selectionsCommandId !== null && selectionsCommandId !== void 0 ? selectionsCommandId : commandId) !== null && _ref !== void 0 ? _ref : id;
3397
+ const bId = commandId ?? id;
3398
+ const sId = selectionsCommandId ?? commandId ?? id;
3351
3399
  const titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
3352
3400
  function handleSelect(option) {
3353
3401
  if (disabled) return;
3354
3402
  let commandId = sId;
3355
3403
  if (option.id) commandId = option.id;
3356
3404
  const commandParams = typeof option.params === "function" ? option.params(option.value) : option.params;
3357
- executeCommand(commandId, commandParams !== null && commandParams !== void 0 ? commandParams : { value: option.value });
3405
+ executeCommand(commandId, commandParams ?? { value: option.value });
3358
3406
  }
3359
3407
  function handleSelectionsValueChange(value) {
3360
3408
  if (disabled) return;
@@ -3364,7 +3412,7 @@ const ToolbarItem = forwardRef((props, ref) => {
3364
3412
  if (disabled) return;
3365
3413
  if (menuType === 2) {
3366
3414
  const commandParams = typeof params === "function" ? params() : params;
3367
- executeCommand(bId, commandParams !== null && commandParams !== void 0 ? commandParams : { value });
3415
+ executeCommand(bId, commandParams ?? { value });
3368
3416
  }
3369
3417
  }
3370
3418
  if (menuType === 2) return /* @__PURE__ */ jsxs("div", {
@@ -3387,7 +3435,7 @@ const ToolbarItem = forwardRef((props, ref) => {
3387
3435
  icon: iconToDisplay,
3388
3436
  iconSize,
3389
3437
  title: titleToDisplay,
3390
- value: iconColor !== null && iconColor !== void 0 ? iconColor : value,
3438
+ value: iconColor ?? value,
3391
3439
  label,
3392
3440
  onChange: handleSelectionsValueChange
3393
3441
  })
@@ -3455,8 +3503,7 @@ const ToolbarItem = forwardRef((props, ref) => {
3455
3503
  });
3456
3504
  }
3457
3505
  function renderButtonType() {
3458
- var _label$name;
3459
- 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 : "");
3506
+ const isCustomComponent = componentManager.get(typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "");
3460
3507
  const buttonClassName = 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");
3461
3508
  const buttonStyle = grid && large ? {
3462
3509
  textAlign: "center",
@@ -3486,9 +3533,8 @@ const ToolbarItem = forwardRef((props, ref) => {
3486
3533
  active: activated,
3487
3534
  disabled,
3488
3535
  onClick: () => {
3489
- var _props$commandId;
3490
3536
  const commandParams = typeof params === "function" ? params() : params;
3491
- 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 });
3537
+ executeCommand(props.commandId ?? props.id, commandParams ?? (typeof value === "undefined" ? void 0 : { value }));
3492
3538
  },
3493
3539
  onDoubleClick: () => props.subId && executeCommand(props.subId),
3494
3540
  children: icon ? /* @__PURE__ */ jsx(CustomLabel, {
@@ -3528,14 +3574,13 @@ function RibbonGrid({ groups, title, className, ...props }) {
3528
3574
  role: "toolbar",
3529
3575
  "aria-label": localeService.t(title),
3530
3576
  children: /* @__PURE__ */ jsx(ToolbarDropdownProvider, { children: groups.map((group) => {
3531
- var _group$children;
3532
3577
  return /* @__PURE__ */ jsxs("div", {
3533
3578
  "data-u-comp": "ribbon-grid-group",
3534
3579
  className: "univer-relative univer-box-border univer-flex univer-min-w-16 univer-shrink-0 univer-flex-col univer-px-2",
3535
3580
  children: [/* @__PURE__ */ jsx("div", {
3536
3581
  "data-testid": "ribbon-grid-group-grid",
3537
3582
  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",
3538
- children: placeRibbonGridItems((_group$children = group.children) !== null && _group$children !== void 0 ? _group$children : []).map((placement) => placement.item.item && /* @__PURE__ */ jsx("div", {
3583
+ children: placeRibbonGridItems(group.children ?? []).map((placement) => placement.item.item && /* @__PURE__ */ jsx("div", {
3539
3584
  className: clsx("univer-flex univer-items-stretch [&>span>button]:univer-h-full [&>span]:univer-h-full", placement.width && "[&>span>span]:univer-w-full [&>span]:univer-w-full [&_[data-u-command]]:univer-w-full"),
3540
3585
  style: {
3541
3586
  gridRow: `${placement.row} / span ${placement.rowSpan}`,
@@ -3564,13 +3609,12 @@ function RibbonGrid({ groups, title, className, ...props }) {
3564
3609
  //#endregion
3565
3610
  //#region src/views/components/ribbon/Ribbon.tsx
3566
3611
  function Ribbon(props) {
3567
- var _ribbonOverride$ribbo;
3568
3612
  const { ribbonType, headerMenuComponents, headerMenu = true, toolbarOnly = false, headerClassName } = props;
3569
3613
  const defaultRibbonService = useDependency(IRibbonService);
3570
3614
  const ribbonOverrideService = useDependency(IRibbonOverrideService);
3571
3615
  const localeService = useDependency(LocaleService);
3572
3616
  const ribbonOverride = useObservable(ribbonOverrideService.override$, ribbonOverrideService.getOverride());
3573
- const ribbonService = (_ribbonOverride$ribbo = ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.ribbonService) !== null && _ribbonOverride$ribbo !== void 0 ? _ribbonOverride$ribbo : defaultRibbonService;
3617
+ const ribbonService = (ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.ribbonService) ?? defaultRibbonService;
3574
3618
  const containerRef = useRef(null);
3575
3619
  const toolbarItemRefs = useRef({});
3576
3620
  const ribbonData = useObservable(ribbonService.ribbon$, []);
@@ -3605,8 +3649,8 @@ function Ribbon(props) {
3605
3649
  ribbonService.setActivatedTab(group.key);
3606
3650
  }, [ribbonService]);
3607
3651
  const activeGroup = useMemo(() => {
3608
- var _ribbon$find$children, _ribbon$find2;
3609
- const allGroups = (_ribbon$find$children = (_ribbon$find2 = ribbon.find((group) => group.key === activatedTab)) === null || _ribbon$find2 === void 0 ? void 0 : _ribbon$find2.children) !== null && _ribbon$find$children !== void 0 ? _ribbon$find$children : [];
3652
+ var _ribbon$find2;
3653
+ const allGroups = ((_ribbon$find2 = ribbon.find((group) => group.key === activatedTab)) === null || _ribbon$find2 === void 0 ? void 0 : _ribbon$find2.children) ?? [];
3610
3654
  const visibleGroups = [];
3611
3655
  const hiddenGroups = [];
3612
3656
  for (const item of allGroups) if (item.children) {
@@ -3643,14 +3687,14 @@ function Ribbon(props) {
3643
3687
  for (const entry of entries) {
3644
3688
  ribbonService.setFakeToolbarVisible(true);
3645
3689
  timer = requestAnimationFrame(() => {
3646
- var _ribbon$find$children2, _ribbon$find3;
3690
+ var _ribbon$find3;
3647
3691
  const { width: avaliableWidth } = entry.contentRect;
3648
3692
  const sortedToolbarItems = Object.values(toolbarItemRefs.current).sort((a, b) => {
3649
3693
  return a.order - b.order || a.groupOrder - b.groupOrder || a.itemOrder - b.itemOrder;
3650
3694
  });
3651
3695
  const newCollapsedIds = [];
3652
3696
  let totalWidth = 32;
3653
- const gapWidth = (((_ribbon$find$children2 = (_ribbon$find3 = ribbon.find((group) => group.key === activatedTab)) === null || _ribbon$find3 === void 0 ? void 0 : _ribbon$find3.children) !== null && _ribbon$find$children2 !== void 0 ? _ribbon$find$children2 : []).length - 1) * 8;
3697
+ const gapWidth = ((((_ribbon$find3 = ribbon.find((group) => group.key === activatedTab)) === null || _ribbon$find3 === void 0 ? void 0 : _ribbon$find3.children) ?? []).length - 1) * 8;
3654
3698
  totalWidth += gapWidth;
3655
3699
  for (const { el, key } of sortedToolbarItems) {
3656
3700
  const { width } = el.getBoundingClientRect();
@@ -3798,7 +3842,6 @@ function Ribbon(props) {
3798
3842
  });
3799
3843
  }
3800
3844
  function RibbonOverrideRuntimeProvider(props) {
3801
- var _override$portalConta;
3802
3845
  const { override, children } = props;
3803
3846
  const config = useContext(ConfigContext);
3804
3847
  const injector = override === null || override === void 0 ? void 0 : override.injector;
@@ -3807,7 +3850,7 @@ function RibbonOverrideRuntimeProvider(props) {
3807
3850
  return /* @__PURE__ */ jsx(ConnectedRibbonOverrideConfigProvider, {
3808
3851
  locale: config.locale,
3809
3852
  direction: config.direction,
3810
- mountContainer: (_override$portalConta = override.portalContainer) !== null && _override$portalConta !== void 0 ? _override$portalConta : config.mountContainer,
3853
+ mountContainer: override.portalContainer ?? config.mountContainer,
3811
3854
  children
3812
3855
  });
3813
3856
  }
@@ -3855,6 +3898,33 @@ var ThemeSwitcherService = class extends Disposable {
3855
3898
  }
3856
3899
  };
3857
3900
 
3901
+ //#endregion
3902
+ //#region src/services/workbench/workbench.service.ts
3903
+ const IWorkbenchService = createIdentifier("univer.ui.workbench.service");
3904
+ var WorkbenchService = class extends Disposable {
3905
+ constructor(..._args) {
3906
+ super(..._args);
3907
+ _defineProperty(this, "_tokens", /* @__PURE__ */ new Set());
3908
+ _defineProperty(this, "_skeletonVisible$", new BehaviorSubject(false));
3909
+ _defineProperty(this, "skeletonVisible$", this._skeletonVisible$.asObservable());
3910
+ }
3911
+ acquireSkeleton() {
3912
+ const token = Symbol("workbench-skeleton");
3913
+ this._tokens.add(token);
3914
+ if (this._tokens.size === 1) this._skeletonVisible$.next(true);
3915
+ const disposable = toDisposable(() => {
3916
+ if (!this._tokens.delete(token) || this._tokens.size > 0) return;
3917
+ this._skeletonVisible$.next(false);
3918
+ });
3919
+ return this.disposeWithMe(disposable);
3920
+ }
3921
+ dispose() {
3922
+ super.dispose();
3923
+ this._tokens.clear();
3924
+ this._skeletonVisible$.complete();
3925
+ }
3926
+ };
3927
+
3858
3928
  //#endregion
3859
3929
  //#region src/services/contextmenu/contextmenu.service.ts
3860
3930
  const IContextMenuService = createIdentifier("ui.contextmenu.service");
@@ -3865,8 +3935,8 @@ var ContextMenuService = class extends Disposable {
3865
3935
  _defineProperty(this, "disabled", false);
3866
3936
  }
3867
3937
  get visible() {
3868
- var _this$_currentHandler, _this$_currentHandler2;
3869
- return (_this$_currentHandler = (_this$_currentHandler2 = this._currentHandler) === null || _this$_currentHandler2 === void 0 ? void 0 : _this$_currentHandler2.visible) !== null && _this$_currentHandler !== void 0 ? _this$_currentHandler : false;
3938
+ var _this$_currentHandler;
3939
+ return ((_this$_currentHandler = this._currentHandler) === null || _this$_currentHandler === void 0 ? void 0 : _this$_currentHandler.visible) ?? false;
3870
3940
  }
3871
3941
  disable() {
3872
3942
  this.disabled = true;
@@ -3875,14 +3945,14 @@ var ContextMenuService = class extends Disposable {
3875
3945
  this.disabled = false;
3876
3946
  }
3877
3947
  triggerContextMenu(event, menuType, context) {
3878
- var _this$_currentHandler3;
3948
+ var _this$_currentHandler2;
3879
3949
  event.stopPropagation();
3880
3950
  if (this.disabled) return;
3881
- (_this$_currentHandler3 = this._currentHandler) === null || _this$_currentHandler3 === void 0 || _this$_currentHandler3.handleContextMenu(event, menuType, context);
3951
+ (_this$_currentHandler2 = this._currentHandler) === null || _this$_currentHandler2 === void 0 || _this$_currentHandler2.handleContextMenu(event, menuType, context);
3882
3952
  }
3883
3953
  hideContextMenu() {
3884
- var _this$_currentHandler4;
3885
- (_this$_currentHandler4 = this._currentHandler) === null || _this$_currentHandler4 === void 0 || _this$_currentHandler4.hideContextMenu();
3954
+ var _this$_currentHandler3;
3955
+ (_this$_currentHandler3 = this._currentHandler) === null || _this$_currentHandler3 === void 0 || _this$_currentHandler3.hideContextMenu();
3886
3956
  }
3887
3957
  registerContextMenuHandler(handler) {
3888
3958
  if (this._currentHandler) throw new Error("There is already a context menu handler!");
@@ -3965,10 +4035,10 @@ function useScrollYOverContainer(element, container) {
3965
4035
  useEffect(() => {
3966
4036
  if (!isBrowser() || !element || !container) return;
3967
4037
  updater();
3968
- const resizeObserver = resizeObserverCtor(updater);
4038
+ const resizeObserver = new ResizeObserver(updater);
3969
4039
  resizeObserver.observe(element);
3970
4040
  return () => {
3971
- resizeObserver.unobserve(element);
4041
+ resizeObserver.disconnect();
3972
4042
  };
3973
4043
  }, [element, container]);
3974
4044
  }
@@ -4076,11 +4146,10 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
4076
4146
  }),
4077
4147
  style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
4078
4148
  children: items.map((item) => {
4079
- var _item$tooltip;
4080
4149
  const showTooltip = !isParagraphTVariant && item.tooltip;
4081
4150
  const ele = /* @__PURE__ */ jsx("button", {
4082
4151
  type: "button",
4083
- "aria-label": (_item$tooltip = item.tooltip) !== null && _item$tooltip !== void 0 ? _item$tooltip : item.key,
4152
+ "aria-label": item.tooltip ?? item.key,
4084
4153
  title: showTooltip ? item.tooltip : void 0,
4085
4154
  className: tinyMenuButtonVariants({
4086
4155
  variant,
@@ -4130,8 +4199,8 @@ function resolveMenuItemActiveState(itemId, observableActive, activeItemIds) {
4130
4199
  return observableActive;
4131
4200
  }
4132
4201
  function getTinyMenuChildStateKey(child) {
4133
- var _child$item$id, _child$item;
4134
- return (_child$item$id = (_child$item = child.item) === null || _child$item === void 0 ? void 0 : _child$item.id) !== null && _child$item$id !== void 0 ? _child$item$id : child.key;
4202
+ var _child$item;
4203
+ return ((_child$item = child.item) === null || _child$item === void 0 ? void 0 : _child$item.id) ?? child.key;
4135
4204
  }
4136
4205
  function getVisibleTinyMenuChildren(children, hiddenItemKeys) {
4137
4206
  const hiddenSet = new Set(hiddenItemKeys);
@@ -4147,18 +4216,18 @@ function QuickTileMenuItem(props) {
4147
4216
  const activated = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.activated$, false);
4148
4217
  if (!menuItem || hidden) return null;
4149
4218
  const Icon = menuItem.icon ? iconManager.get(menuItem.icon) : null;
4219
+ const active = resolveMenuItemActiveState(menuItem.id, activated, activeItemIds);
4150
4220
  return /* @__PURE__ */ jsxs("button", {
4151
4221
  type: "button",
4152
4222
  className: quickTileMenuButtonVariants({
4153
4223
  disabled,
4154
- active: resolveMenuItemActiveState(menuItem.id, activated, activeItemIds)
4224
+ active
4155
4225
  }),
4156
4226
  disabled,
4157
4227
  onClick: () => {
4158
- var _menuItem$id;
4159
4228
  if (disabled) return;
4160
4229
  onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
4161
- label: (_menuItem$id = menuItem.id) !== null && _menuItem$id !== void 0 ? _menuItem$id : menuSchema.key,
4230
+ label: menuItem.id ?? menuSchema.key,
4162
4231
  commandId: menuItem.commandId,
4163
4232
  id: menuItem.id,
4164
4233
  params: menuItem.params,
@@ -4176,25 +4245,21 @@ function QuickTileMenuItem(props) {
4176
4245
  });
4177
4246
  }
4178
4247
  function UITinyMenuGroup(props) {
4179
- var _item$children;
4180
4248
  const { item, activeItemIds, hiddenItemIds = EMPTY_HIDDEN_ITEM_IDS, hoverSuppressed, columns, sizeVariant = "default", layoutVariant = "default", onOptionSelect } = props;
4181
4249
  const iconManager = useDependency(IconManager);
4182
4250
  const localeService = useDependency(LocaleService);
4183
- const children = (_item$children = item.children) !== null && _item$children !== void 0 ? _item$children : EMPTY_TINY_MENU_CHILDREN;
4251
+ const children = item.children ?? EMPTY_TINY_MENU_CHILDREN;
4184
4252
  const activeItems$ = useMemo(() => children.length ? combineLatest(children.map((child) => {
4185
- var _child$item$activated, _child$item2;
4186
- return ((_child$item$activated = (_child$item2 = child.item) === null || _child$item2 === void 0 ? void 0 : _child$item2.activated$) !== null && _child$item$activated !== void 0 ? _child$item$activated : of(false)).pipe(startWith(false));
4253
+ var _child$item2;
4254
+ return (((_child$item2 = child.item) === null || _child$item2 === void 0 ? void 0 : _child$item2.activated$) ?? of(false)).pipe(startWith(false));
4187
4255
  })).pipe(map((states) => children.flatMap((child, index) => states[index] ? [getTinyMenuChildStateKey(child)] : []))) : of([]), [children]);
4188
4256
  const hiddenItems$ = useMemo(() => children.length ? combineLatest(children.map((child) => {
4189
- var _child$item$hidden$, _child$item3;
4190
- return ((_child$item$hidden$ = (_child$item3 = child.item) === null || _child$item3 === void 0 ? void 0 : _child$item3.hidden$) !== null && _child$item$hidden$ !== void 0 ? _child$item$hidden$ : of(false)).pipe(startWith(false));
4257
+ var _child$item3;
4258
+ return (((_child$item3 = child.item) === null || _child$item3 === void 0 ? void 0 : _child$item3.hidden$) ?? of(false)).pipe(startWith(false));
4191
4259
  })).pipe(map((states) => children.flatMap((child, index) => states[index] ? [getTinyMenuChildStateKey(child)] : []))) : of([]), [children]);
4192
4260
  const activeItems = useObservable(activeItems$, []);
4193
4261
  const hiddenItems = useObservable(hiddenItems$, []);
4194
- const visibleChildren = useMemo(() => {
4195
- var _item$children2;
4196
- return getVisibleTinyMenuChildren((_item$children2 = item.children) !== null && _item$children2 !== void 0 ? _item$children2 : [], [...hiddenItems, ...hiddenItemIds]);
4197
- }, [
4262
+ const visibleChildren = useMemo(() => getVisibleTinyMenuChildren(item.children ?? [], [...hiddenItems, ...hiddenItemIds]), [
4198
4263
  hiddenItemIds,
4199
4264
  hiddenItems,
4200
4265
  item.children
@@ -4206,15 +4271,15 @@ function UITinyMenuGroup(props) {
4206
4271
  layoutVariant,
4207
4272
  hoverSuppressed,
4208
4273
  items: visibleChildren.map((child) => {
4209
- var _child$item4, _child$item12, _child$item13, _child$item$id3, _child$item14, _child$item15;
4274
+ var _child$item4, _child$item12, _child$item13, _child$item14, _child$item15;
4210
4275
  const Icon = ((_child$item4 = child.item) === null || _child$item4 === void 0 ? void 0 : _child$item4.icon) ? iconManager.get(child.item.icon) : void 0;
4211
4276
  if (!Icon) return null;
4212
4277
  return {
4213
4278
  key: child.key,
4214
4279
  onClick: () => {
4215
- var _child$item$id2, _child$item5, _child$item6, _child$item7, _child$item8, _child$item9, _child$item10, _child$item11;
4280
+ var _child$item5, _child$item6, _child$item7, _child$item8, _child$item9, _child$item10, _child$item11;
4216
4281
  onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect({
4217
- label: (_child$item$id2 = (_child$item5 = child.item) === null || _child$item5 === void 0 ? void 0 : _child$item5.id) !== null && _child$item$id2 !== void 0 ? _child$item$id2 : child.key,
4282
+ label: ((_child$item5 = child.item) === null || _child$item5 === void 0 ? void 0 : _child$item5.id) ?? child.key,
4218
4283
  commandId: (_child$item6 = child.item) === null || _child$item6 === void 0 ? void 0 : _child$item6.commandId,
4219
4284
  id: (_child$item7 = child.item) === null || _child$item7 === void 0 ? void 0 : _child$item7.id,
4220
4285
  params: (_child$item8 = child.item) === null || _child$item8 === void 0 ? void 0 : _child$item8.params,
@@ -4225,16 +4290,16 @@ function UITinyMenuGroup(props) {
4225
4290
  className: "",
4226
4291
  iconClassName: ((_child$item12 = child.item) === null || _child$item12 === void 0 ? void 0 : _child$item12.icon) === "TextTypeIcon" ? sizeVariant === "paragraph-t" ? "!univer-size-4" : "!univer-size-3.5" : void 0,
4227
4292
  Icon,
4228
- active: resolveMenuItemActiveState((_child$item13 = child.item) === null || _child$item13 === void 0 ? void 0 : _child$item13.id, activeItems.includes((_child$item$id3 = (_child$item14 = child.item) === null || _child$item14 === void 0 ? void 0 : _child$item14.id) !== null && _child$item$id3 !== void 0 ? _child$item$id3 : ""), activeItemIds),
4293
+ active: resolveMenuItemActiveState((_child$item13 = child.item) === null || _child$item13 === void 0 ? void 0 : _child$item13.id, activeItems.includes(((_child$item14 = child.item) === null || _child$item14 === void 0 ? void 0 : _child$item14.id) ?? ""), activeItemIds),
4229
4294
  tooltip: ((_child$item15 = child.item) === null || _child$item15 === void 0 ? void 0 : _child$item15.tooltip) ? localeService.t(child.item.tooltip) : void 0
4230
4295
  };
4231
4296
  }).filter((child) => child != null)
4232
4297
  });
4233
4298
  }
4234
4299
  function UIQuickTileMenuGroup(props) {
4235
- var _item$children3;
4300
+ var _item$children;
4236
4301
  const { item, activeItemIds, hiddenItemIds = EMPTY_HIDDEN_ITEM_IDS, onOptionSelect } = props;
4237
- if (!((_item$children3 = item.children) === null || _item$children3 === void 0 ? void 0 : _item$children3.length)) return null;
4302
+ if (!((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length)) return null;
4238
4303
  return /* @__PURE__ */ jsx("div", {
4239
4304
  className: "univer-item-center univer-grid univer-grid-cols-3 univer-gap-1.5 univer-py-1",
4240
4305
  children: getVisibleTinyMenuChildren(item.children, hiddenItemIds).map((menuSchema) => /* @__PURE__ */ jsx(QuickTileMenuItem, {
@@ -4450,11 +4515,11 @@ function getContextMenuPanelClassName(sizeVariant) {
4450
4515
  function getContextMenuGroupClassName(sizeVariant) {
4451
4516
  return contextMenuGroupVariants({ sizeVariant });
4452
4517
  }
4453
- function isParagraphTHeaderQuickGroup(menuSchema, sizeVariant) {
4454
- return sizeVariant === "paragraph-t" && menuSchema.quickLayout === "icon" && CONTEXT_MENU_HEADER_QUICK_GROUP_KEYS.has(menuSchema.key);
4518
+ function isHeaderQuickGroup(menuSchema) {
4519
+ return menuSchema.quickLayout === "icon" && CONTEXT_MENU_HEADER_QUICK_GROUP_KEYS.has(menuSchema.key);
4455
4520
  }
4456
- function shouldClusterParagraphTHeaderQuickGroups(currentSchema, nextSchema, sizeVariant) {
4457
- return isParagraphTHeaderQuickGroup(currentSchema, sizeVariant) && !!nextSchema && isParagraphTHeaderQuickGroup(nextSchema, sizeVariant);
4521
+ function shouldClusterHeaderQuickGroups(currentSchema, nextSchema) {
4522
+ return isHeaderQuickGroup(currentSchema) && !!nextSchema && isHeaderQuickGroup(nextSchema);
4458
4523
  }
4459
4524
  function getContextMenuQuickGroupClassName(menuSchema, visibleSchemas, index, sizeVariant) {
4460
4525
  if (sizeVariant !== "paragraph-t" || !CONTEXT_MENU_HEADER_QUICK_GROUP_KEYS.has(menuSchema.key)) return getContextMenuGroupClassName(sizeVariant);
@@ -4507,7 +4572,7 @@ function getFirstMenuButtonByVisualOrder(buttons) {
4507
4572
  })[0];
4508
4573
  }
4509
4574
  function getNextMenuButtonByDirection(buttons, activeIndex, key) {
4510
- var _scoredCandidates$0$b, _scoredCandidates$;
4575
+ var _scoredCandidates$;
4511
4576
  const direction = key === "ArrowDown" || key === "ArrowRight" ? 1 : -1;
4512
4577
  const fallbackButton = buttons[activeIndex < 0 ? direction > 0 ? 0 : buttons.length - 1 : (activeIndex + direction + buttons.length) % buttons.length];
4513
4578
  const activeButton = activeIndex >= 0 ? buttons[activeIndex] : null;
@@ -4515,20 +4580,16 @@ function getNextMenuButtonByDirection(buttons, activeIndex, key) {
4515
4580
  const rows = getMenuButtonRows(buttons);
4516
4581
  const activeRowIndex = rows.findIndex((row) => row.includes(activeButton));
4517
4582
  const activeRow = rows[activeRowIndex];
4518
- if (activeRow && (key === "ArrowRight" || key === "ArrowLeft")) {
4519
- const nextRowButton = activeRow[activeRow.indexOf(activeButton) + (key === "ArrowRight" ? 1 : -1)];
4520
- return nextRowButton !== null && nextRowButton !== void 0 ? nextRowButton : fallbackButton;
4521
- }
4583
+ if (activeRow && (key === "ArrowRight" || key === "ArrowLeft")) return activeRow[activeRow.indexOf(activeButton) + (key === "ArrowRight" ? 1 : -1)] ?? fallbackButton;
4522
4584
  if (activeRow && (key === "ArrowDown" || key === "ArrowUp")) {
4523
4585
  const nextRow = rows[activeRowIndex + (key === "ArrowDown" ? 1 : -1)];
4524
4586
  if (nextRow) {
4525
- var _sort$;
4526
4587
  const activeCenter = getMenuButtonCenter(activeButton);
4527
- return (_sort$ = [...nextRow].sort((left, right) => Math.abs(getMenuButtonCenter(left).x - activeCenter.x) - Math.abs(getMenuButtonCenter(right).x - activeCenter.x))[0]) !== null && _sort$ !== void 0 ? _sort$ : fallbackButton;
4588
+ return [...nextRow].sort((left, right) => Math.abs(getMenuButtonCenter(left).x - activeCenter.x) - Math.abs(getMenuButtonCenter(right).x - activeCenter.x))[0] ?? fallbackButton;
4528
4589
  }
4529
4590
  }
4530
4591
  const activeCenter = getMenuButtonCenter(activeButton);
4531
- return (_scoredCandidates$0$b = (_scoredCandidates$ = buttons.filter((button) => button !== activeButton).map((button) => {
4592
+ return ((_scoredCandidates$ = buttons.filter((button) => button !== activeButton).map((button) => {
4532
4593
  const center = getMenuButtonCenter(button);
4533
4594
  const deltaX = center.x - activeCenter.x;
4534
4595
  const deltaY = center.y - activeCenter.y;
@@ -4539,14 +4600,14 @@ function getNextMenuButtonByDirection(buttons, activeIndex, key) {
4539
4600
  button,
4540
4601
  score: primaryDistance * 1e3 + secondaryDistance
4541
4602
  };
4542
- }).filter((candidate) => candidate != null).sort((left, right) => left.score - right.score)[0]) === null || _scoredCandidates$ === void 0 ? void 0 : _scoredCandidates$.button) !== null && _scoredCandidates$0$b !== void 0 ? _scoredCandidates$0$b : fallbackButton;
4603
+ }).filter((candidate) => candidate != null).sort((left, right) => left.score - right.score)[0]) === null || _scoredCandidates$ === void 0 ? void 0 : _scoredCandidates$.button) ?? fallbackButton;
4543
4604
  }
4544
- function getContextMenuSchemaRenderGroups(visibleSchemas, sizeVariant) {
4605
+ function getContextMenuSchemaRenderGroups(visibleSchemas, flowQuickGroups = false) {
4545
4606
  const renderGroups = [];
4546
4607
  for (let index = 0; index < visibleSchemas.length; index++) {
4547
4608
  const menuSchema = visibleSchemas[index];
4548
4609
  const nextSchema = visibleSchemas[index + 1];
4549
- if (shouldClusterParagraphTHeaderQuickGroups(menuSchema, nextSchema, sizeVariant)) {
4610
+ if (flowQuickGroups && shouldClusterHeaderQuickGroups(menuSchema, nextSchema)) {
4550
4611
  renderGroups.push({
4551
4612
  startIndex: index,
4552
4613
  endIndex: index + 1,
@@ -4563,6 +4624,15 @@ function getContextMenuSchemaRenderGroups(visibleSchemas, sizeVariant) {
4563
4624
  }
4564
4625
  return renderGroups;
4565
4626
  }
4627
+ function mergeContextMenuQuickGroupSchemas(menuSchemas) {
4628
+ const firstSchema = menuSchemas[0];
4629
+ return {
4630
+ ...firstSchema,
4631
+ key: menuSchemas.map((schema) => schema.key).join("-"),
4632
+ quickColumns: getContextMenuQuickGroupColumns(firstSchema),
4633
+ children: menuSchemas.flatMap((schema) => schema.children ?? [])
4634
+ };
4635
+ }
4566
4636
  function getContextMenuHeaderClassName(sizeVariant) {
4567
4637
  return contextMenuHeaderVariants({ sizeVariant });
4568
4638
  }
@@ -4573,12 +4643,12 @@ function getContextMenuSubmenuPanelClassName(sizeVariant) {
4573
4643
  return contextMenuSubmenuPanelVariants({ sizeVariant });
4574
4644
  }
4575
4645
  function ContextMenuPanel(props) {
4576
- var _layoutService$rootCo, _layoutService$rootCo2;
4577
- const { menuType, menuManagerService: providedMenuManagerService, layoutService: providedLayoutService, menuSessionVersion = 0, className, activeItemIds, hiddenItemIds, sizeVariant = "default", autoFocus, autoFocusTarget = "first-item", suppressHoverUntilPointerMove = false, onCancel, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
4646
+ var _layoutService$rootCo;
4647
+ const { menuType, menuManagerService: providedMenuManagerService, layoutService: providedLayoutService, menuSessionVersion = 0, className, activeItemIds, hiddenItemIds, flowQuickGroups, sizeVariant = "default", autoFocus, autoFocusTarget = "first-item", suppressHoverUntilPointerMove = false, onCancel, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
4578
4648
  const rootMenuManagerService = useDependency(IMenuManagerService);
4579
4649
  const rootLayoutService = useDependency(ILayoutService);
4580
- const menuManagerService = providedMenuManagerService !== null && providedMenuManagerService !== void 0 ? providedMenuManagerService : rootMenuManagerService;
4581
- const layoutService = providedLayoutService !== null && providedLayoutService !== void 0 ? providedLayoutService : rootLayoutService;
4650
+ const menuManagerService = providedMenuManagerService ?? rootMenuManagerService;
4651
+ const layoutService = providedLayoutService ?? rootLayoutService;
4582
4652
  const [menuElement, setMenuElement] = useState(null);
4583
4653
  const [maxMenuHeight, setMaxMenuHeight] = useState(() => {
4584
4654
  if (typeof window === "undefined") return 240;
@@ -4591,23 +4661,21 @@ function ContextMenuPanel(props) {
4591
4661
  useObservable(useMemo(() => menuManagerService.menuChanged$.pipe(startWith(void 0), scan((version) => version + 1, 0)), [menuManagerService]), 0),
4592
4662
  menuSessionVersion
4593
4663
  ]);
4594
- const submenuPortalContainer = (_layoutService$rootCo = (_layoutService$rootCo2 = layoutService.rootContainerElement) === null || _layoutService$rootCo2 === void 0 || (_layoutService$rootCo2 = _layoutService$rootCo2.ownerDocument) === null || _layoutService$rootCo2 === void 0 ? void 0 : _layoutService$rootCo2.body) !== null && _layoutService$rootCo !== void 0 ? _layoutService$rootCo : typeof document !== "undefined" ? document.body : null;
4664
+ const submenuPortalContainer = ((_layoutService$rootCo = layoutService.rootContainerElement) === null || _layoutService$rootCo === void 0 || (_layoutService$rootCo = _layoutService$rootCo.ownerDocument) === null || _layoutService$rootCo === void 0 ? void 0 : _layoutService$rootCo.body) ?? (typeof document !== "undefined" ? document.body : null);
4595
4665
  useScrollYOverContainer(menuElement, layoutService.rootContainerElement);
4596
4666
  const getFocusableMenuButtons = useCallback(() => {
4597
4667
  if (!menuElement) return [];
4598
4668
  return Array.from(menuElement.querySelectorAll("button:not(:disabled)"));
4599
4669
  }, [menuElement]);
4600
4670
  useEffect(() => {
4601
- var _menuElement$ownerDoc;
4602
4671
  if (!autoFocus || !menuElement) return;
4603
- const view = (_menuElement$ownerDoc = menuElement.ownerDocument.defaultView) !== null && _menuElement$ownerDoc !== void 0 ? _menuElement$ownerDoc : window;
4672
+ const view = menuElement.ownerDocument.defaultView ?? window;
4604
4673
  const frameId = view.requestAnimationFrame(() => {
4605
4674
  if (autoFocusTarget === "container") {
4606
4675
  menuElement.focus();
4607
4676
  return;
4608
4677
  }
4609
- const firstButton = getFirstMenuButtonByVisualOrder(getFocusableMenuButtons());
4610
- (firstButton !== null && firstButton !== void 0 ? firstButton : menuElement).focus();
4678
+ (getFirstMenuButtonByVisualOrder(getFocusableMenuButtons()) ?? menuElement).focus();
4611
4679
  });
4612
4680
  return () => view.cancelAnimationFrame(frameId);
4613
4681
  }, [
@@ -4651,8 +4719,8 @@ function ContextMenuPanel(props) {
4651
4719
  onCancel
4652
4720
  ]);
4653
4721
  useEffect(() => {
4654
- var _layoutService$rootCo3, _layoutService$rootCo4;
4655
- const defaultView = (_layoutService$rootCo3 = (_layoutService$rootCo4 = layoutService.rootContainerElement) === null || _layoutService$rootCo4 === void 0 || (_layoutService$rootCo4 = _layoutService$rootCo4.ownerDocument) === null || _layoutService$rootCo4 === void 0 ? void 0 : _layoutService$rootCo4.defaultView) !== null && _layoutService$rootCo3 !== void 0 ? _layoutService$rootCo3 : typeof window !== "undefined" ? window : null;
4722
+ var _layoutService$rootCo2;
4723
+ const defaultView = ((_layoutService$rootCo2 = layoutService.rootContainerElement) === null || _layoutService$rootCo2 === void 0 || (_layoutService$rootCo2 = _layoutService$rootCo2.ownerDocument) === null || _layoutService$rootCo2 === void 0 ? void 0 : _layoutService$rootCo2.defaultView) ?? (typeof window !== "undefined" ? window : null);
4656
4724
  if (!defaultView) return;
4657
4725
  let frameId = 0;
4658
4726
  const updateMaxHeight = () => {
@@ -4687,6 +4755,7 @@ function ContextMenuPanel(props) {
4687
4755
  rootMenuElement: menuElement,
4688
4756
  activeItemIds,
4689
4757
  hiddenItemIds,
4758
+ flowQuickGroups,
4690
4759
  hoverSuppressed,
4691
4760
  sizeVariant,
4692
4761
  onMenuPointerEnter,
@@ -4697,7 +4766,7 @@ function ContextMenuPanel(props) {
4697
4766
  });
4698
4767
  }
4699
4768
  function ContextMenuMenu(props) {
4700
- const { menuSchemas, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, activeItemIds, hiddenItemIds, hoverSuppressed, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect, maxMenuHeight } = props;
4769
+ const { menuSchemas, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, activeItemIds, hiddenItemIds, flowQuickGroups, hoverSuppressed, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect, maxMenuHeight } = props;
4701
4770
  const localeService = useDependency(LocaleService);
4702
4771
  const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
4703
4772
  const [activeSubmenuKey, setActiveSubmenuKey] = useState(null);
@@ -4708,7 +4777,7 @@ function ContextMenuMenu(props) {
4708
4777
  return !hiddenGroupStates[item.key];
4709
4778
  });
4710
4779
  }, [hiddenGroupStates, menuSchemas]);
4711
- const renderGroups = useMemo(() => getContextMenuSchemaRenderGroups(visibleSchemas, sizeVariant), [sizeVariant, visibleSchemas]);
4780
+ const renderGroups = useMemo(() => getContextMenuSchemaRenderGroups(visibleSchemas, flowQuickGroups), [flowQuickGroups, visibleSchemas]);
4712
4781
  const renderQuickLayoutGroup = (menuSchema, index, renderAsClusterChild = false, hasSeparator = false) => {
4713
4782
  const titleNode = renderMenuSchemaHeader(menuSchema);
4714
4783
  return /* @__PURE__ */ jsxs("div", {
@@ -4736,10 +4805,13 @@ function ContextMenuMenu(props) {
4736
4805
  const menuSchema = groupedSchemas[0];
4737
4806
  const hasSeparator = shouldShowContextMenuGroupSeparator(visibleSchemas, endIndex);
4738
4807
  const titleNode = renderMenuSchemaHeader(menuSchema);
4739
- if (groupedSchemas.length > 1) return /* @__PURE__ */ jsx("div", {
4740
- className: clsx(getContextMenuQuickGroupClusterClassName(sizeVariant), hasSeparator && borderBottomClassName),
4741
- children: groupedSchemas.map((groupedMenuSchema, groupedIndex) => renderQuickLayoutGroup(groupedMenuSchema, startIndex + groupedIndex, true))
4742
- }, groupedSchemas.map((schema) => schema.key).join("-"));
4808
+ if (groupedSchemas.length > 1) {
4809
+ const mergedMenuSchema = mergeContextMenuQuickGroupSchemas(groupedSchemas);
4810
+ return /* @__PURE__ */ jsx("div", {
4811
+ className: clsx(getContextMenuQuickGroupClusterClassName(sizeVariant), hasSeparator && borderBottomClassName),
4812
+ children: renderQuickLayoutGroup(mergedMenuSchema, startIndex, true)
4813
+ }, groupedSchemas.map((schema) => schema.key).join("-"));
4814
+ }
4743
4815
  if (menuSchema.item) return /* @__PURE__ */ jsx(ContextMenuMenuItem, {
4744
4816
  menuKey: menuSchema.key,
4745
4817
  menuItem: menuSchema.item,
@@ -4924,9 +4996,10 @@ function ContextMenuMenuItem(props) {
4924
4996
  const left = useLeft ? leftLeft : rightLeft;
4925
4997
  setSubmenuPlacement(useLeft ? "left" : "right");
4926
4998
  const maxTop = window.innerHeight - menuViewportPadding - submenuRect.height;
4999
+ const top = maxTop < menuViewportPadding ? menuViewportPadding : Math.min(Math.max(menuItemRect.top, menuViewportPadding), maxTop);
4927
5000
  setSubmenuPosition({
4928
5001
  left,
4929
- top: maxTop < menuViewportPadding ? menuViewportPadding : Math.min(Math.max(menuItemRect.top, menuViewportPadding), maxTop)
5002
+ top
4930
5003
  });
4931
5004
  setSubmenuPositionReady(true);
4932
5005
  };
@@ -4947,7 +5020,8 @@ function ContextMenuMenuItem(props) {
4947
5020
  const hiddenById = menuItem.id != null && hiddenItemIds.includes(menuItem.id) || hiddenItemIds.includes(menuKey);
4948
5021
  if (hidden || hiddenById) return null;
4949
5022
  const onChange = (v) => {
4950
- setInputValue(isRealNum(v) && typeof v === "string" ? Number.parseInt(v) : v);
5023
+ const newValue = isRealNum(v) && typeof v === "string" ? Number.parseInt(v) : v;
5024
+ setInputValue(newValue);
4951
5025
  };
4952
5026
  const onSubmenuOptionSelect = (option) => {
4953
5027
  onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect(option);
@@ -5087,8 +5161,7 @@ function ContextMenuMenuItem(props) {
5087
5161
  children: [hasSelectionSubmenu && /* @__PURE__ */ jsx("div", {
5088
5162
  className: sizeVariant === "paragraph-t" ? "univer-grid univer-gap-2" : "univer-grid univer-gap-1",
5089
5163
  children: selections.map((option, index) => {
5090
- var _option$label;
5091
- const optionKey = `${menuItem.id}-${(_option$label = option.label) !== null && _option$label !== void 0 ? _option$label : option.id}-${index}`;
5164
+ const optionKey = `${menuItem.id}-${option.label ?? option.id}-${index}`;
5092
5165
  const optionSelected = typeof inputValue !== "undefined" && String(inputValue) === String(option.value);
5093
5166
  const optionSelectable = !isNonSelectableLabel(option.label);
5094
5167
  const optionHoverable = !isNonHoverableLabel(option.label);
@@ -5101,13 +5174,12 @@ function ContextMenuMenuItem(props) {
5101
5174
  label: option.label,
5102
5175
  icon: option.icon,
5103
5176
  onChange: (optionValue) => {
5104
- var _option$commandId;
5105
5177
  onSubmenuOptionSelect === null || onSubmenuOptionSelect === void 0 || onSubmenuOptionSelect({
5106
5178
  ...option,
5107
5179
  value: optionValue,
5108
5180
  id: menuItem.id,
5109
5181
  label: menuKey,
5110
- commandId: (_option$commandId = option.commandId) !== null && _option$commandId !== void 0 ? _option$commandId : selectionsCommandId
5182
+ commandId: option.commandId ?? selectionsCommandId
5111
5183
  });
5112
5184
  }
5113
5185
  })
@@ -5117,12 +5189,11 @@ function ContextMenuMenuItem(props) {
5117
5189
  className: optionClassName,
5118
5190
  disabled: option.disabled,
5119
5191
  onClick: () => {
5120
- var _option$commandId2;
5121
5192
  onSubmenuOptionSelect === null || onSubmenuOptionSelect === void 0 || onSubmenuOptionSelect({
5122
5193
  ...option,
5123
5194
  id: menuItem.id,
5124
5195
  label: menuKey,
5125
- commandId: (_option$commandId2 = option.commandId) !== null && _option$commandId2 !== void 0 ? _option$commandId2 : selectionsCommandId
5196
+ commandId: option.commandId ?? selectionsCommandId
5126
5197
  });
5127
5198
  },
5128
5199
  children: optionContentNode
@@ -5154,11 +5225,11 @@ function ContextMenuMenuItem(props) {
5154
5225
  function useContextGroupHiddenStates$1(menuSchemas) {
5155
5226
  return useObservable(useMemo(() => {
5156
5227
  const groupStates = menuSchemas.flatMap((menuSchema) => {
5157
- var _menuSchema$children$, _menuSchema$children3;
5158
- const hiddenObservables = (_menuSchema$children$ = (_menuSchema$children3 = menuSchema.children) === null || _menuSchema$children3 === void 0 ? void 0 : _menuSchema$children3.map((childSchema) => {
5159
- var _childSchema$item$hid, _childSchema$item;
5160
- return (_childSchema$item$hid = (_childSchema$item = childSchema.item) === null || _childSchema$item === void 0 ? void 0 : _childSchema$item.hidden$) !== null && _childSchema$item$hid !== void 0 ? _childSchema$item$hid : of(false);
5161
- })) !== null && _menuSchema$children$ !== void 0 ? _menuSchema$children$ : [];
5228
+ var _menuSchema$children3;
5229
+ const hiddenObservables = ((_menuSchema$children3 = menuSchema.children) === null || _menuSchema$children3 === void 0 ? void 0 : _menuSchema$children3.map((childSchema) => {
5230
+ var _childSchema$item;
5231
+ return ((_childSchema$item = childSchema.item) === null || _childSchema$item === void 0 ? void 0 : _childSchema$item.hidden$) ?? of(false);
5232
+ })) ?? [];
5162
5233
  return hiddenObservables.length ? [combineLatest(hiddenObservables).pipe(map((values) => [menuSchema.key, values.every(Boolean)]))] : [];
5163
5234
  });
5164
5235
  return groupStates.length ? merge$1(...groupStates).pipe(scan((states, [key, hidden]) => ({
@@ -5331,7 +5402,7 @@ function DesktopContextMenu() {
5331
5402
  const { label: id, commandId, value } = params;
5332
5403
  const rawParams = typeof params.params === "function" ? params.params() : params.params;
5333
5404
  const commandParams = typeof rawParams === "undefined" ? { value } : rawParams;
5334
- if (activeCommandService) activeCommandService.executeCommand(commandId !== null && commandId !== void 0 ? commandId : id, commandParams);
5405
+ if (activeCommandService) activeCommandService.executeCommand(commandId ?? id, commandParams);
5335
5406
  activeLayoutService.focus();
5336
5407
  handleClose();
5337
5408
  }
@@ -5495,7 +5566,7 @@ function Sidebar() {
5495
5566
  })]
5496
5567
  }),
5497
5568
  /* @__PURE__ */ jsx("section", {
5498
- className: "univer-box-border univer-cursor-default univer-px-4",
5569
+ className: "univer-box-border univer-min-w-0 univer-cursor-default univer-px-4",
5499
5570
  children: options === null || options === void 0 ? void 0 : options.children
5500
5571
  }),
5501
5572
  (options === null || options === void 0 ? void 0 : options.footer) && /* @__PURE__ */ jsx("footer", {
@@ -5507,6 +5578,95 @@ function Sidebar() {
5507
5578
  });
5508
5579
  }
5509
5580
 
5581
+ //#endregion
5582
+ //#region src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
5583
+ function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
5584
+ const shimmerClassName = `
5585
+ univer-animate-pulse univer-bg-gray-100 motion-reduce:univer-animate-none
5586
+ dark:!univer-bg-gray-700
5587
+ `;
5588
+ const shimmerStyle = { animationDuration: "1.2s" };
5589
+ return /* @__PURE__ */ jsxs("div", {
5590
+ "aria-busy": "true",
5591
+ className: 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", {
5592
+ "univer-absolute univer-inset-0 univer-z-50": overlay,
5593
+ "univer-dark": darkMode
5594
+ }),
5595
+ dir: direction,
5596
+ children: [
5597
+ /* @__PURE__ */ jsxs("header", {
5598
+ "data-u-comp": "workbench-skeleton-toolbar",
5599
+ 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",
5600
+ children: [
5601
+ /* @__PURE__ */ jsx("div", {
5602
+ "data-u-comp": "workbench-skeleton-shimmer",
5603
+ className: clsx(shimmerClassName, "univer-h-4 univer-w-24 univer-rounded"),
5604
+ style: shimmerStyle
5605
+ }),
5606
+ /* @__PURE__ */ jsx("div", {
5607
+ "data-u-comp": "workbench-skeleton-shimmer",
5608
+ className: clsx(shimmerClassName, "univer-ml-2 univer-size-6 univer-rounded"),
5609
+ style: shimmerStyle
5610
+ }),
5611
+ /* @__PURE__ */ jsx("div", {
5612
+ "data-u-comp": "workbench-skeleton-shimmer",
5613
+ className: clsx(shimmerClassName, "univer-size-6 univer-rounded"),
5614
+ style: shimmerStyle
5615
+ })
5616
+ ]
5617
+ }),
5618
+ /* @__PURE__ */ jsxs("main", {
5619
+ "data-u-comp": "workbench-skeleton-content",
5620
+ className: "univer-flex univer-min-h-0 univer-min-w-0 univer-flex-1 univer-flex-col univer-gap-4 univer-p-4",
5621
+ children: [/* @__PURE__ */ jsx("div", {
5622
+ "data-u-comp": "workbench-skeleton-shimmer",
5623
+ className: clsx(shimmerClassName, "univer-h-4 univer-w-1/3 univer-rounded"),
5624
+ style: shimmerStyle
5625
+ }), /* @__PURE__ */ jsx("div", {
5626
+ "data-u-comp": "workbench-skeleton-shimmer",
5627
+ className: clsx(shimmerClassName, "univer-flex-1 univer-rounded-md"),
5628
+ style: shimmerStyle
5629
+ })]
5630
+ }),
5631
+ /* @__PURE__ */ jsxs("footer", {
5632
+ "data-u-comp": "workbench-skeleton-footer",
5633
+ 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",
5634
+ children: [/* @__PURE__ */ jsxs("div", {
5635
+ className: "univer-flex univer-items-center univer-gap-2",
5636
+ children: [/* @__PURE__ */ jsx("div", {
5637
+ "data-u-comp": "workbench-skeleton-shimmer",
5638
+ className: clsx(shimmerClassName, "univer-size-5 univer-rounded"),
5639
+ style: shimmerStyle
5640
+ }), /* @__PURE__ */ jsx("div", {
5641
+ "data-u-comp": "workbench-skeleton-shimmer",
5642
+ className: clsx(shimmerClassName, "univer-h-5 univer-w-14 univer-rounded"),
5643
+ style: shimmerStyle
5644
+ })]
5645
+ }), /* @__PURE__ */ jsxs("div", {
5646
+ className: "univer-flex univer-items-center univer-gap-2",
5647
+ children: [
5648
+ /* @__PURE__ */ jsx("div", {
5649
+ "data-u-comp": "workbench-skeleton-shimmer",
5650
+ className: clsx(shimmerClassName, "univer-size-5 univer-rounded"),
5651
+ style: shimmerStyle
5652
+ }),
5653
+ /* @__PURE__ */ jsx("div", {
5654
+ "data-u-comp": "workbench-skeleton-shimmer",
5655
+ className: clsx(shimmerClassName, "univer-h-2 univer-w-24 univer-rounded-full"),
5656
+ style: shimmerStyle
5657
+ }),
5658
+ /* @__PURE__ */ jsx("div", {
5659
+ "data-u-comp": "workbench-skeleton-shimmer",
5660
+ className: clsx(shimmerClassName, "univer-size-5 univer-rounded"),
5661
+ style: shimmerStyle
5662
+ })
5663
+ ]
5664
+ })]
5665
+ })
5666
+ ]
5667
+ });
5668
+ }
5669
+
5510
5670
  //#endregion
5511
5671
  //#region src/views/hooks/update-effect.ts
5512
5672
  /**
@@ -5710,9 +5870,10 @@ function mountDesktopWorkbench(injector, options, mountContainer, onRendered) {
5710
5870
  }), mountContainer);
5711
5871
  }
5712
5872
  function DesktopWorkbenchContent(props) {
5713
- var _uiConfig$popupRootId;
5714
5873
  const { header = true, toolbar = true, footer = true, headerMenu = true, contextMenu = true, ribbonType = "classic", mountContainer, onRendered } = props;
5715
5874
  const localeService = useDependency(LocaleService);
5875
+ const lifecycleService = useDependency(LifecycleService);
5876
+ const workbenchService = useDependency(IWorkbenchService);
5716
5877
  const themeService = useDependency(ThemeService);
5717
5878
  const themeSwitcherService = useDependency(ThemeSwitcherService);
5718
5879
  const contentRef = useRef(null);
@@ -5725,7 +5886,10 @@ function DesktopWorkbenchContent(props) {
5725
5886
  const leftSidebarComponents = useComponentsOfPart("left-sidebar");
5726
5887
  const globalComponents = useComponentsOfPart("global");
5727
5888
  const toolbarComponents = useComponentsOfPart("toolbar");
5728
- const popupRootId = (_uiConfig$popupRootId = uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) !== null && _uiConfig$popupRootId !== void 0 ? _uiConfig$popupRootId : "univer-popup-portal";
5889
+ const lifecycleStage = useObservable(lifecycleService.lifecycle$, lifecycleService.stage);
5890
+ const externalSkeletonVisible = useObservable(workbenchService.skeletonVisible$, void 0, true);
5891
+ const ready = lifecycleStage >= LifecycleStages.Ready;
5892
+ const popupRootId = (uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) ?? "univer-popup-portal";
5729
5893
  useLayoutEffect(() => {
5730
5894
  const sub = themeService.currentTheme$.subscribe((theme) => {
5731
5895
  themeSwitcherService.injectThemeToHead(theme);
@@ -5740,8 +5904,8 @@ function DesktopWorkbenchContent(props) {
5740
5904
  else document.documentElement.classList.remove("univer-dark");
5741
5905
  }, [darkMode]);
5742
5906
  useEffect(() => {
5743
- if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
5744
- }, [onRendered]);
5907
+ if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
5908
+ }, [ready, onRendered]);
5745
5909
  const locale = useObservable(() => localeService.localeChanged$.pipe(map(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
5746
5910
  const direction = useObservable(localeService.direction$, localeService.getDirection());
5747
5911
  const portalContainer = useMemo(() => document.createElement("div"), []);
@@ -5759,61 +5923,68 @@ function DesktopWorkbenchContent(props) {
5759
5923
  direction,
5760
5924
  mountContainer: portalContainer,
5761
5925
  children: [/* @__PURE__ */ jsxs("div", {
5762
- "data-u-comp": "workbench-layout",
5763
- className: clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
5764
- tabIndex: -1,
5765
- onBlur: (e) => e.stopPropagation(),
5766
- onContextMenu: (e) => e.preventDefault(),
5767
- dir: direction,
5768
- children: [
5769
- /* @__PURE__ */ jsx("div", {
5770
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
5771
- children: /* @__PURE__ */ jsx(ComponentContainer, { components: customHeaderComponents }, "custom-header")
5772
- }),
5773
- header && toolbar && /* @__PURE__ */ jsx("header", {
5774
- "data-u-comp": "headerbar",
5775
- className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
5776
- children: /* @__PURE__ */ jsx(ComponentContainer, {
5777
- components: toolbarComponents,
5778
- sharedProps: {
5779
- ribbonType,
5780
- headerMenuComponents,
5781
- headerMenu
5782
- }
5783
- }, "toolbar")
5784
- }),
5785
- /* @__PURE__ */ jsxs("section", {
5786
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
5787
- children: [/* @__PURE__ */ jsxs("div", {
5788
- className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
5789
- children: [
5790
- /* @__PURE__ */ jsx("aside", {
5791
- "data-u-comp": "left-sidebar",
5792
- className: "univer-h-full",
5793
- children: /* @__PURE__ */ jsx(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
5794
- }),
5795
- /* @__PURE__ */ jsxs("section", {
5796
- className: clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", borderBottomClassName),
5797
- children: [/* @__PURE__ */ jsx("header", { children: header && /* @__PURE__ */ jsx(ComponentContainer, { components: headerComponents }, "header") }), /* @__PURE__ */ jsx("section", {
5798
- className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
5799
- ref: contentRef,
5800
- "data-range-selector": true,
5801
- onContextMenu: (e) => e.preventDefault(),
5802
- children: /* @__PURE__ */ jsx(ComponentContainer, { components: contentComponents }, "content")
5803
- })]
5804
- }),
5805
- /* @__PURE__ */ jsx("aside", {
5806
- "data-u-comp": "right-sidebar",
5807
- className: "univer-z-[100] univer-h-full",
5808
- children: /* @__PURE__ */ jsx(Sidebar, {})
5809
- })
5810
- ]
5811
- }), footer && /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(ComponentContainer, {
5812
- components: footerComponents,
5813
- sharedProps: { contextMenu }
5814
- }, "footer") })]
5815
- })
5816
- ]
5926
+ className: "univer-relative univer-h-full univer-min-h-0",
5927
+ children: [/* @__PURE__ */ jsxs("div", {
5928
+ "data-u-comp": "workbench-layout",
5929
+ className: clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800", { "univer-dark": darkMode }),
5930
+ tabIndex: -1,
5931
+ onBlur: (e) => e.stopPropagation(),
5932
+ onContextMenu: (e) => e.preventDefault(),
5933
+ dir: direction,
5934
+ children: [
5935
+ /* @__PURE__ */ jsx("div", {
5936
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
5937
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: customHeaderComponents }, "custom-header")
5938
+ }),
5939
+ header && toolbar && /* @__PURE__ */ jsx("header", {
5940
+ "data-u-comp": "headerbar",
5941
+ className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
5942
+ children: /* @__PURE__ */ jsx(ComponentContainer, {
5943
+ components: toolbarComponents,
5944
+ sharedProps: {
5945
+ ribbonType,
5946
+ headerMenuComponents,
5947
+ headerMenu
5948
+ }
5949
+ }, "toolbar")
5950
+ }),
5951
+ /* @__PURE__ */ jsxs("section", {
5952
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
5953
+ children: [/* @__PURE__ */ jsxs("div", {
5954
+ className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
5955
+ children: [
5956
+ /* @__PURE__ */ jsx("aside", {
5957
+ "data-u-comp": "left-sidebar",
5958
+ className: "univer-h-full",
5959
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
5960
+ }),
5961
+ /* @__PURE__ */ jsxs("section", {
5962
+ className: clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", borderBottomClassName),
5963
+ children: [/* @__PURE__ */ jsx("header", { children: header && /* @__PURE__ */ jsx(ComponentContainer, { components: headerComponents }, "header") }), /* @__PURE__ */ jsx("section", {
5964
+ className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
5965
+ ref: contentRef,
5966
+ "data-range-selector": true,
5967
+ onContextMenu: (e) => e.preventDefault(),
5968
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: contentComponents }, "content")
5969
+ })]
5970
+ }),
5971
+ /* @__PURE__ */ jsx("aside", {
5972
+ "data-u-comp": "right-sidebar",
5973
+ className: "univer-z-[100] univer-h-full",
5974
+ children: /* @__PURE__ */ jsx(Sidebar, {})
5975
+ })
5976
+ ]
5977
+ }), footer && /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(ComponentContainer, {
5978
+ components: footerComponents,
5979
+ sharedProps: { contextMenu }
5980
+ }, "footer") })]
5981
+ })
5982
+ ]
5983
+ }), (!ready || externalSkeletonVisible) && /* @__PURE__ */ jsx(WorkbenchSkeleton, {
5984
+ darkMode,
5985
+ direction,
5986
+ overlay: true
5987
+ })]
5817
5988
  }), /* @__PURE__ */ jsxs("div", {
5818
5989
  dir: direction,
5819
5990
  children: [
@@ -5858,6 +6029,9 @@ var SingleUnitUIController = class extends Disposable {
5858
6029
  delete this._renderManagerService;
5859
6030
  }
5860
6031
  _bootstrapWorkbench() {
6032
+ var _this$_injector$get;
6033
+ const initialSkeleton = (_this$_injector$get = this._injector.get(IWorkbenchService, Quantity.OPTIONAL)) === null || _this$_injector$get === void 0 ? void 0 : _this$_injector$get.acquireSkeleton();
6034
+ if (initialSkeleton) this.disposeWithMe(initialSkeleton);
5861
6035
  this.disposeWithMe(this.bootstrap(async (contentElement, containerElement) => {
5862
6036
  if (this._layoutService) {
5863
6037
  this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement));
@@ -5868,6 +6042,7 @@ var SingleUnitUIController = class extends Disposable {
5868
6042
  this._renderTimeout = window.setTimeout(() => {
5869
6043
  const allRenders = this._renderManagerService.getRenderAll();
5870
6044
  for (const [key] of allRenders) if (this._changeRenderUnit(key, contentElement)) break;
6045
+ requestAnimationFrame(() => requestAnimationFrame(() => initialSkeleton === null || initialSkeleton === void 0 ? void 0 : initialSkeleton.dispose()));
5871
6046
  this.disposeWithMe(this._instanceService.focused$.subscribe((unit) => {
5872
6047
  if (unit) this._changeRenderUnit(unit, contentElement);
5873
6048
  }));
@@ -5895,9 +6070,9 @@ var SingleUnitUIController = class extends Disposable {
5895
6070
  var _this$_instanceServic2;
5896
6071
  if (this._currentRenderId === rendererId) return false;
5897
6072
  if ((_this$_instanceServic2 = this._instanceService.getUnitCreateOptions(rendererId)) === null || _this$_instanceServic2 === void 0 ? void 0 : _this$_instanceServic2.embeddedRender) return false;
5898
- const renderer = this._renderManagerService.getRenderById(rendererId);
6073
+ const renderer = this._renderManagerService.getRenderUnitById(rendererId);
5899
6074
  if (!renderer || !renderer.unitId || isInternalEditorID(renderer.unitId)) return false;
5900
- const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderById(this._currentRenderId) : null;
6075
+ const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderUnitById(this._currentRenderId) : null;
5901
6076
  currentRenderer === null || currentRenderer === void 0 || currentRenderer.deactivate();
5902
6077
  currentRenderer === null || currentRenderer === void 0 || currentRenderer.engine.unmount();
5903
6078
  renderer.engine.mount(contentElement);
@@ -5969,7 +6144,7 @@ const IUIController = createIdentifier("univer.ui.ui-controller");
5969
6144
  //#endregion
5970
6145
  //#region package.json
5971
6146
  var name = "@univerjs/ui";
5972
- var version = "1.0.0-alpha.7";
6147
+ var version = "1.0.0-beta.0";
5973
6148
 
5974
6149
  //#endregion
5975
6150
  //#region src/views/color-picker/interface.ts
@@ -6013,9 +6188,9 @@ const CommonLabel = (props) => {
6013
6188
  return /* @__PURE__ */ jsx("div", {
6014
6189
  className: "univer-truncate univer-text-sm",
6015
6190
  children: useMemo(() => {
6016
- var _selections$find$labe, _selections$find;
6191
+ var _selections$find;
6017
6192
  if (value == null) return "";
6018
- return localeService.t((_selections$find$labe = (_selections$find = selections.find((item) => item.value === value)) === null || _selections$find === void 0 ? void 0 : _selections$find.label) !== null && _selections$find$labe !== void 0 ? _selections$find$labe : "");
6193
+ return localeService.t(((_selections$find = selections.find((item) => item.value === value)) === null || _selections$find === void 0 ? void 0 : _selections$find.label) ?? "");
6019
6194
  }, [value, selections])
6020
6195
  });
6021
6196
  };
@@ -6051,10 +6226,9 @@ function ShortcutPanel() {
6051
6226
  const shortcuts = shortcutService.getAllShortcuts().filter((item) => !!item.group);
6052
6227
  const groupTitles = /* @__PURE__ */ new Map();
6053
6228
  for (const shortcut of shortcuts) {
6054
- var _shortcut$description;
6055
6229
  const group = shortcut.group;
6056
6230
  const shortcutItem = {
6057
- title: localeService.t((_shortcut$description = shortcut.description) !== null && _shortcut$description !== void 0 ? _shortcut$description : shortcut.id),
6231
+ title: localeService.t(shortcut.description ?? shortcut.id),
6058
6232
  shortcut: shortcutService.getShortcutDisplay(shortcut)
6059
6233
  };
6060
6234
  if (!/^\d+_/.test(group)) throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${group}!`);
@@ -6063,7 +6237,7 @@ function ShortcutPanel() {
6063
6237
  if (!shortcutGroups.has(group)) shortcutGroups.set(group, []);
6064
6238
  shortcutGroups.get(group).push(shortcutItem);
6065
6239
  }
6066
- setShortcutItems(Array.from(shortcutGroups.entries()).map(([name, items]) => {
6240
+ const toRender = Array.from(shortcutGroups.entries()).map(([name, items]) => {
6067
6241
  const groupSequence = name.split("_")[0];
6068
6242
  const localeKey = groupTitles.get(name);
6069
6243
  return {
@@ -6071,7 +6245,8 @@ function ShortcutPanel() {
6071
6245
  name: localeService.t(localeKey),
6072
6246
  items: dedupeBy(items, (item) => item.title + item.shortcut)
6073
6247
  };
6074
- }).sort((a, b) => a.sequence - b.sequence));
6248
+ }).sort((a, b) => a.sequence - b.sequence);
6249
+ setShortcutItems(toRender);
6075
6250
  }, [
6076
6251
  shortcutService,
6077
6252
  localeService,
@@ -20901,13 +21076,11 @@ function parseStoredRecentEmojis(value) {
20901
21076
  }
20902
21077
  }
20903
21078
  function getRandomEmoji(random = Math.random) {
20904
- var _allEmojis$Math$floor;
20905
21079
  const allEmojis = getAllEmojis();
20906
- return (_allEmojis$Math$floor = allEmojis[Math.floor(random() * allEmojis.length)]) !== null && _allEmojis$Math$floor !== void 0 ? _allEmojis$Math$floor : getDefaultRecentEmojis()[0];
21080
+ return allEmojis[Math.floor(random() * allEmojis.length)] ?? getDefaultRecentEmojis()[0];
20907
21081
  }
20908
21082
  function getLocalizedEmojiTitle(item, emojiTitles) {
20909
- var _emojiTitles$item$emo;
20910
- return (_emojiTitles$item$emo = emojiTitles === null || emojiTitles === void 0 ? void 0 : emojiTitles[item.emoji]) !== null && _emojiTitles$item$emo !== void 0 ? _emojiTitles$item$emo : item.title;
21083
+ return (emojiTitles === null || emojiTitles === void 0 ? void 0 : emojiTitles[item.emoji]) ?? item.title;
20911
21084
  }
20912
21085
  function getEmojiLocaleData(localeService) {
20913
21086
  const localePack = localeService.getLocales();
@@ -20930,37 +21103,54 @@ function normalizeStoredRecentEmojis(value) {
20930
21103
  const EMOJI_PICKER_COMPONENT = "ui.emoji-picker";
20931
21104
  const RECENTS_STORAGE_KEY = "univer.ui.recent-emojis";
20932
21105
  const ACTIVE_SECTION_SCROLL_OFFSET = 28;
21106
+ const EMOJI_COLUMN_COUNT = 10;
21107
+ const EMOJI_ROW_HEIGHT = 32;
21108
+ const EMOJI_SECTION_HEADER_HEIGHT = 24;
21109
+ const EMOJI_VIRTUAL_OVERSCAN = 3;
20933
21110
  function EmojiPicker(props) {
20934
- var _props$popup, _extraProps$recentSto;
21111
+ var _props$popup;
20935
21112
  const extraProps = (_props$popup = props.popup) === null || _props$popup === void 0 ? void 0 : _props$popup.extraProps;
20936
21113
  const localeService = useDependency(LocaleService);
20937
21114
  const localStorageService = useDependency(ILocalStorageService);
20938
21115
  const currentLocale = useObservable(localeService.currentLocale$, localeService.getCurrentLocale());
20939
- const scrollRef = useRef(null);
20940
- const sectionRefs = useRef({});
21116
+ const scrollRef = useRef(void 0);
21117
+ const pendingSectionRef = useRef(null);
20941
21118
  const [query, setQuery] = useState("");
20942
21119
  const [activeEmoji, setActiveEmoji] = useState(extraProps === null || extraProps === void 0 ? void 0 : extraProps.activeEmoji);
20943
21120
  const [activeTab, setActiveTab] = useState("recent");
20944
21121
  const [recents, setRecents] = useState(() => getDefaultRecentEmojis());
20945
21122
  const deferredQuery = useDeferredValue(query);
20946
- const emojiLocaleData = useMemo(() => getEmojiLocaleData(localeService), [currentLocale, localeService]);
21123
+ const emojiLocaleData = getEmojiLocaleData(localeService);
20947
21124
  const searchResults = useMemo(() => searchEmojis(deferredQuery, emojiLocaleData.emojiSearchIndex), [deferredQuery, emojiLocaleData]);
20948
- const recentStorageKey = (_extraProps$recentSto = extraProps === null || extraProps === void 0 ? void 0 : extraProps.recentStorageKey) !== null && _extraProps$recentSto !== void 0 ? _extraProps$recentSto : RECENTS_STORAGE_KEY;
21125
+ const recentStorageKey = (extraProps === null || extraProps === void 0 ? void 0 : extraProps.recentStorageKey) ?? RECENTS_STORAGE_KEY;
20949
21126
  const isSearching = deferredQuery.trim().length > 0;
20950
- const normalSections = [{
20951
- key: "recent",
20952
- title: localeService.t("ui.emojiPicker.recents"),
20953
- emojis: recents
20954
- }, ...EMOJI_CATEGORIES.map((category) => ({
20955
- key: category.key,
20956
- title: localeService.t(category.titleKey),
20957
- emojis: emojis[category.key]
20958
- }))];
20959
- const renderedSections = (isSearching ? [{
20960
- key: "people",
20961
- title: localeService.t("ui.emojiPicker.searchResults"),
20962
- emojis: searchResults
20963
- }] : normalSections).filter((section) => section.emojis.length);
21127
+ const { rows, sectionPositions } = useMemo(() => {
21128
+ const normalSections = [{
21129
+ key: "recent",
21130
+ title: localeService.t("ui.emojiPicker.recents"),
21131
+ emojis: recents
21132
+ }, ...EMOJI_CATEGORIES.map((category) => ({
21133
+ key: category.key,
21134
+ title: localeService.t(category.titleKey),
21135
+ emojis: emojis[category.key]
21136
+ }))];
21137
+ return createEmojiVirtualRows(isSearching ? [{
21138
+ key: "people",
21139
+ title: localeService.t("ui.emojiPicker.searchResults"),
21140
+ emojis: searchResults
21141
+ }] : normalSections, currentLocale);
21142
+ }, [
21143
+ currentLocale,
21144
+ isSearching,
21145
+ localeService,
21146
+ recents,
21147
+ searchResults
21148
+ ]);
21149
+ const [virtualRows, { containerProps, scrollTo, wrapperStyle }] = useVirtualList(rows, {
21150
+ containerTarget: scrollRef,
21151
+ itemHeight: getEmojiVirtualRowHeight,
21152
+ overscan: EMOJI_VIRTUAL_OVERSCAN
21153
+ });
20964
21154
  useEffect(() => {
20965
21155
  let disposed = false;
20966
21156
  localStorageService.getItem(recentStorageKey).then((storedRecents) => {
@@ -20970,6 +21160,17 @@ function EmojiPicker(props) {
20970
21160
  disposed = true;
20971
21161
  };
20972
21162
  }, [localStorageService, recentStorageKey]);
21163
+ useEffect(() => {
21164
+ const pendingSection = pendingSectionRef.current;
21165
+ if (isSearching || !pendingSection) return;
21166
+ const position = sectionPositions.find((item) => item.key === pendingSection);
21167
+ if (position) scrollTo(position.rowIndex);
21168
+ pendingSectionRef.current = null;
21169
+ }, [
21170
+ isSearching,
21171
+ scrollTo,
21172
+ sectionPositions
21173
+ ]);
20973
21174
  const handleSelect = (item, options) => {
20974
21175
  var _props$onChange, _extraProps$onSelect;
20975
21176
  const nextRecents = promoteRecentEmoji(recents, item);
@@ -20983,16 +21184,19 @@ function EmojiPicker(props) {
20983
21184
  handleSelect(getRandomEmoji(), { keepOpen: true });
20984
21185
  };
20985
21186
  const handleScroll = (event) => {
21187
+ containerProps.onScroll(event);
20986
21188
  if (isSearching) return;
20987
- setActiveTab(getActiveSectionByScrollTop(normalSections, sectionRefs.current, event.currentTarget.scrollTop));
21189
+ setActiveTab(getActiveSectionByScrollTop(sectionPositions, event.currentTarget.scrollTop));
20988
21190
  };
20989
21191
  const scrollToSection = (section) => {
20990
21192
  setQuery("");
20991
21193
  setActiveTab(section);
20992
- requestAnimationFrame(() => {
20993
- const sectionElement = sectionRefs.current[section];
20994
- if (scrollRef.current && sectionElement) scrollRef.current.scrollTop = sectionElement.offsetTop;
20995
- });
21194
+ const position = sectionPositions.find((item) => item.key === section);
21195
+ if (!isSearching && position) {
21196
+ scrollTo(position.rowIndex);
21197
+ return;
21198
+ }
21199
+ pendingSectionRef.current = section;
20996
21200
  };
20997
21201
  return /* @__PURE__ */ jsxs("section", {
20998
21202
  "data-u-comp": EMOJI_PICKER_COMPONENT,
@@ -21020,17 +21224,19 @@ function EmojiPicker(props) {
21020
21224
  ref: scrollRef,
21021
21225
  className: clsx("univer-relative univer-min-h-0 univer-flex-1 univer-overflow-y-auto univer-px-3", scrollbarClassName),
21022
21226
  onScroll: handleScroll,
21023
- children: renderedSections.length ? /* @__PURE__ */ jsx("div", {
21024
- className: "univer-flex univer-flex-col univer-gap-1.5 univer-pb-2",
21025
- children: renderedSections.map((section) => /* @__PURE__ */ jsx(EmojiSectionView, {
21227
+ children: rows.length ? /* @__PURE__ */ jsx("div", {
21228
+ style: wrapperStyle,
21229
+ children: virtualRows.map(({ data: row }) => row.type === "header" ? /* @__PURE__ */ jsx("div", {
21230
+ style: { height: EMOJI_SECTION_HEADER_HEIGHT },
21231
+ className: "univer-flex univer-items-center univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
21232
+ children: row.title
21233
+ }, row.key) : /* @__PURE__ */ jsx(EmojiGrid, {
21026
21234
  activeEmoji,
21027
21235
  emojiTitles: emojiLocaleData.emojiTitles,
21028
- section,
21029
- onSelect: handleSelect,
21030
- refElement: (element) => {
21031
- sectionRefs.current[section.key] = element;
21032
- }
21033
- }, section.key))
21236
+ items: row.items,
21237
+ keyPrefix: row.key,
21238
+ onSelect: handleSelect
21239
+ }, row.key))
21034
21240
  }) : /* @__PURE__ */ jsx("div", {
21035
21241
  className: "univer-py-7 univer-text-center univer-text-sm univer-text-gray-400 dark:!univer-text-gray-500",
21036
21242
  children: localeService.t("ui.emojiPicker.noResults")
@@ -21040,12 +21246,12 @@ function EmojiPicker(props) {
21040
21246
  className: clsx("univer-flex univer-h-10 univer-shrink-0 univer-items-center univer-border-gray-200 univer-px-2.5 dark:!univer-border-gray-600 [&_svg]:univer-size-5", borderTopClassName),
21041
21247
  children: [/* @__PURE__ */ jsx(CategoryButton, {
21042
21248
  selected: !isSearching && activeTab === "recent",
21043
- titleKey: "ui.emojiPicker.recents",
21249
+ title: localeService.t("ui.emojiPicker.recents"),
21044
21250
  onClick: () => scrollToSection("recent"),
21045
21251
  children: /* @__PURE__ */ jsx(RecentIcon, {})
21046
21252
  }), EMOJI_CATEGORIES.map((category) => /* @__PURE__ */ jsx(CategoryButton, {
21047
21253
  selected: !isSearching && activeTab === category.key,
21048
- titleKey: category.titleKey,
21254
+ title: localeService.t(category.titleKey),
21049
21255
  onClick: () => scrollToSection(category.key),
21050
21256
  children: /* @__PURE__ */ jsx(CategoryIcon, { category: category.key })
21051
21257
  }, category.key))]
@@ -21053,25 +21259,10 @@ function EmojiPicker(props) {
21053
21259
  ]
21054
21260
  });
21055
21261
  }
21056
- function EmojiSectionView(props) {
21057
- return /* @__PURE__ */ jsxs("section", {
21058
- ref: props.refElement,
21059
- className: "univer-flex univer-flex-col univer-gap-1",
21060
- children: [/* @__PURE__ */ jsx("div", {
21061
- className: "univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
21062
- children: props.section.title
21063
- }), /* @__PURE__ */ jsx(EmojiGrid, {
21064
- activeEmoji: props.activeEmoji,
21065
- emojiTitles: props.emojiTitles,
21066
- items: props.section.emojis,
21067
- keyPrefix: props.section.key,
21068
- onSelect: props.onSelect
21069
- })]
21070
- });
21071
- }
21072
21262
  function EmojiGrid(props) {
21073
21263
  return /* @__PURE__ */ jsx("div", {
21074
21264
  className: "univer-grid univer-grid-cols-10 univer-justify-between univer-gap-1",
21265
+ style: { height: EMOJI_ROW_HEIGHT },
21075
21266
  children: props.items.map((item) => {
21076
21267
  const title = getLocalizedEmojiTitle(item, props.emojiTitles);
21077
21268
  return /* @__PURE__ */ jsx("button", {
@@ -21086,12 +21277,11 @@ function EmojiGrid(props) {
21086
21277
  });
21087
21278
  }
21088
21279
  function CategoryButton(props) {
21089
- const localeService = useDependency(LocaleService);
21090
21280
  return /* @__PURE__ */ jsx("button", {
21091
21281
  type: "button",
21092
- "aria-label": localeService.t(props.titleKey),
21282
+ "aria-label": props.title,
21093
21283
  "aria-selected": props.selected,
21094
- title: localeService.t(props.titleKey),
21284
+ title: props.title,
21095
21285
  className: clsx("univer-flex univer-h-[30px] univer-flex-1 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-lg univer-border-0 univer-bg-transparent univer-p-0 univer-text-gray-500 dark:!univer-text-gray-400", props.selected ? "univer-bg-primary-50 univer-text-primary-500 dark:!univer-bg-gray-800 dark:!univer-text-primary-400" : "hover:univer-bg-gray-50 hover:univer-text-gray-700 dark:hover:!univer-bg-gray-800 dark:hover:!univer-text-gray-300"),
21096
21286
  onClick: props.onClick,
21097
21287
  children: props.children
@@ -21100,11 +21290,44 @@ function CategoryButton(props) {
21100
21290
  function writeRecents(localStorageService, storageKey, recents) {
21101
21291
  localStorageService.setItem(storageKey, recents).catch(() => void 0);
21102
21292
  }
21103
- function getActiveSectionByScrollTop(sections, sectionElements, scrollTop) {
21104
- let active = "recent";
21293
+ function createEmojiVirtualRows(sections, locale) {
21294
+ const rows = [];
21295
+ const sectionPositions = [];
21296
+ let top = 0;
21105
21297
  sections.forEach((section) => {
21106
- const element = sectionElements[section.key];
21107
- if (element && element.offsetTop <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = section.key;
21298
+ if (!section.emojis.length) return;
21299
+ sectionPositions.push({
21300
+ key: section.key,
21301
+ rowIndex: rows.length,
21302
+ top
21303
+ });
21304
+ rows.push({
21305
+ key: `${locale}-${section.key}-header`,
21306
+ title: section.title,
21307
+ type: "header"
21308
+ });
21309
+ top += EMOJI_SECTION_HEADER_HEIGHT;
21310
+ for (let start = 0; start < section.emojis.length; start += EMOJI_COLUMN_COUNT) {
21311
+ rows.push({
21312
+ items: section.emojis.slice(start, start + EMOJI_COLUMN_COUNT),
21313
+ key: `${locale}-${section.key}-${start / EMOJI_COLUMN_COUNT}`,
21314
+ type: "emojis"
21315
+ });
21316
+ top += EMOJI_ROW_HEIGHT;
21317
+ }
21318
+ });
21319
+ return {
21320
+ rows,
21321
+ sectionPositions
21322
+ };
21323
+ }
21324
+ function getEmojiVirtualRowHeight(_index, row) {
21325
+ return row.type === "header" ? EMOJI_SECTION_HEADER_HEIGHT : EMOJI_ROW_HEIGHT;
21326
+ }
21327
+ function getActiveSectionByScrollTop(sectionPositions, scrollTop) {
21328
+ let active = "recent";
21329
+ sectionPositions.forEach((position) => {
21330
+ if (position.top <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = position.key;
21108
21331
  });
21109
21332
  return active;
21110
21333
  }
@@ -21329,8 +21552,7 @@ let FontService = class FontService {
21329
21552
  constructor(_configService) {
21330
21553
  this._configService = _configService;
21331
21554
  _defineProperty(this, "fonts$", new BehaviorSubject([]));
21332
- const config = this._configService.getConfig(UI_PLUGIN_CONFIG_KEY);
21333
- const { customFontFamily } = config !== null && config !== void 0 ? config : {};
21555
+ const { customFontFamily } = this._configService.getConfig("ui.config") ?? {};
21334
21556
  let fonts = [];
21335
21557
  if (customFontFamily) if (Array.isArray(customFontFamily)) fonts = [...DEFAULT_FONT_LIST, ...customFontFamily];
21336
21558
  else if (customFontFamily.override) fonts = [...customFontFamily.list];
@@ -21434,7 +21656,7 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
21434
21656
  fonts,
21435
21657
  localeService
21436
21658
  ]);
21437
- const inputValue = draftValue !== null && draftValue !== void 0 ? draftValue : viewValue;
21659
+ const inputValue = draftValue ?? viewValue;
21438
21660
  function resetValue() {
21439
21661
  setDraftValue(null);
21440
21662
  }
@@ -21562,8 +21784,8 @@ function FontFamilyDropdown(props) {
21562
21784
  const FontSize = (props) => {
21563
21785
  const { value, min, max, onChange, disabled$ } = props;
21564
21786
  const disabled = useObservable(disabled$);
21565
- const [realValue, setRealValue] = useState(Number(value !== null && value !== void 0 ? value : 0));
21566
- const _value = useMemo(() => Number(value !== null && value !== void 0 ? value : realValue), [value]);
21787
+ const [realValue, setRealValue] = useState(Number(value ?? 0));
21788
+ const _value = useMemo(() => Number(value ?? realValue), [value]);
21567
21789
  function handleChange(value) {
21568
21790
  if (value === null) return;
21569
21791
  setRealValue(value);
@@ -21690,7 +21912,7 @@ const FONT_SIZE_COMPONENT = "UI_FONT_SIZE_COMPONENT";
21690
21912
  //#endregion
21691
21913
  //#region src/views/HeadingItem.tsx
21692
21914
  const HeadingItem = (props) => {
21693
- var _style$cl$rgb, _style$cl;
21915
+ var _style$cl;
21694
21916
  const { value, text } = props;
21695
21917
  const style = NAMED_STYLE_MAP[value];
21696
21918
  const localeService = useDependency(LocaleService);
@@ -21698,7 +21920,7 @@ const HeadingItem = (props) => {
21698
21920
  className: clsx("univer-text-sm", { "univer-font-bold": style === null || style === void 0 ? void 0 : style.bl }),
21699
21921
  style: {
21700
21922
  fontSize: style === null || style === void 0 ? void 0 : style.fs,
21701
- color: (_style$cl$rgb = style === null || style === void 0 || (_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) !== null && _style$cl$rgb !== void 0 ? _style$cl$rgb : void 0
21923
+ color: (style === null || style === void 0 || (_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) ?? void 0
21702
21924
  },
21703
21925
  children: localeService.t(text)
21704
21926
  });
@@ -21804,7 +22026,6 @@ const DRAG_COMMIT_INTERVAL = 50;
21804
22026
  * Slider Component
21805
22027
  */
21806
22028
  function Slider(props) {
21807
- var _getSliderOffset;
21808
22029
  const iconManager = useDependency(IconManager);
21809
22030
  const localeService = useDependency(LocaleService);
21810
22031
  const { value, min = 0, max = 400, disabled = false, resetPoint = 100, shortcuts, onChange } = props;
@@ -21915,7 +22136,7 @@ function Slider(props) {
21915
22136
  window.addEventListener("pointerout", onPointerOut);
21916
22137
  }
21917
22138
  const visualValue = isDragging ? dragValue : value;
21918
- const sliderOffset = Math.min(Math.max((_getSliderOffset = getSliderOffset(visualValue)) !== null && _getSliderOffset !== void 0 ? _getSliderOffset : 0, 0), 100);
22139
+ const sliderOffset = Math.min(Math.max(getSliderOffset(visualValue) ?? 0, 0), 100);
21919
22140
  const handleOffset = isRtl ? 100 - sliderOffset : sliderOffset;
21920
22141
  const ReduceIcon = iconManager.get("ReduceIcon");
21921
22142
  const IncreaseIcon = iconManager.get("IncreaseIcon");
@@ -22296,7 +22517,6 @@ FeatureSearchController = __decorate([__decorateParam(0, ICommandService), __dec
22296
22517
  //#region src/views/components/ribbon/MobileRibbon.tsx
22297
22518
  const toolbarScrollOffset = 168;
22298
22519
  function MobileRibbon(props) {
22299
- var _activeGroup$children;
22300
22520
  const { headerMenuComponents, headerMenu = true } = props;
22301
22521
  const localeService = useDependency(LocaleService);
22302
22522
  const ribbonService = useDependency(IRibbonService);
@@ -22307,7 +22527,7 @@ function MobileRibbon(props) {
22307
22527
  return index === -1 ? 0 : index;
22308
22528
  }, [activatedTab, ribbon]);
22309
22529
  const activeGroup = ribbon[activeIndex];
22310
- const activeGroups = (_activeGroup$children = activeGroup === null || activeGroup === void 0 ? void 0 : activeGroup.children) !== null && _activeGroup$children !== void 0 ? _activeGroup$children : [];
22530
+ const activeGroups = (activeGroup === null || activeGroup === void 0 ? void 0 : activeGroup.children) ?? [];
22311
22531
  const hasHeaderMenu = !!(headerMenu && headerMenuComponents && headerMenuComponents.size > 0);
22312
22532
  const toolbarScrollRef = useRef(null);
22313
22533
  const [canScrollLeft, setCanScrollLeft] = useState(false);
@@ -22428,8 +22648,8 @@ function MobileRibbon(props) {
22428
22648
  "data-u-comp": "mobile-ribbon-toolbar",
22429
22649
  className: "univer-flex univer-min-w-0 univer-items-center univer-gap-1.5 univer-overflow-x-auto univer-scroll-smooth univer-px-0.5 [&::-webkit-scrollbar]:univer-hidden",
22430
22650
  children: activeGroups.map((groupItem, groupIndex) => {
22431
- var _groupItem$children$f, _groupItem$children;
22432
- const groupItems = (_groupItem$children$f = (_groupItem$children = groupItem.children) === null || _groupItem$children === void 0 ? void 0 : _groupItem$children.filter((child) => !!child.item)) !== null && _groupItem$children$f !== void 0 ? _groupItem$children$f : [];
22651
+ var _groupItem$children;
22652
+ const groupItems = ((_groupItem$children = groupItem.children) === null || _groupItem$children === void 0 ? void 0 : _groupItem$children.filter((child) => !!child.item)) ?? [];
22433
22653
  if (!groupItems.length) return null;
22434
22654
  return /* @__PURE__ */ jsx("div", {
22435
22655
  className: clsx("univer-flex univer-shrink-0 univer-items-center univer-gap-0.5 univer-pr-1.5 rtl:univer-pl-1.5 rtl:univer-pr-0", { [borderRightClassName]: groupIndex !== activeGroups.length - 1 }),
@@ -22460,11 +22680,10 @@ function MobileRibbon(props) {
22460
22680
  //#endregion
22461
22681
  //#region src/views/menu/mobile/MobileMenu.tsx
22462
22682
  function MobileMenu(props) {
22463
- var _viewStack;
22464
22683
  const { menuType, onOptionSelect, schemas: providedSchemas, menuManagerService: providedMenuManagerService } = props;
22465
22684
  const rootMenuManagerService = useDependency(IMenuManagerService);
22466
22685
  const localeService = useDependency(LocaleService);
22467
- const menuManagerService = providedMenuManagerService !== null && providedMenuManagerService !== void 0 ? providedMenuManagerService : rootMenuManagerService;
22686
+ const menuManagerService = providedMenuManagerService ?? rootMenuManagerService;
22468
22687
  const [viewStack, setViewStack] = useState([]);
22469
22688
  const menuSchemas = useMemo(() => {
22470
22689
  if (providedSchemas) return providedSchemas;
@@ -22481,7 +22700,7 @@ function MobileMenu(props) {
22481
22700
  useEffect(() => {
22482
22701
  setViewStack([]);
22483
22702
  }, [menuType, providedSchemas]);
22484
- const currentView = (_viewStack = viewStack[viewStack.length - 1]) !== null && _viewStack !== void 0 ? _viewStack : null;
22703
+ const currentView = viewStack[viewStack.length - 1] ?? null;
22485
22704
  if (!menuType && !providedSchemas) return null;
22486
22705
  const openView = (view) => setViewStack((stack) => [...stack, view]);
22487
22706
  const closeView = () => setViewStack((stack) => stack.slice(0, -1));
@@ -22609,24 +22828,20 @@ function MobileSchemaRow(props) {
22609
22828
  function MobileSelectionOptionsView(props) {
22610
22829
  const { options, menuKey, menuItem, currentValue, inheritedDisabled$, onExecute } = props;
22611
22830
  const inheritedDisabled = useObservable(inheritedDisabled$, false);
22612
- return /* @__PURE__ */ jsx(Fragment$1, { children: options.map((option, index) => {
22613
- var _option$value;
22614
- return /* @__PURE__ */ jsx(MobileSelectionOptionRow, {
22615
- option,
22616
- menuKey,
22617
- menuItem,
22618
- currentValue,
22619
- disabled: inheritedDisabled,
22620
- bordered: index !== options.length - 1,
22621
- onExecute
22622
- }, `${menuKey}-${String((_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : index)}`);
22623
- }) });
22831
+ return /* @__PURE__ */ jsx(Fragment$1, { children: options.map((option, index) => /* @__PURE__ */ jsx(MobileSelectionOptionRow, {
22832
+ option,
22833
+ menuKey,
22834
+ menuItem,
22835
+ currentValue,
22836
+ disabled: inheritedDisabled,
22837
+ bordered: index !== options.length - 1,
22838
+ onExecute
22839
+ }, `${menuKey}-${String(option.value ?? index)}`)) });
22624
22840
  }
22625
22841
  function MobileSelectionOptionRow(props) {
22626
- var _option$value2;
22627
22842
  const { option, menuKey, menuItem, currentValue, disabled, bordered, onExecute } = props;
22628
22843
  const optionValue = useObservable(option.value$);
22629
- const displayValue = (_option$value2 = option.value) !== null && _option$value2 !== void 0 ? _option$value2 : optionValue;
22844
+ const displayValue = option.value ?? optionValue;
22630
22845
  const selected = displayValue === currentValue;
22631
22846
  const optionDisabled = disabled || Boolean(option.disabled);
22632
22847
  return /* @__PURE__ */ jsxs("button", {
@@ -22655,7 +22870,6 @@ function MobileSelectionOptionRow(props) {
22655
22870
  });
22656
22871
  }
22657
22872
  function useMobileSchemaInteraction(props) {
22658
- var _schema$children3;
22659
22873
  const { schema, menuManagerService, menuType, onOpenView, inheritedDisabled$ } = props;
22660
22874
  const localeService = useDependency(LocaleService);
22661
22875
  const menuItem = schema.item;
@@ -22682,7 +22896,7 @@ function useMobileSchemaInteraction(props) {
22682
22896
  return menuManagerService.getMenuByPositionKey(menuItem.id);
22683
22897
  }, [menuItem, menuManagerService]);
22684
22898
  if (!menuItem) return null;
22685
- const schemaChildren = (_schema$children3 = schema.children) !== null && _schema$children3 !== void 0 ? _schema$children3 : [];
22899
+ const schemaChildren = schema.children ?? [];
22686
22900
  const hasSubmenu = schemaChildren.length > 0 || selections.length > 0 || subMenuItems.length > 0;
22687
22901
  const currentValueText = typeof value === "string" || typeof value === "number" ? String(value) : "";
22688
22902
  const onPress = (onExecute) => {
@@ -22749,8 +22963,8 @@ function useContextGroupHiddenStates(menuSchemas) {
22749
22963
  const groupStates = menuSchemas.flatMap((menuSchema) => {
22750
22964
  var _menuSchema$children;
22751
22965
  const hiddenObservables = ((_menuSchema$children = menuSchema.children) === null || _menuSchema$children === void 0 ? void 0 : _menuSchema$children.length) ? getLeafItemSchemas(menuSchema.children).map((childSchema) => {
22752
- var _childSchema$item$hid, _childSchema$item;
22753
- return (_childSchema$item$hid = (_childSchema$item = childSchema.item) === null || _childSchema$item === void 0 ? void 0 : _childSchema$item.hidden$) !== null && _childSchema$item$hid !== void 0 ? _childSchema$item$hid : of(false);
22966
+ var _childSchema$item;
22967
+ return ((_childSchema$item = childSchema.item) === null || _childSchema$item === void 0 ? void 0 : _childSchema$item.hidden$) ?? of(false);
22754
22968
  }) : [];
22755
22969
  return hiddenObservables.length ? [combineLatest(hiddenObservables).pipe(map((values) => [menuSchema.key, values.every(Boolean)]))] : [];
22756
22970
  });
@@ -22762,8 +22976,8 @@ function useContextGroupHiddenStates(menuSchemas) {
22762
22976
  }
22763
22977
  function getLeafItemSchemas(schemas) {
22764
22978
  return schemas.reduce((acc, schema) => {
22765
- var _schema$children4;
22766
- if ((_schema$children4 = schema.children) === null || _schema$children4 === void 0 ? void 0 : _schema$children4.length) return [...acc, ...getLeafItemSchemas(schema.children)];
22979
+ var _schema$children3;
22980
+ if ((_schema$children3 = schema.children) === null || _schema$children3 === void 0 ? void 0 : _schema$children3.length) return [...acc, ...getLeafItemSchemas(schema.children)];
22767
22981
  if (schema.item) return [...acc, schema];
22768
22982
  return acc;
22769
22983
  }, []);
@@ -22831,8 +23045,7 @@ function MobileContextMenu() {
22831
23045
  menuType,
22832
23046
  menuManagerService: (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(IMenuManagerService)) ? activeScope.get(IMenuManagerService) : menuManagerService,
22833
23047
  onOptionSelect: (params) => {
22834
- var _ref, _params$commandId;
22835
- const commandId = (_ref = (_params$commandId = params.commandId) !== null && _params$commandId !== void 0 ? _params$commandId : params.id) !== null && _ref !== void 0 ? _ref : params.label;
23048
+ const commandId = params.commandId ?? params.id ?? params.label;
22836
23049
  const fallbackParams = typeof params.params === "function" ? params.params() : params.params;
22837
23050
  const commandParams = typeof params.value === "undefined" ? fallbackParams : { value: params.value };
22838
23051
  if (!commandId) return;
@@ -22891,6 +23104,8 @@ function mountMobileWorkbench(injector, options, mountContainer, onRendered) {
22891
23104
  function MobileWorkbench(props) {
22892
23105
  const { header = true, toolbar = true, footer = true, headerMenu = true, ribbonType = "classic", contextMenu = true, mountContainer, onRendered } = props;
22893
23106
  const localeService = useDependency(LocaleService);
23107
+ const lifecycleService = useDependency(LifecycleService);
23108
+ const workbenchService = useDependency(IWorkbenchService);
22894
23109
  const themeService = useDependency(ThemeService);
22895
23110
  const themeSwitcherService = useDependency(ThemeSwitcherService);
22896
23111
  const contentRef = useRef(null);
@@ -22902,9 +23117,12 @@ function MobileWorkbench(props) {
22902
23117
  const globalComponents = useComponentsOfPart("global");
22903
23118
  const toolbarComponents = useComponentsOfPart("toolbar");
22904
23119
  const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
23120
+ const lifecycleStage = useObservable(lifecycleService.lifecycle$, lifecycleService.stage);
23121
+ const externalSkeletonVisible = useObservable(workbenchService.skeletonVisible$, void 0, true);
23122
+ const ready = lifecycleStage >= LifecycleStages.Ready;
22905
23123
  useEffect(() => {
22906
- if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
22907
- }, [onRendered]);
23124
+ if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
23125
+ }, [ready, onRendered]);
22908
23126
  const locale = useObservable(() => localeService.localeChanged$.pipe(map(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
22909
23127
  const direction = useObservable(localeService.direction$, localeService.getDirection());
22910
23128
  const portalContainer = useMemo(() => document.createElement("div"), []);
@@ -22930,51 +23148,58 @@ function MobileWorkbench(props) {
22930
23148
  direction,
22931
23149
  mountContainer: portalContainer,
22932
23150
  children: [/* @__PURE__ */ jsxs("div", {
22933
- "data-u-comp": "app-layout",
22934
- className: 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 }),
22935
- tabIndex: -1,
22936
- onBlur: (e) => e.stopPropagation(),
22937
- onContextMenu: (e) => e.preventDefault(),
22938
- dir: direction,
22939
- children: [header && toolbar && /* @__PURE__ */ jsx("header", {
22940
- "data-u-comp": "headerbar",
22941
- className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
22942
- children: /* @__PURE__ */ jsx(ComponentContainer, {
22943
- components: toolbarComponents,
22944
- sharedProps: {
22945
- ribbonType,
22946
- headerMenuComponents,
22947
- headerMenu
22948
- }
22949
- }, "toolbar")
22950
- }), /* @__PURE__ */ jsxs("section", {
22951
- className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
22952
- children: [/* @__PURE__ */ jsxs("div", {
22953
- className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
22954
- children: [
22955
- /* @__PURE__ */ jsx("aside", {
22956
- className: "univer-h-full",
22957
- children: /* @__PURE__ */ jsx(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
22958
- }),
22959
- /* @__PURE__ */ jsxs("section", {
22960
- className: clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", borderBottomClassName),
22961
- children: [/* @__PURE__ */ jsx("header", {
22962
- className: "univer-w-screen",
22963
- children: header && /* @__PURE__ */ jsx(ComponentContainer, { components: headerComponents }, "header")
22964
- }), /* @__PURE__ */ jsx("section", {
22965
- ref: contentRef,
22966
- className: "univer-relative univer-overflow-hidden",
22967
- "data-range-selector": true,
22968
- onContextMenu: (e) => e.preventDefault(),
22969
- children: /* @__PURE__ */ jsx(ComponentContainer, { components: contentComponents }, "content")
22970
- })]
22971
- }),
22972
- /* @__PURE__ */ jsx("aside", {
22973
- className: "univer-h-full",
22974
- children: /* @__PURE__ */ jsx(Sidebar, {})
22975
- })
22976
- ]
22977
- }), footer && /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(ComponentContainer, { components: footerComponents }, "footer") })]
23151
+ className: "univer-relative univer-h-full univer-min-h-0",
23152
+ children: [/* @__PURE__ */ jsxs("div", {
23153
+ "data-u-comp": "app-layout",
23154
+ className: 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 }),
23155
+ tabIndex: -1,
23156
+ onBlur: (e) => e.stopPropagation(),
23157
+ onContextMenu: (e) => e.preventDefault(),
23158
+ dir: direction,
23159
+ children: [header && toolbar && /* @__PURE__ */ jsx("header", {
23160
+ "data-u-comp": "headerbar",
23161
+ className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
23162
+ children: /* @__PURE__ */ jsx(ComponentContainer, {
23163
+ components: toolbarComponents,
23164
+ sharedProps: {
23165
+ ribbonType,
23166
+ headerMenuComponents,
23167
+ headerMenu
23168
+ }
23169
+ }, "toolbar")
23170
+ }), /* @__PURE__ */ jsxs("section", {
23171
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
23172
+ children: [/* @__PURE__ */ jsxs("div", {
23173
+ className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
23174
+ children: [
23175
+ /* @__PURE__ */ jsx("aside", {
23176
+ className: "univer-h-full",
23177
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
23178
+ }),
23179
+ /* @__PURE__ */ jsxs("section", {
23180
+ className: clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800", borderBottomClassName),
23181
+ children: [/* @__PURE__ */ jsx("header", {
23182
+ className: "univer-w-screen",
23183
+ children: header && /* @__PURE__ */ jsx(ComponentContainer, { components: headerComponents }, "header")
23184
+ }), /* @__PURE__ */ jsx("section", {
23185
+ ref: contentRef,
23186
+ className: "univer-relative univer-overflow-hidden",
23187
+ "data-range-selector": true,
23188
+ onContextMenu: (e) => e.preventDefault(),
23189
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: contentComponents }, "content")
23190
+ })]
23191
+ }),
23192
+ /* @__PURE__ */ jsx("aside", {
23193
+ className: "univer-h-full",
23194
+ children: /* @__PURE__ */ jsx(Sidebar, {})
23195
+ })
23196
+ ]
23197
+ }), footer && /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(ComponentContainer, { components: footerComponents }, "footer") })]
23198
+ })]
23199
+ }), (!ready || externalSkeletonVisible) && /* @__PURE__ */ jsx(WorkbenchSkeleton, {
23200
+ darkMode,
23201
+ direction,
23202
+ overlay: true
22978
23203
  })]
22979
23204
  }), /* @__PURE__ */ jsxs("div", {
22980
23205
  dir: direction,
@@ -23273,7 +23498,7 @@ let BrowserClipboardService = class BrowserClipboardService extends Disposable {
23273
23498
  return await navigator.clipboard.write([new ClipboardItem({
23274
23499
  [PLAIN_TEXT_CLIPBOARD_MIME_TYPE]: new Blob([text], { type: PLAIN_TEXT_CLIPBOARD_MIME_TYPE }),
23275
23500
  [HTML_CLIPBOARD_MIME_TYPE]: new Blob([html], { type: HTML_CLIPBOARD_MIME_TYPE }),
23276
- ...Object.fromEntries(Object.entries(customData !== null && customData !== void 0 ? customData : {}).map(([type, value]) => [type, new Blob([value], { type })]))
23501
+ ...Object.fromEntries(Object.entries(customData ?? {}).map(([type, value]) => [type, new Blob([value], { type })]))
23277
23502
  })]);
23278
23503
  } catch (error) {
23279
23504
  if (customData && Object.keys(customData).length) try {
@@ -23410,10 +23635,7 @@ function serializeSanitizedHtmlForClipboard(html) {
23410
23635
  return container.innerHTML;
23411
23636
  }
23412
23637
  function sanitizeHtmlNode(node) {
23413
- if (node.nodeType === Node.TEXT_NODE) {
23414
- var _node$textContent;
23415
- return document.createTextNode((_node$textContent = node.textContent) !== null && _node$textContent !== void 0 ? _node$textContent : "");
23416
- }
23638
+ if (node.nodeType === Node.TEXT_NODE) return document.createTextNode(node.textContent ?? "");
23417
23639
  if (node.nodeType !== Node.ELEMENT_NODE) return null;
23418
23640
  const sourceElement = node;
23419
23641
  const tagName = sourceElement.tagName.toLowerCase();
@@ -23742,11 +23964,10 @@ DesktopGalleryService = __decorate([__decorateParam(0, Inject(Injector)), __deco
23742
23964
  var DesktopLocalFileService = class extends Disposable {
23743
23965
  openFile(options) {
23744
23966
  return new Promise((resolve) => {
23745
- var _options$accept, _options$multiple;
23746
23967
  const inputElement = document.createElement("input");
23747
23968
  inputElement.type = "file";
23748
- inputElement.accept = (_options$accept = options === null || options === void 0 ? void 0 : options.accept) !== null && _options$accept !== void 0 ? _options$accept : "";
23749
- inputElement.multiple = (_options$multiple = options === null || options === void 0 ? void 0 : options.multiple) !== null && _options$multiple !== void 0 ? _options$multiple : false;
23969
+ inputElement.accept = (options === null || options === void 0 ? void 0 : options.accept) ?? "";
23970
+ inputElement.multiple = (options === null || options === void 0 ? void 0 : options.multiple) ?? false;
23750
23971
  inputElement.onchange = (event) => {
23751
23972
  const fileList = event.target.files;
23752
23973
  if (fileList) resolve(Array.from(fileList));
@@ -23828,10 +24049,7 @@ var IndexedDBDriver = class {
23828
24049
  const store = await this._store("readonly");
23829
24050
  return new Promise((resolve, reject) => {
23830
24051
  const req = store.get(key);
23831
- req.onsuccess = () => {
23832
- var _req$result;
23833
- return resolve((_req$result = req.result) !== null && _req$result !== void 0 ? _req$result : null);
23834
- };
24052
+ req.onsuccess = () => resolve(req.result ?? null);
23835
24053
  req.onerror = () => reject(req.error);
23836
24054
  });
23837
24055
  }
@@ -23939,8 +24157,7 @@ var LocalStorageDriver = class {
23939
24157
  toRemove.forEach((k) => localStorage.removeItem(k));
23940
24158
  }
23941
24159
  async key(index) {
23942
- var _keys$index;
23943
- return (_keys$index = this._keys()[index]) !== null && _keys$index !== void 0 ? _keys$index : null;
24160
+ return this._keys()[index] ?? null;
23944
24161
  }
23945
24162
  async keys() {
23946
24163
  return this._keys();
@@ -24041,8 +24258,7 @@ let DesktopMessageService = class DesktopMessageService extends Disposable {
24041
24258
  removeMessage();
24042
24259
  }
24043
24260
  show(options) {
24044
- var _options$id;
24045
- const id = (_options$id = options.id) !== null && _options$id !== void 0 ? _options$id : `message-${Date.now()}-${messageId}`;
24261
+ const id = options.id ?? `message-${Date.now()}-${messageId}`;
24046
24262
  messageId += 1;
24047
24263
  message(Object.assign({}, options, { id }));
24048
24264
  return toDisposable(() => removeMessage(id));
@@ -24188,6 +24404,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends Plugin {
24188
24404
  [IconManager],
24189
24405
  [ComponentsController],
24190
24406
  [ThemeSwitcherService],
24407
+ [IWorkbenchService, { useClass: WorkbenchService }],
24191
24408
  [ZIndexManager],
24192
24409
  [ShortcutPanelService],
24193
24410
  [IUIPartsService, { useClass: UIPartsService }],
@@ -24293,6 +24510,7 @@ let UniverUIPlugin = class UniverUIPlugin extends Plugin {
24293
24510
  [ZIndexManager],
24294
24511
  [ShortcutPanelService],
24295
24512
  [IUIPartsService, { useClass: UIPartsService }],
24513
+ [IWorkbenchService, { useClass: WorkbenchService }],
24296
24514
  [ILayoutService, { useClass: DesktopLayoutService }],
24297
24515
  [IRibbonService, { useClass: DesktopRibbonService }],
24298
24516
  [IRibbonOverrideService, { useClass: RibbonOverrideService }],
@@ -24468,8 +24686,7 @@ function handleDomToJson($dom) {
24468
24686
  let span = nodeList[`${i}`];
24469
24687
  let str;
24470
24688
  if (span.nodeName === "#text") {
24471
- var _span$textContent;
24472
- str = (_span$textContent = span.textContent) !== null && _span$textContent !== void 0 ? _span$textContent : "";
24689
+ str = span.textContent ?? "";
24473
24690
  span = span.parentElement;
24474
24691
  } else str = span.innerText;
24475
24692
  const textStyle = handleStringToStyle(span);
@@ -24501,8 +24718,8 @@ function handleDomToJson($dom) {
24501
24718
  * @returns
24502
24719
  */
24503
24720
  function handleStringToStyle($dom, cssStyle = "") {
24504
- var _$dom$style$cssText, _$dom$style;
24505
- let cssText = (_$dom$style$cssText = $dom === null || $dom === void 0 || (_$dom$style = $dom.style) === null || _$dom$style === void 0 ? void 0 : _$dom$style.cssText) !== null && _$dom$style$cssText !== void 0 ? _$dom$style$cssText : "";
24721
+ var _$dom$style;
24722
+ let cssText = ($dom === null || $dom === void 0 || (_$dom$style = $dom.style) === null || _$dom$style === void 0 ? void 0 : _$dom$style.cssText) ?? "";
24506
24723
  cssText += cssStyle;
24507
24724
  cssText = cssText.replace(/[\r\n]+/g, "");
24508
24725
  if (cssText.length === 0) return {};
@@ -24522,8 +24739,10 @@ function handleStringToStyle($dom, cssStyle = "") {
24522
24739
  else styleList.bl = 0;
24523
24740
  else if (key === "font-style") if (value === "italic") styleList.it = 1;
24524
24741
  else styleList.it = 0;
24525
- else if (key === "font-family") styleList.ff = extractFontFamily(textTrim(originStr));
24526
- 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") {
24527
24746
  let fs = Number.parseInt(value);
24528
24747
  if (cssText.indexOf("vertical-align") > -1 && (cssText.indexOf("sub") > -1 || cssText.indexOf("sup") > -1)) fs *= 2;
24529
24748
  if (value.indexOf("px") !== -1) fs = getPtFontSizeByPx(Number.parseInt(value, 10));
@@ -24850,10 +25069,9 @@ function handelTableToJson(table) {
24850
25069
  while (c < colLen && data[r][c] != null) c++;
24851
25070
  if (c === colLen) return;
24852
25071
  if (data[r][c] == null) {
24853
- var _Number, _Number2;
24854
25072
  data[r][c] = cell;
24855
- const rowSpan = (_Number = Number(td.getAttribute("rowSpan"))) !== null && _Number !== void 0 ? _Number : 1;
24856
- const colSpan = (_Number2 = Number(td.getAttribute("colSpan"))) !== null && _Number2 !== void 0 ? _Number2 : 1;
25073
+ const rowSpan = Number(td.getAttribute("rowSpan")) ?? 1;
25074
+ const colSpan = Number(td.getAttribute("colSpan")) ?? 1;
24857
25075
  if (rowSpan > 1 || colSpan > 1) {
24858
25076
  const first = {
24859
25077
  rs: +rowSpan - 1,
@@ -24960,10 +25178,9 @@ function handelExcelToJson(html) {
24960
25178
  while (c < colLen && data[r][c] != null) c++;
24961
25179
  if (c === colLen) return;
24962
25180
  if (data[r][c] == null) {
24963
- var _Number3, _Number4;
24964
25181
  data[r][c] = cell;
24965
- const rowSpan = (_Number3 = Number(td.getAttribute("rowSpan"))) !== null && _Number3 !== void 0 ? _Number3 : 1;
24966
- const colSpan = (_Number4 = Number(td.getAttribute("colSpan"))) !== null && _Number4 !== void 0 ? _Number4 : 1;
25182
+ const rowSpan = Number(td.getAttribute("rowSpan")) ?? 1;
25183
+ const colSpan = Number(td.getAttribute("colSpan")) ?? 1;
24967
25184
  if (rowSpan > 1 || colSpan > 1) {
24968
25185
  const first = {
24969
25186
  rs: +rowSpan - 1,
@@ -25020,21 +25237,20 @@ const PrintFloatDomSingle = memo((props) => {
25020
25237
  });
25021
25238
  });
25022
25239
  function RegisteredPrintFloatDomSingle(props) {
25023
- const componentManager = useDependency$1(ComponentManager);
25240
+ const componentManager = useDependency(ComponentManager);
25024
25241
  return /* @__PURE__ */ jsx(PrintFloatDomSingleContent, {
25025
25242
  ...props,
25026
25243
  Component: componentManager.get(props.componentKey)
25027
25244
  });
25028
25245
  }
25029
25246
  function PrintFloatDomSingleContent(props) {
25030
- var _position$startY, _position$startX;
25031
25247
  const { layer, id, position, Component } = props;
25032
- const univerInstanceService = useDependency$1(IUniverInstanceService);
25248
+ const univerInstanceService = useDependency(IUniverInstanceService);
25033
25249
  const domRef = useRef(null);
25034
25250
  const innerDomRef = useRef(null);
25035
25251
  const transformRef = useRef(`transform: rotate(${position === null || position === void 0 ? void 0 : position.rotate}deg) translate(${position === null || position === void 0 ? void 0 : position.startX}px, ${position === null || position === void 0 ? void 0 : position.startY}px)`);
25036
- const topRef = useRef((_position$startY = position === null || position === void 0 ? void 0 : position.startY) !== null && _position$startY !== void 0 ? _position$startY : 0);
25037
- const leftRef = useRef((_position$startX = position === null || position === void 0 ? void 0 : position.startX) !== null && _position$startX !== void 0 ? _position$startX : 0);
25252
+ const topRef = useRef((position === null || position === void 0 ? void 0 : position.startY) ?? 0);
25253
+ const leftRef = useRef((position === null || position === void 0 ? void 0 : position.startX) ?? 0);
25038
25254
  const layerProps = useMemo(() => ({
25039
25255
  data: layer.data,
25040
25256
  ...layer.props
@@ -25174,4 +25390,4 @@ function ProgressBar(props) {
25174
25390
  }
25175
25391
 
25176
25392
  //#endregion
25177
- export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomPreviewService, CanvasFloatDomService, CanvasPopup, CanvasPopupService, CommonLabel, ComponentContainer, ComponentManager, DesktopContextMenu as ContextMenu, ContextMenuGroup, ContextMenuHostService, ContextMenuPanel, ContextMenuPosition, ContextMenuService, CopyCommand, CopyShortcutItem, CustomLabel, CutCommand, CutShortcutItem, DISABLE_AUTO_FOCUS_KEY, DesktopBeforeCloseService, DesktopConfirmService, DesktopDialogService, DesktopGalleryService, DesktopLayoutService, DesktopLocalFileService, DesktopLocalStorageService, DesktopMessageService, DesktopNotificationService, DesktopRibbonService, DesktopSidebarService, DesktopUIController, EMBED_CHILD_UNIT_ID_ATTRIBUTE, EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, EMOJI_CATEGORIES, EMOJI_PICKER_COMPONENT, EMOJI_RECENT_LIMIT, EmojiPicker, ErrorController, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE_SVG_XML_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, FloatDom, FloatDomSingle, FontFamily, FontFamilyDropdown, FontFamilyItem, FontService, FontSize, HEADING_ITEM_COMPONENT, HEADING_LIST, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonOverrideService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IUIRuntimeScopeService, IconManager, KeyCode, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileContextMenu, MockMessageService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonOverrideService, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SYMBOL_CATEGORIES, SYMBOL_PICKER_COMPONENT, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, SymbolPicker, ThemeSwitcherService, ToggleFullscreenOperation, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UIRuntimeScopeService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoShortcutItem, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, ZIndexManager, ZoomInput, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmbedBoundaryOwner, getEmbedChildUnitId, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, isEmbedBoundaryTarget, keepInteractionInsideSameEmbedBoundary, mergeMenuConfigs, parseHtmlDocument, parseHtmlFragment, parseStoredRecentEmojis, promoteRecentEmoji, sanitizeParsedHtml, searchEmojis, splitSpanText, supportClipboardAPI, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };
25393
+ export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomPreviewService, CanvasFloatDomService, CanvasPopup, CanvasPopupService, CommonLabel, ComponentContainer, ComponentManager, DesktopContextMenu as ContextMenu, ContextMenuGroup, ContextMenuHostService, ContextMenuPanel, ContextMenuPosition, ContextMenuService, CopyCommand, CopyShortcutItem, CustomLabel, CutCommand, CutShortcutItem, DISABLE_AUTO_FOCUS_KEY, DesktopBeforeCloseService, DesktopConfirmService, DesktopDialogService, DesktopGalleryService, DesktopLayoutService, DesktopLocalFileService, DesktopLocalStorageService, DesktopMessageService, DesktopNotificationService, DesktopRibbonService, DesktopSidebarService, DesktopUIController, EMBED_CHILD_UNIT_ID_ATTRIBUTE, EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, EMOJI_CATEGORIES, EMOJI_PICKER_COMPONENT, EMOJI_RECENT_LIMIT, EmojiPicker, ErrorController, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE_SVG_XML_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, FloatDom, FloatDomSingle, FontFamily, FontFamilyDropdown, FontFamilyItem, FontService, FontSize, HEADING_ITEM_COMPONENT, HEADING_LIST, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonOverrideService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IUIRuntimeScopeService, IWorkbenchService, IconManager, KeyCode, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileContextMenu, MockMessageService, NativeTextEditorShortcutBehavior, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonOverrideService, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SYMBOL_CATEGORIES, SYMBOL_PICKER_COMPONENT, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, SymbolPicker, ThemeSwitcherService, ToggleFullscreenOperation, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UIRuntimeScopeService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoShortcutItem, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, WorkbenchService, ZIndexManager, ZoomInput, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmbedBoundaryOwner, getEmbedChildUnitId, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, isEmbedBoundaryTarget, keepInteractionInsideSameEmbedBoundary, mergeMenuConfigs, parseHtmlDocument, parseHtmlFragment, parseStoredRecentEmojis, promoteRecentEmoji, sanitizeParsedHtml, searchEmojis, splitSpanText, supportClipboardAPI, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };