@univerjs/ui 1.0.0-alpha.1 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/lib/cjs/facade.js +2 -0
  2. package/lib/cjs/index.js +657 -268
  3. package/lib/es/facade.js +2 -0
  4. package/lib/es/index.js +648 -269
  5. package/lib/facade.js +2 -0
  6. package/lib/index.css +53 -8
  7. package/lib/index.js +648 -269
  8. package/lib/types/common/menu-hidden-observable.d.ts +2 -1
  9. package/lib/types/facade/f-menu-builder.d.ts +2 -0
  10. package/lib/types/index.d.ts +12 -6
  11. package/lib/types/services/contextmenu/contextmenu.service.d.ts +6 -3
  12. package/lib/types/services/dom/canvas-dom-layer.service.d.ts +52 -1
  13. package/lib/types/services/menu/menu-manager.service.d.ts +1 -0
  14. package/lib/types/services/popup/canvas-popup.service.d.ts +2 -1
  15. package/lib/types/services/ribbon/ribbon-override.service.d.ts +42 -0
  16. package/lib/types/services/runtime-scope/ui-runtime-scope.service.d.ts +32 -0
  17. package/lib/types/services/shortcut/shortcut.service.d.ts +2 -1
  18. package/lib/types/utils/embed-boundary.d.ts +23 -0
  19. package/lib/types/utils/index.d.ts +1 -0
  20. package/lib/types/views/components/context-menu/AnchoredContextMenu.d.ts +4 -0
  21. package/lib/types/views/components/context-menu/ContextMenuPanel.d.ts +4 -0
  22. package/lib/types/views/components/dom/FloatDom.d.ts +11 -0
  23. package/lib/types/views/components/dom/float-dom-layout.d.ts +35 -0
  24. package/lib/types/views/components/ribbon/Ribbon.d.ts +2 -0
  25. package/lib/types/views/components/ribbon/TooltipButtonWrapper.d.ts +6 -1
  26. package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
  27. package/lib/types/views/font-family/FontFamily.d.ts +10 -2
  28. package/lib/types/views/font-family/FontFamilyDropdown.d.ts +32 -0
  29. package/lib/types/views/font-family/FontFamilyItem.d.ts +5 -3
  30. package/lib/types/views/font-family/index.d.ts +6 -2
  31. package/lib/types/views/font-family/{interface.d.ts → use-font-list.d.ts} +6 -9
  32. package/lib/types/views/menu/mobile/MobileMenu.d.ts +2 -0
  33. package/lib/umd/index.js +15 -22
  34. package/package.json +9 -9
package/lib/es/index.js CHANGED
@@ -306,11 +306,11 @@ function getHeaderFooterMenuHiddenObservable(accessor) {
306
306
  return new Observable((subscriber) => {
307
307
  const subscription = univerInstanceService.focused$.subscribe((unitId) => {
308
308
  if (unitId == null) return subscriber.next(true);
309
- const docDataModel = univerInstanceService.getUniverDocInstance(unitId);
309
+ const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
310
310
  const documentFlavor = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
311
311
  subscriber.next(documentFlavor !== DocumentFlavor.TRADITIONAL);
312
312
  });
313
- const docDataModel = univerInstanceService.getCurrentUniverDocInstance();
313
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
314
314
  if (docDataModel == null) subscriber.next(true);
315
315
  else {
316
316
  const documentFlavor = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
@@ -624,6 +624,47 @@ function fromGlobalEvent(type, listener, options) {
624
624
  return toDisposable(() => window.removeEventListener(type, listener, options));
625
625
  }
626
626
 
627
+ //#endregion
628
+ //#region src/utils/embed-boundary.ts
629
+ /**
630
+ * Copyright 2023-present DreamNum Co., Ltd.
631
+ *
632
+ * Licensed under the Apache License, Version 2.0 (the "License");
633
+ * you may not use this file except in compliance with the License.
634
+ * You may obtain a copy of the License at
635
+ *
636
+ * http://www.apache.org/licenses/LICENSE-2.0
637
+ *
638
+ * Unless required by applicable law or agreed to in writing, software
639
+ * distributed under the License is distributed on an "AS IS" BASIS,
640
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
641
+ * See the License for the specific language governing permissions and
642
+ * limitations under the License.
643
+ */
644
+ const EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
645
+ function getEmbedBoundaryOwner(target) {
646
+ var _ref, _getAttributeValue;
647
+ if (!hasClosest(target)) return;
648
+ const ownerElement = target.closest(`[${EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}]`);
649
+ 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;
650
+ }
651
+ function isEmbedBoundaryTarget(target) {
652
+ return hasClosest(target) && target.closest(`[${"data-embed-interaction-boundary-owner"}]`) != null;
653
+ }
654
+ function keepInteractionInsideSameEmbedBoundary(event) {
655
+ const owner = getEmbedBoundaryOwner(event.currentTarget);
656
+ if (!owner) return;
657
+ if (getEmbedBoundaryOwner(event.target) === owner) event.preventDefault();
658
+ }
659
+ function hasClosest(target) {
660
+ return !!target && typeof target.closest === "function";
661
+ }
662
+ function getAttributeValue(target, name) {
663
+ var _getAttribute$call;
664
+ const getAttribute = target === null || target === void 0 ? void 0 : target.getAttribute;
665
+ return typeof getAttribute === "function" ? (_getAttribute$call = getAttribute.call(target, name)) !== null && _getAttribute$call !== void 0 ? _getAttribute$call : void 0 : void 0;
666
+ }
667
+
627
668
  //#endregion
628
669
  //#region src/services/layout/layout.service.ts
629
670
  const FOCUSING_UNIVER = "FOCUSING_UNIVER";
@@ -704,8 +745,15 @@ let DesktopLayoutService = class DesktopLayoutService extends Disposable {
704
745
  this.disposeWithMe(fromEvent(window, "focusin").subscribe((event) => {
705
746
  var _this$_rootContainerE;
706
747
  const target = event.target;
707
- if (((_this$_rootContainerE = this._rootContainerElement) === null || _this$_rootContainerE === void 0 ? void 0 : _this$_rootContainerE.contains(target)) && givingBackFocusElements.some((item) => target.dataset.uComp === item)) {
708
- queueMicrotask(() => this.focus());
748
+ if (((_this$_rootContainerE = this._rootContainerElement) === null || _this$_rootContainerE === void 0 ? void 0 : _this$_rootContainerE.contains(target)) && givingBackFocusElements.some((item) => target.dataset.uComp === item) && !isEmbedBoundaryTarget(target)) {
749
+ queueMicrotask(() => {
750
+ const targetUnitId = getFocusUnitIdFromElement(target);
751
+ if (targetUnitId && this._univerInstanceService.getUnit(targetUnitId)) this._univerInstanceService.focusUnit(targetUnitId);
752
+ this.focus();
753
+ this._isFocused = true;
754
+ this._contextService.setContextValue(FOCUSING_UNIVER, this._isFocused);
755
+ this._contextService.setContextValue(FOCUSING_UNIVER_EDITOR, getFocusingUniverEditorStatus());
756
+ });
709
757
  return;
710
758
  }
711
759
  if (target && this.checkElementInCurrentContainers(target)) this._isFocused = true;
@@ -723,6 +771,9 @@ function getFocusingUniverEditorStatus() {
723
771
  var _document$activeEleme;
724
772
  return ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.dataset.uComp) === "editor";
725
773
  }
774
+ function getFocusUnitIdFromElement(target) {
775
+ return target.dataset.uUnitId;
776
+ }
726
777
 
727
778
  //#endregion
728
779
  //#region src/services/platform/platform.service.ts
@@ -844,6 +895,7 @@ let ShortcutService = class ShortcutService extends Disposable {
844
895
  if (this._layoutService && !this._layoutService.checkElementInCurrentContainers(e.target)) return;
845
896
  const binding = this._deriveBindingFromEvent(e);
846
897
  if (binding === null) return;
898
+ if (this._shouldLetEmbedTextEditorHandleNativeShortcut(e, binding)) return;
847
899
  const shortcuts = this._shortCutMapping.get(binding);
848
900
  if (shortcuts === void 0) return;
849
901
  return Array.from(shortcuts).sort((s1, s2) => {
@@ -869,6 +921,12 @@ let ShortcutService = class ShortcutService extends Disposable {
869
921
  if (this._platformService.isMac && e.ctrlKey) binding |= 8192;
870
922
  return binding;
871
923
  }
924
+ _shouldLetEmbedTextEditorHandleNativeShortcut(e, binding) {
925
+ if (binding !== (65 | 4096)) return false;
926
+ const target = e.target;
927
+ if (!(target instanceof HTMLElement)) return false;
928
+ return (target.isContentEditable || target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) && isEmbedBoundaryTarget(target);
929
+ }
872
930
  };
873
931
  ShortcutService = __decorate([
874
932
  __decorateParam(0, ICommandService),
@@ -1050,8 +1108,9 @@ let ContextMenuGroup = /* @__PURE__ */ function(ContextMenuGroup) {
1050
1108
 
1051
1109
  //#endregion
1052
1110
  //#region src/services/menu/menu-manager.service.ts
1111
+ var _MenuManagerService;
1053
1112
  const IMenuManagerService = createIdentifier("univer.menu-manager-service");
1054
- let MenuManagerService = class MenuManagerService extends Disposable {
1113
+ let MenuManagerService = _MenuManagerService = class MenuManagerService extends Disposable {
1055
1114
  constructor(_injector, _configService) {
1056
1115
  super();
1057
1116
  this._injector = _injector;
@@ -1185,6 +1244,21 @@ let MenuManagerService = class MenuManagerService extends Disposable {
1185
1244
  this._menu = merge({}, this._menu, source);
1186
1245
  this.menuChanged$.next();
1187
1246
  }
1247
+ createScoped(injector) {
1248
+ const root = this;
1249
+ const createScopedBuilder = () => {
1250
+ const service = new _MenuManagerService(injector, root._configService);
1251
+ service._menu = root._menu;
1252
+ return service;
1253
+ };
1254
+ return {
1255
+ menuChanged$: root.menuChanged$,
1256
+ mergeMenu: (source, target) => root.mergeMenu(source, target),
1257
+ appendRootMenu: (source) => root.appendRootMenu(source),
1258
+ getMenuByPositionKey: (position) => createScopedBuilder().getMenuByPositionKey(position),
1259
+ getFlatMenuByPositionKey: (position) => createScopedBuilder().getFlatMenuByPositionKey(position)
1260
+ };
1261
+ }
1188
1262
  _buildMenuSchema(data) {
1189
1263
  const result = [];
1190
1264
  for (const [key, value] of Object.entries(data)) {
@@ -1224,6 +1298,7 @@ let MenuManagerService = class MenuManagerService extends Disposable {
1224
1298
  * @returns Menu schema array or empty array if not found
1225
1299
  */
1226
1300
  getMenuByPositionKey(key) {
1301
+ var _findKey;
1227
1302
  const findKey = (obj) => {
1228
1303
  if (key in obj) return this._buildMenuSchema(obj[key]);
1229
1304
  for (const k in obj) {
@@ -1234,7 +1309,7 @@ let MenuManagerService = class MenuManagerService extends Disposable {
1234
1309
  }
1235
1310
  }
1236
1311
  };
1237
- return findKey(this._menu);
1312
+ return (_findKey = findKey(this._menu)) !== null && _findKey !== void 0 ? _findKey : [];
1238
1313
  }
1239
1314
  /**
1240
1315
  * Get flat menu schema by position key
@@ -1256,7 +1331,7 @@ let MenuManagerService = class MenuManagerService extends Disposable {
1256
1331
  return flatMenuItems(menu);
1257
1332
  }
1258
1333
  };
1259
- MenuManagerService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IConfigService)], MenuManagerService);
1334
+ MenuManagerService = _MenuManagerService = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, IConfigService)], MenuManagerService);
1260
1335
  function normalizeMenuOrder(order) {
1261
1336
  return order !== null && order !== void 0 ? order : 0;
1262
1337
  }
@@ -1333,11 +1408,14 @@ const undoRedoDisableFactory$ = (accessor, isUndo) => {
1333
1408
  return undoDisable || contextService.getContextValue(EDITOR_ACTIVATED) || contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
1334
1409
  }));
1335
1410
  };
1411
+ const rtlIconFactory$ = (accessor, ltrIcon, rtlIcon) => {
1412
+ return accessor.get(LocaleService).direction$.pipe(map$1((direction) => direction === "rtl" ? rtlIcon : ltrIcon));
1413
+ };
1336
1414
  function UndoMenuItemFactory(accessor) {
1337
1415
  return {
1338
1416
  id: UndoCommand.id,
1339
1417
  type: 0,
1340
- icon: "UndoIcon",
1418
+ icon: rtlIconFactory$(accessor, "UndoIcon", "RedoIcon"),
1341
1419
  title: "ui.shortcut.undo",
1342
1420
  tooltip: "ui.shortcut.undo",
1343
1421
  disabled$: undoRedoDisableFactory$(accessor, true)
@@ -1347,7 +1425,7 @@ function RedoMenuItemFactory(accessor) {
1347
1425
  return {
1348
1426
  id: RedoCommand.id,
1349
1427
  type: 0,
1350
- icon: "RedoIcon",
1428
+ icon: rtlIconFactory$(accessor, "RedoIcon", "UndoIcon"),
1351
1429
  title: "ui.shortcut.redo",
1352
1430
  tooltip: "ui.shortcut.redo",
1353
1431
  disabled$: undoRedoDisableFactory$(accessor, false)
@@ -1468,8 +1546,15 @@ function useObservableRef(observable, defaultValue) {
1468
1546
 
1469
1547
  //#endregion
1470
1548
  //#region src/services/dom/canvas-dom-layer.service.ts
1471
- var CanvasFloatDomService = class {
1472
- constructor() {
1549
+ function shouldForwardFloatDomEvents(layer) {
1550
+ return layer.eventPassThrough !== false;
1551
+ }
1552
+ function shouldRenderFloatDomLayer(layer, currentUnitId) {
1553
+ return layer.unitId === currentUnitId || layer.preserveOnFocusChange === true;
1554
+ }
1555
+ var CanvasFloatDomService = class extends Disposable {
1556
+ constructor(..._args) {
1557
+ super(..._args);
1473
1558
  _defineProperty(this, "_domLayerMap", /* @__PURE__ */ new Map());
1474
1559
  _defineProperty(this, "_domLayers$", new BehaviorSubject([]));
1475
1560
  _defineProperty(this, "domLayers$", this._domLayers$.asObservable());
@@ -1500,68 +1585,131 @@ var CanvasFloatDomService = class {
1500
1585
  this._domLayerMap.clear();
1501
1586
  this._notice();
1502
1587
  }
1588
+ dispose() {
1589
+ this._domLayerMap.clear();
1590
+ this._domLayers$.next([]);
1591
+ this._domLayers$.complete();
1592
+ super.dispose();
1593
+ }
1503
1594
  };
1595
+ var CanvasFloatDomPreviewService = class extends Disposable {
1596
+ constructor(..._args2) {
1597
+ super(..._args2);
1598
+ _defineProperty(this, "previewUpdated$", new Subject());
1599
+ _defineProperty(this, "previewRequested$", new Subject());
1600
+ _defineProperty(this, "_previewMap", /* @__PURE__ */ new Map());
1601
+ _defineProperty(this, "_requestMap", /* @__PURE__ */ new Map());
1602
+ }
1603
+ getPreview(id) {
1604
+ return this._previewMap.get(id);
1605
+ }
1606
+ getPendingRequests() {
1607
+ return Array.from(this._requestMap.values());
1608
+ }
1609
+ setPreview(preview) {
1610
+ this._previewMap.set(preview.id, preview);
1611
+ this._requestMap.delete(preview.id);
1612
+ this.previewUpdated$.next(preview);
1613
+ }
1614
+ removePreview(id) {
1615
+ this._previewMap.delete(id);
1616
+ this._requestMap.delete(id);
1617
+ }
1618
+ requestPreview(request) {
1619
+ this._requestMap.set(request.id, request);
1620
+ this.previewRequested$.next(request);
1621
+ }
1622
+ dispose() {
1623
+ this._previewMap.clear();
1624
+ this._requestMap.clear();
1625
+ this.previewUpdated$.complete();
1626
+ this.previewRequested$.complete();
1627
+ super.dispose();
1628
+ }
1629
+ };
1630
+
1631
+ //#endregion
1632
+ //#region src/views/components/dom/float-dom-layout.ts
1633
+ const LEGACY_WRAPPER_INSET = 2;
1634
+ const LEGACY_CONTENT_INSET = 4;
1635
+ function resolveFloatDomLayout(position, contentBox) {
1636
+ var _contentBox$wrapperIn, _contentBox$contentIn, _position$opacity;
1637
+ const wrapperInset = (_contentBox$wrapperIn = contentBox === null || contentBox === void 0 ? void 0 : contentBox.wrapperInset) !== null && _contentBox$wrapperIn !== void 0 ? _contentBox$wrapperIn : LEGACY_WRAPPER_INSET;
1638
+ const contentInset = (_contentBox$contentIn = contentBox === null || contentBox === void 0 ? void 0 : contentBox.contentInset) !== null && _contentBox$contentIn !== void 0 ? _contentBox$contentIn : LEGACY_CONTENT_INSET;
1639
+ return {
1640
+ wrapper: {
1641
+ top: position.startY,
1642
+ left: position.startX,
1643
+ width: Math.max(position.endX - position.startX - wrapperInset, 0),
1644
+ height: Math.max(position.endY - position.startY - wrapperInset, 0),
1645
+ transform: `rotate(${position.rotate}deg)`,
1646
+ opacity: (_position$opacity = position.opacity) !== null && _position$opacity !== void 0 ? _position$opacity : 1
1647
+ },
1648
+ inner: {
1649
+ width: position.width - contentInset,
1650
+ height: position.height - contentInset,
1651
+ left: position.absolute.left ? 0 : "auto",
1652
+ top: position.absolute.top ? 0 : "auto",
1653
+ right: position.absolute.left ? "auto" : 0,
1654
+ bottom: position.absolute.top ? "auto" : 0
1655
+ }
1656
+ };
1657
+ }
1504
1658
 
1505
1659
  //#endregion
1506
1660
  //#region src/views/components/dom/FloatDom.tsx
1661
+ function applyFloatDomLayout(wrapper, inner, layout) {
1662
+ const { wrapper: wrapperLayout, inner: innerLayout } = layout;
1663
+ const wrapperStyle = wrapper.style;
1664
+ wrapperStyle.top = `${wrapperLayout.top}px`;
1665
+ wrapperStyle.left = `${wrapperLayout.left}px`;
1666
+ wrapperStyle.width = `${wrapperLayout.width}px`;
1667
+ wrapperStyle.height = `${wrapperLayout.height}px`;
1668
+ wrapperStyle.transform = wrapperLayout.transform;
1669
+ wrapperStyle.opacity = `${wrapperLayout.opacity}`;
1670
+ const innerStyle = inner.style;
1671
+ innerStyle.width = `${innerLayout.width}px`;
1672
+ innerStyle.height = `${innerLayout.height}px`;
1673
+ innerStyle.left = innerLayout.left === "auto" ? "auto" : `${innerLayout.left}px`;
1674
+ innerStyle.top = innerLayout.top === "auto" ? "auto" : `${innerLayout.top}px`;
1675
+ innerStyle.right = innerLayout.right === "auto" ? "auto" : `${innerLayout.right}px`;
1676
+ innerStyle.bottom = innerLayout.bottom === "auto" ? "auto" : `${innerLayout.bottom}px`;
1677
+ }
1507
1678
  const FloatDomSingle = memo((props) => {
1508
- var _position$startY, _position$startX;
1679
+ var _layer$contentBox, _layer$contentBox2;
1509
1680
  const { layer, id } = props;
1510
- const size$ = useMemo(() => layer.position$.pipe(distinctUntilChanged((prev, curr) => prev.absolute.left === curr.absolute.left && prev.absolute.top === curr.absolute.top && prev.endX - prev.startX === curr.endX - curr.startX && prev.endY - prev.startY === curr.endY - curr.startY)), [layer.position$]);
1511
1681
  const univerInstanceService = useDependency(IUniverInstanceService);
1512
1682
  const position = useObservable(useMemo(() => layer.position$.pipe(first()), [layer.position$]));
1513
1683
  const domRef = useRef(null);
1514
1684
  const innerDomRef = useRef(null);
1515
- 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)`);
1516
- const topRef = useRef((_position$startY = position === null || position === void 0 ? void 0 : position.startY) !== null && _position$startY !== void 0 ? _position$startY : 0);
1517
- const leftRef = useRef((_position$startX = position === null || position === void 0 ? void 0 : position.startX) !== null && _position$startX !== void 0 ? _position$startX : 0);
1518
- const innerStyle = useRef({});
1519
1685
  const Component = typeof layer.componentKey === "string" ? useDependency(ComponentManager).get(layer.componentKey) : layer.componentKey;
1520
1686
  const layerProps = useMemo(() => ({
1521
1687
  data: layer.data,
1522
- ...layer.props
1523
- }), [layer.data, layer.props]);
1688
+ ...layer.props,
1689
+ hostFloatDomLayout$: layer.position$
1690
+ }), [
1691
+ layer.data,
1692
+ layer.position$,
1693
+ layer.props
1694
+ ]);
1695
+ const floatDomOverflow = resolveFloatDomOverflow(layerProps);
1696
+ const wrapperInset = (_layer$contentBox = layer.contentBox) === null || _layer$contentBox === void 0 ? void 0 : _layer$contentBox.wrapperInset;
1697
+ const contentInset = (_layer$contentBox2 = layer.contentBox) === null || _layer$contentBox2 === void 0 ? void 0 : _layer$contentBox2.contentInset;
1524
1698
  useEffect(() => {
1525
1699
  const subscription = layer.position$.subscribe((position) => {
1526
- transformRef.current = `rotate(${position.rotate}deg)`;
1527
- topRef.current = position.startY;
1528
- leftRef.current = position.startX;
1529
- if (domRef.current) {
1530
- var _position$opacity;
1531
- domRef.current.style.transform = transformRef.current;
1532
- domRef.current.style.top = `${topRef.current}px`;
1533
- domRef.current.style.left = `${leftRef.current}px`;
1534
- domRef.current.style.opacity = `${(_position$opacity = position.opacity) !== null && _position$opacity !== void 0 ? _position$opacity : 1}`;
1535
- }
1536
- });
1537
- const sizeSubscription = size$.subscribe((size) => {
1538
- if (domRef.current) {
1539
- domRef.current.style.width = `${Math.max(size.endX - size.startX - 2, 0)}px`;
1540
- domRef.current.style.height = `${Math.max(size.endY - size.startY - 2, 0)}px`;
1541
- }
1542
- if (innerDomRef.current) {
1543
- const style = {
1544
- width: `${size.width - 4}px`,
1545
- height: `${size.height - 4}px`,
1546
- left: `${size.absolute.left ? 0 : "auto"}`,
1547
- top: `${size.absolute.top ? 0 : "auto"}`,
1548
- right: `${size.absolute.left ? "auto" : 0}`,
1549
- bottom: `${size.absolute.top ? "auto" : 0}`
1550
- };
1551
- innerDomRef.current.style.width = style.width;
1552
- innerDomRef.current.style.height = style.height;
1553
- innerDomRef.current.style.left = style.left;
1554
- innerDomRef.current.style.top = style.top;
1555
- innerDomRef.current.style.right = style.right;
1556
- innerDomRef.current.style.bottom = style.bottom;
1557
- innerStyle.current = style;
1558
- }
1700
+ if (domRef.current && innerDomRef.current) applyFloatDomLayout(domRef.current, innerDomRef.current, resolveFloatDomLayout(position, {
1701
+ wrapperInset,
1702
+ contentInset
1703
+ }));
1559
1704
  });
1560
1705
  return () => {
1561
1706
  subscription.unsubscribe();
1562
- sizeSubscription.unsubscribe();
1563
1707
  };
1564
- }, [layer.position$, size$]);
1708
+ }, [
1709
+ contentInset,
1710
+ layer.position$,
1711
+ wrapperInset
1712
+ ]);
1565
1713
  const instance = univerInstanceService.getUnit(layer.unitId);
1566
1714
  const docDisabled = instance instanceof DocumentDataModel ? instance.getDisabled() : void 0;
1567
1715
  const component = useMemo(() => Component ? /* @__PURE__ */ jsx(Component, {
@@ -1575,36 +1723,34 @@ const FloatDomSingle = memo((props) => {
1575
1723
  }
1576
1724
  }) : null, [Component, layerProps]);
1577
1725
  if (!position) return null;
1726
+ const layout = resolveFloatDomLayout(position, layer.contentBox);
1578
1727
  return /* @__PURE__ */ jsx("div", {
1579
1728
  ref: domRef,
1580
- className: "univer-z-10",
1729
+ className: "univer-absolute univer-z-10 univer-origin-center",
1581
1730
  style: {
1582
- position: "absolute",
1583
- top: topRef.current,
1584
- left: leftRef.current,
1585
- width: Math.max(position.endX - position.startX - 2, 0),
1586
- height: Math.max(position.endY - position.startY - 2, 0),
1587
- transform: transformRef.current,
1588
- overflow: "hidden",
1589
- transformOrigin: "center center"
1731
+ ...layout.wrapper,
1732
+ overflow: floatDomOverflow.outerOverflow
1590
1733
  },
1591
1734
  onPointerMove: (e) => {
1592
- layer.onPointerMove(e.nativeEvent);
1735
+ if (shouldForwardFloatDomEvents(layer)) layer.onPointerMove(e.nativeEvent);
1593
1736
  },
1594
1737
  onPointerDown: (e) => {
1595
- layer.onPointerDown(e.nativeEvent);
1738
+ if (shouldForwardFloatDomEvents(layer)) layer.onPointerDown(e.nativeEvent);
1596
1739
  },
1597
1740
  onPointerUp: (e) => {
1598
- layer.onPointerUp(e.nativeEvent);
1741
+ if (shouldForwardFloatDomEvents(layer)) layer.onPointerUp(e.nativeEvent);
1599
1742
  },
1600
1743
  onWheel: (e) => {
1601
- layer.onWheel(e.nativeEvent);
1744
+ if (shouldForwardFloatDomEvents(layer)) layer.onWheel(e.nativeEvent);
1602
1745
  },
1603
1746
  children: /* @__PURE__ */ jsx("div", {
1604
1747
  id,
1605
1748
  ref: innerDomRef,
1606
1749
  className: "univer-absolute univer-overflow-hidden",
1607
- style: { ...innerStyle.current },
1750
+ style: {
1751
+ ...layout.inner,
1752
+ overflow: floatDomOverflow.innerOverflow
1753
+ },
1608
1754
  children: component
1609
1755
  })
1610
1756
  });
@@ -1613,9 +1759,8 @@ const FloatDom = ({ unitId }) => {
1613
1759
  var _layers$filter;
1614
1760
  const instanceService = useDependency(IUniverInstanceService);
1615
1761
  const layers = useObservable(useDependency(CanvasFloatDomService).domLayers$);
1616
- const focusUnit = useObservable(instanceService.focused$);
1617
- const currentUnitId = unitId || focusUnit;
1618
- return layers === null || layers === void 0 || (_layers$filter = layers.filter((layer) => layer[1].unitId === currentUnitId)) === null || _layers$filter === void 0 ? void 0 : _layers$filter.map((layer) => {
1762
+ const currentUnitId = resolveFloatDomCurrentUnitId(unitId, useObservable(instanceService.focused$));
1763
+ 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) => {
1619
1764
  var _layer$1$domId;
1620
1765
  return /* @__PURE__ */ jsx(FloatDomSingle, {
1621
1766
  id: (_layer$1$domId = layer[1].domId) !== null && _layer$1$domId !== void 0 ? _layer$1$domId : layer[0],
@@ -1623,6 +1768,27 @@ const FloatDom = ({ unitId }) => {
1623
1768
  }, layer[0]);
1624
1769
  });
1625
1770
  };
1771
+ function resolveFloatDomCurrentUnitId(unitId, focusedUnit) {
1772
+ if (typeof unitId === "string") return unitId;
1773
+ if (typeof focusedUnit === "string") return focusedUnit;
1774
+ if (focusedUnit != null && typeof focusedUnit === "object" && "getUnitId" in focusedUnit && typeof focusedUnit.getUnitId === "function") {
1775
+ const focusedUnitId = focusedUnit.getUnitId();
1776
+ return typeof focusedUnitId === "string" ? focusedUnitId : null;
1777
+ }
1778
+ return null;
1779
+ }
1780
+ function resolveFloatDomOverflow(props) {
1781
+ var _viewport$bleedWidth;
1782
+ const viewport = props.customBlockRenderViewport;
1783
+ 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 {
1784
+ outerOverflow: "hidden",
1785
+ innerOverflow: "hidden"
1786
+ };
1787
+ return {
1788
+ outerOverflow: "visible",
1789
+ innerOverflow: "visible"
1790
+ };
1791
+ }
1626
1792
 
1627
1793
  //#endregion
1628
1794
  //#region src/services/popup/canvas-popup.service.ts
@@ -1929,13 +2095,41 @@ function CanvasPopup() {
1929
2095
  return useObservable(popupService.popups$, void 0, true).map((item) => {
1930
2096
  const [key, popup] = item;
1931
2097
  const Component = componentManager.get(popup.componentKey);
2098
+ const PopupComponent = Component && popup.connectorInjector ? connectInjector(Component, popup.connectorInjector) : Component;
1932
2099
  return /* @__PURE__ */ jsx(SingleCanvasPopup, {
1933
2100
  popup,
1934
- children: Component ? /* @__PURE__ */ jsx(Component, { popup }) : null
2101
+ children: PopupComponent && /* @__PURE__ */ jsx(PopupComponent, { popup })
1935
2102
  }, key);
1936
2103
  });
1937
2104
  }
1938
2105
 
2106
+ //#endregion
2107
+ //#region src/services/ribbon/ribbon-override.service.ts
2108
+ const IRibbonOverrideService = createIdentifier("univer.ribbon-override-service");
2109
+ var RibbonOverrideService = class extends Disposable {
2110
+ constructor(..._args) {
2111
+ super(..._args);
2112
+ _defineProperty(this, "_override$", new BehaviorSubject(null));
2113
+ _defineProperty(this, "override$", this._override$.asObservable());
2114
+ }
2115
+ getOverride() {
2116
+ return this._override$.getValue();
2117
+ }
2118
+ activate(override) {
2119
+ this._override$.next(override);
2120
+ }
2121
+ clear(id) {
2122
+ const current = this.getOverride();
2123
+ if (!current) return;
2124
+ if (!id || current.id === id) this._override$.next(null);
2125
+ }
2126
+ dispose() {
2127
+ this._override$.next(null);
2128
+ this._override$.complete();
2129
+ super.dispose();
2130
+ }
2131
+ };
2132
+
1939
2133
  //#endregion
1940
2134
  //#region src/services/ribbon/ribbon.service.ts
1941
2135
  const IRibbonService = createIdentifier("univer.ribbon-service");
@@ -2418,39 +2612,52 @@ const TooltipWrapperContext = createContext({
2418
2612
  dropdownVisible: false,
2419
2613
  setDropdownVisible: (_visible) => {}
2420
2614
  });
2615
+ const ToolbarDropdownContext = createContext(null);
2616
+ function ToolbarDropdownProvider(props) {
2617
+ const [openDropdownKey, setOpenDropdownKey] = useState(null);
2618
+ const contextValue = useMemo(() => ({
2619
+ openDropdownKey,
2620
+ setOpenDropdownKey
2621
+ }), [openDropdownKey]);
2622
+ return /* @__PURE__ */ jsx(ToolbarDropdownContext.Provider, {
2623
+ value: contextValue,
2624
+ children: props.children
2625
+ });
2626
+ }
2421
2627
  const TooltipWrapper = forwardRef((props, ref) => {
2422
- const { children, ...tooltipProps } = props;
2628
+ const { children, dropdownKey, ...tooltipProps } = props;
2423
2629
  const spanRef = useRef(null);
2424
2630
  const [tooltipVisible, setTooltipVisible] = useState(false);
2425
- const [dropdownVisible, setDropdownVisible] = useState(false);
2631
+ const [localDropdownVisible, setLocalDropdownVisible] = useState(false);
2632
+ const toolbarDropdownContext = useContext(ToolbarDropdownContext);
2633
+ const dropdownVisible = dropdownKey && toolbarDropdownContext ? toolbarDropdownContext.openDropdownKey === dropdownKey : localDropdownVisible;
2426
2634
  function handleChangeTooltipVisible(visible) {
2427
2635
  if (dropdownVisible) setTooltipVisible(false);
2428
2636
  else setTooltipVisible(visible);
2429
2637
  }
2430
- function handleChangeDropdownVisible(visible) {
2431
- setDropdownVisible(visible);
2638
+ const handleChangeDropdownVisible = useCallback((visible) => {
2639
+ if (dropdownKey && toolbarDropdownContext) toolbarDropdownContext.setOpenDropdownKey(visible ? dropdownKey : null);
2640
+ else setLocalDropdownVisible(visible);
2432
2641
  setTooltipVisible(false);
2433
- }
2642
+ }, [dropdownKey, toolbarDropdownContext]);
2434
2643
  const contextValue = useMemo(() => ({
2435
2644
  dropdownVisible,
2436
2645
  setDropdownVisible: handleChangeDropdownVisible
2437
- }), [dropdownVisible]);
2646
+ }), [dropdownVisible, handleChangeDropdownVisible]);
2438
2647
  useImperativeHandle(ref, () => ({ el: spanRef.current }));
2648
+ const content = /* @__PURE__ */ jsx("span", {
2649
+ ref: spanRef,
2650
+ children: /* @__PURE__ */ jsx(TooltipWrapperContext.Provider, {
2651
+ value: contextValue,
2652
+ children
2653
+ })
2654
+ });
2439
2655
  return tooltipProps.title ? /* @__PURE__ */ jsx(Tooltip, {
2440
2656
  visible: tooltipVisible,
2441
2657
  onVisibleChange: handleChangeTooltipVisible,
2442
2658
  ...tooltipProps,
2443
- children: /* @__PURE__ */ jsx("span", {
2444
- ref: spanRef,
2445
- children: /* @__PURE__ */ jsx(TooltipWrapperContext.Provider, {
2446
- value: contextValue,
2447
- children
2448
- })
2449
- })
2450
- }) : /* @__PURE__ */ jsx("span", {
2451
- ref: spanRef,
2452
- children
2453
- });
2659
+ children: content
2660
+ }) : content;
2454
2661
  });
2455
2662
  function DropdownWrapper(props) {
2456
2663
  const { children, overlay, disabled, align = "start" } = props;
@@ -2503,6 +2710,10 @@ function DropdownMenuLabel({ icon, value, option, onOptionSelect }) {
2503
2710
  })]
2504
2711
  });
2505
2712
  }
2713
+ function getOptionKey(option) {
2714
+ var _ref, _ref2, _option$id, _option$label2;
2715
+ 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);
2716
+ }
2506
2717
  function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, onOptionSelect }) {
2507
2718
  const { dropdownVisible, setDropdownVisible } = useContext(TooltipWrapperContext);
2508
2719
  const menuManagerService = useDependency(IMenuManagerService);
@@ -2531,6 +2742,9 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
2531
2742
  function handleVisibleChange(visible) {
2532
2743
  setDropdownVisible(visible);
2533
2744
  }
2745
+ function handleEmbedBoundaryFocusOutside(event) {
2746
+ keepInteractionInsideSameEmbedBoundary(event);
2747
+ }
2534
2748
  function handleOptionSelect(option) {
2535
2749
  onOptionSelect(option);
2536
2750
  setDropdownVisible(false);
@@ -2570,19 +2784,19 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
2570
2784
  }, [menuItems]);
2571
2785
  if (slot) return /* @__PURE__ */ jsx(DropdownWrapper, {
2572
2786
  disabled,
2573
- overlay: options.map((option, index) => /* @__PURE__ */ jsx(DropdownMenuLabel, {
2787
+ overlay: options.map((option) => /* @__PURE__ */ jsx(DropdownMenuLabel, {
2574
2788
  value,
2575
2789
  option,
2576
2790
  onOptionSelect: handleOptionSelect
2577
- }, index)),
2791
+ }, getOptionKey(option))),
2578
2792
  children
2579
2793
  });
2580
2794
  if (options === null || options === void 0 ? void 0 : options.length) {
2581
2795
  const items = options.map((option) => {
2582
- var _option$label2;
2796
+ var _option$label3;
2583
2797
  return {
2584
2798
  type: "item",
2585
- className: clsx({ "focus:univer-bg-white": typeof option.label !== "string" && ((_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.hoverable) === false }),
2799
+ className: clsx({ "focus:univer-bg-white": typeof option.label !== "string" && ((_option$label3 = option.label) === null || _option$label3 === void 0 ? void 0 : _option$label3.hoverable) === false }),
2586
2800
  children: /* @__PURE__ */ jsx(DropdownMenuLabel, {
2587
2801
  icon: option.icon,
2588
2802
  value,
@@ -2625,6 +2839,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
2625
2839
  disabled,
2626
2840
  open: dropdownVisible,
2627
2841
  onOpenChange: handleVisibleChange,
2842
+ onFocusOutside: handleEmbedBoundaryFocusOutside,
2843
+ onInteractOutside: handleEmbedBoundaryFocusOutside,
2628
2844
  children
2629
2845
  });
2630
2846
  } else {
@@ -2659,6 +2875,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
2659
2875
  disabled,
2660
2876
  open: dropdownVisible,
2661
2877
  onOpenChange: handleVisibleChange,
2878
+ onFocusOutside: handleEmbedBoundaryFocusOutside,
2879
+ onInteractOutside: handleEmbedBoundaryFocusOutside,
2662
2880
  children
2663
2881
  });
2664
2882
  }
@@ -2667,14 +2885,14 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
2667
2885
  //#endregion
2668
2886
  //#region src/views/components/ribbon/ToolbarItem.tsx
2669
2887
  const toolbarDisabledClassName = "univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600";
2670
- const toolbarButtonSelectorRootVariants = cva("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", {
2888
+ const toolbarButtonSelectorRootVariants = cva("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 rtl:univer-pl-5 rtl:univer-pr-0 dark:hover:!univer-bg-gray-700", {
2671
2889
  variants: { disabled: {
2672
2890
  true: toolbarDisabledClassName,
2673
2891
  false: "univer-text-gray-900 dark:!univer-text-white"
2674
2892
  } },
2675
2893
  defaultVariants: { disabled: false }
2676
2894
  });
2677
- const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600", {
2895
+ const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 rtl:univer-rounded-l-none rtl:univer-rounded-r dark:hover:!univer-bg-gray-600", {
2678
2896
  variants: {
2679
2897
  active: {
2680
2898
  true: "univer-bg-gray-200 dark:!univer-bg-gray-500",
@@ -2695,7 +2913,7 @@ const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-ma
2695
2913
  disabled: false
2696
2914
  }
2697
2915
  });
2698
- const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600", {
2916
+ const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 rtl:univer-left-0 rtl:univer-right-auto rtl:univer-rounded-l rtl:univer-rounded-r-none dark:hover:!univer-bg-gray-600", {
2699
2917
  variants: {
2700
2918
  disabled: {
2701
2919
  true: toolbarDisabledClassName,
@@ -2895,6 +3113,7 @@ const ToolbarItem = forwardRef((props, ref) => {
2895
3113
  ref,
2896
3114
  title: tooltipTitle,
2897
3115
  placement: "bottom",
3116
+ dropdownKey: id,
2898
3117
  children: renderItem()
2899
3118
  });
2900
3119
  });
@@ -2902,15 +3121,20 @@ const ToolbarItem = forwardRef((props, ref) => {
2902
3121
  //#endregion
2903
3122
  //#region src/views/components/ribbon/Ribbon.tsx
2904
3123
  function Ribbon(props) {
2905
- const { ribbonType, headerMenuComponents, headerMenu = true } = props;
2906
- const ribbonService = useDependency(IRibbonService);
3124
+ var _ribbonOverride$ribbo;
3125
+ const { ribbonType, headerMenuComponents, headerMenu = true, toolbarOnly = false, headerClassName } = props;
3126
+ const defaultRibbonService = useDependency(IRibbonService);
3127
+ const ribbonOverrideService = useDependency(IRibbonOverrideService);
2907
3128
  const localeService = useDependency(LocaleService);
3129
+ const ribbonOverride = useObservable(ribbonOverrideService.override$, ribbonOverrideService.getOverride());
3130
+ const ribbonService = (_ribbonOverride$ribbo = ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.ribbonService) !== null && _ribbonOverride$ribbo !== void 0 ? _ribbonOverride$ribbo : defaultRibbonService;
2908
3131
  const containerRef = useRef(null);
2909
3132
  const toolbarItemRefs = useRef({});
2910
3133
  const ribbonData = useObservable(ribbonService.ribbon$, []);
2911
3134
  const activatedTab = useObservable(ribbonService.activatedTab$, "ribbon.start");
2912
3135
  const collapsedIds = useObservable(ribbonService.collapsedIds$, []);
2913
3136
  const fakeToolbarVisible = useObservable(ribbonService.fakeToolbarVisible$, false);
3137
+ const hideToolbar = (ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.hideToolbar) === true;
2914
3138
  const ribbon = useMemo(() => {
2915
3139
  if (ribbonType === "simple") {
2916
3140
  const simpleRibbon = [{
@@ -2936,7 +3160,7 @@ function Ribbon(props) {
2936
3160
  const handleSelectTab = useCallback((group) => {
2937
3161
  toolbarItemRefs.current = {};
2938
3162
  ribbonService.setActivatedTab(group.key);
2939
- }, []);
3163
+ }, [ribbonService]);
2940
3164
  const activeGroup = useMemo(() => {
2941
3165
  var _ribbon$find$children, _ribbon$find2;
2942
3166
  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 : [];
@@ -2964,6 +3188,13 @@ function Ribbon(props) {
2964
3188
  activatedTab
2965
3189
  ]);
2966
3190
  useEffect(() => {
3191
+ if (hideToolbar) {
3192
+ toolbarItemRefs.current = {};
3193
+ ribbonService.setCollapsedIds([]);
3194
+ ribbonService.setFakeToolbarVisible(false);
3195
+ return;
3196
+ }
3197
+ if (!containerRef.current) return;
2967
3198
  let timer = null;
2968
3199
  const observer = new ResizeObserver(throttle((entries) => {
2969
3200
  for (const entry of entries) {
@@ -2993,7 +3224,12 @@ function Ribbon(props) {
2993
3224
  timer && cancelAnimationFrame(timer);
2994
3225
  observer.disconnect();
2995
3226
  };
2996
- }, [ribbon, activatedTab]);
3227
+ }, [
3228
+ hideToolbar,
3229
+ ribbon,
3230
+ activatedTab,
3231
+ ribbonService
3232
+ ]);
2997
3233
  const fakeToolbar = useMemo(() => {
2998
3234
  return /* @__PURE__ */ jsx("div", {
2999
3235
  "aria-hidden": "true",
@@ -3018,75 +3254,117 @@ function Ribbon(props) {
3018
3254
  })
3019
3255
  });
3020
3256
  }, [activeGroup.allGroups, fakeToolbarVisible]);
3021
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3022
- /* @__PURE__ */ jsxs("div", {
3023
- "data-u-comp": "ribbon-header-menu",
3024
- className: clsx("univer-relative univer-select-none", { "univer-h-9": ribbonType === "classic" || headerMenuComponents && headerMenuComponents.size > 0 }),
3025
- children: [ribbonType === "classic" && ribbon.length >= 1 && /* @__PURE__ */ jsx(ClassicMenu, {
3026
- ribbon,
3027
- activatedTab,
3028
- onSelectTab: handleSelectTab
3029
- }), headerMenu && headerMenuComponents && headerMenuComponents.size > 0 && /* @__PURE__ */ jsx("div", {
3030
- className: "univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-items-center univer-gap-2 [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",
3031
- children: /* @__PURE__ */ jsx(ComponentContainer, { components: headerMenuComponents })
3032
- })]
3033
- }),
3034
- /* @__PURE__ */ jsxs("div", {
3035
- className: clsx("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3 univer-text-sm", {
3036
- "univer-grid-cols-[1fr] univer-justify-center": ribbonType === "classic" || ribbon.length === 1,
3037
- "univer-grid-cols-[auto,1fr]": ribbon.length > 1 && ribbonType !== "classic"
3038
- }, borderBottomClassName),
3039
- children: [ribbonType === "collapsed" && ribbon.length >= 1 && /* @__PURE__ */ jsx(DefaultMenu, {
3040
- ribbon,
3041
- activatedTab,
3042
- onSelectTab: handleSelectTab
3043
- }), /* @__PURE__ */ jsxs("div", {
3044
- "data-u-comp": "ribbon-toolbar",
3045
- ref: containerRef,
3046
- className: clsx("univer-flex univer-overflow-hidden", divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
3047
- role: "toolbar",
3048
- "aria-label": localeService.t(activatedTabTitle),
3049
- children: [activeGroup.visibleGroups.map((groupItem) => {
3050
- var _groupItem$children3, _groupItem$children4;
3051
- return (((_groupItem$children3 = groupItem.children) === null || _groupItem$children3 === void 0 ? void 0 : _groupItem$children3.length) || groupItem.item) && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
3052
- className: "univer-grid univer-shrink-0 univer-grid-flow-col univer-gap-2 univer-px-2 empty:univer-hidden",
3053
- children: groupItem.children && ((_groupItem$children4 = groupItem.children) === null || _groupItem$children4 === void 0 ? void 0 : _groupItem$children4.map((child) => child.item && /* @__PURE__ */ jsx(ToolbarItem, { ...child.item }, child.key)))
3054
- }) }, groupItem.key);
3055
- }), collapsedIds.length > 0 && /* @__PURE__ */ jsx("div", {
3056
- "data-u-comp": "ribbon-toolbar-more",
3057
- className: "univer-pl-2 rtl:univer-pr-2",
3058
- children: /* @__PURE__ */ jsx(Dropdown, {
3059
- collisionPadding: {
3060
- right: 12,
3061
- left: 12
3062
- },
3063
- onOpenAutoFocus: (e) => e.preventDefault(),
3064
- overlay: /* @__PURE__ */ jsx("div", {
3065
- className: "univer-box-border univer-grid univer-max-w-[--radix-popper-available-width] univer-gap-2 univer-p-2",
3066
- children: activeGroup.hiddenGroups.map((groupItem) => {
3067
- var _groupItem$children5;
3068
- return /* @__PURE__ */ jsx("div", {
3069
- className: "univer-flex univer-items-center univer-gap-2",
3070
- children: /* @__PURE__ */ jsx("div", {
3071
- className: "univer-flex univer-flex-wrap univer-gap-2",
3072
- children: groupItem.children ? (_groupItem$children5 = groupItem.children) === null || _groupItem$children5 === void 0 ? void 0 : _groupItem$children5.map((child) => child.item && /* @__PURE__ */ jsx(ToolbarItem, { ...child.item }, child.key)) : groupItem.item && /* @__PURE__ */ jsx(ToolbarItem, { ...groupItem.item }, groupItem.key)
3073
- })
3074
- }, groupItem.key);
3075
- })
3076
- }),
3077
- children: /* @__PURE__ */ jsx("button", {
3078
- type: "button",
3079
- className: toolbarButtonClassName,
3080
- "aria-label": localeService.t("ui.ribbon.more"),
3081
- "aria-haspopup": "true",
3082
- children: /* @__PURE__ */ jsx(MoreVerticalIcon, {})
3257
+ const embedRibbonOverrideAttributes = ribbonOverride ? {
3258
+ "data-embed-ribbon-override": "true",
3259
+ "data-embed-id": ribbonOverride.id
3260
+ } : {};
3261
+ return /* @__PURE__ */ jsx(RibbonOverrideRuntimeProvider, {
3262
+ override: ribbonOverride,
3263
+ children: /* @__PURE__ */ jsxs(Fragment$1, { children: [
3264
+ /* @__PURE__ */ jsxs("div", {
3265
+ "data-u-comp": "ribbon-header-menu",
3266
+ ...embedRibbonOverrideAttributes,
3267
+ className: clsx("univer-relative univer-select-none", headerClassName, {
3268
+ "univer-hidden": toolbarOnly,
3269
+ "univer-h-9": !toolbarOnly && (ribbonType === "classic" || headerMenuComponents && headerMenuComponents.size > 0)
3270
+ }),
3271
+ children: [
3272
+ !toolbarOnly && (ribbonOverride === null || ribbonOverride === void 0 ? void 0 : ribbonOverride.placeholderTitle) && ribbon.length === 0 && /* @__PURE__ */ jsx("div", {
3273
+ className: clsx("univer-flex univer-h-9 univer-items-end univer-px-3", { "univer-justify-center": hideToolbar }),
3274
+ children: /* @__PURE__ */ jsx("span", {
3275
+ className: "univer-relative univer-inline-flex univer-h-8 univer-items-center univer-justify-center univer-rounded-t univer-bg-primary-50 univer-px-3 univer-text-sm univer-font-medium univer-text-primary-600",
3276
+ children: ribbonOverride.placeholderTitle
3083
3277
  })
3278
+ }),
3279
+ !toolbarOnly && ribbonType === "classic" && ribbon.length >= 1 && /* @__PURE__ */ jsx(ClassicMenu, {
3280
+ ribbon,
3281
+ activatedTab,
3282
+ onSelectTab: handleSelectTab
3283
+ }),
3284
+ headerMenu && headerMenuComponents && headerMenuComponents.size > 0 && /* @__PURE__ */ jsx("div", {
3285
+ className: "univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-flex-row univer-items-center univer-gap-2 rtl:univer-left-2 rtl:univer-right-auto [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",
3286
+ children: /* @__PURE__ */ jsx(ComponentContainer, { components: headerMenuComponents })
3084
3287
  })
3288
+ ]
3289
+ }),
3290
+ !hideToolbar && /* @__PURE__ */ jsxs("div", {
3291
+ ...embedRibbonOverrideAttributes,
3292
+ className: clsx("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3 univer-text-sm", {
3293
+ "univer-grid-cols-[1fr] univer-justify-center": ribbonType === "classic" || ribbon.length === 1,
3294
+ "univer-grid-cols-[auto,1fr]": ribbon.length > 1 && ribbonType !== "classic"
3295
+ }, borderBottomClassName),
3296
+ children: [ribbonType === "collapsed" && ribbon.length >= 1 && /* @__PURE__ */ jsx(DefaultMenu, {
3297
+ ribbon,
3298
+ activatedTab,
3299
+ onSelectTab: handleSelectTab
3300
+ }), /* @__PURE__ */ jsx("div", {
3301
+ "data-u-comp": "ribbon-toolbar",
3302
+ ref: containerRef,
3303
+ className: clsx("univer-flex univer-overflow-hidden", divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
3304
+ role: "toolbar",
3305
+ "aria-label": localeService.t(activatedTabTitle),
3306
+ children: /* @__PURE__ */ jsxs(ToolbarDropdownProvider, { children: [activeGroup.visibleGroups.map((groupItem) => {
3307
+ var _groupItem$children3, _groupItem$children4;
3308
+ return (((_groupItem$children3 = groupItem.children) === null || _groupItem$children3 === void 0 ? void 0 : _groupItem$children3.length) || groupItem.item) && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
3309
+ className: "univer-grid univer-shrink-0 univer-grid-flow-col univer-gap-2 univer-px-2 empty:univer-hidden",
3310
+ children: groupItem.children && ((_groupItem$children4 = groupItem.children) === null || _groupItem$children4 === void 0 ? void 0 : _groupItem$children4.map((child) => child.item && /* @__PURE__ */ jsx(ToolbarItem, { ...child.item }, child.key)))
3311
+ }) }, groupItem.key);
3312
+ }), collapsedIds.length > 0 && /* @__PURE__ */ jsx("div", {
3313
+ className: "univer-pl-2 rtl:univer-pr-2",
3314
+ children: /* @__PURE__ */ jsx(Dropdown, {
3315
+ collisionPadding: {
3316
+ right: 12,
3317
+ left: 12
3318
+ },
3319
+ onOpenAutoFocus: (e) => e.preventDefault(),
3320
+ overlay: /* @__PURE__ */ jsx("div", {
3321
+ className: "univer-box-border univer-grid univer-max-w-[--radix-popper-available-width] univer-gap-2 univer-p-2",
3322
+ children: activeGroup.hiddenGroups.map((groupItem) => {
3323
+ var _groupItem$children5;
3324
+ return /* @__PURE__ */ jsx("div", {
3325
+ className: "univer-flex univer-items-center univer-gap-2",
3326
+ children: /* @__PURE__ */ jsx("div", {
3327
+ className: "univer-flex univer-flex-wrap univer-gap-2",
3328
+ children: groupItem.children ? (_groupItem$children5 = groupItem.children) === null || _groupItem$children5 === void 0 ? void 0 : _groupItem$children5.map((child) => child.item && /* @__PURE__ */ jsx(ToolbarItem, { ...child.item }, child.key)) : groupItem.item && /* @__PURE__ */ jsx(ToolbarItem, { ...groupItem.item }, groupItem.key)
3329
+ })
3330
+ }, groupItem.key);
3331
+ })
3332
+ }),
3333
+ children: /* @__PURE__ */ jsx("button", {
3334
+ type: "button",
3335
+ className: toolbarButtonClassName,
3336
+ children: /* @__PURE__ */ jsx(MoreVerticalIcon, {})
3337
+ })
3338
+ })
3339
+ })] }, activatedTab)
3085
3340
  })]
3086
- })]
3087
- }),
3088
- fakeToolbar
3089
- ] });
3341
+ }),
3342
+ fakeToolbar
3343
+ ] })
3344
+ });
3345
+ }
3346
+ function RibbonOverrideRuntimeProvider(props) {
3347
+ var _override$portalConta;
3348
+ const { override, children } = props;
3349
+ const config = useContext(ConfigContext);
3350
+ const injector = override === null || override === void 0 ? void 0 : override.injector;
3351
+ const ConnectedRibbonOverrideConfigProvider = useMemo(() => injector ? connectInjector(RibbonOverrideConfigProvider, injector) : null, [injector]);
3352
+ if (!override || !ConnectedRibbonOverrideConfigProvider) return children;
3353
+ return /* @__PURE__ */ jsx(ConnectedRibbonOverrideConfigProvider, {
3354
+ locale: config.locale,
3355
+ direction: config.direction,
3356
+ mountContainer: (_override$portalConta = override.portalContainer) !== null && _override$portalConta !== void 0 ? _override$portalConta : config.mountContainer,
3357
+ children
3358
+ });
3359
+ }
3360
+ function RibbonOverrideConfigProvider(props) {
3361
+ const { children, locale, direction, mountContainer } = props;
3362
+ return /* @__PURE__ */ jsx(ConfigProvider, {
3363
+ locale,
3364
+ direction,
3365
+ mountContainer,
3366
+ children
3367
+ });
3090
3368
  }
3091
3369
 
3092
3370
  //#endregion
@@ -3142,11 +3420,11 @@ var ContextMenuService = class extends Disposable {
3142
3420
  enable() {
3143
3421
  this.disabled = false;
3144
3422
  }
3145
- triggerContextMenu(event, menuType) {
3423
+ triggerContextMenu(event, menuType, context) {
3146
3424
  var _this$_currentHandler3;
3147
3425
  event.stopPropagation();
3148
3426
  if (this.disabled) return;
3149
- (_this$_currentHandler3 = this._currentHandler) === null || _this$_currentHandler3 === void 0 || _this$_currentHandler3.handleContextMenu(event, menuType);
3427
+ (_this$_currentHandler3 = this._currentHandler) === null || _this$_currentHandler3 === void 0 || _this$_currentHandler3.handleContextMenu(event, menuType, context);
3150
3428
  }
3151
3429
  hideContextMenu() {
3152
3430
  var _this$_currentHandler4;
@@ -3159,6 +3437,25 @@ var ContextMenuService = class extends Disposable {
3159
3437
  }
3160
3438
  };
3161
3439
 
3440
+ //#endregion
3441
+ //#region src/services/runtime-scope/ui-runtime-scope.service.ts
3442
+ const IUIRuntimeScopeService = createIdentifier("ui.runtime-scope.service");
3443
+ var UIRuntimeScopeService = class extends Disposable {
3444
+ constructor(..._args) {
3445
+ super(..._args);
3446
+ _defineProperty(this, "_scopes", /* @__PURE__ */ new Map());
3447
+ }
3448
+ register(scope) {
3449
+ this._scopes.set(scope.unitId, scope);
3450
+ return toDisposable(() => {
3451
+ if (this._scopes.get(scope.unitId) === scope) this._scopes.delete(scope.unitId);
3452
+ });
3453
+ }
3454
+ get(unitId) {
3455
+ return unitId ? this._scopes.get(unitId) : void 0;
3456
+ }
3457
+ };
3458
+
3162
3459
  //#endregion
3163
3460
  //#region src/services/contextmenu/contextmenu-host.service.ts
3164
3461
  const IContextMenuHostService = createIdentifier("ui.contextmenu.host.service");
@@ -3863,9 +4160,11 @@ function getContextMenuSubmenuPanelClassName(sizeVariant) {
3863
4160
  }
3864
4161
  function ContextMenuPanel(props) {
3865
4162
  var _layoutService$rootCo, _layoutService$rootCo2;
3866
- const { menuType, menuSessionVersion = 0, className, activeItemIds, hiddenItemIds, sizeVariant = "default", autoFocus, autoFocusTarget = "first-item", suppressHoverUntilPointerMove = false, onCancel, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
3867
- const menuManagerService = useDependency(IMenuManagerService);
3868
- const layoutService = useDependency(ILayoutService);
4163
+ const { menuType, menuManagerService: providedMenuManagerService, layoutService: providedLayoutService, menuSessionVersion = 0, className, activeItemIds, hiddenItemIds, sizeVariant = "default", autoFocus, autoFocusTarget = "first-item", suppressHoverUntilPointerMove = false, onCancel, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
4164
+ const rootMenuManagerService = useDependency(IMenuManagerService);
4165
+ const rootLayoutService = useDependency(ILayoutService);
4166
+ const menuManagerService = providedMenuManagerService !== null && providedMenuManagerService !== void 0 ? providedMenuManagerService : rootMenuManagerService;
4167
+ const layoutService = providedLayoutService !== null && providedLayoutService !== void 0 ? providedLayoutService : rootLayoutService;
3869
4168
  const [menuElement, setMenuElement] = useState(null);
3870
4169
  const [maxMenuHeight, setMaxMenuHeight] = useState(() => {
3871
4170
  if (typeof window === "undefined") return 240;
@@ -3968,6 +4267,7 @@ function ContextMenuPanel(props) {
3968
4267
  onWheel: (event) => event.stopPropagation(),
3969
4268
  children: /* @__PURE__ */ jsx(ContextMenuMenu, {
3970
4269
  menuSchemas: menuItems,
4270
+ menuManagerService,
3971
4271
  menuSessionVersion,
3972
4272
  submenuPortalContainer,
3973
4273
  rootMenuElement: menuElement,
@@ -3983,7 +4283,7 @@ function ContextMenuPanel(props) {
3983
4283
  });
3984
4284
  }
3985
4285
  function ContextMenuMenu(props) {
3986
- const { menuSchemas, menuSessionVersion, submenuPortalContainer, rootMenuElement, activeItemIds, hiddenItemIds, hoverSuppressed, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect, maxMenuHeight } = props;
4286
+ const { menuSchemas, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, activeItemIds, hiddenItemIds, hoverSuppressed, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect, maxMenuHeight } = props;
3987
4287
  const localeService = useDependency(LocaleService);
3988
4288
  const hiddenGroupStates = useContextGroupHiddenStates$1(menuSchemas);
3989
4289
  const [activeSubmenuKey, setActiveSubmenuKey] = useState(null);
@@ -4029,6 +4329,7 @@ function ContextMenuMenu(props) {
4029
4329
  if (menuSchema.item) return /* @__PURE__ */ jsx(ContextMenuMenuItem, {
4030
4330
  menuKey: menuSchema.key,
4031
4331
  menuItem: menuSchema.item,
4332
+ menuManagerService,
4032
4333
  menuSessionVersion,
4033
4334
  submenuPortalContainer,
4034
4335
  rootMenuElement,
@@ -4049,6 +4350,7 @@ function ContextMenuMenu(props) {
4049
4350
  children: menuSchema.children.map((childSchema) => childSchema.item && /* @__PURE__ */ jsx(ContextMenuMenuItem, {
4050
4351
  menuKey: childSchema.key,
4051
4352
  menuItem: childSchema.item,
4353
+ menuManagerService,
4052
4354
  menuSessionVersion,
4053
4355
  submenuPortalContainer,
4054
4356
  rootMenuElement,
@@ -4070,6 +4372,7 @@ function ContextMenuMenu(props) {
4070
4372
  children: [titleNode, menuSchema.children.map((childSchema) => childSchema.item && /* @__PURE__ */ jsx(ContextMenuMenuItem, {
4071
4373
  menuKey: childSchema.key,
4072
4374
  menuItem: childSchema.item,
4375
+ menuManagerService,
4073
4376
  menuSessionVersion,
4074
4377
  submenuPortalContainer,
4075
4378
  rootMenuElement,
@@ -4098,6 +4401,7 @@ function ContextMenuMenu(props) {
4098
4401
  children: [titleContent, /* @__PURE__ */ jsx(ContextMenuMenuItem, {
4099
4402
  menuKey: `${menuSchema.key}-header-action`,
4100
4403
  menuItem: menuSchema.headerActionItem,
4404
+ menuManagerService,
4101
4405
  menuSessionVersion,
4102
4406
  submenuPortalContainer,
4103
4407
  rootMenuElement,
@@ -4118,10 +4422,9 @@ function ContextMenuMenu(props) {
4118
4422
  }
4119
4423
  }
4120
4424
  function ContextMenuMenuItem(props) {
4121
- const { menuKey, menuItem, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
4425
+ const { menuKey, menuItem, menuManagerService, menuSessionVersion, submenuPortalContainer, rootMenuElement, maxMenuHeight, activeSubmenuKey, setActiveSubmenuKey, activeItemIds, hiddenItemIds = [], hoverSuppressed = false, compact = false, headerAction = false, sizeVariant, onMenuPointerEnter, onMenuPointerLeave, onOptionSelect } = props;
4122
4426
  const localeService = useDependency(LocaleService);
4123
4427
  const direction = useObservable(localeService.direction$);
4124
- const menuManagerService = useDependency(IMenuManagerService);
4125
4428
  const disabled = useObservable(menuItem.disabled$, false);
4126
4429
  const activated = useObservable(menuItem.activated$, false);
4127
4430
  const hidden = useObservable(menuItem.hidden$, false);
@@ -4198,7 +4501,9 @@ function ContextMenuMenuItem(props) {
4198
4501
  const submenuRect = submenuElement.getBoundingClientRect();
4199
4502
  const rightLeft = menuItemRect.right - submenuOverlapOffset;
4200
4503
  const leftLeft = menuItemRect.left - submenuRect.width + submenuOverlapOffset;
4201
- const useLeft = rightLeft + submenuRect.width + menuViewportPadding > window.innerWidth && leftLeft >= menuViewportPadding;
4504
+ const hasLeftSpace = leftLeft >= menuViewportPadding;
4505
+ const hasRightSpace = rightLeft + submenuRect.width + menuViewportPadding <= window.innerWidth;
4506
+ const useLeft = direction === "rtl" ? hasLeftSpace || !hasRightSpace : !hasRightSpace && hasLeftSpace;
4202
4507
  const left = useLeft ? leftLeft : rightLeft;
4203
4508
  setSubmenuPlacement(useLeft ? "left" : "right");
4204
4509
  const maxTop = window.innerHeight - menuViewportPadding - submenuRect.height;
@@ -4217,6 +4522,7 @@ function ContextMenuMenuItem(props) {
4217
4522
  window.removeEventListener("scroll", updateSubmenuPosition, true);
4218
4523
  };
4219
4524
  }, [
4525
+ direction,
4220
4526
  submenuVisible,
4221
4527
  hasSelectionSubmenu,
4222
4528
  hasSubItemSubmenu
@@ -4250,6 +4556,7 @@ function ContextMenuMenuItem(props) {
4250
4556
  });
4251
4557
  const canExecuteItem = menuItem.type === 0 || menuItem.type === 2;
4252
4558
  const renderAsContainer = isNonSelectableLabel(menuItem.label);
4559
+ const SubmenuAffordanceIcon = direction === "rtl" ? MoreLeftIcon : MoreRightIcon;
4253
4560
  const interactiveItemClassName = clsx(itemClassName, isNonHoverableLabel(menuItem.label) && "hover:univer-bg-transparent dark:hover:!univer-bg-transparent");
4254
4561
  return /* @__PURE__ */ jsxs("div", {
4255
4562
  ref: menuItemElementRef,
@@ -4278,7 +4585,7 @@ function ContextMenuMenuItem(props) {
4278
4585
  children: [renderAsContainer ? /* @__PURE__ */ jsxs("div", {
4279
4586
  className: interactiveItemClassName,
4280
4587
  "aria-disabled": disabled,
4281
- children: [contentNode, hasSubmenu && /* @__PURE__ */ jsx(MoreRightIcon, { className: `
4588
+ children: [contentNode, hasSubmenu && /* @__PURE__ */ jsx(SubmenuAffordanceIcon, { className: `
4282
4589
  ${sizeVariant === "paragraph-t" ? "univer-size-4" : "univer-size-3.5"}
4283
4590
  univer-text-gray-400
4284
4591
  dark:!univer-text-gray-200
@@ -4321,7 +4628,7 @@ function ContextMenuMenuItem(props) {
4321
4628
  label: menuKey
4322
4629
  });
4323
4630
  },
4324
- children: [contentNode, hasSubmenu && !compact && /* @__PURE__ */ jsx(MoreRightIcon, { className: `
4631
+ children: [contentNode, hasSubmenu && !compact && /* @__PURE__ */ jsx(SubmenuAffordanceIcon, { className: `
4325
4632
  ${sizeVariant === "paragraph-t" ? "univer-size-4" : "univer-size-3.5"}
4326
4633
  univer-text-gray-400
4327
4634
  dark:!univer-text-gray-200
@@ -4368,7 +4675,7 @@ function ContextMenuMenuItem(props) {
4368
4675
  const optionSelected = typeof inputValue !== "undefined" && String(inputValue) === String(option.value);
4369
4676
  const optionSelectable = !isNonSelectableLabel(option.label);
4370
4677
  const optionHoverable = !isNonHoverableLabel(option.label);
4371
- const optionClassName = clsx(sizeVariant === "paragraph-t" ? "univer-relative univer-box-border univer-flex univer-min-h-10 univer-w-full univer-items-center univer-rounded-lg univer-border-none univer-bg-transparent univer-px-3 univer-text-left univer-text-base dark:!univer-text-white" : "univer-relative univer-box-border univer-flex univer-min-h-8 univer-w-full univer-items-center univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm dark:!univer-text-white", option.disabled ? "univer-cursor-not-allowed univer-opacity-60" : optionHoverable && "univer-cursor-pointer hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-600");
4678
+ const optionClassName = clsx(optionSelectable ? sizeVariant === "paragraph-t" ? "univer-relative univer-box-border univer-flex univer-min-h-10 univer-w-full univer-items-center univer-rounded-lg univer-border-none univer-bg-transparent univer-px-3 univer-text-left univer-text-base dark:!univer-text-white" : "univer-relative univer-box-border univer-flex univer-min-h-8 univer-w-full univer-items-center univer-rounded-md univer-border-none univer-bg-transparent univer-px-2 univer-text-left univer-text-sm dark:!univer-text-white" : "univer-relative univer-box-border univer-block univer-w-full univer-border-none univer-bg-transparent univer-p-0", option.disabled ? "univer-cursor-not-allowed univer-opacity-60" : optionHoverable && "univer-cursor-pointer hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-600");
4372
4679
  const optionContentNode = /* @__PURE__ */ jsxs(Fragment$1, { children: [optionSelectable && optionSelected && /* @__PURE__ */ jsx(CheckMarkIcon, { className: clsx("univer-absolute univer-left-0 univer-text-primary-600", sizeVariant === "paragraph-t" ? "univer-size-5" : "univer-size-4") }), /* @__PURE__ */ jsx("span", {
4373
4680
  className: clsx(getContextMenuContentClassName(sizeVariant), optionSelectable && optionSelected && "univer-pl-4"),
4374
4681
  children: /* @__PURE__ */ jsx(CustomLabel, {
@@ -4410,6 +4717,7 @@ function ContextMenuMenuItem(props) {
4410
4717
  })
4411
4718
  }), hasSubItemSubmenu && /* @__PURE__ */ jsx(ContextMenuMenu, {
4412
4719
  menuSchemas: subMenuItems,
4720
+ menuManagerService,
4413
4721
  menuSessionVersion,
4414
4722
  submenuPortalContainer,
4415
4723
  rootMenuElement,
@@ -4454,7 +4762,7 @@ function useContextGroupHiddenStates$1(menuSchemas) {
4454
4762
  //#endregion
4455
4763
  //#region src/views/components/context-menu/AnchoredContextMenu.tsx
4456
4764
  function AnchoredContextMenu(props) {
4457
- const { hostId, visible, anchorRect, menuType, anchorVertical = "bottom", menuOffset = 0, onRequestClose, onOptionSelect } = props;
4765
+ const { hostId, visible, anchorRect, menuType, anchorVertical = "bottom", menuOffset = 0, menuManagerService, layoutService, onRequestClose, onOptionSelect } = props;
4458
4766
  const contentRef = useRef(null);
4459
4767
  const contextMenuHostService = useDependency(IContextMenuHostService);
4460
4768
  const onRequestCloseRef = useRef(onRequestClose);
@@ -4543,6 +4851,8 @@ function AnchoredContextMenu(props) {
4543
4851
  ref: contentRef,
4544
4852
  children: menuType && /* @__PURE__ */ jsx(ContextMenuPanel, {
4545
4853
  menuType,
4854
+ menuManagerService,
4855
+ layoutService,
4546
4856
  menuSessionVersion: menuSessionVersionRef.current,
4547
4857
  onOptionSelect
4548
4858
  })
@@ -4557,10 +4867,13 @@ function DesktopContextMenu() {
4557
4867
  const [visible, setVisible] = useState(false);
4558
4868
  const [menuType, setMenuType] = useState("");
4559
4869
  const [anchorRect, setAnchorRect] = useState(null);
4870
+ const [menuContext, setMenuContext] = useState();
4560
4871
  const visibleRef = useRef(visible);
4561
4872
  const contextMenuService = useDependency(IContextMenuService);
4562
4873
  const commandService = useDependency(ICommandService);
4563
- const injector = useInjector();
4874
+ const layoutService = useDependency(ILayoutService);
4875
+ const menuManagerService = useDependency(IMenuManagerService);
4876
+ const runtimeScopeService = useDependency(IUIRuntimeScopeService);
4564
4877
  visibleRef.current = visible;
4565
4878
  useEffect(() => {
4566
4879
  const disposables = contextMenuService.registerContextMenuHandler({
@@ -4577,10 +4890,11 @@ function DesktopContextMenu() {
4577
4890
  };
4578
4891
  }, [contextMenuService]);
4579
4892
  /** A function to open context menu with given position and menu type. */
4580
- function handleContextMenu(event, menuType) {
4893
+ function handleContextMenu(event, menuType, context) {
4581
4894
  setVisible(false);
4582
4895
  requestAnimationFrame(() => {
4583
4896
  setMenuType(menuType);
4897
+ setMenuContext(context);
4584
4898
  setAnchorRect({
4585
4899
  left: event.clientX,
4586
4900
  top: event.clientY,
@@ -4592,18 +4906,24 @@ function DesktopContextMenu() {
4592
4906
  function handleClose() {
4593
4907
  setVisible(false);
4594
4908
  }
4909
+ const activeScope = runtimeScopeService.get(menuContext === null || menuContext === void 0 ? void 0 : menuContext.unitId);
4910
+ const activeMenuManagerService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(IMenuManagerService)) ? activeScope.get(IMenuManagerService) : menuManagerService;
4911
+ const activeCommandService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(ICommandService)) ? activeScope.get(ICommandService) : commandService;
4912
+ const activeLayoutService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(ILayoutService)) ? activeScope.get(ILayoutService) : layoutService;
4595
4913
  return /* @__PURE__ */ jsx(AnchoredContextMenu, {
4596
4914
  hostId: DESKTOP_CONTEXT_MENU_HOST_ID,
4597
4915
  visible,
4598
4916
  anchorRect,
4599
4917
  menuType,
4918
+ menuManagerService: activeMenuManagerService,
4919
+ layoutService: activeLayoutService,
4600
4920
  onRequestClose: handleClose,
4601
4921
  onOptionSelect: (params) => {
4602
4922
  const { label: id, commandId, value } = params;
4603
4923
  const rawParams = typeof params.params === "function" ? params.params() : params.params;
4604
4924
  const commandParams = typeof rawParams === "undefined" ? { value } : rawParams;
4605
- if (commandService) commandService.executeCommand(commandId !== null && commandId !== void 0 ? commandId : id, commandParams);
4606
- injector.get(ILayoutService).focus();
4925
+ if (activeCommandService) activeCommandService.executeCommand(commandId !== null && commandId !== void 0 ? commandId : id, commandParams);
4926
+ activeLayoutService.focus();
4607
4927
  handleClose();
4608
4928
  }
4609
4929
  });
@@ -5179,7 +5499,9 @@ var SingleUnitUIController = class extends Disposable {
5179
5499
  }));
5180
5500
  }
5181
5501
  _changeRenderUnit(rendererId, contentElement) {
5502
+ var _this$_instanceServic2;
5182
5503
  if (this._currentRenderId === rendererId) return false;
5504
+ if ((_this$_instanceServic2 = this._instanceService.getUnitCreateOptions(rendererId)) === null || _this$_instanceServic2 === void 0 ? void 0 : _this$_instanceServic2.embeddedRender) return false;
5183
5505
  const renderer = this._renderManagerService.getRenderById(rendererId);
5184
5506
  if (!renderer || !renderer.unitId || isInternalEditorID(renderer.unitId)) return false;
5185
5507
  const currentRenderer = this._currentRenderId ? this._renderManagerService.getRenderById(this._currentRenderId) : null;
@@ -5257,7 +5579,7 @@ const IUIController = createIdentifier("univer.ui.ui-controller");
5257
5579
  //#endregion
5258
5580
  //#region package.json
5259
5581
  var name = "@univerjs/ui";
5260
- var version = "1.0.0-alpha.1";
5582
+ var version = "1.0.0-alpha.3";
5261
5583
 
5262
5584
  //#endregion
5263
5585
  //#region src/views/color-picker/interface.ts
@@ -20287,15 +20609,13 @@ function EmojiPicker(props) {
20287
20609
  children: [
20288
20610
  /* @__PURE__ */ jsxs("div", {
20289
20611
  className: "univer-flex univer-items-center univer-gap-1 univer-px-3 univer-pb-2 univer-pt-3",
20290
- children: [/* @__PURE__ */ jsxs("label", {
20291
- className: "univer-flex univer-h-8 univer-flex-1 univer-items-center univer-gap-1 univer-rounded-lg univer-border univer-border-solid univer-border-primary-500 univer-px-2 univer-text-gray-500 dark:!univer-border-primary-600 dark:!univer-text-gray-400",
20292
- children: [/* @__PURE__ */ jsx(SearchIcon, {}), /* @__PURE__ */ jsx(Input, {
20293
- "aria-label": localeService.t("ui.emojiPicker.search"),
20294
- placeholder: localeService.t("ui.emojiPicker.search"),
20295
- className: "univer-min-w-0 univer-flex-1",
20296
- value: query,
20297
- onChange: setQuery
20298
- })]
20612
+ children: [/* @__PURE__ */ jsx(Input, {
20613
+ "aria-label": localeService.t("ui.emojiPicker.search"),
20614
+ placeholder: localeService.t("ui.emojiPicker.search"),
20615
+ className: "univer-min-w-0 univer-flex-1",
20616
+ value: query,
20617
+ onChange: setQuery,
20618
+ slot: /* @__PURE__ */ jsx(SearchIcon, { className: "univer-size-4 univer-text-gray-500 dark:!univer-text-gray-400" })
20299
20619
  }), /* @__PURE__ */ jsx("button", {
20300
20620
  type: "button",
20301
20621
  "aria-label": localeService.t("ui.emojiPicker.random"),
@@ -20329,12 +20649,12 @@ function EmojiPicker(props) {
20329
20649
  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),
20330
20650
  children: [/* @__PURE__ */ jsx(CategoryButton, {
20331
20651
  selected: !isSearching && activeTab === "recent",
20332
- title: localeService.t("ui.emojiPicker.recents"),
20652
+ titleKey: "ui.emojiPicker.recents",
20333
20653
  onClick: () => scrollToSection("recent"),
20334
20654
  children: /* @__PURE__ */ jsx(RecentIcon, {})
20335
20655
  }), EMOJI_CATEGORIES.map((category) => /* @__PURE__ */ jsx(CategoryButton, {
20336
20656
  selected: !isSearching && activeTab === category.key,
20337
- title: localeService.t(category.titleKey),
20657
+ titleKey: category.titleKey,
20338
20658
  onClick: () => scrollToSection(category.key),
20339
20659
  children: /* @__PURE__ */ jsx(CategoryIcon, { category: category.key })
20340
20660
  }, category.key))]
@@ -20375,11 +20695,12 @@ function EmojiGrid(props) {
20375
20695
  });
20376
20696
  }
20377
20697
  function CategoryButton(props) {
20698
+ const localeService = useDependency(LocaleService);
20378
20699
  return /* @__PURE__ */ jsx("button", {
20379
20700
  type: "button",
20380
- "aria-label": props.title,
20701
+ "aria-label": localeService.t(props.titleKey),
20381
20702
  "aria-selected": props.selected,
20382
- title: props.title,
20703
+ title: localeService.t(props.titleKey),
20383
20704
  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"),
20384
20705
  onClick: props.onClick,
20385
20706
  children: props.children
@@ -20557,14 +20878,10 @@ let FontService = class FontService {
20557
20878
  FontService = __decorate([__decorateParam(0, IConfigService)], FontService);
20558
20879
 
20559
20880
  //#endregion
20560
- //#region src/views/font-family/FontFamily.tsx
20561
- const FontFamily = ({ id, value, disabled$ }) => {
20562
- const disabled = useObservable(disabled$);
20563
- const commandService = useDependency(ICommandService);
20564
- const localeService = useDependency(LocaleService);
20881
+ //#region src/views/font-family/use-font-list.ts
20882
+ function useFontList() {
20565
20883
  const fontService = useDependency(IFontService);
20566
- const [inputValue, setInputValue] = useState("");
20567
- const [fonts, setFonts] = useState([]);
20884
+ const [fonts, setFonts] = useState(() => fontService.getFonts());
20568
20885
  useEffect(() => {
20569
20886
  const subscription = fontService.fonts$.subscribe((fonts) => {
20570
20887
  setFonts(fonts);
@@ -20572,7 +20889,22 @@ const FontFamily = ({ id, value, disabled$ }) => {
20572
20889
  return () => {
20573
20890
  subscription.unsubscribe();
20574
20891
  };
20575
- }, []);
20892
+ }, [fontService]);
20893
+ return {
20894
+ fonts,
20895
+ fontService
20896
+ };
20897
+ }
20898
+
20899
+ //#endregion
20900
+ //#region src/views/font-family/FontFamily.tsx
20901
+ const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
20902
+ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange }) => {
20903
+ const disabledObservableValue = useObservable(disabled$);
20904
+ const disabled = Boolean(disabledProp || disabledObservableValue);
20905
+ const localeService = useDependency(LocaleService);
20906
+ const { fonts } = useFontList();
20907
+ const [draftValue, setDraftValue] = useState(null);
20576
20908
  const viewValue = useMemo(() => {
20577
20909
  if (value == null) return "";
20578
20910
  const font = fonts.find((font) => {
@@ -20585,14 +20917,12 @@ const FontFamily = ({ id, value, disabled$ }) => {
20585
20917
  fonts,
20586
20918
  localeService
20587
20919
  ]);
20588
- useMemo(() => {
20589
- setInputValue(viewValue);
20590
- }, [value]);
20920
+ const inputValue = draftValue !== null && draftValue !== void 0 ? draftValue : viewValue;
20591
20921
  function resetValue() {
20592
- setInputValue(viewValue);
20922
+ setDraftValue(null);
20593
20923
  }
20594
20924
  function handleChangeSelection(e) {
20595
- setInputValue(e.target.value);
20925
+ setDraftValue(e.target.value);
20596
20926
  }
20597
20927
  function handleKeyDown(e) {
20598
20928
  e.stopPropagation();
@@ -20604,7 +20934,7 @@ const FontFamily = ({ id, value, disabled$ }) => {
20604
20934
  }
20605
20935
  }
20606
20936
  function handleBlur() {
20607
- if (inputValue !== value) resetValue();
20937
+ if (draftValue !== null && inputValue !== viewValue) resetValue();
20608
20938
  }
20609
20939
  function confirm() {
20610
20940
  const font = fonts.find((item) => {
@@ -20616,11 +20946,12 @@ const FontFamily = ({ id, value, disabled$ }) => {
20616
20946
  }
20617
20947
  handleSelectFont(font.value);
20618
20948
  }
20619
- function handleSelectFont(value) {
20620
- commandService.executeCommand(id, { value });
20949
+ function handleSelectFont(nextValue) {
20950
+ resetValue();
20951
+ onChange(nextValue);
20621
20952
  }
20622
20953
  return /* @__PURE__ */ jsx("div", {
20623
- className: "univer-w-32 univer-truncate univer-text-sm",
20954
+ className: clsx("univer-w-32 univer-truncate univer-text-sm", className),
20624
20955
  style: { fontFamily: value },
20625
20956
  children: /* @__PURE__ */ jsx("input", {
20626
20957
  className: "univer-block univer-h-6 univer-border-none univer-bg-transparent univer-leading-6 focus:univer-outline-none dark:!univer-text-white [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-7 [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-p-0 [&_input]:univer-text-sm",
@@ -20636,25 +20967,16 @@ const FontFamily = ({ id, value, disabled$ }) => {
20636
20967
 
20637
20968
  //#endregion
20638
20969
  //#region src/views/font-family/FontFamilyItem.tsx
20639
- const FontFamilyItem = ({ id, value }) => {
20640
- const commandService = useDependency(ICommandService);
20641
- const fontService = useDependency(IFontService);
20642
- const layoutService = useDependency(ILayoutService);
20643
- const [fonts, setFonts] = useState([]);
20644
- useEffect(() => {
20645
- const subscription = fontService.fonts$.subscribe((fonts) => {
20646
- setFonts(fonts);
20647
- });
20648
- return () => {
20649
- subscription.unsubscribe();
20650
- };
20651
- }, []);
20970
+ const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
20971
+ const FontFamilyItem = ({ value, onChange }) => {
20652
20972
  const localeService = useDependency(LocaleService);
20653
- function handleSelectFont(value) {
20654
- layoutService.focus();
20655
- commandService.executeCommand(id, { value });
20973
+ const direction = useObservable(localeService.direction$, localeService.getDirection());
20974
+ const { fonts, fontService } = useFontList();
20975
+ function handleSelectFont(nextValue) {
20976
+ onChange(nextValue);
20656
20977
  }
20657
20978
  return /* @__PURE__ */ jsx("ul", {
20979
+ dir: direction,
20658
20980
  className: "univer-m-0 univer-list-none univer-p-0 univer-text-sm",
20659
20981
  style: { fontFamily: value },
20660
20982
  children: fonts.map((font) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
@@ -20671,9 +20993,52 @@ const FontFamilyItem = ({ id, value }) => {
20671
20993
  };
20672
20994
 
20673
20995
  //#endregion
20674
- //#region src/views/font-family/interface.ts
20675
- const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
20676
- const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
20996
+ //#region src/views/font-family/FontFamilyDropdown.tsx
20997
+ function FontFamilyDropdown(props) {
20998
+ const { value, onChange, ariaLabel, className, disabled: disabledProp, disabled$, inputClassName, popupClassName, popupDataComponent, title, onMouseDown, onPointerDown } = props;
20999
+ const localeService = useDependency(LocaleService);
21000
+ const direction = useObservable(localeService.direction$, localeService.getDirection());
21001
+ const disabledObservableValue = useObservable(disabled$);
21002
+ const disabled = Boolean(disabledProp || disabledObservableValue);
21003
+ const [open, setOpen] = useState(false);
21004
+ const popupDataAttributes = popupDataComponent ? { "data-u-comp": popupDataComponent } : void 0;
21005
+ function handleChange(nextValue) {
21006
+ setOpen(false);
21007
+ onChange(nextValue);
21008
+ }
21009
+ return /* @__PURE__ */ jsx(Dropdown, {
21010
+ disabled,
21011
+ open,
21012
+ onOpenChange: setOpen,
21013
+ overlay: /* @__PURE__ */ jsx("div", {
21014
+ dir: direction,
21015
+ className: clsx("univer-max-h-72 univer-min-w-44 univer-overflow-y-auto univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-p-1 univer-shadow-lg dark:!univer-border-gray-700 dark:!univer-bg-gray-900", popupClassName),
21016
+ ...popupDataAttributes,
21017
+ children: /* @__PURE__ */ jsx(FontFamilyItem, {
21018
+ value,
21019
+ onChange: handleChange
21020
+ })
21021
+ }),
21022
+ children: /* @__PURE__ */ jsxs("div", {
21023
+ "aria-disabled": disabled,
21024
+ "aria-expanded": open,
21025
+ "aria-label": ariaLabel,
21026
+ dir: direction,
21027
+ className: clsx("univer-flex univer-h-6 univer-min-w-0 univer-cursor-default univer-items-center univer-justify-between univer-gap-1 univer-rounded-md univer-px-1.5 univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-700", { "univer-cursor-not-allowed univer-opacity-60": disabled }, className),
21028
+ role: "combobox",
21029
+ tabIndex: disabled ? -1 : 0,
21030
+ title: typeof title === "string" ? title : void 0,
21031
+ onMouseDown,
21032
+ onPointerDown,
21033
+ children: [/* @__PURE__ */ jsx(FontFamily, {
21034
+ className: clsx("univer-min-w-0 univer-flex-1", inputClassName),
21035
+ value,
21036
+ disabled,
21037
+ onChange: handleChange
21038
+ }), /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-flex-shrink-0 univer-text-xs univer-text-gray-500" })]
21039
+ })
21040
+ });
21041
+ }
20677
21042
 
20678
21043
  //#endregion
20679
21044
  //#region src/views/font-size/FontSize.tsx
@@ -20833,7 +21198,9 @@ const DRAG_COMMIT_INTERVAL = 50;
20833
21198
  function Slider(props) {
20834
21199
  var _getSliderOffset;
20835
21200
  const iconManager = useDependency(IconManager);
21201
+ const localeService = useDependency(LocaleService);
20836
21202
  const { value, min = 0, max = 400, disabled = false, resetPoint = 100, shortcuts, onChange } = props;
21203
+ const isRtl = useObservable(localeService.direction$, localeService.getDirection()) === "rtl";
20837
21204
  const sliderInnerRailRef = useRef(null);
20838
21205
  const isEditingZoomRef = useRef(false);
20839
21206
  const dragValueRef = useRef(value);
@@ -20877,6 +21244,7 @@ function Slider(props) {
20877
21244
  let offsetX = clientX - railRect.x;
20878
21245
  if (offsetX <= 0) offsetX = 0;
20879
21246
  else if (offsetX >= railWidth) offsetX = railWidth;
21247
+ if (isRtl) offsetX = railWidth - offsetX;
20880
21248
  const ratio = offsetX / railWidth;
20881
21249
  if (ratio <= .5) return min + ratio * (resetPoint - min) * 2;
20882
21250
  return resetPoint + (ratio - .5) * (max - resetPoint) * 2;
@@ -20995,6 +21363,7 @@ function Slider(props) {
20995
21363
  }];
20996
21364
  const visualValue = isDragging ? dragValue : value;
20997
21365
  const sliderOffset = Math.min(Math.max((_getSliderOffset = getSliderOffset(visualValue)) !== null && _getSliderOffset !== void 0 ? _getSliderOffset : 0, 0), 100);
21366
+ const handleOffset = isRtl ? 100 - sliderOffset : sliderOffset;
20998
21367
  const ReduceIcon = iconManager.get("ReduceIcon");
20999
21368
  const IncreaseIcon = iconManager.get("IncreaseIcon");
21000
21369
  const MoreDownIcon = iconManager.get("MoreDownIcon");
@@ -21021,7 +21390,7 @@ function Slider(props) {
21021
21390
  onPointerDown: handlePointerDown,
21022
21391
  children: [
21023
21392
  /* @__PURE__ */ jsx("div", {
21024
- className: "univer-bg-primary-500/60 univer-absolute univer-left-0 univer-top-0 univer-h-full univer-rounded-full",
21393
+ className: clsx("univer-bg-primary-500/60 univer-absolute univer-top-0 univer-h-full univer-rounded-full", isRtl ? "univer-right-0" : "univer-left-0"),
21025
21394
  style: { width: `${sliderOffset}%` }
21026
21395
  }),
21027
21396
  /* @__PURE__ */ jsx("a", {
@@ -21040,7 +21409,7 @@ function Slider(props) {
21040
21409
  "aria-valuemax": max,
21041
21410
  "aria-valuenow": visualValue,
21042
21411
  type: "button",
21043
- style: { left: `${sliderOffset}%` },
21412
+ style: { left: `${handleOffset}%` },
21044
21413
  onPointerDown: handlePointerDown
21045
21414
  })
21046
21415
  ]
@@ -21142,14 +21511,6 @@ ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)),
21142
21511
  //#endregion
21143
21512
  //#region src/views/components/ribbon/MobileRibbon.tsx
21144
21513
  const toolbarScrollOffset = 168;
21145
- const nestedControlResetClassName = `
21146
- [&_button]:!univer-m-0 [&_button]:!univer-appearance-none [&_button]:!univer-border-0
21147
- [&_button]:!univer-bg-transparent [&_button]:!univer-p-0 [&_button]:!univer-leading-none
21148
- [&_button]:!univer-outline-none
21149
- [&_input]:!univer-m-0 [&_input]:!univer-appearance-none [&_input]:!univer-border-0
21150
- [&_input]:!univer-bg-transparent [&_input]:!univer-p-0 [&_input]:!univer-leading-none
21151
- [&_input]:!univer-outline-none
21152
- `;
21153
21514
  function MobileRibbon(props) {
21154
21515
  var _activeGroup$children;
21155
21516
  const { headerMenuComponents, headerMenu = true } = props;
@@ -21289,7 +21650,7 @@ function MobileRibbon(props) {
21289
21650
  return /* @__PURE__ */ jsx("div", {
21290
21651
  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 }),
21291
21652
  children: groupItems.map((child) => child.item && /* @__PURE__ */ jsx("div", {
21292
- className: clsx("[&_button]:!univer-font-inherit univer-flex univer-h-8 univer-shrink-0 univer-items-center univer-rounded-md [&_*]:univer-box-border [&_.univer-custom-label]:univer-text-sm [&_.univer-custom-label]:univer-leading-none [&_.univer-toolbar-button-selector-main]:!univer-h-8 [&_.univer-toolbar-button-selector-main]:!univer-rounded-none [&_.univer-toolbar-button-selector-main]:!univer-rounded-l-md [&_.univer-toolbar-button-selector-main]:!univer-px-1.5 [&_.univer-toolbar-button-selector-root]:!univer-h-8 [&_.univer-toolbar-button-selector-root]:univer-overflow-hidden [&_.univer-toolbar-button-selector-root]:!univer-rounded-md [&_.univer-toolbar-button-selector-root]:!univer-pr-0 [&_.univer-toolbar-button-selector-trigger]:!univer-static [&_.univer-toolbar-button-selector-trigger]:!univer-h-8 [&_.univer-toolbar-button-selector-trigger]:!univer-w-6 [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-none [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-r-md [&_.univer-toolbar-selector-root]:!univer-h-8 [&_.univer-toolbar-selector-root]:!univer-gap-1 [&_.univer-toolbar-selector-root]:!univer-rounded-md [&_.univer-toolbar-selector-root]:!univer-px-1.5 [&_.univer-toolbar-selector-trigger]:!univer-pl-0.5 [&_.univer-tooltip]:univer-inline-flex [&_.univer-tooltip]:univer-h-full [&_.univer-tooltip]:univer-items-center [&_[data-u-command]]:!univer-h-8 [&_[data-u-command]]:!univer-min-h-8 [&_[data-u-command]]:!univer-rounded-md [&_[data-u-command]]:!univer-px-1.5 [&_button]:!univer-h-8 [&_button]:!univer-min-w-8 [&_button]:!univer-rounded-md [&_button]:!univer-px-1.5", nestedControlResetClassName),
21653
+ className: clsx("[&_button]:!univer-font-inherit univer-flex univer-h-8 univer-shrink-0 univer-items-center univer-rounded-md [&_*]:univer-box-border [&_.univer-custom-label]:univer-text-sm [&_.univer-custom-label]:univer-leading-none [&_.univer-toolbar-button-selector-main]:!univer-h-8 [&_.univer-toolbar-button-selector-main]:!univer-rounded-none [&_.univer-toolbar-button-selector-main]:!univer-rounded-l-md [&_.univer-toolbar-button-selector-main]:!univer-px-1.5 [&_.univer-toolbar-button-selector-root]:!univer-h-8 [&_.univer-toolbar-button-selector-root]:univer-overflow-hidden [&_.univer-toolbar-button-selector-root]:!univer-rounded-md [&_.univer-toolbar-button-selector-root]:!univer-pr-0 [&_.univer-toolbar-button-selector-trigger]:!univer-static [&_.univer-toolbar-button-selector-trigger]:!univer-h-8 [&_.univer-toolbar-button-selector-trigger]:!univer-w-6 [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-none [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-r-md [&_.univer-toolbar-selector-root]:!univer-h-8 [&_.univer-toolbar-selector-root]:!univer-gap-1 [&_.univer-toolbar-selector-root]:!univer-rounded-md [&_.univer-toolbar-selector-root]:!univer-px-1.5 [&_.univer-toolbar-selector-trigger]:!univer-pl-0.5 [&_.univer-tooltip]:univer-inline-flex [&_.univer-tooltip]:univer-h-full [&_.univer-tooltip]:univer-items-center [&_[data-u-command]]:!univer-h-8 [&_[data-u-command]]:!univer-min-h-8 [&_[data-u-command]]:!univer-rounded-md [&_[data-u-command]]:!univer-px-1.5 [&_button]:!univer-m-0 [&_button]:!univer-h-8 [&_button]:!univer-min-w-8 [&_button]:!univer-appearance-none [&_button]:!univer-rounded-md [&_button]:!univer-border-0 [&_button]:!univer-bg-transparent [&_button]:!univer-p-0 [&_button]:!univer-px-1.5 [&_button]:!univer-leading-none [&_button]:!univer-outline-none [&_input]:!univer-m-0 [&_input]:!univer-appearance-none [&_input]:!univer-border-0 [&_input]:!univer-bg-transparent [&_input]:!univer-p-0 [&_input]:!univer-leading-none [&_input]:!univer-outline-none"),
21293
21654
  children: /* @__PURE__ */ jsx(ToolbarItem, { ...child.item })
21294
21655
  }, child.key))
21295
21656
  }, groupItem.key);
@@ -21316,8 +21677,9 @@ function MobileRibbon(props) {
21316
21677
  //#region src/views/menu/mobile/MobileMenu.tsx
21317
21678
  function MobileMenu(props) {
21318
21679
  var _viewStack;
21319
- const { menuType, onOptionSelect, schemas: providedSchemas } = props;
21320
- const menuManagerService = useDependency(IMenuManagerService);
21680
+ const { menuType, onOptionSelect, schemas: providedSchemas, menuManagerService: providedMenuManagerService } = props;
21681
+ const rootMenuManagerService = useDependency(IMenuManagerService);
21682
+ const menuManagerService = providedMenuManagerService !== null && providedMenuManagerService !== void 0 ? providedMenuManagerService : rootMenuManagerService;
21321
21683
  const [viewStack, setViewStack] = useState([]);
21322
21684
  const menuSchemas = useMemo(() => {
21323
21685
  if (providedSchemas) return providedSchemas;
@@ -21365,6 +21727,7 @@ function MobileMenu(props) {
21365
21727
  className: "univer-overflow-hidden univer-rounded-2xl univer-bg-white",
21366
21728
  children: /* @__PURE__ */ jsx(MobileSchemaList, {
21367
21729
  schemas: (currentView === null || currentView === void 0 ? void 0 : currentView.kind) === "schema" ? currentView.schemas : menuSchemas,
21730
+ menuManagerService,
21368
21731
  menuType,
21369
21732
  onExecute: onOptionSelect,
21370
21733
  onOpenView: openView
@@ -21383,7 +21746,7 @@ function MobileMenu(props) {
21383
21746
  });
21384
21747
  }
21385
21748
  function MobileSchemaList(props) {
21386
- const { schemas, menuType, onExecute, onOpenView } = props;
21749
+ const { schemas, menuManagerService, menuType, onExecute, onOpenView } = props;
21387
21750
  const localeService = useDependency(LocaleService);
21388
21751
  const hiddenGroupStates = useContextGroupHiddenStates(schemas);
21389
21752
  const visibleSchemas = useMemo(() => {
@@ -21397,6 +21760,7 @@ function MobileSchemaList(props) {
21397
21760
  var _schema$children2;
21398
21761
  if (schema.item) return /* @__PURE__ */ jsx(MobileSchemaRow, {
21399
21762
  schema,
21763
+ menuManagerService,
21400
21764
  menuType,
21401
21765
  onExecute,
21402
21766
  onOpenView,
@@ -21410,6 +21774,7 @@ function MobileSchemaList(props) {
21410
21774
  children: localeService.t(schema.title)
21411
21775
  }), schema.children.map((childSchema, childIndex) => /* @__PURE__ */ jsx(MobileSchemaRow, {
21412
21776
  schema: childSchema,
21777
+ menuManagerService,
21413
21778
  menuType,
21414
21779
  onExecute,
21415
21780
  onOpenView,
@@ -21419,9 +21784,10 @@ function MobileSchemaList(props) {
21419
21784
  }) });
21420
21785
  }
21421
21786
  function MobileSchemaRow(props) {
21422
- const { schema, menuType, onExecute, onOpenView, bordered } = props;
21787
+ const { schema, menuManagerService, menuType, onExecute, onOpenView, bordered } = props;
21423
21788
  const interaction = useMobileSchemaInteraction({
21424
21789
  schema,
21790
+ menuManagerService,
21425
21791
  menuType,
21426
21792
  onOpenView
21427
21793
  });
@@ -21496,8 +21862,7 @@ function MobileSelectionOptionRow(props) {
21496
21862
  }
21497
21863
  function useMobileSchemaInteraction(props) {
21498
21864
  var _schema$children3;
21499
- const { schema, menuType, onOpenView } = props;
21500
- const menuManagerService = useDependency(IMenuManagerService);
21865
+ const { schema, menuManagerService, menuType, onOpenView } = props;
21501
21866
  const localeService = useDependency(LocaleService);
21502
21867
  const menuItem = schema.item;
21503
21868
  const selectorItem = menuItem;
@@ -21618,11 +21983,14 @@ const MOBILE_CONTEXT_MENU_HOST_ID = "mobile-context-menu";
21618
21983
  function MobileContextMenu() {
21619
21984
  const [visible, setVisible] = useState(false);
21620
21985
  const [menuType, setMenuType] = useState("");
21986
+ const [menuContext, setMenuContext] = useState();
21621
21987
  const visibleRef = useRef(visible);
21622
21988
  const contextMenuHostService = useDependency(IContextMenuHostService);
21623
21989
  const contextMenuService = useDependency(IContextMenuService);
21624
21990
  const commandService = useDependency(ICommandService);
21625
21991
  const layoutService = useDependency(ILayoutService);
21992
+ const menuManagerService = useDependency(IMenuManagerService);
21993
+ const runtimeScopeService = useDependency(IUIRuntimeScopeService);
21626
21994
  const localeService = useDependency(LocaleService);
21627
21995
  const direction = useObservable(localeService.direction$);
21628
21996
  const { mountContainer } = useContext(ConfigContext);
@@ -21646,9 +22014,10 @@ function MobileContextMenu() {
21646
22014
  contextMenuHostService.deactivateMenu(MOBILE_CONTEXT_MENU_HOST_ID);
21647
22015
  };
21648
22016
  }, [contextMenuHostService, contextMenuService]);
21649
- function handleContextMenu(_event, nextMenuType) {
22017
+ function handleContextMenu(_event, nextMenuType, context) {
21650
22018
  contextMenuHostService.activateMenu(MOBILE_CONTEXT_MENU_HOST_ID);
21651
22019
  setMenuType(nextMenuType);
22020
+ setMenuContext(context);
21652
22021
  setVisible(true);
21653
22022
  }
21654
22023
  function handleClose() {
@@ -21663,6 +22032,23 @@ function MobileContextMenu() {
21663
22032
  }
21664
22033
  }, [localeService, menuType]);
21665
22034
  if (!mountContainer || !visible) return null;
22035
+ const activeScope = runtimeScopeService.get(menuContext === null || menuContext === void 0 ? void 0 : menuContext.unitId);
22036
+ const activeCommandService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(ICommandService)) ? activeScope.get(ICommandService) : commandService;
22037
+ const activeLayoutService = (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(ILayoutService)) ? activeScope.get(ILayoutService) : layoutService;
22038
+ const menu = /* @__PURE__ */ jsx(MobileMenu, {
22039
+ menuType,
22040
+ menuManagerService: (activeScope === null || activeScope === void 0 ? void 0 : activeScope.has(IMenuManagerService)) ? activeScope.get(IMenuManagerService) : menuManagerService,
22041
+ onOptionSelect: (params) => {
22042
+ var _ref, _params$commandId;
22043
+ const commandId = (_ref = (_params$commandId = params.commandId) !== null && _params$commandId !== void 0 ? _params$commandId : params.id) !== null && _ref !== void 0 ? _ref : params.label;
22044
+ const fallbackParams = typeof params.params === "function" ? params.params() : params.params;
22045
+ const commandParams = typeof params.value === "undefined" ? fallbackParams : { value: params.value };
22046
+ if (!commandId) return;
22047
+ activeLayoutService.focus();
22048
+ activeCommandService.executeCommand(commandId, commandParams);
22049
+ handleClose();
22050
+ }
22051
+ });
21666
22052
  return createPortal(/* @__PURE__ */ jsxs("div", {
21667
22053
  dir: direction,
21668
22054
  className: "univer-fixed univer-inset-0 univer-z-[1080] univer-flex univer-items-end",
@@ -21696,19 +22082,7 @@ function MobileContextMenu() {
21696
22082
  children: /* @__PURE__ */ jsx(CloseIcon, { className: "univer-size-4 univer-text-current" })
21697
22083
  })]
21698
22084
  })]
21699
- }), menuType && /* @__PURE__ */ jsx(MobileMenu, {
21700
- menuType,
21701
- onOptionSelect: (params) => {
21702
- var _ref, _params$commandId;
21703
- const commandId = (_ref = (_params$commandId = params.commandId) !== null && _params$commandId !== void 0 ? _params$commandId : params.id) !== null && _ref !== void 0 ? _ref : params.label;
21704
- const fallbackParams = typeof params.params === "function" ? params.params() : params.params;
21705
- const commandParams = typeof params.value === "undefined" ? fallbackParams : { value: params.value };
21706
- if (!commandId) return;
21707
- layoutService.focus();
21708
- commandService.executeCommand(commandId, commandParams);
21709
- handleClose();
21710
- }
21711
- })]
22085
+ }), menuType && menu]
21712
22086
  })]
21713
22087
  }), mountContainer);
21714
22088
  }
@@ -23073,6 +23447,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends Plugin {
23073
23447
  [IMenuManagerService, { useClass: MenuManagerService }],
23074
23448
  [IContextMenuHostService, { useClass: ContextMenuHostService }],
23075
23449
  [IContextMenuService, { useClass: ContextMenuService }],
23450
+ [IUIRuntimeScopeService, { useClass: UIRuntimeScopeService }],
23076
23451
  [IClipboardInterfaceService, {
23077
23452
  useClass: BrowserClipboardService,
23078
23453
  lazy: true
@@ -23110,6 +23485,7 @@ let UniverMobileUIPlugin = class UniverMobileUIPlugin extends Plugin {
23110
23485
  [ICanvasPopupService, { useClass: CanvasPopupService }],
23111
23486
  [IFontService, { useClass: FontService }],
23112
23487
  [CanvasFloatDomService],
23488
+ [CanvasFloatDomPreviewService],
23113
23489
  [IUIController, {
23114
23490
  useFactory: (injector) => injector.createInstance(MobileUIController, this._config),
23115
23491
  deps: [Injector]
@@ -23167,11 +23543,13 @@ let UniverUIPlugin = class UniverUIPlugin extends Plugin {
23167
23543
  [IUIPartsService, { useClass: UIPartsService }],
23168
23544
  [ILayoutService, { useClass: DesktopLayoutService }],
23169
23545
  [IRibbonService, { useClass: DesktopRibbonService }],
23546
+ [IRibbonOverrideService, { useClass: RibbonOverrideService }],
23170
23547
  [IShortcutService, { useClass: ShortcutService }],
23171
23548
  [IPlatformService, { useClass: PlatformService }],
23172
23549
  [IMenuManagerService, { useClass: MenuManagerService }],
23173
23550
  [IContextMenuHostService, { useClass: ContextMenuHostService }],
23174
23551
  [IContextMenuService, { useClass: ContextMenuService }],
23552
+ [IUIRuntimeScopeService, { useClass: UIRuntimeScopeService }],
23175
23553
  [IClipboardInterfaceService, {
23176
23554
  useClass: BrowserClipboardService,
23177
23555
  lazy: true
@@ -23209,6 +23587,7 @@ let UniverUIPlugin = class UniverUIPlugin extends Plugin {
23209
23587
  [ICanvasPopupService, { useClass: CanvasPopupService }],
23210
23588
  [IFontService, { useClass: FontService }],
23211
23589
  [CanvasFloatDomService],
23590
+ [CanvasFloatDomPreviewService],
23212
23591
  [IUIController, {
23213
23592
  useFactory: (injector) => injector.createInstance(DesktopUIController, this._config),
23214
23593
  deps: [Injector]
@@ -23922,16 +24301,16 @@ const PrintFloatDomSingle = memo((props) => {
23922
24301
  transform: transformRef.current
23923
24302
  },
23924
24303
  onPointerMove: (e) => {
23925
- layer.onPointerMove(e.nativeEvent);
24304
+ if (shouldForwardFloatDomEvents(layer)) layer.onPointerMove(e.nativeEvent);
23926
24305
  },
23927
24306
  onPointerDown: (e) => {
23928
- layer.onPointerDown(e.nativeEvent);
24307
+ if (shouldForwardFloatDomEvents(layer)) layer.onPointerDown(e.nativeEvent);
23929
24308
  },
23930
24309
  onPointerUp: (e) => {
23931
- layer.onPointerUp(e.nativeEvent);
24310
+ if (shouldForwardFloatDomEvents(layer)) layer.onPointerUp(e.nativeEvent);
23932
24311
  },
23933
24312
  onWheel: (e) => {
23934
- layer.onWheel(e.nativeEvent);
24313
+ if (shouldForwardFloatDomEvents(layer)) layer.onWheel(e.nativeEvent);
23935
24314
  },
23936
24315
  children: /* @__PURE__ */ jsx("div", {
23937
24316
  ref: innerDomRef,
@@ -24026,4 +24405,4 @@ function ProgressBar(props) {
24026
24405
  }
24027
24406
 
24028
24407
  //#endregion
24029
- export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, 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, 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, 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, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, 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, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, ThemeSwitcherService, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoShortcutItem, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, ZIndexManager, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, 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 };
24408
+ 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_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, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, ThemeSwitcherService, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UIRuntimeScopeService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoShortcutItem, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, ZIndexManager, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmbedBoundaryOwner, 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 };