@pqina/pintura 8.57.5

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 (258) hide show
  1. package/README.md +7 -0
  2. package/locale/de_DE/annotate/de_DE.js +5 -0
  3. package/locale/de_DE/annotate/index.js +1 -0
  4. package/locale/de_DE/core/de_DE.js +210 -0
  5. package/locale/de_DE/core/index.js +1 -0
  6. package/locale/de_DE/crop/de_DE.js +54 -0
  7. package/locale/de_DE/crop/index.js +1 -0
  8. package/locale/de_DE/decorate/de_DE.js +5 -0
  9. package/locale/de_DE/decorate/index.js +1 -0
  10. package/locale/de_DE/fill/de_DE.js +12 -0
  11. package/locale/de_DE/fill/index.js +1 -0
  12. package/locale/de_DE/filter/de_DE.js +19 -0
  13. package/locale/de_DE/filter/index.js +1 -0
  14. package/locale/de_DE/finetune/de_DE.js +14 -0
  15. package/locale/de_DE/finetune/index.js +1 -0
  16. package/locale/de_DE/frame/de_DE.js +17 -0
  17. package/locale/de_DE/frame/index.js +1 -0
  18. package/locale/de_DE/index.js +28 -0
  19. package/locale/de_DE/redact/de_DE.js +4 -0
  20. package/locale/de_DE/redact/index.js +1 -0
  21. package/locale/de_DE/resize/de_DE.js +19 -0
  22. package/locale/de_DE/resize/index.js +1 -0
  23. package/locale/de_DE/sticker/de_DE.js +5 -0
  24. package/locale/de_DE/sticker/index.js +1 -0
  25. package/locale/de_DE/trim/de_DE.js +54 -0
  26. package/locale/de_DE/trim/index.js +1 -0
  27. package/locale/en_GB/annotate/en_GB.js +5 -0
  28. package/locale/en_GB/annotate/index.js +1 -0
  29. package/locale/en_GB/core/en_GB.js +209 -0
  30. package/locale/en_GB/core/index.js +1 -0
  31. package/locale/en_GB/crop/en_GB.js +54 -0
  32. package/locale/en_GB/crop/index.js +1 -0
  33. package/locale/en_GB/decorate/en_GB.js +5 -0
  34. package/locale/en_GB/decorate/index.js +1 -0
  35. package/locale/en_GB/fill/en_GB.js +12 -0
  36. package/locale/en_GB/fill/index.js +1 -0
  37. package/locale/en_GB/filter/en_GB.js +18 -0
  38. package/locale/en_GB/filter/index.js +1 -0
  39. package/locale/en_GB/finetune/en_GB.js +14 -0
  40. package/locale/en_GB/finetune/index.js +1 -0
  41. package/locale/en_GB/frame/en_GB.js +17 -0
  42. package/locale/en_GB/frame/index.js +1 -0
  43. package/locale/en_GB/index.js +28 -0
  44. package/locale/en_GB/redact/en_GB.js +4 -0
  45. package/locale/en_GB/redact/index.js +1 -0
  46. package/locale/en_GB/resize/en_GB.js +19 -0
  47. package/locale/en_GB/resize/index.js +1 -0
  48. package/locale/en_GB/sticker/en_GB.js +5 -0
  49. package/locale/en_GB/sticker/index.js +1 -0
  50. package/locale/en_GB/trim/en_GB.js +54 -0
  51. package/locale/en_GB/trim/index.js +1 -0
  52. package/locale/es_ES/annotate/es_ES.js +5 -0
  53. package/locale/es_ES/annotate/index.js +1 -0
  54. package/locale/es_ES/core/es_ES.js +206 -0
  55. package/locale/es_ES/core/index.js +1 -0
  56. package/locale/es_ES/crop/es_ES.js +54 -0
  57. package/locale/es_ES/crop/index.js +1 -0
  58. package/locale/es_ES/decorate/es_ES.js +5 -0
  59. package/locale/es_ES/decorate/index.js +1 -0
  60. package/locale/es_ES/fill/es_ES.js +12 -0
  61. package/locale/es_ES/fill/index.js +1 -0
  62. package/locale/es_ES/filter/es_ES.js +18 -0
  63. package/locale/es_ES/filter/index.js +1 -0
  64. package/locale/es_ES/finetune/es_ES.js +14 -0
  65. package/locale/es_ES/finetune/index.js +1 -0
  66. package/locale/es_ES/frame/es_ES.js +17 -0
  67. package/locale/es_ES/frame/index.js +1 -0
  68. package/locale/es_ES/index.js +28 -0
  69. package/locale/es_ES/redact/es_ES.js +4 -0
  70. package/locale/es_ES/redact/index.js +1 -0
  71. package/locale/es_ES/resize/es_ES.js +19 -0
  72. package/locale/es_ES/resize/index.js +1 -0
  73. package/locale/es_ES/sticker/es_ES.js +5 -0
  74. package/locale/es_ES/sticker/index.js +1 -0
  75. package/locale/es_ES/trim/es_ES.js +55 -0
  76. package/locale/es_ES/trim/index.js +1 -0
  77. package/locale/fr_FR/annotate/fr_FR.js +5 -0
  78. package/locale/fr_FR/annotate/index.js +1 -0
  79. package/locale/fr_FR/core/fr_FR.js +207 -0
  80. package/locale/fr_FR/core/index.js +1 -0
  81. package/locale/fr_FR/crop/fr_FR.js +54 -0
  82. package/locale/fr_FR/crop/index.js +1 -0
  83. package/locale/fr_FR/decorate/fr_FR.js +5 -0
  84. package/locale/fr_FR/decorate/index.js +1 -0
  85. package/locale/fr_FR/fill/fr_FR.js +12 -0
  86. package/locale/fr_FR/fill/index.js +1 -0
  87. package/locale/fr_FR/filter/fr_FR.js +18 -0
  88. package/locale/fr_FR/filter/index.js +1 -0
  89. package/locale/fr_FR/finetune/fr_FR.js +14 -0
  90. package/locale/fr_FR/finetune/index.js +1 -0
  91. package/locale/fr_FR/frame/fr_FR.js +17 -0
  92. package/locale/fr_FR/frame/index.js +1 -0
  93. package/locale/fr_FR/index.js +28 -0
  94. package/locale/fr_FR/redact/fr_FR.js +4 -0
  95. package/locale/fr_FR/redact/index.js +1 -0
  96. package/locale/fr_FR/resize/fr_FR.js +19 -0
  97. package/locale/fr_FR/resize/index.js +1 -0
  98. package/locale/fr_FR/sticker/fr_FR.js +5 -0
  99. package/locale/fr_FR/sticker/index.js +1 -0
  100. package/locale/fr_FR/trim/fr_FR.js +55 -0
  101. package/locale/fr_FR/trim/index.js +1 -0
  102. package/locale/hi_IN/annotate/hi_IN.js +5 -0
  103. package/locale/hi_IN/annotate/index.js +1 -0
  104. package/locale/hi_IN/core/hi_IN.js +210 -0
  105. package/locale/hi_IN/core/index.js +1 -0
  106. package/locale/hi_IN/crop/hi_IN.js +54 -0
  107. package/locale/hi_IN/crop/index.js +1 -0
  108. package/locale/hi_IN/decorate/hi_IN.js +5 -0
  109. package/locale/hi_IN/decorate/index.js +1 -0
  110. package/locale/hi_IN/fill/hi_IN.js +12 -0
  111. package/locale/hi_IN/fill/index.js +1 -0
  112. package/locale/hi_IN/filter/hi_IN.js +18 -0
  113. package/locale/hi_IN/filter/index.js +1 -0
  114. package/locale/hi_IN/finetune/hi_IN.js +14 -0
  115. package/locale/hi_IN/finetune/index.js +1 -0
  116. package/locale/hi_IN/frame/hi_IN.js +17 -0
  117. package/locale/hi_IN/frame/index.js +1 -0
  118. package/locale/hi_IN/index.js +28 -0
  119. package/locale/hi_IN/redact/hi_IN.js +4 -0
  120. package/locale/hi_IN/redact/index.js +1 -0
  121. package/locale/hi_IN/resize/hi_IN.js +19 -0
  122. package/locale/hi_IN/resize/index.js +1 -0
  123. package/locale/hi_IN/sticker/hi_IN.js +5 -0
  124. package/locale/hi_IN/sticker/index.js +1 -0
  125. package/locale/hi_IN/trim/hi_IN.js +54 -0
  126. package/locale/hi_IN/trim/index.js +1 -0
  127. package/locale/it_IT/annotate/index.js +1 -0
  128. package/locale/it_IT/annotate/it_IT.js +5 -0
  129. package/locale/it_IT/core/index.js +1 -0
  130. package/locale/it_IT/core/it_IT.js +207 -0
  131. package/locale/it_IT/crop/index.js +1 -0
  132. package/locale/it_IT/crop/it_IT.js +54 -0
  133. package/locale/it_IT/decorate/index.js +1 -0
  134. package/locale/it_IT/decorate/it_IT.js +5 -0
  135. package/locale/it_IT/fill/index.js +1 -0
  136. package/locale/it_IT/fill/it_IT.js +12 -0
  137. package/locale/it_IT/filter/index.js +1 -0
  138. package/locale/it_IT/filter/it_IT.js +19 -0
  139. package/locale/it_IT/finetune/index.js +1 -0
  140. package/locale/it_IT/finetune/it_IT.js +14 -0
  141. package/locale/it_IT/frame/index.js +1 -0
  142. package/locale/it_IT/frame/it_IT.js +17 -0
  143. package/locale/it_IT/index.js +28 -0
  144. package/locale/it_IT/redact/index.js +1 -0
  145. package/locale/it_IT/redact/it_IT.js +4 -0
  146. package/locale/it_IT/resize/index.js +1 -0
  147. package/locale/it_IT/resize/it_IT.js +19 -0
  148. package/locale/it_IT/sticker/index.js +1 -0
  149. package/locale/it_IT/sticker/it_IT.js +5 -0
  150. package/locale/it_IT/trim/index.js +1 -0
  151. package/locale/it_IT/trim/it_IT.js +54 -0
  152. package/locale/nl_NL/annotate/index.js +1 -0
  153. package/locale/nl_NL/annotate/nl_NL.js +5 -0
  154. package/locale/nl_NL/core/index.js +1 -0
  155. package/locale/nl_NL/core/nl_NL.js +208 -0
  156. package/locale/nl_NL/crop/index.js +1 -0
  157. package/locale/nl_NL/crop/nl_NL.js +54 -0
  158. package/locale/nl_NL/decorate/index.js +1 -0
  159. package/locale/nl_NL/decorate/nl_NL.js +5 -0
  160. package/locale/nl_NL/fill/index.js +1 -0
  161. package/locale/nl_NL/fill/nl_NL.js +12 -0
  162. package/locale/nl_NL/filter/index.js +1 -0
  163. package/locale/nl_NL/filter/nl_NL.js +18 -0
  164. package/locale/nl_NL/finetune/index.js +1 -0
  165. package/locale/nl_NL/finetune/nl_NL.js +14 -0
  166. package/locale/nl_NL/frame/index.js +1 -0
  167. package/locale/nl_NL/frame/nl_NL.js +17 -0
  168. package/locale/nl_NL/index.js +28 -0
  169. package/locale/nl_NL/redact/index.js +1 -0
  170. package/locale/nl_NL/redact/nl_NL.js +4 -0
  171. package/locale/nl_NL/resize/index.js +1 -0
  172. package/locale/nl_NL/resize/nl_NL.js +19 -0
  173. package/locale/nl_NL/sticker/index.js +1 -0
  174. package/locale/nl_NL/sticker/nl_NL.js +5 -0
  175. package/locale/nl_NL/trim/index.js +1 -0
  176. package/locale/nl_NL/trim/nl_NL.js +55 -0
  177. package/locale/ru_RU/annotate/index.js +1 -0
  178. package/locale/ru_RU/annotate/ru_RU.js +5 -0
  179. package/locale/ru_RU/core/index.js +1 -0
  180. package/locale/ru_RU/core/ru_RU.js +206 -0
  181. package/locale/ru_RU/crop/index.js +1 -0
  182. package/locale/ru_RU/crop/ru_RU.js +54 -0
  183. package/locale/ru_RU/decorate/index.js +1 -0
  184. package/locale/ru_RU/decorate/ru_RU.js +5 -0
  185. package/locale/ru_RU/fill/index.js +1 -0
  186. package/locale/ru_RU/fill/ru_RU.js +12 -0
  187. package/locale/ru_RU/filter/index.js +1 -0
  188. package/locale/ru_RU/filter/ru_RU.js +18 -0
  189. package/locale/ru_RU/finetune/index.js +1 -0
  190. package/locale/ru_RU/finetune/ru_RU.js +14 -0
  191. package/locale/ru_RU/frame/index.js +1 -0
  192. package/locale/ru_RU/frame/ru_RU.js +17 -0
  193. package/locale/ru_RU/index.js +28 -0
  194. package/locale/ru_RU/redact/index.js +1 -0
  195. package/locale/ru_RU/redact/ru_RU.js +4 -0
  196. package/locale/ru_RU/resize/index.js +1 -0
  197. package/locale/ru_RU/resize/ru_RU.js +19 -0
  198. package/locale/ru_RU/sticker/index.js +1 -0
  199. package/locale/ru_RU/sticker/ru_RU.js +5 -0
  200. package/locale/ru_RU/trim/index.js +1 -0
  201. package/locale/ru_RU/trim/ru_RU.js +54 -0
  202. package/locale/sv_SE/annotate/index.js +1 -0
  203. package/locale/sv_SE/annotate/sv_SE.js +5 -0
  204. package/locale/sv_SE/core/index.js +1 -0
  205. package/locale/sv_SE/core/sv_SE.js +209 -0
  206. package/locale/sv_SE/crop/index.js +1 -0
  207. package/locale/sv_SE/crop/sv_SE.js +54 -0
  208. package/locale/sv_SE/decorate/index.js +1 -0
  209. package/locale/sv_SE/decorate/sv_SE.js +5 -0
  210. package/locale/sv_SE/fill/index.js +1 -0
  211. package/locale/sv_SE/fill/sv_SE.js +12 -0
  212. package/locale/sv_SE/filter/index.js +1 -0
  213. package/locale/sv_SE/filter/sv_SE.js +18 -0
  214. package/locale/sv_SE/finetune/index.js +1 -0
  215. package/locale/sv_SE/finetune/sv_SE.js +14 -0
  216. package/locale/sv_SE/frame/index.js +1 -0
  217. package/locale/sv_SE/frame/sv_SE.js +17 -0
  218. package/locale/sv_SE/index.js +28 -0
  219. package/locale/sv_SE/redact/index.js +1 -0
  220. package/locale/sv_SE/redact/sv_SE.js +4 -0
  221. package/locale/sv_SE/resize/index.js +1 -0
  222. package/locale/sv_SE/resize/sv_SE.js +19 -0
  223. package/locale/sv_SE/sticker/index.js +1 -0
  224. package/locale/sv_SE/sticker/sv_SE.js +5 -0
  225. package/locale/sv_SE/trim/index.js +1 -0
  226. package/locale/sv_SE/trim/sv_SE.js +54 -0
  227. package/locale/zh_CN/annotate/index.js +1 -0
  228. package/locale/zh_CN/annotate/zh_CN.js +5 -0
  229. package/locale/zh_CN/core/index.js +1 -0
  230. package/locale/zh_CN/core/zh_CN.js +206 -0
  231. package/locale/zh_CN/crop/index.js +1 -0
  232. package/locale/zh_CN/crop/zh_CN.js +54 -0
  233. package/locale/zh_CN/decorate/index.js +1 -0
  234. package/locale/zh_CN/decorate/zh_CN.js +5 -0
  235. package/locale/zh_CN/fill/index.js +1 -0
  236. package/locale/zh_CN/fill/zh_CN.js +12 -0
  237. package/locale/zh_CN/filter/index.js +1 -0
  238. package/locale/zh_CN/filter/zh_CN.js +18 -0
  239. package/locale/zh_CN/finetune/index.js +1 -0
  240. package/locale/zh_CN/finetune/zh_CN.js +14 -0
  241. package/locale/zh_CN/frame/index.js +1 -0
  242. package/locale/zh_CN/frame/zh_CN.js +17 -0
  243. package/locale/zh_CN/index.js +28 -0
  244. package/locale/zh_CN/redact/index.js +1 -0
  245. package/locale/zh_CN/redact/zh_CN.js +4 -0
  246. package/locale/zh_CN/resize/index.js +1 -0
  247. package/locale/zh_CN/resize/zh_CN.js +19 -0
  248. package/locale/zh_CN/sticker/index.js +1 -0
  249. package/locale/zh_CN/sticker/zh_CN.js +5 -0
  250. package/locale/zh_CN/trim/index.js +1 -0
  251. package/locale/zh_CN/trim/zh_CN.js +54 -0
  252. package/package.json +10 -0
  253. package/pintura-iife.js +11 -0
  254. package/pintura-umd.js +11 -0
  255. package/pintura.css +10 -0
  256. package/pintura.d.ts +1354 -0
  257. package/pintura.js +11 -0
  258. package/pintura.module.css +10 -0
package/pintura.d.ts ADDED
@@ -0,0 +1,1354 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ export type ProgressCallback = (event: ProgressEvent) => void;
3
+
4
+ export type Percentage = string;
5
+
6
+ export interface PinturaMetadata {
7
+ [key: string]: any;
8
+ }
9
+
10
+ // prettier-ignore
11
+ /**
12
+ * A matrix of 20 digits based on the SVG <feColorMatrix> filter
13
+ *
14
+ * @example
15
+ * ```
16
+ * R G B A W
17
+ * R | 1 0 0 0 0
18
+ * G | 0 1 0 0 0
19
+ * B | 0 0 1 0 0
20
+ * A | 0 0 0 1 0
21
+ * ```
22
+ * @link Utility to generate a color matrix: https://fecolormatrix.com
23
+ * @link More information on color matrices: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feColorMatrix
24
+ */
25
+ export type ColorMatrix = [
26
+ number, number, number, number, number,
27
+ number, number, number, number, number,
28
+ number, number, number, number, number,
29
+ number, number, number, number, number
30
+ ];
31
+
32
+ // prettier-ignore
33
+ /**
34
+ * A matrix of 9 digits based on the SVG <feConvolveMatrix> filter
35
+ *
36
+ * @example
37
+ * ```
38
+ * 1 0 0
39
+ * 0 1 0
40
+ * 0 0 1
41
+ * ```
42
+ * @link More information on convolution matrices: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feConvolveMatrix
43
+ */
44
+ export type ConvolutionMatrix = [
45
+ number, number, number,
46
+ number, number, number,
47
+ number, number, number
48
+ ];
49
+
50
+ export type Color = number[];
51
+
52
+ export type TextAlign = 'left' | 'center' | 'right';
53
+
54
+ export type TextLayout = 'auto-width' | 'auto-height' | 'fixed-size';
55
+
56
+ export type SizeCategory =
57
+ | 'extraSmall'
58
+ | 'small'
59
+ | 'mediumSmall'
60
+ | 'medium'
61
+ | 'mediumLarge'
62
+ | 'large'
63
+ | 'extraLarge';
64
+
65
+ export type LineEndStyle =
66
+ | 'bar'
67
+ | 'arrow'
68
+ | 'arrowSolid'
69
+ | 'circle'
70
+ | 'circleSolid'
71
+ | 'square'
72
+ | 'squareSolid';
73
+
74
+ export interface ColorPalette {
75
+ transparent?: Color;
76
+ white?: Color;
77
+ silver?: Color;
78
+ gray?: Color;
79
+ black?: Color;
80
+ navy?: Color;
81
+ blue?: Color;
82
+ aqua?: Color;
83
+ teal?: Color;
84
+ olive?: Color;
85
+ green?: Color;
86
+ yellow?: Color;
87
+ orange?: Color;
88
+ red?: Color;
89
+ maroon?: Color;
90
+ fuchsia?: Color;
91
+ purple?: Color;
92
+ }
93
+
94
+ export type SizeCategories = Record<SizeCategory, Percentage | number>;
95
+
96
+ export interface LocaleCollection {
97
+ [shapeProperty: string]: string;
98
+ }
99
+
100
+ export type LocaleString = string | ((locale: LocaleCollection) => string);
101
+
102
+ export interface Vector {
103
+ x: number;
104
+ y: number;
105
+ }
106
+
107
+ export interface Size {
108
+ width: number;
109
+ height: number;
110
+ }
111
+
112
+ export interface Rect {
113
+ x: number;
114
+ y: number;
115
+ width: number;
116
+ height: number;
117
+ }
118
+
119
+ export interface ShapeToolOptions {
120
+ position?: string;
121
+ inputMode?: string;
122
+ }
123
+
124
+ export interface ShapeRectangle {
125
+ x?: number | Percentage;
126
+ y?: number | Percentage;
127
+ width?: number | Percentage;
128
+ height?: number | Percentage;
129
+ }
130
+
131
+ export interface Shape {
132
+ x?: number | Percentage;
133
+ y?: number | Percentage;
134
+ width?: number | Percentage;
135
+ height?: number | Percentage;
136
+ left?: number | Percentage;
137
+ top?: number | Percentage;
138
+ right?: number | Percentage;
139
+ bottom?: number | Percentage;
140
+ rx?: number | Percentage;
141
+ ry?: number | Percentage;
142
+ x1?: number | Percentage;
143
+ y1?: number | Percentage;
144
+ x2?: number | Percentage;
145
+ y2?: number | Percentage;
146
+ strokeColor?: Color;
147
+ strokeWidth?: number | Percentage;
148
+ cornerRadius?: number | Percentage;
149
+ fontSize?: number | Percentage;
150
+ fontFamily?: string;
151
+ lineHeight?: number | Percentage;
152
+ textAlign?: undefined | 'left' | 'center' | 'right';
153
+ text?: string;
154
+ aspectRatio?: number;
155
+ rotation?: number;
156
+ points?: Vector[];
157
+ color?: Color;
158
+ backgroundColor?: Color;
159
+ backgroundImage?: string | HTMLCanvasElement | File | Blob | HTMLImageElement;
160
+ backgroundSize?: string | Size;
161
+ eraseRadius?: number;
162
+ lineStart?:
163
+ | undefined
164
+ | 'bar'
165
+ | 'arrow'
166
+ | 'arrow-solid'
167
+ | 'square'
168
+ | 'square-solid'
169
+ | 'circle'
170
+ | 'circle-solid';
171
+ lineEnd?:
172
+ | undefined
173
+ | 'bar'
174
+ | 'arrow'
175
+ | 'arrow-solid'
176
+ | 'square'
177
+ | 'square-solid'
178
+ | 'circle'
179
+ | 'circle-solid';
180
+ isSelected?: boolean;
181
+ isEditing?: boolean;
182
+ disableStyle?: boolean | string[];
183
+ disableErase?: boolean;
184
+ disableSelect?: boolean;
185
+ disableRemove?: boolean;
186
+ disableDuplicate?: boolean;
187
+ disableReorder?: boolean;
188
+ disableFlip?: boolean;
189
+ disableInput?: boolean | ((text: string) => string);
190
+ disableManipulate?: boolean;
191
+ disableMove?: boolean;
192
+ disableResize?: boolean;
193
+ disableRotate?: boolean;
194
+ disableTextLayout?: boolean | TextLayout[];
195
+ disableNewline?: boolean;
196
+
197
+ // private
198
+ readonly _context?: Rect | Size;
199
+ readonly _isDraft?: boolean;
200
+ readonly _isComplete?: boolean;
201
+ readonly _isError?: boolean;
202
+ readonly _isLoading?: boolean;
203
+ readonly _isFormatted?: boolean;
204
+ }
205
+
206
+ export type SvelteComponent = any;
207
+ export type SvelteComponentProps = any;
208
+
209
+ export type ShapeControl = [
210
+ // Component to use
211
+ SvelteComponent,
212
+
213
+ // Component properties to map
214
+ {
215
+ title?: LocaleString;
216
+ label?: LocaleString;
217
+ options?: SvelteComponentProps;
218
+ optionIconStyle?: LocaleString;
219
+ optionLabelStyle?: LocaleString;
220
+ }
221
+ ];
222
+
223
+ export type ShapeColorOption = [Color, string] | [Color, string, any];
224
+ export type ShapeSizeOption = [number | Percentage, string] | [number | Percentage, string, any];
225
+
226
+ export type ShapeLineEndOption = [LineEndStyle, string] | [LineEndStyle, string, any];
227
+ export type ShapeFontFamilyOption = [string, string] | [string, string, any];
228
+ export type ShapeFontStyleOption = [string, string] | [string, string, any];
229
+
230
+ export interface ShapeControlOptions {
231
+ colorOptions?: false | ShapeColorOption[];
232
+ lineEndStyleOptions?: false | ShapeLineEndOption[];
233
+ fontFamilyOptions?: false | ShapeFontFamilyOption[];
234
+ fontStyleOptions?: false | ShapeFontStyleOption[];
235
+ textAlignOptions?: false | [TextAlign, string][];
236
+ strokeWidthOptions?: false | ShapeSizeOption[] | number[];
237
+ fontSizeOptions?: false | ShapeSizeOption[] | number[];
238
+ lineHeightOptions?: false | ShapeSizeOption[] | number[];
239
+ }
240
+
241
+ export interface ShapeControlConfiguration {
242
+ // A mapping of a shapeProperty to a Component
243
+ [shapeProperty: string]: ShapeControl;
244
+ }
245
+
246
+ export type StickerSource = string; // emoji or URL
247
+
248
+ export interface StickerTemplate {
249
+ thumb?: StickerSource;
250
+ src?: StickerSource;
251
+ width?: number;
252
+ height?: number;
253
+ alt?: string;
254
+ disabled?: boolean;
255
+ shape?: Shape;
256
+ mount?: (
257
+ element: HTMLElement,
258
+ sticker: StickerTemplate
259
+ ) => { update?: (sticker: StickerTemplate) => void; destroy?: () => void };
260
+ }
261
+
262
+ export type Sticker = StickerSource | StickerTemplate;
263
+
264
+ export interface StickerGroupOptions {
265
+ icon?: string;
266
+ hideLabel?: boolean;
267
+ disabled?: boolean;
268
+ }
269
+
270
+ export type StickerGroup = [string, Sticker[]] | [string, Sticker[], StickerGroupOptions];
271
+
272
+ export type ImageSource = File | Blob | string | HTMLImageElement | HTMLCanvasElement;
273
+
274
+ export interface Store {
275
+ subscribe: (value: (value: any) => void) => () => void;
276
+ set?: (value: any) => void;
277
+ update?: (fn: (value: any) => any) => void;
278
+ }
279
+
280
+ export interface StoreCollection {
281
+ [shapeProperty: string]: Store;
282
+ }
283
+
284
+ export type Filter = () => ColorMatrix;
285
+
286
+ export interface Frame {
287
+ shape: any;
288
+ thumb: string; // HTML or SVG
289
+ }
290
+
291
+ export interface Effect {
292
+ base: number;
293
+ min: number;
294
+ max: number;
295
+ getLabel?: (value: number) => number;
296
+ getStore: (stores: StoreCollection) => Store;
297
+ getValue: (store: Store) => number;
298
+ setValue: (store: Store, value: number) => void;
299
+ }
300
+
301
+ export interface PinturaEditorHistoryAPI {
302
+ undo: () => number;
303
+ redo: () => number;
304
+ revert: () => void;
305
+ write: (imageState?: PinturaImageState) => void;
306
+ get: () => PinturaImageState[];
307
+ getCollapsed: () => PinturaImageState[];
308
+ set: (imageStates: PinturaImageState[]) => void;
309
+ readonly length: number;
310
+ readonly index: number;
311
+ }
312
+
313
+ export interface PinturaEditorMethods {
314
+ on: (event: string, cb: (detail?: any) => void) => void;
315
+ loadImage: (
316
+ src: ImageSource,
317
+ options?: PinturaEditorOptions
318
+ ) => Promise<PinturaDefaultImageReaderResult>;
319
+ editImage: (
320
+ src: ImageSource,
321
+ options?: PinturaEditorOptions
322
+ ) => Promise<PinturaDefaultImageWriterResult>;
323
+ processImage: (
324
+ src?: ImageSource,
325
+ options?: PinturaEditorOptions
326
+ ) => Promise<PinturaDefaultImageWriterResult>;
327
+ abortLoadImage: () => void;
328
+ abortProcessImage: () => void;
329
+ updateImage: (src: ImageSource) => Promise<PinturaDefaultImageReaderResult>;
330
+ updateImagePreview: (src: ImageSource) => void;
331
+ removeImage: () => void;
332
+ close: () => void;
333
+ destroy: () => void;
334
+ readonly history: PinturaEditorHistoryAPI;
335
+ }
336
+
337
+ export type CropOption = [number | undefined, string];
338
+
339
+ export type SizeOption = [[number, number], string];
340
+
341
+ export type CropPresetOption = CropOption | SizeOption;
342
+
343
+ export type OptionGroup = [string, any[]] | [string, any[], any];
344
+
345
+ export interface CropPluginOptions {
346
+ cropAutoCenterImageSelectionTimeout?: undefined | number;
347
+ cropWillRenderImageSelectionGuides?:
348
+ | undefined
349
+ | ((
350
+ interaction: string,
351
+ interactionFraction: number
352
+ ) => { rows: number; cols: number; opacity: number });
353
+ cropEnableButtonFlipHorizontal?: boolean;
354
+ cropEnableButtonFlipVertical?: boolean;
355
+ cropEnableButtonRotateLeft?: boolean;
356
+ cropEnableButtonRotateRight?: boolean;
357
+ cropEnableButtonToggleCropLimit?: boolean;
358
+ cropEnableCenterImageSelection?: boolean;
359
+ cropEnableImageSelection?: boolean;
360
+ cropEnableInfoIndicator?: boolean;
361
+ cropEnableLimitWheelInputToCropSelection?: boolean;
362
+
363
+ /**
364
+ * Range in radians, defaults to Math.PI / 4
365
+ */
366
+ cropEnableRotationInput?: boolean;
367
+ cropRotationRange?: number;
368
+ cropActiveTransformTool?: 'zoom' | 'rotation';
369
+ cropEnableSelectPreset?: boolean;
370
+ cropEnableZoomInput?: boolean;
371
+ cropEnableZoomMatchImageAspectRatio?: boolean;
372
+ cropEnableZoomTowardsWheelPosition?: boolean;
373
+ cropEnableZoomAutoHide?: boolean;
374
+ cropImageSelectionCornerStyle?: undefined | 'hook' | 'round' | 'invisible';
375
+ cropSelectPresetOptions?: OptionGroup[] | CropPresetOption[];
376
+ cropSelectPresetFilter?: 'landscape' | 'portrait' | false;
377
+ cropEnableRotateMatchImageAspectRatio?: 'never' | 'custom' | 'always';
378
+ cropWillRenderTools?: (nodes: PinturaNode[], env: any, redraw: () => void) => PinturaNode[];
379
+ cropInteractionFocus?: 'image' | 'selection';
380
+ cropMinimizeToolbar?: 'never' | 'auto' | 'always';
381
+ }
382
+
383
+ export interface ShapeToolButtonOptions {
384
+ icon?: string;
385
+ }
386
+
387
+ export type ShapeTool = [string, LocaleString] | [string, LocaleString, ShapeToolButtonOptions];
388
+
389
+ export interface PinturaMarkupEditorProperties {
390
+ markupEditorToolbar?: [string, LocaleString, any][];
391
+ markupEditorToolStyles?: MarkupEditorToolStyleDefaults;
392
+ markupEditorToolRetainStyles?: boolean;
393
+ markupEditorShapeStyleControls?: MarkupEditorShapeStyleControlDefaults;
394
+ markupEditorToolSelectRadius?: number;
395
+
396
+ /**
397
+ * Set to `'modal'` to show a text input popup, set to `'inline'` to enable inline text editing.
398
+ */
399
+ markupEditorTextInputMode?: 'modal' | 'inline';
400
+
401
+ /**
402
+ * Enable to automatically add a shape when a tool is selected
403
+ */
404
+ enableSelectToolToAddShape?: boolean;
405
+
406
+ /**
407
+ * Enable to tap canvas to add text box instead of dragging
408
+ */
409
+ enableTapToAddText?: boolean;
410
+
411
+ /**
412
+ * Enable to show the move/arrow, used to select and manipulate shapes
413
+ */
414
+ enableMoveTool?: boolean;
415
+
416
+ /**
417
+ * Enable to show the hand/view tool, used to pan the canvas
418
+ */
419
+ enableViewTool?: boolean;
420
+
421
+ /**
422
+ * Wether to automatically select move tool when enabled, set to `true` to select for all tools, set to `false` to don't select, set to array of tool names to enable for specific tools only.
423
+ */
424
+ enableAutoSelectMoveTool?: boolean | string[];
425
+
426
+ /**
427
+ * @deprecated Use `enablePanInput` instead
428
+ */
429
+ markupEditorInteractionMode?: 'auto' | 'pan';
430
+
431
+ /**
432
+ * @deprecated Use `zoomLevel` instead
433
+ */
434
+ markupEditorZoomLevel?: number | undefined | null;
435
+
436
+ /**
437
+ * @deprecated Use `zoomPresetOptions` instead
438
+ */
439
+ markupEditorZoomLevels?: number[];
440
+
441
+ /**
442
+ * @deprecated Use `zoomAdjustStep` instead
443
+ */
444
+ markupEditorZoomAdjustStep?: number;
445
+
446
+ /**
447
+ * @deprecated Use `zoomAdjustFactor` instead
448
+ */
449
+ markupEditorZoomAdjustFactor?: number;
450
+
451
+ /**
452
+ * @deprecated Use `zoomAdjustWheelFactor` instead
453
+ */
454
+ markupEditorZoomAdjustWheelFactor?: number;
455
+
456
+ markupEditorWillStartInteraction?: (point: Vector, image: Rect) => boolean;
457
+ }
458
+
459
+ export interface AnnotatePluginOptions extends PinturaMarkupEditorProperties {
460
+ annotateTools?: [string, LocaleString, any][];
461
+ annotateToolShapes?: MarkupEditorToolStyleDefaults;
462
+ annotateShapeControls?: MarkupEditorShapeStyleControlDefaults;
463
+ annotateActiveTool?: string;
464
+ annotateEnableButtonFlipVertical?: boolean;
465
+ annotatePresets?: Sticker[] | StickerGroup[];
466
+ annotateEnableDropImagePreset?: boolean;
467
+ annotateEnableSelectImagePreset?: boolean;
468
+ }
469
+
470
+ export interface DecoratePluginOptions extends PinturaMarkupEditorProperties {
471
+ decorateTools?: [string, LocaleString, any][];
472
+ decorateToolShapes?: MarkupEditorToolStyleDefaults;
473
+ decorateShapeControls?: MarkupEditorShapeStyleControlDefaults;
474
+ decorateActiveTool?: string;
475
+ decorateEnableButtonFlipVertical?: boolean;
476
+ decoratePresets?: Sticker[] | StickerGroup[];
477
+ decorateEnableDropImagePreset?: boolean;
478
+ decorateEnableSelectImagePreset?: boolean;
479
+ }
480
+
481
+ export interface FilterPluginOptions {
482
+ filterFunctions?: { [key: string]: Filter };
483
+ filterOptions?: any;
484
+ }
485
+
486
+ export interface FinetunePluginOptions {
487
+ finetuneControlConfiguration?: { [key: string]: Effect };
488
+ finetuneOptions?: [string | undefined, LocaleString][];
489
+ }
490
+
491
+ export interface ResizePluginOptions {
492
+ resizeMaxSize?: Size;
493
+ resizeMinSize?: Size;
494
+ resizeSizePresetOptions?: OptionGroup[] | SizeOption[];
495
+ resizeWidthPresetOptions?: OptionGroup[] | SizeOption[];
496
+ resizeHeightPresetOptions?: OptionGroup[] | SizeOption[];
497
+ resizeWillRenderFooter?: (nodes: PinturaNode[], env: any, redraw: () => void) => PinturaNode[];
498
+ }
499
+
500
+ export interface FramePluginOptions {
501
+ frameStyles?: {
502
+ [key: string]: {
503
+ shape: {
504
+ frameStyle: string;
505
+ [key: string]: any;
506
+ };
507
+ thumb: string;
508
+ };
509
+ };
510
+ frameOptions?: [string | undefined, LocaleString][];
511
+ }
512
+
513
+ export interface FillPluginOptions {
514
+ fillOptions?: [string | undefined, LocaleString][];
515
+ }
516
+
517
+ export interface StickerPluginOptions {
518
+ stickers?: Sticker[] | StickerGroup[];
519
+ stickerStickToImage?: boolean;
520
+ stickerEnableDropImagePreset?: boolean;
521
+ stickerEnableSelectImagePreset?: boolean;
522
+ stickerEnableButtonFlipVertical?: boolean;
523
+ stickerWillRenderShapePresetToolbar?: (
524
+ nodes: PinturaNode[],
525
+ addPreset: (sticker: Sticker) => void,
526
+ env: any,
527
+ redraw: () => void
528
+ ) => PinturaNode[];
529
+
530
+ /**
531
+ * @deprecated Use `stickerEnableSelectImagePreset` instead
532
+ */
533
+ stickerEnableSelectImage?: boolean;
534
+
535
+ /**
536
+ * @deprecated Use `stickerEnableButtonFlipVerticalt instead
537
+ */
538
+ stickersEnableButtonFlipVertical?: boolean;
539
+
540
+ /**
541
+ * @deprecated Use `stickerWillRenderShapePresetToolbar` instead
542
+ */
543
+ stickersWillRenderShapePresetToolbar?: (
544
+ nodes: PinturaNode[],
545
+ addPreset: (sticker: Sticker) => void,
546
+ env: any,
547
+ redraw: () => void
548
+ ) => PinturaNode[];
549
+ }
550
+
551
+ export interface PinturaImageState {
552
+ annotation?: Shape[];
553
+ backgroundColor?: Color;
554
+ backgroundImage?: string | undefined;
555
+ colorMatrix?: ColorMatrix | undefined;
556
+ convolutionMatrix?: ConvolutionMatrix | undefined;
557
+ crop?: Rect;
558
+ cropAspectRatio?: number | undefined;
559
+ cropLimitToImage?: boolean;
560
+ cropMaxSize?: Size;
561
+ cropMinSize?: Size;
562
+ decoration?: Shape[];
563
+ duration?: number;
564
+ flipX?: boolean;
565
+ flipY?: boolean;
566
+ frame?: string | undefined;
567
+ gamma?: number | undefined;
568
+ metadata?: PinturaMetadata | undefined;
569
+ redaction?: ShapeRectangle[];
570
+ rotation?: number;
571
+ targetSize?: Size | undefined;
572
+ trim?: [number, number][] | undefined;
573
+ vignette?: number | undefined;
574
+ volume?: number | undefined;
575
+ }
576
+
577
+ export interface PinturaImageOptions extends PinturaImageState {
578
+ readonly size: Size;
579
+ readonly aspectRatio: number;
580
+ readonly cropSize: Size;
581
+ readonly cropRectAspectRatio: number;
582
+ readonly file: File;
583
+ readonly loadState: any;
584
+ readonly processState: any;
585
+ readonly rotationRange: [number, number];
586
+ state?: any;
587
+ }
588
+
589
+ export interface PinturaEditorImageOptionsReadonly {
590
+ readonly imageSize: Size;
591
+ readonly imageAspectRatio: number;
592
+ readonly imageCropSize: Size;
593
+ readonly imageCropRectAspectRatio: number;
594
+ readonly imageFile: File;
595
+ readonly imageLoadState: any;
596
+ readonly imageProcessState: any;
597
+ readonly imageRotationRange: [number, number];
598
+ }
599
+
600
+ export interface PinturaEditorImageOptions {
601
+ imageBackgroundColor?: Color;
602
+ imageBackgroundImage?: ImageSource;
603
+ imageColorMatrix?: ColorMatrix;
604
+ imageConvolutionMatrix?: ConvolutionMatrix;
605
+ imageCrop?: Rect;
606
+ imageCropAspectRatio?: number | undefined;
607
+ imageCropLimitToImage?: boolean;
608
+ imageCropMaxSize?: Size;
609
+ imageCropMinSize?: Size;
610
+ imageRedaction?: ShapeRectangle[];
611
+ imageAnnotation?: Shape[];
612
+ imageDecoration?: Shape[];
613
+ imageFlipX?: boolean;
614
+ imageFlipY?: boolean;
615
+ imageGamma?: number;
616
+ imageNoise?: number;
617
+ imageRotation?: number;
618
+ imageVignette?: number;
619
+ imageTargetSize?: Size;
620
+ imageTrim?: [number, number][];
621
+ imageFrame?:
622
+ | string
623
+ | {
624
+ [key: string]: any;
625
+ frameStyle: string;
626
+ };
627
+ imageMetadata?: PinturaMetadata;
628
+ imageState?: PinturaImageState;
629
+ }
630
+
631
+ export interface PinturaEditorOptionsReadonly {
632
+ readonly element?: HTMLElement;
633
+ readonly stores?: any[];
634
+ readonly images?: any;
635
+ }
636
+
637
+ export interface PinturaNodeOptions {
638
+ [key: string]: any;
639
+ }
640
+
641
+ export type PinturaComponent = 'Button' | 'Dropdown';
642
+
643
+ export type PinturaNodeType = string | SvelteComponent | PinturaComponent;
644
+
645
+ // ignore for TypeScript 3.x
646
+ // @ts-ignore
647
+ export type PinturaNode =
648
+ | [PinturaNodeType, string]
649
+ | [PinturaNodeType, string, PinturaNodeOptions]
650
+ | [PinturaNodeType, string, PinturaNode[]]
651
+ | [PinturaNodeType, string, PinturaNodeOptions, PinturaNode[]];
652
+
653
+ export type PinturaEditorStatus =
654
+ | string
655
+ | [string]
656
+ | [string, number]
657
+ | [string, false]
658
+ | undefined;
659
+
660
+ export interface PinturaEditorBaseOptions {
661
+ id?: string;
662
+ class?: string;
663
+ animations?: boolean;
664
+ src?: ImageSource;
665
+ util?: string;
666
+ utils?: string[];
667
+ disabled?: boolean;
668
+ status?: PinturaEditorStatus;
669
+ elasticityMultiplier?: number;
670
+ layoutDirectionPreference?: 'auto' | 'horizontal' | 'vertical';
671
+ layoutVerticalUtilsPreference?: 'left' | 'right';
672
+ layoutHorizontalUtilsPreference?: 'bottom' | 'top';
673
+ layoutVerticalControlGroupsPreference?: 'bottom' | 'top';
674
+ layoutVerticalControlTabsPreference?: 'bottom' | 'top';
675
+ layoutVerticalToolbarPreference?: 'bottom' | 'top';
676
+ imageSourceToImageData?: (src: any) => Promise<ImageData>;
677
+ previewImageData?: ImageBitmap | ImageData | HTMLCanvasElement;
678
+ previewImageDataMaxSize?: Size;
679
+ previewUpscale?: boolean;
680
+ previewPad?: boolean;
681
+ previewMaskOpacity?: number;
682
+ shapePreprocessor?: any;
683
+ enableCanvasAlpha?: boolean;
684
+ enableButtonClose?: boolean;
685
+ enableButtonExport?: boolean;
686
+ enableButtonResetHistory?: boolean;
687
+ enableButtonRevert?: boolean;
688
+ enableNavigateHistory?: boolean;
689
+ enableToolbar?: boolean;
690
+ enableUtils?: boolean;
691
+ enableDropImage?: boolean;
692
+ enablePasteImage?: boolean;
693
+ enableBrowseImage?: boolean;
694
+ willSetMediaInitialTimeOffset?: (duration: number, trim: [number, number][]) => number;
695
+ muteAudio?: boolean;
696
+
697
+ /**
698
+ * Enable to toggle zooming the canvas with multi-touch input and mouse wheel
699
+ */
700
+ enableZoom?: boolean;
701
+
702
+ /**
703
+ * Enable to show zoom controls
704
+ */
705
+ enableZoomControls?: boolean;
706
+
707
+ /**
708
+ * Enable to toggle panning the canvas, pan with two fingers or by holding spacebar
709
+ */
710
+ enablePan?: boolean;
711
+
712
+ /**
713
+ * Set to false to disable limiting pan input to the centered image bounds
714
+ */
715
+ enablePanLimit?: boolean;
716
+
717
+ /**
718
+ * Gutter scalar to add around the pan limit bounds, value between 0 and 1, 0 no gutter, 1 gutter size of centered image
719
+ */
720
+ panLimitGutterScalar?: number;
721
+
722
+ /**
723
+ * Set current zoom level or set undefined to fit to view, set null to let editor handle zoom level
724
+ */
725
+ zoomLevel?: number | undefined | null;
726
+ zoomPresetOptions?: number[];
727
+ zoomAdjustStep?: number;
728
+ zoomAdjustFactor?: number;
729
+ zoomAdjustWheelFactor?: number;
730
+
731
+ /**
732
+ * Set to `true` to enable pan mode programatically
733
+ */
734
+ enablePanInput?: boolean;
735
+
736
+ /**
737
+ * Enable zoom input mode
738
+ */
739
+ enableZoomInput?: boolean;
740
+
741
+ handleEvent?: (type: string, detail: any) => void;
742
+
743
+ willRequest?: (
744
+ url: string,
745
+ requestInfo: { resourceType: string }
746
+ ) => void | false | RequestInit;
747
+ willClose?: () => Promise<boolean>;
748
+ willRevert?: () => Promise<boolean>;
749
+ willProcessImage?: () => Promise<boolean>;
750
+ willRenderCanvas?: (
751
+ shapes: {
752
+ decorationShapes: Shape[];
753
+ annotationShapes: Shape[];
754
+ interfaceShapes: Shape[];
755
+ frameShapes: Shape;
756
+ },
757
+ state: {
758
+ annotationShapesDirty: boolean;
759
+ backgroundColor: number[];
760
+ blendShapesDirty: boolean;
761
+ decorationShapesDirty: boolean;
762
+ foregroundColor: number[];
763
+ frameShapesDirty: boolean;
764
+ images: {
765
+ backgroundColor: number[];
766
+ colorMatrix: number[];
767
+ convolutionMatrix: number[];
768
+ data: ImageBitmap | ImageData;
769
+ gamma: number;
770
+ opacity: number;
771
+ origin: Vector;
772
+ resize: number;
773
+ rotation: { x: number; y: number; z: number };
774
+ scale: number;
775
+ size: Size;
776
+ translation: Vector;
777
+ vignette: number;
778
+ };
779
+ isInteracting: boolean;
780
+ isInteractingFraction: number;
781
+ lineColor: number[];
782
+ opacity: number;
783
+ rootRect: Rect;
784
+ rotation: { x: number; y: number; z: number };
785
+ scale: number;
786
+ selectionRect: Rect;
787
+ size: Size;
788
+ stageRect: Rect;
789
+ utilVisibility: {
790
+ annotate: number;
791
+ crop: number;
792
+ decorate: number;
793
+ filter: number;
794
+ finetune: number;
795
+ frame: number;
796
+ redact: number;
797
+ resize: number;
798
+ };
799
+ }
800
+ ) => {
801
+ decorationShapes: Shape[];
802
+ annotationShapes: Shape[];
803
+ interfaceShapes: Shape[];
804
+ };
805
+ willSetHistoryInitialState?: (initialState: any) => any;
806
+ willRenderToolbar?: (nodes: PinturaNode[], env: any, redraw: () => void) => PinturaNode[];
807
+ beforeSelectShape?: (current: Shape | undefined, target: Shape) => boolean;
808
+ beforeDeselectShape?: (current: Shape, target: Shape | undefined) => boolean;
809
+ beforeAddShape?: (shape: Shape) => boolean;
810
+ beforeRemoveShape?: (shape: Shape) => boolean;
811
+ beforeUpdateShape?: (shape: Shape, props: any, context: Rect) => Shape;
812
+ willRenderShapeControls?: (nodes: PinturaNode[], shapeId: string) => PinturaNode[];
813
+ willRenderShapePresetToolbar?: (
814
+ nodes: PinturaNode[],
815
+ addPreset: (sticker: Sticker) => void,
816
+ env: any,
817
+ redraw: () => void
818
+ ) => PinturaNode[];
819
+
820
+ /**
821
+ * @deprecated Use `willRequest` instead
822
+ */
823
+ willRequestResource?: (url: string) => boolean;
824
+ }
825
+
826
+ export interface PinturaEditorOptions
827
+ extends PinturaEditorBaseOptions,
828
+ PinturaEditorImageOptions,
829
+ AnnotatePluginOptions,
830
+ CropPluginOptions,
831
+ DecoratePluginOptions,
832
+ FilterPluginOptions,
833
+ FinetunePluginOptions,
834
+ StickerPluginOptions,
835
+ FillPluginOptions {
836
+ locale: any;
837
+ imageReader: any;
838
+ imageWriter?: any;
839
+ imageOrienter?: any;
840
+ imageScrambler?: any;
841
+ }
842
+
843
+ export interface PinturaEditorDefaultOptions
844
+ extends PinturaEditorBaseOptions,
845
+ PinturaEditorImageOptions,
846
+ AnnotatePluginOptions,
847
+ CropPluginOptions,
848
+ DecoratePluginOptions,
849
+ FilterPluginOptions,
850
+ FinetunePluginOptions,
851
+ StickerPluginOptions,
852
+ FillPluginOptions {
853
+ locale?: any;
854
+ imageReader?: any;
855
+ imageWriter?: any;
856
+ imageOrienter?: any;
857
+ }
858
+
859
+ export interface PinturaEditorHeadlessOptions extends PinturaEditorImageOptions {
860
+ imageReader?: any;
861
+ imageWriter?: any;
862
+ imageScrambler?: any;
863
+ shapePreprocessor?: any;
864
+ }
865
+
866
+ export interface PinturaEditor
867
+ extends PinturaEditorMethods,
868
+ PinturaEditorOptions,
869
+ PinturaEditorOptionsReadonly,
870
+ PinturaEditorImageOptionsReadonly {}
871
+
872
+ export interface PinturaEditorModalOptions {
873
+ preventZoomViewport?: boolean;
874
+ preventScrollBodyIfNeeded?: boolean;
875
+ preventFooterOverlapIfNeeded?: boolean;
876
+ enableAutoHide?: boolean;
877
+ enableAutoDestroy?: boolean;
878
+ readonly modal?: HTMLElement;
879
+ }
880
+
881
+ export interface PinturaEditorModal extends PinturaEditor, PinturaEditorModalOptions {
882
+ show: () => void;
883
+ hide: () => void;
884
+ }
885
+
886
+ export interface PinturaReadState {
887
+ index: number;
888
+ task: string;
889
+ taskLengthComputable: boolean;
890
+ taskProgress: number;
891
+ timeStamp: number;
892
+ error?: unknown;
893
+ }
894
+
895
+ export interface PinturaWriteState {
896
+ index: number;
897
+ task: string;
898
+ taskLengthComputable: boolean;
899
+ taskProgress: number;
900
+ timeStamp: number;
901
+ error?: unknown;
902
+ }
903
+
904
+ // Default image reader and writer
905
+ export interface PinturaDefaultImageReaderResult {
906
+ readonly src: ImageSource;
907
+ readonly dest: File;
908
+ readonly size: Size;
909
+ readonly duration: number;
910
+ }
911
+
912
+ export interface PinturaDefaultImageWriterResult {
913
+ readonly src: ImageSource;
914
+ readonly dest: File;
915
+ readonly imageState: PinturaImageState;
916
+ readonly store: any;
917
+ }
918
+
919
+ export interface PinturaTargetSize {
920
+ width?: number;
921
+ height?: number;
922
+ fit?: 'contain' | 'cover' | 'force';
923
+ upscale?: boolean;
924
+ }
925
+
926
+ export interface PinturaDefaultImageReaderOptions {
927
+ orientImage?: boolean;
928
+ outputProps?: string[];
929
+ request?: {
930
+ headers?: { [key: string]: string };
931
+ credentials?: string;
932
+ };
933
+ preprocessImageFile?: (file: File, options: any, onprogress: ProgressCallback) => Promise<File>;
934
+ }
935
+
936
+ export type PinturaStoreField = [string, string] | [string, Blob | File, string];
937
+
938
+ export interface PinturaDefaultImageWriterOptions {
939
+ canvasMemoryLimit?: number;
940
+ orientImage?: boolean;
941
+ copyImageHead?: boolean;
942
+ mimeType?: string;
943
+ quality?: number;
944
+ format?: 'file' | 'imageData' | 'canvas';
945
+ renameFile?: (file: File) => string;
946
+ targetSize?: PinturaTargetSize;
947
+ imageDataResizer?: (imageData: ImageData, width: number, height: number) => Promise<ImageData>;
948
+ store?:
949
+ | string
950
+ | {
951
+ url: string;
952
+ dataset?: (imageState: PinturaImageState) => PinturaStoreField[];
953
+ credentials?: string;
954
+ headers?: { [key: string]: string };
955
+ }
956
+ | ((
957
+ imageState: PinturaImageState,
958
+ options: any,
959
+ onprogress: ProgressCallback
960
+ ) => Promise<any>);
961
+ outputProps?: string[];
962
+ preprocessImageSource?: (
963
+ imageSource: Blob | File,
964
+ options: any,
965
+ onprogress: ProgressCallback
966
+ ) => Promise<Blob | File>;
967
+ preprocessImageState?: (
968
+ imageState: PinturaImageState,
969
+ options: any,
970
+ onprogress: ProgressCallback
971
+ ) => Promise<any>;
972
+ postprocessImageData?: (
973
+ imageData: any,
974
+ options: any,
975
+ onprogress: ProgressCallback
976
+ ) => Promise<ImageData>;
977
+
978
+ postprocessImageBlob?: (
979
+ output: {
980
+ blob: Blob;
981
+ imageData: ImageData;
982
+ src: File;
983
+ },
984
+ options: any,
985
+ onprogress: ProgressCallback
986
+ ) => Promise<ImageData>;
987
+ }
988
+
989
+ export interface PinturaDefaultImageScramblerOptions {
990
+ dataSizeScalar?: number;
991
+ blurAmount?: number;
992
+ scrambleAmount?: number;
993
+ backgroundColor?: number[];
994
+ }
995
+
996
+ export interface PinturaImageOrienter {
997
+ read: (file: Blob | File, onprogress?: ProgressCallback) => Promise<number>;
998
+ apply: (imageData: ImageData, orientation: number) => ImageData;
999
+ }
1000
+
1001
+ // exports
1002
+ export const setPlugins: (...plugins: any[]) => void;
1003
+
1004
+ export const getEditorDefaults: (
1005
+ options?: PinturaEditorDefaultOptions
1006
+ ) => PinturaEditorDefaultOptions;
1007
+
1008
+ export const appendEditor: (
1009
+ target: HTMLElement | string,
1010
+ options?: PinturaEditorOptions
1011
+ ) => PinturaEditor;
1012
+
1013
+ export const appendDefaultEditor: (
1014
+ target: HTMLElement | string,
1015
+ options?: PinturaEditorDefaultOptions
1016
+ ) => PinturaEditor;
1017
+
1018
+ export const appendEditors: (
1019
+ target: HTMLElement | string,
1020
+ options?: PinturaEditorOptions
1021
+ ) => PinturaEditor[];
1022
+
1023
+ export const appendDefaultEditors: (
1024
+ target: HTMLElement | string,
1025
+ options?: PinturaEditorDefaultOptions
1026
+ ) => PinturaEditor[];
1027
+
1028
+ export const overlayEditor: (
1029
+ target: HTMLElement | string,
1030
+ options?: PinturaEditorOptions
1031
+ ) => PinturaEditor;
1032
+
1033
+ export const overlayDefaultEditor: (
1034
+ target: HTMLElement | string,
1035
+ options?: PinturaEditorDefaultOptions
1036
+ ) => PinturaEditor;
1037
+
1038
+ export const openEditor: (options: PinturaEditorOptions) => PinturaEditorModal;
1039
+
1040
+ export const openDefaultEditor: (options: PinturaEditorDefaultOptions) => PinturaEditorModal;
1041
+
1042
+ export const defineCustomElements: (options?: PinturaEditorOptions) => Promise<PinturaEditor>;
1043
+
1044
+ export const defineDefaultCustomElements: (
1045
+ options?: PinturaEditorDefaultOptions
1046
+ ) => Promise<PinturaEditor>;
1047
+
1048
+ export const processImage: (
1049
+ src: ImageSource,
1050
+ options: PinturaEditorHeadlessOptions
1051
+ ) => Promise<PinturaDefaultImageWriterResult>;
1052
+
1053
+ export const processDefaultImage: (
1054
+ src: ImageSource,
1055
+ options: PinturaEditorHeadlessOptions
1056
+ ) => Promise<PinturaDefaultImageWriterResult>;
1057
+
1058
+ export const createDefaultImageReader: (options?: PinturaDefaultImageReaderOptions) => any[];
1059
+
1060
+ export const createDefaultImageWriter: (options?: PinturaDefaultImageWriterOptions) => any[];
1061
+
1062
+ type WriterFunction = (
1063
+ src: File,
1064
+ imageState: PinturaImageState,
1065
+ genericOptions: any
1066
+ ) => unknown[] | undefined;
1067
+
1068
+ export const createDefaultMediaWriter: (options?: any, ...writers: WriterFunction[]) => any;
1069
+
1070
+ export const createDefaultImageOrienter: () => PinturaImageOrienter;
1071
+
1072
+ export const createDefaultImageScrambler: (
1073
+ options?: PinturaDefaultImageScramblerOptions
1074
+ ) => (imageData: ImageData | ImageBitmap) => HTMLCanvasElement;
1075
+
1076
+ export const createDefaultShapePreprocessor: () => any;
1077
+
1078
+ export const createDefaultFrameStyles: () => {
1079
+ [key: string]: (shape: Shape, options?: { isPreview: boolean }) => Shape[];
1080
+ };
1081
+
1082
+ export const createDefaultLineEndStyles: () => {
1083
+ [key: string]: (shape: Shape, options?: { isPreview: boolean }) => Shape[];
1084
+ };
1085
+
1086
+ export const createFrameStyleProcessor: (styles: any) => any;
1087
+
1088
+ export const createLineEndProcessor: (styles: any) => any;
1089
+
1090
+ export const imageStateToCanvas: (
1091
+ src: HTMLCanvasElement | HTMLVideoElement | HTMLImageElement,
1092
+ imageState: PinturaImageState,
1093
+ options: {
1094
+ targetCanvas?: HTMLCanvasElement;
1095
+ targetSize?: PinturaTargetSize;
1096
+ disableDraw?: boolean;
1097
+ }
1098
+ ) => {
1099
+ canvas: HTMLCanvasElement;
1100
+ redraw: () => void;
1101
+ };
1102
+
1103
+ // node tree helpers
1104
+ export function createNode(
1105
+ name: PinturaNodeType,
1106
+ id: string,
1107
+ props: PinturaNodeOptions | undefined,
1108
+ children: PinturaNode[]
1109
+ ): PinturaNode;
1110
+
1111
+ export function createNode(name: PinturaNodeType, id: string): PinturaNode;
1112
+
1113
+ export function createNode(name: PinturaNodeType, id: string, children: PinturaNode[]): PinturaNode;
1114
+
1115
+ export function createNode(
1116
+ name: PinturaNodeType,
1117
+ id: string,
1118
+ props: PinturaNodeOptions
1119
+ ): PinturaNode;
1120
+
1121
+ export function findNode(
1122
+ id: string,
1123
+ haystack: PinturaNode | PinturaNode[]
1124
+ ): undefined | PinturaNode;
1125
+ export function updateNode(node: PinturaNode, props: { [key: string]: unknown }): void;
1126
+ export function appendNode(node: PinturaNode, haystack: PinturaNode | PinturaNode[]): void;
1127
+ export function removeNode(id: string): PinturaNode[];
1128
+ export function insertNodeBefore(
1129
+ node: PinturaNode,
1130
+ targetId: string,
1131
+ haystack: PinturaNode | PinturaNode[]
1132
+ ): void;
1133
+ export function insertNodeAfter(
1134
+ node: PinturaNode,
1135
+ targetId: string,
1136
+ haystack: PinturaNode | PinturaNode[]
1137
+ ): void;
1138
+
1139
+ // utils
1140
+ export const supportsWebGL: () => boolean;
1141
+ export const degToRad: (deg: number) => number;
1142
+ export const naturalAspectRatioToNumber: (
1143
+ aspectRatio: string | number | undefined
1144
+ ) => number | false | undefined;
1145
+ export const colorStringToColorArray: (Color: string) => Color;
1146
+ export const legacyDataToImageState: (
1147
+ editor: any,
1148
+ imageSize: Size,
1149
+ data: any
1150
+ ) => PinturaImageOptions;
1151
+ export const dispatchEditorEvents: (
1152
+ editor: PinturaEditor,
1153
+ element: HTMLElement,
1154
+ options?: { prefix?: string }
1155
+ ) => any[];
1156
+ export const blobToFile: (blob: Blob | File, filename: string, mimetype?: string) => File;
1157
+ export const isSupported: () => boolean;
1158
+
1159
+ // shape helpers
1160
+ export const shapeGetLevel: (
1161
+ shapeState: { flipX: undefined | boolean; flipY: undefined | boolean; rotation: number },
1162
+ imageState: { flipX: boolean; flipY: boolean; rotation: number }
1163
+ ) => { flipX: boolean; flipY: boolean; rotation: number };
1164
+ export const shapeGetLength: (shape: Shape) => undefined | number;
1165
+ export const shapeGetCenter: (shape: Shape) => Vector;
1166
+
1167
+ // locale
1168
+ export const locale_en_gb: LocaleCollection;
1169
+
1170
+ //
1171
+ // markup editor
1172
+ //
1173
+ export interface MarkupEditorToolStyleDefaults {
1174
+ sharpie: [Shape, ShapeToolOptions];
1175
+ line: [Shape, ShapeToolOptions];
1176
+ arrow: [Shape, ShapeToolOptions];
1177
+ rectangle: [Shape, ShapeToolOptions];
1178
+ ellipse: [Shape, ShapeToolOptions];
1179
+ text: [Shape, ShapeToolOptions];
1180
+ [custom: string]: [Shape, ShapeToolOptions];
1181
+ }
1182
+
1183
+ export interface MarkupEditorShapeStyleControlDefaults {
1184
+ backgroundColor: undefined | ShapeControl;
1185
+ strokeColor: undefined | ShapeControl;
1186
+ strokeWidth: undefined | ShapeControl;
1187
+ lineStart: undefined | ShapeControl;
1188
+ lineEnd: undefined | ShapeControl;
1189
+ color: undefined | ShapeControl;
1190
+ fontFamily: undefined | ShapeControl;
1191
+ fontStyle_fontWeight: undefined | ShapeControl;
1192
+ fontSize: undefined | ShapeControl;
1193
+ textAlign: undefined | ShapeControl;
1194
+ lineHeight: undefined | ShapeControl;
1195
+ }
1196
+
1197
+ export type ToolbarItem =
1198
+ | string
1199
+ | [string, { disabled?: boolean; icon: string }]
1200
+ | [string, LocaleString, { disabled?: boolean; icon: string }];
1201
+
1202
+ /**
1203
+ * Create tools available in the markup editor
1204
+ */
1205
+ export const createMarkupEditorToolbar: (tools?: ToolbarItem[]) => [string, LocaleString, any][];
1206
+
1207
+ /**
1208
+ * Create default shape styles for each tool, optionally add custom shape styles
1209
+ */
1210
+ export const createMarkupEditorToolStyles: (toolStyles?: {
1211
+ [key: string]: [Shape, ShapeToolOptions];
1212
+ }) => MarkupEditorToolStyleDefaults;
1213
+
1214
+ /**
1215
+ * Create a custom tool style based on one of the existing types
1216
+ */
1217
+ export const createMarkupEditorToolStyle: (
1218
+ type: 'path' | 'rectangle' | 'ellipse' | 'line' | 'text',
1219
+ shape?: Shape,
1220
+ options?: ShapeToolOptions
1221
+ ) => [Shape, ShapeToolOptions];
1222
+
1223
+ /**
1224
+ * Create default shape style controls
1225
+ */
1226
+ export const createMarkupEditorShapeStyleControls: (
1227
+ shapeControlOptions?: ShapeControlOptions
1228
+ ) => MarkupEditorShapeStyleControlDefaults;
1229
+
1230
+ export const createDefaultColorOptions: () => ColorPalette;
1231
+ export const createDefaultFontSizeOptions: () => number[];
1232
+ export const createDefaultFontScaleOptions: () => SizeCategories;
1233
+ export const createDefaultLineHeightOptions: () => number[];
1234
+ export const createDefaultLineHeightScaleOptions: () => SizeCategories;
1235
+ export const createDefaultStrokeWidthOptions: () => number[];
1236
+ export const createDefaultStrokeScaleOptions: () => SizeCategories;
1237
+ export const createDefaultLineEndStyleOptions: () => LineEndStyle[];
1238
+ export const createDefaultFontFamilyOptions: () => [string, string][];
1239
+ export const createDefaultFontStyleOptions: () => [string, string][];
1240
+ export const createDefaultTextAlignOptions: () => TextAlign[];
1241
+
1242
+ export const createMarkupEditorColorOptions: (colors: ColorPalette) => ShapeColorOption[];
1243
+ export const createMarkupEditorFontSizeOptions: (sizes: number[]) => ShapeSizeOption[];
1244
+ export const createMarkupEditorFontScaleOptions: (sizes: SizeCategories) => ShapeSizeOption[];
1245
+ export const createMarkupEditorLineHeightOptions: (sizes: number[]) => ShapeSizeOption[];
1246
+ export const createMarkupEditorLineHeightScaleOptions: (sizes: SizeCategories) => ShapeSizeOption[];
1247
+ export const createMarkupEditorStrokeWidthOptions: (widths: number[]) => ShapeSizeOption[];
1248
+ export const createMarkupEditorStrokeScaleOptions: (sizes: SizeCategories) => ShapeSizeOption[];
1249
+ export const createMarkupEditorFontFamilyOptions: (
1250
+ families: [string, string][]
1251
+ ) => ShapeFontFamilyOption[];
1252
+ export const createMarkupEditorFontStyleOptions: (
1253
+ styles: [string, string][]
1254
+ ) => ShapeFontStyleOption[];
1255
+ export const createMarkupEditorLineEndStyleOptions: (
1256
+ styles: LineEndStyle[]
1257
+ ) => [LineEndStyle, string][];
1258
+
1259
+ export const createMarkupEditorBackgroundColorControl: (colors: ShapeColorOption[]) => ShapeControl;
1260
+ export const createMarkupEditorStrokeColorControl: (
1261
+ colors: ShapeColorOption[],
1262
+ options?: { defaultStrokeWidth: number | string }
1263
+ ) => ShapeControl;
1264
+ export const createMarkupEditorStrokeWidthControl: (widths: ShapeSizeOption[]) => ShapeControl;
1265
+ export const createMarkupEditorLineStartStyleControl: (
1266
+ styles: [LineEndStyle, string][]
1267
+ ) => ShapeControl;
1268
+ export const createMarkupEditorLineEndStyleControl: (
1269
+ styles: [LineEndStyle, string][]
1270
+ ) => ShapeControl;
1271
+ export const createMarkupEditorFontColorControl: (colors: ShapeColorOption[]) => ShapeControl;
1272
+ export const createMarkupEditorFontFamilyControl: (
1273
+ fontFamilies: [string, string][],
1274
+ options?: { defaultKey: string | undefined }
1275
+ ) => ShapeControl;
1276
+ export const createMarkupEditorFontStyleControl: (fontStyles: [string, string][]) => ShapeControl;
1277
+ export const createMarkupEditorFontSizeControl: (sizes: ShapeSizeOption[]) => ShapeControl;
1278
+ export const createMarkupEditorTextAlignControl: (textAlignments: TextAlign[]) => ShapeControl;
1279
+ export const createMarkupEditorLineHeightControl: (lineHeights: [number, string][]) => ShapeControl;
1280
+
1281
+ export const markup_editor_defaults: {
1282
+ markupEditorToolbar: [string, LocaleString, any][];
1283
+ markupEditorToolStyles: MarkupEditorToolStyleDefaults;
1284
+ markupEditorShapeStyleControls: MarkupEditorShapeStyleControlDefaults;
1285
+ };
1286
+
1287
+ export const markup_editor_locale_en_gb: LocaleCollection;
1288
+
1289
+ //
1290
+ // plugins
1291
+ //
1292
+ export interface PinturaUtilPlugin {
1293
+ util: [string, any];
1294
+ }
1295
+
1296
+ export const plugin_annotate: PinturaUtilPlugin;
1297
+ export const plugin_crop: PinturaUtilPlugin;
1298
+ export const plugin_decorate: PinturaUtilPlugin;
1299
+ export const plugin_filter: PinturaUtilPlugin;
1300
+ export const plugin_finetune: PinturaUtilPlugin;
1301
+ export const plugin_resize: PinturaUtilPlugin;
1302
+ export const plugin_sticker: PinturaUtilPlugin;
1303
+ export const plugin_redact: PinturaUtilPlugin;
1304
+ export const plugin_frame: PinturaUtilPlugin;
1305
+ export const plugin_fill: PinturaUtilPlugin;
1306
+
1307
+ export const plugin_annotate_locale_en_gb: LocaleCollection;
1308
+ export const plugin_crop_locale_en_gb: LocaleCollection;
1309
+ export const plugin_decorate_locale_en_gb: LocaleCollection;
1310
+ export const plugin_filter_locale_en_gb: LocaleCollection;
1311
+ export const plugin_finetune_locale_en_gb: LocaleCollection;
1312
+ export const plugin_resize_locale_en_gb: LocaleCollection;
1313
+ export const plugin_sticker_locale_en_gb: LocaleCollection;
1314
+ export const plugin_redact_locale_en_gb: LocaleCollection;
1315
+ export const plugin_frame_locale_en_gb: LocaleCollection;
1316
+ export const plugin_fill_locale_en_gb: LocaleCollection;
1317
+
1318
+ export const plugin_frame_defaults: FramePluginOptions;
1319
+ export const plugin_filter_defaults: FilterPluginOptions;
1320
+ export const plugin_finetune_defaults: FinetunePluginOptions;
1321
+
1322
+ export const effectBrightness: Effect;
1323
+ export const effectContrast: Effect;
1324
+ export const effectSaturation: Effect;
1325
+ export const effectExposure: Effect;
1326
+ export const effectGamma: Effect;
1327
+ export const effectVignette: Effect;
1328
+ export const effectClarity: Effect;
1329
+ export const effectTemperature: Effect;
1330
+
1331
+ export const filterPastel: Filter;
1332
+ export const filterChrome: Filter;
1333
+ export const filterFade: Filter;
1334
+ export const filterWarm: Filter;
1335
+ export const filterCold: Filter;
1336
+ export const filterInvert: Filter;
1337
+ export const filterMonoDefault: Filter;
1338
+ export const filterMonoNoir: Filter;
1339
+ export const filterMonoWash: Filter;
1340
+ export const filterMonoStark: Filter;
1341
+ export const filterSepiaDefault: Filter;
1342
+ export const filterSepiaBlues: Filter;
1343
+ export const filterSepiaRust: Filter;
1344
+ export const filterSepiaColor: Filter;
1345
+
1346
+ export const frameSolidSharp: Frame;
1347
+ export const frameSolidRound: Frame;
1348
+ export const frameLineSingle: Frame;
1349
+ export const frameLineMultiple: Frame;
1350
+ export const frameEdgeSeparate: Frame;
1351
+ export const frameEdgeCross: Frame;
1352
+ export const frameEdgeOverlap: Frame;
1353
+ export const frameHook: Frame;
1354
+ export const framePolaroid: Frame;