@univerjs/docs-ui 0.25.1 → 1.0.0-alpha.1

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 (159) hide show
  1. package/lib/cjs/facade.js +23 -183
  2. package/lib/cjs/index.js +9004 -6506
  3. package/lib/cjs/locale/ar-SA.js +35 -1
  4. package/lib/cjs/locale/ca-ES.js +35 -1
  5. package/lib/cjs/locale/de-DE.js +35 -1
  6. package/lib/cjs/locale/en-US.js +35 -1
  7. package/lib/cjs/locale/es-ES.js +35 -1
  8. package/lib/cjs/locale/fa-IR.js +35 -1
  9. package/lib/cjs/locale/fr-FR.js +35 -1
  10. package/lib/cjs/locale/id-ID.js +35 -1
  11. package/lib/cjs/locale/it-IT.js +35 -1
  12. package/lib/cjs/locale/ja-JP.js +35 -1
  13. package/lib/cjs/locale/ko-KR.js +35 -1
  14. package/lib/cjs/locale/pl-PL.js +35 -1
  15. package/lib/cjs/locale/pt-BR.js +35 -1
  16. package/lib/cjs/locale/ru-RU.js +35 -1
  17. package/lib/cjs/locale/sk-SK.js +35 -1
  18. package/lib/cjs/locale/vi-VN.js +35 -1
  19. package/lib/cjs/locale/zh-CN.js +35 -1
  20. package/lib/cjs/locale/zh-HK.js +35 -1
  21. package/lib/cjs/locale/zh-TW.js +35 -1
  22. package/lib/es/facade.js +25 -178
  23. package/lib/es/index.js +8919 -6452
  24. package/lib/es/locale/ar-SA.js +35 -1
  25. package/lib/es/locale/ca-ES.js +35 -1
  26. package/lib/es/locale/de-DE.js +35 -1
  27. package/lib/es/locale/en-US.js +35 -1
  28. package/lib/es/locale/es-ES.js +35 -1
  29. package/lib/es/locale/fa-IR.js +35 -1
  30. package/lib/es/locale/fr-FR.js +35 -1
  31. package/lib/es/locale/id-ID.js +35 -1
  32. package/lib/es/locale/it-IT.js +35 -1
  33. package/lib/es/locale/ja-JP.js +35 -1
  34. package/lib/es/locale/ko-KR.js +35 -1
  35. package/lib/es/locale/pl-PL.js +35 -1
  36. package/lib/es/locale/pt-BR.js +35 -1
  37. package/lib/es/locale/ru-RU.js +35 -1
  38. package/lib/es/locale/sk-SK.js +35 -1
  39. package/lib/es/locale/vi-VN.js +35 -1
  40. package/lib/es/locale/zh-CN.js +35 -1
  41. package/lib/es/locale/zh-HK.js +35 -1
  42. package/lib/es/locale/zh-TW.js +35 -1
  43. package/lib/facade.js +25 -178
  44. package/lib/index.css +25 -35
  45. package/lib/index.js +8919 -6452
  46. package/lib/locale/ar-SA.js +35 -1
  47. package/lib/locale/ca-ES.js +35 -1
  48. package/lib/locale/de-DE.js +35 -1
  49. package/lib/locale/en-US.js +35 -1
  50. package/lib/locale/es-ES.js +35 -1
  51. package/lib/locale/fa-IR.js +35 -1
  52. package/lib/locale/fr-FR.js +35 -1
  53. package/lib/locale/id-ID.js +35 -1
  54. package/lib/locale/it-IT.js +35 -1
  55. package/lib/locale/ja-JP.js +35 -1
  56. package/lib/locale/ko-KR.js +35 -1
  57. package/lib/locale/pl-PL.js +35 -1
  58. package/lib/locale/pt-BR.js +35 -1
  59. package/lib/locale/ru-RU.js +35 -1
  60. package/lib/locale/sk-SK.js +35 -1
  61. package/lib/locale/vi-VN.js +35 -1
  62. package/lib/locale/zh-CN.js +35 -1
  63. package/lib/locale/zh-HK.js +35 -1
  64. package/lib/locale/zh-TW.js +35 -1
  65. package/lib/types/commands/commands/doc-delete.command.d.ts +1 -1
  66. package/lib/types/commands/commands/inline-format.command.d.ts +3 -1
  67. package/lib/types/commands/commands/table/doc-table-create.command.d.ts +31 -1
  68. package/lib/types/commands/operations/doc-cursor.operation.d.ts +2 -0
  69. package/lib/types/commands/util.d.ts +1 -2
  70. package/lib/types/config/config.d.ts +15 -0
  71. package/lib/types/controllers/components.controller.d.ts +25 -0
  72. package/lib/types/controllers/doc-header-footer.controller.d.ts +1 -4
  73. package/lib/types/controllers/doc-move-cursor.controller.d.ts +36 -1
  74. package/lib/types/controllers/doc-paragraph-setting.controller.d.ts +2 -4
  75. package/lib/types/controllers/doc-table.controller.d.ts +1 -4
  76. package/lib/types/controllers/render-controllers/doc-paragraph-placeholder.render-controller.d.ts +51 -0
  77. package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +5 -2
  78. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +3 -1
  79. package/lib/types/controllers/{doc-ui.controller.d.ts → ui.controller.d.ts} +2 -4
  80. package/lib/types/facade/f-document.d.ts +11 -43
  81. package/lib/types/facade/index.d.ts +2 -3
  82. package/lib/types/index.d.ts +41 -26
  83. package/lib/types/locale/en-US.d.ts +34 -0
  84. package/lib/types/{views/side-menu/index.d.ts → locale/types.d.ts} +3 -1
  85. package/lib/types/menu/context-menu.d.ts +15 -14
  86. package/lib/types/menu/menu.d.ts +31 -29
  87. package/lib/types/menu/paragraph-menu.d.ts +68 -38
  88. package/lib/types/services/clipboard/clipboard.service.d.ts +3 -2
  89. package/lib/types/services/clipboard/html-to-udm/converter.d.ts +1 -0
  90. package/lib/types/services/clipboard/udm-to-html/convertor.d.ts +3 -0
  91. package/lib/types/services/clipboard/udm-to-html/doc-html-export.service.d.ts +23 -0
  92. package/lib/types/services/doc-event-manager.service.d.ts +15 -0
  93. package/lib/types/services/doc-ime-state-change-interceptor.service.d.ts +23 -0
  94. package/lib/types/services/doc-page-layout.service.d.ts +3 -1
  95. package/lib/types/services/doc-paragraph-menu.service.d.ts +28 -5
  96. package/lib/types/services/doc-render-background.d.ts +29 -0
  97. package/lib/types/services/doc-view-scale.d.ts +54 -0
  98. package/lib/types/services/doc-zoom.d.ts +20 -0
  99. package/lib/types/services/docs-render.service.d.ts +5 -2
  100. package/lib/types/services/editor/editor-manager.service.d.ts +8 -1
  101. package/lib/types/services/index.d.ts +2 -0
  102. package/lib/types/services/selection/selection-utils.d.ts +0 -15
  103. package/lib/types/services/{doc-content-insert.service.d.ts → selection/word-boundary.d.ts} +4 -10
  104. package/lib/types/shortcuts/core-editing.shortcut.d.ts +1 -0
  105. package/lib/types/shortcuts/cursor.shortcut.d.ts +16 -0
  106. package/lib/types/shortcuts/heading.shortcut.d.ts +22 -0
  107. package/lib/types/{types/delete-direction.d.ts → views/DocSideMenu.d.ts} +1 -4
  108. package/lib/types/views/Icon.d.ts +49 -0
  109. package/lib/types/views/{page-settings/index.d.ts → PageSettings.d.ts} +1 -1
  110. package/lib/types/views/ParagraphMenu.d.ts +74 -0
  111. package/lib/types/views/{rich-text-editor/index.d.ts → RichTextEditor.d.ts} +3 -3
  112. package/lib/types/{components/side-menu/index.d.ts → views/SideMenu.d.ts} +4 -3
  113. package/lib/types/views/count-bar/CountBar.d.ts +1 -1
  114. package/lib/types/views/count-bar/ZoomSlider.d.ts +1 -1
  115. package/lib/types/views/doc-footer/DocFooter.d.ts +1 -1
  116. package/lib/types/views/float-toolbar/FloatToolbar.d.ts +25 -0
  117. package/lib/types/{components → views}/float-toolbar/FloatToolbar.stories.d.ts +1 -1
  118. package/lib/types/views/header-footer/panel/DocHeaderFooterOptions.d.ts +1 -1
  119. package/lib/types/views/header-footer/panel/DocHeaderFooterPanel.d.ts +1 -1
  120. package/lib/types/{components → views}/list-type-picker/Picker.d.ts +3 -3
  121. package/lib/types/{components/float-toolbar/FloatToolbar.d.ts → views/paragraph-menu/component-keys.d.ts} +2 -5
  122. package/lib/types/views/paragraph-menu/theme-color.d.ts +17 -0
  123. package/lib/types/views/paragraph-setting/Setting.d.ts +1 -1
  124. package/lib/types/views/paragraph-setting/index.d.ts +1 -1
  125. package/lib/types/views/paragraph-setting/line-spacing.d.ts +51 -0
  126. package/lib/types/views/rich-text-editor/hooks/editor-undo-redo-keyboard.d.ts +32 -0
  127. package/lib/types/views/rich-text-editor/hooks/index.d.ts +1 -0
  128. package/lib/types/views/rich-text-editor/hooks/use-editor-click-outside.d.ts +2 -1
  129. package/lib/types/{components → views}/side-menu/SideMenu.stories.d.ts +5 -5
  130. package/lib/types/views/table/create/TableCreate.d.ts +1 -1
  131. package/lib/umd/facade.js +1 -5
  132. package/lib/umd/index.js +11 -26
  133. package/lib/umd/locale/ar-SA.js +1 -1
  134. package/lib/umd/locale/ca-ES.js +1 -1
  135. package/lib/umd/locale/de-DE.js +1 -1
  136. package/lib/umd/locale/en-US.js +1 -1
  137. package/lib/umd/locale/es-ES.js +1 -1
  138. package/lib/umd/locale/fa-IR.js +1 -1
  139. package/lib/umd/locale/fr-FR.js +1 -1
  140. package/lib/umd/locale/id-ID.js +1 -1
  141. package/lib/umd/locale/it-IT.js +1 -1
  142. package/lib/umd/locale/ja-JP.js +1 -1
  143. package/lib/umd/locale/ko-KR.js +1 -1
  144. package/lib/umd/locale/pl-PL.js +1 -1
  145. package/lib/umd/locale/pt-BR.js +1 -1
  146. package/lib/umd/locale/ru-RU.js +1 -1
  147. package/lib/umd/locale/sk-SK.js +1 -1
  148. package/lib/umd/locale/vi-VN.js +1 -1
  149. package/lib/umd/locale/zh-CN.js +1 -1
  150. package/lib/umd/locale/zh-HK.js +1 -1
  151. package/lib/umd/locale/zh-TW.js +1 -1
  152. package/package.json +12 -12
  153. package/lib/types/commands/commands/core-editing.command.d.ts +0 -58
  154. package/lib/types/components/paragraph-menu/index.d.ts +0 -41
  155. package/lib/types/facade/f-univer.d.ts +0 -52
  156. package/lib/types/services/doc-state-change-manager.service.d.ts +0 -50
  157. /package/lib/types/{components → views}/const.d.ts +0 -0
  158. /package/lib/types/{components → views}/editor/utils.d.ts +0 -0
  159. /package/lib/types/{components → views}/list-type-picker/index.d.ts +0 -0
@@ -0,0 +1,49 @@
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 { IconType, IIconProps } from '@univerjs/ui';
17
+ type ColorSwatchIconProps = IIconProps & {
18
+ color: string;
19
+ };
20
+ export declare function TitleTypeIcon({ className, style, onClick }: IIconProps): import("react").JSX.Element;
21
+ export declare function SubtitleTypeIcon({ className, style, onClick }: IIconProps): import("react").JSX.Element;
22
+ export declare function TextColorSwatchIcon({ className, style, onClick, color }: ColorSwatchIconProps): import("react").JSX.Element;
23
+ export declare function BackgroundColorSwatchIcon({ className, style, onClick, color }: ColorSwatchIconProps): import("react").JSX.Element;
24
+ export declare function HeaderTextColorIcon({ className, style, onClick, extend }: IIconProps): import("react").JSX.Element;
25
+ export declare function DefaultTextColorIcon({ className, style, onClick }: IIconProps): import("react").JSX.Element;
26
+ export declare const DocParagraphTextColorSwatchIcon0: IconType;
27
+ export declare const DocParagraphTextColorSwatchIcon1: IconType;
28
+ export declare const DocParagraphTextColorSwatchIcon2: IconType;
29
+ export declare const DocParagraphTextColorSwatchIcon3: IconType;
30
+ export declare const DocParagraphTextColorSwatchIcon4: IconType;
31
+ export declare const DocParagraphTextColorSwatchIcon5: IconType;
32
+ export declare const DocParagraphTextColorSwatchIcon6: IconType;
33
+ export declare const DocParagraphBackgroundColorSwatchIcon0: IconType;
34
+ export declare const DocParagraphBackgroundColorSwatchIcon1: IconType;
35
+ export declare const DocParagraphBackgroundColorSwatchIcon2: IconType;
36
+ export declare const DocParagraphBackgroundColorSwatchIcon3: IconType;
37
+ export declare const DocParagraphBackgroundColorSwatchIcon4: IconType;
38
+ export declare const DocParagraphBackgroundColorSwatchIcon5: IconType;
39
+ export declare const DocParagraphBackgroundColorSwatchIcon6: IconType;
40
+ export declare const DocParagraphBackgroundColorSwatchIcon7: IconType;
41
+ export declare const DocParagraphBackgroundColorSwatchIcon8: IconType;
42
+ export declare const DocParagraphBackgroundColorSwatchIcon9: IconType;
43
+ export declare const DocParagraphBackgroundColorSwatchIcon10: IconType;
44
+ export declare const DocParagraphBackgroundColorSwatchIcon11: IconType;
45
+ export declare const DocParagraphBackgroundColorSwatchIcon12: IconType;
46
+ export declare const DocParagraphBackgroundColorSwatchIcon13: IconType;
47
+ export declare const DocParagraphBackgroundColorSwatchIcon14: IconType;
48
+ export declare const DocParagraphBackgroundColorSwatchIcon15: IconType;
49
+ export {};
@@ -35,5 +35,5 @@ export interface IPageSettings {
35
35
  height: number;
36
36
  };
37
37
  }
38
- export declare function PageSettings(props: IConfirmChildrenProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare function PageSettings(props: IConfirmChildrenProps): import("react").JSX.Element;
39
39
  export declare const PAGE_SETTING_COMPONENT_ID = "docs.component.page-setting";
@@ -0,0 +1,74 @@
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 { IDocumentBlockRange, IDocumentBody } from '@univerjs/core';
17
+ import type { IDocBlockMoveValidationContext } from '@univerjs/docs';
18
+ import type { ITextRangeWithStyle } from '@univerjs/engine-render';
19
+ import type { IPopup, IValueOption } from '@univerjs/ui';
20
+ import type { CSSProperties } from 'react';
21
+ import type { IMutiPageParagraphBound } from '../services/doc-event-manager.service';
22
+ import type { IDocBlockMenuTarget } from '../services/doc-paragraph-menu.service';
23
+ import { NamedStyleType } from '@univerjs/core';
24
+ import { DocBlockMoveValidatorService } from '@univerjs/docs';
25
+ import { ILayoutService } from '@univerjs/ui';
26
+ import { DocParagraphMenuService } from '../services/doc-paragraph-menu.service';
27
+ export { DOC_PARAGRAPH_MENU_COMPONENT_KEY, DOC_TABLE_BLOCK_MENU_COMPONENT_KEY } from './paragraph-menu/component-keys';
28
+ export declare function getParagraphMenuPopupDirection(anchorLeft: number, menuWidth?: number, viewportPadding?: number): 'left' | 'right';
29
+ export declare const PARAGRAPH_MENU_HOVER_OPEN_DELAY = 800;
30
+ export declare function shouldExecuteParagraphMenuMove(validatorService: Pick<DocBlockMoveValidatorService, 'canMoveBlock'>, context: IDocBlockMoveValidationContext): boolean;
31
+ export declare function createParagraphMenuHoverOpenScheduler(openMenu: () => void, delay?: number): {
32
+ schedule(): void;
33
+ cancel: () => void;
34
+ openNow(): void;
35
+ };
36
+ export declare function setParagraphMenuInteractionActive(docParagraphMenuService: Pick<DocParagraphMenuService, 'setParagraphMenuActive'> | null | undefined, active: boolean): void;
37
+ export declare function isEmptyParagraphMenuTarget(dataStream: string, paragraph?: IMutiPageParagraphBound | null | void): boolean;
38
+ export declare function getParagraphMenuTargetRange(paragraph?: IMutiPageParagraphBound | null | void): ITextRangeWithStyle | null;
39
+ export declare function getParagraphMenuHoverBridgeStyle(anchorRect: {
40
+ left: number;
41
+ right: number;
42
+ top: number;
43
+ bottom: number;
44
+ } | null | undefined, direction: 'left' | 'right', edgeOverlap?: number, verticalPadding?: number): CSSProperties | undefined;
45
+ export declare function getParagraphMenuActiveHeadingCommandId(namedStyleType?: NamedStyleType): string;
46
+ export declare function getParagraphMenuHiddenHeadingCommandIds(namedStyleType?: NamedStyleType): string[];
47
+ export declare function getParagraphMenuCommand(params: IValueOption, targetRange?: ITextRangeWithStyle | null): {
48
+ commandId?: string;
49
+ params?: object;
50
+ };
51
+ export declare function getParagraphMenuResolvedCommand(option: IValueOption, targetRange?: ITextRangeWithStyle | null): {
52
+ commandId?: string;
53
+ params?: object;
54
+ };
55
+ export declare function shouldShowParagraphSettingMenu(target: IDocBlockMenuTarget | null | undefined): boolean;
56
+ export declare function getParagraphMenuHiddenItemIds(menuType: string, target: IDocBlockMenuTarget | null | undefined, namedStyleType?: NamedStyleType): string[];
57
+ export declare function unwrapBlockRangeBody(documentBody: IDocumentBody, blockRange: IDocumentBlockRange): {
58
+ body: IDocumentBody;
59
+ range: {
60
+ startOffset: number;
61
+ endOffset: number;
62
+ collapsed: boolean;
63
+ };
64
+ };
65
+ export declare function getParagraphFormattingRange(target: IDocBlockMenuTarget | null | undefined, paragraph?: IMutiPageParagraphBound | null): ITextRangeWithStyle | null;
66
+ export declare function getParagraphMenuCommandTargetRange(commandId: string | undefined, targetRange?: ITextRangeWithStyle | null, formattingRange?: ITextRangeWithStyle | null): ITextRangeWithStyle | null | undefined;
67
+ export declare function finishParagraphMenuCommand(docParagraphMenuService: Pick<DocParagraphMenuService, 'hideParagraphMenu'> | null | undefined, layoutService: Pick<ILayoutService, 'focus'>, hideMenu: () => void): void;
68
+ export declare const ParagraphMenu: ({ popup }: {
69
+ popup: IPopup;
70
+ }) => import("react").JSX.Element;
71
+ export declare const TableBlockMenu: ({ popup }: {
72
+ popup: IPopup;
73
+ }) => import("react").JSX.Element;
74
+ export declare function shouldUseInsertBelowRange(commandId: string, params: IValueOption): boolean;
@@ -15,8 +15,8 @@
15
15
  */
16
16
  import type { IDocumentData } from '@univerjs/core';
17
17
  import type { CSSProperties, ReactNode, RefObject } from 'react';
18
- import type { Editor } from '../../services/editor/editor';
19
- import type { IKeyboardEventConfig } from './hooks';
18
+ import type { Editor } from '../services/editor/editor';
19
+ import type { IKeyboardEventConfig } from './rich-text-editor/hooks';
20
20
  export interface IRichTextEditorProps {
21
21
  className?: string;
22
22
  autoFocus?: boolean;
@@ -37,4 +37,4 @@ export interface IRichTextEditorProps {
37
37
  editorRef?: RefObject<Editor | null> | ((editor: Editor | null) => void);
38
38
  noStyle?: boolean;
39
39
  }
40
- export declare const RichTextEditor: (props: IRichTextEditorProps) => import("react/jsx-runtime").JSX.Element;
40
+ export declare const RichTextEditor: (props: IRichTextEditorProps) => import("react").JSX.Element;
@@ -13,6 +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 { CSSProperties } from 'react';
16
17
  export interface ISideMenuItem {
17
18
  text: string;
18
19
  level: number;
@@ -23,7 +24,7 @@ export interface ISideMenuProps {
23
24
  menus?: ISideMenuItem[];
24
25
  onClick?: (menu: ISideMenuItem) => void;
25
26
  className?: string;
26
- style?: React.CSSProperties;
27
+ style?: CSSProperties;
27
28
  mode?: 'float' | 'side-bar';
28
29
  maxHeight: number;
29
30
  activeId?: string;
@@ -31,9 +32,9 @@ export interface ISideMenuProps {
31
32
  onOpenChange?: (open: boolean) => void;
32
33
  maxWidth?: number;
33
34
  wrapperClass?: string;
34
- wrapperStyle?: React.CSSProperties;
35
+ wrapperStyle?: CSSProperties;
35
36
  iconClass?: string;
36
- iconStyle?: React.CSSProperties;
37
+ iconStyle?: CSSProperties;
37
38
  }
38
39
  export interface ISideMenuInstance {
39
40
  scrollTo: (id: string) => void;
@@ -17,5 +17,5 @@ interface ICountBarProps {
17
17
  changeRatio?: (ratio: string) => void;
18
18
  onChange?: (value: string) => void;
19
19
  }
20
- export declare function CountBar(_props: ICountBarProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function CountBar(_props: ICountBarProps): import("react").JSX.Element;
21
21
  export {};
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function ZoomSlider(): import("react/jsx-runtime").JSX.Element;
16
+ export declare function ZoomSlider(): import("react").JSX.Element;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function DocFooter(): import("react/jsx-runtime").JSX.Element | null;
16
+ export declare function DocFooter(): import("react").JSX.Element | null;
@@ -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 { IMenuManagerService as IMenuManagerServiceType, IMenuSchema } from '@univerjs/ui';
17
+ interface IFloatToolbarProps {
18
+ avaliableMenus?: string[];
19
+ }
20
+ export declare function resolveFloatToolbarMenus(menuManagerService: IMenuManagerServiceType, avaliableMenus: string[]): {
21
+ menus: IMenuSchema[];
22
+ extraMenus: IMenuSchema[];
23
+ };
24
+ export declare function FloatToolbar(props: IFloatToolbarProps): import("react").JSX.Element;
25
+ export {};
@@ -18,5 +18,5 @@ import { FloatToolbar } from './FloatToolbar';
18
18
  declare const meta: Meta<typeof FloatToolbar>;
19
19
  export default meta;
20
20
  export declare const Playground: {
21
- render(): import("react/jsx-runtime").JSX.Element;
21
+ render(): import("react").JSX.Element;
22
22
  };
@@ -16,4 +16,4 @@
16
16
  export interface IDocHeaderFooterOptionsProps {
17
17
  unitId: string;
18
18
  }
19
- export declare const DocHeaderFooterOptions: (props: IDocHeaderFooterOptionsProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const DocHeaderFooterOptions: (props: IDocHeaderFooterOptionsProps) => import("react").JSX.Element;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const DocHeaderFooterPanel: () => import("react/jsx-runtime").JSX.Element;
16
+ export declare const DocHeaderFooterPanel: () => import("react").JSX.Element;
@@ -24,7 +24,7 @@ interface IListTypePickerProps extends IListTypePickerBaseProps {
24
24
  img: string;
25
25
  }[];
26
26
  }
27
- export declare const ListTypePicker: (props: IListTypePickerProps) => import("react/jsx-runtime").JSX.Element;
28
- export declare const OrderListTypePicker: (props: IListTypePickerBaseProps) => import("react/jsx-runtime").JSX.Element;
29
- export declare const BulletListTypePicker: (props: IListTypePickerBaseProps) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const ListTypePicker: (props: IListTypePickerProps) => import("react").JSX.Element;
28
+ export declare const OrderListTypePicker: (props: IListTypePickerBaseProps) => import("react").JSX.Element;
29
+ export declare const BulletListTypePicker: (props: IListTypePickerBaseProps) => import("react").JSX.Element;
30
30
  export {};
@@ -13,8 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- interface IFloatToolbarProps {
17
- avaliableMenus?: string[];
18
- }
19
- export declare function FloatToolbar(props: IFloatToolbarProps): import("react/jsx-runtime").JSX.Element;
20
- export {};
16
+ export declare const DOC_PARAGRAPH_MENU_COMPONENT_KEY = "doc.paragraph.menu";
17
+ export declare const DOC_TABLE_BLOCK_MENU_COMPONENT_KEY = "doc.table-block.menu";
@@ -0,0 +1,17 @@
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 { ThemeService } from '@univerjs/core';
17
+ export declare function getHighlightBackgroundColor(themeService: ThemeService, index: number): string;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function ParagraphSetting(): import("react/jsx-runtime").JSX.Element;
16
+ export declare function ParagraphSetting(): import("react").JSX.Element;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function ParagraphSettingIndex(): import("react/jsx-runtime").JSX.Element;
16
+ export declare function ParagraphSettingIndex(): import("react").JSX.Element;
@@ -0,0 +1,51 @@
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 { LocaleService } from '@univerjs/core';
17
+ import { SpacingRule } from '@univerjs/core';
18
+ interface ILineSpacingMetrics {
19
+ glyphLineHeight: number;
20
+ renderedLineHeight: number;
21
+ }
22
+ interface ILineSpacingLike {
23
+ contentHeight?: number;
24
+ paddingTop?: number;
25
+ paddingBottom?: number;
26
+ divides?: Array<{
27
+ glyphGroup?: Array<{
28
+ bBox?: {
29
+ ba?: number;
30
+ bd?: number;
31
+ };
32
+ }>;
33
+ }>;
34
+ }
35
+ export declare function getLineSpacingRuleOptions(localeService: LocaleService): {
36
+ label: string;
37
+ value: string;
38
+ }[];
39
+ export declare function getLineSpacingInputConfig(spacingRule: SpacingRule): {
40
+ readonly min: 1;
41
+ readonly max: 5;
42
+ readonly step: 0.1;
43
+ } | {
44
+ readonly min: 1;
45
+ readonly max: 100;
46
+ };
47
+ export declare function convertStoredLineSpacingToDisplayValue(lineSpacing: number, spacingRule: SpacingRule): number;
48
+ export declare function convertDisplayLineSpacingToStoredValue(lineSpacing: number, spacingRule: SpacingRule): number;
49
+ export declare function getLineSpacingMetrics(lineNode?: ILineSpacingLike | null): ILineSpacingMetrics | null;
50
+ export declare function convertLineSpacingForRuleChange(currentStoredValue: number, currentRule: SpacingRule, nextRule: SpacingRule, metrics?: ILineSpacingMetrics | null): number;
51
+ export {};
@@ -0,0 +1,32 @@
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 { ICommandService, IUniverInstanceService } from '@univerjs/core';
17
+ import type { IKeyboardEventConfig } from './use-keyboard-event';
18
+ export interface IExecuteEditorUndoRedoCommandOptions {
19
+ commandId: string;
20
+ commandService: ICommandService;
21
+ editorUnitId: string;
22
+ univerInstanceService: IUniverInstanceService;
23
+ }
24
+ export interface ICreateEditorUndoRedoKeyboardConfigOptions {
25
+ commandService: ICommandService;
26
+ univerInstanceService: IUniverInstanceService;
27
+ editorUnitId: string;
28
+ keyCodes?: IKeyboardEventConfig['keyCodes'];
29
+ handler?: IKeyboardEventConfig['handler'];
30
+ }
31
+ export declare function executeEditorUndoRedoCommand(options: IExecuteEditorUndoRedoCommandOptions): void;
32
+ export declare function createEditorUndoRedoKeyboardConfig(options: ICreateEditorUndoRedoKeyboardConfigOptions): IKeyboardEventConfig;
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export { createEditorUndoRedoKeyboardConfig, executeEditorUndoRedoCommand, type ICreateEditorUndoRedoKeyboardConfigOptions, type IExecuteEditorUndoRedoCommandOptions } from './editor-undo-redo-keyboard';
16
17
  export { useEditor } from './use-editor';
17
18
  export { useEditorClickOutside } from './use-editor-click-outside';
18
19
  export { useIsFocusing } from './use-is-focusing';
@@ -13,4 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const useEditorClickOutside: (editorId: string, containerRef: React.RefObject<HTMLElement | null>, onClickOutside?: () => void) => void;
16
+ import type { RefObject } from 'react';
17
+ export declare const useEditorClickOutside: (editorId: string, containerRef: RefObject<HTMLElement | null>, onClickOutside?: () => void) => void;
@@ -14,18 +14,18 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Meta } from '@storybook/react';
17
- import { SideMenu } from './index';
17
+ import { SideMenu } from '../SideMenu';
18
18
  declare const meta: Meta<typeof SideMenu>;
19
19
  export default meta;
20
20
  export declare const SideMenuBasic: {
21
- render(): import("react/jsx-runtime").JSX.Element;
21
+ render(): import("react").JSX.Element;
22
22
  };
23
23
  export declare const EmptySideMenu: {
24
- render(): import("react/jsx-runtime").JSX.Element;
24
+ render(): import("react").JSX.Element;
25
25
  };
26
26
  export declare const CustomStyledSideMenu: {
27
- render(): import("react/jsx-runtime").JSX.Element;
27
+ render(): import("react").JSX.Element;
28
28
  };
29
29
  export declare const MultiLevelSideMenu: {
30
- render(): import("react/jsx-runtime").JSX.Element;
30
+ render(): import("react").JSX.Element;
31
31
  };
@@ -20,5 +20,5 @@ interface IDocCreateTableConfirmProps {
20
20
  colCount: number;
21
21
  };
22
22
  }
23
- export declare const DocCreateTableConfirm: ({ handleRowColChange, tableCreateParams, }: IDocCreateTableConfirmProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const DocCreateTableConfirm: ({ handleRowColChange, tableCreateParams, }: IDocCreateTableConfirmProps) => import("react").JSX.Element;
24
24
  export {};
package/lib/umd/facade.js CHANGED
@@ -1,5 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/docs-ui`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsUiFacade={},e.UniverCore,e.UniverCoreFacade,e.UniverDocsUi,e.UniverEngineRender))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let d=class{constructor(e,t,n,r,i,a){this._documentDataModel=e,this._injector=t,this._univerInstanceService=n,this._commandService=r,this._resourceManagerService=i,this._renderManagerService=a,c(this,`id`,void 0),this.id=this._documentDataModel.getUnitId()}getId(){return this._documentDataModel.getUnitId()}getName(){return this.getSnapshot().title||``}getSnapshot(){let e=this._resourceManagerService.getResourcesByType(this.id,t.UniverInstanceType.UNIVER_DOC),n=this._documentDataModel.getSnapshot();return n.resources=e,n}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(t.UndoCommand.id)}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(t.RedoCommand.id)}appendText(e){let{body:t}=this.getSnapshot();if(!t)throw Error(`The document body is empty`);let n=t.dataStream.length-2;return this.insertText(e,{startOffset:n,endOffset:n,segmentId:``})}insertText(e,t={}){var n,i,a;let o=this.id,{body:s}=this.getSnapshot();if(!s)throw Error(`The document body is empty`);let c=(n=t.startOffset)==null?Math.max(0,s.dataStream.length-2):n,l=(i=t.endOffset)==null?c:i,u=(a=t.segmentId)==null?``:a,d={startOffset:c,endOffset:l,collapsed:c===l,segmentId:u};return this._commandService.executeCommand(r.InsertCommand.id,{unitId:o,body:{dataStream:e},range:d,segmentId:u,...t.cursorOffset==null?{}:{cursorOffset:t.cursorOffset}})}insertParagraph(e=``,t={}){var n;let r=`${e.replace(/\r\n/g,`
2
- `).replace(/\r/g,`
3
- `).split(`
4
- `).join(`\r
5
- `)}\r\n`;return this.insertText(r,{...t,cursorOffset:(n=t.cursorOffset)==null?r.length:n})}setSelection(e,n){var i;let a=(i=this._renderManagerService.getRenderById(this.getId()))==null?void 0:i.with(r.DocSelectionRenderService);a==null||a.removeAllRanges(),a==null||a.addDocRanges([{startOffset:e,endOffset:n,rangeType:t.DOC_RANGE_TYPE.TEXT}],!0)}};d=u([l(1,(0,t.Inject)(t.Injector)),l(2,t.IUniverInstanceService),l(3,t.ICommandService),l(4,t.IResourceManagerService),l(5,i.IRenderManagerService)],d);var f=class extends n.FUniver{createUniverDoc(e){let n=this._univerInstanceService.createUnit(t.UniverInstanceType.UNIVER_DOC,e);return this._injector.createInstance(d,n)}getActiveDocument(){let e=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_DOC);return e?this._injector.createInstance(d,e):null}getUniverDoc(e){let t=this._univerInstanceService.getUniverDocInstance(e);return t?this._injector.createInstance(d,t):null}};n.FUniver.extend(f),Object.defineProperty(e,"FDocument",{enumerable:!0,get:function(){return d}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/docs/facade"),require("@univerjs/engine-render")):typeof define==`function`&&define.amd?define([`@univerjs/core`,`@univerjs/docs-ui`,`@univerjs/docs/facade`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCore,e.UniverDocsUi,e.UniverDocsFacade,e.UniverEngineRender))})(this,function(e,t,n,r){var i=class extends n.FDocument{setSelection(n,i){var a;let o=(a=this._injector.get(r.IRenderManagerService).getRenderUnitById(this.getId()))==null?void 0:a.with(t.DocSelectionRenderService);o==null||o.removeAllRanges(),o==null||o.addDocRanges([{startOffset:n,endOffset:i,rangeType:e.DOC_RANGE_TYPE.TEXT}],!0)}};n.FDocument.extend(i)});