polotno 3.11.0 → 3.12.1
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.
- package/README.md +57 -22
- package/blueprint/side-panel/select-video.d.ts +6 -2
- package/canvas/crop-overlay.d.ts +42 -0
- package/canvas/crop-overlay.js +1 -0
- package/canvas/downscale-bands.d.ts +10 -0
- package/canvas/downscale-bands.js +1 -0
- package/canvas/downscale-kernel.d.ts +7 -0
- package/canvas/downscale-kernel.js +1 -0
- package/canvas/downscale-kernel.wasm.d.ts +1 -0
- package/canvas/downscale-kernel.wasm.js +1 -0
- package/canvas/downscale-passes.d.ts +7 -0
- package/canvas/downscale-passes.js +1 -0
- package/canvas/downscale.d.ts +16 -2
- package/canvas/downscale.js +1 -1
- package/canvas/drawing-layer.js +1 -1
- package/canvas/element.js +1 -1
- package/canvas/gif-element.js +1 -1
- package/canvas/hotkeys.js +1 -1
- package/canvas/image-element.d.ts +10 -0
- package/canvas/image-element.js +1 -1
- package/canvas/page.js +1 -1
- package/canvas/tooltip.js +1 -1
- package/canvas/transform-box.d.ts +9 -0
- package/canvas/transform-box.js +1 -0
- package/canvas/use-image.d.ts +4 -0
- package/canvas/use-image.js +1 -0
- package/canvas/video-element.js +1 -1
- package/canvas/workspace-canvas.d.ts +3 -1
- package/canvas/workspace-canvas.js +1 -1
- package/canvas/workspace-style.d.ts +4 -0
- package/canvas/workspace-style.js +1 -1
- package/model/crop-mode.d.ts +34 -0
- package/model/crop-mode.js +1 -0
- package/model/figure-model.d.ts +1 -1
- package/model/gif-model.d.ts +3 -1
- package/model/group-model.d.ts +21 -8
- package/model/image-model.d.ts +3 -1
- package/model/image-model.js +1 -1
- package/model/line-model.d.ts +1 -1
- package/model/page-model.d.ts +23 -10
- package/model/shape-model.d.ts +2 -2
- package/model/shape-model.js +1 -1
- package/model/store.d.ts +236 -97
- package/model/store.js +1 -1
- package/model/svg-model.d.ts +8 -1
- package/model/svg-model.js +1 -1
- package/model/table-model.d.ts +1 -1
- package/model/text-model.d.ts +1 -1
- package/model/video-model.d.ts +3 -1
- package/package.json +44 -25
- package/polotno.bundle.js +180 -194
- package/side-panel/draw-panel.js +1 -1
- package/side-panel/select-image.js +1 -1
- package/side-panel/select-video.d.ts +6 -2
- package/toolbar/image-toolbar.d.ts +7 -2
- package/toolbar/image-toolbar.js +1 -1
- package/toolbar/svg-toolbar.js +1 -1
- package/toolbar/toolbar.js +1 -1
- package/utils/base64.d.ts +1 -1
- package/utils/clipboard.d.ts +2 -2
- package/utils/fonts.d.ts +1 -0
- package/utils/fonts.js +1 -1
- package/utils/html2canvas.js +1 -1
- package/utils/l10n.d.ts +4 -0
- package/utils/l10n.js +1 -1
- package/utils/path-to-svg.d.ts +0 -2
- package/utils/path-to-svg.js +1 -1
- package/utils/px.d.ts +1 -0
- package/utils/px.js +1 -1
- package/utils/rich-text-html.d.ts +0 -10
- package/utils/rich-text-html.js +1 -1
- package/utils/validate-key.js +1 -1
package/model/group-model.d.ts
CHANGED
|
@@ -203,7 +203,7 @@ export declare const TYPES_MAP: {
|
|
|
203
203
|
} & {
|
|
204
204
|
readonly locked: boolean;
|
|
205
205
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
206
|
-
animated(attr:
|
|
206
|
+
animated(attr: string): any;
|
|
207
207
|
readonly timeRange: {
|
|
208
208
|
start: number;
|
|
209
209
|
end: number;
|
|
@@ -217,6 +217,13 @@ export declare const TYPES_MAP: {
|
|
|
217
217
|
} & {
|
|
218
218
|
replaceColor(oldColor: any, newColor: any): void;
|
|
219
219
|
resetColors(): void;
|
|
220
|
+
} & {
|
|
221
|
+
toggleCropMode(flag?: boolean): void;
|
|
222
|
+
cancelCropMode(): void;
|
|
223
|
+
beforeDestroy(): void;
|
|
224
|
+
} & {
|
|
225
|
+
readonly _cropModeEnabled: boolean;
|
|
226
|
+
readonly _cropEnabled: boolean;
|
|
220
227
|
}, any, import("mobx-state-tree").ModelSnapshotType<{
|
|
221
228
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
222
229
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -384,7 +391,7 @@ export declare const TYPES_MAP: {
|
|
|
384
391
|
} & {
|
|
385
392
|
readonly locked: boolean;
|
|
386
393
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
387
|
-
animated(attr:
|
|
394
|
+
animated(attr: string): any;
|
|
388
395
|
readonly timeRange: {
|
|
389
396
|
start: number;
|
|
390
397
|
end: number;
|
|
@@ -554,7 +561,7 @@ export declare const TYPES_MAP: {
|
|
|
554
561
|
} & {
|
|
555
562
|
readonly locked: boolean;
|
|
556
563
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
557
|
-
animated(attr:
|
|
564
|
+
animated(attr: string): any;
|
|
558
565
|
readonly timeRange: {
|
|
559
566
|
start: number;
|
|
560
567
|
end: number;
|
|
@@ -567,9 +574,11 @@ export declare const TYPES_MAP: {
|
|
|
567
574
|
setFilter(type: any, value: any): void;
|
|
568
575
|
} & {
|
|
569
576
|
toggleCropMode(flag?: boolean): void;
|
|
577
|
+
cancelCropMode(): void;
|
|
570
578
|
beforeDestroy(): void;
|
|
571
579
|
} & {
|
|
572
580
|
readonly _cropModeEnabled: boolean;
|
|
581
|
+
readonly _cropEnabled: boolean;
|
|
573
582
|
}, import("mobx-state-tree").ModelCreationType<{
|
|
574
583
|
id: string;
|
|
575
584
|
type: string | undefined;
|
|
@@ -728,7 +737,7 @@ export declare const TYPES_MAP: {
|
|
|
728
737
|
} & {
|
|
729
738
|
readonly locked: boolean;
|
|
730
739
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
731
|
-
animated(attr:
|
|
740
|
+
animated(attr: string): any;
|
|
732
741
|
readonly timeRange: {
|
|
733
742
|
start: number;
|
|
734
743
|
end: number;
|
|
@@ -912,7 +921,7 @@ export declare const TYPES_MAP: {
|
|
|
912
921
|
} & {
|
|
913
922
|
readonly locked: boolean;
|
|
914
923
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
915
|
-
animated(attr:
|
|
924
|
+
animated(attr: string): any;
|
|
916
925
|
readonly timeRange: {
|
|
917
926
|
start: number;
|
|
918
927
|
end: number;
|
|
@@ -925,9 +934,11 @@ export declare const TYPES_MAP: {
|
|
|
925
934
|
setFilter(type: any, value: any): void;
|
|
926
935
|
} & {
|
|
927
936
|
toggleCropMode(flag?: boolean): void;
|
|
937
|
+
cancelCropMode(): void;
|
|
928
938
|
beforeDestroy(): void;
|
|
929
939
|
} & {
|
|
930
940
|
readonly _cropModeEnabled: boolean;
|
|
941
|
+
readonly _cropEnabled: boolean;
|
|
931
942
|
}, import("mobx-state-tree").ModelCreationType<{
|
|
932
943
|
id: string;
|
|
933
944
|
type: string | undefined;
|
|
@@ -1085,7 +1096,7 @@ export declare const TYPES_MAP: {
|
|
|
1085
1096
|
} & {
|
|
1086
1097
|
readonly locked: boolean;
|
|
1087
1098
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
1088
|
-
animated(attr:
|
|
1099
|
+
animated(attr: string): any;
|
|
1089
1100
|
readonly timeRange: {
|
|
1090
1101
|
start: number;
|
|
1091
1102
|
end: number;
|
|
@@ -1266,7 +1277,7 @@ export declare const TYPES_MAP: {
|
|
|
1266
1277
|
} & {
|
|
1267
1278
|
readonly locked: boolean;
|
|
1268
1279
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
1269
|
-
animated(attr:
|
|
1280
|
+
animated(attr: string): any;
|
|
1270
1281
|
readonly timeRange: {
|
|
1271
1282
|
start: number;
|
|
1272
1283
|
end: number;
|
|
@@ -1279,9 +1290,11 @@ export declare const TYPES_MAP: {
|
|
|
1279
1290
|
setFilter(type: any, value: any): void;
|
|
1280
1291
|
} & {
|
|
1281
1292
|
toggleCropMode(flag?: boolean): void;
|
|
1293
|
+
cancelCropMode(): void;
|
|
1282
1294
|
beforeDestroy(): void;
|
|
1283
1295
|
} & {
|
|
1284
1296
|
readonly _cropModeEnabled: boolean;
|
|
1297
|
+
readonly _cropEnabled: boolean;
|
|
1285
1298
|
}, import("mobx-state-tree").ModelCreationType<{
|
|
1286
1299
|
id: string;
|
|
1287
1300
|
type: string | undefined;
|
|
@@ -1588,7 +1601,7 @@ export declare const TYPES_MAP: {
|
|
|
1588
1601
|
} & {
|
|
1589
1602
|
readonly locked: boolean;
|
|
1590
1603
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
1591
|
-
animated(attr:
|
|
1604
|
+
animated(attr: string): any;
|
|
1592
1605
|
readonly timeRange: {
|
|
1593
1606
|
start: number;
|
|
1594
1607
|
end: number;
|
package/model/image-model.d.ts
CHANGED
|
@@ -142,7 +142,7 @@ export declare const ImageElement: import("mobx-state-tree").IModelType<{
|
|
|
142
142
|
} & {
|
|
143
143
|
readonly locked: boolean;
|
|
144
144
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
145
|
-
animated(attr:
|
|
145
|
+
animated(attr: string): any;
|
|
146
146
|
readonly timeRange: {
|
|
147
147
|
start: number;
|
|
148
148
|
end: number;
|
|
@@ -155,9 +155,11 @@ export declare const ImageElement: import("mobx-state-tree").IModelType<{
|
|
|
155
155
|
setFilter(type: any, value: any): void;
|
|
156
156
|
} & {
|
|
157
157
|
toggleCropMode(flag?: boolean): void;
|
|
158
|
+
cancelCropMode(): void;
|
|
158
159
|
beforeDestroy(): void;
|
|
159
160
|
} & {
|
|
160
161
|
readonly _cropModeEnabled: boolean;
|
|
162
|
+
readonly _cropEnabled: boolean;
|
|
161
163
|
}, import("mobx-state-tree").ModelCreationType<{
|
|
162
164
|
id: string;
|
|
163
165
|
type: string | undefined;
|
package/model/image-model.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Shape as e}from"./shape-model.js";import{cropMode as r}from"./crop-mode.js";export const ImageElement=e.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,keepRatio:!1,stretchEnabled:!1}).extend(r);
|
package/model/line-model.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export declare const LineElement: import("mobx-state-tree").IModelType<{
|
|
|
133
133
|
} & {
|
|
134
134
|
readonly locked: boolean;
|
|
135
135
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
136
|
-
animated(attr:
|
|
136
|
+
animated(attr: string): any;
|
|
137
137
|
readonly timeRange: {
|
|
138
138
|
start: number;
|
|
139
139
|
end: number;
|
package/model/page-model.d.ts
CHANGED
|
@@ -147,7 +147,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
147
147
|
} & {
|
|
148
148
|
readonly locked: boolean;
|
|
149
149
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
150
|
-
animated(attr:
|
|
150
|
+
animated(attr: string): any;
|
|
151
151
|
readonly timeRange: {
|
|
152
152
|
start: number;
|
|
153
153
|
end: number;
|
|
@@ -161,6 +161,13 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
161
161
|
} & {
|
|
162
162
|
replaceColor(oldColor: any, newColor: any): void;
|
|
163
163
|
resetColors(): void;
|
|
164
|
+
} & {
|
|
165
|
+
toggleCropMode(flag?: boolean): void;
|
|
166
|
+
cancelCropMode(): void;
|
|
167
|
+
beforeDestroy(): void;
|
|
168
|
+
} & {
|
|
169
|
+
readonly _cropModeEnabled: boolean;
|
|
170
|
+
readonly _cropEnabled: boolean;
|
|
164
171
|
}, any, import("mobx-state-tree").ModelSnapshotType<{
|
|
165
172
|
id: import("mobx-state-tree").ISimpleType<string>;
|
|
166
173
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -327,7 +334,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
327
334
|
} & {
|
|
328
335
|
readonly locked: boolean;
|
|
329
336
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
330
|
-
animated(attr:
|
|
337
|
+
animated(attr: string): any;
|
|
331
338
|
readonly timeRange: {
|
|
332
339
|
start: number;
|
|
333
340
|
end: number;
|
|
@@ -496,7 +503,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
496
503
|
} & {
|
|
497
504
|
readonly locked: boolean;
|
|
498
505
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
499
|
-
animated(attr:
|
|
506
|
+
animated(attr: string): any;
|
|
500
507
|
readonly timeRange: {
|
|
501
508
|
start: number;
|
|
502
509
|
end: number;
|
|
@@ -509,9 +516,11 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
509
516
|
setFilter(type: any, value: any): void;
|
|
510
517
|
} & {
|
|
511
518
|
toggleCropMode(flag?: boolean): void;
|
|
519
|
+
cancelCropMode(): void;
|
|
512
520
|
beforeDestroy(): void;
|
|
513
521
|
} & {
|
|
514
522
|
readonly _cropModeEnabled: boolean;
|
|
523
|
+
readonly _cropEnabled: boolean;
|
|
515
524
|
}, import("mobx-state-tree").ModelCreationType<{
|
|
516
525
|
id: string;
|
|
517
526
|
type: string | undefined;
|
|
@@ -668,7 +677,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
668
677
|
} & {
|
|
669
678
|
readonly locked: boolean;
|
|
670
679
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
671
|
-
animated(attr:
|
|
680
|
+
animated(attr: string): any;
|
|
672
681
|
readonly timeRange: {
|
|
673
682
|
start: number;
|
|
674
683
|
end: number;
|
|
@@ -851,7 +860,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
851
860
|
} & {
|
|
852
861
|
readonly locked: boolean;
|
|
853
862
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
854
|
-
animated(attr:
|
|
863
|
+
animated(attr: string): any;
|
|
855
864
|
readonly timeRange: {
|
|
856
865
|
start: number;
|
|
857
866
|
end: number;
|
|
@@ -864,9 +873,11 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
864
873
|
setFilter(type: any, value: any): void;
|
|
865
874
|
} & {
|
|
866
875
|
toggleCropMode(flag?: boolean): void;
|
|
876
|
+
cancelCropMode(): void;
|
|
867
877
|
beforeDestroy(): void;
|
|
868
878
|
} & {
|
|
869
879
|
readonly _cropModeEnabled: boolean;
|
|
880
|
+
readonly _cropEnabled: boolean;
|
|
870
881
|
}, import("mobx-state-tree").ModelCreationType<{
|
|
871
882
|
id: string;
|
|
872
883
|
type: string | undefined;
|
|
@@ -1023,7 +1034,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
1023
1034
|
} & {
|
|
1024
1035
|
readonly locked: boolean;
|
|
1025
1036
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
1026
|
-
animated(attr:
|
|
1037
|
+
animated(attr: string): any;
|
|
1027
1038
|
readonly timeRange: {
|
|
1028
1039
|
start: number;
|
|
1029
1040
|
end: number;
|
|
@@ -1203,7 +1214,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
1203
1214
|
} & {
|
|
1204
1215
|
readonly locked: boolean;
|
|
1205
1216
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
1206
|
-
animated(attr:
|
|
1217
|
+
animated(attr: string): any;
|
|
1207
1218
|
readonly timeRange: {
|
|
1208
1219
|
start: number;
|
|
1209
1220
|
end: number;
|
|
@@ -1216,9 +1227,11 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
1216
1227
|
setFilter(type: any, value: any): void;
|
|
1217
1228
|
} & {
|
|
1218
1229
|
toggleCropMode(flag?: boolean): void;
|
|
1230
|
+
cancelCropMode(): void;
|
|
1219
1231
|
beforeDestroy(): void;
|
|
1220
1232
|
} & {
|
|
1221
1233
|
readonly _cropModeEnabled: boolean;
|
|
1234
|
+
readonly _cropEnabled: boolean;
|
|
1222
1235
|
}, import("mobx-state-tree").ModelCreationType<{
|
|
1223
1236
|
id: string;
|
|
1224
1237
|
type: string | undefined;
|
|
@@ -1524,7 +1537,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
1524
1537
|
} & {
|
|
1525
1538
|
readonly locked: boolean;
|
|
1526
1539
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
1527
|
-
animated(attr:
|
|
1540
|
+
animated(attr: string): any;
|
|
1528
1541
|
readonly timeRange: {
|
|
1529
1542
|
start: number;
|
|
1530
1543
|
end: number;
|
|
@@ -1724,7 +1737,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
1724
1737
|
} & {
|
|
1725
1738
|
readonly locked: boolean;
|
|
1726
1739
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
1727
|
-
animated(attr:
|
|
1740
|
+
animated(attr: string): any;
|
|
1728
1741
|
readonly timeRange: {
|
|
1729
1742
|
start: number;
|
|
1730
1743
|
end: number;
|
|
@@ -1861,7 +1874,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
|
|
|
1861
1874
|
} & {
|
|
1862
1875
|
readonly locked: boolean;
|
|
1863
1876
|
readonly a: import("./shape-model.js").AnimatedAttrs;
|
|
1864
|
-
animated(attr:
|
|
1877
|
+
animated(attr: string): any;
|
|
1865
1878
|
readonly timeRange: {
|
|
1866
1879
|
start: number;
|
|
1867
1880
|
end: number;
|
package/model/shape-model.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const Animation: import("mobx-state-tree").IModelType<{
|
|
|
16
16
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
17
17
|
data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>;
|
|
18
18
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
19
|
-
export declare const getDiff: (obj1: Record<string,
|
|
19
|
+
export declare const getDiff: (obj1: Record<string, unknown>, obj2: Record<string, unknown>) => Record<string, number>;
|
|
20
20
|
export declare const ShapeFilter: import("mobx-state-tree").IModelType<{
|
|
21
21
|
intensity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
22
22
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
@@ -147,7 +147,7 @@ export declare const Shape: import("mobx-state-tree").IModelType<{
|
|
|
147
147
|
} & {
|
|
148
148
|
readonly locked: boolean;
|
|
149
149
|
readonly a: AnimatedAttrs;
|
|
150
|
-
animated(attr:
|
|
150
|
+
animated(attr: string): any;
|
|
151
151
|
readonly timeRange: {
|
|
152
152
|
start: number;
|
|
153
153
|
end: number;
|
package/model/shape-model.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{types as e,isAlive as t}from"mobx-state-tree";import{animate as
|
|
1
|
+
import{types as e,isAlive as t}from"mobx-state-tree";import{animate as n}from"../utils/animations.js";import{computed as i}from"mobx";import{Node as o}from"./node-model.js";import{getElementTimeRange as a,getPlayheadLocalTime as r}from"../utils/timeline.js";export const Animation=e.model("Animation",{delay:0,duration:500,enabled:!0,type:e.enumeration("Type",["enter","exit","loop"]),name:"none",data:e.frozen({})});export const getDiff=(e,t)=>{const n={};for(const i in t){if("number"==typeof e[i]&&"number"==typeof t[i]){const o=t[i]-e[i];0!==o&&(n[i]=o)}}return n};export const ShapeFilter=e.model("ShapeFilter",{intensity:1});export const INDEPENDENT_FILTERS=["temperature","contrast","highlights","shadows","white","black","saturation","vibrance"];export const Shape=o.named("Shape").props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:e.array(Animation),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:e.map(ShapeFilter),shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",shadowOpacity:1,visible:!0,draggable:!0,resizable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{const t=Object.assign(Object.assign({},e),{x:"x"in e&&e.x||0,y:"y"in e&&e.y||0,filters:"filters"in e?Array.isArray(e.filters)?{}:e.filters:void 0});return"width"in e&&(t.width=t.width||1),"height"in e&&(t.height=t.height||1),"locked"in e&&e.locked&&(t.draggable=!1,t.contentEditable=!1,t.styleEditable=!1,t.resizable=!1,t.removable=!1),t}).views(e=>{var o,s,l,d,c,u;const f=["x","y","width","height","rotation","opacity","color","fontSize","cropX","cropY","cropWidth","cropHeight"],p=e,m={x:null!==(o=p.x)&&void 0!==o?o:0,y:null!==(s=p.y)&&void 0!==s?s:0,width:null!==(l=p.width)&&void 0!==l?l:0,height:null!==(d=p.height)&&void 0!==d?d:0,rotation:null!==(c=p.rotation)&&void 0!==c?c:0,opacity:null!==(u=p.opacity)&&void 0!==u?u:1};for(const t of f){t in e&&(m[t]=p[t])}const b=i(()=>{if(!t(e)){return m}const i=Object.assign({},m);for(const e in i){i[e]=p[e]}const o=r(e);if(null===o){return i}const a=e.store.isEditingPaused&&e.isSelected,s=e.store.animatedElementsIds;if(s.length&&!s.includes(e.id)){return i}const l=e.animations.find(e=>"enter"===e.type),d=(null==l?void 0:l.enabled)&&o<l.delay;d&&(i.opacity=0);const c=(null==l?void 0:l.enabled)&&o>=l.delay&&o<=l.delay+l.duration;if(c&&!a){const t=o-l.delay,a=n({element:e,animation:l,dTime:t}),r=getDiff(p,a);for(const e in r){const t=i[e];"number"==typeof t&&(i[e]=t+r[e])}}const u=e.animations.find(e=>"exit"===e.type);if(!d&&!c&&(null==u?void 0:u.enabled)&&o>=e.page.duration-u.duration-u.delay&&o<=e.page.duration-u.delay&&!a){const t=o-(e.page.duration-u.duration-u.delay),a=n({element:e,animation:u,dTime:t}),r=getDiff(p,a);for(const e in r){const t=i[e];"number"==typeof t&&(i[e]=t+r[e])}}(null==u?void 0:u.enabled)&&o>=e.page.duration-u.delay&&(i.opacity=0);const f=e.animations.find(e=>"loop"===e.type);if((null==f?void 0:f.enabled)&&!a){const t=n({element:e,animation:f,dTime:o}),a=getDiff(p,t);for(const e in a){const t=i[e];"number"==typeof t&&(i[e]=t+a[e])}}return i}),g={};for(const t in m){const e=i(()=>b.get()[t]);Object.defineProperty(g,t,{enumerable:!0,get:()=>e.get()})}return{get locked(){return!(e.draggable||e.contentEditable||e.styleEditable||e.resizable)},get a(){return g},animated(e){return this.a[e]},get timeRange(){return t(e)&&e.page?a(e.animations,e.page.duration):{start:0,end:0}},get active(){if(!t(e)){return!0}const n=r(e);if(null===n){return!0}const{start:i,end:o}=this.timeRange;return n>=i&&n<o},get isSelected(){return!!t(e)&&e.store.selectedShapes.indexOf(e)>=0&&e.selectable},get isSelectedDirectly(){return!!t(e)&&e.store.selectedElements.indexOf(e)>=0&&e.selectable}}}).actions(e=>({setAnimation(t,n){const i=e.animations.find(e=>e.type===t);i?Object.assign(i,n):e.animations.push(Object.assign({type:t},n))},setFilter(t,n){INDEPENDENT_FILTERS.includes(t)||e.filters.forEach((t,n)=>{INDEPENDENT_FILTERS.includes(n.toString())||e.filters.delete(n.toString())}),null==n?e.filters.delete(t):e.filters.set(t,{intensity:n})}}));
|