@hyperframes/studio-server 0.9.11 → 0.9.13
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.
|
@@ -347,9 +347,10 @@ function resolveElementTiming(el) {
|
|
|
347
347
|
const timing = readClipTiming(el);
|
|
348
348
|
return { start: timing.start ?? 0, duration: timing.duration ?? 0 };
|
|
349
349
|
}
|
|
350
|
+
var roundMs = (seconds) => Math.round(seconds * 1e3) / 1e3;
|
|
350
351
|
function setElementDuration(el, start, duration, trackIndex) {
|
|
351
352
|
writeClipTiming(el, {
|
|
352
|
-
start: Math.round(start * 1e3) / 1e3,
|
|
353
|
+
start: typeof start === "number" ? Math.round(start * 1e3) / 1e3 : start,
|
|
353
354
|
duration: Math.round(duration * 1e3) / 1e3,
|
|
354
355
|
...trackIndex != null ? { trackIndex } : {}
|
|
355
356
|
});
|
|
@@ -369,6 +370,12 @@ function splitElementInHtml(source, target, splitTime, newId, fallbackTiming) {
|
|
|
369
370
|
const timed = timedMedia ?? el;
|
|
370
371
|
const timing = resolveElementTiming(timed);
|
|
371
372
|
let { start, duration } = timing;
|
|
373
|
+
const reference = readClipTiming(timed).startExpression;
|
|
374
|
+
const startsAfter = reference?.kind === "reference" ? reference : null;
|
|
375
|
+
if (startsAfter) {
|
|
376
|
+
if (!fallbackTiming) return { html: source, matched: false, newId: null };
|
|
377
|
+
start = fallbackTiming.start;
|
|
378
|
+
}
|
|
372
379
|
if (duration <= 0 && fallbackTiming && fallbackTiming.duration > 0) {
|
|
373
380
|
start = fallbackTiming.start;
|
|
374
381
|
duration = fallbackTiming.duration;
|
|
@@ -391,7 +398,12 @@ function splitElementInHtml(source, target, splitTime, newId, fallbackTiming) {
|
|
|
391
398
|
duplicateCssRulesForId(document, timedMedia.id, mediaId);
|
|
392
399
|
clonedTimed.setAttribute("id", mediaId);
|
|
393
400
|
}
|
|
394
|
-
setElementDuration(
|
|
401
|
+
setElementDuration(
|
|
402
|
+
clonedTimed,
|
|
403
|
+
startsAfter ? { ...startsAfter, offset: roundMs(startsAfter.offset + firstDuration) } : splitTime,
|
|
404
|
+
secondDuration,
|
|
405
|
+
fallbackTiming?.track
|
|
406
|
+
);
|
|
395
407
|
const playbackStartAttr = timed.hasAttribute("data-playback-start") ? "data-playback-start" : timed.hasAttribute("data-media-start") ? "data-media-start" : timed.matches("[data-composition-src], [data-composition-id]") ? "data-playback-start" : timed.matches("audio, video") ? "data-media-start" : null;
|
|
396
408
|
if (playbackStartAttr) {
|
|
397
409
|
const readAttr = (name) => timed.getAttribute(name);
|
|
@@ -409,7 +421,7 @@ function splitElementInHtml(source, target, splitTime, newId, fallbackTiming) {
|
|
|
409
421
|
if (originalId) {
|
|
410
422
|
duplicateCssRulesForId(document, originalId, newId);
|
|
411
423
|
}
|
|
412
|
-
setElementDuration(timed, start, firstDuration, fallbackTiming?.track);
|
|
424
|
+
setElementDuration(timed, startsAfter ?? start, firstDuration, fallbackTiming?.track);
|
|
413
425
|
if (el.nextSibling) {
|
|
414
426
|
el.parentElement.insertBefore(clone, el.nextSibling);
|
|
415
427
|
} else {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio-server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"linkedom": "^0.18.12",
|
|
89
89
|
"postcss": "^8.5.8",
|
|
90
90
|
"postcss-selector-parser": "^7.1.2",
|
|
91
|
-
"@hyperframes/core": "0.9.
|
|
92
|
-
"@hyperframes/parsers": "0.9.
|
|
91
|
+
"@hyperframes/core": "0.9.13",
|
|
92
|
+
"@hyperframes/parsers": "0.9.13"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@types/node": "^25.0.10",
|