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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,7 +1,7 @@
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
7
  import { RediConsumer, RediContext, RediProvider, WithDependency, connectDependencies, connectInjector, useDependency, useDependency as useDependency$1, useInjector, useObservable, useUpdateBinder } from "@wendellhu/redi/react-bindings";
@@ -57,7 +57,7 @@ function getAttributeValue(target, name) {
57
57
  }
58
58
 
59
59
  //#endregion
60
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
60
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
61
61
  function _typeof(o) {
62
62
  "@babel/helpers - typeof";
63
63
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -68,7 +68,7 @@ function _typeof(o) {
68
68
  }
69
69
 
70
70
  //#endregion
71
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
71
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
72
72
  function toPrimitive(t, r) {
73
73
  if ("object" != _typeof(t) || !t) return t;
74
74
  var e = t[Symbol.toPrimitive];
@@ -81,14 +81,14 @@ function toPrimitive(t, r) {
81
81
  }
82
82
 
83
83
  //#endregion
84
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
84
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
85
85
  function toPropertyKey(t) {
86
86
  var i = toPrimitive(t, "string");
87
87
  return "symbol" == _typeof(i) ? i : i + "";
88
88
  }
89
89
 
90
90
  //#endregion
91
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
91
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
92
92
  function _defineProperty(e, r, t) {
93
93
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
94
94
  value: t,
@@ -99,7 +99,7 @@ function _defineProperty(e, r, t) {
99
99
  }
100
100
 
101
101
  //#endregion
102
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
102
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
103
103
  function __decorateParam(paramIndex, decorator) {
104
104
  return function(target, key) {
105
105
  decorator(target, key, paramIndex);
@@ -107,7 +107,7 @@ function __decorateParam(paramIndex, decorator) {
107
107
  }
108
108
 
109
109
  //#endregion
110
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
110
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
111
111
  function __decorate(decorators, target, key, desc) {
112
112
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
113
113
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -859,6 +859,15 @@ var UIRuntimeScopeService = class extends Disposable {
859
859
  //#endregion
860
860
  //#region src/services/shortcut/shortcut.service.ts
861
861
  /**
862
+ * Defines whether a Univer shortcut should yield to the browser's native behavior
863
+ * when the keyboard event originates from an editable text element.
864
+ */
865
+ let NativeTextEditorShortcutBehavior = /* @__PURE__ */ function(NativeTextEditorShortcutBehavior) {
866
+ NativeTextEditorShortcutBehavior[NativeTextEditorShortcutBehavior["ALLOW_NATIVE"] = 0] = "ALLOW_NATIVE";
867
+ NativeTextEditorShortcutBehavior[NativeTextEditorShortcutBehavior["OVERRIDE_NATIVE"] = 1] = "OVERRIDE_NATIVE";
868
+ return NativeTextEditorShortcutBehavior;
869
+ }({});
870
+ /**
862
871
  * The dependency injection identifier of the {@link IShortcutService}.
863
872
  */
864
873
  const IShortcutService = createIdentifier("ui.shortcut.service");
@@ -949,17 +958,18 @@ let ShortcutService = class ShortcutService extends Disposable {
949
958
  if (this._layoutService && !this._layoutService.checkElementInCurrentContainers(e.target)) return;
950
959
  const binding = this._deriveBindingFromEvent(e);
951
960
  if (binding === null) return;
952
- if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding)) return;
953
961
  const shortcuts = this._shortCutMapping.get(binding);
954
962
  if (shortcuts === void 0) return;
955
963
  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) => {
964
+ const candidateShortcut = Array.from(shortcuts).sort((s1, s2) => {
957
965
  var _s2$priority, _s1$priority;
958
966
  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
967
  }).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;
968
+ var _s$eventPreconditions, _s$eventPreconditions2, _s$preconditions, _s$preconditions2;
969
+ return ((_s$eventPreconditions = (_s$eventPreconditions2 = s.eventPreconditions) === null || _s$eventPreconditions2 === void 0 ? void 0 : _s$eventPreconditions2.call(s, e)) !== null && _s$eventPreconditions !== void 0 ? _s$eventPreconditions : true) && ((_s$preconditions = (_s$preconditions2 = s.preconditions) === null || _s$preconditions2 === void 0 ? void 0 : _s$preconditions2.call(s, contextService)) !== null && _s$preconditions !== void 0 ? _s$preconditions : true);
962
970
  });
971
+ if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding) && (candidateShortcut === null || candidateShortcut === void 0 ? void 0 : candidateShortcut.nativeTextEditorBehavior) !== 1) return;
972
+ return candidateShortcut;
963
973
  }
964
974
  _getBindingFromItem(item) {
965
975
  if (this._platformService.isMac && item.mac) return item.mac;
@@ -1938,6 +1948,7 @@ var UIPartsService = class extends Disposable {
1938
1948
  constructor(..._args) {
1939
1949
  super(..._args);
1940
1950
  _defineProperty(this, "_componentsByPart", /* @__PURE__ */ new Map());
1951
+ _defineProperty(this, "_disabledUIParts", /* @__PURE__ */ new Map());
1941
1952
  _defineProperty(this, "_componentRegistered$", new Subject());
1942
1953
  _defineProperty(this, "componentRegistered$", this._componentRegistered$.asObservable());
1943
1954
  _defineProperty(this, "_uiVisible", /* @__PURE__ */ new Map());
@@ -1947,20 +1958,55 @@ var UIPartsService = class extends Disposable {
1947
1958
  dispose() {
1948
1959
  super.dispose();
1949
1960
  this._componentsByPart.clear();
1961
+ this._disabledUIParts.clear();
1950
1962
  this._uiVisible.clear();
1951
1963
  this._componentRegistered$.complete();
1952
1964
  this._uiVisibleChange$.complete();
1953
1965
  }
1954
1966
  setUIVisible(part, visible) {
1967
+ const wasVisible = this.isUIVisible(part);
1955
1968
  this._uiVisible.set(part, visible);
1956
- this._uiVisibleChange$.next({
1969
+ const isVisible = this.isUIVisible(part);
1970
+ if (wasVisible !== isVisible) this._uiVisibleChange$.next({
1957
1971
  ui: part,
1958
- visible
1972
+ visible: isVisible
1959
1973
  });
1960
1974
  }
1961
1975
  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;
1976
+ var _this$_uiVisible$get, _this$_disabledUIPart;
1977
+ return ((_this$_uiVisible$get = this._uiVisible.get(part)) !== null && _this$_uiVisible$get !== void 0 ? _this$_uiVisible$get : true) && !((_this$_disabledUIPart = this._disabledUIParts.get(part)) === null || _this$_disabledUIPart === void 0 ? void 0 : _this$_disabledUIPart.size);
1978
+ }
1979
+ registerDisabledUIParts(parts, disabled$) {
1980
+ const uniqueParts = [...new Set(parts)];
1981
+ const registration = Symbol("disabled-ui-parts");
1982
+ let disabled = false;
1983
+ const update = (nextDisabled) => {
1984
+ if (disabled === nextDisabled) return;
1985
+ disabled = nextDisabled;
1986
+ uniqueParts.forEach((part) => {
1987
+ var _this$_disabledUIPart2;
1988
+ const wasVisible = this.isUIVisible(part);
1989
+ const registrations = (_this$_disabledUIPart2 = this._disabledUIParts.get(part)) !== null && _this$_disabledUIPart2 !== void 0 ? _this$_disabledUIPart2 : /* @__PURE__ */ new Set();
1990
+ if (disabled) {
1991
+ registrations.add(registration);
1992
+ this._disabledUIParts.set(part, registrations);
1993
+ } else {
1994
+ registrations.delete(registration);
1995
+ if (registrations.size === 0) this._disabledUIParts.delete(part);
1996
+ }
1997
+ const isVisible = this.isUIVisible(part);
1998
+ if (wasVisible !== isVisible) this._uiVisibleChange$.next({
1999
+ ui: part,
2000
+ visible: isVisible
2001
+ });
2002
+ });
2003
+ };
2004
+ const subscription = disabled$.subscribe(update);
2005
+ const disposable = toDisposable(() => {
2006
+ subscription.unsubscribe();
2007
+ update(false);
2008
+ });
2009
+ return this.disposeWithMe(disposable);
1964
2010
  }
1965
2011
  registerComponent(part, componentFactory) {
1966
2012
  const componentType = componentFactory();
@@ -2718,24 +2764,21 @@ function placeRibbonGridItems(items) {
2718
2764
  const occupied = /* @__PURE__ */ new Set();
2719
2765
  const placements = /* @__PURE__ */ new Map();
2720
2766
  const fallbackItems = [];
2721
- let maxExplicitColumn = 0;
2722
2767
  for (const item of items) {
2723
2768
  var _layout$rowSpan, _layout$columnSpan, _layout$showLabel;
2724
2769
  const layout = item.gridLayout;
2725
2770
  if (!layout) {
2726
- fallbackItems.push(item);
2771
+ fallbackItems.push({ item });
2727
2772
  continue;
2728
2773
  }
2729
2774
  const rowSpan = (_layout$rowSpan = layout.rowSpan) !== null && _layout$rowSpan !== void 0 ? _layout$rowSpan : 1;
2730
2775
  const columnSpan = (_layout$columnSpan = layout.columnSpan) !== null && _layout$columnSpan !== void 0 ? _layout$columnSpan : 1;
2731
2776
  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);
2777
+ if (!isValidGridGeometry(layout, rowSpan, cells)) {
2778
+ fallbackItems.push({ item });
2734
2779
  continue;
2735
2780
  }
2736
- cells.forEach((cell) => occupied.add(cell));
2737
- maxExplicitColumn = Math.max(maxExplicitColumn, layout.column + columnSpan - 1);
2738
- placements.set(item, {
2781
+ const placement = {
2739
2782
  item,
2740
2783
  row: layout.row,
2741
2784
  column: layout.column,
@@ -2744,27 +2787,49 @@ function placeRibbonGridItems(items) {
2744
2787
  showLabel: (_layout$showLabel = layout.showLabel) !== null && _layout$showLabel !== void 0 ? _layout$showLabel : false,
2745
2788
  width: layout.width,
2746
2789
  iconSize: layout.iconSize
2747
- });
2790
+ };
2791
+ if (cells.some((cell) => occupied.has(cell))) {
2792
+ fallbackItems.push({
2793
+ item,
2794
+ layout: placement
2795
+ });
2796
+ continue;
2797
+ }
2798
+ cells.forEach((cell) => occupied.add(cell));
2799
+ placements.set(item, placement);
2748
2800
  }
2749
- let fallbackRow = 1;
2750
- let fallbackColumn = maxExplicitColumn + 1;
2751
- for (const item of fallbackItems) {
2801
+ for (const { item, layout } of fallbackItems) {
2802
+ var _layout$rowSpan2, _layout$columnSpan2, _layout$showLabel2;
2803
+ const rowSpan = (_layout$rowSpan2 = layout === null || layout === void 0 ? void 0 : layout.rowSpan) !== null && _layout$rowSpan2 !== void 0 ? _layout$rowSpan2 : 1;
2804
+ const columnSpan = (_layout$columnSpan2 = layout === null || layout === void 0 ? void 0 : layout.columnSpan) !== null && _layout$columnSpan2 !== void 0 ? _layout$columnSpan2 : 1;
2805
+ const { row, column, cells } = findFirstAvailableCells(occupied, rowSpan, columnSpan);
2806
+ cells.forEach((cell) => occupied.add(cell));
2752
2807
  placements.set(item, {
2753
2808
  item,
2754
- row: fallbackRow,
2755
- column: fallbackColumn,
2756
- rowSpan: 1,
2757
- columnSpan: 1,
2758
- showLabel: false
2809
+ row,
2810
+ column,
2811
+ rowSpan,
2812
+ columnSpan,
2813
+ showLabel: (_layout$showLabel2 = layout === null || layout === void 0 ? void 0 : layout.showLabel) !== null && _layout$showLabel2 !== void 0 ? _layout$showLabel2 : false,
2814
+ width: layout === null || layout === void 0 ? void 0 : layout.width,
2815
+ iconSize: layout === null || layout === void 0 ? void 0 : layout.iconSize
2759
2816
  });
2760
- fallbackRow += 1;
2761
- if (fallbackRow > RIBBON_GRID_ROWS) {
2762
- fallbackRow = 1;
2763
- fallbackColumn += 1;
2764
- }
2765
2817
  }
2766
2818
  return items.map((item) => placements.get(item));
2767
2819
  }
2820
+ function isValidGridGeometry(layout, rowSpan, cells) {
2821
+ 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);
2822
+ }
2823
+ function findFirstAvailableCells(occupied, rowSpan, columnSpan) {
2824
+ for (let column = 1;; column++) for (let row = 1; row + rowSpan - 1 <= RIBBON_GRID_ROWS; row++) {
2825
+ const cells = getCells(row, column, rowSpan, columnSpan);
2826
+ if (cells.every((cell) => !occupied.has(cell))) return {
2827
+ row,
2828
+ column,
2829
+ cells
2830
+ };
2831
+ }
2832
+ }
2768
2833
  function getCells(row, column, rowSpan, columnSpan) {
2769
2834
  if (![
2770
2835
  row,
@@ -3106,7 +3171,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
3106
3171
  return menuItems.filter((item) => {
3107
3172
  var _item$key;
3108
3173
  if (!item.children) return !hiddenStates[item.key];
3109
- return !hiddenStates[((_item$key = item.key) === null || _item$key === void 0 ? void 0 : _item$key.toString()) || ""];
3174
+ const itemKey = ((_item$key = item.key) === null || _item$key === void 0 ? void 0 : _item$key.toString()) || "";
3175
+ return !hiddenStates[itemKey];
3110
3176
  });
3111
3177
  }, [menuItems, hiddenStates]);
3112
3178
  function handleVisibleChange(visible) {
@@ -3855,6 +3921,33 @@ var ThemeSwitcherService = class extends Disposable {
3855
3921
  }
3856
3922
  };
3857
3923
 
3924
+ //#endregion
3925
+ //#region src/services/workbench/workbench.service.ts
3926
+ const IWorkbenchService = createIdentifier("univer.ui.workbench.service");
3927
+ var WorkbenchService = class extends Disposable {
3928
+ constructor(..._args) {
3929
+ super(..._args);
3930
+ _defineProperty(this, "_tokens", /* @__PURE__ */ new Set());
3931
+ _defineProperty(this, "_skeletonVisible$", new BehaviorSubject(false));
3932
+ _defineProperty(this, "skeletonVisible$", this._skeletonVisible$.asObservable());
3933
+ }
3934
+ acquireSkeleton() {
3935
+ const token = Symbol("workbench-skeleton");
3936
+ this._tokens.add(token);
3937
+ if (this._tokens.size === 1) this._skeletonVisible$.next(true);
3938
+ const disposable = toDisposable(() => {
3939
+ if (!this._tokens.delete(token) || this._tokens.size > 0) return;
3940
+ this._skeletonVisible$.next(false);
3941
+ });
3942
+ return this.disposeWithMe(disposable);
3943
+ }
3944
+ dispose() {
3945
+ super.dispose();
3946
+ this._tokens.clear();
3947
+ this._skeletonVisible$.complete();
3948
+ }
3949
+ };
3950
+
3858
3951
  //#endregion
3859
3952
  //#region src/services/contextmenu/contextmenu.service.ts
3860
3953
  const IContextMenuService = createIdentifier("ui.contextmenu.service");
@@ -3965,10 +4058,10 @@ function useScrollYOverContainer(element, container) {
3965
4058
  useEffect(() => {
3966
4059
  if (!isBrowser() || !element || !container) return;
3967
4060
  updater();
3968
- const resizeObserver = resizeObserverCtor(updater);
4061
+ const resizeObserver = new ResizeObserver(updater);
3969
4062
  resizeObserver.observe(element);
3970
4063
  return () => {
3971
- resizeObserver.unobserve(element);
4064
+ resizeObserver.disconnect();
3972
4065
  };
3973
4066
  }, [element, container]);
3974
4067
  }
@@ -4147,11 +4240,12 @@ function QuickTileMenuItem(props) {
4147
4240
  const activated = useObservable(menuItem === null || menuItem === void 0 ? void 0 : menuItem.activated$, false);
4148
4241
  if (!menuItem || hidden) return null;
4149
4242
  const Icon = menuItem.icon ? iconManager.get(menuItem.icon) : null;
4243
+ const active = resolveMenuItemActiveState(menuItem.id, activated, activeItemIds);
4150
4244
  return /* @__PURE__ */ jsxs("button", {
4151
4245
  type: "button",
4152
4246
  className: quickTileMenuButtonVariants({
4153
4247
  disabled,
4154
- active: resolveMenuItemActiveState(menuItem.id, activated, activeItemIds)
4248
+ active
4155
4249
  }),
4156
4250
  disabled,
4157
4251
  onClick: () => {
@@ -4924,9 +5018,10 @@ function ContextMenuMenuItem(props) {
4924
5018
  const left = useLeft ? leftLeft : rightLeft;
4925
5019
  setSubmenuPlacement(useLeft ? "left" : "right");
4926
5020
  const maxTop = window.innerHeight - menuViewportPadding - submenuRect.height;
5021
+ const top = maxTop < menuViewportPadding ? menuViewportPadding : Math.min(Math.max(menuItemRect.top, menuViewportPadding), maxTop);
4927
5022
  setSubmenuPosition({
4928
5023
  left,
4929
- top: maxTop < menuViewportPadding ? menuViewportPadding : Math.min(Math.max(menuItemRect.top, menuViewportPadding), maxTop)
5024
+ top
4930
5025
  });
4931
5026
  setSubmenuPositionReady(true);
4932
5027
  };
@@ -4947,7 +5042,8 @@ function ContextMenuMenuItem(props) {
4947
5042
  const hiddenById = menuItem.id != null && hiddenItemIds.includes(menuItem.id) || hiddenItemIds.includes(menuKey);
4948
5043
  if (hidden || hiddenById) return null;
4949
5044
  const onChange = (v) => {
4950
- setInputValue(isRealNum(v) && typeof v === "string" ? Number.parseInt(v) : v);
5045
+ const newValue = isRealNum(v) && typeof v === "string" ? Number.parseInt(v) : v;
5046
+ setInputValue(newValue);
4951
5047
  };
4952
5048
  const onSubmenuOptionSelect = (option) => {
4953
5049
  onOptionSelect === null || onOptionSelect === void 0 || onOptionSelect(option);
@@ -5507,6 +5603,95 @@ function Sidebar() {
5507
5603
  });
5508
5604
  }
5509
5605
 
5606
+ //#endregion
5607
+ //#region src/views/components/workbench-skeleton/WorkbenchSkeleton.tsx
5608
+ function WorkbenchSkeleton({ darkMode, direction, overlay = false }) {
5609
+ const shimmerClassName = `
5610
+ univer-animate-pulse univer-bg-gray-100 motion-reduce:univer-animate-none
5611
+ dark:!univer-bg-gray-700
5612
+ `;
5613
+ const shimmerStyle = { animationDuration: "1.2s" };
5614
+ return /* @__PURE__ */ jsxs("div", {
5615
+ "aria-busy": "true",
5616
+ 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", {
5617
+ "univer-absolute univer-inset-0 univer-z-50": overlay,
5618
+ "univer-dark": darkMode
5619
+ }),
5620
+ dir: direction,
5621
+ children: [
5622
+ /* @__PURE__ */ jsxs("header", {
5623
+ "data-u-comp": "workbench-skeleton-toolbar",
5624
+ 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",
5625
+ children: [
5626
+ /* @__PURE__ */ jsx("div", {
5627
+ "data-u-comp": "workbench-skeleton-shimmer",
5628
+ className: clsx(shimmerClassName, "univer-h-4 univer-w-24 univer-rounded"),
5629
+ style: shimmerStyle
5630
+ }),
5631
+ /* @__PURE__ */ jsx("div", {
5632
+ "data-u-comp": "workbench-skeleton-shimmer",
5633
+ className: clsx(shimmerClassName, "univer-ml-2 univer-size-6 univer-rounded"),
5634
+ style: shimmerStyle
5635
+ }),
5636
+ /* @__PURE__ */ jsx("div", {
5637
+ "data-u-comp": "workbench-skeleton-shimmer",
5638
+ className: clsx(shimmerClassName, "univer-size-6 univer-rounded"),
5639
+ style: shimmerStyle
5640
+ })
5641
+ ]
5642
+ }),
5643
+ /* @__PURE__ */ jsxs("main", {
5644
+ "data-u-comp": "workbench-skeleton-content",
5645
+ className: "univer-flex univer-min-h-0 univer-min-w-0 univer-flex-1 univer-flex-col univer-gap-4 univer-p-4",
5646
+ children: [/* @__PURE__ */ jsx("div", {
5647
+ "data-u-comp": "workbench-skeleton-shimmer",
5648
+ className: clsx(shimmerClassName, "univer-h-4 univer-w-1/3 univer-rounded"),
5649
+ style: shimmerStyle
5650
+ }), /* @__PURE__ */ jsx("div", {
5651
+ "data-u-comp": "workbench-skeleton-shimmer",
5652
+ className: clsx(shimmerClassName, "univer-flex-1 univer-rounded-md"),
5653
+ style: shimmerStyle
5654
+ })]
5655
+ }),
5656
+ /* @__PURE__ */ jsxs("footer", {
5657
+ "data-u-comp": "workbench-skeleton-footer",
5658
+ 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",
5659
+ children: [/* @__PURE__ */ jsxs("div", {
5660
+ className: "univer-flex univer-items-center univer-gap-2",
5661
+ children: [/* @__PURE__ */ jsx("div", {
5662
+ "data-u-comp": "workbench-skeleton-shimmer",
5663
+ className: clsx(shimmerClassName, "univer-size-5 univer-rounded"),
5664
+ style: shimmerStyle
5665
+ }), /* @__PURE__ */ jsx("div", {
5666
+ "data-u-comp": "workbench-skeleton-shimmer",
5667
+ className: clsx(shimmerClassName, "univer-h-5 univer-w-14 univer-rounded"),
5668
+ style: shimmerStyle
5669
+ })]
5670
+ }), /* @__PURE__ */ jsxs("div", {
5671
+ className: "univer-flex univer-items-center univer-gap-2",
5672
+ children: [
5673
+ /* @__PURE__ */ jsx("div", {
5674
+ "data-u-comp": "workbench-skeleton-shimmer",
5675
+ className: clsx(shimmerClassName, "univer-size-5 univer-rounded"),
5676
+ style: shimmerStyle
5677
+ }),
5678
+ /* @__PURE__ */ jsx("div", {
5679
+ "data-u-comp": "workbench-skeleton-shimmer",
5680
+ className: clsx(shimmerClassName, "univer-h-2 univer-w-24 univer-rounded-full"),
5681
+ style: shimmerStyle
5682
+ }),
5683
+ /* @__PURE__ */ jsx("div", {
5684
+ "data-u-comp": "workbench-skeleton-shimmer",
5685
+ className: clsx(shimmerClassName, "univer-size-5 univer-rounded"),
5686
+ style: shimmerStyle
5687
+ })
5688
+ ]
5689
+ })]
5690
+ })
5691
+ ]
5692
+ });
5693
+ }
5694
+
5510
5695
  //#endregion
5511
5696
  //#region src/views/hooks/update-effect.ts
5512
5697
  /**
@@ -5713,6 +5898,8 @@ function DesktopWorkbenchContent(props) {
5713
5898
  var _uiConfig$popupRootId;
5714
5899
  const { header = true, toolbar = true, footer = true, headerMenu = true, contextMenu = true, ribbonType = "classic", mountContainer, onRendered } = props;
5715
5900
  const localeService = useDependency(LocaleService);
5901
+ const lifecycleService = useDependency(LifecycleService);
5902
+ const workbenchService = useDependency(IWorkbenchService);
5716
5903
  const themeService = useDependency(ThemeService);
5717
5904
  const themeSwitcherService = useDependency(ThemeSwitcherService);
5718
5905
  const contentRef = useRef(null);
@@ -5725,6 +5912,9 @@ function DesktopWorkbenchContent(props) {
5725
5912
  const leftSidebarComponents = useComponentsOfPart("left-sidebar");
5726
5913
  const globalComponents = useComponentsOfPart("global");
5727
5914
  const toolbarComponents = useComponentsOfPart("toolbar");
5915
+ const lifecycleStage = useObservable(lifecycleService.lifecycle$, lifecycleService.stage);
5916
+ const externalSkeletonVisible = useObservable(workbenchService.skeletonVisible$, void 0, true);
5917
+ const ready = lifecycleStage >= LifecycleStages.Ready;
5728
5918
  const popupRootId = (_uiConfig$popupRootId = uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.popupRootId) !== null && _uiConfig$popupRootId !== void 0 ? _uiConfig$popupRootId : "univer-popup-portal";
5729
5919
  useLayoutEffect(() => {
5730
5920
  const sub = themeService.currentTheme$.subscribe((theme) => {
@@ -5740,8 +5930,8 @@ function DesktopWorkbenchContent(props) {
5740
5930
  else document.documentElement.classList.remove("univer-dark");
5741
5931
  }, [darkMode]);
5742
5932
  useEffect(() => {
5743
- if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
5744
- }, [onRendered]);
5933
+ if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
5934
+ }, [ready, onRendered]);
5745
5935
  const locale = useObservable(() => localeService.localeChanged$.pipe(map(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
5746
5936
  const direction = useObservable(localeService.direction$, localeService.getDirection());
5747
5937
  const portalContainer = useMemo(() => document.createElement("div"), []);
@@ -5759,61 +5949,68 @@ function DesktopWorkbenchContent(props) {
5759
5949
  direction,
5760
5950
  mountContainer: portalContainer,
5761
5951
  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
- ]
5952
+ className: "univer-relative univer-h-full univer-min-h-0",
5953
+ children: [/* @__PURE__ */ jsxs("div", {
5954
+ "data-u-comp": "workbench-layout",
5955
+ 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 }),
5956
+ tabIndex: -1,
5957
+ onBlur: (e) => e.stopPropagation(),
5958
+ onContextMenu: (e) => e.preventDefault(),
5959
+ dir: direction,
5960
+ children: [
5961
+ /* @__PURE__ */ jsx("div", {
5962
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",
5963
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: customHeaderComponents }, "custom-header")
5964
+ }),
5965
+ header && toolbar && /* @__PURE__ */ jsx("header", {
5966
+ "data-u-comp": "headerbar",
5967
+ className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
5968
+ children: /* @__PURE__ */ jsx(ComponentContainer, {
5969
+ components: toolbarComponents,
5970
+ sharedProps: {
5971
+ ribbonType,
5972
+ headerMenuComponents,
5973
+ headerMenu
5974
+ }
5975
+ }, "toolbar")
5976
+ }),
5977
+ /* @__PURE__ */ jsxs("section", {
5978
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
5979
+ children: [/* @__PURE__ */ jsxs("div", {
5980
+ className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
5981
+ children: [
5982
+ /* @__PURE__ */ jsx("aside", {
5983
+ "data-u-comp": "left-sidebar",
5984
+ className: "univer-h-full",
5985
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
5986
+ }),
5987
+ /* @__PURE__ */ jsxs("section", {
5988
+ 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),
5989
+ children: [/* @__PURE__ */ jsx("header", { children: header && /* @__PURE__ */ jsx(ComponentContainer, { components: headerComponents }, "header") }), /* @__PURE__ */ jsx("section", {
5990
+ className: "univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",
5991
+ ref: contentRef,
5992
+ "data-range-selector": true,
5993
+ onContextMenu: (e) => e.preventDefault(),
5994
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: contentComponents }, "content")
5995
+ })]
5996
+ }),
5997
+ /* @__PURE__ */ jsx("aside", {
5998
+ "data-u-comp": "right-sidebar",
5999
+ className: "univer-z-[100] univer-h-full",
6000
+ children: /* @__PURE__ */ jsx(Sidebar, {})
6001
+ })
6002
+ ]
6003
+ }), footer && /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(ComponentContainer, {
6004
+ components: footerComponents,
6005
+ sharedProps: { contextMenu }
6006
+ }, "footer") })]
6007
+ })
6008
+ ]
6009
+ }), (!ready || externalSkeletonVisible) && /* @__PURE__ */ jsx(WorkbenchSkeleton, {
6010
+ darkMode,
6011
+ direction,
6012
+ overlay: true
6013
+ })]
5817
6014
  }), /* @__PURE__ */ jsxs("div", {
5818
6015
  dir: direction,
5819
6016
  children: [
@@ -5858,6 +6055,9 @@ var SingleUnitUIController = class extends Disposable {
5858
6055
  delete this._renderManagerService;
5859
6056
  }
5860
6057
  _bootstrapWorkbench() {
6058
+ var _this$_injector$get;
6059
+ const initialSkeleton = (_this$_injector$get = this._injector.get(IWorkbenchService, Quantity.OPTIONAL)) === null || _this$_injector$get === void 0 ? void 0 : _this$_injector$get.acquireSkeleton();
6060
+ if (initialSkeleton) this.disposeWithMe(initialSkeleton);
5861
6061
  this.disposeWithMe(this.bootstrap(async (contentElement, containerElement) => {
5862
6062
  if (this._layoutService) {
5863
6063
  this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement));
@@ -5868,6 +6068,7 @@ var SingleUnitUIController = class extends Disposable {
5868
6068
  this._renderTimeout = window.setTimeout(() => {
5869
6069
  const allRenders = this._renderManagerService.getRenderAll();
5870
6070
  for (const [key] of allRenders) if (this._changeRenderUnit(key, contentElement)) break;
6071
+ requestAnimationFrame(() => requestAnimationFrame(() => initialSkeleton === null || initialSkeleton === void 0 ? void 0 : initialSkeleton.dispose()));
5871
6072
  this.disposeWithMe(this._instanceService.focused$.subscribe((unit) => {
5872
6073
  if (unit) this._changeRenderUnit(unit, contentElement);
5873
6074
  }));
@@ -5895,9 +6096,9 @@ var SingleUnitUIController = class extends Disposable {
5895
6096
  var _this$_instanceServic2;
5896
6097
  if (this._currentRenderId === rendererId) return false;
5897
6098
  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);
6099
+ const renderer = this._renderManagerService.getRenderUnitById(rendererId);
5899
6100
  if (!renderer || !renderer.unitId || isInternalEditorID(renderer.unitId)) return false;
5900
- const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderById(this._currentRenderId) : null;
6101
+ const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderUnitById(this._currentRenderId) : null;
5901
6102
  currentRenderer === null || currentRenderer === void 0 || currentRenderer.deactivate();
5902
6103
  currentRenderer === null || currentRenderer === void 0 || currentRenderer.engine.unmount();
5903
6104
  renderer.engine.mount(contentElement);
@@ -5969,7 +6170,7 @@ const IUIController = createIdentifier("univer.ui.ui-controller");
5969
6170
  //#endregion
5970
6171
  //#region package.json
5971
6172
  var name = "@univerjs/ui";
5972
- var version = "1.0.0-alpha.7";
6173
+ var version = "1.0.0-alpha.8";
5973
6174
 
5974
6175
  //#endregion
5975
6176
  //#region src/views/color-picker/interface.ts
@@ -6063,7 +6264,7 @@ function ShortcutPanel() {
6063
6264
  if (!shortcutGroups.has(group)) shortcutGroups.set(group, []);
6064
6265
  shortcutGroups.get(group).push(shortcutItem);
6065
6266
  }
6066
- setShortcutItems(Array.from(shortcutGroups.entries()).map(([name, items]) => {
6267
+ const toRender = Array.from(shortcutGroups.entries()).map(([name, items]) => {
6067
6268
  const groupSequence = name.split("_")[0];
6068
6269
  const localeKey = groupTitles.get(name);
6069
6270
  return {
@@ -6071,7 +6272,8 @@ function ShortcutPanel() {
6071
6272
  name: localeService.t(localeKey),
6072
6273
  items: dedupeBy(items, (item) => item.title + item.shortcut)
6073
6274
  };
6074
- }).sort((a, b) => a.sequence - b.sequence));
6275
+ }).sort((a, b) => a.sequence - b.sequence);
6276
+ setShortcutItems(toRender);
6075
6277
  }, [
6076
6278
  shortcutService,
6077
6279
  localeService,
@@ -22891,6 +23093,8 @@ function mountMobileWorkbench(injector, options, mountContainer, onRendered) {
22891
23093
  function MobileWorkbench(props) {
22892
23094
  const { header = true, toolbar = true, footer = true, headerMenu = true, ribbonType = "classic", contextMenu = true, mountContainer, onRendered } = props;
22893
23095
  const localeService = useDependency(LocaleService);
23096
+ const lifecycleService = useDependency(LifecycleService);
23097
+ const workbenchService = useDependency(IWorkbenchService);
22894
23098
  const themeService = useDependency(ThemeService);
22895
23099
  const themeSwitcherService = useDependency(ThemeSwitcherService);
22896
23100
  const contentRef = useRef(null);
@@ -22902,9 +23106,12 @@ function MobileWorkbench(props) {
22902
23106
  const globalComponents = useComponentsOfPart("global");
22903
23107
  const toolbarComponents = useComponentsOfPart("toolbar");
22904
23108
  const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
23109
+ const lifecycleStage = useObservable(lifecycleService.lifecycle$, lifecycleService.stage);
23110
+ const externalSkeletonVisible = useObservable(workbenchService.skeletonVisible$, void 0, true);
23111
+ const ready = lifecycleStage >= LifecycleStages.Ready;
22905
23112
  useEffect(() => {
22906
- if (contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
22907
- }, [onRendered]);
23113
+ if (ready && contentRef.current) onRendered === null || onRendered === void 0 || onRendered(contentRef.current);
23114
+ }, [ready, onRendered]);
22908
23115
  const locale = useObservable(() => localeService.localeChanged$.pipe(map(() => localeService.getLocales())), localeService.getLocales(), false, [localeService]);
22909
23116
  const direction = useObservable(localeService.direction$, localeService.getDirection());
22910
23117
  const portalContainer = useMemo(() => document.createElement("div"), []);
@@ -22930,51 +23137,58 @@ function MobileWorkbench(props) {
22930
23137
  direction,
22931
23138
  mountContainer: portalContainer,
22932
23139
  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") })]
23140
+ className: "univer-relative univer-h-full univer-min-h-0",
23141
+ children: [/* @__PURE__ */ jsxs("div", {
23142
+ "data-u-comp": "app-layout",
23143
+ 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 }),
23144
+ tabIndex: -1,
23145
+ onBlur: (e) => e.stopPropagation(),
23146
+ onContextMenu: (e) => e.preventDefault(),
23147
+ dir: direction,
23148
+ children: [header && toolbar && /* @__PURE__ */ jsx("header", {
23149
+ "data-u-comp": "headerbar",
23150
+ className: "univer-relative univer-z-10 univer-w-full univer-overflow-hidden",
23151
+ children: /* @__PURE__ */ jsx(ComponentContainer, {
23152
+ components: toolbarComponents,
23153
+ sharedProps: {
23154
+ ribbonType,
23155
+ headerMenuComponents,
23156
+ headerMenu
23157
+ }
23158
+ }, "toolbar")
23159
+ }), /* @__PURE__ */ jsxs("section", {
23160
+ className: "univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",
23161
+ children: [/* @__PURE__ */ jsxs("div", {
23162
+ className: "univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",
23163
+ children: [
23164
+ /* @__PURE__ */ jsx("aside", {
23165
+ className: "univer-h-full",
23166
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: leftSidebarComponents }, "left-sidebar")
23167
+ }),
23168
+ /* @__PURE__ */ jsxs("section", {
23169
+ 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),
23170
+ children: [/* @__PURE__ */ jsx("header", {
23171
+ className: "univer-w-screen",
23172
+ children: header && /* @__PURE__ */ jsx(ComponentContainer, { components: headerComponents }, "header")
23173
+ }), /* @__PURE__ */ jsx("section", {
23174
+ ref: contentRef,
23175
+ className: "univer-relative univer-overflow-hidden",
23176
+ "data-range-selector": true,
23177
+ onContextMenu: (e) => e.preventDefault(),
23178
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: contentComponents }, "content")
23179
+ })]
23180
+ }),
23181
+ /* @__PURE__ */ jsx("aside", {
23182
+ className: "univer-h-full",
23183
+ children: /* @__PURE__ */ jsx(Sidebar, {})
23184
+ })
23185
+ ]
23186
+ }), footer && /* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(ComponentContainer, { components: footerComponents }, "footer") })]
23187
+ })]
23188
+ }), (!ready || externalSkeletonVisible) && /* @__PURE__ */ jsx(WorkbenchSkeleton, {
23189
+ darkMode,
23190
+ direction,
23191
+ overlay: true
22978
23192
  })]
22979
23193
  }), /* @__PURE__ */ jsxs("div", {
22980
23194
  dir: direction,
@@ -24188,6 +24402,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends Plugin {
24188
24402
  [IconManager],
24189
24403
  [ComponentsController],
24190
24404
  [ThemeSwitcherService],
24405
+ [IWorkbenchService, { useClass: WorkbenchService }],
24191
24406
  [ZIndexManager],
24192
24407
  [ShortcutPanelService],
24193
24408
  [IUIPartsService, { useClass: UIPartsService }],
@@ -24293,6 +24508,7 @@ let UniverUIPlugin = class UniverUIPlugin extends Plugin {
24293
24508
  [ZIndexManager],
24294
24509
  [ShortcutPanelService],
24295
24510
  [IUIPartsService, { useClass: UIPartsService }],
24511
+ [IWorkbenchService, { useClass: WorkbenchService }],
24296
24512
  [ILayoutService, { useClass: DesktopLayoutService }],
24297
24513
  [IRibbonService, { useClass: DesktopRibbonService }],
24298
24514
  [IRibbonOverrideService, { useClass: RibbonOverrideService }],
@@ -24522,8 +24738,10 @@ function handleStringToStyle($dom, cssStyle = "") {
24522
24738
  else styleList.bl = 0;
24523
24739
  else if (key === "font-style") if (value === "italic") styleList.it = 1;
24524
24740
  else styleList.it = 0;
24525
- else if (key === "font-family") styleList.ff = extractFontFamily(textTrim(originStr));
24526
- else if (key === "font-size") {
24741
+ else if (key === "font-family") {
24742
+ const fontFamily = extractFontFamily(textTrim(originStr));
24743
+ styleList.ff = fontFamily;
24744
+ } else if (key === "font-size") {
24527
24745
  let fs = Number.parseInt(value);
24528
24746
  if (cssText.indexOf("vertical-align") > -1 && (cssText.indexOf("sub") > -1 || cssText.indexOf("sup") > -1)) fs *= 2;
24529
24747
  if (value.indexOf("px") !== -1) fs = getPtFontSizeByPx(Number.parseInt(value, 10));
@@ -25174,4 +25392,4 @@ function ProgressBar(props) {
25174
25392
  }
25175
25393
 
25176
25394
  //#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 };
25395
+ 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 };