@hyperframes/studio 0.9.56 → 0.9.59
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/assets/hyperframes-player-bya4hgms.js +573 -0
- package/dist/assets/{index-yuN1pZrv.js → index--dcfSUzI.js} +1 -1
- package/dist/assets/{index-CgyBYe2L.js → index-Bxh5lW0C.js} +178 -178
- package/dist/assets/{pausedVideoDecoder-DtvSF8bV.js → pausedVideoDecoder-BKym1jA6.js} +1 -1
- package/dist/index.d.ts +88 -3
- package/dist/index.html +1 -1
- package/dist/index.js +912 -814
- package/package.json +8 -8
- package/src/components/nle/NLEPreview.test.ts +35 -3
- package/src/components/nle/NLEPreview.tsx +5 -4
- package/src/hooks/gsapRuntimePatch.ts +2 -3
- package/src/hooks/gsapRuntimeReaders.test.ts +5 -40
- package/src/hooks/gsapRuntimeReaders.ts +3 -27
- package/src/hooks/useExternalFileChangeCoordinator.test.tsx +20 -0
- package/src/hooks/useExternalFileChangeCoordinator.ts +1 -1
- package/src/hooks/useMusicBeatAnalysis.test.tsx +131 -0
- package/src/hooks/useMusicBeatAnalysis.ts +51 -66
- package/src/hooks/useRenderClipContent.test.ts +21 -0
- package/src/hooks/useRenderClipContent.ts +3 -1
- package/src/index.ts +18 -0
- package/src/player/components/studioShortcuts.ts +3 -2
- package/src/player/hooks/timelinePlayerTestHarness.ts +2 -0
- package/src/player/hooks/timelineSyncHydration.test.ts +28 -2
- package/src/player/hooks/timelineSyncHydration.ts +3 -7
- package/src/player/hooks/usePlaybackKeyboard.test.ts +107 -2
- package/src/player/hooks/usePlaybackKeyboard.ts +38 -1
- package/src/player/hooks/useShadowPreviewReload.ts +131 -14
- package/src/player/hooks/useTimelinePlayer.reloadStill.test.ts +241 -0
- package/src/player/hooks/useTimelinePlayer.ts +13 -1
- package/src/player/hooks/useTimelineSyncCallbacks.ts +4 -0
- package/src/player/lib/previewElements.test.ts +4 -0
- package/src/player/lib/previewElements.ts +1 -0
- package/src/sealedPreviewExports.test.ts +21 -0
- package/src/utils/externalConflictStorage.test.ts +66 -14
- package/src/utils/externalConflictStorage.ts +36 -82
- package/src/utils/gsapSoftReload.ts +2 -14
- package/src/utils/timelineInspector.test.ts +49 -2
- package/src/utils/timelineInspector.ts +21 -2
- package/dist/assets/hyperframes-player-SRLbmEDB.js +0 -565
package/dist/index.js
CHANGED
|
@@ -312,11 +312,12 @@ function setStudioKeys(overrides) {
|
|
|
312
312
|
for (const listener2 of listeners) listener2();
|
|
313
313
|
}
|
|
314
314
|
var getStudioKeys = () => current;
|
|
315
|
-
|
|
315
|
+
var getStudioKey = (action) => current[action];
|
|
316
|
+
function subscribeStudioKeys(listener2) {
|
|
316
317
|
listeners.add(listener2);
|
|
317
318
|
return () => listeners.delete(listener2);
|
|
318
319
|
}
|
|
319
|
-
var useStudioKeys = () => useSyncExternalStore(
|
|
320
|
+
var useStudioKeys = () => useSyncExternalStore(subscribeStudioKeys, getStudioKeys);
|
|
320
321
|
function useShortcutSections(host) {
|
|
321
322
|
const keys = useStudioKeys();
|
|
322
323
|
return host ?? buildShortcutSections(keys);
|
|
@@ -461,9 +462,9 @@ function getCliDistinctId() {
|
|
|
461
462
|
}
|
|
462
463
|
}
|
|
463
464
|
function persist(ls, id) {
|
|
464
|
-
for (const
|
|
465
|
+
for (const key of [DISTINCT_ID_KEY, LEGACY_STUDIO_ANON_ID_KEY]) {
|
|
465
466
|
try {
|
|
466
|
-
ls.setItem(
|
|
467
|
+
ls.setItem(key, id);
|
|
467
468
|
} catch {
|
|
468
469
|
}
|
|
469
470
|
}
|
|
@@ -504,9 +505,9 @@ var NOTICE_KEY = "hyperframes-studio:telemetryNoticeShown";
|
|
|
504
505
|
function getAnonymousId() {
|
|
505
506
|
return resolveStudioDistinctId();
|
|
506
507
|
}
|
|
507
|
-
function readStoredFlag(
|
|
508
|
+
function readStoredFlag(key) {
|
|
508
509
|
try {
|
|
509
|
-
return safeLocalStorage()?.getItem(
|
|
510
|
+
return safeLocalStorage()?.getItem(key) === "1";
|
|
510
511
|
} catch {
|
|
511
512
|
return false;
|
|
512
513
|
}
|
|
@@ -607,12 +608,12 @@ function resolveBucketUnit() {
|
|
|
607
608
|
var STORAGE_PREFIX = "hyperframes-studio:canary:";
|
|
608
609
|
function readOverride(name) {
|
|
609
610
|
if (typeof window === "undefined") return void 0;
|
|
610
|
-
const
|
|
611
|
+
const key = canaryParamName(name);
|
|
611
612
|
const storageKey = `${STORAGE_PREFIX}${name}`;
|
|
612
613
|
const store = safeSessionStorage();
|
|
613
614
|
let raw = null;
|
|
614
615
|
try {
|
|
615
|
-
raw = new URLSearchParams(window.location.search).get(
|
|
616
|
+
raw = new URLSearchParams(window.location.search).get(key);
|
|
616
617
|
} catch {
|
|
617
618
|
raw = null;
|
|
618
619
|
}
|
|
@@ -1604,6 +1605,12 @@ function isMusicTrack(element) {
|
|
|
1604
1605
|
const id = element.domId ?? element.id ?? "";
|
|
1605
1606
|
return MUSIC_ID_RE.test(id);
|
|
1606
1607
|
}
|
|
1608
|
+
var MAX_BEAT_SOURCE_SECONDS = 15 * 60;
|
|
1609
|
+
function fitsBeatAnalysis({
|
|
1610
|
+
sourceDuration
|
|
1611
|
+
}) {
|
|
1612
|
+
return sourceDuration != null && sourceDuration <= MAX_BEAT_SOURCE_SECONDS;
|
|
1613
|
+
}
|
|
1607
1614
|
function resolveBeatSourceTrack(elements) {
|
|
1608
1615
|
const explicit = elements.find(isMusicTrack);
|
|
1609
1616
|
if (explicit) return { element: explicit, isFallback: false };
|
|
@@ -1611,6 +1618,7 @@ function resolveBeatSourceTrack(elements) {
|
|
|
1611
1618
|
for (const el of elements) {
|
|
1612
1619
|
if (!isMusicSourceElement(el)) continue;
|
|
1613
1620
|
if (el.timelineRole && el.timelineRole !== "music") continue;
|
|
1621
|
+
if (!fitsBeatAnalysis(el)) continue;
|
|
1614
1622
|
if (!best || el.duration > best.duration) best = el;
|
|
1615
1623
|
}
|
|
1616
1624
|
return best ? { element: best, isFallback: true } : null;
|
|
@@ -2020,42 +2028,43 @@ function cacheAnalysis(url, promise) {
|
|
|
2020
2028
|
analysisCache.delete(oldest);
|
|
2021
2029
|
}
|
|
2022
2030
|
}
|
|
2023
|
-
async function
|
|
2024
|
-
if (!beatPath) return { ...detected, hasFile: false };
|
|
2031
|
+
async function readSavedBeats(io, beatPath) {
|
|
2025
2032
|
try {
|
|
2026
2033
|
const content = await io.readOptionalProjectFile(beatPath);
|
|
2027
2034
|
const parsed = content ? parseBeats(content) : null;
|
|
2028
|
-
|
|
2029
|
-
return { times: parsed.times, strengths: parsed.strengths, hasFile: true };
|
|
2030
|
-
}
|
|
2035
|
+
return parsed && parsed.times.length > 0 ? { times: parsed.times, strengths: parsed.strengths } : null;
|
|
2031
2036
|
} catch {
|
|
2032
|
-
|
|
2033
|
-
return { ...detected, hasFile: false };
|
|
2034
|
-
}
|
|
2035
|
-
async function readHasSavedBeats(io, beatPath) {
|
|
2036
|
-
try {
|
|
2037
|
-
const content = await io.readOptionalProjectFile(beatPath);
|
|
2038
|
-
const parsed = content ? parseBeats(content) : null;
|
|
2039
|
-
return !!(parsed && parsed.times.length > 0);
|
|
2040
|
-
} catch {
|
|
2041
|
-
return false;
|
|
2037
|
+
return null;
|
|
2042
2038
|
}
|
|
2043
2039
|
}
|
|
2044
|
-
async function
|
|
2040
|
+
async function decodeTrack(musicSrc) {
|
|
2045
2041
|
let promise = analysisCache.get(musicSrc);
|
|
2046
2042
|
if (!promise) {
|
|
2047
2043
|
promise = analyzeMusicFromUrl(musicSrc, { pause: whenTimelineIdle });
|
|
2048
2044
|
cacheAnalysis(musicSrc, promise);
|
|
2049
2045
|
}
|
|
2050
|
-
|
|
2051
|
-
const analysis = await promise;
|
|
2052
|
-
const detected = { times: analysis.beatTimes, strengths: analysis.beatStrengths };
|
|
2053
|
-
const { times, strengths } = await resolveBeats(beatPath, detected, io);
|
|
2054
|
-
return { analysis, times, strengths };
|
|
2055
|
-
} catch {
|
|
2056
|
-
return null;
|
|
2057
|
-
}
|
|
2046
|
+
return promise.catch(() => null);
|
|
2058
2047
|
}
|
|
2048
|
+
async function loadTrack(musicSrc, beatPath, io, isFallbackTrack, decodable) {
|
|
2049
|
+
const saved2 = await readSavedBeats(io, beatPath);
|
|
2050
|
+
if (!isFallbackTrack && !saved2) return null;
|
|
2051
|
+
if (!decodable) return saved2 && { analysis: savedOnly(saved2), ...saved2 };
|
|
2052
|
+
const analysis = await decodeTrack(musicSrc);
|
|
2053
|
+
if (!analysis) return null;
|
|
2054
|
+
return {
|
|
2055
|
+
analysis,
|
|
2056
|
+
...saved2 ?? { times: analysis.beatTimes, strengths: analysis.beatStrengths }
|
|
2057
|
+
};
|
|
2058
|
+
}
|
|
2059
|
+
var savedOnly = ({ times, strengths }) => ({
|
|
2060
|
+
beatTimes: times,
|
|
2061
|
+
beatStrengths: strengths,
|
|
2062
|
+
bpm: null,
|
|
2063
|
+
bpmConfidence: "uncertain",
|
|
2064
|
+
channelData: null,
|
|
2065
|
+
sampleRate: 0,
|
|
2066
|
+
peak: 0
|
|
2067
|
+
});
|
|
2059
2068
|
function useAdjustedBeatAnalysis() {
|
|
2060
2069
|
const beatAnalysis = usePlayerStore((s) => s.beatAnalysis);
|
|
2061
2070
|
const musicElement = usePlayerStore((s) => getTimelineElementIndexes(s.elements).musicElement);
|
|
@@ -2076,13 +2085,16 @@ function useMusicBeatAnalysis() {
|
|
|
2076
2085
|
const writeProjectFile = fileManager?.writeProjectFile;
|
|
2077
2086
|
const ioRef = useRef5(null);
|
|
2078
2087
|
ioRef.current = readOptionalProjectFile && writeProjectFile ? { readOptionalProjectFile, writeProjectFile } : null;
|
|
2079
|
-
const { musicSrc, isFallbackTrack } = useMemo2(() => {
|
|
2088
|
+
const { musicSrc, isFallbackTrack, decodable } = useMemo2(() => {
|
|
2080
2089
|
const resolved2 = resolveBeatSourceTrack(elements);
|
|
2081
2090
|
return {
|
|
2082
2091
|
musicSrc: resolved2?.element.src ?? null,
|
|
2083
|
-
isFallbackTrack: resolved2?.isFallback ?? false
|
|
2092
|
+
isFallbackTrack: resolved2?.isFallback ?? false,
|
|
2093
|
+
decodable: resolved2 ? fitsBeatAnalysis(resolved2.element) : false
|
|
2084
2094
|
};
|
|
2085
2095
|
}, [elements]);
|
|
2096
|
+
const decodableRef = useRef5(decodable);
|
|
2097
|
+
decodableRef.current = decodable;
|
|
2086
2098
|
useEffect5(() => {
|
|
2087
2099
|
if (!musicSrc) {
|
|
2088
2100
|
setBeatAnalysis(null);
|
|
@@ -2101,16 +2113,7 @@ function useMusicBeatAnalysis() {
|
|
|
2101
2113
|
const io = ioRef.current;
|
|
2102
2114
|
(async () => {
|
|
2103
2115
|
if (!beatPath || !io) return;
|
|
2104
|
-
|
|
2105
|
-
const hasSavedBeats = await readHasSavedBeats(io, beatPath);
|
|
2106
|
-
if (cancelled) return;
|
|
2107
|
-
if (!hasSavedBeats) {
|
|
2108
|
-
setBeatAnalysis(null);
|
|
2109
|
-
return;
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2112
|
-
if (cancelled) return;
|
|
2113
|
-
const result = await loadBeatAnalysis(musicSrc, beatPath, io);
|
|
2116
|
+
const result = await loadTrack(musicSrc, beatPath, io, isFallbackTrack, decodableRef.current);
|
|
2114
2117
|
if (cancelled) return;
|
|
2115
2118
|
if (!result) {
|
|
2116
2119
|
setBeatAnalysis(null);
|
|
@@ -2314,14 +2317,14 @@ function createTimelineRowGeometry(rowKeys, rowHeights, padding = {}) {
|
|
|
2314
2317
|
const heights = Object.freeze(rowHeights.map(validRowHeight));
|
|
2315
2318
|
const keys = Object.freeze(
|
|
2316
2319
|
heights.map((_, row) => {
|
|
2317
|
-
const
|
|
2318
|
-
return
|
|
2320
|
+
const key = rowKeys[row];
|
|
2321
|
+
return key !== void 0 && Number.isFinite(key) ? key : row;
|
|
2319
2322
|
})
|
|
2320
2323
|
);
|
|
2321
2324
|
const offsets = [0];
|
|
2322
2325
|
for (const height of heights) offsets.push((offsets.at(-1) ?? 0) + height);
|
|
2323
2326
|
Object.freeze(offsets);
|
|
2324
|
-
const rowIndexByKey = new Map(keys.map((
|
|
2327
|
+
const rowIndexByKey = new Map(keys.map((key, row) => [key, row]));
|
|
2325
2328
|
const getRowHeight = (row) => validRowHeight(heights[row]);
|
|
2326
2329
|
const getRowOffset = (row) => {
|
|
2327
2330
|
if (heights.length === 0) return row * TRACK_H;
|
|
@@ -2921,8 +2924,8 @@ var ONTO_ROW_THRESHOLD = 0.35;
|
|
|
2921
2924
|
function isAudioElement(element) {
|
|
2922
2925
|
return element.tag?.toLowerCase() === "audio";
|
|
2923
2926
|
}
|
|
2924
|
-
function layerContainsElement(layer,
|
|
2925
|
-
return layer.elements.some((element) => getTimelineElementIdentity(element) ===
|
|
2927
|
+
function layerContainsElement(layer, key) {
|
|
2928
|
+
return layer.elements.some((element) => getTimelineElementIdentity(element) === key);
|
|
2926
2929
|
}
|
|
2927
2930
|
function layerConflictsWithElement(layer, element, draggedKey) {
|
|
2928
2931
|
return layer.elements.some(
|
|
@@ -2943,8 +2946,8 @@ function addElementChange(changes, element, zIndex) {
|
|
|
2943
2946
|
function addLayerChanges(changes, layer, zIndex, excludedKey) {
|
|
2944
2947
|
let count = 0;
|
|
2945
2948
|
for (const element of layer.elements) {
|
|
2946
|
-
const
|
|
2947
|
-
if (
|
|
2949
|
+
const key = getTimelineElementIdentity(element);
|
|
2950
|
+
if (key === excludedKey) continue;
|
|
2948
2951
|
const before = changes.length;
|
|
2949
2952
|
addElementChange(changes, element, zIndex);
|
|
2950
2953
|
if (changes.length > before) count += 1;
|
|
@@ -5000,7 +5003,7 @@ function useTimelineClipCapabilities() {
|
|
|
5000
5003
|
}
|
|
5001
5004
|
function refuseWhenReadOnly(readOnlyPress, callbacks) {
|
|
5002
5005
|
if (!readOnlyPress) return callbacks;
|
|
5003
|
-
return Object.fromEntries(Object.keys(callbacks).map((
|
|
5006
|
+
return Object.fromEntries(Object.keys(callbacks).map((key) => [key, readOnlyPress]));
|
|
5004
5007
|
}
|
|
5005
5008
|
function useAbandonEditsOnReadOnly(readOnly, abandon) {
|
|
5006
5009
|
const abandonNow = useEffectEvent(abandon);
|
|
@@ -5037,11 +5040,11 @@ function timelineKeyframeSelectionKey(elementId2, target) {
|
|
|
5037
5040
|
target.tweenPercentage ?? target.percentage
|
|
5038
5041
|
]);
|
|
5039
5042
|
}
|
|
5040
|
-
function timelineKeyframeTargetFromSelectionKey(elementId2,
|
|
5041
|
-
if (
|
|
5043
|
+
function timelineKeyframeTargetFromSelectionKey(elementId2, key) {
|
|
5044
|
+
if (key.startsWith("[")) {
|
|
5042
5045
|
let decoded;
|
|
5043
5046
|
try {
|
|
5044
|
-
decoded = JSON.parse(
|
|
5047
|
+
decoded = JSON.parse(key);
|
|
5045
5048
|
} catch {
|
|
5046
5049
|
return null;
|
|
5047
5050
|
}
|
|
@@ -5057,9 +5060,9 @@ function timelineKeyframeTargetFromSelectionKey(elementId2, key2) {
|
|
|
5057
5060
|
tweenPercentage
|
|
5058
5061
|
};
|
|
5059
5062
|
}
|
|
5060
|
-
const separator =
|
|
5061
|
-
if (separator < 0 ||
|
|
5062
|
-
const percentage = Number(
|
|
5063
|
+
const separator = key.lastIndexOf(":");
|
|
5064
|
+
if (separator < 0 || key.slice(0, separator) !== elementId2) return null;
|
|
5065
|
+
const percentage = Number(key.slice(separator + 1));
|
|
5063
5066
|
return Number.isFinite(percentage) ? { percentage } : null;
|
|
5064
5067
|
}
|
|
5065
5068
|
|
|
@@ -5398,12 +5401,12 @@ function parsePercentageKeyframes(kfObj) {
|
|
|
5398
5401
|
});
|
|
5399
5402
|
return keyframes.length > 0 ? { keyframes } : null;
|
|
5400
5403
|
}
|
|
5401
|
-
for (const [
|
|
5402
|
-
if (
|
|
5404
|
+
for (const [key, val] of Object.entries(kfObj)) {
|
|
5405
|
+
if (key === "easeEach") {
|
|
5403
5406
|
if (typeof val === "string") easeEach = val;
|
|
5404
5407
|
continue;
|
|
5405
5408
|
}
|
|
5406
|
-
const pctMatch =
|
|
5409
|
+
const pctMatch = key.match(/^(\d+(?:\.\d+)?)%$/);
|
|
5407
5410
|
if (!pctMatch || !val || typeof val !== "object") continue;
|
|
5408
5411
|
const percentage = parseFloat(pctMatch[1]);
|
|
5409
5412
|
const properties = collectAnimatableKeyframeProperties(val);
|
|
@@ -6042,9 +6045,9 @@ function parseMotionValues(value) {
|
|
|
6042
6045
|
if (!value || typeof value !== "object") return null;
|
|
6043
6046
|
const record2 = value;
|
|
6044
6047
|
const parsed = {};
|
|
6045
|
-
for (const
|
|
6046
|
-
const next = finiteNumber(record2[
|
|
6047
|
-
if (next != null) parsed[
|
|
6048
|
+
for (const key of ["x", "y", "scale", "rotation", "opacity", "autoAlpha"]) {
|
|
6049
|
+
const next = finiteNumber(record2[key]);
|
|
6050
|
+
if (next != null) parsed[key] = next;
|
|
6048
6051
|
}
|
|
6049
6052
|
return Object.keys(parsed).length > 0 ? parsed : null;
|
|
6050
6053
|
}
|
|
@@ -6806,9 +6809,9 @@ var xToSvg = (px) => PADH + S * px;
|
|
|
6806
6809
|
var yToSvg = (py) => HR + S * (1 - py);
|
|
6807
6810
|
var clampView = (py) => Math.max(VMIN, Math.min(VMAX, py));
|
|
6808
6811
|
var clampDragY = (py) => Math.max(DRAG_VMIN, Math.min(DRAG_VMAX, py));
|
|
6809
|
-
function nudgeCurve(tuple, handle,
|
|
6810
|
-
const deltaX =
|
|
6811
|
-
const deltaY =
|
|
6812
|
+
function nudgeCurve(tuple, handle, key, step) {
|
|
6813
|
+
const deltaX = key === "ArrowLeft" ? -step : key === "ArrowRight" ? step : 0;
|
|
6814
|
+
const deltaY = key === "ArrowDown" ? -step : key === "ArrowUp" ? step : 0;
|
|
6812
6815
|
if (deltaX === 0 && deltaY === 0) return null;
|
|
6813
6816
|
const next = [...tuple];
|
|
6814
6817
|
const xIndex = handle === "p1" ? 0 : 2;
|
|
@@ -7061,7 +7064,7 @@ function EaseCurveSection({
|
|
|
7061
7064
|
),
|
|
7062
7065
|
/* @__PURE__ */ jsx12("circle", { cx: a0.x, cy: a0.y, r: "3", className: "fill-accent-ink" }),
|
|
7063
7066
|
/* @__PURE__ */ jsx12("circle", { cx: a1.x, cy: a1.y, r: "3", className: "fill-accent-ink" }),
|
|
7064
|
-
showHandles && [["p1", p1], ["p2", p2]].map(([
|
|
7067
|
+
showHandles && [["p1", p1], ["p2", p2]].map(([key, pt]) => /* @__PURE__ */ jsxs9("g", { children: [
|
|
7065
7068
|
/* @__PURE__ */ jsx12(
|
|
7066
7069
|
"circle",
|
|
7067
7070
|
{
|
|
@@ -7071,16 +7074,16 @@ function EaseCurveSection({
|
|
|
7071
7074
|
fill: "transparent",
|
|
7072
7075
|
role: "slider",
|
|
7073
7076
|
tabIndex: 0,
|
|
7074
|
-
"aria-label": `${
|
|
7077
|
+
"aria-label": `${key === "p1" ? "First" : "Second"} bezier control point`,
|
|
7075
7078
|
"aria-valuemin": 0,
|
|
7076
7079
|
"aria-valuemax": 1,
|
|
7077
|
-
"aria-valuenow":
|
|
7078
|
-
"aria-valuetext": `x ${
|
|
7080
|
+
"aria-valuenow": key === "p1" ? x1 : x2,
|
|
7081
|
+
"aria-valuetext": `x ${key === "p1" ? x1 : x2}, y ${key === "p1" ? y1 : y2}`,
|
|
7079
7082
|
className: "cursor-grab stroke-transparent outline-hidden active:cursor-grabbing focus-visible:stroke-text-0 focus-visible:stroke-[2px]",
|
|
7080
|
-
onPointerDown: (e) => handlePointerDown(
|
|
7081
|
-
onKeyDown: (event) => handleKeyDown(
|
|
7082
|
-
onPointerEnter: () => setHover(
|
|
7083
|
-
onPointerLeave: () => setHover((h) => h ===
|
|
7083
|
+
onPointerDown: (e) => handlePointerDown(key, e),
|
|
7084
|
+
onKeyDown: (event) => handleKeyDown(key, event),
|
|
7085
|
+
onPointerEnter: () => setHover(key),
|
|
7086
|
+
onPointerLeave: () => setHover((h) => h === key ? null : h)
|
|
7084
7087
|
}
|
|
7085
7088
|
),
|
|
7086
7089
|
/* @__PURE__ */ jsx12(
|
|
@@ -7088,12 +7091,12 @@ function EaseCurveSection({
|
|
|
7088
7091
|
{
|
|
7089
7092
|
cx: pt.x,
|
|
7090
7093
|
cy: pt.y,
|
|
7091
|
-
r: hover ===
|
|
7094
|
+
r: hover === key || draggingRef.current === key ? 7 : 5.5,
|
|
7092
7095
|
strokeWidth: "2.5",
|
|
7093
7096
|
className: "pointer-events-none fill-input stroke-accent-ink transition-[r]"
|
|
7094
7097
|
}
|
|
7095
7098
|
)
|
|
7096
|
-
] },
|
|
7099
|
+
] }, key))
|
|
7097
7100
|
]
|
|
7098
7101
|
}
|
|
7099
7102
|
)
|
|
@@ -7545,8 +7548,8 @@ var DETAIL_KEYS = [
|
|
|
7545
7548
|
var trail = [];
|
|
7546
7549
|
var startedAt = Date.now();
|
|
7547
7550
|
function detailFor(properties) {
|
|
7548
|
-
for (const
|
|
7549
|
-
const value = properties[
|
|
7551
|
+
for (const key of DETAIL_KEYS) {
|
|
7552
|
+
const value = properties[key];
|
|
7550
7553
|
if (typeof value === "string" && value.length > 0 && value.length <= 24) return `:${value}`;
|
|
7551
7554
|
if (typeof value === "number" || typeof value === "boolean") return `:${String(value)}`;
|
|
7552
7555
|
}
|
|
@@ -7818,14 +7821,14 @@ function beginTimelineKeyframeRetime(input) {
|
|
|
7818
7821
|
actor2.phase = "complete";
|
|
7819
7822
|
};
|
|
7820
7823
|
if (coordinator.actor) cancel(coordinator.actor);
|
|
7821
|
-
for (const [
|
|
7822
|
-
if (pending3.sessionEpoch !== sessionEpoch) coordinator.pending.delete(
|
|
7824
|
+
for (const [key, pending3] of coordinator.pending) {
|
|
7825
|
+
if (pending3.sessionEpoch !== sessionEpoch) coordinator.pending.delete(key);
|
|
7823
7826
|
}
|
|
7824
|
-
for (const [
|
|
7827
|
+
for (const [key, pending3] of coordinator.pending) {
|
|
7825
7828
|
if (pending3.elementId === input.elementId && input.keyframes.some(
|
|
7826
7829
|
(keyframe) => input.keyframeKeyOf(keyframe) === pending3.destinationKeyframeKey && Math.abs(keyframe.percentage - pending3.clipPercentage) < 0.2
|
|
7827
7830
|
)) {
|
|
7828
|
-
coordinator.pending.delete(
|
|
7831
|
+
coordinator.pending.delete(key);
|
|
7829
7832
|
}
|
|
7830
7833
|
}
|
|
7831
7834
|
const pending2 = coordinator.pending.get(input.keyframeKey);
|
|
@@ -8018,8 +8021,8 @@ function beginTimelineKeyframeRetime(input) {
|
|
|
8018
8021
|
coordinator.latest = null;
|
|
8019
8022
|
cancel(actor);
|
|
8020
8023
|
} else if (actor.sourceWasPresent && !sourceStillPresent) {
|
|
8021
|
-
for (const [
|
|
8022
|
-
if (pending3.elementId === actor.elementId) coordinator.pending.delete(
|
|
8024
|
+
for (const [key, pending3] of coordinator.pending) {
|
|
8025
|
+
if (pending3.elementId === actor.elementId) coordinator.pending.delete(key);
|
|
8023
8026
|
}
|
|
8024
8027
|
if (coordinator.latest?.elementId === actor.elementId) coordinator.latest = null;
|
|
8025
8028
|
cancel(actor);
|
|
@@ -8587,11 +8590,11 @@ var EMPTY = { version: 1, lanes: [] };
|
|
|
8587
8590
|
var chainCache = /* @__PURE__ */ new Map();
|
|
8588
8591
|
var automationCache = /* @__PURE__ */ new Map();
|
|
8589
8592
|
var CACHE_LIMIT = 64;
|
|
8590
|
-
function cached3(store,
|
|
8591
|
-
const hit = store.get(
|
|
8593
|
+
function cached3(store, key, build) {
|
|
8594
|
+
const hit = store.get(key);
|
|
8592
8595
|
if (hit !== void 0) {
|
|
8593
|
-
store.delete(
|
|
8594
|
-
store.set(
|
|
8596
|
+
store.delete(key);
|
|
8597
|
+
store.set(key, hit);
|
|
8595
8598
|
return hit;
|
|
8596
8599
|
}
|
|
8597
8600
|
const value = build();
|
|
@@ -8599,7 +8602,7 @@ function cached3(store, key2, build) {
|
|
|
8599
8602
|
const oldest = store.keys().next();
|
|
8600
8603
|
if (!oldest.done) store.delete(oldest.value);
|
|
8601
8604
|
}
|
|
8602
|
-
store.set(
|
|
8605
|
+
store.set(key, value);
|
|
8603
8606
|
return value;
|
|
8604
8607
|
}
|
|
8605
8608
|
function elementFxChain(element) {
|
|
@@ -8676,14 +8679,14 @@ function groupAutomationLanes(elements) {
|
|
|
8676
8679
|
if (!isAudioOrVideoTimelineElement(element)) continue;
|
|
8677
8680
|
const chain = elementFxChain(element);
|
|
8678
8681
|
for (const lane of elementAutomationLanes(element)) {
|
|
8679
|
-
const
|
|
8682
|
+
const key = laneGroupKey(lane.target, chain);
|
|
8680
8683
|
const parts = automationLaneLabelParts(lane.target, chain);
|
|
8681
|
-
if (!
|
|
8682
|
-
const group = groups.get(
|
|
8684
|
+
if (!key || !parts) continue;
|
|
8685
|
+
const group = groups.get(key);
|
|
8683
8686
|
if (group) group.entries.push({ element, lane });
|
|
8684
8687
|
else {
|
|
8685
|
-
groups.set(
|
|
8686
|
-
key
|
|
8688
|
+
groups.set(key, {
|
|
8689
|
+
key,
|
|
8687
8690
|
name: parts.name,
|
|
8688
8691
|
param: parts.param,
|
|
8689
8692
|
entries: [{ element, lane }]
|
|
@@ -8826,7 +8829,7 @@ function useTimelineTrackDerivations(expandedElements) {
|
|
|
8826
8829
|
|
|
8827
8830
|
// src/player/components/timelineTrackInsertLayout.ts
|
|
8828
8831
|
function timelineTrackOrderChanged(previous, current2) {
|
|
8829
|
-
return current2.length !== previous.length || current2.some((
|
|
8832
|
+
return current2.length !== previous.length || current2.some((key, row) => key !== previous[row]);
|
|
8830
8833
|
}
|
|
8831
8834
|
function keyboardPickupInsertRow(row, allowed2) {
|
|
8832
8835
|
while (row > 0 && allowed2 && !allowed2.has(row)) row--;
|
|
@@ -8846,17 +8849,17 @@ function nextKeyboardInsertRow(input) {
|
|
|
8846
8849
|
function buildTimelineTrackInsertLayout(order, groups) {
|
|
8847
8850
|
const allowedRows = new Set(Array.from({ length: order.length + 1 }, (_, row) => row));
|
|
8848
8851
|
const anchors = new Map(groups.map((group) => [group.anchorKey, group.memberTracks]));
|
|
8849
|
-
const positions = new Map(order.map((
|
|
8852
|
+
const positions = new Map(order.map((key, row) => [key, row]));
|
|
8850
8853
|
for (const group of groups) {
|
|
8851
8854
|
const anchor2 = positions.get(group.anchorKey);
|
|
8852
8855
|
if (anchor2 === void 0) continue;
|
|
8853
|
-
const end = Math.max(anchor2, ...group.memberTracks.map((
|
|
8856
|
+
const end = Math.max(anchor2, ...group.memberTracks.map((key) => positions.get(key) ?? anchor2));
|
|
8854
8857
|
for (let row = anchor2 + 1; row <= end; row++) allowedRows.delete(row);
|
|
8855
8858
|
}
|
|
8856
8859
|
const tracks = /* @__PURE__ */ new Set();
|
|
8857
8860
|
const topologyRows = [0];
|
|
8858
|
-
for (const
|
|
8859
|
-
for (const track2 of anchors.get(
|
|
8861
|
+
for (const key of order) {
|
|
8862
|
+
for (const track2 of anchors.get(key) ?? [key]) tracks.add(track2);
|
|
8860
8863
|
topologyRows.push(tracks.size);
|
|
8861
8864
|
}
|
|
8862
8865
|
return {
|
|
@@ -8912,8 +8915,8 @@ function resolveTrackKeyframeClip(elements, laneCounts, selectedElementId, selec
|
|
|
8912
8915
|
const keyframed = elements.filter((element) => disclosable(element) >= 1);
|
|
8913
8916
|
if (keyframed.length === 0) return null;
|
|
8914
8917
|
const selected = keyframed.find((element) => {
|
|
8915
|
-
const
|
|
8916
|
-
return
|
|
8918
|
+
const key = element.key ?? element.id;
|
|
8919
|
+
return key === selectedElementId || selectedElementIds.has(key);
|
|
8917
8920
|
});
|
|
8918
8921
|
if (selected) return selected;
|
|
8919
8922
|
return keyframed.reduce(
|
|
@@ -9048,12 +9051,12 @@ function useDisplayRowHeights(displayTrackOrder2, rowGeometry) {
|
|
|
9048
9051
|
function insertPreviewTrack(trackOrder, preview2) {
|
|
9049
9052
|
const result = [];
|
|
9050
9053
|
let inserted = false;
|
|
9051
|
-
for (const
|
|
9052
|
-
if (!inserted && Number.isInteger(
|
|
9054
|
+
for (const key of trackOrder) {
|
|
9055
|
+
if (!inserted && Number.isInteger(key) && key > preview2) {
|
|
9053
9056
|
result.push(preview2);
|
|
9054
9057
|
inserted = true;
|
|
9055
9058
|
}
|
|
9056
|
-
result.push(
|
|
9059
|
+
result.push(key);
|
|
9057
9060
|
}
|
|
9058
9061
|
if (!inserted) result.push(preview2);
|
|
9059
9062
|
return result;
|
|
@@ -9065,7 +9068,7 @@ function useDisplayTrackOrder(draggedClip, trackOrder) {
|
|
|
9065
9068
|
return useMemo5(() => {
|
|
9066
9069
|
if (!started || previewTrack === void 0) return trackOrder;
|
|
9067
9070
|
if (insertRow !== null) {
|
|
9068
|
-
const pendingKey = trackOrder.reduce((lowest,
|
|
9071
|
+
const pendingKey = trackOrder.reduce((lowest, key) => Math.min(lowest, key), 0) - 1;
|
|
9069
9072
|
const displayOrder = [...trackOrder];
|
|
9070
9073
|
displayOrder.splice(insertRow, 0, pendingKey);
|
|
9071
9074
|
return displayOrder;
|
|
@@ -9105,8 +9108,8 @@ var NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
|
9105
9108
|
"PageUp",
|
|
9106
9109
|
"PageDown"
|
|
9107
9110
|
]);
|
|
9108
|
-
function isTimelineNavigationKey(
|
|
9109
|
-
return NAVIGATION_KEYS.has(
|
|
9111
|
+
function isTimelineNavigationKey(key) {
|
|
9112
|
+
return NAVIGATION_KEYS.has(key);
|
|
9110
9113
|
}
|
|
9111
9114
|
function elementId(element) {
|
|
9112
9115
|
return element.key ?? element.id;
|
|
@@ -9155,9 +9158,9 @@ function propertyItems(rowId, clip, keyframes) {
|
|
|
9155
9158
|
const unique = /* @__PURE__ */ new Map();
|
|
9156
9159
|
for (const keyframe of keyframes) {
|
|
9157
9160
|
const target = keyframeTarget2(keyframe);
|
|
9158
|
-
const
|
|
9159
|
-
if (!unique.has(
|
|
9160
|
-
unique.set(
|
|
9161
|
+
const key = timelineKeyframeSelectionKey(id, target);
|
|
9162
|
+
if (!unique.has(key)) {
|
|
9163
|
+
unique.set(key, {
|
|
9161
9164
|
target,
|
|
9162
9165
|
time: clip.start + keyframe.percentage / 100 * clip.duration
|
|
9163
9166
|
});
|
|
@@ -9293,14 +9296,14 @@ function buildTimelineLogicalRows({
|
|
|
9293
9296
|
if (!groupExpanded) return;
|
|
9294
9297
|
for (const track2 of group.memberTracks) emitTrack(track2, 2, groupRowId);
|
|
9295
9298
|
}
|
|
9296
|
-
for (const
|
|
9297
|
-
const group = groupByAnchor.get(
|
|
9299
|
+
for (const key of displayTrackOrder2) {
|
|
9300
|
+
const group = groupByAnchor.get(key);
|
|
9298
9301
|
if (group) {
|
|
9299
9302
|
emitGroup(group);
|
|
9300
9303
|
continue;
|
|
9301
9304
|
}
|
|
9302
|
-
if (trackGroupOf.has(
|
|
9303
|
-
emitTrack(
|
|
9305
|
+
if (trackGroupOf.has(key)) continue;
|
|
9306
|
+
emitTrack(key, 1, null);
|
|
9304
9307
|
}
|
|
9305
9308
|
return rows;
|
|
9306
9309
|
}
|
|
@@ -9318,29 +9321,29 @@ function nearestTarget(row, time) {
|
|
|
9318
9321
|
(left, right) => Math.abs(left.time - time) - Math.abs(right.time - time) || left.time - right.time || left.id.localeCompare(right.id)
|
|
9319
9322
|
)[0] ?? row;
|
|
9320
9323
|
}
|
|
9321
|
-
function resolveTimelineNavigationTarget(rows, currentId,
|
|
9324
|
+
function resolveTimelineNavigationTarget(rows, currentId, key, options = {}) {
|
|
9322
9325
|
const current2 = locateTimelineLogicalTarget(rows, currentId);
|
|
9323
9326
|
if (!current2) return null;
|
|
9324
9327
|
const { row, rowIndex, itemIndex, target } = current2;
|
|
9325
|
-
if (
|
|
9326
|
-
const boundaryRow = options.timelineBoundary ?
|
|
9328
|
+
if (key === "Home" || key === "End") {
|
|
9329
|
+
const boundaryRow = options.timelineBoundary ? key === "Home" ? rows[0] : rows.at(-1) : row;
|
|
9327
9330
|
if (!boundaryRow) return target;
|
|
9328
9331
|
if (options.timelineBoundary) return boundaryRow;
|
|
9329
|
-
return
|
|
9332
|
+
return key === "Home" ? boundaryRow : boundaryRow.items.at(-1) ?? boundaryRow;
|
|
9330
9333
|
}
|
|
9331
|
-
if (
|
|
9334
|
+
if (key === "ArrowLeft") {
|
|
9332
9335
|
if (itemIndex < 0) {
|
|
9333
9336
|
if (!row.parentId) return row;
|
|
9334
9337
|
return locateTimelineLogicalTarget(rows, row.parentId)?.target ?? row;
|
|
9335
9338
|
}
|
|
9336
9339
|
return itemIndex === 0 ? row : row.items[itemIndex - 1];
|
|
9337
9340
|
}
|
|
9338
|
-
if (
|
|
9341
|
+
if (key === "ArrowRight") {
|
|
9339
9342
|
if (itemIndex < 0) return row.items[0] ?? row;
|
|
9340
9343
|
return row.items[itemIndex + 1] ?? target;
|
|
9341
9344
|
}
|
|
9342
|
-
const direction =
|
|
9343
|
-
const pageKey =
|
|
9345
|
+
const direction = key === "ArrowUp" || key === "PageUp" ? -1 : 1;
|
|
9346
|
+
const pageKey = key === "PageUp" || key === "PageDown";
|
|
9344
9347
|
const pageSize = options.pageSize;
|
|
9345
9348
|
if (pageKey && (pageSize === void 0 || !Number.isFinite(pageSize) || pageSize < 1)) {
|
|
9346
9349
|
return target;
|
|
@@ -9771,15 +9774,15 @@ function beginTimelineOptimisticGesture(updateElement, keys, scope = "timing") {
|
|
|
9771
9774
|
scopes.set(scope, revisions);
|
|
9772
9775
|
}
|
|
9773
9776
|
const gesture = /* @__PURE__ */ new Map();
|
|
9774
|
-
for (const
|
|
9775
|
-
const revision = (revisions.get(
|
|
9776
|
-
revisions.set(
|
|
9777
|
-
gesture.set(
|
|
9777
|
+
for (const key of keys) {
|
|
9778
|
+
const revision = (revisions.get(key) ?? 0) + 1;
|
|
9779
|
+
revisions.set(key, revision);
|
|
9780
|
+
gesture.set(key, revision);
|
|
9778
9781
|
}
|
|
9779
9782
|
return gesture;
|
|
9780
9783
|
}
|
|
9781
|
-
function isLatestTimelineOptimisticGesture(updateElement, gesture,
|
|
9782
|
-
return gesture.has(
|
|
9784
|
+
function isLatestTimelineOptimisticGesture(updateElement, gesture, key, scope = "timing") {
|
|
9785
|
+
return gesture.has(key) && revisionsByUpdater.get(updateElement)?.get(scope)?.get(key) === gesture.get(key);
|
|
9783
9786
|
}
|
|
9784
9787
|
function rollbackLatestTimelineOptimisticGesture(updateElement, gesture, rollbacks) {
|
|
9785
9788
|
batchElementUpdates(() => {
|
|
@@ -9873,9 +9876,9 @@ var StudioFileConflictError = class extends StudioSaveHttpError {
|
|
|
9873
9876
|
this.attemptedContent = input.attemptedContent;
|
|
9874
9877
|
}
|
|
9875
9878
|
};
|
|
9876
|
-
function readNumericProperty(value,
|
|
9879
|
+
function readNumericProperty(value, key) {
|
|
9877
9880
|
const record2 = value;
|
|
9878
|
-
const property = record2[
|
|
9881
|
+
const property = record2[key];
|
|
9879
9882
|
return typeof property === "number" && Number.isFinite(property) ? property : void 0;
|
|
9880
9883
|
}
|
|
9881
9884
|
function createStudioSaveAbortError() {
|
|
@@ -10308,15 +10311,15 @@ function persistMoveEdits(edits, deps, coalesceKey, operation = "timing") {
|
|
|
10308
10311
|
);
|
|
10309
10312
|
const applyEdit = (e, reassert = false) => {
|
|
10310
10313
|
const { timing, detach } = moveStoreUpdates(e);
|
|
10311
|
-
const
|
|
10314
|
+
const key = keyOf6(e.element);
|
|
10312
10315
|
const updates = {};
|
|
10313
|
-
if (!reassert || isLatestTimelineOptimisticGesture(updateElement, revision,
|
|
10316
|
+
if (!reassert || isLatestTimelineOptimisticGesture(updateElement, revision, key)) {
|
|
10314
10317
|
Object.assign(updates, timing);
|
|
10315
10318
|
}
|
|
10316
|
-
if (detach && (!reassert || isLatestTimelineOptimisticGesture(updateElement, membershipRevision,
|
|
10319
|
+
if (detach && (!reassert || isLatestTimelineOptimisticGesture(updateElement, membershipRevision, key, "membership"))) {
|
|
10317
10320
|
updates.audioGroup = void 0;
|
|
10318
10321
|
}
|
|
10319
|
-
if (Object.keys(updates).length) updateElement(
|
|
10322
|
+
if (Object.keys(updates).length) updateElement(key, updates);
|
|
10320
10323
|
};
|
|
10321
10324
|
const applyEdits = (reassert = false) => batchElementUpdates(() => edits.forEach((e) => applyEdit(e, reassert)));
|
|
10322
10325
|
applyEdits();
|
|
@@ -11320,9 +11323,9 @@ function useTimelineClipDrag({
|
|
|
11320
11323
|
};
|
|
11321
11324
|
const pickup = (event, viewport2) => {
|
|
11322
11325
|
const target = timelineKeyboardEventTarget(event.target, viewport2);
|
|
11323
|
-
const
|
|
11324
|
-
if (
|
|
11325
|
-
const element = getTimelineElementIndexes(elementsRef.current).byKey.get(
|
|
11326
|
+
const key = target?.dataset.elId;
|
|
11327
|
+
if (key === void 0 || !onMoveElementRef.current) return;
|
|
11328
|
+
const element = getTimelineElementIndexes(elementsRef.current).byKey.get(key);
|
|
11326
11329
|
if (!element || !getClipCapabilities(element).canMove) return;
|
|
11327
11330
|
event.preventDefault();
|
|
11328
11331
|
event.stopImmediatePropagation();
|
|
@@ -11596,29 +11599,29 @@ function useTimelineDragPreviewState(draggedClip, resizingClip, selectedElementI
|
|
|
11596
11599
|
import { useCallback as useCallback11 } from "react";
|
|
11597
11600
|
|
|
11598
11601
|
// src/player/components/timelineLinkSelection.ts
|
|
11599
|
-
function selectClipWithLinks(
|
|
11602
|
+
function selectClipWithLinks(key, altKey, setSelectedElementId) {
|
|
11600
11603
|
const state = usePlayerStore.getState();
|
|
11601
11604
|
if (altKey || !isLinkedSelectionOn()) {
|
|
11602
|
-
state.setSelection([
|
|
11605
|
+
state.setSelection([key], key);
|
|
11603
11606
|
return;
|
|
11604
11607
|
}
|
|
11605
|
-
setSelectedElementId(
|
|
11608
|
+
setSelectedElementId(key);
|
|
11606
11609
|
const { selectedElementIds, elements } = usePlayerStore.getState();
|
|
11607
11610
|
const expanded = expandToLinkedMembers(selectedElementIds, elements);
|
|
11608
|
-
if (expanded.size > selectedElementIds.size) state.setSelection(expanded,
|
|
11611
|
+
if (expanded.size > selectedElementIds.size) state.setSelection(expanded, key);
|
|
11609
11612
|
}
|
|
11610
|
-
function toggleClipWithLinks(
|
|
11613
|
+
function toggleClipWithLinks(key, altKey) {
|
|
11611
11614
|
const state = usePlayerStore.getState();
|
|
11612
|
-
const element = state.elements.find((el) => (el.key ?? el.id) ===
|
|
11615
|
+
const element = state.elements.find((el) => (el.key ?? el.id) === key);
|
|
11613
11616
|
const members = element ? linkedMembersOf(element, state.elements, !altKey && isLinkedSelectionOn()) : [];
|
|
11614
|
-
const memberKeys = members.length > 0 ? members.map((el) => el.key ?? el.id) : [
|
|
11617
|
+
const memberKeys = members.length > 0 ? members.map((el) => el.key ?? el.id) : [key];
|
|
11615
11618
|
const next = new Set(state.selectedElementIds);
|
|
11616
|
-
const removing = next.has(
|
|
11619
|
+
const removing = next.has(key);
|
|
11617
11620
|
for (const memberKey of memberKeys) {
|
|
11618
11621
|
if (removing) next.delete(memberKey);
|
|
11619
11622
|
else next.add(memberKey);
|
|
11620
11623
|
}
|
|
11621
|
-
state.setSelection(next, removing ? state.selectedElementId :
|
|
11624
|
+
state.setSelection(next, removing ? state.selectedElementId : key);
|
|
11622
11625
|
const primary = usePlayerStore.getState().selectedElementId;
|
|
11623
11626
|
return state.elements.find((el) => (el.key ?? el.id) === primary) ?? null;
|
|
11624
11627
|
}
|
|
@@ -12810,9 +12813,9 @@ var SAVES_AN_EDIT = {
|
|
|
12810
12813
|
};
|
|
12811
12814
|
function trackEditCommits(actions) {
|
|
12812
12815
|
const tracked = { ...actions };
|
|
12813
|
-
for (const
|
|
12814
|
-
if (!SAVES_AN_EDIT[
|
|
12815
|
-
tracked[
|
|
12816
|
+
for (const key of Object.keys(SAVES_AN_EDIT)) {
|
|
12817
|
+
if (!SAVES_AN_EDIT[key]) continue;
|
|
12818
|
+
tracked[key] = trackedStudioEdit(actions[key], {
|
|
12816
12819
|
afterOlderSaves: true
|
|
12817
12820
|
});
|
|
12818
12821
|
}
|
|
@@ -13624,13 +13627,13 @@ function useTimelineGeometry({
|
|
|
13624
13627
|
// src/player/components/useAutoExpandKeyframedClips.ts
|
|
13625
13628
|
import { useEffect as useEffect18, useRef as useRef20 } from "react";
|
|
13626
13629
|
function freshLaneClips(gsapAnimations, clips) {
|
|
13627
|
-
for (const
|
|
13628
|
-
if (!gsapAnimations.has(
|
|
13630
|
+
for (const key of clips) {
|
|
13631
|
+
if (!gsapAnimations.has(key)) clips.delete(key);
|
|
13629
13632
|
}
|
|
13630
13633
|
const fresh = [];
|
|
13631
|
-
for (const [
|
|
13632
|
-
if (clips.has(
|
|
13633
|
-
if (animations.some(animationContributesLane)) fresh.push(
|
|
13634
|
+
for (const [key, animations] of gsapAnimations) {
|
|
13635
|
+
if (clips.has(key)) continue;
|
|
13636
|
+
if (animations.some(animationContributesLane)) fresh.push(key);
|
|
13634
13637
|
}
|
|
13635
13638
|
return fresh;
|
|
13636
13639
|
}
|
|
@@ -13648,7 +13651,7 @@ function useAutoExpandKeyframedClips(gsapAnimations) {
|
|
|
13648
13651
|
}
|
|
13649
13652
|
const fresh = freshLaneClips(gsapAnimations, seen.current.clips);
|
|
13650
13653
|
if (fresh.length === 0) return;
|
|
13651
|
-
for (const
|
|
13654
|
+
for (const key of fresh) seen.current.clips.add(key);
|
|
13652
13655
|
expandClips(fresh);
|
|
13653
13656
|
}, [gsapAnimations, expandClips, projectId]);
|
|
13654
13657
|
}
|
|
@@ -13885,7 +13888,7 @@ function TimelineEditProvider({
|
|
|
13885
13888
|
// Each callback is a stable reference from the parent — memoize the bag
|
|
13886
13889
|
// so consumers don't re-render when unrelated parent state changes.
|
|
13887
13890
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13888
|
-
EDIT_CALLBACK_KEYS.map((
|
|
13891
|
+
EDIT_CALLBACK_KEYS.map((key) => value[key])
|
|
13889
13892
|
);
|
|
13890
13893
|
return /* @__PURE__ */ jsx23(TimelineEditContext.Provider, { value: memoized, children });
|
|
13891
13894
|
}
|
|
@@ -14241,7 +14244,7 @@ function useTimelineActiveClips({
|
|
|
14241
14244
|
import { useCallback as useCallback19 } from "react";
|
|
14242
14245
|
function useTimelineLaneMoveRefresh() {
|
|
14243
14246
|
const setRefreshKey = useStudioPlaybackContextOptional()?.setRefreshKey;
|
|
14244
|
-
return useCallback19(() => setRefreshKey?.((
|
|
14247
|
+
return useCallback19(() => setRefreshKey?.((key) => key + 1), [setRefreshKey]);
|
|
14245
14248
|
}
|
|
14246
14249
|
|
|
14247
14250
|
// src/player/components/useTimelineFocusCoordinator.ts
|
|
@@ -14512,7 +14515,7 @@ function sameData(a, b) {
|
|
|
14512
14515
|
if ("nodeType" in a || "nodeType" in b || Array.isArray(a) !== Array.isArray(b)) return false;
|
|
14513
14516
|
const keys = Object.keys(a);
|
|
14514
14517
|
if (keys.length !== Object.keys(b).length) return false;
|
|
14515
|
-
return keys.every((
|
|
14518
|
+
return keys.every((key) => sameData(a[key], b[key]));
|
|
14516
14519
|
}
|
|
14517
14520
|
|
|
14518
14521
|
// src/player/components/timelineFocusIdentity.ts
|
|
@@ -14558,7 +14561,7 @@ function useTimelineVirtualRows({
|
|
|
14558
14561
|
() => [
|
|
14559
14562
|
...new Set(
|
|
14560
14563
|
[...pinnedRowKeys, ...focusedRowKey === void 0 ? [] : [focusedRowKey]].map(
|
|
14561
|
-
(
|
|
14564
|
+
(key) => rowGeometry.getRowIndex(key)
|
|
14562
14565
|
)
|
|
14563
14566
|
)
|
|
14564
14567
|
],
|
|
@@ -15355,7 +15358,7 @@ import { useCallback as useCallback24, useRef as useRef28, useSyncExternalStore
|
|
|
15355
15358
|
function useSettledScrollLeft(scrollRef) {
|
|
15356
15359
|
const scrollingRef = useRef28(false);
|
|
15357
15360
|
const settledRef = useRef28(0);
|
|
15358
|
-
const
|
|
15361
|
+
const subscribe2 = useCallback24(
|
|
15359
15362
|
(onChange) => {
|
|
15360
15363
|
const el = scrollRef.current;
|
|
15361
15364
|
settledRef.current = el?.scrollLeft ?? 0;
|
|
@@ -15383,7 +15386,7 @@ function useSettledScrollLeft(scrollRef) {
|
|
|
15383
15386
|
[scrollRef]
|
|
15384
15387
|
);
|
|
15385
15388
|
return useSyncExternalStore5(
|
|
15386
|
-
|
|
15389
|
+
subscribe2,
|
|
15387
15390
|
() => scrollingRef.current ? null : settledRef.current,
|
|
15388
15391
|
() => null
|
|
15389
15392
|
);
|
|
@@ -15789,8 +15792,8 @@ var FADE_KEYS = {
|
|
|
15789
15792
|
End: (_current, _step, limit) => limit,
|
|
15790
15793
|
Enter: (current2) => current2 === 0 ? DEFAULT_FADE_SECONDS : null
|
|
15791
15794
|
};
|
|
15792
|
-
function keyedFadeSeconds(
|
|
15793
|
-
return FADE_KEYS[
|
|
15795
|
+
function keyedFadeSeconds(key, shift, current2, limit) {
|
|
15796
|
+
return FADE_KEYS[key]?.(current2, shift ? 1 : 0.1, limit) ?? null;
|
|
15794
15797
|
}
|
|
15795
15798
|
function TimelineClipFades({
|
|
15796
15799
|
el,
|
|
@@ -16190,7 +16193,7 @@ function useThumbnailLease(request2, scheduler = thumbnailScheduler) {
|
|
|
16190
16193
|
const leaseRef = useRef30(null);
|
|
16191
16194
|
const identity = request2 ? createThumbnailRequestIdentity(request2) : null;
|
|
16192
16195
|
const priority = request2?.priority;
|
|
16193
|
-
const
|
|
16196
|
+
const subscribe2 = useCallback25(
|
|
16194
16197
|
(listener2) => {
|
|
16195
16198
|
const current2 = requestRef.current;
|
|
16196
16199
|
if (!current2 || identity === null) return () => {
|
|
@@ -16211,7 +16214,7 @@ function useThumbnailLease(request2, scheduler = thumbnailScheduler) {
|
|
|
16211
16214
|
useLayoutEffect8(() => {
|
|
16212
16215
|
if (priority) leaseRef.current?.updatePriority(priority);
|
|
16213
16216
|
}, [priority]);
|
|
16214
|
-
return useSyncExternalStore6(
|
|
16217
|
+
return useSyncExternalStore6(subscribe2, getSnapshot, () => IDLE);
|
|
16215
16218
|
}
|
|
16216
16219
|
|
|
16217
16220
|
// src/hooks/useThumbnailStripSize.ts
|
|
@@ -16235,7 +16238,7 @@ var merge = (prev, patch) => {
|
|
|
16235
16238
|
const width = next.width > 0 ? Math.ceil(next.width) : Infinity;
|
|
16236
16239
|
next.inViewStart = isShort(width) ? 0 : Math.min(next.inViewStart, width);
|
|
16237
16240
|
next.inViewEnd = isShort(width) ? width : Math.min(next.inViewEnd, width);
|
|
16238
|
-
return Object.keys(next).every((
|
|
16241
|
+
return Object.keys(next).every((key) => next[key] === prev[key]) ? prev : next;
|
|
16239
16242
|
};
|
|
16240
16243
|
var NEAR_PX = IN_VIEW_CHUNK_PX / 2;
|
|
16241
16244
|
var strips = /* @__PURE__ */ new Map();
|
|
@@ -17096,9 +17099,9 @@ function patchInlineStyleInTag(tag, prop, value) {
|
|
|
17096
17099
|
for (const part of splitInlineStyleDeclarations(existingStyle)) {
|
|
17097
17100
|
const colon = part.indexOf(":");
|
|
17098
17101
|
if (colon < 0) continue;
|
|
17099
|
-
const
|
|
17102
|
+
const key = part.slice(0, colon).trim();
|
|
17100
17103
|
const val = part.slice(colon + 1).trim();
|
|
17101
|
-
if (
|
|
17104
|
+
if (key) props.set(key, val);
|
|
17102
17105
|
}
|
|
17103
17106
|
if (value === null) {
|
|
17104
17107
|
props.delete(prop);
|
|
@@ -17418,7 +17421,6 @@ async function writeProjectFilesWithHistoryInQueue({
|
|
|
17418
17421
|
}
|
|
17419
17422
|
|
|
17420
17423
|
// src/utils/gsapSoftReload.ts
|
|
17421
|
-
import { COLOR_GRADING_SOURCE_HIDDEN_ATTR as COLOR_GRADING_SOURCE_HIDDEN_ATTR2 } from "@hyperframes/core/color-grading";
|
|
17422
17424
|
import { parseGsapScript as parseGsapScript2 } from "@hyperframes/parsers/gsap-parser";
|
|
17423
17425
|
import { GSAP_BASE_URL_META, motionPathPluginUrl } from "@hyperframes/core/gsap-cdn";
|
|
17424
17426
|
|
|
@@ -17560,9 +17562,9 @@ function elementTargets(tween) {
|
|
|
17560
17562
|
var NESTED_VARS = /* @__PURE__ */ new Set(["css", "startAt", "keyframes"]);
|
|
17561
17563
|
function tweenedProps(vars) {
|
|
17562
17564
|
if (!vars || typeof vars !== "object") return [];
|
|
17563
|
-
return Object.entries(vars).flatMap(([
|
|
17564
|
-
|
|
17565
|
-
...NESTED_VARS.has(
|
|
17565
|
+
return Object.entries(vars).flatMap(([key, value]) => [
|
|
17566
|
+
key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`),
|
|
17567
|
+
...NESTED_VARS.has(key) || /^\d|%$/.test(key) ? tweenedProps(value) : []
|
|
17566
17568
|
]);
|
|
17567
17569
|
}
|
|
17568
17570
|
function ownTweens(tl, nested) {
|
|
@@ -17586,11 +17588,11 @@ function collectResetTargets(win, doc, targetKeys, outgoingScripts = []) {
|
|
|
17586
17588
|
const targets = /* @__PURE__ */ new Map();
|
|
17587
17589
|
const timelines = win.__timelines ?? {};
|
|
17588
17590
|
const others = new Set(
|
|
17589
|
-
Object.entries(timelines).flatMap(([
|
|
17591
|
+
Object.entries(timelines).flatMap(([key, tl]) => targetKeys.includes(key) ? [] : [tl])
|
|
17590
17592
|
);
|
|
17591
|
-
for (const
|
|
17593
|
+
for (const key of targetKeys) {
|
|
17592
17594
|
try {
|
|
17593
|
-
for (const tween of ownTweens(timelines[
|
|
17595
|
+
for (const tween of ownTweens(timelines[key] ?? {}, others)) addTweenTargets(tween, targets);
|
|
17594
17596
|
} catch {
|
|
17595
17597
|
}
|
|
17596
17598
|
}
|
|
@@ -17611,11 +17613,11 @@ function tweenTargetsIn(timelines) {
|
|
|
17611
17613
|
}
|
|
17612
17614
|
return els;
|
|
17613
17615
|
}
|
|
17614
|
-
function compositionRoot(doc,
|
|
17615
|
-
return doc.querySelectorAll(`[data-composition-id="${CSS.escape(
|
|
17616
|
+
function compositionRoot(doc, key) {
|
|
17617
|
+
return doc.querySelectorAll(`[data-composition-id="${CSS.escape(key)}"]`)[0];
|
|
17616
17618
|
}
|
|
17617
17619
|
function compositionFile(doc, targetKeys) {
|
|
17618
|
-
const root = targetKeys.map((
|
|
17620
|
+
const root = targetKeys.map((key) => compositionRoot(doc, key)).find(Boolean);
|
|
17619
17621
|
return root?.closest("[data-composition-file]")?.getAttribute("data-composition-file") ?? null;
|
|
17620
17622
|
}
|
|
17621
17623
|
function sweepHeldElements(doc, targetKeys, others, targets) {
|
|
@@ -17758,7 +17760,7 @@ function verifyTimelinesPopulated(win, targetKeys) {
|
|
|
17758
17760
|
const timelines = win.__timelines;
|
|
17759
17761
|
if (!timelines) return false;
|
|
17760
17762
|
if (targetKeys.length > 0) {
|
|
17761
|
-
return targetKeys.every((
|
|
17763
|
+
return targetKeys.every((key) => timelines[key] != null);
|
|
17762
17764
|
}
|
|
17763
17765
|
return Object.keys(timelines).filter((k) => k !== "__proxied").length > 0;
|
|
17764
17766
|
}
|
|
@@ -17823,13 +17825,13 @@ function repaintDroppedTweenStyle(win, doc, authored, targetKeys, restoredScript
|
|
|
17823
17825
|
}
|
|
17824
17826
|
}
|
|
17825
17827
|
function timelineKeys(scriptText) {
|
|
17826
|
-
return [...scriptText.matchAll(/__timelines\s*\[\s*["'`]([^"'`]+)["'`]\s*\]/g)].map((m) => m[1]).filter((
|
|
17828
|
+
return [...scriptText.matchAll(/__timelines\s*\[\s*["'`]([^"'`]+)["'`]\s*\]/g)].map((m) => m[1]).filter((key) => key !== "__proxied");
|
|
17827
17829
|
}
|
|
17828
17830
|
function scriptsRegistering(scripts, keys) {
|
|
17829
17831
|
return scripts.filter((script) => {
|
|
17830
17832
|
const text3 = script.textContent || "";
|
|
17831
17833
|
return keys.some(
|
|
17832
|
-
(
|
|
17834
|
+
(key) => text3.includes(`__timelines["${key}"]`) || text3.includes(`__timelines['${key}']`)
|
|
17833
17835
|
);
|
|
17834
17836
|
});
|
|
17835
17837
|
}
|
|
@@ -17866,15 +17868,15 @@ function applySoftReload(iframe, scriptText, options = {}) {
|
|
|
17866
17868
|
staleScripts.map((script) => script.textContent ?? "")
|
|
17867
17869
|
);
|
|
17868
17870
|
if (timelines) {
|
|
17869
|
-
for (const
|
|
17870
|
-
const tl = timelines[
|
|
17871
|
+
for (const key of targetKeys) {
|
|
17872
|
+
const tl = timelines[key];
|
|
17871
17873
|
if (!tl) continue;
|
|
17872
17874
|
try {
|
|
17873
17875
|
tl.clear?.();
|
|
17874
17876
|
tl.kill?.();
|
|
17875
17877
|
} catch {
|
|
17876
17878
|
}
|
|
17877
|
-
delete timelines[
|
|
17879
|
+
delete timelines[key];
|
|
17878
17880
|
}
|
|
17879
17881
|
}
|
|
17880
17882
|
const allTargets = [...targets.keys()];
|
|
@@ -17888,11 +17890,7 @@ function applySoftReload(iframe, scriptText, options = {}) {
|
|
|
17888
17890
|
s.cssText = css2;
|
|
17889
17891
|
restoreAuthoredStyle(s, findAuthoredStyle(el), targets.get(el));
|
|
17890
17892
|
const authored = readAuthoredOpacity(el);
|
|
17891
|
-
if (authored !== null)
|
|
17892
|
-
applyAuthoredInlineOpacity(s, authored);
|
|
17893
|
-
} else if (el.hasAttribute(COLOR_GRADING_SOURCE_HIDDEN_ATTR2) && s.getPropertyValue("opacity") === "0" && s.getPropertyPriority("opacity") === "important") {
|
|
17894
|
-
s.removeProperty("opacity");
|
|
17895
|
-
}
|
|
17893
|
+
if (authored !== null) applyAuthoredInlineOpacity(s, authored);
|
|
17896
17894
|
}
|
|
17897
17895
|
}
|
|
17898
17896
|
forgetLiveSets(targets);
|
|
@@ -18133,9 +18131,9 @@ function planLiveRetime(before, after) {
|
|
|
18133
18131
|
}
|
|
18134
18132
|
function planLiveRetimeFromPreview(iframe, after) {
|
|
18135
18133
|
const doc = iframe?.contentDocument;
|
|
18136
|
-
const [
|
|
18137
|
-
if (!doc || !
|
|
18138
|
-
const [script, ...extra] = scriptsRegistering(findGsapScriptElements(doc), [
|
|
18134
|
+
const [key] = timelineKeys(after);
|
|
18135
|
+
if (!doc || !key) return RERUN;
|
|
18136
|
+
const [script, ...extra] = scriptsRegistering(findGsapScriptElements(doc), [key]);
|
|
18139
18137
|
if (!script || extra.length > 0) return RERUN;
|
|
18140
18138
|
const plan = planLiveRetime(script.textContent ?? "", after);
|
|
18141
18139
|
return plan.kind === "retime" ? { ...plan, script } : RERUN;
|
|
@@ -18565,8 +18563,8 @@ function deleteSelectedKeyframes(session) {
|
|
|
18565
18563
|
const fallbackAnimation = keyframedAnimations.length === 1 ? keyframedAnimations[0] : void 0;
|
|
18566
18564
|
const animationsById = new Map(keyframedAnimations.map((animation2) => [animation2.id, animation2]));
|
|
18567
18565
|
const removals = /* @__PURE__ */ new Map();
|
|
18568
|
-
for (const
|
|
18569
|
-
const target = timelineKeyframeTargetFromSelectionKey(selectedElementId,
|
|
18566
|
+
for (const key of selectedKeyframes) {
|
|
18567
|
+
const target = timelineKeyframeTargetFromSelectionKey(selectedElementId, key);
|
|
18570
18568
|
if (!target) continue;
|
|
18571
18569
|
const animation2 = target.animationId ? animationsById.get(target.animationId) : fallbackAnimation;
|
|
18572
18570
|
if (!animation2) continue;
|
|
@@ -19651,8 +19649,8 @@ import { jsx as jsx37 } from "react/jsx-runtime";
|
|
|
19651
19649
|
var sameCapabilities = (a, b) => a.canMove === b.canMove && a.canTrimStart === b.canTrimStart && a.canTrimEnd === b.canTrimEnd && a.readOnly === b.readOnly;
|
|
19652
19650
|
var zoomKey = (p) => clipZoomKey(p.previewElement, p.pps, p.isSelected || p.isHovered);
|
|
19653
19651
|
function sameClip(prev, next) {
|
|
19654
|
-
for (const
|
|
19655
|
-
if (
|
|
19652
|
+
for (const key of Object.keys(next)) {
|
|
19653
|
+
if (key === "pps" || key === "capabilities" || prev[key] === next[key]) continue;
|
|
19656
19654
|
return false;
|
|
19657
19655
|
}
|
|
19658
19656
|
return sameCapabilities(prev.capabilities, next.capabilities) && zoomKey(prev) === zoomKey(next);
|
|
@@ -21430,10 +21428,10 @@ function TimelineAutomationLaneSlot({
|
|
|
21430
21428
|
const rowsByClip = /* @__PURE__ */ new Map();
|
|
21431
21429
|
groupAutomationLanes(clips).forEach((group, rowIndex) => {
|
|
21432
21430
|
for (const entry3 of group.entries) {
|
|
21433
|
-
const
|
|
21434
|
-
const rows = rowsByClip.get(
|
|
21431
|
+
const key = getTimelineElementIdentity(entry3.element);
|
|
21432
|
+
const rows = rowsByClip.get(key);
|
|
21435
21433
|
if (rows) rows.push({ lane: entry3.lane, rowIndex });
|
|
21436
|
-
else rowsByClip.set(
|
|
21434
|
+
else rowsByClip.set(key, [{ lane: entry3.lane, rowIndex }]);
|
|
21437
21435
|
}
|
|
21438
21436
|
});
|
|
21439
21437
|
const top = topOffset ?? getTimelineLaneTop(laneCount);
|
|
@@ -21767,7 +21765,7 @@ function resolveTimelineIdForSelection(selection, elements, activeCompPath, byCl
|
|
|
21767
21765
|
);
|
|
21768
21766
|
}
|
|
21769
21767
|
function timelineKeysForSelections(selections, elements, activeCompPath) {
|
|
21770
|
-
return selections.map((selection) => resolveTimelineIdForSelection(selection, elements, activeCompPath)).filter((
|
|
21768
|
+
return selections.map((selection) => resolveTimelineIdForSelection(selection, elements, activeCompPath)).filter((key) => key !== null);
|
|
21771
21769
|
}
|
|
21772
21770
|
function resolveTimelineSelectionSeekTime(currentTime, element) {
|
|
21773
21771
|
if (!element) return null;
|
|
@@ -21846,9 +21844,9 @@ import { isTypingTarget as isTypingTarget4 } from "@hyperframes/core/typing-targ
|
|
|
21846
21844
|
function elementKeyOf(element) {
|
|
21847
21845
|
return element.key ?? element.id;
|
|
21848
21846
|
}
|
|
21849
|
-
function findElement(elements,
|
|
21850
|
-
if (!
|
|
21851
|
-
return elements.find((el) => elementKeyOf(el) ===
|
|
21847
|
+
function findElement(elements, key) {
|
|
21848
|
+
if (!key) return null;
|
|
21849
|
+
return elements.find((el) => elementKeyOf(el) === key) ?? null;
|
|
21852
21850
|
}
|
|
21853
21851
|
function resolveSelectionContext(state, lanes, sel) {
|
|
21854
21852
|
const element = findElement(state.elements, sel.elementKey);
|
|
@@ -24066,14 +24064,14 @@ function useTimelineClipDisclosure() {
|
|
|
24066
24064
|
const toggleClipExpanded = usePlayerStore((s) => s.toggleClipExpanded);
|
|
24067
24065
|
return {
|
|
24068
24066
|
toggleRowExpanded: (keys) => {
|
|
24069
|
-
const willExpand = !keys.some((
|
|
24067
|
+
const willExpand = !keys.some((key) => expandedClipIds.has(key));
|
|
24070
24068
|
trackStudioKeyframeLaneExpand({ expanded: willExpand });
|
|
24071
24069
|
if (willExpand) expandClips(keys);
|
|
24072
|
-
else for (const
|
|
24070
|
+
else for (const key of keys) setClipExpanded(key, false);
|
|
24073
24071
|
},
|
|
24074
|
-
toggleClipExpanded: (
|
|
24075
|
-
trackStudioKeyframeLaneExpand({ expanded: !expandedClipIds.has(
|
|
24076
|
-
toggleClipExpanded(
|
|
24072
|
+
toggleClipExpanded: (key) => {
|
|
24073
|
+
trackStudioKeyframeLaneExpand({ expanded: !expandedClipIds.has(key) });
|
|
24074
|
+
toggleClipExpanded(key);
|
|
24077
24075
|
}
|
|
24078
24076
|
};
|
|
24079
24077
|
}
|
|
@@ -24669,8 +24667,8 @@ function TimelineLanes({
|
|
|
24669
24667
|
{
|
|
24670
24668
|
elements: automationElements,
|
|
24671
24669
|
isSelected: (element) => {
|
|
24672
|
-
const
|
|
24673
|
-
return selectedElementId ===
|
|
24670
|
+
const key = getTimelineElementIdentity(element);
|
|
24671
|
+
return selectedElementId === key || selectedElementIds.has(key);
|
|
24674
24672
|
},
|
|
24675
24673
|
lanes: automationLanes,
|
|
24676
24674
|
pps,
|
|
@@ -25275,7 +25273,7 @@ function normalizeToastText(plan) {
|
|
|
25275
25273
|
function isNormalizePlan(value) {
|
|
25276
25274
|
if (typeof value !== "object" || value === null) return false;
|
|
25277
25275
|
return ["targetLufs", "projectedLufs", "volume", "changeDb"].every(
|
|
25278
|
-
(
|
|
25276
|
+
(key) => typeof Reflect.get(value, key) === "number"
|
|
25279
25277
|
);
|
|
25280
25278
|
}
|
|
25281
25279
|
async function requestNormalizePlan(projectId, el, fetchImpl = studioApiFetch) {
|
|
@@ -25469,8 +25467,8 @@ function AudioGainDialog({
|
|
|
25469
25467
|
}
|
|
25470
25468
|
const byKey = new Map(elements.map((el) => [keyOf10(el), el]));
|
|
25471
25469
|
const plan = planAudioGain(clips, { mode, db: values[mode] });
|
|
25472
|
-
const edits = plan.flatMap(({ key
|
|
25473
|
-
const element = byKey.get(
|
|
25470
|
+
const edits = plan.flatMap(({ key, gain }) => {
|
|
25471
|
+
const element = byKey.get(key);
|
|
25474
25472
|
return element ? [{ element, gain }] : [];
|
|
25475
25473
|
});
|
|
25476
25474
|
await writeClipGains(edits, edit, AUDIO_GAIN_LABEL);
|
|
@@ -25645,17 +25643,17 @@ import { jsx as jsx65, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
|
25645
25643
|
function draftKey(start, end) {
|
|
25646
25644
|
return `hf-edit-draft:${start.toFixed(2)}:${end.toFixed(2)}`;
|
|
25647
25645
|
}
|
|
25648
|
-
function readDraft(
|
|
25646
|
+
function readDraft(key) {
|
|
25649
25647
|
try {
|
|
25650
|
-
return sessionStorage.getItem(
|
|
25648
|
+
return sessionStorage.getItem(key) ?? "";
|
|
25651
25649
|
} catch {
|
|
25652
25650
|
return "";
|
|
25653
25651
|
}
|
|
25654
25652
|
}
|
|
25655
|
-
function writeDraft(
|
|
25653
|
+
function writeDraft(key, value) {
|
|
25656
25654
|
try {
|
|
25657
|
-
if (value) sessionStorage.setItem(
|
|
25658
|
-
else sessionStorage.removeItem(
|
|
25655
|
+
if (value) sessionStorage.setItem(key, value);
|
|
25656
|
+
else sessionStorage.removeItem(key);
|
|
25659
25657
|
} catch {
|
|
25660
25658
|
}
|
|
25661
25659
|
}
|
|
@@ -26571,7 +26569,7 @@ function formatBoundingBox(bounds) {
|
|
|
26571
26569
|
return `x=${Math.round(bounds.x)}, y=${Math.round(bounds.y)}, width=${Math.round(bounds.width)}, height=${Math.round(bounds.height)}`;
|
|
26572
26570
|
}
|
|
26573
26571
|
function formatStyleBlock(styles) {
|
|
26574
|
-
return Object.entries(styles).filter(([, value]) => value && value !== "initial").map(([
|
|
26572
|
+
return Object.entries(styles).filter(([, value]) => value && value !== "initial").map(([key, value]) => `${key}: ${value}`).join("\n");
|
|
26575
26573
|
}
|
|
26576
26574
|
function formatTextFields(fields) {
|
|
26577
26575
|
return fields.map(
|
|
@@ -28060,38 +28058,38 @@ function use(frame3) {
|
|
|
28060
28058
|
if (frame3.users++ === 0 && released.delete(frame3)) releasedBytes -= frame3.bytes;
|
|
28061
28059
|
return frame3;
|
|
28062
28060
|
}
|
|
28063
|
-
function takeSharedFrame(
|
|
28064
|
-
const frame3 = sharedFrames.get(
|
|
28061
|
+
function takeSharedFrame(key, accepts2) {
|
|
28062
|
+
const frame3 = sharedFrames.get(key)?.find((shared2) => accepts2(shared2.decodedAt));
|
|
28065
28063
|
return frame3 && use(frame3);
|
|
28066
28064
|
}
|
|
28067
|
-
function shareFrame(
|
|
28068
|
-
const frames = sharedFrames.get(
|
|
28065
|
+
function shareFrame(key, decodedAt, url, bytes) {
|
|
28066
|
+
const frames = sharedFrames.get(key) ?? [];
|
|
28069
28067
|
const existing = frames.find((shared2) => shared2.decodedAt === decodedAt);
|
|
28070
28068
|
if (existing) {
|
|
28071
28069
|
URL.revokeObjectURL(url);
|
|
28072
28070
|
return use(existing);
|
|
28073
28071
|
}
|
|
28074
28072
|
const frame3 = { url, decodedAt, bytes, users: 1 };
|
|
28075
|
-
sharedFrames.set(
|
|
28073
|
+
sharedFrames.set(key, [...frames, frame3]);
|
|
28076
28074
|
return frame3;
|
|
28077
28075
|
}
|
|
28078
|
-
function evict(frame3,
|
|
28076
|
+
function evict(frame3, key) {
|
|
28079
28077
|
released.delete(frame3);
|
|
28080
28078
|
releasedBytes -= frame3.bytes;
|
|
28081
|
-
const rest = sharedFrames.get(
|
|
28082
|
-
if (rest.length > 0) sharedFrames.set(
|
|
28083
|
-
else sharedFrames.delete(
|
|
28079
|
+
const rest = sharedFrames.get(key)?.filter((shared2) => shared2 !== frame3) ?? [];
|
|
28080
|
+
if (rest.length > 0) sharedFrames.set(key, rest);
|
|
28081
|
+
else sharedFrames.delete(key);
|
|
28084
28082
|
URL.revokeObjectURL(frame3.url);
|
|
28085
28083
|
}
|
|
28086
28084
|
function releaseSharedFrames(held, budgetBytes) {
|
|
28087
|
-
for (const { key
|
|
28085
|
+
for (const { key, frame: frame3 } of held.splice(0)) {
|
|
28088
28086
|
if (--frame3.users > 0) continue;
|
|
28089
|
-
released.set(frame3,
|
|
28087
|
+
released.set(frame3, key);
|
|
28090
28088
|
releasedBytes += frame3.bytes;
|
|
28091
28089
|
}
|
|
28092
|
-
for (const [frame3,
|
|
28090
|
+
for (const [frame3, key] of released) {
|
|
28093
28091
|
if (releasedBytes <= budgetBytes) break;
|
|
28094
|
-
evict(frame3,
|
|
28092
|
+
evict(frame3, key);
|
|
28095
28093
|
}
|
|
28096
28094
|
}
|
|
28097
28095
|
|
|
@@ -28140,7 +28138,7 @@ function laterOf(own, theirs) {
|
|
|
28140
28138
|
}
|
|
28141
28139
|
function savedEtagsButThisTabsMoves(mine, theirs) {
|
|
28142
28140
|
const etags = { ...mine, ...theirs };
|
|
28143
|
-
for (const
|
|
28141
|
+
for (const key of sourcesThisTabMovedOn) etags[key] = mine[key];
|
|
28144
28142
|
sourcesThisTabMovedOn.clear();
|
|
28145
28143
|
return etags;
|
|
28146
28144
|
}
|
|
@@ -28179,15 +28177,15 @@ var storedVersion = (source) => quietly(async () => {
|
|
|
28179
28177
|
return response.status === 304 ? { source, etag } : void 0;
|
|
28180
28178
|
});
|
|
28181
28179
|
var rememberVersion = (stored) => quietly(async () => {
|
|
28182
|
-
const
|
|
28180
|
+
const key = await digest(stored.source);
|
|
28183
28181
|
const saved2 = loadIndex();
|
|
28184
|
-
if (saved2.etags[
|
|
28185
|
-
saved2.etags[
|
|
28186
|
-
sourcesThisTabMovedOn.add(
|
|
28182
|
+
if (saved2.etags[key] === stored.etag) return;
|
|
28183
|
+
saved2.etags[key] = stored.etag;
|
|
28184
|
+
sourcesThisTabMovedOn.add(key);
|
|
28187
28185
|
saveIndexSoon();
|
|
28188
28186
|
const keep = await cacheNameOf(stored);
|
|
28189
28187
|
for (const name of await caches.keys()) {
|
|
28190
|
-
if (!name.startsWith(`${CACHE_PREFIX}${
|
|
28188
|
+
if (!name.startsWith(`${CACHE_PREFIX}${key}:`) || name === keep) continue;
|
|
28191
28189
|
await caches.delete(name);
|
|
28192
28190
|
delete saved2.caches[name];
|
|
28193
28191
|
dropped.add(name);
|
|
@@ -28343,11 +28341,11 @@ function stripTimes(request2, info, budgets) {
|
|
|
28343
28341
|
function takeDecodedFrames({ timestamps, window: window2 }, keyOf17, resources) {
|
|
28344
28342
|
const missing = [];
|
|
28345
28343
|
timestamps.forEach((time, slot) => {
|
|
28346
|
-
const
|
|
28347
|
-
const frame3 = takeSharedFrame(
|
|
28344
|
+
const key = keyOf17(time);
|
|
28345
|
+
const frame3 = takeSharedFrame(key, (decodedAt) => accepts(window2, time, decodedAt));
|
|
28348
28346
|
if (!frame3) return void missing.push(slot);
|
|
28349
28347
|
resources.urls[slot] = frame3.url;
|
|
28350
|
-
resources.held.push({ key
|
|
28348
|
+
resources.held.push({ key, frame: frame3 });
|
|
28351
28349
|
});
|
|
28352
28350
|
return missing;
|
|
28353
28351
|
}
|
|
@@ -28397,10 +28395,10 @@ async function takeStoredFrames({ timestamps, window: window2 }, slots, keyOf17,
|
|
|
28397
28395
|
const time = timestamps[slot];
|
|
28398
28396
|
const hit = found[i];
|
|
28399
28397
|
if (!hit || !accepts(window2, time, hit.decodedAt)) return true;
|
|
28400
|
-
const
|
|
28401
|
-
const frame3 = shareFrame(
|
|
28398
|
+
const key = keyOf17(time);
|
|
28399
|
+
const frame3 = shareFrame(key, hit.decodedAt, URL.createObjectURL(hit.blob), hit.blob.size);
|
|
28402
28400
|
resources.urls[slot] = frame3.url;
|
|
28403
|
-
resources.held.push({ key
|
|
28401
|
+
resources.held.push({ key, frame: frame3 });
|
|
28404
28402
|
return false;
|
|
28405
28403
|
});
|
|
28406
28404
|
}
|
|
@@ -28492,9 +28490,9 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
|
|
|
28492
28490
|
async function* decodeTimesAtNearbyKeyframes() {
|
|
28493
28491
|
for (const target2 of slots) {
|
|
28494
28492
|
const time = timestamps[target2.slot];
|
|
28495
|
-
const
|
|
28493
|
+
const key = await keys.getKeyPacket(time, { metadataOnly: true });
|
|
28496
28494
|
if (signal.aborted) return;
|
|
28497
|
-
target2.decodedAt =
|
|
28495
|
+
target2.decodedAt = key && accepts(window2, time, key.timestamp) ? key.timestamp : time;
|
|
28498
28496
|
yield target2.decodedAt;
|
|
28499
28497
|
}
|
|
28500
28498
|
}
|
|
@@ -28908,14 +28906,14 @@ var initialState = {
|
|
|
28908
28906
|
};
|
|
28909
28907
|
var lastHistoryKey = null;
|
|
28910
28908
|
var lastHistoryAt = 0;
|
|
28911
|
-
function pushHistory(state,
|
|
28909
|
+
function pushHistory(state, key) {
|
|
28912
28910
|
if (!state.model) return {};
|
|
28913
28911
|
const now2 = Date.now();
|
|
28914
|
-
if (lastHistoryKey ===
|
|
28912
|
+
if (lastHistoryKey === key && now2 - lastHistoryAt < HISTORY_COALESCE_MS) {
|
|
28915
28913
|
lastHistoryAt = now2;
|
|
28916
28914
|
return { future: [] };
|
|
28917
28915
|
}
|
|
28918
|
-
lastHistoryKey =
|
|
28916
|
+
lastHistoryKey = key;
|
|
28919
28917
|
lastHistoryAt = now2;
|
|
28920
28918
|
const past = [...state.past, state.model].slice(-HISTORY_CAP);
|
|
28921
28919
|
return { past, future: [] };
|
|
@@ -29239,6 +29237,22 @@ function ignoresPlaybackKey(e) {
|
|
|
29239
29237
|
selectedCaptionSegmentCount: captionState.selectedSegmentIds.size
|
|
29240
29238
|
});
|
|
29241
29239
|
}
|
|
29240
|
+
function forwardSealedFrameKeys(iframe, keyDown, keyUp) {
|
|
29241
|
+
const client = previewEditingClient(iframe);
|
|
29242
|
+
const watch = (combos) => void client.request("watch-keys", { combos }).catch(() => {
|
|
29243
|
+
});
|
|
29244
|
+
const watchPlayback = () => watch(PLAYBACK_ACTIONS.map(getStudioKey));
|
|
29245
|
+
watchPlayback();
|
|
29246
|
+
const stopRebinds = subscribeStudioKeys(watchPlayback);
|
|
29247
|
+
const stopKeys = client.onKey(
|
|
29248
|
+
(key) => (key.type === "keydown" ? keyDown : keyUp).current(new KeyboardEvent(key.type, key))
|
|
29249
|
+
);
|
|
29250
|
+
return () => {
|
|
29251
|
+
stopRebinds();
|
|
29252
|
+
stopKeys();
|
|
29253
|
+
watch([]);
|
|
29254
|
+
};
|
|
29255
|
+
}
|
|
29242
29256
|
function handleWorkAreaKey(e, action, getAdapter, seek) {
|
|
29243
29257
|
const store = usePlayerStore.getState();
|
|
29244
29258
|
const time = () => getAdapter()?.getTime() ?? store.currentTime;
|
|
@@ -29353,6 +29367,15 @@ function usePlaybackKeyboard({
|
|
|
29353
29367
|
const attachIframeShortcutListeners = useCallback37(() => {
|
|
29354
29368
|
iframeShortcutCleanupRef.current?.();
|
|
29355
29369
|
iframeShortcutCleanupRef.current = null;
|
|
29370
|
+
const iframe = iframeRef.current;
|
|
29371
|
+
if (iframe && previewFrameOpaque(iframe)) {
|
|
29372
|
+
iframeShortcutCleanupRef.current = forwardSealedFrameKeys(
|
|
29373
|
+
iframe,
|
|
29374
|
+
playbackKeyDownRef,
|
|
29375
|
+
playbackKeyUpRef
|
|
29376
|
+
);
|
|
29377
|
+
return;
|
|
29378
|
+
}
|
|
29356
29379
|
let iframeWin = null;
|
|
29357
29380
|
let iframeDoc = null;
|
|
29358
29381
|
try {
|
|
@@ -30339,11 +30362,10 @@ function isPreviewReadinessMessage(e, iframe) {
|
|
|
30339
30362
|
if (data?.type !== "state" && data?.type !== "timeline") return false;
|
|
30340
30363
|
return inspectStudioRuntimeMessage(data).status !== "unsupported";
|
|
30341
30364
|
}
|
|
30342
|
-
function normalizePreviewDom(doc, iframeWin
|
|
30365
|
+
function normalizePreviewDom(doc, iframeWin) {
|
|
30343
30366
|
if (!doc || !iframeWin) return;
|
|
30344
30367
|
normalizePreviewViewport(doc, iframeWin);
|
|
30345
30368
|
autoHealMissingCompositionIds(doc);
|
|
30346
|
-
attachIframeShortcutListeners();
|
|
30347
30369
|
}
|
|
30348
30370
|
function applyRuntimeClipManifest(iframeWin, processTimelineMessage) {
|
|
30349
30371
|
const manifest = iframeWin?.__clipManifest;
|
|
@@ -30354,7 +30376,8 @@ function hydrateTimelineFromPreview(input) {
|
|
|
30354
30376
|
try {
|
|
30355
30377
|
const doc = safeContentDocument(iframe);
|
|
30356
30378
|
const iframeWin = iframe?.contentWindow ?? null;
|
|
30357
|
-
normalizePreviewDom(doc, iframeWin
|
|
30379
|
+
normalizePreviewDom(doc, iframeWin);
|
|
30380
|
+
input.attachIframeShortcutListeners();
|
|
30358
30381
|
applyRuntimeClipManifest(iframeWin, input.processTimelineMessage);
|
|
30359
30382
|
input.enrichMissingCompositions();
|
|
30360
30383
|
input.applyPreviewAudioState();
|
|
@@ -30379,6 +30402,9 @@ function planShadowReload(slots, nextGen, url) {
|
|
|
30379
30402
|
const live = slots.find((slot) => slot.role === "live");
|
|
30380
30403
|
return live ? [live, { gen: nextGen, role: "shadow", url }] : [{ gen: nextGen, role: "live" }];
|
|
30381
30404
|
}
|
|
30405
|
+
function planShadowAlone(nextGen, url) {
|
|
30406
|
+
return [{ gen: nextGen, role: "shadow", url }];
|
|
30407
|
+
}
|
|
30382
30408
|
function planShadowDiscard(slots) {
|
|
30383
30409
|
return slots.filter((slot) => slot.role === "live");
|
|
30384
30410
|
}
|
|
@@ -30673,9 +30699,9 @@ function withTweenIndex(run) {
|
|
|
30673
30699
|
}
|
|
30674
30700
|
function indexTweens(children) {
|
|
30675
30701
|
const index2 = { byElement: /* @__PURE__ */ new Map(), byId: /* @__PURE__ */ new Map() };
|
|
30676
|
-
const add = (map,
|
|
30677
|
-
const list = map.get(
|
|
30678
|
-
if (!list) map.set(
|
|
30702
|
+
const add = (map, key, tween) => {
|
|
30703
|
+
const list = map.get(key);
|
|
30704
|
+
if (!list) map.set(key, [tween]);
|
|
30679
30705
|
else if (list.at(-1) !== tween) list.push(tween);
|
|
30680
30706
|
};
|
|
30681
30707
|
for (const tween of children) {
|
|
@@ -30812,7 +30838,7 @@ function restoreAttributes(layer, attributes) {
|
|
|
30812
30838
|
if (layer.getAttribute(name) !== value) layer.setAttribute(name, value);
|
|
30813
30839
|
}
|
|
30814
30840
|
function restoreCache(live, cache2) {
|
|
30815
|
-
for (const
|
|
30841
|
+
for (const key of Object.keys(live)) if (!(key in cache2)) delete live[key];
|
|
30816
30842
|
Object.assign(live, cache2);
|
|
30817
30843
|
}
|
|
30818
30844
|
function parsedImplicitEndValue(tween) {
|
|
@@ -31203,7 +31229,7 @@ function gsapWritesRotation(el) {
|
|
|
31203
31229
|
function gsapHoldsTranslate(el) {
|
|
31204
31230
|
const cache2 = el._gsap;
|
|
31205
31231
|
return ["x", "y", "xPercent", "yPercent"].some(
|
|
31206
|
-
(
|
|
31232
|
+
(key) => !!Number.parseFloat(String(cache2?.[key]))
|
|
31207
31233
|
);
|
|
31208
31234
|
}
|
|
31209
31235
|
var BOX_CHANNELS = [
|
|
@@ -31771,6 +31797,19 @@ function useShadowReloadRetry(generation, url, begin) {
|
|
|
31771
31797
|
// src/player/hooks/useShadowPreviewReload.ts
|
|
31772
31798
|
var SHADOW_READY_TIMEOUT_MS = 15e3;
|
|
31773
31799
|
var SHADOW_READY_BUDGETS = 3;
|
|
31800
|
+
var STILL_RELEASE_MAX_MS = 3e3;
|
|
31801
|
+
function releaseAfterPaint(iframe, release2) {
|
|
31802
|
+
let done = false;
|
|
31803
|
+
const go = () => {
|
|
31804
|
+
if (done) return;
|
|
31805
|
+
done = true;
|
|
31806
|
+
release2();
|
|
31807
|
+
};
|
|
31808
|
+
setTimeout(go, STILL_RELEASE_MAX_MS);
|
|
31809
|
+
void (restoreSeekPainted(iframe) ?? Promise.resolve()).then(
|
|
31810
|
+
() => requestAnimationFrame(() => requestAnimationFrame(go))
|
|
31811
|
+
);
|
|
31812
|
+
}
|
|
31774
31813
|
function restoreSeekPainted(iframe) {
|
|
31775
31814
|
if (!iframe) return void 0;
|
|
31776
31815
|
if (previewFrameOpaque(iframe)) return previewSeekPainted(iframe, SHADOW_READY_TIMEOUT_MS);
|
|
@@ -31813,7 +31852,8 @@ function useShadowPreviewReload({
|
|
|
31813
31852
|
applyPreviewAudioState,
|
|
31814
31853
|
onPromoted,
|
|
31815
31854
|
onReloadFailed,
|
|
31816
|
-
handOverPlayback
|
|
31855
|
+
handOverPlayback,
|
|
31856
|
+
holdStill
|
|
31817
31857
|
}) {
|
|
31818
31858
|
const shadowIframeRef = useRef49(null);
|
|
31819
31859
|
const shadowProbeIntervalRef = useRef49(void 0);
|
|
@@ -31843,6 +31883,36 @@ function useShadowPreviewReload({
|
|
|
31843
31883
|
const promoteWhenReadyRef = useRef49(() => {
|
|
31844
31884
|
});
|
|
31845
31885
|
const [previewSlots, setPreviewSlots] = useState35([{ gen: 0, role: "live" }]);
|
|
31886
|
+
const slotsRef = useRef49(previewSlots);
|
|
31887
|
+
slotsRef.current = previewSlots;
|
|
31888
|
+
const holdStillRef = useRef49(holdStill);
|
|
31889
|
+
holdStillRef.current = holdStill;
|
|
31890
|
+
const heldRef = useRef49(null);
|
|
31891
|
+
const holdingUrlRef = useRef49(null);
|
|
31892
|
+
const holdTokenRef = useRef49(0);
|
|
31893
|
+
const restoringRef = useRef49(null);
|
|
31894
|
+
const dropRestoring = useCallback40(() => {
|
|
31895
|
+
const release2 = restoringRef.current;
|
|
31896
|
+
restoringRef.current = null;
|
|
31897
|
+
release2?.();
|
|
31898
|
+
}, []);
|
|
31899
|
+
const restoreLive = useCallback40(
|
|
31900
|
+
(held) => {
|
|
31901
|
+
dropRestoring();
|
|
31902
|
+
setPreviewSlots([held.liveSlot]);
|
|
31903
|
+
pendingSeekRef.current = held.time;
|
|
31904
|
+
restoringRef.current = held.release;
|
|
31905
|
+
setTimeout(() => {
|
|
31906
|
+
if (restoringRef.current === held.release) dropRestoring();
|
|
31907
|
+
}, SHADOW_READY_TIMEOUT_MS);
|
|
31908
|
+
},
|
|
31909
|
+
[pendingSeekRef, dropRestoring]
|
|
31910
|
+
);
|
|
31911
|
+
const onLiveLoaded = useCallback40(() => {
|
|
31912
|
+
const release2 = restoringRef.current;
|
|
31913
|
+
restoringRef.current = null;
|
|
31914
|
+
if (release2) releaseAfterPaint(iframeRef.current, release2);
|
|
31915
|
+
}, [iframeRef]);
|
|
31846
31916
|
const stopPendingShadow = useCallback40(() => {
|
|
31847
31917
|
clearTimeout(readyTimerRef.current);
|
|
31848
31918
|
budgetGenRef.current = null;
|
|
@@ -31863,7 +31933,10 @@ function useShadowPreviewReload({
|
|
|
31863
31933
|
shadowIframeRef.current = null;
|
|
31864
31934
|
isRefreshingRef.current = false;
|
|
31865
31935
|
pendingSeekRef.current = null;
|
|
31866
|
-
|
|
31936
|
+
const held = heldRef.current;
|
|
31937
|
+
heldRef.current = null;
|
|
31938
|
+
if (held) restoreLive(held);
|
|
31939
|
+
else setPreviewSlots(planShadowDiscard);
|
|
31867
31940
|
setPreviewReloading(false);
|
|
31868
31941
|
const message = `The preview did not reload (${cause}). It was still waiting for ${waitingFor}.${got} The previous preview is still showing.`;
|
|
31869
31942
|
logReload("shadow-failed", { cause, waitingFor });
|
|
@@ -31873,7 +31946,7 @@ function useShadowPreviewReload({
|
|
|
31873
31946
|
onReloadFailedRef.current?.(message);
|
|
31874
31947
|
retry.afterFailure(cause, failedGen);
|
|
31875
31948
|
},
|
|
31876
|
-
[stopPendingShadow, retry, isRefreshingRef, pendingSeekRef]
|
|
31949
|
+
[stopPendingShadow, retry, isRefreshingRef, pendingSeekRef, restoreLive]
|
|
31877
31950
|
);
|
|
31878
31951
|
const gestureSavesOnScreen = useCallback40(() => {
|
|
31879
31952
|
const liveDoc = iframeRef.current?.contentDocument;
|
|
@@ -31902,8 +31975,8 @@ function useShadowPreviewReload({
|
|
|
31902
31975
|
"gesture",
|
|
31903
31976
|
(retry2) => afterStudioManualEditGestures(liveDoc, retry2)
|
|
31904
31977
|
);
|
|
31905
|
-
|
|
31906
|
-
|
|
31978
|
+
const savesSame = heldRef.current !== null || gestureSavesOnScreen() === savesAtRequestRef.current;
|
|
31979
|
+
if (savesSame && studioFileRevision() === revisionAtRequestRef.current) return false;
|
|
31907
31980
|
if (isStudioEditSaving()) return waitThenRetry(gen, "save", afterStudioPendingEdits);
|
|
31908
31981
|
logReload("shadow-reloaded-after-gesture-save", { gen });
|
|
31909
31982
|
const url = new URL(shadowUrlRef.current, window.location.origin);
|
|
@@ -31925,9 +31998,11 @@ function useShadowPreviewReload({
|
|
|
31925
31998
|
if (!promotable || heldOrStale(gen)) return;
|
|
31926
31999
|
const { shadow, pending: pending2 } = promotable;
|
|
31927
32000
|
stopPendingShadow();
|
|
32001
|
+
const held = heldRef.current;
|
|
32002
|
+
heldRef.current = null;
|
|
31928
32003
|
const live = getAdapter();
|
|
31929
|
-
const liveTime2 = live?.getTime();
|
|
31930
|
-
const playing = usePlayerStore.getState().isPlaying;
|
|
32004
|
+
const liveTime2 = held ? held.time : live?.getTime();
|
|
32005
|
+
const playing = held ? held.playing : usePlayerStore.getState().isPlaying;
|
|
31931
32006
|
live?.pause();
|
|
31932
32007
|
const retired = iframeRef.current;
|
|
31933
32008
|
iframeRef.current = shadow;
|
|
@@ -31937,6 +32012,7 @@ function useShadowPreviewReload({
|
|
|
31937
32012
|
applyPreviewAudioState();
|
|
31938
32013
|
setPreviewSlots((prev) => planShadowPromotion(prev, gen));
|
|
31939
32014
|
if (liveTime2 != null) handOverPlaybackRef.current(liveTime2, playing);
|
|
32015
|
+
if (held) releaseAfterPaint(shadow, held.release);
|
|
31940
32016
|
announcePreviewPromoted({ retired, live: shadow });
|
|
31941
32017
|
onPromotedRef.current?.();
|
|
31942
32018
|
setPreviewReloading(false);
|
|
@@ -32044,8 +32120,8 @@ function useShadowPreviewReload({
|
|
|
32044
32120
|
logReload("shadow-reattached", { gen });
|
|
32045
32121
|
armReadyTimerRef.current(gen);
|
|
32046
32122
|
}, []);
|
|
32047
|
-
const
|
|
32048
|
-
(url) => {
|
|
32123
|
+
const startShadowReload = useCallback40(
|
|
32124
|
+
(url, alone) => {
|
|
32049
32125
|
retry.started();
|
|
32050
32126
|
shadowGenRef.current += 1;
|
|
32051
32127
|
const gen = shadowGenRef.current;
|
|
@@ -32056,11 +32132,49 @@ function useShadowPreviewReload({
|
|
|
32056
32132
|
savesAtRequestRef.current = gestureSavesOnScreen();
|
|
32057
32133
|
revisionAtRequestRef.current = studioFileRevision();
|
|
32058
32134
|
armReadyTimer(gen);
|
|
32059
|
-
setPreviewSlots(
|
|
32135
|
+
setPreviewSlots(
|
|
32136
|
+
(prev) => alone ? planShadowAlone(gen, url) : planShadowReload(prev, gen, url)
|
|
32137
|
+
);
|
|
32060
32138
|
setPreviewReloading(true);
|
|
32061
32139
|
},
|
|
32062
32140
|
[retry, stopPendingShadow, armReadyTimer, gestureSavesOnScreen]
|
|
32063
32141
|
);
|
|
32142
|
+
const beginShadowReload = useCallback40(
|
|
32143
|
+
(url) => {
|
|
32144
|
+
const live = iframeRef.current;
|
|
32145
|
+
const take = holdStillRef.current;
|
|
32146
|
+
if (heldRef.current || !take || !live?.isConnected) {
|
|
32147
|
+
startShadowReload(url, heldRef.current !== null);
|
|
32148
|
+
return;
|
|
32149
|
+
}
|
|
32150
|
+
if (holdingUrlRef.current !== null) {
|
|
32151
|
+
holdingUrlRef.current = url;
|
|
32152
|
+
return;
|
|
32153
|
+
}
|
|
32154
|
+
holdingUrlRef.current = url;
|
|
32155
|
+
const token = ++holdTokenRef.current;
|
|
32156
|
+
const playing = usePlayerStore.getState().isPlaying;
|
|
32157
|
+
getAdapter()?.pause();
|
|
32158
|
+
const time = getAdapter()?.getTime() ?? null;
|
|
32159
|
+
const liveSlot = slotsRef.current.find((slot) => slot.role === "live");
|
|
32160
|
+
void new Promise((resolve2) => resolve2(take(live))).catch(() => null).then((release2) => {
|
|
32161
|
+
if (token !== holdTokenRef.current) {
|
|
32162
|
+
release2?.();
|
|
32163
|
+
return;
|
|
32164
|
+
}
|
|
32165
|
+
const latest2 = holdingUrlRef.current ?? url;
|
|
32166
|
+
holdingUrlRef.current = null;
|
|
32167
|
+
if (release2 && liveSlot && iframeRef.current === live) {
|
|
32168
|
+
heldRef.current = { release: release2, time, playing, liveSlot, liveIframe: live };
|
|
32169
|
+
} else {
|
|
32170
|
+
release2?.();
|
|
32171
|
+
if (playing) getAdapter()?.play();
|
|
32172
|
+
}
|
|
32173
|
+
startShadowReload(latest2, heldRef.current !== null);
|
|
32174
|
+
});
|
|
32175
|
+
},
|
|
32176
|
+
[iframeRef, getAdapter, startShadowReload]
|
|
32177
|
+
);
|
|
32064
32178
|
beginShadowReloadRef.current = beginShadowReload;
|
|
32065
32179
|
const resetPreviewSlots = useCallback40(() => {
|
|
32066
32180
|
retry.cancel();
|
|
@@ -32070,9 +32184,15 @@ function useShadowPreviewReload({
|
|
|
32070
32184
|
isRefreshingRef.current = false;
|
|
32071
32185
|
pendingSeekRef.current = null;
|
|
32072
32186
|
usePlayerStore.getState().setTimelineReady(false);
|
|
32073
|
-
|
|
32187
|
+
const held = heldRef.current;
|
|
32188
|
+
heldRef.current = null;
|
|
32189
|
+
holdingUrlRef.current = null;
|
|
32190
|
+
holdTokenRef.current += 1;
|
|
32191
|
+
dropRestoring();
|
|
32192
|
+
setPreviewSlots(held ? [held.liveSlot] : planShadowDiscard);
|
|
32193
|
+
held?.release();
|
|
32074
32194
|
setPreviewReloading(false);
|
|
32075
|
-
}, [retry, stopPendingShadow, isRefreshingRef, pendingSeekRef]);
|
|
32195
|
+
}, [retry, stopPendingShadow, isRefreshingRef, pendingSeekRef, dropRestoring]);
|
|
32076
32196
|
useMountEffect(() => {
|
|
32077
32197
|
const onVisibilityChange = () => {
|
|
32078
32198
|
if (isDocumentHidden()) {
|
|
@@ -32087,6 +32207,10 @@ function useShadowPreviewReload({
|
|
|
32087
32207
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
32088
32208
|
retry.cancel();
|
|
32089
32209
|
stopPendingShadow();
|
|
32210
|
+
heldRef.current?.release();
|
|
32211
|
+
heldRef.current = null;
|
|
32212
|
+
holdTokenRef.current += 1;
|
|
32213
|
+
dropRestoring();
|
|
32090
32214
|
setPreviewReloading(false);
|
|
32091
32215
|
};
|
|
32092
32216
|
});
|
|
@@ -32098,7 +32222,8 @@ function useShadowPreviewReload({
|
|
|
32098
32222
|
setShadowIframeNode,
|
|
32099
32223
|
beginShadowReload,
|
|
32100
32224
|
resetPreviewSlots,
|
|
32101
|
-
previewGeneration
|
|
32225
|
+
previewGeneration,
|
|
32226
|
+
onLiveLoaded
|
|
32102
32227
|
};
|
|
32103
32228
|
}
|
|
32104
32229
|
|
|
@@ -32162,8 +32287,8 @@ function* timelineCandidates(iframe, win) {
|
|
|
32162
32287
|
const keys = win.__timelines ? Object.keys(win.__timelines) : [];
|
|
32163
32288
|
if (!win.__timelines || keys.length === 0) return;
|
|
32164
32289
|
const rootId = iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id");
|
|
32165
|
-
const
|
|
32166
|
-
yield wrapTimeline(win.__timelines[
|
|
32290
|
+
const key = rootId && rootId in win.__timelines ? rootId : keys[keys.length - 1];
|
|
32291
|
+
yield wrapTimeline(win.__timelines[key]);
|
|
32167
32292
|
}
|
|
32168
32293
|
function resolvePlaybackAdapter(iframe, win, refs) {
|
|
32169
32294
|
const playerAdapter = win.__player && typeof win.__player.play === "function" ? win.__player : null;
|
|
@@ -32444,8 +32569,8 @@ function evictMetadataOverflow() {
|
|
|
32444
32569
|
const overflow = cache.size + failed.size - TIMELINE_VIEWPORT_BUDGETS.metadataRegistryEntries;
|
|
32445
32570
|
if (overflow <= 0) return;
|
|
32446
32571
|
const entries = [
|
|
32447
|
-
...Array.from(cache, ([
|
|
32448
|
-
...Array.from(failed, ([
|
|
32572
|
+
...Array.from(cache, ([key, value]) => ({ key, at: value.lastAccess, failed: false })),
|
|
32573
|
+
...Array.from(failed, ([key, value]) => ({ key, at: value.lastAccess, failed: true }))
|
|
32449
32574
|
].sort((left, right) => left.at - right.at);
|
|
32450
32575
|
for (const entry3 of entries.slice(0, overflow)) {
|
|
32451
32576
|
if (entry3.failed) failed.delete(entry3.key);
|
|
@@ -32475,32 +32600,32 @@ async function probeMissingSourceDurations(elements, projectId, apply) {
|
|
|
32475
32600
|
await Promise.allSettled(
|
|
32476
32601
|
[...keysBySource].map(async ([source, keys]) => {
|
|
32477
32602
|
const result = await probeMediaUrl(source);
|
|
32478
|
-
if (result) apply(new Map(keys.map((
|
|
32603
|
+
if (result) apply(new Map(keys.map((key) => [key, result.duration])));
|
|
32479
32604
|
})
|
|
32480
32605
|
);
|
|
32481
32606
|
}
|
|
32482
|
-
function hasFreshFailure(
|
|
32483
|
-
const failedAt = failed.get(
|
|
32607
|
+
function hasFreshFailure(key) {
|
|
32608
|
+
const failedAt = failed.get(key);
|
|
32484
32609
|
if (failedAt === void 0) return false;
|
|
32485
32610
|
if (Date.now() - failedAt.failedAt < TIMELINE_VIEWPORT_BUDGETS.metadataFailureTtlMs) {
|
|
32486
32611
|
failedAt.lastAccess = ++accessSequence;
|
|
32487
32612
|
return true;
|
|
32488
32613
|
}
|
|
32489
|
-
failed.delete(
|
|
32614
|
+
failed.delete(key);
|
|
32490
32615
|
return false;
|
|
32491
32616
|
}
|
|
32492
32617
|
async function probeMediaUrl(url) {
|
|
32493
|
-
const
|
|
32494
|
-
const cached5 = getCachedProbe(
|
|
32618
|
+
const key = normalizeUrl(url);
|
|
32619
|
+
const cached5 = getCachedProbe(key);
|
|
32495
32620
|
if (cached5) return cached5;
|
|
32496
|
-
if (hasFreshFailure(
|
|
32497
|
-
let pending2 = inflight.get(
|
|
32621
|
+
if (hasFreshFailure(key)) return null;
|
|
32622
|
+
let pending2 = inflight.get(key);
|
|
32498
32623
|
if (pending2) return pending2;
|
|
32499
32624
|
pending2 = new Promise((resolve2) => {
|
|
32500
|
-
probeQueue.push({ key
|
|
32625
|
+
probeQueue.push({ key, epoch: registryEpoch, resolve: resolve2 });
|
|
32501
32626
|
pumpProbeQueue();
|
|
32502
32627
|
});
|
|
32503
|
-
inflight.set(
|
|
32628
|
+
inflight.set(key, pending2);
|
|
32504
32629
|
return pending2;
|
|
32505
32630
|
}
|
|
32506
32631
|
function pumpProbeQueue() {
|
|
@@ -32685,7 +32810,7 @@ function timelineElementsChanged(previous, next) {
|
|
|
32685
32810
|
if (next.length !== previous.length) return true;
|
|
32686
32811
|
return next.some((element, index2) => {
|
|
32687
32812
|
const prior = previous[index2];
|
|
32688
|
-
return !prior || RENDERED_FIELDS.some((
|
|
32813
|
+
return !prior || RENDERED_FIELDS.some((key) => element[key] !== prior[key]) || !sameTimelineText(element.text, prior.text);
|
|
32689
32814
|
});
|
|
32690
32815
|
}
|
|
32691
32816
|
|
|
@@ -32693,7 +32818,8 @@ function timelineElementsChanged(previous, next) {
|
|
|
32693
32818
|
var publishSeek = (time, options) => options?.follow === false ? liveTime.notify(time) : liveTime.notifySeek(time);
|
|
32694
32819
|
function useTimelinePlayer({
|
|
32695
32820
|
onShadowPromoted,
|
|
32696
|
-
onPreviewReloadFailed
|
|
32821
|
+
onPreviewReloadFailed,
|
|
32822
|
+
holdPreviewStill
|
|
32697
32823
|
} = {}) {
|
|
32698
32824
|
const iframeRef = useRef50(null);
|
|
32699
32825
|
const rafRef = useRef50(0);
|
|
@@ -33011,7 +33137,8 @@ function useTimelinePlayer({
|
|
|
33011
33137
|
setShadowIframeNode,
|
|
33012
33138
|
beginShadowReload,
|
|
33013
33139
|
resetPreviewSlots,
|
|
33014
|
-
previewGeneration
|
|
33140
|
+
previewGeneration,
|
|
33141
|
+
onLiveLoaded
|
|
33015
33142
|
} = useShadowPreviewReload({
|
|
33016
33143
|
iframeRef,
|
|
33017
33144
|
getAdapter,
|
|
@@ -33026,6 +33153,7 @@ function useTimelinePlayer({
|
|
|
33026
33153
|
applyPreviewAudioState,
|
|
33027
33154
|
onPromoted: onShadowPromoted,
|
|
33028
33155
|
onReloadFailed: onPreviewReloadFailed,
|
|
33156
|
+
holdStill: holdPreviewStill,
|
|
33029
33157
|
handOverPlayback: (time, playing) => {
|
|
33030
33158
|
seek(time, { keepPlaying: true, follow: false });
|
|
33031
33159
|
const adapter = getAdapter();
|
|
@@ -33131,13 +33259,20 @@ function useTimelinePlayer({
|
|
|
33131
33259
|
applyPreviewAudioState();
|
|
33132
33260
|
});
|
|
33133
33261
|
}, [applyPlaybackRate, applyPreviewAudioState]);
|
|
33262
|
+
const onLiveIframeLoad = useCallback42(
|
|
33263
|
+
(context) => {
|
|
33264
|
+
onIframeLoad(context);
|
|
33265
|
+
onLiveLoaded();
|
|
33266
|
+
},
|
|
33267
|
+
[onIframeLoad, onLiveLoaded]
|
|
33268
|
+
);
|
|
33134
33269
|
return {
|
|
33135
33270
|
iframeRef,
|
|
33136
33271
|
play,
|
|
33137
33272
|
pause,
|
|
33138
33273
|
togglePlay,
|
|
33139
33274
|
seek,
|
|
33140
|
-
onIframeLoad,
|
|
33275
|
+
onIframeLoad: onLiveIframeLoad,
|
|
33141
33276
|
refreshPlayer,
|
|
33142
33277
|
saveSeekPosition,
|
|
33143
33278
|
resetPlayer,
|
|
@@ -33522,7 +33657,7 @@ function usePlayerHandle() {
|
|
|
33522
33657
|
},
|
|
33523
33658
|
[ready, seekPlayer]
|
|
33524
33659
|
);
|
|
33525
|
-
const
|
|
33660
|
+
const subscribe2 = useCallback45((listener2) => {
|
|
33526
33661
|
let previous = usePlayerStore.getState();
|
|
33527
33662
|
return usePlayerStore.subscribe((state) => {
|
|
33528
33663
|
const structuralChange = state.timelineReady !== previous.timelineReady || state.isPlaying !== previous.isPlaying || state.duration !== previous.duration || state.elements !== previous.elements;
|
|
@@ -33546,7 +33681,7 @@ function usePlayerHandle() {
|
|
|
33546
33681
|
},
|
|
33547
33682
|
duration,
|
|
33548
33683
|
elements: handleElements,
|
|
33549
|
-
subscribe:
|
|
33684
|
+
subscribe: subscribe2,
|
|
33550
33685
|
subscribeTime
|
|
33551
33686
|
};
|
|
33552
33687
|
}
|
|
@@ -33577,6 +33712,7 @@ import {
|
|
|
33577
33712
|
useRef as useRef56,
|
|
33578
33713
|
useState as useState40
|
|
33579
33714
|
} from "react";
|
|
33715
|
+
import { flushSync as flushSync3 } from "react-dom";
|
|
33580
33716
|
|
|
33581
33717
|
// src/components/nle/previewZoom.ts
|
|
33582
33718
|
var MIN_PREVIEW_ZOOM_PERCENT = 25;
|
|
@@ -33741,10 +33877,10 @@ var usePreviewGuidesStore = create8((set, get) => {
|
|
|
33741
33877
|
return {
|
|
33742
33878
|
rulerVisible: stored.rulerVisible ?? false,
|
|
33743
33879
|
safeMarginsVisible: stored.safeMarginsVisible ?? false,
|
|
33744
|
-
toggle: (
|
|
33745
|
-
const next = !get()[
|
|
33746
|
-
writeStudioUiPreferences({ [
|
|
33747
|
-
set({ [
|
|
33880
|
+
toggle: (key) => {
|
|
33881
|
+
const next = !get()[key];
|
|
33882
|
+
writeStudioUiPreferences({ [key]: next });
|
|
33883
|
+
set({ [key]: next });
|
|
33748
33884
|
}
|
|
33749
33885
|
};
|
|
33750
33886
|
});
|
|
@@ -34133,10 +34269,10 @@ function renderPosterForNextOpen(projectId) {
|
|
|
34133
34269
|
});
|
|
34134
34270
|
if (settled()) lease.release();
|
|
34135
34271
|
}
|
|
34136
|
-
function useVisitNumber(
|
|
34137
|
-
const [seen, setSeen] = useState39({ key
|
|
34138
|
-
if (seen.key ===
|
|
34139
|
-
setSeen({ key
|
|
34272
|
+
function useVisitNumber(key) {
|
|
34273
|
+
const [seen, setSeen] = useState39({ key, visit: 0 });
|
|
34274
|
+
if (seen.key === key) return seen.visit;
|
|
34275
|
+
setSeen({ key, visit: seen.visit + 1 });
|
|
34140
34276
|
return seen.visit + 1;
|
|
34141
34277
|
}
|
|
34142
34278
|
|
|
@@ -34211,11 +34347,10 @@ var NLEPreview = memo24(function NLEPreview2({
|
|
|
34211
34347
|
const viewport2 = viewportRef.current;
|
|
34212
34348
|
if (!viewport2) return;
|
|
34213
34349
|
const updateStageSize = () => {
|
|
34214
|
-
const rect = viewport2.getBoundingClientRect();
|
|
34215
34350
|
setStageSize(
|
|
34216
34351
|
resolvePreviewStageSize(
|
|
34217
|
-
|
|
34218
|
-
|
|
34352
|
+
viewport2.clientWidth,
|
|
34353
|
+
viewport2.clientHeight,
|
|
34219
34354
|
compositionSize ?? (hintWidth && hintHeight ? { width: hintWidth, height: hintHeight } : null),
|
|
34220
34355
|
portrait,
|
|
34221
34356
|
gutterPx,
|
|
@@ -34224,7 +34359,8 @@ var NLEPreview = memo24(function NLEPreview2({
|
|
|
34224
34359
|
);
|
|
34225
34360
|
};
|
|
34226
34361
|
updateStageSize();
|
|
34227
|
-
const
|
|
34362
|
+
const resizeBeforePaint = () => flushSync3(updateStageSize);
|
|
34363
|
+
const observer = new ResizeObserver(resizeBeforePaint);
|
|
34228
34364
|
observer.observe(viewport2);
|
|
34229
34365
|
return () => observer.disconnect();
|
|
34230
34366
|
}, [compositionSize, hintWidth, hintHeight, portrait, gutterPx, insetPx]);
|
|
@@ -37734,16 +37870,16 @@ function framePointer(iframe, clientX, clientY) {
|
|
|
37734
37870
|
function objectLike(value) {
|
|
37735
37871
|
return value && (typeof value === "object" || typeof value === "function") ? value : null;
|
|
37736
37872
|
}
|
|
37737
|
-
function callPlaybackMethod(target,
|
|
37738
|
-
const method = target ? Reflect.get(target,
|
|
37873
|
+
function callPlaybackMethod(target, key) {
|
|
37874
|
+
const method = target ? Reflect.get(target, key) : null;
|
|
37739
37875
|
if (typeof method !== "function") return;
|
|
37740
37876
|
try {
|
|
37741
37877
|
method.call(target);
|
|
37742
37878
|
} catch {
|
|
37743
37879
|
}
|
|
37744
37880
|
}
|
|
37745
|
-
function readPlaybackTime(target,
|
|
37746
|
-
const method = target ? Reflect.get(target,
|
|
37881
|
+
function readPlaybackTime(target, key) {
|
|
37882
|
+
const method = target ? Reflect.get(target, key) : null;
|
|
37747
37883
|
if (typeof method !== "function") return null;
|
|
37748
37884
|
try {
|
|
37749
37885
|
const value = method.call(target);
|
|
@@ -38105,11 +38241,11 @@ function createOverlayMeasurePass() {
|
|
|
38105
38241
|
sourceBoundaryRect: /* @__PURE__ */ new Map()
|
|
38106
38242
|
};
|
|
38107
38243
|
}
|
|
38108
|
-
function readThroughPass(memo64,
|
|
38109
|
-
const answered = memo64.get(
|
|
38244
|
+
function readThroughPass(memo64, key, compute) {
|
|
38245
|
+
const answered = memo64.get(key);
|
|
38110
38246
|
if (answered !== void 0) return answered;
|
|
38111
38247
|
const value = compute();
|
|
38112
|
-
memo64.set(
|
|
38248
|
+
memo64.set(key, value);
|
|
38113
38249
|
return value;
|
|
38114
38250
|
}
|
|
38115
38251
|
|
|
@@ -38342,13 +38478,13 @@ function selectionCacheKey(selection) {
|
|
|
38342
38478
|
].join("|");
|
|
38343
38479
|
}
|
|
38344
38480
|
function resolveElementForOverlay(doc, sel, activeCompositionPath, cacheRef) {
|
|
38345
|
-
const
|
|
38481
|
+
const key = selectionCacheKey(sel);
|
|
38346
38482
|
const cached5 = cacheRef.current;
|
|
38347
|
-
if (cached5?.key ===
|
|
38483
|
+
if (cached5?.key === key && cached5.element.isConnected && cached5.element.ownerDocument === doc) {
|
|
38348
38484
|
return cached5.element;
|
|
38349
38485
|
}
|
|
38350
38486
|
const next = findElementForSelection(doc, sel, activeCompositionPath);
|
|
38351
|
-
cacheRef.current = next ? { key
|
|
38487
|
+
cacheRef.current = next ? { key, element: next } : null;
|
|
38352
38488
|
return next;
|
|
38353
38489
|
}
|
|
38354
38490
|
|
|
@@ -38451,11 +38587,18 @@ function readHit(value) {
|
|
|
38451
38587
|
function readPreviewElement(value) {
|
|
38452
38588
|
if (!readHit(value) || !isFields(value)) return null;
|
|
38453
38589
|
if (value.parent !== null && !isHandle(value.parent)) return null;
|
|
38590
|
+
if (value.label !== void 0 && !isText(value.label)) return null;
|
|
38454
38591
|
if (!isTextOrNull(value.id) || !isTextOrNull(value.selector)) return null;
|
|
38455
38592
|
if (!isSource(value.source) || typeof value.locked !== "boolean") return null;
|
|
38456
38593
|
if (!isTextRecord(value.inlineStyles) || !isText(value.text)) return null;
|
|
38457
38594
|
return hasPlainFields(value) ? value : null;
|
|
38458
38595
|
}
|
|
38596
|
+
async function previewElementsAtPoint(iframe, x, y) {
|
|
38597
|
+
const reply = await previewRequest(iframe, "elements-at-point", { x, y });
|
|
38598
|
+
const elements = reply?.elements;
|
|
38599
|
+
if (!Array.isArray(elements)) return null;
|
|
38600
|
+
return elements.map(readHit).filter((element) => element !== null);
|
|
38601
|
+
}
|
|
38459
38602
|
async function previewPointerTargets(iframe, rootFractionX, rootFractionY) {
|
|
38460
38603
|
const params = { x: rootFractionX, y: rootFractionY };
|
|
38461
38604
|
const reply = await previewRequest(iframe, "pointer-targets", params);
|
|
@@ -38524,7 +38667,7 @@ async function previewGeometry(iframe, handles, children) {
|
|
|
38524
38667
|
};
|
|
38525
38668
|
}
|
|
38526
38669
|
var isFlag = (value) => typeof value === "boolean";
|
|
38527
|
-
var isFiniteFields = (value, keys) => isFields(value) && keys.every((
|
|
38670
|
+
var isFiniteFields = (value, keys) => isFields(value) && keys.every((key) => Number.isFinite(value[key]));
|
|
38528
38671
|
var readGestureStart = (value) => {
|
|
38529
38672
|
if (!readGeometry(value) || !isFields(value)) return null;
|
|
38530
38673
|
const { layout, move, gsap: gsap3 } = value;
|
|
@@ -38942,7 +39085,7 @@ function readable(element) {
|
|
|
38942
39085
|
probe2.textContent = element.text;
|
|
38943
39086
|
return probe2;
|
|
38944
39087
|
}
|
|
38945
|
-
var attr = (element, name) => element.attributes.find(([
|
|
39088
|
+
var attr = (element, name) => element.attributes.find(([key]) => key === name)?.[1] ?? null;
|
|
38946
39089
|
var mayBeCut = (value) => value.length >= MAX_ELEMENT_VALUE2 || value.startsWith("data:") && value.endsWith(",");
|
|
38947
39090
|
function valuesWhole(element) {
|
|
38948
39091
|
if (!element.truncated) return true;
|
|
@@ -39262,7 +39405,7 @@ async function compositionViewport(iframe) {
|
|
|
39262
39405
|
const root = roots?.matches[0] ?? (await queryPreviewElements(iframe, "html"))?.matches[0];
|
|
39263
39406
|
const [described] = root && await describePreviewElements(iframe, [root.handle]) || [];
|
|
39264
39407
|
if (!described) return null;
|
|
39265
|
-
const declared = (name) => Number.parseFloat(described.attributes.find(([
|
|
39408
|
+
const declared = (name) => Number.parseFloat(described.attributes.find(([key]) => key === name)?.[1] ?? "");
|
|
39266
39409
|
const [width, height] = [declared("data-width"), declared("data-height")];
|
|
39267
39410
|
return {
|
|
39268
39411
|
width: width > 0 ? width : described.rect.width || 1,
|
|
@@ -39708,14 +39851,14 @@ function useDomEditOverlayRects({
|
|
|
39708
39851
|
setGroupOverlayItemsState(next);
|
|
39709
39852
|
};
|
|
39710
39853
|
const resolveGroupElement = (doc, sel) => {
|
|
39711
|
-
const
|
|
39712
|
-
const cached5 = resolvedGroupElementRef.current.get(
|
|
39854
|
+
const key = selectionCacheKey(sel);
|
|
39855
|
+
const cached5 = resolvedGroupElementRef.current.get(key);
|
|
39713
39856
|
if (cached5?.isConnected && cached5.ownerDocument === doc) return cached5;
|
|
39714
39857
|
const next = findElementForSelection(doc, sel, activeCompositionPathRef.current);
|
|
39715
39858
|
if (next) {
|
|
39716
|
-
resolvedGroupElementRef.current.set(
|
|
39859
|
+
resolvedGroupElementRef.current.set(key, next);
|
|
39717
39860
|
} else {
|
|
39718
|
-
resolvedGroupElementRef.current.delete(
|
|
39861
|
+
resolvedGroupElementRef.current.delete(key);
|
|
39719
39862
|
}
|
|
39720
39863
|
return next;
|
|
39721
39864
|
};
|
|
@@ -39727,16 +39870,16 @@ function useDomEditOverlayRects({
|
|
|
39727
39870
|
const distinctGroup = (group) => {
|
|
39728
39871
|
const keys = /* @__PURE__ */ new Set();
|
|
39729
39872
|
return group.flatMap((selection) => {
|
|
39730
|
-
const
|
|
39731
|
-
if (keys.has(
|
|
39732
|
-
keys.add(
|
|
39733
|
-
return [{ key
|
|
39873
|
+
const key = selectionCacheKey(selection);
|
|
39874
|
+
if (keys.has(key)) return [];
|
|
39875
|
+
keys.add(key);
|
|
39876
|
+
return [{ key, selection }];
|
|
39734
39877
|
});
|
|
39735
39878
|
};
|
|
39736
39879
|
const hoverShown = (sel, group) => {
|
|
39737
39880
|
const hoverSel = hoverSelectionRef.current;
|
|
39738
|
-
const
|
|
39739
|
-
const covered = sel && selectionCacheKey(sel) ===
|
|
39881
|
+
const key = hoverSel && selectionCacheKey(hoverSel);
|
|
39882
|
+
const covered = sel && selectionCacheKey(sel) === key || group.some((entry3) => selectionCacheKey(entry3) === key);
|
|
39740
39883
|
return covered ? null : hoverSel;
|
|
39741
39884
|
};
|
|
39742
39885
|
const updateOverChannel = (iframe, overlayEl) => {
|
|
@@ -39764,9 +39907,9 @@ function useDomEditOverlayRects({
|
|
|
39764
39907
|
setOverlayRect(rects.selection);
|
|
39765
39908
|
setChildRects(rects.children);
|
|
39766
39909
|
setGroupOverlayItems(
|
|
39767
|
-
members.flatMap(({ key
|
|
39910
|
+
members.flatMap(({ key, selection }, index2) => {
|
|
39768
39911
|
const rect = rects.group[index2];
|
|
39769
|
-
return rect ? [{ key
|
|
39912
|
+
return rect ? [{ key, selection, element: selection.element, rect }] : [];
|
|
39770
39913
|
})
|
|
39771
39914
|
);
|
|
39772
39915
|
setHoverRect(rects.hover);
|
|
@@ -39854,17 +39997,17 @@ function useDomEditOverlayRects({
|
|
|
39854
39997
|
const nextGroupItems = [];
|
|
39855
39998
|
const liveGroupKeys = /* @__PURE__ */ new Set();
|
|
39856
39999
|
for (const groupSelection of group) {
|
|
39857
|
-
const
|
|
39858
|
-
if (liveGroupKeys.has(
|
|
39859
|
-
liveGroupKeys.add(
|
|
40000
|
+
const key = selectionCacheKey(groupSelection);
|
|
40001
|
+
if (liveGroupKeys.has(key)) continue;
|
|
40002
|
+
liveGroupKeys.add(key);
|
|
39860
40003
|
const el = resolveGroupElement(doc, groupSelection);
|
|
39861
40004
|
const base2 = el ? groupAwareOverlayRect(overlayEl, iframe, el, scale) : null;
|
|
39862
40005
|
const rect = base2 && el ? { ...base2, ...hugRectForElement(base2, el) } : base2;
|
|
39863
40006
|
if (el && rect)
|
|
39864
|
-
nextGroupItems.push({ key
|
|
40007
|
+
nextGroupItems.push({ key, selection: groupSelection, element: el, rect });
|
|
39865
40008
|
}
|
|
39866
|
-
for (const
|
|
39867
|
-
if (!liveGroupKeys.has(
|
|
40009
|
+
for (const key of resolvedGroupElementRef.current.keys()) {
|
|
40010
|
+
if (!liveGroupKeys.has(key)) resolvedGroupElementRef.current.delete(key);
|
|
39868
40011
|
}
|
|
39869
40012
|
setGroupOverlayItems(nextGroupItems);
|
|
39870
40013
|
} else {
|
|
@@ -40152,8 +40295,8 @@ function normalizeStudioFileChangePath(path) {
|
|
|
40152
40295
|
function asPayloadRecord(payload) {
|
|
40153
40296
|
return payload && typeof payload === "object" ? payload : null;
|
|
40154
40297
|
}
|
|
40155
|
-
function readFileChangeField(payload,
|
|
40156
|
-
const value = asPayloadRecord(payload)?.[
|
|
40298
|
+
function readFileChangeField(payload, key) {
|
|
40299
|
+
const value = asPayloadRecord(payload)?.[key];
|
|
40157
40300
|
return typeof value === "string" ? value : null;
|
|
40158
40301
|
}
|
|
40159
40302
|
function readStudioFileChangePath(payload) {
|
|
@@ -40527,8 +40670,8 @@ function markWrapped(fn) {
|
|
|
40527
40670
|
function isWrapped(fn) {
|
|
40528
40671
|
return Boolean(fn[STUDIO_MANUAL_EDITS_WRAPPED_PROP]);
|
|
40529
40672
|
}
|
|
40530
|
-
function wrapSeekReapplyFunction(win, owner,
|
|
40531
|
-
const fn = owner?.[
|
|
40673
|
+
function wrapSeekReapplyFunction(win, owner, key, reapplyWhenHeldSeekLands = false) {
|
|
40674
|
+
const fn = owner?.[key];
|
|
40532
40675
|
if (!owner || typeof fn !== "function") return false;
|
|
40533
40676
|
const seek = fn;
|
|
40534
40677
|
if (isWrapped(seek)) return true;
|
|
@@ -40541,14 +40684,14 @@ function wrapSeekReapplyFunction(win, owner, key2, reapplyWhenHeldSeekLands = fa
|
|
|
40541
40684
|
};
|
|
40542
40685
|
markWrapped(wrappedSeek);
|
|
40543
40686
|
try {
|
|
40544
|
-
owner[
|
|
40687
|
+
owner[key] = wrappedSeek;
|
|
40545
40688
|
} catch {
|
|
40546
40689
|
return false;
|
|
40547
40690
|
}
|
|
40548
40691
|
return true;
|
|
40549
40692
|
}
|
|
40550
|
-
function readOwnerNumber(owner,
|
|
40551
|
-
const fn = owner[
|
|
40693
|
+
function readOwnerNumber(owner, key) {
|
|
40694
|
+
const fn = owner[key];
|
|
40552
40695
|
if (typeof fn !== "function") return null;
|
|
40553
40696
|
try {
|
|
40554
40697
|
return finiteNumber2(fn.call(owner));
|
|
@@ -40634,8 +40777,8 @@ function startStudioManualEditPlaybackReapply(win) {
|
|
|
40634
40777
|
};
|
|
40635
40778
|
win[STUDIO_MANUAL_EDITS_PLAYBACK_FRAME_PROP] = win.requestAnimationFrame(tick);
|
|
40636
40779
|
}
|
|
40637
|
-
function wrapPlayReapplyFunction(win, owner,
|
|
40638
|
-
const fn = owner?.[
|
|
40780
|
+
function wrapPlayReapplyFunction(win, owner, key) {
|
|
40781
|
+
const fn = owner?.[key];
|
|
40639
40782
|
if (!owner || typeof fn !== "function") return false;
|
|
40640
40783
|
const play = fn;
|
|
40641
40784
|
if (isWrapped(play)) return true;
|
|
@@ -40646,14 +40789,14 @@ function wrapPlayReapplyFunction(win, owner, key2) {
|
|
|
40646
40789
|
};
|
|
40647
40790
|
markWrapped(wrappedPlay);
|
|
40648
40791
|
try {
|
|
40649
|
-
owner[
|
|
40792
|
+
owner[key] = wrappedPlay;
|
|
40650
40793
|
} catch {
|
|
40651
40794
|
return false;
|
|
40652
40795
|
}
|
|
40653
40796
|
return true;
|
|
40654
40797
|
}
|
|
40655
|
-
function wrapApplyAfterFunction(win, owner,
|
|
40656
|
-
const fn = owner?.[
|
|
40798
|
+
function wrapApplyAfterFunction(win, owner, key) {
|
|
40799
|
+
const fn = owner?.[key];
|
|
40657
40800
|
if (!owner || typeof fn !== "function") return false;
|
|
40658
40801
|
const applyAfter = fn;
|
|
40659
40802
|
if (isWrapped(applyAfter)) return true;
|
|
@@ -40664,7 +40807,7 @@ function wrapApplyAfterFunction(win, owner, key2) {
|
|
|
40664
40807
|
};
|
|
40665
40808
|
markWrapped(wrappedApplyAfter);
|
|
40666
40809
|
try {
|
|
40667
|
-
owner[
|
|
40810
|
+
owner[key] = wrappedApplyAfter;
|
|
40668
40811
|
} catch {
|
|
40669
40812
|
return false;
|
|
40670
40813
|
}
|
|
@@ -41623,19 +41766,19 @@ function resetDragMoveLog() {
|
|
|
41623
41766
|
}
|
|
41624
41767
|
function readDragPositions(elements) {
|
|
41625
41768
|
const positions = {};
|
|
41626
|
-
for (const { key
|
|
41769
|
+
for (const { key, element } of elements) {
|
|
41627
41770
|
const rect = element.getBoundingClientRect();
|
|
41628
|
-
positions[
|
|
41771
|
+
positions[key] = `${Math.round(rect.left)},${Math.round(rect.top)}`;
|
|
41629
41772
|
}
|
|
41630
41773
|
return positions;
|
|
41631
41774
|
}
|
|
41632
41775
|
function findNonRigidMembers(before, after) {
|
|
41633
41776
|
const moves = /* @__PURE__ */ new Map();
|
|
41634
|
-
for (const
|
|
41635
|
-
const from = before[
|
|
41636
|
-
const to = after[
|
|
41777
|
+
for (const key of Object.keys(after)) {
|
|
41778
|
+
const from = before[key]?.split(",").map(Number);
|
|
41779
|
+
const to = after[key]?.split(",").map(Number);
|
|
41637
41780
|
if (!from || !to || from.length !== 2 || to.length !== 2) continue;
|
|
41638
|
-
moves.set(
|
|
41781
|
+
moves.set(key, `${Math.round(to[0] - from[0])},${Math.round(to[1] - from[1])}`);
|
|
41639
41782
|
}
|
|
41640
41783
|
const counts = /* @__PURE__ */ new Map();
|
|
41641
41784
|
for (const move of moves.values()) counts.set(move, (counts.get(move) ?? 0) + 1);
|
|
@@ -41644,7 +41787,7 @@ function findNonRigidMembers(before, after) {
|
|
|
41644
41787
|
for (const [move, count] of counts) {
|
|
41645
41788
|
if (count > best) [common, best] = [move, count];
|
|
41646
41789
|
}
|
|
41647
|
-
return [...moves].filter(([, move]) => move !== common).map(([
|
|
41790
|
+
return [...moves].filter(([, move]) => move !== common).map(([key, move]) => `${key.split("|")[2] ?? key} moved ${move}, group moved ${common}`);
|
|
41648
41791
|
}
|
|
41649
41792
|
function logDragSettle(stage, elements) {
|
|
41650
41793
|
logDrag(stage, () => {
|
|
@@ -44144,8 +44287,8 @@ function InlineTextCaret({
|
|
|
44144
44287
|
let composing = false;
|
|
44145
44288
|
let side = "after";
|
|
44146
44289
|
const update = () => setPlacement(composing ? null : placeAtCaret(element, iframe, color, side));
|
|
44147
|
-
const onKey = ({ key
|
|
44148
|
-
if (!MODIFIERS.has(
|
|
44290
|
+
const onKey = ({ key }) => {
|
|
44291
|
+
if (!MODIFIERS.has(key)) side = SIDE_OF_KEY[key] ?? "after";
|
|
44149
44292
|
};
|
|
44150
44293
|
const onPress = () => void (side = "after");
|
|
44151
44294
|
const composition = (on) => () => {
|
|
@@ -44512,18 +44655,18 @@ function runNodes(doc, runs) {
|
|
|
44512
44655
|
return nodes;
|
|
44513
44656
|
}
|
|
44514
44657
|
function runNode(doc, run, carried) {
|
|
44515
|
-
const
|
|
44658
|
+
const key = styleKey(run.style);
|
|
44516
44659
|
const nodes = [];
|
|
44517
44660
|
for (const [index2, piece] of run.text.split(BREAK).entries()) {
|
|
44518
44661
|
if (index2 > 0) nodes.push(doc.createElement("br"));
|
|
44519
44662
|
if (!piece) continue;
|
|
44520
|
-
if (!
|
|
44663
|
+
if (!key && carried.size === 0) {
|
|
44521
44664
|
nodes.push(doc.createTextNode(piece));
|
|
44522
44665
|
continue;
|
|
44523
44666
|
}
|
|
44524
44667
|
const span = doc.createElement("span");
|
|
44525
44668
|
for (const [name, value] of carried) span.setAttribute(name, value);
|
|
44526
|
-
if (
|
|
44669
|
+
if (key) span.setAttribute("style", key);
|
|
44527
44670
|
span.textContent = piece;
|
|
44528
44671
|
nodes.push(span);
|
|
44529
44672
|
carried.clear();
|
|
@@ -45423,13 +45566,13 @@ function renderFields(label, text3) {
|
|
|
45423
45566
|
const [name = "", ...value] = field.split(" ");
|
|
45424
45567
|
const cells = document.createElement("span");
|
|
45425
45568
|
cells.className = "flex items-baseline gap-1.5";
|
|
45426
|
-
const
|
|
45427
|
-
|
|
45428
|
-
|
|
45569
|
+
const key = document.createElement("span");
|
|
45570
|
+
key.className = "text-text-4";
|
|
45571
|
+
key.textContent = name;
|
|
45429
45572
|
const figure = document.createElement("span");
|
|
45430
45573
|
figure.className = "min-w-[4ch] text-right font-medium";
|
|
45431
45574
|
figure.textContent = value.join(" ");
|
|
45432
|
-
cells.append(
|
|
45575
|
+
cells.append(key, figure);
|
|
45433
45576
|
if (index2 === 0) return [cells];
|
|
45434
45577
|
const divider = document.createElement("span");
|
|
45435
45578
|
divider.className = "h-3.5 w-px bg-border";
|
|
@@ -46214,9 +46357,9 @@ function flushAttemptCounts() {
|
|
|
46214
46357
|
const keys = Object.keys(attemptCounts);
|
|
46215
46358
|
if (keys.length === 0) return null;
|
|
46216
46359
|
const snapshot3 = {};
|
|
46217
|
-
for (const
|
|
46218
|
-
snapshot3[
|
|
46219
|
-
delete attemptCounts[
|
|
46360
|
+
for (const key of keys) {
|
|
46361
|
+
snapshot3[key] = attemptCounts[key];
|
|
46362
|
+
delete attemptCounts[key];
|
|
46220
46363
|
}
|
|
46221
46364
|
return snapshot3;
|
|
46222
46365
|
}
|
|
@@ -47543,9 +47686,9 @@ function resolveRepositionLaneMove(input) {
|
|
|
47543
47686
|
const selfKey = keyOf13(element);
|
|
47544
47687
|
const selfIdx = desiredOrderKeys.indexOf(selfKey);
|
|
47545
47688
|
if (selfIdx === -1) return null;
|
|
47546
|
-
const clipLaneForKey = (
|
|
47547
|
-
if (
|
|
47548
|
-
const el = elements.find((candidate) => keyOf13(candidate) ===
|
|
47689
|
+
const clipLaneForKey = (key) => {
|
|
47690
|
+
if (key == null) return null;
|
|
47691
|
+
const el = elements.find((candidate) => keyOf13(candidate) === key);
|
|
47549
47692
|
return el && classifyZone(el) === "visual" && el.duration > 0 && samePaintScope(el, element) && keyOf13(el) !== selfKey ? el.track : null;
|
|
47550
47693
|
};
|
|
47551
47694
|
let aboveLane = null;
|
|
@@ -47686,7 +47829,7 @@ function useMirrorLaneMoveCommit() {
|
|
|
47686
47829
|
{
|
|
47687
47830
|
elements: els,
|
|
47688
47831
|
trackOrder: timelineTrackOrder(els),
|
|
47689
|
-
updateElement: (
|
|
47832
|
+
updateElement: (key, updates) => usePlayerStore.getState().updateElement(key, updates),
|
|
47690
47833
|
onMoveElements
|
|
47691
47834
|
// NO readZIndex / onStackingPatches: see the hook doc — the lane→z
|
|
47692
47835
|
// stacking sync must not re-trigger and fight the just-set z values.
|
|
@@ -48826,15 +48969,15 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
|
|
|
48826
48969
|
|
|
48827
48970
|
// src/hooks/gsapKeyframeCacheHelpers.ts
|
|
48828
48971
|
function keepEqualEntries(before, draft) {
|
|
48829
|
-
for (const [
|
|
48830
|
-
const shown3 = before.get(
|
|
48831
|
-
if (shown3 !== void 0 && shown3 !== value && sameData(shown3, value)) draft.set(
|
|
48972
|
+
for (const [key, value] of draft) {
|
|
48973
|
+
const shown3 = before.get(key);
|
|
48974
|
+
if (shown3 !== void 0 && shown3 !== value && sameData(shown3, value)) draft.set(key, shown3);
|
|
48832
48975
|
}
|
|
48833
48976
|
}
|
|
48834
48977
|
function sameEntries(before, after) {
|
|
48835
48978
|
if (before.size !== after.size) return false;
|
|
48836
|
-
for (const [
|
|
48837
|
-
if (after.get(
|
|
48979
|
+
for (const [key, value] of before) {
|
|
48980
|
+
if (after.get(key) !== value) return false;
|
|
48838
48981
|
}
|
|
48839
48982
|
return true;
|
|
48840
48983
|
}
|
|
@@ -48897,16 +49040,16 @@ function updateKeyframeCacheFromParsed(animations, targetPath, selectionId, muta
|
|
|
48897
49040
|
});
|
|
48898
49041
|
}
|
|
48899
49042
|
function writeElementIntoDraft(draft, sourceFile, elementId2, entry3, animations) {
|
|
48900
|
-
for (const
|
|
48901
|
-
draft.keyframeCache.set(
|
|
48902
|
-
if (animations) draft.gsapAnimations.set(
|
|
48903
|
-
else draft.gsapAnimations.delete(
|
|
49043
|
+
for (const key of elementCacheKeys(sourceFile, elementId2)) {
|
|
49044
|
+
draft.keyframeCache.set(key, entry3);
|
|
49045
|
+
if (animations) draft.gsapAnimations.set(key, animations);
|
|
49046
|
+
else draft.gsapAnimations.delete(key);
|
|
48904
49047
|
}
|
|
48905
49048
|
}
|
|
48906
49049
|
function deleteElementFromDraft(draft, sourceFile, elementId2) {
|
|
48907
|
-
for (const
|
|
48908
|
-
draft.keyframeCache.delete(
|
|
48909
|
-
draft.gsapAnimations.delete(
|
|
49050
|
+
for (const key of elementCacheKeys(sourceFile, elementId2)) {
|
|
49051
|
+
draft.keyframeCache.delete(key);
|
|
49052
|
+
draft.gsapAnimations.delete(key);
|
|
48910
49053
|
}
|
|
48911
49054
|
}
|
|
48912
49055
|
function clearKeyframeCacheForElement(sourceFile, elementId2) {
|
|
@@ -48915,14 +49058,14 @@ function clearKeyframeCacheForElement(sourceFile, elementId2) {
|
|
|
48915
49058
|
function cachedElementIdsForFile(sourceFile, keyframeCache, gsapAnimations) {
|
|
48916
49059
|
const sfPrefix = `${sourceFile}#`;
|
|
48917
49060
|
const ids = /* @__PURE__ */ new Set();
|
|
48918
|
-
for (const
|
|
48919
|
-
if (
|
|
49061
|
+
for (const key of [...keyframeCache.keys(), ...gsapAnimations.keys()]) {
|
|
49062
|
+
if (key.startsWith(sfPrefix)) ids.add(key.slice(sfPrefix.length));
|
|
48920
49063
|
}
|
|
48921
49064
|
if (sourceFile !== "index.html") return ids;
|
|
48922
|
-
for (const [
|
|
48923
|
-
const hash =
|
|
48924
|
-
const id =
|
|
48925
|
-
if (hash > 0 && !
|
|
49065
|
+
for (const [key, entry3] of keyframeCache) {
|
|
49066
|
+
const hash = key.indexOf("#");
|
|
49067
|
+
const id = key.slice(hash + 1);
|
|
49068
|
+
if (hash > 0 && !key.startsWith(sfPrefix) && keyframeCache.get(sfPrefix + id) === entry3) {
|
|
48926
49069
|
ids.delete(id);
|
|
48927
49070
|
}
|
|
48928
49071
|
}
|
|
@@ -48932,13 +49075,13 @@ function pruneKeyframeCacheToFiles(files) {
|
|
|
48932
49075
|
const keep = new Set(files);
|
|
48933
49076
|
const { keyframeCache, gsapAnimations } = usePlayerStore.getState();
|
|
48934
49077
|
const stale = /* @__PURE__ */ new Map();
|
|
48935
|
-
for (const
|
|
48936
|
-
const hash =
|
|
49078
|
+
for (const key of [...keyframeCache.keys(), ...gsapAnimations.keys()]) {
|
|
49079
|
+
const hash = key.indexOf("#");
|
|
48937
49080
|
if (hash < 0) continue;
|
|
48938
|
-
const sourceFile =
|
|
49081
|
+
const sourceFile = key.slice(0, hash);
|
|
48939
49082
|
if (keep.has(sourceFile)) continue;
|
|
48940
49083
|
const ids = stale.get(sourceFile) ?? /* @__PURE__ */ new Set();
|
|
48941
|
-
ids.add(
|
|
49084
|
+
ids.add(key.slice(hash + 1));
|
|
48942
49085
|
stale.set(sourceFile, ids);
|
|
48943
49086
|
}
|
|
48944
49087
|
publishKeyframeCache((draft) => {
|
|
@@ -48981,9 +49124,9 @@ function replaceKeyframeCacheForFile(sourceFile, entries, animationsByElement) {
|
|
|
48981
49124
|
}
|
|
48982
49125
|
function writeGsapAnimationsForElement(sourceFile, elementId2, animations) {
|
|
48983
49126
|
publishKeyframeCache((draft) => {
|
|
48984
|
-
for (const
|
|
48985
|
-
if (animations) draft.gsapAnimations.set(
|
|
48986
|
-
else draft.gsapAnimations.delete(
|
|
49127
|
+
for (const key of elementCacheKeys(sourceFile, elementId2)) {
|
|
49128
|
+
if (animations) draft.gsapAnimations.set(key, animations);
|
|
49129
|
+
else draft.gsapAnimations.delete(key);
|
|
48987
49130
|
}
|
|
48988
49131
|
});
|
|
48989
49132
|
}
|
|
@@ -49377,10 +49520,10 @@ async function materializeIfDynamic(anim, iframe, commitMutation, selection) {
|
|
|
49377
49520
|
void selection;
|
|
49378
49521
|
throw new GsapEditBlockedError("source-uneditable", "geometry-unresolved-source");
|
|
49379
49522
|
}
|
|
49380
|
-
function stepBlock([
|
|
49381
|
-
if (
|
|
49382
|
-
if (/^on[A-Z]/.test(
|
|
49383
|
-
if (isTweenConfigKey(
|
|
49523
|
+
function stepBlock([key, value]) {
|
|
49524
|
+
if (key === "delay") return "array-step-delay";
|
|
49525
|
+
if (/^on[A-Z]/.test(key)) return "array-step-callback";
|
|
49526
|
+
if (isTweenConfigKey(key)) return "array-step-config";
|
|
49384
49527
|
if (typeof value === "number") return null;
|
|
49385
49528
|
return STEP_VALUE_BLOCKS.find(([pattern]) => pattern.test(value))?.[1] ?? null;
|
|
49386
49529
|
}
|
|
@@ -50240,7 +50383,7 @@ async function commitWholePropertyOffset(selection, anim, newValues, currentPct,
|
|
|
50240
50383
|
const ts = resolveTweenStart(effectiveAnim);
|
|
50241
50384
|
const td = resolveTweenDuration(effectiveAnim);
|
|
50242
50385
|
const keys = Object.keys(newValues);
|
|
50243
|
-
const at = (props,
|
|
50386
|
+
const at = (props, key) => typeof props[key] === "number" ? props[key] : KEYFRAME_PROPERTY_DEFAULTS[key] ?? 0;
|
|
50244
50387
|
const kfs = effectiveAnim.keyframes?.keyframes ?? synthesizeFlatTweenKeyframes(effectiveAnim)?.keyframes;
|
|
50245
50388
|
if (!kfs || kfs.length === 0) {
|
|
50246
50389
|
await callbacks.commitMutation(
|
|
@@ -50255,9 +50398,9 @@ async function commitWholePropertyOffset(selection, anim, newValues, currentPct,
|
|
|
50255
50398
|
);
|
|
50256
50399
|
const shifted = kfs.map((kf) => {
|
|
50257
50400
|
const properties = { ...kf.properties };
|
|
50258
|
-
for (const
|
|
50259
|
-
properties[
|
|
50260
|
-
at(properties,
|
|
50401
|
+
for (const key of keys) {
|
|
50402
|
+
properties[key] = roundTo3(
|
|
50403
|
+
at(properties, key) + (newValues[key] - at(nearest.properties, key))
|
|
50261
50404
|
);
|
|
50262
50405
|
}
|
|
50263
50406
|
return { percentage: kf.percentage, properties, ...kf.ease ? { ease: kf.ease } : {} };
|
|
@@ -50964,9 +51107,9 @@ var SnapToolbar = memo32(function SnapToolbar2() {
|
|
|
50964
51107
|
[
|
|
50965
51108
|
["rulerVisible", "Ruler", Ruler],
|
|
50966
51109
|
["safeMarginsVisible", "Safe margins", FrameCorners]
|
|
50967
|
-
].map(([
|
|
50968
|
-
const visible =
|
|
50969
|
-
const toggle =
|
|
51110
|
+
].map(([key, label, Icon]) => {
|
|
51111
|
+
const visible = key === "rulerVisible" ? rulerVisible : safeMarginsVisible;
|
|
51112
|
+
const toggle = key === "rulerVisible" ? actions.toggleRulers : actions.toggleSafeMargins;
|
|
50970
51113
|
return /* @__PURE__ */ jsx117(
|
|
50971
51114
|
"button",
|
|
50972
51115
|
{
|
|
@@ -50974,14 +51117,14 @@ var SnapToolbar = memo32(function SnapToolbar2() {
|
|
|
50974
51117
|
className: `rounded-md p-1.5 transition-colors active:scale-[0.95] ${visible ? "bg-studio-accent/20 text-accent-ink" : "bg-black/40 text-white/60 hover:bg-black/60 hover:text-white/80"}`,
|
|
50975
51118
|
onClick: () => {
|
|
50976
51119
|
toggle();
|
|
50977
|
-
trackPreviewFeatureUsed(
|
|
51120
|
+
trackPreviewFeatureUsed(key === "rulerVisible" ? "ruler" : "safe_margins", "button");
|
|
50978
51121
|
},
|
|
50979
51122
|
title: `${label} ${visible ? "on" : "off"}`,
|
|
50980
51123
|
"aria-label": `Toggle ${label.toLowerCase()}`,
|
|
50981
51124
|
"aria-pressed": visible,
|
|
50982
51125
|
children: /* @__PURE__ */ jsx117(Icon, { size: 16, weight: visible ? "fill" : "regular" })
|
|
50983
51126
|
},
|
|
50984
|
-
|
|
51127
|
+
key
|
|
50985
51128
|
);
|
|
50986
51129
|
}),
|
|
50987
51130
|
/* @__PURE__ */ jsx117(
|
|
@@ -51320,21 +51463,6 @@ import { isXYPositionWrite, PROPERTY_GROUPS } from "@hyperframes/parsers/gsap-co
|
|
|
51320
51463
|
|
|
51321
51464
|
// src/hooks/gsapRuntimeReaders.ts
|
|
51322
51465
|
import { classifyPropertyGroup as classifyPropertyGroup3 } from "@hyperframes/core/gsap-parser";
|
|
51323
|
-
import {
|
|
51324
|
-
COLOR_GRADING_SOURCE_HIDDEN_ATTR as COLOR_GRADING_SOURCE_HIDDEN_ATTR3,
|
|
51325
|
-
HF_COLOR_GRADING_CANVAS_ID_PREFIX
|
|
51326
|
-
} from "@hyperframes/core/color-grading";
|
|
51327
|
-
function readLiveGsapValue(gsap3, el, prop) {
|
|
51328
|
-
if (prop === "opacity" && el.getAttribute(COLOR_GRADING_SOURCE_HIDDEN_ATTR3) != null && el.id) {
|
|
51329
|
-
const canvas = el.ownerDocument.getElementById(HF_COLOR_GRADING_CANVAS_ID_PREFIX + el.id);
|
|
51330
|
-
const win = el.ownerDocument.defaultView;
|
|
51331
|
-
if (canvas && win) {
|
|
51332
|
-
const val = Number(win.getComputedStyle(canvas).opacity);
|
|
51333
|
-
if (Number.isFinite(val)) return val;
|
|
51334
|
-
}
|
|
51335
|
-
}
|
|
51336
|
-
return Number(gsap3.getProperty(el, prop));
|
|
51337
|
-
}
|
|
51338
51466
|
function readGsapProperty(iframe, selector, prop) {
|
|
51339
51467
|
if (!selector) return null;
|
|
51340
51468
|
const gsap3 = getIframeGsap(iframe);
|
|
@@ -51342,7 +51470,7 @@ function readGsapProperty(iframe, selector, prop) {
|
|
|
51342
51470
|
const el = queryIframeElement(iframe, selector);
|
|
51343
51471
|
if (!el) return null;
|
|
51344
51472
|
try {
|
|
51345
|
-
const val =
|
|
51473
|
+
const val = Number(gsap3.getProperty(el, prop));
|
|
51346
51474
|
if (!Number.isFinite(val)) return null;
|
|
51347
51475
|
return POSITION_PROPS.has(prop) ? Math.round(val) : roundTo3(val);
|
|
51348
51476
|
} catch {
|
|
@@ -51375,7 +51503,7 @@ function readAllAnimatedProperties(iframe, selector, anim, group) {
|
|
|
51375
51503
|
const inGroup = (p) => !group || classifyPropertyGroup3(p) === group;
|
|
51376
51504
|
const groupedPropKeys = new Set([...propKeys].filter(inGroup));
|
|
51377
51505
|
for (const prop of groupedPropKeys) {
|
|
51378
|
-
const val =
|
|
51506
|
+
const val = Number(gsap3.getProperty(el, prop));
|
|
51379
51507
|
if (Number.isFinite(val)) {
|
|
51380
51508
|
result[prop] = POSITION_PROPS.has(prop) ? Math.round(val) : roundTo3(val);
|
|
51381
51509
|
}
|
|
@@ -51881,14 +52009,14 @@ function hasAnimations(value) {
|
|
|
51881
52009
|
var inFlightParses = /* @__PURE__ */ new Map();
|
|
51882
52010
|
var parseCacheKey = (projectId, sourceFile) => `${projectId}|${sourceFile}`;
|
|
51883
52011
|
function fetchParsedAnimations(projectId, sourceFile, options = {}) {
|
|
51884
|
-
const
|
|
51885
|
-
if (options.fresh) inFlightParses.delete(
|
|
51886
|
-
const inFlight = inFlightParses.get(
|
|
52012
|
+
const key = parseCacheKey(projectId, sourceFile);
|
|
52013
|
+
if (options.fresh) inFlightParses.delete(key);
|
|
52014
|
+
const inFlight = inFlightParses.get(key);
|
|
51887
52015
|
if (inFlight) return inFlight;
|
|
51888
52016
|
const request2 = requestParsedAnimations(projectId, sourceFile).finally(() => {
|
|
51889
|
-
if (inFlightParses.get(
|
|
52017
|
+
if (inFlightParses.get(key) === request2) inFlightParses.delete(key);
|
|
51890
52018
|
});
|
|
51891
|
-
inFlightParses.set(
|
|
52019
|
+
inFlightParses.set(key, request2);
|
|
51892
52020
|
return request2;
|
|
51893
52021
|
}
|
|
51894
52022
|
async function requestParsedAnimations(projectId, sourceFile) {
|
|
@@ -52066,7 +52194,7 @@ function useGsapAnimationsForElement(projectId, sourceFile, target, version, ifr
|
|
|
52066
52194
|
if (allKeyframes.length === 0) {
|
|
52067
52195
|
const { keyframeCache } = usePlayerStore.getState();
|
|
52068
52196
|
const hasCached = elementCacheKeys(sourceFile, elementId2).some(
|
|
52069
|
-
(
|
|
52197
|
+
(key) => keyframeCache.has(key)
|
|
52070
52198
|
);
|
|
52071
52199
|
if (!hasCached) clearKeyframeCacheForElement(sourceFile, elementId2);
|
|
52072
52200
|
return;
|
|
@@ -52079,8 +52207,8 @@ function useGsapAnimationsForElement(projectId, sourceFile, target, version, ifr
|
|
|
52079
52207
|
...easeEach ? { easeEach } : {}
|
|
52080
52208
|
};
|
|
52081
52209
|
publishKeyframeCache((draft) => {
|
|
52082
|
-
for (const
|
|
52083
|
-
draft.keyframeCache.set(
|
|
52210
|
+
for (const key of elementCacheKeys(sourceFile, elementId2)) {
|
|
52211
|
+
draft.keyframeCache.set(key, merged);
|
|
52084
52212
|
}
|
|
52085
52213
|
});
|
|
52086
52214
|
}, [elementId2, sourceFile, animations, domClipChildrenKey]);
|
|
@@ -52142,7 +52270,7 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
|
|
|
52142
52270
|
publishKeyframeCache((draft) => {
|
|
52143
52271
|
for (const [id, data] of scanned) {
|
|
52144
52272
|
const keys = elementCacheKeys(sf, id);
|
|
52145
|
-
if (keys.some((
|
|
52273
|
+
if (keys.some((key) => draft.keyframeCache.has(key))) continue;
|
|
52146
52274
|
const isPosOnly = data.keyframes.length === 1 && Object.keys(data.keyframes[0].properties).every((k) => k === "x" || k === "y");
|
|
52147
52275
|
if (isPosOnly) {
|
|
52148
52276
|
continue;
|
|
@@ -52152,7 +52280,7 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
|
|
|
52152
52280
|
keyframes: data.keyframes,
|
|
52153
52281
|
...data.easeEach ? { easeEach: data.easeEach } : {}
|
|
52154
52282
|
};
|
|
52155
|
-
for (const
|
|
52283
|
+
for (const key of keys) draft.keyframeCache.set(key, entry3);
|
|
52156
52284
|
}
|
|
52157
52285
|
});
|
|
52158
52286
|
runtimeScanDoneRef.current = `kf-cache:${projectId}:${sf}:${version}`;
|
|
@@ -52283,8 +52411,8 @@ function useTimelineEditCallbacks({
|
|
|
52283
52411
|
const { gsapAnimations } = usePlayerStore.getState();
|
|
52284
52412
|
const { sourceFile, domId } = splitTimelineElementKey(elementKey3);
|
|
52285
52413
|
const scope = sourceFile ?? activeCompPath ?? "index.html";
|
|
52286
|
-
for (const
|
|
52287
|
-
const animations = gsapAnimations.get(
|
|
52414
|
+
for (const key of elementCacheKeys(scope, domId)) {
|
|
52415
|
+
const animations = gsapAnimations.get(key);
|
|
52288
52416
|
if (animations) return animations;
|
|
52289
52417
|
}
|
|
52290
52418
|
return [];
|
|
@@ -53499,8 +53627,8 @@ function transformReceipt(request2, initial, box, observations, failure2) {
|
|
|
53499
53627
|
const unchanged = Object.fromEntries(
|
|
53500
53628
|
observations.flatMap((item) => {
|
|
53501
53629
|
if (!item.unchangedReason) return [];
|
|
53502
|
-
const
|
|
53503
|
-
return [[
|
|
53630
|
+
const key = item.operation === "rotate" ? "rotation" : item.operation;
|
|
53631
|
+
return [[key, item.unchangedReason]];
|
|
53504
53632
|
})
|
|
53505
53633
|
);
|
|
53506
53634
|
const value = {
|
|
@@ -53712,14 +53840,14 @@ async function studioAddKeyframe(deps, input, signal = new AbortController().sig
|
|
|
53712
53840
|
);
|
|
53713
53841
|
}
|
|
53714
53842
|
const properties = {};
|
|
53715
|
-
for (const [
|
|
53843
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
53716
53844
|
if (isRawGsapExpression(value)) {
|
|
53717
53845
|
return preDispatchFailure2(
|
|
53718
53846
|
"add-keyframe",
|
|
53719
53847
|
toolFailure("invalid", "raw JavaScript expressions are not accepted")
|
|
53720
53848
|
);
|
|
53721
53849
|
}
|
|
53722
|
-
if (typeof value === "number" || typeof value === "string") properties[
|
|
53850
|
+
if (typeof value === "number" || typeof value === "string") properties[key] = value;
|
|
53723
53851
|
}
|
|
53724
53852
|
if (Object.keys(properties).length === 0) {
|
|
53725
53853
|
return preDispatchFailure2(
|
|
@@ -53993,12 +54121,12 @@ function buildStudioTools(depsRef) {
|
|
|
53993
54121
|
}
|
|
53994
54122
|
];
|
|
53995
54123
|
}
|
|
53996
|
-
function readStringInput(input,
|
|
53997
|
-
const value = Reflect.get(input,
|
|
54124
|
+
function readStringInput(input, key) {
|
|
54125
|
+
const value = Reflect.get(input, key);
|
|
53998
54126
|
return typeof value === "string" ? value : "";
|
|
53999
54127
|
}
|
|
54000
|
-
function readNumberInput(input,
|
|
54001
|
-
const value = Reflect.get(input,
|
|
54128
|
+
function readNumberInput(input, key) {
|
|
54129
|
+
const value = Reflect.get(input, key);
|
|
54002
54130
|
return typeof value === "number" ? value : Number.NaN;
|
|
54003
54131
|
}
|
|
54004
54132
|
function useStudioAgentTools(deps) {
|
|
@@ -54343,14 +54471,14 @@ function DockStripActions({
|
|
|
54343
54471
|
panels,
|
|
54344
54472
|
isGroupActive
|
|
54345
54473
|
}) {
|
|
54346
|
-
const
|
|
54474
|
+
const subscribe2 = useCallback75(
|
|
54347
54475
|
(onChange) => {
|
|
54348
54476
|
const subscription = containerApi.onDidMaximizedGroupChange(onChange);
|
|
54349
54477
|
return () => subscription.dispose();
|
|
54350
54478
|
},
|
|
54351
54479
|
[containerApi]
|
|
54352
54480
|
);
|
|
54353
|
-
const maximized = useSyncExternalStore9(
|
|
54481
|
+
const maximized = useSyncExternalStore9(subscribe2, () => api.isMaximized());
|
|
54354
54482
|
const openPanels = useDockLayoutStore((state) => state.openPanels);
|
|
54355
54483
|
const togglePanel = useDockLayoutStore((state) => state.togglePanel);
|
|
54356
54484
|
const resetLayout = useDockLayoutStore((state) => state.resetLayout);
|
|
@@ -54433,14 +54561,14 @@ var TAB_ICONS = {
|
|
|
54433
54561
|
motionBlur: Aperture
|
|
54434
54562
|
};
|
|
54435
54563
|
function DockTab({ api }) {
|
|
54436
|
-
const
|
|
54564
|
+
const subscribe2 = useCallback76(
|
|
54437
54565
|
(onChange) => {
|
|
54438
54566
|
const subscription = api.onDidTitleChange(onChange);
|
|
54439
54567
|
return () => subscription.dispose();
|
|
54440
54568
|
},
|
|
54441
54569
|
[api]
|
|
54442
54570
|
);
|
|
54443
|
-
const title = useSyncExternalStore10(
|
|
54571
|
+
const title = useSyncExternalStore10(subscribe2, () => api.title ?? "");
|
|
54444
54572
|
const TypeIcon = isPanelId(api.id) ? TAB_ICONS[api.id] : null;
|
|
54445
54573
|
return /* @__PURE__ */ jsxs86("div", { className: "hf-dock-tab", children: [
|
|
54446
54574
|
TypeIcon ? /* @__PURE__ */ jsx122(TypeIcon, { className: "hf-dock-tab-icon", size: 14, "aria-hidden": true }) : null,
|
|
@@ -55449,8 +55577,9 @@ function renderAudioClip(el, pid, sessionEpoch, labelColor, context, labelInset)
|
|
|
55449
55577
|
const encodedRelative = srcRelative ? encodePreviewPath(srcRelative) : null;
|
|
55450
55578
|
const waveformUrl = encodedRelative ? buildProjectApiPath(pid, `/waveform/${encodedRelative}`) : void 0;
|
|
55451
55579
|
const { start, end } = trimFractions(el);
|
|
55580
|
+
const serverPeaksOrShortFile = waveformUrl !== void 0 || fitsBeatAnalysis(el);
|
|
55452
55581
|
const waveform = createElement(AudioWaveform, {
|
|
55453
|
-
audioUrl,
|
|
55582
|
+
audioUrl: serverPeaksOrShortFile ? audioUrl : "",
|
|
55454
55583
|
waveformUrl,
|
|
55455
55584
|
label: "",
|
|
55456
55585
|
labelColor,
|
|
@@ -55864,11 +55993,11 @@ function trackDesignInput(descriptor) {
|
|
|
55864
55993
|
const section = slugifyDesignInput(descriptor.section) || "unknown";
|
|
55865
55994
|
const name = slugifyDesignInput(descriptor.name);
|
|
55866
55995
|
const control = descriptor.control || "unknown";
|
|
55867
|
-
const
|
|
55996
|
+
const key = `${descriptor.ui}:${section}:${control}:${name || "unnamed"}`;
|
|
55868
55997
|
const t2 = now();
|
|
55869
|
-
const last = lastFiredByKey.get(
|
|
55998
|
+
const last = lastFiredByKey.get(key);
|
|
55870
55999
|
if (last !== void 0 && t2 - last < COALESCE_WINDOW_MS) return;
|
|
55871
|
-
lastFiredByKey.set(
|
|
56000
|
+
lastFiredByKey.set(key, t2);
|
|
55872
56001
|
trackStudioEvent("design_input", {
|
|
55873
56002
|
ui: descriptor.ui,
|
|
55874
56003
|
section,
|
|
@@ -56180,9 +56309,9 @@ function uniqueFontFamilies(values, seen = /* @__PURE__ */ new Set()) {
|
|
|
56180
56309
|
return values.reduce((result, value) => {
|
|
56181
56310
|
const family = value.trim();
|
|
56182
56311
|
if (!family) return result;
|
|
56183
|
-
const
|
|
56184
|
-
if (seen.has(
|
|
56185
|
-
seen.add(
|
|
56312
|
+
const key = family.toLowerCase();
|
|
56313
|
+
if (seen.has(key)) return result;
|
|
56314
|
+
seen.add(key);
|
|
56186
56315
|
result.push(family);
|
|
56187
56316
|
return result;
|
|
56188
56317
|
}, []);
|
|
@@ -56192,9 +56321,9 @@ function uniqueFontOptions(values) {
|
|
|
56192
56321
|
return values.reduce((result, value) => {
|
|
56193
56322
|
const family = value.family.trim();
|
|
56194
56323
|
if (!family) return result;
|
|
56195
|
-
const
|
|
56196
|
-
if (seen.has(
|
|
56197
|
-
seen.add(
|
|
56324
|
+
const key = family.toLowerCase();
|
|
56325
|
+
if (seen.has(key)) return result;
|
|
56326
|
+
seen.add(key);
|
|
56198
56327
|
result.push({ family, source: value.source });
|
|
56199
56328
|
return result;
|
|
56200
56329
|
}, []);
|
|
@@ -56630,9 +56759,9 @@ function useInspectorGestureDraft({
|
|
|
56630
56759
|
|
|
56631
56760
|
// src/components/editor/propertyPanelCommitField.tsx
|
|
56632
56761
|
import { jsx as jsx132 } from "react/jsx-runtime";
|
|
56633
|
-
function arrowDirection(
|
|
56634
|
-
if (
|
|
56635
|
-
if (
|
|
56762
|
+
function arrowDirection(key) {
|
|
56763
|
+
if (key === "ArrowUp") return 1;
|
|
56764
|
+
if (key === "ArrowDown") return -1;
|
|
56636
56765
|
return null;
|
|
56637
56766
|
}
|
|
56638
56767
|
function CommitField({
|
|
@@ -57946,21 +58075,21 @@ function colorGradingWithLut(grading, src, intensity = 1) {
|
|
|
57946
58075
|
lut: src ? { src, intensity } : null
|
|
57947
58076
|
};
|
|
57948
58077
|
}
|
|
57949
|
-
function colorGradingWithDetail(grading,
|
|
58078
|
+
function colorGradingWithDetail(grading, key, value) {
|
|
57950
58079
|
return {
|
|
57951
58080
|
...grading,
|
|
57952
58081
|
intensity: visibleColorGradingIntensity(grading),
|
|
57953
|
-
details: { ...grading.details, [
|
|
58082
|
+
details: { ...grading.details, [key]: value }
|
|
57954
58083
|
};
|
|
57955
58084
|
}
|
|
57956
58085
|
function colorGradingWithIntensity(grading, intensity) {
|
|
57957
58086
|
return { ...grading, intensity };
|
|
57958
58087
|
}
|
|
57959
|
-
function colorGradingWithAdjust(grading,
|
|
58088
|
+
function colorGradingWithAdjust(grading, key, value) {
|
|
57960
58089
|
return {
|
|
57961
58090
|
...grading,
|
|
57962
58091
|
intensity: visibleColorGradingIntensity(grading),
|
|
57963
|
-
adjust: { ...grading.adjust, [
|
|
58092
|
+
adjust: { ...grading.adjust, [key]: value }
|
|
57964
58093
|
};
|
|
57965
58094
|
}
|
|
57966
58095
|
async function importFirstLut(files, onImportAssets) {
|
|
@@ -60611,7 +60740,7 @@ function VariablePromoteProvider({
|
|
|
60611
60740
|
}
|
|
60612
60741
|
function useVariablePromoteChannel(channel) {
|
|
60613
60742
|
const ctx3 = useContext14(VariablePromoteContext);
|
|
60614
|
-
const
|
|
60743
|
+
const key = channel.kind === "style" ? `style:${channel.prop}` : channel.kind;
|
|
60615
60744
|
return useMemo56(() => {
|
|
60616
60745
|
if (!ctx3 || !ctx3.session || !ctx3.selection?.hfId) return null;
|
|
60617
60746
|
const { session, selection, actions, declarations, persist: persist2, onPersistError } = ctx3;
|
|
@@ -60641,7 +60770,7 @@ function useVariablePromoteChannel(channel) {
|
|
|
60641
60770
|
).catch(onPersistError);
|
|
60642
60771
|
}
|
|
60643
60772
|
};
|
|
60644
|
-
}, [ctx3,
|
|
60773
|
+
}, [ctx3, key]);
|
|
60645
60774
|
}
|
|
60646
60775
|
|
|
60647
60776
|
// src/components/editor/PromotableControl.tsx
|
|
@@ -63587,10 +63716,10 @@ var ANIMATION_META_LABELS = {
|
|
|
63587
63716
|
easeEach: { control: "select", name: "Speed" }
|
|
63588
63717
|
};
|
|
63589
63718
|
function trackAnimationMetaUpdate(track2, updates) {
|
|
63590
|
-
for (const
|
|
63591
|
-
const mapped = ANIMATION_META_LABELS[
|
|
63719
|
+
for (const key of Object.keys(updates)) {
|
|
63720
|
+
const mapped = ANIMATION_META_LABELS[key];
|
|
63592
63721
|
if (mapped) track2(mapped.control, mapped.name);
|
|
63593
|
-
else track2("select",
|
|
63722
|
+
else track2("select", key);
|
|
63594
63723
|
}
|
|
63595
63724
|
}
|
|
63596
63725
|
function withTrackedGsapAnimationCallbacks(callbacks, track2) {
|
|
@@ -64955,9 +65084,9 @@ function FlatGroupHeader({
|
|
|
64955
65084
|
}
|
|
64956
65085
|
);
|
|
64957
65086
|
}
|
|
64958
|
-
function sliderKeyTarget(
|
|
64959
|
-
if (
|
|
64960
|
-
if (
|
|
65087
|
+
function sliderKeyTarget(key, current2, min, max, step) {
|
|
65088
|
+
if (key === "Home") return min;
|
|
65089
|
+
if (key === "End") return max;
|
|
64961
65090
|
const deltas = {
|
|
64962
65091
|
ArrowLeft: -step,
|
|
64963
65092
|
ArrowDown: -step,
|
|
@@ -64966,7 +65095,7 @@ function sliderKeyTarget(key2, current2, min, max, step) {
|
|
|
64966
65095
|
PageDown: -step * 10,
|
|
64967
65096
|
PageUp: step * 10
|
|
64968
65097
|
};
|
|
64969
|
-
const delta = deltas[
|
|
65098
|
+
const delta = deltas[key];
|
|
64970
65099
|
if (delta === void 0) return null;
|
|
64971
65100
|
return Math.max(min, Math.min(max, current2 + delta));
|
|
64972
65101
|
}
|
|
@@ -66878,11 +67007,11 @@ function FxParams({
|
|
|
66878
67007
|
onRemoveAutomation
|
|
66879
67008
|
}) {
|
|
66880
67009
|
const set = useCallback92(
|
|
66881
|
-
(
|
|
67010
|
+
(key, value) => onChange({ ...params, [key]: value }),
|
|
66882
67011
|
[params, onChange]
|
|
66883
67012
|
);
|
|
66884
67013
|
const commit2 = useCallback92(
|
|
66885
|
-
(
|
|
67014
|
+
(key, value) => onCommit?.({ ...params, [key]: value }),
|
|
66886
67015
|
[params, onCommit]
|
|
66887
67016
|
);
|
|
66888
67017
|
return /* @__PURE__ */ jsx171("div", { className: "hf-fx-params space-y-0.5 border-t border-panel-border-input px-1.5 py-1.5", children: def.params.map((p) => {
|
|
@@ -67669,21 +67798,21 @@ function FxNodeParams({
|
|
|
67669
67798
|
onChange: (params) => onPreview(index2, params),
|
|
67670
67799
|
onCommit: (next) => {
|
|
67671
67800
|
const before = node.params ?? defaultAudioFxParams3(node.type);
|
|
67672
|
-
for (const [
|
|
67673
|
-
if (before[
|
|
67801
|
+
for (const [key, value] of Object.entries(next)) {
|
|
67802
|
+
if (before[key] === value) continue;
|
|
67674
67803
|
if (typeof value !== "number" && typeof value !== "string") continue;
|
|
67675
|
-
trackParamCommitted(node.type,
|
|
67676
|
-
trackInput(typeof value === "number" ? "slider" : "select",
|
|
67804
|
+
trackParamCommitted(node.type, key, value, "details", { trackKind });
|
|
67805
|
+
trackInput(typeof value === "number" ? "slider" : "select", key);
|
|
67677
67806
|
}
|
|
67678
67807
|
onUpdate(index2, { params: next });
|
|
67679
67808
|
},
|
|
67680
67809
|
automatedKeys: automatedKeysOf(node, def.params, automatedTargets),
|
|
67681
|
-
onAutomate: nodeId && onAutomateParam ? (
|
|
67682
|
-
onAutomateParam(nodeId,
|
|
67810
|
+
onAutomate: nodeId && onAutomateParam ? (key) => {
|
|
67811
|
+
onAutomateParam(nodeId, key);
|
|
67683
67812
|
trackInput("button", "automate-param");
|
|
67684
67813
|
} : void 0,
|
|
67685
|
-
onRemoveAutomation: nodeId && onRemoveParamAutomation ? (
|
|
67686
|
-
onRemoveParamAutomation(nodeId,
|
|
67814
|
+
onRemoveAutomation: nodeId && onRemoveParamAutomation ? (key) => {
|
|
67815
|
+
onRemoveParamAutomation(nodeId, key);
|
|
67687
67816
|
trackInput("button", "remove-param-automation");
|
|
67688
67817
|
} : void 0
|
|
67689
67818
|
}
|
|
@@ -69122,7 +69251,7 @@ import { timeAtSourceTime as timeAtSourceTime2 } from "@hyperframes/core/speed-r
|
|
|
69122
69251
|
var DECODE_SAMPLE_RATE2 = 48e3;
|
|
69123
69252
|
function useFxLevelling(element, chain, automation, onSetAttributeQuiet, onSetAttributeLive, setAnalysing) {
|
|
69124
69253
|
const decoded = useRef109(null);
|
|
69125
|
-
const
|
|
69254
|
+
const decodeTrack2 = async () => {
|
|
69126
69255
|
const el = element.element;
|
|
69127
69256
|
const src = el?.getAttribute("src");
|
|
69128
69257
|
const doc = el?.ownerDocument;
|
|
@@ -69154,7 +69283,7 @@ function useFxLevelling(element, chain, automation, onSetAttributeQuiet, onSetAt
|
|
|
69154
69283
|
const runLeveller = async () => {
|
|
69155
69284
|
setAnalysing(true);
|
|
69156
69285
|
try {
|
|
69157
|
-
const audio = await
|
|
69286
|
+
const audio = await decodeTrack2();
|
|
69158
69287
|
if (!audio) return;
|
|
69159
69288
|
const result = measureLevelling(audio);
|
|
69160
69289
|
if (!result) return;
|
|
@@ -69186,7 +69315,7 @@ function useFxLevelling(element, chain, automation, onSetAttributeQuiet, onSetAt
|
|
|
69186
69315
|
const startLevelAudition = async (run) => {
|
|
69187
69316
|
setAuditioningLevel(true);
|
|
69188
69317
|
try {
|
|
69189
|
-
const audio = await
|
|
69318
|
+
const audio = await decodeTrack2();
|
|
69190
69319
|
if (!audio || run !== auditionRun.current) return;
|
|
69191
69320
|
const result = measureLevelling(audio);
|
|
69192
69321
|
if (!result || run !== auditionRun.current) return;
|
|
@@ -70183,19 +70312,19 @@ function movePoint(points, index2, input, output, tab) {
|
|
|
70183
70312
|
return { points: next, selected: next.indexOf(moved) };
|
|
70184
70313
|
}
|
|
70185
70314
|
var ARROW_KEYS = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"];
|
|
70186
|
-
function isArrowKey(
|
|
70187
|
-
return ARROW_KEYS.includes(
|
|
70315
|
+
function isArrowKey(key) {
|
|
70316
|
+
return ARROW_KEYS.includes(key);
|
|
70188
70317
|
}
|
|
70189
70318
|
function curveOutputStep(tab, large) {
|
|
70190
70319
|
if (tab.kind === "rgb") return large ? 0.05 : 0.01;
|
|
70191
70320
|
if (tab.key === "hueVsHue") return large ? 10 : 1;
|
|
70192
70321
|
return large ? 0.1 : 0.01;
|
|
70193
70322
|
}
|
|
70194
|
-
function keyboardPointPosition(point,
|
|
70323
|
+
function keyboardPointPosition(point, key, tab, large) {
|
|
70195
70324
|
const inputStep = tab.kind === "rgb" ? large ? 0.05 : 0.01 : large ? 10 : 1;
|
|
70196
70325
|
const outputStep = curveOutputStep(tab, large);
|
|
70197
|
-
const inputDelta =
|
|
70198
|
-
const outputDelta =
|
|
70326
|
+
const inputDelta = key === "ArrowLeft" ? -inputStep : key === "ArrowRight" ? inputStep : 0;
|
|
70327
|
+
const outputDelta = key === "ArrowDown" ? -outputStep : key === "ArrowUp" ? outputStep : 0;
|
|
70199
70328
|
return { input: point[0] + inputDelta, output: point[1] + outputDelta };
|
|
70200
70329
|
}
|
|
70201
70330
|
function CurveGraph({
|
|
@@ -70232,11 +70361,11 @@ function CurveGraph({
|
|
|
70232
70361
|
onPreview(inserted.points, inserted.selected);
|
|
70233
70362
|
onSettle();
|
|
70234
70363
|
};
|
|
70235
|
-
const moveSelectedByKeyboard = (
|
|
70364
|
+
const moveSelectedByKeyboard = (key, large) => {
|
|
70236
70365
|
if (selectedIndex === null) return false;
|
|
70237
70366
|
const selected = points[selectedIndex];
|
|
70238
70367
|
if (!selected) return false;
|
|
70239
|
-
const position = keyboardPointPosition(selected,
|
|
70368
|
+
const position = keyboardPointPosition(selected, key, tab, large);
|
|
70240
70369
|
const moved = movePoint(points, selectedIndex, position.input, position.output, tab);
|
|
70241
70370
|
onBegin();
|
|
70242
70371
|
onPreview(moved.points, moved.selected);
|
|
@@ -70741,16 +70870,16 @@ function rgbToHsv2(red, green, blue) {
|
|
|
70741
70870
|
value: max
|
|
70742
70871
|
};
|
|
70743
70872
|
}
|
|
70744
|
-
function colorGradingSecondaryMask(red, green, blue,
|
|
70873
|
+
function colorGradingSecondaryMask(red, green, blue, key) {
|
|
70745
70874
|
const hsv = rgbToHsv2(red / BYTE_MAX, green / BYTE_MAX, blue / BYTE_MAX);
|
|
70746
70875
|
return calculateHfColorGradingSecondaryMask(
|
|
70747
70876
|
hsv.hue,
|
|
70748
70877
|
hsv.saturation,
|
|
70749
70878
|
rec709Luma(red / BYTE_MAX, green / BYTE_MAX, blue / BYTE_MAX),
|
|
70750
|
-
|
|
70879
|
+
key
|
|
70751
70880
|
);
|
|
70752
70881
|
}
|
|
70753
|
-
function buildColorGradingSecondaryMatte(pixels, width, height,
|
|
70882
|
+
function buildColorGradingSecondaryMatte(pixels, width, height, key) {
|
|
70754
70883
|
const matte = new Uint8ClampedArray(width * height * 4);
|
|
70755
70884
|
for (let offset = 0; offset < pixels.length; offset += 4) {
|
|
70756
70885
|
const alpha = pixels[offset + 3] ?? 0;
|
|
@@ -70758,7 +70887,7 @@ function buildColorGradingSecondaryMatte(pixels, width, height, key2) {
|
|
|
70758
70887
|
pixels[offset] ?? 0,
|
|
70759
70888
|
pixels[offset + 1] ?? 0,
|
|
70760
70889
|
pixels[offset + 2] ?? 0,
|
|
70761
|
-
|
|
70890
|
+
key
|
|
70762
70891
|
);
|
|
70763
70892
|
const value = Math.round(mask * BYTE_MAX);
|
|
70764
70893
|
matte[offset] = value;
|
|
@@ -71333,14 +71462,14 @@ function PropertyPanelColorSecondary({
|
|
|
71333
71462
|
"aria-label": "Sample color from captured frame",
|
|
71334
71463
|
onClick: (event) => {
|
|
71335
71464
|
const pointer = event.detail === 0 ? [] : [event.clientX, event.clientY];
|
|
71336
|
-
const
|
|
71465
|
+
const key = sampleCapturedFrame(
|
|
71337
71466
|
samplePixels,
|
|
71338
71467
|
sampleFrame,
|
|
71339
71468
|
event.currentTarget,
|
|
71340
71469
|
...pointer
|
|
71341
71470
|
);
|
|
71342
|
-
if (!
|
|
71343
|
-
replaceSelected({ ...selected, key
|
|
71471
|
+
if (!key) return;
|
|
71472
|
+
replaceSelected({ ...selected, key });
|
|
71344
71473
|
setShowMatte(true);
|
|
71345
71474
|
},
|
|
71346
71475
|
children: /* @__PURE__ */ jsx189(
|
|
@@ -71418,10 +71547,10 @@ function PropertyPanelColorSecondary({
|
|
|
71418
71547
|
})
|
|
71419
71548
|
}
|
|
71420
71549
|
),
|
|
71421
|
-
["saturation", "luma"].flatMap((
|
|
71422
|
-
const label =
|
|
71423
|
-
const range = selected.key[
|
|
71424
|
-
const capability = SECONDARY_CAPABILITIES[
|
|
71550
|
+
["saturation", "luma"].flatMap((key) => {
|
|
71551
|
+
const label = key === "saturation" ? "Saturation" : "Luma";
|
|
71552
|
+
const range = selected.key[key];
|
|
71553
|
+
const capability = SECONDARY_CAPABILITIES[key];
|
|
71425
71554
|
return [
|
|
71426
71555
|
/* @__PURE__ */ jsx189(
|
|
71427
71556
|
FlatSlider,
|
|
@@ -71436,7 +71565,7 @@ function PropertyPanelColorSecondary({
|
|
|
71436
71565
|
...selected,
|
|
71437
71566
|
key: {
|
|
71438
71567
|
...selected.key,
|
|
71439
|
-
[
|
|
71568
|
+
[key]: {
|
|
71440
71569
|
...range,
|
|
71441
71570
|
min: Math.max(
|
|
71442
71571
|
capability.min.min,
|
|
@@ -71446,7 +71575,7 @@ function PropertyPanelColorSecondary({
|
|
|
71446
71575
|
}
|
|
71447
71576
|
})
|
|
71448
71577
|
},
|
|
71449
|
-
`${
|
|
71578
|
+
`${key}-min`
|
|
71450
71579
|
),
|
|
71451
71580
|
/* @__PURE__ */ jsx189(
|
|
71452
71581
|
FlatSlider,
|
|
@@ -71461,7 +71590,7 @@ function PropertyPanelColorSecondary({
|
|
|
71461
71590
|
...selected,
|
|
71462
71591
|
key: {
|
|
71463
71592
|
...selected.key,
|
|
71464
|
-
[
|
|
71593
|
+
[key]: {
|
|
71465
71594
|
...range,
|
|
71466
71595
|
max: Math.min(
|
|
71467
71596
|
capability.max.max,
|
|
@@ -71471,7 +71600,7 @@ function PropertyPanelColorSecondary({
|
|
|
71471
71600
|
}
|
|
71472
71601
|
})
|
|
71473
71602
|
},
|
|
71474
|
-
`${
|
|
71603
|
+
`${key}-max`
|
|
71475
71604
|
),
|
|
71476
71605
|
/* @__PURE__ */ jsx189(
|
|
71477
71606
|
FlatSlider,
|
|
@@ -71486,18 +71615,18 @@ function PropertyPanelColorSecondary({
|
|
|
71486
71615
|
...selected,
|
|
71487
71616
|
key: {
|
|
71488
71617
|
...selected.key,
|
|
71489
|
-
[
|
|
71618
|
+
[key]: { ...range, softness: value / PERCENT_SCALE }
|
|
71490
71619
|
}
|
|
71491
71620
|
})
|
|
71492
71621
|
},
|
|
71493
|
-
`${
|
|
71622
|
+
`${key}-softness`
|
|
71494
71623
|
)
|
|
71495
71624
|
];
|
|
71496
71625
|
}),
|
|
71497
71626
|
/* @__PURE__ */ jsx189("div", { className: "pt-1 text-[9px] font-semibold uppercase tracking-[0.12em] text-panel-text-5", children: "Correction" }),
|
|
71498
|
-
CORRECTION_CONTROLS.map(([
|
|
71499
|
-
const limit = SECONDARY_CAPABILITIES.correction[
|
|
71500
|
-
const value = selected.correction[
|
|
71627
|
+
CORRECTION_CONTROLS.map(([key, label, scale, suffix]) => {
|
|
71628
|
+
const limit = SECONDARY_CAPABILITIES.correction[key];
|
|
71629
|
+
const value = selected.correction[key] * scale;
|
|
71501
71630
|
return /* @__PURE__ */ jsx189(
|
|
71502
71631
|
FlatSlider,
|
|
71503
71632
|
{
|
|
@@ -71510,14 +71639,14 @@ function PropertyPanelColorSecondary({
|
|
|
71510
71639
|
displayValue: `${Math.round(value)}${suffix}`,
|
|
71511
71640
|
onCommit: (next) => replaceSelected({
|
|
71512
71641
|
...selected,
|
|
71513
|
-
correction: { ...selected.correction, [
|
|
71642
|
+
correction: { ...selected.correction, [key]: next / scale }
|
|
71514
71643
|
}),
|
|
71515
71644
|
onReset: () => replaceSelected({
|
|
71516
71645
|
...selected,
|
|
71517
|
-
correction: { ...selected.correction, [
|
|
71646
|
+
correction: { ...selected.correction, [key]: 0 }
|
|
71518
71647
|
})
|
|
71519
71648
|
},
|
|
71520
|
-
|
|
71649
|
+
key
|
|
71521
71650
|
);
|
|
71522
71651
|
})
|
|
71523
71652
|
] })
|
|
@@ -71562,13 +71691,13 @@ function wheelFromPointer(wheel, clientX, clientY, rect) {
|
|
|
71562
71691
|
amount: clampNumber(Math.hypot(x, y), WHEEL_CONTROLS.amount.min, WHEEL_CONTROLS.amount.max)
|
|
71563
71692
|
};
|
|
71564
71693
|
}
|
|
71565
|
-
function updateWheel(value,
|
|
71566
|
-
return { ...value, [
|
|
71694
|
+
function updateWheel(value, key, wheel) {
|
|
71695
|
+
return { ...value, [key]: wheel };
|
|
71567
71696
|
}
|
|
71568
|
-
function wheelFromKey(wheel,
|
|
71697
|
+
function wheelFromKey(wheel, key, large) {
|
|
71569
71698
|
const hueStep = large ? 10 : 1;
|
|
71570
71699
|
const amountStep = large ? 0.1 : 0.01;
|
|
71571
|
-
switch (
|
|
71700
|
+
switch (key) {
|
|
71572
71701
|
case "ArrowLeft":
|
|
71573
71702
|
return { ...wheel, hue: wrapHue(wheel.hue - hueStep) };
|
|
71574
71703
|
case "ArrowRight":
|
|
@@ -71797,10 +71926,10 @@ function ColorWheels({
|
|
|
71797
71926
|
onPreview,
|
|
71798
71927
|
onCommit
|
|
71799
71928
|
});
|
|
71800
|
-
const previewWheel = (
|
|
71801
|
-
const resetWheel = (
|
|
71929
|
+
const previewWheel = (key, wheel) => transaction.preview(updateWheel(draft, key, wheel));
|
|
71930
|
+
const resetWheel = (key) => {
|
|
71802
71931
|
transaction.cancel();
|
|
71803
|
-
const next = updateWheel(draft,
|
|
71932
|
+
const next = updateWheel(draft, key, RESET_WHEEL);
|
|
71804
71933
|
setDraft(next);
|
|
71805
71934
|
onCommit(next);
|
|
71806
71935
|
};
|
|
@@ -71809,19 +71938,19 @@ function ColorWheels({
|
|
|
71809
71938
|
{
|
|
71810
71939
|
"data-color-wheels": "true",
|
|
71811
71940
|
className: "grid grid-cols-[repeat(auto-fit,minmax(88px,1fr))] gap-2",
|
|
71812
|
-
children: WHEELS.map(({ key
|
|
71941
|
+
children: WHEELS.map(({ key, label }) => /* @__PURE__ */ jsx190(
|
|
71813
71942
|
TonalWheel,
|
|
71814
71943
|
{
|
|
71815
71944
|
label,
|
|
71816
|
-
wheel: draft[
|
|
71945
|
+
wheel: draft[key],
|
|
71817
71946
|
disabled,
|
|
71818
71947
|
onBegin: transaction.begin,
|
|
71819
|
-
onPreview: (wheel) => previewWheel(
|
|
71948
|
+
onPreview: (wheel) => previewWheel(key, wheel),
|
|
71820
71949
|
onSettle: transaction.settle,
|
|
71821
71950
|
onCancel: transaction.cancel,
|
|
71822
|
-
onReset: () => resetWheel(
|
|
71951
|
+
onReset: () => resetWheel(key)
|
|
71823
71952
|
},
|
|
71824
|
-
|
|
71953
|
+
key
|
|
71825
71954
|
))
|
|
71826
71955
|
}
|
|
71827
71956
|
);
|
|
@@ -71937,16 +72066,16 @@ function FlatColorGradingAccessory({
|
|
|
71937
72066
|
|
|
71938
72067
|
// src/components/editor/propertyPanelFlatColorGradingSection.tsx
|
|
71939
72068
|
import { jsx as jsx192, jsxs as jsxs147 } from "react/jsx-runtime";
|
|
71940
|
-
function formatAdjustValue(
|
|
71941
|
-
if (
|
|
72069
|
+
function formatAdjustValue(key, rawPercent) {
|
|
72070
|
+
if (key === "exposure") {
|
|
71942
72071
|
const stops = rawPercent / 100;
|
|
71943
72072
|
return `${stops >= 0 ? "+" : ""}${stops.toFixed(2)}`;
|
|
71944
72073
|
}
|
|
71945
72074
|
return `${Math.round(rawPercent)}%`;
|
|
71946
72075
|
}
|
|
71947
|
-
var detailByKey = (
|
|
71948
|
-
const spec = COLOR_GRADING_DETAIL_SLIDERS.find((candidate) => candidate.key ===
|
|
71949
|
-
if (!spec) throw new Error(`Unknown color grading detail key: ${
|
|
72076
|
+
var detailByKey = (key) => {
|
|
72077
|
+
const spec = COLOR_GRADING_DETAIL_SLIDERS.find((candidate) => candidate.key === key);
|
|
72078
|
+
if (!spec) throw new Error(`Unknown color grading detail key: ${key}`);
|
|
71950
72079
|
return spec;
|
|
71951
72080
|
};
|
|
71952
72081
|
function resolveColorGrading(grading) {
|
|
@@ -72040,9 +72169,9 @@ function FlatColorGradingSection({
|
|
|
72040
72169
|
} : grading;
|
|
72041
72170
|
};
|
|
72042
72171
|
useEffect107(() => () => onPreviewColorGrading(null), [onPreviewColorGrading]);
|
|
72043
|
-
const renderDetailSlider = (
|
|
72044
|
-
const spec = detailByKey(
|
|
72045
|
-
const value = grading.details[
|
|
72172
|
+
const renderDetailSlider = (key) => {
|
|
72173
|
+
const spec = detailByKey(key);
|
|
72174
|
+
const value = grading.details[key];
|
|
72046
72175
|
const defaultValue = normalizedColorGradingDefault(spec);
|
|
72047
72176
|
const isSet = Math.abs(value - defaultValue) > 1e-4;
|
|
72048
72177
|
return /* @__PURE__ */ jsx192(
|
|
@@ -72055,11 +72184,11 @@ function FlatColorGradingSection({
|
|
|
72055
72184
|
step: spec.step,
|
|
72056
72185
|
tier: isSet ? "explicitCustom" : "default",
|
|
72057
72186
|
displayValue: `${Math.round(value * spec.scale)}${spec.suffix}`,
|
|
72058
|
-
centerTick:
|
|
72059
|
-
onCommit: (next) => onCommitColorGrading(colorGradingWithDetail(grading,
|
|
72060
|
-
onReset: () => onCommitColorGrading(colorGradingWithDetail(grading,
|
|
72187
|
+
centerTick: key === "vignetteRoundness",
|
|
72188
|
+
onCommit: (next) => onCommitColorGrading(colorGradingWithDetail(grading, key, next / spec.scale)),
|
|
72189
|
+
onReset: () => onCommitColorGrading(colorGradingWithDetail(grading, key, defaultValue))
|
|
72061
72190
|
},
|
|
72062
|
-
|
|
72191
|
+
key
|
|
72063
72192
|
);
|
|
72064
72193
|
};
|
|
72065
72194
|
return /* @__PURE__ */ jsxs147("div", { className: "space-y-1.5", children: [
|
|
@@ -72405,28 +72534,28 @@ var EFFECT_CONTROL_LIMITS = new Map(
|
|
|
72405
72534
|
(effect) => effect.controls.map((control) => [control.key, control])
|
|
72406
72535
|
)
|
|
72407
72536
|
);
|
|
72408
|
-
function controlRange(
|
|
72409
|
-
const control = EFFECT_CONTROL_LIMITS.get(
|
|
72537
|
+
function controlRange(key, scale) {
|
|
72538
|
+
const control = EFFECT_CONTROL_LIMITS.get(key);
|
|
72410
72539
|
return control ? { min: control.min * scale, max: control.max * scale, scale } : { scale };
|
|
72411
72540
|
}
|
|
72412
|
-
var percent2 = (
|
|
72541
|
+
var percent2 = (key, label) => ({
|
|
72413
72542
|
kind: "slider",
|
|
72414
|
-
key
|
|
72543
|
+
key,
|
|
72415
72544
|
label,
|
|
72416
|
-
...controlRange(
|
|
72545
|
+
...controlRange(key, 100)
|
|
72417
72546
|
});
|
|
72418
|
-
var degrees = (
|
|
72547
|
+
var degrees = (key, label, max) => ({
|
|
72419
72548
|
kind: "slider",
|
|
72420
|
-
key
|
|
72549
|
+
key,
|
|
72421
72550
|
label,
|
|
72422
|
-
...controlRange(
|
|
72551
|
+
...controlRange(key, max),
|
|
72423
72552
|
unit: "deg"
|
|
72424
72553
|
});
|
|
72425
|
-
function enumOptions(
|
|
72426
|
-
const control = EFFECT_CONTROL_LIMITS.get(
|
|
72554
|
+
function enumOptions(key, labels) {
|
|
72555
|
+
const control = EFFECT_CONTROL_LIMITS.get(key);
|
|
72427
72556
|
const first = control?.min ?? 0;
|
|
72428
72557
|
const count = (control?.max ?? labels.length - 1) - first + 1;
|
|
72429
|
-
if (labels.length !== count) throw new Error(`${
|
|
72558
|
+
if (labels.length !== count) throw new Error(`${key} labels do not match Core capabilities`);
|
|
72430
72559
|
return labels.map((label, index2) => ({ value: String(first + index2), label }));
|
|
72431
72560
|
}
|
|
72432
72561
|
var ASCII_STYLES = enumOptions("asciiStyle", [
|
|
@@ -72797,8 +72926,8 @@ function FlatEffectsSection({
|
|
|
72797
72926
|
effects
|
|
72798
72927
|
});
|
|
72799
72928
|
};
|
|
72800
|
-
const commitEffect = (
|
|
72801
|
-
commitEffects({ ...grading.effects, [
|
|
72929
|
+
const commitEffect = (key, value) => {
|
|
72930
|
+
commitEffects({ ...grading.effects, [key]: value });
|
|
72802
72931
|
};
|
|
72803
72932
|
const resolveEffect = (effect) => ({
|
|
72804
72933
|
...grading,
|
|
@@ -75447,17 +75576,17 @@ function useStableHandlers(value, scope) {
|
|
|
75447
75576
|
const current2 = epoch.current;
|
|
75448
75577
|
current2.latest = value;
|
|
75449
75578
|
const next = {};
|
|
75450
|
-
for (const [
|
|
75579
|
+
for (const [key, field] of Object.entries(value)) {
|
|
75451
75580
|
if (typeof field !== "function") {
|
|
75452
|
-
next[
|
|
75581
|
+
next[key] = field;
|
|
75453
75582
|
continue;
|
|
75454
75583
|
}
|
|
75455
|
-
let wrapper = current2.wrappers.get(
|
|
75584
|
+
let wrapper = current2.wrappers.get(key);
|
|
75456
75585
|
if (!wrapper) {
|
|
75457
|
-
wrapper = (...args) => current2.latest[
|
|
75458
|
-
current2.wrappers.set(
|
|
75586
|
+
wrapper = (...args) => current2.latest[key](...args);
|
|
75587
|
+
current2.wrappers.set(key, wrapper);
|
|
75459
75588
|
}
|
|
75460
|
-
next[
|
|
75589
|
+
next[key] = wrapper;
|
|
75461
75590
|
}
|
|
75462
75591
|
const prev = current2.previous;
|
|
75463
75592
|
const keys = Object.keys(next);
|
|
@@ -75728,16 +75857,16 @@ function isDisabled() {
|
|
|
75728
75857
|
return false;
|
|
75729
75858
|
}
|
|
75730
75859
|
}
|
|
75731
|
-
function readTimestamp(
|
|
75860
|
+
function readTimestamp(key) {
|
|
75732
75861
|
try {
|
|
75733
|
-
return parseInt(window.localStorage.getItem(
|
|
75862
|
+
return parseInt(window.localStorage.getItem(key) || "0", 10) || 0;
|
|
75734
75863
|
} catch {
|
|
75735
75864
|
return 0;
|
|
75736
75865
|
}
|
|
75737
75866
|
}
|
|
75738
|
-
function writeTimestamp(
|
|
75867
|
+
function writeTimestamp(key, now2) {
|
|
75739
75868
|
try {
|
|
75740
|
-
window.localStorage.setItem(
|
|
75869
|
+
window.localStorage.setItem(key, String(now2));
|
|
75741
75870
|
} catch {
|
|
75742
75871
|
}
|
|
75743
75872
|
}
|
|
@@ -77532,7 +77661,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
77532
77661
|
projectIdRef.current = projectId;
|
|
77533
77662
|
const [own] = useState121(createOwnHistory);
|
|
77534
77663
|
const [pageKeyScope] = useState121(generateId);
|
|
77535
|
-
const claimKey = useCallback104((
|
|
77664
|
+
const claimKey = useCallback104((key) => `${pageKeyScope}:${key}`, [pageKeyScope]);
|
|
77536
77665
|
const refresh2 = useCallback104(async () => {
|
|
77537
77666
|
if (!projectId) return;
|
|
77538
77667
|
const seen = own.changes();
|
|
@@ -78471,10 +78600,10 @@ var IDENTITY_SELECTOR = "[id], [data-hf-id]";
|
|
|
78471
78600
|
function identityElementMap(root) {
|
|
78472
78601
|
const map = /* @__PURE__ */ new Map();
|
|
78473
78602
|
for (const el of root.querySelectorAll(IDENTITY_SELECTOR)) {
|
|
78474
|
-
const
|
|
78475
|
-
if (!
|
|
78476
|
-
if (map.has(
|
|
78477
|
-
map.set(
|
|
78603
|
+
const key = elementIdentityKey(el);
|
|
78604
|
+
if (!key) continue;
|
|
78605
|
+
if (map.has(key)) return null;
|
|
78606
|
+
map.set(key, el);
|
|
78478
78607
|
}
|
|
78479
78608
|
return map;
|
|
78480
78609
|
}
|
|
@@ -78514,10 +78643,10 @@ function diffRestoreDocs(prevDoc, nextDoc) {
|
|
|
78514
78643
|
if (!prevByKey || !nextByKey) return null;
|
|
78515
78644
|
if (prevByKey.size !== nextByKey.size) return null;
|
|
78516
78645
|
const changedElementKeys = [];
|
|
78517
|
-
for (const [
|
|
78518
|
-
const prevEl = prevByKey.get(
|
|
78646
|
+
for (const [key, nextEl] of nextByKey) {
|
|
78647
|
+
const prevEl = prevByKey.get(key);
|
|
78519
78648
|
if (!prevEl || prevEl.tagName !== nextEl.tagName) return null;
|
|
78520
|
-
if (!attributesEqual(prevEl, nextEl)) changedElementKeys.push(
|
|
78649
|
+
if (!attributesEqual(prevEl, nextEl)) changedElementKeys.push(key);
|
|
78521
78650
|
}
|
|
78522
78651
|
const [prevRest, nextRest] = [prevDoc, nextDoc].map((doc) => {
|
|
78523
78652
|
const root = doc.documentElement.cloneNode(true);
|
|
@@ -78586,11 +78715,11 @@ function scopeTargets(scope, keys, restoredByKey, previousByKey) {
|
|
|
78586
78715
|
const liveByKey = identityElementMap(scope);
|
|
78587
78716
|
if (!liveByKey) return null;
|
|
78588
78717
|
const targets = [];
|
|
78589
|
-
for (const
|
|
78590
|
-
const live = liveByKey.get(
|
|
78591
|
-
const restored = restoredByKey.get(
|
|
78718
|
+
for (const key of keys) {
|
|
78719
|
+
const live = liveByKey.get(key);
|
|
78720
|
+
const restored = restoredByKey.get(key);
|
|
78592
78721
|
if (!live || !restored || live.hasAttribute("data-hf-inner-root")) return null;
|
|
78593
|
-
targets.push({ live, restored, previous: previousByKey.get(
|
|
78722
|
+
targets.push({ live, restored, previous: previousByKey.get(key) });
|
|
78594
78723
|
}
|
|
78595
78724
|
return targets;
|
|
78596
78725
|
}
|
|
@@ -78744,7 +78873,7 @@ function syncStoredAutomationFromPreview(doc) {
|
|
|
78744
78873
|
if (!node) return element;
|
|
78745
78874
|
const fields = syncedFields(doc, element, node);
|
|
78746
78875
|
const keys = Object.keys(fields);
|
|
78747
|
-
if (keys.every((
|
|
78876
|
+
if (keys.every((key) => fields[key] === element[key])) return element;
|
|
78748
78877
|
changed = true;
|
|
78749
78878
|
return { ...element, ...fields };
|
|
78750
78879
|
});
|
|
@@ -78763,12 +78892,12 @@ var STORED_FIELD = {
|
|
|
78763
78892
|
function syncStoredElementAttribute(target, attr2, value) {
|
|
78764
78893
|
const fields = STORED_FIELD[attr2]?.(value);
|
|
78765
78894
|
if (!fields) return;
|
|
78766
|
-
const
|
|
78895
|
+
const key = getTimelineElementIdentity(target);
|
|
78767
78896
|
const same2 = (element) => Object.keys(fields).every((k) => element[k] === fields[k]);
|
|
78768
78897
|
usePlayerStore.setState((state) => {
|
|
78769
78898
|
let changed = false;
|
|
78770
78899
|
const elements = state.elements.map((element) => {
|
|
78771
|
-
if (getTimelineElementIdentity(element) !==
|
|
78900
|
+
if (getTimelineElementIdentity(element) !== key || same2(element)) return element;
|
|
78772
78901
|
changed = true;
|
|
78773
78902
|
return { ...element, ...fields };
|
|
78774
78903
|
});
|
|
@@ -79358,9 +79487,9 @@ function planDropTrackInsert(input) {
|
|
|
79358
79487
|
const byKey = new Map(elements.map((e) => [e.key ?? e.id, e]));
|
|
79359
79488
|
const renumbers = [];
|
|
79360
79489
|
for (const norm of layout.normalized) {
|
|
79361
|
-
const
|
|
79362
|
-
if (
|
|
79363
|
-
const src = byKey.get(
|
|
79490
|
+
const key = norm.key ?? norm.id;
|
|
79491
|
+
if (key === dropped2.id) continue;
|
|
79492
|
+
const src = byKey.get(key);
|
|
79364
79493
|
if (!src || norm.track === (src.authoredTrack ?? src.track)) continue;
|
|
79365
79494
|
if (!canMoveTimelineElement(src)) return null;
|
|
79366
79495
|
renumbers.push({ element: src, track: norm.track });
|
|
@@ -79469,10 +79598,10 @@ async function commitTimelineCompositionInsertion(input) {
|
|
|
79469
79598
|
}
|
|
79470
79599
|
|
|
79471
79600
|
// src/player/components/timelineDropReveal.ts
|
|
79472
|
-
function selectAndRevealTimelineElement(
|
|
79601
|
+
function selectAndRevealTimelineElement(key) {
|
|
79473
79602
|
const store = usePlayerStore.getState();
|
|
79474
|
-
store.setSelectedElementId(
|
|
79475
|
-
store.requestTimelineFocus(timelineClipFocusId(
|
|
79603
|
+
store.setSelectedElementId(key);
|
|
79604
|
+
store.requestTimelineFocus(timelineClipFocusId(key));
|
|
79476
79605
|
}
|
|
79477
79606
|
|
|
79478
79607
|
// src/hooks/useTimelineAssetDropOps.ts
|
|
@@ -79773,71 +79902,71 @@ function createLiveLanes(project, composition) {
|
|
|
79773
79902
|
const verified2 = /* @__PURE__ */ new Map();
|
|
79774
79903
|
const clean = /* @__PURE__ */ new Set();
|
|
79775
79904
|
let saves = 0;
|
|
79776
|
-
const take = (
|
|
79777
|
-
const claimed = before.has(
|
|
79778
|
-
before.delete(
|
|
79779
|
-
clean.delete(
|
|
79780
|
-
if (!pending2.has(
|
|
79905
|
+
const take = (key) => {
|
|
79906
|
+
const claimed = before.has(key) ? before.get(key) ?? null : void 0;
|
|
79907
|
+
before.delete(key);
|
|
79908
|
+
clean.delete(key);
|
|
79909
|
+
if (!pending2.has(key)) sources.delete(key);
|
|
79781
79910
|
return claimed;
|
|
79782
79911
|
};
|
|
79783
|
-
const overtaken = (
|
|
79784
|
-
const rebase = (
|
|
79912
|
+
const overtaken = (key, save) => [...pending2.get(key) ?? []].some((newer) => newer > save);
|
|
79913
|
+
const rebase = (key, value) => {
|
|
79785
79914
|
if (value === void 0) {
|
|
79786
|
-
clean.delete(
|
|
79787
|
-
verified2.delete(
|
|
79915
|
+
clean.delete(key);
|
|
79916
|
+
verified2.delete(key);
|
|
79788
79917
|
return;
|
|
79789
79918
|
}
|
|
79790
|
-
if (before.has(
|
|
79791
|
-
if (pending2.has(
|
|
79792
|
-
if (pending2.has(
|
|
79793
|
-
else clean.add(
|
|
79919
|
+
if (before.has(key)) before.set(key, value);
|
|
79920
|
+
if (pending2.has(key)) verified2.set(key, value);
|
|
79921
|
+
if (pending2.has(key)) clean.delete(key);
|
|
79922
|
+
else clean.add(key);
|
|
79794
79923
|
};
|
|
79795
79924
|
const scoped = (laneKey) => `${project()}
|
|
79796
79925
|
${composition()}
|
|
79797
79926
|
${laneKey}`;
|
|
79798
79927
|
return {
|
|
79799
79928
|
preview(laneKey, readCurrent, source) {
|
|
79800
|
-
const
|
|
79801
|
-
if (before.has(
|
|
79802
|
-
before.set(
|
|
79803
|
-
sources.set(
|
|
79804
|
-
if (!pending2.has(
|
|
79929
|
+
const key = scoped(laneKey);
|
|
79930
|
+
if (before.has(key)) return;
|
|
79931
|
+
before.set(key, readCurrent());
|
|
79932
|
+
sources.set(key, source);
|
|
79933
|
+
if (!pending2.has(key)) clean.add(key);
|
|
79805
79934
|
},
|
|
79806
79935
|
// A save. Its settle records what the file holds: `saved`, else the last value verified on
|
|
79807
79936
|
// this lane (a landed save, a read-back, or a clean before-value), never an unsaved one.
|
|
79808
79937
|
// Store and preview follow only while no newer save is pending and its composition is open,
|
|
79809
79938
|
// and the preview only while no drag is live.
|
|
79810
79939
|
claim(laneKey, apply, source) {
|
|
79811
|
-
const
|
|
79812
|
-
const open2 = () => scoped(laneKey) ===
|
|
79813
|
-
const trusted = clean.has(
|
|
79814
|
-
const claimed = take(
|
|
79940
|
+
const key = scoped(laneKey);
|
|
79941
|
+
const open2 = () => scoped(laneKey) === key;
|
|
79942
|
+
const trusted = clean.has(key);
|
|
79943
|
+
const claimed = take(key);
|
|
79815
79944
|
const mine = ++saves;
|
|
79816
|
-
sources.set(
|
|
79817
|
-
if (claimed !== void 0 && trusted) verified2.set(
|
|
79818
|
-
pending2.set(
|
|
79945
|
+
sources.set(key, source);
|
|
79946
|
+
if (claimed !== void 0 && trusted) verified2.set(key, claimed);
|
|
79947
|
+
pending2.set(key, (pending2.get(key) ?? /* @__PURE__ */ new Set()).add(mine));
|
|
79819
79948
|
const preview2 = (value) => {
|
|
79820
|
-
if (open2() && !before.has(
|
|
79949
|
+
if (open2() && !before.has(key) && !overtaken(key, mine)) apply.preview(value);
|
|
79821
79950
|
};
|
|
79822
79951
|
return {
|
|
79823
79952
|
preview: preview2,
|
|
79824
79953
|
read(value) {
|
|
79825
|
-
verified2.set(
|
|
79954
|
+
verified2.set(key, value);
|
|
79826
79955
|
},
|
|
79827
79956
|
settle(saved2) {
|
|
79828
|
-
const inFlight = pending2.get(
|
|
79957
|
+
const inFlight = pending2.get(key);
|
|
79829
79958
|
inFlight?.delete(mine);
|
|
79830
|
-
if (saved2 !== void 0) verified2.set(
|
|
79831
|
-
const value = verified2.get(
|
|
79959
|
+
if (saved2 !== void 0) verified2.set(key, saved2);
|
|
79960
|
+
const value = verified2.get(key);
|
|
79832
79961
|
if (!inFlight?.size) {
|
|
79833
|
-
pending2.delete(
|
|
79834
|
-
verified2.delete(
|
|
79835
|
-
if (!before.has(
|
|
79962
|
+
pending2.delete(key);
|
|
79963
|
+
verified2.delete(key);
|
|
79964
|
+
if (!before.has(key)) sources.delete(key);
|
|
79836
79965
|
}
|
|
79837
|
-
if (value === void 0 || overtaken(
|
|
79838
|
-
if (before.has(
|
|
79839
|
-
before.set(
|
|
79840
|
-
clean.add(
|
|
79966
|
+
if (value === void 0 || overtaken(key, mine) || !open2()) return;
|
|
79967
|
+
if (before.has(key)) {
|
|
79968
|
+
before.set(key, value);
|
|
79969
|
+
clean.add(key);
|
|
79841
79970
|
}
|
|
79842
79971
|
apply.store(value);
|
|
79843
79972
|
preview2(value);
|
|
@@ -79857,9 +79986,9 @@ ${laneKey}`;
|
|
|
79857
79986
|
restore({ paths = [], files }) {
|
|
79858
79987
|
const inProject = `${project()}
|
|
79859
79988
|
`;
|
|
79860
|
-
for (const [
|
|
79861
|
-
if (
|
|
79862
|
-
rebase(
|
|
79989
|
+
for (const [key, source] of sources) {
|
|
79990
|
+
if (key.startsWith(inProject) && paths.includes(source.path)) {
|
|
79991
|
+
rebase(key, restoredValue(source, files));
|
|
79863
79992
|
}
|
|
79864
79993
|
}
|
|
79865
79994
|
}
|
|
@@ -79985,10 +80114,10 @@ function useSetAudioGroupAttribute({
|
|
|
79985
80114
|
const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
|
|
79986
80115
|
const setLive = useCallback116(
|
|
79987
80116
|
(groupId, attr2, value) => {
|
|
79988
|
-
const
|
|
80117
|
+
const key = audioGroupAttributeLiveKey(groupId, attr2);
|
|
79989
80118
|
const target = previewIframeRef.current?.contentDocument?.getElementById(groupId);
|
|
79990
80119
|
liveLanes.preview(
|
|
79991
|
-
|
|
80120
|
+
key,
|
|
79992
80121
|
() => target?.getAttribute(attr2) ?? null,
|
|
79993
80122
|
groupLiveSource(previewIframeRef.current, groupId, activeCompPath, attr2)
|
|
79994
80123
|
);
|
|
@@ -80128,10 +80257,10 @@ function useSetElementAttribute({
|
|
|
80128
80257
|
const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
|
|
80129
80258
|
const setLive = useCallback117(
|
|
80130
80259
|
(element, attr2, value) => {
|
|
80131
|
-
const
|
|
80260
|
+
const key = elementAttributeLiveKey(element, activeCompPath, attr2);
|
|
80132
80261
|
const target = findTimelineElementInIframe(previewIframeRef.current, element, activeCompPath);
|
|
80133
80262
|
liveLanes.preview(
|
|
80134
|
-
|
|
80263
|
+
key,
|
|
80135
80264
|
() => target?.getAttribute(attr2) ?? null,
|
|
80136
80265
|
elementLiveSource(element, activeCompPath, attr2)
|
|
80137
80266
|
);
|
|
@@ -80471,8 +80600,8 @@ function useTimelineEditGuard(canEdit, showToast) {
|
|
|
80471
80600
|
const guardedRef = useRef144(/* @__PURE__ */ new WeakMap());
|
|
80472
80601
|
const guard = useCallback120(
|
|
80473
80602
|
(resolveTargets, fn, onRefused) => {
|
|
80474
|
-
const
|
|
80475
|
-
const cached5 = guardedRef.current.get(
|
|
80603
|
+
const key = fn;
|
|
80604
|
+
const cached5 = guardedRef.current.get(key);
|
|
80476
80605
|
if (cached5) {
|
|
80477
80606
|
cached5.resolveTargets = resolveTargets;
|
|
80478
80607
|
cached5.onRefused = onRefused;
|
|
@@ -80487,7 +80616,7 @@ function useTimelineEditGuard(canEdit, showToast) {
|
|
|
80487
80616
|
return Promise.resolve(entry3.onRefused?.(reason, ...args));
|
|
80488
80617
|
return fn(...args);
|
|
80489
80618
|
});
|
|
80490
|
-
guardedRef.current.set(
|
|
80619
|
+
guardedRef.current.set(key, entry3);
|
|
80491
80620
|
return entry3.wrapped;
|
|
80492
80621
|
},
|
|
80493
80622
|
[]
|
|
@@ -80715,11 +80844,11 @@ import { useCallback as useCallback122, useRef as useRef145 } from "react";
|
|
|
80715
80844
|
function useTrackPendingTimelineEdit() {
|
|
80716
80845
|
const wrappedRef = useRef145(/* @__PURE__ */ new WeakMap());
|
|
80717
80846
|
return useCallback122((fn) => {
|
|
80718
|
-
const
|
|
80719
|
-
const cached5 = wrappedRef.current.get(
|
|
80847
|
+
const key = fn;
|
|
80848
|
+
const cached5 = wrappedRef.current.get(key);
|
|
80720
80849
|
if (cached5) return cached5;
|
|
80721
80850
|
const wrapped = trackedStudioEdit(fn);
|
|
80722
|
-
wrappedRef.current.set(
|
|
80851
|
+
wrappedRef.current.set(key, wrapped);
|
|
80723
80852
|
return wrapped;
|
|
80724
80853
|
}, []);
|
|
80725
80854
|
}
|
|
@@ -84343,8 +84472,8 @@ function stagePlainTranslate(commitPositionPatchToHtml, selection, next, coalesc
|
|
|
84343
84472
|
const rollback = () => {
|
|
84344
84473
|
if (el.style.getPropertyValue("translate") === written) restoreStudioPathOffset(el, before);
|
|
84345
84474
|
};
|
|
84346
|
-
const
|
|
84347
|
-
const options = { label: "Move layer", coalesceKey:
|
|
84475
|
+
const key = coalesceKey ?? `move:${++plainMoveCounter}`;
|
|
84476
|
+
const options = { label: "Move layer", coalesceKey: key, coalesceMs: Number.POSITIVE_INFINITY };
|
|
84348
84477
|
const save = () => commitPositionPatchToHtml(selection, patches, options).catch((error) => {
|
|
84349
84478
|
rollback();
|
|
84350
84479
|
throw error;
|
|
@@ -84938,16 +85067,16 @@ function patchKeyframes(tween, keyframes) {
|
|
|
84938
85067
|
function mergeKeyframeStep(map, pct, props) {
|
|
84939
85068
|
const next = {};
|
|
84940
85069
|
for (const [k, step] of Object.entries(map)) next[k] = { ...step };
|
|
84941
|
-
let
|
|
85070
|
+
let key = null;
|
|
84942
85071
|
for (const k of Object.keys(next)) {
|
|
84943
85072
|
const n = parseFloat(k);
|
|
84944
85073
|
if (Number.isFinite(n) && Math.abs(n - pct) < 0.05) {
|
|
84945
|
-
|
|
85074
|
+
key = k;
|
|
84946
85075
|
break;
|
|
84947
85076
|
}
|
|
84948
85077
|
}
|
|
84949
|
-
if (
|
|
84950
|
-
next[
|
|
85078
|
+
if (key === null) key = `${pct}%`;
|
|
85079
|
+
next[key] = { ...next[key] ?? {}, ...props };
|
|
84951
85080
|
return next;
|
|
84952
85081
|
}
|
|
84953
85082
|
function rebuildKeyframeTween(tween, pct, props) {
|
|
@@ -85034,16 +85163,16 @@ function patchRuntimeTweenInPlace(iframe, selector, change, compositionId, defer
|
|
|
85034
85163
|
// src/hooks/serializeByKey.ts
|
|
85035
85164
|
function createKeyedSerializer() {
|
|
85036
85165
|
const inFlight = /* @__PURE__ */ new Map();
|
|
85037
|
-
return function run(
|
|
85038
|
-
const prior = inFlight.get(
|
|
85166
|
+
return function run(key, task) {
|
|
85167
|
+
const prior = inFlight.get(key) ?? Promise.resolve();
|
|
85039
85168
|
const next = prior.then(task, task);
|
|
85040
|
-
inFlight.set(
|
|
85169
|
+
inFlight.set(key, next);
|
|
85041
85170
|
void next.then(
|
|
85042
85171
|
() => {
|
|
85043
|
-
if (inFlight.get(
|
|
85172
|
+
if (inFlight.get(key) === next) inFlight.delete(key);
|
|
85044
85173
|
},
|
|
85045
85174
|
() => {
|
|
85046
|
-
if (inFlight.get(
|
|
85175
|
+
if (inFlight.get(key) === next) inFlight.delete(key);
|
|
85047
85176
|
}
|
|
85048
85177
|
);
|
|
85049
85178
|
return next;
|
|
@@ -85347,8 +85476,8 @@ async function commitKeyframeAtTimeImpl(selection, absoluteTime, animations, pro
|
|
|
85347
85476
|
);
|
|
85348
85477
|
}
|
|
85349
85478
|
const backfillDefaults = {};
|
|
85350
|
-
for (const
|
|
85351
|
-
backfillDefaults[
|
|
85479
|
+
for (const key of Object.keys(properties)) {
|
|
85480
|
+
backfillDefaults[key] = KEYFRAME_PROPERTY_DEFAULTS[key] ?? 0;
|
|
85352
85481
|
}
|
|
85353
85482
|
await commitMutation(
|
|
85354
85483
|
selection,
|
|
@@ -86805,8 +86934,8 @@ function useDomEditWiring(params) {
|
|
|
86805
86934
|
const matchKey = elements.find(
|
|
86806
86935
|
(el) => el.domId === domEditSelection.id || el.id === domEditSelection.id
|
|
86807
86936
|
);
|
|
86808
|
-
const
|
|
86809
|
-
if (
|
|
86937
|
+
const key = matchKey ? matchKey.key ?? matchKey.id : null;
|
|
86938
|
+
if (key && key !== selectedElementId) setSelectedElementId(key);
|
|
86810
86939
|
}, [domEditSelection?.id]);
|
|
86811
86940
|
const prevRefreshKeyRef = useRef158(refreshKey);
|
|
86812
86941
|
useEffect127(() => {
|
|
@@ -87111,8 +87240,8 @@ function isPlayheadWithinTween(anim, currentTime) {
|
|
|
87111
87240
|
async function replaceSetWithSingleKeyframe(session, sel, setAnim, t2, iframe, selector) {
|
|
87112
87241
|
const position = readElementPosition(iframe, sel, setAnim);
|
|
87113
87242
|
if (Object.keys(position).length === 0) {
|
|
87114
|
-
for (const [
|
|
87115
|
-
if (typeof held === "number") position[
|
|
87243
|
+
for (const [key, held] of Object.entries(setAnim.properties ?? {})) {
|
|
87244
|
+
if (typeof held === "number") position[key] = held;
|
|
87116
87245
|
}
|
|
87117
87246
|
}
|
|
87118
87247
|
if (Object.keys(position).length === 0 || !session.commitMutation) return;
|
|
@@ -87258,9 +87387,9 @@ async function promoteSetToKeyframes(session, sel, setAnim, t2, iframe) {
|
|
|
87258
87387
|
const endPosition = readElementPosition(iframe, sel, setAnim);
|
|
87259
87388
|
if (Object.keys(endPosition).length === 0) return;
|
|
87260
87389
|
const startPosition = {};
|
|
87261
|
-
for (const
|
|
87262
|
-
const held = setAnim.properties?.[
|
|
87263
|
-
if (typeof held === "number") startPosition[
|
|
87390
|
+
for (const key of Object.keys(endPosition)) {
|
|
87391
|
+
const held = setAnim.properties?.[key];
|
|
87392
|
+
if (typeof held === "number") startPosition[key] = held;
|
|
87264
87393
|
}
|
|
87265
87394
|
await session.commitMutation(
|
|
87266
87395
|
{
|
|
@@ -88681,19 +88810,19 @@ function useCommitPreflightCapabilities({
|
|
|
88681
88810
|
if (!enabled || !projectId) return;
|
|
88682
88811
|
const targets = selection ? [selection, ...groupSelections] : groupSelections;
|
|
88683
88812
|
for (const file of new Set(targets.map(gsapSourceFileForSelection))) {
|
|
88684
|
-
const
|
|
88685
|
-
const known = parsesRef.current.get(
|
|
88813
|
+
const key = parseCacheKey(projectId, file);
|
|
88814
|
+
const known = parsesRef.current.get(key);
|
|
88686
88815
|
if (known?.version === version) continue;
|
|
88687
|
-
parsesRef.current.set(
|
|
88816
|
+
parsesRef.current.set(key, { version, animations: known?.animations ?? null });
|
|
88688
88817
|
void fetchParsedAnimations(projectId, file).then((parsed) => {
|
|
88689
|
-
if (parsesRef.current.get(
|
|
88818
|
+
if (parsesRef.current.get(key)?.version !== version) return;
|
|
88690
88819
|
if (parsed) {
|
|
88691
|
-
parsesRef.current.set(
|
|
88820
|
+
parsesRef.current.set(key, { version, animations: parsed.animations });
|
|
88692
88821
|
setParseTick((tick) => tick + 1);
|
|
88693
88822
|
return;
|
|
88694
88823
|
}
|
|
88695
|
-
if (known?.animations) parsesRef.current.set(
|
|
88696
|
-
else parsesRef.current.delete(
|
|
88824
|
+
if (known?.animations) parsesRef.current.set(key, known);
|
|
88825
|
+
else parsesRef.current.delete(key);
|
|
88697
88826
|
});
|
|
88698
88827
|
}
|
|
88699
88828
|
}, [enabled, projectId, selection, groupSelections, version]);
|
|
@@ -89434,9 +89563,9 @@ function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded
|
|
|
89434
89563
|
setUnreachableProject(reportReadFailure(read2, forProjectId, pathInTree));
|
|
89435
89564
|
setCompositionMissing(read2.reason === "absent");
|
|
89436
89565
|
if (read2.reason !== "absent") return;
|
|
89437
|
-
const
|
|
89438
|
-
if (refreshedAbsentPathsRef.current.has(
|
|
89439
|
-
refreshedAbsentPathsRef.current.add(
|
|
89566
|
+
const key = `${forProjectId}:${forPath}`;
|
|
89567
|
+
if (refreshedAbsentPathsRef.current.has(key)) return;
|
|
89568
|
+
refreshedAbsentPathsRef.current.add(key);
|
|
89440
89569
|
onAbsentRead?.(forPath);
|
|
89441
89570
|
}
|
|
89442
89571
|
useEffect132(
|
|
@@ -89565,75 +89694,32 @@ function useStudioSdkSessions(projectId, activeCompPath, masterCompPath, fileTre
|
|
|
89565
89694
|
import { useCallback as useCallback156 } from "react";
|
|
89566
89695
|
|
|
89567
89696
|
// src/utils/externalConflictStorage.ts
|
|
89568
|
-
|
|
89569
|
-
|
|
89570
|
-
|
|
89571
|
-
function
|
|
89572
|
-
|
|
89573
|
-
}
|
|
89574
|
-
|
|
89575
|
-
|
|
89576
|
-
|
|
89577
|
-
|
|
89578
|
-
|
|
89579
|
-
|
|
89580
|
-
|
|
89581
|
-
|
|
89582
|
-
|
|
89583
|
-
|
|
89584
|
-
}
|
|
89585
|
-
|
|
89586
|
-
|
|
89587
|
-
|
|
89588
|
-
|
|
89589
|
-
}
|
|
89590
|
-
|
|
89591
|
-
|
|
89592
|
-
(db) => new Promise((resolve2, reject) => {
|
|
89593
|
-
const transaction = db.transaction(STORE_NAME, mode);
|
|
89594
|
-
const request2 = callback(transaction.objectStore(STORE_NAME));
|
|
89595
|
-
let result;
|
|
89596
|
-
request2.onerror = () => reject(request2.error ?? new Error("Conflict storage failed"));
|
|
89597
|
-
request2.onsuccess = () => {
|
|
89598
|
-
result = request2.result;
|
|
89599
|
-
};
|
|
89600
|
-
transaction.oncomplete = () => {
|
|
89601
|
-
db.close();
|
|
89602
|
-
resolve2(result);
|
|
89603
|
-
};
|
|
89604
|
-
transaction.onerror = () => {
|
|
89605
|
-
db.close();
|
|
89606
|
-
reject(transaction.error ?? new Error("Conflict storage transaction failed"));
|
|
89607
|
-
};
|
|
89608
|
-
transaction.onabort = () => {
|
|
89609
|
-
db.close();
|
|
89610
|
-
reject(transaction.error ?? new Error("Conflict storage transaction was aborted"));
|
|
89611
|
-
};
|
|
89612
|
-
})
|
|
89613
|
-
);
|
|
89614
|
-
}
|
|
89615
|
-
function createIndexedDbExternalConflictStorage() {
|
|
89616
|
-
return {
|
|
89617
|
-
async get(projectId, filePath) {
|
|
89618
|
-
return await withStore(
|
|
89619
|
-
"readonly",
|
|
89620
|
-
(store) => store.get(key(projectId, filePath))
|
|
89621
|
-
) ?? null;
|
|
89622
|
-
},
|
|
89623
|
-
async set(snapshot3) {
|
|
89624
|
-
await withStore(
|
|
89625
|
-
"readwrite",
|
|
89626
|
-
(store) => store.put(snapshot3, key(snapshot3.projectId, snapshot3.filePath))
|
|
89627
|
-
);
|
|
89628
|
-
},
|
|
89629
|
-
async delete(projectId, filePath) {
|
|
89630
|
-
await withStore("readwrite", (store) => store.delete(key(projectId, filePath)));
|
|
89631
|
-
}
|
|
89632
|
-
};
|
|
89633
|
-
}
|
|
89634
|
-
var indexedDbStorage = createIndexedDbExternalConflictStorage();
|
|
89697
|
+
function draftUrl(projectId, filePath) {
|
|
89698
|
+
return `/api/projects/${encodeURIComponent(projectId)}/recovery-drafts/${encodeURIComponent(filePath)}`;
|
|
89699
|
+
}
|
|
89700
|
+
async function draftRequest(projectId, filePath, init) {
|
|
89701
|
+
const res = await studioApiFetch(draftUrl(projectId, filePath), init);
|
|
89702
|
+
if (!res.ok) throw new Error(`Recovery draft storage failed (${res.status})`);
|
|
89703
|
+
return res;
|
|
89704
|
+
}
|
|
89705
|
+
var projectStorage = {
|
|
89706
|
+
async get(projectId, filePath) {
|
|
89707
|
+
const { draft } = await (await draftRequest(projectId, filePath)).json();
|
|
89708
|
+
return draft?.projectId === projectId && draft.filePath === filePath ? draft : null;
|
|
89709
|
+
},
|
|
89710
|
+
async set(snapshot3) {
|
|
89711
|
+
await draftRequest(snapshot3.projectId, snapshot3.filePath, {
|
|
89712
|
+
method: "PUT",
|
|
89713
|
+
headers: { "content-type": "application/json" },
|
|
89714
|
+
body: JSON.stringify(snapshot3)
|
|
89715
|
+
});
|
|
89716
|
+
},
|
|
89717
|
+
async delete(projectId, filePath) {
|
|
89718
|
+
await draftRequest(projectId, filePath, { method: "DELETE" });
|
|
89719
|
+
}
|
|
89720
|
+
};
|
|
89635
89721
|
async function persistExternalConflictSnapshot(projectId, conflict) {
|
|
89636
|
-
await
|
|
89722
|
+
await projectStorage.set({
|
|
89637
89723
|
kind: "conflict",
|
|
89638
89724
|
projectId,
|
|
89639
89725
|
filePath: conflict.filePath,
|
|
@@ -89644,7 +89730,7 @@ async function persistExternalConflictSnapshot(projectId, conflict) {
|
|
|
89644
89730
|
});
|
|
89645
89731
|
}
|
|
89646
89732
|
async function persistExternalFailureSnapshot(projectId, filePath, studioContent, externalVersion, externalContent, error) {
|
|
89647
|
-
await
|
|
89733
|
+
await projectStorage.set({
|
|
89648
89734
|
kind: "failed",
|
|
89649
89735
|
projectId,
|
|
89650
89736
|
filePath,
|
|
@@ -89656,10 +89742,10 @@ async function persistExternalFailureSnapshot(projectId, filePath, studioContent
|
|
|
89656
89742
|
});
|
|
89657
89743
|
}
|
|
89658
89744
|
async function loadExternalConflictSnapshot(projectId, filePath) {
|
|
89659
|
-
return
|
|
89745
|
+
return projectStorage.get(projectId, filePath);
|
|
89660
89746
|
}
|
|
89661
89747
|
async function deleteExternalConflictSnapshot(projectId, filePath) {
|
|
89662
|
-
await
|
|
89748
|
+
await projectStorage.delete(projectId, filePath);
|
|
89663
89749
|
}
|
|
89664
89750
|
|
|
89665
89751
|
// src/hooks/useExternalFileChangeCoordinator.ts
|
|
@@ -89786,7 +89872,7 @@ function useExternalFileChangeCoordinator({
|
|
|
89786
89872
|
return () => {
|
|
89787
89873
|
cancelled = true;
|
|
89788
89874
|
};
|
|
89789
|
-
}, [loadConflictSnapshot, projectId, recoveryFilePath, setBlocked]);
|
|
89875
|
+
}, [loadConflictSnapshot, projectId, activeCompPath, recoveryFilePath, setBlocked]);
|
|
89790
89876
|
const deliverOwed = useCallback155(
|
|
89791
89877
|
(owed, accept = true) => {
|
|
89792
89878
|
const path = readStudioFileChangePath(owed) ?? ".";
|
|
@@ -90890,10 +90976,10 @@ function useAppHotkeys({
|
|
|
90890
90976
|
};
|
|
90891
90977
|
const handleAppKeyDown = useCallback159((event) => {
|
|
90892
90978
|
const cb = cbRef.current;
|
|
90893
|
-
const
|
|
90979
|
+
const key = event.key.toLowerCase();
|
|
90894
90980
|
if (dispatchLinkShortcut(event, cb)) return;
|
|
90895
|
-
if (dispatchModifierKey(event,
|
|
90896
|
-
dispatchPlainKey(event,
|
|
90981
|
+
if (dispatchModifierKey(event, key, cb)) return;
|
|
90982
|
+
dispatchPlainKey(event, key, cb);
|
|
90897
90983
|
}, []);
|
|
90898
90984
|
useEffect135(() => {
|
|
90899
90985
|
window.addEventListener("keydown", handleAppKeyDown, true);
|
|
@@ -91696,11 +91782,11 @@ function readStaticProperty(property) {
|
|
|
91696
91782
|
if (property.type !== "Property" || property.kind !== "init" || property.method || property.shorthand || property.computed) {
|
|
91697
91783
|
throw new SyntaxError("Transcript properties must be static data");
|
|
91698
91784
|
}
|
|
91699
|
-
const
|
|
91700
|
-
if (typeof
|
|
91785
|
+
const key = property.key.type === "Identifier" ? property.key.name : readStaticValue(property.key);
|
|
91786
|
+
if (typeof key !== "string" && typeof key !== "number") {
|
|
91701
91787
|
throw new SyntaxError("Transcript property keys must be names or literals");
|
|
91702
91788
|
}
|
|
91703
|
-
return [
|
|
91789
|
+
return [key, readStaticValue(property.value)];
|
|
91704
91790
|
}
|
|
91705
91791
|
function parseTranscriptArray(parsed) {
|
|
91706
91792
|
if (!Array.isArray(parsed)) {
|
|
@@ -92108,12 +92194,12 @@ function useLintModal(projectId, refreshKey) {
|
|
|
92108
92194
|
(keyFn) => {
|
|
92109
92195
|
const map = /* @__PURE__ */ new Map();
|
|
92110
92196
|
for (const f of backgroundFindings) {
|
|
92111
|
-
const
|
|
92112
|
-
if (!
|
|
92113
|
-
const prev = map.get(
|
|
92197
|
+
const key = keyFn(f);
|
|
92198
|
+
if (!key) continue;
|
|
92199
|
+
const prev = map.get(key) ?? { count: 0, messages: [] };
|
|
92114
92200
|
prev.count += 1;
|
|
92115
92201
|
prev.messages.push(f.message);
|
|
92116
|
-
map.set(
|
|
92202
|
+
map.set(key, prev);
|
|
92117
92203
|
}
|
|
92118
92204
|
return map;
|
|
92119
92205
|
},
|
|
@@ -92305,8 +92391,8 @@ function toPersistedSelection(selection, group = []) {
|
|
|
92305
92391
|
for (const member of group) {
|
|
92306
92392
|
const target = toPersistedTarget(member);
|
|
92307
92393
|
if (!target) continue;
|
|
92308
|
-
const
|
|
92309
|
-
if (
|
|
92394
|
+
const key = selectionTargetKey(target);
|
|
92395
|
+
if (key !== primaryKey) members.set(key, target);
|
|
92310
92396
|
}
|
|
92311
92397
|
return {
|
|
92312
92398
|
...primary,
|
|
@@ -93388,13 +93474,13 @@ function setStudioTheme(theme) {
|
|
|
93388
93474
|
if (theme === "light") root.dataset.theme = "paper";
|
|
93389
93475
|
else delete root.dataset.theme;
|
|
93390
93476
|
}
|
|
93391
|
-
function
|
|
93477
|
+
function subscribe(listener2) {
|
|
93392
93478
|
const observer = new MutationObserver(listener2);
|
|
93393
93479
|
observer.observe(document.documentElement, { attributeFilter: ["data-theme"] });
|
|
93394
93480
|
return () => observer.disconnect();
|
|
93395
93481
|
}
|
|
93396
93482
|
function useShownStudioTheme() {
|
|
93397
|
-
return useSyncExternalStore12(
|
|
93483
|
+
return useSyncExternalStore12(subscribe, shownStudioTheme);
|
|
93398
93484
|
}
|
|
93399
93485
|
|
|
93400
93486
|
// src/components/ThemeToggle.tsx
|
|
@@ -93650,7 +93736,7 @@ function connectGsapRuntime(element, iframeEl, elementEndTime) {
|
|
|
93650
93736
|
try {
|
|
93651
93737
|
const win = iframeEl.contentWindow;
|
|
93652
93738
|
const tl = win?.__timelines ? Object.entries(win.__timelines).find(
|
|
93653
|
-
([
|
|
93739
|
+
([key, value]) => key !== "__proxied" && typeof value?.seek === "function"
|
|
93654
93740
|
)?.[1] ?? null : null;
|
|
93655
93741
|
if (win?.gsap?.set && tl?.seek && element.id) {
|
|
93656
93742
|
const tlDuration = tl.duration();
|
|
@@ -93953,19 +94039,19 @@ function simplifyGestureSamples(samples, totalDuration, epsilon) {
|
|
|
93953
94039
|
if (totalDuration <= 0) return /* @__PURE__ */ new Map();
|
|
93954
94040
|
const propertyKeys = /* @__PURE__ */ new Set();
|
|
93955
94041
|
for (const s of samples) {
|
|
93956
|
-
for (const
|
|
93957
|
-
propertyKeys.add(
|
|
94042
|
+
for (const key of Object.keys(s.properties)) {
|
|
94043
|
+
propertyKeys.add(key);
|
|
93958
94044
|
}
|
|
93959
94045
|
}
|
|
93960
94046
|
const survivingTimes = /* @__PURE__ */ new Set();
|
|
93961
|
-
for (const
|
|
94047
|
+
for (const key of propertyKeys) {
|
|
93962
94048
|
const series = [];
|
|
93963
94049
|
for (const s of samples) {
|
|
93964
|
-
if (
|
|
93965
|
-
series.push({ time: s.time, value: s.properties[
|
|
94050
|
+
if (key in s.properties) {
|
|
94051
|
+
series.push({ time: s.time, value: s.properties[key] });
|
|
93966
94052
|
}
|
|
93967
94053
|
}
|
|
93968
|
-
const keyEpsilon = typeof epsilon === "function" ? epsilon(
|
|
94054
|
+
const keyEpsilon = typeof epsilon === "function" ? epsilon(key) : epsilon;
|
|
93969
94055
|
const simplified = simplifyTimeSeries(series, keyEpsilon);
|
|
93970
94056
|
for (const pt of simplified) {
|
|
93971
94057
|
survivingTimes.add(pt.time);
|
|
@@ -93976,19 +94062,19 @@ function simplifyGestureSamples(samples, totalDuration, epsilon) {
|
|
|
93976
94062
|
for (const t2 of sortedTimes) {
|
|
93977
94063
|
const pct = Math.round(t2 / totalDuration * 1e3) / 10;
|
|
93978
94064
|
const props = {};
|
|
93979
|
-
for (const
|
|
93980
|
-
props[
|
|
94065
|
+
for (const key of propertyKeys) {
|
|
94066
|
+
props[key] = interpolatePropertyAtTime(samples, key, t2);
|
|
93981
94067
|
}
|
|
93982
94068
|
result.set(pct, props);
|
|
93983
94069
|
}
|
|
93984
94070
|
return result;
|
|
93985
94071
|
}
|
|
93986
|
-
function interpolatePropertyAtTime(samples,
|
|
94072
|
+
function interpolatePropertyAtTime(samples, key, t2) {
|
|
93987
94073
|
let before;
|
|
93988
94074
|
let after;
|
|
93989
94075
|
for (const s of samples) {
|
|
93990
|
-
if (!(
|
|
93991
|
-
const v = s.properties[
|
|
94076
|
+
if (!(key in s.properties)) continue;
|
|
94077
|
+
const v = s.properties[key];
|
|
93992
94078
|
if (s.time <= t2) {
|
|
93993
94079
|
before = { time: s.time, value: v };
|
|
93994
94080
|
}
|
|
@@ -94090,17 +94176,17 @@ function smoothGestureKeyframes(keyframes, radius) {
|
|
|
94090
94176
|
return keyframes.map((kf, i) => {
|
|
94091
94177
|
if (i === 0 || i === keyframes.length - 1) return kf;
|
|
94092
94178
|
const smoothed = { ...kf.properties };
|
|
94093
|
-
for (const
|
|
94179
|
+
for (const key of numericKeys) {
|
|
94094
94180
|
let weightSum = 0;
|
|
94095
94181
|
let valueSum = 0;
|
|
94096
94182
|
for (let j = Math.max(0, i - radius); j <= Math.min(keyframes.length - 1, i + radius); j++) {
|
|
94097
|
-
const v = keyframes[j].properties[
|
|
94183
|
+
const v = keyframes[j].properties[key];
|
|
94098
94184
|
if (typeof v !== "number") continue;
|
|
94099
94185
|
const w = gaussianWeight(j - i, sigma);
|
|
94100
94186
|
weightSum += w;
|
|
94101
94187
|
valueSum += v * w;
|
|
94102
94188
|
}
|
|
94103
|
-
if (weightSum > 0) smoothed[
|
|
94189
|
+
if (weightSum > 0) smoothed[key] = Math.round(valueSum / weightSum * 1e3) / 1e3;
|
|
94104
94190
|
}
|
|
94105
94191
|
return { percentage: kf.percentage, properties: smoothed };
|
|
94106
94192
|
});
|
|
@@ -94113,14 +94199,14 @@ function partitionKeyframesByGroup(keyframes) {
|
|
|
94113
94199
|
const byGroup = /* @__PURE__ */ new Map();
|
|
94114
94200
|
for (const kf of keyframes) {
|
|
94115
94201
|
const perGroup = /* @__PURE__ */ new Map();
|
|
94116
|
-
for (const [
|
|
94117
|
-
const group = classifyPropertyGroup5(
|
|
94202
|
+
for (const [key, value] of Object.entries(kf.properties)) {
|
|
94203
|
+
const group = classifyPropertyGroup5(key);
|
|
94118
94204
|
let props = perGroup.get(group);
|
|
94119
94205
|
if (!props) {
|
|
94120
94206
|
props = {};
|
|
94121
94207
|
perGroup.set(group, props);
|
|
94122
94208
|
}
|
|
94123
|
-
props[
|
|
94209
|
+
props[key] = value;
|
|
94124
94210
|
}
|
|
94125
94211
|
for (const [group, props] of perGroup) {
|
|
94126
94212
|
let set = byGroup.get(group);
|
|
@@ -94210,9 +94296,9 @@ function useGestureCommit({
|
|
|
94210
94296
|
showToast("Recording too short. Try again", "error");
|
|
94211
94297
|
return;
|
|
94212
94298
|
}
|
|
94213
|
-
const simplified = simplifyGestureSamples(frozenSamples, duration, (
|
|
94214
|
-
if (
|
|
94215
|
-
if (
|
|
94299
|
+
const simplified = simplifyGestureSamples(frozenSamples, duration, (key) => {
|
|
94300
|
+
if (key === "opacity") return 0.01;
|
|
94301
|
+
if (key === "scale" || key === "scaleX" || key === "scaleY") return 0.01;
|
|
94216
94302
|
return 5;
|
|
94217
94303
|
});
|
|
94218
94304
|
const sortedPcts = Array.from(simplified.keys()).sort((a, b) => a - b);
|
|
@@ -97659,9 +97745,9 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
|
|
|
97659
97745
|
},
|
|
97660
97746
|
[resolveSelection, updateDomEditHoverSelection]
|
|
97661
97747
|
);
|
|
97662
|
-
const toggleCollapse = useCallback176((
|
|
97748
|
+
const toggleCollapse = useCallback176((key, e) => {
|
|
97663
97749
|
e.stopPropagation();
|
|
97664
|
-
setCollapsed((prev) => ({ ...prev, [
|
|
97750
|
+
setCollapsed((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
97665
97751
|
}, []);
|
|
97666
97752
|
const handleReorder = useCallback176(
|
|
97667
97753
|
(event) => {
|
|
@@ -98168,12 +98254,12 @@ var CaptionAnimationPanel = memo53(function CaptionAnimationPanel2() {
|
|
|
98168
98254
|
|
|
98169
98255
|
// src/captions/components/CaptionPropertyPanel.tsx
|
|
98170
98256
|
import { jsx as jsx238, jsxs as jsxs187 } from "react/jsx-runtime";
|
|
98171
|
-
function isMixedValue(model, selectedSegmentIds,
|
|
98257
|
+
function isMixedValue(model, selectedSegmentIds, key, fallback) {
|
|
98172
98258
|
if (!model || selectedSegmentIds.size < 2) return false;
|
|
98173
98259
|
let first;
|
|
98174
98260
|
let seen = false;
|
|
98175
98261
|
for (const segId of selectedSegmentIds) {
|
|
98176
|
-
const v = model.segments.get(segId)?.style[
|
|
98262
|
+
const v = model.segments.get(segId)?.style[key] ?? fallback;
|
|
98177
98263
|
if (!seen) {
|
|
98178
98264
|
first = v;
|
|
98179
98265
|
seen = true;
|
|
@@ -98413,9 +98499,9 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98413
98499
|
const [commitState, setCommitState] = useState156({ tone: "idle" });
|
|
98414
98500
|
const commitTimersRef = useRef186(/* @__PURE__ */ new Map());
|
|
98415
98501
|
const commitParamNow = useCallback179(
|
|
98416
|
-
async (
|
|
98502
|
+
async (key, nextValue) => {
|
|
98417
98503
|
if (!fileManager) return;
|
|
98418
|
-
const previous = appliedRef.current[
|
|
98504
|
+
const previous = appliedRef.current[key];
|
|
98419
98505
|
if (previous === void 0 || previous === nextValue || !nextValue.trim()) return;
|
|
98420
98506
|
setCommitState({ tone: "saving" });
|
|
98421
98507
|
try {
|
|
@@ -98430,7 +98516,7 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98430
98516
|
tone: "error",
|
|
98431
98517
|
message: `Couldn't find the current value in ${compositionPath}. It may have been edited by hand.`
|
|
98432
98518
|
});
|
|
98433
|
-
trackBlockParamCommit({ tone: "error", blockName, key
|
|
98519
|
+
trackBlockParamCommit({ tone: "error", blockName, key });
|
|
98434
98520
|
return;
|
|
98435
98521
|
}
|
|
98436
98522
|
if (matches > 1) {
|
|
@@ -98438,7 +98524,7 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98438
98524
|
tone: "error",
|
|
98439
98525
|
message: `"${previous}" appears ${matches}\xD7 in ${compositionPath}. The panel can't tell which one belongs to this parameter, so it won't risk changing unrelated content. Edit the file directly to disambiguate.`
|
|
98440
98526
|
});
|
|
98441
|
-
trackBlockParamCommit({ tone: "error", blockName, key
|
|
98527
|
+
trackBlockParamCommit({ tone: "error", blockName, key });
|
|
98442
98528
|
return;
|
|
98443
98529
|
}
|
|
98444
98530
|
await fileManager.writeProjectFile(
|
|
@@ -98446,36 +98532,36 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98446
98532
|
content.replace(matcher, nextValue),
|
|
98447
98533
|
content
|
|
98448
98534
|
);
|
|
98449
|
-
appliedRef.current[
|
|
98535
|
+
appliedRef.current[key] = nextValue;
|
|
98450
98536
|
setCommitState({ tone: "saved" });
|
|
98451
|
-
trackBlockParamCommit({ tone: "saved", blockName, key
|
|
98537
|
+
trackBlockParamCommit({ tone: "saved", blockName, key });
|
|
98452
98538
|
setRefreshKey((k) => k + 1);
|
|
98453
98539
|
} catch {
|
|
98454
98540
|
setCommitState({ tone: "error", message: "Couldn't save the block file. Retry?" });
|
|
98455
|
-
trackBlockParamCommit({ tone: "error", blockName, key
|
|
98541
|
+
trackBlockParamCommit({ tone: "error", blockName, key });
|
|
98456
98542
|
}
|
|
98457
98543
|
},
|
|
98458
98544
|
[fileManager, compositionPath, setRefreshKey, blockName]
|
|
98459
98545
|
);
|
|
98460
98546
|
const commitParam = useCallback179(
|
|
98461
|
-
(
|
|
98547
|
+
(key, nextValue) => fileManager ? serializeStudioFileMutation(
|
|
98462
98548
|
fileManager.writeProjectFile,
|
|
98463
98549
|
compositionPath,
|
|
98464
|
-
() => commitParamNow(
|
|
98550
|
+
() => commitParamNow(key, nextValue)
|
|
98465
98551
|
) : Promise.resolve(),
|
|
98466
98552
|
[commitParamNow, compositionPath, fileManager]
|
|
98467
98553
|
);
|
|
98468
98554
|
const handleChange = useCallback179(
|
|
98469
|
-
(
|
|
98470
|
-
setValues((prev) => ({ ...prev, [
|
|
98555
|
+
(key, value) => {
|
|
98556
|
+
setValues((prev) => ({ ...prev, [key]: value }));
|
|
98471
98557
|
const timers = commitTimersRef.current;
|
|
98472
|
-
const existing = timers.get(
|
|
98558
|
+
const existing = timers.get(key);
|
|
98473
98559
|
if (existing) clearTimeout(existing);
|
|
98474
98560
|
timers.set(
|
|
98475
|
-
|
|
98561
|
+
key,
|
|
98476
98562
|
setTimeout(() => {
|
|
98477
|
-
timers.delete(
|
|
98478
|
-
void commitParam(
|
|
98563
|
+
timers.delete(key);
|
|
98564
|
+
void commitParam(key, value);
|
|
98479
98565
|
}, 300)
|
|
98480
98566
|
);
|
|
98481
98567
|
},
|
|
@@ -98484,10 +98570,10 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98484
98570
|
const flushRef = useRef186(() => {
|
|
98485
98571
|
});
|
|
98486
98572
|
flushRef.current = () => {
|
|
98487
|
-
for (const [
|
|
98573
|
+
for (const [key, timer] of commitTimersRef.current) {
|
|
98488
98574
|
clearTimeout(timer);
|
|
98489
|
-
const value = values[
|
|
98490
|
-
if (value !== void 0) void commitParam(
|
|
98575
|
+
const value = values[key];
|
|
98576
|
+
if (value !== void 0) void commitParam(key, value);
|
|
98491
98577
|
}
|
|
98492
98578
|
commitTimersRef.current.clear();
|
|
98493
98579
|
};
|
|
@@ -100298,13 +100384,13 @@ function SlideshowPanel({ scenes, onPersist, onPersistNotes }) {
|
|
|
100298
100384
|
ctrl.flush();
|
|
100299
100385
|
};
|
|
100300
100386
|
}, []);
|
|
100301
|
-
const toggleSection = useCallback182((
|
|
100387
|
+
const toggleSection = useCallback182((key) => {
|
|
100302
100388
|
setExpandedSections((prev) => {
|
|
100303
100389
|
const next = new Set(prev);
|
|
100304
|
-
if (next.has(
|
|
100305
|
-
next.delete(
|
|
100390
|
+
if (next.has(key)) {
|
|
100391
|
+
next.delete(key);
|
|
100306
100392
|
} else {
|
|
100307
|
-
next.add(
|
|
100393
|
+
next.add(key);
|
|
100308
100394
|
}
|
|
100309
100395
|
return next;
|
|
100310
100396
|
});
|
|
@@ -100716,11 +100802,11 @@ function draftFromDeclaration(decl) {
|
|
|
100716
100802
|
function numberDeclFromDraft(base2, draft) {
|
|
100717
100803
|
const value = Number(draft.defaultRaw);
|
|
100718
100804
|
if (!Number.isFinite(value)) return "Default must be a number.";
|
|
100719
|
-
const constraint = (
|
|
100720
|
-
const raw = draft[
|
|
100805
|
+
const constraint = (key) => {
|
|
100806
|
+
const raw = draft[key].trim();
|
|
100721
100807
|
if (!raw) return {};
|
|
100722
100808
|
const parsed = Number(raw);
|
|
100723
|
-
return Number.isFinite(parsed) ? { [
|
|
100809
|
+
return Number.isFinite(parsed) ? { [key]: parsed } : {};
|
|
100724
100810
|
};
|
|
100725
100811
|
return {
|
|
100726
100812
|
...base2,
|
|
@@ -100756,8 +100842,8 @@ var FORM_OWNED_KEYS = /* @__PURE__ */ new Set([
|
|
|
100756
100842
|
function mergeDeclarationEdit(original, edited) {
|
|
100757
100843
|
if (original.type !== edited.type) return edited;
|
|
100758
100844
|
const passthrough = {};
|
|
100759
|
-
for (const [
|
|
100760
|
-
if (!FORM_OWNED_KEYS.has(
|
|
100845
|
+
for (const [key, value] of Object.entries(original)) {
|
|
100846
|
+
if (!FORM_OWNED_KEYS.has(key)) passthrough[key] = value;
|
|
100761
100847
|
}
|
|
100762
100848
|
return { ...passthrough, ...edited };
|
|
100763
100849
|
}
|
|
@@ -100886,15 +100972,15 @@ function DeclarationForm({
|
|
|
100886
100972
|
) }),
|
|
100887
100973
|
/* @__PURE__ */ jsx250(Field, { label: "Default", children: /* @__PURE__ */ jsx250(DefaultField, { draft, onChange: (defaultRaw) => set({ defaultRaw }) }) })
|
|
100888
100974
|
] }),
|
|
100889
|
-
draft.type === "number" && /* @__PURE__ */ jsx250("div", { className: "grid grid-cols-3 gap-2", children: ["min", "max", "step"].map((
|
|
100975
|
+
draft.type === "number" && /* @__PURE__ */ jsx250("div", { className: "grid grid-cols-3 gap-2", children: ["min", "max", "step"].map((key) => /* @__PURE__ */ jsx250(Field, { label: key, children: /* @__PURE__ */ jsx250(
|
|
100890
100976
|
"input",
|
|
100891
100977
|
{
|
|
100892
100978
|
type: "text",
|
|
100893
|
-
value: draft[
|
|
100894
|
-
onChange: (e) => set({ [
|
|
100979
|
+
value: draft[key],
|
|
100980
|
+
onChange: (e) => set({ [key]: e.target.value }),
|
|
100895
100981
|
className: `${VARIABLES_INPUT_CLASS} tabular-nums`
|
|
100896
100982
|
}
|
|
100897
|
-
) },
|
|
100983
|
+
) }, key)) }),
|
|
100898
100984
|
draft.type === "enum" && /* @__PURE__ */ jsx250(Field, { label: "Options (one per line, value:Label)", children: /* @__PURE__ */ jsx250(
|
|
100899
100985
|
"textarea",
|
|
100900
100986
|
{
|
|
@@ -100976,8 +101062,8 @@ function CompositionSection({
|
|
|
100976
101062
|
}
|
|
100977
101063
|
),
|
|
100978
101064
|
group.variables.map((decl) => {
|
|
100979
|
-
const
|
|
100980
|
-
const editing = editingKey ===
|
|
101065
|
+
const key = `${group.path}::${decl.id}`;
|
|
101066
|
+
const editing = editingKey === key;
|
|
100981
101067
|
return /* @__PURE__ */ jsxs200("div", { className: "space-y-1.5 rounded-lg border border-neutral-800/70 p-2", children: [
|
|
100982
101068
|
/* @__PURE__ */ jsxs200("div", { className: "flex items-center gap-1.5", children: [
|
|
100983
101069
|
/* @__PURE__ */ jsx252("span", { className: "truncate text-[10px] font-medium text-neutral-300", children: decl.label }),
|
|
@@ -100988,7 +101074,7 @@ function CompositionSection({
|
|
|
100988
101074
|
{
|
|
100989
101075
|
label: "Edit",
|
|
100990
101076
|
title: "Edit declaration",
|
|
100991
|
-
onClick: () => onToggleEdit(editing ? null :
|
|
101077
|
+
onClick: () => onToggleEdit(editing ? null : key)
|
|
100992
101078
|
}
|
|
100993
101079
|
),
|
|
100994
101080
|
/* @__PURE__ */ jsx252(
|
|
@@ -101012,7 +101098,7 @@ function CompositionSection({
|
|
|
101012
101098
|
onCancel: () => onToggleEdit(null)
|
|
101013
101099
|
}
|
|
101014
101100
|
)
|
|
101015
|
-
] },
|
|
101101
|
+
] }, key);
|
|
101016
101102
|
})
|
|
101017
101103
|
] });
|
|
101018
101104
|
}
|
|
@@ -104423,9 +104509,9 @@ function parseStyleString(style) {
|
|
|
104423
104509
|
for (const decl of style.split(";")) {
|
|
104424
104510
|
const colonIdx = decl.indexOf(":");
|
|
104425
104511
|
if (colonIdx < 0) continue;
|
|
104426
|
-
const
|
|
104512
|
+
const key = decl.slice(0, colonIdx).trim();
|
|
104427
104513
|
const value = decl.slice(colonIdx + 1).trim();
|
|
104428
|
-
if (
|
|
104514
|
+
if (key && value) result[key] = value;
|
|
104429
104515
|
}
|
|
104430
104516
|
return result;
|
|
104431
104517
|
}
|
|
@@ -104792,6 +104878,7 @@ export {
|
|
|
104792
104878
|
collectSnapContext,
|
|
104793
104879
|
collectStudioLookScene,
|
|
104794
104880
|
currentTimelineRange,
|
|
104881
|
+
describePreviewElements,
|
|
104795
104882
|
dispatchLinkShortcut,
|
|
104796
104883
|
displayTrackOrder,
|
|
104797
104884
|
extractSnapTargets,
|
|
@@ -104799,6 +104886,8 @@ export {
|
|
|
104799
104886
|
fieldBase,
|
|
104800
104887
|
fieldText,
|
|
104801
104888
|
findElementBlock,
|
|
104889
|
+
findPreviewElementForSelection,
|
|
104890
|
+
findPreviewElementForTimelineElement,
|
|
104802
104891
|
flushStudioPendingEdits,
|
|
104803
104892
|
formatCombo2 as formatCombo,
|
|
104804
104893
|
formatTime,
|
|
@@ -104814,8 +104903,15 @@ export {
|
|
|
104814
104903
|
persistRenderSettings,
|
|
104815
104904
|
playSeamTransitionLoop,
|
|
104816
104905
|
popupSurface,
|
|
104906
|
+
previewAncestors,
|
|
104817
104907
|
previewEditingClient,
|
|
104908
|
+
previewElementsAtPoint,
|
|
104818
104909
|
previewFrameOpaque,
|
|
104910
|
+
previewGeometry,
|
|
104911
|
+
previewLayers,
|
|
104912
|
+
previewPointerTargets,
|
|
104913
|
+
queryPreviewElements,
|
|
104914
|
+
readable,
|
|
104819
104915
|
resolveDomEditSelection,
|
|
104820
104916
|
resolveEquidistanceGuides,
|
|
104821
104917
|
resolveGuideLineRect,
|
|
@@ -104826,6 +104922,8 @@ export {
|
|
|
104826
104922
|
revertNewestStudioPendingEdit,
|
|
104827
104923
|
setStudioKeys,
|
|
104828
104924
|
snapEngagedForTravel,
|
|
104925
|
+
standInFor,
|
|
104926
|
+
standInHandle,
|
|
104829
104927
|
studioKeyClash,
|
|
104830
104928
|
useAudioGainDialogStore,
|
|
104831
104929
|
useAudioMetersVisible,
|