@twick/video-editor 0.14.3 → 0.14.4
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/components/controls/player-controls.d.ts +6 -0
- package/dist/components/player/player-manager.d.ts +1 -0
- package/dist/components/timeline/timeline-view.d.ts +2 -1
- package/dist/components/track/track-element.d.ts +1 -1
- package/dist/components/video-editor.d.ts +2 -0
- package/dist/helpers/types.d.ts +52 -183
- package/dist/hooks/use-timeline-manager.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +304 -222
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +304 -222
- package/dist/index.mjs.map +1 -1
- package/dist/video-editor.css +3 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -6936,10 +6936,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6936
6936
|
objects.forEach((obj) => canvas.add(obj));
|
|
6937
6937
|
canvas.renderAll();
|
|
6938
6938
|
};
|
|
6939
|
+
const getCanvasContext = (canvas) => {
|
|
6940
|
+
var _a2, _b, _c, _d;
|
|
6941
|
+
if (!canvas || !((_b = (_a2 = canvas.elements) == null ? void 0 : _a2.lower) == null ? void 0 : _b.ctx)) return;
|
|
6942
|
+
return (_d = (_c = canvas.elements) == null ? void 0 : _c.lower) == null ? void 0 : _d.ctx;
|
|
6943
|
+
};
|
|
6939
6944
|
const clearCanvas = (canvas) => {
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6945
|
+
try {
|
|
6946
|
+
if (!canvas || !getCanvasContext(canvas)) return;
|
|
6947
|
+
canvas.clear();
|
|
6948
|
+
canvas.renderAll();
|
|
6949
|
+
} catch (error) {
|
|
6950
|
+
console.warn("Error clearing canvas:", error);
|
|
6951
|
+
}
|
|
6943
6952
|
};
|
|
6944
6953
|
const convertToCanvasPosition = (x2, y2, canvasMetadata) => {
|
|
6945
6954
|
return {
|
|
@@ -7085,7 +7094,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7085
7094
|
timeoutId = window.setTimeout(() => {
|
|
7086
7095
|
cleanup();
|
|
7087
7096
|
reject(new Error("Video loading timed out"));
|
|
7088
|
-
},
|
|
7097
|
+
}, 15e3);
|
|
7089
7098
|
video.src = videoUrl;
|
|
7090
7099
|
document.body.appendChild(video);
|
|
7091
7100
|
});
|
|
@@ -7136,7 +7145,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7136
7145
|
canvas,
|
|
7137
7146
|
canvasMetadata
|
|
7138
7147
|
}) => {
|
|
7139
|
-
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v;
|
|
7148
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w;
|
|
7140
7149
|
const { x: x2, y: y2 } = convertToCanvasPosition(
|
|
7141
7150
|
((_a2 = element.props) == null ? void 0 : _a2.x) || 0,
|
|
7142
7151
|
((_b = element.props) == null ? void 0 : _b.y) || 0,
|
|
@@ -7155,15 +7164,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7155
7164
|
fontStyle: ((_g = element.props) == null ? void 0 : _g.fontStyle) || "normal",
|
|
7156
7165
|
fontWeight: ((_h = element.props) == null ? void 0 : _h.fontWeight) || "normal",
|
|
7157
7166
|
fill: ((_i2 = element.props) == null ? void 0 : _i2.fill) || DEFAULT_TEXT_PROPS.fill,
|
|
7167
|
+
opacity: ((_j = element.props) == null ? void 0 : _j.opacity) ?? 1,
|
|
7158
7168
|
skipWrapping: false,
|
|
7159
|
-
textAlign: ((
|
|
7160
|
-
stroke: ((
|
|
7161
|
-
strokeWidth: ((
|
|
7162
|
-
shadow: ((
|
|
7163
|
-
offsetX: ((
|
|
7164
|
-
offsetY: ((
|
|
7165
|
-
blur: (((
|
|
7166
|
-
color: (
|
|
7169
|
+
textAlign: ((_k = element.props) == null ? void 0 : _k.textAlign) || "center",
|
|
7170
|
+
stroke: ((_l = element.props) == null ? void 0 : _l.stroke) || DEFAULT_TEXT_PROPS.stroke,
|
|
7171
|
+
strokeWidth: ((_m = element.props) == null ? void 0 : _m.lineWidth) || DEFAULT_TEXT_PROPS.lineWidth,
|
|
7172
|
+
shadow: ((_n2 = element.props) == null ? void 0 : _n2.shadowColor) ? new ds({
|
|
7173
|
+
offsetX: ((_p = (_o2 = element.props) == null ? void 0 : _o2.shadowOffset) == null ? void 0 : _p.length) && ((_r2 = (_q = element.props) == null ? void 0 : _q.shadowOffset) == null ? void 0 : _r2.length) > 1 ? element.props.shadowOffset[0] / 2 : 1,
|
|
7174
|
+
offsetY: ((_t2 = (_s2 = element.props) == null ? void 0 : _s2.shadowOffset) == null ? void 0 : _t2.length) && ((_u = element.props) == null ? void 0 : _u.shadowOffset.length) > 1 ? element.props.shadowOffset[1] / 2 : 1,
|
|
7175
|
+
blur: (((_v = element.props) == null ? void 0 : _v.shadowBlur) || 2) / 2,
|
|
7176
|
+
color: (_w = element.props) == null ? void 0 : _w.shadowColor
|
|
7167
7177
|
}) : void 0
|
|
7168
7178
|
});
|
|
7169
7179
|
text.set("id", element.id);
|
|
@@ -7186,7 +7196,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7186
7196
|
index,
|
|
7187
7197
|
canvasMetadata
|
|
7188
7198
|
}) => {
|
|
7189
|
-
var _a2, _b, _c, _d;
|
|
7199
|
+
var _a2, _b, _c, _d, _e2;
|
|
7190
7200
|
const width = (((_a2 = element.props) == null ? void 0 : _a2.width) || 0) * canvasMetadata.scaleX || canvasMetadata.width;
|
|
7191
7201
|
const height = (((_b = element.props) == null ? void 0 : _b.height) || 0) * canvasMetadata.scaleY || canvasMetadata.height;
|
|
7192
7202
|
const { x: x2, y: y2 } = convertToCanvasPosition(
|
|
@@ -7201,6 +7211,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7201
7211
|
img.set("height", height);
|
|
7202
7212
|
img.set("left", x2);
|
|
7203
7213
|
img.set("top", y2);
|
|
7214
|
+
img.set("opacity", ((_e2 = element.props) == null ? void 0 : _e2.opacity) ?? 1);
|
|
7204
7215
|
img.set("selectable", true);
|
|
7205
7216
|
img.set("hasControls", true);
|
|
7206
7217
|
img.set("touchAction", "all");
|
|
@@ -7212,7 +7223,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7212
7223
|
captionProps,
|
|
7213
7224
|
canvasMetadata
|
|
7214
7225
|
}) => {
|
|
7215
|
-
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w, _x, _y, _z;
|
|
7226
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w, _x, _y, _z, _A;
|
|
7216
7227
|
const { x: x2, y: y2 } = convertToCanvasPosition(
|
|
7217
7228
|
((_b = (_a2 = element.props) == null ? void 0 : _a2.pos) == null ? void 0 : _b.x) || ((_c = captionProps == null ? void 0 : captionProps.pos) == null ? void 0 : _c.x) || 0,
|
|
7218
7229
|
((_e2 = (_d = element.props) == null ? void 0 : _d.pos) == null ? void 0 : _e2.y) || ((_f = captionProps == null ? void 0 : captionProps.pos) == null ? void 0 : _f.y) || 0,
|
|
@@ -7231,13 +7242,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7231
7242
|
fill: ((_o2 = element.props) == null ? void 0 : _o2.fill) || ((_p = captionProps.color) == null ? void 0 : _p.text) || DEFAULT_CAPTION_PROPS.fill,
|
|
7232
7243
|
fontWeight: DEFAULT_CAPTION_PROPS.fontWeight,
|
|
7233
7244
|
stroke: ((_q = element.props) == null ? void 0 : _q.stroke) || DEFAULT_CAPTION_PROPS.stroke,
|
|
7245
|
+
opacity: ((_r2 = element.props) == null ? void 0 : _r2.opacity) ?? 1,
|
|
7234
7246
|
shadow: new ds({
|
|
7235
|
-
offsetX: ((
|
|
7236
|
-
offsetY: ((
|
|
7237
|
-
blur: ((
|
|
7238
|
-
color: ((
|
|
7247
|
+
offsetX: ((_t2 = (_s2 = element.props) == null ? void 0 : _s2.shadowOffset) == null ? void 0 : _t2[0]) || ((_u = DEFAULT_CAPTION_PROPS.shadowOffset) == null ? void 0 : _u[0]),
|
|
7248
|
+
offsetY: ((_w = (_v = element.props) == null ? void 0 : _v.shadowOffset) == null ? void 0 : _w[1]) || ((_x = DEFAULT_CAPTION_PROPS.shadowOffset) == null ? void 0 : _x[1]),
|
|
7249
|
+
blur: ((_y = element.props) == null ? void 0 : _y.shadowBlur) || DEFAULT_CAPTION_PROPS.shadowBlur,
|
|
7250
|
+
color: ((_z = element.props) == null ? void 0 : _z.shadowColor) || DEFAULT_CAPTION_PROPS.shadowColor
|
|
7239
7251
|
}),
|
|
7240
|
-
strokeWidth: ((
|
|
7252
|
+
strokeWidth: ((_A = element.props) == null ? void 0 : _A.lineWidth) || DEFAULT_CAPTION_PROPS.lineWidth
|
|
7241
7253
|
});
|
|
7242
7254
|
caption.set("id", element.id);
|
|
7243
7255
|
caption.set("zIndex", index);
|
|
@@ -7328,7 +7340,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7328
7340
|
canvasMetadata,
|
|
7329
7341
|
currentFrameEffect
|
|
7330
7342
|
}) => {
|
|
7331
|
-
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m;
|
|
7343
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2;
|
|
7332
7344
|
let frameSize;
|
|
7333
7345
|
let angle;
|
|
7334
7346
|
let framePosition;
|
|
@@ -7383,7 +7395,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7383
7395
|
originX: "center",
|
|
7384
7396
|
originY: "center",
|
|
7385
7397
|
scaleX: newSize.width / img.width,
|
|
7386
|
-
scaleY: newSize.height / img.height
|
|
7398
|
+
scaleY: newSize.height / img.height,
|
|
7399
|
+
opacity: ((_n2 = element.props) == null ? void 0 : _n2.opacity) ?? 1
|
|
7387
7400
|
});
|
|
7388
7401
|
const { x: x2, y: y2 } = convertToCanvasPosition(
|
|
7389
7402
|
(framePosition == null ? void 0 : framePosition.x) || 0,
|
|
@@ -7503,6 +7516,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7503
7516
|
const elementFrameMap = React.useRef({});
|
|
7504
7517
|
const twickCanvasRef = React.useRef(null);
|
|
7505
7518
|
const videoSizeRef = React.useRef({ width: 1, height: 1 });
|
|
7519
|
+
const canvasResolutionRef = React.useRef({ width: 1, height: 1 });
|
|
7506
7520
|
const canvasMetadataRef = React.useRef({
|
|
7507
7521
|
width: 0,
|
|
7508
7522
|
height: 0,
|
|
@@ -7526,9 +7540,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7526
7540
|
selectionLineWidth = 2,
|
|
7527
7541
|
uniScaleTransform = true,
|
|
7528
7542
|
enableRetinaScaling = true,
|
|
7529
|
-
touchZoomThreshold = 10
|
|
7543
|
+
touchZoomThreshold = 10,
|
|
7544
|
+
forceBuild = false
|
|
7530
7545
|
}) => {
|
|
7531
7546
|
if (!canvasRef) return;
|
|
7547
|
+
if (!forceBuild && canvasResolutionRef.current.width === canvasSize.width && canvasResolutionRef.current.height === canvasSize.height) {
|
|
7548
|
+
return;
|
|
7549
|
+
}
|
|
7532
7550
|
if (twickCanvasRef.current) {
|
|
7533
7551
|
console.log("Destroying twickCanvas");
|
|
7534
7552
|
twickCanvasRef.current.off("mouse:up", handleMouseUp);
|
|
@@ -7548,6 +7566,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7548
7566
|
canvasMetadataRef.current = canvasMetadata;
|
|
7549
7567
|
videoSizeRef.current = videoSize;
|
|
7550
7568
|
canvas == null ? void 0 : canvas.on("mouse:up", handleMouseUp);
|
|
7569
|
+
canvasResolutionRef.current = canvasSize;
|
|
7551
7570
|
setTwickCanvas(canvas);
|
|
7552
7571
|
twickCanvasRef.current = canvas;
|
|
7553
7572
|
if (onCanvasReady) {
|
|
@@ -7688,13 +7707,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7688
7707
|
captionProps,
|
|
7689
7708
|
cleanAndAdd = false
|
|
7690
7709
|
}) => {
|
|
7691
|
-
if (!twickCanvas) {
|
|
7692
|
-
console.warn("Canvas not initialized");
|
|
7710
|
+
if (!twickCanvas || !getCanvasContext(twickCanvas)) {
|
|
7711
|
+
console.warn("Canvas not properly initialized");
|
|
7693
7712
|
return;
|
|
7694
7713
|
}
|
|
7695
7714
|
try {
|
|
7696
|
-
if (cleanAndAdd) {
|
|
7715
|
+
if (cleanAndAdd && getCanvasContext(twickCanvas)) {
|
|
7716
|
+
const backgroundColor = twickCanvas.backgroundColor;
|
|
7697
7717
|
clearCanvas(twickCanvas);
|
|
7718
|
+
if (backgroundColor) {
|
|
7719
|
+
twickCanvas.backgroundColor = backgroundColor;
|
|
7720
|
+
twickCanvas.renderAll();
|
|
7721
|
+
}
|
|
7698
7722
|
}
|
|
7699
7723
|
await Promise.all(
|
|
7700
7724
|
elements.map(async (element, index) => {
|
|
@@ -7826,7 +7850,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7826
7850
|
break;
|
|
7827
7851
|
case CANVAS_OPERATIONS.ITEM_UPDATED:
|
|
7828
7852
|
if (element) {
|
|
7829
|
-
editor.updateElement(element);
|
|
7853
|
+
const updatedElement = editor.updateElement(element);
|
|
7854
|
+
setSelectedItem(updatedElement);
|
|
7830
7855
|
}
|
|
7831
7856
|
break;
|
|
7832
7857
|
}
|
|
@@ -7909,6 +7934,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7909
7934
|
height: container == null ? void 0 : container.clientHeight
|
|
7910
7935
|
};
|
|
7911
7936
|
buildCanvas({
|
|
7937
|
+
backgroundColor: videoProps.backgroundColor,
|
|
7912
7938
|
videoSize: {
|
|
7913
7939
|
width: videoProps.width,
|
|
7914
7940
|
height: videoProps.height
|
|
@@ -9568,7 +9594,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
9568
9594
|
* This source code is licensed under the ISC license.
|
|
9569
9595
|
* See the LICENSE file in the root directory of this source tree.
|
|
9570
9596
|
*/
|
|
9571
|
-
const __iconNode$
|
|
9597
|
+
const __iconNode$b = [
|
|
9572
9598
|
["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
|
|
9573
9599
|
["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
|
|
9574
9600
|
["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
|
|
@@ -9576,45 +9602,56 @@ This message will only show in development mode. It won't appear in production.
|
|
|
9576
9602
|
["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
|
|
9577
9603
|
["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
|
|
9578
9604
|
];
|
|
9579
|
-
const GripVertical = createLucideIcon("grip-vertical", __iconNode$
|
|
9605
|
+
const GripVertical = createLucideIcon("grip-vertical", __iconNode$b);
|
|
9580
9606
|
/**
|
|
9581
9607
|
* @license lucide-react v0.511.0 - ISC
|
|
9582
9608
|
*
|
|
9583
9609
|
* This source code is licensed under the ISC license.
|
|
9584
9610
|
* See the LICENSE file in the root directory of this source tree.
|
|
9585
9611
|
*/
|
|
9586
|
-
const __iconNode$
|
|
9587
|
-
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$
|
|
9612
|
+
const __iconNode$a = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
9613
|
+
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$a);
|
|
9588
9614
|
/**
|
|
9589
9615
|
* @license lucide-react v0.511.0 - ISC
|
|
9590
9616
|
*
|
|
9591
9617
|
* This source code is licensed under the ISC license.
|
|
9592
9618
|
* See the LICENSE file in the root directory of this source tree.
|
|
9593
9619
|
*/
|
|
9594
|
-
const __iconNode$
|
|
9620
|
+
const __iconNode$9 = [
|
|
9595
9621
|
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
|
|
9596
9622
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
|
9597
9623
|
];
|
|
9598
|
-
const Lock = createLucideIcon("lock", __iconNode$
|
|
9624
|
+
const Lock = createLucideIcon("lock", __iconNode$9);
|
|
9599
9625
|
/**
|
|
9600
9626
|
* @license lucide-react v0.511.0 - ISC
|
|
9601
9627
|
*
|
|
9602
9628
|
* This source code is licensed under the ISC license.
|
|
9603
9629
|
* See the LICENSE file in the root directory of this source tree.
|
|
9604
9630
|
*/
|
|
9605
|
-
const __iconNode$
|
|
9631
|
+
const __iconNode$8 = [
|
|
9606
9632
|
["rect", { x: "14", y: "4", width: "4", height: "16", rx: "1", key: "zuxfzm" }],
|
|
9607
9633
|
["rect", { x: "6", y: "4", width: "4", height: "16", rx: "1", key: "1okwgv" }]
|
|
9608
9634
|
];
|
|
9609
|
-
const Pause = createLucideIcon("pause", __iconNode$
|
|
9635
|
+
const Pause = createLucideIcon("pause", __iconNode$8);
|
|
9636
|
+
/**
|
|
9637
|
+
* @license lucide-react v0.511.0 - ISC
|
|
9638
|
+
*
|
|
9639
|
+
* This source code is licensed under the ISC license.
|
|
9640
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
9641
|
+
*/
|
|
9642
|
+
const __iconNode$7 = [["polygon", { points: "6 3 20 12 6 21 6 3", key: "1oa8hb" }]];
|
|
9643
|
+
const Play = createLucideIcon("play", __iconNode$7);
|
|
9610
9644
|
/**
|
|
9611
9645
|
* @license lucide-react v0.511.0 - ISC
|
|
9612
9646
|
*
|
|
9613
9647
|
* This source code is licensed under the ISC license.
|
|
9614
9648
|
* See the LICENSE file in the root directory of this source tree.
|
|
9615
9649
|
*/
|
|
9616
|
-
const __iconNode$6 = [
|
|
9617
|
-
|
|
9650
|
+
const __iconNode$6 = [
|
|
9651
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
9652
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
9653
|
+
];
|
|
9654
|
+
const Plus = createLucideIcon("plus", __iconNode$6);
|
|
9618
9655
|
/**
|
|
9619
9656
|
* @license lucide-react v0.511.0 - ISC
|
|
9620
9657
|
*
|
|
@@ -16893,30 +16930,34 @@ This message will only show in development mode. It won't appear in production.
|
|
|
16893
16930
|
};
|
|
16894
16931
|
const DEFAULT_TIMELINE_ZOOM = 1.5;
|
|
16895
16932
|
const DEFAULT_ELEMENT_COLORS = {
|
|
16896
|
-
/** Fragment element color */
|
|
16897
|
-
fragment: "#
|
|
16898
|
-
/** Video element color -
|
|
16899
|
-
video: "#
|
|
16900
|
-
/** Caption element color -
|
|
16901
|
-
caption: "#
|
|
16902
|
-
/** Image element color -
|
|
16903
|
-
image: "#
|
|
16904
|
-
/** Audio element color -
|
|
16905
|
-
audio: "#
|
|
16906
|
-
/** Text element color -
|
|
16907
|
-
text: "#
|
|
16908
|
-
/** Generic element color - muted
|
|
16909
|
-
element: "#
|
|
16910
|
-
/** Rectangle element color -
|
|
16911
|
-
rect: "#
|
|
16912
|
-
/** Frame effect color -
|
|
16913
|
-
frameEffect: "#
|
|
16914
|
-
/** Filters color -
|
|
16915
|
-
filters: "#
|
|
16916
|
-
/** Transition color -
|
|
16917
|
-
transition: "#
|
|
16918
|
-
/** Animation color -
|
|
16919
|
-
animation: "#
|
|
16933
|
+
/** Fragment element color - deep charcoal matching UI background */
|
|
16934
|
+
fragment: "#1A1A1A",
|
|
16935
|
+
/** Video element color - vibrant royal purple */
|
|
16936
|
+
video: "#8B5FBF",
|
|
16937
|
+
/** Caption element color - soft wisteria purple */
|
|
16938
|
+
caption: "#9B8ACE",
|
|
16939
|
+
/** Image element color - warm copper accent */
|
|
16940
|
+
image: "#D4956C",
|
|
16941
|
+
/** Audio element color - deep teal */
|
|
16942
|
+
audio: "#3D8B8B",
|
|
16943
|
+
/** Text element color - medium lavender */
|
|
16944
|
+
text: "#8D74C4",
|
|
16945
|
+
/** Generic element color - muted amethyst */
|
|
16946
|
+
element: "#7B68B8",
|
|
16947
|
+
/** Rectangle element color - deep indigo */
|
|
16948
|
+
rect: "#5B4B99",
|
|
16949
|
+
/** Frame effect color - rich magenta */
|
|
16950
|
+
frameEffect: "#B55B9C",
|
|
16951
|
+
/** Filters color - periwinkle blue */
|
|
16952
|
+
filters: "#7A89D4",
|
|
16953
|
+
/** Transition color - burnished bronze */
|
|
16954
|
+
transition: "#BE8157",
|
|
16955
|
+
/** Animation color - muted emerald */
|
|
16956
|
+
animation: "#4B9B78",
|
|
16957
|
+
/** Icon element color - bright orchid */
|
|
16958
|
+
icon: "#A76CD4",
|
|
16959
|
+
/** Circle element color - deep byzantium */
|
|
16960
|
+
circle: "#703D8B"
|
|
16920
16961
|
};
|
|
16921
16962
|
const AVAILABLE_TEXT_FONTS = {
|
|
16922
16963
|
// Google Fonts
|
|
@@ -16968,6 +17009,12 @@ This message will only show in development mode. It won't appear in production.
|
|
|
16968
17009
|
BRITTANY_SIGNATURE: "Brittany Signature"
|
|
16969
17010
|
};
|
|
16970
17011
|
let ELEMENT_COLORS = { ...DEFAULT_ELEMENT_COLORS };
|
|
17012
|
+
const setElementColors = (colors) => {
|
|
17013
|
+
ELEMENT_COLORS = {
|
|
17014
|
+
...DEFAULT_ELEMENT_COLORS,
|
|
17015
|
+
...colors
|
|
17016
|
+
};
|
|
17017
|
+
};
|
|
16971
17018
|
const TrackElementView = ({
|
|
16972
17019
|
element,
|
|
16973
17020
|
parentWidth,
|
|
@@ -17002,10 +17049,12 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17002
17049
|
const span = prev.end - prev.start;
|
|
17003
17050
|
let newStart = Math.max(0, prev.start + dx / parentWidth * duration);
|
|
17004
17051
|
newStart = Math.min(newStart, prev.end - MIN_DURATION);
|
|
17005
|
-
if (
|
|
17006
|
-
newStart
|
|
17007
|
-
|
|
17008
|
-
|
|
17052
|
+
if (!allowOverlap) {
|
|
17053
|
+
if (prevEnd !== null && newStart < prevEnd) {
|
|
17054
|
+
newStart = prevEnd;
|
|
17055
|
+
} else if (nextStart !== null && !allowOverlap && newStart + span > nextStart) {
|
|
17056
|
+
newStart = nextStart - span;
|
|
17057
|
+
}
|
|
17009
17058
|
}
|
|
17010
17059
|
return {
|
|
17011
17060
|
start: newStart,
|
|
@@ -17046,8 +17095,10 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17046
17095
|
setPosition((prev) => {
|
|
17047
17096
|
let newEnd = prev.end + dx / parentWidth * duration;
|
|
17048
17097
|
newEnd = Math.max(newEnd, prev.start + MIN_DURATION);
|
|
17049
|
-
if (
|
|
17050
|
-
newEnd
|
|
17098
|
+
if (!allowOverlap) {
|
|
17099
|
+
if (nextStart !== null && newEnd > nextStart) {
|
|
17100
|
+
newEnd = nextStart;
|
|
17101
|
+
}
|
|
17051
17102
|
}
|
|
17052
17103
|
return {
|
|
17053
17104
|
start: prev.start,
|
|
@@ -17084,11 +17135,19 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17084
17135
|
const motionProps = {
|
|
17085
17136
|
ref,
|
|
17086
17137
|
className: `twick-track-element ${isSelected ? "twick-track-element-selected" : "twick-track-element-default"} ${isDragging2 ? "twick-track-element-dragging" : ""}`,
|
|
17087
|
-
onMouseDown:
|
|
17088
|
-
|
|
17138
|
+
onMouseDown: (e2) => {
|
|
17139
|
+
if (e2.target === ref.current) {
|
|
17140
|
+
setLastPos();
|
|
17141
|
+
}
|
|
17142
|
+
},
|
|
17143
|
+
onTouchStart: (e2) => {
|
|
17144
|
+
if (e2.target === ref.current) {
|
|
17145
|
+
setLastPos();
|
|
17146
|
+
}
|
|
17147
|
+
},
|
|
17089
17148
|
onMouseUp: sendUpdate,
|
|
17090
17149
|
onTouchEnd: sendUpdate,
|
|
17091
|
-
|
|
17150
|
+
onClick: () => {
|
|
17092
17151
|
if (onSelection) {
|
|
17093
17152
|
onSelection(element);
|
|
17094
17153
|
}
|
|
@@ -17104,7 +17163,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17104
17163
|
isSelected ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
17105
17164
|
"div",
|
|
17106
17165
|
{
|
|
17107
|
-
style: { touchAction: "none" },
|
|
17166
|
+
style: { touchAction: "none", zIndex: isSelected ? 100 : 1 },
|
|
17108
17167
|
...bindStartHandle(),
|
|
17109
17168
|
className: "twick-track-element-handle twick-track-element-handle-start"
|
|
17110
17169
|
}
|
|
@@ -17113,7 +17172,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17113
17172
|
isSelected ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
17114
17173
|
"div",
|
|
17115
17174
|
{
|
|
17116
|
-
style: { touchAction: "none" },
|
|
17175
|
+
style: { touchAction: "none", zIndex: isSelected ? 100 : 1 },
|
|
17117
17176
|
...bindEndHandle(),
|
|
17118
17177
|
className: "twick-track-element-handle twick-track-element-handle-end"
|
|
17119
17178
|
}
|
|
@@ -17165,7 +17224,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17165
17224
|
selectedItem,
|
|
17166
17225
|
onSelection: onItemSelection,
|
|
17167
17226
|
onDrag,
|
|
17168
|
-
nextStart: index < elements.length - 1 ? elements[index + 1].getStart() :
|
|
17227
|
+
nextStart: index < elements.length - 1 ? elements[index + 1].getStart() : null,
|
|
17169
17228
|
prevEnd: index > 0 ? elements[index - 1].getEnd() : 0
|
|
17170
17229
|
},
|
|
17171
17230
|
element.getId()
|
|
@@ -17179,6 +17238,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17179
17238
|
duration,
|
|
17180
17239
|
tracks,
|
|
17181
17240
|
seekTrack,
|
|
17241
|
+
onAddTrack,
|
|
17182
17242
|
onReorder,
|
|
17183
17243
|
onSelectionChange,
|
|
17184
17244
|
onElementDrag
|
|
@@ -17268,7 +17328,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17268
17328
|
onScroll: handleScroll,
|
|
17269
17329
|
children: [
|
|
17270
17330
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: timelineWidthPx }, children: seekTrack ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", position: "relative" }, children: [
|
|
17271
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twick-seek-track-empty-space" }),
|
|
17331
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "twick-seek-track-empty-space", onClick: onAddTrack, children: /* @__PURE__ */ jsxRuntime.jsx(Plus, { color: "white", size: 20 }) }),
|
|
17272
17332
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexGrow: 1 }, children: seekTrack })
|
|
17273
17333
|
] }) : null }),
|
|
17274
17334
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: timelineContentRef, style: { width: timelineWidthPx }, children: (tracks || []).map((track) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twick-timeline-container", children: [
|
|
@@ -17302,13 +17362,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17302
17362
|
);
|
|
17303
17363
|
}
|
|
17304
17364
|
const useTimelineManager = () => {
|
|
17305
|
-
const {
|
|
17306
|
-
selectedItem,
|
|
17307
|
-
changeLog,
|
|
17308
|
-
setSelectedItem,
|
|
17309
|
-
totalDuration,
|
|
17310
|
-
editor
|
|
17311
|
-
} = timeline.useTimelineContext();
|
|
17365
|
+
const { selectedItem, changeLog, setSelectedItem, totalDuration, editor } = timeline.useTimelineContext();
|
|
17312
17366
|
const onElementDrag = ({
|
|
17313
17367
|
element,
|
|
17314
17368
|
dragType,
|
|
@@ -17327,7 +17381,8 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17327
17381
|
}
|
|
17328
17382
|
element.setStart(updates.start);
|
|
17329
17383
|
element.setEnd(updates.end);
|
|
17330
|
-
editor.updateElement(element);
|
|
17384
|
+
const updatedElement = editor.updateElement(element);
|
|
17385
|
+
setSelectedItem(updatedElement);
|
|
17331
17386
|
};
|
|
17332
17387
|
const timelineData = React.useMemo(() => {
|
|
17333
17388
|
const timelineDataFromEditor = editor.getTimelineData();
|
|
@@ -17344,8 +17399,14 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17344
17399
|
const onSelectionChange = (selectedItem2) => {
|
|
17345
17400
|
setSelectedItem(selectedItem2);
|
|
17346
17401
|
};
|
|
17402
|
+
const onAddTrack = () => {
|
|
17403
|
+
var _a2;
|
|
17404
|
+
const tracks = ((_a2 = editor.getTimelineData()) == null ? void 0 : _a2.tracks) || [];
|
|
17405
|
+
editor.addTrack(`Track_${tracks.length + 1}`);
|
|
17406
|
+
};
|
|
17347
17407
|
return {
|
|
17348
17408
|
timelineData,
|
|
17409
|
+
onAddTrack,
|
|
17349
17410
|
onElementDrag,
|
|
17350
17411
|
onReorder,
|
|
17351
17412
|
onSeek,
|
|
@@ -17359,7 +17420,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17359
17420
|
trackZoom
|
|
17360
17421
|
}) => {
|
|
17361
17422
|
var _a2;
|
|
17362
|
-
const { timelineData, totalDuration, selectedItem, onReorder, onElementDrag, onSeek, onSelectionChange } = useTimelineManager();
|
|
17423
|
+
const { timelineData, totalDuration, selectedItem, onAddTrack, onReorder, onElementDrag, onSeek, onSelectionChange } = useTimelineManager();
|
|
17363
17424
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17364
17425
|
TimelineView,
|
|
17365
17426
|
{
|
|
@@ -17370,6 +17431,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17370
17431
|
selectedItem,
|
|
17371
17432
|
onDeletion: () => {
|
|
17372
17433
|
},
|
|
17434
|
+
onAddTrack,
|
|
17373
17435
|
onReorder,
|
|
17374
17436
|
onElementDrag,
|
|
17375
17437
|
onSeek,
|
|
@@ -17408,6 +17470,9 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17408
17470
|
)
|
|
17409
17471
|
] });
|
|
17410
17472
|
};
|
|
17473
|
+
const MAX_ZOOM = 3;
|
|
17474
|
+
const MIN_ZOOM = 0.5;
|
|
17475
|
+
const ZOOM_STEP = 0.25;
|
|
17411
17476
|
const PlayerControls = ({
|
|
17412
17477
|
selectedItem,
|
|
17413
17478
|
duration,
|
|
@@ -17420,6 +17485,8 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17420
17485
|
onRedo,
|
|
17421
17486
|
onSplit,
|
|
17422
17487
|
onDelete,
|
|
17488
|
+
zoomLevel = 1,
|
|
17489
|
+
setZoomLevel,
|
|
17423
17490
|
className = ""
|
|
17424
17491
|
}) => {
|
|
17425
17492
|
const formatTime = React.useCallback((time2) => {
|
|
@@ -17437,61 +17504,92 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17437
17504
|
onSplit(selectedItem, currentTime);
|
|
17438
17505
|
}
|
|
17439
17506
|
}, [selectedItem, onSplit, currentTime]);
|
|
17440
|
-
|
|
17441
|
-
|
|
17442
|
-
|
|
17443
|
-
|
|
17444
|
-
|
|
17445
|
-
|
|
17446
|
-
|
|
17447
|
-
|
|
17448
|
-
|
|
17449
|
-
|
|
17450
|
-
|
|
17451
|
-
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
|
|
17462
|
-
|
|
17463
|
-
|
|
17464
|
-
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
|
-
|
|
17472
|
-
|
|
17473
|
-
|
|
17474
|
-
|
|
17475
|
-
|
|
17476
|
-
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
|
|
17481
|
-
|
|
17482
|
-
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17494
|
-
|
|
17507
|
+
const handleZoomIn = React.useCallback(() => {
|
|
17508
|
+
if (setZoomLevel && zoomLevel < MAX_ZOOM) {
|
|
17509
|
+
setZoomLevel(zoomLevel + ZOOM_STEP);
|
|
17510
|
+
}
|
|
17511
|
+
}, [zoomLevel, setZoomLevel]);
|
|
17512
|
+
const handleZoomOut = React.useCallback(() => {
|
|
17513
|
+
if (setZoomLevel && zoomLevel > MIN_ZOOM) {
|
|
17514
|
+
setZoomLevel(zoomLevel - ZOOM_STEP);
|
|
17515
|
+
}
|
|
17516
|
+
}, [zoomLevel, setZoomLevel]);
|
|
17517
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `h-16 bg-gray-800 border-t border-gray-700 p-4 ${className}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
17518
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
17519
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
17520
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17521
|
+
"button",
|
|
17522
|
+
{
|
|
17523
|
+
onClick: handleDelete,
|
|
17524
|
+
disabled: !selectedItem,
|
|
17525
|
+
title: "Delete",
|
|
17526
|
+
className: `btn btn-ghost ${!!selectedItem ? "text-red-400 hover:text-red-300" : "text-gray-500 cursor-not-allowed"}`,
|
|
17527
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Trash2, { className: "w-5 h-5" })
|
|
17528
|
+
}
|
|
17529
|
+
),
|
|
17530
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17531
|
+
"button",
|
|
17532
|
+
{
|
|
17533
|
+
onClick: handleSplit,
|
|
17534
|
+
disabled: !(selectedItem instanceof timeline.TrackElement),
|
|
17535
|
+
title: "Split",
|
|
17536
|
+
className: `btn btn-ghost ${selectedItem instanceof timeline.TrackElement ? "text-purple-400 hover:text-purple-300" : "text-gray-500 cursor-not-allowed"}`,
|
|
17537
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Scissors, { className: "w-5 h-5" })
|
|
17538
|
+
}
|
|
17539
|
+
),
|
|
17540
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17541
|
+
UndoRedoControls,
|
|
17542
|
+
{
|
|
17543
|
+
canUndo,
|
|
17544
|
+
canRedo,
|
|
17545
|
+
onUndo,
|
|
17546
|
+
onRedo
|
|
17547
|
+
}
|
|
17548
|
+
)
|
|
17549
|
+
] }),
|
|
17550
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17551
|
+
"button",
|
|
17552
|
+
{
|
|
17553
|
+
onClick: togglePlayback,
|
|
17554
|
+
disabled: playerState === livePlayer.PLAYER_STATE.REFRESH,
|
|
17555
|
+
title: playerState === livePlayer.PLAYER_STATE.PLAYING ? "Pause" : playerState === livePlayer.PLAYER_STATE.REFRESH ? "Refreshing" : "Play",
|
|
17556
|
+
className: "btn btn-ghost text-white",
|
|
17557
|
+
children: playerState === livePlayer.PLAYER_STATE.PLAYING ? /* @__PURE__ */ jsxRuntime.jsx(Pause, { className: "w-6 h-6" }) : playerState === livePlayer.PLAYER_STATE.REFRESH ? /* @__PURE__ */ jsxRuntime.jsx(LoaderCircle, { className: "w-6 h-6 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(Play, { className: "w-6 h-6" })
|
|
17558
|
+
}
|
|
17559
|
+
),
|
|
17560
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-gray-300", children: [
|
|
17561
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: formatTime(currentTime) }),
|
|
17562
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: "/" }),
|
|
17563
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: formatTime(duration) })
|
|
17564
|
+
] })
|
|
17565
|
+
] }),
|
|
17566
|
+
setZoomLevel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
17567
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17568
|
+
"button",
|
|
17569
|
+
{
|
|
17570
|
+
onClick: handleZoomOut,
|
|
17571
|
+
disabled: zoomLevel <= MIN_ZOOM,
|
|
17572
|
+
title: "Zoom Out",
|
|
17573
|
+
className: `btn btn-ghost ${zoomLevel > MIN_ZOOM ? "text-gray-300 hover:text-white" : "text-gray-500 cursor-not-allowed"}`,
|
|
17574
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ZoomOut, { className: "w-5 h-5" })
|
|
17575
|
+
}
|
|
17576
|
+
),
|
|
17577
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-gray-300 font-medium min-w-[3rem] text-center", children: [
|
|
17578
|
+
Math.round(zoomLevel * 100),
|
|
17579
|
+
"%"
|
|
17580
|
+
] }),
|
|
17581
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17582
|
+
"button",
|
|
17583
|
+
{
|
|
17584
|
+
onClick: handleZoomIn,
|
|
17585
|
+
disabled: zoomLevel >= MAX_ZOOM,
|
|
17586
|
+
title: "Zoom In",
|
|
17587
|
+
className: `btn btn-ghost ${zoomLevel < MAX_ZOOM ? "text-gray-300 hover:text-white" : "text-gray-500 cursor-not-allowed"}`,
|
|
17588
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ZoomIn, { className: "w-5 h-5" })
|
|
17589
|
+
}
|
|
17590
|
+
)
|
|
17591
|
+
] })
|
|
17592
|
+
] }) });
|
|
17495
17593
|
};
|
|
17496
17594
|
const usePlayerControl = () => {
|
|
17497
17595
|
const { playerState, setPlayerState } = livePlayer.useLivePlayerContext();
|
|
@@ -17519,59 +17617,15 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17519
17617
|
togglePlayback
|
|
17520
17618
|
};
|
|
17521
17619
|
};
|
|
17522
|
-
const MAX_ZOOM = 3;
|
|
17523
|
-
const MIN_ZOOM = 0.5;
|
|
17524
|
-
const ZOOM_STEP = 0.25;
|
|
17525
|
-
const TimelineZoom = ({
|
|
17526
|
-
zoomLevel,
|
|
17527
|
-
setZoomLevel,
|
|
17528
|
-
minZoom = MIN_ZOOM,
|
|
17529
|
-
maxZoom = MAX_ZOOM,
|
|
17530
|
-
zoomStep = ZOOM_STEP
|
|
17531
|
-
}) => {
|
|
17532
|
-
const handleZoomIn = () => {
|
|
17533
|
-
if (zoomLevel < maxZoom) {
|
|
17534
|
-
setZoomLevel(zoomLevel + zoomStep);
|
|
17535
|
-
}
|
|
17536
|
-
};
|
|
17537
|
-
const handleZoomOut = () => {
|
|
17538
|
-
if (zoomLevel > minZoom) {
|
|
17539
|
-
setZoomLevel(zoomLevel - zoomStep);
|
|
17540
|
-
}
|
|
17541
|
-
};
|
|
17542
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twick-track-zoom-container", children: [
|
|
17543
|
-
/* @__PURE__ */ jsxRuntime.jsx(ZoomOut, { size: 28, onClick: handleZoomOut }),
|
|
17544
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twick-zoom-slider", children: [
|
|
17545
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17546
|
-
"div",
|
|
17547
|
-
{
|
|
17548
|
-
className: "twick-zoom-slider-track",
|
|
17549
|
-
style: {
|
|
17550
|
-
width: `${(zoomLevel - minZoom) / (maxZoom - minZoom) * 100}%`
|
|
17551
|
-
}
|
|
17552
|
-
}
|
|
17553
|
-
),
|
|
17554
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17555
|
-
"div",
|
|
17556
|
-
{
|
|
17557
|
-
className: "twick-zoom-slider-thumb",
|
|
17558
|
-
style: {
|
|
17559
|
-
left: `calc(${(zoomLevel - minZoom) / (maxZoom - minZoom) * 100}%)`
|
|
17560
|
-
}
|
|
17561
|
-
}
|
|
17562
|
-
)
|
|
17563
|
-
] }),
|
|
17564
|
-
/* @__PURE__ */ jsxRuntime.jsx(ZoomIn, { size: 28, onClick: handleZoomIn })
|
|
17565
|
-
] });
|
|
17566
|
-
};
|
|
17567
17620
|
const useTimelineControl = () => {
|
|
17568
|
-
const { editor } = timeline.useTimelineContext();
|
|
17621
|
+
const { editor, setSelectedItem } = timeline.useTimelineContext();
|
|
17569
17622
|
const deleteItem = (item) => {
|
|
17570
17623
|
if (item instanceof timeline.Track) {
|
|
17571
17624
|
editor.removeTrack(item);
|
|
17572
17625
|
} else if (item instanceof timeline.TrackElement) {
|
|
17573
17626
|
editor.removeElement(item);
|
|
17574
17627
|
}
|
|
17628
|
+
setSelectedItem(null);
|
|
17575
17629
|
};
|
|
17576
17630
|
const splitElement = (element, currentTime) => {
|
|
17577
17631
|
editor.splitElement(element, currentTime);
|
|
@@ -17597,25 +17651,24 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17597
17651
|
const { togglePlayback } = usePlayerControl();
|
|
17598
17652
|
const { canRedo, canUndo, totalDuration, selectedItem } = timeline.useTimelineContext();
|
|
17599
17653
|
const { deleteItem, splitElement, handleUndo, handleRedo } = useTimelineControl();
|
|
17600
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
] });
|
|
17654
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twick-editor-timeline-controls", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17655
|
+
PlayerControls,
|
|
17656
|
+
{
|
|
17657
|
+
selectedItem,
|
|
17658
|
+
duration: totalDuration,
|
|
17659
|
+
currentTime,
|
|
17660
|
+
playerState,
|
|
17661
|
+
togglePlayback,
|
|
17662
|
+
canUndo,
|
|
17663
|
+
canRedo,
|
|
17664
|
+
onDelete: deleteItem,
|
|
17665
|
+
onSplit: splitElement,
|
|
17666
|
+
onUndo: handleUndo,
|
|
17667
|
+
onRedo: handleRedo,
|
|
17668
|
+
zoomLevel: trackZoom,
|
|
17669
|
+
setZoomLevel: setTrackZoom
|
|
17670
|
+
}
|
|
17671
|
+
) });
|
|
17619
17672
|
};
|
|
17620
17673
|
const VideoEditor = ({
|
|
17621
17674
|
leftPanel,
|
|
@@ -17626,27 +17679,26 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17626
17679
|
defaultPlayControls = true
|
|
17627
17680
|
}) => {
|
|
17628
17681
|
const [trackZoom, setTrackZoom] = React.useState(DEFAULT_TIMELINE_ZOOM);
|
|
17682
|
+
const useMemoizedPlayerManager = React.useMemo(
|
|
17683
|
+
() => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17684
|
+
PlayerManager,
|
|
17685
|
+
{
|
|
17686
|
+
videoProps: editorConfig.videoProps,
|
|
17687
|
+
canvasMode: editorConfig.canvasMode ?? true
|
|
17688
|
+
}
|
|
17689
|
+
),
|
|
17690
|
+
[editorConfig]
|
|
17691
|
+
);
|
|
17629
17692
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twick-editor-main-container", children: [
|
|
17630
17693
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twick-editor-view-section", children: [
|
|
17631
17694
|
leftPanel ? leftPanel : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
|
|
17632
|
-
|
|
17633
|
-
PlayerManager,
|
|
17634
|
-
{
|
|
17635
|
-
videoProps: editorConfig.videoProps,
|
|
17636
|
-
canvasMode: editorConfig.canvasMode ?? true
|
|
17637
|
-
}
|
|
17638
|
-
),
|
|
17695
|
+
useMemoizedPlayerManager,
|
|
17639
17696
|
rightPanel ? rightPanel : /* @__PURE__ */ jsxRuntime.jsx("div", {})
|
|
17640
17697
|
] }),
|
|
17641
17698
|
bottomPanel ? bottomPanel : null,
|
|
17642
17699
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "twick-editor-timeline-section", children: [
|
|
17643
17700
|
playControls ? playControls : defaultPlayControls ? /* @__PURE__ */ jsxRuntime.jsx(ControlManager, { trackZoom, setTrackZoom }) : null,
|
|
17644
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17645
|
-
TimelineManager,
|
|
17646
|
-
{
|
|
17647
|
-
trackZoom
|
|
17648
|
-
}
|
|
17649
|
-
)
|
|
17701
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimelineManager, { trackZoom })
|
|
17650
17702
|
] })
|
|
17651
17703
|
] });
|
|
17652
17704
|
};
|
|
@@ -17817,7 +17869,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17817
17869
|
request.onsuccess = async () => {
|
|
17818
17870
|
let items = request.result;
|
|
17819
17871
|
const filteredItems = items.filter((item) => {
|
|
17820
|
-
const matchesQuery = item.url.toLowerCase().includes(options.query.toLowerCase());
|
|
17872
|
+
const matchesQuery = item.url.toLowerCase().includes((options.query || "").toLowerCase());
|
|
17821
17873
|
const matchesType = !options.type || item.type === options.type;
|
|
17822
17874
|
const matchesMetadata = !options.metadata || Object.entries(options.metadata).every(
|
|
17823
17875
|
([key, value]) => {
|
|
@@ -17871,9 +17923,14 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17871
17923
|
{
|
|
17872
17924
|
name: "fade",
|
|
17873
17925
|
interval: 1,
|
|
17926
|
+
duration: 1,
|
|
17927
|
+
intensity: 1,
|
|
17874
17928
|
animate: "enter",
|
|
17875
17929
|
options: {
|
|
17876
|
-
animate: ["enter", "exit", "both"]
|
|
17930
|
+
animate: ["enter", "exit", "both"],
|
|
17931
|
+
interval: [0.1, 5],
|
|
17932
|
+
duration: [0.1, 5],
|
|
17933
|
+
intensity: [0.1, 2]
|
|
17877
17934
|
},
|
|
17878
17935
|
getSample: () => {
|
|
17879
17936
|
return animationGifs.fade;
|
|
@@ -17882,11 +17939,16 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17882
17939
|
{
|
|
17883
17940
|
name: "rise",
|
|
17884
17941
|
interval: 1,
|
|
17942
|
+
duration: 1,
|
|
17943
|
+
intensity: 1,
|
|
17885
17944
|
animate: "enter",
|
|
17886
17945
|
direction: "up",
|
|
17887
17946
|
options: {
|
|
17888
17947
|
animate: ["enter", "exit", "both"],
|
|
17889
|
-
direction: ["up", "down"]
|
|
17948
|
+
direction: ["up", "down", "left", "right", "center"],
|
|
17949
|
+
interval: [0.1, 5],
|
|
17950
|
+
duration: [0.1, 5],
|
|
17951
|
+
intensity: [1, 300]
|
|
17890
17952
|
},
|
|
17891
17953
|
getSample: (animation) => {
|
|
17892
17954
|
return (animation == null ? void 0 : animation.direction) === "down" ? animationGifs["rise-down"] : animationGifs["rise-up"];
|
|
@@ -17895,9 +17957,14 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17895
17957
|
{
|
|
17896
17958
|
name: "blur",
|
|
17897
17959
|
interval: 1,
|
|
17960
|
+
duration: 1,
|
|
17961
|
+
intensity: 1,
|
|
17898
17962
|
animate: "enter",
|
|
17899
17963
|
options: {
|
|
17900
|
-
animate: ["enter", "exit", "both"]
|
|
17964
|
+
animate: ["enter", "exit", "both"],
|
|
17965
|
+
interval: [0.1, 5],
|
|
17966
|
+
duration: [0.1, 5],
|
|
17967
|
+
intensity: [0.1, 100]
|
|
17901
17968
|
},
|
|
17902
17969
|
getSample: () => {
|
|
17903
17970
|
return animationGifs.blur;
|
|
@@ -17906,11 +17973,16 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17906
17973
|
{
|
|
17907
17974
|
name: "breathe",
|
|
17908
17975
|
interval: 1,
|
|
17976
|
+
duration: 1,
|
|
17977
|
+
intensity: 1,
|
|
17909
17978
|
mode: "in",
|
|
17910
17979
|
animate: "enter",
|
|
17911
17980
|
options: {
|
|
17912
17981
|
animate: ["enter", "exit", "both"],
|
|
17913
|
-
mode: ["in", "out"]
|
|
17982
|
+
mode: ["in", "out"],
|
|
17983
|
+
interval: [0.1, 5],
|
|
17984
|
+
duration: [0.1, 5],
|
|
17985
|
+
intensity: [0.1, 2]
|
|
17914
17986
|
},
|
|
17915
17987
|
getSample: (animation) => {
|
|
17916
17988
|
return (animation == null ? void 0 : animation.mode) === "out" ? animationGifs["breathe-out"] : animationGifs["breathe-in"];
|
|
@@ -17919,9 +17991,14 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17919
17991
|
{
|
|
17920
17992
|
name: "succession",
|
|
17921
17993
|
interval: 1,
|
|
17994
|
+
duration: 1,
|
|
17995
|
+
intensity: 1,
|
|
17922
17996
|
animate: "enter",
|
|
17923
17997
|
options: {
|
|
17924
|
-
animate: ["enter", "exit", "both"]
|
|
17998
|
+
animate: ["enter", "exit", "both"],
|
|
17999
|
+
interval: [0.1, 5],
|
|
18000
|
+
duration: [0.1, 5],
|
|
18001
|
+
intensity: [0.1, 2]
|
|
17925
18002
|
},
|
|
17926
18003
|
getSample: () => {
|
|
17927
18004
|
return animationGifs.succession;
|
|
@@ -17932,6 +18009,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17932
18009
|
{
|
|
17933
18010
|
name: "typewriter",
|
|
17934
18011
|
delay: 0,
|
|
18012
|
+
duration: 1,
|
|
17935
18013
|
bufferTime: 0.1,
|
|
17936
18014
|
getSample: () => {
|
|
17937
18015
|
return "";
|
|
@@ -17940,6 +18018,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17940
18018
|
{
|
|
17941
18019
|
name: "erase",
|
|
17942
18020
|
delay: 0,
|
|
18021
|
+
duration: 1,
|
|
17943
18022
|
bufferTime: 0.1,
|
|
17944
18023
|
getSample: () => {
|
|
17945
18024
|
return "";
|
|
@@ -17948,6 +18027,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17948
18027
|
{
|
|
17949
18028
|
name: "elastic",
|
|
17950
18029
|
delay: 0,
|
|
18030
|
+
duration: 1,
|
|
17951
18031
|
bufferTime: 0.1,
|
|
17952
18032
|
getSample: () => {
|
|
17953
18033
|
return "";
|
|
@@ -17956,6 +18036,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17956
18036
|
{
|
|
17957
18037
|
name: "stream-word",
|
|
17958
18038
|
delay: 0,
|
|
18039
|
+
duration: 1,
|
|
17959
18040
|
bufferTime: 0.1,
|
|
17960
18041
|
getSample: () => {
|
|
17961
18042
|
return "";
|
|
@@ -17977,6 +18058,7 @@ This message will only show in development mode. It won't appear in production.
|
|
|
17977
18058
|
exports2.animationGifs = animationGifs;
|
|
17978
18059
|
exports2.default = VideoEditor;
|
|
17979
18060
|
exports2.getAnimationGif = getAnimationGif;
|
|
18061
|
+
exports2.setElementColors = setElementColors;
|
|
17980
18062
|
exports2.usePlayerControl = usePlayerControl;
|
|
17981
18063
|
exports2.useTimelineControl = useTimelineControl;
|
|
17982
18064
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|