@univerjs-pro/shape-editor-ui 1.0.0-alpha.1 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) 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 +159 -12
  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/config/config.d.ts +5 -0
  65. package/lib/types/controllers/components.controller.d.ts +7 -0
  66. package/lib/types/index.d.ts +25 -20
  67. package/lib/types/locale/en-US.d.ts +2 -0
  68. package/lib/types/plugin.d.ts +13 -0
  69. package/lib/types/utils/activate-drawing-object.d.ts +23 -0
  70. package/lib/types/utils/shape-floating-toolbar-config.d.ts +5 -0
  71. package/lib/types/utils/shape-transformer-config.d.ts +31 -0
  72. package/lib/types/views/shape-floating-toolbar/ShapeFloatingToolbar.d.ts +131 -10
  73. package/lib/types/views/shape-floating-toolbar/shape-floating-toolbar-utils.d.ts +2 -5
  74. package/lib/types/views/shape-picker/ShapePickerGrid.d.ts +22 -0
  75. package/lib/types/views/shape-picker/index.d.ts +4 -0
  76. package/lib/types/views/shape-picker/shapes.d.ts +25 -0
  77. package/lib/types/views/shape-text-editor/ShapeTextEditor.d.ts +105 -9
  78. package/lib/types/views/shape-text-editor/ShapeTextEditorContainer.d.ts +2 -2
  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-layout.d.ts +24 -0
  85. package/lib/types/views/shape-text-editor/shape-text-no-wrap-layout.d.ts +24 -0
  86. package/lib/types/views/shape-text-editor/shape-text-placeholder.d.ts +8 -0
  87. package/lib/types/views/shape-text-editor/shape-text-resize-policy.d.ts +17 -0
  88. package/lib/types/views/shape-text-editor/types.d.ts +25 -6
  89. package/lib/umd/index.js +1 -1
  90. package/lib/umd/locale/ar-SA.js +1 -1
  91. package/lib/umd/locale/ca-ES.js +1 -1
  92. package/lib/umd/locale/de-DE.js +1 -1
  93. package/lib/umd/locale/en-US.js +1 -1
  94. package/lib/umd/locale/es-ES.js +1 -1
  95. package/lib/umd/locale/fa-IR.js +1 -1
  96. package/lib/umd/locale/fr-FR.js +1 -1
  97. package/lib/umd/locale/id-ID.js +1 -1
  98. package/lib/umd/locale/it-IT.js +1 -1
  99. package/lib/umd/locale/ja-JP.js +1 -1
  100. package/lib/umd/locale/ko-KR.js +1 -1
  101. package/lib/umd/locale/pl-PL.js +1 -1
  102. package/lib/umd/locale/pt-BR.js +1 -1
  103. package/lib/umd/locale/ru-RU.js +1 -1
  104. package/lib/umd/locale/sk-SK.js +1 -1
  105. package/lib/umd/locale/vi-VN.js +1 -1
  106. package/lib/umd/locale/zh-CN.js +1 -1
  107. package/lib/umd/locale/zh-HK.js +1 -1
  108. package/lib/umd/locale/zh-TW.js +1 -1
  109. package/package.json +13 -13
@@ -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, IShapeTextDataModel } 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,34 @@ 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
+ export type IShapeTextModel = IShapeTextDataModel<IDocumentData, HorizontalAlign, VerticalAlign> & {
20
21
  doc: IDocumentData;
21
- }
22
+ };
23
+ export declare function normalizeShapeTextModel(dataModel: IShapeTextDataModel<IDocumentData, HorizontalAlign, VerticalAlign> | null | undefined): IShapeTextModel | null;
24
+ export declare function stripShapeTextPlainMarker(shapeText: IShapeTextData | ICustomShapeTextData | null | undefined): ICustomShapeTextData;
22
25
  export interface IShapeTextModelLike {
23
26
  getShapeTextData(): ICustomShapeTextData;
24
27
  getShapeTextRect(rect: IShapeRect): IShapeRect;
25
28
  }
26
29
  export interface IShapeTextDataContext {
30
+ shapeText: ICustomShapeTextData;
31
+ bodyBehavior: IShapeTextBodyBehavior;
27
32
  doc?: IDocumentData;
28
33
  verticalAlign: VerticalAlign;
29
34
  horizontalAlign: HorizontalAlign;
30
35
  wrapStrategy: WrapStrategy;
36
+ autoFitNoWrap: boolean;
31
37
  textRect: IShapeRect;
32
38
  transform: ITransformState;
33
39
  isHorizontal: boolean;
40
+ isTextBox: boolean;
34
41
  }
35
42
  export interface IShapeTextUpdateParams {
36
43
  unitId: string;
@@ -38,6 +45,7 @@ export interface IShapeTextUpdateParams {
38
45
  shapeId: string;
39
46
  shapeText: ICustomShapeTextData;
40
47
  oldShapeText: ICustomShapeTextData;
48
+ hostSize?: IShapeTextHostSizeUpdateParams;
41
49
  }
42
50
  export interface IShapeTextHostHeightUpdateParams {
43
51
  unitId: string;
@@ -54,11 +62,16 @@ export interface IShapeTextHostSizeUpdateParams {
54
62
  }
55
63
  export interface IShapeTextEditorAdapter {
56
64
  getShapeModel(unitId: string, subUnitId: string, shapeId: string): Nullable<IShapeTextModelLike>;
65
+ getShapeData?(unitId: string, subUnitId: string, shapeId: string): Nullable<IShapeData>;
57
66
  getDrawingTransform(unitId: string, subUnitId: string, shapeId: string): Nullable<ITransformState>;
58
67
  updateShapeText(params: IShapeTextUpdateParams): void;
59
68
  updateHostHeight?(params: IShapeTextHostHeightUpdateParams): void;
60
69
  updateHostSize?(params: IShapeTextHostSizeUpdateParams): void;
70
+ previewHostSize?(params: IShapeTextHostSizeUpdateParams): void;
61
71
  allowHostSizeShrink?(params: IShapeTextEditingParams): boolean;
72
+ deferHostSizeUpdateDuringEditing?(params: IShapeTextEditingParams): boolean;
73
+ getEditingContentStyle?(params: IShapeTextEditingParams): CSSProperties | undefined;
74
+ commitOnEnter?(params: IShapeTextEditingParams): boolean;
62
75
  }
63
76
  export interface IShapeTextEditorViewportKeys {
64
77
  main: string;
@@ -66,7 +79,13 @@ export interface IShapeTextEditorViewportKeys {
66
79
  top?: string;
67
80
  left?: string;
68
81
  }
82
+ export interface IShapeTextEditorPositionOffset {
83
+ left: number;
84
+ top: number;
85
+ }
69
86
  export interface IShapeTextEditorPositionOptions {
70
87
  viewportKeys: IShapeTextEditorViewportKeys;
71
88
  getSkeleton?: (renderUnit: IRender, editingParams: IShapeTextEditingParams) => unknown;
89
+ getHostTransform?: (renderUnit: IRender, editingParams: IShapeTextEditingParams) => Nullable<ITransformState>;
90
+ getPositionOffset?: (renderUnit: IRender, editingParams: IShapeTextEditingParams) => Nullable<IShapeTextEditorPositionOffset>;
72
91
  }