@univerjs/ui 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/lib/cjs/index.js +912 -618
  2. package/lib/cjs/locale/ar-SA.js +16 -1
  3. package/lib/cjs/locale/ca-ES.js +16 -1
  4. package/lib/cjs/locale/de-DE.js +16 -1
  5. package/lib/cjs/locale/en-US.js +16 -1
  6. package/lib/cjs/locale/es-ES.js +16 -1
  7. package/lib/cjs/locale/fa-IR.js +16 -1
  8. package/lib/cjs/locale/fr-FR.js +16 -1
  9. package/lib/cjs/locale/id-ID.js +16 -1
  10. package/lib/cjs/locale/it-IT.js +16 -1
  11. package/lib/cjs/locale/ja-JP.js +16 -1
  12. package/lib/cjs/locale/ko-KR.js +16 -1
  13. package/lib/cjs/locale/pl-PL.js +16 -1
  14. package/lib/cjs/locale/pt-BR.js +16 -1
  15. package/lib/cjs/locale/ru-RU.js +16 -1
  16. package/lib/cjs/locale/sk-SK.js +16 -1
  17. package/lib/cjs/locale/vi-VN.js +16 -1
  18. package/lib/cjs/locale/zh-CN.js +16 -1
  19. package/lib/cjs/locale/zh-HK.js +16 -1
  20. package/lib/cjs/locale/zh-TW.js +16 -1
  21. package/lib/es/index.js +912 -619
  22. package/lib/es/locale/ar-SA.js +16 -1
  23. package/lib/es/locale/ca-ES.js +16 -1
  24. package/lib/es/locale/de-DE.js +16 -1
  25. package/lib/es/locale/en-US.js +16 -1
  26. package/lib/es/locale/es-ES.js +16 -1
  27. package/lib/es/locale/fa-IR.js +16 -1
  28. package/lib/es/locale/fr-FR.js +16 -1
  29. package/lib/es/locale/id-ID.js +16 -1
  30. package/lib/es/locale/it-IT.js +16 -1
  31. package/lib/es/locale/ja-JP.js +16 -1
  32. package/lib/es/locale/ko-KR.js +16 -1
  33. package/lib/es/locale/pl-PL.js +16 -1
  34. package/lib/es/locale/pt-BR.js +16 -1
  35. package/lib/es/locale/ru-RU.js +16 -1
  36. package/lib/es/locale/sk-SK.js +16 -1
  37. package/lib/es/locale/vi-VN.js +16 -1
  38. package/lib/es/locale/zh-CN.js +16 -1
  39. package/lib/es/locale/zh-HK.js +16 -1
  40. package/lib/es/locale/zh-TW.js +16 -1
  41. package/lib/index.css +126 -31
  42. package/lib/index.js +912 -619
  43. package/lib/locale/ar-SA.js +16 -1
  44. package/lib/locale/ca-ES.js +16 -1
  45. package/lib/locale/de-DE.js +16 -1
  46. package/lib/locale/en-US.js +16 -1
  47. package/lib/locale/es-ES.js +16 -1
  48. package/lib/locale/fa-IR.js +16 -1
  49. package/lib/locale/fr-FR.js +16 -1
  50. package/lib/locale/id-ID.js +16 -1
  51. package/lib/locale/it-IT.js +16 -1
  52. package/lib/locale/ja-JP.js +16 -1
  53. package/lib/locale/ko-KR.js +16 -1
  54. package/lib/locale/pl-PL.js +16 -1
  55. package/lib/locale/pt-BR.js +16 -1
  56. package/lib/locale/ru-RU.js +16 -1
  57. package/lib/locale/sk-SK.js +16 -1
  58. package/lib/locale/vi-VN.js +16 -1
  59. package/lib/locale/zh-CN.js +16 -1
  60. package/lib/locale/zh-HK.js +16 -1
  61. package/lib/locale/zh-TW.js +16 -1
  62. package/lib/types/facade/f-univer.d.ts +5 -3
  63. package/lib/types/index.d.ts +1 -1
  64. package/lib/types/locale/en-US.d.ts +15 -0
  65. package/lib/types/services/font.service.d.ts +9 -2
  66. package/lib/types/services/menu/menu-manager.service.d.ts +1 -1
  67. package/lib/types/views/components/ribbon/RibbonOverflow.d.ts +22 -0
  68. package/lib/types/views/components/ribbon/ToolbarItem.d.ts +1 -0
  69. package/lib/types/views/components/ribbon/hook.d.ts +2 -2
  70. package/lib/types/views/emoji-picker/EmojiPicker.d.ts +1 -1
  71. package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
  72. package/lib/umd/index.js +19 -19
  73. package/lib/umd/locale/ar-SA.js +1 -1
  74. package/lib/umd/locale/ca-ES.js +1 -1
  75. package/lib/umd/locale/de-DE.js +1 -1
  76. package/lib/umd/locale/en-US.js +1 -1
  77. package/lib/umd/locale/es-ES.js +1 -1
  78. package/lib/umd/locale/fa-IR.js +1 -1
  79. package/lib/umd/locale/fr-FR.js +1 -1
  80. package/lib/umd/locale/id-ID.js +1 -1
  81. package/lib/umd/locale/it-IT.js +1 -1
  82. package/lib/umd/locale/ja-JP.js +1 -1
  83. package/lib/umd/locale/ko-KR.js +1 -1
  84. package/lib/umd/locale/pl-PL.js +1 -1
  85. package/lib/umd/locale/pt-BR.js +1 -1
  86. package/lib/umd/locale/ru-RU.js +1 -1
  87. package/lib/umd/locale/sk-SK.js +1 -1
  88. package/lib/umd/locale/vi-VN.js +1 -1
  89. package/lib/umd/locale/zh-CN.js +1 -1
  90. package/lib/umd/locale/zh-HK.js +1 -1
  91. package/lib/umd/locale/zh-TW.js +1 -1
  92. package/package.json +8 -8
package/lib/cjs/index.js CHANGED
@@ -1375,45 +1375,102 @@ let MenuManagerService = _MenuManagerService = class MenuManagerService extends
1375
1375
  ["ribbon.start"]: {
1376
1376
  order: 0,
1377
1377
  title: "ui.ribbon.start",
1378
- ["ribbon.start.history"]: { order: 0 },
1379
- ["ribbon.start.format"]: { order: 1 },
1380
- ["ribbon.start.layout"]: { order: 2 },
1381
- ["ribbon.start.number"]: { order: 3 },
1382
- ["ribbon.start.others"]: { order: 4 }
1378
+ ["ribbon.start.history"]: {
1379
+ order: 0,
1380
+ title: "ui.ribbon.groups.clipboard"
1381
+ },
1382
+ ["ribbon.start.format"]: {
1383
+ order: 1,
1384
+ title: "ui.ribbon.groups.font"
1385
+ },
1386
+ ["ribbon.start.layout"]: {
1387
+ order: 2,
1388
+ title: "ui.ribbon.groups.layout"
1389
+ },
1390
+ ["ribbon.start.number"]: {
1391
+ order: 3,
1392
+ title: "ui.ribbon.groups.number"
1393
+ },
1394
+ ["ribbon.start.others"]: {
1395
+ order: 4,
1396
+ title: "ui.ribbon.groups.tools"
1397
+ }
1383
1398
  },
1384
1399
  ["ribbon.insert"]: {
1385
1400
  order: 1,
1386
1401
  title: "ui.ribbon.insert",
1387
- ["ribbon.insert.edit"]: { order: 0 },
1388
- ["ribbon.insert.media"]: { order: 1 },
1389
- ["ribbon.insert.cell"]: { order: 2 },
1390
- ["ribbon.insert.others"]: { order: 3 }
1402
+ ["ribbon.insert.edit"]: {
1403
+ order: 0,
1404
+ title: "ui.ribbon.groups.editing"
1405
+ },
1406
+ ["ribbon.insert.media"]: {
1407
+ order: 1,
1408
+ title: "ui.ribbon.groups.media"
1409
+ },
1410
+ ["ribbon.insert.cell"]: {
1411
+ order: 2,
1412
+ title: "ui.ribbon.groups.cells"
1413
+ },
1414
+ ["ribbon.insert.others"]: {
1415
+ order: 3,
1416
+ title: "ui.ribbon.groups.tools"
1417
+ }
1391
1418
  },
1392
1419
  ["ribbon.formulas"]: {
1393
1420
  order: 2,
1394
1421
  title: "ui.ribbon.formulas",
1395
- ["ribbon.formulas.basic"]: { order: 0 },
1396
- ["ribbon.formulas.others"]: { order: 1 }
1422
+ ["ribbon.formulas.basic"]: {
1423
+ order: 0,
1424
+ title: "ui.ribbon.groups.formulas"
1425
+ },
1426
+ ["ribbon.formulas.others"]: {
1427
+ order: 1,
1428
+ title: "ui.ribbon.groups.tools"
1429
+ }
1397
1430
  },
1398
1431
  ["ribbon.data"]: {
1399
1432
  order: 3,
1400
1433
  title: "ui.ribbon.data",
1401
- ["ribbon.data.formulas"]: { order: 0 },
1402
- ["ribbon.data.rules"]: { order: 1 },
1403
- ["ribbon.data.organization"]: { order: 2 },
1404
- ["ribbon.data.others"]: { order: 3 }
1434
+ ["ribbon.data.formulas"]: {
1435
+ order: 0,
1436
+ title: "ui.ribbon.groups.formulas"
1437
+ },
1438
+ ["ribbon.data.rules"]: {
1439
+ order: 1,
1440
+ title: "ui.ribbon.groups.rules"
1441
+ },
1442
+ ["ribbon.data.organization"]: {
1443
+ order: 2,
1444
+ title: "ui.ribbon.groups.organization"
1445
+ },
1446
+ ["ribbon.data.others"]: {
1447
+ order: 3,
1448
+ title: "ui.ribbon.groups.tools"
1449
+ }
1405
1450
  },
1406
1451
  ["ribbon.view"]: {
1407
1452
  order: 4,
1408
1453
  title: "ui.ribbon.view",
1409
- ["ribbon.view.display"]: { order: 0 },
1410
- ["ribbon.view.Visibility"]: { order: 0 },
1411
- ["ribbon.view.others"]: { order: 0 }
1454
+ ["ribbon.view.display"]: {
1455
+ order: 0,
1456
+ title: "ui.ribbon.groups.display"
1457
+ },
1458
+ ["ribbon.view.Visibility"]: {
1459
+ order: 0,
1460
+ title: "ui.ribbon.groups.visibility"
1461
+ },
1462
+ ["ribbon.view.others"]: {
1463
+ order: 0,
1464
+ title: "ui.ribbon.groups.tools"
1465
+ }
1412
1466
  },
1413
1467
  ["ribbon.others"]: {
1414
1468
  order: 5,
1415
1469
  title: "ui.ribbon.others",
1416
- ["ribbon.others.others"]: { order: 0 }
1470
+ ["ribbon.others.others"]: {
1471
+ order: 0,
1472
+ title: "ui.ribbon.groups.tools"
1473
+ }
1417
1474
  }
1418
1475
  },
1419
1476
  ["contextMenu"]: {
@@ -1835,17 +1892,23 @@ function useObservableRef(observable, defaultValue) {
1835
1892
 
1836
1893
  //#endregion
1837
1894
  //#region src/views/components/feature-search/FeatureSearch.tsx
1895
+ /**
1896
+ * Copyright 2023-present DreamNum Co., Ltd.
1897
+ *
1898
+ * Licensed under the Apache License, Version 2.0 (the "License");
1899
+ * you may not use this file except in compliance with the License.
1900
+ * You may obtain a copy of the License at
1901
+ *
1902
+ * http://www.apache.org/licenses/LICENSE-2.0
1903
+ *
1904
+ * Unless required by applicable law or agreed to in writing, software
1905
+ * distributed under the License is distributed on an "AS IS" BASIS,
1906
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1907
+ * See the License for the specific language governing permissions and
1908
+ * limitations under the License.
1909
+ */
1838
1910
  const FEATURE_SEARCH_COMPONENT = "FeatureSearch";
1839
1911
  const FEATURE_SEARCH_DIALOG_ID = "FEATURE_SEARCH_DIALOG";
1840
- function resolveParams(item, value) {
1841
- return (typeof item.params === "function" ? item.params() : item.params) ?? (value === void 0 ? void 0 : { value });
1842
- }
1843
- function resolveOptionParams(option) {
1844
- return (typeof option.params === "function" ? option.params(option.value) : option.params) ?? (option.value === void 0 ? void 0 : { value: option.value });
1845
- }
1846
- function deduplicate(items) {
1847
- return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && _univerjs_core.Tools.diffValue(candidate.params, item.params)) === index);
1848
- }
1849
1912
  function FeatureSearch() {
1850
1913
  const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
1851
1914
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
@@ -1854,6 +1917,15 @@ function FeatureSearch() {
1854
1917
  const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
1855
1918
  const ribbonService = (0, _wendellhu_redi_react_bindings.useDependency)(IRibbonService);
1856
1919
  const items$ = (0, react.useMemo)(() => {
1920
+ function resolveParams(item, value) {
1921
+ return (typeof item.params === "function" ? item.params() : item.params) ?? (value === void 0 ? void 0 : { value });
1922
+ }
1923
+ function resolveOptionParams(option) {
1924
+ return (typeof option.params === "function" ? option.params(option.value) : option.params) ?? (option.value === void 0 ? void 0 : { value: option.value });
1925
+ }
1926
+ function deduplicate(items) {
1927
+ return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && _univerjs_core.Tools.diffValue(candidate.params, item.params)) === index);
1928
+ }
1857
1929
  function getItemTitle(item) {
1858
1930
  const titleKey = item.title ?? item.tooltip ?? item.description;
1859
1931
  return titleKey ? localeService.t(titleKey) : "";
@@ -1978,7 +2050,7 @@ function FeatureSearch() {
1978
2050
  children: item.title
1979
2051
  })]
1980
2052
  }), item.path && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1981
- className: "univer-max-w-1/2 univer-truncate univer-text-xs univer-text-gray-400",
2053
+ className: "univer-max-w-[50%] univer-truncate univer-text-xs univer-text-gray-400",
1982
2054
  children: item.path
1983
2055
  })]
1984
2056
  }, item.key)) })] })]
@@ -3221,6 +3293,21 @@ function useComponentsOfPart(part, injector) {
3221
3293
 
3222
3294
  //#endregion
3223
3295
  //#region src/views/components/ribbon/ribbon-menu/ClassicMenu.tsx
3296
+ /**
3297
+ * Copyright 2023-present DreamNum Co., Ltd.
3298
+ *
3299
+ * Licensed under the Apache License, Version 2.0 (the "License");
3300
+ * you may not use this file except in compliance with the License.
3301
+ * You may obtain a copy of the License at
3302
+ *
3303
+ * http://www.apache.org/licenses/LICENSE-2.0
3304
+ *
3305
+ * Unless required by applicable law or agreed to in writing, software
3306
+ * distributed under the License is distributed on an "AS IS" BASIS,
3307
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3308
+ * See the License for the specific language governing permissions and
3309
+ * limitations under the License.
3310
+ */
3224
3311
  function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
3225
3312
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
3226
3313
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3234,7 +3321,7 @@ function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
3234
3321
  "aria-selected": isActive,
3235
3322
  title: localeService.t(group.title || group.key),
3236
3323
  onClick: () => onSelectTab(group),
3237
- className: (0, _univerjs_design.clsx)("univer-focus:outline-none univer-focus:ring-2 univer-focus:ring-primary-500 dark:!univer-focus:ring-primary-300 univer-flex univer-cursor-pointer univer-appearance-none univer-items-center univer-gap-1 univer-rounded-sm univer-border-none univer-px-2 univer-py-1 univer-text-sm univer-transition-colors", isActive ? "univer-bg-primary-50 univer-font-semibold univer-text-primary-600 univer-shadow-sm dark:!univer-bg-primary-900 dark:!univer-text-primary-300" : "univer-hover:bg-gray-100 dark:!univer-hover:bg-gray-700 univer-bg-transparent univer-text-gray-700 dark:!univer-text-gray-200"),
3324
+ className: (0, _univerjs_design.clsx)("univer-flex univer-cursor-pointer univer-appearance-none univer-items-center univer-gap-1 univer-rounded-sm univer-border-none univer-px-2 univer-py-1 univer-text-sm univer-transition-colors focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-500 dark:focus:!univer-ring-primary-300", isActive ? "univer-bg-primary-50 univer-font-semibold univer-text-primary-600 univer-shadow-sm dark:!univer-bg-primary-900 dark:!univer-text-primary-300" : "univer-bg-transparent univer-text-gray-700 hover:univer-bg-gray-100 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700"),
3238
3325
  children: localeService.t(group.title || group.key)
3239
3326
  }, group.key);
3240
3327
  })
@@ -3346,6 +3433,7 @@ function placeRibbonGridItems(items) {
3346
3433
  const columnSpan = layout.columnSpan ?? 1;
3347
3434
  const cells = getCells(layout.row, layout.column, rowSpan, columnSpan);
3348
3435
  if (!isValidGridGeometry(layout, rowSpan, cells)) {
3436
+ globalThis.console.warn(`[RibbonGrid] Invalid gridLayout for "${item.key}"; using fallback placement.`);
3349
3437
  fallbackItems.push({ item });
3350
3438
  continue;
3351
3439
  }
@@ -3412,6 +3500,83 @@ function getCells(row, column, rowSpan, columnSpan) {
3412
3500
  return cells;
3413
3501
  }
3414
3502
 
3503
+ //#endregion
3504
+ //#region src/views/components/ribbon/ToolbarButton.tsx
3505
+ /**
3506
+ * Copyright 2023-present DreamNum Co., Ltd.
3507
+ *
3508
+ * Licensed under the Apache License, Version 2.0 (the "License");
3509
+ * you may not use this file except in compliance with the License.
3510
+ * You may obtain a copy of the License at
3511
+ *
3512
+ * http://www.apache.org/licenses/LICENSE-2.0
3513
+ *
3514
+ * Unless required by applicable law or agreed to in writing, software
3515
+ * distributed under the License is distributed on an "AS IS" BASIS,
3516
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3517
+ * See the License for the specific language governing permissions and
3518
+ * limitations under the License.
3519
+ */
3520
+ const toolbarButtonClassName = `
3521
+ univer-box-border univer-flex univer-h-6 univer-min-w-6 univer-cursor-pointer univer-items-center
3522
+ univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-px-0 univer-py-0
3523
+ univer-text-gray-900 univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
3524
+ dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700 dark:disabled:!univer-text-gray-600
3525
+ disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
3526
+ hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
3527
+ [&_svg]:univer-shrink-0
3528
+ `;
3529
+ const toolbarButtonVariants = (0, _univerjs_design.cva)(toolbarButtonClassName, {
3530
+ variants: {
3531
+ noIcon: {
3532
+ true: "univer-px-2",
3533
+ false: ""
3534
+ },
3535
+ active: {
3536
+ true: "!univer-bg-gray-200 dark:!univer-bg-gray-500",
3537
+ false: ""
3538
+ }
3539
+ },
3540
+ defaultVariants: {
3541
+ noIcon: false,
3542
+ active: false
3543
+ }
3544
+ });
3545
+ /**
3546
+ * Button Component
3547
+ */
3548
+ function ToolbarButton(props) {
3549
+ const { children, className, style, disabled = false, active = false, noIcon, onClick, onDoubleClick, ...restProps } = props;
3550
+ const handleClick = (e) => {
3551
+ if (disabled) {
3552
+ e.preventDefault();
3553
+ return;
3554
+ }
3555
+ onClick && onClick(e);
3556
+ };
3557
+ const handleDoubleClick = (e) => {
3558
+ if (disabled) {
3559
+ e.preventDefault();
3560
+ return;
3561
+ }
3562
+ onDoubleClick && onDoubleClick(e);
3563
+ };
3564
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3565
+ type: "button",
3566
+ className: (0, _univerjs_design.clsx)(toolbarButtonVariants({
3567
+ noIcon,
3568
+ active,
3569
+ className
3570
+ })),
3571
+ style,
3572
+ disabled,
3573
+ onClick: handleClick,
3574
+ onDoubleClick: handleDoubleClick,
3575
+ ...restProps,
3576
+ children
3577
+ });
3578
+ }
3579
+
3415
3580
  //#endregion
3416
3581
  //#region src/views/custom-label/CustomLabel.tsx
3417
3582
  /**
@@ -3514,82 +3679,334 @@ function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
3514
3679
  }
3515
3680
 
3516
3681
  //#endregion
3517
- //#region src/views/components/ribbon/ToolbarButton.tsx
3518
- /**
3519
- * Copyright 2023-present DreamNum Co., Ltd.
3520
- *
3521
- * Licensed under the Apache License, Version 2.0 (the "License");
3522
- * you may not use this file except in compliance with the License.
3523
- * You may obtain a copy of the License at
3524
- *
3525
- * http://www.apache.org/licenses/LICENSE-2.0
3526
- *
3527
- * Unless required by applicable law or agreed to in writing, software
3528
- * distributed under the License is distributed on an "AS IS" BASIS,
3529
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3530
- * See the License for the specific language governing permissions and
3531
- * limitations under the License.
3532
- */
3533
- const toolbarButtonClassName = `
3534
- univer-box-border univer-flex univer-h-6 univer-min-w-6 univer-cursor-pointer univer-items-center
3535
- univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-px-0 univer-py-0
3536
- univer-text-gray-900 univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
3537
- dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700 dark:disabled:!univer-text-gray-600
3538
- disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
3539
- hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
3540
- [&_svg]:univer-shrink-0
3541
- `;
3542
- const toolbarButtonVariants = (0, _univerjs_design.cva)(toolbarButtonClassName, {
3543
- variants: {
3544
- noIcon: {
3545
- true: "univer-px-2",
3546
- false: ""
3547
- },
3548
- active: {
3549
- true: "!univer-bg-gray-200 dark:!univer-bg-gray-500",
3550
- false: ""
3551
- }
3552
- },
3553
- defaultVariants: {
3554
- noIcon: false,
3555
- active: false
3682
+ //#region src/services/font.service.ts
3683
+ const IFontService = (0, _univerjs_core.createIdentifier)("univer.font-service");
3684
+ let FontCategory = /* @__PURE__ */ function(FontCategory) {
3685
+ FontCategory["SANS_SERIF"] = "sans-serif";
3686
+ FontCategory["SERIF"] = "serif";
3687
+ FontCategory["MONOSPACE"] = "monospace";
3688
+ FontCategory["DISPLAY"] = "display";
3689
+ FontCategory["HANDWRITING"] = "handwriting";
3690
+ return FontCategory;
3691
+ }({});
3692
+ const DEFAULT_FONT_LIST = [
3693
+ ["宋体", { category: "serif" }],
3694
+ ["Arial", { category: "sans-serif" }],
3695
+ ["Baskerville", { category: "serif" }],
3696
+ ["Comic Sans MS", { category: "handwriting" }],
3697
+ ["Courier New", { category: "monospace" }],
3698
+ ["Helvetica", { category: "sans-serif" }],
3699
+ ["Times New Roman", { category: "serif" }],
3700
+ ["Verdana", { category: "sans-serif" }],
3701
+ ["Apple LiGothic", { category: "sans-serif" }],
3702
+ ["Apple LiSung", { category: "serif" }],
3703
+ ["Hei", { category: "sans-serif" }],
3704
+ ["Kai", { category: "handwriting" }],
3705
+ ["LiHei Pro", { category: "sans-serif" }],
3706
+ ["LiSong Pro", { category: "serif" }],
3707
+ ["STFangsong", { category: "serif" }],
3708
+ ["STHeiti", { category: "sans-serif" }],
3709
+ ["STKaiti", { category: "handwriting" }],
3710
+ ["STSong", { category: "serif" }],
3711
+ ["报隶-繁", { category: "handwriting" }],
3712
+ ["报隶-简", { category: "handwriting" }],
3713
+ ["冬青黑体简体中文", { category: "sans-serif" }],
3714
+ ["黑体-繁", { category: "sans-serif" }],
3715
+ ["黑体-简", { category: "sans-serif" }],
3716
+ ["华文仿宋", { category: "serif" }],
3717
+ ["华文楷体", { category: "handwriting" }],
3718
+ ["华文宋体", { category: "serif" }],
3719
+ ["楷体-繁", { category: "handwriting" }],
3720
+ ["楷体-简", { category: "handwriting" }],
3721
+ ["兰亭黑-繁", { category: "sans-serif" }],
3722
+ ["兰亭黑-简", { category: "sans-serif" }],
3723
+ ["隶变-繁", { category: "handwriting" }],
3724
+ ["隶变-简", { category: "handwriting" }],
3725
+ ["凌慧体-繁", { category: "handwriting" }],
3726
+ ["凌慧体-简", { category: "handwriting" }],
3727
+ ["翩翩体-繁", { category: "handwriting" }],
3728
+ ["翩翩体-简", { category: "handwriting" }],
3729
+ ["苹方-繁", { category: "sans-serif" }],
3730
+ ["苹方-港", { category: "sans-serif" }],
3731
+ ["苹方-简", { category: "sans-serif" }],
3732
+ ["手札体-繁", { category: "handwriting" }],
3733
+ ["手札体-简", { category: "handwriting" }],
3734
+ ["宋体-繁", { category: "serif" }],
3735
+ ["宋体-简", { category: "serif" }],
3736
+ ["娃娃体-繁", { category: "handwriting" }],
3737
+ ["娃娃体-简", { category: "handwriting" }],
3738
+ ["魏碑-繁", { category: "handwriting" }],
3739
+ ["魏碑-简", { category: "handwriting" }],
3740
+ ["行楷-繁", { category: "handwriting" }],
3741
+ ["行楷-简", { category: "handwriting" }],
3742
+ ["雅痞-繁", { category: "display" }],
3743
+ ["雅痞-简", { category: "display" }],
3744
+ ["圆体-繁", { category: "sans-serif" }],
3745
+ ["圆体-简", { category: "sans-serif" }],
3746
+ ["Arial Black", { category: "sans-serif" }],
3747
+ ["Big Caslon", { category: "serif" }],
3748
+ ["Courier", { category: "monospace" }],
3749
+ ["Didot", { category: "serif" }],
3750
+ ["Futura", { category: "sans-serif" }],
3751
+ ["Georgia", { category: "serif" }],
3752
+ ["Helvetica Neue", { category: "sans-serif" }],
3753
+ ["Optima", { category: "sans-serif" }],
3754
+ ["Times", { category: "serif" }],
3755
+ ["Tahoma", { category: "sans-serif" }],
3756
+ ["BIZ UDGothic", { category: "monospace" }],
3757
+ ["BIZ UDMincho", { category: "monospace" }],
3758
+ ["Hiragino Maru Gothic Pro", { category: "sans-serif" }],
3759
+ ["Hiragino Maru Gothic ProN", { category: "sans-serif" }],
3760
+ ["Hiragino Mincho Pro", { category: "serif" }],
3761
+ ["Hiragino Mincho ProN", { category: "serif" }],
3762
+ ["Hiragino Sans", { category: "sans-serif" }],
3763
+ ["Klee", { category: "handwriting" }],
3764
+ ["Osaka", { category: "sans-serif" }],
3765
+ ["Toppan Bunkyu Gothic", { category: "sans-serif" }],
3766
+ ["Toppan Bunkyu Midashi Gothic", { category: "sans-serif" }],
3767
+ ["Toppan Bunkyu Midashi Mincho", { category: "serif" }],
3768
+ ["Toppan Bunkyu Mincho", { category: "serif" }],
3769
+ ["Tsukushi A Round Gothic", { category: "sans-serif" }],
3770
+ ["Tsukushi B Round Gothic", { category: "sans-serif" }],
3771
+ ["YuKyokasho", { category: "handwriting" }],
3772
+ ["YuKyokasho Yoko", { category: "handwriting" }],
3773
+ ["YuMincho +36p Kana", { category: "serif" }],
3774
+ ["American Typewriter", { category: "serif" }],
3775
+ ["Andale Mono", { category: "monospace" }],
3776
+ ["Apple Chancery", { category: "handwriting" }],
3777
+ ["Apple SD Gothic Neo", { category: "sans-serif" }],
3778
+ ["Apple Symbols", { category: "display" }],
3779
+ ["AppleGothic", { category: "sans-serif" }],
3780
+ ["AppleMyungjo", { category: "serif" }],
3781
+ ["Arial Unicode MS", { category: "sans-serif" }],
3782
+ ["Athelas", { category: "serif" }],
3783
+ ["Avenir", { category: "sans-serif" }],
3784
+ ["Avenir Next", { category: "sans-serif" }],
3785
+ ["Avenir Next Condensed", { category: "sans-serif" }],
3786
+ ["Ayuthaya", { category: "sans-serif" }],
3787
+ ["Bangla MN", { category: "serif" }],
3788
+ ["Bangla Sangam MN", { category: "sans-serif" }],
3789
+ ["Bauhaus 93", { category: "display" }],
3790
+ ["Bodoni 72", { category: "serif" }],
3791
+ ["Bodoni 72 Oldstyle", { category: "serif" }],
3792
+ ["Bodoni 72 Smallcaps", { category: "serif" }],
3793
+ ["Bodoni Ornaments", { category: "display" }],
3794
+ ["Bookshelf Symbol 7", { category: "display" }],
3795
+ ["Bradley Hand", { category: "handwriting" }],
3796
+ ["Chalkboard", { category: "handwriting" }],
3797
+ ["Chalkboard SE", { category: "handwriting" }],
3798
+ ["Chalkduster", { category: "handwriting" }],
3799
+ ["Charter", { category: "serif" }],
3800
+ ["Cochin", { category: "serif" }],
3801
+ ["Copperplate", { category: "serif" }],
3802
+ ["Devanagari Sangam MN", { category: "sans-serif" }],
3803
+ ["Din Alternate", { category: "sans-serif" }],
3804
+ ["Euphemia UCAS", { category: "sans-serif" }],
3805
+ ["Galvji", { category: "sans-serif" }],
3806
+ ["Geneva", { category: "sans-serif" }],
3807
+ ["Gill Sans", { category: "sans-serif" }],
3808
+ ["Gujarati Sangam MN", { category: "sans-serif" }],
3809
+ ["GungSeo", { category: "handwriting" }],
3810
+ ["Gurmukhi MN", { category: "serif" }],
3811
+ ["Gurmukhi Sangam MN", { category: "sans-serif" }],
3812
+ ["HeadLineA", { category: "display" }],
3813
+ ["Herculanum", { category: "display" }],
3814
+ ["Hiragino Kaku Gothic Pro", { category: "sans-serif" }],
3815
+ ["Hiragino Kaku Gothic ProN", { category: "sans-serif" }],
3816
+ ["Hiragino Kaku Gothic Std", { category: "sans-serif" }],
3817
+ ["Hiragino Kaku Gothic StdN", { category: "sans-serif" }],
3818
+ ["Hoefler Text", { category: "serif" }],
3819
+ ["Impact", { category: "sans-serif" }],
3820
+ ["InaiMathi", { category: "sans-serif" }],
3821
+ ["Iowan Old Style", { category: "serif" }],
3822
+ ["Kannada MN", { category: "serif" }],
3823
+ ["Kannada Sangam MN", { category: "sans-serif" }],
3824
+ ["Kefa", { category: "serif" }],
3825
+ ["Khmer MN", { category: "serif" }],
3826
+ ["Khmer Sangam MN", { category: "sans-serif" }],
3827
+ ["Kohinoor Bangla", { category: "sans-serif" }],
3828
+ ["Kohinoor Devanagari", { category: "sans-serif" }],
3829
+ ["Kohinoor Telugu", { category: "sans-serif" }],
3830
+ ["Krungthep", { category: "sans-serif" }],
3831
+ ["Lao MN", { category: "serif" }],
3832
+ ["Lao Sangam MN", { category: "sans-serif" }],
3833
+ ["Lucida Grande", { category: "sans-serif" }],
3834
+ ["Luminari", { category: "display" }],
3835
+ ["Malayalam MN", { category: "serif" }],
3836
+ ["Malayalam Sangam MN", { category: "sans-serif" }],
3837
+ ["Marion", { category: "serif" }],
3838
+ ["Marker Felt", { category: "handwriting" }],
3839
+ ["Menlo", { category: "monospace" }],
3840
+ ["Microsoft Sans Serif", { category: "sans-serif" }],
3841
+ ["Modern No. 20", { category: "serif" }],
3842
+ ["Monaco", { category: "monospace" }],
3843
+ ["Mukta Mahee", { category: "sans-serif" }],
3844
+ ["Nanum Brush Script", { category: "handwriting" }],
3845
+ ["Nanum Gothic", { category: "sans-serif" }],
3846
+ ["Nanum Myeongjo", { category: "serif" }],
3847
+ ["Nanum Pen Script", { category: "handwriting" }],
3848
+ ["Noteworthy", { category: "handwriting" }],
3849
+ ["Oriya MN", { category: "serif" }],
3850
+ ["Oriya Sangam MN", { category: "sans-serif" }],
3851
+ ["Palatino", { category: "serif" }],
3852
+ ["Papyrus", { category: "display" }],
3853
+ ["PCMyungjo", { category: "monospace" }],
3854
+ ["Phosphate", { category: "display" }],
3855
+ ["PilGi", { category: "handwriting" }],
3856
+ ["Plantagenet Cherokee", { category: "serif" }],
3857
+ ["PT Mono", { category: "monospace" }],
3858
+ ["PT Sans", { category: "sans-serif" }],
3859
+ ["PT Sans Caption", { category: "sans-serif" }],
3860
+ ["PT Serif", { category: "serif" }],
3861
+ ["PT Serif Caption", { category: "serif" }],
3862
+ ["Rockwell", { category: "serif" }],
3863
+ ["Sathu", { category: "sans-serif" }],
3864
+ ["Savoye LET", { category: "handwriting" }],
3865
+ ["Seravek", { category: "sans-serif" }],
3866
+ ["Shree Devanagari 714", { category: "sans-serif" }],
3867
+ ["SignPainter", { category: "handwriting" }],
3868
+ ["Silom", { category: "display" }],
3869
+ ["Sinhala MN", { category: "serif" }],
3870
+ ["Sinhala Sangam MN", { category: "sans-serif" }],
3871
+ ["Skia", { category: "sans-serif" }],
3872
+ ["Snell Roundhand", { category: "handwriting" }],
3873
+ ["STIXGeneral", { category: "serif" }],
3874
+ ["Sukhumvit Set", { category: "sans-serif" }],
3875
+ ["Superclarendon", { category: "serif" }],
3876
+ ["Tamil MN", { category: "serif" }],
3877
+ ["Tamil Sangam MN", { category: "sans-serif" }],
3878
+ ["Telugu MN", { category: "serif" }],
3879
+ ["Telugu Sangam MN", { category: "sans-serif" }],
3880
+ ["Trattatello", { category: "handwriting" }],
3881
+ ["Trebuchet MS", { category: "sans-serif" }],
3882
+ ["Webdings", { category: "display" }],
3883
+ ["Wingdings", { category: "display" }],
3884
+ ["Wingdings 2", { category: "display" }],
3885
+ ["Wingdings 3", { category: "display" }],
3886
+ ["YuGothic", { category: "sans-serif" }],
3887
+ ["YuGothic Light", { category: "sans-serif" }],
3888
+ ["YuGothic Medium", { category: "sans-serif" }],
3889
+ ["Zapfino", { category: "handwriting" }]
3890
+ ].map(([value, config]) => ({
3891
+ value,
3892
+ label: value,
3893
+ ...config
3894
+ }));
3895
+ let FontService = class FontService {
3896
+ constructor(_configService) {
3897
+ this._configService = _configService;
3898
+ _defineProperty(this, "fonts$", new rxjs.BehaviorSubject([]));
3899
+ const { customFontFamily } = this._configService.getConfig("ui.config") ?? {};
3900
+ let fonts = [];
3901
+ if (customFontFamily) {
3902
+ if (Array.isArray(customFontFamily)) fonts = [...DEFAULT_FONT_LIST, ...customFontFamily];
3903
+ else if (customFontFamily.override) fonts = [...customFontFamily.list];
3904
+ else fonts = [...DEFAULT_FONT_LIST, ...customFontFamily.list];
3905
+ } else fonts = [...DEFAULT_FONT_LIST];
3906
+ this.fonts$.next(fonts);
3556
3907
  }
3557
- });
3558
- /**
3559
- * Button Component
3560
- */
3561
- function ToolbarButton(props) {
3562
- const { children, className, style, disabled = false, active = false, noIcon, onClick, onDoubleClick, ...restProps } = props;
3563
- const handleClick = (e) => {
3564
- if (disabled) {
3565
- e.preventDefault();
3566
- return;
3567
- }
3568
- onClick && onClick(e);
3569
- };
3570
- const handleDoubleClick = (e) => {
3571
- if (disabled) {
3572
- e.preventDefault();
3573
- return;
3574
- }
3575
- onDoubleClick && onDoubleClick(e);
3908
+ dispose() {
3909
+ this.resetToDefaults();
3910
+ this.fonts$.complete();
3911
+ }
3912
+ getFonts() {
3913
+ return this.fonts$.getValue();
3914
+ }
3915
+ getFontByValue(value) {
3916
+ return this.getFonts().find((font) => font.value === value);
3917
+ }
3918
+ /**
3919
+ * Check if the current browser environment supports the font
3920
+ * @param fontValue
3921
+ * @returns boolean Whether the font is supported
3922
+ */
3923
+ isFontSupported(fontValue) {
3924
+ const context = document.createElement("canvas").getContext("2d");
3925
+ if (!context) return false;
3926
+ const text = "abcdefghijklmnopqrstuvwxyz0123456789";
3927
+ const size = "72px";
3928
+ const baseFonts = [
3929
+ "monospace",
3930
+ "serif",
3931
+ "sans-serif"
3932
+ ];
3933
+ const defaultWidths = {};
3934
+ baseFonts.forEach((base) => {
3935
+ context.font = `${size} ${base}`;
3936
+ defaultWidths[base] = context.measureText(text).width;
3937
+ });
3938
+ return baseFonts.some((base) => {
3939
+ context.font = `${size} "${fontValue}", ${base}`;
3940
+ return context.measureText(text).width !== defaultWidths[base];
3941
+ });
3942
+ }
3943
+ addFont(font) {
3944
+ if (this.getFontByValue(font.value)) throw new Error(`[FontService]: Font with value "${font.value}" already exists.`);
3945
+ const updatedFonts = [...this.getFonts(), font].sort();
3946
+ this.fonts$.next(updatedFonts);
3947
+ }
3948
+ updateFont(value, updates) {
3949
+ const fonts = this.getFonts();
3950
+ const fontIndex = fonts.findIndex((font) => font.value === value);
3951
+ if (fontIndex === -1) throw new Error(`Font with value "${value}" not found.`);
3952
+ const updatedFont = {
3953
+ ...fonts[fontIndex],
3954
+ ...updates
3955
+ };
3956
+ const updatedFonts = [...fonts];
3957
+ updatedFonts[fontIndex] = updatedFont;
3958
+ this.fonts$.next(updatedFonts);
3959
+ }
3960
+ removeFont(value) {
3961
+ const fonts = this.getFonts();
3962
+ if (fonts.findIndex((font) => font.value === value) === -1) return false;
3963
+ const updatedFonts = fonts.filter((font) => font.value !== value);
3964
+ this.fonts$.next(updatedFonts);
3965
+ return true;
3966
+ }
3967
+ resetToDefaults() {
3968
+ this.fonts$.next([...DEFAULT_FONT_LIST]);
3969
+ }
3970
+ };
3971
+ FontService = __decorate([__decorateParam(0, _univerjs_core.IConfigService)], FontService);
3972
+
3973
+ //#endregion
3974
+ //#region src/views/font-family/use-font-list.ts
3975
+ function useFontList() {
3976
+ const fontService = (0, _wendellhu_redi_react_bindings.useDependency)(IFontService);
3977
+ return {
3978
+ fonts: (0, _wendellhu_redi_react_bindings.useObservable)(fontService.fonts$, fontService.getFonts()),
3979
+ fontService
3576
3980
  };
3577
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3578
- type: "button",
3579
- className: (0, _univerjs_design.clsx)(toolbarButtonVariants({
3580
- noIcon,
3581
- active,
3582
- className
3583
- })),
3584
- style,
3585
- disabled,
3586
- onClick: handleClick,
3587
- onDoubleClick: handleDoubleClick,
3588
- ...restProps,
3589
- children
3590
- });
3591
3981
  }
3592
3982
 
3983
+ //#endregion
3984
+ //#region src/views/font-family/FontFamilyItem.tsx
3985
+ const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
3986
+ const FontFamilyItem = ({ value, onChange }) => {
3987
+ const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
3988
+ const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
3989
+ const { fonts, fontService } = useFontList();
3990
+ function handleSelectFont(nextValue) {
3991
+ onChange(nextValue);
3992
+ }
3993
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
3994
+ dir: direction,
3995
+ className: "univer-m-0 univer-list-none univer-p-0 univer-text-sm",
3996
+ style: { fontFamily: value },
3997
+ children: fonts.map((font) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3998
+ className: "univer-flex univer-h-7 univer-w-full univer-appearance-none univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-border-none univer-bg-transparent univer-px-2 univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700",
3999
+ style: { fontFamily: font.value },
4000
+ type: "button",
4001
+ onClick: () => handleSelectFont(font.value),
4002
+ children: [localeService.t(font.label), !fontService.isFontSupported(font.value) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
4003
+ title: localeService.t("ui.fontFamily.not-supported"),
4004
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.InfoIcon, { className: "univer-text-gray-300 dark:!univer-text-gray-400" })
4005
+ })]
4006
+ }) }, font.value))
4007
+ });
4008
+ };
4009
+
3593
4010
  //#endregion
3594
4011
  //#region src/views/components/ribbon/TooltipButtonWrapper.tsx
3595
4012
  const TooltipWrapperContext = (0, react.createContext)({
@@ -3735,10 +4152,6 @@ function DropdownMenuLabel({ icon, value, option, preserveStrokeWidth, onOptionS
3735
4152
  })]
3736
4153
  });
3737
4154
  }
3738
- function getOptionKey(option) {
3739
- var _option$label2;
3740
- return String(option.id ?? option.commandId ?? option.value ?? (typeof option.label === "string" ? option.label : (_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.name));
3741
- }
3742
4155
  function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, preserveStrokeWidth, onOptionSelect, dropdownComponent, dropdownMenuComponent: DropdownMenuComponent = _univerjs_design.DropdownMenu }) {
3743
4156
  const { dropdownVisible, setDropdownVisible } = (0, react.useContext)(TooltipWrapperContext);
3744
4157
  const shortcutService = (0, _wendellhu_redi_react_bindings.useDependency)(IShortcutService);
@@ -3871,6 +4284,10 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
3871
4284
  function handleEmbedBoundaryFocusOutside(event) {
3872
4285
  keepInteractionInsideSameEmbedBoundary(event);
3873
4286
  }
4287
+ function getOptionKey(option) {
4288
+ var _option$label2;
4289
+ return String(option.id ?? option.commandId ?? option.value ?? (typeof option.label === "string" ? option.label : (_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.name));
4290
+ }
3874
4291
  function handleOptionSelect(option) {
3875
4292
  var _instanceService$getC, _instanceService$getC2;
3876
4293
  const target = sheetTarget;
@@ -3902,8 +4319,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
3902
4319
  return {
3903
4320
  type: "item",
3904
4321
  className: (0, _univerjs_design.clsx)({
3905
- "focus:univer-bg-gray-0 dark:focus:!univer-bg-gray-800": typeof option.label !== "string" && ((_option$label3 = option.label) === null || _option$label3 === void 0 ? void 0 : _option$label3.hoverable) === false,
3906
- "!univer-p-0": isSingleEmbeddedCustomPanel
4322
+ "focus:univer-bg-transparent dark:focus:!univer-bg-transparent": typeof option.label !== "string" && ((_option$label3 = option.label) === null || _option$label3 === void 0 ? void 0 : _option$label3.hoverable) === false,
4323
+ "!univer-p-0": isSingleEmbeddedCustomPanel || typeof option.label === "object" && option.label.name === "UI_FONT_FAMILY_ITEM_COMPONENT"
3907
4324
  }),
3908
4325
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuLabel, {
3909
4326
  icon: option.icon,
@@ -4092,16 +4509,17 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4092
4509
  const { value, hidden, disabled, activated } = useToolbarItemStatus(props);
4093
4510
  const executeCommand = (commandId, params) => {
4094
4511
  layoutService.focus();
4095
- commandService.executeCommand(commandId, params);
4512
+ return commandService.executeCommand(commandId, params);
4096
4513
  };
4097
- const { tooltip, shortcut, icon, title, label, id, commandId, type, slot, params, grid, large, showLabel, iconSize, iconColor, fullWidth, preserveStrokeWidth, dropdownComponent, dropdownMenuComponent } = props;
4514
+ const { tooltip, shortcut, icon, title, label, id, commandId, type, slot, params, grid, overflow, large, showLabel, iconSize, iconColor, fullWidth, preserveStrokeWidth, dropdownComponent, dropdownMenuComponent } = props;
4098
4515
  const gridLabel = title ?? tooltip;
4099
4516
  const shortcutDisplay = useToolbarShortcutDisplay({
4100
4517
  id,
4101
4518
  commandId,
4102
4519
  shortcut
4103
4520
  });
4104
- let tooltipTitle = tooltip ? localeService.t(tooltip) : "";
4521
+ const tooltipLabel = tooltip ?? (overflow ? title : void 0);
4522
+ let tooltipTitle = typeof tooltipLabel === "string" ? localeService.t(tooltipLabel) : "";
4105
4523
  if (shortcutDisplay) tooltipTitle += ` (${shortcutDisplay})`;
4106
4524
  const { selections } = props;
4107
4525
  const selections$ = (0, react.useMemo)(() => {
@@ -4128,26 +4546,27 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4128
4546
  const selectionsCommandId = props.selectionsCommandId;
4129
4547
  const bId = commandId ?? id;
4130
4548
  const sId = selectionsCommandId ?? commandId ?? id;
4131
- const titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
4132
4549
  const customLabelName = typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "";
4133
4550
  const hasCustomLabel = Boolean(componentManager.get(customLabelName));
4134
- const selectorAriaLabel = tooltip ? localeService.t(tooltip) : typeof titleToDisplay === "string" ? localeService.t(titleToDisplay) : void 0;
4551
+ let titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
4552
+ if (overflow) titleToDisplay = hasCustomLabel || iconToDisplay && !showLabel ? void 0 : gridLabel;
4553
+ const selectorAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
4135
4554
  function handleSelect(option) {
4136
4555
  if (disabled) return;
4137
4556
  let commandId = sId;
4138
4557
  if (option.id) commandId = option.id;
4139
4558
  const commandParams = typeof option.params === "function" ? option.params(option.value) : option.params;
4140
- executeCommand(commandId, commandParams ?? { value: option.value });
4559
+ return executeCommand(commandId, commandParams ?? { value: option.value });
4141
4560
  }
4142
4561
  function handleSelectionsValueChange(value) {
4143
4562
  if (disabled) return;
4144
- executeCommand(sId, { value });
4563
+ return executeCommand(sId, { value });
4145
4564
  }
4146
4565
  function handleClick() {
4147
4566
  if (disabled) return;
4148
4567
  if (menuType === 2) {
4149
4568
  const commandParams = typeof params === "function" ? params() : params;
4150
- executeCommand(bId, commandParams ?? { value });
4569
+ return executeCommand(bId, commandParams ?? { value });
4151
4570
  }
4152
4571
  }
4153
4572
  if (menuType === 2) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -4156,15 +4575,21 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4156
4575
  "aria-disabled": disabled,
4157
4576
  className: (0, _univerjs_design.clsx)(toolbarButtonSelectorRootVariants({ disabled }), {
4158
4577
  "univer-box-border univer-h-full univer-min-w-14 univer-flex-col !univer-pr-0": grid && large,
4159
- "univer-box-border univer-h-full": grid && !large
4578
+ "univer-box-border univer-h-full": grid && !large,
4579
+ "!univer-h-auto univer-min-h-7 univer-w-full univer-text-xs": overflow
4160
4580
  }),
4161
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4162
- className: (0, _univerjs_design.clsx)(toolbarButtonSelectorMainVariants({
4581
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4582
+ type: "button",
4583
+ disabled,
4584
+ "aria-label": selectorAriaLabel,
4585
+ "aria-pressed": props.activated$ ? activated : void 0,
4586
+ className: (0, _univerjs_design.clsx)("univer-border-0 univer-bg-transparent univer-text-inherit focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600", toolbarButtonSelectorMainVariants({
4163
4587
  active: activated,
4164
4588
  disabled
4165
4589
  }), {
4166
4590
  "univer-h-full univer-w-full univer-flex-col univer-justify-center univer-rounded univer-px-1 univer-pb-4 [&>svg]:univer-size-6": grid && large,
4167
- "[&>svg]:univer-size-4": grid && !large
4591
+ "[&>svg]:univer-size-4": grid && !large,
4592
+ "univer-min-h-7 univer-min-w-0 univer-flex-1 univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-text-start": overflow
4168
4593
  }),
4169
4594
  onClick: handleClick,
4170
4595
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
@@ -4186,8 +4611,11 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4186
4611
  onOptionSelect: handleSelect,
4187
4612
  dropdownComponent,
4188
4613
  dropdownMenuComponent,
4189
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4190
- className: (0, _univerjs_design.clsx)(toolbarButtonSelectorTriggerVariants({
4614
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4615
+ type: "button",
4616
+ disabled,
4617
+ "aria-label": `${selectorAriaLabel ?? ""} ${localeService.t("ui.ribbon.more")}`,
4618
+ className: (0, _univerjs_design.clsx)("univer-border-0 univer-bg-transparent univer-text-inherit focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600", toolbarButtonSelectorTriggerVariants({
4191
4619
  disabled,
4192
4620
  active: activated
4193
4621
  }), {
@@ -4222,7 +4650,8 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4222
4650
  "univer-box-border univer-h-full univer-min-w-14 univer-flex-col univer-justify-center univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6": grid && large,
4223
4651
  "univer-box-border univer-h-full": grid && !large,
4224
4652
  "univer-bg-gray-0 dark:!univer-bg-gray-800": grid && !large && !icon,
4225
- "[&>svg]:univer-size-4": grid && !large
4653
+ "[&>svg]:univer-size-4": grid && !large,
4654
+ "!univer-h-auto univer-min-h-7 univer-w-full univer-min-w-0 univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-text-start univer-text-xs focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 [&>span]:univer-min-w-0 [&>span]:univer-whitespace-normal": overflow
4226
4655
  }, grid && !large && !icon && _univerjs_design.borderClassName),
4227
4656
  children: grid && large ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
4228
4657
  icon: iconToDisplay,
@@ -4254,7 +4683,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4254
4683
  function renderButtonType() {
4255
4684
  const isCustomComponent = componentManager.get(typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "");
4256
4685
  const buttonAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
4257
- const buttonClassName = (0, _univerjs_design.clsx)(grid && !large && "[&>svg]:univer-size-4", grid && large ? "univer-h-full univer-min-w-14 univer-flex-col univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0");
4686
+ const buttonClassName = (0, _univerjs_design.clsx)(grid && !large && "[&>svg]:univer-size-4", grid && large ? "univer-h-full univer-min-w-14 univer-flex-col univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0", overflow && "!univer-h-auto univer-min-h-7 univer-w-full univer-justify-start univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-py-1 univer-text-start univer-text-xs focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600");
4258
4687
  const buttonStyle = grid && large ? {
4259
4688
  textAlign: "center",
4260
4689
  whiteSpace: "normal"
@@ -4272,7 +4701,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4272
4701
  "aria-disabled": disabled,
4273
4702
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
4274
4703
  className: grid && fullWidth ? "!univer-w-full" : void 0,
4275
- title: grid && showLabel ? gridLabel : title,
4704
+ title: overflow ? void 0 : grid && showLabel ? gridLabel : title,
4276
4705
  value,
4277
4706
  label
4278
4707
  })
@@ -4290,7 +4719,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4290
4719
  onClick: (event) => {
4291
4720
  if (props.subId && event.detail > 1) return;
4292
4721
  const commandParams = typeof params === "function" ? params() : params;
4293
- executeCommand(props.commandId ?? props.id, commandParams ?? (typeof value === "undefined" ? void 0 : { value }));
4722
+ return executeCommand(props.commandId ?? props.id, commandParams ?? (typeof value === "undefined" ? void 0 : { value }));
4294
4723
  },
4295
4724
  onDoubleClick: () => props.subId && executeCommand(props.subId),
4296
4725
  children: icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, {
@@ -4298,7 +4727,7 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4298
4727
  iconSize,
4299
4728
  preserveStrokeWidth,
4300
4729
  title: grid && (large || showLabel) ? gridLabel : void 0
4301
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, { title })
4730
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomLabel, { title: overflow ? gridLabel : title })
4302
4731
  });
4303
4732
  }
4304
4733
  function renderItem() {
@@ -4319,49 +4748,219 @@ const ToolbarItem = (0, react.forwardRef)((props, ref) => {
4319
4748
  });
4320
4749
  });
4321
4750
 
4751
+ //#endregion
4752
+ //#region src/views/components/ribbon/RibbonOverflow.tsx
4753
+ /**
4754
+ * Copyright 2023-present DreamNum Co., Ltd.
4755
+ *
4756
+ * Licensed under the Apache License, Version 2.0 (the "License");
4757
+ * you may not use this file except in compliance with the License.
4758
+ * You may obtain a copy of the License at
4759
+ *
4760
+ * http://www.apache.org/licenses/LICENSE-2.0
4761
+ *
4762
+ * Unless required by applicable law or agreed to in writing, software
4763
+ * distributed under the License is distributed on an "AS IS" BASIS,
4764
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4765
+ * See the License for the specific language governing permissions and
4766
+ * limitations under the License.
4767
+ */
4768
+ function RibbonOverflow({ groups, grid = false }) {
4769
+ const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
4770
+ const dialogService = (0, _wendellhu_redi_react_bindings.useDependency)(IDialogService);
4771
+ const sidebarService = (0, _wendellhu_redi_react_bindings.useDependency)(ISidebarService);
4772
+ const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
4773
+ const [openedGroups, setOpenedGroups] = (0, react.useState)(null);
4774
+ const open = openedGroups === groups;
4775
+ const keyboardRef = (0, react.useRef)(false);
4776
+ const restoreFocusRef = (0, react.useRef)(true);
4777
+ const label = localeService.t("ui.ribbon.more");
4778
+ (0, react.useEffect)(() => {
4779
+ if (!open) return;
4780
+ const closeForPanel = () => {
4781
+ restoreFocusRef.current = false;
4782
+ setOpenedGroups(null);
4783
+ };
4784
+ const sidebar = sidebarService.sidebarOptions$.subscribe((options) => {
4785
+ if (options.visible) closeForPanel();
4786
+ });
4787
+ const dialogs = dialogService.getDialogs$().subscribe((options) => {
4788
+ if (options.some((dialog) => dialog.open)) closeForPanel();
4789
+ });
4790
+ return () => {
4791
+ sidebar.unsubscribe();
4792
+ dialogs.unsubscribe();
4793
+ };
4794
+ }, [
4795
+ open,
4796
+ dialogService,
4797
+ sidebarService
4798
+ ]);
4799
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
4800
+ open,
4801
+ onOpenChange: (visible) => {
4802
+ if (visible) restoreFocusRef.current = true;
4803
+ setOpenedGroups(visible ? groups : null);
4804
+ },
4805
+ align: direction === "rtl" ? "start" : "end",
4806
+ collisionPadding: 12,
4807
+ "aria-label": label,
4808
+ "data-u-comp": "ribbon-overflow",
4809
+ className: "univer-w-80 univer-max-w-[--radix-popper-available-width] univer-overflow-x-hidden",
4810
+ onOpenAutoFocus: (event) => {
4811
+ if (!keyboardRef.current) event.preventDefault();
4812
+ },
4813
+ onFocusOutside: (event) => {
4814
+ event.preventDefault();
4815
+ },
4816
+ onCloseAutoFocus: (event) => {
4817
+ if (!restoreFocusRef.current) event.preventDefault();
4818
+ },
4819
+ overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarDropdownProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4820
+ className: "univer-px-2 univer-py-1",
4821
+ children: groups.map((group, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4822
+ "aria-label": group.title ? localeService.t(group.title) : void 0,
4823
+ className: (0, _univerjs_design.clsx)("univer-py-1.5", index > 0 && _univerjs_design.borderTopClassName),
4824
+ children: [group.title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
4825
+ className: "univer-m-0 univer-mb-1 univer-px-1 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-400",
4826
+ children: localeService.t(group.title)
4827
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4828
+ className: "univer-flex univer-flex-wrap univer-items-center univer-gap-1",
4829
+ children: (group.children ?? [group]).map((child) => {
4830
+ var _child$gridLayout, _child$gridLayout2;
4831
+ return child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4832
+ className: "univer-min-w-0 univer-max-w-full [&>span]:univer-block [&>span]:univer-h-full",
4833
+ style: { width: child.item.label && !child.item.icon ? (_child$gridLayout = child.gridLayout) === null || _child$gridLayout === void 0 ? void 0 : _child$gridLayout.width : void 0 },
4834
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
4835
+ ...child.item,
4836
+ grid: true,
4837
+ showLabel: (_child$gridLayout2 = child.gridLayout) === null || _child$gridLayout2 === void 0 ? void 0 : _child$gridLayout2.showLabel,
4838
+ fullWidth: true,
4839
+ overflow: true,
4840
+ preserveStrokeWidth: true
4841
+ })
4842
+ }, child.key);
4843
+ })
4844
+ })]
4845
+ }, group.key))
4846
+ }) }),
4847
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4848
+ type: "button",
4849
+ "aria-label": label,
4850
+ onPointerDown: () => {
4851
+ keyboardRef.current = false;
4852
+ },
4853
+ onKeyDown: () => {
4854
+ keyboardRef.current = true;
4855
+ },
4856
+ className: (0, _univerjs_design.clsx)(toolbarButtonClassName, "data-[state=open]:univer-bg-primary-50 data-[state=open]:univer-text-primary-600 focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 dark:data-[state=open]:!univer-bg-gray-700 dark:data-[state=open]:!univer-text-primary-300", grid && "!univer-h-14 !univer-w-14 univer-flex-col univer-gap-1.5 univer-text-xs"),
4857
+ children: grid ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreHorizontalIcon, {
4858
+ className: "univer-size-5",
4859
+ preserveStrokeWidth: true
4860
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4861
+ className: "univer-flex univer-items-center univer-gap-0.5",
4862
+ children: [label, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {
4863
+ className: "univer-size-3",
4864
+ preserveStrokeWidth: true
4865
+ })]
4866
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreVerticalIcon, { preserveStrokeWidth: true })
4867
+ })
4868
+ });
4869
+ }
4870
+
4322
4871
  //#endregion
4323
4872
  //#region src/views/components/ribbon/RibbonGrid.tsx
4324
4873
  function RibbonGrid({ groups, title, className, ...props }) {
4325
4874
  const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
4875
+ const containerRef = (0, react.useRef)(null);
4876
+ const moreRef = (0, react.useRef)(null);
4877
+ const groupsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
4878
+ const [visibleGroupCount, setVisibleGroupCount] = (0, react.useState)(groups.length);
4879
+ (0, react.useLayoutEffect)(() => {
4880
+ const container = containerRef.current;
4881
+ if (!container) return;
4882
+ const measure = () => {
4883
+ var _moreRef$current;
4884
+ const style = getComputedStyle(container);
4885
+ const availableWidth = container.clientWidth - Number.parseFloat(style.paddingLeft || "0") - Number.parseFloat(style.paddingRight || "0");
4886
+ const widths = groups.map((group) => {
4887
+ var _groupsRef$current$ge;
4888
+ return ((_groupsRef$current$ge = groupsRef.current.get(group.key)) === null || _groupsRef$current$ge === void 0 ? void 0 : _groupsRef$current$ge.getBoundingClientRect().width) ?? 0;
4889
+ });
4890
+ const limit = widths.reduce((sum, width) => sum + width, 0) <= availableWidth ? availableWidth : availableWidth - (((_moreRef$current = moreRef.current) === null || _moreRef$current === void 0 ? void 0 : _moreRef$current.getBoundingClientRect().width) ?? 0);
4891
+ let used = 0;
4892
+ let count = 0;
4893
+ for (const width of widths) {
4894
+ if (used + width > limit) break;
4895
+ used += width;
4896
+ count += 1;
4897
+ }
4898
+ setVisibleGroupCount(count);
4899
+ };
4900
+ const observer = new ResizeObserver(measure);
4901
+ observer.observe(container);
4902
+ groupsRef.current.forEach((element) => observer.observe(element));
4903
+ if (moreRef.current) observer.observe(moreRef.current);
4904
+ return () => observer.disconnect();
4905
+ }, [groups, visibleGroupCount]);
4906
+ const hiddenGroups = groups.slice(visibleGroupCount);
4326
4907
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4327
4908
  ...props,
4909
+ ref: containerRef,
4328
4910
  "data-testid": "ribbon-grid-toolbar",
4329
4911
  "data-u-comp": "ribbon-grid-toolbar",
4330
- className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-overflow-x-auto univer-overflow-y-hidden univer-bg-gray-50 univer-px-2 univer-text-sm dark:!univer-bg-gray-900", _univerjs_design.borderBottomClassName, _univerjs_design.scrollbarClassName, className),
4912
+ className: (0, _univerjs_design.clsx)("univer-relative univer-box-border univer-flex univer-h-[73px] univer-min-w-0 univer-overflow-hidden univer-bg-gray-50 univer-px-2 univer-text-sm dark:!univer-bg-gray-900", _univerjs_design.borderBottomClassName, className),
4331
4913
  role: "toolbar",
4332
4914
  "aria-label": localeService.t(title),
4333
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarDropdownProvider, { children: groups.map((group) => {
4334
- const placements = placeRibbonGridItems(group.children ?? []);
4335
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4336
- "data-u-comp": "ribbon-grid-group",
4337
- className: "univer-relative univer-box-border univer-flex univer-shrink-0 univer-flex-col univer-px-2",
4338
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4339
- "data-testid": "ribbon-grid-group-grid",
4340
- className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-[repeat(2,1.5rem)] univer-content-center univer-gap-2 univer-py-2 [&>div>span>span]:univer-h-full",
4341
- children: placements.map((placement) => placement.item.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4342
- className: (0, _univerjs_design.clsx)("univer-flex univer-items-stretch [&>span>button]:univer-h-full [&>span]:univer-h-full", placement.width && "[&>span>span]:univer-w-full [&>span]:univer-w-full [&_[data-u-command]]:univer-w-full"),
4343
- style: {
4344
- gridRow: `${placement.row} / span ${placement.rowSpan}`,
4345
- gridColumn: `${placement.column} / span ${placement.columnSpan}`,
4346
- width: placement.width
4347
- },
4348
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
4349
- ...placement.item.item,
4350
- grid: true,
4351
- large: placement.rowSpan > 1,
4352
- showLabel: placement.showLabel,
4353
- iconSize: placement.iconSize,
4354
- fullWidth: placement.width !== void 0,
4355
- preserveStrokeWidth: true
4356
- })
4357
- }, placement.item.key))
4358
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4359
- "data-testid": "ribbon-grid-group-divider",
4360
- className: (0, _univerjs_design.clsx)("univer-pointer-events-none univer-absolute univer-bottom-1.5 univer-right-0 univer-top-3.5 !univer-border-gray-300 univer-opacity-50 rtl:univer-left-0 rtl:univer-right-auto", _univerjs_design.borderRightClassName),
4361
- "aria-hidden": "true"
4362
- })]
4363
- }, group.key);
4364
- }) })
4915
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarDropdownProvider, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4916
+ className: "univer-flex univer-min-w-0 univer-overflow-hidden",
4917
+ children: groups.map((group, index) => {
4918
+ const placements = placeRibbonGridItems(group.children ?? []);
4919
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4920
+ ref: (element) => {
4921
+ if (element) groupsRef.current.set(group.key, element);
4922
+ else groupsRef.current.delete(group.key);
4923
+ },
4924
+ "data-u-comp": "ribbon-grid-group",
4925
+ "data-group-key": group.key,
4926
+ "aria-hidden": index >= visibleGroupCount || void 0,
4927
+ className: (0, _univerjs_design.clsx)("univer-relative univer-box-border univer-flex univer-w-max univer-shrink-0 univer-flex-col univer-px-2", index >= visibleGroupCount && "univer-pointer-events-none univer-invisible univer-absolute"),
4928
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4929
+ "data-testid": "ribbon-grid-group-grid",
4930
+ className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-[repeat(2,1.5rem)] univer-content-center univer-gap-2 univer-py-2 [&>div>span>span]:univer-h-full",
4931
+ children: placements.map((placement) => placement.item.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4932
+ className: (0, _univerjs_design.clsx)("univer-flex univer-items-stretch [&>span>button]:univer-h-full [&>span]:univer-h-full", placement.width && "[&>span>span]:univer-w-full [&>span]:univer-w-full [&_[data-u-command]]:univer-w-full"),
4933
+ style: {
4934
+ gridRow: `${placement.row} / span ${placement.rowSpan}`,
4935
+ gridColumn: `${placement.column} / span ${placement.columnSpan}`,
4936
+ width: placement.width
4937
+ },
4938
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
4939
+ ...placement.item.item,
4940
+ grid: true,
4941
+ large: placement.rowSpan > 1,
4942
+ showLabel: placement.showLabel,
4943
+ iconSize: placement.iconSize,
4944
+ fullWidth: placement.width !== void 0,
4945
+ preserveStrokeWidth: true
4946
+ })
4947
+ }, placement.item.key))
4948
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4949
+ "data-testid": "ribbon-grid-group-divider",
4950
+ className: (0, _univerjs_design.clsx)("univer-pointer-events-none univer-absolute univer-bottom-1.5 univer-right-0 univer-top-3.5 !univer-border-gray-300 univer-opacity-50 rtl:univer-left-0 rtl:univer-right-auto", _univerjs_design.borderRightClassName),
4951
+ "aria-hidden": "true"
4952
+ })]
4953
+ }, group.key);
4954
+ })
4955
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4956
+ ref: moreRef,
4957
+ "aria-hidden": hiddenGroups.length === 0 || void 0,
4958
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-w-16 univer-shrink-0 univer-py-2 univer-pl-2 rtl:univer-pl-0 rtl:univer-pr-2", hiddenGroups.length === 0 && "univer-invisible univer-absolute"),
4959
+ children: hiddenGroups.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RibbonOverflow, {
4960
+ groups: hiddenGroups,
4961
+ grid: true
4962
+ })
4963
+ })] }, visibleGroupCount)
4365
4964
  });
4366
4965
  }
4367
4966
 
@@ -4551,7 +5150,7 @@ function Ribbon(props) {
4551
5150
  ...embedRibbonOverrideAttributes,
4552
5151
  groups: activeGroup.allGroups,
4553
5152
  title: activatedTabTitle
4554
- }),
5153
+ }, effectiveActivatedTab),
4555
5154
  !hideToolbar && ribbonType !== "grid" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4556
5155
  ...embedRibbonOverrideAttributes,
4557
5156
  className: (0, _univerjs_design.clsx)("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3 univer-text-sm", {
@@ -4579,37 +5178,7 @@ function Ribbon(props) {
4579
5178
  }) }, groupItem.key);
4580
5179
  }), collapsedIds.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4581
5180
  className: "univer-pl-2 rtl:univer-pr-2",
4582
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
4583
- collisionPadding: {
4584
- right: 12,
4585
- left: 12
4586
- },
4587
- onOpenAutoFocus: (e) => e.preventDefault(),
4588
- overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4589
- className: "univer-box-border univer-grid univer-max-w-[--radix-popper-available-width] univer-gap-2 univer-p-2",
4590
- children: activeGroup.hiddenGroups.map((groupItem) => {
4591
- var _groupItem$children5;
4592
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4593
- className: "univer-flex univer-items-center univer-gap-2",
4594
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4595
- className: "univer-flex univer-flex-wrap univer-gap-2",
4596
- children: groupItem.children ? (_groupItem$children5 = groupItem.children) === null || _groupItem$children5 === void 0 ? void 0 : _groupItem$children5.map((child) => child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
4597
- ...child.item,
4598
- preserveStrokeWidth: true
4599
- }, child.key)) : groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarItem, {
4600
- ...groupItem.item,
4601
- preserveStrokeWidth: true
4602
- }, groupItem.key)
4603
- })
4604
- }, groupItem.key);
4605
- })
4606
- }),
4607
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4608
- type: "button",
4609
- className: toolbarButtonClassName,
4610
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreVerticalIcon, { preserveStrokeWidth: true })
4611
- })
4612
- })
5181
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RibbonOverflow, { groups: activeGroup.hiddenGroups })
4613
5182
  })] }, effectiveActivatedTab)
4614
5183
  })]
4615
5184
  }),
@@ -4929,6 +5498,21 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
4929
5498
 
4930
5499
  //#endregion
4931
5500
  //#region src/views/menu/desktop/TinyMenuGroup.tsx
5501
+ /**
5502
+ * Copyright 2023-present DreamNum Co., Ltd.
5503
+ *
5504
+ * Licensed under the Apache License, Version 2.0 (the "License");
5505
+ * you may not use this file except in compliance with the License.
5506
+ * You may obtain a copy of the License at
5507
+ *
5508
+ * http://www.apache.org/licenses/LICENSE-2.0
5509
+ *
5510
+ * Unless required by applicable law or agreed to in writing, software
5511
+ * distributed under the License is distributed on an "AS IS" BASIS,
5512
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5513
+ * See the License for the specific language governing permissions and
5514
+ * limitations under the License.
5515
+ */
4932
5516
  const EMPTY_HIDDEN_ITEM_IDS = [];
4933
5517
  const EMPTY_TINY_MENU_CHILDREN = [];
4934
5518
  const quickTileMenuButtonVariants = (0, _univerjs_design.cva)("univer-relative univer-box-border univer-flex univer-size-12 univer-w-full univer-appearance-none univer-flex-col univer-items-center univer-justify-center univer-gap-0.5 univer-rounded-lg univer-border-none univer-bg-gray-0 univer-p-0 univer-font-medium univer-text-gray-700 univer-outline-none univer-transition-all focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 focus-visible:univer-ring-offset-0 dark:!univer-bg-gray-700 dark:!univer-text-gray-100", {
@@ -5055,7 +5639,7 @@ function UIQuickTileMenuGroup(props) {
5055
5639
  const { item, activeItemIds, hiddenItemIds = EMPTY_HIDDEN_ITEM_IDS, onOptionSelect } = props;
5056
5640
  if (!((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length)) return null;
5057
5641
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5058
- className: "univer-item-center univer-grid univer-grid-cols-3 univer-gap-1.5 univer-py-1",
5642
+ className: "univer-grid univer-grid-cols-3 univer-items-center univer-gap-1.5 univer-py-1",
5059
5643
  children: getVisibleTinyMenuChildren(item.children, hiddenItemIds).map((menuSchema) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuickTileMenuItem, {
5060
5644
  menuSchema,
5061
5645
  activeItemIds,
@@ -5730,8 +6314,9 @@ function ContextMenuMenuItem(props) {
5730
6314
  const scheduleSubmenuClose = (0, react.useCallback)(() => {
5731
6315
  clearSubmenuCloseTimer();
5732
6316
  submenuCloseTimerRef.current = setTimeout(() => {
6317
+ var _submenuElementRef$cu;
5733
6318
  submenuCloseTimerRef.current = null;
5734
- closeSubmenu();
6319
+ if (!((_submenuElementRef$cu = submenuElementRef.current) === null || _submenuElementRef$cu === void 0 ? void 0 : _submenuElementRef$cu.contains(document.activeElement))) closeSubmenu();
5735
6320
  }, 500);
5736
6321
  }, [clearSubmenuCloseTimer, closeSubmenu]);
5737
6322
  (0, react.useEffect)(() => {
@@ -5747,9 +6332,9 @@ function ContextMenuMenuItem(props) {
5747
6332
  return preventBrowserZoomInContainers([submenuElement]);
5748
6333
  }, [submenuVisible]);
5749
6334
  (0, react.useLayoutEffect)(() => {
5750
- var _submenuElementRef$cu;
6335
+ var _submenuElementRef$cu2;
5751
6336
  if (!submenuVisible || !submenuPositionReady || !keyboardSubmenuFocusRequested) return;
5752
- const firstEnabledButton = (_submenuElementRef$cu = submenuElementRef.current) === null || _submenuElementRef$cu === void 0 ? void 0 : _submenuElementRef$cu.querySelector("button:not(:disabled)");
6337
+ const firstEnabledButton = (_submenuElementRef$cu2 = submenuElementRef.current) === null || _submenuElementRef$cu2 === void 0 ? void 0 : _submenuElementRef$cu2.querySelector("button:not(:disabled)");
5753
6338
  firstEnabledButton === null || firstEnabledButton === void 0 || firstEnabledButton.focus();
5754
6339
  }, [
5755
6340
  keyboardSubmenuFocusRequested,
@@ -5783,10 +6368,13 @@ function ContextMenuMenuItem(props) {
5783
6368
  setSubmenuPositionReady(true);
5784
6369
  };
5785
6370
  const frameId = window.requestAnimationFrame(updateSubmenuPosition);
6371
+ const resizeObserver = new ResizeObserver(updateSubmenuPosition);
6372
+ if (submenuElementRef.current) resizeObserver.observe(submenuElementRef.current);
5786
6373
  window.addEventListener("resize", updateSubmenuPosition);
5787
6374
  window.addEventListener("scroll", updateSubmenuPosition, true);
5788
6375
  return () => {
5789
6376
  window.cancelAnimationFrame(frameId);
6377
+ resizeObserver.disconnect();
5790
6378
  window.removeEventListener("resize", updateSubmenuPosition);
5791
6379
  window.removeEventListener("scroll", updateSubmenuPosition, true);
5792
6380
  };
@@ -5843,9 +6431,10 @@ function ContextMenuMenuItem(props) {
5843
6431
  },
5844
6432
  onMouseLeave: (event) => {
5845
6433
  if (hasSubmenu) {
5846
- var _submenuElementRef$cu2;
6434
+ var _submenuElementRef$cu3, _submenuElementRef$cu4;
6435
+ if ((_submenuElementRef$cu3 = submenuElementRef.current) === null || _submenuElementRef$cu3 === void 0 ? void 0 : _submenuElementRef$cu3.contains(document.activeElement)) return;
5847
6436
  const nextTarget = event.relatedTarget;
5848
- if (nextTarget && ((_submenuElementRef$cu2 = submenuElementRef.current) === null || _submenuElementRef$cu2 === void 0 ? void 0 : _submenuElementRef$cu2.contains(nextTarget))) return;
6437
+ if (nextTarget && ((_submenuElementRef$cu4 = submenuElementRef.current) === null || _submenuElementRef$cu4 === void 0 ? void 0 : _submenuElementRef$cu4.contains(nextTarget))) return;
5849
6438
  if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
5850
6439
  closeSubmenu();
5851
6440
  return;
@@ -5941,7 +6530,8 @@ function ContextMenuMenuItem(props) {
5941
6530
  onMenuPointerEnter === null || onMenuPointerEnter === void 0 || onMenuPointerEnter();
5942
6531
  },
5943
6532
  onMouseLeave: (event) => {
5944
- var _menuItemElementRef$c;
6533
+ var _submenuElementRef$cu5, _menuItemElementRef$c;
6534
+ if ((_submenuElementRef$cu5 = submenuElementRef.current) === null || _submenuElementRef$cu5 === void 0 ? void 0 : _submenuElementRef$cu5.contains(document.activeElement)) return;
5945
6535
  const nextTarget = event.relatedTarget;
5946
6536
  if (nextTarget && ((_menuItemElementRef$c = menuItemElementRef.current) === null || _menuItemElementRef$c === void 0 ? void 0 : _menuItemElementRef$c.contains(nextTarget))) return;
5947
6537
  if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
@@ -6370,7 +6960,7 @@ function Sidebar() {
6370
6960
  }),
6371
6961
  style: { width: isDragging ? void 0 : width },
6372
6962
  children: [(options === null || options === void 0 ? void 0 : options.visible) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6373
- className: "hover:univer-bg-primary-500/30 active:univer-bg-primary-500/50 univer-absolute univer-left-0 univer-top-0 univer-z-20 univer-h-full univer-w-1 univer-cursor-col-resize univer-transition-colors",
6963
+ className: "univer-absolute univer-left-0 univer-top-0 univer-z-20 univer-h-full univer-w-1 univer-cursor-col-resize univer-transition-colors hover:univer-bg-primary-500 active:univer-bg-primary-500",
6374
6964
  onMouseDown: handleResizeMouseDown,
6375
6965
  role: "separator",
6376
6966
  "aria-orientation": "vertical",
@@ -6401,7 +6991,7 @@ function Sidebar() {
6401
6991
  children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6402
6992
  ref: closeButtonRef,
6403
6993
  type: "button",
6404
- className: "focus:univer-ring-primary-500/50 univer-flex univer-size-6 univer-cursor-pointer univer-appearance-none univer-items-center univer-justify-center univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-text-gray-500 focus:univer-outline-none focus:univer-ring-2 dark:!univer-text-gray-300",
6994
+ className: "univer-flex univer-size-6 univer-cursor-pointer univer-appearance-none univer-items-center univer-justify-center univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-text-gray-500 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-500 dark:!univer-text-gray-300",
6405
6995
  onClick: handleClose,
6406
6996
  "aria-label": localeService.t("ui.sidebar.close"),
6407
6997
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, {})
@@ -6630,16 +7220,8 @@ function useLatest(value) {
6630
7220
  ref.current = value;
6631
7221
  return ref;
6632
7222
  }
6633
- const useVirtualList = (list, options) => {
6634
- const { containerTarget, itemHeight, overscan = 5 } = options;
7223
+ function useVirtualListMetrics(list, itemHeight) {
6635
7224
  const itemHeightRef = useLatest(itemHeight);
6636
- const [size, setSize] = (0, react.useState)(null);
6637
- const scrollTriggerByScrollToFunc = (0, react.useRef)(false);
6638
- const [targetList, setTargetList] = (0, react.useState)([]);
6639
- const [wrapperStyle, setWrapperStyle] = (0, react.useState)({
6640
- height: void 0,
6641
- marginTop: void 0
6642
- });
6643
7225
  const getVisibleCount = (containerHeight, fromIndex) => {
6644
7226
  if (typeof itemHeightRef.current === "number") return Math.ceil(containerHeight / itemHeightRef.current);
6645
7227
  let sum = 0;
@@ -6670,29 +7252,18 @@ const useVirtualList = (list, options) => {
6670
7252
  if (typeof itemHeightRef.current === "number") return index * itemHeightRef.current;
6671
7253
  return list.slice(0, index).reduce((sum, _, i) => sum + itemHeightRef.current(i, list[i]), 0);
6672
7254
  };
6673
- const totalHeight = (0, react.useMemo)(() => {
6674
- if (isNumber(itemHeightRef.current)) return list.length * itemHeightRef.current;
6675
- return list.reduce((sum, _, index) => sum + itemHeightRef.current(index, list[index]), 0);
6676
- }, [list]);
6677
- const calculateRange = () => {
6678
- const container = containerTarget.current;
6679
- if (container) {
6680
- const { scrollTop, clientHeight } = container;
6681
- const offset = getOffset(scrollTop);
6682
- const visibleCount = getVisibleCount(clientHeight, offset);
6683
- const start = Math.max(0, offset - overscan);
6684
- const end = Math.min(list.length, offset + visibleCount + overscan);
6685
- const offsetTop = getDistanceTop(start);
6686
- setWrapperStyle({
6687
- height: `${totalHeight - offsetTop}px`,
6688
- marginTop: `${offsetTop}px`
6689
- });
6690
- setTargetList(list.slice(start, end).map((ele, index) => ({
6691
- data: ele,
6692
- index: index + start
6693
- })));
6694
- }
7255
+ return {
7256
+ getVisibleCount,
7257
+ getOffset,
7258
+ getDistanceTop,
7259
+ totalHeight: (0, react.useMemo)(() => {
7260
+ if (isNumber(itemHeightRef.current)) return list.length * itemHeightRef.current;
7261
+ return list.reduce((sum, _, index) => sum + itemHeightRef.current(index, list[index]), 0);
7262
+ }, [list])
6695
7263
  };
7264
+ }
7265
+ function useContainerSize(containerTarget) {
7266
+ const [size, setSize] = (0, react.useState)(null);
6696
7267
  (0, react.useEffect)(() => {
6697
7268
  if (containerTarget.current) {
6698
7269
  const getSize = () => {
@@ -6711,6 +7282,37 @@ const useVirtualList = (list, options) => {
6711
7282
  };
6712
7283
  }
6713
7284
  }, []);
7285
+ return size;
7286
+ }
7287
+ const useVirtualList = (list, options) => {
7288
+ const { containerTarget, itemHeight, overscan = 5 } = options;
7289
+ const { getVisibleCount, getOffset, getDistanceTop, totalHeight } = useVirtualListMetrics(list, itemHeight);
7290
+ const size = useContainerSize(containerTarget);
7291
+ const scrollTriggerByScrollToFunc = (0, react.useRef)(false);
7292
+ const [targetList, setTargetList] = (0, react.useState)([]);
7293
+ const [wrapperStyle, setWrapperStyle] = (0, react.useState)({
7294
+ height: void 0,
7295
+ marginTop: void 0
7296
+ });
7297
+ const calculateRange = () => {
7298
+ const container = containerTarget.current;
7299
+ if (container) {
7300
+ const { scrollTop, clientHeight } = container;
7301
+ const offset = getOffset(scrollTop);
7302
+ const visibleCount = getVisibleCount(clientHeight, offset);
7303
+ const start = Math.max(0, offset - overscan);
7304
+ const end = Math.min(list.length, offset + visibleCount + overscan);
7305
+ const offsetTop = getDistanceTop(start);
7306
+ setWrapperStyle({
7307
+ height: `${totalHeight - offsetTop}px`,
7308
+ marginTop: `${offsetTop}px`
7309
+ });
7310
+ setTargetList(list.slice(start, end).map((ele, index) => ({
7311
+ data: ele,
7312
+ index: index + start
7313
+ })));
7314
+ }
7315
+ };
6714
7316
  (0, react.useEffect)(() => {
6715
7317
  if (!(size === null || size === void 0 ? void 0 : size.width) || !(size === null || size === void 0 ? void 0 : size.height)) return;
6716
7318
  calculateRange();
@@ -7036,7 +7638,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
7036
7638
  //#endregion
7037
7639
  //#region package.json
7038
7640
  var name = "@univerjs/ui";
7039
- var version = "1.1.0";
7641
+ var version = "1.3.0";
7040
7642
 
7041
7643
  //#endregion
7042
7644
  //#region src/views/color-picker/interface.ts
@@ -22708,6 +23310,37 @@ function EmojiPicker(props) {
22708
23310
  const recentStorageKey = (extraProps === null || extraProps === void 0 ? void 0 : extraProps.recentStorageKey) ?? RECENTS_STORAGE_KEY;
22709
23311
  const isSearching = deferredQuery.trim().length > 0;
22710
23312
  const { rows, sectionPositions } = (0, react.useMemo)(() => {
23313
+ function createEmojiVirtualRows(sections, locale) {
23314
+ const rows = [];
23315
+ const sectionPositions = [];
23316
+ let top = 0;
23317
+ sections.forEach((section) => {
23318
+ if (!section.emojis.length) return;
23319
+ sectionPositions.push({
23320
+ key: section.key,
23321
+ rowIndex: rows.length,
23322
+ top
23323
+ });
23324
+ rows.push({
23325
+ key: `${locale}-${section.key}-header`,
23326
+ title: section.title,
23327
+ type: "header"
23328
+ });
23329
+ top += EMOJI_SECTION_HEADER_HEIGHT;
23330
+ for (let start = 0; start < section.emojis.length; start += EMOJI_COLUMN_COUNT) {
23331
+ rows.push({
23332
+ items: section.emojis.slice(start, start + EMOJI_COLUMN_COUNT),
23333
+ key: `${locale}-${section.key}-${start / EMOJI_COLUMN_COUNT}`,
23334
+ type: "emojis"
23335
+ });
23336
+ top += EMOJI_ROW_HEIGHT;
23337
+ }
23338
+ });
23339
+ return {
23340
+ rows,
23341
+ sectionPositions
23342
+ };
23343
+ }
22711
23344
  const normalSections = [{
22712
23345
  key: "recent",
22713
23346
  title: localeService.t("ui.emojiPicker.recents"),
@@ -22732,7 +23365,7 @@ function EmojiPicker(props) {
22732
23365
  ]);
22733
23366
  const [virtualRows, { containerProps, scrollTo, wrapperStyle }] = useVirtualList(rows, {
22734
23367
  containerTarget: scrollRef,
22735
- itemHeight: getEmojiVirtualRowHeight,
23368
+ itemHeight: (_index, row) => row.type === "header" ? EMOJI_SECTION_HEADER_HEIGHT : EMOJI_ROW_HEIGHT,
22736
23369
  overscan: EMOJI_VIRTUAL_OVERSCAN
22737
23370
  });
22738
23371
  (0, react.useEffect)(() => {
@@ -22764,6 +23397,16 @@ function EmojiPicker(props) {
22764
23397
  scrollTo,
22765
23398
  sectionPositions
22766
23399
  ]);
23400
+ function writeStorageItem(localStorageService, storageKey, value) {
23401
+ localStorageService.setItem(storageKey, value).catch(() => void 0);
23402
+ }
23403
+ function getActiveSectionByScrollTop(sectionPositions, scrollTop) {
23404
+ let active = "recent";
23405
+ sectionPositions.forEach((position) => {
23406
+ if (position.top <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = position.key;
23407
+ });
23408
+ return active;
23409
+ }
22767
23410
  const handleSelect = (item, options) => {
22768
23411
  var _props$onChange, _extraProps$onSelect;
22769
23412
  const nextRecents = promoteRecentEmoji(recents, item);
@@ -22928,7 +23571,7 @@ function EmojiButton(props) {
22928
23571
  type: "button",
22929
23572
  "aria-label": `${title}, ${props.moreTitle}`,
22930
23573
  title: `${title}, ${props.moreTitle}`,
22931
- className: "univer-bg-gray-0/90 dark:!univer-bg-gray-800/90 univer-absolute univer-bottom-0 univer-right-0 univer-flex univer-size-3 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-border-0 univer-p-0 univer-text-gray-500 hover:univer-bg-gray-100 hover:univer-text-gray-700 focus-visible:univer-outline-none focus-visible:univer-ring-1 focus-visible:univer-ring-primary-600 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700",
23574
+ className: "univer-absolute univer-bottom-0 univer-right-0 univer-flex univer-size-3 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-border-0 univer-bg-gray-0 univer-p-0 univer-text-gray-500 hover:univer-bg-gray-100 hover:univer-text-gray-700 focus-visible:univer-outline-none focus-visible:univer-ring-1 focus-visible:univer-ring-primary-600 dark:!univer-bg-gray-800 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700",
22932
23575
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "!univer-size-2.5" })
22933
23576
  })
22934
23577
  })]
@@ -23016,50 +23659,6 @@ function CategoryButton(props) {
23016
23659
  children: props.children
23017
23660
  });
23018
23661
  }
23019
- function writeStorageItem(localStorageService, storageKey, value) {
23020
- localStorageService.setItem(storageKey, value).catch(() => void 0);
23021
- }
23022
- function createEmojiVirtualRows(sections, locale) {
23023
- const rows = [];
23024
- const sectionPositions = [];
23025
- let top = 0;
23026
- sections.forEach((section) => {
23027
- if (!section.emojis.length) return;
23028
- sectionPositions.push({
23029
- key: section.key,
23030
- rowIndex: rows.length,
23031
- top
23032
- });
23033
- rows.push({
23034
- key: `${locale}-${section.key}-header`,
23035
- title: section.title,
23036
- type: "header"
23037
- });
23038
- top += EMOJI_SECTION_HEADER_HEIGHT;
23039
- for (let start = 0; start < section.emojis.length; start += EMOJI_COLUMN_COUNT) {
23040
- rows.push({
23041
- items: section.emojis.slice(start, start + EMOJI_COLUMN_COUNT),
23042
- key: `${locale}-${section.key}-${start / EMOJI_COLUMN_COUNT}`,
23043
- type: "emojis"
23044
- });
23045
- top += EMOJI_ROW_HEIGHT;
23046
- }
23047
- });
23048
- return {
23049
- rows,
23050
- sectionPositions
23051
- };
23052
- }
23053
- function getEmojiVirtualRowHeight(_index, row) {
23054
- return row.type === "header" ? EMOJI_SECTION_HEADER_HEIGHT : EMOJI_ROW_HEIGHT;
23055
- }
23056
- function getActiveSectionByScrollTop(sectionPositions, scrollTop) {
23057
- let active = "recent";
23058
- sectionPositions.forEach((position) => {
23059
- if (position.top <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = position.key;
23060
- });
23061
- return active;
23062
- }
23063
23662
  function CategoryIcon(props) {
23064
23663
  switch (props.category) {
23065
23664
  case "activity": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.ActivityIcon, {});
@@ -23081,299 +23680,6 @@ function MobileEmojiPicker(props) {
23081
23680
  });
23082
23681
  }
23083
23682
 
23084
- //#endregion
23085
- //#region src/services/font.service.ts
23086
- const IFontService = (0, _univerjs_core.createIdentifier)("univer.font-service");
23087
- const DEFAULT_FONT_LIST = [
23088
- "宋体",
23089
- "Arial",
23090
- "Baskerville",
23091
- "Comic Sans MS",
23092
- "Courier New",
23093
- "Helvetica",
23094
- "Times New Roman",
23095
- "Verdana",
23096
- "Apple LiGothic",
23097
- "Apple LiSung",
23098
- "Hei",
23099
- "Kai",
23100
- "LiHei Pro",
23101
- "LiSong Pro",
23102
- "STFangsong",
23103
- "STHeiti",
23104
- "STKaiti",
23105
- "STSong",
23106
- "报隶-繁",
23107
- "报隶-简",
23108
- "冬青黑体简体中文",
23109
- "黑体-繁",
23110
- "黑体-简",
23111
- "华文仿宋",
23112
- "华文楷体",
23113
- "华文宋体",
23114
- "楷体-繁",
23115
- "楷体-简",
23116
- "兰亭黑-繁",
23117
- "兰亭黑-简",
23118
- "隶变-繁",
23119
- "隶变-简",
23120
- "凌慧体-繁",
23121
- "凌慧体-简",
23122
- "翩翩体-繁",
23123
- "翩翩体-简",
23124
- "苹方-繁",
23125
- "苹方-港",
23126
- "苹方-简",
23127
- "手札体-繁",
23128
- "手札体-简",
23129
- "宋体-繁",
23130
- "宋体-简",
23131
- "娃娃体-繁",
23132
- "娃娃体-简",
23133
- "魏碑-繁",
23134
- "魏碑-简",
23135
- "行楷-繁",
23136
- "行楷-简",
23137
- "雅痞-繁",
23138
- "雅痞-简",
23139
- "圆体-繁",
23140
- "圆体-简",
23141
- "Arial Black",
23142
- "Big Caslon",
23143
- "Courier",
23144
- "Didot",
23145
- "Futura",
23146
- "Georgia",
23147
- "Helvetica Neue",
23148
- "Optima",
23149
- "Times",
23150
- "Tahoma",
23151
- "BIZ UDGothic",
23152
- "BIZ UDMincho",
23153
- "Hiragino Maru Gothic Pro",
23154
- "Hiragino Maru Gothic ProN",
23155
- "Hiragino Mincho Pro",
23156
- "Hiragino Mincho ProN",
23157
- "Hiragino Sans",
23158
- "Klee",
23159
- "Osaka",
23160
- "Toppan Bunkyu Gothic",
23161
- "Toppan Bunkyu Midashi Gothic",
23162
- "Toppan Bunkyu Midashi Mincho",
23163
- "Toppan Bunkyu Mincho",
23164
- "Tsukushi A Round Gothic",
23165
- "Tsukushi B Round Gothic",
23166
- "YuKyokasho",
23167
- "YuKyokasho Yoko",
23168
- "YuMincho +36p Kana",
23169
- "American Typewriter",
23170
- "Andale Mono",
23171
- "Apple Chancery",
23172
- "Apple SD Gothic Neo",
23173
- "Apple Symbols",
23174
- "AppleGothic",
23175
- "AppleMyungjo",
23176
- "Arial Unicode MS",
23177
- "Athelas",
23178
- "Avenir",
23179
- "Avenir Next",
23180
- "Avenir Next Condensed",
23181
- "Ayuthaya",
23182
- "Bangla MN",
23183
- "Bangla Sangam MN",
23184
- "Bauhaus 93",
23185
- "Bodoni 72",
23186
- "Bodoni 72 Oldstyle",
23187
- "Bodoni 72 Smallcaps",
23188
- "Bodoni Ornaments",
23189
- "Bookshelf Symbol 7",
23190
- "Bradley Hand",
23191
- "Chalkboard",
23192
- "Chalkboard SE",
23193
- "Chalkduster",
23194
- "Charter",
23195
- "Cochin",
23196
- "Copperplate",
23197
- "Devanagari Sangam MN",
23198
- "Din Alternate",
23199
- "Euphemia UCAS",
23200
- "Galvji",
23201
- "Geneva",
23202
- "Gill Sans",
23203
- "Gujarati Sangam MN",
23204
- "GungSeo",
23205
- "Gurmukhi MN",
23206
- "Gurmukhi Sangam MN",
23207
- "HeadLineA",
23208
- "Herculanum",
23209
- "Hiragino Kaku Gothic Pro",
23210
- "Hiragino Kaku Gothic ProN",
23211
- "Hiragino Kaku Gothic Std",
23212
- "Hiragino Kaku Gothic StdN",
23213
- "Hoefler Text",
23214
- "Impact",
23215
- "InaiMathi",
23216
- "Iowan Old Style",
23217
- "Kannada MN",
23218
- "Kannada Sangam MN",
23219
- "Kefa",
23220
- "Khmer MN",
23221
- "Khmer Sangam MN",
23222
- "Kohinoor Bangla",
23223
- "Kohinoor Devanagari",
23224
- "Kohinoor Telugu",
23225
- "Krungthep",
23226
- "Lao MN",
23227
- "Lao Sangam MN",
23228
- "Lucida Grande",
23229
- "Luminari",
23230
- "Malayalam MN",
23231
- "Malayalam Sangam MN",
23232
- "Marion",
23233
- "Marker Felt",
23234
- "Menlo",
23235
- "Microsoft Sans Serif",
23236
- "Modern No. 20",
23237
- "Monaco",
23238
- "Mukta Mahee",
23239
- "Nanum Brush Script",
23240
- "Nanum Gothic",
23241
- "Nanum Myeongjo",
23242
- "Nanum Pen Script",
23243
- "Noteworthy",
23244
- "Oriya MN",
23245
- "Oriya Sangam MN",
23246
- "Palatino",
23247
- "Papyrus",
23248
- "PCMyungjo",
23249
- "Phosphate",
23250
- "PilGi",
23251
- "Plantagenet Cherokee",
23252
- "PT Mono",
23253
- "PT Sans",
23254
- "PT Sans Caption",
23255
- "PT Serif",
23256
- "PT Serif Caption",
23257
- "Rockwell",
23258
- "Sathu",
23259
- "Savoye LET",
23260
- "Seravek",
23261
- "Shree Devanagari 714",
23262
- "SignPainter",
23263
- "Silom",
23264
- "Sinhala MN",
23265
- "Sinhala Sangam MN",
23266
- "Skia",
23267
- "Snell Roundhand",
23268
- "STIXGeneral",
23269
- "Sukhumvit Set",
23270
- "Superclarendon",
23271
- "Tamil MN",
23272
- "Tamil Sangam MN",
23273
- "Telugu MN",
23274
- "Telugu Sangam MN",
23275
- "Trattatello",
23276
- "Trebuchet MS",
23277
- "Webdings",
23278
- "Wingdings",
23279
- "Wingdings 2",
23280
- "Wingdings 3",
23281
- "YuGothic",
23282
- "YuGothic Light",
23283
- "YuGothic Medium",
23284
- "Zapfino"
23285
- ].map((value) => ({
23286
- value,
23287
- label: value
23288
- }));
23289
- let FontService = class FontService {
23290
- constructor(_configService) {
23291
- this._configService = _configService;
23292
- _defineProperty(this, "fonts$", new rxjs.BehaviorSubject([]));
23293
- const { customFontFamily } = this._configService.getConfig("ui.config") ?? {};
23294
- let fonts = [];
23295
- if (customFontFamily) {
23296
- if (Array.isArray(customFontFamily)) fonts = [...DEFAULT_FONT_LIST, ...customFontFamily];
23297
- else if (customFontFamily.override) fonts = [...customFontFamily.list];
23298
- else fonts = [...DEFAULT_FONT_LIST, ...customFontFamily.list];
23299
- } else fonts = [...DEFAULT_FONT_LIST];
23300
- this.fonts$.next(fonts);
23301
- }
23302
- dispose() {
23303
- this.resetToDefaults();
23304
- this.fonts$.complete();
23305
- }
23306
- getFonts() {
23307
- return this.fonts$.getValue();
23308
- }
23309
- getFontByValue(value) {
23310
- return this.getFonts().find((font) => font.value === value);
23311
- }
23312
- /**
23313
- * Check if the current browser environment supports the font
23314
- * @param fontValue
23315
- * @returns boolean Whether the font is supported
23316
- */
23317
- isFontSupported(fontValue) {
23318
- const context = document.createElement("canvas").getContext("2d");
23319
- if (!context) return false;
23320
- const text = "abcdefghijklmnopqrstuvwxyz0123456789";
23321
- const size = "72px";
23322
- const baseFonts = [
23323
- "monospace",
23324
- "serif",
23325
- "sans-serif"
23326
- ];
23327
- const defaultWidths = {};
23328
- baseFonts.forEach((base) => {
23329
- context.font = `${size} ${base}`;
23330
- defaultWidths[base] = context.measureText(text).width;
23331
- });
23332
- return baseFonts.some((base) => {
23333
- context.font = `${size} "${fontValue}", ${base}`;
23334
- return context.measureText(text).width !== defaultWidths[base];
23335
- });
23336
- }
23337
- addFont(font) {
23338
- if (this.getFontByValue(font.value)) throw new Error(`[FontService]: Font with value "${font.value}" already exists.`);
23339
- const updatedFonts = [...this.getFonts(), font].sort();
23340
- this.fonts$.next(updatedFonts);
23341
- }
23342
- updateFont(value, updates) {
23343
- const fonts = this.getFonts();
23344
- const fontIndex = fonts.findIndex((font) => font.value === value);
23345
- if (fontIndex === -1) throw new Error(`Font with value "${value}" not found.`);
23346
- const updatedFont = {
23347
- ...fonts[fontIndex],
23348
- ...updates
23349
- };
23350
- const updatedFonts = [...fonts];
23351
- updatedFonts[fontIndex] = updatedFont;
23352
- this.fonts$.next(updatedFonts);
23353
- }
23354
- removeFont(value) {
23355
- const fonts = this.getFonts();
23356
- if (fonts.findIndex((font) => font.value === value) === -1) return false;
23357
- const updatedFonts = fonts.filter((font) => font.value !== value);
23358
- this.fonts$.next(updatedFonts);
23359
- return true;
23360
- }
23361
- resetToDefaults() {
23362
- this.fonts$.next([...DEFAULT_FONT_LIST]);
23363
- }
23364
- };
23365
- FontService = __decorate([__decorateParam(0, _univerjs_core.IConfigService)], FontService);
23366
-
23367
- //#endregion
23368
- //#region src/views/font-family/use-font-list.ts
23369
- function useFontList() {
23370
- const fontService = (0, _wendellhu_redi_react_bindings.useDependency)(IFontService);
23371
- return {
23372
- fonts: (0, _wendellhu_redi_react_bindings.useObservable)(fontService.fonts$, fontService.getFonts()),
23373
- fontService
23374
- };
23375
- }
23376
-
23377
23683
  //#endregion
23378
23684
  //#region src/views/font-family/FontFamily.tsx
23379
23685
  const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
@@ -23449,33 +23755,6 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
23449
23755
  });
23450
23756
  };
23451
23757
 
23452
- //#endregion
23453
- //#region src/views/font-family/FontFamilyItem.tsx
23454
- const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
23455
- const FontFamilyItem = ({ value, onChange }) => {
23456
- const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
23457
- const direction = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection());
23458
- const { fonts, fontService } = useFontList();
23459
- function handleSelectFont(nextValue) {
23460
- onChange(nextValue);
23461
- }
23462
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
23463
- dir: direction,
23464
- className: "univer-m-0 univer-list-none univer-p-0 univer-text-sm",
23465
- style: { fontFamily: value },
23466
- children: fonts.map((font) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
23467
- className: "univer-flex univer-h-7 univer-w-full univer-appearance-none univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-border-none univer-bg-transparent univer-px-2 univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700",
23468
- style: { fontFamily: font.value },
23469
- type: "button",
23470
- onClick: () => handleSelectFont(font.value),
23471
- children: [localeService.t(font.label), !fontService.isFontSupported(font.value) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
23472
- title: localeService.t("ui.fontFamily.not-supported"),
23473
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.InfoIcon, { className: "univer-text-gray-300 dark:!univer-text-gray-400" })
23474
- })]
23475
- }) }, font.value))
23476
- });
23477
- };
23478
-
23479
23758
  //#endregion
23480
23759
  //#region src/views/font-size/FontSize.tsx
23481
23760
  const FontSize = (props) => {
@@ -24123,7 +24402,7 @@ function MobileRibbonToolbar(props) {
24123
24402
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
24124
24403
  className: (0, _univerjs_design.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", { [_univerjs_design.borderRightClassName]: groupIndex !== activeGroups.length - 1 }),
24125
24404
  children: groupItems.map((child) => child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
24126
- className: (0, _univerjs_design.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"),
24405
+ className: (0, _univerjs_design.clsx)("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 [&_button]:![font-family:inherit] [&_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"),
24127
24406
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileToolbarItem, {
24128
24407
  ...child.item,
24129
24408
  preserveStrokeWidth: true
@@ -27789,34 +28068,48 @@ function Slider(props) {
27789
28068
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
27790
28069
  className: "univer-hidden univer-h-6 univer-items-center sm:!univer-flex",
27791
28070
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
27792
- className: (0, _univerjs_design.clsx)("univer-relative univer-h-1.5 univer-rounded-full univer-bg-gray-200 univer-px-1.5 univer-transition-colors dark:!univer-bg-gray-600", { "univer-opacity-60": disabled }),
28071
+ className: (0, _univerjs_design.clsx)("univer-relative univer-h-1.5 univer-px-1.5", { "univer-opacity-60": disabled }),
27793
28072
  style: { width: `${SLIDER_WIDTH}px` },
27794
28073
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
27795
28074
  ref: sliderInnerRailRef,
27796
28075
  role: "track",
27797
- className: "univer-relative univer-h-1.5 univer-bg-gray-200 dark:!univer-bg-gray-600",
28076
+ className: "univer-relative univer-h-1.5 univer-rounded-full univer-bg-gray-200 univer-transition-colors dark:!univer-bg-gray-600",
27798
28077
  onPointerDown: handlePointerDown,
27799
28078
  children: [
27800
28079
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
27801
- className: (0, _univerjs_design.clsx)("univer-bg-primary-500/60 univer-absolute univer-top-0 univer-h-full univer-rounded-full", isRtl ? "univer-right-0" : "univer-left-0"),
28080
+ className: (0, _univerjs_design.clsx)("univer-absolute univer-top-0 univer-h-full univer-rounded-full univer-bg-primary-500", isRtl ? "univer-right-0" : "univer-left-0"),
27802
28081
  style: { width: `${sliderOffset}%` }
27803
28082
  }),
27804
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
27805
- className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-box-border univer-block univer-size-1.5 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-cursor-pointer univer-rounded-full univer-border univer-border-gray-0 univer-bg-gray-400 dark:!univer-border-gray-700 dark:!univer-bg-gray-300",
27806
- role: "button",
27807
- tabIndex: disabled ? -1 : 0,
27808
- "aria-label": localeService.t("ui.accessibility.resetZoom"),
27809
- "aria-disabled": disabled,
27810
- onClick: handleReset,
27811
- onKeyDown: (e) => {
27812
- if (e.key !== "Enter" && e.key !== " ") return;
27813
- e.preventDefault();
27814
- e.stopPropagation();
27815
- handleReset();
27816
- }
27817
- }, "reset-button"),
28083
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
28084
+ className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-size-6 -univer-translate-x-1/2 -univer-translate-y-1/2",
28085
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
28086
+ title: `${localeService.t("ui.accessibility.resetZoom")} (${resetPoint}%)`,
28087
+ placement: "top",
28088
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
28089
+ className: "univer-size-6 univer-p-0 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-100",
28090
+ size: "small",
28091
+ variant: "link",
28092
+ type: "button",
28093
+ "data-u-comp": "zoom-reset",
28094
+ "aria-label": localeService.t("ui.accessibility.resetZoom"),
28095
+ disabled,
28096
+ onPointerDown: (e) => e.stopPropagation(),
28097
+ onClick: handleReset,
28098
+ onKeyDown: (e) => {
28099
+ if (e.key !== "Enter" && e.key !== " ") return;
28100
+ e.preventDefault();
28101
+ e.stopPropagation();
28102
+ handleReset();
28103
+ },
28104
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
28105
+ "aria-hidden": "true",
28106
+ className: "univer-box-border univer-h-3 univer-w-1 univer-rounded-full univer-border univer-border-solid univer-border-gray-0 univer-bg-gray-600 dark:!univer-border-gray-800 dark:!univer-bg-gray-100"
28107
+ })
28108
+ })
28109
+ })
28110
+ }),
27818
28111
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
27819
- className: (0, _univerjs_design.clsx)("univer-absolute univer-top-1/2 univer-size-3.5 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-rounded-full univer-bg-gray-0 univer-shadow-sm univer-transition-all focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-100 dark:!univer-bg-gray-800", _univerjs_design.borderClassName, {
28112
+ className: (0, _univerjs_design.clsx)("univer-absolute univer-top-1/2 univer-size-3.5 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-rounded-full univer-bg-gray-0 univer-shadow-sm univer-transition focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-100 dark:!univer-bg-gray-800", _univerjs_design.borderClassName, {
27820
28113
  "univer-cursor-pointer hover:univer-border-primary-600 hover:univer-shadow-md": !disabled,
27821
28114
  "univer-cursor-not-allowed": disabled,
27822
28115
  "univer-scale-105 univer-border-primary-600 univer-shadow-md": isDragging
@@ -29996,6 +30289,7 @@ exports.FONT_SIZE_LIST = FONT_SIZE_LIST;
29996
30289
  exports.FloatDom = FloatDom;
29997
30290
  exports.FloatDomSingle = FloatDomSingle;
29998
30291
  exports.FloatingObjectToolbarPosition = FloatingObjectToolbarPosition;
30292
+ exports.FontCategory = FontCategory;
29999
30293
  exports.FontFamily = FontFamily;
30000
30294
  exports.FontFamilyDropdown = FontFamilyDropdown;
30001
30295
  exports.FontFamilyItem = FontFamilyItem;