@hyperframes/studio 0.9.56 → 0.9.58
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-SRLbmEDB.js → hyperframes-player-B78JDyI_.js} +1 -1
- package/dist/assets/{index-CgyBYe2L.js → index-D7ICtobF.js} +178 -178
- package/dist/assets/{index-yuN1pZrv.js → index-ww7-RmuM.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-DtvSF8bV.js → pausedVideoDecoder-Dbe8Cmab.js} +1 -1
- package/dist/index.d.ts +87 -3
- package/dist/index.html +1 -1
- package/dist/index.js +867 -774
- 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/index.ts +17 -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/sealedPreviewExports.test.ts +20 -0
- package/src/utils/externalConflictStorage.test.ts +66 -14
- package/src/utils/externalConflictStorage.ts +36 -82
- package/src/utils/gsapSoftReload.ts +2 -14
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
|
}
|
|
@@ -2314,14 +2315,14 @@ function createTimelineRowGeometry(rowKeys, rowHeights, padding = {}) {
|
|
|
2314
2315
|
const heights = Object.freeze(rowHeights.map(validRowHeight));
|
|
2315
2316
|
const keys = Object.freeze(
|
|
2316
2317
|
heights.map((_, row) => {
|
|
2317
|
-
const
|
|
2318
|
-
return
|
|
2318
|
+
const key = rowKeys[row];
|
|
2319
|
+
return key !== void 0 && Number.isFinite(key) ? key : row;
|
|
2319
2320
|
})
|
|
2320
2321
|
);
|
|
2321
2322
|
const offsets = [0];
|
|
2322
2323
|
for (const height of heights) offsets.push((offsets.at(-1) ?? 0) + height);
|
|
2323
2324
|
Object.freeze(offsets);
|
|
2324
|
-
const rowIndexByKey = new Map(keys.map((
|
|
2325
|
+
const rowIndexByKey = new Map(keys.map((key, row) => [key, row]));
|
|
2325
2326
|
const getRowHeight = (row) => validRowHeight(heights[row]);
|
|
2326
2327
|
const getRowOffset = (row) => {
|
|
2327
2328
|
if (heights.length === 0) return row * TRACK_H;
|
|
@@ -2921,8 +2922,8 @@ var ONTO_ROW_THRESHOLD = 0.35;
|
|
|
2921
2922
|
function isAudioElement(element) {
|
|
2922
2923
|
return element.tag?.toLowerCase() === "audio";
|
|
2923
2924
|
}
|
|
2924
|
-
function layerContainsElement(layer,
|
|
2925
|
-
return layer.elements.some((element) => getTimelineElementIdentity(element) ===
|
|
2925
|
+
function layerContainsElement(layer, key) {
|
|
2926
|
+
return layer.elements.some((element) => getTimelineElementIdentity(element) === key);
|
|
2926
2927
|
}
|
|
2927
2928
|
function layerConflictsWithElement(layer, element, draggedKey) {
|
|
2928
2929
|
return layer.elements.some(
|
|
@@ -2943,8 +2944,8 @@ function addElementChange(changes, element, zIndex) {
|
|
|
2943
2944
|
function addLayerChanges(changes, layer, zIndex, excludedKey) {
|
|
2944
2945
|
let count = 0;
|
|
2945
2946
|
for (const element of layer.elements) {
|
|
2946
|
-
const
|
|
2947
|
-
if (
|
|
2947
|
+
const key = getTimelineElementIdentity(element);
|
|
2948
|
+
if (key === excludedKey) continue;
|
|
2948
2949
|
const before = changes.length;
|
|
2949
2950
|
addElementChange(changes, element, zIndex);
|
|
2950
2951
|
if (changes.length > before) count += 1;
|
|
@@ -5000,7 +5001,7 @@ function useTimelineClipCapabilities() {
|
|
|
5000
5001
|
}
|
|
5001
5002
|
function refuseWhenReadOnly(readOnlyPress, callbacks) {
|
|
5002
5003
|
if (!readOnlyPress) return callbacks;
|
|
5003
|
-
return Object.fromEntries(Object.keys(callbacks).map((
|
|
5004
|
+
return Object.fromEntries(Object.keys(callbacks).map((key) => [key, readOnlyPress]));
|
|
5004
5005
|
}
|
|
5005
5006
|
function useAbandonEditsOnReadOnly(readOnly, abandon) {
|
|
5006
5007
|
const abandonNow = useEffectEvent(abandon);
|
|
@@ -5037,11 +5038,11 @@ function timelineKeyframeSelectionKey(elementId2, target) {
|
|
|
5037
5038
|
target.tweenPercentage ?? target.percentage
|
|
5038
5039
|
]);
|
|
5039
5040
|
}
|
|
5040
|
-
function timelineKeyframeTargetFromSelectionKey(elementId2,
|
|
5041
|
-
if (
|
|
5041
|
+
function timelineKeyframeTargetFromSelectionKey(elementId2, key) {
|
|
5042
|
+
if (key.startsWith("[")) {
|
|
5042
5043
|
let decoded;
|
|
5043
5044
|
try {
|
|
5044
|
-
decoded = JSON.parse(
|
|
5045
|
+
decoded = JSON.parse(key);
|
|
5045
5046
|
} catch {
|
|
5046
5047
|
return null;
|
|
5047
5048
|
}
|
|
@@ -5057,9 +5058,9 @@ function timelineKeyframeTargetFromSelectionKey(elementId2, key2) {
|
|
|
5057
5058
|
tweenPercentage
|
|
5058
5059
|
};
|
|
5059
5060
|
}
|
|
5060
|
-
const separator =
|
|
5061
|
-
if (separator < 0 ||
|
|
5062
|
-
const percentage = Number(
|
|
5061
|
+
const separator = key.lastIndexOf(":");
|
|
5062
|
+
if (separator < 0 || key.slice(0, separator) !== elementId2) return null;
|
|
5063
|
+
const percentage = Number(key.slice(separator + 1));
|
|
5063
5064
|
return Number.isFinite(percentage) ? { percentage } : null;
|
|
5064
5065
|
}
|
|
5065
5066
|
|
|
@@ -5398,12 +5399,12 @@ function parsePercentageKeyframes(kfObj) {
|
|
|
5398
5399
|
});
|
|
5399
5400
|
return keyframes.length > 0 ? { keyframes } : null;
|
|
5400
5401
|
}
|
|
5401
|
-
for (const [
|
|
5402
|
-
if (
|
|
5402
|
+
for (const [key, val] of Object.entries(kfObj)) {
|
|
5403
|
+
if (key === "easeEach") {
|
|
5403
5404
|
if (typeof val === "string") easeEach = val;
|
|
5404
5405
|
continue;
|
|
5405
5406
|
}
|
|
5406
|
-
const pctMatch =
|
|
5407
|
+
const pctMatch = key.match(/^(\d+(?:\.\d+)?)%$/);
|
|
5407
5408
|
if (!pctMatch || !val || typeof val !== "object") continue;
|
|
5408
5409
|
const percentage = parseFloat(pctMatch[1]);
|
|
5409
5410
|
const properties = collectAnimatableKeyframeProperties(val);
|
|
@@ -6042,9 +6043,9 @@ function parseMotionValues(value) {
|
|
|
6042
6043
|
if (!value || typeof value !== "object") return null;
|
|
6043
6044
|
const record2 = value;
|
|
6044
6045
|
const parsed = {};
|
|
6045
|
-
for (const
|
|
6046
|
-
const next = finiteNumber(record2[
|
|
6047
|
-
if (next != null) parsed[
|
|
6046
|
+
for (const key of ["x", "y", "scale", "rotation", "opacity", "autoAlpha"]) {
|
|
6047
|
+
const next = finiteNumber(record2[key]);
|
|
6048
|
+
if (next != null) parsed[key] = next;
|
|
6048
6049
|
}
|
|
6049
6050
|
return Object.keys(parsed).length > 0 ? parsed : null;
|
|
6050
6051
|
}
|
|
@@ -6806,9 +6807,9 @@ var xToSvg = (px) => PADH + S * px;
|
|
|
6806
6807
|
var yToSvg = (py) => HR + S * (1 - py);
|
|
6807
6808
|
var clampView = (py) => Math.max(VMIN, Math.min(VMAX, py));
|
|
6808
6809
|
var clampDragY = (py) => Math.max(DRAG_VMIN, Math.min(DRAG_VMAX, py));
|
|
6809
|
-
function nudgeCurve(tuple, handle,
|
|
6810
|
-
const deltaX =
|
|
6811
|
-
const deltaY =
|
|
6810
|
+
function nudgeCurve(tuple, handle, key, step) {
|
|
6811
|
+
const deltaX = key === "ArrowLeft" ? -step : key === "ArrowRight" ? step : 0;
|
|
6812
|
+
const deltaY = key === "ArrowDown" ? -step : key === "ArrowUp" ? step : 0;
|
|
6812
6813
|
if (deltaX === 0 && deltaY === 0) return null;
|
|
6813
6814
|
const next = [...tuple];
|
|
6814
6815
|
const xIndex = handle === "p1" ? 0 : 2;
|
|
@@ -7061,7 +7062,7 @@ function EaseCurveSection({
|
|
|
7061
7062
|
),
|
|
7062
7063
|
/* @__PURE__ */ jsx12("circle", { cx: a0.x, cy: a0.y, r: "3", className: "fill-accent-ink" }),
|
|
7063
7064
|
/* @__PURE__ */ jsx12("circle", { cx: a1.x, cy: a1.y, r: "3", className: "fill-accent-ink" }),
|
|
7064
|
-
showHandles && [["p1", p1], ["p2", p2]].map(([
|
|
7065
|
+
showHandles && [["p1", p1], ["p2", p2]].map(([key, pt]) => /* @__PURE__ */ jsxs9("g", { children: [
|
|
7065
7066
|
/* @__PURE__ */ jsx12(
|
|
7066
7067
|
"circle",
|
|
7067
7068
|
{
|
|
@@ -7071,16 +7072,16 @@ function EaseCurveSection({
|
|
|
7071
7072
|
fill: "transparent",
|
|
7072
7073
|
role: "slider",
|
|
7073
7074
|
tabIndex: 0,
|
|
7074
|
-
"aria-label": `${
|
|
7075
|
+
"aria-label": `${key === "p1" ? "First" : "Second"} bezier control point`,
|
|
7075
7076
|
"aria-valuemin": 0,
|
|
7076
7077
|
"aria-valuemax": 1,
|
|
7077
|
-
"aria-valuenow":
|
|
7078
|
-
"aria-valuetext": `x ${
|
|
7078
|
+
"aria-valuenow": key === "p1" ? x1 : x2,
|
|
7079
|
+
"aria-valuetext": `x ${key === "p1" ? x1 : x2}, y ${key === "p1" ? y1 : y2}`,
|
|
7079
7080
|
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 ===
|
|
7081
|
+
onPointerDown: (e) => handlePointerDown(key, e),
|
|
7082
|
+
onKeyDown: (event) => handleKeyDown(key, event),
|
|
7083
|
+
onPointerEnter: () => setHover(key),
|
|
7084
|
+
onPointerLeave: () => setHover((h) => h === key ? null : h)
|
|
7084
7085
|
}
|
|
7085
7086
|
),
|
|
7086
7087
|
/* @__PURE__ */ jsx12(
|
|
@@ -7088,12 +7089,12 @@ function EaseCurveSection({
|
|
|
7088
7089
|
{
|
|
7089
7090
|
cx: pt.x,
|
|
7090
7091
|
cy: pt.y,
|
|
7091
|
-
r: hover ===
|
|
7092
|
+
r: hover === key || draggingRef.current === key ? 7 : 5.5,
|
|
7092
7093
|
strokeWidth: "2.5",
|
|
7093
7094
|
className: "pointer-events-none fill-input stroke-accent-ink transition-[r]"
|
|
7094
7095
|
}
|
|
7095
7096
|
)
|
|
7096
|
-
] },
|
|
7097
|
+
] }, key))
|
|
7097
7098
|
]
|
|
7098
7099
|
}
|
|
7099
7100
|
)
|
|
@@ -7545,8 +7546,8 @@ var DETAIL_KEYS = [
|
|
|
7545
7546
|
var trail = [];
|
|
7546
7547
|
var startedAt = Date.now();
|
|
7547
7548
|
function detailFor(properties) {
|
|
7548
|
-
for (const
|
|
7549
|
-
const value = properties[
|
|
7549
|
+
for (const key of DETAIL_KEYS) {
|
|
7550
|
+
const value = properties[key];
|
|
7550
7551
|
if (typeof value === "string" && value.length > 0 && value.length <= 24) return `:${value}`;
|
|
7551
7552
|
if (typeof value === "number" || typeof value === "boolean") return `:${String(value)}`;
|
|
7552
7553
|
}
|
|
@@ -7818,14 +7819,14 @@ function beginTimelineKeyframeRetime(input) {
|
|
|
7818
7819
|
actor2.phase = "complete";
|
|
7819
7820
|
};
|
|
7820
7821
|
if (coordinator.actor) cancel(coordinator.actor);
|
|
7821
|
-
for (const [
|
|
7822
|
-
if (pending3.sessionEpoch !== sessionEpoch) coordinator.pending.delete(
|
|
7822
|
+
for (const [key, pending3] of coordinator.pending) {
|
|
7823
|
+
if (pending3.sessionEpoch !== sessionEpoch) coordinator.pending.delete(key);
|
|
7823
7824
|
}
|
|
7824
|
-
for (const [
|
|
7825
|
+
for (const [key, pending3] of coordinator.pending) {
|
|
7825
7826
|
if (pending3.elementId === input.elementId && input.keyframes.some(
|
|
7826
7827
|
(keyframe) => input.keyframeKeyOf(keyframe) === pending3.destinationKeyframeKey && Math.abs(keyframe.percentage - pending3.clipPercentage) < 0.2
|
|
7827
7828
|
)) {
|
|
7828
|
-
coordinator.pending.delete(
|
|
7829
|
+
coordinator.pending.delete(key);
|
|
7829
7830
|
}
|
|
7830
7831
|
}
|
|
7831
7832
|
const pending2 = coordinator.pending.get(input.keyframeKey);
|
|
@@ -8018,8 +8019,8 @@ function beginTimelineKeyframeRetime(input) {
|
|
|
8018
8019
|
coordinator.latest = null;
|
|
8019
8020
|
cancel(actor);
|
|
8020
8021
|
} else if (actor.sourceWasPresent && !sourceStillPresent) {
|
|
8021
|
-
for (const [
|
|
8022
|
-
if (pending3.elementId === actor.elementId) coordinator.pending.delete(
|
|
8022
|
+
for (const [key, pending3] of coordinator.pending) {
|
|
8023
|
+
if (pending3.elementId === actor.elementId) coordinator.pending.delete(key);
|
|
8023
8024
|
}
|
|
8024
8025
|
if (coordinator.latest?.elementId === actor.elementId) coordinator.latest = null;
|
|
8025
8026
|
cancel(actor);
|
|
@@ -8587,11 +8588,11 @@ var EMPTY = { version: 1, lanes: [] };
|
|
|
8587
8588
|
var chainCache = /* @__PURE__ */ new Map();
|
|
8588
8589
|
var automationCache = /* @__PURE__ */ new Map();
|
|
8589
8590
|
var CACHE_LIMIT = 64;
|
|
8590
|
-
function cached3(store,
|
|
8591
|
-
const hit = store.get(
|
|
8591
|
+
function cached3(store, key, build) {
|
|
8592
|
+
const hit = store.get(key);
|
|
8592
8593
|
if (hit !== void 0) {
|
|
8593
|
-
store.delete(
|
|
8594
|
-
store.set(
|
|
8594
|
+
store.delete(key);
|
|
8595
|
+
store.set(key, hit);
|
|
8595
8596
|
return hit;
|
|
8596
8597
|
}
|
|
8597
8598
|
const value = build();
|
|
@@ -8599,7 +8600,7 @@ function cached3(store, key2, build) {
|
|
|
8599
8600
|
const oldest = store.keys().next();
|
|
8600
8601
|
if (!oldest.done) store.delete(oldest.value);
|
|
8601
8602
|
}
|
|
8602
|
-
store.set(
|
|
8603
|
+
store.set(key, value);
|
|
8603
8604
|
return value;
|
|
8604
8605
|
}
|
|
8605
8606
|
function elementFxChain(element) {
|
|
@@ -8676,14 +8677,14 @@ function groupAutomationLanes(elements) {
|
|
|
8676
8677
|
if (!isAudioOrVideoTimelineElement(element)) continue;
|
|
8677
8678
|
const chain = elementFxChain(element);
|
|
8678
8679
|
for (const lane of elementAutomationLanes(element)) {
|
|
8679
|
-
const
|
|
8680
|
+
const key = laneGroupKey(lane.target, chain);
|
|
8680
8681
|
const parts = automationLaneLabelParts(lane.target, chain);
|
|
8681
|
-
if (!
|
|
8682
|
-
const group = groups.get(
|
|
8682
|
+
if (!key || !parts) continue;
|
|
8683
|
+
const group = groups.get(key);
|
|
8683
8684
|
if (group) group.entries.push({ element, lane });
|
|
8684
8685
|
else {
|
|
8685
|
-
groups.set(
|
|
8686
|
-
key
|
|
8686
|
+
groups.set(key, {
|
|
8687
|
+
key,
|
|
8687
8688
|
name: parts.name,
|
|
8688
8689
|
param: parts.param,
|
|
8689
8690
|
entries: [{ element, lane }]
|
|
@@ -8826,7 +8827,7 @@ function useTimelineTrackDerivations(expandedElements) {
|
|
|
8826
8827
|
|
|
8827
8828
|
// src/player/components/timelineTrackInsertLayout.ts
|
|
8828
8829
|
function timelineTrackOrderChanged(previous, current2) {
|
|
8829
|
-
return current2.length !== previous.length || current2.some((
|
|
8830
|
+
return current2.length !== previous.length || current2.some((key, row) => key !== previous[row]);
|
|
8830
8831
|
}
|
|
8831
8832
|
function keyboardPickupInsertRow(row, allowed2) {
|
|
8832
8833
|
while (row > 0 && allowed2 && !allowed2.has(row)) row--;
|
|
@@ -8846,17 +8847,17 @@ function nextKeyboardInsertRow(input) {
|
|
|
8846
8847
|
function buildTimelineTrackInsertLayout(order, groups) {
|
|
8847
8848
|
const allowedRows = new Set(Array.from({ length: order.length + 1 }, (_, row) => row));
|
|
8848
8849
|
const anchors = new Map(groups.map((group) => [group.anchorKey, group.memberTracks]));
|
|
8849
|
-
const positions = new Map(order.map((
|
|
8850
|
+
const positions = new Map(order.map((key, row) => [key, row]));
|
|
8850
8851
|
for (const group of groups) {
|
|
8851
8852
|
const anchor2 = positions.get(group.anchorKey);
|
|
8852
8853
|
if (anchor2 === void 0) continue;
|
|
8853
|
-
const end = Math.max(anchor2, ...group.memberTracks.map((
|
|
8854
|
+
const end = Math.max(anchor2, ...group.memberTracks.map((key) => positions.get(key) ?? anchor2));
|
|
8854
8855
|
for (let row = anchor2 + 1; row <= end; row++) allowedRows.delete(row);
|
|
8855
8856
|
}
|
|
8856
8857
|
const tracks = /* @__PURE__ */ new Set();
|
|
8857
8858
|
const topologyRows = [0];
|
|
8858
|
-
for (const
|
|
8859
|
-
for (const track2 of anchors.get(
|
|
8859
|
+
for (const key of order) {
|
|
8860
|
+
for (const track2 of anchors.get(key) ?? [key]) tracks.add(track2);
|
|
8860
8861
|
topologyRows.push(tracks.size);
|
|
8861
8862
|
}
|
|
8862
8863
|
return {
|
|
@@ -8912,8 +8913,8 @@ function resolveTrackKeyframeClip(elements, laneCounts, selectedElementId, selec
|
|
|
8912
8913
|
const keyframed = elements.filter((element) => disclosable(element) >= 1);
|
|
8913
8914
|
if (keyframed.length === 0) return null;
|
|
8914
8915
|
const selected = keyframed.find((element) => {
|
|
8915
|
-
const
|
|
8916
|
-
return
|
|
8916
|
+
const key = element.key ?? element.id;
|
|
8917
|
+
return key === selectedElementId || selectedElementIds.has(key);
|
|
8917
8918
|
});
|
|
8918
8919
|
if (selected) return selected;
|
|
8919
8920
|
return keyframed.reduce(
|
|
@@ -9048,12 +9049,12 @@ function useDisplayRowHeights(displayTrackOrder2, rowGeometry) {
|
|
|
9048
9049
|
function insertPreviewTrack(trackOrder, preview2) {
|
|
9049
9050
|
const result = [];
|
|
9050
9051
|
let inserted = false;
|
|
9051
|
-
for (const
|
|
9052
|
-
if (!inserted && Number.isInteger(
|
|
9052
|
+
for (const key of trackOrder) {
|
|
9053
|
+
if (!inserted && Number.isInteger(key) && key > preview2) {
|
|
9053
9054
|
result.push(preview2);
|
|
9054
9055
|
inserted = true;
|
|
9055
9056
|
}
|
|
9056
|
-
result.push(
|
|
9057
|
+
result.push(key);
|
|
9057
9058
|
}
|
|
9058
9059
|
if (!inserted) result.push(preview2);
|
|
9059
9060
|
return result;
|
|
@@ -9065,7 +9066,7 @@ function useDisplayTrackOrder(draggedClip, trackOrder) {
|
|
|
9065
9066
|
return useMemo5(() => {
|
|
9066
9067
|
if (!started || previewTrack === void 0) return trackOrder;
|
|
9067
9068
|
if (insertRow !== null) {
|
|
9068
|
-
const pendingKey = trackOrder.reduce((lowest,
|
|
9069
|
+
const pendingKey = trackOrder.reduce((lowest, key) => Math.min(lowest, key), 0) - 1;
|
|
9069
9070
|
const displayOrder = [...trackOrder];
|
|
9070
9071
|
displayOrder.splice(insertRow, 0, pendingKey);
|
|
9071
9072
|
return displayOrder;
|
|
@@ -9105,8 +9106,8 @@ var NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
|
9105
9106
|
"PageUp",
|
|
9106
9107
|
"PageDown"
|
|
9107
9108
|
]);
|
|
9108
|
-
function isTimelineNavigationKey(
|
|
9109
|
-
return NAVIGATION_KEYS.has(
|
|
9109
|
+
function isTimelineNavigationKey(key) {
|
|
9110
|
+
return NAVIGATION_KEYS.has(key);
|
|
9110
9111
|
}
|
|
9111
9112
|
function elementId(element) {
|
|
9112
9113
|
return element.key ?? element.id;
|
|
@@ -9155,9 +9156,9 @@ function propertyItems(rowId, clip, keyframes) {
|
|
|
9155
9156
|
const unique = /* @__PURE__ */ new Map();
|
|
9156
9157
|
for (const keyframe of keyframes) {
|
|
9157
9158
|
const target = keyframeTarget2(keyframe);
|
|
9158
|
-
const
|
|
9159
|
-
if (!unique.has(
|
|
9160
|
-
unique.set(
|
|
9159
|
+
const key = timelineKeyframeSelectionKey(id, target);
|
|
9160
|
+
if (!unique.has(key)) {
|
|
9161
|
+
unique.set(key, {
|
|
9161
9162
|
target,
|
|
9162
9163
|
time: clip.start + keyframe.percentage / 100 * clip.duration
|
|
9163
9164
|
});
|
|
@@ -9293,14 +9294,14 @@ function buildTimelineLogicalRows({
|
|
|
9293
9294
|
if (!groupExpanded) return;
|
|
9294
9295
|
for (const track2 of group.memberTracks) emitTrack(track2, 2, groupRowId);
|
|
9295
9296
|
}
|
|
9296
|
-
for (const
|
|
9297
|
-
const group = groupByAnchor.get(
|
|
9297
|
+
for (const key of displayTrackOrder2) {
|
|
9298
|
+
const group = groupByAnchor.get(key);
|
|
9298
9299
|
if (group) {
|
|
9299
9300
|
emitGroup(group);
|
|
9300
9301
|
continue;
|
|
9301
9302
|
}
|
|
9302
|
-
if (trackGroupOf.has(
|
|
9303
|
-
emitTrack(
|
|
9303
|
+
if (trackGroupOf.has(key)) continue;
|
|
9304
|
+
emitTrack(key, 1, null);
|
|
9304
9305
|
}
|
|
9305
9306
|
return rows;
|
|
9306
9307
|
}
|
|
@@ -9318,29 +9319,29 @@ function nearestTarget(row, time) {
|
|
|
9318
9319
|
(left, right) => Math.abs(left.time - time) - Math.abs(right.time - time) || left.time - right.time || left.id.localeCompare(right.id)
|
|
9319
9320
|
)[0] ?? row;
|
|
9320
9321
|
}
|
|
9321
|
-
function resolveTimelineNavigationTarget(rows, currentId,
|
|
9322
|
+
function resolveTimelineNavigationTarget(rows, currentId, key, options = {}) {
|
|
9322
9323
|
const current2 = locateTimelineLogicalTarget(rows, currentId);
|
|
9323
9324
|
if (!current2) return null;
|
|
9324
9325
|
const { row, rowIndex, itemIndex, target } = current2;
|
|
9325
|
-
if (
|
|
9326
|
-
const boundaryRow = options.timelineBoundary ?
|
|
9326
|
+
if (key === "Home" || key === "End") {
|
|
9327
|
+
const boundaryRow = options.timelineBoundary ? key === "Home" ? rows[0] : rows.at(-1) : row;
|
|
9327
9328
|
if (!boundaryRow) return target;
|
|
9328
9329
|
if (options.timelineBoundary) return boundaryRow;
|
|
9329
|
-
return
|
|
9330
|
+
return key === "Home" ? boundaryRow : boundaryRow.items.at(-1) ?? boundaryRow;
|
|
9330
9331
|
}
|
|
9331
|
-
if (
|
|
9332
|
+
if (key === "ArrowLeft") {
|
|
9332
9333
|
if (itemIndex < 0) {
|
|
9333
9334
|
if (!row.parentId) return row;
|
|
9334
9335
|
return locateTimelineLogicalTarget(rows, row.parentId)?.target ?? row;
|
|
9335
9336
|
}
|
|
9336
9337
|
return itemIndex === 0 ? row : row.items[itemIndex - 1];
|
|
9337
9338
|
}
|
|
9338
|
-
if (
|
|
9339
|
+
if (key === "ArrowRight") {
|
|
9339
9340
|
if (itemIndex < 0) return row.items[0] ?? row;
|
|
9340
9341
|
return row.items[itemIndex + 1] ?? target;
|
|
9341
9342
|
}
|
|
9342
|
-
const direction =
|
|
9343
|
-
const pageKey =
|
|
9343
|
+
const direction = key === "ArrowUp" || key === "PageUp" ? -1 : 1;
|
|
9344
|
+
const pageKey = key === "PageUp" || key === "PageDown";
|
|
9344
9345
|
const pageSize = options.pageSize;
|
|
9345
9346
|
if (pageKey && (pageSize === void 0 || !Number.isFinite(pageSize) || pageSize < 1)) {
|
|
9346
9347
|
return target;
|
|
@@ -9771,15 +9772,15 @@ function beginTimelineOptimisticGesture(updateElement, keys, scope = "timing") {
|
|
|
9771
9772
|
scopes.set(scope, revisions);
|
|
9772
9773
|
}
|
|
9773
9774
|
const gesture = /* @__PURE__ */ new Map();
|
|
9774
|
-
for (const
|
|
9775
|
-
const revision = (revisions.get(
|
|
9776
|
-
revisions.set(
|
|
9777
|
-
gesture.set(
|
|
9775
|
+
for (const key of keys) {
|
|
9776
|
+
const revision = (revisions.get(key) ?? 0) + 1;
|
|
9777
|
+
revisions.set(key, revision);
|
|
9778
|
+
gesture.set(key, revision);
|
|
9778
9779
|
}
|
|
9779
9780
|
return gesture;
|
|
9780
9781
|
}
|
|
9781
|
-
function isLatestTimelineOptimisticGesture(updateElement, gesture,
|
|
9782
|
-
return gesture.has(
|
|
9782
|
+
function isLatestTimelineOptimisticGesture(updateElement, gesture, key, scope = "timing") {
|
|
9783
|
+
return gesture.has(key) && revisionsByUpdater.get(updateElement)?.get(scope)?.get(key) === gesture.get(key);
|
|
9783
9784
|
}
|
|
9784
9785
|
function rollbackLatestTimelineOptimisticGesture(updateElement, gesture, rollbacks) {
|
|
9785
9786
|
batchElementUpdates(() => {
|
|
@@ -9873,9 +9874,9 @@ var StudioFileConflictError = class extends StudioSaveHttpError {
|
|
|
9873
9874
|
this.attemptedContent = input.attemptedContent;
|
|
9874
9875
|
}
|
|
9875
9876
|
};
|
|
9876
|
-
function readNumericProperty(value,
|
|
9877
|
+
function readNumericProperty(value, key) {
|
|
9877
9878
|
const record2 = value;
|
|
9878
|
-
const property = record2[
|
|
9879
|
+
const property = record2[key];
|
|
9879
9880
|
return typeof property === "number" && Number.isFinite(property) ? property : void 0;
|
|
9880
9881
|
}
|
|
9881
9882
|
function createStudioSaveAbortError() {
|
|
@@ -10308,15 +10309,15 @@ function persistMoveEdits(edits, deps, coalesceKey, operation = "timing") {
|
|
|
10308
10309
|
);
|
|
10309
10310
|
const applyEdit = (e, reassert = false) => {
|
|
10310
10311
|
const { timing, detach } = moveStoreUpdates(e);
|
|
10311
|
-
const
|
|
10312
|
+
const key = keyOf6(e.element);
|
|
10312
10313
|
const updates = {};
|
|
10313
|
-
if (!reassert || isLatestTimelineOptimisticGesture(updateElement, revision,
|
|
10314
|
+
if (!reassert || isLatestTimelineOptimisticGesture(updateElement, revision, key)) {
|
|
10314
10315
|
Object.assign(updates, timing);
|
|
10315
10316
|
}
|
|
10316
|
-
if (detach && (!reassert || isLatestTimelineOptimisticGesture(updateElement, membershipRevision,
|
|
10317
|
+
if (detach && (!reassert || isLatestTimelineOptimisticGesture(updateElement, membershipRevision, key, "membership"))) {
|
|
10317
10318
|
updates.audioGroup = void 0;
|
|
10318
10319
|
}
|
|
10319
|
-
if (Object.keys(updates).length) updateElement(
|
|
10320
|
+
if (Object.keys(updates).length) updateElement(key, updates);
|
|
10320
10321
|
};
|
|
10321
10322
|
const applyEdits = (reassert = false) => batchElementUpdates(() => edits.forEach((e) => applyEdit(e, reassert)));
|
|
10322
10323
|
applyEdits();
|
|
@@ -11320,9 +11321,9 @@ function useTimelineClipDrag({
|
|
|
11320
11321
|
};
|
|
11321
11322
|
const pickup = (event, viewport2) => {
|
|
11322
11323
|
const target = timelineKeyboardEventTarget(event.target, viewport2);
|
|
11323
|
-
const
|
|
11324
|
-
if (
|
|
11325
|
-
const element = getTimelineElementIndexes(elementsRef.current).byKey.get(
|
|
11324
|
+
const key = target?.dataset.elId;
|
|
11325
|
+
if (key === void 0 || !onMoveElementRef.current) return;
|
|
11326
|
+
const element = getTimelineElementIndexes(elementsRef.current).byKey.get(key);
|
|
11326
11327
|
if (!element || !getClipCapabilities(element).canMove) return;
|
|
11327
11328
|
event.preventDefault();
|
|
11328
11329
|
event.stopImmediatePropagation();
|
|
@@ -11596,29 +11597,29 @@ function useTimelineDragPreviewState(draggedClip, resizingClip, selectedElementI
|
|
|
11596
11597
|
import { useCallback as useCallback11 } from "react";
|
|
11597
11598
|
|
|
11598
11599
|
// src/player/components/timelineLinkSelection.ts
|
|
11599
|
-
function selectClipWithLinks(
|
|
11600
|
+
function selectClipWithLinks(key, altKey, setSelectedElementId) {
|
|
11600
11601
|
const state = usePlayerStore.getState();
|
|
11601
11602
|
if (altKey || !isLinkedSelectionOn()) {
|
|
11602
|
-
state.setSelection([
|
|
11603
|
+
state.setSelection([key], key);
|
|
11603
11604
|
return;
|
|
11604
11605
|
}
|
|
11605
|
-
setSelectedElementId(
|
|
11606
|
+
setSelectedElementId(key);
|
|
11606
11607
|
const { selectedElementIds, elements } = usePlayerStore.getState();
|
|
11607
11608
|
const expanded = expandToLinkedMembers(selectedElementIds, elements);
|
|
11608
|
-
if (expanded.size > selectedElementIds.size) state.setSelection(expanded,
|
|
11609
|
+
if (expanded.size > selectedElementIds.size) state.setSelection(expanded, key);
|
|
11609
11610
|
}
|
|
11610
|
-
function toggleClipWithLinks(
|
|
11611
|
+
function toggleClipWithLinks(key, altKey) {
|
|
11611
11612
|
const state = usePlayerStore.getState();
|
|
11612
|
-
const element = state.elements.find((el) => (el.key ?? el.id) ===
|
|
11613
|
+
const element = state.elements.find((el) => (el.key ?? el.id) === key);
|
|
11613
11614
|
const members = element ? linkedMembersOf(element, state.elements, !altKey && isLinkedSelectionOn()) : [];
|
|
11614
|
-
const memberKeys = members.length > 0 ? members.map((el) => el.key ?? el.id) : [
|
|
11615
|
+
const memberKeys = members.length > 0 ? members.map((el) => el.key ?? el.id) : [key];
|
|
11615
11616
|
const next = new Set(state.selectedElementIds);
|
|
11616
|
-
const removing = next.has(
|
|
11617
|
+
const removing = next.has(key);
|
|
11617
11618
|
for (const memberKey of memberKeys) {
|
|
11618
11619
|
if (removing) next.delete(memberKey);
|
|
11619
11620
|
else next.add(memberKey);
|
|
11620
11621
|
}
|
|
11621
|
-
state.setSelection(next, removing ? state.selectedElementId :
|
|
11622
|
+
state.setSelection(next, removing ? state.selectedElementId : key);
|
|
11622
11623
|
const primary = usePlayerStore.getState().selectedElementId;
|
|
11623
11624
|
return state.elements.find((el) => (el.key ?? el.id) === primary) ?? null;
|
|
11624
11625
|
}
|
|
@@ -12810,9 +12811,9 @@ var SAVES_AN_EDIT = {
|
|
|
12810
12811
|
};
|
|
12811
12812
|
function trackEditCommits(actions) {
|
|
12812
12813
|
const tracked = { ...actions };
|
|
12813
|
-
for (const
|
|
12814
|
-
if (!SAVES_AN_EDIT[
|
|
12815
|
-
tracked[
|
|
12814
|
+
for (const key of Object.keys(SAVES_AN_EDIT)) {
|
|
12815
|
+
if (!SAVES_AN_EDIT[key]) continue;
|
|
12816
|
+
tracked[key] = trackedStudioEdit(actions[key], {
|
|
12816
12817
|
afterOlderSaves: true
|
|
12817
12818
|
});
|
|
12818
12819
|
}
|
|
@@ -13624,13 +13625,13 @@ function useTimelineGeometry({
|
|
|
13624
13625
|
// src/player/components/useAutoExpandKeyframedClips.ts
|
|
13625
13626
|
import { useEffect as useEffect18, useRef as useRef20 } from "react";
|
|
13626
13627
|
function freshLaneClips(gsapAnimations, clips) {
|
|
13627
|
-
for (const
|
|
13628
|
-
if (!gsapAnimations.has(
|
|
13628
|
+
for (const key of clips) {
|
|
13629
|
+
if (!gsapAnimations.has(key)) clips.delete(key);
|
|
13629
13630
|
}
|
|
13630
13631
|
const fresh = [];
|
|
13631
|
-
for (const [
|
|
13632
|
-
if (clips.has(
|
|
13633
|
-
if (animations.some(animationContributesLane)) fresh.push(
|
|
13632
|
+
for (const [key, animations] of gsapAnimations) {
|
|
13633
|
+
if (clips.has(key)) continue;
|
|
13634
|
+
if (animations.some(animationContributesLane)) fresh.push(key);
|
|
13634
13635
|
}
|
|
13635
13636
|
return fresh;
|
|
13636
13637
|
}
|
|
@@ -13648,7 +13649,7 @@ function useAutoExpandKeyframedClips(gsapAnimations) {
|
|
|
13648
13649
|
}
|
|
13649
13650
|
const fresh = freshLaneClips(gsapAnimations, seen.current.clips);
|
|
13650
13651
|
if (fresh.length === 0) return;
|
|
13651
|
-
for (const
|
|
13652
|
+
for (const key of fresh) seen.current.clips.add(key);
|
|
13652
13653
|
expandClips(fresh);
|
|
13653
13654
|
}, [gsapAnimations, expandClips, projectId]);
|
|
13654
13655
|
}
|
|
@@ -13885,7 +13886,7 @@ function TimelineEditProvider({
|
|
|
13885
13886
|
// Each callback is a stable reference from the parent — memoize the bag
|
|
13886
13887
|
// so consumers don't re-render when unrelated parent state changes.
|
|
13887
13888
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13888
|
-
EDIT_CALLBACK_KEYS.map((
|
|
13889
|
+
EDIT_CALLBACK_KEYS.map((key) => value[key])
|
|
13889
13890
|
);
|
|
13890
13891
|
return /* @__PURE__ */ jsx23(TimelineEditContext.Provider, { value: memoized, children });
|
|
13891
13892
|
}
|
|
@@ -14241,7 +14242,7 @@ function useTimelineActiveClips({
|
|
|
14241
14242
|
import { useCallback as useCallback19 } from "react";
|
|
14242
14243
|
function useTimelineLaneMoveRefresh() {
|
|
14243
14244
|
const setRefreshKey = useStudioPlaybackContextOptional()?.setRefreshKey;
|
|
14244
|
-
return useCallback19(() => setRefreshKey?.((
|
|
14245
|
+
return useCallback19(() => setRefreshKey?.((key) => key + 1), [setRefreshKey]);
|
|
14245
14246
|
}
|
|
14246
14247
|
|
|
14247
14248
|
// src/player/components/useTimelineFocusCoordinator.ts
|
|
@@ -14512,7 +14513,7 @@ function sameData(a, b) {
|
|
|
14512
14513
|
if ("nodeType" in a || "nodeType" in b || Array.isArray(a) !== Array.isArray(b)) return false;
|
|
14513
14514
|
const keys = Object.keys(a);
|
|
14514
14515
|
if (keys.length !== Object.keys(b).length) return false;
|
|
14515
|
-
return keys.every((
|
|
14516
|
+
return keys.every((key) => sameData(a[key], b[key]));
|
|
14516
14517
|
}
|
|
14517
14518
|
|
|
14518
14519
|
// src/player/components/timelineFocusIdentity.ts
|
|
@@ -14558,7 +14559,7 @@ function useTimelineVirtualRows({
|
|
|
14558
14559
|
() => [
|
|
14559
14560
|
...new Set(
|
|
14560
14561
|
[...pinnedRowKeys, ...focusedRowKey === void 0 ? [] : [focusedRowKey]].map(
|
|
14561
|
-
(
|
|
14562
|
+
(key) => rowGeometry.getRowIndex(key)
|
|
14562
14563
|
)
|
|
14563
14564
|
)
|
|
14564
14565
|
],
|
|
@@ -15355,7 +15356,7 @@ import { useCallback as useCallback24, useRef as useRef28, useSyncExternalStore
|
|
|
15355
15356
|
function useSettledScrollLeft(scrollRef) {
|
|
15356
15357
|
const scrollingRef = useRef28(false);
|
|
15357
15358
|
const settledRef = useRef28(0);
|
|
15358
|
-
const
|
|
15359
|
+
const subscribe2 = useCallback24(
|
|
15359
15360
|
(onChange) => {
|
|
15360
15361
|
const el = scrollRef.current;
|
|
15361
15362
|
settledRef.current = el?.scrollLeft ?? 0;
|
|
@@ -15383,7 +15384,7 @@ function useSettledScrollLeft(scrollRef) {
|
|
|
15383
15384
|
[scrollRef]
|
|
15384
15385
|
);
|
|
15385
15386
|
return useSyncExternalStore5(
|
|
15386
|
-
|
|
15387
|
+
subscribe2,
|
|
15387
15388
|
() => scrollingRef.current ? null : settledRef.current,
|
|
15388
15389
|
() => null
|
|
15389
15390
|
);
|
|
@@ -15789,8 +15790,8 @@ var FADE_KEYS = {
|
|
|
15789
15790
|
End: (_current, _step, limit) => limit,
|
|
15790
15791
|
Enter: (current2) => current2 === 0 ? DEFAULT_FADE_SECONDS : null
|
|
15791
15792
|
};
|
|
15792
|
-
function keyedFadeSeconds(
|
|
15793
|
-
return FADE_KEYS[
|
|
15793
|
+
function keyedFadeSeconds(key, shift, current2, limit) {
|
|
15794
|
+
return FADE_KEYS[key]?.(current2, shift ? 1 : 0.1, limit) ?? null;
|
|
15794
15795
|
}
|
|
15795
15796
|
function TimelineClipFades({
|
|
15796
15797
|
el,
|
|
@@ -16190,7 +16191,7 @@ function useThumbnailLease(request2, scheduler = thumbnailScheduler) {
|
|
|
16190
16191
|
const leaseRef = useRef30(null);
|
|
16191
16192
|
const identity = request2 ? createThumbnailRequestIdentity(request2) : null;
|
|
16192
16193
|
const priority = request2?.priority;
|
|
16193
|
-
const
|
|
16194
|
+
const subscribe2 = useCallback25(
|
|
16194
16195
|
(listener2) => {
|
|
16195
16196
|
const current2 = requestRef.current;
|
|
16196
16197
|
if (!current2 || identity === null) return () => {
|
|
@@ -16211,7 +16212,7 @@ function useThumbnailLease(request2, scheduler = thumbnailScheduler) {
|
|
|
16211
16212
|
useLayoutEffect8(() => {
|
|
16212
16213
|
if (priority) leaseRef.current?.updatePriority(priority);
|
|
16213
16214
|
}, [priority]);
|
|
16214
|
-
return useSyncExternalStore6(
|
|
16215
|
+
return useSyncExternalStore6(subscribe2, getSnapshot, () => IDLE);
|
|
16215
16216
|
}
|
|
16216
16217
|
|
|
16217
16218
|
// src/hooks/useThumbnailStripSize.ts
|
|
@@ -16235,7 +16236,7 @@ var merge = (prev, patch) => {
|
|
|
16235
16236
|
const width = next.width > 0 ? Math.ceil(next.width) : Infinity;
|
|
16236
16237
|
next.inViewStart = isShort(width) ? 0 : Math.min(next.inViewStart, width);
|
|
16237
16238
|
next.inViewEnd = isShort(width) ? width : Math.min(next.inViewEnd, width);
|
|
16238
|
-
return Object.keys(next).every((
|
|
16239
|
+
return Object.keys(next).every((key) => next[key] === prev[key]) ? prev : next;
|
|
16239
16240
|
};
|
|
16240
16241
|
var NEAR_PX = IN_VIEW_CHUNK_PX / 2;
|
|
16241
16242
|
var strips = /* @__PURE__ */ new Map();
|
|
@@ -17096,9 +17097,9 @@ function patchInlineStyleInTag(tag, prop, value) {
|
|
|
17096
17097
|
for (const part of splitInlineStyleDeclarations(existingStyle)) {
|
|
17097
17098
|
const colon = part.indexOf(":");
|
|
17098
17099
|
if (colon < 0) continue;
|
|
17099
|
-
const
|
|
17100
|
+
const key = part.slice(0, colon).trim();
|
|
17100
17101
|
const val = part.slice(colon + 1).trim();
|
|
17101
|
-
if (
|
|
17102
|
+
if (key) props.set(key, val);
|
|
17102
17103
|
}
|
|
17103
17104
|
if (value === null) {
|
|
17104
17105
|
props.delete(prop);
|
|
@@ -17418,7 +17419,6 @@ async function writeProjectFilesWithHistoryInQueue({
|
|
|
17418
17419
|
}
|
|
17419
17420
|
|
|
17420
17421
|
// src/utils/gsapSoftReload.ts
|
|
17421
|
-
import { COLOR_GRADING_SOURCE_HIDDEN_ATTR as COLOR_GRADING_SOURCE_HIDDEN_ATTR2 } from "@hyperframes/core/color-grading";
|
|
17422
17422
|
import { parseGsapScript as parseGsapScript2 } from "@hyperframes/parsers/gsap-parser";
|
|
17423
17423
|
import { GSAP_BASE_URL_META, motionPathPluginUrl } from "@hyperframes/core/gsap-cdn";
|
|
17424
17424
|
|
|
@@ -17560,9 +17560,9 @@ function elementTargets(tween) {
|
|
|
17560
17560
|
var NESTED_VARS = /* @__PURE__ */ new Set(["css", "startAt", "keyframes"]);
|
|
17561
17561
|
function tweenedProps(vars) {
|
|
17562
17562
|
if (!vars || typeof vars !== "object") return [];
|
|
17563
|
-
return Object.entries(vars).flatMap(([
|
|
17564
|
-
|
|
17565
|
-
...NESTED_VARS.has(
|
|
17563
|
+
return Object.entries(vars).flatMap(([key, value]) => [
|
|
17564
|
+
key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`),
|
|
17565
|
+
...NESTED_VARS.has(key) || /^\d|%$/.test(key) ? tweenedProps(value) : []
|
|
17566
17566
|
]);
|
|
17567
17567
|
}
|
|
17568
17568
|
function ownTweens(tl, nested) {
|
|
@@ -17586,11 +17586,11 @@ function collectResetTargets(win, doc, targetKeys, outgoingScripts = []) {
|
|
|
17586
17586
|
const targets = /* @__PURE__ */ new Map();
|
|
17587
17587
|
const timelines = win.__timelines ?? {};
|
|
17588
17588
|
const others = new Set(
|
|
17589
|
-
Object.entries(timelines).flatMap(([
|
|
17589
|
+
Object.entries(timelines).flatMap(([key, tl]) => targetKeys.includes(key) ? [] : [tl])
|
|
17590
17590
|
);
|
|
17591
|
-
for (const
|
|
17591
|
+
for (const key of targetKeys) {
|
|
17592
17592
|
try {
|
|
17593
|
-
for (const tween of ownTweens(timelines[
|
|
17593
|
+
for (const tween of ownTweens(timelines[key] ?? {}, others)) addTweenTargets(tween, targets);
|
|
17594
17594
|
} catch {
|
|
17595
17595
|
}
|
|
17596
17596
|
}
|
|
@@ -17611,11 +17611,11 @@ function tweenTargetsIn(timelines) {
|
|
|
17611
17611
|
}
|
|
17612
17612
|
return els;
|
|
17613
17613
|
}
|
|
17614
|
-
function compositionRoot(doc,
|
|
17615
|
-
return doc.querySelectorAll(`[data-composition-id="${CSS.escape(
|
|
17614
|
+
function compositionRoot(doc, key) {
|
|
17615
|
+
return doc.querySelectorAll(`[data-composition-id="${CSS.escape(key)}"]`)[0];
|
|
17616
17616
|
}
|
|
17617
17617
|
function compositionFile(doc, targetKeys) {
|
|
17618
|
-
const root = targetKeys.map((
|
|
17618
|
+
const root = targetKeys.map((key) => compositionRoot(doc, key)).find(Boolean);
|
|
17619
17619
|
return root?.closest("[data-composition-file]")?.getAttribute("data-composition-file") ?? null;
|
|
17620
17620
|
}
|
|
17621
17621
|
function sweepHeldElements(doc, targetKeys, others, targets) {
|
|
@@ -17758,7 +17758,7 @@ function verifyTimelinesPopulated(win, targetKeys) {
|
|
|
17758
17758
|
const timelines = win.__timelines;
|
|
17759
17759
|
if (!timelines) return false;
|
|
17760
17760
|
if (targetKeys.length > 0) {
|
|
17761
|
-
return targetKeys.every((
|
|
17761
|
+
return targetKeys.every((key) => timelines[key] != null);
|
|
17762
17762
|
}
|
|
17763
17763
|
return Object.keys(timelines).filter((k) => k !== "__proxied").length > 0;
|
|
17764
17764
|
}
|
|
@@ -17823,13 +17823,13 @@ function repaintDroppedTweenStyle(win, doc, authored, targetKeys, restoredScript
|
|
|
17823
17823
|
}
|
|
17824
17824
|
}
|
|
17825
17825
|
function timelineKeys(scriptText) {
|
|
17826
|
-
return [...scriptText.matchAll(/__timelines\s*\[\s*["'`]([^"'`]+)["'`]\s*\]/g)].map((m) => m[1]).filter((
|
|
17826
|
+
return [...scriptText.matchAll(/__timelines\s*\[\s*["'`]([^"'`]+)["'`]\s*\]/g)].map((m) => m[1]).filter((key) => key !== "__proxied");
|
|
17827
17827
|
}
|
|
17828
17828
|
function scriptsRegistering(scripts, keys) {
|
|
17829
17829
|
return scripts.filter((script) => {
|
|
17830
17830
|
const text3 = script.textContent || "";
|
|
17831
17831
|
return keys.some(
|
|
17832
|
-
(
|
|
17832
|
+
(key) => text3.includes(`__timelines["${key}"]`) || text3.includes(`__timelines['${key}']`)
|
|
17833
17833
|
);
|
|
17834
17834
|
});
|
|
17835
17835
|
}
|
|
@@ -17866,15 +17866,15 @@ function applySoftReload(iframe, scriptText, options = {}) {
|
|
|
17866
17866
|
staleScripts.map((script) => script.textContent ?? "")
|
|
17867
17867
|
);
|
|
17868
17868
|
if (timelines) {
|
|
17869
|
-
for (const
|
|
17870
|
-
const tl = timelines[
|
|
17869
|
+
for (const key of targetKeys) {
|
|
17870
|
+
const tl = timelines[key];
|
|
17871
17871
|
if (!tl) continue;
|
|
17872
17872
|
try {
|
|
17873
17873
|
tl.clear?.();
|
|
17874
17874
|
tl.kill?.();
|
|
17875
17875
|
} catch {
|
|
17876
17876
|
}
|
|
17877
|
-
delete timelines[
|
|
17877
|
+
delete timelines[key];
|
|
17878
17878
|
}
|
|
17879
17879
|
}
|
|
17880
17880
|
const allTargets = [...targets.keys()];
|
|
@@ -17888,11 +17888,7 @@ function applySoftReload(iframe, scriptText, options = {}) {
|
|
|
17888
17888
|
s.cssText = css2;
|
|
17889
17889
|
restoreAuthoredStyle(s, findAuthoredStyle(el), targets.get(el));
|
|
17890
17890
|
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
|
-
}
|
|
17891
|
+
if (authored !== null) applyAuthoredInlineOpacity(s, authored);
|
|
17896
17892
|
}
|
|
17897
17893
|
}
|
|
17898
17894
|
forgetLiveSets(targets);
|
|
@@ -18133,9 +18129,9 @@ function planLiveRetime(before, after) {
|
|
|
18133
18129
|
}
|
|
18134
18130
|
function planLiveRetimeFromPreview(iframe, after) {
|
|
18135
18131
|
const doc = iframe?.contentDocument;
|
|
18136
|
-
const [
|
|
18137
|
-
if (!doc || !
|
|
18138
|
-
const [script, ...extra] = scriptsRegistering(findGsapScriptElements(doc), [
|
|
18132
|
+
const [key] = timelineKeys(after);
|
|
18133
|
+
if (!doc || !key) return RERUN;
|
|
18134
|
+
const [script, ...extra] = scriptsRegistering(findGsapScriptElements(doc), [key]);
|
|
18139
18135
|
if (!script || extra.length > 0) return RERUN;
|
|
18140
18136
|
const plan = planLiveRetime(script.textContent ?? "", after);
|
|
18141
18137
|
return plan.kind === "retime" ? { ...plan, script } : RERUN;
|
|
@@ -18565,8 +18561,8 @@ function deleteSelectedKeyframes(session) {
|
|
|
18565
18561
|
const fallbackAnimation = keyframedAnimations.length === 1 ? keyframedAnimations[0] : void 0;
|
|
18566
18562
|
const animationsById = new Map(keyframedAnimations.map((animation2) => [animation2.id, animation2]));
|
|
18567
18563
|
const removals = /* @__PURE__ */ new Map();
|
|
18568
|
-
for (const
|
|
18569
|
-
const target = timelineKeyframeTargetFromSelectionKey(selectedElementId,
|
|
18564
|
+
for (const key of selectedKeyframes) {
|
|
18565
|
+
const target = timelineKeyframeTargetFromSelectionKey(selectedElementId, key);
|
|
18570
18566
|
if (!target) continue;
|
|
18571
18567
|
const animation2 = target.animationId ? animationsById.get(target.animationId) : fallbackAnimation;
|
|
18572
18568
|
if (!animation2) continue;
|
|
@@ -19651,8 +19647,8 @@ import { jsx as jsx37 } from "react/jsx-runtime";
|
|
|
19651
19647
|
var sameCapabilities = (a, b) => a.canMove === b.canMove && a.canTrimStart === b.canTrimStart && a.canTrimEnd === b.canTrimEnd && a.readOnly === b.readOnly;
|
|
19652
19648
|
var zoomKey = (p) => clipZoomKey(p.previewElement, p.pps, p.isSelected || p.isHovered);
|
|
19653
19649
|
function sameClip(prev, next) {
|
|
19654
|
-
for (const
|
|
19655
|
-
if (
|
|
19650
|
+
for (const key of Object.keys(next)) {
|
|
19651
|
+
if (key === "pps" || key === "capabilities" || prev[key] === next[key]) continue;
|
|
19656
19652
|
return false;
|
|
19657
19653
|
}
|
|
19658
19654
|
return sameCapabilities(prev.capabilities, next.capabilities) && zoomKey(prev) === zoomKey(next);
|
|
@@ -21430,10 +21426,10 @@ function TimelineAutomationLaneSlot({
|
|
|
21430
21426
|
const rowsByClip = /* @__PURE__ */ new Map();
|
|
21431
21427
|
groupAutomationLanes(clips).forEach((group, rowIndex) => {
|
|
21432
21428
|
for (const entry3 of group.entries) {
|
|
21433
|
-
const
|
|
21434
|
-
const rows = rowsByClip.get(
|
|
21429
|
+
const key = getTimelineElementIdentity(entry3.element);
|
|
21430
|
+
const rows = rowsByClip.get(key);
|
|
21435
21431
|
if (rows) rows.push({ lane: entry3.lane, rowIndex });
|
|
21436
|
-
else rowsByClip.set(
|
|
21432
|
+
else rowsByClip.set(key, [{ lane: entry3.lane, rowIndex }]);
|
|
21437
21433
|
}
|
|
21438
21434
|
});
|
|
21439
21435
|
const top = topOffset ?? getTimelineLaneTop(laneCount);
|
|
@@ -21767,7 +21763,7 @@ function resolveTimelineIdForSelection(selection, elements, activeCompPath, byCl
|
|
|
21767
21763
|
);
|
|
21768
21764
|
}
|
|
21769
21765
|
function timelineKeysForSelections(selections, elements, activeCompPath) {
|
|
21770
|
-
return selections.map((selection) => resolveTimelineIdForSelection(selection, elements, activeCompPath)).filter((
|
|
21766
|
+
return selections.map((selection) => resolveTimelineIdForSelection(selection, elements, activeCompPath)).filter((key) => key !== null);
|
|
21771
21767
|
}
|
|
21772
21768
|
function resolveTimelineSelectionSeekTime(currentTime, element) {
|
|
21773
21769
|
if (!element) return null;
|
|
@@ -21846,9 +21842,9 @@ import { isTypingTarget as isTypingTarget4 } from "@hyperframes/core/typing-targ
|
|
|
21846
21842
|
function elementKeyOf(element) {
|
|
21847
21843
|
return element.key ?? element.id;
|
|
21848
21844
|
}
|
|
21849
|
-
function findElement(elements,
|
|
21850
|
-
if (!
|
|
21851
|
-
return elements.find((el) => elementKeyOf(el) ===
|
|
21845
|
+
function findElement(elements, key) {
|
|
21846
|
+
if (!key) return null;
|
|
21847
|
+
return elements.find((el) => elementKeyOf(el) === key) ?? null;
|
|
21852
21848
|
}
|
|
21853
21849
|
function resolveSelectionContext(state, lanes, sel) {
|
|
21854
21850
|
const element = findElement(state.elements, sel.elementKey);
|
|
@@ -24066,14 +24062,14 @@ function useTimelineClipDisclosure() {
|
|
|
24066
24062
|
const toggleClipExpanded = usePlayerStore((s) => s.toggleClipExpanded);
|
|
24067
24063
|
return {
|
|
24068
24064
|
toggleRowExpanded: (keys) => {
|
|
24069
|
-
const willExpand = !keys.some((
|
|
24065
|
+
const willExpand = !keys.some((key) => expandedClipIds.has(key));
|
|
24070
24066
|
trackStudioKeyframeLaneExpand({ expanded: willExpand });
|
|
24071
24067
|
if (willExpand) expandClips(keys);
|
|
24072
|
-
else for (const
|
|
24068
|
+
else for (const key of keys) setClipExpanded(key, false);
|
|
24073
24069
|
},
|
|
24074
|
-
toggleClipExpanded: (
|
|
24075
|
-
trackStudioKeyframeLaneExpand({ expanded: !expandedClipIds.has(
|
|
24076
|
-
toggleClipExpanded(
|
|
24070
|
+
toggleClipExpanded: (key) => {
|
|
24071
|
+
trackStudioKeyframeLaneExpand({ expanded: !expandedClipIds.has(key) });
|
|
24072
|
+
toggleClipExpanded(key);
|
|
24077
24073
|
}
|
|
24078
24074
|
};
|
|
24079
24075
|
}
|
|
@@ -24669,8 +24665,8 @@ function TimelineLanes({
|
|
|
24669
24665
|
{
|
|
24670
24666
|
elements: automationElements,
|
|
24671
24667
|
isSelected: (element) => {
|
|
24672
|
-
const
|
|
24673
|
-
return selectedElementId ===
|
|
24668
|
+
const key = getTimelineElementIdentity(element);
|
|
24669
|
+
return selectedElementId === key || selectedElementIds.has(key);
|
|
24674
24670
|
},
|
|
24675
24671
|
lanes: automationLanes,
|
|
24676
24672
|
pps,
|
|
@@ -25275,7 +25271,7 @@ function normalizeToastText(plan) {
|
|
|
25275
25271
|
function isNormalizePlan(value) {
|
|
25276
25272
|
if (typeof value !== "object" || value === null) return false;
|
|
25277
25273
|
return ["targetLufs", "projectedLufs", "volume", "changeDb"].every(
|
|
25278
|
-
(
|
|
25274
|
+
(key) => typeof Reflect.get(value, key) === "number"
|
|
25279
25275
|
);
|
|
25280
25276
|
}
|
|
25281
25277
|
async function requestNormalizePlan(projectId, el, fetchImpl = studioApiFetch) {
|
|
@@ -25469,8 +25465,8 @@ function AudioGainDialog({
|
|
|
25469
25465
|
}
|
|
25470
25466
|
const byKey = new Map(elements.map((el) => [keyOf10(el), el]));
|
|
25471
25467
|
const plan = planAudioGain(clips, { mode, db: values[mode] });
|
|
25472
|
-
const edits = plan.flatMap(({ key
|
|
25473
|
-
const element = byKey.get(
|
|
25468
|
+
const edits = plan.flatMap(({ key, gain }) => {
|
|
25469
|
+
const element = byKey.get(key);
|
|
25474
25470
|
return element ? [{ element, gain }] : [];
|
|
25475
25471
|
});
|
|
25476
25472
|
await writeClipGains(edits, edit, AUDIO_GAIN_LABEL);
|
|
@@ -25645,17 +25641,17 @@ import { jsx as jsx65, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
|
25645
25641
|
function draftKey(start, end) {
|
|
25646
25642
|
return `hf-edit-draft:${start.toFixed(2)}:${end.toFixed(2)}`;
|
|
25647
25643
|
}
|
|
25648
|
-
function readDraft(
|
|
25644
|
+
function readDraft(key) {
|
|
25649
25645
|
try {
|
|
25650
|
-
return sessionStorage.getItem(
|
|
25646
|
+
return sessionStorage.getItem(key) ?? "";
|
|
25651
25647
|
} catch {
|
|
25652
25648
|
return "";
|
|
25653
25649
|
}
|
|
25654
25650
|
}
|
|
25655
|
-
function writeDraft(
|
|
25651
|
+
function writeDraft(key, value) {
|
|
25656
25652
|
try {
|
|
25657
|
-
if (value) sessionStorage.setItem(
|
|
25658
|
-
else sessionStorage.removeItem(
|
|
25653
|
+
if (value) sessionStorage.setItem(key, value);
|
|
25654
|
+
else sessionStorage.removeItem(key);
|
|
25659
25655
|
} catch {
|
|
25660
25656
|
}
|
|
25661
25657
|
}
|
|
@@ -26571,7 +26567,7 @@ function formatBoundingBox(bounds) {
|
|
|
26571
26567
|
return `x=${Math.round(bounds.x)}, y=${Math.round(bounds.y)}, width=${Math.round(bounds.width)}, height=${Math.round(bounds.height)}`;
|
|
26572
26568
|
}
|
|
26573
26569
|
function formatStyleBlock(styles) {
|
|
26574
|
-
return Object.entries(styles).filter(([, value]) => value && value !== "initial").map(([
|
|
26570
|
+
return Object.entries(styles).filter(([, value]) => value && value !== "initial").map(([key, value]) => `${key}: ${value}`).join("\n");
|
|
26575
26571
|
}
|
|
26576
26572
|
function formatTextFields(fields) {
|
|
26577
26573
|
return fields.map(
|
|
@@ -28060,38 +28056,38 @@ function use(frame3) {
|
|
|
28060
28056
|
if (frame3.users++ === 0 && released.delete(frame3)) releasedBytes -= frame3.bytes;
|
|
28061
28057
|
return frame3;
|
|
28062
28058
|
}
|
|
28063
|
-
function takeSharedFrame(
|
|
28064
|
-
const frame3 = sharedFrames.get(
|
|
28059
|
+
function takeSharedFrame(key, accepts2) {
|
|
28060
|
+
const frame3 = sharedFrames.get(key)?.find((shared2) => accepts2(shared2.decodedAt));
|
|
28065
28061
|
return frame3 && use(frame3);
|
|
28066
28062
|
}
|
|
28067
|
-
function shareFrame(
|
|
28068
|
-
const frames = sharedFrames.get(
|
|
28063
|
+
function shareFrame(key, decodedAt, url, bytes) {
|
|
28064
|
+
const frames = sharedFrames.get(key) ?? [];
|
|
28069
28065
|
const existing = frames.find((shared2) => shared2.decodedAt === decodedAt);
|
|
28070
28066
|
if (existing) {
|
|
28071
28067
|
URL.revokeObjectURL(url);
|
|
28072
28068
|
return use(existing);
|
|
28073
28069
|
}
|
|
28074
28070
|
const frame3 = { url, decodedAt, bytes, users: 1 };
|
|
28075
|
-
sharedFrames.set(
|
|
28071
|
+
sharedFrames.set(key, [...frames, frame3]);
|
|
28076
28072
|
return frame3;
|
|
28077
28073
|
}
|
|
28078
|
-
function evict(frame3,
|
|
28074
|
+
function evict(frame3, key) {
|
|
28079
28075
|
released.delete(frame3);
|
|
28080
28076
|
releasedBytes -= frame3.bytes;
|
|
28081
|
-
const rest = sharedFrames.get(
|
|
28082
|
-
if (rest.length > 0) sharedFrames.set(
|
|
28083
|
-
else sharedFrames.delete(
|
|
28077
|
+
const rest = sharedFrames.get(key)?.filter((shared2) => shared2 !== frame3) ?? [];
|
|
28078
|
+
if (rest.length > 0) sharedFrames.set(key, rest);
|
|
28079
|
+
else sharedFrames.delete(key);
|
|
28084
28080
|
URL.revokeObjectURL(frame3.url);
|
|
28085
28081
|
}
|
|
28086
28082
|
function releaseSharedFrames(held, budgetBytes) {
|
|
28087
|
-
for (const { key
|
|
28083
|
+
for (const { key, frame: frame3 } of held.splice(0)) {
|
|
28088
28084
|
if (--frame3.users > 0) continue;
|
|
28089
|
-
released.set(frame3,
|
|
28085
|
+
released.set(frame3, key);
|
|
28090
28086
|
releasedBytes += frame3.bytes;
|
|
28091
28087
|
}
|
|
28092
|
-
for (const [frame3,
|
|
28088
|
+
for (const [frame3, key] of released) {
|
|
28093
28089
|
if (releasedBytes <= budgetBytes) break;
|
|
28094
|
-
evict(frame3,
|
|
28090
|
+
evict(frame3, key);
|
|
28095
28091
|
}
|
|
28096
28092
|
}
|
|
28097
28093
|
|
|
@@ -28140,7 +28136,7 @@ function laterOf(own, theirs) {
|
|
|
28140
28136
|
}
|
|
28141
28137
|
function savedEtagsButThisTabsMoves(mine, theirs) {
|
|
28142
28138
|
const etags = { ...mine, ...theirs };
|
|
28143
|
-
for (const
|
|
28139
|
+
for (const key of sourcesThisTabMovedOn) etags[key] = mine[key];
|
|
28144
28140
|
sourcesThisTabMovedOn.clear();
|
|
28145
28141
|
return etags;
|
|
28146
28142
|
}
|
|
@@ -28179,15 +28175,15 @@ var storedVersion = (source) => quietly(async () => {
|
|
|
28179
28175
|
return response.status === 304 ? { source, etag } : void 0;
|
|
28180
28176
|
});
|
|
28181
28177
|
var rememberVersion = (stored) => quietly(async () => {
|
|
28182
|
-
const
|
|
28178
|
+
const key = await digest(stored.source);
|
|
28183
28179
|
const saved2 = loadIndex();
|
|
28184
|
-
if (saved2.etags[
|
|
28185
|
-
saved2.etags[
|
|
28186
|
-
sourcesThisTabMovedOn.add(
|
|
28180
|
+
if (saved2.etags[key] === stored.etag) return;
|
|
28181
|
+
saved2.etags[key] = stored.etag;
|
|
28182
|
+
sourcesThisTabMovedOn.add(key);
|
|
28187
28183
|
saveIndexSoon();
|
|
28188
28184
|
const keep = await cacheNameOf(stored);
|
|
28189
28185
|
for (const name of await caches.keys()) {
|
|
28190
|
-
if (!name.startsWith(`${CACHE_PREFIX}${
|
|
28186
|
+
if (!name.startsWith(`${CACHE_PREFIX}${key}:`) || name === keep) continue;
|
|
28191
28187
|
await caches.delete(name);
|
|
28192
28188
|
delete saved2.caches[name];
|
|
28193
28189
|
dropped.add(name);
|
|
@@ -28343,11 +28339,11 @@ function stripTimes(request2, info, budgets) {
|
|
|
28343
28339
|
function takeDecodedFrames({ timestamps, window: window2 }, keyOf17, resources) {
|
|
28344
28340
|
const missing = [];
|
|
28345
28341
|
timestamps.forEach((time, slot) => {
|
|
28346
|
-
const
|
|
28347
|
-
const frame3 = takeSharedFrame(
|
|
28342
|
+
const key = keyOf17(time);
|
|
28343
|
+
const frame3 = takeSharedFrame(key, (decodedAt) => accepts(window2, time, decodedAt));
|
|
28348
28344
|
if (!frame3) return void missing.push(slot);
|
|
28349
28345
|
resources.urls[slot] = frame3.url;
|
|
28350
|
-
resources.held.push({ key
|
|
28346
|
+
resources.held.push({ key, frame: frame3 });
|
|
28351
28347
|
});
|
|
28352
28348
|
return missing;
|
|
28353
28349
|
}
|
|
@@ -28397,10 +28393,10 @@ async function takeStoredFrames({ timestamps, window: window2 }, slots, keyOf17,
|
|
|
28397
28393
|
const time = timestamps[slot];
|
|
28398
28394
|
const hit = found[i];
|
|
28399
28395
|
if (!hit || !accepts(window2, time, hit.decodedAt)) return true;
|
|
28400
|
-
const
|
|
28401
|
-
const frame3 = shareFrame(
|
|
28396
|
+
const key = keyOf17(time);
|
|
28397
|
+
const frame3 = shareFrame(key, hit.decodedAt, URL.createObjectURL(hit.blob), hit.blob.size);
|
|
28402
28398
|
resources.urls[slot] = frame3.url;
|
|
28403
|
-
resources.held.push({ key
|
|
28399
|
+
resources.held.push({ key, frame: frame3 });
|
|
28404
28400
|
return false;
|
|
28405
28401
|
});
|
|
28406
28402
|
}
|
|
@@ -28492,9 +28488,9 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
|
|
|
28492
28488
|
async function* decodeTimesAtNearbyKeyframes() {
|
|
28493
28489
|
for (const target2 of slots) {
|
|
28494
28490
|
const time = timestamps[target2.slot];
|
|
28495
|
-
const
|
|
28491
|
+
const key = await keys.getKeyPacket(time, { metadataOnly: true });
|
|
28496
28492
|
if (signal.aborted) return;
|
|
28497
|
-
target2.decodedAt =
|
|
28493
|
+
target2.decodedAt = key && accepts(window2, time, key.timestamp) ? key.timestamp : time;
|
|
28498
28494
|
yield target2.decodedAt;
|
|
28499
28495
|
}
|
|
28500
28496
|
}
|
|
@@ -28908,14 +28904,14 @@ var initialState = {
|
|
|
28908
28904
|
};
|
|
28909
28905
|
var lastHistoryKey = null;
|
|
28910
28906
|
var lastHistoryAt = 0;
|
|
28911
|
-
function pushHistory(state,
|
|
28907
|
+
function pushHistory(state, key) {
|
|
28912
28908
|
if (!state.model) return {};
|
|
28913
28909
|
const now2 = Date.now();
|
|
28914
|
-
if (lastHistoryKey ===
|
|
28910
|
+
if (lastHistoryKey === key && now2 - lastHistoryAt < HISTORY_COALESCE_MS) {
|
|
28915
28911
|
lastHistoryAt = now2;
|
|
28916
28912
|
return { future: [] };
|
|
28917
28913
|
}
|
|
28918
|
-
lastHistoryKey =
|
|
28914
|
+
lastHistoryKey = key;
|
|
28919
28915
|
lastHistoryAt = now2;
|
|
28920
28916
|
const past = [...state.past, state.model].slice(-HISTORY_CAP);
|
|
28921
28917
|
return { past, future: [] };
|
|
@@ -29239,6 +29235,22 @@ function ignoresPlaybackKey(e) {
|
|
|
29239
29235
|
selectedCaptionSegmentCount: captionState.selectedSegmentIds.size
|
|
29240
29236
|
});
|
|
29241
29237
|
}
|
|
29238
|
+
function forwardSealedFrameKeys(iframe, keyDown, keyUp) {
|
|
29239
|
+
const client = previewEditingClient(iframe);
|
|
29240
|
+
const watch = (combos) => void client.request("watch-keys", { combos }).catch(() => {
|
|
29241
|
+
});
|
|
29242
|
+
const watchPlayback = () => watch(PLAYBACK_ACTIONS.map(getStudioKey));
|
|
29243
|
+
watchPlayback();
|
|
29244
|
+
const stopRebinds = subscribeStudioKeys(watchPlayback);
|
|
29245
|
+
const stopKeys = client.onKey(
|
|
29246
|
+
(key) => (key.type === "keydown" ? keyDown : keyUp).current(new KeyboardEvent(key.type, key))
|
|
29247
|
+
);
|
|
29248
|
+
return () => {
|
|
29249
|
+
stopRebinds();
|
|
29250
|
+
stopKeys();
|
|
29251
|
+
watch([]);
|
|
29252
|
+
};
|
|
29253
|
+
}
|
|
29242
29254
|
function handleWorkAreaKey(e, action, getAdapter, seek) {
|
|
29243
29255
|
const store = usePlayerStore.getState();
|
|
29244
29256
|
const time = () => getAdapter()?.getTime() ?? store.currentTime;
|
|
@@ -29353,6 +29365,15 @@ function usePlaybackKeyboard({
|
|
|
29353
29365
|
const attachIframeShortcutListeners = useCallback37(() => {
|
|
29354
29366
|
iframeShortcutCleanupRef.current?.();
|
|
29355
29367
|
iframeShortcutCleanupRef.current = null;
|
|
29368
|
+
const iframe = iframeRef.current;
|
|
29369
|
+
if (iframe && previewFrameOpaque(iframe)) {
|
|
29370
|
+
iframeShortcutCleanupRef.current = forwardSealedFrameKeys(
|
|
29371
|
+
iframe,
|
|
29372
|
+
playbackKeyDownRef,
|
|
29373
|
+
playbackKeyUpRef
|
|
29374
|
+
);
|
|
29375
|
+
return;
|
|
29376
|
+
}
|
|
29356
29377
|
let iframeWin = null;
|
|
29357
29378
|
let iframeDoc = null;
|
|
29358
29379
|
try {
|
|
@@ -30339,11 +30360,10 @@ function isPreviewReadinessMessage(e, iframe) {
|
|
|
30339
30360
|
if (data?.type !== "state" && data?.type !== "timeline") return false;
|
|
30340
30361
|
return inspectStudioRuntimeMessage(data).status !== "unsupported";
|
|
30341
30362
|
}
|
|
30342
|
-
function normalizePreviewDom(doc, iframeWin
|
|
30363
|
+
function normalizePreviewDom(doc, iframeWin) {
|
|
30343
30364
|
if (!doc || !iframeWin) return;
|
|
30344
30365
|
normalizePreviewViewport(doc, iframeWin);
|
|
30345
30366
|
autoHealMissingCompositionIds(doc);
|
|
30346
|
-
attachIframeShortcutListeners();
|
|
30347
30367
|
}
|
|
30348
30368
|
function applyRuntimeClipManifest(iframeWin, processTimelineMessage) {
|
|
30349
30369
|
const manifest = iframeWin?.__clipManifest;
|
|
@@ -30354,7 +30374,8 @@ function hydrateTimelineFromPreview(input) {
|
|
|
30354
30374
|
try {
|
|
30355
30375
|
const doc = safeContentDocument(iframe);
|
|
30356
30376
|
const iframeWin = iframe?.contentWindow ?? null;
|
|
30357
|
-
normalizePreviewDom(doc, iframeWin
|
|
30377
|
+
normalizePreviewDom(doc, iframeWin);
|
|
30378
|
+
input.attachIframeShortcutListeners();
|
|
30358
30379
|
applyRuntimeClipManifest(iframeWin, input.processTimelineMessage);
|
|
30359
30380
|
input.enrichMissingCompositions();
|
|
30360
30381
|
input.applyPreviewAudioState();
|
|
@@ -30379,6 +30400,9 @@ function planShadowReload(slots, nextGen, url) {
|
|
|
30379
30400
|
const live = slots.find((slot) => slot.role === "live");
|
|
30380
30401
|
return live ? [live, { gen: nextGen, role: "shadow", url }] : [{ gen: nextGen, role: "live" }];
|
|
30381
30402
|
}
|
|
30403
|
+
function planShadowAlone(nextGen, url) {
|
|
30404
|
+
return [{ gen: nextGen, role: "shadow", url }];
|
|
30405
|
+
}
|
|
30382
30406
|
function planShadowDiscard(slots) {
|
|
30383
30407
|
return slots.filter((slot) => slot.role === "live");
|
|
30384
30408
|
}
|
|
@@ -30673,9 +30697,9 @@ function withTweenIndex(run) {
|
|
|
30673
30697
|
}
|
|
30674
30698
|
function indexTweens(children) {
|
|
30675
30699
|
const index2 = { byElement: /* @__PURE__ */ new Map(), byId: /* @__PURE__ */ new Map() };
|
|
30676
|
-
const add = (map,
|
|
30677
|
-
const list = map.get(
|
|
30678
|
-
if (!list) map.set(
|
|
30700
|
+
const add = (map, key, tween) => {
|
|
30701
|
+
const list = map.get(key);
|
|
30702
|
+
if (!list) map.set(key, [tween]);
|
|
30679
30703
|
else if (list.at(-1) !== tween) list.push(tween);
|
|
30680
30704
|
};
|
|
30681
30705
|
for (const tween of children) {
|
|
@@ -30812,7 +30836,7 @@ function restoreAttributes(layer, attributes) {
|
|
|
30812
30836
|
if (layer.getAttribute(name) !== value) layer.setAttribute(name, value);
|
|
30813
30837
|
}
|
|
30814
30838
|
function restoreCache(live, cache2) {
|
|
30815
|
-
for (const
|
|
30839
|
+
for (const key of Object.keys(live)) if (!(key in cache2)) delete live[key];
|
|
30816
30840
|
Object.assign(live, cache2);
|
|
30817
30841
|
}
|
|
30818
30842
|
function parsedImplicitEndValue(tween) {
|
|
@@ -31203,7 +31227,7 @@ function gsapWritesRotation(el) {
|
|
|
31203
31227
|
function gsapHoldsTranslate(el) {
|
|
31204
31228
|
const cache2 = el._gsap;
|
|
31205
31229
|
return ["x", "y", "xPercent", "yPercent"].some(
|
|
31206
|
-
(
|
|
31230
|
+
(key) => !!Number.parseFloat(String(cache2?.[key]))
|
|
31207
31231
|
);
|
|
31208
31232
|
}
|
|
31209
31233
|
var BOX_CHANNELS = [
|
|
@@ -31771,6 +31795,19 @@ function useShadowReloadRetry(generation, url, begin) {
|
|
|
31771
31795
|
// src/player/hooks/useShadowPreviewReload.ts
|
|
31772
31796
|
var SHADOW_READY_TIMEOUT_MS = 15e3;
|
|
31773
31797
|
var SHADOW_READY_BUDGETS = 3;
|
|
31798
|
+
var STILL_RELEASE_MAX_MS = 3e3;
|
|
31799
|
+
function releaseAfterPaint(iframe, release2) {
|
|
31800
|
+
let done = false;
|
|
31801
|
+
const go = () => {
|
|
31802
|
+
if (done) return;
|
|
31803
|
+
done = true;
|
|
31804
|
+
release2();
|
|
31805
|
+
};
|
|
31806
|
+
setTimeout(go, STILL_RELEASE_MAX_MS);
|
|
31807
|
+
void (restoreSeekPainted(iframe) ?? Promise.resolve()).then(
|
|
31808
|
+
() => requestAnimationFrame(() => requestAnimationFrame(go))
|
|
31809
|
+
);
|
|
31810
|
+
}
|
|
31774
31811
|
function restoreSeekPainted(iframe) {
|
|
31775
31812
|
if (!iframe) return void 0;
|
|
31776
31813
|
if (previewFrameOpaque(iframe)) return previewSeekPainted(iframe, SHADOW_READY_TIMEOUT_MS);
|
|
@@ -31813,7 +31850,8 @@ function useShadowPreviewReload({
|
|
|
31813
31850
|
applyPreviewAudioState,
|
|
31814
31851
|
onPromoted,
|
|
31815
31852
|
onReloadFailed,
|
|
31816
|
-
handOverPlayback
|
|
31853
|
+
handOverPlayback,
|
|
31854
|
+
holdStill
|
|
31817
31855
|
}) {
|
|
31818
31856
|
const shadowIframeRef = useRef49(null);
|
|
31819
31857
|
const shadowProbeIntervalRef = useRef49(void 0);
|
|
@@ -31843,6 +31881,36 @@ function useShadowPreviewReload({
|
|
|
31843
31881
|
const promoteWhenReadyRef = useRef49(() => {
|
|
31844
31882
|
});
|
|
31845
31883
|
const [previewSlots, setPreviewSlots] = useState35([{ gen: 0, role: "live" }]);
|
|
31884
|
+
const slotsRef = useRef49(previewSlots);
|
|
31885
|
+
slotsRef.current = previewSlots;
|
|
31886
|
+
const holdStillRef = useRef49(holdStill);
|
|
31887
|
+
holdStillRef.current = holdStill;
|
|
31888
|
+
const heldRef = useRef49(null);
|
|
31889
|
+
const holdingUrlRef = useRef49(null);
|
|
31890
|
+
const holdTokenRef = useRef49(0);
|
|
31891
|
+
const restoringRef = useRef49(null);
|
|
31892
|
+
const dropRestoring = useCallback40(() => {
|
|
31893
|
+
const release2 = restoringRef.current;
|
|
31894
|
+
restoringRef.current = null;
|
|
31895
|
+
release2?.();
|
|
31896
|
+
}, []);
|
|
31897
|
+
const restoreLive = useCallback40(
|
|
31898
|
+
(held) => {
|
|
31899
|
+
dropRestoring();
|
|
31900
|
+
setPreviewSlots([held.liveSlot]);
|
|
31901
|
+
pendingSeekRef.current = held.time;
|
|
31902
|
+
restoringRef.current = held.release;
|
|
31903
|
+
setTimeout(() => {
|
|
31904
|
+
if (restoringRef.current === held.release) dropRestoring();
|
|
31905
|
+
}, SHADOW_READY_TIMEOUT_MS);
|
|
31906
|
+
},
|
|
31907
|
+
[pendingSeekRef, dropRestoring]
|
|
31908
|
+
);
|
|
31909
|
+
const onLiveLoaded = useCallback40(() => {
|
|
31910
|
+
const release2 = restoringRef.current;
|
|
31911
|
+
restoringRef.current = null;
|
|
31912
|
+
if (release2) releaseAfterPaint(iframeRef.current, release2);
|
|
31913
|
+
}, [iframeRef]);
|
|
31846
31914
|
const stopPendingShadow = useCallback40(() => {
|
|
31847
31915
|
clearTimeout(readyTimerRef.current);
|
|
31848
31916
|
budgetGenRef.current = null;
|
|
@@ -31863,7 +31931,10 @@ function useShadowPreviewReload({
|
|
|
31863
31931
|
shadowIframeRef.current = null;
|
|
31864
31932
|
isRefreshingRef.current = false;
|
|
31865
31933
|
pendingSeekRef.current = null;
|
|
31866
|
-
|
|
31934
|
+
const held = heldRef.current;
|
|
31935
|
+
heldRef.current = null;
|
|
31936
|
+
if (held) restoreLive(held);
|
|
31937
|
+
else setPreviewSlots(planShadowDiscard);
|
|
31867
31938
|
setPreviewReloading(false);
|
|
31868
31939
|
const message = `The preview did not reload (${cause}). It was still waiting for ${waitingFor}.${got} The previous preview is still showing.`;
|
|
31869
31940
|
logReload("shadow-failed", { cause, waitingFor });
|
|
@@ -31873,7 +31944,7 @@ function useShadowPreviewReload({
|
|
|
31873
31944
|
onReloadFailedRef.current?.(message);
|
|
31874
31945
|
retry.afterFailure(cause, failedGen);
|
|
31875
31946
|
},
|
|
31876
|
-
[stopPendingShadow, retry, isRefreshingRef, pendingSeekRef]
|
|
31947
|
+
[stopPendingShadow, retry, isRefreshingRef, pendingSeekRef, restoreLive]
|
|
31877
31948
|
);
|
|
31878
31949
|
const gestureSavesOnScreen = useCallback40(() => {
|
|
31879
31950
|
const liveDoc = iframeRef.current?.contentDocument;
|
|
@@ -31902,8 +31973,8 @@ function useShadowPreviewReload({
|
|
|
31902
31973
|
"gesture",
|
|
31903
31974
|
(retry2) => afterStudioManualEditGestures(liveDoc, retry2)
|
|
31904
31975
|
);
|
|
31905
|
-
|
|
31906
|
-
|
|
31976
|
+
const savesSame = heldRef.current !== null || gestureSavesOnScreen() === savesAtRequestRef.current;
|
|
31977
|
+
if (savesSame && studioFileRevision() === revisionAtRequestRef.current) return false;
|
|
31907
31978
|
if (isStudioEditSaving()) return waitThenRetry(gen, "save", afterStudioPendingEdits);
|
|
31908
31979
|
logReload("shadow-reloaded-after-gesture-save", { gen });
|
|
31909
31980
|
const url = new URL(shadowUrlRef.current, window.location.origin);
|
|
@@ -31925,9 +31996,11 @@ function useShadowPreviewReload({
|
|
|
31925
31996
|
if (!promotable || heldOrStale(gen)) return;
|
|
31926
31997
|
const { shadow, pending: pending2 } = promotable;
|
|
31927
31998
|
stopPendingShadow();
|
|
31999
|
+
const held = heldRef.current;
|
|
32000
|
+
heldRef.current = null;
|
|
31928
32001
|
const live = getAdapter();
|
|
31929
|
-
const liveTime2 = live?.getTime();
|
|
31930
|
-
const playing = usePlayerStore.getState().isPlaying;
|
|
32002
|
+
const liveTime2 = held ? held.time : live?.getTime();
|
|
32003
|
+
const playing = held ? held.playing : usePlayerStore.getState().isPlaying;
|
|
31931
32004
|
live?.pause();
|
|
31932
32005
|
const retired = iframeRef.current;
|
|
31933
32006
|
iframeRef.current = shadow;
|
|
@@ -31937,6 +32010,7 @@ function useShadowPreviewReload({
|
|
|
31937
32010
|
applyPreviewAudioState();
|
|
31938
32011
|
setPreviewSlots((prev) => planShadowPromotion(prev, gen));
|
|
31939
32012
|
if (liveTime2 != null) handOverPlaybackRef.current(liveTime2, playing);
|
|
32013
|
+
if (held) releaseAfterPaint(shadow, held.release);
|
|
31940
32014
|
announcePreviewPromoted({ retired, live: shadow });
|
|
31941
32015
|
onPromotedRef.current?.();
|
|
31942
32016
|
setPreviewReloading(false);
|
|
@@ -32044,8 +32118,8 @@ function useShadowPreviewReload({
|
|
|
32044
32118
|
logReload("shadow-reattached", { gen });
|
|
32045
32119
|
armReadyTimerRef.current(gen);
|
|
32046
32120
|
}, []);
|
|
32047
|
-
const
|
|
32048
|
-
(url) => {
|
|
32121
|
+
const startShadowReload = useCallback40(
|
|
32122
|
+
(url, alone) => {
|
|
32049
32123
|
retry.started();
|
|
32050
32124
|
shadowGenRef.current += 1;
|
|
32051
32125
|
const gen = shadowGenRef.current;
|
|
@@ -32056,11 +32130,49 @@ function useShadowPreviewReload({
|
|
|
32056
32130
|
savesAtRequestRef.current = gestureSavesOnScreen();
|
|
32057
32131
|
revisionAtRequestRef.current = studioFileRevision();
|
|
32058
32132
|
armReadyTimer(gen);
|
|
32059
|
-
setPreviewSlots(
|
|
32133
|
+
setPreviewSlots(
|
|
32134
|
+
(prev) => alone ? planShadowAlone(gen, url) : planShadowReload(prev, gen, url)
|
|
32135
|
+
);
|
|
32060
32136
|
setPreviewReloading(true);
|
|
32061
32137
|
},
|
|
32062
32138
|
[retry, stopPendingShadow, armReadyTimer, gestureSavesOnScreen]
|
|
32063
32139
|
);
|
|
32140
|
+
const beginShadowReload = useCallback40(
|
|
32141
|
+
(url) => {
|
|
32142
|
+
const live = iframeRef.current;
|
|
32143
|
+
const take = holdStillRef.current;
|
|
32144
|
+
if (heldRef.current || !take || !live?.isConnected) {
|
|
32145
|
+
startShadowReload(url, heldRef.current !== null);
|
|
32146
|
+
return;
|
|
32147
|
+
}
|
|
32148
|
+
if (holdingUrlRef.current !== null) {
|
|
32149
|
+
holdingUrlRef.current = url;
|
|
32150
|
+
return;
|
|
32151
|
+
}
|
|
32152
|
+
holdingUrlRef.current = url;
|
|
32153
|
+
const token = ++holdTokenRef.current;
|
|
32154
|
+
const playing = usePlayerStore.getState().isPlaying;
|
|
32155
|
+
getAdapter()?.pause();
|
|
32156
|
+
const time = getAdapter()?.getTime() ?? null;
|
|
32157
|
+
const liveSlot = slotsRef.current.find((slot) => slot.role === "live");
|
|
32158
|
+
void new Promise((resolve2) => resolve2(take(live))).catch(() => null).then((release2) => {
|
|
32159
|
+
if (token !== holdTokenRef.current) {
|
|
32160
|
+
release2?.();
|
|
32161
|
+
return;
|
|
32162
|
+
}
|
|
32163
|
+
const latest2 = holdingUrlRef.current ?? url;
|
|
32164
|
+
holdingUrlRef.current = null;
|
|
32165
|
+
if (release2 && liveSlot && iframeRef.current === live) {
|
|
32166
|
+
heldRef.current = { release: release2, time, playing, liveSlot, liveIframe: live };
|
|
32167
|
+
} else {
|
|
32168
|
+
release2?.();
|
|
32169
|
+
if (playing) getAdapter()?.play();
|
|
32170
|
+
}
|
|
32171
|
+
startShadowReload(latest2, heldRef.current !== null);
|
|
32172
|
+
});
|
|
32173
|
+
},
|
|
32174
|
+
[iframeRef, getAdapter, startShadowReload]
|
|
32175
|
+
);
|
|
32064
32176
|
beginShadowReloadRef.current = beginShadowReload;
|
|
32065
32177
|
const resetPreviewSlots = useCallback40(() => {
|
|
32066
32178
|
retry.cancel();
|
|
@@ -32070,9 +32182,15 @@ function useShadowPreviewReload({
|
|
|
32070
32182
|
isRefreshingRef.current = false;
|
|
32071
32183
|
pendingSeekRef.current = null;
|
|
32072
32184
|
usePlayerStore.getState().setTimelineReady(false);
|
|
32073
|
-
|
|
32185
|
+
const held = heldRef.current;
|
|
32186
|
+
heldRef.current = null;
|
|
32187
|
+
holdingUrlRef.current = null;
|
|
32188
|
+
holdTokenRef.current += 1;
|
|
32189
|
+
dropRestoring();
|
|
32190
|
+
setPreviewSlots(held ? [held.liveSlot] : planShadowDiscard);
|
|
32191
|
+
held?.release();
|
|
32074
32192
|
setPreviewReloading(false);
|
|
32075
|
-
}, [retry, stopPendingShadow, isRefreshingRef, pendingSeekRef]);
|
|
32193
|
+
}, [retry, stopPendingShadow, isRefreshingRef, pendingSeekRef, dropRestoring]);
|
|
32076
32194
|
useMountEffect(() => {
|
|
32077
32195
|
const onVisibilityChange = () => {
|
|
32078
32196
|
if (isDocumentHidden()) {
|
|
@@ -32087,6 +32205,10 @@ function useShadowPreviewReload({
|
|
|
32087
32205
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
32088
32206
|
retry.cancel();
|
|
32089
32207
|
stopPendingShadow();
|
|
32208
|
+
heldRef.current?.release();
|
|
32209
|
+
heldRef.current = null;
|
|
32210
|
+
holdTokenRef.current += 1;
|
|
32211
|
+
dropRestoring();
|
|
32090
32212
|
setPreviewReloading(false);
|
|
32091
32213
|
};
|
|
32092
32214
|
});
|
|
@@ -32098,7 +32220,8 @@ function useShadowPreviewReload({
|
|
|
32098
32220
|
setShadowIframeNode,
|
|
32099
32221
|
beginShadowReload,
|
|
32100
32222
|
resetPreviewSlots,
|
|
32101
|
-
previewGeneration
|
|
32223
|
+
previewGeneration,
|
|
32224
|
+
onLiveLoaded
|
|
32102
32225
|
};
|
|
32103
32226
|
}
|
|
32104
32227
|
|
|
@@ -32162,8 +32285,8 @@ function* timelineCandidates(iframe, win) {
|
|
|
32162
32285
|
const keys = win.__timelines ? Object.keys(win.__timelines) : [];
|
|
32163
32286
|
if (!win.__timelines || keys.length === 0) return;
|
|
32164
32287
|
const rootId = iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id");
|
|
32165
|
-
const
|
|
32166
|
-
yield wrapTimeline(win.__timelines[
|
|
32288
|
+
const key = rootId && rootId in win.__timelines ? rootId : keys[keys.length - 1];
|
|
32289
|
+
yield wrapTimeline(win.__timelines[key]);
|
|
32167
32290
|
}
|
|
32168
32291
|
function resolvePlaybackAdapter(iframe, win, refs) {
|
|
32169
32292
|
const playerAdapter = win.__player && typeof win.__player.play === "function" ? win.__player : null;
|
|
@@ -32444,8 +32567,8 @@ function evictMetadataOverflow() {
|
|
|
32444
32567
|
const overflow = cache.size + failed.size - TIMELINE_VIEWPORT_BUDGETS.metadataRegistryEntries;
|
|
32445
32568
|
if (overflow <= 0) return;
|
|
32446
32569
|
const entries = [
|
|
32447
|
-
...Array.from(cache, ([
|
|
32448
|
-
...Array.from(failed, ([
|
|
32570
|
+
...Array.from(cache, ([key, value]) => ({ key, at: value.lastAccess, failed: false })),
|
|
32571
|
+
...Array.from(failed, ([key, value]) => ({ key, at: value.lastAccess, failed: true }))
|
|
32449
32572
|
].sort((left, right) => left.at - right.at);
|
|
32450
32573
|
for (const entry3 of entries.slice(0, overflow)) {
|
|
32451
32574
|
if (entry3.failed) failed.delete(entry3.key);
|
|
@@ -32475,32 +32598,32 @@ async function probeMissingSourceDurations(elements, projectId, apply) {
|
|
|
32475
32598
|
await Promise.allSettled(
|
|
32476
32599
|
[...keysBySource].map(async ([source, keys]) => {
|
|
32477
32600
|
const result = await probeMediaUrl(source);
|
|
32478
|
-
if (result) apply(new Map(keys.map((
|
|
32601
|
+
if (result) apply(new Map(keys.map((key) => [key, result.duration])));
|
|
32479
32602
|
})
|
|
32480
32603
|
);
|
|
32481
32604
|
}
|
|
32482
|
-
function hasFreshFailure(
|
|
32483
|
-
const failedAt = failed.get(
|
|
32605
|
+
function hasFreshFailure(key) {
|
|
32606
|
+
const failedAt = failed.get(key);
|
|
32484
32607
|
if (failedAt === void 0) return false;
|
|
32485
32608
|
if (Date.now() - failedAt.failedAt < TIMELINE_VIEWPORT_BUDGETS.metadataFailureTtlMs) {
|
|
32486
32609
|
failedAt.lastAccess = ++accessSequence;
|
|
32487
32610
|
return true;
|
|
32488
32611
|
}
|
|
32489
|
-
failed.delete(
|
|
32612
|
+
failed.delete(key);
|
|
32490
32613
|
return false;
|
|
32491
32614
|
}
|
|
32492
32615
|
async function probeMediaUrl(url) {
|
|
32493
|
-
const
|
|
32494
|
-
const cached5 = getCachedProbe(
|
|
32616
|
+
const key = normalizeUrl(url);
|
|
32617
|
+
const cached5 = getCachedProbe(key);
|
|
32495
32618
|
if (cached5) return cached5;
|
|
32496
|
-
if (hasFreshFailure(
|
|
32497
|
-
let pending2 = inflight.get(
|
|
32619
|
+
if (hasFreshFailure(key)) return null;
|
|
32620
|
+
let pending2 = inflight.get(key);
|
|
32498
32621
|
if (pending2) return pending2;
|
|
32499
32622
|
pending2 = new Promise((resolve2) => {
|
|
32500
|
-
probeQueue.push({ key
|
|
32623
|
+
probeQueue.push({ key, epoch: registryEpoch, resolve: resolve2 });
|
|
32501
32624
|
pumpProbeQueue();
|
|
32502
32625
|
});
|
|
32503
|
-
inflight.set(
|
|
32626
|
+
inflight.set(key, pending2);
|
|
32504
32627
|
return pending2;
|
|
32505
32628
|
}
|
|
32506
32629
|
function pumpProbeQueue() {
|
|
@@ -32685,7 +32808,7 @@ function timelineElementsChanged(previous, next) {
|
|
|
32685
32808
|
if (next.length !== previous.length) return true;
|
|
32686
32809
|
return next.some((element, index2) => {
|
|
32687
32810
|
const prior = previous[index2];
|
|
32688
|
-
return !prior || RENDERED_FIELDS.some((
|
|
32811
|
+
return !prior || RENDERED_FIELDS.some((key) => element[key] !== prior[key]) || !sameTimelineText(element.text, prior.text);
|
|
32689
32812
|
});
|
|
32690
32813
|
}
|
|
32691
32814
|
|
|
@@ -32693,7 +32816,8 @@ function timelineElementsChanged(previous, next) {
|
|
|
32693
32816
|
var publishSeek = (time, options) => options?.follow === false ? liveTime.notify(time) : liveTime.notifySeek(time);
|
|
32694
32817
|
function useTimelinePlayer({
|
|
32695
32818
|
onShadowPromoted,
|
|
32696
|
-
onPreviewReloadFailed
|
|
32819
|
+
onPreviewReloadFailed,
|
|
32820
|
+
holdPreviewStill
|
|
32697
32821
|
} = {}) {
|
|
32698
32822
|
const iframeRef = useRef50(null);
|
|
32699
32823
|
const rafRef = useRef50(0);
|
|
@@ -33011,7 +33135,8 @@ function useTimelinePlayer({
|
|
|
33011
33135
|
setShadowIframeNode,
|
|
33012
33136
|
beginShadowReload,
|
|
33013
33137
|
resetPreviewSlots,
|
|
33014
|
-
previewGeneration
|
|
33138
|
+
previewGeneration,
|
|
33139
|
+
onLiveLoaded
|
|
33015
33140
|
} = useShadowPreviewReload({
|
|
33016
33141
|
iframeRef,
|
|
33017
33142
|
getAdapter,
|
|
@@ -33026,6 +33151,7 @@ function useTimelinePlayer({
|
|
|
33026
33151
|
applyPreviewAudioState,
|
|
33027
33152
|
onPromoted: onShadowPromoted,
|
|
33028
33153
|
onReloadFailed: onPreviewReloadFailed,
|
|
33154
|
+
holdStill: holdPreviewStill,
|
|
33029
33155
|
handOverPlayback: (time, playing) => {
|
|
33030
33156
|
seek(time, { keepPlaying: true, follow: false });
|
|
33031
33157
|
const adapter = getAdapter();
|
|
@@ -33131,13 +33257,20 @@ function useTimelinePlayer({
|
|
|
33131
33257
|
applyPreviewAudioState();
|
|
33132
33258
|
});
|
|
33133
33259
|
}, [applyPlaybackRate, applyPreviewAudioState]);
|
|
33260
|
+
const onLiveIframeLoad = useCallback42(
|
|
33261
|
+
(context) => {
|
|
33262
|
+
onIframeLoad(context);
|
|
33263
|
+
onLiveLoaded();
|
|
33264
|
+
},
|
|
33265
|
+
[onIframeLoad, onLiveLoaded]
|
|
33266
|
+
);
|
|
33134
33267
|
return {
|
|
33135
33268
|
iframeRef,
|
|
33136
33269
|
play,
|
|
33137
33270
|
pause,
|
|
33138
33271
|
togglePlay,
|
|
33139
33272
|
seek,
|
|
33140
|
-
onIframeLoad,
|
|
33273
|
+
onIframeLoad: onLiveIframeLoad,
|
|
33141
33274
|
refreshPlayer,
|
|
33142
33275
|
saveSeekPosition,
|
|
33143
33276
|
resetPlayer,
|
|
@@ -33522,7 +33655,7 @@ function usePlayerHandle() {
|
|
|
33522
33655
|
},
|
|
33523
33656
|
[ready, seekPlayer]
|
|
33524
33657
|
);
|
|
33525
|
-
const
|
|
33658
|
+
const subscribe2 = useCallback45((listener2) => {
|
|
33526
33659
|
let previous = usePlayerStore.getState();
|
|
33527
33660
|
return usePlayerStore.subscribe((state) => {
|
|
33528
33661
|
const structuralChange = state.timelineReady !== previous.timelineReady || state.isPlaying !== previous.isPlaying || state.duration !== previous.duration || state.elements !== previous.elements;
|
|
@@ -33546,7 +33679,7 @@ function usePlayerHandle() {
|
|
|
33546
33679
|
},
|
|
33547
33680
|
duration,
|
|
33548
33681
|
elements: handleElements,
|
|
33549
|
-
subscribe:
|
|
33682
|
+
subscribe: subscribe2,
|
|
33550
33683
|
subscribeTime
|
|
33551
33684
|
};
|
|
33552
33685
|
}
|
|
@@ -33577,6 +33710,7 @@ import {
|
|
|
33577
33710
|
useRef as useRef56,
|
|
33578
33711
|
useState as useState40
|
|
33579
33712
|
} from "react";
|
|
33713
|
+
import { flushSync as flushSync3 } from "react-dom";
|
|
33580
33714
|
|
|
33581
33715
|
// src/components/nle/previewZoom.ts
|
|
33582
33716
|
var MIN_PREVIEW_ZOOM_PERCENT = 25;
|
|
@@ -33741,10 +33875,10 @@ var usePreviewGuidesStore = create8((set, get) => {
|
|
|
33741
33875
|
return {
|
|
33742
33876
|
rulerVisible: stored.rulerVisible ?? false,
|
|
33743
33877
|
safeMarginsVisible: stored.safeMarginsVisible ?? false,
|
|
33744
|
-
toggle: (
|
|
33745
|
-
const next = !get()[
|
|
33746
|
-
writeStudioUiPreferences({ [
|
|
33747
|
-
set({ [
|
|
33878
|
+
toggle: (key) => {
|
|
33879
|
+
const next = !get()[key];
|
|
33880
|
+
writeStudioUiPreferences({ [key]: next });
|
|
33881
|
+
set({ [key]: next });
|
|
33748
33882
|
}
|
|
33749
33883
|
};
|
|
33750
33884
|
});
|
|
@@ -34133,10 +34267,10 @@ function renderPosterForNextOpen(projectId) {
|
|
|
34133
34267
|
});
|
|
34134
34268
|
if (settled()) lease.release();
|
|
34135
34269
|
}
|
|
34136
|
-
function useVisitNumber(
|
|
34137
|
-
const [seen, setSeen] = useState39({ key
|
|
34138
|
-
if (seen.key ===
|
|
34139
|
-
setSeen({ key
|
|
34270
|
+
function useVisitNumber(key) {
|
|
34271
|
+
const [seen, setSeen] = useState39({ key, visit: 0 });
|
|
34272
|
+
if (seen.key === key) return seen.visit;
|
|
34273
|
+
setSeen({ key, visit: seen.visit + 1 });
|
|
34140
34274
|
return seen.visit + 1;
|
|
34141
34275
|
}
|
|
34142
34276
|
|
|
@@ -34211,11 +34345,10 @@ var NLEPreview = memo24(function NLEPreview2({
|
|
|
34211
34345
|
const viewport2 = viewportRef.current;
|
|
34212
34346
|
if (!viewport2) return;
|
|
34213
34347
|
const updateStageSize = () => {
|
|
34214
|
-
const rect = viewport2.getBoundingClientRect();
|
|
34215
34348
|
setStageSize(
|
|
34216
34349
|
resolvePreviewStageSize(
|
|
34217
|
-
|
|
34218
|
-
|
|
34350
|
+
viewport2.clientWidth,
|
|
34351
|
+
viewport2.clientHeight,
|
|
34219
34352
|
compositionSize ?? (hintWidth && hintHeight ? { width: hintWidth, height: hintHeight } : null),
|
|
34220
34353
|
portrait,
|
|
34221
34354
|
gutterPx,
|
|
@@ -34224,7 +34357,8 @@ var NLEPreview = memo24(function NLEPreview2({
|
|
|
34224
34357
|
);
|
|
34225
34358
|
};
|
|
34226
34359
|
updateStageSize();
|
|
34227
|
-
const
|
|
34360
|
+
const resizeBeforePaint = () => flushSync3(updateStageSize);
|
|
34361
|
+
const observer = new ResizeObserver(resizeBeforePaint);
|
|
34228
34362
|
observer.observe(viewport2);
|
|
34229
34363
|
return () => observer.disconnect();
|
|
34230
34364
|
}, [compositionSize, hintWidth, hintHeight, portrait, gutterPx, insetPx]);
|
|
@@ -37734,16 +37868,16 @@ function framePointer(iframe, clientX, clientY) {
|
|
|
37734
37868
|
function objectLike(value) {
|
|
37735
37869
|
return value && (typeof value === "object" || typeof value === "function") ? value : null;
|
|
37736
37870
|
}
|
|
37737
|
-
function callPlaybackMethod(target,
|
|
37738
|
-
const method = target ? Reflect.get(target,
|
|
37871
|
+
function callPlaybackMethod(target, key) {
|
|
37872
|
+
const method = target ? Reflect.get(target, key) : null;
|
|
37739
37873
|
if (typeof method !== "function") return;
|
|
37740
37874
|
try {
|
|
37741
37875
|
method.call(target);
|
|
37742
37876
|
} catch {
|
|
37743
37877
|
}
|
|
37744
37878
|
}
|
|
37745
|
-
function readPlaybackTime(target,
|
|
37746
|
-
const method = target ? Reflect.get(target,
|
|
37879
|
+
function readPlaybackTime(target, key) {
|
|
37880
|
+
const method = target ? Reflect.get(target, key) : null;
|
|
37747
37881
|
if (typeof method !== "function") return null;
|
|
37748
37882
|
try {
|
|
37749
37883
|
const value = method.call(target);
|
|
@@ -38105,11 +38239,11 @@ function createOverlayMeasurePass() {
|
|
|
38105
38239
|
sourceBoundaryRect: /* @__PURE__ */ new Map()
|
|
38106
38240
|
};
|
|
38107
38241
|
}
|
|
38108
|
-
function readThroughPass(memo64,
|
|
38109
|
-
const answered = memo64.get(
|
|
38242
|
+
function readThroughPass(memo64, key, compute) {
|
|
38243
|
+
const answered = memo64.get(key);
|
|
38110
38244
|
if (answered !== void 0) return answered;
|
|
38111
38245
|
const value = compute();
|
|
38112
|
-
memo64.set(
|
|
38246
|
+
memo64.set(key, value);
|
|
38113
38247
|
return value;
|
|
38114
38248
|
}
|
|
38115
38249
|
|
|
@@ -38342,13 +38476,13 @@ function selectionCacheKey(selection) {
|
|
|
38342
38476
|
].join("|");
|
|
38343
38477
|
}
|
|
38344
38478
|
function resolveElementForOverlay(doc, sel, activeCompositionPath, cacheRef) {
|
|
38345
|
-
const
|
|
38479
|
+
const key = selectionCacheKey(sel);
|
|
38346
38480
|
const cached5 = cacheRef.current;
|
|
38347
|
-
if (cached5?.key ===
|
|
38481
|
+
if (cached5?.key === key && cached5.element.isConnected && cached5.element.ownerDocument === doc) {
|
|
38348
38482
|
return cached5.element;
|
|
38349
38483
|
}
|
|
38350
38484
|
const next = findElementForSelection(doc, sel, activeCompositionPath);
|
|
38351
|
-
cacheRef.current = next ? { key
|
|
38485
|
+
cacheRef.current = next ? { key, element: next } : null;
|
|
38352
38486
|
return next;
|
|
38353
38487
|
}
|
|
38354
38488
|
|
|
@@ -38456,6 +38590,12 @@ function readPreviewElement(value) {
|
|
|
38456
38590
|
if (!isTextRecord(value.inlineStyles) || !isText(value.text)) return null;
|
|
38457
38591
|
return hasPlainFields(value) ? value : null;
|
|
38458
38592
|
}
|
|
38593
|
+
async function previewElementsAtPoint(iframe, x, y) {
|
|
38594
|
+
const reply = await previewRequest(iframe, "elements-at-point", { x, y });
|
|
38595
|
+
const elements = reply?.elements;
|
|
38596
|
+
if (!Array.isArray(elements)) return null;
|
|
38597
|
+
return elements.map(readHit).filter((element) => element !== null);
|
|
38598
|
+
}
|
|
38459
38599
|
async function previewPointerTargets(iframe, rootFractionX, rootFractionY) {
|
|
38460
38600
|
const params = { x: rootFractionX, y: rootFractionY };
|
|
38461
38601
|
const reply = await previewRequest(iframe, "pointer-targets", params);
|
|
@@ -38524,7 +38664,7 @@ async function previewGeometry(iframe, handles, children) {
|
|
|
38524
38664
|
};
|
|
38525
38665
|
}
|
|
38526
38666
|
var isFlag = (value) => typeof value === "boolean";
|
|
38527
|
-
var isFiniteFields = (value, keys) => isFields(value) && keys.every((
|
|
38667
|
+
var isFiniteFields = (value, keys) => isFields(value) && keys.every((key) => Number.isFinite(value[key]));
|
|
38528
38668
|
var readGestureStart = (value) => {
|
|
38529
38669
|
if (!readGeometry(value) || !isFields(value)) return null;
|
|
38530
38670
|
const { layout, move, gsap: gsap3 } = value;
|
|
@@ -38942,7 +39082,7 @@ function readable(element) {
|
|
|
38942
39082
|
probe2.textContent = element.text;
|
|
38943
39083
|
return probe2;
|
|
38944
39084
|
}
|
|
38945
|
-
var attr = (element, name) => element.attributes.find(([
|
|
39085
|
+
var attr = (element, name) => element.attributes.find(([key]) => key === name)?.[1] ?? null;
|
|
38946
39086
|
var mayBeCut = (value) => value.length >= MAX_ELEMENT_VALUE2 || value.startsWith("data:") && value.endsWith(",");
|
|
38947
39087
|
function valuesWhole(element) {
|
|
38948
39088
|
if (!element.truncated) return true;
|
|
@@ -39262,7 +39402,7 @@ async function compositionViewport(iframe) {
|
|
|
39262
39402
|
const root = roots?.matches[0] ?? (await queryPreviewElements(iframe, "html"))?.matches[0];
|
|
39263
39403
|
const [described] = root && await describePreviewElements(iframe, [root.handle]) || [];
|
|
39264
39404
|
if (!described) return null;
|
|
39265
|
-
const declared = (name) => Number.parseFloat(described.attributes.find(([
|
|
39405
|
+
const declared = (name) => Number.parseFloat(described.attributes.find(([key]) => key === name)?.[1] ?? "");
|
|
39266
39406
|
const [width, height] = [declared("data-width"), declared("data-height")];
|
|
39267
39407
|
return {
|
|
39268
39408
|
width: width > 0 ? width : described.rect.width || 1,
|
|
@@ -39708,14 +39848,14 @@ function useDomEditOverlayRects({
|
|
|
39708
39848
|
setGroupOverlayItemsState(next);
|
|
39709
39849
|
};
|
|
39710
39850
|
const resolveGroupElement = (doc, sel) => {
|
|
39711
|
-
const
|
|
39712
|
-
const cached5 = resolvedGroupElementRef.current.get(
|
|
39851
|
+
const key = selectionCacheKey(sel);
|
|
39852
|
+
const cached5 = resolvedGroupElementRef.current.get(key);
|
|
39713
39853
|
if (cached5?.isConnected && cached5.ownerDocument === doc) return cached5;
|
|
39714
39854
|
const next = findElementForSelection(doc, sel, activeCompositionPathRef.current);
|
|
39715
39855
|
if (next) {
|
|
39716
|
-
resolvedGroupElementRef.current.set(
|
|
39856
|
+
resolvedGroupElementRef.current.set(key, next);
|
|
39717
39857
|
} else {
|
|
39718
|
-
resolvedGroupElementRef.current.delete(
|
|
39858
|
+
resolvedGroupElementRef.current.delete(key);
|
|
39719
39859
|
}
|
|
39720
39860
|
return next;
|
|
39721
39861
|
};
|
|
@@ -39727,16 +39867,16 @@ function useDomEditOverlayRects({
|
|
|
39727
39867
|
const distinctGroup = (group) => {
|
|
39728
39868
|
const keys = /* @__PURE__ */ new Set();
|
|
39729
39869
|
return group.flatMap((selection) => {
|
|
39730
|
-
const
|
|
39731
|
-
if (keys.has(
|
|
39732
|
-
keys.add(
|
|
39733
|
-
return [{ key
|
|
39870
|
+
const key = selectionCacheKey(selection);
|
|
39871
|
+
if (keys.has(key)) return [];
|
|
39872
|
+
keys.add(key);
|
|
39873
|
+
return [{ key, selection }];
|
|
39734
39874
|
});
|
|
39735
39875
|
};
|
|
39736
39876
|
const hoverShown = (sel, group) => {
|
|
39737
39877
|
const hoverSel = hoverSelectionRef.current;
|
|
39738
|
-
const
|
|
39739
|
-
const covered = sel && selectionCacheKey(sel) ===
|
|
39878
|
+
const key = hoverSel && selectionCacheKey(hoverSel);
|
|
39879
|
+
const covered = sel && selectionCacheKey(sel) === key || group.some((entry3) => selectionCacheKey(entry3) === key);
|
|
39740
39880
|
return covered ? null : hoverSel;
|
|
39741
39881
|
};
|
|
39742
39882
|
const updateOverChannel = (iframe, overlayEl) => {
|
|
@@ -39764,9 +39904,9 @@ function useDomEditOverlayRects({
|
|
|
39764
39904
|
setOverlayRect(rects.selection);
|
|
39765
39905
|
setChildRects(rects.children);
|
|
39766
39906
|
setGroupOverlayItems(
|
|
39767
|
-
members.flatMap(({ key
|
|
39907
|
+
members.flatMap(({ key, selection }, index2) => {
|
|
39768
39908
|
const rect = rects.group[index2];
|
|
39769
|
-
return rect ? [{ key
|
|
39909
|
+
return rect ? [{ key, selection, element: selection.element, rect }] : [];
|
|
39770
39910
|
})
|
|
39771
39911
|
);
|
|
39772
39912
|
setHoverRect(rects.hover);
|
|
@@ -39854,17 +39994,17 @@ function useDomEditOverlayRects({
|
|
|
39854
39994
|
const nextGroupItems = [];
|
|
39855
39995
|
const liveGroupKeys = /* @__PURE__ */ new Set();
|
|
39856
39996
|
for (const groupSelection of group) {
|
|
39857
|
-
const
|
|
39858
|
-
if (liveGroupKeys.has(
|
|
39859
|
-
liveGroupKeys.add(
|
|
39997
|
+
const key = selectionCacheKey(groupSelection);
|
|
39998
|
+
if (liveGroupKeys.has(key)) continue;
|
|
39999
|
+
liveGroupKeys.add(key);
|
|
39860
40000
|
const el = resolveGroupElement(doc, groupSelection);
|
|
39861
40001
|
const base2 = el ? groupAwareOverlayRect(overlayEl, iframe, el, scale) : null;
|
|
39862
40002
|
const rect = base2 && el ? { ...base2, ...hugRectForElement(base2, el) } : base2;
|
|
39863
40003
|
if (el && rect)
|
|
39864
|
-
nextGroupItems.push({ key
|
|
40004
|
+
nextGroupItems.push({ key, selection: groupSelection, element: el, rect });
|
|
39865
40005
|
}
|
|
39866
|
-
for (const
|
|
39867
|
-
if (!liveGroupKeys.has(
|
|
40006
|
+
for (const key of resolvedGroupElementRef.current.keys()) {
|
|
40007
|
+
if (!liveGroupKeys.has(key)) resolvedGroupElementRef.current.delete(key);
|
|
39868
40008
|
}
|
|
39869
40009
|
setGroupOverlayItems(nextGroupItems);
|
|
39870
40010
|
} else {
|
|
@@ -40152,8 +40292,8 @@ function normalizeStudioFileChangePath(path) {
|
|
|
40152
40292
|
function asPayloadRecord(payload) {
|
|
40153
40293
|
return payload && typeof payload === "object" ? payload : null;
|
|
40154
40294
|
}
|
|
40155
|
-
function readFileChangeField(payload,
|
|
40156
|
-
const value = asPayloadRecord(payload)?.[
|
|
40295
|
+
function readFileChangeField(payload, key) {
|
|
40296
|
+
const value = asPayloadRecord(payload)?.[key];
|
|
40157
40297
|
return typeof value === "string" ? value : null;
|
|
40158
40298
|
}
|
|
40159
40299
|
function readStudioFileChangePath(payload) {
|
|
@@ -40527,8 +40667,8 @@ function markWrapped(fn) {
|
|
|
40527
40667
|
function isWrapped(fn) {
|
|
40528
40668
|
return Boolean(fn[STUDIO_MANUAL_EDITS_WRAPPED_PROP]);
|
|
40529
40669
|
}
|
|
40530
|
-
function wrapSeekReapplyFunction(win, owner,
|
|
40531
|
-
const fn = owner?.[
|
|
40670
|
+
function wrapSeekReapplyFunction(win, owner, key, reapplyWhenHeldSeekLands = false) {
|
|
40671
|
+
const fn = owner?.[key];
|
|
40532
40672
|
if (!owner || typeof fn !== "function") return false;
|
|
40533
40673
|
const seek = fn;
|
|
40534
40674
|
if (isWrapped(seek)) return true;
|
|
@@ -40541,14 +40681,14 @@ function wrapSeekReapplyFunction(win, owner, key2, reapplyWhenHeldSeekLands = fa
|
|
|
40541
40681
|
};
|
|
40542
40682
|
markWrapped(wrappedSeek);
|
|
40543
40683
|
try {
|
|
40544
|
-
owner[
|
|
40684
|
+
owner[key] = wrappedSeek;
|
|
40545
40685
|
} catch {
|
|
40546
40686
|
return false;
|
|
40547
40687
|
}
|
|
40548
40688
|
return true;
|
|
40549
40689
|
}
|
|
40550
|
-
function readOwnerNumber(owner,
|
|
40551
|
-
const fn = owner[
|
|
40690
|
+
function readOwnerNumber(owner, key) {
|
|
40691
|
+
const fn = owner[key];
|
|
40552
40692
|
if (typeof fn !== "function") return null;
|
|
40553
40693
|
try {
|
|
40554
40694
|
return finiteNumber2(fn.call(owner));
|
|
@@ -40634,8 +40774,8 @@ function startStudioManualEditPlaybackReapply(win) {
|
|
|
40634
40774
|
};
|
|
40635
40775
|
win[STUDIO_MANUAL_EDITS_PLAYBACK_FRAME_PROP] = win.requestAnimationFrame(tick);
|
|
40636
40776
|
}
|
|
40637
|
-
function wrapPlayReapplyFunction(win, owner,
|
|
40638
|
-
const fn = owner?.[
|
|
40777
|
+
function wrapPlayReapplyFunction(win, owner, key) {
|
|
40778
|
+
const fn = owner?.[key];
|
|
40639
40779
|
if (!owner || typeof fn !== "function") return false;
|
|
40640
40780
|
const play = fn;
|
|
40641
40781
|
if (isWrapped(play)) return true;
|
|
@@ -40646,14 +40786,14 @@ function wrapPlayReapplyFunction(win, owner, key2) {
|
|
|
40646
40786
|
};
|
|
40647
40787
|
markWrapped(wrappedPlay);
|
|
40648
40788
|
try {
|
|
40649
|
-
owner[
|
|
40789
|
+
owner[key] = wrappedPlay;
|
|
40650
40790
|
} catch {
|
|
40651
40791
|
return false;
|
|
40652
40792
|
}
|
|
40653
40793
|
return true;
|
|
40654
40794
|
}
|
|
40655
|
-
function wrapApplyAfterFunction(win, owner,
|
|
40656
|
-
const fn = owner?.[
|
|
40795
|
+
function wrapApplyAfterFunction(win, owner, key) {
|
|
40796
|
+
const fn = owner?.[key];
|
|
40657
40797
|
if (!owner || typeof fn !== "function") return false;
|
|
40658
40798
|
const applyAfter = fn;
|
|
40659
40799
|
if (isWrapped(applyAfter)) return true;
|
|
@@ -40664,7 +40804,7 @@ function wrapApplyAfterFunction(win, owner, key2) {
|
|
|
40664
40804
|
};
|
|
40665
40805
|
markWrapped(wrappedApplyAfter);
|
|
40666
40806
|
try {
|
|
40667
|
-
owner[
|
|
40807
|
+
owner[key] = wrappedApplyAfter;
|
|
40668
40808
|
} catch {
|
|
40669
40809
|
return false;
|
|
40670
40810
|
}
|
|
@@ -41623,19 +41763,19 @@ function resetDragMoveLog() {
|
|
|
41623
41763
|
}
|
|
41624
41764
|
function readDragPositions(elements) {
|
|
41625
41765
|
const positions = {};
|
|
41626
|
-
for (const { key
|
|
41766
|
+
for (const { key, element } of elements) {
|
|
41627
41767
|
const rect = element.getBoundingClientRect();
|
|
41628
|
-
positions[
|
|
41768
|
+
positions[key] = `${Math.round(rect.left)},${Math.round(rect.top)}`;
|
|
41629
41769
|
}
|
|
41630
41770
|
return positions;
|
|
41631
41771
|
}
|
|
41632
41772
|
function findNonRigidMembers(before, after) {
|
|
41633
41773
|
const moves = /* @__PURE__ */ new Map();
|
|
41634
|
-
for (const
|
|
41635
|
-
const from = before[
|
|
41636
|
-
const to = after[
|
|
41774
|
+
for (const key of Object.keys(after)) {
|
|
41775
|
+
const from = before[key]?.split(",").map(Number);
|
|
41776
|
+
const to = after[key]?.split(",").map(Number);
|
|
41637
41777
|
if (!from || !to || from.length !== 2 || to.length !== 2) continue;
|
|
41638
|
-
moves.set(
|
|
41778
|
+
moves.set(key, `${Math.round(to[0] - from[0])},${Math.round(to[1] - from[1])}`);
|
|
41639
41779
|
}
|
|
41640
41780
|
const counts = /* @__PURE__ */ new Map();
|
|
41641
41781
|
for (const move of moves.values()) counts.set(move, (counts.get(move) ?? 0) + 1);
|
|
@@ -41644,7 +41784,7 @@ function findNonRigidMembers(before, after) {
|
|
|
41644
41784
|
for (const [move, count] of counts) {
|
|
41645
41785
|
if (count > best) [common, best] = [move, count];
|
|
41646
41786
|
}
|
|
41647
|
-
return [...moves].filter(([, move]) => move !== common).map(([
|
|
41787
|
+
return [...moves].filter(([, move]) => move !== common).map(([key, move]) => `${key.split("|")[2] ?? key} moved ${move}, group moved ${common}`);
|
|
41648
41788
|
}
|
|
41649
41789
|
function logDragSettle(stage, elements) {
|
|
41650
41790
|
logDrag(stage, () => {
|
|
@@ -44144,8 +44284,8 @@ function InlineTextCaret({
|
|
|
44144
44284
|
let composing = false;
|
|
44145
44285
|
let side = "after";
|
|
44146
44286
|
const update = () => setPlacement(composing ? null : placeAtCaret(element, iframe, color, side));
|
|
44147
|
-
const onKey = ({ key
|
|
44148
|
-
if (!MODIFIERS.has(
|
|
44287
|
+
const onKey = ({ key }) => {
|
|
44288
|
+
if (!MODIFIERS.has(key)) side = SIDE_OF_KEY[key] ?? "after";
|
|
44149
44289
|
};
|
|
44150
44290
|
const onPress = () => void (side = "after");
|
|
44151
44291
|
const composition = (on) => () => {
|
|
@@ -44512,18 +44652,18 @@ function runNodes(doc, runs) {
|
|
|
44512
44652
|
return nodes;
|
|
44513
44653
|
}
|
|
44514
44654
|
function runNode(doc, run, carried) {
|
|
44515
|
-
const
|
|
44655
|
+
const key = styleKey(run.style);
|
|
44516
44656
|
const nodes = [];
|
|
44517
44657
|
for (const [index2, piece] of run.text.split(BREAK).entries()) {
|
|
44518
44658
|
if (index2 > 0) nodes.push(doc.createElement("br"));
|
|
44519
44659
|
if (!piece) continue;
|
|
44520
|
-
if (!
|
|
44660
|
+
if (!key && carried.size === 0) {
|
|
44521
44661
|
nodes.push(doc.createTextNode(piece));
|
|
44522
44662
|
continue;
|
|
44523
44663
|
}
|
|
44524
44664
|
const span = doc.createElement("span");
|
|
44525
44665
|
for (const [name, value] of carried) span.setAttribute(name, value);
|
|
44526
|
-
if (
|
|
44666
|
+
if (key) span.setAttribute("style", key);
|
|
44527
44667
|
span.textContent = piece;
|
|
44528
44668
|
nodes.push(span);
|
|
44529
44669
|
carried.clear();
|
|
@@ -45423,13 +45563,13 @@ function renderFields(label, text3) {
|
|
|
45423
45563
|
const [name = "", ...value] = field.split(" ");
|
|
45424
45564
|
const cells = document.createElement("span");
|
|
45425
45565
|
cells.className = "flex items-baseline gap-1.5";
|
|
45426
|
-
const
|
|
45427
|
-
|
|
45428
|
-
|
|
45566
|
+
const key = document.createElement("span");
|
|
45567
|
+
key.className = "text-text-4";
|
|
45568
|
+
key.textContent = name;
|
|
45429
45569
|
const figure = document.createElement("span");
|
|
45430
45570
|
figure.className = "min-w-[4ch] text-right font-medium";
|
|
45431
45571
|
figure.textContent = value.join(" ");
|
|
45432
|
-
cells.append(
|
|
45572
|
+
cells.append(key, figure);
|
|
45433
45573
|
if (index2 === 0) return [cells];
|
|
45434
45574
|
const divider = document.createElement("span");
|
|
45435
45575
|
divider.className = "h-3.5 w-px bg-border";
|
|
@@ -46214,9 +46354,9 @@ function flushAttemptCounts() {
|
|
|
46214
46354
|
const keys = Object.keys(attemptCounts);
|
|
46215
46355
|
if (keys.length === 0) return null;
|
|
46216
46356
|
const snapshot3 = {};
|
|
46217
|
-
for (const
|
|
46218
|
-
snapshot3[
|
|
46219
|
-
delete attemptCounts[
|
|
46357
|
+
for (const key of keys) {
|
|
46358
|
+
snapshot3[key] = attemptCounts[key];
|
|
46359
|
+
delete attemptCounts[key];
|
|
46220
46360
|
}
|
|
46221
46361
|
return snapshot3;
|
|
46222
46362
|
}
|
|
@@ -47543,9 +47683,9 @@ function resolveRepositionLaneMove(input) {
|
|
|
47543
47683
|
const selfKey = keyOf13(element);
|
|
47544
47684
|
const selfIdx = desiredOrderKeys.indexOf(selfKey);
|
|
47545
47685
|
if (selfIdx === -1) return null;
|
|
47546
|
-
const clipLaneForKey = (
|
|
47547
|
-
if (
|
|
47548
|
-
const el = elements.find((candidate) => keyOf13(candidate) ===
|
|
47686
|
+
const clipLaneForKey = (key) => {
|
|
47687
|
+
if (key == null) return null;
|
|
47688
|
+
const el = elements.find((candidate) => keyOf13(candidate) === key);
|
|
47549
47689
|
return el && classifyZone(el) === "visual" && el.duration > 0 && samePaintScope(el, element) && keyOf13(el) !== selfKey ? el.track : null;
|
|
47550
47690
|
};
|
|
47551
47691
|
let aboveLane = null;
|
|
@@ -47686,7 +47826,7 @@ function useMirrorLaneMoveCommit() {
|
|
|
47686
47826
|
{
|
|
47687
47827
|
elements: els,
|
|
47688
47828
|
trackOrder: timelineTrackOrder(els),
|
|
47689
|
-
updateElement: (
|
|
47829
|
+
updateElement: (key, updates) => usePlayerStore.getState().updateElement(key, updates),
|
|
47690
47830
|
onMoveElements
|
|
47691
47831
|
// NO readZIndex / onStackingPatches: see the hook doc — the lane→z
|
|
47692
47832
|
// stacking sync must not re-trigger and fight the just-set z values.
|
|
@@ -48826,15 +48966,15 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
|
|
|
48826
48966
|
|
|
48827
48967
|
// src/hooks/gsapKeyframeCacheHelpers.ts
|
|
48828
48968
|
function keepEqualEntries(before, draft) {
|
|
48829
|
-
for (const [
|
|
48830
|
-
const shown3 = before.get(
|
|
48831
|
-
if (shown3 !== void 0 && shown3 !== value && sameData(shown3, value)) draft.set(
|
|
48969
|
+
for (const [key, value] of draft) {
|
|
48970
|
+
const shown3 = before.get(key);
|
|
48971
|
+
if (shown3 !== void 0 && shown3 !== value && sameData(shown3, value)) draft.set(key, shown3);
|
|
48832
48972
|
}
|
|
48833
48973
|
}
|
|
48834
48974
|
function sameEntries(before, after) {
|
|
48835
48975
|
if (before.size !== after.size) return false;
|
|
48836
|
-
for (const [
|
|
48837
|
-
if (after.get(
|
|
48976
|
+
for (const [key, value] of before) {
|
|
48977
|
+
if (after.get(key) !== value) return false;
|
|
48838
48978
|
}
|
|
48839
48979
|
return true;
|
|
48840
48980
|
}
|
|
@@ -48897,16 +49037,16 @@ function updateKeyframeCacheFromParsed(animations, targetPath, selectionId, muta
|
|
|
48897
49037
|
});
|
|
48898
49038
|
}
|
|
48899
49039
|
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(
|
|
49040
|
+
for (const key of elementCacheKeys(sourceFile, elementId2)) {
|
|
49041
|
+
draft.keyframeCache.set(key, entry3);
|
|
49042
|
+
if (animations) draft.gsapAnimations.set(key, animations);
|
|
49043
|
+
else draft.gsapAnimations.delete(key);
|
|
48904
49044
|
}
|
|
48905
49045
|
}
|
|
48906
49046
|
function deleteElementFromDraft(draft, sourceFile, elementId2) {
|
|
48907
|
-
for (const
|
|
48908
|
-
draft.keyframeCache.delete(
|
|
48909
|
-
draft.gsapAnimations.delete(
|
|
49047
|
+
for (const key of elementCacheKeys(sourceFile, elementId2)) {
|
|
49048
|
+
draft.keyframeCache.delete(key);
|
|
49049
|
+
draft.gsapAnimations.delete(key);
|
|
48910
49050
|
}
|
|
48911
49051
|
}
|
|
48912
49052
|
function clearKeyframeCacheForElement(sourceFile, elementId2) {
|
|
@@ -48915,14 +49055,14 @@ function clearKeyframeCacheForElement(sourceFile, elementId2) {
|
|
|
48915
49055
|
function cachedElementIdsForFile(sourceFile, keyframeCache, gsapAnimations) {
|
|
48916
49056
|
const sfPrefix = `${sourceFile}#`;
|
|
48917
49057
|
const ids = /* @__PURE__ */ new Set();
|
|
48918
|
-
for (const
|
|
48919
|
-
if (
|
|
49058
|
+
for (const key of [...keyframeCache.keys(), ...gsapAnimations.keys()]) {
|
|
49059
|
+
if (key.startsWith(sfPrefix)) ids.add(key.slice(sfPrefix.length));
|
|
48920
49060
|
}
|
|
48921
49061
|
if (sourceFile !== "index.html") return ids;
|
|
48922
|
-
for (const [
|
|
48923
|
-
const hash =
|
|
48924
|
-
const id =
|
|
48925
|
-
if (hash > 0 && !
|
|
49062
|
+
for (const [key, entry3] of keyframeCache) {
|
|
49063
|
+
const hash = key.indexOf("#");
|
|
49064
|
+
const id = key.slice(hash + 1);
|
|
49065
|
+
if (hash > 0 && !key.startsWith(sfPrefix) && keyframeCache.get(sfPrefix + id) === entry3) {
|
|
48926
49066
|
ids.delete(id);
|
|
48927
49067
|
}
|
|
48928
49068
|
}
|
|
@@ -48932,13 +49072,13 @@ function pruneKeyframeCacheToFiles(files) {
|
|
|
48932
49072
|
const keep = new Set(files);
|
|
48933
49073
|
const { keyframeCache, gsapAnimations } = usePlayerStore.getState();
|
|
48934
49074
|
const stale = /* @__PURE__ */ new Map();
|
|
48935
|
-
for (const
|
|
48936
|
-
const hash =
|
|
49075
|
+
for (const key of [...keyframeCache.keys(), ...gsapAnimations.keys()]) {
|
|
49076
|
+
const hash = key.indexOf("#");
|
|
48937
49077
|
if (hash < 0) continue;
|
|
48938
|
-
const sourceFile =
|
|
49078
|
+
const sourceFile = key.slice(0, hash);
|
|
48939
49079
|
if (keep.has(sourceFile)) continue;
|
|
48940
49080
|
const ids = stale.get(sourceFile) ?? /* @__PURE__ */ new Set();
|
|
48941
|
-
ids.add(
|
|
49081
|
+
ids.add(key.slice(hash + 1));
|
|
48942
49082
|
stale.set(sourceFile, ids);
|
|
48943
49083
|
}
|
|
48944
49084
|
publishKeyframeCache((draft) => {
|
|
@@ -48981,9 +49121,9 @@ function replaceKeyframeCacheForFile(sourceFile, entries, animationsByElement) {
|
|
|
48981
49121
|
}
|
|
48982
49122
|
function writeGsapAnimationsForElement(sourceFile, elementId2, animations) {
|
|
48983
49123
|
publishKeyframeCache((draft) => {
|
|
48984
|
-
for (const
|
|
48985
|
-
if (animations) draft.gsapAnimations.set(
|
|
48986
|
-
else draft.gsapAnimations.delete(
|
|
49124
|
+
for (const key of elementCacheKeys(sourceFile, elementId2)) {
|
|
49125
|
+
if (animations) draft.gsapAnimations.set(key, animations);
|
|
49126
|
+
else draft.gsapAnimations.delete(key);
|
|
48987
49127
|
}
|
|
48988
49128
|
});
|
|
48989
49129
|
}
|
|
@@ -49377,10 +49517,10 @@ async function materializeIfDynamic(anim, iframe, commitMutation, selection) {
|
|
|
49377
49517
|
void selection;
|
|
49378
49518
|
throw new GsapEditBlockedError("source-uneditable", "geometry-unresolved-source");
|
|
49379
49519
|
}
|
|
49380
|
-
function stepBlock([
|
|
49381
|
-
if (
|
|
49382
|
-
if (/^on[A-Z]/.test(
|
|
49383
|
-
if (isTweenConfigKey(
|
|
49520
|
+
function stepBlock([key, value]) {
|
|
49521
|
+
if (key === "delay") return "array-step-delay";
|
|
49522
|
+
if (/^on[A-Z]/.test(key)) return "array-step-callback";
|
|
49523
|
+
if (isTweenConfigKey(key)) return "array-step-config";
|
|
49384
49524
|
if (typeof value === "number") return null;
|
|
49385
49525
|
return STEP_VALUE_BLOCKS.find(([pattern]) => pattern.test(value))?.[1] ?? null;
|
|
49386
49526
|
}
|
|
@@ -50240,7 +50380,7 @@ async function commitWholePropertyOffset(selection, anim, newValues, currentPct,
|
|
|
50240
50380
|
const ts = resolveTweenStart(effectiveAnim);
|
|
50241
50381
|
const td = resolveTweenDuration(effectiveAnim);
|
|
50242
50382
|
const keys = Object.keys(newValues);
|
|
50243
|
-
const at = (props,
|
|
50383
|
+
const at = (props, key) => typeof props[key] === "number" ? props[key] : KEYFRAME_PROPERTY_DEFAULTS[key] ?? 0;
|
|
50244
50384
|
const kfs = effectiveAnim.keyframes?.keyframes ?? synthesizeFlatTweenKeyframes(effectiveAnim)?.keyframes;
|
|
50245
50385
|
if (!kfs || kfs.length === 0) {
|
|
50246
50386
|
await callbacks.commitMutation(
|
|
@@ -50255,9 +50395,9 @@ async function commitWholePropertyOffset(selection, anim, newValues, currentPct,
|
|
|
50255
50395
|
);
|
|
50256
50396
|
const shifted = kfs.map((kf) => {
|
|
50257
50397
|
const properties = { ...kf.properties };
|
|
50258
|
-
for (const
|
|
50259
|
-
properties[
|
|
50260
|
-
at(properties,
|
|
50398
|
+
for (const key of keys) {
|
|
50399
|
+
properties[key] = roundTo3(
|
|
50400
|
+
at(properties, key) + (newValues[key] - at(nearest.properties, key))
|
|
50261
50401
|
);
|
|
50262
50402
|
}
|
|
50263
50403
|
return { percentage: kf.percentage, properties, ...kf.ease ? { ease: kf.ease } : {} };
|
|
@@ -50964,9 +51104,9 @@ var SnapToolbar = memo32(function SnapToolbar2() {
|
|
|
50964
51104
|
[
|
|
50965
51105
|
["rulerVisible", "Ruler", Ruler],
|
|
50966
51106
|
["safeMarginsVisible", "Safe margins", FrameCorners]
|
|
50967
|
-
].map(([
|
|
50968
|
-
const visible =
|
|
50969
|
-
const toggle =
|
|
51107
|
+
].map(([key, label, Icon]) => {
|
|
51108
|
+
const visible = key === "rulerVisible" ? rulerVisible : safeMarginsVisible;
|
|
51109
|
+
const toggle = key === "rulerVisible" ? actions.toggleRulers : actions.toggleSafeMargins;
|
|
50970
51110
|
return /* @__PURE__ */ jsx117(
|
|
50971
51111
|
"button",
|
|
50972
51112
|
{
|
|
@@ -50974,14 +51114,14 @@ var SnapToolbar = memo32(function SnapToolbar2() {
|
|
|
50974
51114
|
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
51115
|
onClick: () => {
|
|
50976
51116
|
toggle();
|
|
50977
|
-
trackPreviewFeatureUsed(
|
|
51117
|
+
trackPreviewFeatureUsed(key === "rulerVisible" ? "ruler" : "safe_margins", "button");
|
|
50978
51118
|
},
|
|
50979
51119
|
title: `${label} ${visible ? "on" : "off"}`,
|
|
50980
51120
|
"aria-label": `Toggle ${label.toLowerCase()}`,
|
|
50981
51121
|
"aria-pressed": visible,
|
|
50982
51122
|
children: /* @__PURE__ */ jsx117(Icon, { size: 16, weight: visible ? "fill" : "regular" })
|
|
50983
51123
|
},
|
|
50984
|
-
|
|
51124
|
+
key
|
|
50985
51125
|
);
|
|
50986
51126
|
}),
|
|
50987
51127
|
/* @__PURE__ */ jsx117(
|
|
@@ -51320,21 +51460,6 @@ import { isXYPositionWrite, PROPERTY_GROUPS } from "@hyperframes/parsers/gsap-co
|
|
|
51320
51460
|
|
|
51321
51461
|
// src/hooks/gsapRuntimeReaders.ts
|
|
51322
51462
|
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
51463
|
function readGsapProperty(iframe, selector, prop) {
|
|
51339
51464
|
if (!selector) return null;
|
|
51340
51465
|
const gsap3 = getIframeGsap(iframe);
|
|
@@ -51342,7 +51467,7 @@ function readGsapProperty(iframe, selector, prop) {
|
|
|
51342
51467
|
const el = queryIframeElement(iframe, selector);
|
|
51343
51468
|
if (!el) return null;
|
|
51344
51469
|
try {
|
|
51345
|
-
const val =
|
|
51470
|
+
const val = Number(gsap3.getProperty(el, prop));
|
|
51346
51471
|
if (!Number.isFinite(val)) return null;
|
|
51347
51472
|
return POSITION_PROPS.has(prop) ? Math.round(val) : roundTo3(val);
|
|
51348
51473
|
} catch {
|
|
@@ -51375,7 +51500,7 @@ function readAllAnimatedProperties(iframe, selector, anim, group) {
|
|
|
51375
51500
|
const inGroup = (p) => !group || classifyPropertyGroup3(p) === group;
|
|
51376
51501
|
const groupedPropKeys = new Set([...propKeys].filter(inGroup));
|
|
51377
51502
|
for (const prop of groupedPropKeys) {
|
|
51378
|
-
const val =
|
|
51503
|
+
const val = Number(gsap3.getProperty(el, prop));
|
|
51379
51504
|
if (Number.isFinite(val)) {
|
|
51380
51505
|
result[prop] = POSITION_PROPS.has(prop) ? Math.round(val) : roundTo3(val);
|
|
51381
51506
|
}
|
|
@@ -51881,14 +52006,14 @@ function hasAnimations(value) {
|
|
|
51881
52006
|
var inFlightParses = /* @__PURE__ */ new Map();
|
|
51882
52007
|
var parseCacheKey = (projectId, sourceFile) => `${projectId}|${sourceFile}`;
|
|
51883
52008
|
function fetchParsedAnimations(projectId, sourceFile, options = {}) {
|
|
51884
|
-
const
|
|
51885
|
-
if (options.fresh) inFlightParses.delete(
|
|
51886
|
-
const inFlight = inFlightParses.get(
|
|
52009
|
+
const key = parseCacheKey(projectId, sourceFile);
|
|
52010
|
+
if (options.fresh) inFlightParses.delete(key);
|
|
52011
|
+
const inFlight = inFlightParses.get(key);
|
|
51887
52012
|
if (inFlight) return inFlight;
|
|
51888
52013
|
const request2 = requestParsedAnimations(projectId, sourceFile).finally(() => {
|
|
51889
|
-
if (inFlightParses.get(
|
|
52014
|
+
if (inFlightParses.get(key) === request2) inFlightParses.delete(key);
|
|
51890
52015
|
});
|
|
51891
|
-
inFlightParses.set(
|
|
52016
|
+
inFlightParses.set(key, request2);
|
|
51892
52017
|
return request2;
|
|
51893
52018
|
}
|
|
51894
52019
|
async function requestParsedAnimations(projectId, sourceFile) {
|
|
@@ -52066,7 +52191,7 @@ function useGsapAnimationsForElement(projectId, sourceFile, target, version, ifr
|
|
|
52066
52191
|
if (allKeyframes.length === 0) {
|
|
52067
52192
|
const { keyframeCache } = usePlayerStore.getState();
|
|
52068
52193
|
const hasCached = elementCacheKeys(sourceFile, elementId2).some(
|
|
52069
|
-
(
|
|
52194
|
+
(key) => keyframeCache.has(key)
|
|
52070
52195
|
);
|
|
52071
52196
|
if (!hasCached) clearKeyframeCacheForElement(sourceFile, elementId2);
|
|
52072
52197
|
return;
|
|
@@ -52079,8 +52204,8 @@ function useGsapAnimationsForElement(projectId, sourceFile, target, version, ifr
|
|
|
52079
52204
|
...easeEach ? { easeEach } : {}
|
|
52080
52205
|
};
|
|
52081
52206
|
publishKeyframeCache((draft) => {
|
|
52082
|
-
for (const
|
|
52083
|
-
draft.keyframeCache.set(
|
|
52207
|
+
for (const key of elementCacheKeys(sourceFile, elementId2)) {
|
|
52208
|
+
draft.keyframeCache.set(key, merged);
|
|
52084
52209
|
}
|
|
52085
52210
|
});
|
|
52086
52211
|
}, [elementId2, sourceFile, animations, domClipChildrenKey]);
|
|
@@ -52142,7 +52267,7 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
|
|
|
52142
52267
|
publishKeyframeCache((draft) => {
|
|
52143
52268
|
for (const [id, data] of scanned) {
|
|
52144
52269
|
const keys = elementCacheKeys(sf, id);
|
|
52145
|
-
if (keys.some((
|
|
52270
|
+
if (keys.some((key) => draft.keyframeCache.has(key))) continue;
|
|
52146
52271
|
const isPosOnly = data.keyframes.length === 1 && Object.keys(data.keyframes[0].properties).every((k) => k === "x" || k === "y");
|
|
52147
52272
|
if (isPosOnly) {
|
|
52148
52273
|
continue;
|
|
@@ -52152,7 +52277,7 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
|
|
|
52152
52277
|
keyframes: data.keyframes,
|
|
52153
52278
|
...data.easeEach ? { easeEach: data.easeEach } : {}
|
|
52154
52279
|
};
|
|
52155
|
-
for (const
|
|
52280
|
+
for (const key of keys) draft.keyframeCache.set(key, entry3);
|
|
52156
52281
|
}
|
|
52157
52282
|
});
|
|
52158
52283
|
runtimeScanDoneRef.current = `kf-cache:${projectId}:${sf}:${version}`;
|
|
@@ -52283,8 +52408,8 @@ function useTimelineEditCallbacks({
|
|
|
52283
52408
|
const { gsapAnimations } = usePlayerStore.getState();
|
|
52284
52409
|
const { sourceFile, domId } = splitTimelineElementKey(elementKey3);
|
|
52285
52410
|
const scope = sourceFile ?? activeCompPath ?? "index.html";
|
|
52286
|
-
for (const
|
|
52287
|
-
const animations = gsapAnimations.get(
|
|
52411
|
+
for (const key of elementCacheKeys(scope, domId)) {
|
|
52412
|
+
const animations = gsapAnimations.get(key);
|
|
52288
52413
|
if (animations) return animations;
|
|
52289
52414
|
}
|
|
52290
52415
|
return [];
|
|
@@ -53499,8 +53624,8 @@ function transformReceipt(request2, initial, box, observations, failure2) {
|
|
|
53499
53624
|
const unchanged = Object.fromEntries(
|
|
53500
53625
|
observations.flatMap((item) => {
|
|
53501
53626
|
if (!item.unchangedReason) return [];
|
|
53502
|
-
const
|
|
53503
|
-
return [[
|
|
53627
|
+
const key = item.operation === "rotate" ? "rotation" : item.operation;
|
|
53628
|
+
return [[key, item.unchangedReason]];
|
|
53504
53629
|
})
|
|
53505
53630
|
);
|
|
53506
53631
|
const value = {
|
|
@@ -53712,14 +53837,14 @@ async function studioAddKeyframe(deps, input, signal = new AbortController().sig
|
|
|
53712
53837
|
);
|
|
53713
53838
|
}
|
|
53714
53839
|
const properties = {};
|
|
53715
|
-
for (const [
|
|
53840
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
53716
53841
|
if (isRawGsapExpression(value)) {
|
|
53717
53842
|
return preDispatchFailure2(
|
|
53718
53843
|
"add-keyframe",
|
|
53719
53844
|
toolFailure("invalid", "raw JavaScript expressions are not accepted")
|
|
53720
53845
|
);
|
|
53721
53846
|
}
|
|
53722
|
-
if (typeof value === "number" || typeof value === "string") properties[
|
|
53847
|
+
if (typeof value === "number" || typeof value === "string") properties[key] = value;
|
|
53723
53848
|
}
|
|
53724
53849
|
if (Object.keys(properties).length === 0) {
|
|
53725
53850
|
return preDispatchFailure2(
|
|
@@ -53993,12 +54118,12 @@ function buildStudioTools(depsRef) {
|
|
|
53993
54118
|
}
|
|
53994
54119
|
];
|
|
53995
54120
|
}
|
|
53996
|
-
function readStringInput(input,
|
|
53997
|
-
const value = Reflect.get(input,
|
|
54121
|
+
function readStringInput(input, key) {
|
|
54122
|
+
const value = Reflect.get(input, key);
|
|
53998
54123
|
return typeof value === "string" ? value : "";
|
|
53999
54124
|
}
|
|
54000
|
-
function readNumberInput(input,
|
|
54001
|
-
const value = Reflect.get(input,
|
|
54125
|
+
function readNumberInput(input, key) {
|
|
54126
|
+
const value = Reflect.get(input, key);
|
|
54002
54127
|
return typeof value === "number" ? value : Number.NaN;
|
|
54003
54128
|
}
|
|
54004
54129
|
function useStudioAgentTools(deps) {
|
|
@@ -54343,14 +54468,14 @@ function DockStripActions({
|
|
|
54343
54468
|
panels,
|
|
54344
54469
|
isGroupActive
|
|
54345
54470
|
}) {
|
|
54346
|
-
const
|
|
54471
|
+
const subscribe2 = useCallback75(
|
|
54347
54472
|
(onChange) => {
|
|
54348
54473
|
const subscription = containerApi.onDidMaximizedGroupChange(onChange);
|
|
54349
54474
|
return () => subscription.dispose();
|
|
54350
54475
|
},
|
|
54351
54476
|
[containerApi]
|
|
54352
54477
|
);
|
|
54353
|
-
const maximized = useSyncExternalStore9(
|
|
54478
|
+
const maximized = useSyncExternalStore9(subscribe2, () => api.isMaximized());
|
|
54354
54479
|
const openPanels = useDockLayoutStore((state) => state.openPanels);
|
|
54355
54480
|
const togglePanel = useDockLayoutStore((state) => state.togglePanel);
|
|
54356
54481
|
const resetLayout = useDockLayoutStore((state) => state.resetLayout);
|
|
@@ -54433,14 +54558,14 @@ var TAB_ICONS = {
|
|
|
54433
54558
|
motionBlur: Aperture
|
|
54434
54559
|
};
|
|
54435
54560
|
function DockTab({ api }) {
|
|
54436
|
-
const
|
|
54561
|
+
const subscribe2 = useCallback76(
|
|
54437
54562
|
(onChange) => {
|
|
54438
54563
|
const subscription = api.onDidTitleChange(onChange);
|
|
54439
54564
|
return () => subscription.dispose();
|
|
54440
54565
|
},
|
|
54441
54566
|
[api]
|
|
54442
54567
|
);
|
|
54443
|
-
const title = useSyncExternalStore10(
|
|
54568
|
+
const title = useSyncExternalStore10(subscribe2, () => api.title ?? "");
|
|
54444
54569
|
const TypeIcon = isPanelId(api.id) ? TAB_ICONS[api.id] : null;
|
|
54445
54570
|
return /* @__PURE__ */ jsxs86("div", { className: "hf-dock-tab", children: [
|
|
54446
54571
|
TypeIcon ? /* @__PURE__ */ jsx122(TypeIcon, { className: "hf-dock-tab-icon", size: 14, "aria-hidden": true }) : null,
|
|
@@ -55864,11 +55989,11 @@ function trackDesignInput(descriptor) {
|
|
|
55864
55989
|
const section = slugifyDesignInput(descriptor.section) || "unknown";
|
|
55865
55990
|
const name = slugifyDesignInput(descriptor.name);
|
|
55866
55991
|
const control = descriptor.control || "unknown";
|
|
55867
|
-
const
|
|
55992
|
+
const key = `${descriptor.ui}:${section}:${control}:${name || "unnamed"}`;
|
|
55868
55993
|
const t2 = now();
|
|
55869
|
-
const last = lastFiredByKey.get(
|
|
55994
|
+
const last = lastFiredByKey.get(key);
|
|
55870
55995
|
if (last !== void 0 && t2 - last < COALESCE_WINDOW_MS) return;
|
|
55871
|
-
lastFiredByKey.set(
|
|
55996
|
+
lastFiredByKey.set(key, t2);
|
|
55872
55997
|
trackStudioEvent("design_input", {
|
|
55873
55998
|
ui: descriptor.ui,
|
|
55874
55999
|
section,
|
|
@@ -56180,9 +56305,9 @@ function uniqueFontFamilies(values, seen = /* @__PURE__ */ new Set()) {
|
|
|
56180
56305
|
return values.reduce((result, value) => {
|
|
56181
56306
|
const family = value.trim();
|
|
56182
56307
|
if (!family) return result;
|
|
56183
|
-
const
|
|
56184
|
-
if (seen.has(
|
|
56185
|
-
seen.add(
|
|
56308
|
+
const key = family.toLowerCase();
|
|
56309
|
+
if (seen.has(key)) return result;
|
|
56310
|
+
seen.add(key);
|
|
56186
56311
|
result.push(family);
|
|
56187
56312
|
return result;
|
|
56188
56313
|
}, []);
|
|
@@ -56192,9 +56317,9 @@ function uniqueFontOptions(values) {
|
|
|
56192
56317
|
return values.reduce((result, value) => {
|
|
56193
56318
|
const family = value.family.trim();
|
|
56194
56319
|
if (!family) return result;
|
|
56195
|
-
const
|
|
56196
|
-
if (seen.has(
|
|
56197
|
-
seen.add(
|
|
56320
|
+
const key = family.toLowerCase();
|
|
56321
|
+
if (seen.has(key)) return result;
|
|
56322
|
+
seen.add(key);
|
|
56198
56323
|
result.push({ family, source: value.source });
|
|
56199
56324
|
return result;
|
|
56200
56325
|
}, []);
|
|
@@ -56630,9 +56755,9 @@ function useInspectorGestureDraft({
|
|
|
56630
56755
|
|
|
56631
56756
|
// src/components/editor/propertyPanelCommitField.tsx
|
|
56632
56757
|
import { jsx as jsx132 } from "react/jsx-runtime";
|
|
56633
|
-
function arrowDirection(
|
|
56634
|
-
if (
|
|
56635
|
-
if (
|
|
56758
|
+
function arrowDirection(key) {
|
|
56759
|
+
if (key === "ArrowUp") return 1;
|
|
56760
|
+
if (key === "ArrowDown") return -1;
|
|
56636
56761
|
return null;
|
|
56637
56762
|
}
|
|
56638
56763
|
function CommitField({
|
|
@@ -57946,21 +58071,21 @@ function colorGradingWithLut(grading, src, intensity = 1) {
|
|
|
57946
58071
|
lut: src ? { src, intensity } : null
|
|
57947
58072
|
};
|
|
57948
58073
|
}
|
|
57949
|
-
function colorGradingWithDetail(grading,
|
|
58074
|
+
function colorGradingWithDetail(grading, key, value) {
|
|
57950
58075
|
return {
|
|
57951
58076
|
...grading,
|
|
57952
58077
|
intensity: visibleColorGradingIntensity(grading),
|
|
57953
|
-
details: { ...grading.details, [
|
|
58078
|
+
details: { ...grading.details, [key]: value }
|
|
57954
58079
|
};
|
|
57955
58080
|
}
|
|
57956
58081
|
function colorGradingWithIntensity(grading, intensity) {
|
|
57957
58082
|
return { ...grading, intensity };
|
|
57958
58083
|
}
|
|
57959
|
-
function colorGradingWithAdjust(grading,
|
|
58084
|
+
function colorGradingWithAdjust(grading, key, value) {
|
|
57960
58085
|
return {
|
|
57961
58086
|
...grading,
|
|
57962
58087
|
intensity: visibleColorGradingIntensity(grading),
|
|
57963
|
-
adjust: { ...grading.adjust, [
|
|
58088
|
+
adjust: { ...grading.adjust, [key]: value }
|
|
57964
58089
|
};
|
|
57965
58090
|
}
|
|
57966
58091
|
async function importFirstLut(files, onImportAssets) {
|
|
@@ -60611,7 +60736,7 @@ function VariablePromoteProvider({
|
|
|
60611
60736
|
}
|
|
60612
60737
|
function useVariablePromoteChannel(channel) {
|
|
60613
60738
|
const ctx3 = useContext14(VariablePromoteContext);
|
|
60614
|
-
const
|
|
60739
|
+
const key = channel.kind === "style" ? `style:${channel.prop}` : channel.kind;
|
|
60615
60740
|
return useMemo56(() => {
|
|
60616
60741
|
if (!ctx3 || !ctx3.session || !ctx3.selection?.hfId) return null;
|
|
60617
60742
|
const { session, selection, actions, declarations, persist: persist2, onPersistError } = ctx3;
|
|
@@ -60641,7 +60766,7 @@ function useVariablePromoteChannel(channel) {
|
|
|
60641
60766
|
).catch(onPersistError);
|
|
60642
60767
|
}
|
|
60643
60768
|
};
|
|
60644
|
-
}, [ctx3,
|
|
60769
|
+
}, [ctx3, key]);
|
|
60645
60770
|
}
|
|
60646
60771
|
|
|
60647
60772
|
// src/components/editor/PromotableControl.tsx
|
|
@@ -63587,10 +63712,10 @@ var ANIMATION_META_LABELS = {
|
|
|
63587
63712
|
easeEach: { control: "select", name: "Speed" }
|
|
63588
63713
|
};
|
|
63589
63714
|
function trackAnimationMetaUpdate(track2, updates) {
|
|
63590
|
-
for (const
|
|
63591
|
-
const mapped = ANIMATION_META_LABELS[
|
|
63715
|
+
for (const key of Object.keys(updates)) {
|
|
63716
|
+
const mapped = ANIMATION_META_LABELS[key];
|
|
63592
63717
|
if (mapped) track2(mapped.control, mapped.name);
|
|
63593
|
-
else track2("select",
|
|
63718
|
+
else track2("select", key);
|
|
63594
63719
|
}
|
|
63595
63720
|
}
|
|
63596
63721
|
function withTrackedGsapAnimationCallbacks(callbacks, track2) {
|
|
@@ -64955,9 +65080,9 @@ function FlatGroupHeader({
|
|
|
64955
65080
|
}
|
|
64956
65081
|
);
|
|
64957
65082
|
}
|
|
64958
|
-
function sliderKeyTarget(
|
|
64959
|
-
if (
|
|
64960
|
-
if (
|
|
65083
|
+
function sliderKeyTarget(key, current2, min, max, step) {
|
|
65084
|
+
if (key === "Home") return min;
|
|
65085
|
+
if (key === "End") return max;
|
|
64961
65086
|
const deltas = {
|
|
64962
65087
|
ArrowLeft: -step,
|
|
64963
65088
|
ArrowDown: -step,
|
|
@@ -64966,7 +65091,7 @@ function sliderKeyTarget(key2, current2, min, max, step) {
|
|
|
64966
65091
|
PageDown: -step * 10,
|
|
64967
65092
|
PageUp: step * 10
|
|
64968
65093
|
};
|
|
64969
|
-
const delta = deltas[
|
|
65094
|
+
const delta = deltas[key];
|
|
64970
65095
|
if (delta === void 0) return null;
|
|
64971
65096
|
return Math.max(min, Math.min(max, current2 + delta));
|
|
64972
65097
|
}
|
|
@@ -66878,11 +67003,11 @@ function FxParams({
|
|
|
66878
67003
|
onRemoveAutomation
|
|
66879
67004
|
}) {
|
|
66880
67005
|
const set = useCallback92(
|
|
66881
|
-
(
|
|
67006
|
+
(key, value) => onChange({ ...params, [key]: value }),
|
|
66882
67007
|
[params, onChange]
|
|
66883
67008
|
);
|
|
66884
67009
|
const commit2 = useCallback92(
|
|
66885
|
-
(
|
|
67010
|
+
(key, value) => onCommit?.({ ...params, [key]: value }),
|
|
66886
67011
|
[params, onCommit]
|
|
66887
67012
|
);
|
|
66888
67013
|
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 +67794,21 @@ function FxNodeParams({
|
|
|
67669
67794
|
onChange: (params) => onPreview(index2, params),
|
|
67670
67795
|
onCommit: (next) => {
|
|
67671
67796
|
const before = node.params ?? defaultAudioFxParams3(node.type);
|
|
67672
|
-
for (const [
|
|
67673
|
-
if (before[
|
|
67797
|
+
for (const [key, value] of Object.entries(next)) {
|
|
67798
|
+
if (before[key] === value) continue;
|
|
67674
67799
|
if (typeof value !== "number" && typeof value !== "string") continue;
|
|
67675
|
-
trackParamCommitted(node.type,
|
|
67676
|
-
trackInput(typeof value === "number" ? "slider" : "select",
|
|
67800
|
+
trackParamCommitted(node.type, key, value, "details", { trackKind });
|
|
67801
|
+
trackInput(typeof value === "number" ? "slider" : "select", key);
|
|
67677
67802
|
}
|
|
67678
67803
|
onUpdate(index2, { params: next });
|
|
67679
67804
|
},
|
|
67680
67805
|
automatedKeys: automatedKeysOf(node, def.params, automatedTargets),
|
|
67681
|
-
onAutomate: nodeId && onAutomateParam ? (
|
|
67682
|
-
onAutomateParam(nodeId,
|
|
67806
|
+
onAutomate: nodeId && onAutomateParam ? (key) => {
|
|
67807
|
+
onAutomateParam(nodeId, key);
|
|
67683
67808
|
trackInput("button", "automate-param");
|
|
67684
67809
|
} : void 0,
|
|
67685
|
-
onRemoveAutomation: nodeId && onRemoveParamAutomation ? (
|
|
67686
|
-
onRemoveParamAutomation(nodeId,
|
|
67810
|
+
onRemoveAutomation: nodeId && onRemoveParamAutomation ? (key) => {
|
|
67811
|
+
onRemoveParamAutomation(nodeId, key);
|
|
67687
67812
|
trackInput("button", "remove-param-automation");
|
|
67688
67813
|
} : void 0
|
|
67689
67814
|
}
|
|
@@ -70183,19 +70308,19 @@ function movePoint(points, index2, input, output, tab) {
|
|
|
70183
70308
|
return { points: next, selected: next.indexOf(moved) };
|
|
70184
70309
|
}
|
|
70185
70310
|
var ARROW_KEYS = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"];
|
|
70186
|
-
function isArrowKey(
|
|
70187
|
-
return ARROW_KEYS.includes(
|
|
70311
|
+
function isArrowKey(key) {
|
|
70312
|
+
return ARROW_KEYS.includes(key);
|
|
70188
70313
|
}
|
|
70189
70314
|
function curveOutputStep(tab, large) {
|
|
70190
70315
|
if (tab.kind === "rgb") return large ? 0.05 : 0.01;
|
|
70191
70316
|
if (tab.key === "hueVsHue") return large ? 10 : 1;
|
|
70192
70317
|
return large ? 0.1 : 0.01;
|
|
70193
70318
|
}
|
|
70194
|
-
function keyboardPointPosition(point,
|
|
70319
|
+
function keyboardPointPosition(point, key, tab, large) {
|
|
70195
70320
|
const inputStep = tab.kind === "rgb" ? large ? 0.05 : 0.01 : large ? 10 : 1;
|
|
70196
70321
|
const outputStep = curveOutputStep(tab, large);
|
|
70197
|
-
const inputDelta =
|
|
70198
|
-
const outputDelta =
|
|
70322
|
+
const inputDelta = key === "ArrowLeft" ? -inputStep : key === "ArrowRight" ? inputStep : 0;
|
|
70323
|
+
const outputDelta = key === "ArrowDown" ? -outputStep : key === "ArrowUp" ? outputStep : 0;
|
|
70199
70324
|
return { input: point[0] + inputDelta, output: point[1] + outputDelta };
|
|
70200
70325
|
}
|
|
70201
70326
|
function CurveGraph({
|
|
@@ -70232,11 +70357,11 @@ function CurveGraph({
|
|
|
70232
70357
|
onPreview(inserted.points, inserted.selected);
|
|
70233
70358
|
onSettle();
|
|
70234
70359
|
};
|
|
70235
|
-
const moveSelectedByKeyboard = (
|
|
70360
|
+
const moveSelectedByKeyboard = (key, large) => {
|
|
70236
70361
|
if (selectedIndex === null) return false;
|
|
70237
70362
|
const selected = points[selectedIndex];
|
|
70238
70363
|
if (!selected) return false;
|
|
70239
|
-
const position = keyboardPointPosition(selected,
|
|
70364
|
+
const position = keyboardPointPosition(selected, key, tab, large);
|
|
70240
70365
|
const moved = movePoint(points, selectedIndex, position.input, position.output, tab);
|
|
70241
70366
|
onBegin();
|
|
70242
70367
|
onPreview(moved.points, moved.selected);
|
|
@@ -70741,16 +70866,16 @@ function rgbToHsv2(red, green, blue) {
|
|
|
70741
70866
|
value: max
|
|
70742
70867
|
};
|
|
70743
70868
|
}
|
|
70744
|
-
function colorGradingSecondaryMask(red, green, blue,
|
|
70869
|
+
function colorGradingSecondaryMask(red, green, blue, key) {
|
|
70745
70870
|
const hsv = rgbToHsv2(red / BYTE_MAX, green / BYTE_MAX, blue / BYTE_MAX);
|
|
70746
70871
|
return calculateHfColorGradingSecondaryMask(
|
|
70747
70872
|
hsv.hue,
|
|
70748
70873
|
hsv.saturation,
|
|
70749
70874
|
rec709Luma(red / BYTE_MAX, green / BYTE_MAX, blue / BYTE_MAX),
|
|
70750
|
-
|
|
70875
|
+
key
|
|
70751
70876
|
);
|
|
70752
70877
|
}
|
|
70753
|
-
function buildColorGradingSecondaryMatte(pixels, width, height,
|
|
70878
|
+
function buildColorGradingSecondaryMatte(pixels, width, height, key) {
|
|
70754
70879
|
const matte = new Uint8ClampedArray(width * height * 4);
|
|
70755
70880
|
for (let offset = 0; offset < pixels.length; offset += 4) {
|
|
70756
70881
|
const alpha = pixels[offset + 3] ?? 0;
|
|
@@ -70758,7 +70883,7 @@ function buildColorGradingSecondaryMatte(pixels, width, height, key2) {
|
|
|
70758
70883
|
pixels[offset] ?? 0,
|
|
70759
70884
|
pixels[offset + 1] ?? 0,
|
|
70760
70885
|
pixels[offset + 2] ?? 0,
|
|
70761
|
-
|
|
70886
|
+
key
|
|
70762
70887
|
);
|
|
70763
70888
|
const value = Math.round(mask * BYTE_MAX);
|
|
70764
70889
|
matte[offset] = value;
|
|
@@ -71333,14 +71458,14 @@ function PropertyPanelColorSecondary({
|
|
|
71333
71458
|
"aria-label": "Sample color from captured frame",
|
|
71334
71459
|
onClick: (event) => {
|
|
71335
71460
|
const pointer = event.detail === 0 ? [] : [event.clientX, event.clientY];
|
|
71336
|
-
const
|
|
71461
|
+
const key = sampleCapturedFrame(
|
|
71337
71462
|
samplePixels,
|
|
71338
71463
|
sampleFrame,
|
|
71339
71464
|
event.currentTarget,
|
|
71340
71465
|
...pointer
|
|
71341
71466
|
);
|
|
71342
|
-
if (!
|
|
71343
|
-
replaceSelected({ ...selected, key
|
|
71467
|
+
if (!key) return;
|
|
71468
|
+
replaceSelected({ ...selected, key });
|
|
71344
71469
|
setShowMatte(true);
|
|
71345
71470
|
},
|
|
71346
71471
|
children: /* @__PURE__ */ jsx189(
|
|
@@ -71418,10 +71543,10 @@ function PropertyPanelColorSecondary({
|
|
|
71418
71543
|
})
|
|
71419
71544
|
}
|
|
71420
71545
|
),
|
|
71421
|
-
["saturation", "luma"].flatMap((
|
|
71422
|
-
const label =
|
|
71423
|
-
const range = selected.key[
|
|
71424
|
-
const capability = SECONDARY_CAPABILITIES[
|
|
71546
|
+
["saturation", "luma"].flatMap((key) => {
|
|
71547
|
+
const label = key === "saturation" ? "Saturation" : "Luma";
|
|
71548
|
+
const range = selected.key[key];
|
|
71549
|
+
const capability = SECONDARY_CAPABILITIES[key];
|
|
71425
71550
|
return [
|
|
71426
71551
|
/* @__PURE__ */ jsx189(
|
|
71427
71552
|
FlatSlider,
|
|
@@ -71436,7 +71561,7 @@ function PropertyPanelColorSecondary({
|
|
|
71436
71561
|
...selected,
|
|
71437
71562
|
key: {
|
|
71438
71563
|
...selected.key,
|
|
71439
|
-
[
|
|
71564
|
+
[key]: {
|
|
71440
71565
|
...range,
|
|
71441
71566
|
min: Math.max(
|
|
71442
71567
|
capability.min.min,
|
|
@@ -71446,7 +71571,7 @@ function PropertyPanelColorSecondary({
|
|
|
71446
71571
|
}
|
|
71447
71572
|
})
|
|
71448
71573
|
},
|
|
71449
|
-
`${
|
|
71574
|
+
`${key}-min`
|
|
71450
71575
|
),
|
|
71451
71576
|
/* @__PURE__ */ jsx189(
|
|
71452
71577
|
FlatSlider,
|
|
@@ -71461,7 +71586,7 @@ function PropertyPanelColorSecondary({
|
|
|
71461
71586
|
...selected,
|
|
71462
71587
|
key: {
|
|
71463
71588
|
...selected.key,
|
|
71464
|
-
[
|
|
71589
|
+
[key]: {
|
|
71465
71590
|
...range,
|
|
71466
71591
|
max: Math.min(
|
|
71467
71592
|
capability.max.max,
|
|
@@ -71471,7 +71596,7 @@ function PropertyPanelColorSecondary({
|
|
|
71471
71596
|
}
|
|
71472
71597
|
})
|
|
71473
71598
|
},
|
|
71474
|
-
`${
|
|
71599
|
+
`${key}-max`
|
|
71475
71600
|
),
|
|
71476
71601
|
/* @__PURE__ */ jsx189(
|
|
71477
71602
|
FlatSlider,
|
|
@@ -71486,18 +71611,18 @@ function PropertyPanelColorSecondary({
|
|
|
71486
71611
|
...selected,
|
|
71487
71612
|
key: {
|
|
71488
71613
|
...selected.key,
|
|
71489
|
-
[
|
|
71614
|
+
[key]: { ...range, softness: value / PERCENT_SCALE }
|
|
71490
71615
|
}
|
|
71491
71616
|
})
|
|
71492
71617
|
},
|
|
71493
|
-
`${
|
|
71618
|
+
`${key}-softness`
|
|
71494
71619
|
)
|
|
71495
71620
|
];
|
|
71496
71621
|
}),
|
|
71497
71622
|
/* @__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[
|
|
71623
|
+
CORRECTION_CONTROLS.map(([key, label, scale, suffix]) => {
|
|
71624
|
+
const limit = SECONDARY_CAPABILITIES.correction[key];
|
|
71625
|
+
const value = selected.correction[key] * scale;
|
|
71501
71626
|
return /* @__PURE__ */ jsx189(
|
|
71502
71627
|
FlatSlider,
|
|
71503
71628
|
{
|
|
@@ -71510,14 +71635,14 @@ function PropertyPanelColorSecondary({
|
|
|
71510
71635
|
displayValue: `${Math.round(value)}${suffix}`,
|
|
71511
71636
|
onCommit: (next) => replaceSelected({
|
|
71512
71637
|
...selected,
|
|
71513
|
-
correction: { ...selected.correction, [
|
|
71638
|
+
correction: { ...selected.correction, [key]: next / scale }
|
|
71514
71639
|
}),
|
|
71515
71640
|
onReset: () => replaceSelected({
|
|
71516
71641
|
...selected,
|
|
71517
|
-
correction: { ...selected.correction, [
|
|
71642
|
+
correction: { ...selected.correction, [key]: 0 }
|
|
71518
71643
|
})
|
|
71519
71644
|
},
|
|
71520
|
-
|
|
71645
|
+
key
|
|
71521
71646
|
);
|
|
71522
71647
|
})
|
|
71523
71648
|
] })
|
|
@@ -71562,13 +71687,13 @@ function wheelFromPointer(wheel, clientX, clientY, rect) {
|
|
|
71562
71687
|
amount: clampNumber(Math.hypot(x, y), WHEEL_CONTROLS.amount.min, WHEEL_CONTROLS.amount.max)
|
|
71563
71688
|
};
|
|
71564
71689
|
}
|
|
71565
|
-
function updateWheel(value,
|
|
71566
|
-
return { ...value, [
|
|
71690
|
+
function updateWheel(value, key, wheel) {
|
|
71691
|
+
return { ...value, [key]: wheel };
|
|
71567
71692
|
}
|
|
71568
|
-
function wheelFromKey(wheel,
|
|
71693
|
+
function wheelFromKey(wheel, key, large) {
|
|
71569
71694
|
const hueStep = large ? 10 : 1;
|
|
71570
71695
|
const amountStep = large ? 0.1 : 0.01;
|
|
71571
|
-
switch (
|
|
71696
|
+
switch (key) {
|
|
71572
71697
|
case "ArrowLeft":
|
|
71573
71698
|
return { ...wheel, hue: wrapHue(wheel.hue - hueStep) };
|
|
71574
71699
|
case "ArrowRight":
|
|
@@ -71797,10 +71922,10 @@ function ColorWheels({
|
|
|
71797
71922
|
onPreview,
|
|
71798
71923
|
onCommit
|
|
71799
71924
|
});
|
|
71800
|
-
const previewWheel = (
|
|
71801
|
-
const resetWheel = (
|
|
71925
|
+
const previewWheel = (key, wheel) => transaction.preview(updateWheel(draft, key, wheel));
|
|
71926
|
+
const resetWheel = (key) => {
|
|
71802
71927
|
transaction.cancel();
|
|
71803
|
-
const next = updateWheel(draft,
|
|
71928
|
+
const next = updateWheel(draft, key, RESET_WHEEL);
|
|
71804
71929
|
setDraft(next);
|
|
71805
71930
|
onCommit(next);
|
|
71806
71931
|
};
|
|
@@ -71809,19 +71934,19 @@ function ColorWheels({
|
|
|
71809
71934
|
{
|
|
71810
71935
|
"data-color-wheels": "true",
|
|
71811
71936
|
className: "grid grid-cols-[repeat(auto-fit,minmax(88px,1fr))] gap-2",
|
|
71812
|
-
children: WHEELS.map(({ key
|
|
71937
|
+
children: WHEELS.map(({ key, label }) => /* @__PURE__ */ jsx190(
|
|
71813
71938
|
TonalWheel,
|
|
71814
71939
|
{
|
|
71815
71940
|
label,
|
|
71816
|
-
wheel: draft[
|
|
71941
|
+
wheel: draft[key],
|
|
71817
71942
|
disabled,
|
|
71818
71943
|
onBegin: transaction.begin,
|
|
71819
|
-
onPreview: (wheel) => previewWheel(
|
|
71944
|
+
onPreview: (wheel) => previewWheel(key, wheel),
|
|
71820
71945
|
onSettle: transaction.settle,
|
|
71821
71946
|
onCancel: transaction.cancel,
|
|
71822
|
-
onReset: () => resetWheel(
|
|
71947
|
+
onReset: () => resetWheel(key)
|
|
71823
71948
|
},
|
|
71824
|
-
|
|
71949
|
+
key
|
|
71825
71950
|
))
|
|
71826
71951
|
}
|
|
71827
71952
|
);
|
|
@@ -71937,16 +72062,16 @@ function FlatColorGradingAccessory({
|
|
|
71937
72062
|
|
|
71938
72063
|
// src/components/editor/propertyPanelFlatColorGradingSection.tsx
|
|
71939
72064
|
import { jsx as jsx192, jsxs as jsxs147 } from "react/jsx-runtime";
|
|
71940
|
-
function formatAdjustValue(
|
|
71941
|
-
if (
|
|
72065
|
+
function formatAdjustValue(key, rawPercent) {
|
|
72066
|
+
if (key === "exposure") {
|
|
71942
72067
|
const stops = rawPercent / 100;
|
|
71943
72068
|
return `${stops >= 0 ? "+" : ""}${stops.toFixed(2)}`;
|
|
71944
72069
|
}
|
|
71945
72070
|
return `${Math.round(rawPercent)}%`;
|
|
71946
72071
|
}
|
|
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: ${
|
|
72072
|
+
var detailByKey = (key) => {
|
|
72073
|
+
const spec = COLOR_GRADING_DETAIL_SLIDERS.find((candidate) => candidate.key === key);
|
|
72074
|
+
if (!spec) throw new Error(`Unknown color grading detail key: ${key}`);
|
|
71950
72075
|
return spec;
|
|
71951
72076
|
};
|
|
71952
72077
|
function resolveColorGrading(grading) {
|
|
@@ -72040,9 +72165,9 @@ function FlatColorGradingSection({
|
|
|
72040
72165
|
} : grading;
|
|
72041
72166
|
};
|
|
72042
72167
|
useEffect107(() => () => onPreviewColorGrading(null), [onPreviewColorGrading]);
|
|
72043
|
-
const renderDetailSlider = (
|
|
72044
|
-
const spec = detailByKey(
|
|
72045
|
-
const value = grading.details[
|
|
72168
|
+
const renderDetailSlider = (key) => {
|
|
72169
|
+
const spec = detailByKey(key);
|
|
72170
|
+
const value = grading.details[key];
|
|
72046
72171
|
const defaultValue = normalizedColorGradingDefault(spec);
|
|
72047
72172
|
const isSet = Math.abs(value - defaultValue) > 1e-4;
|
|
72048
72173
|
return /* @__PURE__ */ jsx192(
|
|
@@ -72055,11 +72180,11 @@ function FlatColorGradingSection({
|
|
|
72055
72180
|
step: spec.step,
|
|
72056
72181
|
tier: isSet ? "explicitCustom" : "default",
|
|
72057
72182
|
displayValue: `${Math.round(value * spec.scale)}${spec.suffix}`,
|
|
72058
|
-
centerTick:
|
|
72059
|
-
onCommit: (next) => onCommitColorGrading(colorGradingWithDetail(grading,
|
|
72060
|
-
onReset: () => onCommitColorGrading(colorGradingWithDetail(grading,
|
|
72183
|
+
centerTick: key === "vignetteRoundness",
|
|
72184
|
+
onCommit: (next) => onCommitColorGrading(colorGradingWithDetail(grading, key, next / spec.scale)),
|
|
72185
|
+
onReset: () => onCommitColorGrading(colorGradingWithDetail(grading, key, defaultValue))
|
|
72061
72186
|
},
|
|
72062
|
-
|
|
72187
|
+
key
|
|
72063
72188
|
);
|
|
72064
72189
|
};
|
|
72065
72190
|
return /* @__PURE__ */ jsxs147("div", { className: "space-y-1.5", children: [
|
|
@@ -72405,28 +72530,28 @@ var EFFECT_CONTROL_LIMITS = new Map(
|
|
|
72405
72530
|
(effect) => effect.controls.map((control) => [control.key, control])
|
|
72406
72531
|
)
|
|
72407
72532
|
);
|
|
72408
|
-
function controlRange(
|
|
72409
|
-
const control = EFFECT_CONTROL_LIMITS.get(
|
|
72533
|
+
function controlRange(key, scale) {
|
|
72534
|
+
const control = EFFECT_CONTROL_LIMITS.get(key);
|
|
72410
72535
|
return control ? { min: control.min * scale, max: control.max * scale, scale } : { scale };
|
|
72411
72536
|
}
|
|
72412
|
-
var percent2 = (
|
|
72537
|
+
var percent2 = (key, label) => ({
|
|
72413
72538
|
kind: "slider",
|
|
72414
|
-
key
|
|
72539
|
+
key,
|
|
72415
72540
|
label,
|
|
72416
|
-
...controlRange(
|
|
72541
|
+
...controlRange(key, 100)
|
|
72417
72542
|
});
|
|
72418
|
-
var degrees = (
|
|
72543
|
+
var degrees = (key, label, max) => ({
|
|
72419
72544
|
kind: "slider",
|
|
72420
|
-
key
|
|
72545
|
+
key,
|
|
72421
72546
|
label,
|
|
72422
|
-
...controlRange(
|
|
72547
|
+
...controlRange(key, max),
|
|
72423
72548
|
unit: "deg"
|
|
72424
72549
|
});
|
|
72425
|
-
function enumOptions(
|
|
72426
|
-
const control = EFFECT_CONTROL_LIMITS.get(
|
|
72550
|
+
function enumOptions(key, labels) {
|
|
72551
|
+
const control = EFFECT_CONTROL_LIMITS.get(key);
|
|
72427
72552
|
const first = control?.min ?? 0;
|
|
72428
72553
|
const count = (control?.max ?? labels.length - 1) - first + 1;
|
|
72429
|
-
if (labels.length !== count) throw new Error(`${
|
|
72554
|
+
if (labels.length !== count) throw new Error(`${key} labels do not match Core capabilities`);
|
|
72430
72555
|
return labels.map((label, index2) => ({ value: String(first + index2), label }));
|
|
72431
72556
|
}
|
|
72432
72557
|
var ASCII_STYLES = enumOptions("asciiStyle", [
|
|
@@ -72797,8 +72922,8 @@ function FlatEffectsSection({
|
|
|
72797
72922
|
effects
|
|
72798
72923
|
});
|
|
72799
72924
|
};
|
|
72800
|
-
const commitEffect = (
|
|
72801
|
-
commitEffects({ ...grading.effects, [
|
|
72925
|
+
const commitEffect = (key, value) => {
|
|
72926
|
+
commitEffects({ ...grading.effects, [key]: value });
|
|
72802
72927
|
};
|
|
72803
72928
|
const resolveEffect = (effect) => ({
|
|
72804
72929
|
...grading,
|
|
@@ -75447,17 +75572,17 @@ function useStableHandlers(value, scope) {
|
|
|
75447
75572
|
const current2 = epoch.current;
|
|
75448
75573
|
current2.latest = value;
|
|
75449
75574
|
const next = {};
|
|
75450
|
-
for (const [
|
|
75575
|
+
for (const [key, field] of Object.entries(value)) {
|
|
75451
75576
|
if (typeof field !== "function") {
|
|
75452
|
-
next[
|
|
75577
|
+
next[key] = field;
|
|
75453
75578
|
continue;
|
|
75454
75579
|
}
|
|
75455
|
-
let wrapper = current2.wrappers.get(
|
|
75580
|
+
let wrapper = current2.wrappers.get(key);
|
|
75456
75581
|
if (!wrapper) {
|
|
75457
|
-
wrapper = (...args) => current2.latest[
|
|
75458
|
-
current2.wrappers.set(
|
|
75582
|
+
wrapper = (...args) => current2.latest[key](...args);
|
|
75583
|
+
current2.wrappers.set(key, wrapper);
|
|
75459
75584
|
}
|
|
75460
|
-
next[
|
|
75585
|
+
next[key] = wrapper;
|
|
75461
75586
|
}
|
|
75462
75587
|
const prev = current2.previous;
|
|
75463
75588
|
const keys = Object.keys(next);
|
|
@@ -75728,16 +75853,16 @@ function isDisabled() {
|
|
|
75728
75853
|
return false;
|
|
75729
75854
|
}
|
|
75730
75855
|
}
|
|
75731
|
-
function readTimestamp(
|
|
75856
|
+
function readTimestamp(key) {
|
|
75732
75857
|
try {
|
|
75733
|
-
return parseInt(window.localStorage.getItem(
|
|
75858
|
+
return parseInt(window.localStorage.getItem(key) || "0", 10) || 0;
|
|
75734
75859
|
} catch {
|
|
75735
75860
|
return 0;
|
|
75736
75861
|
}
|
|
75737
75862
|
}
|
|
75738
|
-
function writeTimestamp(
|
|
75863
|
+
function writeTimestamp(key, now2) {
|
|
75739
75864
|
try {
|
|
75740
|
-
window.localStorage.setItem(
|
|
75865
|
+
window.localStorage.setItem(key, String(now2));
|
|
75741
75866
|
} catch {
|
|
75742
75867
|
}
|
|
75743
75868
|
}
|
|
@@ -77532,7 +77657,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
77532
77657
|
projectIdRef.current = projectId;
|
|
77533
77658
|
const [own] = useState121(createOwnHistory);
|
|
77534
77659
|
const [pageKeyScope] = useState121(generateId);
|
|
77535
|
-
const claimKey = useCallback104((
|
|
77660
|
+
const claimKey = useCallback104((key) => `${pageKeyScope}:${key}`, [pageKeyScope]);
|
|
77536
77661
|
const refresh2 = useCallback104(async () => {
|
|
77537
77662
|
if (!projectId) return;
|
|
77538
77663
|
const seen = own.changes();
|
|
@@ -78471,10 +78596,10 @@ var IDENTITY_SELECTOR = "[id], [data-hf-id]";
|
|
|
78471
78596
|
function identityElementMap(root) {
|
|
78472
78597
|
const map = /* @__PURE__ */ new Map();
|
|
78473
78598
|
for (const el of root.querySelectorAll(IDENTITY_SELECTOR)) {
|
|
78474
|
-
const
|
|
78475
|
-
if (!
|
|
78476
|
-
if (map.has(
|
|
78477
|
-
map.set(
|
|
78599
|
+
const key = elementIdentityKey(el);
|
|
78600
|
+
if (!key) continue;
|
|
78601
|
+
if (map.has(key)) return null;
|
|
78602
|
+
map.set(key, el);
|
|
78478
78603
|
}
|
|
78479
78604
|
return map;
|
|
78480
78605
|
}
|
|
@@ -78514,10 +78639,10 @@ function diffRestoreDocs(prevDoc, nextDoc) {
|
|
|
78514
78639
|
if (!prevByKey || !nextByKey) return null;
|
|
78515
78640
|
if (prevByKey.size !== nextByKey.size) return null;
|
|
78516
78641
|
const changedElementKeys = [];
|
|
78517
|
-
for (const [
|
|
78518
|
-
const prevEl = prevByKey.get(
|
|
78642
|
+
for (const [key, nextEl] of nextByKey) {
|
|
78643
|
+
const prevEl = prevByKey.get(key);
|
|
78519
78644
|
if (!prevEl || prevEl.tagName !== nextEl.tagName) return null;
|
|
78520
|
-
if (!attributesEqual(prevEl, nextEl)) changedElementKeys.push(
|
|
78645
|
+
if (!attributesEqual(prevEl, nextEl)) changedElementKeys.push(key);
|
|
78521
78646
|
}
|
|
78522
78647
|
const [prevRest, nextRest] = [prevDoc, nextDoc].map((doc) => {
|
|
78523
78648
|
const root = doc.documentElement.cloneNode(true);
|
|
@@ -78586,11 +78711,11 @@ function scopeTargets(scope, keys, restoredByKey, previousByKey) {
|
|
|
78586
78711
|
const liveByKey = identityElementMap(scope);
|
|
78587
78712
|
if (!liveByKey) return null;
|
|
78588
78713
|
const targets = [];
|
|
78589
|
-
for (const
|
|
78590
|
-
const live = liveByKey.get(
|
|
78591
|
-
const restored = restoredByKey.get(
|
|
78714
|
+
for (const key of keys) {
|
|
78715
|
+
const live = liveByKey.get(key);
|
|
78716
|
+
const restored = restoredByKey.get(key);
|
|
78592
78717
|
if (!live || !restored || live.hasAttribute("data-hf-inner-root")) return null;
|
|
78593
|
-
targets.push({ live, restored, previous: previousByKey.get(
|
|
78718
|
+
targets.push({ live, restored, previous: previousByKey.get(key) });
|
|
78594
78719
|
}
|
|
78595
78720
|
return targets;
|
|
78596
78721
|
}
|
|
@@ -78744,7 +78869,7 @@ function syncStoredAutomationFromPreview(doc) {
|
|
|
78744
78869
|
if (!node) return element;
|
|
78745
78870
|
const fields = syncedFields(doc, element, node);
|
|
78746
78871
|
const keys = Object.keys(fields);
|
|
78747
|
-
if (keys.every((
|
|
78872
|
+
if (keys.every((key) => fields[key] === element[key])) return element;
|
|
78748
78873
|
changed = true;
|
|
78749
78874
|
return { ...element, ...fields };
|
|
78750
78875
|
});
|
|
@@ -78763,12 +78888,12 @@ var STORED_FIELD = {
|
|
|
78763
78888
|
function syncStoredElementAttribute(target, attr2, value) {
|
|
78764
78889
|
const fields = STORED_FIELD[attr2]?.(value);
|
|
78765
78890
|
if (!fields) return;
|
|
78766
|
-
const
|
|
78891
|
+
const key = getTimelineElementIdentity(target);
|
|
78767
78892
|
const same2 = (element) => Object.keys(fields).every((k) => element[k] === fields[k]);
|
|
78768
78893
|
usePlayerStore.setState((state) => {
|
|
78769
78894
|
let changed = false;
|
|
78770
78895
|
const elements = state.elements.map((element) => {
|
|
78771
|
-
if (getTimelineElementIdentity(element) !==
|
|
78896
|
+
if (getTimelineElementIdentity(element) !== key || same2(element)) return element;
|
|
78772
78897
|
changed = true;
|
|
78773
78898
|
return { ...element, ...fields };
|
|
78774
78899
|
});
|
|
@@ -79358,9 +79483,9 @@ function planDropTrackInsert(input) {
|
|
|
79358
79483
|
const byKey = new Map(elements.map((e) => [e.key ?? e.id, e]));
|
|
79359
79484
|
const renumbers = [];
|
|
79360
79485
|
for (const norm of layout.normalized) {
|
|
79361
|
-
const
|
|
79362
|
-
if (
|
|
79363
|
-
const src = byKey.get(
|
|
79486
|
+
const key = norm.key ?? norm.id;
|
|
79487
|
+
if (key === dropped2.id) continue;
|
|
79488
|
+
const src = byKey.get(key);
|
|
79364
79489
|
if (!src || norm.track === (src.authoredTrack ?? src.track)) continue;
|
|
79365
79490
|
if (!canMoveTimelineElement(src)) return null;
|
|
79366
79491
|
renumbers.push({ element: src, track: norm.track });
|
|
@@ -79469,10 +79594,10 @@ async function commitTimelineCompositionInsertion(input) {
|
|
|
79469
79594
|
}
|
|
79470
79595
|
|
|
79471
79596
|
// src/player/components/timelineDropReveal.ts
|
|
79472
|
-
function selectAndRevealTimelineElement(
|
|
79597
|
+
function selectAndRevealTimelineElement(key) {
|
|
79473
79598
|
const store = usePlayerStore.getState();
|
|
79474
|
-
store.setSelectedElementId(
|
|
79475
|
-
store.requestTimelineFocus(timelineClipFocusId(
|
|
79599
|
+
store.setSelectedElementId(key);
|
|
79600
|
+
store.requestTimelineFocus(timelineClipFocusId(key));
|
|
79476
79601
|
}
|
|
79477
79602
|
|
|
79478
79603
|
// src/hooks/useTimelineAssetDropOps.ts
|
|
@@ -79773,71 +79898,71 @@ function createLiveLanes(project, composition) {
|
|
|
79773
79898
|
const verified2 = /* @__PURE__ */ new Map();
|
|
79774
79899
|
const clean = /* @__PURE__ */ new Set();
|
|
79775
79900
|
let saves = 0;
|
|
79776
|
-
const take = (
|
|
79777
|
-
const claimed = before.has(
|
|
79778
|
-
before.delete(
|
|
79779
|
-
clean.delete(
|
|
79780
|
-
if (!pending2.has(
|
|
79901
|
+
const take = (key) => {
|
|
79902
|
+
const claimed = before.has(key) ? before.get(key) ?? null : void 0;
|
|
79903
|
+
before.delete(key);
|
|
79904
|
+
clean.delete(key);
|
|
79905
|
+
if (!pending2.has(key)) sources.delete(key);
|
|
79781
79906
|
return claimed;
|
|
79782
79907
|
};
|
|
79783
|
-
const overtaken = (
|
|
79784
|
-
const rebase = (
|
|
79908
|
+
const overtaken = (key, save) => [...pending2.get(key) ?? []].some((newer) => newer > save);
|
|
79909
|
+
const rebase = (key, value) => {
|
|
79785
79910
|
if (value === void 0) {
|
|
79786
|
-
clean.delete(
|
|
79787
|
-
verified2.delete(
|
|
79911
|
+
clean.delete(key);
|
|
79912
|
+
verified2.delete(key);
|
|
79788
79913
|
return;
|
|
79789
79914
|
}
|
|
79790
|
-
if (before.has(
|
|
79791
|
-
if (pending2.has(
|
|
79792
|
-
if (pending2.has(
|
|
79793
|
-
else clean.add(
|
|
79915
|
+
if (before.has(key)) before.set(key, value);
|
|
79916
|
+
if (pending2.has(key)) verified2.set(key, value);
|
|
79917
|
+
if (pending2.has(key)) clean.delete(key);
|
|
79918
|
+
else clean.add(key);
|
|
79794
79919
|
};
|
|
79795
79920
|
const scoped = (laneKey) => `${project()}
|
|
79796
79921
|
${composition()}
|
|
79797
79922
|
${laneKey}`;
|
|
79798
79923
|
return {
|
|
79799
79924
|
preview(laneKey, readCurrent, source) {
|
|
79800
|
-
const
|
|
79801
|
-
if (before.has(
|
|
79802
|
-
before.set(
|
|
79803
|
-
sources.set(
|
|
79804
|
-
if (!pending2.has(
|
|
79925
|
+
const key = scoped(laneKey);
|
|
79926
|
+
if (before.has(key)) return;
|
|
79927
|
+
before.set(key, readCurrent());
|
|
79928
|
+
sources.set(key, source);
|
|
79929
|
+
if (!pending2.has(key)) clean.add(key);
|
|
79805
79930
|
},
|
|
79806
79931
|
// A save. Its settle records what the file holds: `saved`, else the last value verified on
|
|
79807
79932
|
// this lane (a landed save, a read-back, or a clean before-value), never an unsaved one.
|
|
79808
79933
|
// Store and preview follow only while no newer save is pending and its composition is open,
|
|
79809
79934
|
// and the preview only while no drag is live.
|
|
79810
79935
|
claim(laneKey, apply, source) {
|
|
79811
|
-
const
|
|
79812
|
-
const open2 = () => scoped(laneKey) ===
|
|
79813
|
-
const trusted = clean.has(
|
|
79814
|
-
const claimed = take(
|
|
79936
|
+
const key = scoped(laneKey);
|
|
79937
|
+
const open2 = () => scoped(laneKey) === key;
|
|
79938
|
+
const trusted = clean.has(key);
|
|
79939
|
+
const claimed = take(key);
|
|
79815
79940
|
const mine = ++saves;
|
|
79816
|
-
sources.set(
|
|
79817
|
-
if (claimed !== void 0 && trusted) verified2.set(
|
|
79818
|
-
pending2.set(
|
|
79941
|
+
sources.set(key, source);
|
|
79942
|
+
if (claimed !== void 0 && trusted) verified2.set(key, claimed);
|
|
79943
|
+
pending2.set(key, (pending2.get(key) ?? /* @__PURE__ */ new Set()).add(mine));
|
|
79819
79944
|
const preview2 = (value) => {
|
|
79820
|
-
if (open2() && !before.has(
|
|
79945
|
+
if (open2() && !before.has(key) && !overtaken(key, mine)) apply.preview(value);
|
|
79821
79946
|
};
|
|
79822
79947
|
return {
|
|
79823
79948
|
preview: preview2,
|
|
79824
79949
|
read(value) {
|
|
79825
|
-
verified2.set(
|
|
79950
|
+
verified2.set(key, value);
|
|
79826
79951
|
},
|
|
79827
79952
|
settle(saved2) {
|
|
79828
|
-
const inFlight = pending2.get(
|
|
79953
|
+
const inFlight = pending2.get(key);
|
|
79829
79954
|
inFlight?.delete(mine);
|
|
79830
|
-
if (saved2 !== void 0) verified2.set(
|
|
79831
|
-
const value = verified2.get(
|
|
79955
|
+
if (saved2 !== void 0) verified2.set(key, saved2);
|
|
79956
|
+
const value = verified2.get(key);
|
|
79832
79957
|
if (!inFlight?.size) {
|
|
79833
|
-
pending2.delete(
|
|
79834
|
-
verified2.delete(
|
|
79835
|
-
if (!before.has(
|
|
79958
|
+
pending2.delete(key);
|
|
79959
|
+
verified2.delete(key);
|
|
79960
|
+
if (!before.has(key)) sources.delete(key);
|
|
79836
79961
|
}
|
|
79837
|
-
if (value === void 0 || overtaken(
|
|
79838
|
-
if (before.has(
|
|
79839
|
-
before.set(
|
|
79840
|
-
clean.add(
|
|
79962
|
+
if (value === void 0 || overtaken(key, mine) || !open2()) return;
|
|
79963
|
+
if (before.has(key)) {
|
|
79964
|
+
before.set(key, value);
|
|
79965
|
+
clean.add(key);
|
|
79841
79966
|
}
|
|
79842
79967
|
apply.store(value);
|
|
79843
79968
|
preview2(value);
|
|
@@ -79857,9 +79982,9 @@ ${laneKey}`;
|
|
|
79857
79982
|
restore({ paths = [], files }) {
|
|
79858
79983
|
const inProject = `${project()}
|
|
79859
79984
|
`;
|
|
79860
|
-
for (const [
|
|
79861
|
-
if (
|
|
79862
|
-
rebase(
|
|
79985
|
+
for (const [key, source] of sources) {
|
|
79986
|
+
if (key.startsWith(inProject) && paths.includes(source.path)) {
|
|
79987
|
+
rebase(key, restoredValue(source, files));
|
|
79863
79988
|
}
|
|
79864
79989
|
}
|
|
79865
79990
|
}
|
|
@@ -79985,10 +80110,10 @@ function useSetAudioGroupAttribute({
|
|
|
79985
80110
|
const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
|
|
79986
80111
|
const setLive = useCallback116(
|
|
79987
80112
|
(groupId, attr2, value) => {
|
|
79988
|
-
const
|
|
80113
|
+
const key = audioGroupAttributeLiveKey(groupId, attr2);
|
|
79989
80114
|
const target = previewIframeRef.current?.contentDocument?.getElementById(groupId);
|
|
79990
80115
|
liveLanes.preview(
|
|
79991
|
-
|
|
80116
|
+
key,
|
|
79992
80117
|
() => target?.getAttribute(attr2) ?? null,
|
|
79993
80118
|
groupLiveSource(previewIframeRef.current, groupId, activeCompPath, attr2)
|
|
79994
80119
|
);
|
|
@@ -80128,10 +80253,10 @@ function useSetElementAttribute({
|
|
|
80128
80253
|
const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
|
|
80129
80254
|
const setLive = useCallback117(
|
|
80130
80255
|
(element, attr2, value) => {
|
|
80131
|
-
const
|
|
80256
|
+
const key = elementAttributeLiveKey(element, activeCompPath, attr2);
|
|
80132
80257
|
const target = findTimelineElementInIframe(previewIframeRef.current, element, activeCompPath);
|
|
80133
80258
|
liveLanes.preview(
|
|
80134
|
-
|
|
80259
|
+
key,
|
|
80135
80260
|
() => target?.getAttribute(attr2) ?? null,
|
|
80136
80261
|
elementLiveSource(element, activeCompPath, attr2)
|
|
80137
80262
|
);
|
|
@@ -80471,8 +80596,8 @@ function useTimelineEditGuard(canEdit, showToast) {
|
|
|
80471
80596
|
const guardedRef = useRef144(/* @__PURE__ */ new WeakMap());
|
|
80472
80597
|
const guard = useCallback120(
|
|
80473
80598
|
(resolveTargets, fn, onRefused) => {
|
|
80474
|
-
const
|
|
80475
|
-
const cached5 = guardedRef.current.get(
|
|
80599
|
+
const key = fn;
|
|
80600
|
+
const cached5 = guardedRef.current.get(key);
|
|
80476
80601
|
if (cached5) {
|
|
80477
80602
|
cached5.resolveTargets = resolveTargets;
|
|
80478
80603
|
cached5.onRefused = onRefused;
|
|
@@ -80487,7 +80612,7 @@ function useTimelineEditGuard(canEdit, showToast) {
|
|
|
80487
80612
|
return Promise.resolve(entry3.onRefused?.(reason, ...args));
|
|
80488
80613
|
return fn(...args);
|
|
80489
80614
|
});
|
|
80490
|
-
guardedRef.current.set(
|
|
80615
|
+
guardedRef.current.set(key, entry3);
|
|
80491
80616
|
return entry3.wrapped;
|
|
80492
80617
|
},
|
|
80493
80618
|
[]
|
|
@@ -80715,11 +80840,11 @@ import { useCallback as useCallback122, useRef as useRef145 } from "react";
|
|
|
80715
80840
|
function useTrackPendingTimelineEdit() {
|
|
80716
80841
|
const wrappedRef = useRef145(/* @__PURE__ */ new WeakMap());
|
|
80717
80842
|
return useCallback122((fn) => {
|
|
80718
|
-
const
|
|
80719
|
-
const cached5 = wrappedRef.current.get(
|
|
80843
|
+
const key = fn;
|
|
80844
|
+
const cached5 = wrappedRef.current.get(key);
|
|
80720
80845
|
if (cached5) return cached5;
|
|
80721
80846
|
const wrapped = trackedStudioEdit(fn);
|
|
80722
|
-
wrappedRef.current.set(
|
|
80847
|
+
wrappedRef.current.set(key, wrapped);
|
|
80723
80848
|
return wrapped;
|
|
80724
80849
|
}, []);
|
|
80725
80850
|
}
|
|
@@ -84343,8 +84468,8 @@ function stagePlainTranslate(commitPositionPatchToHtml, selection, next, coalesc
|
|
|
84343
84468
|
const rollback = () => {
|
|
84344
84469
|
if (el.style.getPropertyValue("translate") === written) restoreStudioPathOffset(el, before);
|
|
84345
84470
|
};
|
|
84346
|
-
const
|
|
84347
|
-
const options = { label: "Move layer", coalesceKey:
|
|
84471
|
+
const key = coalesceKey ?? `move:${++plainMoveCounter}`;
|
|
84472
|
+
const options = { label: "Move layer", coalesceKey: key, coalesceMs: Number.POSITIVE_INFINITY };
|
|
84348
84473
|
const save = () => commitPositionPatchToHtml(selection, patches, options).catch((error) => {
|
|
84349
84474
|
rollback();
|
|
84350
84475
|
throw error;
|
|
@@ -84938,16 +85063,16 @@ function patchKeyframes(tween, keyframes) {
|
|
|
84938
85063
|
function mergeKeyframeStep(map, pct, props) {
|
|
84939
85064
|
const next = {};
|
|
84940
85065
|
for (const [k, step] of Object.entries(map)) next[k] = { ...step };
|
|
84941
|
-
let
|
|
85066
|
+
let key = null;
|
|
84942
85067
|
for (const k of Object.keys(next)) {
|
|
84943
85068
|
const n = parseFloat(k);
|
|
84944
85069
|
if (Number.isFinite(n) && Math.abs(n - pct) < 0.05) {
|
|
84945
|
-
|
|
85070
|
+
key = k;
|
|
84946
85071
|
break;
|
|
84947
85072
|
}
|
|
84948
85073
|
}
|
|
84949
|
-
if (
|
|
84950
|
-
next[
|
|
85074
|
+
if (key === null) key = `${pct}%`;
|
|
85075
|
+
next[key] = { ...next[key] ?? {}, ...props };
|
|
84951
85076
|
return next;
|
|
84952
85077
|
}
|
|
84953
85078
|
function rebuildKeyframeTween(tween, pct, props) {
|
|
@@ -85034,16 +85159,16 @@ function patchRuntimeTweenInPlace(iframe, selector, change, compositionId, defer
|
|
|
85034
85159
|
// src/hooks/serializeByKey.ts
|
|
85035
85160
|
function createKeyedSerializer() {
|
|
85036
85161
|
const inFlight = /* @__PURE__ */ new Map();
|
|
85037
|
-
return function run(
|
|
85038
|
-
const prior = inFlight.get(
|
|
85162
|
+
return function run(key, task) {
|
|
85163
|
+
const prior = inFlight.get(key) ?? Promise.resolve();
|
|
85039
85164
|
const next = prior.then(task, task);
|
|
85040
|
-
inFlight.set(
|
|
85165
|
+
inFlight.set(key, next);
|
|
85041
85166
|
void next.then(
|
|
85042
85167
|
() => {
|
|
85043
|
-
if (inFlight.get(
|
|
85168
|
+
if (inFlight.get(key) === next) inFlight.delete(key);
|
|
85044
85169
|
},
|
|
85045
85170
|
() => {
|
|
85046
|
-
if (inFlight.get(
|
|
85171
|
+
if (inFlight.get(key) === next) inFlight.delete(key);
|
|
85047
85172
|
}
|
|
85048
85173
|
);
|
|
85049
85174
|
return next;
|
|
@@ -85347,8 +85472,8 @@ async function commitKeyframeAtTimeImpl(selection, absoluteTime, animations, pro
|
|
|
85347
85472
|
);
|
|
85348
85473
|
}
|
|
85349
85474
|
const backfillDefaults = {};
|
|
85350
|
-
for (const
|
|
85351
|
-
backfillDefaults[
|
|
85475
|
+
for (const key of Object.keys(properties)) {
|
|
85476
|
+
backfillDefaults[key] = KEYFRAME_PROPERTY_DEFAULTS[key] ?? 0;
|
|
85352
85477
|
}
|
|
85353
85478
|
await commitMutation(
|
|
85354
85479
|
selection,
|
|
@@ -86805,8 +86930,8 @@ function useDomEditWiring(params) {
|
|
|
86805
86930
|
const matchKey = elements.find(
|
|
86806
86931
|
(el) => el.domId === domEditSelection.id || el.id === domEditSelection.id
|
|
86807
86932
|
);
|
|
86808
|
-
const
|
|
86809
|
-
if (
|
|
86933
|
+
const key = matchKey ? matchKey.key ?? matchKey.id : null;
|
|
86934
|
+
if (key && key !== selectedElementId) setSelectedElementId(key);
|
|
86810
86935
|
}, [domEditSelection?.id]);
|
|
86811
86936
|
const prevRefreshKeyRef = useRef158(refreshKey);
|
|
86812
86937
|
useEffect127(() => {
|
|
@@ -87111,8 +87236,8 @@ function isPlayheadWithinTween(anim, currentTime) {
|
|
|
87111
87236
|
async function replaceSetWithSingleKeyframe(session, sel, setAnim, t2, iframe, selector) {
|
|
87112
87237
|
const position = readElementPosition(iframe, sel, setAnim);
|
|
87113
87238
|
if (Object.keys(position).length === 0) {
|
|
87114
|
-
for (const [
|
|
87115
|
-
if (typeof held === "number") position[
|
|
87239
|
+
for (const [key, held] of Object.entries(setAnim.properties ?? {})) {
|
|
87240
|
+
if (typeof held === "number") position[key] = held;
|
|
87116
87241
|
}
|
|
87117
87242
|
}
|
|
87118
87243
|
if (Object.keys(position).length === 0 || !session.commitMutation) return;
|
|
@@ -87258,9 +87383,9 @@ async function promoteSetToKeyframes(session, sel, setAnim, t2, iframe) {
|
|
|
87258
87383
|
const endPosition = readElementPosition(iframe, sel, setAnim);
|
|
87259
87384
|
if (Object.keys(endPosition).length === 0) return;
|
|
87260
87385
|
const startPosition = {};
|
|
87261
|
-
for (const
|
|
87262
|
-
const held = setAnim.properties?.[
|
|
87263
|
-
if (typeof held === "number") startPosition[
|
|
87386
|
+
for (const key of Object.keys(endPosition)) {
|
|
87387
|
+
const held = setAnim.properties?.[key];
|
|
87388
|
+
if (typeof held === "number") startPosition[key] = held;
|
|
87264
87389
|
}
|
|
87265
87390
|
await session.commitMutation(
|
|
87266
87391
|
{
|
|
@@ -88681,19 +88806,19 @@ function useCommitPreflightCapabilities({
|
|
|
88681
88806
|
if (!enabled || !projectId) return;
|
|
88682
88807
|
const targets = selection ? [selection, ...groupSelections] : groupSelections;
|
|
88683
88808
|
for (const file of new Set(targets.map(gsapSourceFileForSelection))) {
|
|
88684
|
-
const
|
|
88685
|
-
const known = parsesRef.current.get(
|
|
88809
|
+
const key = parseCacheKey(projectId, file);
|
|
88810
|
+
const known = parsesRef.current.get(key);
|
|
88686
88811
|
if (known?.version === version) continue;
|
|
88687
|
-
parsesRef.current.set(
|
|
88812
|
+
parsesRef.current.set(key, { version, animations: known?.animations ?? null });
|
|
88688
88813
|
void fetchParsedAnimations(projectId, file).then((parsed) => {
|
|
88689
|
-
if (parsesRef.current.get(
|
|
88814
|
+
if (parsesRef.current.get(key)?.version !== version) return;
|
|
88690
88815
|
if (parsed) {
|
|
88691
|
-
parsesRef.current.set(
|
|
88816
|
+
parsesRef.current.set(key, { version, animations: parsed.animations });
|
|
88692
88817
|
setParseTick((tick) => tick + 1);
|
|
88693
88818
|
return;
|
|
88694
88819
|
}
|
|
88695
|
-
if (known?.animations) parsesRef.current.set(
|
|
88696
|
-
else parsesRef.current.delete(
|
|
88820
|
+
if (known?.animations) parsesRef.current.set(key, known);
|
|
88821
|
+
else parsesRef.current.delete(key);
|
|
88697
88822
|
});
|
|
88698
88823
|
}
|
|
88699
88824
|
}, [enabled, projectId, selection, groupSelections, version]);
|
|
@@ -89434,9 +89559,9 @@ function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded
|
|
|
89434
89559
|
setUnreachableProject(reportReadFailure(read2, forProjectId, pathInTree));
|
|
89435
89560
|
setCompositionMissing(read2.reason === "absent");
|
|
89436
89561
|
if (read2.reason !== "absent") return;
|
|
89437
|
-
const
|
|
89438
|
-
if (refreshedAbsentPathsRef.current.has(
|
|
89439
|
-
refreshedAbsentPathsRef.current.add(
|
|
89562
|
+
const key = `${forProjectId}:${forPath}`;
|
|
89563
|
+
if (refreshedAbsentPathsRef.current.has(key)) return;
|
|
89564
|
+
refreshedAbsentPathsRef.current.add(key);
|
|
89440
89565
|
onAbsentRead?.(forPath);
|
|
89441
89566
|
}
|
|
89442
89567
|
useEffect132(
|
|
@@ -89565,75 +89690,32 @@ function useStudioSdkSessions(projectId, activeCompPath, masterCompPath, fileTre
|
|
|
89565
89690
|
import { useCallback as useCallback156 } from "react";
|
|
89566
89691
|
|
|
89567
89692
|
// 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();
|
|
89693
|
+
function draftUrl(projectId, filePath) {
|
|
89694
|
+
return `/api/projects/${encodeURIComponent(projectId)}/recovery-drafts/${encodeURIComponent(filePath)}`;
|
|
89695
|
+
}
|
|
89696
|
+
async function draftRequest(projectId, filePath, init) {
|
|
89697
|
+
const res = await studioApiFetch(draftUrl(projectId, filePath), init);
|
|
89698
|
+
if (!res.ok) throw new Error(`Recovery draft storage failed (${res.status})`);
|
|
89699
|
+
return res;
|
|
89700
|
+
}
|
|
89701
|
+
var projectStorage = {
|
|
89702
|
+
async get(projectId, filePath) {
|
|
89703
|
+
const { draft } = await (await draftRequest(projectId, filePath)).json();
|
|
89704
|
+
return draft?.projectId === projectId && draft.filePath === filePath ? draft : null;
|
|
89705
|
+
},
|
|
89706
|
+
async set(snapshot3) {
|
|
89707
|
+
await draftRequest(snapshot3.projectId, snapshot3.filePath, {
|
|
89708
|
+
method: "PUT",
|
|
89709
|
+
headers: { "content-type": "application/json" },
|
|
89710
|
+
body: JSON.stringify(snapshot3)
|
|
89711
|
+
});
|
|
89712
|
+
},
|
|
89713
|
+
async delete(projectId, filePath) {
|
|
89714
|
+
await draftRequest(projectId, filePath, { method: "DELETE" });
|
|
89715
|
+
}
|
|
89716
|
+
};
|
|
89635
89717
|
async function persistExternalConflictSnapshot(projectId, conflict) {
|
|
89636
|
-
await
|
|
89718
|
+
await projectStorage.set({
|
|
89637
89719
|
kind: "conflict",
|
|
89638
89720
|
projectId,
|
|
89639
89721
|
filePath: conflict.filePath,
|
|
@@ -89644,7 +89726,7 @@ async function persistExternalConflictSnapshot(projectId, conflict) {
|
|
|
89644
89726
|
});
|
|
89645
89727
|
}
|
|
89646
89728
|
async function persistExternalFailureSnapshot(projectId, filePath, studioContent, externalVersion, externalContent, error) {
|
|
89647
|
-
await
|
|
89729
|
+
await projectStorage.set({
|
|
89648
89730
|
kind: "failed",
|
|
89649
89731
|
projectId,
|
|
89650
89732
|
filePath,
|
|
@@ -89656,10 +89738,10 @@ async function persistExternalFailureSnapshot(projectId, filePath, studioContent
|
|
|
89656
89738
|
});
|
|
89657
89739
|
}
|
|
89658
89740
|
async function loadExternalConflictSnapshot(projectId, filePath) {
|
|
89659
|
-
return
|
|
89741
|
+
return projectStorage.get(projectId, filePath);
|
|
89660
89742
|
}
|
|
89661
89743
|
async function deleteExternalConflictSnapshot(projectId, filePath) {
|
|
89662
|
-
await
|
|
89744
|
+
await projectStorage.delete(projectId, filePath);
|
|
89663
89745
|
}
|
|
89664
89746
|
|
|
89665
89747
|
// src/hooks/useExternalFileChangeCoordinator.ts
|
|
@@ -89786,7 +89868,7 @@ function useExternalFileChangeCoordinator({
|
|
|
89786
89868
|
return () => {
|
|
89787
89869
|
cancelled = true;
|
|
89788
89870
|
};
|
|
89789
|
-
}, [loadConflictSnapshot, projectId, recoveryFilePath, setBlocked]);
|
|
89871
|
+
}, [loadConflictSnapshot, projectId, activeCompPath, recoveryFilePath, setBlocked]);
|
|
89790
89872
|
const deliverOwed = useCallback155(
|
|
89791
89873
|
(owed, accept = true) => {
|
|
89792
89874
|
const path = readStudioFileChangePath(owed) ?? ".";
|
|
@@ -90890,10 +90972,10 @@ function useAppHotkeys({
|
|
|
90890
90972
|
};
|
|
90891
90973
|
const handleAppKeyDown = useCallback159((event) => {
|
|
90892
90974
|
const cb = cbRef.current;
|
|
90893
|
-
const
|
|
90975
|
+
const key = event.key.toLowerCase();
|
|
90894
90976
|
if (dispatchLinkShortcut(event, cb)) return;
|
|
90895
|
-
if (dispatchModifierKey(event,
|
|
90896
|
-
dispatchPlainKey(event,
|
|
90977
|
+
if (dispatchModifierKey(event, key, cb)) return;
|
|
90978
|
+
dispatchPlainKey(event, key, cb);
|
|
90897
90979
|
}, []);
|
|
90898
90980
|
useEffect135(() => {
|
|
90899
90981
|
window.addEventListener("keydown", handleAppKeyDown, true);
|
|
@@ -91696,11 +91778,11 @@ function readStaticProperty(property) {
|
|
|
91696
91778
|
if (property.type !== "Property" || property.kind !== "init" || property.method || property.shorthand || property.computed) {
|
|
91697
91779
|
throw new SyntaxError("Transcript properties must be static data");
|
|
91698
91780
|
}
|
|
91699
|
-
const
|
|
91700
|
-
if (typeof
|
|
91781
|
+
const key = property.key.type === "Identifier" ? property.key.name : readStaticValue(property.key);
|
|
91782
|
+
if (typeof key !== "string" && typeof key !== "number") {
|
|
91701
91783
|
throw new SyntaxError("Transcript property keys must be names or literals");
|
|
91702
91784
|
}
|
|
91703
|
-
return [
|
|
91785
|
+
return [key, readStaticValue(property.value)];
|
|
91704
91786
|
}
|
|
91705
91787
|
function parseTranscriptArray(parsed) {
|
|
91706
91788
|
if (!Array.isArray(parsed)) {
|
|
@@ -92108,12 +92190,12 @@ function useLintModal(projectId, refreshKey) {
|
|
|
92108
92190
|
(keyFn) => {
|
|
92109
92191
|
const map = /* @__PURE__ */ new Map();
|
|
92110
92192
|
for (const f of backgroundFindings) {
|
|
92111
|
-
const
|
|
92112
|
-
if (!
|
|
92113
|
-
const prev = map.get(
|
|
92193
|
+
const key = keyFn(f);
|
|
92194
|
+
if (!key) continue;
|
|
92195
|
+
const prev = map.get(key) ?? { count: 0, messages: [] };
|
|
92114
92196
|
prev.count += 1;
|
|
92115
92197
|
prev.messages.push(f.message);
|
|
92116
|
-
map.set(
|
|
92198
|
+
map.set(key, prev);
|
|
92117
92199
|
}
|
|
92118
92200
|
return map;
|
|
92119
92201
|
},
|
|
@@ -92305,8 +92387,8 @@ function toPersistedSelection(selection, group = []) {
|
|
|
92305
92387
|
for (const member of group) {
|
|
92306
92388
|
const target = toPersistedTarget(member);
|
|
92307
92389
|
if (!target) continue;
|
|
92308
|
-
const
|
|
92309
|
-
if (
|
|
92390
|
+
const key = selectionTargetKey(target);
|
|
92391
|
+
if (key !== primaryKey) members.set(key, target);
|
|
92310
92392
|
}
|
|
92311
92393
|
return {
|
|
92312
92394
|
...primary,
|
|
@@ -93388,13 +93470,13 @@ function setStudioTheme(theme) {
|
|
|
93388
93470
|
if (theme === "light") root.dataset.theme = "paper";
|
|
93389
93471
|
else delete root.dataset.theme;
|
|
93390
93472
|
}
|
|
93391
|
-
function
|
|
93473
|
+
function subscribe(listener2) {
|
|
93392
93474
|
const observer = new MutationObserver(listener2);
|
|
93393
93475
|
observer.observe(document.documentElement, { attributeFilter: ["data-theme"] });
|
|
93394
93476
|
return () => observer.disconnect();
|
|
93395
93477
|
}
|
|
93396
93478
|
function useShownStudioTheme() {
|
|
93397
|
-
return useSyncExternalStore12(
|
|
93479
|
+
return useSyncExternalStore12(subscribe, shownStudioTheme);
|
|
93398
93480
|
}
|
|
93399
93481
|
|
|
93400
93482
|
// src/components/ThemeToggle.tsx
|
|
@@ -93650,7 +93732,7 @@ function connectGsapRuntime(element, iframeEl, elementEndTime) {
|
|
|
93650
93732
|
try {
|
|
93651
93733
|
const win = iframeEl.contentWindow;
|
|
93652
93734
|
const tl = win?.__timelines ? Object.entries(win.__timelines).find(
|
|
93653
|
-
([
|
|
93735
|
+
([key, value]) => key !== "__proxied" && typeof value?.seek === "function"
|
|
93654
93736
|
)?.[1] ?? null : null;
|
|
93655
93737
|
if (win?.gsap?.set && tl?.seek && element.id) {
|
|
93656
93738
|
const tlDuration = tl.duration();
|
|
@@ -93953,19 +94035,19 @@ function simplifyGestureSamples(samples, totalDuration, epsilon) {
|
|
|
93953
94035
|
if (totalDuration <= 0) return /* @__PURE__ */ new Map();
|
|
93954
94036
|
const propertyKeys = /* @__PURE__ */ new Set();
|
|
93955
94037
|
for (const s of samples) {
|
|
93956
|
-
for (const
|
|
93957
|
-
propertyKeys.add(
|
|
94038
|
+
for (const key of Object.keys(s.properties)) {
|
|
94039
|
+
propertyKeys.add(key);
|
|
93958
94040
|
}
|
|
93959
94041
|
}
|
|
93960
94042
|
const survivingTimes = /* @__PURE__ */ new Set();
|
|
93961
|
-
for (const
|
|
94043
|
+
for (const key of propertyKeys) {
|
|
93962
94044
|
const series = [];
|
|
93963
94045
|
for (const s of samples) {
|
|
93964
|
-
if (
|
|
93965
|
-
series.push({ time: s.time, value: s.properties[
|
|
94046
|
+
if (key in s.properties) {
|
|
94047
|
+
series.push({ time: s.time, value: s.properties[key] });
|
|
93966
94048
|
}
|
|
93967
94049
|
}
|
|
93968
|
-
const keyEpsilon = typeof epsilon === "function" ? epsilon(
|
|
94050
|
+
const keyEpsilon = typeof epsilon === "function" ? epsilon(key) : epsilon;
|
|
93969
94051
|
const simplified = simplifyTimeSeries(series, keyEpsilon);
|
|
93970
94052
|
for (const pt of simplified) {
|
|
93971
94053
|
survivingTimes.add(pt.time);
|
|
@@ -93976,19 +94058,19 @@ function simplifyGestureSamples(samples, totalDuration, epsilon) {
|
|
|
93976
94058
|
for (const t2 of sortedTimes) {
|
|
93977
94059
|
const pct = Math.round(t2 / totalDuration * 1e3) / 10;
|
|
93978
94060
|
const props = {};
|
|
93979
|
-
for (const
|
|
93980
|
-
props[
|
|
94061
|
+
for (const key of propertyKeys) {
|
|
94062
|
+
props[key] = interpolatePropertyAtTime(samples, key, t2);
|
|
93981
94063
|
}
|
|
93982
94064
|
result.set(pct, props);
|
|
93983
94065
|
}
|
|
93984
94066
|
return result;
|
|
93985
94067
|
}
|
|
93986
|
-
function interpolatePropertyAtTime(samples,
|
|
94068
|
+
function interpolatePropertyAtTime(samples, key, t2) {
|
|
93987
94069
|
let before;
|
|
93988
94070
|
let after;
|
|
93989
94071
|
for (const s of samples) {
|
|
93990
|
-
if (!(
|
|
93991
|
-
const v = s.properties[
|
|
94072
|
+
if (!(key in s.properties)) continue;
|
|
94073
|
+
const v = s.properties[key];
|
|
93992
94074
|
if (s.time <= t2) {
|
|
93993
94075
|
before = { time: s.time, value: v };
|
|
93994
94076
|
}
|
|
@@ -94090,17 +94172,17 @@ function smoothGestureKeyframes(keyframes, radius) {
|
|
|
94090
94172
|
return keyframes.map((kf, i) => {
|
|
94091
94173
|
if (i === 0 || i === keyframes.length - 1) return kf;
|
|
94092
94174
|
const smoothed = { ...kf.properties };
|
|
94093
|
-
for (const
|
|
94175
|
+
for (const key of numericKeys) {
|
|
94094
94176
|
let weightSum = 0;
|
|
94095
94177
|
let valueSum = 0;
|
|
94096
94178
|
for (let j = Math.max(0, i - radius); j <= Math.min(keyframes.length - 1, i + radius); j++) {
|
|
94097
|
-
const v = keyframes[j].properties[
|
|
94179
|
+
const v = keyframes[j].properties[key];
|
|
94098
94180
|
if (typeof v !== "number") continue;
|
|
94099
94181
|
const w = gaussianWeight(j - i, sigma);
|
|
94100
94182
|
weightSum += w;
|
|
94101
94183
|
valueSum += v * w;
|
|
94102
94184
|
}
|
|
94103
|
-
if (weightSum > 0) smoothed[
|
|
94185
|
+
if (weightSum > 0) smoothed[key] = Math.round(valueSum / weightSum * 1e3) / 1e3;
|
|
94104
94186
|
}
|
|
94105
94187
|
return { percentage: kf.percentage, properties: smoothed };
|
|
94106
94188
|
});
|
|
@@ -94113,14 +94195,14 @@ function partitionKeyframesByGroup(keyframes) {
|
|
|
94113
94195
|
const byGroup = /* @__PURE__ */ new Map();
|
|
94114
94196
|
for (const kf of keyframes) {
|
|
94115
94197
|
const perGroup = /* @__PURE__ */ new Map();
|
|
94116
|
-
for (const [
|
|
94117
|
-
const group = classifyPropertyGroup5(
|
|
94198
|
+
for (const [key, value] of Object.entries(kf.properties)) {
|
|
94199
|
+
const group = classifyPropertyGroup5(key);
|
|
94118
94200
|
let props = perGroup.get(group);
|
|
94119
94201
|
if (!props) {
|
|
94120
94202
|
props = {};
|
|
94121
94203
|
perGroup.set(group, props);
|
|
94122
94204
|
}
|
|
94123
|
-
props[
|
|
94205
|
+
props[key] = value;
|
|
94124
94206
|
}
|
|
94125
94207
|
for (const [group, props] of perGroup) {
|
|
94126
94208
|
let set = byGroup.get(group);
|
|
@@ -94210,9 +94292,9 @@ function useGestureCommit({
|
|
|
94210
94292
|
showToast("Recording too short. Try again", "error");
|
|
94211
94293
|
return;
|
|
94212
94294
|
}
|
|
94213
|
-
const simplified = simplifyGestureSamples(frozenSamples, duration, (
|
|
94214
|
-
if (
|
|
94215
|
-
if (
|
|
94295
|
+
const simplified = simplifyGestureSamples(frozenSamples, duration, (key) => {
|
|
94296
|
+
if (key === "opacity") return 0.01;
|
|
94297
|
+
if (key === "scale" || key === "scaleX" || key === "scaleY") return 0.01;
|
|
94216
94298
|
return 5;
|
|
94217
94299
|
});
|
|
94218
94300
|
const sortedPcts = Array.from(simplified.keys()).sort((a, b) => a - b);
|
|
@@ -97659,9 +97741,9 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
|
|
|
97659
97741
|
},
|
|
97660
97742
|
[resolveSelection, updateDomEditHoverSelection]
|
|
97661
97743
|
);
|
|
97662
|
-
const toggleCollapse = useCallback176((
|
|
97744
|
+
const toggleCollapse = useCallback176((key, e) => {
|
|
97663
97745
|
e.stopPropagation();
|
|
97664
|
-
setCollapsed((prev) => ({ ...prev, [
|
|
97746
|
+
setCollapsed((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
97665
97747
|
}, []);
|
|
97666
97748
|
const handleReorder = useCallback176(
|
|
97667
97749
|
(event) => {
|
|
@@ -98168,12 +98250,12 @@ var CaptionAnimationPanel = memo53(function CaptionAnimationPanel2() {
|
|
|
98168
98250
|
|
|
98169
98251
|
// src/captions/components/CaptionPropertyPanel.tsx
|
|
98170
98252
|
import { jsx as jsx238, jsxs as jsxs187 } from "react/jsx-runtime";
|
|
98171
|
-
function isMixedValue(model, selectedSegmentIds,
|
|
98253
|
+
function isMixedValue(model, selectedSegmentIds, key, fallback) {
|
|
98172
98254
|
if (!model || selectedSegmentIds.size < 2) return false;
|
|
98173
98255
|
let first;
|
|
98174
98256
|
let seen = false;
|
|
98175
98257
|
for (const segId of selectedSegmentIds) {
|
|
98176
|
-
const v = model.segments.get(segId)?.style[
|
|
98258
|
+
const v = model.segments.get(segId)?.style[key] ?? fallback;
|
|
98177
98259
|
if (!seen) {
|
|
98178
98260
|
first = v;
|
|
98179
98261
|
seen = true;
|
|
@@ -98413,9 +98495,9 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98413
98495
|
const [commitState, setCommitState] = useState156({ tone: "idle" });
|
|
98414
98496
|
const commitTimersRef = useRef186(/* @__PURE__ */ new Map());
|
|
98415
98497
|
const commitParamNow = useCallback179(
|
|
98416
|
-
async (
|
|
98498
|
+
async (key, nextValue) => {
|
|
98417
98499
|
if (!fileManager) return;
|
|
98418
|
-
const previous = appliedRef.current[
|
|
98500
|
+
const previous = appliedRef.current[key];
|
|
98419
98501
|
if (previous === void 0 || previous === nextValue || !nextValue.trim()) return;
|
|
98420
98502
|
setCommitState({ tone: "saving" });
|
|
98421
98503
|
try {
|
|
@@ -98430,7 +98512,7 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98430
98512
|
tone: "error",
|
|
98431
98513
|
message: `Couldn't find the current value in ${compositionPath}. It may have been edited by hand.`
|
|
98432
98514
|
});
|
|
98433
|
-
trackBlockParamCommit({ tone: "error", blockName, key
|
|
98515
|
+
trackBlockParamCommit({ tone: "error", blockName, key });
|
|
98434
98516
|
return;
|
|
98435
98517
|
}
|
|
98436
98518
|
if (matches > 1) {
|
|
@@ -98438,7 +98520,7 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98438
98520
|
tone: "error",
|
|
98439
98521
|
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
98522
|
});
|
|
98441
|
-
trackBlockParamCommit({ tone: "error", blockName, key
|
|
98523
|
+
trackBlockParamCommit({ tone: "error", blockName, key });
|
|
98442
98524
|
return;
|
|
98443
98525
|
}
|
|
98444
98526
|
await fileManager.writeProjectFile(
|
|
@@ -98446,36 +98528,36 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98446
98528
|
content.replace(matcher, nextValue),
|
|
98447
98529
|
content
|
|
98448
98530
|
);
|
|
98449
|
-
appliedRef.current[
|
|
98531
|
+
appliedRef.current[key] = nextValue;
|
|
98450
98532
|
setCommitState({ tone: "saved" });
|
|
98451
|
-
trackBlockParamCommit({ tone: "saved", blockName, key
|
|
98533
|
+
trackBlockParamCommit({ tone: "saved", blockName, key });
|
|
98452
98534
|
setRefreshKey((k) => k + 1);
|
|
98453
98535
|
} catch {
|
|
98454
98536
|
setCommitState({ tone: "error", message: "Couldn't save the block file. Retry?" });
|
|
98455
|
-
trackBlockParamCommit({ tone: "error", blockName, key
|
|
98537
|
+
trackBlockParamCommit({ tone: "error", blockName, key });
|
|
98456
98538
|
}
|
|
98457
98539
|
},
|
|
98458
98540
|
[fileManager, compositionPath, setRefreshKey, blockName]
|
|
98459
98541
|
);
|
|
98460
98542
|
const commitParam = useCallback179(
|
|
98461
|
-
(
|
|
98543
|
+
(key, nextValue) => fileManager ? serializeStudioFileMutation(
|
|
98462
98544
|
fileManager.writeProjectFile,
|
|
98463
98545
|
compositionPath,
|
|
98464
|
-
() => commitParamNow(
|
|
98546
|
+
() => commitParamNow(key, nextValue)
|
|
98465
98547
|
) : Promise.resolve(),
|
|
98466
98548
|
[commitParamNow, compositionPath, fileManager]
|
|
98467
98549
|
);
|
|
98468
98550
|
const handleChange = useCallback179(
|
|
98469
|
-
(
|
|
98470
|
-
setValues((prev) => ({ ...prev, [
|
|
98551
|
+
(key, value) => {
|
|
98552
|
+
setValues((prev) => ({ ...prev, [key]: value }));
|
|
98471
98553
|
const timers = commitTimersRef.current;
|
|
98472
|
-
const existing = timers.get(
|
|
98554
|
+
const existing = timers.get(key);
|
|
98473
98555
|
if (existing) clearTimeout(existing);
|
|
98474
98556
|
timers.set(
|
|
98475
|
-
|
|
98557
|
+
key,
|
|
98476
98558
|
setTimeout(() => {
|
|
98477
|
-
timers.delete(
|
|
98478
|
-
void commitParam(
|
|
98559
|
+
timers.delete(key);
|
|
98560
|
+
void commitParam(key, value);
|
|
98479
98561
|
}, 300)
|
|
98480
98562
|
);
|
|
98481
98563
|
},
|
|
@@ -98484,10 +98566,10 @@ var BlockParamsPanel = memo55(function BlockParamsPanel2({
|
|
|
98484
98566
|
const flushRef = useRef186(() => {
|
|
98485
98567
|
});
|
|
98486
98568
|
flushRef.current = () => {
|
|
98487
|
-
for (const [
|
|
98569
|
+
for (const [key, timer] of commitTimersRef.current) {
|
|
98488
98570
|
clearTimeout(timer);
|
|
98489
|
-
const value = values[
|
|
98490
|
-
if (value !== void 0) void commitParam(
|
|
98571
|
+
const value = values[key];
|
|
98572
|
+
if (value !== void 0) void commitParam(key, value);
|
|
98491
98573
|
}
|
|
98492
98574
|
commitTimersRef.current.clear();
|
|
98493
98575
|
};
|
|
@@ -100298,13 +100380,13 @@ function SlideshowPanel({ scenes, onPersist, onPersistNotes }) {
|
|
|
100298
100380
|
ctrl.flush();
|
|
100299
100381
|
};
|
|
100300
100382
|
}, []);
|
|
100301
|
-
const toggleSection = useCallback182((
|
|
100383
|
+
const toggleSection = useCallback182((key) => {
|
|
100302
100384
|
setExpandedSections((prev) => {
|
|
100303
100385
|
const next = new Set(prev);
|
|
100304
|
-
if (next.has(
|
|
100305
|
-
next.delete(
|
|
100386
|
+
if (next.has(key)) {
|
|
100387
|
+
next.delete(key);
|
|
100306
100388
|
} else {
|
|
100307
|
-
next.add(
|
|
100389
|
+
next.add(key);
|
|
100308
100390
|
}
|
|
100309
100391
|
return next;
|
|
100310
100392
|
});
|
|
@@ -100716,11 +100798,11 @@ function draftFromDeclaration(decl) {
|
|
|
100716
100798
|
function numberDeclFromDraft(base2, draft) {
|
|
100717
100799
|
const value = Number(draft.defaultRaw);
|
|
100718
100800
|
if (!Number.isFinite(value)) return "Default must be a number.";
|
|
100719
|
-
const constraint = (
|
|
100720
|
-
const raw = draft[
|
|
100801
|
+
const constraint = (key) => {
|
|
100802
|
+
const raw = draft[key].trim();
|
|
100721
100803
|
if (!raw) return {};
|
|
100722
100804
|
const parsed = Number(raw);
|
|
100723
|
-
return Number.isFinite(parsed) ? { [
|
|
100805
|
+
return Number.isFinite(parsed) ? { [key]: parsed } : {};
|
|
100724
100806
|
};
|
|
100725
100807
|
return {
|
|
100726
100808
|
...base2,
|
|
@@ -100756,8 +100838,8 @@ var FORM_OWNED_KEYS = /* @__PURE__ */ new Set([
|
|
|
100756
100838
|
function mergeDeclarationEdit(original, edited) {
|
|
100757
100839
|
if (original.type !== edited.type) return edited;
|
|
100758
100840
|
const passthrough = {};
|
|
100759
|
-
for (const [
|
|
100760
|
-
if (!FORM_OWNED_KEYS.has(
|
|
100841
|
+
for (const [key, value] of Object.entries(original)) {
|
|
100842
|
+
if (!FORM_OWNED_KEYS.has(key)) passthrough[key] = value;
|
|
100761
100843
|
}
|
|
100762
100844
|
return { ...passthrough, ...edited };
|
|
100763
100845
|
}
|
|
@@ -100886,15 +100968,15 @@ function DeclarationForm({
|
|
|
100886
100968
|
) }),
|
|
100887
100969
|
/* @__PURE__ */ jsx250(Field, { label: "Default", children: /* @__PURE__ */ jsx250(DefaultField, { draft, onChange: (defaultRaw) => set({ defaultRaw }) }) })
|
|
100888
100970
|
] }),
|
|
100889
|
-
draft.type === "number" && /* @__PURE__ */ jsx250("div", { className: "grid grid-cols-3 gap-2", children: ["min", "max", "step"].map((
|
|
100971
|
+
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
100972
|
"input",
|
|
100891
100973
|
{
|
|
100892
100974
|
type: "text",
|
|
100893
|
-
value: draft[
|
|
100894
|
-
onChange: (e) => set({ [
|
|
100975
|
+
value: draft[key],
|
|
100976
|
+
onChange: (e) => set({ [key]: e.target.value }),
|
|
100895
100977
|
className: `${VARIABLES_INPUT_CLASS} tabular-nums`
|
|
100896
100978
|
}
|
|
100897
|
-
) },
|
|
100979
|
+
) }, key)) }),
|
|
100898
100980
|
draft.type === "enum" && /* @__PURE__ */ jsx250(Field, { label: "Options (one per line, value:Label)", children: /* @__PURE__ */ jsx250(
|
|
100899
100981
|
"textarea",
|
|
100900
100982
|
{
|
|
@@ -100976,8 +101058,8 @@ function CompositionSection({
|
|
|
100976
101058
|
}
|
|
100977
101059
|
),
|
|
100978
101060
|
group.variables.map((decl) => {
|
|
100979
|
-
const
|
|
100980
|
-
const editing = editingKey ===
|
|
101061
|
+
const key = `${group.path}::${decl.id}`;
|
|
101062
|
+
const editing = editingKey === key;
|
|
100981
101063
|
return /* @__PURE__ */ jsxs200("div", { className: "space-y-1.5 rounded-lg border border-neutral-800/70 p-2", children: [
|
|
100982
101064
|
/* @__PURE__ */ jsxs200("div", { className: "flex items-center gap-1.5", children: [
|
|
100983
101065
|
/* @__PURE__ */ jsx252("span", { className: "truncate text-[10px] font-medium text-neutral-300", children: decl.label }),
|
|
@@ -100988,7 +101070,7 @@ function CompositionSection({
|
|
|
100988
101070
|
{
|
|
100989
101071
|
label: "Edit",
|
|
100990
101072
|
title: "Edit declaration",
|
|
100991
|
-
onClick: () => onToggleEdit(editing ? null :
|
|
101073
|
+
onClick: () => onToggleEdit(editing ? null : key)
|
|
100992
101074
|
}
|
|
100993
101075
|
),
|
|
100994
101076
|
/* @__PURE__ */ jsx252(
|
|
@@ -101012,7 +101094,7 @@ function CompositionSection({
|
|
|
101012
101094
|
onCancel: () => onToggleEdit(null)
|
|
101013
101095
|
}
|
|
101014
101096
|
)
|
|
101015
|
-
] },
|
|
101097
|
+
] }, key);
|
|
101016
101098
|
})
|
|
101017
101099
|
] });
|
|
101018
101100
|
}
|
|
@@ -104423,9 +104505,9 @@ function parseStyleString(style) {
|
|
|
104423
104505
|
for (const decl of style.split(";")) {
|
|
104424
104506
|
const colonIdx = decl.indexOf(":");
|
|
104425
104507
|
if (colonIdx < 0) continue;
|
|
104426
|
-
const
|
|
104508
|
+
const key = decl.slice(0, colonIdx).trim();
|
|
104427
104509
|
const value = decl.slice(colonIdx + 1).trim();
|
|
104428
|
-
if (
|
|
104510
|
+
if (key && value) result[key] = value;
|
|
104429
104511
|
}
|
|
104430
104512
|
return result;
|
|
104431
104513
|
}
|
|
@@ -104792,6 +104874,7 @@ export {
|
|
|
104792
104874
|
collectSnapContext,
|
|
104793
104875
|
collectStudioLookScene,
|
|
104794
104876
|
currentTimelineRange,
|
|
104877
|
+
describePreviewElements,
|
|
104795
104878
|
dispatchLinkShortcut,
|
|
104796
104879
|
displayTrackOrder,
|
|
104797
104880
|
extractSnapTargets,
|
|
@@ -104799,6 +104882,8 @@ export {
|
|
|
104799
104882
|
fieldBase,
|
|
104800
104883
|
fieldText,
|
|
104801
104884
|
findElementBlock,
|
|
104885
|
+
findPreviewElementForSelection,
|
|
104886
|
+
findPreviewElementForTimelineElement,
|
|
104802
104887
|
flushStudioPendingEdits,
|
|
104803
104888
|
formatCombo2 as formatCombo,
|
|
104804
104889
|
formatTime,
|
|
@@ -104814,8 +104899,15 @@ export {
|
|
|
104814
104899
|
persistRenderSettings,
|
|
104815
104900
|
playSeamTransitionLoop,
|
|
104816
104901
|
popupSurface,
|
|
104902
|
+
previewAncestors,
|
|
104817
104903
|
previewEditingClient,
|
|
104904
|
+
previewElementsAtPoint,
|
|
104818
104905
|
previewFrameOpaque,
|
|
104906
|
+
previewGeometry,
|
|
104907
|
+
previewLayers,
|
|
104908
|
+
previewPointerTargets,
|
|
104909
|
+
queryPreviewElements,
|
|
104910
|
+
readable,
|
|
104819
104911
|
resolveDomEditSelection,
|
|
104820
104912
|
resolveEquidistanceGuides,
|
|
104821
104913
|
resolveGuideLineRect,
|
|
@@ -104826,6 +104918,7 @@ export {
|
|
|
104826
104918
|
revertNewestStudioPendingEdit,
|
|
104827
104919
|
setStudioKeys,
|
|
104828
104920
|
snapEngagedForTravel,
|
|
104921
|
+
standInFor,
|
|
104829
104922
|
studioKeyClash,
|
|
104830
104923
|
useAudioGainDialogStore,
|
|
104831
104924
|
useAudioMetersVisible,
|