@twick/video-editor 0.15.20 → 0.15.21
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/timeline/timeline-view.d.ts +3 -2
- package/dist/helpers/types.d.ts +1 -0
- package/dist/hooks/use-timeline-manager.d.ts +2 -1
- package/dist/index.js +208 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useLivePlayerContext, PLAYER_STATE, LivePlayer } from "@twick/live-player";
|
|
6
|
-
import { ImageElement as ImageElement$1, AudioElement, VideoElement as VideoElement$1, useTimelineContext, TIMELINE_ACTION, ElementDeserializer, getCurrentElements, CaptionElement as CaptionElement$1, getDecimalNumber, resolveIds, TrackElement, TRACK_TYPES, resolveId, Track, getElementIdsInRange, ValidationError, VALIDATION_ERROR_CODE, formatTimeWithFrames } from "@twick/timeline";
|
|
6
|
+
import { ImageElement as ImageElement$1, AudioElement, VideoElement as VideoElement$1, useTimelineContext, TIMELINE_ACTION, ElementDeserializer, getCurrentElements, CaptionElement as CaptionElement$1, TIMELINE_ELEMENT_TYPE, getDecimalNumber, resolveIds, TrackElement, TRACK_TYPES, resolveId, Track, getElementIdsInRange, ValidationError, VALIDATION_ERROR_CODE, formatTimeWithFrames } from "@twick/timeline";
|
|
7
7
|
import React, { useState, useRef, useCallback, useEffect, useMemo, forwardRef, createElement, createContext, useContext, useId, useLayoutEffect, useInsertionEffect, Fragment, Component } from "react";
|
|
8
8
|
function t(t2, e3, s2) {
|
|
9
9
|
return (e3 = function(t3) {
|
|
@@ -6900,7 +6900,13 @@ const ELEMENT_TYPES = {
|
|
|
6900
6900
|
/** Rectangle element type */
|
|
6901
6901
|
RECT: "rect",
|
|
6902
6902
|
/** Circle element type */
|
|
6903
|
-
CIRCLE: "circle"
|
|
6903
|
+
CIRCLE: "circle",
|
|
6904
|
+
/** Arrow annotation element type */
|
|
6905
|
+
ARROW: "arrow",
|
|
6906
|
+
/** Line annotation / shape element type */
|
|
6907
|
+
LINE: "line",
|
|
6908
|
+
/** Global / adjustment-layer style effect element */
|
|
6909
|
+
EFFECT: "effect"
|
|
6904
6910
|
};
|
|
6905
6911
|
const isBrowser$2 = typeof window !== "undefined";
|
|
6906
6912
|
const isCanvasSupported = isBrowser$2 && !!window.HTMLCanvasElement;
|
|
@@ -7644,7 +7650,7 @@ const addCaptionElement = ({
|
|
|
7644
7650
|
canvasMetadata,
|
|
7645
7651
|
lockAspectRatio = false
|
|
7646
7652
|
}) => {
|
|
7647
|
-
var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K;
|
|
7653
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
|
|
7648
7654
|
const applyToAll = (captionProps == null ? void 0 : captionProps.applyToAll) ?? false;
|
|
7649
7655
|
const captionTextColor = ((_a = captionProps == null ? void 0 : captionProps.colors) == null ? void 0 : _a.text) ?? ((_b = captionProps == null ? void 0 : captionProps.color) == null ? void 0 : _b.text);
|
|
7650
7656
|
const { x: x2, y: y2 } = convertToCanvasPosition(
|
|
@@ -7669,19 +7675,19 @@ const addCaptionElement = ({
|
|
|
7669
7675
|
),
|
|
7670
7676
|
fontFamily: (applyToAll ? (_o2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _o2.family : ((_q = (_p = element.props) == null ? void 0 : _p.font) == null ? void 0 : _q.family) ?? ((_r2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _r2.family)) ?? DEFAULT_CAPTION_PROPS.family,
|
|
7671
7677
|
fill: resolvedFill,
|
|
7672
|
-
fontWeight: (applyToAll ? (_s2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _s2.weight : ((_t2 = element.props) == null ? void 0 : _t2.
|
|
7673
|
-
stroke: (applyToAll ? captionProps == null ? void 0 : captionProps.stroke : ((
|
|
7674
|
-
opacity: (applyToAll ? captionProps == null ? void 0 : captionProps.opacity : ((
|
|
7678
|
+
fontWeight: (applyToAll ? (_s2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _s2.weight : ((_u = (_t2 = element.props) == null ? void 0 : _t2.font) == null ? void 0 : _u.weight) ?? ((_v = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _v.weight)) ?? DEFAULT_CAPTION_PROPS.fontWeight,
|
|
7679
|
+
stroke: (applyToAll ? captionProps == null ? void 0 : captionProps.stroke : ((_w = element.props) == null ? void 0 : _w.stroke) ?? (captionProps == null ? void 0 : captionProps.stroke)) ?? DEFAULT_CAPTION_PROPS.stroke,
|
|
7680
|
+
opacity: (applyToAll ? captionProps == null ? void 0 : captionProps.opacity : ((_x = element.props) == null ? void 0 : _x.opacity) ?? (captionProps == null ? void 0 : captionProps.opacity)) ?? 1,
|
|
7675
7681
|
width,
|
|
7676
7682
|
splitByGrapheme: false,
|
|
7677
|
-
textAlign: ((
|
|
7683
|
+
textAlign: ((_y = element.props) == null ? void 0 : _y.textAlign) ?? "center",
|
|
7678
7684
|
shadow: new Ds({
|
|
7679
|
-
offsetX: (applyToAll ? (
|
|
7680
|
-
offsetY: (applyToAll ? (
|
|
7681
|
-
blur: (applyToAll ? captionProps == null ? void 0 : captionProps.shadowBlur : ((
|
|
7682
|
-
color: (applyToAll ? captionProps == null ? void 0 : captionProps.shadowColor : ((
|
|
7685
|
+
offsetX: (applyToAll ? (_z = captionProps == null ? void 0 : captionProps.shadowOffset) == null ? void 0 : _z[0] : ((_B = (_A = element.props) == null ? void 0 : _A.shadowOffset) == null ? void 0 : _B[0]) ?? ((_C = captionProps == null ? void 0 : captionProps.shadowOffset) == null ? void 0 : _C[0])) ?? ((_D = DEFAULT_CAPTION_PROPS.shadowOffset) == null ? void 0 : _D[0]),
|
|
7686
|
+
offsetY: (applyToAll ? (_E = captionProps == null ? void 0 : captionProps.shadowOffset) == null ? void 0 : _E[1] : ((_G = (_F = element.props) == null ? void 0 : _F.shadowOffset) == null ? void 0 : _G[1]) ?? ((_H = captionProps == null ? void 0 : captionProps.shadowOffset) == null ? void 0 : _H[1])) ?? ((_I = DEFAULT_CAPTION_PROPS.shadowOffset) == null ? void 0 : _I[1]),
|
|
7687
|
+
blur: (applyToAll ? captionProps == null ? void 0 : captionProps.shadowBlur : ((_J = element.props) == null ? void 0 : _J.shadowBlur) ?? (captionProps == null ? void 0 : captionProps.shadowBlur)) ?? DEFAULT_CAPTION_PROPS.shadowBlur,
|
|
7688
|
+
color: (applyToAll ? captionProps == null ? void 0 : captionProps.shadowColor : ((_K = element.props) == null ? void 0 : _K.shadowColor) ?? (captionProps == null ? void 0 : captionProps.shadowColor)) ?? DEFAULT_CAPTION_PROPS.shadowColor
|
|
7683
7689
|
}),
|
|
7684
|
-
strokeWidth: (applyToAll ? captionProps == null ? void 0 : captionProps.lineWidth : ((
|
|
7690
|
+
strokeWidth: (applyToAll ? captionProps == null ? void 0 : captionProps.lineWidth : ((_L = element.props) == null ? void 0 : _L.lineWidth) ?? (captionProps == null ? void 0 : captionProps.lineWidth)) ?? DEFAULT_CAPTION_PROPS.lineWidth
|
|
7685
7691
|
});
|
|
7686
7692
|
caption.set("id", element.id);
|
|
7687
7693
|
caption.set("zIndex", index);
|
|
@@ -8392,6 +8398,148 @@ const WatermarkElement = {
|
|
|
8392
8398
|
};
|
|
8393
8399
|
}
|
|
8394
8400
|
};
|
|
8401
|
+
const ArrowElement = {
|
|
8402
|
+
name: ELEMENT_TYPES.ARROW,
|
|
8403
|
+
async add(params) {
|
|
8404
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2;
|
|
8405
|
+
const { element, index, canvas, canvasMetadata, lockAspectRatio } = params;
|
|
8406
|
+
const baseWidth = ((_a = element.props) == null ? void 0 : _a.width) ?? 220;
|
|
8407
|
+
const baseHeight = ((_b = element.props) == null ? void 0 : _b.height) ?? 14;
|
|
8408
|
+
const { x: x2, y: y2 } = convertToCanvasPosition(
|
|
8409
|
+
((_c = element.props) == null ? void 0 : _c.x) ?? 0,
|
|
8410
|
+
((_d = element.props) == null ? void 0 : _d.y) ?? 0,
|
|
8411
|
+
canvasMetadata
|
|
8412
|
+
);
|
|
8413
|
+
const fill = ((_e2 = element.props) == null ? void 0 : _e2.fill) || "#f59e0b";
|
|
8414
|
+
const radius = (((_f = element.props) == null ? void 0 : _f.radius) ?? 4) * canvasMetadata.scaleX;
|
|
8415
|
+
const barWidth = baseWidth * canvasMetadata.scaleX;
|
|
8416
|
+
const barHeight = baseHeight * canvasMetadata.scaleY;
|
|
8417
|
+
const headSize = barHeight * 1.8;
|
|
8418
|
+
const barLength = barWidth - headSize * 0.5;
|
|
8419
|
+
const bar = new jr({
|
|
8420
|
+
left: -barWidth / 2,
|
|
8421
|
+
top: -barHeight / 2,
|
|
8422
|
+
originX: "left",
|
|
8423
|
+
originY: "top",
|
|
8424
|
+
width: barLength,
|
|
8425
|
+
height: barHeight,
|
|
8426
|
+
rx: radius,
|
|
8427
|
+
ry: radius,
|
|
8428
|
+
fill
|
|
8429
|
+
});
|
|
8430
|
+
const arrowHead = new yo({
|
|
8431
|
+
left: barWidth / 2 - headSize * 0.25,
|
|
8432
|
+
top: 0,
|
|
8433
|
+
originX: "center",
|
|
8434
|
+
originY: "center",
|
|
8435
|
+
width: headSize,
|
|
8436
|
+
height: headSize,
|
|
8437
|
+
fill,
|
|
8438
|
+
angle: 90
|
|
8439
|
+
});
|
|
8440
|
+
const opacity = ((_g = element.props) == null ? void 0 : _g.opacity) ?? 1;
|
|
8441
|
+
const group = new Ur([bar, arrowHead], {
|
|
8442
|
+
left: x2,
|
|
8443
|
+
top: y2,
|
|
8444
|
+
originX: "center",
|
|
8445
|
+
originY: "center",
|
|
8446
|
+
angle: ((_h2 = element.props) == null ? void 0 : _h2.rotation) || 0,
|
|
8447
|
+
opacity,
|
|
8448
|
+
selectable: true,
|
|
8449
|
+
hasControls: true
|
|
8450
|
+
});
|
|
8451
|
+
group.set(
|
|
8452
|
+
"lockUniScaling",
|
|
8453
|
+
lockAspectRatio ?? ((_i2 = element.props) == null ? void 0 : _i2.lockAspectRatio) ?? true
|
|
8454
|
+
);
|
|
8455
|
+
group.set("id", element.id);
|
|
8456
|
+
group.set("zIndex", index);
|
|
8457
|
+
canvas.add(group);
|
|
8458
|
+
},
|
|
8459
|
+
updateFromFabricObject(object, element, context) {
|
|
8460
|
+
var _a, _b, _c;
|
|
8461
|
+
const canvasCenter = getObjectCanvasCenter(object);
|
|
8462
|
+
const { x: x2, y: y2 } = convertToVideoPosition(
|
|
8463
|
+
canvasCenter.x,
|
|
8464
|
+
canvasCenter.y,
|
|
8465
|
+
context.canvasMetadata,
|
|
8466
|
+
context.videoSize
|
|
8467
|
+
);
|
|
8468
|
+
const baseWidth = ((_a = element.props) == null ? void 0 : _a.width) ?? 220;
|
|
8469
|
+
const baseHeight = ((_b = element.props) == null ? void 0 : _b.height) ?? 14;
|
|
8470
|
+
const opacity = object.opacity ?? ((_c = element.props) == null ? void 0 : _c.opacity) ?? 1;
|
|
8471
|
+
return {
|
|
8472
|
+
element: {
|
|
8473
|
+
...element,
|
|
8474
|
+
props: {
|
|
8475
|
+
...element.props,
|
|
8476
|
+
rotation: getObjectCanvasAngle(object),
|
|
8477
|
+
width: baseWidth * object.scaleX,
|
|
8478
|
+
height: baseHeight * object.scaleY,
|
|
8479
|
+
x: x2,
|
|
8480
|
+
y: y2,
|
|
8481
|
+
opacity
|
|
8482
|
+
}
|
|
8483
|
+
}
|
|
8484
|
+
};
|
|
8485
|
+
}
|
|
8486
|
+
};
|
|
8487
|
+
const LineElement = {
|
|
8488
|
+
name: ELEMENT_TYPES.LINE,
|
|
8489
|
+
async add(params) {
|
|
8490
|
+
var _a;
|
|
8491
|
+
const { element, index, canvas, canvasMetadata, lockAspectRatio } = params;
|
|
8492
|
+
const lineProps = element.props ?? {};
|
|
8493
|
+
const lineElement = {
|
|
8494
|
+
...element,
|
|
8495
|
+
props: {
|
|
8496
|
+
...lineProps,
|
|
8497
|
+
// Use fill as stroke color when a stroke is desired; otherwise rely
|
|
8498
|
+
// on fill-only rendering. Avoid the generic "#000000" fallback.
|
|
8499
|
+
stroke: lineProps.stroke ?? lineProps.fill,
|
|
8500
|
+
// If a specific lineWidth is provided, keep it; otherwise default to 0
|
|
8501
|
+
// so the stroke does not override the visual fill color.
|
|
8502
|
+
lineWidth: lineProps.lineWidth ?? 0
|
|
8503
|
+
}
|
|
8504
|
+
};
|
|
8505
|
+
await addRectElement({
|
|
8506
|
+
element: lineElement,
|
|
8507
|
+
index,
|
|
8508
|
+
canvas,
|
|
8509
|
+
canvasMetadata,
|
|
8510
|
+
lockAspectRatio: lockAspectRatio ?? ((_a = lineElement.props) == null ? void 0 : _a.lockAspectRatio)
|
|
8511
|
+
});
|
|
8512
|
+
},
|
|
8513
|
+
updateFromFabricObject(object, element, context) {
|
|
8514
|
+
var _a, _b;
|
|
8515
|
+
const canvasCenter = getObjectCanvasCenter(object);
|
|
8516
|
+
const { x: x2, y: y2 } = convertToVideoPosition(
|
|
8517
|
+
canvasCenter.x,
|
|
8518
|
+
canvasCenter.y,
|
|
8519
|
+
context.canvasMetadata,
|
|
8520
|
+
context.videoSize
|
|
8521
|
+
);
|
|
8522
|
+
return {
|
|
8523
|
+
element: {
|
|
8524
|
+
...element,
|
|
8525
|
+
props: {
|
|
8526
|
+
...element.props,
|
|
8527
|
+
rotation: getObjectCanvasAngle(object),
|
|
8528
|
+
width: (((_a = element.props) == null ? void 0 : _a.width) ?? 0) * object.scaleX,
|
|
8529
|
+
height: (((_b = element.props) == null ? void 0 : _b.height) ?? 0) * object.scaleY,
|
|
8530
|
+
x: x2,
|
|
8531
|
+
y: y2
|
|
8532
|
+
}
|
|
8533
|
+
}
|
|
8534
|
+
};
|
|
8535
|
+
}
|
|
8536
|
+
};
|
|
8537
|
+
const EffectElement = {
|
|
8538
|
+
name: ELEMENT_TYPES.EFFECT,
|
|
8539
|
+
async add() {
|
|
8540
|
+
return;
|
|
8541
|
+
}
|
|
8542
|
+
};
|
|
8395
8543
|
class ElementController {
|
|
8396
8544
|
constructor() {
|
|
8397
8545
|
__publicField2(this, "elements", /* @__PURE__ */ new Map());
|
|
@@ -8415,6 +8563,9 @@ function registerElements() {
|
|
|
8415
8563
|
elementController.register(TextElement);
|
|
8416
8564
|
elementController.register(CaptionElement);
|
|
8417
8565
|
elementController.register(WatermarkElement);
|
|
8566
|
+
elementController.register(ArrowElement);
|
|
8567
|
+
elementController.register(LineElement);
|
|
8568
|
+
elementController.register(EffectElement);
|
|
8418
8569
|
}
|
|
8419
8570
|
registerElements();
|
|
8420
8571
|
const useTwickCanvas = ({
|
|
@@ -8995,7 +9146,9 @@ const DEFAULT_ELEMENT_COLORS = {
|
|
|
8995
9146
|
/** Icon element color - bright orchid */
|
|
8996
9147
|
icon: "#A76CD4",
|
|
8997
9148
|
/** Circle element color - deep byzantium */
|
|
8998
|
-
circle: "#703D8B"
|
|
9149
|
+
circle: "#703D8B",
|
|
9150
|
+
/** Effect element color - cyan accent for global effects */
|
|
9151
|
+
effect: "#22C3EE"
|
|
8999
9152
|
};
|
|
9000
9153
|
const AVAILABLE_TEXT_FONTS = {
|
|
9001
9154
|
// Google Fonts
|
|
@@ -18886,6 +19039,7 @@ const TrackElementView = ({
|
|
|
18886
19039
|
onDragStateChange,
|
|
18887
19040
|
elementColors
|
|
18888
19041
|
}) => {
|
|
19042
|
+
var _a, _b;
|
|
18889
19043
|
const ref = useRef(null);
|
|
18890
19044
|
const dragType = useRef(null);
|
|
18891
19045
|
const lastPosRef = useRef(null);
|
|
@@ -18975,12 +19129,12 @@ const TrackElementView = ({
|
|
|
18975
19129
|
lastPosRef.current = position;
|
|
18976
19130
|
};
|
|
18977
19131
|
const sendUpdate = (e3) => {
|
|
18978
|
-
var
|
|
19132
|
+
var _a2, _b2, _c;
|
|
18979
19133
|
let dropPointer;
|
|
18980
19134
|
if (e3) {
|
|
18981
19135
|
if ("clientX" in e3) {
|
|
18982
19136
|
dropPointer = { clientX: e3.clientX, clientY: e3.clientY };
|
|
18983
|
-
} else if ("changedTouches" in e3 && ((
|
|
19137
|
+
} else if ("changedTouches" in e3 && ((_a2 = e3.changedTouches) == null ? void 0 : _a2[0])) {
|
|
18984
19138
|
const t2 = e3.changedTouches[0];
|
|
18985
19139
|
dropPointer = { clientX: t2.clientX, clientY: t2.clientY };
|
|
18986
19140
|
}
|
|
@@ -18995,15 +19149,16 @@ const TrackElementView = ({
|
|
|
18995
19149
|
},
|
|
18996
19150
|
dragType: dragType.current || ""
|
|
18997
19151
|
};
|
|
18998
|
-
const didChange = ((
|
|
19152
|
+
const didChange = ((_b2 = lastPosRef.current) == null ? void 0 : _b2.start) !== position.start || ((_c = lastPosRef.current) == null ? void 0 : _c.end) !== position.end;
|
|
18999
19153
|
if (didChange || dropPointer) {
|
|
19000
19154
|
onDrag(payload, dropPointer);
|
|
19001
19155
|
}
|
|
19002
19156
|
};
|
|
19003
19157
|
const getElementColor = (elementType) => {
|
|
19004
19158
|
const colors = elementColors || ELEMENT_COLORS;
|
|
19005
|
-
|
|
19006
|
-
|
|
19159
|
+
const key = elementType === TIMELINE_ELEMENT_TYPE.VIDEO ? "video" : elementType === TIMELINE_ELEMENT_TYPE.AUDIO ? "audio" : elementType === TIMELINE_ELEMENT_TYPE.IMAGE ? "image" : elementType === TIMELINE_ELEMENT_TYPE.TEXT ? "text" : elementType === TIMELINE_ELEMENT_TYPE.CAPTION ? "caption" : elementType === TIMELINE_ELEMENT_TYPE.RECT ? "rect" : elementType === TIMELINE_ELEMENT_TYPE.CIRCLE ? "circle" : elementType === TIMELINE_ELEMENT_TYPE.ICON ? "icon" : elementType === TIMELINE_ELEMENT_TYPE.EFFECT ? "effect" : "element";
|
|
19160
|
+
if (key in colors) {
|
|
19161
|
+
return colors[key];
|
|
19007
19162
|
}
|
|
19008
19163
|
return ELEMENT_COLORS.element;
|
|
19009
19164
|
};
|
|
@@ -19047,7 +19202,7 @@ const TrackElementView = ({
|
|
|
19047
19202
|
className: "twick-track-element-handle twick-track-element-handle-start"
|
|
19048
19203
|
}
|
|
19049
19204
|
) : null,
|
|
19050
|
-
/* @__PURE__ */ jsx("div", { className: "twick-track-element-content", children: element.getText ? element.getText() : element.getName() || element.getType() }),
|
|
19205
|
+
/* @__PURE__ */ jsx("div", { className: "twick-track-element-content", children: element.getType() === TIMELINE_ELEMENT_TYPE.EFFECT ? ((_b = (_a = element.getProps) == null ? void 0 : _a.call(element)) == null ? void 0 : _b.effectKey) ?? "Effect" : element.getText ? element.getText() : element.getName() || element.getType() }),
|
|
19051
19206
|
hasHandles ? /* @__PURE__ */ jsx(
|
|
19052
19207
|
"div",
|
|
19053
19208
|
{
|
|
@@ -19405,13 +19560,15 @@ function TimelineView({
|
|
|
19405
19560
|
onMarqueeSelect,
|
|
19406
19561
|
onElementDrag,
|
|
19407
19562
|
onElementDrop,
|
|
19563
|
+
onSeek,
|
|
19408
19564
|
elementColors,
|
|
19409
19565
|
selectedIds,
|
|
19410
19566
|
playheadPositionPx = 0,
|
|
19411
19567
|
isPlayheadActive = false,
|
|
19412
19568
|
onDropOnTimeline,
|
|
19413
19569
|
videoResolution,
|
|
19414
|
-
enableDropOnTimeline = true
|
|
19570
|
+
enableDropOnTimeline = true,
|
|
19571
|
+
chapters = []
|
|
19415
19572
|
}) {
|
|
19416
19573
|
const containerRef = useRef(null);
|
|
19417
19574
|
const seekContainerRef = useRef(null);
|
|
@@ -19573,9 +19730,36 @@ function TimelineView({
|
|
|
19573
19730
|
className: "twick-timeline-scroll-container",
|
|
19574
19731
|
onScroll: handleScroll,
|
|
19575
19732
|
children: [
|
|
19576
|
-
/* @__PURE__ */ jsx("div", { style: { width: timelineWidthPx }, children: seekTrack ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", position: "relative" }, children: [
|
|
19733
|
+
/* @__PURE__ */ jsx("div", { style: { width: timelineWidthPx }, children: seekTrack ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", position: "relative", minHeight: 34 }, children: [
|
|
19577
19734
|
/* @__PURE__ */ jsx("div", { className: "twick-seek-track-empty-space", onClick: onAddTrack, children: /* @__PURE__ */ jsx(Plus, { color: "white", size: 20 }) }),
|
|
19578
|
-
/* @__PURE__ */ jsx("div", { style: { flexGrow: 1 }, children: seekTrack })
|
|
19735
|
+
/* @__PURE__ */ jsx("div", { style: { flexGrow: 1 }, children: seekTrack }),
|
|
19736
|
+
chapters.map((chapter) => {
|
|
19737
|
+
const left = LABEL_WIDTH + chapter.time / Math.max(duration, 1e-3) * (timelineWidth - LABEL_WIDTH);
|
|
19738
|
+
return /* @__PURE__ */ jsx(
|
|
19739
|
+
"button",
|
|
19740
|
+
{
|
|
19741
|
+
className: "btn-ghost",
|
|
19742
|
+
title: chapter.title,
|
|
19743
|
+
onClick: (e3) => {
|
|
19744
|
+
e3.stopPropagation();
|
|
19745
|
+
onSeek(chapter.time);
|
|
19746
|
+
},
|
|
19747
|
+
style: {
|
|
19748
|
+
position: "absolute",
|
|
19749
|
+
left,
|
|
19750
|
+
top: 0,
|
|
19751
|
+
height: "100%",
|
|
19752
|
+
padding: "0 4px",
|
|
19753
|
+
borderRadius: 0,
|
|
19754
|
+
borderLeft: "1px solid rgba(255,255,255,0.4)",
|
|
19755
|
+
borderRight: "none",
|
|
19756
|
+
minWidth: 0
|
|
19757
|
+
},
|
|
19758
|
+
children: /* @__PURE__ */ jsx("span", { style: { fontSize: 10, opacity: 0.9 }, children: chapter.title })
|
|
19759
|
+
},
|
|
19760
|
+
chapter.id
|
|
19761
|
+
);
|
|
19762
|
+
})
|
|
19579
19763
|
] }) : null }),
|
|
19580
19764
|
/* @__PURE__ */ jsxs(
|
|
19581
19765
|
"div",
|
|
@@ -19890,7 +20074,7 @@ const TimelineManager = ({
|
|
|
19890
20074
|
timelineTickConfigs,
|
|
19891
20075
|
elementColors
|
|
19892
20076
|
}) => {
|
|
19893
|
-
var _a;
|
|
20077
|
+
var _a, _b;
|
|
19894
20078
|
const { playerState } = useLivePlayerContext();
|
|
19895
20079
|
const { followPlayheadEnabled, editor, videoResolution, setSelectedItem } = useTimelineContext();
|
|
19896
20080
|
const {
|
|
@@ -19962,6 +20146,7 @@ const TimelineManager = ({
|
|
|
19962
20146
|
elementColors,
|
|
19963
20147
|
playheadPositionPx: playheadState.positionPx,
|
|
19964
20148
|
isPlayheadActive,
|
|
20149
|
+
chapters: ((_a = timelineData == null ? void 0 : timelineData.metadata) == null ? void 0 : _a.chapters) ?? [],
|
|
19965
20150
|
onDropOnTimeline: handleDropOnTimeline,
|
|
19966
20151
|
videoResolution,
|
|
19967
20152
|
enableDropOnTimeline: true,
|
|
@@ -19971,7 +20156,7 @@ const TimelineManager = ({
|
|
|
19971
20156
|
duration: totalDuration,
|
|
19972
20157
|
zoom: trackZoom,
|
|
19973
20158
|
onSeek,
|
|
19974
|
-
timelineCount: ((
|
|
20159
|
+
timelineCount: ((_b = timelineData == null ? void 0 : timelineData.tracks) == null ? void 0 : _b.length) ?? 0,
|
|
19975
20160
|
timelineTickConfigs,
|
|
19976
20161
|
onPlayheadUpdate: handlePlayheadUpdate
|
|
19977
20162
|
}
|