@univerjs-pro/shape-editor-ui 1.0.0-alpha.2 → 1.0.0-alpha.4

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 (110) hide show
  1. package/README.md +14 -2
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/locale/ar-SA.js +1 -1
  4. package/lib/cjs/locale/ca-ES.js +1 -1
  5. package/lib/cjs/locale/de-DE.js +1 -1
  6. package/lib/cjs/locale/en-US.js +1 -1
  7. package/lib/cjs/locale/es-ES.js +1 -1
  8. package/lib/cjs/locale/fa-IR.js +1 -1
  9. package/lib/cjs/locale/fr-FR.js +1 -1
  10. package/lib/cjs/locale/id-ID.js +1 -1
  11. package/lib/cjs/locale/it-IT.js +1 -1
  12. package/lib/cjs/locale/ja-JP.js +1 -1
  13. package/lib/cjs/locale/ko-KR.js +1 -1
  14. package/lib/cjs/locale/pl-PL.js +1 -1
  15. package/lib/cjs/locale/pt-BR.js +1 -1
  16. package/lib/cjs/locale/ru-RU.js +1 -1
  17. package/lib/cjs/locale/sk-SK.js +1 -1
  18. package/lib/cjs/locale/vi-VN.js +1 -1
  19. package/lib/cjs/locale/zh-CN.js +1 -1
  20. package/lib/cjs/locale/zh-HK.js +1 -1
  21. package/lib/cjs/locale/zh-TW.js +1 -1
  22. package/lib/es/index.js +1 -1
  23. package/lib/es/locale/ar-SA.js +1 -1
  24. package/lib/es/locale/ca-ES.js +1 -1
  25. package/lib/es/locale/de-DE.js +1 -1
  26. package/lib/es/locale/en-US.js +1 -1
  27. package/lib/es/locale/es-ES.js +1 -1
  28. package/lib/es/locale/fa-IR.js +1 -1
  29. package/lib/es/locale/fr-FR.js +1 -1
  30. package/lib/es/locale/id-ID.js +1 -1
  31. package/lib/es/locale/it-IT.js +1 -1
  32. package/lib/es/locale/ja-JP.js +1 -1
  33. package/lib/es/locale/ko-KR.js +1 -1
  34. package/lib/es/locale/pl-PL.js +1 -1
  35. package/lib/es/locale/pt-BR.js +1 -1
  36. package/lib/es/locale/ru-RU.js +1 -1
  37. package/lib/es/locale/sk-SK.js +1 -1
  38. package/lib/es/locale/vi-VN.js +1 -1
  39. package/lib/es/locale/zh-CN.js +1 -1
  40. package/lib/es/locale/zh-HK.js +1 -1
  41. package/lib/es/locale/zh-TW.js +1 -1
  42. package/lib/index.css +124 -26
  43. package/lib/index.js +1 -1
  44. package/lib/locale/ar-SA.js +1 -1
  45. package/lib/locale/ca-ES.js +1 -1
  46. package/lib/locale/de-DE.js +1 -1
  47. package/lib/locale/en-US.js +1 -1
  48. package/lib/locale/es-ES.js +1 -1
  49. package/lib/locale/fa-IR.js +1 -1
  50. package/lib/locale/fr-FR.js +1 -1
  51. package/lib/locale/id-ID.js +1 -1
  52. package/lib/locale/it-IT.js +1 -1
  53. package/lib/locale/ja-JP.js +1 -1
  54. package/lib/locale/ko-KR.js +1 -1
  55. package/lib/locale/pl-PL.js +1 -1
  56. package/lib/locale/pt-BR.js +1 -1
  57. package/lib/locale/ru-RU.js +1 -1
  58. package/lib/locale/sk-SK.js +1 -1
  59. package/lib/locale/vi-VN.js +1 -1
  60. package/lib/locale/zh-CN.js +1 -1
  61. package/lib/locale/zh-HK.js +1 -1
  62. package/lib/locale/zh-TW.js +1 -1
  63. package/lib/types/components/fill-style-tabs-editor/FillStyleTabsEditor.d.ts +2 -1
  64. package/lib/types/controllers/components.controller.d.ts +1 -1
  65. package/lib/types/index.d.ts +27 -23
  66. package/lib/types/locale/en-US.d.ts +21 -0
  67. package/lib/types/utils/activate-drawing-object.d.ts +23 -0
  68. package/lib/types/utils/shape-floating-toolbar-config.d.ts +5 -0
  69. package/lib/types/utils/shape-transformer-config.d.ts +31 -0
  70. package/lib/types/utils/util.d.ts +5 -0
  71. package/lib/types/views/shape-editor-panel/ShapeTextBoxEditor.d.ts +2 -0
  72. package/lib/types/views/shape-floating-toolbar/ShapeFloatingToolbar.d.ts +131 -6
  73. package/lib/types/views/shape-floating-toolbar/shape-floating-toolbar-utils.d.ts +2 -7
  74. package/lib/types/views/shape-picker/ShapePickerGrid.d.ts +2 -4
  75. package/lib/types/views/shape-picker/index.d.ts +2 -2
  76. package/lib/types/views/shape-text-editor/ShapeTextEditor.d.ts +105 -9
  77. package/lib/types/views/shape-text-editor/ShapeTextEditorContainer.d.ts +2 -2
  78. package/lib/types/views/shape-text-editor/ShapeTextFloatToolbar.d.ts +0 -1
  79. package/lib/types/views/shape-text-editor/ShapeTextPositionWrapper.d.ts +29 -0
  80. package/lib/types/views/shape-text-editor/hooks/use-shape-position.d.ts +3 -1
  81. package/lib/types/views/shape-text-editor/shape-text-behavior.d.ts +15 -0
  82. package/lib/types/views/shape-text-editor/shape-text-document.d.ts +8 -3
  83. package/lib/types/views/shape-text-editor/shape-text-editor-commands.d.ts +4 -0
  84. package/lib/types/views/shape-text-editor/shape-text-float-menu-render-controller-base.d.ts +1 -5
  85. package/lib/types/views/shape-text-editor/shape-text-layout.d.ts +24 -0
  86. package/lib/types/views/shape-text-editor/shape-text-no-wrap-layout.d.ts +25 -0
  87. package/lib/types/views/shape-text-editor/shape-text-placeholder.d.ts +8 -0
  88. package/lib/types/views/shape-text-editor/shape-text-resize-policy.d.ts +17 -0
  89. package/lib/types/views/shape-text-editor/types.d.ts +24 -9
  90. package/lib/umd/index.js +1 -1
  91. package/lib/umd/locale/ar-SA.js +1 -1
  92. package/lib/umd/locale/ca-ES.js +1 -1
  93. package/lib/umd/locale/de-DE.js +1 -1
  94. package/lib/umd/locale/en-US.js +1 -1
  95. package/lib/umd/locale/es-ES.js +1 -1
  96. package/lib/umd/locale/fa-IR.js +1 -1
  97. package/lib/umd/locale/fr-FR.js +1 -1
  98. package/lib/umd/locale/id-ID.js +1 -1
  99. package/lib/umd/locale/it-IT.js +1 -1
  100. package/lib/umd/locale/ja-JP.js +1 -1
  101. package/lib/umd/locale/ko-KR.js +1 -1
  102. package/lib/umd/locale/pl-PL.js +1 -1
  103. package/lib/umd/locale/pt-BR.js +1 -1
  104. package/lib/umd/locale/ru-RU.js +1 -1
  105. package/lib/umd/locale/sk-SK.js +1 -1
  106. package/lib/umd/locale/vi-VN.js +1 -1
  107. package/lib/umd/locale/zh-CN.js +1 -1
  108. package/lib/umd/locale/zh-HK.js +1 -1
  109. package/lib/umd/locale/zh-TW.js +1 -1
  110. package/package.json +13 -13
@@ -0,0 +1,25 @@
1
+ import type { ShapeTextHorizontalAnchor } from '@univerjs-pro/engine-shape';
2
+ import type { IDocumentData } from '@univerjs/core';
3
+ import { ShapeTextWrapType } from '@univerjs-pro/engine-shape';
4
+ import { HorizontalAlign } from '@univerjs/core';
5
+ export interface IShapeTextNoWrapRect {
6
+ left: number;
7
+ top: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+ export interface IShapeTextNoWrapLayout {
12
+ contentWidth: number;
13
+ measureAsNoWrap: boolean;
14
+ textRect: IShapeTextNoWrapRect;
15
+ }
16
+ export interface IResolveShapeTextNoWrapLayoutOptions {
17
+ documentData?: IDocumentData;
18
+ horizontalAlign?: HorizontalAlign;
19
+ horizontalAnchor?: ShapeTextHorizontalAnchor;
20
+ isHorizontal?: boolean;
21
+ textRect: IShapeTextNoWrapRect;
22
+ textWrap?: ShapeTextWrapType;
23
+ widthBuffer?: number;
24
+ }
25
+ export declare function resolveShapeTextNoWrapLayout(options: IResolveShapeTextNoWrapLayoutOptions): IShapeTextNoWrapLayout;
@@ -0,0 +1,8 @@
1
+ import type { IDocumentData } from '@univerjs/core';
2
+ export declare function isShapeTextEditorDocumentEmpty(documentData: IDocumentData | null | undefined): boolean;
3
+ export declare function createShapeTextPlaceholderDocumentData(options: {
4
+ documentData?: IDocumentData;
5
+ isTextBox: boolean;
6
+ placeholder: string;
7
+ text?: string;
8
+ }): IDocumentData | undefined;
@@ -0,0 +1,17 @@
1
+ import type { IShapeData } from '@univerjs-pro/engine-shape';
2
+ export interface IShapeTextBoxResizeRect {
3
+ height: number;
4
+ left: number;
5
+ top: number;
6
+ width: number;
7
+ }
8
+ export interface IShapeTextBoxResizePolicyResult {
9
+ rect: IShapeTextBoxResizeRect;
10
+ shapeData: IShapeData;
11
+ }
12
+ export declare function resolveShapeTextBoxResizePolicy(options: {
13
+ initialRect: IShapeTextBoxResizeRect;
14
+ naturalCrossSize?: number;
15
+ requestedRect: IShapeTextBoxResizeRect;
16
+ shapeData: IShapeData;
17
+ }): IShapeTextBoxResizePolicyResult | null;
@@ -1,6 +1,7 @@
1
- import type { ICustomShapeTextData, IShapeRect } from '@univerjs-pro/engine-shape';
1
+ import type { ICustomShapeTextData, IShapeData, IShapeRect, IShapeTextBodyBehavior, IShapeTextData } from '@univerjs-pro/engine-shape';
2
2
  import type { HorizontalAlign, IDocumentData, ITransformState, Nullable, VerticalAlign, WrapStrategy } from '@univerjs/core';
3
3
  import type { IRender } from '@univerjs/engine-render';
4
+ import type { CSSProperties } from 'react';
4
5
  import type { Observable } from 'rxjs';
5
6
  export interface IShapeTextEditingParams {
6
7
  unitId: string;
@@ -9,28 +10,30 @@ export interface IShapeTextEditingParams {
9
10
  shapeKey: string;
10
11
  visible: boolean;
11
12
  }
12
- export interface IShapeTextEditingServiceLike {
13
+ export interface IShapeTextEditingService {
13
14
  editingParams$: Observable<Nullable<IShapeTextEditingParams>>;
14
15
  onSavingEditorData$: Observable<Nullable<boolean>>;
15
16
  setEditing(params: Nullable<IShapeTextEditingParams>): void;
17
+ completeEditing?(event?: PointerEvent): void;
18
+ cancelEditing?(): void;
16
19
  }
17
- export interface IShapeTextModel {
18
- va?: VerticalAlign;
19
- ha?: HorizontalAlign;
20
- doc: IDocumentData;
21
- }
22
- export interface IShapeTextModelLike {
20
+ export declare function stripShapeTextPlainMarker(shapeText: IShapeTextData | ICustomShapeTextData | null | undefined): ICustomShapeTextData;
21
+ export interface IShapeTextEditorModel {
23
22
  getShapeTextData(): ICustomShapeTextData;
24
23
  getShapeTextRect(rect: IShapeRect): IShapeRect;
25
24
  }
26
25
  export interface IShapeTextDataContext {
26
+ shapeText: ICustomShapeTextData;
27
+ bodyBehavior: IShapeTextBodyBehavior;
27
28
  doc?: IDocumentData;
28
29
  verticalAlign: VerticalAlign;
29
30
  horizontalAlign: HorizontalAlign;
30
31
  wrapStrategy: WrapStrategy;
32
+ autoFitNoWrap: boolean;
31
33
  textRect: IShapeRect;
32
34
  transform: ITransformState;
33
35
  isHorizontal: boolean;
36
+ isTextBox: boolean;
34
37
  }
35
38
  export interface IShapeTextUpdateParams {
36
39
  unitId: string;
@@ -38,6 +41,7 @@ export interface IShapeTextUpdateParams {
38
41
  shapeId: string;
39
42
  shapeText: ICustomShapeTextData;
40
43
  oldShapeText: ICustomShapeTextData;
44
+ hostSize?: IShapeTextHostSizeUpdateParams;
41
45
  }
42
46
  export interface IShapeTextHostHeightUpdateParams {
43
47
  unitId: string;
@@ -53,12 +57,17 @@ export interface IShapeTextHostSizeUpdateParams {
53
57
  height: number;
54
58
  }
55
59
  export interface IShapeTextEditorAdapter {
56
- getShapeModel(unitId: string, subUnitId: string, shapeId: string): Nullable<IShapeTextModelLike>;
60
+ getShapeModel(unitId: string, subUnitId: string, shapeId: string): Nullable<IShapeTextEditorModel>;
61
+ getShapeData?(unitId: string, subUnitId: string, shapeId: string): Nullable<IShapeData>;
57
62
  getDrawingTransform(unitId: string, subUnitId: string, shapeId: string): Nullable<ITransformState>;
58
63
  updateShapeText(params: IShapeTextUpdateParams): void;
59
64
  updateHostHeight?(params: IShapeTextHostHeightUpdateParams): void;
60
65
  updateHostSize?(params: IShapeTextHostSizeUpdateParams): void;
66
+ previewHostSize?(params: IShapeTextHostSizeUpdateParams): void;
61
67
  allowHostSizeShrink?(params: IShapeTextEditingParams): boolean;
68
+ deferHostSizeUpdateDuringEditing?(params: IShapeTextEditingParams): boolean;
69
+ getEditingContentStyle?(params: IShapeTextEditingParams): CSSProperties | undefined;
70
+ commitOnEnter?(params: IShapeTextEditingParams): boolean;
62
71
  }
63
72
  export interface IShapeTextEditorViewportKeys {
64
73
  main: string;
@@ -66,7 +75,13 @@ export interface IShapeTextEditorViewportKeys {
66
75
  top?: string;
67
76
  left?: string;
68
77
  }
78
+ export interface IShapeTextEditorPositionOffset {
79
+ left: number;
80
+ top: number;
81
+ }
69
82
  export interface IShapeTextEditorPositionOptions {
70
83
  viewportKeys: IShapeTextEditorViewportKeys;
71
84
  getSkeleton?: (renderUnit: IRender, editingParams: IShapeTextEditingParams) => unknown;
85
+ getHostTransform?: (renderUnit: IRender, editingParams: IShapeTextEditingParams) => Nullable<ITransformState>;
86
+ getPositionOffset?: (renderUnit: IRender, editingParams: IShapeTextEditingParams) => Nullable<IShapeTextEditorPositionOffset>;
72
87
  }