@univerjs/ui 1.0.0-rc.0 → 1.0.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 (111) hide show
  1. package/README.md +16 -0
  2. package/lib/cjs/facade.js +12 -6
  3. package/lib/cjs/index.js +1820 -635
  4. package/lib/cjs/locale/ar-SA.js +2 -1
  5. package/lib/cjs/locale/ca-ES.js +2 -1
  6. package/lib/cjs/locale/de-DE.js +2 -1
  7. package/lib/cjs/locale/en-US.js +2 -1
  8. package/lib/cjs/locale/es-ES.js +2 -1
  9. package/lib/cjs/locale/fa-IR.js +2 -1
  10. package/lib/cjs/locale/fr-FR.js +2 -1
  11. package/lib/cjs/locale/id-ID.js +2 -1
  12. package/lib/cjs/locale/it-IT.js +2 -1
  13. package/lib/cjs/locale/ja-JP.js +2 -1
  14. package/lib/cjs/locale/ko-KR.js +2 -1
  15. package/lib/cjs/locale/pl-PL.js +2 -1
  16. package/lib/cjs/locale/pt-BR.js +2 -1
  17. package/lib/cjs/locale/ru-RU.js +2 -1
  18. package/lib/cjs/locale/sk-SK.js +2 -1
  19. package/lib/cjs/locale/vi-VN.js +2 -1
  20. package/lib/cjs/locale/zh-CN.js +2 -1
  21. package/lib/cjs/locale/zh-HK.js +2 -1
  22. package/lib/cjs/locale/zh-TW.js +2 -1
  23. package/lib/es/facade.js +12 -6
  24. package/lib/es/index.js +1815 -638
  25. package/lib/es/locale/ar-SA.js +2 -0
  26. package/lib/es/locale/ca-ES.js +2 -0
  27. package/lib/es/locale/de-DE.js +2 -0
  28. package/lib/es/locale/en-US.js +2 -0
  29. package/lib/es/locale/es-ES.js +2 -0
  30. package/lib/es/locale/fa-IR.js +2 -0
  31. package/lib/es/locale/fr-FR.js +2 -0
  32. package/lib/es/locale/id-ID.js +2 -0
  33. package/lib/es/locale/it-IT.js +2 -0
  34. package/lib/es/locale/ja-JP.js +2 -0
  35. package/lib/es/locale/ko-KR.js +2 -0
  36. package/lib/es/locale/pl-PL.js +2 -0
  37. package/lib/es/locale/pt-BR.js +2 -0
  38. package/lib/es/locale/ru-RU.js +2 -0
  39. package/lib/es/locale/sk-SK.js +2 -0
  40. package/lib/es/locale/vi-VN.js +2 -0
  41. package/lib/es/locale/zh-CN.js +2 -0
  42. package/lib/es/locale/zh-HK.js +2 -0
  43. package/lib/es/locale/zh-TW.js +2 -0
  44. package/lib/facade.js +12 -6
  45. package/lib/index.css +102 -34
  46. package/lib/index.js +1815 -638
  47. package/lib/locale/ar-SA.js +2 -0
  48. package/lib/locale/ca-ES.js +2 -0
  49. package/lib/locale/de-DE.js +2 -0
  50. package/lib/locale/en-US.js +2 -0
  51. package/lib/locale/es-ES.js +2 -0
  52. package/lib/locale/fa-IR.js +2 -0
  53. package/lib/locale/fr-FR.js +2 -0
  54. package/lib/locale/id-ID.js +2 -0
  55. package/lib/locale/it-IT.js +2 -0
  56. package/lib/locale/ja-JP.js +2 -0
  57. package/lib/locale/ko-KR.js +2 -0
  58. package/lib/locale/pl-PL.js +2 -0
  59. package/lib/locale/pt-BR.js +2 -0
  60. package/lib/locale/ru-RU.js +2 -0
  61. package/lib/locale/sk-SK.js +2 -0
  62. package/lib/locale/vi-VN.js +2 -0
  63. package/lib/locale/zh-CN.js +2 -0
  64. package/lib/locale/zh-HK.js +2 -0
  65. package/lib/locale/zh-TW.js +2 -0
  66. package/lib/types/controllers/format-painter.controller.d.ts +25 -0
  67. package/lib/types/facade/f-menu-builder.d.ts +14 -1
  68. package/lib/types/facade/f-univer.d.ts +30 -5
  69. package/lib/types/index.d.ts +10 -0
  70. package/lib/types/locale/en-US.d.ts +2 -0
  71. package/lib/types/menu/format-painter.menu.d.ts +19 -0
  72. package/lib/types/services/contextmenu/contextmenu.service.d.ts +1 -0
  73. package/lib/types/services/format-painter/format-painter-canvas.d.ts +28 -0
  74. package/lib/types/services/format-painter/format-painter-session.service.d.ts +61 -0
  75. package/lib/types/services/menu/menu-manager.service.d.ts +13 -1
  76. package/lib/types/services/menu/menu.d.ts +6 -0
  77. package/lib/types/utils/mobile-canvas-gesture.d.ts +50 -0
  78. package/lib/types/views/components/context-menu/MobileContextMenu.d.ts +6 -0
  79. package/lib/types/views/components/dialog-part/MobileDialogPart.d.ts +5 -0
  80. package/lib/types/views/components/mobile-drawer/MobileDrawer.d.ts +2 -0
  81. package/lib/types/views/components/mobile-zoom-indicator/mobile-zoom-indicator.d.ts +26 -0
  82. package/lib/types/views/components/ribbon/ToolbarButton.d.ts +1 -1
  83. package/lib/types/views/components/sidebar/MobileSidebar.d.ts +5 -0
  84. package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
  85. package/lib/types/views/font-family/MobileFontFamilyDropdown.d.ts +17 -0
  86. package/lib/types/views/menu/mobile/MobileMenu.d.ts +1 -1
  87. package/lib/types/views/mobile-workbench/MobileCanvasLayout.d.ts +42 -0
  88. package/lib/types/views/mobile-workbench/MobileWorkbench.d.ts +2 -0
  89. package/lib/types/views/notification/Notification.d.ts +6 -1
  90. package/lib/umd/facade.js +1 -1
  91. package/lib/umd/index.js +34 -16
  92. package/lib/umd/locale/ar-SA.js +1 -1
  93. package/lib/umd/locale/ca-ES.js +1 -1
  94. package/lib/umd/locale/de-DE.js +1 -1
  95. package/lib/umd/locale/en-US.js +1 -1
  96. package/lib/umd/locale/es-ES.js +1 -1
  97. package/lib/umd/locale/fa-IR.js +1 -1
  98. package/lib/umd/locale/fr-FR.js +1 -1
  99. package/lib/umd/locale/id-ID.js +1 -1
  100. package/lib/umd/locale/it-IT.js +1 -1
  101. package/lib/umd/locale/ja-JP.js +1 -1
  102. package/lib/umd/locale/ko-KR.js +1 -1
  103. package/lib/umd/locale/pl-PL.js +1 -1
  104. package/lib/umd/locale/pt-BR.js +1 -1
  105. package/lib/umd/locale/ru-RU.js +1 -1
  106. package/lib/umd/locale/sk-SK.js +1 -1
  107. package/lib/umd/locale/vi-VN.js +1 -1
  108. package/lib/umd/locale/zh-CN.js +1 -1
  109. package/lib/umd/locale/zh-HK.js +1 -1
  110. package/lib/umd/locale/zh-TW.js +1 -1
  111. package/package.json +12 -12
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/ar-SA.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "مسح التنسيق",
7361
+ formatPainter: "نسخ التنسيق",
7360
7362
  accessibility: {
7361
7363
  menu: "القائمة",
7362
7364
  zoom: "التكبير والتصغير",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/ca-ES.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Esborra el format",
7361
+ formatPainter: "Copia el format",
7360
7362
  accessibility: {
7361
7363
  menu: "Menú",
7362
7364
  zoom: "Zoom",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/de-DE.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Formatierung löschen",
7361
+ formatPainter: "Format übertragen",
7360
7362
  accessibility: {
7361
7363
  menu: "Menü",
7362
7364
  zoom: "Zoom",
@@ -7372,6 +7372,8 @@ const emojiLocale = {
7372
7372
  * limitations under the License.
7373
7373
  */
7374
7374
  const locale = { ui: {
7375
+ clearFormatting: "Clear formatting",
7376
+ formatPainter: "Format Painter",
7375
7377
  accessibility: {
7376
7378
  menu: "Menu",
7377
7379
  zoom: "Zoom",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/es-ES.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Borrar formato",
7361
+ formatPainter: "Copiar formato",
7360
7362
  accessibility: {
7361
7363
  menu: "Menú",
7362
7364
  zoom: "Zoom",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/fa-IR.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "پاک کردن قالب‌بندی",
7361
+ formatPainter: "کپی قالب‌بندی",
7360
7362
  accessibility: {
7361
7363
  menu: "منو",
7362
7364
  zoom: "بزرگ‌نمایی",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/fr-FR.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Effacer la mise en forme",
7361
+ formatPainter: "Reproduire la mise en forme",
7360
7362
  accessibility: {
7361
7363
  menu: "Menu",
7362
7364
  zoom: "Zoom",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/id-ID.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Hapus pemformatan",
7361
+ formatPainter: "Salin Format",
7360
7362
  accessibility: {
7361
7363
  menu: "Menu",
7362
7364
  zoom: "Zoom",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/it-IT.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Cancella formattazione",
7361
+ formatPainter: "Copia formato",
7360
7362
  accessibility: {
7361
7363
  menu: "Menu",
7362
7364
  zoom: "Zoom",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/ja-JP.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "書式をクリア",
7361
+ formatPainter: "書式のコピー",
7360
7362
  accessibility: {
7361
7363
  menu: "メニュー",
7362
7364
  zoom: "ズーム",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/ko-KR.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "서식 지우기",
7361
+ formatPainter: "서식 복사",
7360
7362
  accessibility: {
7361
7363
  menu: "메뉴",
7362
7364
  zoom: "확대/축소",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/pl-PL.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Wyczyść formatowanie",
7361
+ formatPainter: "Malarz formatów",
7360
7362
  accessibility: {
7361
7363
  menu: "Menu",
7362
7364
  zoom: "Powiększenie",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/pt-BR.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Limpar formatação",
7361
+ formatPainter: "Pincel de Formatação",
7360
7362
  accessibility: {
7361
7363
  menu: "Menu",
7362
7364
  zoom: "Zoom",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/ru-RU.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Очистить форматирование",
7361
+ formatPainter: "Формат по образцу",
7360
7362
  accessibility: {
7361
7363
  menu: "Меню",
7362
7364
  zoom: "Масштаб",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/sk-SK.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Vymazať formátovanie",
7361
+ formatPainter: "Kopírovať formát",
7360
7362
  accessibility: {
7361
7363
  menu: "Ponuka",
7362
7364
  zoom: "Priblíženie",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/vi-VN.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "Xóa định dạng",
7361
+ formatPainter: "Sao chép định dạng",
7360
7362
  accessibility: {
7361
7363
  menu: "Trình đơn",
7362
7364
  zoom: "Thu phóng",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/zh-CN.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "清除格式",
7361
+ formatPainter: "格式刷",
7360
7362
  accessibility: {
7361
7363
  menu: "菜单",
7362
7364
  zoom: "缩放",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/zh-HK.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "清除格式",
7361
+ formatPainter: "複製格式",
7360
7362
  accessibility: {
7361
7363
  menu: "選單",
7362
7364
  zoom: "縮放",
@@ -7357,6 +7357,8 @@ const emojiLocale = {
7357
7357
  //#endregion
7358
7358
  //#region src/locale/zh-TW.ts
7359
7359
  const locale = { ui: {
7360
+ clearFormatting: "清除格式",
7361
+ formatPainter: "複製格式",
7360
7362
  accessibility: {
7361
7363
  menu: "選單",
7362
7364
  zoom: "縮放",
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ICommand, IOperation } from '@univerjs/core';
17
+ import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
18
+ import { FormatPainterSessionService } from '../services/format-painter/format-painter-session.service';
19
+ import { IShortcutService } from '../services/shortcut/shortcut.service';
20
+ export declare const ActivateFormatPainterOperation: IOperation;
21
+ export declare const ContinuousFormatPainterOperation: IOperation;
22
+ export declare const ClearFormattingCommand: ICommand;
23
+ export declare class FormatPainterController extends Disposable {
24
+ constructor(session: FormatPainterSessionService, commandService: ICommandService, shortcutService: IShortcutService, instanceService: IUniverInstanceService);
25
+ }
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { MenuSchemaType } from '@univerjs/ui';
16
+ import type { IRibbonGridLayout, MenuSchemaType } from '@univerjs/ui';
17
17
  import { ICommandService, Injector } from '@univerjs/core';
18
18
  import { FBase } from '@univerjs/core/facade';
19
19
  import { IMenuManagerService, MenuManagerPosition, RibbonPosition, RibbonStartGroup } from '@univerjs/ui';
@@ -46,6 +46,8 @@ export interface IFacadeMenuItem {
46
46
  * The order of the menu item in the submenu.
47
47
  */
48
48
  order?: number;
49
+ /** Placement within a ribbon group when ribbonType is 'grid'. */
50
+ gridLayout?: IRibbonGridLayout;
49
51
  }
50
52
  /**
51
53
  * @ignore
@@ -71,6 +73,8 @@ export interface IFacadeSubmenuItem {
71
73
  * The order of the menu item in the submenu.
72
74
  */
73
75
  order?: number;
76
+ /** Placement within a ribbon group when ribbonType is 'grid'. */
77
+ gridLayout?: IRibbonGridLayout;
74
78
  }
75
79
  /**
76
80
  * @ignore
@@ -125,8 +129,17 @@ export declare class FMenu extends FMenuBase {
125
129
  protected readonly _injector: Injector;
126
130
  protected readonly _commandService: ICommandService;
127
131
  protected readonly _menuManagerService: IMenuManagerService;
132
+ /**
133
+ * Built-in group identifiers for placing items on the Start ribbon tab.
134
+ */
128
135
  static RibbonStartGroup: typeof RibbonStartGroup;
136
+ /**
137
+ * Built-in ribbon tab identifiers for menu placement.
138
+ */
129
139
  static RibbonPosition: typeof RibbonPosition;
140
+ /**
141
+ * Top-level menu placement identifiers for the ribbon and context menu.
142
+ */
130
143
  static MenuManagerPosition: typeof MenuManagerPosition;
131
144
  private _commandToRegister;
132
145
  private _buildingSchema;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { IDisposable } from '@univerjs/core';
17
17
  import type { IMessageProps } from '@univerjs/design';
18
- import type { BuiltInUIPart, ComponentType, IComponentOptions, IDialogPartMethodOptions, IFontConfig, ISidebarMethodOptions, RibbonType } from '@univerjs/ui';
18
+ import type { BuiltInUIPart, ComponentType, IComponentOptions, IDialogPartMethodOptions, IFontConfig, ISidebarMethodOptions, MenuConfig, RibbonType } from '@univerjs/ui';
19
19
  import type { IFacadeMenuItem, IFacadeSubmenuItem } from './f-menu-builder';
20
20
  import { FUniver } from '@univerjs/core/facade';
21
21
  import { ComponentManager } from '@univerjs/ui';
@@ -135,7 +135,7 @@ export interface IFUniverUIMixin {
135
135
  * @param {IFacadeMenuItem} menuItem the menu item
136
136
  * @returns the {@link FMenu} object
137
137
  * @example
138
- * ```ts
138
+ * ```tsx
139
139
  * // Univer Icon can be viewed at https://docs.univer.ai/icons
140
140
  * import { SmileIcon } from '@univerjs/icons'
141
141
  *
@@ -214,6 +214,29 @@ export interface IFUniverUIMixin {
214
214
  * ```
215
215
  */
216
216
  createSubmenu(submenuItem: IFacadeSubmenuItem): FSubmenu;
217
+ /**
218
+ * Merge menu overrides and refresh the UI immediately. Overrides also apply to menus registered later.
219
+ * Use the same configuration as the UI plugin or preset's `menu` option.
220
+ * @param {MenuConfig} config Overrides keyed by menu item ID, ribbon tab key, or ribbon group key.
221
+ * Unspecified properties keep their current values. Lower `order` values come first among siblings.
222
+ * `gridLayout` applies only to the grid ribbon and uses 1-based positions within a two-row group.
223
+ * @returns the {@link FUniver} instance for chaining
224
+ * @example
225
+ * ```ts
226
+ * univerAPI.updateMenuConfig({
227
+ * 'ribbon.insert': { order: -1 },
228
+ * 'ribbon.start.format': { order: -1 },
229
+ * 'sheet.command.set-range-bold': {
230
+ * order: 0,
231
+ * gridLayout: { row: 2, column: 2, showLabel: true, width: 80 },
232
+ * },
233
+ * 'sheet.command.set-range-italic': {
234
+ * gridLayout: { row: 2, column: 1 },
235
+ * },
236
+ * });
237
+ * ```
238
+ */
239
+ updateMenuConfig(config: MenuConfig): FUniver;
217
240
  /**
218
241
  * Open a sidebar.
219
242
  * @param {ISidebarMethodOptions} params the sidebar options
@@ -244,7 +267,7 @@ export interface IFUniverUIMixin {
244
267
  * @param {IDialogPartMethodOptions} dialog the dialog options
245
268
  * @returns {IDisposable} the disposable object
246
269
  * @example
247
- * ```ts
270
+ * ```tsx
248
271
  * import { Button } from '@univerjs/design';
249
272
  *
250
273
  * univerAPI.openDialog({
@@ -284,6 +307,7 @@ export interface IFUniverUIMixin {
284
307
  /**
285
308
  * Show a message.
286
309
  * @returns {FUniver} the {@link FUniver} instance for chaining
310
+ * @param {IMessageProps} options Message content, type, duration, and other display options.
287
311
  * @example
288
312
  * ```ts
289
313
  * univerAPI.showMessage({
@@ -309,7 +333,7 @@ export interface IFUniverUIMixin {
309
333
  * @param {BuiltInUIPart} key the built-in UI part
310
334
  * @param {boolean} visible the visibility
311
335
  * @returns the {@link FUniver} instance for chaining
312
- * example
336
+ * @example
313
337
  * ```ts
314
338
  * // Hide header, footer, and toolbar
315
339
  * univerAPI.setUIVisible(univerAPI.Enum.BuiltInUIPart.HEADER, false)
@@ -354,7 +378,7 @@ export interface IFUniverUIMixin {
354
378
  * @param {IComponentOptions} [options] - The options of the component.
355
379
  * @returns {IDisposable} The disposable object.
356
380
  * @example
357
- * ```ts
381
+ * ```tsx
358
382
  * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
359
383
  * if (!fWorksheet) return;
360
384
  *
@@ -438,6 +462,7 @@ export declare class FUniverUIMixin extends FUniver implements IFUniverUIMixin {
438
462
  paste(): Promise<boolean>;
439
463
  createMenu(menuItem: IFacadeMenuItem): FMenu;
440
464
  createSubmenu(submenuItem: IFacadeSubmenuItem): FSubmenu;
465
+ updateMenuConfig(config: MenuConfig): FUniver;
441
466
  openSidebar(params: ISidebarMethodOptions): IDisposable;
442
467
  openDialog(dialog: IDialogPartMethodOptions): IDisposable;
443
468
  getComponentManager(): ComponentManager;
@@ -48,6 +48,9 @@ export { CanvasFloatDomPreviewService, CanvasFloatDomService } from './services/
48
48
  export type { ICanvasFloatDomPreview, ICanvasFloatDomPreviewRequest, IFloatDom, IFloatDomLayout, } from './services/dom/canvas-dom-layer.service';
49
49
  export { FontService, IFontService } from './services/font.service';
50
50
  export type { IFontConfig } from './services/font.service';
51
+ export { bindFormatPainterCanvas } from './services/format-painter/format-painter-canvas';
52
+ export { FormatPainterSessionService } from './services/format-painter/format-painter-session.service';
53
+ export type { IFormatPainterTarget } from './services/format-painter/format-painter-session.service';
51
54
  export { DesktopGalleryService } from './services/gallery/desktop-gallery.service';
52
55
  export { IGalleryService } from './services/gallery/gallery.service';
53
56
  export { DesktopLayoutService, ILayoutService } from './services/layout/layout.service';
@@ -87,6 +90,7 @@ export { ThemeSwitcherService } from './services/theme-switcher/theme-switcher.s
87
90
  export { UndoRedoGroupService } from './services/undo-redo/undo-redo-group.service';
88
91
  export { IWorkbenchService, WorkbenchService } from './services/workbench/workbench.service';
89
92
  export * from './utils';
93
+ export { MobileCanvasGesture } from './utils/mobile-canvas-gesture';
90
94
  export { COLOR_PICKER_COMPONENT } from './views/color-picker/interface';
91
95
  export { ComponentContainer, useComponentsOfPart } from './views/components/ComponentContainer';
92
96
  export type { IComponentContainerProps } from './views/components/ComponentContainer';
@@ -98,12 +102,14 @@ export { DesktopContextMenu as ContextMenu } from './views/components/context-me
98
102
  export { ContextMenuPanel } from './views/components/context-menu/ContextMenuPanel';
99
103
  export { MobileContextMenu } from './views/components/context-menu/MobileContextMenu';
100
104
  export { type IDialogPartMethodOptions } from './views/components/dialog-part/interface';
105
+ export type { IMobileDialogPartMethodOptions } from './views/components/dialog-part/MobileDialogPart';
101
106
  export { FloatDomSingle } from './views/components/dom/FloatDom';
102
107
  export { FloatDom } from './views/components/dom/FloatDom';
103
108
  export { PrintFloatDomSingle } from './views/components/dom/Print';
104
109
  export { HOVER_TRACK_HOST_CLASS_NAME, HoverTrack } from './views/components/hover-track/HoverTrack';
105
110
  export { MobileDrawer } from './views/components/mobile-drawer/MobileDrawer';
106
111
  export type { MobileDrawerSnap } from './views/components/mobile-drawer/MobileDrawer';
112
+ export { MobileZoomIndicator } from './views/components/mobile-zoom-indicator/mobile-zoom-indicator';
107
113
  export { CanvasPopup, SingleCanvasPopup } from './views/components/popup/CanvasPopup';
108
114
  export { RectPopup } from './views/components/popup/RectPopup';
109
115
  export type { RectPopupDirection } from './views/components/popup/RectPopup';
@@ -111,6 +117,7 @@ export { useToolbarItemStatus } from './views/components/ribbon/hook';
111
117
  export { Ribbon } from './views/components/ribbon/Ribbon';
112
118
  export { ToolbarButton } from './views/components/ribbon/ToolbarButton';
113
119
  export { ToolbarItem } from './views/components/ribbon/ToolbarItem';
120
+ export type { IMobileSidebarMethodOptions } from './views/components/sidebar/MobileSidebar';
114
121
  export { Sidebar } from './views/components/sidebar/Sidebar';
115
122
  export type { ISidebarMethodOptions } from './views/components/sidebar/Sidebar';
116
123
  export { FONT_FAMILY_COMPONENT, FontFamily } from './views/font-family/FontFamily';
@@ -119,6 +126,7 @@ export { FontFamilyDropdown } from './views/font-family/FontFamilyDropdown';
119
126
  export type { IFontFamilyDropdownProps } from './views/font-family/FontFamilyDropdown';
120
127
  export { FONT_FAMILY_ITEM_COMPONENT, FontFamilyItem } from './views/font-family/FontFamilyItem';
121
128
  export type { IFontFamilyItemProps } from './views/font-family/FontFamilyItem';
129
+ export { MobileFontFamilyDropdown } from './views/font-family/MobileFontFamilyDropdown';
122
130
  export { FontSize } from './views/font-size/FontSize';
123
131
  export { FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HEADING_LIST } from './views/font-size/interface';
124
132
  export * from './views/hooks/index';
@@ -126,6 +134,8 @@ export { preventBrowserZoomInContainers } from './views/hooks/prevent-browser-zo
126
134
  export * from './views/index';
127
135
  export { MobileMenu } from './views/menu/mobile/MobileMenu';
128
136
  export { MobileKeyboardInsetContext } from './views/mobile-workbench/mobile-keyboard-inset-context';
137
+ export { getMobileCanvasPanDelta, useMobileCanvasPanel, useMobileCanvasViewport } from './views/mobile-workbench/MobileCanvasLayout';
138
+ export type { MobilePanelLayout } from './views/mobile-workbench/MobileCanvasLayout';
129
139
  export type { INotificationOptions } from './views/notification/Notification';
130
140
  export { ObjectPermissionButton, openObjectPermissionDialog } from './views/object-permission/ObjectPermissionButton';
131
141
  export type { IObjectPermissionButtonProps } from './views/object-permission/ObjectPermissionButton';
@@ -15,6 +15,8 @@
15
15
  */
16
16
  declare const locale: {
17
17
  ui: {
18
+ clearFormatting: string;
19
+ formatPainter: string;
18
20
  accessibility: {
19
21
  menu: string;
20
22
  zoom: string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IAccessor } from '@univerjs/core';
17
+ import type { IMenuButtonItem } from '../services/menu/menu';
18
+ export declare function FormatPainterMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
19
+ export declare function ClearFormattingMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
@@ -18,6 +18,7 @@ import type { IMouseEvent } from '@univerjs/engine-render';
18
18
  import { Disposable } from '@univerjs/core';
19
19
  export interface IContextMenuTriggerContext {
20
20
  autoFocus?: boolean;
21
+ caretAnchor?: boolean;
21
22
  unitId?: string;
22
23
  subUnitId?: string;
23
24
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IDisposable } from '@univerjs/core';
17
+ import type { FormatPainterSessionService, IFormatPainterTarget } from './format-painter-session.service';
18
+ export declare const FORMAT_PAINTER_CURSOR_CSS = "\n/* Keep the brush visible while the render engine updates its usual object/text cursors. */\ncanvas[data-format-painter=\"available\"] {\n cursor: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M2 1v18l4-4 3 7 3-2-3-6h6z' fill='white' stroke='black'/%3E%3Cpath d='m17 13 8-10 2 2-8 10z' fill='white' stroke='black'/%3E%3Cpath d='M17 14c-4 0-2 5-6 6 5 2 10-1 8-5z' fill='black' stroke='white'/%3E%3C/svg%3E\") 2 1, crosshair !important;\n}\ncanvas[data-format-painter=\"unavailable\"] {\n cursor: not-allowed !important;\n}\n";
19
+ interface IFormatPainterCanvasOptions {
20
+ adapterId: string;
21
+ unitId: string;
22
+ getUnitId?(): string;
23
+ /** Object painting consumes the gesture before selection/transform handlers run. */
24
+ intercept: boolean;
25
+ getTarget(event: PointerEvent): IFormatPainterTarget | null;
26
+ }
27
+ export declare function bindFormatPainterCanvas(canvas: HTMLCanvasElement, session: FormatPainterSessionService, options: IFormatPainterCanvasOptions): IDisposable;
28
+ export {};
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IDisposable, IRange } from '@univerjs/core';
17
+ import type { Observable } from 'rxjs';
18
+ import { Disposable } from '@univerjs/core';
19
+ export type FormatPainterMode = 'off' | 'once' | 'continuous';
20
+ export interface IFormatPainterTarget {
21
+ unitId: string;
22
+ subUnitId?: string;
23
+ shapeId?: string;
24
+ range?: IRange;
25
+ }
26
+ export interface IFormatPainterSource {
27
+ unitId: string;
28
+ apply(target: IFormatPainterTarget): boolean | Promise<boolean>;
29
+ onModeChange?(mode: FormatPainterMode): void;
30
+ }
31
+ export interface IFormatPainterAdapter {
32
+ id: string;
33
+ priority: number;
34
+ changes$: Observable<unknown>;
35
+ /** Claim the editing context even when its selection cannot be sampled. */
36
+ isActive(): boolean;
37
+ canStart(): boolean;
38
+ capture(): IFormatPainterSource | null;
39
+ clear?(): boolean | Promise<boolean>;
40
+ }
41
+ /** One local interaction session; domain commands retain ownership of persisted formatting. */
42
+ export declare class FormatPainterSessionService extends Disposable {
43
+ private readonly _adapters;
44
+ private readonly _state$;
45
+ readonly state$: Observable<FormatPainterMode>;
46
+ private _session;
47
+ private _applying;
48
+ get mode(): FormatPainterMode;
49
+ get unitId(): string | undefined;
50
+ register(adapter: IFormatPainterAdapter): IDisposable;
51
+ refresh(): void;
52
+ canStart(): boolean;
53
+ isActive(adapterId: string): boolean;
54
+ canClear(): boolean;
55
+ clearFormatting(): Promise<boolean>;
56
+ activate(continuous?: boolean): boolean;
57
+ apply(adapterId: string, target: IFormatPainterTarget): Promise<boolean>;
58
+ cancel(): void;
59
+ private _setMode;
60
+ dispose(): void;
61
+ }
@@ -15,19 +15,27 @@
15
15
  */
16
16
  import type { IAccessor } from '@univerjs/core';
17
17
  import type { Observable } from 'rxjs';
18
- import type { IMenuItem } from './menu';
18
+ import type { IMenuItem, MenuConfig } from './menu';
19
19
  import { Disposable, IConfigService, Injector } from '@univerjs/core';
20
20
  import { Subject } from 'rxjs';
21
21
  export declare const IMenuManagerService: import("@wendellhu/redi").IdentifierDecorator<IMenuManagerService>;
22
22
  export type ContextMenuQuickLayout = 'icon' | 'tile';
23
23
  export type ContextMenuQuickLayoutVariant = 'default' | 'compact';
24
+ export type MobileMenuLayout = 'grid' | 'list';
24
25
  export interface IRibbonGridLayout {
26
+ /** 1-based row within the ribbon group's two rows. */
25
27
  row: number;
28
+ /** 1-based column within the ribbon group. */
26
29
  column: number;
30
+ /** Number of rows occupied. Defaults to 1; use 2 for a large button. */
27
31
  rowSpan?: number;
32
+ /** Number of columns occupied. Defaults to 1. */
28
33
  columnSpan?: number;
34
+ /** Whether to display the menu title alongside its icon. */
29
35
  showLabel?: boolean;
36
+ /** Width in pixels. */
30
37
  width?: number;
38
+ /** Icon size in pixels. */
31
39
  iconSize?: number;
32
40
  }
33
41
  export interface IMenuSchema {
@@ -41,6 +49,7 @@ export interface IMenuSchema {
41
49
  quickLayout?: ContextMenuQuickLayout;
42
50
  quickColumns?: number;
43
51
  quickLayoutVariant?: ContextMenuQuickLayoutVariant;
52
+ mobileLayout?: MobileMenuLayout;
44
53
  tiny?: boolean;
45
54
  gridLayout?: IRibbonGridLayout;
46
55
  }
@@ -48,6 +57,7 @@ export interface IMenuManagerService {
48
57
  readonly menuChanged$: Observable<void>;
49
58
  mergeMenu(source: MenuSchemaType, target?: MenuSchemaType): void;
50
59
  appendRootMenu(source: MenuSchemaType): void;
60
+ updateMenuConfig(config: MenuConfig): void;
51
61
  getMenuByPositionKey(position: string): IMenuSchema[];
52
62
  getFlatMenuByPositionKey(position: string): IMenuSchema[];
53
63
  }
@@ -61,6 +71,7 @@ export type MenuSchemaType = {
61
71
  quickLayout?: ContextMenuQuickLayout;
62
72
  quickColumns?: number;
63
73
  quickLayoutVariant?: ContextMenuQuickLayoutVariant;
74
+ mobileLayout?: MobileMenuLayout;
64
75
  tiny?: boolean;
65
76
  gridLayout?: IRibbonGridLayout;
66
77
  } | {
@@ -80,6 +91,7 @@ export declare class MenuManagerService extends Disposable implements IMenuManag
80
91
  */
81
92
  mergeMenu(source: MenuSchemaType, target?: MenuSchemaType): void;
82
93
  appendRootMenu(source: MenuSchemaType): void;
94
+ updateMenuConfig(config: MenuConfig): void;
83
95
  createScoped(injector: Injector): IMenuManagerService;
84
96
  private _buildMenuSchema;
85
97
  /**
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { IAccessor } from '@univerjs/core';
17
17
  import type { Observable } from 'rxjs';
18
+ import type { IRibbonGridLayout } from './menu-manager.service';
18
19
  export type OneOrMany<T> = T | T[];
19
20
  export declare enum MenuItemType {
20
21
  /** Button style menu item. */
@@ -103,7 +104,12 @@ export type MenuItemConfig<TLocaleKey extends string = string> = Partial<Omit<IM
103
104
  hidden?: boolean;
104
105
  disabled?: boolean;
105
106
  activated?: boolean;
107
+ /** Display order among sibling menu items, ribbon tabs, or groups. Lower values come first. */
108
+ order?: number;
109
+ /** Placement within a ribbon group when ribbonType is 'grid'. Rows and columns start at 1. */
110
+ gridLayout?: IRibbonGridLayout;
106
111
  }>;
112
+ /** Overrides keyed by menu item ID, ribbon tab key, or ribbon group key. */
107
113
  export type MenuConfig<TLocaleKey extends string = string> = Record<string, MenuItemConfig<TLocaleKey>>;
108
114
  export type IMenuItemFactory<TLocaleKey extends string = string> = (accessor: IAccessor, menuConfig?: MenuConfig<TLocaleKey>) => IMenuItem<TLocaleKey>;
109
115
  export {};