polotno 3.20.1 → 3.22.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 (111) hide show
  1. package/THIRD_PARTY_NOTICES.md +8 -8
  2. package/blueprint/side-panel/select-video.d.ts +74 -0
  3. package/blueprint.polotno.css +165 -230
  4. package/canvas/crop-overlay.d.ts +20 -8
  5. package/canvas/crop-overlay.js +1 -1
  6. package/canvas/element.js +1 -1
  7. package/canvas/fade-overlay.js +1 -1
  8. package/canvas/figure-element.js +1 -1
  9. package/canvas/gif-element.d.ts +28 -4
  10. package/canvas/gif-element.js +1 -1
  11. package/canvas/image-element.js +1 -1
  12. package/canvas/lottie-element.js +1 -1
  13. package/canvas/lottie-player.wasm.js +1 -1
  14. package/canvas/media-resize.d.ts +19 -0
  15. package/canvas/media-resize.js +1 -0
  16. package/canvas/page.js +1 -1
  17. package/canvas/quill-font-formats.d.ts +1 -1
  18. package/canvas/quill-font-formats.js +1 -1
  19. package/canvas/render-tag-element.js +1 -1
  20. package/canvas/rich-editor.js +3 -5
  21. package/canvas/text-element/render-tag-source.d.ts +5 -0
  22. package/canvas/text-element/render-tag-source.js +1 -1
  23. package/canvas/tooltip.js +1 -1
  24. package/canvas/use-color.js +1 -1
  25. package/canvas/use-mediabunny-video.js +1 -1
  26. package/canvas/video-element.js +1 -1
  27. package/canvas/workspace-canvas.js +1 -1
  28. package/config.d.ts +1 -1
  29. package/config.js +1 -1
  30. package/icons/registry.d.ts +7 -0
  31. package/icons/registry.js +1 -1
  32. package/image-tools/host.d.ts +3 -0
  33. package/image-tools/sessions.js +1 -1
  34. package/image-tools/target.d.ts +5 -0
  35. package/image-tools/target.js +1 -1
  36. package/image-tools/types.d.ts +5 -0
  37. package/model/crop-mode.d.ts +3 -0
  38. package/model/crop-mode.js +1 -1
  39. package/model/figure-model.d.ts +29 -0
  40. package/model/gif-model.d.ts +40 -0
  41. package/model/group-model.d.ts +304 -2
  42. package/model/group-model.js +1 -1
  43. package/model/history.js +1 -1
  44. package/model/image-model.d.ts +40 -0
  45. package/model/image-model.js +1 -1
  46. package/model/line-model.d.ts +29 -0
  47. package/model/lottie-model.d.ts +40 -0
  48. package/model/node-model.d.ts +32 -0
  49. package/model/node-model.js +1 -1
  50. package/model/page-model.d.ts +912 -6
  51. package/model/shape-model.d.ts +29 -0
  52. package/model/shape-model.js +1 -1
  53. package/model/store.d.ts +61 -2
  54. package/model/store.js +1 -1
  55. package/model/svg-model.d.ts +27 -0
  56. package/model/table-model.d.ts +37 -1
  57. package/model/table-model.js +1 -1
  58. package/model/text-model.d.ts +29 -1
  59. package/model/text-model.js +1 -1
  60. package/model/video-model.d.ts +40 -0
  61. package/package.json +25 -27
  62. package/polotno.bundle.js +240 -238
  63. package/primitives/autocomplete.d.ts +11 -0
  64. package/primitives/autocomplete.js +1 -0
  65. package/primitives/select.js +1 -1
  66. package/side-panel/index.d.ts +1 -0
  67. package/side-panel/index.js +1 -1
  68. package/side-panel/layers-panel.js +1 -1
  69. package/side-panel/select-image.js +1 -1
  70. package/side-panel/select-video.d.ts +74 -0
  71. package/side-panel/select-video.js +1 -1
  72. package/side-panel/variables-panel.d.ts +10 -0
  73. package/side-panel/variables-panel.js +1 -0
  74. package/side-panel/videos-grid.d.ts +1 -1
  75. package/side-panel/videos-grid.js +1 -1
  76. package/toolbar/color-picker.d.ts +8 -0
  77. package/toolbar/color-picker.js +1 -1
  78. package/toolbar/download-button.js +1 -1
  79. package/toolbar/element-container.d.ts +6 -0
  80. package/toolbar/element-container.js +1 -1
  81. package/toolbar/figure-toolbar.d.ts +8 -9
  82. package/toolbar/figure-toolbar.js +1 -1
  83. package/toolbar/gif-toolbar.d.ts +4 -5
  84. package/toolbar/gif-toolbar.js +1 -1
  85. package/toolbar/group-toolbar.d.ts +2 -3
  86. package/toolbar/group-toolbar.js +1 -1
  87. package/toolbar/image-toolbar.d.ts +11 -12
  88. package/toolbar/image-toolbar.js +1 -1
  89. package/toolbar/index.d.ts +1 -0
  90. package/toolbar/index.js +1 -1
  91. package/toolbar/line-toolbar.js +1 -1
  92. package/toolbar/many-toolbar.d.ts +2 -3
  93. package/toolbar/many-toolbar.js +1 -1
  94. package/toolbar/page-toolbar.d.ts +2 -3
  95. package/toolbar/page-toolbar.js +1 -1
  96. package/toolbar/svg-toolbar.d.ts +2 -3
  97. package/toolbar/svg-toolbar.js +1 -1
  98. package/toolbar/text-toolbar.js +1 -1
  99. package/toolbar/text-variables.d.ts +15 -0
  100. package/toolbar/text-variables.js +1 -0
  101. package/toolbar/toolbar.js +1 -1
  102. package/toolbar/video-toolbar.js +1 -1
  103. package/ui.css +1 -1
  104. package/utils/animations.js +1 -1
  105. package/utils/clipboard.d.ts +54 -2
  106. package/utils/l10n.d.ts +32 -0
  107. package/utils/l10n.js +1 -1
  108. package/utils/selection-transform.js +1 -1
  109. package/utils/use-api.d.ts +1 -1
  110. package/utils/use-api.js +1 -1
  111. package/utils/validate-key.js +1 -1
@@ -14,6 +14,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
14
14
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
15
15
  blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
16
16
  custom: import("mobx-state-tree").IType<any, any, any>;
17
+ bindings: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<import("@polotno/schema").Bindings, import("@polotno/schema").Bindings, import("@polotno/schema").Bindings>>;
18
+ href: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
17
19
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
18
20
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
19
21
  removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -78,7 +80,6 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
78
80
  strokeLineJoin: import("mobx-state-tree").IType<string | undefined, string, string>;
79
81
  lineHeight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree/dist/internal").IUnionType<[import("mobx-state-tree").ISimpleType<number>, import("mobx-state-tree").ISimpleType<string>]>, [undefined]>;
80
82
  letterSpacing: import("mobx-state-tree").IType<number | undefined, number, number>;
81
- _editModeEnabled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
82
83
  backgroundEnabled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
83
84
  backgroundColor: import("mobx-state-tree").IType<string | undefined, string, string>;
84
85
  backgroundOpacity: import("mobx-state-tree").IType<number | undefined, number, number>;
@@ -96,6 +97,13 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
96
97
  }> & {
97
98
  readonly page: any;
98
99
  readonly store: any;
100
+ readonly filled: Partial<{
101
+ text?: string;
102
+ placeholder?: string;
103
+ src?: string;
104
+ fill?: string;
105
+ visible?: boolean;
106
+ }>;
99
107
  readonly top: import("mobx-state-tree").ModelInstanceTypeProps<{
100
108
  id: import("mobx-state-tree").ISimpleType<string>;
101
109
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -103,6 +111,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
103
111
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
104
112
  blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
105
113
  custom: import("mobx-state-tree").IType<any, any, any>;
114
+ bindings: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<import("@polotno/schema").Bindings, import("@polotno/schema").Bindings, import("@polotno/schema").Bindings>>;
115
+ href: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
106
116
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
107
117
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
108
118
  removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -115,6 +125,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
115
125
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
116
126
  blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
117
127
  custom: import("mobx-state-tree").IType<any, any, any>;
128
+ bindings: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<import("@polotno/schema").Bindings, import("@polotno/schema").Bindings, import("@polotno/schema").Bindings>>;
129
+ href: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
118
130
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
119
131
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
120
132
  removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -127,6 +139,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
127
139
  opacity: number | undefined;
128
140
  blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
129
141
  custom: any;
142
+ bindings: import("@polotno/schema").Bindings | undefined;
143
+ href: string | undefined;
130
144
  visible: boolean | undefined;
131
145
  selectable: boolean | undefined;
132
146
  removable: boolean | undefined;
@@ -138,6 +152,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
138
152
  name: string;
139
153
  opacity: number;
140
154
  custom: any;
155
+ bindings: import("@polotno/schema").Bindings | undefined;
156
+ href: string | undefined;
141
157
  visible: boolean;
142
158
  selectable: boolean;
143
159
  removable: boolean;
@@ -149,6 +165,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
149
165
  name: string;
150
166
  opacity: number;
151
167
  custom: any;
168
+ bindings: import("@polotno/schema").Bindings | undefined;
169
+ href: string | undefined;
152
170
  visible: boolean;
153
171
  selectable: boolean;
154
172
  removable: boolean;
@@ -166,6 +184,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
166
184
  name: string;
167
185
  opacity: number;
168
186
  custom: any;
187
+ bindings: import("@polotno/schema").Bindings | undefined;
188
+ href: string | undefined;
169
189
  visible: boolean;
170
190
  selectable: boolean;
171
191
  removable: boolean;
@@ -177,6 +197,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
177
197
  name: string;
178
198
  opacity: number;
179
199
  custom: any;
200
+ bindings: import("@polotno/schema").Bindings | undefined;
201
+ href: string | undefined;
180
202
  visible: boolean;
181
203
  selectable: boolean;
182
204
  removable: boolean;
@@ -209,6 +231,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
209
231
  } & {
210
232
  setAnimation(type: 'enter' | 'exit' | 'loop', attrs: import("./animations.js").AnimationAttrs): void;
211
233
  setFilter(type: any, value: any): void;
234
+ } & {
235
+ _editModeEnabled: boolean;
212
236
  } & {
213
237
  set(attrs: any): void;
214
238
  toggleEditMode(editing?: boolean): void;
@@ -220,6 +244,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
220
244
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
221
245
  blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
222
246
  custom: import("mobx-state-tree").IType<any, any, any>;
247
+ bindings: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<import("@polotno/schema").Bindings, import("@polotno/schema").Bindings, import("@polotno/schema").Bindings>>;
248
+ href: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
223
249
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
224
250
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
225
251
  removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -284,7 +310,6 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
284
310
  strokeLineJoin: import("mobx-state-tree").IType<string | undefined, string, string>;
285
311
  lineHeight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree/dist/internal").IUnionType<[import("mobx-state-tree").ISimpleType<number>, import("mobx-state-tree").ISimpleType<string>]>, [undefined]>;
286
312
  letterSpacing: import("mobx-state-tree").IType<number | undefined, number, number>;
287
- _editModeEnabled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
288
313
  backgroundEnabled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
289
314
  backgroundColor: import("mobx-state-tree").IType<string | undefined, string, string>;
290
315
  backgroundOpacity: import("mobx-state-tree").IType<number | undefined, number, number>;
@@ -302,6 +327,13 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
302
327
  }, {
303
328
  readonly page: any;
304
329
  readonly store: any;
330
+ readonly filled: Partial<{
331
+ text?: string;
332
+ placeholder?: string;
333
+ src?: string;
334
+ fill?: string;
335
+ visible?: boolean;
336
+ }>;
305
337
  readonly top: import("mobx-state-tree").ModelInstanceTypeProps<{
306
338
  id: import("mobx-state-tree").ISimpleType<string>;
307
339
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -309,6 +341,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
309
341
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
310
342
  blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
311
343
  custom: import("mobx-state-tree").IType<any, any, any>;
344
+ bindings: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<import("@polotno/schema").Bindings, import("@polotno/schema").Bindings, import("@polotno/schema").Bindings>>;
345
+ href: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
312
346
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
313
347
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
314
348
  removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -321,6 +355,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
321
355
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
322
356
  blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
323
357
  custom: import("mobx-state-tree").IType<any, any, any>;
358
+ bindings: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<import("@polotno/schema").Bindings, import("@polotno/schema").Bindings, import("@polotno/schema").Bindings>>;
359
+ href: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
324
360
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
325
361
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
326
362
  removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -333,6 +369,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
333
369
  opacity: number | undefined;
334
370
  blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
335
371
  custom: any;
372
+ bindings: import("@polotno/schema").Bindings | undefined;
373
+ href: string | undefined;
336
374
  visible: boolean | undefined;
337
375
  selectable: boolean | undefined;
338
376
  removable: boolean | undefined;
@@ -344,6 +382,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
344
382
  name: string;
345
383
  opacity: number;
346
384
  custom: any;
385
+ bindings: import("@polotno/schema").Bindings | undefined;
386
+ href: string | undefined;
347
387
  visible: boolean;
348
388
  selectable: boolean;
349
389
  removable: boolean;
@@ -355,6 +395,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
355
395
  name: string;
356
396
  opacity: number;
357
397
  custom: any;
398
+ bindings: import("@polotno/schema").Bindings | undefined;
399
+ href: string | undefined;
358
400
  visible: boolean;
359
401
  selectable: boolean;
360
402
  removable: boolean;
@@ -372,6 +414,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
372
414
  name: string;
373
415
  opacity: number;
374
416
  custom: any;
417
+ bindings: import("@polotno/schema").Bindings | undefined;
418
+ href: string | undefined;
375
419
  visible: boolean;
376
420
  selectable: boolean;
377
421
  removable: boolean;
@@ -383,6 +427,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
383
427
  name: string;
384
428
  opacity: number;
385
429
  custom: any;
430
+ bindings: import("@polotno/schema").Bindings | undefined;
431
+ href: string | undefined;
386
432
  visible: boolean;
387
433
  selectable: boolean;
388
434
  removable: boolean;
@@ -415,6 +461,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
415
461
  } & {
416
462
  setAnimation(type: 'enter' | 'exit' | 'loop', attrs: import("./animations.js").AnimationAttrs): void;
417
463
  setFilter(type: any, value: any): void;
464
+ } & {
465
+ _editModeEnabled: boolean;
418
466
  } & {
419
467
  set(attrs: any): void;
420
468
  toggleEditMode(editing?: boolean): void;
@@ -425,6 +473,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
425
473
  name: string;
426
474
  opacity: number;
427
475
  custom: any;
476
+ bindings: import("@polotno/schema").Bindings | undefined;
477
+ href: string | undefined;
428
478
  visible: boolean;
429
479
  selectable: boolean;
430
480
  removable: boolean;
@@ -436,6 +486,8 @@ export declare const insertTextElement: (store: StoreType, text: string, extra?:
436
486
  name: string;
437
487
  opacity: number;
438
488
  custom: any;
489
+ bindings: import("@polotno/schema").Bindings | undefined;
490
+ href: string | undefined;
439
491
  visible: boolean;
440
492
  selectable: boolean;
441
493
  removable: boolean;
package/utils/l10n.d.ts CHANGED
@@ -2,6 +2,38 @@ export declare const setTranslations: (json: any, { validate }?: {
2
2
  validate?: boolean | undefined;
3
3
  }) => void;
4
4
  export declare const getTranslations: () => {
5
+ variables: {
6
+ title: string;
7
+ element: string;
8
+ name: string;
9
+ label: string;
10
+ add: string;
11
+ required: string;
12
+ default: string;
13
+ enterValue: string;
14
+ empty: string;
15
+ settings: string;
16
+ delete: string;
17
+ yes: string;
18
+ no: string;
19
+ insert: string;
20
+ search: string;
21
+ noMatch: string;
22
+ nameRule: string;
23
+ nameTaken: string;
24
+ visible: string;
25
+ src: string;
26
+ fill: string;
27
+ unbound: string;
28
+ always: string;
29
+ fit: string;
30
+ manual: string;
31
+ cover: string;
32
+ contain: string;
33
+ focus: string;
34
+ orphan: string;
35
+ 'mixed-types': string;
36
+ };
5
37
  imageEdit: {
6
38
  title: string;
7
39
  expand: string;
package/utils/l10n.js CHANGED
@@ -1 +1 @@
1
- import{observable as e,action as o,toJS as a}from"mobx";const r=e({imageEdit:{title:"AI edit",expand:"Expand",upscale:"Upscale",inpaint:"Generative fill",replace:"Replace",remove:"Remove",prompt:"Your prompt",promptPlaceholder:"Describe what should be there",expandPromptPlaceholder:"Describe the new area (optional)",replaceDescription:"Select an area on the image, then describe what you want to change.",replaceHint:"Describe what should replace the selection, such as “plain wall” or “open sky”.",removeDescription:"Select an object to remove. The surrounding image will fill the selected area.",expandDescription:"Drag the frame beyond the image edges to make room for new content.",cropDescription:"Drag the frame to crop the image.",upscaleDescription:"Increase the image resolution.",removeBackgroundDescription:"Remove the image background.",applyCrop:"Apply crop",generate:"Generate",clear:"Clear selection",resetFrame:"Reset frame",processing:"Generating…",loadingImage:"Loading image…",upscaling:"Upscaling…",removingBackground:"Removing background…",failed:"The image could not be edited. Please try again.",rasterFailed:"This device could not prepare the image. Try a smaller image.",selectRegion:"Drag on the image to select an area."},toolbar:{duration:"Duration",opacity:"Opacity",effects:"Effects",blur:"Blur",curvedText:"Curved text",curvePower:"Power",temperature:"Temperature",saturation:"Saturation",contrast:"Contrast",shadows:"Shadows",white:"White",black:"Black",vibrance:"Vibrance",textBackground:"Background",textBox:"Text box",backgroundCornerRadius:"Corner radius",backgroundOpacity:"Opacity",backgroundPadding:"Padding",brightness:"Brightness",filters:"Filters",sepia:"Sepia",grayscale:"Grayscale",cold:"Cold",natural:"Natural",warm:"Warm",textStroke:"Text Stroke",textEffect:{none:"None",shadow:"Shadow",lift:"Lift",glow:"Glow",outline:"Outline",sticker:"Sticker",pop:"Pop",background:"Background"},blendMode:"Blending",blend:{"pass-through":"Pass Through",normal:"Normal",multiply:"Multiply",screen:"Screen",overlay:"Overlay",darken:"Darken",lighten:"Lighten","color-dodge":"Color Dodge","color-burn":"Color Burn","hard-light":"Hard Light","soft-light":"Soft Light",difference:"Difference",exclusion:"Exclusion",hue:"Hue",saturation:"Saturation",color:"Color",luminosity:"Luminosity"},strokeLineJoin:"Corners",joinRound:"Round",joinMiter:"Miter",joinBevel:"Bevel",shadow:"Drop shadow",border:"Border",cornerRadius:"Corner Radius",copyStyle:"Copy style",uppercase:"Uppercase",position:"Position",layering:"Layering",toForward:"To Front",up:"Forward",down:"Backward",toBottom:"To back",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",flip:"Flip",flipHorizontally:"Flip horizontally",flipVertically:"Flip vertically",fitToBackground:"Fit to page",fitToPage:"Fit to page",widthShort:"W",heightShort:"H",removeBackground:"Remove background",removeBackgroundTitle:"Remove background from image",cancelRemoveBackground:"Cancel",confirmRemoveBackground:"Confirm",crop:"Crop",cropDone:"Done",cropCancel:"Cancel",clip:"Apply mask",removeClip:"Remove mask",removeMask:"Remove mask",transparency:"Transparency",lockedDescription:"Object is locked. Unlock it to allow changes from canvas.",unlockedDescription:"Object is unlocked. Lock it to prevent changes from canvas.",removeElements:"Remove elements",duplicateElements:"Duplicate elements",download:"Download",saveAsImage:"Save as image",saveAsPDF:"Save as PDF",lineHeight:"Line height",letterSpacing:"Letter spacing",offsetX:"Offset X",offsetY:"Offset Y",color:"Color",selectable:"Selectable",draggable:"Draggable",removable:"Removable",resizable:"Resizable",contentEditable:"Can change content",styleEditable:"Can change style",alwaysOnTop:"Always on top",showInExport:"Show in export",ungroupElements:"Ungroup",groupElements:"Group",lineSize:"Line size",fade:"Fade",move:"Move",zoom:"Zoom",animate:"Animate",rotate:"Rotate",none:"None",bounce:"Bounce",blink:"Blink",count:"Count",pop:"Pop",rise:"Rise",flipAnimation:"Flip",growTurn:"Grow & turn",spinAnimation:"Spin",pulse:"Pulse",float:"Float",shake:"Shake",typewriter:"Typewriter",lineRise:"Line rise",wordRise:"Word rise",wordFade:"Word fade",letterPop:"Letter pop",wordBlur:"Word blur",wipe:"Wipe",glow:"Glow",lineWipe:"Line wipe",linePeek:"Line peek",letterWave:"Letter wave",kenBurns:"Ken Burns",strength:"Strength",spaceEvenly:"Space evenly",horizontalDistribution:"Horizontally",verticalDistribution:"Vertically",strokeWidth:"Stroke Width",strokeSettings:"Stroke settings",spacing:"Spacing",volume:"Volume",speed:"Speed",seconds:"sec",lineStyle:"Line style",lineStartHead:"Line start",lineEndHead:"Line end",textDirection:"Text direction",fontSize:"Font size",fontFamily:"Font family",fontFamilyMixed:"Mixed",fontsInSelection:"Fonts in selection",textAlign:"Text align",verticalAlign:"Vertical align",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",cellBackground:"Cell background",tableBorderSettings:"Border settings",tableBorderColor:"Border color",tableBorderWidth:"Border width",tableBorderStyle:"Border style",borderModeAll:"All borders",borderModeOuter:"Outer borders",borderModeInner:"Inner borders",borderModeBottomOnly:"Bottom only",borderModeTopOnly:"Top only",borderModeLeftOnly:"Left only",borderModeRightOnly:"Right only",borderModeInnerHorizontal:"Inner horizontal",borderModeInnerVertical:"Inner vertical",tableStructure:"Table structure",tableRows:"Rows",tableColumns:"Columns",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteColumn:"Delete column",deleteRows:"Delete rows",deleteColumns:"Delete columns",distributeRowsEvenly:"Distribute rows evenly",distributeColumnsEvenly:"Distribute columns evenly",cellPadding:"Cell padding",listFormat:"List",colorPicker:{solid:"Solid",linear:"Linear",angle:"Angle",stops:"Gradient stops",stop:"Stop",addStop:"Add stop",removeStop:"Remove stop",reverse:"Reverse gradient",colors:"Colors",resetColors:"Reset",recolorAll:"Recolor all"},clipFade:{title:"Fade",preparing:"Preparing mask…",shape:"Shape",linear:"Linear",radial:"Radial",stopOpacity:"Stop opacity",stops:"Fade stops",stop:"Stop",start:"Fade start",end:"Fade end",center:"Fade center",radius:"Fade radius",reverse:"Reverse",removeStop:"Remove stop",addStop:"Add stop",reset:"Reset",hint:"Drag the handles on the image to position the fade."},aiText:{aiWrite:"AI write",rewrite:"Rewrite",shorten:"Shorten",continue:"Continue writing",proofread:"Proofread",tones:"Tones",friendly:"Friendly",professional:"Professional",humorous:"Humorous",formal:"Formal",customPrompt:"Custom prompt",generatedResult:"Generated result",cancel:"Cancel",generate:"Generate",back:"Back",tryAgain:"Try Again",insert:"Insert",promptPlaceholder:"Describe what you want to generate"}},workspace:{noPages:"There are no pages yet...",addPage:"Add page",removePage:"Remove page",duplicatePage:"Duplicate page",moveUp:"Move up",moveDown:"Move down",moveLeft:"Move left",moveRight:"Move right"},scale:{reset:"Reset"},error:{removeBackground:"Ops! Something went wrong. Background can not be removed."},sidePanel:{close:"Close",templates:"Templates",searchTemplatesWithSameSize:"Show templates with the same size",searchPlaceholder:"Search...",otherFormats:"Other formats",noResults:"No results",error:"Loading is failed...",text:"Text",uploadFont:"Upload font",myFonts:"My fonts",photos:"Photos",videos:"Videos",animations:"Animations",effects:"Effects",elements:"Elements",shapes:"Shapes",tables:"Tables",lines:"Lines",draw:"Draw",drawTool:"Tool",drawSelection:"Selection",drawBrush:"Brush",drawHighlighter:"Highlighter",upload:"Upload",uploadImage:"Add file",uploadTip:"Upload your assets",uploadUnsupported:"Skipped some files. You can add images, video, audio and Lottie animations.",uploadFailed:"Upload failed. Please try again.",background:"Background",resize:"Resize",layers:"Layers",animate:"Animate",animationEnter:"Enter",animationBoth:"Both",animationExit:"Exit",animationLoop:"Loop",animationGeneral:"General",animationTextPresets:"Text",animationDuration:"Duration (s)",animationRepeatEvery:"Repeat every (s)",animationStartAt:"Start at (s)",animationEndAt:"End at (s)",animationDirection:"Direction",animationDirections:{right:"Right",left:"Left",up:"Up",down:"Down","bottom-right":"Bottom right","bottom-left":"Bottom left","top-right":"Top right","top-left":"Top left",none:"None"},zoomIn:"Zoom In",zoomOut:"Zoom Out",layerTypes:{image:"Image",text:"Text",svg:"SVG",line:"Line",figure:"Figure",group:"Group"},layersTip:"Elements on your active page:",noLayers:"No elements on the page...",namePlaceholder:"Type element name...",useMagicResize:"Use magic resize",advanced:"Advanced",bleed:"Bleed",showBleed:"Show bleed",clipImage:"Mask image",width:"Width",height:"Height",units:"Units",magicResizeDescription:"Magic resize will automatically resize and move all elements on the canvas",headerText:"Header",createHeader:"Create header",subHeaderText:"Sub Header",createSubHeader:"Create sub header",bodyText:"Body text",createBody:"Create body text"},pagesTimeline:{pages:"Pages",removePage:"Remove page",addPage:"Add page",duplicatePage:"Duplicate page",removeAudio:"Remove audio",duplicateAudio:"Duplicate audio",renameAudio:"Rename audio",muteAudio:"Mute",unmuteAudio:"Unmute",volume:"Volume",speed:"Speed",rewind:"Rewind to start",editAsVideo:"Edit as video",editAsVideoHint:"On: preview the frame at the playhead — timed elements hide outside their range. Off: show all elements while editing."},contextMenu:{duplicate:"Duplicate",split:"Split at playhead",rename:"Rename",remove:"Remove",lock:"Lock",unlock:"Unlock",copy:"Copy",paste:"Paste",copyStyle:"Copy style",moveUp:"Move up",moveDown:"Move down",moveBack:"Move back",moveForward:"Move forward"}}),n=e=>e&&"object"==typeof e;function i(e,o){Object.keys(o).forEach(a=>{const r=e[a],l=o[a];n(l)&&n(r)?i(r,l):e[a]=l})}function l(e,o,a=""){Object.keys(o).forEach(r=>{const i=o[r],s=a?`${a}.${r}`:r;n(i)?n(e[r])?l(e[r],i,s):console.warn(`Missing nested translation object at '${s}'`):void 0===e[r]&&console.warn(`Missing translation '${s}'`)})}export const setTranslations=o((e,{validate:o=!1}={})=>{o&&l(e,r),i(r,e)});export const getTranslations=()=>a(r);const s={};export const t=e=>{const o=function(e,o){var a,r=o.split("."),n=e;for(a=0;a<r.length;++a){if(null==n[r[a]]){return}n=n[r[a]]}return n}(r,e);if(void 0!==o){return o}s[e]||(s[e]=!0,console.warn(`Missing translation '${e}'`));const a=e.split("."),n=a[a.length-1]||" ";return n.charAt(0).toUpperCase()+n.slice(1)};
1
+ import{observable as e,action as o,toJS as a}from"mobx";const r=e({variables:{title:"Variables",element:"Selected element",name:"Variable name",label:"Label",add:"Add variable",required:"Required",default:"Default",enterValue:"Enter a value",empty:"Add a variable, then insert it into text or link it to a selected element.",settings:"Settings",delete:"Delete variable",yes:"Yes",no:"No",insert:"Insert variable",search:"Search or add a variable",noMatch:"No matching variables",nameRule:"Use letters, digits, _ and dots",nameTaken:"Already exists",visible:"Visible",src:"Source",fill:"Color",unbound:"Not linked",always:"Always",fit:"Scale",manual:"Crop",cover:"Fill",contain:"Fit",focus:"Focus",orphan:"Unused","mixed-types":"Mixed types"},imageEdit:{title:"AI edit",expand:"Expand",upscale:"Upscale",inpaint:"Generative fill",replace:"Replace",remove:"Remove",prompt:"Your prompt",promptPlaceholder:"Describe what should be there",expandPromptPlaceholder:"Describe the new area (optional)",replaceDescription:"Select an area on the image, then describe what you want to change.",replaceHint:"Describe what should replace the selection, such as “plain wall” or “open sky”.",removeDescription:"Select an object to remove. The surrounding image will fill the selected area.",expandDescription:"Drag the frame beyond the image edges to make room for new content.",cropDescription:"Drag the frame to crop the image.",upscaleDescription:"Increase the image resolution.",removeBackgroundDescription:"Remove the image background.",applyCrop:"Apply crop",generate:"Generate",clear:"Clear selection",resetFrame:"Reset frame",processing:"Generating…",loadingImage:"Loading image…",upscaling:"Upscaling…",removingBackground:"Removing background…",failed:"The image could not be edited. Please try again.",rasterFailed:"This device could not prepare the image. Try a smaller image.",selectRegion:"Drag on the image to select an area."},toolbar:{duration:"Duration",opacity:"Opacity",effects:"Effects",blur:"Blur",curvedText:"Curved text",curvePower:"Power",temperature:"Temperature",saturation:"Saturation",contrast:"Contrast",shadows:"Shadows",white:"White",black:"Black",vibrance:"Vibrance",textBackground:"Background",textBox:"Text box",backgroundCornerRadius:"Corner radius",backgroundOpacity:"Opacity",backgroundPadding:"Padding",brightness:"Brightness",filters:"Filters",sepia:"Sepia",grayscale:"Grayscale",cold:"Cold",natural:"Natural",warm:"Warm",textStroke:"Text Stroke",textEffect:{none:"None",shadow:"Shadow",lift:"Lift",glow:"Glow",outline:"Outline",sticker:"Sticker",pop:"Pop",background:"Background"},blendMode:"Blending",blend:{"pass-through":"Pass Through",normal:"Normal",multiply:"Multiply",screen:"Screen",overlay:"Overlay",darken:"Darken",lighten:"Lighten","color-dodge":"Color Dodge","color-burn":"Color Burn","hard-light":"Hard Light","soft-light":"Soft Light",difference:"Difference",exclusion:"Exclusion",hue:"Hue",saturation:"Saturation",color:"Color",luminosity:"Luminosity"},strokeLineJoin:"Corners",joinRound:"Round",joinMiter:"Miter",joinBevel:"Bevel",shadow:"Drop shadow",border:"Border",cornerRadius:"Corner Radius",copyStyle:"Copy style",uppercase:"Uppercase",position:"Position",layering:"Layering",toForward:"To Front",up:"Forward",down:"Backward",toBottom:"To back",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",flip:"Flip",flipHorizontally:"Flip horizontally",flipVertically:"Flip vertically",fitToBackground:"Fit to page",fitToPage:"Fit to page",widthShort:"W",heightShort:"H",removeBackground:"Remove background",removeBackgroundTitle:"Remove background from image",cancelRemoveBackground:"Cancel",confirmRemoveBackground:"Confirm",crop:"Crop",cropDone:"Done",cropCancel:"Cancel",clip:"Apply mask",removeClip:"Remove mask",removeMask:"Remove mask",transparency:"Transparency",lockedDescription:"Object is locked. Unlock it to allow changes from canvas.",unlockedDescription:"Object is unlocked. Lock it to prevent changes from canvas.",removeElements:"Remove elements",duplicateElements:"Duplicate elements",download:"Download",saveAsImage:"Save as image",saveAsPDF:"Save as PDF",lineHeight:"Line height",letterSpacing:"Letter spacing",offsetX:"Offset X",offsetY:"Offset Y",color:"Color",selectable:"Selectable",draggable:"Draggable",removable:"Removable",resizable:"Resizable",contentEditable:"Can change content",styleEditable:"Can change style",alwaysOnTop:"Always on top",showInExport:"Show in export",ungroupElements:"Ungroup",groupElements:"Group",lineSize:"Line size",fade:"Fade",move:"Move",zoom:"Zoom",animate:"Animate",rotate:"Rotate",none:"None",bounce:"Bounce",blink:"Blink",count:"Count",pop:"Pop",rise:"Rise",flipAnimation:"Flip",growTurn:"Grow & turn",spinAnimation:"Spin",pulse:"Pulse",float:"Float",shake:"Shake",typewriter:"Typewriter",lineRise:"Line rise",wordRise:"Word rise",wordFade:"Word fade",letterPop:"Letter pop",wordBlur:"Word blur",wipe:"Wipe",glow:"Glow",lineWipe:"Line wipe",linePeek:"Line peek",letterWave:"Letter wave",kenBurns:"Ken Burns",strength:"Strength",spaceEvenly:"Space evenly",horizontalDistribution:"Horizontally",verticalDistribution:"Vertically",strokeWidth:"Stroke Width",strokeSettings:"Stroke settings",spacing:"Spacing",volume:"Volume",speed:"Speed",seconds:"sec",lineStyle:"Line style",lineStartHead:"Line start",lineEndHead:"Line end",textDirection:"Text direction",fontSize:"Font size",fontFamily:"Font family",fontFamilyMixed:"Mixed",fontsInSelection:"Fonts in selection",textAlign:"Text align",verticalAlign:"Vertical align",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",cellBackground:"Cell background",tableBorderSettings:"Border settings",tableBorderColor:"Border color",tableBorderWidth:"Border width",tableBorderStyle:"Border style",borderModeAll:"All borders",borderModeOuter:"Outer borders",borderModeInner:"Inner borders",borderModeBottomOnly:"Bottom only",borderModeTopOnly:"Top only",borderModeLeftOnly:"Left only",borderModeRightOnly:"Right only",borderModeInnerHorizontal:"Inner horizontal",borderModeInnerVertical:"Inner vertical",tableStructure:"Table structure",tableRows:"Rows",tableColumns:"Columns",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteColumn:"Delete column",deleteRows:"Delete rows",deleteColumns:"Delete columns",distributeRowsEvenly:"Distribute rows evenly",distributeColumnsEvenly:"Distribute columns evenly",cellPadding:"Cell padding",listFormat:"List",colorPicker:{solid:"Solid",linear:"Linear",angle:"Angle",stops:"Gradient stops",stop:"Stop",addStop:"Add stop",removeStop:"Remove stop",reverse:"Reverse gradient",colors:"Colors",resetColors:"Reset",recolorAll:"Recolor all"},clipFade:{title:"Fade",preparing:"Preparing mask…",shape:"Shape",linear:"Linear",radial:"Radial",stopOpacity:"Stop opacity",stops:"Fade stops",stop:"Stop",start:"Fade start",end:"Fade end",center:"Fade center",radius:"Fade radius",reverse:"Reverse",removeStop:"Remove stop",addStop:"Add stop",reset:"Reset",hint:"Drag the handles on the image to position the fade."},aiText:{aiWrite:"AI write",rewrite:"Rewrite",shorten:"Shorten",continue:"Continue writing",proofread:"Proofread",tones:"Tones",friendly:"Friendly",professional:"Professional",humorous:"Humorous",formal:"Formal",customPrompt:"Custom prompt",generatedResult:"Generated result",cancel:"Cancel",generate:"Generate",back:"Back",tryAgain:"Try Again",insert:"Insert",promptPlaceholder:"Describe what you want to generate"}},workspace:{noPages:"There are no pages yet...",addPage:"Add page",removePage:"Remove page",duplicatePage:"Duplicate page",moveUp:"Move up",moveDown:"Move down",moveLeft:"Move left",moveRight:"Move right"},scale:{reset:"Reset"},error:{removeBackground:"Ops! Something went wrong. Background can not be removed."},sidePanel:{close:"Close",templates:"Templates",searchTemplatesWithSameSize:"Show templates with the same size",searchPlaceholder:"Search...",otherFormats:"Other formats",noResults:"No results",error:"Loading is failed...",text:"Text",uploadFont:"Upload font",myFonts:"My fonts",photos:"Photos",videos:"Videos",animations:"Animations",effects:"Effects",elements:"Elements",shapes:"Shapes",tables:"Tables",lines:"Lines",draw:"Draw",drawTool:"Tool",drawSelection:"Selection",drawBrush:"Brush",drawHighlighter:"Highlighter",upload:"Upload",uploadImage:"Add file",uploadTip:"Upload your assets",uploadUnsupported:"Skipped some files. You can add images, video, audio and Lottie animations.",uploadFailed:"Upload failed. Please try again.",background:"Background",resize:"Resize",layers:"Layers",animate:"Animate",animationEnter:"Enter",animationBoth:"Both",animationExit:"Exit",animationLoop:"Loop",animationGeneral:"General",animationTextPresets:"Text",animationDuration:"Duration (s)",animationRepeatEvery:"Repeat every (s)",animationStartAt:"Start at (s)",animationEndAt:"End at (s)",animationDirection:"Direction",animationDirections:{right:"Right",left:"Left",up:"Up",down:"Down","bottom-right":"Bottom right","bottom-left":"Bottom left","top-right":"Top right","top-left":"Top left",none:"None"},zoomIn:"Zoom In",zoomOut:"Zoom Out",layerTypes:{image:"Image",text:"Text",svg:"SVG",line:"Line",figure:"Figure",group:"Group"},layersTip:"Elements on your active page:",noLayers:"No elements on the page...",namePlaceholder:"Type element name...",useMagicResize:"Use magic resize",advanced:"Advanced",bleed:"Bleed",showBleed:"Show bleed",clipImage:"Mask image",width:"Width",height:"Height",units:"Units",magicResizeDescription:"Magic resize will automatically resize and move all elements on the canvas",headerText:"Header",createHeader:"Create header",subHeaderText:"Sub Header",createSubHeader:"Create sub header",bodyText:"Body text",createBody:"Create body text"},pagesTimeline:{pages:"Pages",removePage:"Remove page",addPage:"Add page",duplicatePage:"Duplicate page",removeAudio:"Remove audio",duplicateAudio:"Duplicate audio",renameAudio:"Rename audio",muteAudio:"Mute",unmuteAudio:"Unmute",volume:"Volume",speed:"Speed",rewind:"Rewind to start",editAsVideo:"Edit as video",editAsVideoHint:"On: preview the frame at the playhead — timed elements hide outside their range. Off: show all elements while editing."},contextMenu:{duplicate:"Duplicate",split:"Split at playhead",rename:"Rename",remove:"Remove",lock:"Lock",unlock:"Unlock",copy:"Copy",paste:"Paste",copyStyle:"Copy style",moveUp:"Move up",moveDown:"Move down",moveBack:"Move back",moveForward:"Move forward"}}),n=e=>e&&"object"==typeof e;function i(e,o){Object.keys(o).forEach(a=>{const r=e[a],l=o[a];n(l)&&n(r)?i(r,l):e[a]=l})}function l(e,o,a=""){Object.keys(o).forEach(r=>{const i=o[r],s=a?`${a}.${r}`:r;n(i)?n(e[r])?l(e[r],i,s):console.warn(`Missing nested translation object at '${s}'`):void 0===e[r]&&console.warn(`Missing translation '${s}'`)})}export const setTranslations=o((e,{validate:o=!1}={})=>{o&&l(e,r),i(r,e)});export const getTranslations=()=>a(r);const s={};export const t=e=>{const o=function(e,o){var a,r=o.split("."),n=e;for(a=0;a<r.length;++a){if(null==n[r[a]]){return}n=n[r[a]]}return n}(r,e);if(void 0!==o){return o}s[e]||(s[e]=!0,console.warn(`Missing translation '${e}'`));const a=e.split("."),n=a[a.length-1]||" ";return n.charAt(0).toUpperCase()+n.slice(1)};
@@ -1 +1 @@
1
- var e=this&&this.__rest||function(e,t){var n={};for(var i in e){Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++){t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}}return n};import{getTotalClientRect as t}from"./math.js";import{roundedGeometryAttrs as n,roundedGeometryPx as i,roundedStyleAttrs as o,scaledFontSizeBounds as s,isMedia as r,scaledStyleAttrs as c,textMinResizeWidth as h,textMinWidthIsMeasured as a}from"./px.js";import{textResizeFloorFontSize as l}from"./text-sizing.js";export const isAxisAligned=e=>{const t=(e%180+180)%180;return t<.1||180-t<.1};export const canStretchAxis=(e,t,n)=>{if(!isAxisAligned(e.rotation-n)){return!1}switch(e.type){case"text":return"x"===t&&!a(e);case"figure":case"video":case"table":return!0;case"image":case"svg":case"gif":case"lottie":return!e.keepRatio;default:return!1}};export const leafMinSize=(e,t,n,i)=>{if("table"===e.type){const n=e;return"x"===t?n.minWidth:n.minHeight}return"text"===e.type&&"x"===t&&n?h(i,l(e)):1};const x=e=>{const[t]=e.selectedElements;return 1===e.selectedElements.length&&"group"!==t.type?t:null};export const getSelectionBox=e=>{const n=x(e);if(n){const{x:e,y:t,width:i,height:o}=n;return{x:e,y:t,width:i,height:o}}const i=e.selectedShapes;return i.length?t(i):null};const p=e=>!e.pendingEdit;export const canResizeSelection=e=>{const t=e.selectedShapes;return t.length>0&&t.every(e=>e.resizable&&p(e))};export const canMoveSelection=e=>{const t=e.selectedShapes;return t.length>0&&t.every(e=>e.draggable&&p(e))};const g=(e,t,n)=>{e.set(t),e.setHeightRedistribute(n),e.set({x:i(e.x),y:i(e.y),width:i(e.width)}),e._resetBaseRowHeights()},d=(e,t,i)=>{const r=i.x+(e.x-i.x)*t,h=i.y+(e.y-i.y)*t;if("table"===e.type){return void g(e,{x:r,y:h,width:e.width*t},e.height*t)}const{fontSize:a,minFontSize:l,maxFontSize:x}=e;e.set(Object.assign({x:r,y:h,width:e.width*t,height:e.height*t},c(e,t))),e.set(Object.assign(Object.assign({},n(e)),o(e))),"text"===e.type&&e.set(s({minFontSize:l,maxFontSize:x},e.fontSize/a,!0))};export const resizeSelection=(t,i,o)=>{const s=getSelectionBox(t),c="x"===i?null==s?void 0:s.width:null==s?void 0:s.height;if(!(s&&c&&o>0&&canResizeSelection(t))){return}const h=t.selectedShapes,a=x(t),l=h.every(e=>!r(e.type))&&(a?((e,t)=>"text"===e.type?"x"===t&&!e.curveEnabled:canStretchAxis(e,t,e.rotation))(a,i):h.every(e=>canStretchAxis(e,i,0))),p=Math.max(...h.flatMap(e=>(l?[i]:["x","y"]).map(t=>{const n="x"===t?e.width:e.height,i=leafMinSize(e,t,l,n);return n>=i?i/n:0}))),y=Math.max(o/c,p),u={x:s.x,y:s.y};t.history.transaction(()=>{h.forEach(t=>{l?((t,i,o,s)=>{const[r,c]="x"===i?["x","width"]:["y","height"],h={[r]:s[r]+(t[r]-s[r])*o,[c]:t[c]*o};if("table"===t.type){const{height:n=t.height}=h,i=e(h,["height"]);return void g(t,i,n)}t.set(h),t.set(n(t))})(t,i,y,u):d(t,y,u)})})};const y=(e,t,n)=>{e.forEach(e=>{e.set({x:i(e.x+t),y:i(e.y+n)})})};export const moveSelection=(e,t,n)=>{const i=getSelectionBox(e);if(!i||!Number.isFinite(n)||!canMoveSelection(e)){return}const o=n-("x"===t?i.x:i.y);e.history.transaction(()=>{y(e.selectedShapes,"x"===t?o:0,"y"===t?o:0)})};export const canFitSelectionToPage=e=>canResizeSelection(e)&&canMoveSelection(e);export const fitSelectionToPage=e=>{var n;const i=e.selectedShapes,o=null===(n=i[0])||void 0===n?void 0:n.page;if(!o||!canFitSelectionToPage(e)){return}const s=t(i);if(!s.width||!s.height){return}const r=Math.min(o.computedWidth/s.width,o.computedHeight/s.height);e.history.transaction(()=>{i.forEach(e=>d(e,r,{x:s.x,y:s.y}));const e=t(i);y(i,(o.computedWidth-e.width)/2-e.x,(o.computedHeight-e.height)/2-e.y)})};
1
+ var e=this&&this.__rest||function(e,t){var i={};for(var n in e){Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++){t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(i[n[o]]=e[n[o]])}}return i};import{getTotalClientRect as t}from"./math.js";import{roundedGeometryAttrs as i,roundedGeometryPx as n,roundedStyleAttrs as o,scaledFontSizeBounds as s,isMedia as r,scaledStyleAttrs as c,textMinResizeWidth as a,textMinWidthIsMeasured as h}from"./px.js";import{textResizeFloorFontSize as l}from"./text-sizing.js";import{sideResizeCrop as x}from"../canvas/media-resize.js";export const isAxisAligned=e=>{const t=(e%180+180)%180;return t<.1||180-t<.1};export const canStretchAxis=(e,t,i)=>{if(!isAxisAligned(e.rotation-i)){return!1}switch(e.type){case"text":return"x"===t&&!h(e);case"figure":case"video":case"table":return!0;case"image":case"svg":case"gif":case"lottie":return!e.keepRatio;default:return!1}};export const leafMinSize=(e,t,i,n)=>{if("table"===e.type){const i=e;return"x"===t?i.minWidth:i.minHeight}return"text"===e.type&&"x"===t&&i?a(n,l(e)):1};const p=e=>{const[t]=e.selectedElements;return 1===e.selectedElements.length&&"group"!==t.type?t:null};export const getSelectionBox=e=>{const i=p(e);if(i){const{x:e,y:t,width:n,height:o}=i;return{x:e,y:t,width:n,height:o}}const n=e.selectedShapes;return n.length?t(n):null};const d=e=>!e.pendingEdit;export const canResizeSelection=e=>{const t=e.selectedShapes;return t.length>0&&t.every(e=>e.resizable&&d(e))};export const canMoveSelection=e=>{const t=e.selectedShapes;return t.length>0&&t.every(e=>e.draggable&&d(e))};const g=(e,t,i)=>{e.set(t),e.setHeightRedistribute(i),e.set({x:n(e.x),y:n(e.y),width:n(e.width)}),e._resetBaseRowHeights()},y=(e,t,n)=>{const r=n.x+(e.x-n.x)*t,a=n.y+(e.y-n.y)*t;if("table"===e.type){return void g(e,{x:r,y:a,width:e.width*t},e.height*t)}const{fontSize:h,minFontSize:l,maxFontSize:x}=e;e.set(Object.assign({x:r,y:a,width:e.width*t,height:e.height*t},c(e,t))),e.set(Object.assign(Object.assign({},i(e)),o(e))),"text"===e.type&&e.set(s({minFontSize:l,maxFontSize:x},e.fontSize/h,!0))},u=e=>r(e.type)?e._sourceSize:null,f=e=>!r(e.type)||e.stretchEnabled||!!u(e);export const resizeSelection=(t,n,o)=>{const s=getSelectionBox(t),r="x"===n?null==s?void 0:s.width:null==s?void 0:s.height;if(!(s&&r&&o>0&&canResizeSelection(t))){return}const c=t.selectedShapes,a=p(t),h=c.every(f)&&(a?((e,t)=>"text"===e.type?"x"===t&&!e.curveEnabled:canStretchAxis(e,t,e.rotation))(a,n):c.every(e=>canStretchAxis(e,n,0))),l=Math.max(...c.flatMap(e=>(h?[n]:["x","y"]).map(t=>{const i="x"===t?e.width:e.height,n=leafMinSize(e,t,h,i);return i>=n?n/i:0}))),d=Math.max(o/r,l),S={x:s.x,y:s.y};t.history.transaction(()=>{c.forEach(t=>{h?((t,n,o,s)=>{const[r,c]="x"===n?["x","width"]:["y","height"],a=u(t),h=Object.assign({[r]:s[r]+(t[r]-s[r])*o,[c]:t[c]*o},a&&!t.fit&&x(t,a,"x"===n?o:1,"y"===n?o:1));if("table"===t.type){const{height:i=t.height}=h,n=e(h,["height"]);return void g(t,n,i)}t.set(h),t.set(i(t))})(t,n,d,S):y(t,d,S)})})};const S=(e,t,i)=>{e.forEach(e=>{e.set({x:n(e.x+t),y:n(e.y+i)})})};export const moveSelection=(e,t,i)=>{const n=getSelectionBox(e);if(!n||!Number.isFinite(i)||!canMoveSelection(e)){return}const o=i-("x"===t?n.x:n.y);e.history.transaction(()=>{S(e.selectedShapes,"x"===t?o:0,"y"===t?o:0)})};export const canFitSelectionToPage=e=>canResizeSelection(e)&&canMoveSelection(e);export const fitSelectionToPage=e=>{var i;const n=e.selectedShapes,o=null===(i=n[0])||void 0===i?void 0:i.page;if(!o||!canFitSelectionToPage(e)){return}const s=t(n);if(!s.width||!s.height){return}const r=Math.min(o.computedWidth/s.width,o.computedHeight/s.height);e.history.transaction(()=>{n.forEach(e=>y(e,r,{x:s.x,y:s.y}));const e=t(n);S(n,(o.computedWidth-e.width)/2-e.x,(o.computedHeight-e.height)/2-e.y)})};
@@ -14,7 +14,7 @@ export declare const useInfiniteAPI: ({ defaultQuery, timeout, getAPI, getSize,
14
14
  setQuery: (newQuery: string) => void;
15
15
  isLoading: boolean;
16
16
  loadMore: () => void;
17
- isReachingEnd: any;
17
+ isReachingEnd: boolean;
18
18
  data: any[] | undefined;
19
19
  items: any[];
20
20
  hasMore: boolean;
package/utils/use-api.js CHANGED
@@ -1 +1 @@
1
- import{useRef as e,useState as t,useCallback as r}from"react";import i from"swr/infinite";export const fetcher=e=>fetch(e).then(e=>e.json());export const useInfiniteAPI=({defaultQuery:o="",timeout:a=1e3,getAPI:n,getSize:l=e=>e.total_pages,fetchFunc:u=fetcher})=>{var s;const[d,c]=t(o),v=e(void 0),{data:f,error:g,size:h,setSize:m,mutate:p}=i(e=>n({query:d,page:e+1}),u,{revalidateAll:!1,revalidateOnFocus:!1,revalidateFirstPage:!1}),y=!f&&!g||!!(h>0&&f&&void 0===f[h-1]),z=0===(null===(s=null==f?void 0:f[0])||void 0===s?void 0:s.length),A=null==f?void 0:f[f.length-1],F=z||A&&l(A)===h;return{setQuery:r(e=>{clearTimeout(v.current),v.current=setTimeout(()=>{c(e)},a)},[a]),isLoading:y,loadMore:()=>{F||m(h+1)},isReachingEnd:F,data:null==f?void 0:f.filter(Boolean),items:(null==f?void 0:f.flat())||[],hasMore:!F,reset:p,error:g}};
1
+ import{useRef as e,useState as t,useCallback as r}from"react";import i from"swr/infinite";export const fetcher=e=>fetch(e).then(e=>e.json());export const useInfiniteAPI=({defaultQuery:o="",timeout:a=1e3,getAPI:n,getSize:l=e=>e.total_pages,fetchFunc:u=fetcher})=>{var s;const[d,c]=t(o),v=e(void 0),{data:f,error:g,size:h,setSize:m,mutate:p}=i(e=>n({query:d,page:e+1}),u,{revalidateAll:!1,revalidateOnFocus:!1,revalidateFirstPage:!1}),y=!f&&!g||!!(h>0&&f&&void 0===f[h-1]),z=0===(null===(s=null==f?void 0:f[0])||void 0===s?void 0:s.length),A=null==f?void 0:f[f.length-1],F=z||!!A&&h>=l(A);return{setQuery:r(e=>{clearTimeout(v.current),v.current=setTimeout(()=>{c(e)},a)},[a]),isLoading:y,loadMore:()=>{F||m(h+1)},isReachingEnd:F,data:null==f?void 0:f.filter(Boolean),items:(null==f?void 0:f.flat())||[],hasMore:!F,reset:p,error:g}};
@@ -1 +1 @@
1
- import*as e from"mobx";import{NO_KEY_MESSAGE as o,NO_VALID_MESSAGE as t,NOT_PAID_MESSAGE as n,NOT_PAID_STYLE as a}from"@polotno/core/validate-key";import{getAPI as i}from"./api.js";import{removeBackgroundState as r}from"./flags.js";const s=e.observable({value:!1}),l=e.observable({value:"v1"});export const ___=()=>l.value;const c=e.observable({value:0});export const ____=()=>c.value;export const isCreditVisible=()=>s.value;const d=e.action(()=>{s.value=!0});let u="";export const getKey=()=>u||"";export const setKey=e=>{u=e||""};let p="undefined"!=typeof window?window.location.origin:"";const v="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Headless")>-1,f="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Electron")>-1;"file://"===p&&v&&(p="headless"),"file://"===p&&f&&(p="electron");const m=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${p}" here: https://polotno.com/cabinet`;let g=fetch;export const __=e=>{g=e};export async function isKeyPaid(s){for(let u=0;u<5;u++){try{const d=await g(i()+"/validate-key",{method:"POST",body:JSON.stringify({key:s,sdkVersion:"3.20.1"})});if(e.runInAction(()=>{l.value=d.headers.get("x-api-version")||""}),!s){return console.error(o),e.runInAction(()=>{c.value=1}),!1}if(200!==d.status){await new Promise(e=>setTimeout(e,3e3));continue}const u=await d.json();return u.is_valid||(console.error(t),e.runInAction(()=>{c.value=1})),u.is_paid||(console.log(n,a),e.runInAction(()=>{0===c.value&&(c.value=2)})),u.is_domain_valid||console.log(m,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),e.runInAction(()=>{r.defaultEnabled=u.remove_background_enabled}),u.is_paid||!1}catch(d){await new Promise(e=>setTimeout(e,3e3))}}return console.error("Can not validate Polotno API key. Please report to anton@polotno.com immediately."),!0}export async function validateKey(e){await isKeyPaid(u)&&!e||d()}
1
+ import*as e from"mobx";import{NO_KEY_MESSAGE as o,NO_VALID_MESSAGE as t,NOT_PAID_MESSAGE as n,NOT_PAID_STYLE as a}from"@polotno/core/validate-key";import{getAPI as i}from"./api.js";import{removeBackgroundState as r}from"./flags.js";const s=e.observable({value:!1}),l=e.observable({value:"v1"});export const ___=()=>l.value;const c=e.observable({value:0});export const ____=()=>c.value;export const isCreditVisible=()=>s.value;const d=e.action(()=>{s.value=!0});let u="";export const getKey=()=>u||"";export const setKey=e=>{u=e||""};let p="undefined"!=typeof window?window.location.origin:"";const v="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Headless")>-1,f="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Electron")>-1;"file://"===p&&v&&(p="headless"),"file://"===p&&f&&(p="electron");const m=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${p}" here: https://polotno.com/cabinet`;let g=fetch;export const __=e=>{g=e};export async function isKeyPaid(s){for(let u=0;u<5;u++){try{const d=await g(i()+"/validate-key",{method:"POST",body:JSON.stringify({key:s,sdkVersion:"3.22.0"})});if(e.runInAction(()=>{l.value=d.headers.get("x-api-version")||""}),!s){return console.error(o),e.runInAction(()=>{c.value=1}),!1}if(200!==d.status){await new Promise(e=>setTimeout(e,3e3));continue}const u=await d.json();return u.is_valid||(console.error(t),e.runInAction(()=>{c.value=1})),u.is_paid||(console.log(n,a),e.runInAction(()=>{0===c.value&&(c.value=2)})),u.is_domain_valid||console.log(m,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),e.runInAction(()=>{r.defaultEnabled=u.remove_background_enabled}),u.is_paid||!1}catch(d){await new Promise(e=>setTimeout(e,3e3))}}return console.error("Can not validate Polotno API key. Please report to anton@polotno.com immediately."),!0}export async function validateKey(e){await isKeyPaid(u)&&!e||d()}