polotno 4.12.1 → 4.13.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 (157) hide show
  1. package/blueprint/canvas/context-menu/context-menu.d.ts +2 -2
  2. package/blueprint/canvas/page-controls.d.ts +14 -2
  3. package/blueprint/canvas/tooltip.d.ts +24 -2
  4. package/blueprint/pages-timeline/audio-track.d.ts +12 -2
  5. package/blueprint/pages-timeline/audios.d.ts +10 -2
  6. package/blueprint/pages-timeline/current-time.d.ts +2 -2
  7. package/blueprint/pages-timeline/element-track.d.ts +14 -2
  8. package/blueprint/pages-timeline/elements.d.ts +2 -2
  9. package/blueprint/pages-timeline/page-preview.d.ts +8 -2
  10. package/blueprint/pages-timeline/pages-timeline.d.ts +8 -2
  11. package/blueprint/pages-timeline/pages.d.ts +8 -2
  12. package/blueprint/pages-timeline/play-button.d.ts +2 -2
  13. package/blueprint/pages-timeline/time-ruler.d.ts +10 -2
  14. package/blueprint/side-panel/ai-images-panel.d.ts +6 -2
  15. package/blueprint/side-panel/animations-panel.d.ts +6 -2
  16. package/blueprint/side-panel/background-panel.d.ts +6 -2
  17. package/blueprint/side-panel/draw-panel.d.ts +6 -2
  18. package/blueprint/side-panel/effects-panel.d.ts +6 -2
  19. package/blueprint/side-panel/image-clip-panel.d.ts +6 -2
  20. package/blueprint/side-panel/layers-panel.d.ts +6 -2
  21. package/blueprint/side-panel/pages-panel.d.ts +6 -2
  22. package/blueprint/side-panel/side-panel.d.ts +2 -2
  23. package/blueprint/side-panel/size-panel.d.ts +6 -2
  24. package/blueprint/side-panel/templates-panel.d.ts +6 -2
  25. package/blueprint/side-panel/text-panel.d.ts +6 -2
  26. package/blueprint/side-panel/videos-panel.d.ts +6 -2
  27. package/blueprint/toolbar/admin-button.d.ts +6 -2
  28. package/blueprint/toolbar/animations-picker.d.ts +18 -4
  29. package/blueprint/toolbar/copy-style.d.ts +6 -2
  30. package/blueprint/toolbar/download-button.d.ts +6 -2
  31. package/blueprint/toolbar/duplicate-button.d.ts +6 -2
  32. package/blueprint/toolbar/figure-toolbar.d.ts +8 -8
  33. package/blueprint/toolbar/filters-picker.d.ts +26 -6
  34. package/blueprint/toolbar/gif-toolbar.d.ts +2 -2
  35. package/blueprint/toolbar/group-button.d.ts +6 -2
  36. package/blueprint/toolbar/group-toolbar.d.ts +2 -2
  37. package/blueprint/toolbar/history-buttons.d.ts +6 -2
  38. package/blueprint/toolbar/html-toolbar.d.ts +10 -10
  39. package/blueprint/toolbar/image-remove-background-button.d.ts +10 -2
  40. package/blueprint/toolbar/image-toolbar.d.ts +28 -8
  41. package/blueprint/toolbar/line-toolbar.d.ts +14 -10
  42. package/blueprint/toolbar/lock-button.d.ts +6 -2
  43. package/blueprint/toolbar/many-toolbar.d.ts +2 -2
  44. package/blueprint/toolbar/opacity-picker.d.ts +6 -2
  45. package/blueprint/toolbar/page-toolbar.d.ts +2 -2
  46. package/blueprint/toolbar/position-picker.d.ts +6 -2
  47. package/blueprint/toolbar/remove-button.d.ts +6 -2
  48. package/blueprint/toolbar/svg-toolbar.d.ts +2 -2
  49. package/blueprint/toolbar/table-toolbar.d.ts +44 -14
  50. package/blueprint/toolbar/text-ai-write.d.ts +6 -2
  51. package/blueprint/toolbar/text-toolbar.d.ts +14 -14
  52. package/blueprint/toolbar/toolbar.d.ts +2 -2
  53. package/blueprint/toolbar/video-toolbar.d.ts +6 -6
  54. package/blueprint/toolbar/zoom-buttons.d.ts +4 -4
  55. package/canvas/audio.d.ts +3 -2
  56. package/canvas/context-menu/context-menu.d.ts +2 -2
  57. package/canvas/drawing-layer.d.ts +2 -2
  58. package/canvas/element.d.ts +2 -2
  59. package/canvas/fade-overlay.d.ts +14 -0
  60. package/canvas/fade-overlay.js +1 -0
  61. package/canvas/figure-element.d.ts +2 -2
  62. package/canvas/gif-element.d.ts +2 -2
  63. package/canvas/gif-element.js +1 -1
  64. package/canvas/highlighter.d.ts +6 -2
  65. package/canvas/html-element.d.ts +2 -2
  66. package/canvas/image-element.d.ts +5 -3
  67. package/canvas/image-element.js +1 -1
  68. package/canvas/line-element.d.ts +2 -2
  69. package/canvas/page-controls.d.ts +14 -2
  70. package/canvas/page.d.ts +2 -2
  71. package/canvas/page.js +1 -1
  72. package/canvas/render-tag-element.d.ts +2 -2
  73. package/canvas/render-tag-element.js +1 -1
  74. package/canvas/rich-editor.js +3 -3
  75. package/canvas/rules.d.ts +2 -2
  76. package/canvas/table-element.d.ts +2 -2
  77. package/canvas/text-element.d.ts +2 -2
  78. package/canvas/tooltip.d.ts +24 -2
  79. package/canvas/video-element.d.ts +3 -2
  80. package/canvas/video-element.js +1 -1
  81. package/canvas/workspace-canvas.d.ts +2 -2
  82. package/hooks/use-fade-stop-focus.d.ts +2 -0
  83. package/hooks/use-fade-stop-focus.js +1 -0
  84. package/icons/registry.d.ts +106 -102
  85. package/package.json +31 -34
  86. package/pages-timeline/audio-track.d.ts +14 -2
  87. package/pages-timeline/audio-track.js +1 -1
  88. package/pages-timeline/audios.d.ts +10 -2
  89. package/pages-timeline/current-time.d.ts +2 -2
  90. package/pages-timeline/current-time.js +1 -1
  91. package/pages-timeline/element-track.d.ts +14 -2
  92. package/pages-timeline/element-track.js +1 -1
  93. package/pages-timeline/elements.d.ts +2 -2
  94. package/pages-timeline/page-preview.d.ts +8 -2
  95. package/pages-timeline/page-preview.js +1 -1
  96. package/pages-timeline/pages-timeline.d.ts +8 -2
  97. package/pages-timeline/pages-timeline.js +1 -1
  98. package/pages-timeline/pages.d.ts +8 -2
  99. package/pages-timeline/play-button.d.ts +2 -2
  100. package/pages-timeline/time-ruler.d.ts +10 -2
  101. package/pages-timeline/time-ruler.js +1 -1
  102. package/polotno.bundle.js +166 -165
  103. package/side-panel/ai-images-panel.d.ts +6 -2
  104. package/side-panel/animations-panel.d.ts +6 -2
  105. package/side-panel/background-panel.d.ts +6 -2
  106. package/side-panel/draw-panel.d.ts +6 -2
  107. package/side-panel/effects-panel.d.ts +6 -2
  108. package/side-panel/effects-panel.js +1 -1
  109. package/side-panel/image-clip-panel.d.ts +6 -2
  110. package/side-panel/layers-panel.d.ts +6 -2
  111. package/side-panel/pages-panel.d.ts +6 -2
  112. package/side-panel/side-panel.d.ts +2 -2
  113. package/side-panel/size-panel.d.ts +6 -2
  114. package/side-panel/templates-panel.d.ts +6 -2
  115. package/side-panel/text-panel.d.ts +6 -2
  116. package/side-panel/videos-panel.d.ts +6 -2
  117. package/toolbar/admin-button.d.ts +6 -2
  118. package/toolbar/animations-picker.d.ts +18 -4
  119. package/toolbar/copy-style.d.ts +6 -2
  120. package/toolbar/download-button.d.ts +6 -2
  121. package/toolbar/duplicate-button.d.ts +6 -2
  122. package/toolbar/figure-toolbar.d.ts +8 -8
  123. package/toolbar/filters-picker.d.ts +26 -6
  124. package/toolbar/gif-toolbar.d.ts +2 -2
  125. package/toolbar/group-button.d.ts +6 -2
  126. package/toolbar/group-toolbar.d.ts +2 -2
  127. package/toolbar/history-buttons.d.ts +6 -2
  128. package/toolbar/html-toolbar.d.ts +10 -10
  129. package/toolbar/image-remove-background-button.d.ts +10 -2
  130. package/toolbar/image-toolbar.d.ts +32 -10
  131. package/toolbar/line-toolbar.d.ts +14 -10
  132. package/toolbar/lock-button.d.ts +6 -2
  133. package/toolbar/many-toolbar.d.ts +2 -2
  134. package/toolbar/opacity-picker.d.ts +6 -2
  135. package/toolbar/page-toolbar.d.ts +2 -2
  136. package/toolbar/position-picker.d.ts +6 -2
  137. package/toolbar/remove-button.d.ts +6 -2
  138. package/toolbar/svg-toolbar.d.ts +2 -2
  139. package/toolbar/table-toolbar.d.ts +44 -14
  140. package/toolbar/text-ai-write.d.ts +6 -2
  141. package/toolbar/text-toolbar.d.ts +30 -18
  142. package/toolbar/toolbar.d.ts +2 -2
  143. package/toolbar/video-toolbar.d.ts +12 -6
  144. package/toolbar/video-toolbar.js +1 -1
  145. package/toolbar/zoom-buttons.d.ts +4 -4
  146. package/ui.css +1 -1
  147. package/utils/clip-fade.d.ts +6 -0
  148. package/utils/clip-fade.js +1 -0
  149. package/utils/fade-gradient.d.ts +33 -0
  150. package/utils/fade-gradient.js +1 -0
  151. package/utils/fade-overlay.d.ts +9 -0
  152. package/utils/fade-overlay.js +1 -0
  153. package/utils/l10n.d.ts +19 -0
  154. package/utils/l10n.js +1 -1
  155. package/utils/pointer-drag.d.ts +6 -4
  156. package/utils/pointer-drag.js +1 -1
  157. package/utils/validate-key.js +1 -1
@@ -16,19 +16,19 @@ type InputProps = {
16
16
  components?: any;
17
17
  elements: TextElementType[];
18
18
  };
19
- export declare const TextBold: (({ store }: InputProps) => React.JSX.Element) & {
20
- displayName: string;
19
+ export declare const TextBold: (({ store }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
20
+ readonly type: ({ store }: InputProps) => React.JSX.Element;
21
21
  };
22
- export declare const FontStyleGroup: (({ element, store, elements, components }: InputProps) => React.JSX.Element) & {
23
- displayName: string;
22
+ export declare const FontStyleGroup: (({ element, store, elements, components }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
23
+ readonly type: ({ element, store, elements, components }: InputProps) => React.JSX.Element;
24
24
  };
25
- export declare const FontColorInput: (({ element, store }: InputProps) => React.JSX.Element) & {
26
- displayName: string;
25
+ export declare const FontColorInput: (({ element, store }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
26
+ readonly type: ({ element, store }: InputProps) => React.JSX.Element;
27
27
  };
28
- export declare const DirectionInput: (({ element }: InputProps) => React.JSX.Element) & {
29
- displayName: string;
28
+ export declare const DirectionInput: (({ element }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
29
+ readonly type: ({ element }: InputProps) => React.JSX.Element;
30
30
  };
31
- export declare const HtmlToolbar: (({ store, components }: PageProps) => React.JSX.Element) & {
32
- displayName: string;
31
+ export declare const HtmlToolbar: (({ store, components }: PageProps) => React.JSX.Element) & React.NamedExoticComponent<PageProps> & {
32
+ readonly type: ({ store, components }: PageProps) => React.JSX.Element;
33
33
  };
34
34
  export {};
@@ -4,8 +4,16 @@ export declare const RemoveBackgroundDialog: (({ isOpen, onClose, element, }: {
4
4
  isOpen: boolean;
5
5
  onClose: () => void;
6
6
  element: any;
7
- }) => React.JSX.Element) & {
8
- displayName: string;
7
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
8
+ isOpen: boolean;
9
+ onClose: () => void;
10
+ element: any;
11
+ }> & {
12
+ readonly type: ({ isOpen, onClose, element, }: {
13
+ isOpen: boolean;
14
+ onClose: () => void;
15
+ element: any;
16
+ }) => React.JSX.Element;
9
17
  };
10
18
  export declare const ImageRemoveBackground: ({ element }: {
11
19
  element: any;
@@ -13,22 +13,42 @@ export declare const ImageClip: (({ element, store, elements, }: {
13
13
  element: ImageElementType;
14
14
  store: StoreType;
15
15
  elements: ImageElementType[];
16
- }) => React.JSX.Element | null) & {
17
- displayName: string;
16
+ }) => React.JSX.Element | null) & React.NamedExoticComponent<{
17
+ element: ImageElementType;
18
+ store: StoreType;
19
+ elements: ImageElementType[];
20
+ }> & {
21
+ readonly type: ({ element, store, elements, }: {
22
+ element: ImageElementType;
23
+ store: StoreType;
24
+ elements: ImageElementType[];
25
+ }) => React.JSX.Element | null;
18
26
  };
19
27
  export declare const ImageCrop: (({ element, store }: {
20
28
  element: ImageElementType;
21
29
  store: StoreType;
22
- }) => React.JSX.Element | null) & {
23
- displayName: string;
30
+ }) => React.JSX.Element | null) & React.NamedExoticComponent<{
31
+ element: ImageElementType;
32
+ store: StoreType;
33
+ }> & {
34
+ readonly type: ({ element, store }: {
35
+ element: ImageElementType;
36
+ store: StoreType;
37
+ }) => React.JSX.Element | null;
24
38
  };
25
39
  export declare const ImageRemoveClip: (({ element, store }: {
26
40
  element: ImageElementType;
27
41
  store: StoreType;
28
- }) => React.JSX.Element | null) & {
29
- displayName: string;
42
+ }) => React.JSX.Element | null) & React.NamedExoticComponent<{
43
+ element: ImageElementType;
44
+ store: StoreType;
45
+ }> & {
46
+ readonly type: ({ element, store }: {
47
+ element: ImageElementType;
48
+ store: StoreType;
49
+ }) => React.JSX.Element | null;
30
50
  };
31
- export declare const ImageToolbar: (({ store, components }: Props) => React.JSX.Element) & {
32
- displayName: string;
51
+ export declare const ImageToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
52
+ readonly type: ({ store, components }: Props) => React.JSX.Element;
33
53
  };
34
54
  export default ImageToolbar;
@@ -10,21 +10,25 @@ type ButtonProps = {
10
10
  store: StoreType;
11
11
  elements: LineElementType[];
12
12
  };
13
- export declare const LineSettings: (({ store, elements }: ButtonProps) => React.JSX.Element) & {
14
- displayName: string;
13
+ export declare const LineSettings: (({ store, elements }: ButtonProps) => React.JSX.Element) & React.NamedExoticComponent<ButtonProps> & {
14
+ readonly type: ({ store, elements }: ButtonProps) => React.JSX.Element;
15
15
  };
16
- export declare const LineColor: (({ elements, store }: ButtonProps) => React.JSX.Element) & {
17
- displayName: string;
16
+ export declare const LineColor: (({ elements, store }: ButtonProps) => React.JSX.Element) & React.NamedExoticComponent<ButtonProps> & {
17
+ readonly type: ({ elements, store }: ButtonProps) => React.JSX.Element;
18
18
  };
19
19
  export declare const BasicHead: (({ elements, store, property }: ButtonProps & {
20
20
  property: string;
21
- }) => React.JSX.Element) & {
22
- displayName: string;
21
+ }) => React.JSX.Element) & React.NamedExoticComponent<ButtonProps & {
22
+ property: string;
23
+ }> & {
24
+ readonly type: ({ elements, store, property }: ButtonProps & {
25
+ property: string;
26
+ }) => React.JSX.Element;
23
27
  };
24
- export declare const LineHeads: (({ elements, store }: ButtonProps) => React.JSX.Element) & {
25
- displayName: string;
28
+ export declare const LineHeads: (({ elements, store }: ButtonProps) => React.JSX.Element) & React.NamedExoticComponent<ButtonProps> & {
29
+ readonly type: ({ elements, store }: ButtonProps) => React.JSX.Element;
26
30
  };
27
- export declare const LineToolbar: (({ store, components }: Props) => React.JSX.Element) & {
28
- displayName: string;
31
+ export declare const LineToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
32
+ readonly type: ({ store, components }: Props) => React.JSX.Element;
29
33
  };
30
34
  export default LineToolbar;
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import { StoreType } from '../../model/store.js';
3
3
  export declare const LockButton: (({ store }: {
4
4
  store: StoreType;
5
- }) => React.JSX.Element) & {
6
- displayName: string;
5
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
6
+ store: StoreType;
7
+ }> & {
8
+ readonly type: ({ store }: {
9
+ store: StoreType;
10
+ }) => React.JSX.Element;
7
11
  };
@@ -4,7 +4,7 @@ type Props = {
4
4
  store: StoreType;
5
5
  components?: any;
6
6
  };
7
- export declare const ManyToolbar: (({ store, components }: Props) => React.JSX.Element) & {
8
- displayName: string;
7
+ export declare const ManyToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
8
+ readonly type: ({ store, components }: Props) => React.JSX.Element;
9
9
  };
10
10
  export default ManyToolbar;
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import { StoreType } from '../../model/store.js';
3
3
  export declare const OpacityPicker: (({ store }: {
4
4
  store: StoreType;
5
- }) => React.JSX.Element) & {
6
- displayName: string;
5
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
6
+ store: StoreType;
7
+ }> & {
8
+ readonly type: ({ store }: {
9
+ store: StoreType;
10
+ }) => React.JSX.Element;
7
11
  };
@@ -9,7 +9,7 @@ export declare const NumberInput: ({ value, onValueChange, ...props }: {
9
9
  value: any;
10
10
  onValueChange: any;
11
11
  }) => React.JSX.Element;
12
- export declare const PageToolbar: (({ store, components }: Props) => React.JSX.Element) & {
13
- displayName: string;
12
+ export declare const PageToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
13
+ readonly type: ({ store, components }: Props) => React.JSX.Element;
14
14
  };
15
15
  export default PageToolbar;
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import { StoreType } from '../../model/store.js';
3
3
  export declare const PositionPicker: (({ store }: {
4
4
  store: StoreType;
5
- }) => React.JSX.Element) & {
6
- displayName: string;
5
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
6
+ store: StoreType;
7
+ }> & {
8
+ readonly type: ({ store }: {
9
+ store: StoreType;
10
+ }) => React.JSX.Element;
7
11
  };
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import { StoreType } from '../../model/store.js';
3
3
  export declare const RemoveButton: (({ store }: {
4
4
  store: StoreType;
5
- }) => React.JSX.Element) & {
6
- displayName: string;
5
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
6
+ store: StoreType;
7
+ }> & {
8
+ readonly type: ({ store }: {
9
+ store: StoreType;
10
+ }) => React.JSX.Element;
7
11
  };
@@ -5,7 +5,7 @@ type Props = {
5
5
  hideSvgEffects?: boolean;
6
6
  components?: any;
7
7
  };
8
- export declare const SvgToolbar: (({ store, hideSvgEffects, components }: Props) => React.JSX.Element) & {
9
- displayName: string;
8
+ export declare const SvgToolbar: (({ store, hideSvgEffects, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
9
+ readonly type: ({ store, hideSvgEffects, components }: Props) => React.JSX.Element;
10
10
  };
11
11
  export default SvgToolbar;
@@ -13,37 +13,67 @@ type ButtonProps = {
13
13
  export declare const TableBorderSettings: (({ elements, store }: {
14
14
  elements: any[];
15
15
  store: StoreType;
16
- }) => React.JSX.Element) & {
17
- displayName: string;
16
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
17
+ elements: any[];
18
+ store: StoreType;
19
+ }> & {
20
+ readonly type: ({ elements, store }: {
21
+ elements: any[];
22
+ store: StoreType;
23
+ }) => React.JSX.Element;
18
24
  };
19
25
  export declare const TableStructureMenu: (({ element, store }: {
20
26
  element: TableElementType;
21
27
  store: StoreType;
22
- }) => React.JSX.Element) & {
23
- displayName: string;
28
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
29
+ element: TableElementType;
30
+ store: StoreType;
31
+ }> & {
32
+ readonly type: ({ element, store }: {
33
+ element: TableElementType;
34
+ store: StoreType;
35
+ }) => React.JSX.Element;
24
36
  };
25
- export declare const TableStructure: (({ elements, store }: ButtonProps) => React.JSX.Element) & {
26
- displayName: string;
37
+ export declare const TableStructure: (({ elements, store }: ButtonProps) => React.JSX.Element) & React.NamedExoticComponent<ButtonProps> & {
38
+ readonly type: ({ elements, store }: ButtonProps) => React.JSX.Element;
27
39
  };
28
40
  export declare const CellPadding: (({ elements, store }: {
29
41
  elements: any[];
30
42
  store: StoreType;
31
- }) => React.JSX.Element) & {
32
- displayName: string;
43
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
44
+ elements: any[];
45
+ store: StoreType;
46
+ }> & {
47
+ readonly type: ({ elements, store }: {
48
+ elements: any[];
49
+ store: StoreType;
50
+ }) => React.JSX.Element;
33
51
  };
34
52
  export declare const CellBackground: (({ elements, store }: {
35
53
  elements: any[];
36
54
  store: StoreType;
37
- }) => React.JSX.Element) & {
38
- displayName: string;
55
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
56
+ elements: any[];
57
+ store: StoreType;
58
+ }> & {
59
+ readonly type: ({ elements, store }: {
60
+ elements: any[];
61
+ store: StoreType;
62
+ }) => React.JSX.Element;
39
63
  };
40
64
  export declare const CellVerticalAlign: (({ elements, store }: {
41
65
  elements: any[];
42
66
  store: StoreType;
43
- }) => React.JSX.Element) & {
44
- displayName: string;
67
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
68
+ elements: any[];
69
+ store: StoreType;
70
+ }> & {
71
+ readonly type: ({ elements, store }: {
72
+ elements: any[];
73
+ store: StoreType;
74
+ }) => React.JSX.Element;
45
75
  };
46
- export declare const TableToolbar: (({ store, components }: Props) => React.JSX.Element) & {
47
- displayName: string;
76
+ export declare const TableToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
77
+ readonly type: ({ store, components }: Props) => React.JSX.Element;
48
78
  };
49
79
  export default TableToolbar;
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import { StoreType } from '../../model/store.js';
3
3
  export declare const TextAiWrite: (({ store }: {
4
4
  store: StoreType;
5
- }) => React.JSX.Element | null) & {
6
- displayName: string;
5
+ }) => React.JSX.Element | null) & React.NamedExoticComponent<{
6
+ store: StoreType;
7
+ }> & {
8
+ readonly type: ({ store }: {
9
+ store: StoreType;
10
+ }) => React.JSX.Element | null;
7
11
  };
@@ -19,11 +19,11 @@ export declare const FontMenu: ({ store, fonts, activeFont, activeFontLabel, onF
19
19
  mixedFonts?: string[];
20
20
  }) => React.JSX.Element;
21
21
  export declare const fetcher: (url: string) => Promise<any>;
22
- export declare const TextFontFamily: (({ elements, store }: InputProps) => React.JSX.Element) & {
23
- displayName: string;
22
+ export declare const TextFontFamily: (({ elements, store }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
23
+ readonly type: ({ elements, store }: InputProps) => React.JSX.Element;
24
24
  };
25
- export declare const TextFontSize: (({ elements, store }: InputProps) => React.JSX.Element) & {
26
- displayName: string;
25
+ export declare const TextFontSize: (({ elements, store }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
26
+ readonly type: ({ elements, store }: InputProps) => React.JSX.Element;
27
27
  };
28
28
  export declare const ALIGN_OPTIONS: string[];
29
29
  export declare const VERTICAL_ALIGN_OPTIONS: string[];
@@ -32,24 +32,24 @@ export declare const VERTICAL_ALIGN_ICONS: {
32
32
  middle: React.JSX.Element;
33
33
  bottom: React.JSX.Element;
34
34
  };
35
- export declare const TextFontVariant: (({ elements, store }: InputProps) => React.JSX.Element) & {
36
- displayName: string;
35
+ export declare const TextFontVariant: (({ elements, store }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
36
+ readonly type: ({ elements, store }: InputProps) => React.JSX.Element;
37
37
  };
38
- export declare const TextTransform: (({ elements, store }: InputProps) => React.JSX.Element) & {
39
- displayName: string;
38
+ export declare const TextTransform: (({ elements, store }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
39
+ readonly type: ({ elements, store }: InputProps) => React.JSX.Element;
40
40
  };
41
- export declare const TextFill: (({ elements, store }: InputProps) => React.JSX.Element) & {
42
- displayName: string;
41
+ export declare const TextFill: (({ elements, store }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
42
+ readonly type: ({ elements, store }: InputProps) => React.JSX.Element;
43
43
  };
44
44
  export declare const NumberInput: ({ value, onValueChange, ...props }: {
45
45
  [x: string]: any;
46
46
  value: any;
47
47
  onValueChange: any;
48
48
  }) => React.JSX.Element;
49
- export declare const TextSpacing: (({ elements, store }: InputProps) => React.JSX.Element) & {
50
- displayName: string;
49
+ export declare const TextSpacing: (({ elements, store }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
50
+ readonly type: ({ elements, store }: InputProps) => React.JSX.Element;
51
51
  };
52
- export declare const TextToolbar: (({ store, components }: PageProps) => React.JSX.Element) & {
53
- displayName: string;
52
+ export declare const TextToolbar: (({ store, components }: PageProps) => React.JSX.Element) & React.NamedExoticComponent<PageProps> & {
53
+ readonly type: ({ store, components }: PageProps) => React.JSX.Element;
54
54
  };
55
55
  export default TextToolbar;
@@ -11,7 +11,7 @@ export declare function useToolbarCondensed(thresholdPx?: number): {
11
11
  readonly containerRef: React.RefObject<HTMLDivElement | null>;
12
12
  readonly condensed: boolean;
13
13
  };
14
- export declare const Toolbar: (({ store, downloadButtonEnabled, components }: ToolbarProps) => React.JSX.Element) & {
15
- displayName: string;
14
+ export declare const Toolbar: (({ store, downloadButtonEnabled, components }: ToolbarProps) => React.JSX.Element) & React.NamedExoticComponent<ToolbarProps> & {
15
+ readonly type: ({ store, downloadButtonEnabled, components }: ToolbarProps) => React.JSX.Element;
16
16
  };
17
17
  export default Toolbar;
@@ -6,13 +6,13 @@ type Props = {
6
6
  components?: any;
7
7
  element: VideoElementType;
8
8
  };
9
- export declare const VideoTrim: (({ store, components, element }: Props) => React.JSX.Element) & {
10
- displayName: string;
9
+ export declare const VideoTrim: (({ store, components, element }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
10
+ readonly type: ({ store, components, element }: Props) => React.JSX.Element;
11
11
  };
12
- export declare const VideoClip: (({ element, store }: Props) => React.JSX.Element | null) & {
13
- displayName: string;
12
+ export declare const VideoClip: (({ element, store }: Props) => React.JSX.Element | null) & React.NamedExoticComponent<Props> & {
13
+ readonly type: ({ element, store }: Props) => React.JSX.Element | null;
14
14
  };
15
- export declare const VideoToolbar: (({ store, components }: Props) => React.JSX.Element) & {
16
- displayName: string;
15
+ export declare const VideoToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
16
+ readonly type: ({ store, components }: Props) => React.JSX.Element;
17
17
  };
18
18
  export default VideoToolbar;
@@ -5,10 +5,10 @@ type Props = {
5
5
  store: StoreType;
6
6
  align?: Alignment;
7
7
  };
8
- export declare const ZoomGroup: (({ store }: Props) => React.JSX.Element) & {
9
- displayName: string;
8
+ export declare const ZoomGroup: (({ store }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
9
+ readonly type: ({ store }: Props) => React.JSX.Element;
10
10
  };
11
- export declare const ZoomButtons: (({ store }: Props) => React.JSX.Element) & {
12
- displayName: string;
11
+ export declare const ZoomButtons: (({ store }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
12
+ readonly type: ({ store }: Props) => React.JSX.Element;
13
13
  };
14
14
  export default ZoomButtons;
package/canvas/audio.d.ts CHANGED
@@ -1,10 +1,11 @@
1
+ import React from 'react';
1
2
  import { StoreType } from '../model/store.js';
2
3
  import { AudioType } from '../model/audio-model.js';
3
4
  type Props = {
4
5
  store: StoreType;
5
6
  audio: AudioType;
6
7
  };
7
- export declare const AudioElement: (({ audio, store }: Props) => null) & {
8
- displayName: string;
8
+ export declare const AudioElement: (({ audio, store }: Props) => null) & React.NamedExoticComponent<Props> & {
9
+ readonly type: ({ audio, store }: Props) => null;
9
10
  };
10
11
  export {};
@@ -10,7 +10,7 @@ type ContextMenuProps = {
10
10
  isOpen: boolean;
11
11
  setIsOpen: (b: boolean) => void;
12
12
  };
13
- export declare const ContextMenu: (({ store, isOpen, offset, setIsOpen }: ContextMenuProps) => import("react").JSX.Element | null) & {
14
- displayName: string;
13
+ export declare const ContextMenu: (({ store, isOpen, offset, setIsOpen }: ContextMenuProps) => import("react").JSX.Element | null) & import("react").NamedExoticComponent<ContextMenuProps> & {
14
+ readonly type: ({ store, isOpen, offset, setIsOpen }: ContextMenuProps) => import("react").JSX.Element | null;
15
15
  };
16
16
  export {};
@@ -12,7 +12,7 @@ type DrawingLayerProps = {
12
12
  bleedLeft: number;
13
13
  bleedTop: number;
14
14
  };
15
- export declare const DrawingLayer: (({ store, page, width, height, scale, xPadding, yPadding, bleedLeft, bleedTop, }: DrawingLayerProps) => React.JSX.Element | null) & {
16
- displayName: string;
15
+ export declare const DrawingLayer: (({ store, page, width, height, scale, xPadding, yPadding, bleedLeft, bleedTop, }: DrawingLayerProps) => React.JSX.Element | null) & React.NamedExoticComponent<DrawingLayerProps> & {
16
+ readonly type: ({ store, page, width, height, scale, xPadding, yPadding, bleedLeft, bleedTop, }: DrawingLayerProps) => React.JSX.Element | null;
17
17
  };
18
18
  export {};
@@ -7,7 +7,7 @@ type ShapeProps = {
7
7
  onClick: Function;
8
8
  };
9
9
  export declare function registerShapeComponent(type: string, component: React.JSX.Element): void;
10
- declare const Element: ((props: ShapeProps) => React.JSX.Element | null) & {
11
- displayName: string;
10
+ declare const Element: ((props: ShapeProps) => React.JSX.Element | null) & React.NamedExoticComponent<ShapeProps> & {
11
+ readonly type: (props: ShapeProps) => React.JSX.Element | null;
12
12
  };
13
13
  export default Element;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { type StoreType } from '../model/store.js';
3
+ export declare const FadeOverlay: (({ store, pageId }: {
4
+ store: StoreType;
5
+ pageId: string;
6
+ }) => React.JSX.Element | null) & React.NamedExoticComponent<{
7
+ store: StoreType;
8
+ pageId: string;
9
+ }> & {
10
+ readonly type: ({ store, pageId }: {
11
+ store: StoreType;
12
+ pageId: string;
13
+ }) => React.JSX.Element | null;
14
+ };
@@ -0,0 +1 @@
1
+ import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import r from"react";import{observer as i}from"mobx-react-lite";import{Circle as s,Ellipse as a,Group as o,Line as l,Rect as c}from"react-konva";import{ROLES as d}from"../model/store.js";import{fadeStopColor as u,moveFadeStop as f,insertFadeStop as p,safe01 as g}from"../utils/fade-gradient.js";import{getFadeStopFocus as v,getSelectedFadeStop as m,setSelectedFadeStop as x}from"../utils/fade-overlay.js";import{useWorkspaceStyle as y}from"./workspace-style.js";import{t as h}from"../utils/l10n.js";import{readClipFade as b,writeClipFade as j}from"../utils/clip-fade.js";import{isAlive as S}from"mobx-state-tree";export const FadeOverlay=i(({store:i,pageId:M})=>{var O,k,E;const w=1===i.selectedElements.length?i.selectedElements[0]:null;let D=!!w;for(let e=w;e;e="group"===(null===(O=e.parent)||void 0===O?void 0:O.type)?e.parent:null){D=D&&e.visible&&e.active}const R=!D||i.role===d.VIEWER||i.isPlaying||(null===(k=null==w?void 0:w.page)||void 0===k?void 0:k.id)!==M||!("clipSrc"in w)||"_cropModeEnabled"in w&&w._cropModeEnabled?null:b(w.clipSrc),F=!!R,P=null==R?void 0:R.fade,A=Math.min(m(i),(null!==(E=null==P?void 0:P.stops.length)&&void 0!==E?E:1)-1),L=e=>{w&&R&&S(w)&&w.set({clipSrc:j(e,R.baseSrc)})},T=e=>{var t,n;x(i,e);const r=v(i);(null==r?void 0:r.elementId)===(null==w?void 0:w.id)&&(null==r?void 0:r.onSelectStop(e))||null===(n=null===(t=W.current)||void 0===t?void 0:t.getStage())||void 0===n||n.container().focus({preventScroll:!0})},{transformerStyle:I}=y(),W=r.useRef(null),z=r.useRef(null),B=r.useRef(!1),V=r.useRef(!1),X=r.useRef(null);if(r.useLayoutEffect(()=>{const e=W.current,t=null==e?void 0:e.getLayer();if(!e||!t||!w){return}const n=w.id,r=()=>{var t;const r=null===(t=e.getStage())||void 0===t?void 0:t.findOne("#"+n),i=e.getParent(),s=!!(null==r?void 0:r.isVisible());if(e.visible(s),!r||!i||!s){return}const a=i.getAbsoluteTransform().copy().invert();a.multiply(r.getAbsoluteTransform()),e.setAttrs(a.decompose())};return r(),t.on("beforeDraw",r),()=>{t.off("beforeDraw",r)}}),r.useLayoutEffect(()=>{var e,t,n;B.current||!F&&!V.current||(V.current=F,z.current=null!==(t=null===(e=W.current)||void 0===e?void 0:e.getLayer())&&void 0!==t?t:z.current,null===(n=z.current)||void 0===n||n.drawHit())}),r.useEffect(()=>{var e,t;if(!F){return}const n=null===(t=null===(e=W.current)||void 0===e?void 0:e.getStage())||void 0===t?void 0:t.container();if(!n){return}const r=n.getAttribute("tabindex");n.tabIndex=-1;const s=e=>{if(document.activeElement!==n||!["Delete","Backspace"].includes(e.key)){return}if(e.preventDefault(),e.stopPropagation(),!w||!S(w)||!("clipSrc"in w)){return}const t=b(w.clipSrc);if(!t||t.fade.stops.length<=2){return}const r=m(i);i.history.transaction(()=>w.set({clipSrc:j(Object.assign(Object.assign({},t.fade),{stops:t.fade.stops.filter((e,t)=>t!==r)}),t.baseSrc)})),x(i,Math.max(0,r-1))};return n.addEventListener("keydown",s),()=>{n.removeEventListener("keydown",s),null===r?n.removeAttribute("tabindex"):n.setAttribute("tabindex",r),x(i,0),n.style.cursor="",n.title="",B.current&&(B.current=!1,i.history.endTransaction())}},[i,null==w?void 0:w.id,F]),!P||!w){return null}const{width:Y,height:_}=w.a;if(Y<=0||_<=0){return null}const H=i.scale||1,q=Math.min(12/H,Y/10,_/10),C=Math.min(5/H,q/2),G=Math.min(24/H,2*q),J=e=>({x:e.x*Y,y:e.y*_}),K=e=>({x:Math.max(q/Y,Math.min(1-q/Y,e.x)),y:Math.max(q/_,Math.min(1-q/_,e.y))}),N=e=>K({x:e.x()/Y,y:e.y()/_}),Q=e=>{var t;const n=((null===(t=W.current)||void 0===t?void 0:t.getAbsoluteRotation())||0)+("y"===e?90:0);return["ew-resize","nwse-resize","ns-resize","nesw-resize"][(Math.round(n/45)%4+4)%4]},U=e=>"function"==typeof e?e():e,Z=(e,t)=>({onMouseEnter:n=>{const r=n.target.getStage().container();r.style.cursor=U(e),r.title=t},onMouseLeave:e=>{if(B.current){return}const t=e.target.getStage().container();t.style.cursor="",t.title=""}}),$=()=>{var e;const t=null===(e=W.current)||void 0===e?void 0:e.getRelativePointerPosition();"radial"===P.shape&&t&&(X.current={position:t,radius:P.radius})},ee=(e,t,n,r="grab")=>Object.assign(Object.assign({draggable:!0,dragDistance:0,stroke:n===A?String(I.anchorStroke):void 0!==n&&P.stops[n].alpha>.5?"#fff":"#222",strokeWidth:2,strokeScaleEnabled:!1,hitStrokeWidth:Math.max(0,G-2*C)},Z(r,e)),{onMouseDown:e=>{e.cancelBubble=!0,$(),void 0!==n&&(e.evt.preventDefault(),T(n))},onTouchStart:e=>{e.cancelBubble=!0,$(),void 0!==n&&(e.evt.preventDefault(),T(n))},onDragStart:e=>{e.target.getStage().container().style.cursor="grab"===r?"grabbing":U(r),B.current=!0,i.history.startTransaction()},onDragMove:e=>t(e.target),onDragEnd:e=>{e.target.getStage().container().style.cursor=U(r),B.current=!1,X.current=null,i.history.endTransaction()}}),te=e=>({fill:u(P.stops[e].alpha)}),ne=[{stroke:"#222"},{stroke:"#fff",dash:[4,4]}],re=J("linear"===P.shape?P.start:P.center),ie=J("linear"===P.shape?P.end:{x:P.center.x-P.radius.x,y:P.center.y}),se=ie.x-re.x,ae=ie.y-re.y,oe=e=>({x:re.x+se*e,y:re.y+ae*e}),le=e=>g(((e.x-re.x)*se+(e.y-re.y)*ae)/(se*se+ae*ae||1)),ce=e=>{var t,n;e.cancelBubble=!0;const r=e.target.getRelativePointerPosition();if(!r){return}const s=p(P.stops,le(r));null===(n=null===(t=W.current)||void 0===t?void 0:t.getStage())||void 0===n||n.container().focus({preventScroll:!0}),x(i,s.index),i.history.transaction(()=>L(Object.assign(Object.assign({},P),{stops:s.stops})))},de=n(t,{children:[ne.map((t,n)=>e(l,Object.assign({},t,{listening:1===n,strokeWidth:1.5,name:"fade-axis-guide"},Z("copy",h("toolbar.clipFade.addStop")),{points:[re.x,re.y,ie.x,ie.y],strokeScaleEnabled:!1,hitStrokeWidth:10,onMouseDown:ce,onTouchStart:ce}),n)),P.stops.map((t,n)=>0===t.offset||"linear"===P.shape&&1===t.offset?null:e(s,Object.assign({name:"fade-stop-anchor"},J(K({x:oe(t.offset).x/Y,y:oe(t.offset).y/_})),{radius:C},te(n),ee(h("toolbar.clipFade.stopOpacity"),e=>((e,t)=>{const n=P.stops.findIndex(t=>t.id===e),r=f(P.stops,n,le(t.position()));t.position(oe(r.stops[r.index].offset)),x(i,r.index),L(Object.assign(Object.assign({},P),{stops:r.stops}))})(t.id,e),n)),t.id))]});let ue;if("linear"===P.shape){const r=(e,t)=>{const n=N(t),r=J("start"===e?P.end:P.start);Math.hypot(n.x*Y-r.x,n.y*_-r.y)<1/H?t.position(J(P[e])):(t.position(J(n)),L(Object.assign(Object.assign({},P),{[e]:n})))};ue=n(t,{children:[de,e(s,Object.assign({name:"fade-axis-anchor fade-start"},J(K(P.start)),{radius:C},te(0),ee(h("toolbar.clipFade.start"),e=>r("start",e),0))),e(s,Object.assign({name:"fade-axis-anchor fade-end"},J(K(P.end)),{radius:C},te(P.stops.length-1),ee(h("toolbar.clipFade.end"),e=>r("end",e),P.stops.length-1)))]})}else{const r=J(P.center),i=P.radius.x*Y,o=P.radius.y*_,l=e=>{const t=N(e),n={x:Math.max(Math.min(.5,P.radius.x),Math.min(Math.max(.5,1-P.radius.x),t.x)),y:Math.max(Math.min(.5,P.radius.y),Math.min(Math.max(.5,1-P.radius.y),t.y))};e.position(J(n)),L(Object.assign(Object.assign({},P),{center:n}))},d=(e,t)=>{var n;const r="x"===e?Y:_,i=X.current;if(!i){return}const s=null===(n=W.current)||void 0===n?void 0:n.getRelativePointerPosition();if(!s){return}const a=s[e],o=Math.max(.001,Math.min(P.center[e],1-P.center[e])),l=Math.min(o,Math.max(.001,i.radius[e]+(a-i.position[e])/r*("x"===e?1:-1)));t.position(J(K("x"===e?{x:P.center.x+l,y:P.center.y}:{x:P.center.x,y:P.center.y-l}))),L(Object.assign(Object.assign({},P),{radius:Object.assign(Object.assign({},P.radius),{[e]:l})}))};ue=n(t,{children:[ne.map((t,n)=>e(a,Object.assign({},t,{strokeWidth:1.5,x:r.x,y:r.y,radiusX:i,radiusY:o,strokeScaleEnabled:!1,listening:!1}),n)),de,e(c,Object.assign({name:"fade-center"},J(K(P.center)),{offsetX:C,offsetY:C,width:2*C,height:2*C},te(0),ee(h("toolbar.clipFade.center"),l,0,"move"))),e(s,Object.assign({name:"fade-radius-x"},J(K({x:(r.x+i)/Y,y:P.center.y})),{radius:C,fill:"#fff"},ee(h("toolbar.clipFade.radius"),e=>d("x",e),void 0,()=>Q("x")))),e(s,Object.assign({name:"fade-radius-y"},J(K({x:P.center.x,y:(r.y-o)/_})),{radius:C,fill:"#fff"},ee(h("toolbar.clipFade.radius"),e=>d("y",e),void 0,()=>Q("y"))))]})}return e(o,{ref:W,name:"fade-overlay",hideInExport:!0,children:ue})});
@@ -5,7 +5,7 @@ type FigureProps = {
5
5
  store: StoreType;
6
6
  element: FigureElementType;
7
7
  };
8
- export declare const FigureElement: (({ element, store }: FigureProps) => React.JSX.Element) & {
9
- displayName: string;
8
+ export declare const FigureElement: (({ element, store }: FigureProps) => React.JSX.Element) & React.NamedExoticComponent<FigureProps> & {
9
+ readonly type: ({ element, store }: FigureProps) => React.JSX.Element;
10
10
  };
11
11
  export {};
@@ -5,7 +5,7 @@ type Props = {
5
5
  store: StoreType;
6
6
  element: VideoElementType;
7
7
  };
8
- export declare const GifElement: (({ element, store }: Props) => React.JSX.Element) & {
9
- displayName: string;
8
+ export declare const GifElement: (({ element, store }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
9
+ readonly type: ({ element, store }: Props) => React.JSX.Element;
10
10
  };
11
11
  export {};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as e,Fragment as r}from"react/jsx-runtime";import i from"react";import{observer as o}from"mobx-react-lite";import{nodeAutorun as a}from"../utils/mobx.js";import{Image as n,Group as s,Rect as h,Arc as d,Text as l}from"react-konva";import{ROLES as c}from"../model/store.js";import g from"konva";import{parseGIF as m,decompressFrames as f}from"gifuct-js";import{useCornerRadiusAndCrop as u}from"./video-element.js";import{useImageLoader as p}from"./image-element.js";import{fetchWithRetry as w}from"@polotno/core/retry";import{useWorkspaceStyle as x}from"./workspace-style.js";import{useFilteredSource as y}from"./use-filtered-source.js";import{useFadeIn as b}from"./use-fadein.js";import{isTouchDevice as E}from"../utils/screen.js";import{roundEnabledPx as v,activeAnchorOf as S,isCornerAnchor as j,scaledBoxStyleAttrs as I,roundedBoxStyleAttrs as M,roundedGeometryAttrs as O,roundedPosition as R}from"../utils/px.js";import{useEvent as z}from"../hooks/use-event.js";function C(t,e,r){const i=e.getContext("2d"),o=r.getContext("2d");if(!i||!o){return}2===t.disposalType&&i.clearRect(0,0,e.width,e.height),r.width=t.width,r.height=t.height;const a=o.createImageData(t.width,t.height);a.data.set(t.patch),o.putImageData(a,0,0),i.drawImage(r,t.left,t.top)}const T=o(({element:r})=>{const o=Math.min(30,r.width/4,r.height/4),a=i.useRef(null);i.useEffect(()=>{const t=a.current;if(!t){return}const e=new g.Animation(e=>{t.rotate(((null==e?void 0:e.timeDiff)||0)/2)},t.getLayer());return e.start(),()=>{e.stop()}},[]);const{mediaLoadingStyle:n}=x();return e(s,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:r.a.opacity,hideInExport:!r.showInExport,children:[t(h,{width:r.width,height:r.height,fill:n.fill}),t(d,{ref:a,x:r.width/2,y:r.height/2,fill:n.textFill,outerRadius:Math.abs(o),innerRadius:Math.max(1,o-5),angle:270})]})}),D=o(({element:r})=>{const{mediaErrorStyle:i}=x(),o=Math.max(10,Math.min(30,r.width/22));return e(s,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:r.a.opacity,hideInExport:!r.showInExport,children:[t(h,{width:r.width,height:r.height,fill:i.fill}),t(l,{text:"Cannot load the GIF...",fontSize:o,width:r.width,height:r.height,align:"center",fill:i.textFill,verticalAlign:"middle",padding:5})]})});export const GifElement=o(({element:o,store:s})=>{var d,l;const[x,X]=i.useState(!1),Y=i.useRef(!1),k=o.isSelected,F=i.useRef(null),A=i.useRef(void 0),[_,B,G,L]=function(t){const[e,r]=i.useState([]),[o,a]=i.useState(0),[n,s]=i.useState("loading"),[h,d]=i.useState({width:0,height:0});return i.useEffect(()=>{(async()=>{try{const e=await w(t),i=await e.arrayBuffer(),o=m(i),n=f(o,!0),h=o.lsd.width,l=o.lsd.height;d({width:h,height:l});const c=n.map(t=>({patch:new Uint8ClampedArray(t.patch),delay:t.delay,width:t.dims.width,height:t.dims.height,left:t.dims.left,top:t.dims.top,disposalType:t.disposalType})),g=c.reduce((t,e)=>t+e.delay,0);r(c),a(g),s("loaded")}catch(e){console.error("Failed to load GIF:",e),s("failed")}})()},[t]),[e,o,h,n]}(o.src);p(L,o.src,o.id),i.useEffect(()=>(A.current=document.createElement("canvas"),()=>{A.current&&g.Util.releaseCanvas(A.current)}),[]),i.useEffect(()=>{if("loaded"===L&&A.current&&(A.current.width=G.width,A.current.height=G.height,_.length>0)){const t=A.current.getContext("2d");if(t){t.clearRect(0,0,G.width,G.height);const e=document.createElement("canvas");C(_[0],A.current,e)}}},[G,L,_]),i.useEffect(()=>{var t;if(!_.length||!A.current){return}const e=A.current;e.width=G.width,e.height=G.height;const r=document.createElement("canvas"),i=e.getContext("2d");i&&i.clearRect(0,0,e.width,e.height);let n=-1;C(_[0],e,r),Z(),n=0;const h=t=>{const i=(t=>{const e=t%B;let r=0;for(let i=0;i<_.length;i++){if(r+=_[i].delay,r>e){return i}}return 0})(t);i!==n&&(C(_[i],e,r),Z(),F.current.getLayer().draw(),n=i)};if(s.isPlaying||(null===(t=o.page)||void 0===t?void 0:t._exportingOrRendering)){return a(o,()=>{h(s.currentTime-o.page.startTime)})}{const t=window.setInterval(()=>{h(s.currentTime||performance.now())},16);return()=>{clearInterval(t)}}},[s.isPlaying,_,B,null===(d=o.page)||void 0===d?void 0:d._exportingOrRendering]),i.useEffect(()=>{B&&s.history.ignore(()=>{o.set({duration:B})})},[B]);let{cropX:P,cropY:U,cropWidth:W,cropHeight:H}=o;"loaded"!==L&&(P=U=0,W=H=1);const N={x:G.width*P,y:G.height*U,width:G.width*W,height:G.height*H},q=null!==(l=o.cornerRadius)&&void 0!==l?l:0,[J,K]=y(o,A.current),[Q,V]=u(o,J,N,s._elementsPixelRatio,q,x||o._cropModeEnabled),Z=z(()=>{K(),V()}),$="loading"===L,tt="failed"===L,et=$||tt?0:o.a.opacity;b(F,et);const rt=o.selectable||s.role===c.ADMIN,it=E();return e(r,{children:[$&&t(T,{element:o}),tt&&t(D,{element:o}),t(n,{ref:F,name:"element",id:o.id,image:Q,x:o.a.x,y:o.a.y,width:o.a.width||1,height:o.a.height||1,rotation:o.a.rotation,opacity:et,shadowEnabled:o.shadowEnabled,shadowBlur:o.shadowBlur,shadowOffsetX:o.shadowOffsetX,shadowOffsetY:o.shadowOffsetY,shadowColor:o.shadowColor,shadowOpacity:o.shadowOpacity,customCrop:N,listening:rt,draggable:it?o.draggable&&k:o.draggable,preventDefault:!it||k,hideInExport:!o.showInExport,onDragMove:t=>{o.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{o.set(R(t.target))},onTransformStart:t=>{X(!0),Y.current=j(S(t.target))},onTransform:t=>{const e=t.currentTarget,r=Math.abs(e.scaleX()-1)<1e-7?1:e.scaleX(),i=Math.abs(e.scaleY()-1)<1e-7?1:e.scaleY();e.scaleX(1),e.scaleY(1);const a=Y.current?Math.min(r,i):1;o.set(Object.assign({x:e.x(),y:e.y(),width:e.width()*r,height:e.height()*i,rotation:e.rotation()},1!==a&&Object.assign(Object.assign({},I(o,a)),{borderSize:o.borderSize*a})))},onTransformEnd:()=>{o.set(Object.assign(Object.assign(Object.assign({},O(o)),M(o)),{borderSize:v(o.borderSize)})),X(!1)}}),t(h,{x:o.a.x,y:o.a.y,width:Math.max(o.a.width-o.borderSize,0),height:Math.max(o.a.height-o.borderSize,0),opacity:et,offsetX:-o.borderSize/2,offsetY:-o.borderSize/2,stroke:o.borderColor,strokeWidth:o.borderSize,listening:!1,visible:!!o.borderSize,rotation:o.rotation,cornerRadius:Math.max(0,q-o.borderSize),hideInExport:!o.showInExport})]})});
1
+ import{jsx as t,jsxs as e,Fragment as r}from"react/jsx-runtime";import i from"react";import{observer as o}from"mobx-react-lite";import{nodeAutorun as a}from"../utils/mobx.js";import{Image as n,Group as s,Rect as h,Arc as d,Text as l}from"react-konva";import{ROLES as c}from"../model/store.js";import g from"konva";import{parseGIF as m,decompressFrames as f}from"gifuct-js";import{useClip as u,useCornerRadiusAndCrop as p}from"./video-element.js";import{useImageLoader as w}from"./image-element.js";import{fetchWithRetry as x}from"@polotno/core/retry";import{useWorkspaceStyle as y}from"./workspace-style.js";import{useFilteredSource as b}from"./use-filtered-source.js";import{useFadeIn as E}from"./use-fadein.js";import{isTouchDevice as v}from"../utils/screen.js";import{roundEnabledPx as S,activeAnchorOf as j,isCornerAnchor as I,scaledBoxStyleAttrs as R,roundedBoxStyleAttrs as M,roundedGeometryAttrs as O,roundedPosition as z}from"../utils/px.js";import{useEvent as C}from"../hooks/use-event.js";function T(t,e,r){const i=e.getContext("2d"),o=r.getContext("2d");if(!i||!o){return}2===t.disposalType&&i.clearRect(0,0,e.width,e.height),r.width=t.width,r.height=t.height;const a=o.createImageData(t.width,t.height);a.data.set(t.patch),o.putImageData(a,0,0),i.drawImage(r,t.left,t.top)}const D=o(({element:r})=>{const o=Math.min(30,r.width/4,r.height/4),a=i.useRef(null);i.useEffect(()=>{const t=a.current;if(!t){return}const e=new g.Animation(e=>{t.rotate(((null==e?void 0:e.timeDiff)||0)/2)},t.getLayer());return e.start(),()=>{e.stop()}},[]);const{mediaLoadingStyle:n}=y();return e(s,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:r.a.opacity,hideInExport:!r.showInExport,children:[t(h,{width:r.width,height:r.height,fill:n.fill}),t(d,{ref:a,x:r.width/2,y:r.height/2,fill:n.textFill,outerRadius:Math.abs(o),innerRadius:Math.max(1,o-5),angle:270})]})}),X=o(({element:r})=>{const{mediaErrorStyle:i}=y(),o=Math.max(10,Math.min(30,r.width/22));return e(s,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:r.a.opacity,hideInExport:!r.showInExport,children:[t(h,{width:r.width,height:r.height,fill:i.fill}),t(l,{text:"Cannot load the GIF...",fontSize:o,width:r.width,height:r.height,align:"center",fill:i.textFill,verticalAlign:"middle",padding:5})]})});export const GifElement=o(({element:o,store:s})=>{var d,l;const[y,Y]=i.useState(!1),k=i.useRef(!1),F=o.isSelected,_=i.useRef(null),A=i.useRef(void 0),[P,B,G,L]=function(t){const[e,r]=i.useState([]),[o,a]=i.useState(0),[n,s]=i.useState("loading"),[h,d]=i.useState({width:0,height:0});return i.useEffect(()=>{(async()=>{try{const e=await x(t),i=await e.arrayBuffer(),o=m(i),n=f(o,!0),h=o.lsd.width,l=o.lsd.height;d({width:h,height:l});const c=n.map(t=>({patch:new Uint8ClampedArray(t.patch),delay:t.delay,width:t.dims.width,height:t.dims.height,left:t.dims.left,top:t.dims.top,disposalType:t.disposalType})),g=c.reduce((t,e)=>t+e.delay,0);r(c),a(g),s("loaded")}catch(e){console.error("Failed to load GIF:",e),s("failed")}})()},[t]),[e,o,h,n]}(o.src);w(L,o.src,o.id),i.useEffect(()=>(A.current=document.createElement("canvas"),()=>{A.current&&g.Util.releaseCanvas(A.current)}),[]),i.useEffect(()=>{if("loaded"===L&&A.current&&(A.current.width=G.width,A.current.height=G.height,P.length>0)){const t=A.current.getContext("2d");if(t){t.clearRect(0,0,G.width,G.height);const e=document.createElement("canvas");T(P[0],A.current,e)}}},[G,L,P]),i.useEffect(()=>{var t;if(!P.length||!A.current){return}const e=A.current;e.width=G.width,e.height=G.height;const r=document.createElement("canvas"),i=e.getContext("2d");i&&i.clearRect(0,0,e.width,e.height);let n=-1;T(P[0],e,r),et(),n=0;const h=t=>{const i=(t=>{const e=t%B;let r=0;for(let i=0;i<P.length;i++){if(r+=P[i].delay,r>e){return i}}return 0})(t);i!==n&&(T(P[i],e,r),et(),_.current.getLayer().draw(),n=i)};if(s.isPlaying||(null===(t=o.page)||void 0===t?void 0:t._exportingOrRendering)){return a(o,()=>{h(s.currentTime-o.page.startTime)})}{const t=window.setInterval(()=>{h(s.currentTime||performance.now())},16);return()=>{clearInterval(t)}}},[s.isPlaying,P,B,null===(d=o.page)||void 0===d?void 0:d._exportingOrRendering]),i.useEffect(()=>{B&&s.history.ignore(()=>{o.set({duration:B})})},[B]);let{cropX:U,cropY:W,cropWidth:H,cropHeight:N}=o;"loaded"!==L&&(U=W=0,H=N=1);const q={x:G.width*U,y:G.height*W,width:G.width*H,height:G.height*N},J=null!==(l=o.cornerRadius)&&void 0!==l?l:0,[K,Q]=b(o,A.current),[V,Z]=p(o,K,q,s._elementsPixelRatio,J,y||o._cropModeEnabled),[$,tt]=u(o,V,s._elementsPixelRatio,[q,J]),et=C(()=>{Q(),Z(),tt()}),rt="loading"===L,it="failed"===L,ot=rt||it?0:o.a.opacity;E(_,ot);const at=o.selectable||s.role===c.ADMIN,nt=v();return e(r,{children:[rt&&t(D,{element:o}),it&&t(X,{element:o}),t(n,{ref:_,name:"element",id:o.id,image:$,x:o.a.x,y:o.a.y,width:o.a.width||1,height:o.a.height||1,rotation:o.a.rotation,opacity:ot,shadowEnabled:o.shadowEnabled,shadowBlur:o.shadowBlur,shadowOffsetX:o.shadowOffsetX,shadowOffsetY:o.shadowOffsetY,shadowColor:o.shadowColor,shadowOpacity:o.shadowOpacity,customCrop:q,listening:at,draggable:nt?o.draggable&&F:o.draggable,preventDefault:!nt||F,hideInExport:!o.showInExport,onDragMove:t=>{o.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{o.set(z(t.target))},onTransformStart:t=>{Y(!0),k.current=I(j(t.target))},onTransform:t=>{const e=t.currentTarget,r=Math.abs(e.scaleX()-1)<1e-7?1:e.scaleX(),i=Math.abs(e.scaleY()-1)<1e-7?1:e.scaleY();e.scaleX(1),e.scaleY(1);const a=k.current?Math.min(r,i):1;o.set(Object.assign({x:e.x(),y:e.y(),width:e.width()*r,height:e.height()*i,rotation:e.rotation()},1!==a&&Object.assign(Object.assign({},R(o,a)),{borderSize:o.borderSize*a})))},onTransformEnd:()=>{o.set(Object.assign(Object.assign(Object.assign({},O(o)),M(o)),{borderSize:S(o.borderSize)})),Y(!1)}}),t(h,{x:o.a.x,y:o.a.y,width:Math.max(o.a.width-o.borderSize,0),height:Math.max(o.a.height-o.borderSize,0),opacity:ot,offsetX:-o.borderSize/2,offsetY:-o.borderSize/2,stroke:o.borderColor,strokeWidth:o.borderSize,listening:!1,visible:!!o.borderSize,rotation:o.rotation,cornerRadius:Math.max(0,J-o.borderSize),hideInExport:!o.showInExport})]})});
@@ -10,7 +10,11 @@ type SimplifiedElement = {
10
10
  };
11
11
  export declare const Highlighter: (({ element }: {
12
12
  element: SimplifiedElement;
13
- }) => React.JSX.Element) & {
14
- displayName: string;
13
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
14
+ element: SimplifiedElement;
15
+ }> & {
16
+ readonly type: ({ element }: {
17
+ element: SimplifiedElement;
18
+ }) => React.JSX.Element;
15
19
  };
16
20
  export {};
@@ -8,6 +8,6 @@ type ShapeProps = {
8
8
  element: TextElementType;
9
9
  onClick: Function;
10
10
  };
11
- export declare const HTMLElement: (({ element, store }: ShapeProps) => React.JSX.Element) & {
12
- displayName: string;
11
+ export declare const HTMLElement: (({ element, store }: ShapeProps) => React.JSX.Element) & React.NamedExoticComponent<ShapeProps> & {
12
+ readonly type: ({ element, store }: ShapeProps) => React.JSX.Element;
13
13
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { StoreType } from '../model/store.js';
3
3
  import { ImageElementType } from '../model/image-model.js';
4
+ import { type ImageStatus } from './use-image.js';
4
5
  declare function alignToPixelGrid(element: ImageElementType, pixelRatio: number, ratio: number, enabled: boolean): {
5
6
  x: number;
6
7
  y: number;
@@ -50,9 +51,10 @@ type ImageProps = {
50
51
  element: ImageOrSVGElementType;
51
52
  };
52
53
  export declare const setImageLoaderHook: (customImageLoaderHook: any) => void;
53
- export declare const useCanvasImage: (src: string, crossOrigin?: "anonymous" | "use-credentials") => [HTMLImageElement | undefined, import("./use-image.js").ImageStatus];
54
+ export declare const useCanvasImage: (src: string, crossOrigin?: "anonymous" | "use-credentials") => [HTMLImageElement | undefined, ImageStatus];
55
+ export declare const useClipImage: (src: string) => readonly [HTMLImageElement | undefined, ImageStatus];
54
56
  export declare const useImageLoader: (status: string, src?: string, id?: string) => void;
55
- export declare const ImageElement: (({ element, store }: ImageProps) => React.JSX.Element) & {
56
- displayName: string;
57
+ export declare const ImageElement: (({ element, store }: ImageProps) => React.JSX.Element) & React.NamedExoticComponent<ImageProps> & {
58
+ readonly type: ({ element, store }: ImageProps) => React.JSX.Element;
57
59
  };
58
60
  export {};