@twick/timeline 0.14.3 → 0.14.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.
- package/dist/context/timeline-context.d.ts +8 -2
- package/dist/core/addOns/animation.d.ts +3 -0
- package/dist/core/editor/timeline.editor.d.ts +8 -4
- package/dist/core/elements/base.element.d.ts +4 -0
- package/dist/core/elements/circle.element.d.ts +4 -0
- package/dist/core/elements/icon.element.d.ts +8 -3
- package/dist/core/elements/rect.element.d.ts +8 -0
- package/dist/core/track/track.d.ts +4 -3
- package/dist/index-CXhwwSX--DHE9Xex3.js.map +1 -1
- package/dist/index.js +146 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -35
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +12 -157
- package/dist/types.d.ts +128 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -484,7 +484,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
484
484
|
this.type = type;
|
|
485
485
|
this.props = {
|
|
486
486
|
x: 0,
|
|
487
|
-
y: 0
|
|
487
|
+
y: 0,
|
|
488
|
+
opacity: 1,
|
|
489
|
+
rotation: 0
|
|
488
490
|
};
|
|
489
491
|
}
|
|
490
492
|
getId() {
|
|
@@ -521,6 +523,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
521
523
|
y: ((_b = this.props) == null ? void 0 : _b.y) ?? 0
|
|
522
524
|
};
|
|
523
525
|
}
|
|
526
|
+
getRotation() {
|
|
527
|
+
return this.props.rotation ?? 0;
|
|
528
|
+
}
|
|
529
|
+
getOpacity() {
|
|
530
|
+
return this.props.opacity ?? 1;
|
|
531
|
+
}
|
|
524
532
|
setId(id) {
|
|
525
533
|
this.id = id;
|
|
526
534
|
return this;
|
|
@@ -554,6 +562,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
554
562
|
this.props.y = position.y;
|
|
555
563
|
return this;
|
|
556
564
|
}
|
|
565
|
+
setRotation(rotation) {
|
|
566
|
+
this.props.rotation = rotation;
|
|
567
|
+
return this;
|
|
568
|
+
}
|
|
569
|
+
setOpacity(opacity) {
|
|
570
|
+
this.props.opacity = opacity;
|
|
571
|
+
return this;
|
|
572
|
+
}
|
|
557
573
|
setProps(props) {
|
|
558
574
|
this.props = structuredClone(props);
|
|
559
575
|
return this;
|
|
@@ -1042,13 +1058,35 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1042
1058
|
}
|
|
1043
1059
|
}
|
|
1044
1060
|
class IconElement extends TrackElement {
|
|
1045
|
-
constructor(src, size) {
|
|
1061
|
+
constructor(src, size, fill = "#866bbf") {
|
|
1046
1062
|
super(TIMELINE_ELEMENT_TYPE.ICON);
|
|
1047
1063
|
this.props = {
|
|
1048
1064
|
src,
|
|
1065
|
+
fill,
|
|
1049
1066
|
size
|
|
1050
1067
|
};
|
|
1051
1068
|
}
|
|
1069
|
+
getSrc() {
|
|
1070
|
+
return this.props.src;
|
|
1071
|
+
}
|
|
1072
|
+
getFill() {
|
|
1073
|
+
return this.props.fill;
|
|
1074
|
+
}
|
|
1075
|
+
getSize() {
|
|
1076
|
+
return this.props.size;
|
|
1077
|
+
}
|
|
1078
|
+
setSrc(src) {
|
|
1079
|
+
this.props.src = src;
|
|
1080
|
+
return this;
|
|
1081
|
+
}
|
|
1082
|
+
setFill(fill) {
|
|
1083
|
+
this.props.fill = fill;
|
|
1084
|
+
return this;
|
|
1085
|
+
}
|
|
1086
|
+
setSize(size) {
|
|
1087
|
+
this.props.size = size;
|
|
1088
|
+
return this;
|
|
1089
|
+
}
|
|
1052
1090
|
accept(visitor) {
|
|
1053
1091
|
return visitor.visitIconElement(this);
|
|
1054
1092
|
}
|
|
@@ -1058,7 +1096,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1058
1096
|
super(TIMELINE_ELEMENT_TYPE.CIRCLE);
|
|
1059
1097
|
this.props = {
|
|
1060
1098
|
radius,
|
|
1061
|
-
fill
|
|
1099
|
+
fill,
|
|
1100
|
+
strokeColor: fill,
|
|
1101
|
+
lineWidth: 1
|
|
1062
1102
|
};
|
|
1063
1103
|
}
|
|
1064
1104
|
getFill() {
|
|
@@ -1067,6 +1107,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1067
1107
|
getRadius() {
|
|
1068
1108
|
return this.props.radius;
|
|
1069
1109
|
}
|
|
1110
|
+
getStrokeColor() {
|
|
1111
|
+
return this.props.strokeColor || this.props.fill;
|
|
1112
|
+
}
|
|
1113
|
+
getLineWidth() {
|
|
1114
|
+
return this.props.lineWidth ?? 0;
|
|
1115
|
+
}
|
|
1070
1116
|
setFill(fill) {
|
|
1071
1117
|
this.props.fill = fill;
|
|
1072
1118
|
return this;
|
|
@@ -1075,6 +1121,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1075
1121
|
this.props.radius = radius;
|
|
1076
1122
|
return this;
|
|
1077
1123
|
}
|
|
1124
|
+
setStrokeColor(strokeColor) {
|
|
1125
|
+
this.props.strokeColor = strokeColor;
|
|
1126
|
+
return this;
|
|
1127
|
+
}
|
|
1128
|
+
setLineWidth(lineWidth) {
|
|
1129
|
+
this.props.lineWidth = lineWidth;
|
|
1130
|
+
return this;
|
|
1131
|
+
}
|
|
1078
1132
|
accept(visitor) {
|
|
1079
1133
|
return visitor.visitCircleElement(this);
|
|
1080
1134
|
}
|
|
@@ -1085,18 +1139,48 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1085
1139
|
this.props = {
|
|
1086
1140
|
width: size.width,
|
|
1087
1141
|
height: size.height,
|
|
1088
|
-
fill
|
|
1142
|
+
fill,
|
|
1143
|
+
radius: 0,
|
|
1144
|
+
strokeColor: fill,
|
|
1145
|
+
lineWidth: 1
|
|
1089
1146
|
};
|
|
1090
1147
|
}
|
|
1148
|
+
getFill() {
|
|
1149
|
+
return this.props.fill;
|
|
1150
|
+
}
|
|
1091
1151
|
setFill(fill) {
|
|
1092
1152
|
this.props.fill = fill;
|
|
1093
1153
|
return this;
|
|
1094
1154
|
}
|
|
1155
|
+
getSize() {
|
|
1156
|
+
return { width: this.props.width, height: this.props.height };
|
|
1157
|
+
}
|
|
1158
|
+
getCornerRadius() {
|
|
1159
|
+
return this.props.radius;
|
|
1160
|
+
}
|
|
1161
|
+
getStrokeColor() {
|
|
1162
|
+
return this.props.strokeColor || this.props.fill;
|
|
1163
|
+
}
|
|
1164
|
+
getLineWidth() {
|
|
1165
|
+
return this.props.lineWidth ?? 0;
|
|
1166
|
+
}
|
|
1095
1167
|
setSize(size) {
|
|
1096
1168
|
this.props.width = size.width;
|
|
1097
1169
|
this.props.height = size.height;
|
|
1098
1170
|
return this;
|
|
1099
1171
|
}
|
|
1172
|
+
setCornerRadius(cornerRadius) {
|
|
1173
|
+
this.props.radius = cornerRadius;
|
|
1174
|
+
return this;
|
|
1175
|
+
}
|
|
1176
|
+
setStrokeColor(strokeColor) {
|
|
1177
|
+
this.props.strokeColor = strokeColor;
|
|
1178
|
+
return this;
|
|
1179
|
+
}
|
|
1180
|
+
setLineWidth(lineWidth) {
|
|
1181
|
+
this.props.lineWidth = lineWidth;
|
|
1182
|
+
return this;
|
|
1183
|
+
}
|
|
1100
1184
|
accept(visitor) {
|
|
1101
1185
|
return visitor.visitRectElement(this);
|
|
1102
1186
|
}
|
|
@@ -1105,6 +1189,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1105
1189
|
constructor(name) {
|
|
1106
1190
|
__publicField(this, "name");
|
|
1107
1191
|
__publicField(this, "interval");
|
|
1192
|
+
__publicField(this, "duration");
|
|
1108
1193
|
__publicField(this, "intensity");
|
|
1109
1194
|
__publicField(this, "animate");
|
|
1110
1195
|
__publicField(this, "mode");
|
|
@@ -1117,6 +1202,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1117
1202
|
getInterval() {
|
|
1118
1203
|
return this.interval;
|
|
1119
1204
|
}
|
|
1205
|
+
getDuration() {
|
|
1206
|
+
return this.duration;
|
|
1207
|
+
}
|
|
1120
1208
|
getIntensity() {
|
|
1121
1209
|
return this.intensity;
|
|
1122
1210
|
}
|
|
@@ -1133,6 +1221,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1133
1221
|
this.interval = interval;
|
|
1134
1222
|
return this;
|
|
1135
1223
|
}
|
|
1224
|
+
setDuration(duration) {
|
|
1225
|
+
this.duration = duration;
|
|
1226
|
+
return this;
|
|
1227
|
+
}
|
|
1136
1228
|
setIntensity(intensity) {
|
|
1137
1229
|
this.intensity = intensity;
|
|
1138
1230
|
return this;
|
|
@@ -1153,6 +1245,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1153
1245
|
return {
|
|
1154
1246
|
name: this.name,
|
|
1155
1247
|
interval: this.interval,
|
|
1248
|
+
duration: this.duration,
|
|
1156
1249
|
intensity: this.intensity,
|
|
1157
1250
|
animate: this.animate,
|
|
1158
1251
|
mode: this.mode,
|
|
@@ -1162,6 +1255,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1162
1255
|
static fromJSON(json) {
|
|
1163
1256
|
const animation = new ElementAnimation(json.name);
|
|
1164
1257
|
animation.setInterval(json.interval);
|
|
1258
|
+
animation.setDuration(json.duration);
|
|
1165
1259
|
animation.setIntensity(json.intensity);
|
|
1166
1260
|
animation.setAnimate(json.animate);
|
|
1167
1261
|
animation.setMode(json.mode);
|
|
@@ -1247,7 +1341,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1247
1341
|
return {
|
|
1248
1342
|
name: this.name,
|
|
1249
1343
|
delay: this.delay,
|
|
1250
|
-
duration: this.duration,
|
|
1344
|
+
duration: this.duration ?? 1,
|
|
1251
1345
|
bufferTime: this.bufferTime
|
|
1252
1346
|
};
|
|
1253
1347
|
}
|
|
@@ -1315,11 +1409,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1315
1409
|
return captionElement;
|
|
1316
1410
|
}
|
|
1317
1411
|
static deserializeIconElement(json) {
|
|
1318
|
-
var _a, _b;
|
|
1319
|
-
const size = ((_a = json.props) == null ? void 0 : _a.size)
|
|
1412
|
+
var _a, _b, _c;
|
|
1413
|
+
const size = ((_a = json.props) == null ? void 0 : _a.size) ?? { width: 100, height: 100 };
|
|
1320
1414
|
const iconElement = new IconElement(
|
|
1321
1415
|
((_b = json.props) == null ? void 0 : _b.src) || "",
|
|
1322
|
-
size
|
|
1416
|
+
size,
|
|
1417
|
+
(_c = json.props) == null ? void 0 : _c.fill
|
|
1323
1418
|
);
|
|
1324
1419
|
ElementDeserializer.deserializeBaseElement(iconElement, json);
|
|
1325
1420
|
return iconElement;
|
|
@@ -1555,10 +1650,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1555
1650
|
const basicValidation = this.validateBasicProperties(element);
|
|
1556
1651
|
const errors = [...basicValidation.errors];
|
|
1557
1652
|
const warnings = [...basicValidation.warnings];
|
|
1558
|
-
const props = element.getProps();
|
|
1559
|
-
if (!(props == null ? void 0 : props.icon)) {
|
|
1560
|
-
errors.push("Icon element must have an icon name");
|
|
1561
|
-
}
|
|
1562
1653
|
return { errors, warnings };
|
|
1563
1654
|
}
|
|
1564
1655
|
validateCircleElement(element) {
|
|
@@ -1714,15 +1805,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1714
1805
|
* Creates a new Track instance.
|
|
1715
1806
|
*
|
|
1716
1807
|
* @param name - The display name for the track
|
|
1808
|
+
* @param type - The type of the track
|
|
1717
1809
|
* @param id - Optional unique identifier (auto-generated if not provided)
|
|
1718
1810
|
*
|
|
1719
1811
|
* @example
|
|
1720
1812
|
* ```js
|
|
1721
1813
|
* const track = new Track("My Video Track");
|
|
1722
|
-
* const trackWithId = new Track("Audio Track", "
|
|
1814
|
+
* const trackWithId = new Track("Audio Track", "element", "video-track-1");
|
|
1723
1815
|
* ```
|
|
1724
1816
|
*/
|
|
1725
|
-
constructor(name, id) {
|
|
1817
|
+
constructor(name, type = "element", id) {
|
|
1726
1818
|
__publicField(this, "id");
|
|
1727
1819
|
__publicField(this, "name");
|
|
1728
1820
|
__publicField(this, "type");
|
|
@@ -1730,7 +1822,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1730
1822
|
__publicField(this, "validator");
|
|
1731
1823
|
this.name = name;
|
|
1732
1824
|
this.id = id ?? `t-${generateShortUuid}`;
|
|
1733
|
-
this.type =
|
|
1825
|
+
this.type = type;
|
|
1734
1826
|
this.elements = [];
|
|
1735
1827
|
this.validator = new ElementValidator();
|
|
1736
1828
|
}
|
|
@@ -1821,7 +1913,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1821
1913
|
*
|
|
1822
1914
|
* @example
|
|
1823
1915
|
* ```js
|
|
1824
|
-
* const track = new Track("My Track", "track-123");
|
|
1916
|
+
* const track = new Track("My Track", "element", "track-123");
|
|
1825
1917
|
* const id = track.getId(); // "track-123"
|
|
1826
1918
|
* ```
|
|
1827
1919
|
*/
|
|
@@ -2163,7 +2255,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2163
2255
|
* ```
|
|
2164
2256
|
*/
|
|
2165
2257
|
static fromJSON(json) {
|
|
2166
|
-
const track = new Track(json.name, json.id);
|
|
2258
|
+
const track = new Track(json.name, json.type ?? "element", json.id);
|
|
2167
2259
|
track.type = json.type;
|
|
2168
2260
|
track.elements = (json.elements || []).map(ElementDeserializer.fromJSON);
|
|
2169
2261
|
return track;
|
|
@@ -2585,7 +2677,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2585
2677
|
visitIconElement(element) {
|
|
2586
2678
|
const clonedElement = new IconElement(
|
|
2587
2679
|
element.getProps().src,
|
|
2588
|
-
element.getProps().size
|
|
2680
|
+
element.getProps().size,
|
|
2681
|
+
element.getProps().fill
|
|
2589
2682
|
);
|
|
2590
2683
|
this.cloneElementProperties(element, clonedElement);
|
|
2591
2684
|
return clonedElement;
|
|
@@ -2759,7 +2852,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2759
2852
|
const timelineData = timelineContextStore.getTimelineData(contextId);
|
|
2760
2853
|
return (timelineData == null ? void 0 : timelineData.version) || 0;
|
|
2761
2854
|
}
|
|
2762
|
-
setTimelineData(
|
|
2855
|
+
setTimelineData({
|
|
2856
|
+
tracks,
|
|
2857
|
+
version,
|
|
2858
|
+
updatePlayerData
|
|
2859
|
+
}) {
|
|
2860
|
+
var _a, _b;
|
|
2763
2861
|
const prevTimelineData = this.getTimelineData();
|
|
2764
2862
|
const updatedVersion = version ?? ((prevTimelineData == null ? void 0 : prevTimelineData.version) || 0) + 1;
|
|
2765
2863
|
const updatedTimelineData = {
|
|
@@ -2772,14 +2870,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2772
2870
|
);
|
|
2773
2871
|
this.updateHistory(updatedTimelineData);
|
|
2774
2872
|
this.context.updateChangeLog();
|
|
2873
|
+
if (updatePlayerData) {
|
|
2874
|
+
(_b = (_a = this.context) == null ? void 0 : _a.setTimelineAction) == null ? void 0 : _b.call(
|
|
2875
|
+
_a,
|
|
2876
|
+
TIMELINE_ACTION.UPDATE_PLAYER_DATA,
|
|
2877
|
+
updatedTimelineData
|
|
2878
|
+
);
|
|
2879
|
+
}
|
|
2775
2880
|
return updatedTimelineData;
|
|
2776
2881
|
}
|
|
2777
|
-
addTrack(name) {
|
|
2882
|
+
addTrack(name, type = "element") {
|
|
2778
2883
|
const prevTimelineData = this.getTimelineData();
|
|
2779
2884
|
const id = `t-${generateShortUuid()}`;
|
|
2780
|
-
const track = new Track(name, id);
|
|
2885
|
+
const track = new Track(name, type, id);
|
|
2781
2886
|
const updatedTimelines = [...(prevTimelineData == null ? void 0 : prevTimelineData.tracks) || [], track];
|
|
2782
|
-
this.setTimelineData(updatedTimelines);
|
|
2887
|
+
this.setTimelineData({ tracks: updatedTimelines, updatePlayerData: true });
|
|
2783
2888
|
return track;
|
|
2784
2889
|
}
|
|
2785
2890
|
getTrackById(id) {
|
|
@@ -2796,13 +2901,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2796
2901
|
var _a;
|
|
2797
2902
|
const tracks = ((_a = this.getTimelineData()) == null ? void 0 : _a.tracks) || [];
|
|
2798
2903
|
const updatedTracks = tracks.filter((t2) => t2.getId() !== id);
|
|
2799
|
-
this.setTimelineData(updatedTracks);
|
|
2904
|
+
this.setTimelineData({ tracks: updatedTracks, updatePlayerData: true });
|
|
2800
2905
|
}
|
|
2801
2906
|
removeTrack(track) {
|
|
2802
2907
|
var _a;
|
|
2803
2908
|
const tracks = ((_a = this.getTimelineData()) == null ? void 0 : _a.tracks) || [];
|
|
2804
2909
|
const updatedTracks = tracks.filter((t2) => t2.getId() !== track.getId());
|
|
2805
|
-
this.setTimelineData(updatedTracks);
|
|
2910
|
+
this.setTimelineData({ tracks: updatedTracks, updatePlayerData: true });
|
|
2806
2911
|
}
|
|
2807
2912
|
/**
|
|
2808
2913
|
* Refresh the timeline data
|
|
@@ -2810,7 +2915,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2810
2915
|
refresh() {
|
|
2811
2916
|
const currentData = this.getTimelineData();
|
|
2812
2917
|
if (currentData) {
|
|
2813
|
-
this.setTimelineData(currentData.tracks);
|
|
2918
|
+
this.setTimelineData({ tracks: currentData.tracks, updatePlayerData: true });
|
|
2814
2919
|
}
|
|
2815
2920
|
}
|
|
2816
2921
|
/**
|
|
@@ -2829,7 +2934,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2829
2934
|
if (result) {
|
|
2830
2935
|
const currentData = this.getTimelineData();
|
|
2831
2936
|
if (currentData) {
|
|
2832
|
-
this.setTimelineData(currentData.tracks);
|
|
2937
|
+
this.setTimelineData({ tracks: currentData.tracks, updatePlayerData: true });
|
|
2833
2938
|
}
|
|
2834
2939
|
}
|
|
2835
2940
|
return result;
|
|
@@ -2853,7 +2958,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2853
2958
|
if (result) {
|
|
2854
2959
|
const currentData = this.getTimelineData();
|
|
2855
2960
|
if (currentData) {
|
|
2856
|
-
this.setTimelineData(currentData.tracks);
|
|
2961
|
+
this.setTimelineData({ tracks: currentData.tracks, updatePlayerData: true });
|
|
2857
2962
|
}
|
|
2858
2963
|
}
|
|
2859
2964
|
return result;
|
|
@@ -2864,12 +2969,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2864
2969
|
/**
|
|
2865
2970
|
* Update an element in a specific track using the visitor pattern
|
|
2866
2971
|
* @param element The updated element
|
|
2867
|
-
* @returns
|
|
2972
|
+
* @returns TrackElement the updated element
|
|
2868
2973
|
*/
|
|
2869
2974
|
updateElement(element) {
|
|
2870
2975
|
const track = this.getTrackById(element.getTrackId());
|
|
2871
2976
|
if (!track) {
|
|
2872
|
-
return
|
|
2977
|
+
return element;
|
|
2873
2978
|
}
|
|
2874
2979
|
try {
|
|
2875
2980
|
const elementUpdater = new ElementUpdater(track);
|
|
@@ -2877,12 +2982,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2877
2982
|
if (result) {
|
|
2878
2983
|
const currentData = this.getTimelineData();
|
|
2879
2984
|
if (currentData) {
|
|
2880
|
-
this.setTimelineData(currentData.tracks);
|
|
2985
|
+
this.setTimelineData({ tracks: currentData.tracks });
|
|
2881
2986
|
}
|
|
2882
2987
|
}
|
|
2883
|
-
return
|
|
2988
|
+
return element;
|
|
2884
2989
|
} catch (error) {
|
|
2885
|
-
return
|
|
2990
|
+
return element;
|
|
2886
2991
|
}
|
|
2887
2992
|
}
|
|
2888
2993
|
/**
|
|
@@ -2907,7 +3012,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2907
3012
|
result.secondElement.accept(elementAdder);
|
|
2908
3013
|
const currentData = this.getTimelineData();
|
|
2909
3014
|
if (currentData) {
|
|
2910
|
-
this.setTimelineData(currentData.tracks);
|
|
3015
|
+
this.setTimelineData({ tracks: currentData.tracks, updatePlayerData: true });
|
|
2911
3016
|
}
|
|
2912
3017
|
}
|
|
2913
3018
|
return result;
|
|
@@ -2929,7 +3034,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2929
3034
|
}
|
|
2930
3035
|
}
|
|
2931
3036
|
reorderTracks(tracks) {
|
|
2932
|
-
this.setTimelineData(tracks);
|
|
3037
|
+
this.setTimelineData({ tracks, updatePlayerData: true });
|
|
2933
3038
|
}
|
|
2934
3039
|
updateHistory(timelineTrackData) {
|
|
2935
3040
|
const tracks = timelineTrackData.tracks.map((t2) => t2.serialize());
|
|
@@ -3014,7 +3119,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3014
3119
|
this.pauseVideo();
|
|
3015
3120
|
this.context.handleResetHistory();
|
|
3016
3121
|
const timelineTracks = tracks.map((t2) => Track.fromJSON(t2));
|
|
3017
|
-
this.setTimelineData(timelineTracks, version);
|
|
3122
|
+
this.setTimelineData({ tracks: timelineTracks, version, updatePlayerData: true });
|
|
3018
3123
|
if ((_a = this.context) == null ? void 0 : _a.setTimelineAction) {
|
|
3019
3124
|
this.context.setTimelineAction(TIMELINE_ACTION.UPDATE_PLAYER_DATA, {
|
|
3020
3125
|
tracks,
|
|
@@ -7695,6 +7800,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7695
7800
|
const TimelineProviderInner = ({
|
|
7696
7801
|
contextId,
|
|
7697
7802
|
children,
|
|
7803
|
+
resolution,
|
|
7698
7804
|
initialData
|
|
7699
7805
|
}) => {
|
|
7700
7806
|
const [timelineAction, setTimelineActionState] = React.useState({
|
|
@@ -7704,6 +7810,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7704
7810
|
const [selectedItem, setSelectedItem] = React.useState(
|
|
7705
7811
|
null
|
|
7706
7812
|
);
|
|
7813
|
+
const [videoResolution, setVideoResolution] = React.useState(resolution ?? { width: 720, height: 1280 });
|
|
7707
7814
|
const [totalDuration, setTotalDuration] = React.useState(0);
|
|
7708
7815
|
const [changeLog, setChangeLog] = React.useState(0);
|
|
7709
7816
|
const undoRedoContext = useUndoRedo();
|
|
@@ -7758,9 +7865,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7758
7865
|
timelineAction,
|
|
7759
7866
|
totalDuration,
|
|
7760
7867
|
changeLog,
|
|
7868
|
+
videoResolution,
|
|
7761
7869
|
present: undoRedoContext.present,
|
|
7762
7870
|
canUndo: undoRedoContext.canUndo,
|
|
7763
7871
|
canRedo: undoRedoContext.canRedo,
|
|
7872
|
+
setVideoResolution,
|
|
7764
7873
|
setSelectedItem,
|
|
7765
7874
|
setTimelineAction,
|
|
7766
7875
|
editor
|
|
@@ -7771,6 +7880,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7771
7880
|
const TimelineProvider = ({
|
|
7772
7881
|
contextId,
|
|
7773
7882
|
children,
|
|
7883
|
+
resolution = { width: 720, height: 1280 },
|
|
7774
7884
|
initialData,
|
|
7775
7885
|
undoRedoPersistenceKey,
|
|
7776
7886
|
maxHistorySize
|
|
@@ -7792,6 +7902,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7792
7902
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7793
7903
|
TimelineProviderInner,
|
|
7794
7904
|
{
|
|
7905
|
+
resolution,
|
|
7795
7906
|
initialData,
|
|
7796
7907
|
contextId,
|
|
7797
7908
|
undoRedoPersistenceKey,
|