@hyperframes/studio 0.9.65 → 0.9.67
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-DHYu0XuV.js +573 -0
- package/dist/assets/{index-tvLrzMBv.js → index-BBKHfua5.js} +180 -180
- package/dist/assets/{index-CAjz3b83.js → index-DqND4rHq.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-xC5IGkfB.js → pausedVideoDecoder-B1FNXBMe.js} +1 -1
- package/dist/{chunk-VDDEXNVX.js → chunk-LR3VT3EF.js} +20 -0
- package/dist/index.html +1 -1
- package/dist/index.js +396 -160
- package/dist/player.js +1 -1
- package/package.json +8 -8
- package/src/captions/components/CaptionOverlay.sealed.test.ts +2 -25
- package/src/components/editor/LayersPanel.opaque.test.ts +4 -29
- package/src/components/editor/domEditOverlayCrop.ts +78 -15
- package/src/components/editor/domEditOverlayCropFrameLift.test.ts +64 -0
- package/src/components/editor/gsapLivePreview.sealed.test.ts +35 -0
- package/src/components/editor/gsapLivePreview.ts +6 -2
- package/src/components/editor/gsapMoveSealedPreview.test.ts +3 -23
- package/src/components/editor/previewDrafts.test.ts +13 -39
- package/src/components/editor/previewDrafts.ts +2 -0
- package/src/components/editor/previewGestureStartRead.test.ts +59 -21
- package/src/components/editor/previewGestureStartRead.ts +9 -0
- package/src/components/editor/previewLayers.test.ts +3 -20
- package/src/components/editor/previewOverlayRects.test.ts +3 -20
- package/src/components/editor/previewPointerTargets.test.ts +3 -20
- package/src/components/editor/previewSelection.test.ts +51 -35
- package/src/components/editor/previewSelection.ts +17 -0
- package/src/components/editor/useColorGradingController.sealed.test.ts +5 -30
- package/src/components/editor/useMotionPathData.sealed.test.ts +2 -29
- package/src/components/nle/NLEContext.drillDown.test.ts +85 -0
- package/src/components/nle/NLEContext.tsx +21 -23
- package/src/components/nle/NLEPreview.test.ts +18 -3
- package/src/components/nle/NLEPreview.tsx +10 -1
- package/src/components/nle/audioSealedPreview.test.ts +5 -32
- package/src/hooks/appHotkeysDispatch.ts +38 -1
- package/src/hooks/domEditCommits.sealed.test.ts +191 -0
- package/src/hooks/domStyleCommit.ts +18 -7
- package/src/hooks/gsapMutationClient.test.ts +32 -0
- package/src/hooks/gsapMutationClient.ts +6 -3
- package/src/hooks/gsapResizeIntercept.ts +7 -2
- package/src/hooks/timelineTimingSync.test.ts +1 -1
- package/src/hooks/useAppHotkeys.previewForwarding.test.tsx +134 -0
- package/src/hooks/useAppHotkeys.ts +36 -1
- package/src/hooks/useDomEditAttributeCommits.ts +43 -19
- package/src/hooks/useEnableKeyframes.sealed.test.ts +2 -29
- package/src/hooks/useFreezeFrame.test.ts +3 -2
- package/src/hooks/useFreezeFrame.ts +2 -2
- package/src/hooks/useGroupCommits.ts +7 -2
- package/src/hooks/useSlideshowTabState.test.ts +47 -3
- package/src/hooks/useSlideshowTabState.ts +32 -16
- package/src/player/hooks/timelinePlayerTestHarness.ts +2 -1
- package/src/player/hooks/usePlaybackKeyboard.ts +1 -1
- package/src/player/hooks/usePreviewFirstFrameTelemetry.sealed.test.ts +43 -0
- package/src/player/hooks/usePreviewFirstFrameTelemetry.ts +11 -7
- package/src/player/hooks/useTimelineSyncCallbacks.sealed.test.ts +39 -31
- package/src/player/hooks/useTimelineSyncCallbacks.ts +21 -11
- package/src/player/lib/previewChannel.test.ts +10 -0
- package/src/player/lib/previewChannel.ts +21 -0
- package/src/player/lib/previewElements.test.ts +34 -1
- package/src/player/lib/previewElements.ts +99 -16
- package/src/player/lib/sealedPreviewFrame.test-helpers.ts +38 -0
- package/src/player/lib/timelineIframeHelpers.ts +1 -1
- package/src/utils/blockInstaller.test.ts +82 -48
- package/src/utils/blockInstaller.ts +6 -14
- package/src/utils/previewCompositionSize.test.ts +61 -0
- package/src/utils/previewCompositionSize.ts +21 -1
- package/src/utils/studioSaveDiagnostics.ts +2 -0
- package/dist/assets/hyperframes-player-Dscc6yHD.js +0 -573
package/dist/index.js
CHANGED
|
@@ -59,6 +59,7 @@ import {
|
|
|
59
59
|
postFrameDisplayScale,
|
|
60
60
|
postRuntimeControlMessage,
|
|
61
61
|
previewClipManifest,
|
|
62
|
+
previewClipParents,
|
|
62
63
|
previewComputedStyles,
|
|
63
64
|
previewConsoleErrors,
|
|
64
65
|
previewDocumentCopy,
|
|
@@ -92,7 +93,7 @@ import {
|
|
|
92
93
|
whileScriptWrites,
|
|
93
94
|
writeStudioUiPreferences,
|
|
94
95
|
zoomToSelectedClips
|
|
95
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-LR3VT3EF.js";
|
|
96
97
|
import {
|
|
97
98
|
Button,
|
|
98
99
|
ContextMenu,
|
|
@@ -5421,6 +5422,7 @@ var previewStandInHandle = (standIn) => standIns.get(standIn)?.handle;
|
|
|
5421
5422
|
function registerPreviewStandIn(standIn, iframe, handle) {
|
|
5422
5423
|
standIns.set(standIn, { iframe, handle });
|
|
5423
5424
|
}
|
|
5425
|
+
var previewStandIn = (standIn) => standIns.get(standIn);
|
|
5424
5426
|
function queueFor(iframe) {
|
|
5425
5427
|
let queue2 = queues.get(iframe);
|
|
5426
5428
|
if (!queue2) {
|
|
@@ -5474,37 +5476,43 @@ import {
|
|
|
5474
5476
|
import {
|
|
5475
5477
|
EDITING_ELEMENT_HANDLE,
|
|
5476
5478
|
MAX_DESCRIBE_HANDLES as MAX_DESCRIBE_HANDLES2,
|
|
5479
|
+
MAX_DRAFT_PX,
|
|
5477
5480
|
MAX_ELEMENT_ENTRIES,
|
|
5481
|
+
MAX_ELEMENT_TEXT,
|
|
5478
5482
|
MAX_ELEMENT_VALUE,
|
|
5479
5483
|
MAX_GEOMETRY_CHILDREN,
|
|
5480
|
-
MAX_SNAP_TARGETS
|
|
5484
|
+
MAX_SNAP_TARGETS,
|
|
5485
|
+
MAX_SOURCE_GROUPS
|
|
5481
5486
|
} from "@hyperframes/core/runtime/editing-port";
|
|
5482
5487
|
var isFields = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5483
5488
|
var isHandle = (value) => typeof value === "string" && EDITING_ELEMENT_HANDLE.test(value);
|
|
5484
5489
|
var isText = (value) => typeof value === "string";
|
|
5485
|
-
var
|
|
5490
|
+
var isValue = (value) => isText(value) && value.length <= MAX_ELEMENT_VALUE;
|
|
5491
|
+
var isLongText = (value) => isText(value) && value.length <= MAX_ELEMENT_TEXT;
|
|
5492
|
+
var isValueOrNull = (value) => value === null || isValue(value);
|
|
5493
|
+
var isEntries = (value) => Array.isArray(value) && value.length <= MAX_ELEMENT_ENTRIES;
|
|
5486
5494
|
var isCount = (value) => Number.isSafeInteger(value) && value >= 0;
|
|
5487
|
-
var isSource = (value) => isFields(value) &&
|
|
5488
|
-
var
|
|
5495
|
+
var isSource = (value) => isFields(value) && isValueOrNull(value.file) && isValueOrNull(value.compositionId) && isValueOrNull(value.originalCompositionId);
|
|
5496
|
+
var isStyles = (value) => isFields(value) && isEntries(Object.keys(value)) && Object.entries(value).every(([name, style]) => isValue(name) && isValue(style));
|
|
5489
5497
|
function hasPlainFields(value) {
|
|
5490
5498
|
const { matchesBefore, attributes, children } = value;
|
|
5491
|
-
const groupsOk = matchesBefore === null || Array.isArray(matchesBefore) && matchesBefore.every((g) => isFields(g) && isSource(g.source) && isCount(g.count));
|
|
5492
|
-
const attributesOk =
|
|
5493
|
-
const childrenOk =
|
|
5499
|
+
const groupsOk = matchesBefore === null || Array.isArray(matchesBefore) && matchesBefore.length <= MAX_SOURCE_GROUPS && matchesBefore.every((g) => isFields(g) && isSource(g.source) && isCount(g.count));
|
|
5500
|
+
const attributesOk = isEntries(attributes) && attributes.every((a) => Array.isArray(a) && a.length === 2 && a.every(isValue));
|
|
5501
|
+
const childrenOk = isEntries(children) && children.every((c) => isFields(c) && (isHandle(c.handle) || isLongText(c.text)));
|
|
5494
5502
|
return groupsOk && attributesOk && childrenOk && typeof value.truncated === "boolean";
|
|
5495
5503
|
}
|
|
5496
5504
|
var isRect = (value) => isFields(value) && [value.x, value.y, value.width, value.height].every(Number.isFinite);
|
|
5497
5505
|
function readHit(value) {
|
|
5498
|
-
if (!isFields(value) || !isHandle(value.handle) || !
|
|
5506
|
+
if (!isFields(value) || !isHandle(value.handle) || !isValue(value.tag)) return null;
|
|
5499
5507
|
return isRect(value.rect) ? value : null;
|
|
5500
5508
|
}
|
|
5501
5509
|
function readPreviewElement(value) {
|
|
5502
5510
|
if (!readHit(value) || !isFields(value)) return null;
|
|
5503
5511
|
if (value.parent !== null && !isHandle(value.parent)) return null;
|
|
5504
|
-
if (value.label !== void 0 && !
|
|
5505
|
-
if (!
|
|
5512
|
+
if (value.label !== void 0 && !isValue(value.label)) return null;
|
|
5513
|
+
if (!isValueOrNull(value.id) || !isValueOrNull(value.selector)) return null;
|
|
5506
5514
|
if (!isSource(value.source) || typeof value.locked !== "boolean") return null;
|
|
5507
|
-
if (!
|
|
5515
|
+
if (!isStyles(value.inlineStyles) || !isLongText(value.text)) return null;
|
|
5508
5516
|
return hasPlainFields(value) ? value : null;
|
|
5509
5517
|
}
|
|
5510
5518
|
async function previewElementsAtPoint(iframe, x, y) {
|
|
@@ -5559,7 +5567,7 @@ var isSizeOrNull = (value) => value === null || Number.isFinite(value) && value
|
|
|
5559
5567
|
var CORNERS = ["nw", "ne", "se", "sw"];
|
|
5560
5568
|
var isCorners = (value) => value === null || isFields(value) && CORNERS.every((corner) => isPoint(value[corner]));
|
|
5561
5569
|
var isSourceBox = (value) => value === null || isFields(value) && Number.isFinite(value.width) && Number.isFinite(value.height) && isSizeOrNull(value.declaredWidth) && isSizeOrNull(value.declaredHeight);
|
|
5562
|
-
var isClipPath =
|
|
5570
|
+
var isClipPath = isValueOrNull;
|
|
5563
5571
|
var isBox = (value) => isFields(value) && isRect(value.rect) && Number.isFinite(value.angle) && isCorners(value.corners) && isSourceBox(value.source) && isClipPath(value.clipPath);
|
|
5564
5572
|
var readGeometry = (value) => {
|
|
5565
5573
|
if (!isBox(value) || !isFields(value) || typeof value.visible !== "boolean") return null;
|
|
@@ -5582,11 +5590,14 @@ async function previewGeometry(iframe, handles, children) {
|
|
|
5582
5590
|
}
|
|
5583
5591
|
var isFlag = (value) => typeof value === "boolean";
|
|
5584
5592
|
var isFiniteFields = (value, keys) => isFields(value) && keys.every((key) => Number.isFinite(value[key]));
|
|
5593
|
+
var isLayout = (value) => isFields(value) && [value.width, value.height].every(
|
|
5594
|
+
(side) => Number.isFinite(side) && side >= 0 && side <= MAX_DRAFT_PX
|
|
5595
|
+
);
|
|
5585
5596
|
var readGestureStart = (value) => {
|
|
5586
5597
|
if (!readGeometry(value) || !isFields(value)) return null;
|
|
5587
5598
|
const { layout, move, gsap: gsap3 } = value;
|
|
5588
5599
|
const valid = [
|
|
5589
|
-
|
|
5600
|
+
isLayout(layout),
|
|
5590
5601
|
move === null || isFiniteFields(move, ["a", "b", "c", "d"]),
|
|
5591
5602
|
gsap3 === null || isFields(gsap3) && isFiniteFields(gsap3, ["x", "y"]) && isFlag(gsap3.moving)
|
|
5592
5603
|
];
|
|
@@ -5612,15 +5623,54 @@ async function previewLayers(iframe, group, offset = 0) {
|
|
|
5612
5623
|
if (typeof missingGroup !== "boolean") return null;
|
|
5613
5624
|
return layers.every(isLayer) ? { layers, truncated, missingGroup } : null;
|
|
5614
5625
|
}
|
|
5626
|
+
var isEditEntries = (value, priority = false) => Array.isArray(value) && value.every(
|
|
5627
|
+
(entry3) => Array.isArray(entry3) && isText(entry3[0]) && (entry3[1] === null || isText(entry3[1])) && (entry3.length === 2 || priority && entry3.length === 3 && entry3[2] === "important")
|
|
5628
|
+
);
|
|
5629
|
+
var latestWriters = /* @__PURE__ */ new WeakMap();
|
|
5630
|
+
function editPreviewElement(iframe, handle, edit) {
|
|
5631
|
+
const send3 = (styles, attributes) => previewRequest(iframe, "edit-element", { handle, styles, attributes });
|
|
5632
|
+
const writers = latestWriters.get(iframe) ?? /* @__PURE__ */ new Map();
|
|
5633
|
+
latestWriters.set(iframe, writers);
|
|
5634
|
+
const self = /* @__PURE__ */ Symbol("edit");
|
|
5635
|
+
const key = (part, name) => `${handle} ${part} ${name}`;
|
|
5636
|
+
for (const [name] of edit.styles ?? []) writers.set(key("style", name), self);
|
|
5637
|
+
for (const [name] of edit.attributes ?? []) writers.set(key("attr", name), self);
|
|
5638
|
+
const reply = send3(edit.styles ?? [], edit.attributes ?? []);
|
|
5639
|
+
return {
|
|
5640
|
+
drawn: reply.then((before) => before?.applied === true),
|
|
5641
|
+
restore(names) {
|
|
5642
|
+
const owns = (part, name) => (!names || names.includes(name)) && writers.get(key(part, name)) === self;
|
|
5643
|
+
void reply.then((before) => {
|
|
5644
|
+
if (!before?.applied || !isEditEntries(before.styles, true)) return;
|
|
5645
|
+
if (!isEditEntries(before.attributes)) return;
|
|
5646
|
+
const styles = before.styles.filter(([name]) => owns("style", name));
|
|
5647
|
+
const attributes = before.attributes.filter(([name]) => owns("attr", name));
|
|
5648
|
+
if (styles.length || attributes.length) void send3(styles, attributes);
|
|
5649
|
+
});
|
|
5650
|
+
}
|
|
5651
|
+
};
|
|
5652
|
+
}
|
|
5653
|
+
var SEALED_DRAW_WAIT_MS = 300;
|
|
5654
|
+
function afterSealedDraw(edit, save) {
|
|
5655
|
+
if (!edit) return save(true);
|
|
5656
|
+
let timer;
|
|
5657
|
+
const late = new Promise((resolve2) => {
|
|
5658
|
+
timer = setTimeout(resolve2, SEALED_DRAW_WAIT_MS, false);
|
|
5659
|
+
});
|
|
5660
|
+
return Promise.race([edit.drawn, late]).then((drawn) => {
|
|
5661
|
+
clearTimeout(timer);
|
|
5662
|
+
return save(drawn);
|
|
5663
|
+
});
|
|
5664
|
+
}
|
|
5615
5665
|
|
|
5616
5666
|
// src/hooks/gsapSnapshotReply.ts
|
|
5617
5667
|
var isText2 = (value) => typeof value === "string" && value.length <= MAX_SNAPSHOT_TEXT;
|
|
5618
|
-
var
|
|
5668
|
+
var isTextOrNull = (value) => value === null || isText2(value);
|
|
5619
5669
|
var isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
5620
5670
|
var isNumberOrNull = (value) => value === null || isNumber(value);
|
|
5621
5671
|
var isList = (value, max) => Array.isArray(value) && value.length <= max;
|
|
5622
5672
|
function readGsapSnapshot(value) {
|
|
5623
|
-
if (!isFields(value) || !isNumberOrNull(value.time) || !
|
|
5673
|
+
if (!isFields(value) || !isNumberOrNull(value.time) || !isTextOrNull(value.defaultEase))
|
|
5624
5674
|
return null;
|
|
5625
5675
|
const budget = { tweens: MAX_SNAPSHOT_TWEENS, fields: MAX_SNAPSHOT_FIELDS };
|
|
5626
5676
|
const { timelines, targets } = value;
|
|
@@ -5628,7 +5678,7 @@ function readGsapSnapshot(value) {
|
|
|
5628
5678
|
return ok ? value : null;
|
|
5629
5679
|
}
|
|
5630
5680
|
function isTimeline(value, budget) {
|
|
5631
|
-
return isFields(value) && isText2(value.id) && isNumberOrNull(value.time) &&
|
|
5681
|
+
return isFields(value) && isText2(value.id) && isNumberOrNull(value.time) && isTextOrNull(value.defaultEase) && isList(value.tweens, MAX_SNAPSHOT_TWEENS) && value.tweens.every((tween) => isTween(tween, budget));
|
|
5632
5682
|
}
|
|
5633
5683
|
function isTween(value, budget) {
|
|
5634
5684
|
if ((budget.tweens -= 1) < 0 || !isFields(value)) return false;
|
|
@@ -10609,6 +10659,7 @@ function heldFileMessage(body, path) {
|
|
|
10609
10659
|
return null;
|
|
10610
10660
|
}
|
|
10611
10661
|
}
|
|
10662
|
+
var withStatus = (words, response) => `${words} (${response.status})`;
|
|
10612
10663
|
async function heldFileWordsOf(response, path) {
|
|
10613
10664
|
return heldFileMessage(
|
|
10614
10665
|
await response.clone().text().catch(() => ""),
|
|
@@ -18681,7 +18732,7 @@ async function rollbackOwnedMutation(projectId, targetPath, expected, restore2)
|
|
|
18681
18732
|
);
|
|
18682
18733
|
if (!response.ok) {
|
|
18683
18734
|
throw new Error(
|
|
18684
|
-
await heldFileWordsOf(response, targetPath) ?? `Failed to restore ${targetPath}
|
|
18735
|
+
await heldFileWordsOf(response, targetPath) ?? withStatus(`Failed to restore ${targetPath}`, response)
|
|
18685
18736
|
);
|
|
18686
18737
|
}
|
|
18687
18738
|
const result = await response.json();
|
|
@@ -18729,7 +18780,9 @@ async function postOwnedGsapMutation(route, projectId, filePath, body, fallback)
|
|
|
18729
18780
|
const held2 = response.ok ? null : await heldFileWordsOf(response, filePath);
|
|
18730
18781
|
const payload = await response.json().catch(() => null);
|
|
18731
18782
|
if (!response.ok) {
|
|
18732
|
-
throw new GsapPreviewConvergenceError(
|
|
18783
|
+
throw new GsapPreviewConvergenceError(
|
|
18784
|
+
held2 ?? withStatus(readMutationError(payload, fallback), response)
|
|
18785
|
+
);
|
|
18733
18786
|
}
|
|
18734
18787
|
return readMutationStatus(payload);
|
|
18735
18788
|
}
|
|
@@ -31096,6 +31149,13 @@ function resolveTimelineTotalDuration(input) {
|
|
|
31096
31149
|
sanitizeDurationSeconds(input.authoredRootDurationSeconds)
|
|
31097
31150
|
);
|
|
31098
31151
|
}
|
|
31152
|
+
function openClipParents(iframe) {
|
|
31153
|
+
try {
|
|
31154
|
+
return clipTreeParentMap(iframe?.contentWindow ?? null);
|
|
31155
|
+
} catch {
|
|
31156
|
+
return /* @__PURE__ */ new Map();
|
|
31157
|
+
}
|
|
31158
|
+
}
|
|
31099
31159
|
function useTimelineSyncCallbacks({
|
|
31100
31160
|
iframeRef,
|
|
31101
31161
|
probeIntervalRef,
|
|
@@ -31115,13 +31175,12 @@ function useTimelineSyncCallbacks({
|
|
|
31115
31175
|
hostOwnsDeadline
|
|
31116
31176
|
}) {
|
|
31117
31177
|
const applyTimelineMessage = useCallback38(
|
|
31118
|
-
(data, iframeDoc) => {
|
|
31178
|
+
(data, iframeDoc, parentMap) => {
|
|
31119
31179
|
const clipCompositionIds = new Set(data.clips.map((c) => c.compositionId).filter(Boolean));
|
|
31120
31180
|
const filtered = data.clips.filter(
|
|
31121
31181
|
(clip) => !clip.parentCompositionId || !clipCompositionIds.has(clip.parentCompositionId)
|
|
31122
31182
|
);
|
|
31123
31183
|
try {
|
|
31124
|
-
const parentMap = clipTreeParentMap(iframeRef.current?.contentWindow ?? null);
|
|
31125
31184
|
const domClipChildren = collectSubCompositionDomChildren(iframeDoc, data.clips, parentMap);
|
|
31126
31185
|
usePlayerStore.getState().setClipParentMap(parentMap);
|
|
31127
31186
|
usePlayerStore.getState().setDomClipChildren(domClipChildren);
|
|
@@ -31142,7 +31201,7 @@ function useTimelineSyncCallbacks({
|
|
|
31142
31201
|
syncTimelineElements
|
|
31143
31202
|
);
|
|
31144
31203
|
},
|
|
31145
|
-
[
|
|
31204
|
+
[syncTimelineElements]
|
|
31146
31205
|
);
|
|
31147
31206
|
const timelineReads = useRef47(0);
|
|
31148
31207
|
const processTimelineMessage = useCallback38(
|
|
@@ -31152,13 +31211,15 @@ function useTimelineSyncCallbacks({
|
|
|
31152
31211
|
const iframe = iframeRef.current;
|
|
31153
31212
|
const read3 = ++timelineReads.current;
|
|
31154
31213
|
if (!iframe || !previewFrameOpaque(iframe)) {
|
|
31155
|
-
applyTimelineMessage(data, safeContentDocument(iframe));
|
|
31214
|
+
applyTimelineMessage(data, safeContentDocument(iframe), openClipParents(iframe));
|
|
31156
31215
|
return;
|
|
31157
31216
|
}
|
|
31158
|
-
void previewDocumentCopy(iframe).then(
|
|
31159
|
-
|
|
31160
|
-
|
|
31161
|
-
|
|
31217
|
+
void Promise.all([previewDocumentCopy(iframe), previewClipParents(iframe)]).then(
|
|
31218
|
+
([doc, parents]) => {
|
|
31219
|
+
if (read3 === timelineReads.current && iframeRef.current === iframe)
|
|
31220
|
+
applyTimelineMessage(data, doc, parents);
|
|
31221
|
+
}
|
|
31222
|
+
);
|
|
31162
31223
|
},
|
|
31163
31224
|
[iframeRef, applyTimelineMessage]
|
|
31164
31225
|
);
|
|
@@ -34115,6 +34176,13 @@ var useAssetPreviewStore = create7((set) => ({
|
|
|
34115
34176
|
|
|
34116
34177
|
// src/components/nle/NLEContext.tsx
|
|
34117
34178
|
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
34179
|
+
async function hostCompositionSrc(iframe, compId) {
|
|
34180
|
+
const selector = `[data-composition-id="${CSS.escape(compId)}"][data-composition-src]`;
|
|
34181
|
+
const handle = (await queryPreviewElements(iframe, selector))?.matches[0]?.handle;
|
|
34182
|
+
if (!handle) return void 0;
|
|
34183
|
+
const [host] = await describePreviewElements(iframe, [handle]) ?? [];
|
|
34184
|
+
return host?.attributes.find(([name]) => name === "data-composition-src")?.[1] || void 0;
|
|
34185
|
+
}
|
|
34118
34186
|
function shouldDisableTimelineWhileCompositionLoading(compositionLoading) {
|
|
34119
34187
|
return compositionLoading;
|
|
34120
34188
|
}
|
|
@@ -34198,25 +34266,12 @@ function NLEProvider({
|
|
|
34198
34266
|
if (!element.compositionSrc) return;
|
|
34199
34267
|
usePlayerStore.getState().setSelectedElementId(null);
|
|
34200
34268
|
const compId = element.id;
|
|
34201
|
-
|
|
34202
|
-
|
|
34203
|
-
|
|
34204
|
-
|
|
34205
|
-
|
|
34206
|
-
|
|
34207
|
-
`[data-composition-id="${CSS.escape(compId)}"][data-composition-src]`
|
|
34208
|
-
);
|
|
34209
|
-
if (host) {
|
|
34210
|
-
resolvedPath = host.getAttribute("data-composition-src") || void 0;
|
|
34211
|
-
}
|
|
34212
|
-
}
|
|
34213
|
-
} catch {
|
|
34214
|
-
}
|
|
34215
|
-
}
|
|
34216
|
-
drillDown({
|
|
34217
|
-
id: compId,
|
|
34218
|
-
compositionSrc: resolvedPath ?? element.compositionSrc
|
|
34219
|
-
});
|
|
34269
|
+
const known = compIdToSrc.get(compId);
|
|
34270
|
+
const iframe = iframeRef_.current;
|
|
34271
|
+
const resolve2 = known || !iframe ? Promise.resolve(known) : hostCompositionSrc(iframe, compId);
|
|
34272
|
+
void resolve2.then(
|
|
34273
|
+
(resolvedPath) => drillDown({ id: compId, compositionSrc: resolvedPath ?? element.compositionSrc })
|
|
34274
|
+
);
|
|
34220
34275
|
},
|
|
34221
34276
|
[compIdToSrc, drillDown, iframeRef_]
|
|
34222
34277
|
);
|
|
@@ -34392,7 +34447,15 @@ function usePlayerHandle() {
|
|
|
34392
34447
|
}
|
|
34393
34448
|
|
|
34394
34449
|
// src/utils/previewCompositionSize.ts
|
|
34450
|
+
var isPositive = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
34451
|
+
function readyPlayerCompositionSize(iframe) {
|
|
34452
|
+
const player = resolvePreviewPlayerHost(iframe);
|
|
34453
|
+
if (!player?.ready) return null;
|
|
34454
|
+
const { compositionWidth: width, compositionHeight: height } = player;
|
|
34455
|
+
return isPositive(width) && isPositive(height) ? { width, height } : null;
|
|
34456
|
+
}
|
|
34395
34457
|
function readPreviewCompositionSize(iframe) {
|
|
34458
|
+
if (iframe && previewFrameOpaque(iframe)) return readyPlayerCompositionSize(iframe);
|
|
34396
34459
|
try {
|
|
34397
34460
|
const doc = iframe?.contentDocument;
|
|
34398
34461
|
const root = doc?.querySelector("[data-composition-id][data-width][data-height]") ?? doc?.querySelector("[data-width][data-height]");
|
|
@@ -34873,13 +34936,15 @@ function usePreviewFirstFrameTelemetry(previewSlots) {
|
|
|
34873
34936
|
const reportKey = `${slot.role}:${slot.gen}:${loadId}`;
|
|
34874
34937
|
if (reportedPaintsRef.current.has(reportKey)) return;
|
|
34875
34938
|
reportedPaintsRef.current.add(reportKey);
|
|
34876
|
-
const
|
|
34877
|
-
trackPreviewFirstFrame({
|
|
34878
|
-
duration_ms:
|
|
34879
|
-
composition_seconds: readTimelineDurationFromDocument(
|
|
34880
|
-
...
|
|
34939
|
+
const durationMs = Math.max(0, Math.round(performance.now() - startedAt2));
|
|
34940
|
+
const report = (doc) => trackPreviewFirstFrame({
|
|
34941
|
+
duration_ms: durationMs,
|
|
34942
|
+
composition_seconds: readTimelineDurationFromDocument(doc),
|
|
34943
|
+
...readPreviewComplexity(doc),
|
|
34881
34944
|
studio_version: getBrowserSystemMeta().studio_version
|
|
34882
34945
|
});
|
|
34946
|
+
if (previewFrameOpaque(iframe)) void previewDocumentCopy(iframe).then(report);
|
|
34947
|
+
else report(iframe.contentDocument);
|
|
34883
34948
|
},
|
|
34884
34949
|
[]
|
|
34885
34950
|
);
|
|
@@ -35087,6 +35152,14 @@ var NLEPreview = memo24(function NLEPreview2({
|
|
|
35087
35152
|
useEffect42(() => {
|
|
35088
35153
|
onCompositionSizeChangeRef.current?.(compositionSize);
|
|
35089
35154
|
}, [compositionSize]);
|
|
35155
|
+
const showLive = poster.onLiveReadyToShowChange;
|
|
35156
|
+
const onLiveReadyToShowChange = useCallback49(
|
|
35157
|
+
(ready) => {
|
|
35158
|
+
showLive(ready);
|
|
35159
|
+
if (ready) updateCompositionSizeFromPreview();
|
|
35160
|
+
},
|
|
35161
|
+
[showLive, updateCompositionSizeFromPreview]
|
|
35162
|
+
);
|
|
35090
35163
|
const setPreviewIframeRef = useCallback49(
|
|
35091
35164
|
(node) => {
|
|
35092
35165
|
previewIframeRef.current = node;
|
|
@@ -35368,7 +35441,7 @@ var NLEPreview = memo24(function NLEPreview2({
|
|
|
35368
35441
|
applyInitialZoom();
|
|
35369
35442
|
},
|
|
35370
35443
|
onCompositionLoadingChange,
|
|
35371
|
-
onReadyToShowChange:
|
|
35444
|
+
onReadyToShowChange: onLiveReadyToShowChange,
|
|
35372
35445
|
onPreviewError: poster.onPreviewError,
|
|
35373
35446
|
onPainted: (details) => reportPreviewFirstFrame(slot, details),
|
|
35374
35447
|
portrait,
|
|
@@ -39003,6 +39076,7 @@ function buildInsetClipPathValue(insetPx, radiusValue) {
|
|
|
39003
39076
|
}
|
|
39004
39077
|
|
|
39005
39078
|
// src/components/editor/domEditOverlayCrop.ts
|
|
39079
|
+
import { MAX_DRAFT_PX as MAX_DRAFT_PX2, MAX_ELEMENT_VALUE as MAX_ELEMENT_VALUE2 } from "@hyperframes/core/runtime/editing-port";
|
|
39006
39080
|
function cropRectFromInsets(rect, insets, scaleX, scaleY) {
|
|
39007
39081
|
const sx = scaleX > 0 ? scaleX : 1;
|
|
39008
39082
|
const sy = scaleY > 0 ? scaleY : 1;
|
|
@@ -39016,13 +39090,42 @@ function cropRectFromInsets(rect, insets, scaleX, scaleY) {
|
|
|
39016
39090
|
};
|
|
39017
39091
|
}
|
|
39018
39092
|
var cropLifts = /* @__PURE__ */ new WeakMap();
|
|
39093
|
+
var UNLIFT_TRIES = 3;
|
|
39019
39094
|
function liftSelector(element) {
|
|
39020
39095
|
const quote = (value) => `"${value.replace(/["\\]/g, "\\$&")}"`;
|
|
39021
39096
|
const hfId = element.getAttribute("data-hf-id");
|
|
39022
39097
|
if (hfId) return `[data-hf-id=${quote(hfId)}]`;
|
|
39023
39098
|
return element.id ? `[id=${quote(element.id)}]` : null;
|
|
39024
39099
|
}
|
|
39100
|
+
function unliftInFrame(element, record2, tries = UNLIFT_TRIES) {
|
|
39101
|
+
const target = previewStandIn(element);
|
|
39102
|
+
if (!target) return;
|
|
39103
|
+
void previewRequest(target.iframe, "crop-lift", { handle: target.handle, lift: false }).then(
|
|
39104
|
+
(reply) => {
|
|
39105
|
+
if (cropLifts.get(element) !== record2) return;
|
|
39106
|
+
if (reply?.lifted === false) cropLifts.delete(element);
|
|
39107
|
+
else if (tries > 1) unliftInFrame(element, record2, tries - 1);
|
|
39108
|
+
}
|
|
39109
|
+
);
|
|
39110
|
+
}
|
|
39111
|
+
function liftInFrame(element) {
|
|
39112
|
+
const target = previewStandIn(element);
|
|
39113
|
+
if (!target) return false;
|
|
39114
|
+
const record2 = { rule: null, sheetClip: frameClipPaths.get(element)?.computed ?? "" };
|
|
39115
|
+
cropLifts.set(element, record2);
|
|
39116
|
+
void previewRequest(target.iframe, "crop-lift", { handle: target.handle, lift: true }).then(
|
|
39117
|
+
(reply) => {
|
|
39118
|
+
if (cropLifts.get(element) !== record2 || !reply) return;
|
|
39119
|
+
if (!reply.lifted) cropLifts.delete(element);
|
|
39120
|
+
else if (typeof reply.clipPath === "string" && reply.clipPath.length <= MAX_ELEMENT_VALUE2)
|
|
39121
|
+
record2.sheetClip = reply.clipPath.trim();
|
|
39122
|
+
}
|
|
39123
|
+
);
|
|
39124
|
+
return true;
|
|
39125
|
+
}
|
|
39025
39126
|
function liftElementCrop(element) {
|
|
39127
|
+
const held2 = cropLifts.get(element);
|
|
39128
|
+
if (held2 && !held2.dropped || liftInFrame(element)) return;
|
|
39026
39129
|
const selector = liftSelector(element);
|
|
39027
39130
|
if (!selector || cropLifts.has(element)) return;
|
|
39028
39131
|
const doc = element.ownerDocument;
|
|
@@ -39032,28 +39135,49 @@ function liftElementCrop(element) {
|
|
|
39032
39135
|
cropLifts.set(element, { rule });
|
|
39033
39136
|
}
|
|
39034
39137
|
function dropElementCropLift(element) {
|
|
39035
|
-
cropLifts.get(element)
|
|
39036
|
-
|
|
39138
|
+
const lift = cropLifts.get(element);
|
|
39139
|
+
if (!lift || lift.dropped) return;
|
|
39140
|
+
if (lift.rule) {
|
|
39141
|
+
lift.rule.remove();
|
|
39142
|
+
cropLifts.delete(element);
|
|
39143
|
+
return;
|
|
39144
|
+
}
|
|
39145
|
+
lift.dropped = true;
|
|
39146
|
+
unliftInFrame(element, lift);
|
|
39037
39147
|
}
|
|
39038
39148
|
function isElementCropLifted(element) {
|
|
39039
|
-
return cropLifts.has(element);
|
|
39040
|
-
}
|
|
39041
|
-
var computedClipPath = (element) => element.ownerDocument.defaultView?.getComputedStyle(element).clipPath.trim() || "";
|
|
39042
|
-
function readElementClipPath(element) {
|
|
39043
|
-
const inline = element.style.getPropertyValue("clip-path").trim();
|
|
39044
39149
|
const lift = cropLifts.get(element);
|
|
39045
|
-
|
|
39046
|
-
|
|
39150
|
+
return !!lift && !lift.dropped;
|
|
39151
|
+
}
|
|
39152
|
+
var frameClipPaths = /* @__PURE__ */ new WeakMap();
|
|
39153
|
+
function rememberFrameClipPath(element, inline, computed) {
|
|
39154
|
+
frameClipPaths.set(element, { inline: inline.trim(), computed: computed.trim() });
|
|
39155
|
+
}
|
|
39156
|
+
var computedClipPath = (element) => {
|
|
39157
|
+
const view = element.ownerDocument.defaultView;
|
|
39158
|
+
if (!view) return frameClipPaths.get(element)?.computed ?? "";
|
|
39159
|
+
return view.getComputedStyle(element).clipPath.trim();
|
|
39160
|
+
};
|
|
39161
|
+
function sheetClipUnder(element, lift) {
|
|
39162
|
+
if (lift.sheetClip === void 0 && lift.rule) {
|
|
39047
39163
|
const { parentNode, nextSibling } = lift.rule;
|
|
39048
39164
|
lift.rule.remove();
|
|
39049
39165
|
lift.sheetClip = computedClipPath(element);
|
|
39050
39166
|
parentNode?.insertBefore(lift.rule, nextSibling);
|
|
39051
39167
|
}
|
|
39052
|
-
return lift.sheetClip;
|
|
39168
|
+
return lift.sheetClip ?? "";
|
|
39169
|
+
}
|
|
39170
|
+
function readElementClipPath(element) {
|
|
39171
|
+
const inline = element.style.getPropertyValue("clip-path").trim() || frameClipPaths.get(element)?.inline;
|
|
39172
|
+
if (inline) return inline;
|
|
39173
|
+
const lift = cropLifts.get(element);
|
|
39174
|
+
return lift && !lift.dropped ? sheetClipUnder(element, lift) : computedClipPath(element);
|
|
39053
39175
|
}
|
|
39054
39176
|
function parseCropClipPath(value) {
|
|
39055
39177
|
if (!value || value === "none") return { top: 0, right: 0, bottom: 0, left: 0, radius: 0 };
|
|
39056
|
-
|
|
39178
|
+
const sides = parseInsetClipPathSides(value);
|
|
39179
|
+
const sane = sides && Object.values(sides).every((side) => Math.abs(side) <= MAX_DRAFT_PX2);
|
|
39180
|
+
return sane ? sides : null;
|
|
39057
39181
|
}
|
|
39058
39182
|
function readElementCropInsets(element) {
|
|
39059
39183
|
return parseCropClipPath(readElementClipPath(element));
|
|
@@ -39605,7 +39729,7 @@ async function measurePreviewVisibleRects(iframe, overlayEl, handles) {
|
|
|
39605
39729
|
import { resolveEditingAffordances } from "@hyperframes/core/editing";
|
|
39606
39730
|
import {
|
|
39607
39731
|
MAX_ELEMENT_ENTRIES as MAX_ELEMENT_ENTRIES2,
|
|
39608
|
-
MAX_ELEMENT_VALUE as
|
|
39732
|
+
MAX_ELEMENT_VALUE as MAX_ELEMENT_VALUE3
|
|
39609
39733
|
} from "@hyperframes/core/runtime/editing-port";
|
|
39610
39734
|
|
|
39611
39735
|
// src/hooks/draggedGsapPosition.ts
|
|
@@ -39884,7 +40008,7 @@ function readable(element) {
|
|
|
39884
40008
|
return probe2;
|
|
39885
40009
|
}
|
|
39886
40010
|
var attr = (element, name) => element.attributes.find(([key]) => key === name)?.[1] ?? null;
|
|
39887
|
-
var mayBeCut = (value) => value.length >=
|
|
40011
|
+
var mayBeCut = (value) => value.length >= MAX_ELEMENT_VALUE3 || value.startsWith("data:") && value.endsWith(",");
|
|
39888
40012
|
function valuesWhole(element) {
|
|
39889
40013
|
if (!element.truncated) return true;
|
|
39890
40014
|
const styles = Object.values(element.inlineStyles);
|
|
@@ -40022,6 +40146,11 @@ async function resolvePreviewSelection(iframe, target, options) {
|
|
|
40022
40146
|
.../* @__PURE__ */ new Set([...CURATED_STYLE_PROPERTIES, ...TRANSLATE_PX_PROPERTIES])
|
|
40023
40147
|
]);
|
|
40024
40148
|
if (!styles) return null;
|
|
40149
|
+
rememberFrameClipPath(
|
|
40150
|
+
element,
|
|
40151
|
+
current2.inlineStyles["clip-path"] ?? "",
|
|
40152
|
+
styles["clip-path"] ?? ""
|
|
40153
|
+
);
|
|
40025
40154
|
rememberFrameTranslate(
|
|
40026
40155
|
element,
|
|
40027
40156
|
translatePx(styles.translate ?? "none", (p) => styles[p] ?? ""),
|
|
@@ -40135,6 +40264,10 @@ async function findPointerTargets(iframe, clientX, clientY) {
|
|
|
40135
40264
|
const described = handles.length ? await describePreviewElements(iframe, handles) : [];
|
|
40136
40265
|
return (described ?? []).filter((element) => element !== null);
|
|
40137
40266
|
}
|
|
40267
|
+
function editSealedSelection(iframe, selection, edit) {
|
|
40268
|
+
if (!iframe || !selection.handle || !previewFrameOpaque(iframe)) return null;
|
|
40269
|
+
return editPreviewElement(iframe, selection.handle, edit);
|
|
40270
|
+
}
|
|
40138
40271
|
var selectionElementLive = (selection) => selection.handle !== void 0 || selection.element.isConnected;
|
|
40139
40272
|
|
|
40140
40273
|
// src/components/editor/previewLayers.ts
|
|
@@ -42863,8 +42996,15 @@ function editMoment(stamp) {
|
|
|
42863
42996
|
}
|
|
42864
42997
|
|
|
42865
42998
|
// src/components/editor/previewGestureStartRead.ts
|
|
42999
|
+
var startLayouts = /* @__PURE__ */ new Map();
|
|
43000
|
+
var gestureStartLayout = (handle) => startLayouts.get(handle) ?? null;
|
|
42866
43001
|
async function measurePreviewGestureStart(iframe, overlayEl, handles) {
|
|
42867
43002
|
const reply = await previewGestureStart(iframe, handles);
|
|
43003
|
+
startLayouts.clear();
|
|
43004
|
+
reply?.elements.forEach((start, i) => {
|
|
43005
|
+
const { width = 0, height = 0 } = start?.layout ?? {};
|
|
43006
|
+
if (width >= 1 && height >= 1) startLayouts.set(handles[i], { width, height });
|
|
43007
|
+
});
|
|
42868
43008
|
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
42869
43009
|
if (!reply || !scale) return null;
|
|
42870
43010
|
const { iframeRect, overlayRect, rootScaleX: sx, rootScaleY: sy } = scale;
|
|
@@ -70931,7 +71071,11 @@ function MediaFadeSliders({
|
|
|
70931
71071
|
function createGsapLivePreview(iframeRef) {
|
|
70932
71072
|
return (el, props) => {
|
|
70933
71073
|
const iframe = iframeRef.current;
|
|
70934
|
-
if (!iframe
|
|
71074
|
+
if (!iframe) return;
|
|
71075
|
+
if (previewFrameOpaque(iframe)) {
|
|
71076
|
+
if (el.handle) void previewRequest(iframe, "gsap-set", { handle: el.handle, props });
|
|
71077
|
+
return;
|
|
71078
|
+
}
|
|
70935
71079
|
const win = iframe?.contentWindow;
|
|
70936
71080
|
const node = findPreviewNode(iframe?.contentDocument, el);
|
|
70937
71081
|
if (win?.gsap && node) win.gsap.set(node, props);
|
|
@@ -76387,7 +76531,7 @@ var FileTree = memo43(function FileTree2({
|
|
|
76387
76531
|
});
|
|
76388
76532
|
|
|
76389
76533
|
// src/App.tsx
|
|
76390
|
-
import { useState as
|
|
76534
|
+
import { useState as useState173, useCallback as useCallback197, useRef as useRef195, useMemo as useMemo91 } from "react";
|
|
76391
76535
|
|
|
76392
76536
|
// src/hooks/useStableHandlers.ts
|
|
76393
76537
|
import { useRef as useRef122 } from "react";
|
|
@@ -80187,7 +80331,7 @@ async function requestFreezeFrame(input) {
|
|
|
80187
80331
|
const held2 = response.ok ? null : await heldFileWordsOf(response, input.path);
|
|
80188
80332
|
const body = await response.json().catch(() => null);
|
|
80189
80333
|
if (!response.ok || !isFreezeFrameResponse(body)) {
|
|
80190
|
-
throw new Error(held2 ?? errorOf(body) ??
|
|
80334
|
+
throw new Error(held2 ?? withStatus(errorOf(body) ?? "Freeze frame failed", response));
|
|
80191
80335
|
}
|
|
80192
80336
|
return body;
|
|
80193
80337
|
}
|
|
@@ -84656,6 +84800,7 @@ async function commitDomStyles(context, selection, stylesInEitherCase) {
|
|
|
84656
84800
|
}
|
|
84657
84801
|
let editedElement = null;
|
|
84658
84802
|
const previousInline = /* @__PURE__ */ new Map();
|
|
84803
|
+
let sealedEdit = null;
|
|
84659
84804
|
return runReportedDomEditCommit({
|
|
84660
84805
|
capture: () => {
|
|
84661
84806
|
const el = doc ? findElementForSelection(doc, selection, activeCompPath) : null;
|
|
@@ -84665,21 +84810,30 @@ async function commitDomStyles(context, selection, stylesInEitherCase) {
|
|
|
84665
84810
|
previousInline.set(property, el.style.getPropertyValue(property));
|
|
84666
84811
|
},
|
|
84667
84812
|
apply: () => {
|
|
84668
|
-
if (!editedElement)
|
|
84813
|
+
if (!editedElement) {
|
|
84814
|
+
sealedEdit = editSealedSelection(previewIframeRef.current, selection, {
|
|
84815
|
+
styles: liveStyles
|
|
84816
|
+
});
|
|
84817
|
+
return;
|
|
84818
|
+
}
|
|
84669
84819
|
for (const [property, value] of liveStyles) editedElement.style.setProperty(property, value);
|
|
84670
84820
|
if (fontFamily !== void 0 && doc) {
|
|
84671
84821
|
injectPreviewGoogleFont(doc, fontFamily);
|
|
84672
84822
|
if (importedFont) injectPreviewImportedFont(doc, importedFont);
|
|
84673
84823
|
}
|
|
84674
84824
|
},
|
|
84675
|
-
persist: () =>
|
|
84676
|
-
|
|
84677
|
-
|
|
84678
|
-
|
|
84679
|
-
|
|
84680
|
-
|
|
84825
|
+
persist: () => afterSealedDraw(
|
|
84826
|
+
sealedEdit,
|
|
84827
|
+
(drawn) => persistDomEditOperations(selection, operations, {
|
|
84828
|
+
label: "Edit layer style",
|
|
84829
|
+
// Live styles skip the reload; a sealed frame reloads to load a new font.
|
|
84830
|
+
skipRefresh: drawn && !(sealedEdit && fontFamily !== void 0),
|
|
84831
|
+
importedFont: importedFont ?? void 0
|
|
84832
|
+
})
|
|
84833
|
+
),
|
|
84681
84834
|
shouldRevert: ownsAny,
|
|
84682
84835
|
revert: () => {
|
|
84836
|
+
sealedEdit?.restore(owned.filter(({ isLatest }) => isLatest()).map((o) => o.property));
|
|
84683
84837
|
const el = editedElement;
|
|
84684
84838
|
if (!el) return;
|
|
84685
84839
|
for (const { property, isLatest } of owned) {
|
|
@@ -84762,6 +84916,7 @@ function useDomEditAttributeCommits({
|
|
|
84762
84916
|
const op = { type: "attribute", property: attr2, value };
|
|
84763
84917
|
let editedElement = null;
|
|
84764
84918
|
let previousValue = null;
|
|
84919
|
+
let sealedEdit = null;
|
|
84765
84920
|
await runDomEditCommit({
|
|
84766
84921
|
capture: () => {
|
|
84767
84922
|
const captured = captureAttributeElement(
|
|
@@ -84775,18 +84930,26 @@ function useDomEditAttributeCommits({
|
|
|
84775
84930
|
previousValue = captured.previousValue;
|
|
84776
84931
|
},
|
|
84777
84932
|
apply: () => {
|
|
84778
|
-
if (!editedElement) return;
|
|
84779
84933
|
const nextValue = value === null || value === "" ? null : value;
|
|
84934
|
+
if (!editedElement) {
|
|
84935
|
+
const attributes = [[fullAttr, nextValue]];
|
|
84936
|
+
sealedEdit = editSealedSelection(iframe, domEditSelection, { attributes });
|
|
84937
|
+
return;
|
|
84938
|
+
}
|
|
84780
84939
|
setOrRemovePreviewAttribute(editedElement, fullAttr, nextValue);
|
|
84781
84940
|
},
|
|
84782
84941
|
persist: options.previewOnly ? async () => {
|
|
84783
|
-
} : () =>
|
|
84784
|
-
|
|
84785
|
-
|
|
84786
|
-
|
|
84787
|
-
|
|
84942
|
+
} : () => afterSealedDraw(
|
|
84943
|
+
sealedEdit,
|
|
84944
|
+
(drawn) => persistDomEditOperations(domEditSelection, [op], {
|
|
84945
|
+
label: options.label,
|
|
84946
|
+
coalesceKey: commitKey,
|
|
84947
|
+
skipRefresh: options.skipRefresh && drawn
|
|
84948
|
+
})
|
|
84949
|
+
),
|
|
84788
84950
|
shouldRevert: () => isLatestCommit(),
|
|
84789
84951
|
revert: () => {
|
|
84952
|
+
sealedEdit?.restore();
|
|
84790
84953
|
if (!editedElement) return;
|
|
84791
84954
|
setOrRemovePreviewAttribute(editedElement, fullAttr, previousValue);
|
|
84792
84955
|
},
|
|
@@ -84822,6 +84985,7 @@ function useDomEditAttributeCommits({
|
|
|
84822
84985
|
commitKey
|
|
84823
84986
|
);
|
|
84824
84987
|
let captured = null;
|
|
84988
|
+
let sealedEdit = null;
|
|
84825
84989
|
let landed = false;
|
|
84826
84990
|
await runDomEditCommit({
|
|
84827
84991
|
capture: () => {
|
|
@@ -84833,19 +84997,30 @@ function useDomEditAttributeCommits({
|
|
|
84833
84997
|
);
|
|
84834
84998
|
},
|
|
84835
84999
|
apply: () => {
|
|
84836
|
-
if (!captured)
|
|
85000
|
+
if (!captured) {
|
|
85001
|
+
const attributes = entries.map(({ fullAttr, value }) => [
|
|
85002
|
+
fullAttr,
|
|
85003
|
+
value
|
|
85004
|
+
]);
|
|
85005
|
+
sealedEdit = editSealedSelection(iframe, selection, { attributes });
|
|
85006
|
+
return;
|
|
85007
|
+
}
|
|
84837
85008
|
for (const entry3 of entries) {
|
|
84838
85009
|
setOrRemovePreviewAttribute(captured.element, entry3.fullAttr, entry3.value);
|
|
84839
85010
|
}
|
|
84840
85011
|
},
|
|
84841
|
-
persist: () =>
|
|
84842
|
-
|
|
84843
|
-
|
|
84844
|
-
|
|
84845
|
-
|
|
84846
|
-
|
|
85012
|
+
persist: () => afterSealedDraw(
|
|
85013
|
+
sealedEdit,
|
|
85014
|
+
(drawn) => persistDomEditOperations(selection, ops, {
|
|
85015
|
+
label: options.label,
|
|
85016
|
+
coalesceKey: commitKey,
|
|
85017
|
+
skipRefresh: options.skipRefresh && drawn,
|
|
85018
|
+
prepareContent: options.prepareContent
|
|
85019
|
+
})
|
|
85020
|
+
),
|
|
84847
85021
|
shouldRevert: (error) => isLatestCommit() && !(error instanceof DomEditPersistPreparedWriteError),
|
|
84848
85022
|
revert: () => {
|
|
85023
|
+
sealedEdit?.restore();
|
|
84849
85024
|
if (!captured) return;
|
|
84850
85025
|
for (const entry3 of entries) {
|
|
84851
85026
|
setOrRemovePreviewAttribute(
|
|
@@ -84955,6 +85130,7 @@ function useDomEditAttributeCommits({
|
|
|
84955
85130
|
const op = { type: "html-attribute", property: attr2, value };
|
|
84956
85131
|
let editedElement = null;
|
|
84957
85132
|
let previousValue = null;
|
|
85133
|
+
let sealedEdit = null;
|
|
84958
85134
|
await runDomEditCommit({
|
|
84959
85135
|
capture: () => {
|
|
84960
85136
|
const captured = captureAttributeElement(
|
|
@@ -84968,12 +85144,13 @@ function useDomEditAttributeCommits({
|
|
|
84968
85144
|
previousValue = captured.previousValue;
|
|
84969
85145
|
},
|
|
84970
85146
|
apply: () => {
|
|
84971
|
-
|
|
84972
|
-
|
|
84973
|
-
|
|
84974
|
-
|
|
84975
|
-
|
|
84976
|
-
|
|
85147
|
+
const optimistic = resolveOptimisticAttributeValue(attr2, value);
|
|
85148
|
+
if (!editedElement) {
|
|
85149
|
+
const attributes = [[attr2, optimistic]];
|
|
85150
|
+
sealedEdit = editSealedSelection(iframe, domEditSelection, { attributes });
|
|
85151
|
+
return;
|
|
85152
|
+
}
|
|
85153
|
+
setOrRemovePreviewAttribute(editedElement, attr2, optimistic);
|
|
84977
85154
|
},
|
|
84978
85155
|
persist: () => persistDomEditOperations(domEditSelection, [op], {
|
|
84979
85156
|
label: `Edit ${attr2}`,
|
|
@@ -84982,6 +85159,7 @@ function useDomEditAttributeCommits({
|
|
|
84982
85159
|
}),
|
|
84983
85160
|
shouldRevert: () => isLatestCommit(),
|
|
84984
85161
|
revert: () => {
|
|
85162
|
+
sealedEdit?.restore();
|
|
84985
85163
|
if (!editedElement) return;
|
|
84986
85164
|
setOrRemovePreviewAttribute(editedElement, attr2, previousValue);
|
|
84987
85165
|
},
|
|
@@ -85904,7 +86082,12 @@ async function commitStructuralMutation(pid, targetPath, route, body, label, dep
|
|
|
85904
86082
|
const held2 = await heldFileWordsOf(mutateResponse, targetPath);
|
|
85905
86083
|
if (held2) throw new Error(held2);
|
|
85906
86084
|
const errBody = await mutateResponse.json().catch(() => null);
|
|
85907
|
-
throw new Error(
|
|
86085
|
+
throw new Error(
|
|
86086
|
+
withStatus(
|
|
86087
|
+
errBody?.error ?? `Failed to ${label.toLowerCase()} in ${targetPath}`,
|
|
86088
|
+
mutateResponse
|
|
86089
|
+
)
|
|
86090
|
+
);
|
|
85908
86091
|
}
|
|
85909
86092
|
result = await mutateResponse.json();
|
|
85910
86093
|
return { disk: typeof result.content === "string" ? result.content : originalContent };
|
|
@@ -88693,8 +88876,9 @@ async function tryGsapResizeIntercept(selection, size, animations, iframe, commi
|
|
|
88693
88876
|
let useScaleLonghands = false;
|
|
88694
88877
|
if (resizeGroup === "scale") {
|
|
88695
88878
|
const el = iframe?.contentDocument?.querySelector(selector ?? "");
|
|
88696
|
-
const
|
|
88697
|
-
const
|
|
88879
|
+
const started = selection.handle ? gestureStartLayout(selection.handle) : null;
|
|
88880
|
+
const cssW = originalBoxSize(el, STUDIO_ORIGINAL_BOX_WIDTH_ATTR, "width") ?? (started?.width || 200);
|
|
88881
|
+
const cssH = originalBoxSize(el, STUDIO_ORIGINAL_BOX_HEIGHT_ATTR, "height") ?? (started?.height || cssW);
|
|
88698
88882
|
const rawLiveScaleX = readGsapProperty(iframe, selector ?? null, "scaleX") ?? 1;
|
|
88699
88883
|
const rawLiveScaleY = readGsapProperty(iframe, selector ?? null, "scaleY") ?? 1;
|
|
88700
88884
|
const liveScaleX = rawLiveScaleX > 0 ? rawLiveScaleX : 1;
|
|
@@ -91219,19 +91403,9 @@ function useStudioExternalFileChanges({
|
|
|
91219
91403
|
import { useCallback as useCallback157, useMemo as useMemo76, useRef as useRef164, useState as useState135 } from "react";
|
|
91220
91404
|
|
|
91221
91405
|
// src/utils/blockInstaller.ts
|
|
91222
|
-
function
|
|
91223
|
-
|
|
91224
|
-
|
|
91225
|
-
if (!doc) return 0;
|
|
91226
|
-
let max = 0;
|
|
91227
|
-
for (const el of doc.body.querySelectorAll("*")) {
|
|
91228
|
-
const z = parseInt(getComputedStyle(el).zIndex, 10);
|
|
91229
|
-
if (Number.isFinite(z) && z > max) max = z;
|
|
91230
|
-
}
|
|
91231
|
-
return max;
|
|
91232
|
-
} catch {
|
|
91233
|
-
return 0;
|
|
91234
|
-
}
|
|
91406
|
+
async function previewMaxZIndex(iframe) {
|
|
91407
|
+
const zIndex = iframe ? (await previewRequest(iframe, "max-z-index", {}))?.zIndex : void 0;
|
|
91408
|
+
return Number.isSafeInteger(zIndex) && zIndex >= 0 ? zIndex : 0;
|
|
91235
91409
|
}
|
|
91236
91410
|
function buildUniqueCompositionId(baseName, existingIds) {
|
|
91237
91411
|
const idSet = new Set(existingIds);
|
|
@@ -91358,6 +91532,7 @@ async function addBlockToProject(opts) {
|
|
|
91358
91532
|
timelineElements: relevantElements,
|
|
91359
91533
|
currentTime: opts.currentTime ?? 0
|
|
91360
91534
|
});
|
|
91535
|
+
const zIndex = await previewMaxZIndex(opts.previewIframe ?? null) + 1;
|
|
91361
91536
|
let hostId = "";
|
|
91362
91537
|
const insertHost = (originalContent) => {
|
|
91363
91538
|
const { width, height } = resolveTimelineAssetCompositionSize(originalContent);
|
|
@@ -91372,7 +91547,7 @@ async function addBlockToProject(opts) {
|
|
|
91372
91547
|
height,
|
|
91373
91548
|
left: visualPosition ? Math.round(visualPosition.left) : 0,
|
|
91374
91549
|
top: visualPosition ? Math.round(visualPosition.top) : 0,
|
|
91375
|
-
zIndex
|
|
91550
|
+
zIndex
|
|
91376
91551
|
});
|
|
91377
91552
|
return extendRootDurationInSource(
|
|
91378
91553
|
insertTimelineAssetIntoSource(originalContent, subComposition),
|
|
@@ -91619,6 +91794,36 @@ function dispatchClipboardKey(event, cb) {
|
|
|
91619
91794
|
}
|
|
91620
91795
|
return true;
|
|
91621
91796
|
}
|
|
91797
|
+
var APP_HOTKEY_ACTIONS = [
|
|
91798
|
+
"undo",
|
|
91799
|
+
"redo",
|
|
91800
|
+
"redoAlt",
|
|
91801
|
+
"tabCompositions",
|
|
91802
|
+
"tabAssets",
|
|
91803
|
+
"group",
|
|
91804
|
+
"ungroup",
|
|
91805
|
+
"copy",
|
|
91806
|
+
"paste",
|
|
91807
|
+
"cut",
|
|
91808
|
+
"duplicate",
|
|
91809
|
+
"zoomSelection",
|
|
91810
|
+
"fullscreen",
|
|
91811
|
+
"split",
|
|
91812
|
+
"audioGain",
|
|
91813
|
+
"razorTool",
|
|
91814
|
+
"selectTool",
|
|
91815
|
+
"selectLeftward",
|
|
91816
|
+
"selectRightward",
|
|
91817
|
+
"cancel",
|
|
91818
|
+
"deleteSelected",
|
|
91819
|
+
"deleteSelectedAlt",
|
|
91820
|
+
"resetKeyframes",
|
|
91821
|
+
"record",
|
|
91822
|
+
"linkToggle",
|
|
91823
|
+
"detachAudio",
|
|
91824
|
+
"deleteLinked",
|
|
91825
|
+
"deleteLinkedAlt"
|
|
91826
|
+
];
|
|
91622
91827
|
function dispatchModifierKey(event, _key, cb) {
|
|
91623
91828
|
if (!shouldIgnoreHistoryShortcut(event.target)) {
|
|
91624
91829
|
const handled = handleUndoRedoKey(
|
|
@@ -91850,6 +92055,7 @@ function fromShown(files, shown3) {
|
|
|
91850
92055
|
}
|
|
91851
92056
|
|
|
91852
92057
|
// src/hooks/useAppHotkeys.ts
|
|
92058
|
+
import { createEditingPortClient } from "@hyperframes/core/runtime/editing-port";
|
|
91853
92059
|
function iframeContentWindow(iframe) {
|
|
91854
92060
|
try {
|
|
91855
92061
|
return iframe?.contentWindow ?? null;
|
|
@@ -91857,6 +92063,24 @@ function iframeContentWindow(iframe) {
|
|
|
91857
92063
|
return null;
|
|
91858
92064
|
}
|
|
91859
92065
|
}
|
|
92066
|
+
function forwardSealedFrameKeys2(iframe, onKeyDown) {
|
|
92067
|
+
const client = createEditingPortClient({ iframe });
|
|
92068
|
+
const watch = (combos) => void client.request("watch-keys", { combos }).catch(() => {
|
|
92069
|
+
});
|
|
92070
|
+
const watchApp = () => watch(APP_HOTKEY_ACTIONS.map(getStudioKey));
|
|
92071
|
+
watchApp();
|
|
92072
|
+
const stopRebinds = subscribeStudioKeys(watchApp);
|
|
92073
|
+
const focused = () => iframe.ownerDocument.hasFocus() && iframe.ownerDocument.activeElement === iframe;
|
|
92074
|
+
const stopKeys = client.onKey((key) => {
|
|
92075
|
+
if (key.type === "keydown" && focused()) onKeyDown(new KeyboardEvent(key.type, key));
|
|
92076
|
+
});
|
|
92077
|
+
return () => {
|
|
92078
|
+
stopRebinds();
|
|
92079
|
+
stopKeys();
|
|
92080
|
+
void client.request("watch-keys", { combos: [] }).catch(() => {
|
|
92081
|
+
}).finally(() => client.dispose());
|
|
92082
|
+
};
|
|
92083
|
+
}
|
|
91860
92084
|
function safeAddListener(t2, type, h, capture = false) {
|
|
91861
92085
|
try {
|
|
91862
92086
|
t2?.addEventListener(type, h, capture);
|
|
@@ -91980,6 +92204,10 @@ function useAppHotkeys({
|
|
|
91980
92204
|
(iframe) => {
|
|
91981
92205
|
previewHistoryCleanupRef.current?.();
|
|
91982
92206
|
previewHistoryCleanupRef.current = null;
|
|
92207
|
+
if (iframe && previewFrameOpaque(iframe)) {
|
|
92208
|
+
previewHistoryCleanupRef.current = forwardSealedFrameKeys2(iframe, handleAppKeyDown);
|
|
92209
|
+
return;
|
|
92210
|
+
}
|
|
91983
92211
|
const win = iframeContentWindow(iframe);
|
|
91984
92212
|
if (!win) return;
|
|
91985
92213
|
const appHandler = handleAppKeyDown;
|
|
@@ -103005,26 +103233,34 @@ function useSlideshowPersist({
|
|
|
103005
103233
|
}
|
|
103006
103234
|
|
|
103007
103235
|
// src/hooks/useSlideshowTabState.ts
|
|
103008
|
-
import { useMemo as useMemo89 } from "react";
|
|
103236
|
+
import { useEffect as useEffect162, useMemo as useMemo89, useState as useState169 } from "react";
|
|
103009
103237
|
import { SLIDESHOW_ISLAND_TYPE as SLIDESHOW_ISLAND_TYPE2, slideshowIslandRegex as slideshowIslandRegex2 } from "@hyperframes/core/slideshow";
|
|
103238
|
+
function isSceneEntry(value) {
|
|
103239
|
+
if (!value || typeof value !== "object") return false;
|
|
103240
|
+
const s = value;
|
|
103241
|
+
return typeof s.id === "string" && typeof s.label === "string" && Number.isFinite(s.start) && Number.isFinite(s.duration);
|
|
103242
|
+
}
|
|
103010
103243
|
function useSlideshowTabState(params) {
|
|
103011
103244
|
const { editingFileContent, previewIframeRef, refreshKey, slideshowVisible } = params;
|
|
103012
103245
|
const isSlideshowComposition = useMemo89(() => {
|
|
103013
103246
|
if (!editingFileContent || !editingFileContent.includes(SLIDESHOW_ISLAND_TYPE2)) return false;
|
|
103014
103247
|
return slideshowIslandRegex2("i").test(editingFileContent);
|
|
103015
103248
|
}, [editingFileContent]);
|
|
103016
|
-
const slideshowScenes =
|
|
103017
|
-
|
|
103018
|
-
|
|
103019
|
-
|
|
103020
|
-
|
|
103021
|
-
|
|
103022
|
-
|
|
103023
|
-
|
|
103024
|
-
|
|
103025
|
-
|
|
103026
|
-
|
|
103027
|
-
}
|
|
103249
|
+
const [slideshowScenes, setSlideshowScenes] = useState169([]);
|
|
103250
|
+
useEffect162(() => {
|
|
103251
|
+
const iframe = previewIframeRef.current;
|
|
103252
|
+
if (!iframe) return setSlideshowScenes([]);
|
|
103253
|
+
let current2 = true;
|
|
103254
|
+
void previewClipManifest(iframe).then((manifest) => {
|
|
103255
|
+
if (!current2) return;
|
|
103256
|
+
const scenes = Array.isArray(manifest?.scenes) ? manifest.scenes : [];
|
|
103257
|
+
setSlideshowScenes(
|
|
103258
|
+
scenes.filter(isSceneEntry).map((s) => ({ id: s.id, label: s.label, start: s.start, duration: s.duration }))
|
|
103259
|
+
);
|
|
103260
|
+
});
|
|
103261
|
+
return () => {
|
|
103262
|
+
current2 = false;
|
|
103263
|
+
};
|
|
103028
103264
|
}, [previewIframeRef, slideshowVisible, refreshKey]);
|
|
103029
103265
|
return { isSlideshowComposition, slideshowScenes };
|
|
103030
103266
|
}
|
|
@@ -103074,7 +103310,7 @@ function DesignPanelPromoteProvider({
|
|
|
103074
103310
|
}
|
|
103075
103311
|
|
|
103076
103312
|
// src/hooks/useRemoveBackground.ts
|
|
103077
|
-
import { useCallback as useCallback190, useEffect as
|
|
103313
|
+
import { useCallback as useCallback190, useEffect as useEffect163, useRef as useRef191 } from "react";
|
|
103078
103314
|
|
|
103079
103315
|
// src/components/studioMediaJobs.ts
|
|
103080
103316
|
var MEDIA_JOB_RECONNECT_TIMEOUT_MS = 15e3;
|
|
@@ -103181,7 +103417,7 @@ function waitForMediaJob(jobId, onProgress, signal) {
|
|
|
103181
103417
|
// src/hooks/useRemoveBackground.ts
|
|
103182
103418
|
function useRemoveBackground(projectId, refreshFileTree, showToast) {
|
|
103183
103419
|
const abortRef = useRef191(null);
|
|
103184
|
-
|
|
103420
|
+
useEffect163(
|
|
103185
103421
|
() => () => {
|
|
103186
103422
|
abortRef.current?.abort();
|
|
103187
103423
|
},
|
|
@@ -103647,7 +103883,7 @@ function useStudioSidePanels(left, right, projectId) {
|
|
|
103647
103883
|
}
|
|
103648
103884
|
|
|
103649
103885
|
// src/components/TimelineToolbar.tsx
|
|
103650
|
-
import { memo as memo63, useEffect as
|
|
103886
|
+
import { memo as memo63, useEffect as useEffect165, useRef as useRef192 } from "react";
|
|
103651
103887
|
import {
|
|
103652
103888
|
ArrowsOutLineHorizontal,
|
|
103653
103889
|
FrameCorners as FrameCorners2,
|
|
@@ -103658,7 +103894,7 @@ import {
|
|
|
103658
103894
|
} from "@phosphor-icons/react";
|
|
103659
103895
|
|
|
103660
103896
|
// src/hooks/useKeyframeKeyboard.ts
|
|
103661
|
-
import { useEffect as
|
|
103897
|
+
import { useEffect as useEffect164, useCallback as useCallback193 } from "react";
|
|
103662
103898
|
import { isTypingTarget as isTypingTarget9 } from "@hyperframes/core/typing-target";
|
|
103663
103899
|
function useKeyframeKeyboard({ enabled, onAddKeyframe }) {
|
|
103664
103900
|
const handler = useCallback193(
|
|
@@ -103672,7 +103908,7 @@ function useKeyframeKeyboard({ enabled, onAddKeyframe }) {
|
|
|
103672
103908
|
},
|
|
103673
103909
|
[enabled, onAddKeyframe]
|
|
103674
103910
|
);
|
|
103675
|
-
|
|
103911
|
+
useEffect164(() => {
|
|
103676
103912
|
if (!enabled) return;
|
|
103677
103913
|
window.addEventListener("keydown", handler, { capture: true });
|
|
103678
103914
|
return () => window.removeEventListener("keydown", handler, { capture: true });
|
|
@@ -103848,7 +104084,7 @@ function TimelineToolPicker({ showSelectAroundPlayhead = true }) {
|
|
|
103848
104084
|
}
|
|
103849
104085
|
|
|
103850
104086
|
// src/components/LinkedSelectionToggle.tsx
|
|
103851
|
-
import { useCallback as useCallback194, useState as
|
|
104087
|
+
import { useCallback as useCallback194, useState as useState170 } from "react";
|
|
103852
104088
|
import { createPortal as createPortal16 } from "react-dom";
|
|
103853
104089
|
import { LinkSimple } from "@phosphor-icons/react";
|
|
103854
104090
|
import { Fragment as Fragment72, jsx as jsx262, jsxs as jsxs208 } from "react/jsx-runtime";
|
|
@@ -103891,7 +104127,7 @@ function SyncIndicatorMenu({ x, y, onClose }) {
|
|
|
103891
104127
|
function LinkedSelectionToggle() {
|
|
103892
104128
|
const linkedSelection = useLinkedClipPreferences((s) => s.linkedSelection);
|
|
103893
104129
|
const setLinkedSelection = useLinkedClipPreferences((s) => s.setLinkedSelection);
|
|
103894
|
-
const [menuAt, setMenuAt] =
|
|
104130
|
+
const [menuAt, setMenuAt] = useState170(null);
|
|
103895
104131
|
const closeMenu = useCallback194(() => setMenuAt(null), []);
|
|
103896
104132
|
return /* @__PURE__ */ jsxs208(Fragment72, { children: [
|
|
103897
104133
|
/* @__PURE__ */ jsx262(
|
|
@@ -104028,10 +104264,10 @@ var TimelineToolbar = memo63(function TimelineToolbar2({
|
|
|
104028
104264
|
enabled: showKeyframes && Boolean(onToggleKeyframe),
|
|
104029
104265
|
onAddKeyframe: onToggleKeyframe
|
|
104030
104266
|
});
|
|
104031
|
-
|
|
104267
|
+
useEffect165(() => {
|
|
104032
104268
|
if (!showKeyframes) setAutoKeyframeEnabled(false);
|
|
104033
104269
|
}, [showKeyframes, setAutoKeyframeEnabled]);
|
|
104034
|
-
|
|
104270
|
+
useEffect165(() => {
|
|
104035
104271
|
const onKeyDown = (e) => {
|
|
104036
104272
|
if (!matchesKey(e, "timelineSnap")) return;
|
|
104037
104273
|
if (isTypingTarget10(e.target)) return;
|
|
@@ -104334,7 +104570,7 @@ function StudioSplash({ waiting }) {
|
|
|
104334
104570
|
}
|
|
104335
104571
|
|
|
104336
104572
|
// src/hooks/useServerConnection.ts
|
|
104337
|
-
import { useEffect as
|
|
104573
|
+
import { useEffect as useEffect166, useState as useState171 } from "react";
|
|
104338
104574
|
async function resolveHashProject(id) {
|
|
104339
104575
|
try {
|
|
104340
104576
|
const res = await studioApiFetch(`/api/projects/${encodeURIComponent(id)}`);
|
|
@@ -104364,9 +104600,9 @@ function reportHashVerdict(stage, verdict) {
|
|
|
104364
104600
|
});
|
|
104365
104601
|
}
|
|
104366
104602
|
function useServerConnection() {
|
|
104367
|
-
const [projectId, setProjectId] =
|
|
104368
|
-
const [resolving, setResolving] =
|
|
104369
|
-
const [waitingForServer, setWaitingForServer] =
|
|
104603
|
+
const [projectId, setProjectId] = useState171(null);
|
|
104604
|
+
const [resolving, setResolving] = useState171(true);
|
|
104605
|
+
const [waitingForServer, setWaitingForServer] = useState171(false);
|
|
104370
104606
|
useMountEffect(() => {
|
|
104371
104607
|
const hashProjectId = parseProjectIdFromHash(window.location.hash);
|
|
104372
104608
|
let cancelled = false;
|
|
@@ -104408,7 +104644,7 @@ function useServerConnection() {
|
|
|
104408
104644
|
if (retryTimer !== null) clearTimeout(retryTimer);
|
|
104409
104645
|
};
|
|
104410
104646
|
});
|
|
104411
|
-
|
|
104647
|
+
useEffect166(() => {
|
|
104412
104648
|
const onHashChange = () => {
|
|
104413
104649
|
const next = parseProjectIdFromHash(window.location.hash);
|
|
104414
104650
|
if (!next || next === projectId) return;
|
|
@@ -104434,9 +104670,9 @@ function useServerConnection() {
|
|
|
104434
104670
|
}
|
|
104435
104671
|
|
|
104436
104672
|
// src/hooks/useStudioSessionStart.ts
|
|
104437
|
-
import { useEffect as
|
|
104673
|
+
import { useEffect as useEffect167 } from "react";
|
|
104438
104674
|
function useStudioSessionStart(projectId, resolving, waitingForServer) {
|
|
104439
|
-
|
|
104675
|
+
useEffect167(() => {
|
|
104440
104676
|
if (resolving || waitingForServer || hasFiredSessionStart()) return;
|
|
104441
104677
|
markSessionStartFired();
|
|
104442
104678
|
trackStudioSessionStart({ has_project: projectId != null });
|
|
@@ -104460,10 +104696,10 @@ function useTimelineAddAtPlayhead(addAsset, addComposition, projectId) {
|
|
|
104460
104696
|
}
|
|
104461
104697
|
|
|
104462
104698
|
// src/hooks/useActiveComposition.ts
|
|
104463
|
-
import { useState as
|
|
104699
|
+
import { useState as useState172 } from "react";
|
|
104464
104700
|
|
|
104465
104701
|
// src/hooks/useHydrateActiveCompPathFromUrl.ts
|
|
104466
|
-
import { useEffect as
|
|
104702
|
+
import { useEffect as useEffect168 } from "react";
|
|
104467
104703
|
function useHydrateActiveCompPathFromUrl({
|
|
104468
104704
|
hydrated,
|
|
104469
104705
|
fileTreeLoaded,
|
|
@@ -104472,7 +104708,7 @@ function useHydrateActiveCompPathFromUrl({
|
|
|
104472
104708
|
setActiveCompPath,
|
|
104473
104709
|
setHydrated
|
|
104474
104710
|
}) {
|
|
104475
|
-
|
|
104711
|
+
useEffect168(() => {
|
|
104476
104712
|
if (hydrated) return;
|
|
104477
104713
|
if (!fileTreeLoaded) return;
|
|
104478
104714
|
const nextCompPath = normalizeStudioCompositionPath(
|
|
@@ -104485,7 +104721,7 @@ function useHydrateActiveCompPathFromUrl({
|
|
|
104485
104721
|
}
|
|
104486
104722
|
|
|
104487
104723
|
// src/hooks/useAutoOpenRootComposition.ts
|
|
104488
|
-
import { useEffect as
|
|
104724
|
+
import { useEffect as useEffect169, useRef as useRef193 } from "react";
|
|
104489
104725
|
function useAutoOpenRootComposition({
|
|
104490
104726
|
projectId,
|
|
104491
104727
|
activeCompPath,
|
|
@@ -104494,7 +104730,7 @@ function useAutoOpenRootComposition({
|
|
|
104494
104730
|
onSelectComposition
|
|
104495
104731
|
}) {
|
|
104496
104732
|
const settledForProjectRef = useRef193(void 0);
|
|
104497
|
-
|
|
104733
|
+
useEffect169(() => {
|
|
104498
104734
|
if (settledForProjectRef.current === projectId) return;
|
|
104499
104735
|
if (!activeCompPathHydrated) return;
|
|
104500
104736
|
if (activeCompPath !== null) {
|
|
@@ -104564,8 +104800,8 @@ function useActiveComposition({
|
|
|
104564
104800
|
setEditingFile,
|
|
104565
104801
|
showToast
|
|
104566
104802
|
}) {
|
|
104567
|
-
const [activeCompPath, setActiveCompPath] =
|
|
104568
|
-
const [activeCompPathHydrated, setActiveCompPathHydrated] =
|
|
104803
|
+
const [activeCompPath, setActiveCompPath] = useState172(null);
|
|
104804
|
+
const [activeCompPathHydrated, setActiveCompPathHydrated] = useState172(
|
|
104569
104805
|
() => isHydratedFromUrlState(initialUrlStateRef.current)
|
|
104570
104806
|
);
|
|
104571
104807
|
useResetSelectionOnProjectSwitch({
|
|
@@ -104605,12 +104841,12 @@ function StudioApp({ readOnlyPreview = false, readOnlyPreviewReason } = {}) {
|
|
|
104605
104841
|
const { projectId, resolving, waitingForServer } = useServerConnection();
|
|
104606
104842
|
const initialUrlStateRef = useRef195(readStudioUrlStateFromWindow());
|
|
104607
104843
|
useStudioSessionStart(projectId, resolving, waitingForServer);
|
|
104608
|
-
const [compIdToSrc, setCompIdToSrc] =
|
|
104844
|
+
const [compIdToSrc, setCompIdToSrc] = useState173(/* @__PURE__ */ new Map());
|
|
104609
104845
|
const previewIframe = useOwnPreviewIframe();
|
|
104610
|
-
const [compositionLoading, setCompositionLoading] =
|
|
104611
|
-
const [refreshKey, setRefreshKeyState] =
|
|
104846
|
+
const [compositionLoading, setCompositionLoading] = useState173(true);
|
|
104847
|
+
const [refreshKey, setRefreshKeyState] = useState173(0);
|
|
104612
104848
|
const [previewDocumentVersion, refreshPreviewDocumentVersion] = usePreviewDocumentVersion();
|
|
104613
|
-
const [blockPreview, setBlockPreview] =
|
|
104849
|
+
const [blockPreview, setBlockPreview] = useState173(null);
|
|
104614
104850
|
const previewIframeRef = useRef195(null);
|
|
104615
104851
|
const captionEditMode = useCaptionStore((s) => s.isEditMode);
|
|
104616
104852
|
const captionHasSelection = useCaptionStore((s) => s.selectedSegmentIds.size > 0);
|
|
@@ -105115,7 +105351,7 @@ function StudioApp({ readOnlyPreview = false, readOnlyPreviewReason } = {}) {
|
|
|
105115
105351
|
}
|
|
105116
105352
|
|
|
105117
105353
|
// src/hooks/useElementPicker.ts
|
|
105118
|
-
import { useState as
|
|
105354
|
+
import { useState as useState174, useCallback as useCallback198, useEffect as useEffect170, useRef as useRef196 } from "react";
|
|
105119
105355
|
|
|
105120
105356
|
// src/hooks/elementPickerStyles.ts
|
|
105121
105357
|
var PICKED_STYLE_PROPERTIES = [
|
|
@@ -105317,7 +105553,7 @@ function useActivePickerIframe(iframeRef, isPickModeRef, clearHover) {
|
|
|
105317
105553
|
[clearHover, iframeRef, isPickModeRef]
|
|
105318
105554
|
);
|
|
105319
105555
|
const renderedActiveIframe = getActiveIframe();
|
|
105320
|
-
|
|
105556
|
+
useEffect170(() => {
|
|
105321
105557
|
const previous = lastRenderedActiveIframeRef.current;
|
|
105322
105558
|
if (previous !== renderedActiveIframe) {
|
|
105323
105559
|
clearHover();
|
|
@@ -105332,8 +105568,8 @@ function useActivePickerIframe(iframeRef, isPickModeRef, clearHover) {
|
|
|
105332
105568
|
return { activeIframeRef, getActiveIframe, setActiveIframe };
|
|
105333
105569
|
}
|
|
105334
105570
|
function useElementPickerSession(iframeRef) {
|
|
105335
|
-
const [isPickMode, setIsPickMode] =
|
|
105336
|
-
const [pickedElement, setPickedElement] =
|
|
105571
|
+
const [isPickMode, setIsPickMode] = useState174(false);
|
|
105572
|
+
const [pickedElement, setPickedElement] = useState174(null);
|
|
105337
105573
|
const isPickModeRef = useRef196(false);
|
|
105338
105574
|
const pickedElementRef = useRef196(null);
|
|
105339
105575
|
pickedElementRef.current = pickedElement;
|
|
@@ -105384,7 +105620,7 @@ function useElementPickerSession(iframeRef) {
|
|
|
105384
105620
|
setPickedElement(filled);
|
|
105385
105621
|
});
|
|
105386
105622
|
}, []);
|
|
105387
|
-
|
|
105623
|
+
useEffect170(() => {
|
|
105388
105624
|
if (!isPickMode) return;
|
|
105389
105625
|
const handleKeyDown = (event) => {
|
|
105390
105626
|
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing || elementOwnsEscape(event.target))
|
|
@@ -105768,7 +106004,7 @@ function findElementBlock(html2, elementId2) {
|
|
|
105768
106004
|
}
|
|
105769
106005
|
|
|
105770
106006
|
// src/hooks/useDomStyleCommit.ts
|
|
105771
|
-
import { useCallback as useCallback199, useMemo as useMemo92, useRef as useRef197, useState as
|
|
106007
|
+
import { useCallback as useCallback199, useMemo as useMemo92, useRef as useRef197, useState as useState175 } from "react";
|
|
105772
106008
|
var noop = () => {
|
|
105773
106009
|
};
|
|
105774
106010
|
function useDomStyleCommit({
|
|
@@ -105781,7 +106017,7 @@ function useDomStyleCommit({
|
|
|
105781
106017
|
}) {
|
|
105782
106018
|
const projectIdRef = useRef197(projectId);
|
|
105783
106019
|
projectIdRef.current = projectId;
|
|
105784
|
-
const [queue2] =
|
|
106020
|
+
const [queue2] = useState175(createDomEditSaveQueue);
|
|
105785
106021
|
useMountEffect(() => () => queue2.destroy());
|
|
105786
106022
|
const versions = useRef197(/* @__PURE__ */ new Map()).current;
|
|
105787
106023
|
const editHistory = useMemo92(() => ({ recordEdit }), [recordEdit]);
|
|
@@ -105816,7 +106052,7 @@ function useDomStyleCommit({
|
|
|
105816
106052
|
}
|
|
105817
106053
|
|
|
105818
106054
|
// src/hooks/useDomGeometryCommit.ts
|
|
105819
|
-
import { useCallback as useCallback200, useMemo as useMemo93, useRef as useRef198, useState as
|
|
106055
|
+
import { useCallback as useCallback200, useMemo as useMemo93, useRef as useRef198, useState as useState176 } from "react";
|
|
105820
106056
|
var noop2 = () => {
|
|
105821
106057
|
};
|
|
105822
106058
|
var NO_SELECTED_ANIMATIONS = [];
|
|
@@ -105844,7 +106080,7 @@ function useDomGeometryCommit({
|
|
|
105844
106080
|
showToast,
|
|
105845
106081
|
writeProjectFile
|
|
105846
106082
|
});
|
|
105847
|
-
const [queue2] =
|
|
106083
|
+
const [queue2] = useState176(createDomEditSaveQueue);
|
|
105848
106084
|
useMountEffect(() => () => queue2.destroy());
|
|
105849
106085
|
const persistDomEditOperations = useDomEditPersist({
|
|
105850
106086
|
activeCompPath,
|