@hyperframes/studio 0.9.42 → 0.9.44
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/{codec-CKqLGYc6.js → codec-DYhkxayl.js} +1 -1
- package/dist/assets/{hyperframes-player-DoEYqOIa.js → hyperframes-player-pPwFQY2W.js} +1 -1
- package/dist/assets/{index-4VGEAZyf.css → index-CU24FmKd.css} +1 -1
- package/dist/assets/{index-DLyQ91Ek.js → index-Crhhpl7F.js} +133 -133
- package/dist/assets/{index-s9iqoWnr.js → index-Cv1BkoPn.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-B-ReRg6i.js → pausedVideoDecoder-Cns-60-8.js} +1 -1
- package/dist/{chunk-4QQMX4BX.js → chunk-67DSVBEI.js} +1 -1
- package/dist/{chunk-52AJB4PN.js → chunk-ZNUWV4FN.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/index.js +790 -709
- package/dist/player.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/ui.js +1 -1
- package/package.json +8 -8
- package/src/components/StudioOverlays.tsx +15 -13
- package/src/components/StudioToast.test.tsx +41 -0
- package/src/components/StudioToast.tsx +23 -39
- package/src/components/editor/domEditOverlayGeometry.ts +2 -0
- package/src/components/editor/domEditOverlayStartGesture.ts +31 -7
- package/src/components/editor/manualOffsetDrag.ts +10 -5
- package/src/components/editor/plainTranslate.ts +2 -0
- package/src/components/editor/previewGestureStartRead.test.ts +279 -0
- package/src/components/editor/previewGestureStartRead.ts +67 -0
- package/src/components/editor/previewGestureStarts.ts +21 -15
- package/src/components/editor/previewOverlayRects.test.ts +62 -0
- package/src/components/editor/previewOverlayRects.ts +8 -20
- package/src/components/editor/snapTargetCollection.ts +26 -62
- package/src/components/feedback/StudioFeedbackCard.tsx +5 -2
- package/src/components/ui/Menu.test.tsx +30 -1
- package/src/components/ui/Menu.tsx +1 -1
- package/src/hooks/timelineEditingHelpers.test.ts +48 -0
- package/src/hooks/timelineEditingHelpers.ts +2 -0
- package/src/hooks/timelineElementsAttribute.test.ts +46 -0
- package/src/hooks/timelineElementsAttribute.ts +14 -16
- package/src/hooks/timelineTrackVisibility.test.ts +34 -0
- package/src/hooks/useElementPicker.test.ts +9 -2
- package/src/hooks/useElementPicker.ts +4 -2
- package/src/hooks/useToast.ts +6 -18
- package/src/player/lib/previewElements.ts +37 -0
- package/src/player/lib/thumbnailFrameSink.test.ts +92 -0
- package/src/player/lib/thumbnailFrameSink.ts +83 -0
- package/src/player/lib/thumbnailVideoDecoder.test.ts +43 -16
- package/src/player/lib/thumbnailVideoDecoder.ts +6 -6
- package/src/styles/components.css +19 -1
- package/src/styles/theme.css +3 -0
- package/src/utils/previewSafeMargins.ts +6 -10
- package/src/utils/sourcePatcher.test.ts +21 -0
- package/src/utils/sourcePatcher.ts +16 -8
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
whileScriptWrites,
|
|
90
90
|
writeStudioUiPreferences,
|
|
91
91
|
zoomToSelectedClips
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-67DSVBEI.js";
|
|
93
93
|
import {
|
|
94
94
|
Button,
|
|
95
95
|
ContextMenu,
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
fieldBase,
|
|
122
122
|
fieldText,
|
|
123
123
|
popupSurface
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-ZNUWV4FN.js";
|
|
125
125
|
import {
|
|
126
126
|
DEFAULT_STUDIO_KEYS,
|
|
127
127
|
comboClashKey,
|
|
@@ -16977,6 +16977,7 @@ import {
|
|
|
16977
16977
|
decodeAuthoredAttribute,
|
|
16978
16978
|
HTML_ATTRIBUTE_ENTITIES
|
|
16979
16979
|
} from "@hyperframes/parsers";
|
|
16980
|
+
import { stampHfIdsInPlace } from "@hyperframes/parsers/hf-ids";
|
|
16980
16981
|
function escapeRegex(s) {
|
|
16981
16982
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16982
16983
|
}
|
|
@@ -17143,6 +17144,11 @@ function findTagByClass(html2, target) {
|
|
|
17143
17144
|
})[target.selectorIndex ?? 0];
|
|
17144
17145
|
return found ? { tag: html2.slice(found.start, found.bodyEnd), start: found.start, end: found.bodyEnd } : null;
|
|
17145
17146
|
}
|
|
17147
|
+
function servedSource(html2, target) {
|
|
17148
|
+
if (!target.hfId || findTagByTarget(html2, target)) return html2;
|
|
17149
|
+
const stamped = stampHfIdsInPlace(html2);
|
|
17150
|
+
return findTagByTarget(stamped, target) ? stamped : html2;
|
|
17151
|
+
}
|
|
17146
17152
|
function findTagByTarget(html2, target) {
|
|
17147
17153
|
if (target.hfId) {
|
|
17148
17154
|
const result = findTagByAttribute(html2, "data-hf-id", target.hfId);
|
|
@@ -17161,7 +17167,7 @@ function findTagByTarget(html2, target) {
|
|
|
17161
17167
|
return findTagByClass(html2, target);
|
|
17162
17168
|
}
|
|
17163
17169
|
function readAttributeByTarget(html2, target, attr2) {
|
|
17164
|
-
const match = findTagByTarget(html2, target);
|
|
17170
|
+
const match = findTagByTarget(servedSource(html2, target), target);
|
|
17165
17171
|
if (!match) return void 0;
|
|
17166
17172
|
return readTagAttribute(match.tag, attr2.startsWith("data-") ? attr2 : `data-${attr2}`);
|
|
17167
17173
|
}
|
|
@@ -17170,7 +17176,7 @@ function readTagAttribute(tag, attr2) {
|
|
|
17170
17176
|
return value?.kind === "value" ? decodeAuthoredAttribute(value.value) : void 0;
|
|
17171
17177
|
}
|
|
17172
17178
|
function readTagSnippetByTarget(html2, target) {
|
|
17173
|
-
const match = findTagByTarget(html2, target);
|
|
17179
|
+
const match = findTagByTarget(servedSource(html2, target), target);
|
|
17174
17180
|
return match?.tag;
|
|
17175
17181
|
}
|
|
17176
17182
|
function patchAttributeByTarget(html2, target, attr2, value) {
|
|
@@ -17266,21 +17272,22 @@ function applyPatch(html2, elementId2, op) {
|
|
|
17266
17272
|
}
|
|
17267
17273
|
}
|
|
17268
17274
|
function applyPatchByTarget(html2, target, op) {
|
|
17275
|
+
const source = servedSource(html2, target);
|
|
17269
17276
|
if (target.id) {
|
|
17270
|
-
const patchedById = applyPatch(
|
|
17271
|
-
if (patchedById !==
|
|
17277
|
+
const patchedById = applyPatch(source, target.id, op);
|
|
17278
|
+
if (patchedById !== source || !target.selector && !target.hfId) {
|
|
17272
17279
|
return patchedById;
|
|
17273
17280
|
}
|
|
17274
17281
|
}
|
|
17275
17282
|
switch (op.type) {
|
|
17276
17283
|
case "inline-style":
|
|
17277
|
-
return patchInlineStyleByTarget(
|
|
17284
|
+
return patchInlineStyleByTarget(source, target, op.property, op.value);
|
|
17278
17285
|
case "attribute":
|
|
17279
|
-
return patchAttributeByTarget(
|
|
17286
|
+
return patchAttributeByTarget(source, target, op.property, op.value);
|
|
17280
17287
|
case "html-attribute":
|
|
17281
|
-
return patchHtmlAttributeByTarget(
|
|
17288
|
+
return patchHtmlAttributeByTarget(source, target, op.property, op.value);
|
|
17282
17289
|
case "text-content":
|
|
17283
|
-
return op.value !== null ? patchTextContentByTarget(
|
|
17290
|
+
return op.value !== null ? patchTextContentByTarget(source, target, op.value) : html2;
|
|
17284
17291
|
default:
|
|
17285
17292
|
return html2;
|
|
17286
17293
|
}
|
|
@@ -18815,6 +18822,7 @@ function patchTimelineChangesInSource(source, targetPath, changes) {
|
|
|
18815
18822
|
for (const { element, buildPatches } of changes) {
|
|
18816
18823
|
const target = buildPatchTarget(element);
|
|
18817
18824
|
if (!target) throw new Error(`Timeline element ${element.id} is missing a patchable target`);
|
|
18825
|
+
current2 = servedSource(current2, target);
|
|
18818
18826
|
if (!findTagByTarget(current2, target)) {
|
|
18819
18827
|
throw new Error(
|
|
18820
18828
|
`Unable to patch timeline element ${element.id} in ${targetPath} (${missedLookups(element, target)})`
|
|
@@ -27887,6 +27895,54 @@ function bindThumbnailPlaybackHold(store, scheduler) {
|
|
|
27887
27895
|
return store.subscribe((state) => scheduler.setPlaybackActive(state.isPlaying));
|
|
27888
27896
|
}
|
|
27889
27897
|
|
|
27898
|
+
// src/player/lib/thumbnailFrameSink.ts
|
|
27899
|
+
function newCanvas({ width, height }) {
|
|
27900
|
+
if (typeof document === "undefined") return new OffscreenCanvas(width, height);
|
|
27901
|
+
const canvas = document.createElement("canvas");
|
|
27902
|
+
canvas.width = width;
|
|
27903
|
+
canvas.height = height;
|
|
27904
|
+
return canvas;
|
|
27905
|
+
}
|
|
27906
|
+
function coverCrop(source, target) {
|
|
27907
|
+
const scale = Math.max(target.width / source.width, target.height / source.height);
|
|
27908
|
+
const width = Math.min(source.width, target.width / scale);
|
|
27909
|
+
const height = Math.min(source.height, target.height / scale);
|
|
27910
|
+
return { x: (source.width - width) / 2, y: (source.height - height) / 2, width, height };
|
|
27911
|
+
}
|
|
27912
|
+
async function drawScaled(sample, context, target, fit) {
|
|
27913
|
+
const frame3 = sample.toVideoFrame();
|
|
27914
|
+
const source = { width: frame3.displayWidth, height: frame3.displayHeight };
|
|
27915
|
+
const crop = fit === "cover" ? coverCrop(source, target) : { x: 0, y: 0, ...source };
|
|
27916
|
+
const bitmap = await createImageBitmap(frame3, crop.x, crop.y, crop.width, crop.height, {
|
|
27917
|
+
resizeWidth: target.width,
|
|
27918
|
+
resizeHeight: target.height,
|
|
27919
|
+
resizeQuality: "medium"
|
|
27920
|
+
}).finally(() => frame3.close());
|
|
27921
|
+
try {
|
|
27922
|
+
context.drawImage(bitmap, 0, 0, target.width, target.height);
|
|
27923
|
+
} finally {
|
|
27924
|
+
bitmap.close();
|
|
27925
|
+
}
|
|
27926
|
+
}
|
|
27927
|
+
async function* scaledFrames(sink, times, target, fit) {
|
|
27928
|
+
for await (const sample of sink.samplesAtTimestamps(times)) {
|
|
27929
|
+
if (!sample) {
|
|
27930
|
+
yield null;
|
|
27931
|
+
continue;
|
|
27932
|
+
}
|
|
27933
|
+
try {
|
|
27934
|
+
const canvas = newCanvas(target);
|
|
27935
|
+
const context = canvas.getContext("2d");
|
|
27936
|
+
if (!context) throw new Error("Thumbnail canvas has no 2d context");
|
|
27937
|
+
if (sample.rotation === 0 && !sample.flipped) await drawScaled(sample, context, target, fit);
|
|
27938
|
+
else sample.drawWithFit(context, { fit });
|
|
27939
|
+
yield { canvas };
|
|
27940
|
+
} finally {
|
|
27941
|
+
sample.close();
|
|
27942
|
+
}
|
|
27943
|
+
}
|
|
27944
|
+
}
|
|
27945
|
+
|
|
27890
27946
|
// src/player/lib/thumbnailSourcePool.ts
|
|
27891
27947
|
var pool = /* @__PURE__ */ new Map();
|
|
27892
27948
|
var mediabunnyModule = null;
|
|
@@ -28441,12 +28497,10 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
|
|
|
28441
28497
|
}
|
|
28442
28498
|
}
|
|
28443
28499
|
const target = targetDimensions(info.aspect, budgets);
|
|
28444
|
-
const
|
|
28445
|
-
|
|
28446
|
-
|
|
28447
|
-
|
|
28448
|
-
poolSize: 1
|
|
28449
|
-
});
|
|
28500
|
+
const frames = new mediabunny.VideoSampleSink(track2);
|
|
28501
|
+
const sink = {
|
|
28502
|
+
canvasesAtTimestamps: (timestamps2) => scaledFrames(frames, timestamps2, target, request2.fit ?? "cover")
|
|
28503
|
+
};
|
|
28450
28504
|
const times = decodeTimesAtNearbyKeyframes();
|
|
28451
28505
|
await decodeFrames(sink, times, slots, signal, resources, source.progress);
|
|
28452
28506
|
}
|
|
@@ -35066,12 +35120,12 @@ function useDomEditCompositionRect({
|
|
|
35066
35120
|
}
|
|
35067
35121
|
|
|
35068
35122
|
// src/utils/previewSafeMargins.ts
|
|
35069
|
-
|
|
35070
|
-
|
|
35071
|
-
|
|
35072
|
-
|
|
35073
|
-
|
|
35074
|
-
}
|
|
35123
|
+
import {
|
|
35124
|
+
ACTION_SAFE_PERCENT,
|
|
35125
|
+
SAFE_BOX_PERCENTS,
|
|
35126
|
+
TITLE_SAFE_PERCENT,
|
|
35127
|
+
safeBoxInsetPercent
|
|
35128
|
+
} from "@hyperframes/core/safe-areas";
|
|
35075
35129
|
|
|
35076
35130
|
// src/components/editor/PreviewOverlayProvider.tsx
|
|
35077
35131
|
import { createContext as createContext6, useContext as useContext10, useRef as useRef59, useState as useState43 } from "react";
|
|
@@ -38379,7 +38433,8 @@ import {
|
|
|
38379
38433
|
MAX_DESCRIBE_HANDLES,
|
|
38380
38434
|
MAX_ELEMENT_ENTRIES,
|
|
38381
38435
|
MAX_ELEMENT_VALUE,
|
|
38382
|
-
MAX_GEOMETRY_CHILDREN
|
|
38436
|
+
MAX_GEOMETRY_CHILDREN,
|
|
38437
|
+
MAX_SNAP_TARGETS
|
|
38383
38438
|
} from "@hyperframes/core/runtime/editing-port";
|
|
38384
38439
|
var isFields = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
38385
38440
|
var isHandle = (value) => typeof value === "string" && EDITING_ELEMENT_HANDLE.test(value);
|
|
@@ -38475,6 +38530,27 @@ async function previewGeometry(iframe, handles, children) {
|
|
|
38475
38530
|
children: children && childrenOk ? boxes : null
|
|
38476
38531
|
};
|
|
38477
38532
|
}
|
|
38533
|
+
var isFlag = (value) => typeof value === "boolean";
|
|
38534
|
+
var isFiniteFields = (value, keys) => isFields(value) && keys.every((key2) => Number.isFinite(value[key2]));
|
|
38535
|
+
var readGestureStart = (value) => {
|
|
38536
|
+
if (!readGeometry(value) || !isFields(value)) return null;
|
|
38537
|
+
const { layout, move, gsap: gsap3 } = value;
|
|
38538
|
+
const valid = [
|
|
38539
|
+
isFiniteFields(layout, ["width", "height"]),
|
|
38540
|
+
move === null || isFiniteFields(move, ["a", "b", "c", "d"]),
|
|
38541
|
+
gsap3 === null || isFields(gsap3) && isFiniteFields(gsap3, ["x", "y"]) && isFlag(gsap3.moving)
|
|
38542
|
+
];
|
|
38543
|
+
return valid.includes(false) ? null : value;
|
|
38544
|
+
};
|
|
38545
|
+
async function previewGestureStart(iframe, handles) {
|
|
38546
|
+
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES) return null;
|
|
38547
|
+
const reply = await previewRequest(iframe, "gesture-start", { handles: [...handles] });
|
|
38548
|
+
const elements = reply?.elements;
|
|
38549
|
+
const snap = reply?.snap;
|
|
38550
|
+
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
38551
|
+
if (!Array.isArray(snap) || snap.length > MAX_SNAP_TARGETS || !snap.every(isBox)) return null;
|
|
38552
|
+
return { elements: elements.map(readGestureStart), snap };
|
|
38553
|
+
}
|
|
38478
38554
|
var LAYER_KINDS = /* @__PURE__ */ new Set(["image", "video", "audio", "vector", "group", "text", "shape"]);
|
|
38479
38555
|
var isLayer = (value) => isFields(value) && isHandle(value.handle) && isCount(value.depth) && isCount(value.childCount) && Number.isFinite(value.zIndex) && LAYER_KINDS.has(value.kind);
|
|
38480
38556
|
async function previewLayers(iframe, group, offset = 0) {
|
|
@@ -38513,6 +38589,10 @@ function groupAwareRect(scale, geometry, oriented) {
|
|
|
38513
38589
|
const union = resolveDomEditGroupOverlayRect(members);
|
|
38514
38590
|
return union ? { ...union, editScaleX: rect.editScaleX, editScaleY: rect.editScaleY } : rect;
|
|
38515
38591
|
}
|
|
38592
|
+
function flatVisibleRect(scale, box) {
|
|
38593
|
+
const rect = baseRect(scale, box);
|
|
38594
|
+
return { ...rect, ...hugRectForClipPath(rect, box.clipPath) };
|
|
38595
|
+
}
|
|
38516
38596
|
function visibleRect(scale, box) {
|
|
38517
38597
|
const rect = orientedRect(scale, box);
|
|
38518
38598
|
return { ...rect, ...hugRectForClipPath(rect, box.clipPath) };
|
|
@@ -38539,12 +38619,6 @@ async function measurePreviewOverlay(iframe, overlayEl, targets) {
|
|
|
38539
38619
|
hover: hovered && groupAwareRect(scale, hovered, true)
|
|
38540
38620
|
};
|
|
38541
38621
|
}
|
|
38542
|
-
async function measurePreviewRects(iframe, overlayEl, handles) {
|
|
38543
|
-
const reply = await previewGeometry(iframe, handles);
|
|
38544
|
-
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
38545
|
-
if (!reply || !scale) return null;
|
|
38546
|
-
return reply.elements.map((geometry) => geometry && groupAwareRect(scale, geometry, true));
|
|
38547
|
-
}
|
|
38548
38622
|
async function measurePreviewVisibleRects(iframe, overlayEl, handles) {
|
|
38549
38623
|
const measured = [];
|
|
38550
38624
|
for (let at = 0; at < handles.length; at += MAX_DESCRIBE_HANDLES2) {
|
|
@@ -38552,13 +38626,8 @@ async function measurePreviewVisibleRects(iframe, overlayEl, handles) {
|
|
|
38552
38626
|
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
38553
38627
|
if (!reply || !scale) return null;
|
|
38554
38628
|
for (const box of reply.elements) {
|
|
38555
|
-
const rect = box && baseRect(scale, box);
|
|
38556
38629
|
measured.push(
|
|
38557
|
-
box && rect
|
|
38558
|
-
rect: { ...rect, ...hugRectForClipPath(rect, box.clipPath) },
|
|
38559
|
-
frame: box.rect,
|
|
38560
|
-
visible: box.visible
|
|
38561
|
-
}
|
|
38630
|
+
box && { rect: flatVisibleRect(scale, box), frame: box.rect, visible: box.visible }
|
|
38562
38631
|
);
|
|
38563
38632
|
}
|
|
38564
38633
|
}
|
|
@@ -38780,6 +38849,7 @@ function readTranslatePxLeavingPercent(el) {
|
|
|
38780
38849
|
return { x: px(x), y: px(y) };
|
|
38781
38850
|
}
|
|
38782
38851
|
var UNREADABLE_TRANSLATE = "Studio can't read this layer's translate. Move it in the Code tab.";
|
|
38852
|
+
var MOVING_LAYER_UNREADABLE = "This preview can't save a move of a layer its animation moves yet. Move it in the Code tab.";
|
|
38783
38853
|
function formatTranslatePx(p) {
|
|
38784
38854
|
return `${roundTo3(p.x)}px ${roundTo3(p.y)}px`;
|
|
38785
38855
|
}
|
|
@@ -40815,14 +40885,15 @@ function resolveManualOffsetForPointerDelta(input) {
|
|
|
40815
40885
|
};
|
|
40816
40886
|
}
|
|
40817
40887
|
function createManualOffsetDragMember(input) {
|
|
40818
|
-
const
|
|
40888
|
+
const { start, gesture } = input;
|
|
40889
|
+
const plainTranslate = start && gesture !== "resize" ? !start.gsap : !!gesture && editsPlainCss(input.element, gesture === "resize" ? "resize" : "move");
|
|
40819
40890
|
const initialOffset = plainTranslate ? readTranslatePx(input.element) : readAppliedStudioPathOffset(input.element);
|
|
40820
40891
|
if (!finitePoint(initialOffset))
|
|
40821
40892
|
return { ok: false, reason: UNREADABLE_TRANSLATE, selection: input.selection };
|
|
40822
40893
|
const win = input.element.ownerDocument.defaultView;
|
|
40823
40894
|
const gsapX = !plainTranslate && win?.gsap?.getProperty?.(input.element, "x") || 0;
|
|
40824
40895
|
const gsapY = !plainTranslate && win?.gsap?.getProperty?.(input.element, "y") || 0;
|
|
40825
|
-
const baseGsap = { x: gsapX, y: gsapY };
|
|
40896
|
+
const baseGsap = start?.gsap ? { x: start.gsap.x, y: start.gsap.y } : { x: gsapX, y: gsapY };
|
|
40826
40897
|
if (!plainTranslate) stampGestureBase(input.element, initialOffset, baseGsap);
|
|
40827
40898
|
if (win?.__timelines) {
|
|
40828
40899
|
const paused = [];
|
|
@@ -40866,7 +40937,7 @@ function createManualOffsetDragMember(input) {
|
|
|
40866
40937
|
baseGsap,
|
|
40867
40938
|
initialPathOffset,
|
|
40868
40939
|
gestureToken,
|
|
40869
|
-
screenToOffset: { a: w / scaleX, b: 0, c: 0, d: w / scaleY },
|
|
40940
|
+
screenToOffset: start?.screenToOffset ?? { a: w / scaleX, b: 0, c: 0, d: w / scaleY },
|
|
40870
40941
|
originRect: input.rect
|
|
40871
40942
|
}
|
|
40872
40943
|
};
|
|
@@ -41152,6 +41223,9 @@ function readRotationBase(element, plain) {
|
|
|
41152
41223
|
return gsapRotation + readStudioRotation(element).angle;
|
|
41153
41224
|
}
|
|
41154
41225
|
|
|
41226
|
+
// src/components/editor/snapTargetCollection.ts
|
|
41227
|
+
import { snapCandidates } from "@hyperframes/core/runtime/editing-port";
|
|
41228
|
+
|
|
41155
41229
|
// src/components/editor/snapEngine.ts
|
|
41156
41230
|
var SNAP_THRESHOLD_PX = 6;
|
|
41157
41231
|
var SNAP_ENGAGE_TRAVEL_PX = 4;
|
|
@@ -41449,30 +41523,20 @@ function readPositiveDimension2(value) {
|
|
|
41449
41523
|
const parsed = Number.parseFloat(value);
|
|
41450
41524
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
41451
41525
|
}
|
|
41452
|
-
|
|
41453
|
-
|
|
41454
|
-
|
|
41455
|
-
|
|
41456
|
-
|
|
41457
|
-
|
|
41458
|
-
|
|
41459
|
-
|
|
41460
|
-
|
|
41461
|
-
|
|
41462
|
-
|
|
41463
|
-
if (child.hasAttribute("data-composition-id")) continue;
|
|
41464
|
-
if (excludeElements.has(child)) continue;
|
|
41465
|
-
if (!isElementVisibleForOverlay(child)) continue;
|
|
41466
|
-
result.push(child);
|
|
41467
|
-
visit(child);
|
|
41468
|
-
}
|
|
41469
|
-
};
|
|
41470
|
-
visit(root);
|
|
41471
|
-
return result;
|
|
41526
|
+
function snapContextFromRects(composition, rects) {
|
|
41527
|
+
const prefs = readStudioUiPreferences();
|
|
41528
|
+
const entries = rects.flatMap((rect, i) => rect ? [{ rect, id: `snap-target-${i}` }] : []);
|
|
41529
|
+
const gridSpacing = prefs.gridSpacing ?? 50;
|
|
41530
|
+
const snapToGrid = prefs.snapToGrid ?? false;
|
|
41531
|
+
return {
|
|
41532
|
+
targets: extractSnapTargets(entries),
|
|
41533
|
+
compositionTarget: buildCompositionSnapTarget(composition),
|
|
41534
|
+
gridEdges: snapToGrid && gridSpacing > 0 ? buildGridSnapEdges(composition, gridSpacing, composition.editScaleX) : null,
|
|
41535
|
+
snapEnabled: prefs.snapEnabled ?? true
|
|
41536
|
+
};
|
|
41472
41537
|
}
|
|
41473
41538
|
function collectSnapContext(input) {
|
|
41474
|
-
const
|
|
41475
|
-
const snapEnabled = prefs.snapEnabled ?? true;
|
|
41539
|
+
const snapEnabled = readStudioUiPreferences().snapEnabled ?? true;
|
|
41476
41540
|
const doc = input.iframe.contentDocument;
|
|
41477
41541
|
if (!doc) {
|
|
41478
41542
|
return { targets: [], compositionTarget: null, gridEdges: null, snapEnabled };
|
|
@@ -41488,32 +41552,19 @@ function collectSnapContext(input) {
|
|
|
41488
41552
|
}
|
|
41489
41553
|
const iframeRect = input.iframe.getBoundingClientRect();
|
|
41490
41554
|
const overlayRect = input.overlayEl.getBoundingClientRect();
|
|
41491
|
-
const rootScaleX = iframeRect.width / rootWidth;
|
|
41492
|
-
const rootScaleY = iframeRect.height / rootHeight;
|
|
41493
41555
|
const compositionOverlayRect = {
|
|
41494
41556
|
left: iframeRect.left - overlayRect.left,
|
|
41495
41557
|
top: iframeRect.top - overlayRect.top,
|
|
41496
41558
|
width: iframeRect.width,
|
|
41497
41559
|
height: iframeRect.height,
|
|
41498
|
-
editScaleX:
|
|
41499
|
-
editScaleY:
|
|
41560
|
+
editScaleX: iframeRect.width / rootWidth,
|
|
41561
|
+
editScaleY: iframeRect.height / rootHeight
|
|
41500
41562
|
};
|
|
41501
|
-
const
|
|
41502
|
-
const
|
|
41503
|
-
|
|
41504
|
-
|
|
41505
|
-
|
|
41506
|
-
const rect = toVisibleOverlayRect(input.overlayEl, input.iframe, elements[i]);
|
|
41507
|
-
if (rect) entries.push({ rect, id: `snap-target-${i}` });
|
|
41508
|
-
}
|
|
41509
|
-
const targets = extractSnapTargets(entries);
|
|
41510
|
-
let gridEdges = null;
|
|
41511
|
-
const gridSpacing = prefs.gridSpacing ?? 50;
|
|
41512
|
-
const snapToGrid = prefs.snapToGrid ?? false;
|
|
41513
|
-
if (snapToGrid && gridSpacing > 0) {
|
|
41514
|
-
gridEdges = buildGridSnapEdges(compositionOverlayRect, gridSpacing, rootScaleX);
|
|
41515
|
-
}
|
|
41516
|
-
return { targets, compositionTarget, gridEdges, snapEnabled };
|
|
41563
|
+
const elements = snapCandidates(root, input.excludeElements);
|
|
41564
|
+
const rects = elements.map(
|
|
41565
|
+
(element) => toVisibleOverlayRect(input.overlayEl, input.iframe, element)
|
|
41566
|
+
);
|
|
41567
|
+
return snapContextFromRects(compositionOverlayRect, rects);
|
|
41517
41568
|
}
|
|
41518
41569
|
function buildExcludeElements(input) {
|
|
41519
41570
|
const elements = /* @__PURE__ */ new Set();
|
|
@@ -41629,7 +41680,7 @@ function notifyBlockedPress(e, opts, selection) {
|
|
|
41629
41680
|
if (e.button !== 0 || selection.capabilities.commitCheckPending) return;
|
|
41630
41681
|
opts.onBlockedMoveRef.current(selection);
|
|
41631
41682
|
}
|
|
41632
|
-
function startGroupDrag(e, opts, at) {
|
|
41683
|
+
function startGroupDrag(e, opts, at, snap) {
|
|
41633
41684
|
const items = opts.groupOverlayItemsRef.current;
|
|
41634
41685
|
if (items.length <= 1) return false;
|
|
41635
41686
|
const blockedSelection = items.find(
|
|
@@ -41641,6 +41692,13 @@ function startGroupDrag(e, opts, at) {
|
|
|
41641
41692
|
notifyBlockedPress(e, opts, blockedSelection);
|
|
41642
41693
|
return false;
|
|
41643
41694
|
}
|
|
41695
|
+
const moving2 = items.find((item) => item.start?.gsap?.moving)?.selection;
|
|
41696
|
+
if (moving2) {
|
|
41697
|
+
e.preventDefault();
|
|
41698
|
+
e.stopPropagation();
|
|
41699
|
+
opts.onBlockedMoveRef.current(moving2, MOVING_LAYER_UNREADABLE);
|
|
41700
|
+
return false;
|
|
41701
|
+
}
|
|
41644
41702
|
opts.onManualDragStartRef.current?.();
|
|
41645
41703
|
const dragItems = filterNestedDomEditGroupItems(items);
|
|
41646
41704
|
const members = [];
|
|
@@ -41651,7 +41709,8 @@ function startGroupDrag(e, opts, at) {
|
|
|
41651
41709
|
element: item.element,
|
|
41652
41710
|
rect: item.rect,
|
|
41653
41711
|
gesture: "drag",
|
|
41654
|
-
at
|
|
41712
|
+
at,
|
|
41713
|
+
start: item.start
|
|
41655
41714
|
});
|
|
41656
41715
|
if (!result.ok) {
|
|
41657
41716
|
restoreManualOffsetDragMembers(members);
|
|
@@ -41681,14 +41740,14 @@ function startGroupDrag(e, opts, at) {
|
|
|
41681
41740
|
});
|
|
41682
41741
|
const overlayEl = opts.overlayRef.current;
|
|
41683
41742
|
const iframe = opts.iframeRef.current;
|
|
41684
|
-
const snapContext = overlayEl && iframe ? collectSnapContext({
|
|
41743
|
+
const snapContext = snap ?? (overlayEl && iframe ? collectSnapContext({
|
|
41685
41744
|
overlayEl,
|
|
41686
41745
|
iframe,
|
|
41687
41746
|
excludeElements: buildExcludeElements({
|
|
41688
41747
|
iframe,
|
|
41689
41748
|
groupSelections: items.map((i) => i.selection)
|
|
41690
41749
|
})
|
|
41691
|
-
}) : void 0;
|
|
41750
|
+
}) : void 0);
|
|
41692
41751
|
e.preventDefault();
|
|
41693
41752
|
e.stopPropagation();
|
|
41694
41753
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
@@ -41710,6 +41769,7 @@ function startGroupDrag(e, opts, at) {
|
|
|
41710
41769
|
}
|
|
41711
41770
|
function startGesture(kind, e, opts, options) {
|
|
41712
41771
|
const at = options?.at;
|
|
41772
|
+
const start = options?.start;
|
|
41713
41773
|
const sel = options?.selection ?? opts.selectionRef.current;
|
|
41714
41774
|
const rect = options?.rect ?? opts.overlayRectRef.current;
|
|
41715
41775
|
const box = opts.boxRef.current;
|
|
@@ -41723,8 +41783,8 @@ function startGesture(kind, e, opts, options) {
|
|
|
41723
41783
|
if (kind === "resize" && (!Number.isFinite(rect.width) || !Number.isFinite(rect.height)))
|
|
41724
41784
|
return false;
|
|
41725
41785
|
const size = readStudioBoxSize(sel.element);
|
|
41726
|
-
const layoutWidth = sel.element.offsetWidth;
|
|
41727
|
-
const layoutHeight = sel.element.offsetHeight;
|
|
41786
|
+
const layoutWidth = start?.layout.width ?? sel.element.offsetWidth;
|
|
41787
|
+
const layoutHeight = start?.layout.height ?? sel.element.offsetHeight;
|
|
41728
41788
|
const actualWidth = size.width > 0 ? size.width : layoutWidth > 0 ? layoutWidth : rect.width / rect.editScaleX;
|
|
41729
41789
|
const actualHeight = size.height > 0 ? size.height : layoutHeight > 0 ? layoutHeight : rect.height / rect.editScaleY;
|
|
41730
41790
|
const rawContentScaleX = rect.width / (rect.editScaleX * actualWidth);
|
|
@@ -41739,6 +41799,11 @@ function startGesture(kind, e, opts, options) {
|
|
|
41739
41799
|
let manualEditDragToken;
|
|
41740
41800
|
let pathOffsetMember;
|
|
41741
41801
|
if (kind === "drag") {
|
|
41802
|
+
if (start?.gsap?.moving) {
|
|
41803
|
+
opts.onBlockedMoveRef.current(sel, MOVING_LAYER_UNREADABLE);
|
|
41804
|
+
e.preventDefault();
|
|
41805
|
+
return false;
|
|
41806
|
+
}
|
|
41742
41807
|
opts.onManualDragStartRef.current?.();
|
|
41743
41808
|
const result = createManualOffsetDragMember({
|
|
41744
41809
|
key: selectionCacheKey(sel),
|
|
@@ -41746,7 +41811,8 @@ function startGesture(kind, e, opts, options) {
|
|
|
41746
41811
|
element: sel.element,
|
|
41747
41812
|
rect,
|
|
41748
41813
|
gesture: "drag",
|
|
41749
|
-
at
|
|
41814
|
+
at,
|
|
41815
|
+
start
|
|
41750
41816
|
});
|
|
41751
41817
|
if (!result.ok) {
|
|
41752
41818
|
opts.onBlockedMoveRef.current(result.selection, result.reason);
|
|
@@ -41765,7 +41831,8 @@ function startGesture(kind, e, opts, options) {
|
|
|
41765
41831
|
element: sel.element,
|
|
41766
41832
|
rect,
|
|
41767
41833
|
gesture: "resize",
|
|
41768
|
-
at
|
|
41834
|
+
at,
|
|
41835
|
+
start
|
|
41769
41836
|
});
|
|
41770
41837
|
if (result.ok) {
|
|
41771
41838
|
pathOffsetMember = result.member;
|
|
@@ -41796,7 +41863,7 @@ function startGesture(kind, e, opts, options) {
|
|
|
41796
41863
|
const corners = elementCornerOverlayPoints(overlayEl, iframe, sel.element);
|
|
41797
41864
|
if (corners) resizeFixedCenterStart = overlayCornersCentroid(corners);
|
|
41798
41865
|
}
|
|
41799
|
-
const snapContext = (kind === "drag" || kind === "resize") && overlayEl && iframe ? collectSnapContext({
|
|
41866
|
+
const snapContext = (kind === "drag" || kind === "resize") && overlayEl && iframe ? options?.snap ?? collectSnapContext({
|
|
41800
41867
|
overlayEl,
|
|
41801
41868
|
iframe,
|
|
41802
41869
|
excludeElements: buildExcludeElements({ iframe, selection: sel })
|
|
@@ -41873,6 +41940,44 @@ function editMoment(stamp) {
|
|
|
41873
41940
|
return stamp?.at ?? playheadMoment();
|
|
41874
41941
|
}
|
|
41875
41942
|
|
|
41943
|
+
// src/components/editor/previewGestureStartRead.ts
|
|
41944
|
+
async function measurePreviewGestureStart(iframe, overlayEl, handles) {
|
|
41945
|
+
const reply = await previewGestureStart(iframe, handles);
|
|
41946
|
+
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
41947
|
+
if (!reply || !scale) return null;
|
|
41948
|
+
const { iframeRect, overlayRect, rootScaleX: sx, rootScaleY: sy } = scale;
|
|
41949
|
+
const screenToOffset = (move) => move && invertManualOffsetDragMatrix({
|
|
41950
|
+
a: move.a * sx,
|
|
41951
|
+
b: move.b * sy,
|
|
41952
|
+
c: move.c * sx,
|
|
41953
|
+
d: move.d * sy
|
|
41954
|
+
});
|
|
41955
|
+
const composition = {
|
|
41956
|
+
left: iframeRect.left - overlayRect.left,
|
|
41957
|
+
top: iframeRect.top - overlayRect.top,
|
|
41958
|
+
width: iframeRect.width,
|
|
41959
|
+
height: iframeRect.height,
|
|
41960
|
+
editScaleX: sx,
|
|
41961
|
+
editScaleY: sy
|
|
41962
|
+
};
|
|
41963
|
+
return {
|
|
41964
|
+
elements: reply.elements.map(
|
|
41965
|
+
(start) => start && {
|
|
41966
|
+
rect: groupAwareRect(scale, start, true),
|
|
41967
|
+
start: {
|
|
41968
|
+
layout: start.layout,
|
|
41969
|
+
screenToOffset: screenToOffset(start.move),
|
|
41970
|
+
gsap: start.gsap
|
|
41971
|
+
}
|
|
41972
|
+
}
|
|
41973
|
+
),
|
|
41974
|
+
snap: snapContextFromRects(
|
|
41975
|
+
composition,
|
|
41976
|
+
reply.snap.map((box) => flatVisibleRect(scale, box))
|
|
41977
|
+
)
|
|
41978
|
+
};
|
|
41979
|
+
}
|
|
41980
|
+
|
|
41876
41981
|
// src/components/editor/previewGestureStarts.ts
|
|
41877
41982
|
var MAX_SETTLED_WAIT_FRAMES = 60;
|
|
41878
41983
|
var PRESS_WAIT_MAX_MS = 1e4;
|
|
@@ -41961,16 +42066,19 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
41961
42066
|
);
|
|
41962
42067
|
const handles = found.map((element) => element?.handle);
|
|
41963
42068
|
if (!overlay || !handles.length || !handles.every(Boolean)) return null;
|
|
41964
|
-
const
|
|
42069
|
+
const read2 = await measurePreviewGestureStart(iframe, overlay, handles);
|
|
41965
42070
|
const shown3 = selections.flatMap((selection, i) => {
|
|
41966
|
-
const
|
|
41967
|
-
return
|
|
42071
|
+
const element = read2?.elements[i];
|
|
42072
|
+
return element ? [{ selection: { ...selection, handle: handles[i] }, ...element }] : [];
|
|
41968
42073
|
});
|
|
41969
|
-
return shown3.length === selections.length ? shown3 : null;
|
|
42074
|
+
return read2 && shown3.length === selections.length ? { shown: shown3, snap: read2.snap } : null;
|
|
41970
42075
|
};
|
|
41971
42076
|
const startOnShownPreview = (e, pressed, start, draw = null, targets = () => []) => {
|
|
41972
42077
|
const at = playheadMoment();
|
|
41973
|
-
|
|
42078
|
+
const iframe = opts.iframeRef.current;
|
|
42079
|
+
const channel = iframe && previewFrameOpaque(iframe) ? iframe : null;
|
|
42080
|
+
if (!channel && !isPreviewChanging() && !opts.waitingPressRef.current)
|
|
42081
|
+
return start(e, at, false);
|
|
41974
42082
|
e.preventDefault();
|
|
41975
42083
|
e.stopPropagation();
|
|
41976
42084
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
@@ -42005,8 +42113,6 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
42005
42113
|
settledFrames = settled ? settledFrames + 1 : 0;
|
|
42006
42114
|
return elements.length;
|
|
42007
42115
|
};
|
|
42008
|
-
const iframe = opts.iframeRef.current;
|
|
42009
|
-
const channel = iframe && previewFrameOpaque(iframe) ? iframe : null;
|
|
42010
42116
|
let overChannel;
|
|
42011
42117
|
let asked = false;
|
|
42012
42118
|
const channelStep = (frame3) => {
|
|
@@ -42072,11 +42178,12 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
42072
42178
|
(pressed, at, waited, overChannel) => {
|
|
42073
42179
|
if (!waited) return startGroupDrag(pressed, opts, at);
|
|
42074
42180
|
if (overChannel) {
|
|
42075
|
-
const measured2 = items.map((item, i) => ({ ...item, ...overChannel[i] }));
|
|
42181
|
+
const measured2 = items.map((item, i) => ({ ...item, ...overChannel.shown[i] }));
|
|
42076
42182
|
return startGroupDrag(
|
|
42077
42183
|
pressed,
|
|
42078
42184
|
{ ...opts, groupOverlayItemsRef: { current: measured2 } },
|
|
42079
|
-
at
|
|
42185
|
+
at,
|
|
42186
|
+
overChannel.snap
|
|
42080
42187
|
);
|
|
42081
42188
|
}
|
|
42082
42189
|
const overlay = opts.overlayRef.current;
|
|
@@ -42118,13 +42225,15 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
42118
42225
|
},
|
|
42119
42226
|
(pressed, at, waited, overChannel) => {
|
|
42120
42227
|
if (!waited) return startGesture(kind, pressed, opts, { ...options, at });
|
|
42121
|
-
const shown3 = overChannel ? overChannel[0] : shownOnPage(target);
|
|
42228
|
+
const shown3 = overChannel ? overChannel.shown[0] : shownOnPage(target);
|
|
42122
42229
|
return !!shown3 && startGesture(kind, pressed, opts, {
|
|
42123
42230
|
selection: shown3.selection,
|
|
42124
42231
|
rect: shown3.rect,
|
|
42125
42232
|
resizeHandle: options?.resizeHandle,
|
|
42126
42233
|
resizeCorner: options?.resizeCorner,
|
|
42127
|
-
at
|
|
42234
|
+
at,
|
|
42235
|
+
start: shown3.start,
|
|
42236
|
+
snap: overChannel?.snap
|
|
42128
42237
|
});
|
|
42129
42238
|
},
|
|
42130
42239
|
draw,
|
|
@@ -49648,7 +49757,7 @@ function keyframeCount(anim) {
|
|
|
49648
49757
|
}
|
|
49649
49758
|
|
|
49650
49759
|
// src/components/editor/MotionPathOverlay.tsx
|
|
49651
|
-
import { isHtmlElement as
|
|
49760
|
+
import { isHtmlElement as isHtmlElement8 } from "@hyperframes/core/runtime/dom-realm";
|
|
49652
49761
|
|
|
49653
49762
|
// src/components/editor/MotionPathNode.tsx
|
|
49654
49763
|
import { Fragment as Fragment33, jsx as jsx115, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
@@ -50310,7 +50419,7 @@ function elementHome(el) {
|
|
|
50310
50419
|
|
|
50311
50420
|
// src/components/editor/useMotionPathData.ts
|
|
50312
50421
|
import { useEffect as useEffect64, useRef as useRef81, useState as useState60 } from "react";
|
|
50313
|
-
import { isHtmlElement as
|
|
50422
|
+
import { isHtmlElement as isHtmlElement7 } from "@hyperframes/core/runtime/dom-realm";
|
|
50314
50423
|
function transformWDivisor(el) {
|
|
50315
50424
|
const t2 = el.ownerDocument?.defaultView?.getComputedStyle(el).transform;
|
|
50316
50425
|
if (!t2 || !t2.startsWith("matrix3d(")) return 1;
|
|
@@ -50366,7 +50475,7 @@ function useMotionPathData(iframeRef, selector) {
|
|
|
50366
50475
|
target = el.contentDocument?.querySelector(selector) ?? null;
|
|
50367
50476
|
} catch {
|
|
50368
50477
|
}
|
|
50369
|
-
const live =
|
|
50478
|
+
const live = isHtmlElement7(target) ? target : null;
|
|
50370
50479
|
const vis = live ? isElementVisibleForOverlay(live) : true;
|
|
50371
50480
|
setVisibleInPreview((prev) => prev === vis ? prev : vis);
|
|
50372
50481
|
if (live) {
|
|
@@ -50487,7 +50596,7 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
|
|
|
50487
50596
|
return;
|
|
50488
50597
|
}
|
|
50489
50598
|
const live = frame3.contentDocument?.querySelector(createSelector);
|
|
50490
|
-
if (!
|
|
50599
|
+
if (!isHtmlElement8(live)) return;
|
|
50491
50600
|
e.stopPropagation();
|
|
50492
50601
|
e.preventDefault();
|
|
50493
50602
|
const sc = r.width / compW;
|
|
@@ -76330,60 +76439,87 @@ function AskAgentModal({
|
|
|
76330
76439
|
);
|
|
76331
76440
|
}
|
|
76332
76441
|
|
|
76442
|
+
// src/hooks/useToast.ts
|
|
76443
|
+
import { useState as useState117, useCallback as useCallback101, useRef as useRef129 } from "react";
|
|
76444
|
+
var AUTO_DISMISS_MS = 4e3;
|
|
76445
|
+
var MAX_TOASTS = 3;
|
|
76446
|
+
var toastPersists = (tone) => tone === "error";
|
|
76447
|
+
var nextToastId = 1;
|
|
76448
|
+
function useToast() {
|
|
76449
|
+
const [toasts, setToasts] = useState117([]);
|
|
76450
|
+
const timersRef = useRef129(/* @__PURE__ */ new Map());
|
|
76451
|
+
const clearTimer = useCallback101((id) => {
|
|
76452
|
+
const timer = timersRef.current.get(id);
|
|
76453
|
+
if (timer) {
|
|
76454
|
+
clearTimeout(timer);
|
|
76455
|
+
timersRef.current.delete(id);
|
|
76456
|
+
}
|
|
76457
|
+
}, []);
|
|
76458
|
+
const dismissToast = useCallback101(
|
|
76459
|
+
(id) => {
|
|
76460
|
+
clearTimer(id);
|
|
76461
|
+
setToasts((prev) => prev.filter((t2) => t2.id !== id));
|
|
76462
|
+
},
|
|
76463
|
+
[clearTimer]
|
|
76464
|
+
);
|
|
76465
|
+
const showToast = useCallback101(
|
|
76466
|
+
(message, tone = "error") => {
|
|
76467
|
+
const id = nextToastId++;
|
|
76468
|
+
setToasts((prev) => {
|
|
76469
|
+
const next = [...prev, { id, message, tone }];
|
|
76470
|
+
while (next.length > MAX_TOASTS) {
|
|
76471
|
+
const dropped2 = next.shift();
|
|
76472
|
+
if (dropped2) clearTimer(dropped2.id);
|
|
76473
|
+
}
|
|
76474
|
+
return next;
|
|
76475
|
+
});
|
|
76476
|
+
if (!toastPersists(tone)) {
|
|
76477
|
+
const timer = setTimeout(() => dismissToast(id), AUTO_DISMISS_MS);
|
|
76478
|
+
timersRef.current.set(id, timer);
|
|
76479
|
+
}
|
|
76480
|
+
return id;
|
|
76481
|
+
},
|
|
76482
|
+
[clearTimer, dismissToast]
|
|
76483
|
+
);
|
|
76484
|
+
useMountEffect(() => () => {
|
|
76485
|
+
for (const timer of timersRef.current.values()) clearTimeout(timer);
|
|
76486
|
+
timersRef.current.clear();
|
|
76487
|
+
});
|
|
76488
|
+
return { toasts, showToast, dismissToast };
|
|
76489
|
+
}
|
|
76490
|
+
|
|
76333
76491
|
// src/components/StudioToast.tsx
|
|
76334
76492
|
import { jsx as jsx205, jsxs as jsxs158 } from "react/jsx-runtime";
|
|
76335
|
-
function StudioToast({ message, tone,
|
|
76336
|
-
const
|
|
76337
|
-
return /* @__PURE__ */
|
|
76493
|
+
function StudioToast({ message, tone, onDismiss }) {
|
|
76494
|
+
const persists = toastPersists(tone);
|
|
76495
|
+
return /* @__PURE__ */ jsxs158(
|
|
76338
76496
|
"div",
|
|
76339
76497
|
{
|
|
76340
|
-
role:
|
|
76341
|
-
|
|
76342
|
-
|
|
76343
|
-
"
|
|
76344
|
-
|
|
76345
|
-
|
|
76346
|
-
|
|
76347
|
-
|
|
76348
|
-
|
|
76349
|
-
|
|
76350
|
-
|
|
76351
|
-
|
|
76352
|
-
|
|
76353
|
-
|
|
76354
|
-
|
|
76355
|
-
|
|
76356
|
-
|
|
76357
|
-
|
|
76358
|
-
|
|
76359
|
-
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-neutral-500 transition-colors hover:bg-hover hover:text-neutral-300",
|
|
76360
|
-
"aria-label": "Dismiss",
|
|
76361
|
-
children: /* @__PURE__ */ jsx205(
|
|
76362
|
-
"svg",
|
|
76363
|
-
{
|
|
76364
|
-
width: "10",
|
|
76365
|
-
height: "10",
|
|
76366
|
-
viewBox: "0 0 10 10",
|
|
76367
|
-
fill: "none",
|
|
76368
|
-
stroke: "currentColor",
|
|
76369
|
-
strokeWidth: "1.5",
|
|
76370
|
-
children: /* @__PURE__ */ jsx205("path", { d: "M2 2l6 6M8 2l-6 6" })
|
|
76371
|
-
}
|
|
76372
|
-
)
|
|
76373
|
-
}
|
|
76374
|
-
)
|
|
76375
|
-
]
|
|
76376
|
-
}
|
|
76377
|
-
)
|
|
76498
|
+
role: tone === "error" ? "alert" : "status",
|
|
76499
|
+
onClick: persists ? void 0 : onDismiss,
|
|
76500
|
+
onKeyDown: (event) => {
|
|
76501
|
+
if (event.key === "Escape") onDismiss();
|
|
76502
|
+
},
|
|
76503
|
+
className: `hf-notice-in flex min-h-12 w-fit max-w-[min(680px,100%)] items-center gap-1.5 rounded-3xl bg-text-0 py-1.5 pr-1.5 pl-5 text-[14px] leading-5 font-medium wrap-anywhere text-bg-0 shadow-notice not-has-[button]:pr-5 ${persists ? "" : "cursor-pointer"}`,
|
|
76504
|
+
children: [
|
|
76505
|
+
/* @__PURE__ */ jsx205("span", { className: "min-w-0 flex-1 text-pretty", children: message }),
|
|
76506
|
+
persists && /* @__PURE__ */ jsx205(
|
|
76507
|
+
"button",
|
|
76508
|
+
{
|
|
76509
|
+
type: "button",
|
|
76510
|
+
onClick: onDismiss,
|
|
76511
|
+
className: "relative ml-2 grid h-9 w-9 shrink-0 place-items-center rounded-full text-bg-0/72 transition-[background-color,color,scale] duration-hover ease-out hover:bg-bg-0/16 hover:text-bg-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-bg-0 active:scale-[0.96]",
|
|
76512
|
+
"aria-label": "Dismiss",
|
|
76513
|
+
children: /* @__PURE__ */ jsx205(X, { size: 14 })
|
|
76514
|
+
}
|
|
76515
|
+
)
|
|
76516
|
+
]
|
|
76378
76517
|
}
|
|
76379
76518
|
);
|
|
76380
76519
|
}
|
|
76381
|
-
function toastSurface(isError2) {
|
|
76382
|
-
return `border shadow-popover bg-raised ${isError2 ? "border-danger/40" : "border-border"}`;
|
|
76383
|
-
}
|
|
76384
76520
|
|
|
76385
76521
|
// src/components/feedback/StudioFeedbackCard.tsx
|
|
76386
|
-
import { memo as memo44, useState as
|
|
76522
|
+
import { memo as memo44, useState as useState118, useCallback as useCallback102, useRef as useRef130, useEffect as useEffect115 } from "react";
|
|
76387
76523
|
|
|
76388
76524
|
// src/components/feedback/projectProvenance.ts
|
|
76389
76525
|
var CONFIG_FILE = "hyperframes.json";
|
|
@@ -76453,30 +76589,30 @@ var CRASH_FOLLOW_UP = {
|
|
|
76453
76589
|
{ label: "Just opened it", hint: "It broke before I did anything" }
|
|
76454
76590
|
]
|
|
76455
76591
|
};
|
|
76456
|
-
var
|
|
76592
|
+
var AUTO_DISMISS_MS2 = 3e4;
|
|
76457
76593
|
var EXIT_MS = 160;
|
|
76458
76594
|
var THANKS_MS = 1e4;
|
|
76459
76595
|
var INTERVIEW_URL = "https://calendar.app.google/yRHT7oPsHWcqFfFv5";
|
|
76460
76596
|
var RATINGS = Array.from({ length: 11 }, (_, n) => n);
|
|
76461
76597
|
var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
|
|
76462
|
-
const [request2, setRequest] =
|
|
76463
|
-
const [step, setStep] =
|
|
76464
|
-
const [rating, setRating] =
|
|
76465
|
-
const [followUp, setFollowUp] =
|
|
76466
|
-
const [comment, setComment] =
|
|
76467
|
-
const [hint, setHint] =
|
|
76468
|
-
const [exiting, setExiting] =
|
|
76469
|
-
const inputRef =
|
|
76470
|
-
const timerRef =
|
|
76471
|
-
const stateRef =
|
|
76598
|
+
const [request2, setRequest] = useState118(null);
|
|
76599
|
+
const [step, setStep] = useState118("rating");
|
|
76600
|
+
const [rating, setRating] = useState118(null);
|
|
76601
|
+
const [followUp, setFollowUp] = useState118(FAILURE_FOLLOW_UP);
|
|
76602
|
+
const [comment, setComment] = useState118("");
|
|
76603
|
+
const [hint, setHint] = useState118(null);
|
|
76604
|
+
const [exiting, setExiting] = useState118(false);
|
|
76605
|
+
const inputRef = useRef130(null);
|
|
76606
|
+
const timerRef = useRef130(null);
|
|
76607
|
+
const stateRef = useRef130({ request: request2, rating, step });
|
|
76472
76608
|
stateRef.current = { request: request2, rating, step };
|
|
76473
|
-
const clearTimer =
|
|
76609
|
+
const clearTimer = useCallback102(() => {
|
|
76474
76610
|
if (timerRef.current) {
|
|
76475
76611
|
clearTimeout(timerRef.current);
|
|
76476
76612
|
timerRef.current = null;
|
|
76477
76613
|
}
|
|
76478
76614
|
}, []);
|
|
76479
|
-
const close =
|
|
76615
|
+
const close = useCallback102(
|
|
76480
76616
|
(via) => {
|
|
76481
76617
|
const { request: req, rating: picked, step: at } = stateRef.current;
|
|
76482
76618
|
if (!req) return;
|
|
@@ -76517,13 +76653,13 @@ var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
|
|
|
76517
76653
|
);
|
|
76518
76654
|
useEffect115(() => {
|
|
76519
76655
|
if (!request2 || step === "thanks" || rating !== null || comment !== "") return;
|
|
76520
|
-
timerRef.current = setTimeout(() => close("timeout"),
|
|
76656
|
+
timerRef.current = setTimeout(() => close("timeout"), AUTO_DISMISS_MS2);
|
|
76521
76657
|
return clearTimer;
|
|
76522
76658
|
}, [request2, step, rating, comment, close, clearTimer]);
|
|
76523
76659
|
useEffect115(() => {
|
|
76524
76660
|
if (step === "comment") inputRef.current?.focus();
|
|
76525
76661
|
}, [step]);
|
|
76526
|
-
const submit =
|
|
76662
|
+
const submit = useCallback102(
|
|
76527
76663
|
(preset) => {
|
|
76528
76664
|
const req = stateRef.current.request;
|
|
76529
76665
|
if (!req) return;
|
|
@@ -76550,7 +76686,7 @@ var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
|
|
|
76550
76686
|
},
|
|
76551
76687
|
[rating, comment, followUp.id, close, clearTimer]
|
|
76552
76688
|
);
|
|
76553
|
-
const pickRating =
|
|
76689
|
+
const pickRating = useCallback102((n) => {
|
|
76554
76690
|
setRating(n);
|
|
76555
76691
|
setFollowUp(followUpFor(n));
|
|
76556
76692
|
setStep("comment");
|
|
@@ -76570,7 +76706,7 @@ var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
|
|
|
76570
76706
|
children: /* @__PURE__ */ jsxs159(
|
|
76571
76707
|
"div",
|
|
76572
76708
|
{
|
|
76573
|
-
className: `flex w-[min(340px,calc(100vw-48px))] flex-col gap-2.5 overflow-hidden rounded-2xl px-3.5 py-3 ${
|
|
76709
|
+
className: `flex w-[min(340px,calc(100vw-48px))] flex-col gap-2.5 overflow-hidden rounded-2xl px-3.5 py-3 ${cardSurface(failed2)}`,
|
|
76574
76710
|
children: [
|
|
76575
76711
|
/* @__PURE__ */ jsxs159("div", { className: "flex items-start gap-3", children: [
|
|
76576
76712
|
/* @__PURE__ */ jsx206(
|
|
@@ -76699,6 +76835,9 @@ var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
|
|
|
76699
76835
|
}
|
|
76700
76836
|
);
|
|
76701
76837
|
});
|
|
76838
|
+
function cardSurface(isError2) {
|
|
76839
|
+
return `border shadow-popover bg-raised ${isError2 ? "border-danger/40" : "border-border"}`;
|
|
76840
|
+
}
|
|
76702
76841
|
|
|
76703
76842
|
// src/components/StudioOverlays.tsx
|
|
76704
76843
|
import { Fragment as Fragment55, jsx as jsx207, jsxs as jsxs160 } from "react/jsx-runtime";
|
|
@@ -76749,18 +76888,17 @@ var StudioOverlays = memo45(function StudioOverlays2({
|
|
|
76749
76888
|
}
|
|
76750
76889
|
}
|
|
76751
76890
|
),
|
|
76752
|
-
/* @__PURE__ */ jsxs160("div", { className: "absolute
|
|
76753
|
-
toasts.map((toast) => /* @__PURE__ */ jsx207(
|
|
76891
|
+
/* @__PURE__ */ jsxs160("div", { className: "pointer-events-none absolute inset-x-6 bottom-6 z-91 flex items-end gap-2", children: [
|
|
76892
|
+
/* @__PURE__ */ jsx207("div", { className: "flex min-w-0 flex-1 flex-col items-center gap-2 *:pointer-events-auto", children: toasts.map((toast) => /* @__PURE__ */ jsx207(
|
|
76754
76893
|
StudioToast,
|
|
76755
76894
|
{
|
|
76756
76895
|
message: toast.message,
|
|
76757
76896
|
tone: toast.tone,
|
|
76758
|
-
leaving: toast.leaving,
|
|
76759
76897
|
onDismiss: () => dismissToast(toast.id)
|
|
76760
76898
|
},
|
|
76761
76899
|
toast.id
|
|
76762
|
-
)),
|
|
76763
|
-
/* @__PURE__ */ jsx207(StudioFeedbackCard, {})
|
|
76900
|
+
)) }),
|
|
76901
|
+
/* @__PURE__ */ jsx207("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx207(StudioFeedbackCard, {}) })
|
|
76764
76902
|
] })
|
|
76765
76903
|
] });
|
|
76766
76904
|
});
|
|
@@ -76790,7 +76928,7 @@ function SaveQueuePausedBanner({ message, onRetry }) {
|
|
|
76790
76928
|
}
|
|
76791
76929
|
|
|
76792
76930
|
// src/components/ExternalFileConflictBanner.tsx
|
|
76793
|
-
import { useRef as
|
|
76931
|
+
import { useRef as useRef131, useState as useState119 } from "react";
|
|
76794
76932
|
import { Fragment as Fragment56, jsx as jsx209, jsxs as jsxs162 } from "react/jsx-runtime";
|
|
76795
76933
|
function errorMessage(error) {
|
|
76796
76934
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -76807,7 +76945,7 @@ function ConflictReview({
|
|
|
76807
76945
|
conflict,
|
|
76808
76946
|
onClose
|
|
76809
76947
|
}) {
|
|
76810
|
-
const containerRef =
|
|
76948
|
+
const containerRef = useRef131(null);
|
|
76811
76949
|
useDialogBehavior({ open: true, onClose, containerRef });
|
|
76812
76950
|
const external = conflict.error.currentContent ?? "(The server did not return file contents.)";
|
|
76813
76951
|
const studio = conflict.error.attemptedContent;
|
|
@@ -76884,7 +77022,7 @@ function FailedDraftReview({
|
|
|
76884
77022
|
content,
|
|
76885
77023
|
onClose
|
|
76886
77024
|
}) {
|
|
76887
|
-
const containerRef =
|
|
77025
|
+
const containerRef = useRef131(null);
|
|
76888
77026
|
useDialogBehavior({ open: true, onClose, containerRef });
|
|
76889
77027
|
return /* @__PURE__ */ jsx209(
|
|
76890
77028
|
"div",
|
|
@@ -76949,7 +77087,7 @@ function FailedDraftReview({
|
|
|
76949
77087
|
function ExternalFileConflictBanner({
|
|
76950
77088
|
coordinator
|
|
76951
77089
|
}) {
|
|
76952
|
-
const [reviewing, setReviewing] =
|
|
77090
|
+
const [reviewing, setReviewing] = useState119(false);
|
|
76953
77091
|
const blocked = coordinator.blocked;
|
|
76954
77092
|
if (!blocked) return null;
|
|
76955
77093
|
const conflict = blocked.status === "conflict" ? blocked : null;
|
|
@@ -77020,10 +77158,10 @@ function ExternalFileConflictBanner({
|
|
|
77020
77158
|
}
|
|
77021
77159
|
|
|
77022
77160
|
// src/components/ProjectUnreachableBanner.tsx
|
|
77023
|
-
import { useEffect as useEffect116, useState as
|
|
77161
|
+
import { useEffect as useEffect116, useState as useState120 } from "react";
|
|
77024
77162
|
import { Fragment as Fragment57, jsx as jsx210, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
77025
77163
|
function ProjectUnreachableBanner({ projectId }) {
|
|
77026
|
-
const [served, setServed] =
|
|
77164
|
+
const [served, setServed] = useState120(null);
|
|
77027
77165
|
useEffect116(() => {
|
|
77028
77166
|
let cancelled = false;
|
|
77029
77167
|
studioApiFetch("/api/projects").then((res) => res.ok ? res.json() : { projects: [] }).then((data) => {
|
|
@@ -77086,7 +77224,7 @@ function CompositionMissingBanner({ path }) {
|
|
|
77086
77224
|
}
|
|
77087
77225
|
|
|
77088
77226
|
// src/captions/hooks/useCaptionSync.ts
|
|
77089
|
-
import { useCallback as
|
|
77227
|
+
import { useCallback as useCallback103, useRef as useRef132 } from "react";
|
|
77090
77228
|
function buildOverrides(model) {
|
|
77091
77229
|
const entries = [];
|
|
77092
77230
|
let globalWordIndex = 0;
|
|
@@ -77117,13 +77255,13 @@ function buildOverrides(model) {
|
|
|
77117
77255
|
return entries;
|
|
77118
77256
|
}
|
|
77119
77257
|
function useCaptionSync(projectId) {
|
|
77120
|
-
const projectIdRef =
|
|
77258
|
+
const projectIdRef = useRef132(projectId);
|
|
77121
77259
|
projectIdRef.current = projectId;
|
|
77122
|
-
const debounceRef =
|
|
77123
|
-
const suppressSaveRef =
|
|
77124
|
-
const pendingRef =
|
|
77125
|
-
const editSeqRef =
|
|
77126
|
-
const save =
|
|
77260
|
+
const debounceRef = useRef132(null);
|
|
77261
|
+
const suppressSaveRef = useRef132(false);
|
|
77262
|
+
const pendingRef = useRef132(false);
|
|
77263
|
+
const editSeqRef = useRef132(0);
|
|
77264
|
+
const save = useCallback103(() => {
|
|
77127
77265
|
const state = useCaptionStore.getState();
|
|
77128
77266
|
if (!state.model || !state.sourceFilePath) {
|
|
77129
77267
|
pendingRef.current = false;
|
|
@@ -77189,7 +77327,7 @@ function useCaptionSync(projectId) {
|
|
|
77189
77327
|
useCaptionStore.getState().setRetrySave(null);
|
|
77190
77328
|
};
|
|
77191
77329
|
});
|
|
77192
|
-
const loadOverrides =
|
|
77330
|
+
const loadOverrides = useCallback103(async () => {
|
|
77193
77331
|
const state = useCaptionStore.getState();
|
|
77194
77332
|
if (!state.model || !state.sourceFilePath) return;
|
|
77195
77333
|
const pid = projectIdRef.current;
|
|
@@ -77252,7 +77390,7 @@ function useCaptionSync(projectId) {
|
|
|
77252
77390
|
}
|
|
77253
77391
|
|
|
77254
77392
|
// src/hooks/usePersistentEditHistory.ts
|
|
77255
|
-
import { useCallback as
|
|
77393
|
+
import { useCallback as useCallback104, useEffect as useEffect117, useMemo as useMemo71, useRef as useRef133, useState as useState121 } from "react";
|
|
77256
77394
|
var EMPTY3 = { entries: [], back: null, forward: null };
|
|
77257
77395
|
var OWN_ENTRIES_KEPT = 100;
|
|
77258
77396
|
function createOwnHistory() {
|
|
@@ -77382,15 +77520,15 @@ function redoneAt(view) {
|
|
|
77382
77520
|
return view.entries.find((entry3) => entry3.id === undo?.undoes)?.endedAt ?? null;
|
|
77383
77521
|
}
|
|
77384
77522
|
function usePersistentEditHistory({ projectId }) {
|
|
77385
|
-
const [view, setView] =
|
|
77386
|
-
const [loaded, setLoaded] =
|
|
77387
|
-
const heldClaimRef =
|
|
77388
|
-
const projectIdRef =
|
|
77523
|
+
const [view, setView] = useState121(EMPTY3);
|
|
77524
|
+
const [loaded, setLoaded] = useState121(false);
|
|
77525
|
+
const heldClaimRef = useRef133(null);
|
|
77526
|
+
const projectIdRef = useRef133(projectId);
|
|
77389
77527
|
projectIdRef.current = projectId;
|
|
77390
|
-
const [own] =
|
|
77391
|
-
const [pageKeyScope] =
|
|
77392
|
-
const claimKey =
|
|
77393
|
-
const refresh2 =
|
|
77528
|
+
const [own] = useState121(createOwnHistory);
|
|
77529
|
+
const [pageKeyScope] = useState121(generateId);
|
|
77530
|
+
const claimKey = useCallback104((key2) => `${pageKeyScope}:${key2}`, [pageKeyScope]);
|
|
77531
|
+
const refresh2 = useCallback104(async () => {
|
|
77394
77532
|
if (!projectId) return;
|
|
77395
77533
|
const seen = own.changes();
|
|
77396
77534
|
const response = await studioApiFetch(historyUrl(projectId)).catch(() => null);
|
|
@@ -77411,7 +77549,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
77411
77549
|
setStudioPendingEditClaimClock(own.claimCount);
|
|
77412
77550
|
return () => setStudioPendingEditClaimClock(null);
|
|
77413
77551
|
}, [own]);
|
|
77414
|
-
const recordEdit =
|
|
77552
|
+
const recordEdit = useCallback104(
|
|
77415
77553
|
async ({ label, coalesceKey, coalesceMs, files, targets, created = [] }) => {
|
|
77416
77554
|
if (!projectId) return;
|
|
77417
77555
|
const paths = [...Object.keys(files), ...created];
|
|
@@ -77436,7 +77574,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
77436
77574
|
},
|
|
77437
77575
|
[projectId, refresh2, own, claimKey]
|
|
77438
77576
|
);
|
|
77439
|
-
const step =
|
|
77577
|
+
const step = useCallback104(
|
|
77440
77578
|
async (direction, callbacks) => {
|
|
77441
77579
|
if (!projectId) return { ok: false, reason: "empty" };
|
|
77442
77580
|
const candidate = direction === "undo" && callbacks.claimedAfter !== void 0 ? own.claimedAfter(callbacks.claimedAfter) : null;
|
|
@@ -77484,12 +77622,12 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
77484
77622
|
},
|
|
77485
77623
|
[projectId, view, refresh2, own]
|
|
77486
77624
|
);
|
|
77487
|
-
const noteOutsideChange =
|
|
77625
|
+
const noteOutsideChange = useCallback104(() => {
|
|
77488
77626
|
own.overtake();
|
|
77489
77627
|
void refresh2();
|
|
77490
77628
|
}, [own, refresh2]);
|
|
77491
|
-
const undo =
|
|
77492
|
-
const redo =
|
|
77629
|
+
const undo = useCallback104((callbacks) => step("undo", callbacks), [step]);
|
|
77630
|
+
const redo = useCallback104((callbacks) => step("redo", callbacks), [step]);
|
|
77493
77631
|
const state = useMemo71(() => {
|
|
77494
77632
|
const backAt = Math.max(view.back?.endedAt ?? 0, heldClaimRef.current?.at ?? 0);
|
|
77495
77633
|
const redoAt = redoneAt(view);
|
|
@@ -77518,7 +77656,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
77518
77656
|
}
|
|
77519
77657
|
|
|
77520
77658
|
// src/hooks/usePanelLayout.ts
|
|
77521
|
-
import { useCallback as
|
|
77659
|
+
import { useCallback as useCallback105, useEffect as useEffect118, useRef as useRef134 } from "react";
|
|
77522
77660
|
function panelForTab(tab) {
|
|
77523
77661
|
return tab === "block-params" ? "design" : tab;
|
|
77524
77662
|
}
|
|
@@ -77529,7 +77667,7 @@ function usePanelLayout(initialState2) {
|
|
|
77529
77667
|
const controller = useDockLayoutStore((state) => state.controller);
|
|
77530
77668
|
const lastActive = useDockLayoutStore((state) => state.lastActive);
|
|
77531
77669
|
const visiblePanels = useDockLayoutStore((state) => state.visiblePanels);
|
|
77532
|
-
const initialRef =
|
|
77670
|
+
const initialRef = useRef134(initialState2);
|
|
77533
77671
|
useEffect118(() => {
|
|
77534
77672
|
if (!controller) return;
|
|
77535
77673
|
const { rightCollapsed: rightCollapsed2, rightPanelTab: rightPanelTab2 } = initialRef.current ?? {};
|
|
@@ -77553,13 +77691,13 @@ function usePanelLayout(initialState2) {
|
|
|
77553
77691
|
const visibleRight = visiblePanelInZone("right", lastActive, visiblePanels);
|
|
77554
77692
|
const rightPanelTab = tabForPanel(visibleRight);
|
|
77555
77693
|
const rightCollapsed = visibleRight === null;
|
|
77556
|
-
const setRightPanelTab =
|
|
77694
|
+
const setRightPanelTab = useCallback105((tab) => {
|
|
77557
77695
|
const store = useDockLayoutStore.getState();
|
|
77558
77696
|
const shown3 = visiblePanelInZone("right", store.lastActive, store.visiblePanels);
|
|
77559
77697
|
store.activatePanel(panelForTab(tab));
|
|
77560
77698
|
if (tabForPanel(shown3) !== tab) trackStudioEvent("tab_switch", { panel: "right_panel", tab });
|
|
77561
77699
|
}, []);
|
|
77562
|
-
const setRightCollapsed =
|
|
77700
|
+
const setRightCollapsed = useCallback105((collapsed) => {
|
|
77563
77701
|
const store = useDockLayoutStore.getState();
|
|
77564
77702
|
if (!collapsed && visiblePanelInZone("right", store.lastActive, store.visiblePanels) === null) {
|
|
77565
77703
|
store.activatePanel("design");
|
|
@@ -77574,10 +77712,10 @@ function usePanelLayout(initialState2) {
|
|
|
77574
77712
|
}
|
|
77575
77713
|
|
|
77576
77714
|
// src/hooks/useFileManager.ts
|
|
77577
|
-
import { useState as
|
|
77715
|
+
import { useState as useState123, useCallback as useCallback109, useRef as useRef137 } from "react";
|
|
77578
77716
|
|
|
77579
77717
|
// src/hooks/useFileTree.ts
|
|
77580
|
-
import { useState as
|
|
77718
|
+
import { useState as useState122, useCallback as useCallback106, useEffect as useEffect119, useMemo as useMemo72, useRef as useRef135 } from "react";
|
|
77581
77719
|
|
|
77582
77720
|
// src/utils/rejectionTelemetry.ts
|
|
77583
77721
|
function errorProps(value) {
|
|
@@ -77604,7 +77742,7 @@ function reportRefreshFailure(err) {
|
|
|
77604
77742
|
trackStudioEvent("file_tree_refresh_failed", { error_name, error_message });
|
|
77605
77743
|
}
|
|
77606
77744
|
function useFileTree({ projectId, projectIdRef }) {
|
|
77607
|
-
const [fetched, setFetched] =
|
|
77745
|
+
const [fetched, setFetched] = useState122(null);
|
|
77608
77746
|
const current2 = fetched?.projectId === projectId ? fetched : null;
|
|
77609
77747
|
const fileTree = current2?.fileTree ?? EMPTY_FILE_LIST;
|
|
77610
77748
|
const compositionPaths = current2?.compositionPaths ?? EMPTY_FILE_LIST;
|
|
@@ -77636,10 +77774,10 @@ function useFileTree({ projectId, projectIdRef }) {
|
|
|
77636
77774
|
cancelled = true;
|
|
77637
77775
|
};
|
|
77638
77776
|
}, [projectId]);
|
|
77639
|
-
const refreshRequestRef =
|
|
77640
|
-
const refreshAbortRef =
|
|
77641
|
-
const failureReportedRef =
|
|
77642
|
-
const refreshFileTree =
|
|
77777
|
+
const refreshRequestRef = useRef135(0);
|
|
77778
|
+
const refreshAbortRef = useRef135(null);
|
|
77779
|
+
const failureReportedRef = useRef135(false);
|
|
77780
|
+
const refreshFileTree = useCallback106(async () => {
|
|
77643
77781
|
const pid = projectIdRef.current;
|
|
77644
77782
|
if (!pid) return;
|
|
77645
77783
|
refreshAbortRef.current?.abort();
|
|
@@ -77692,7 +77830,7 @@ function useFileTree({ projectId, projectIdRef }) {
|
|
|
77692
77830
|
}
|
|
77693
77831
|
|
|
77694
77832
|
// src/hooks/useEditorSave.ts
|
|
77695
|
-
import { useCallback as
|
|
77833
|
+
import { useCallback as useCallback107, useRef as useRef136 } from "react";
|
|
77696
77834
|
var FAILURE_BURST_MS = 5e3;
|
|
77697
77835
|
function useEditorSave({
|
|
77698
77836
|
editingPathRef,
|
|
@@ -77703,14 +77841,14 @@ function useEditorSave({
|
|
|
77703
77841
|
setRefreshKey,
|
|
77704
77842
|
showToast
|
|
77705
77843
|
}) {
|
|
77706
|
-
const saveRafRef =
|
|
77707
|
-
const refreshRafRef =
|
|
77708
|
-
const lastFailureToastAtRef =
|
|
77709
|
-
const lastFailureReportRef =
|
|
77710
|
-
const pendingCandidateRef =
|
|
77711
|
-
const inFlightRef =
|
|
77712
|
-
const inFlightCandidateRef =
|
|
77713
|
-
const reportFailure =
|
|
77844
|
+
const saveRafRef = useRef136(null);
|
|
77845
|
+
const refreshRafRef = useRef136(null);
|
|
77846
|
+
const lastFailureToastAtRef = useRef136(null);
|
|
77847
|
+
const lastFailureReportRef = useRef136(null);
|
|
77848
|
+
const pendingCandidateRef = useRef136(null);
|
|
77849
|
+
const inFlightRef = useRef136(null);
|
|
77850
|
+
const inFlightCandidateRef = useRef136(null);
|
|
77851
|
+
const reportFailure = useCallback107(
|
|
77714
77852
|
(path, error) => {
|
|
77715
77853
|
const now2 = Date.now();
|
|
77716
77854
|
const properties = buildStudioSaveFailureProperties({
|
|
@@ -77740,7 +77878,7 @@ function useEditorSave({
|
|
|
77740
77878
|
},
|
|
77741
77879
|
[showToast]
|
|
77742
77880
|
);
|
|
77743
|
-
const persistCandidate =
|
|
77881
|
+
const persistCandidate = useCallback107(
|
|
77744
77882
|
(candidate) => {
|
|
77745
77883
|
const task = saveProjectFilesWithHistory({
|
|
77746
77884
|
projectId: candidate.projectId,
|
|
@@ -77771,7 +77909,7 @@ function useEditorSave({
|
|
|
77771
77909
|
},
|
|
77772
77910
|
[readProjectFile, recordEdit, reportFailure, setRefreshKey, writeProjectFile]
|
|
77773
77911
|
);
|
|
77774
|
-
const handleContentChange =
|
|
77912
|
+
const handleContentChange = useCallback107(
|
|
77775
77913
|
(content) => {
|
|
77776
77914
|
const pid = projectIdRef.current;
|
|
77777
77915
|
if (!pid) return;
|
|
@@ -77787,7 +77925,7 @@ function useEditorSave({
|
|
|
77787
77925
|
},
|
|
77788
77926
|
[editingPathRef, projectIdRef, persistCandidate]
|
|
77789
77927
|
);
|
|
77790
|
-
const flushPendingSave =
|
|
77928
|
+
const flushPendingSave = useCallback107(async () => {
|
|
77791
77929
|
if (saveRafRef.current != null) {
|
|
77792
77930
|
cancelAnimationFrame(saveRafRef.current);
|
|
77793
77931
|
saveRafRef.current = null;
|
|
@@ -77801,7 +77939,7 @@ function useEditorSave({
|
|
|
77801
77939
|
}
|
|
77802
77940
|
return await inFlightRef.current ?? { status: "clean" };
|
|
77803
77941
|
}, [persistCandidate]);
|
|
77804
|
-
const discardPendingSave =
|
|
77942
|
+
const discardPendingSave = useCallback107(() => {
|
|
77805
77943
|
if (saveRafRef.current != null) cancelAnimationFrame(saveRafRef.current);
|
|
77806
77944
|
saveRafRef.current = null;
|
|
77807
77945
|
pendingCandidateRef.current = null;
|
|
@@ -77816,7 +77954,7 @@ function useEditorSave({
|
|
|
77816
77954
|
}
|
|
77817
77955
|
|
|
77818
77956
|
// src/hooks/useProjectFileWriter.ts
|
|
77819
|
-
import { useCallback as
|
|
77957
|
+
import { useCallback as useCallback108, useMemo as useMemo73 } from "react";
|
|
77820
77958
|
async function fetchProjectFile(projectId, path, query) {
|
|
77821
77959
|
if (!projectId) throw new Error("No active project");
|
|
77822
77960
|
const response = await studioApiFetch(
|
|
@@ -77833,13 +77971,13 @@ function useProjectFileWriter({ projectId }) {
|
|
|
77833
77971
|
[projectId]
|
|
77834
77972
|
);
|
|
77835
77973
|
const fileVersions = fileVersionScope.versions;
|
|
77836
|
-
const observeProjectFileVersion =
|
|
77974
|
+
const observeProjectFileVersion = useCallback108(
|
|
77837
77975
|
(path, version) => {
|
|
77838
77976
|
fileVersions.set(path, version);
|
|
77839
77977
|
},
|
|
77840
77978
|
[fileVersions]
|
|
77841
77979
|
);
|
|
77842
|
-
const readProjectFile =
|
|
77980
|
+
const readProjectFile = useCallback108(
|
|
77843
77981
|
async (path) => {
|
|
77844
77982
|
const { content, version } = await fetchProjectFile(projectId, path, "");
|
|
77845
77983
|
if (typeof content !== "string") throw new Error(`Missing file contents for ${path}`);
|
|
@@ -77848,7 +77986,7 @@ function useProjectFileWriter({ projectId }) {
|
|
|
77848
77986
|
},
|
|
77849
77987
|
[fileVersions, projectId]
|
|
77850
77988
|
);
|
|
77851
|
-
const readOptionalProjectFile =
|
|
77989
|
+
const readOptionalProjectFile = useCallback108(
|
|
77852
77990
|
async (path) => {
|
|
77853
77991
|
const { content, version } = await fetchProjectFile(projectId, path, "?optional=1");
|
|
77854
77992
|
fileVersions.set(path, version);
|
|
@@ -77856,7 +77994,7 @@ function useProjectFileWriter({ projectId }) {
|
|
|
77856
77994
|
},
|
|
77857
77995
|
[fileVersions, projectId]
|
|
77858
77996
|
);
|
|
77859
|
-
const writeProjectFile =
|
|
77997
|
+
const writeProjectFile = useCallback108(
|
|
77860
77998
|
async (path, content, expectedContent) => {
|
|
77861
77999
|
if (!projectId) throw new Error("No active project");
|
|
77862
78000
|
const writeProjectId = projectId;
|
|
@@ -77952,13 +78090,13 @@ function useFileManager({
|
|
|
77952
78090
|
recordEdit,
|
|
77953
78091
|
setRefreshKey
|
|
77954
78092
|
}) {
|
|
77955
|
-
const [editingFile, setEditingFile] =
|
|
77956
|
-
const [revealSourceOffset, setRevealSourceOffset] =
|
|
77957
|
-
const editingPathRef =
|
|
78093
|
+
const [editingFile, setEditingFile] = useState123(null);
|
|
78094
|
+
const [revealSourceOffset, setRevealSourceOffset] = useState123(null);
|
|
78095
|
+
const editingPathRef = useRef137(editingFile?.path);
|
|
77958
78096
|
editingPathRef.current = editingFile?.path;
|
|
77959
|
-
const projectIdRef =
|
|
78097
|
+
const projectIdRef = useRef137(projectId);
|
|
77960
78098
|
projectIdRef.current = projectId;
|
|
77961
|
-
const importedFontAssetsRef =
|
|
78099
|
+
const importedFontAssetsRef = useRef137([]);
|
|
77962
78100
|
const {
|
|
77963
78101
|
fileVersions,
|
|
77964
78102
|
readProjectFile,
|
|
@@ -77975,12 +78113,12 @@ function useFileManager({
|
|
|
77975
78113
|
assets,
|
|
77976
78114
|
fontAssets
|
|
77977
78115
|
} = useFileTree({ projectId, projectIdRef });
|
|
77978
|
-
const updateEditingFileContent =
|
|
78116
|
+
const updateEditingFileContent = useCallback109((path, content) => {
|
|
77979
78117
|
if (editingPathRef.current === path) {
|
|
77980
78118
|
setEditingFile({ path, content });
|
|
77981
78119
|
}
|
|
77982
78120
|
}, []);
|
|
77983
|
-
const writeProjectFile =
|
|
78121
|
+
const writeProjectFile = useCallback109(
|
|
77984
78122
|
async (path, content, expectedContent) => {
|
|
77985
78123
|
const writeProjectId = projectIdRef.current;
|
|
77986
78124
|
await writeProjectFileRaw(path, content, expectedContent);
|
|
@@ -78000,7 +78138,7 @@ function useFileManager({
|
|
|
78000
78138
|
showToast
|
|
78001
78139
|
});
|
|
78002
78140
|
const { saveRafRef, handleContentChange } = editorSave;
|
|
78003
|
-
const overwriteExternalConflict =
|
|
78141
|
+
const overwriteExternalConflict = useCallback109(
|
|
78004
78142
|
async (conflict) => {
|
|
78005
78143
|
await serializeStudioFileMutation(writeProjectFile, conflict.filePath, async () => {
|
|
78006
78144
|
if (conflict.currentContent != null) {
|
|
@@ -78018,9 +78156,9 @@ function useFileManager({
|
|
|
78018
78156
|
},
|
|
78019
78157
|
[fileVersions, updateEditingFileContent, writeProjectFile]
|
|
78020
78158
|
);
|
|
78021
|
-
const revealRequestIdRef =
|
|
78022
|
-
const revealAbortRef =
|
|
78023
|
-
const handleFileSelect =
|
|
78159
|
+
const revealRequestIdRef = useRef137(0);
|
|
78160
|
+
const revealAbortRef = useRef137(null);
|
|
78161
|
+
const handleFileSelect = useCallback109(
|
|
78024
78162
|
(path) => {
|
|
78025
78163
|
const pid = projectIdRef.current;
|
|
78026
78164
|
if (!pid) return;
|
|
@@ -78045,7 +78183,7 @@ function useFileManager({
|
|
|
78045
78183
|
},
|
|
78046
78184
|
[fileVersions, showToast]
|
|
78047
78185
|
);
|
|
78048
|
-
const openSourceForSelection =
|
|
78186
|
+
const openSourceForSelection = useCallback109(
|
|
78049
78187
|
(sourceFile, target) => {
|
|
78050
78188
|
const pid = projectIdRef.current;
|
|
78051
78189
|
if (!pid || !sourceFile) return;
|
|
@@ -78077,7 +78215,7 @@ function useFileManager({
|
|
|
78077
78215
|
},
|
|
78078
78216
|
[editingFile?.content, fileVersions]
|
|
78079
78217
|
);
|
|
78080
|
-
const uploadProjectFiles =
|
|
78218
|
+
const uploadProjectFiles = useCallback109(
|
|
78081
78219
|
async (files, dir) => {
|
|
78082
78220
|
const pid = projectIdRef.current;
|
|
78083
78221
|
const fileList = Array.from(files);
|
|
@@ -78120,7 +78258,7 @@ function useFileManager({
|
|
|
78120
78258
|
},
|
|
78121
78259
|
[refreshFileTree, setRefreshKey, showToast]
|
|
78122
78260
|
);
|
|
78123
|
-
const handleCreateFile =
|
|
78261
|
+
const handleCreateFile = useCallback109(
|
|
78124
78262
|
async (path) => {
|
|
78125
78263
|
const pid = projectIdRef.current;
|
|
78126
78264
|
if (!pid) return;
|
|
@@ -78147,7 +78285,7 @@ function useFileManager({
|
|
|
78147
78285
|
},
|
|
78148
78286
|
[refreshFileTree, handleFileSelect, showToast]
|
|
78149
78287
|
);
|
|
78150
|
-
const handleCreateFolder =
|
|
78288
|
+
const handleCreateFolder = useCallback109(
|
|
78151
78289
|
async (path) => {
|
|
78152
78290
|
const pid = projectIdRef.current;
|
|
78153
78291
|
if (!pid) return;
|
|
@@ -78169,7 +78307,7 @@ function useFileManager({
|
|
|
78169
78307
|
},
|
|
78170
78308
|
[refreshFileTree, showToast]
|
|
78171
78309
|
);
|
|
78172
|
-
const handleDeleteFile =
|
|
78310
|
+
const handleDeleteFile = useCallback109(
|
|
78173
78311
|
async (path) => {
|
|
78174
78312
|
const pid = projectIdRef.current;
|
|
78175
78313
|
if (!pid) return;
|
|
@@ -78190,7 +78328,7 @@ function useFileManager({
|
|
|
78190
78328
|
},
|
|
78191
78329
|
[refreshFileTree, showToast]
|
|
78192
78330
|
);
|
|
78193
|
-
const handleRenameFile =
|
|
78331
|
+
const handleRenameFile = useCallback109(
|
|
78194
78332
|
async (oldPath, newPath) => {
|
|
78195
78333
|
const pid = projectIdRef.current;
|
|
78196
78334
|
if (!pid) return;
|
|
@@ -78216,7 +78354,7 @@ function useFileManager({
|
|
|
78216
78354
|
},
|
|
78217
78355
|
[refreshFileTree, handleFileSelect, setRefreshKey, showToast]
|
|
78218
78356
|
);
|
|
78219
|
-
const handleDuplicateFile =
|
|
78357
|
+
const handleDuplicateFile = useCallback109(
|
|
78220
78358
|
async (path) => {
|
|
78221
78359
|
const pid = projectIdRef.current;
|
|
78222
78360
|
if (!pid) return;
|
|
@@ -78238,13 +78376,13 @@ function useFileManager({
|
|
|
78238
78376
|
[refreshFileTree, handleFileSelect, showToast]
|
|
78239
78377
|
);
|
|
78240
78378
|
const handleMoveFile = handleRenameFile;
|
|
78241
|
-
const handleImportFiles =
|
|
78379
|
+
const handleImportFiles = useCallback109(
|
|
78242
78380
|
async (files, dir) => {
|
|
78243
78381
|
return uploadProjectFiles(Array.from(files), dir);
|
|
78244
78382
|
},
|
|
78245
78383
|
[uploadProjectFiles]
|
|
78246
78384
|
);
|
|
78247
|
-
const handleImportFonts =
|
|
78385
|
+
const handleImportFonts = useCallback109(
|
|
78248
78386
|
async (files) => {
|
|
78249
78387
|
const pid = projectIdRef.current;
|
|
78250
78388
|
if (!pid) return [];
|
|
@@ -78313,7 +78451,7 @@ function useFileManager({
|
|
|
78313
78451
|
}
|
|
78314
78452
|
|
|
78315
78453
|
// src/hooks/usePreviewPersistence.ts
|
|
78316
|
-
import { useCallback as
|
|
78454
|
+
import { useCallback as useCallback110, useRef as useRef138, useState as useState124 } from "react";
|
|
78317
78455
|
|
|
78318
78456
|
// src/utils/gsapUndoRestore.ts
|
|
78319
78457
|
import { ensureHfIds as ensureHfIds2, isCompositionTemplate as isCompositionTemplate2 } from "@hyperframes/parsers/hf-ids";
|
|
@@ -78686,12 +78824,12 @@ function usePreviewPersistence({
|
|
|
78686
78824
|
reloadPreview
|
|
78687
78825
|
}) {
|
|
78688
78826
|
void _recordEdit;
|
|
78689
|
-
const [domEditSaveQueuePaused, setDomEditSaveQueuePaused] =
|
|
78690
|
-
const domTextCommitVersionRef =
|
|
78691
|
-
const showToastRef =
|
|
78827
|
+
const [domEditSaveQueuePaused, setDomEditSaveQueuePaused] = useState124(null);
|
|
78828
|
+
const domTextCommitVersionRef = useRef138(0);
|
|
78829
|
+
const showToastRef = useRef138(showToast);
|
|
78692
78830
|
showToastRef.current = showToast;
|
|
78693
|
-
const domEditSaveQueueRef =
|
|
78694
|
-
const applyStudioManualEditsToPreviewRef =
|
|
78831
|
+
const domEditSaveQueueRef = useRef138(null);
|
|
78832
|
+
const applyStudioManualEditsToPreviewRef = useRef138(async () => {
|
|
78695
78833
|
});
|
|
78696
78834
|
if (!domEditSaveQueueRef.current) {
|
|
78697
78835
|
domEditSaveQueueRef.current = createDomEditSaveQueue({
|
|
@@ -78711,31 +78849,31 @@ function usePreviewPersistence({
|
|
|
78711
78849
|
}
|
|
78712
78850
|
});
|
|
78713
78851
|
}
|
|
78714
|
-
const queueDomEditSave =
|
|
78852
|
+
const queueDomEditSave = useCallback110((save) => {
|
|
78715
78853
|
return domEditSaveQueueRef.current?.enqueue(save) ?? save();
|
|
78716
78854
|
}, []);
|
|
78717
|
-
const drainPendingDomEditSaves =
|
|
78855
|
+
const drainPendingDomEditSaves = useCallback110(async () => {
|
|
78718
78856
|
return drainStudioSaveQueues(flushStudioPendingEdits, async () => {
|
|
78719
78857
|
return await domEditSaveQueueRef.current?.waitForIdle() ?? { status: "clean" };
|
|
78720
78858
|
});
|
|
78721
78859
|
}, []);
|
|
78722
|
-
const waitForPendingDomEditSaves =
|
|
78860
|
+
const waitForPendingDomEditSaves = useCallback110(async () => {
|
|
78723
78861
|
const result = await drainPendingDomEditSaves();
|
|
78724
78862
|
if (result.status !== "clean") throw result.error;
|
|
78725
78863
|
}, [drainPendingDomEditSaves]);
|
|
78726
|
-
const settlePendingEdits =
|
|
78864
|
+
const settlePendingEdits = useCallback110(async () => {
|
|
78727
78865
|
const queued = domEditSaveQueueRef.current?.waitForIdle();
|
|
78728
78866
|
await flushStudioPendingEdits({ onlyCurrent: true });
|
|
78729
78867
|
await queued;
|
|
78730
78868
|
}, []);
|
|
78731
|
-
const resetDomEditSaveQueueBreaker =
|
|
78869
|
+
const resetDomEditSaveQueueBreaker = useCallback110(() => {
|
|
78732
78870
|
domEditSaveQueueRef.current?.reset();
|
|
78733
78871
|
setDomEditSaveQueuePaused(null);
|
|
78734
78872
|
}, []);
|
|
78735
78873
|
useMountEffect(() => () => {
|
|
78736
78874
|
domEditSaveQueueRef.current?.destroy();
|
|
78737
78875
|
});
|
|
78738
|
-
const applyCurrentStudioManualEditsToPreview =
|
|
78876
|
+
const applyCurrentStudioManualEditsToPreview = useCallback110(
|
|
78739
78877
|
(iframe = previewIframeRef.current) => {
|
|
78740
78878
|
if (!iframe) return;
|
|
78741
78879
|
if (!readIframeDocument(iframe)) return;
|
|
@@ -78743,18 +78881,18 @@ function usePreviewPersistence({
|
|
|
78743
78881
|
},
|
|
78744
78882
|
[previewIframeRef]
|
|
78745
78883
|
);
|
|
78746
|
-
const applyStudioManualEditsToPreview =
|
|
78884
|
+
const applyStudioManualEditsToPreview = useCallback110(
|
|
78747
78885
|
async (iframe = previewIframeRef.current) => {
|
|
78748
78886
|
applyCurrentStudioManualEditsToPreview(iframe);
|
|
78749
78887
|
},
|
|
78750
78888
|
[applyCurrentStudioManualEditsToPreview, previewIframeRef]
|
|
78751
78889
|
);
|
|
78752
78890
|
applyStudioManualEditsToPreviewRef.current = applyStudioManualEditsToPreview;
|
|
78753
|
-
const heldPreviewDoc =
|
|
78891
|
+
const heldPreviewDoc = useCallback110(() => {
|
|
78754
78892
|
const doc = previewIframeRef.current?.contentDocument;
|
|
78755
78893
|
return doc && isStudioManualEditGestureLiveIn(doc) ? doc : null;
|
|
78756
78894
|
}, [previewIframeRef]);
|
|
78757
|
-
const syncHistoryPreviewAfterApply =
|
|
78895
|
+
const syncHistoryPreviewAfterApply = useCallback110(
|
|
78758
78896
|
async (restore2) => {
|
|
78759
78897
|
const projectId = usePlayerStore.getState().timelineProjectId;
|
|
78760
78898
|
const nestedFiles = await settleNestedReads(
|
|
@@ -78787,7 +78925,7 @@ function usePreviewPersistence({
|
|
|
78787
78925
|
},
|
|
78788
78926
|
[previewIframeRef, activeCompPathRef, reloadPreview, heldPreviewDoc]
|
|
78789
78927
|
);
|
|
78790
|
-
const showHistoryRestoreNow =
|
|
78928
|
+
const showHistoryRestoreNow = useCallback110(
|
|
78791
78929
|
(files) => {
|
|
78792
78930
|
if (!domEditSaveQueueRef.current?.isIdle() || hasStudioPendingEdits() || heldPreviewDoc())
|
|
78793
78931
|
return null;
|
|
@@ -78824,11 +78962,11 @@ function usePreviewPersistence({
|
|
|
78824
78962
|
}
|
|
78825
78963
|
|
|
78826
78964
|
// src/hooks/usePreviewDocumentVersion.ts
|
|
78827
|
-
import { useCallback as
|
|
78965
|
+
import { useCallback as useCallback111, useEffect as useEffect120, useRef as useRef139, useState as useState125 } from "react";
|
|
78828
78966
|
function usePreviewDocumentVersion() {
|
|
78829
|
-
const [previewDocumentVersion, setPreviewDocumentVersion] =
|
|
78830
|
-
const refreshTimersRef =
|
|
78831
|
-
const refresh2 =
|
|
78967
|
+
const [previewDocumentVersion, setPreviewDocumentVersion] = useState125(0);
|
|
78968
|
+
const refreshTimersRef = useRef139([]);
|
|
78969
|
+
const refresh2 = useCallback111(() => {
|
|
78832
78970
|
for (const id of refreshTimersRef.current) clearTimeout(id);
|
|
78833
78971
|
refreshTimersRef.current = [];
|
|
78834
78972
|
setPreviewDocumentVersion((v) => v + 1);
|
|
@@ -78847,10 +78985,10 @@ function usePreviewDocumentVersion() {
|
|
|
78847
78985
|
}
|
|
78848
78986
|
|
|
78849
78987
|
// src/hooks/useTimelineEditing.ts
|
|
78850
|
-
import { useRef as
|
|
78988
|
+
import { useRef as useRef147 } from "react";
|
|
78851
78989
|
|
|
78852
78990
|
// src/hooks/useRazorSplit.ts
|
|
78853
|
-
import { useCallback as
|
|
78991
|
+
import { useCallback as useCallback113, useRef as useRef141 } from "react";
|
|
78854
78992
|
|
|
78855
78993
|
// src/utils/razorSplitTransaction.ts
|
|
78856
78994
|
function targetIdentity(path, target) {
|
|
@@ -78975,7 +79113,7 @@ function runAtomicCutTransaction(input) {
|
|
|
78975
79113
|
}
|
|
78976
79114
|
|
|
78977
79115
|
// src/hooks/useFreezeFrame.ts
|
|
78978
|
-
import { useCallback as
|
|
79116
|
+
import { useCallback as useCallback112, useRef as useRef140 } from "react";
|
|
78979
79117
|
function isFreezeFrameResponse(value) {
|
|
78980
79118
|
if (typeof value !== "object" || value === null) return false;
|
|
78981
79119
|
const body = value;
|
|
@@ -79024,9 +79162,9 @@ async function requestFreezeFrame(input) {
|
|
|
79024
79162
|
return body;
|
|
79025
79163
|
}
|
|
79026
79164
|
function useFreezeFrame(options) {
|
|
79027
|
-
const optionsRef =
|
|
79165
|
+
const optionsRef = useRef140(options);
|
|
79028
79166
|
optionsRef.current = options;
|
|
79029
|
-
return
|
|
79167
|
+
return useCallback112(async (element, playhead) => {
|
|
79030
79168
|
const opts = optionsRef.current;
|
|
79031
79169
|
if (opts.isRecordingRef?.current) {
|
|
79032
79170
|
opts.showToast("Cannot edit timeline while recording", "error");
|
|
@@ -79071,9 +79209,9 @@ function useRazorSplit({
|
|
|
79071
79209
|
forceReloadSdkSession,
|
|
79072
79210
|
isRecordingRef
|
|
79073
79211
|
}) {
|
|
79074
|
-
const projectIdRef =
|
|
79212
|
+
const projectIdRef = useRef141(projectId);
|
|
79075
79213
|
projectIdRef.current = projectId;
|
|
79076
|
-
const synchronize =
|
|
79214
|
+
const synchronize = useCallback113(() => {
|
|
79077
79215
|
let failure2;
|
|
79078
79216
|
try {
|
|
79079
79217
|
forceReloadSdkSession?.();
|
|
@@ -79087,7 +79225,7 @@ function useRazorSplit({
|
|
|
79087
79225
|
}
|
|
79088
79226
|
if (failure2) throw failure2;
|
|
79089
79227
|
}, [forceReloadSdkSession, reloadPreview]);
|
|
79090
|
-
const runCut =
|
|
79228
|
+
const runCut = useCallback113(
|
|
79091
79229
|
async (elements, splitTime, mode) => {
|
|
79092
79230
|
const pid = projectIdRef.current;
|
|
79093
79231
|
if (!pid || elements.length === 0) return;
|
|
@@ -79127,7 +79265,7 @@ function useRazorSplit({
|
|
|
79127
79265
|
writeProjectFile
|
|
79128
79266
|
]
|
|
79129
79267
|
);
|
|
79130
|
-
const handleRazorSplit =
|
|
79268
|
+
const handleRazorSplit = useCallback113(
|
|
79131
79269
|
async (element, splitTime) => {
|
|
79132
79270
|
if (isRecordingRef?.current) {
|
|
79133
79271
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -79155,7 +79293,7 @@ function useRazorSplit({
|
|
|
79155
79293
|
},
|
|
79156
79294
|
[isRecordingRef, runCut, showToast]
|
|
79157
79295
|
);
|
|
79158
|
-
const handleRazorSplitAll =
|
|
79296
|
+
const handleRazorSplitAll = useCallback113(
|
|
79159
79297
|
async (splitTime) => {
|
|
79160
79298
|
if (isRecordingRef?.current) {
|
|
79161
79299
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -79193,7 +79331,7 @@ function useRazorSplit({
|
|
|
79193
79331
|
}
|
|
79194
79332
|
|
|
79195
79333
|
// src/hooks/useTimelineAssetDropOps.ts
|
|
79196
|
-
import { useCallback as
|
|
79334
|
+
import { useCallback as useCallback114 } from "react";
|
|
79197
79335
|
|
|
79198
79336
|
// src/utils/timelineDropTrackInsert.ts
|
|
79199
79337
|
function planDropTrackInsert(input) {
|
|
@@ -79358,7 +79496,7 @@ function useTimelineAssetDropOps({
|
|
|
79358
79496
|
observeProjectFileVersion,
|
|
79359
79497
|
checkEditable
|
|
79360
79498
|
}) {
|
|
79361
|
-
const dropAssetAt =
|
|
79499
|
+
const dropAssetAt = useCallback114(
|
|
79362
79500
|
// fallow-ignore-next-line complexity
|
|
79363
79501
|
async (assetPath, placement, durationOverride, gesture = { placed: [], onNewTrack: false }) => {
|
|
79364
79502
|
if (isRecordingRef?.current) {
|
|
@@ -79467,13 +79605,13 @@ function useTimelineAssetDropOps({
|
|
|
79467
79605
|
checkEditable
|
|
79468
79606
|
]
|
|
79469
79607
|
);
|
|
79470
|
-
const handleTimelineAssetDrop =
|
|
79608
|
+
const handleTimelineAssetDrop = useCallback114(
|
|
79471
79609
|
async (assetPath, placement, durationOverride) => {
|
|
79472
79610
|
await dropAssetAt(assetPath, placement, durationOverride);
|
|
79473
79611
|
},
|
|
79474
79612
|
[dropAssetAt]
|
|
79475
79613
|
);
|
|
79476
|
-
const handleTimelineFileDrop =
|
|
79614
|
+
const handleTimelineFileDrop = useCallback114(
|
|
79477
79615
|
// fallow-ignore-next-line complexity
|
|
79478
79616
|
async (files, placement) => {
|
|
79479
79617
|
if (isRecordingRef?.current) {
|
|
@@ -79523,7 +79661,7 @@ function useTimelineAssetDropOps({
|
|
|
79523
79661
|
showToast
|
|
79524
79662
|
]
|
|
79525
79663
|
);
|
|
79526
|
-
const handleTimelineCompositionDrop =
|
|
79664
|
+
const handleTimelineCompositionDrop = useCallback114(
|
|
79527
79665
|
async (sourcePath, placement) => {
|
|
79528
79666
|
if (isRecordingRef?.current) {
|
|
79529
79667
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -79574,10 +79712,10 @@ function useTimelineAssetDropOps({
|
|
|
79574
79712
|
}
|
|
79575
79713
|
|
|
79576
79714
|
// src/hooks/timelineAudioGroupVolume.ts
|
|
79577
|
-
import { useCallback as
|
|
79715
|
+
import { useCallback as useCallback116 } from "react";
|
|
79578
79716
|
|
|
79579
79717
|
// src/hooks/timelineEditPermission.ts
|
|
79580
|
-
import { useCallback as
|
|
79718
|
+
import { useCallback as useCallback115 } from "react";
|
|
79581
79719
|
function projectForTimelineSave(isRecording, projectId, showToast) {
|
|
79582
79720
|
if (isRecording) {
|
|
79583
79721
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -79597,7 +79735,7 @@ function timelineEditRefusal(canEdit, targets) {
|
|
|
79597
79735
|
return null;
|
|
79598
79736
|
}
|
|
79599
79737
|
function useTimelineEditRefusal(canEdit, showToast) {
|
|
79600
|
-
return
|
|
79738
|
+
return useCallback115(
|
|
79601
79739
|
(targets) => {
|
|
79602
79740
|
const reason = timelineEditRefusal(canEdit, targets);
|
|
79603
79741
|
if (reason !== null) showToast(reason, "error");
|
|
@@ -79608,7 +79746,7 @@ function useTimelineEditRefusal(canEdit, showToast) {
|
|
|
79608
79746
|
}
|
|
79609
79747
|
function useTimelineEditGate(canEdit, showToast) {
|
|
79610
79748
|
const refuse2 = useTimelineEditRefusal(canEdit, showToast);
|
|
79611
|
-
return
|
|
79749
|
+
return useCallback115(
|
|
79612
79750
|
(targets) => refuse2(targets) === null,
|
|
79613
79751
|
[refuse2]
|
|
79614
79752
|
);
|
|
@@ -79619,7 +79757,7 @@ import { HF_AUDIO_FX_ATTR as HF_AUDIO_FX_ATTR13 } from "@hyperframes/core/audio-
|
|
|
79619
79757
|
import { HF_AUDIO_AUTOMATION_ATTR as HF_AUDIO_AUTOMATION_ATTR8 } from "@hyperframes/core/audio-automation";
|
|
79620
79758
|
|
|
79621
79759
|
// src/hooks/liveLanes.ts
|
|
79622
|
-
import { useRef as
|
|
79760
|
+
import { useRef as useRef142, useState as useState126 } from "react";
|
|
79623
79761
|
function createLiveLanes(project, composition) {
|
|
79624
79762
|
const before = /* @__PURE__ */ new Map();
|
|
79625
79763
|
const sources = /* @__PURE__ */ new Map();
|
|
@@ -79724,9 +79862,9 @@ function restoredValue({ path, target, attr: attr2 }, files) {
|
|
|
79724
79862
|
return html2 === void 0 || !target ? void 0 : readTargetAttribute(html2, target, attr2);
|
|
79725
79863
|
}
|
|
79726
79864
|
function useLiveLanes(projectIdRef, activeCompPath) {
|
|
79727
|
-
const compositionRef =
|
|
79865
|
+
const compositionRef = useRef142(activeCompPath);
|
|
79728
79866
|
compositionRef.current = activeCompPath;
|
|
79729
|
-
const [lanes] =
|
|
79867
|
+
const [lanes] = useState126(
|
|
79730
79868
|
() => createLiveLanes(
|
|
79731
79869
|
() => projectIdRef.current ?? "",
|
|
79732
79870
|
() => compositionRef.current ?? ""
|
|
@@ -79837,7 +79975,7 @@ function useSetAudioGroupAttribute({
|
|
|
79837
79975
|
isRecordingRef
|
|
79838
79976
|
}) {
|
|
79839
79977
|
const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
|
|
79840
|
-
const setLive =
|
|
79978
|
+
const setLive = useCallback116(
|
|
79841
79979
|
(groupId, attr2, value) => {
|
|
79842
79980
|
const key2 = audioGroupAttributeLiveKey(groupId, attr2);
|
|
79843
79981
|
const target = previewIframeRef.current?.contentDocument?.getElementById(groupId);
|
|
@@ -79851,22 +79989,22 @@ function useSetAudioGroupAttribute({
|
|
|
79851
79989
|
},
|
|
79852
79990
|
[liveLanes, previewIframeRef, activeCompPath]
|
|
79853
79991
|
);
|
|
79854
|
-
const laneApply =
|
|
79992
|
+
const laneApply = useCallback116(
|
|
79855
79993
|
(groupId, attr2) => ({
|
|
79856
79994
|
preview: (value) => patchLiveGroupAttribute(previewIframeRef.current, groupId, attr2, value),
|
|
79857
79995
|
store: (value) => syncStoredGroupAttribute(groupId, attr2, value)
|
|
79858
79996
|
}),
|
|
79859
79997
|
[previewIframeRef]
|
|
79860
79998
|
);
|
|
79861
|
-
const claimLive =
|
|
79999
|
+
const claimLive = useCallback116(
|
|
79862
80000
|
(groupId, attr2, source) => liveLanes.claim(audioGroupAttributeLiveKey(groupId, attr2), laneApply(groupId, attr2), source),
|
|
79863
80001
|
[liveLanes, laneApply]
|
|
79864
80002
|
);
|
|
79865
|
-
const revertLive =
|
|
80003
|
+
const revertLive = useCallback116(
|
|
79866
80004
|
(groupId, attr2) => liveLanes.revert(audioGroupAttributeLiveKey(groupId, attr2), laneApply(groupId, attr2)),
|
|
79867
80005
|
[liveLanes, laneApply]
|
|
79868
80006
|
);
|
|
79869
|
-
const setQuiet =
|
|
80007
|
+
const setQuiet = useCallback116(
|
|
79870
80008
|
async (groupId, attr2, value, label) => {
|
|
79871
80009
|
const project = projectIdRef.current;
|
|
79872
80010
|
const pid = projectForTimelineSave(isRecordingRef?.current, project, showToast);
|
|
@@ -79920,7 +80058,7 @@ function useSetAudioGroupAttribute({
|
|
|
79920
80058
|
}
|
|
79921
80059
|
|
|
79922
80060
|
// src/hooks/timelineElementFxAttribute.ts
|
|
79923
|
-
import { useCallback as
|
|
80061
|
+
import { useCallback as useCallback117 } from "react";
|
|
79924
80062
|
function patchLiveElementAttribute(iframe, element, attr2, value, activeCompPath) {
|
|
79925
80063
|
const target = findTimelineElementInIframe(iframe, element, activeCompPath);
|
|
79926
80064
|
if (!target) return;
|
|
@@ -79980,7 +80118,7 @@ function useSetElementAttribute({
|
|
|
79980
80118
|
isRecordingRef
|
|
79981
80119
|
}) {
|
|
79982
80120
|
const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
|
|
79983
|
-
const setLive =
|
|
80121
|
+
const setLive = useCallback117(
|
|
79984
80122
|
(element, attr2, value) => {
|
|
79985
80123
|
const key2 = elementAttributeLiveKey(element, activeCompPath, attr2);
|
|
79986
80124
|
const target = findTimelineElementInIframe(previewIframeRef.current, element, activeCompPath);
|
|
@@ -79993,14 +80131,14 @@ function useSetElementAttribute({
|
|
|
79993
80131
|
},
|
|
79994
80132
|
[liveLanes, previewIframeRef, activeCompPath]
|
|
79995
80133
|
);
|
|
79996
|
-
const laneApply =
|
|
80134
|
+
const laneApply = useCallback117(
|
|
79997
80135
|
(element, attr2) => ({
|
|
79998
80136
|
preview: (value) => patchLiveElementAttribute(previewIframeRef.current, element, attr2, value, activeCompPath),
|
|
79999
80137
|
store: (value) => syncStoredElementAttribute(element, attr2, value)
|
|
80000
80138
|
}),
|
|
80001
80139
|
[previewIframeRef, activeCompPath]
|
|
80002
80140
|
);
|
|
80003
|
-
const claimLive =
|
|
80141
|
+
const claimLive = useCallback117(
|
|
80004
80142
|
(element, attr2) => liveLanes.claim(
|
|
80005
80143
|
elementAttributeLiveKey(element, activeCompPath, attr2),
|
|
80006
80144
|
laneApply(element, attr2),
|
|
@@ -80008,14 +80146,14 @@ function useSetElementAttribute({
|
|
|
80008
80146
|
),
|
|
80009
80147
|
[liveLanes, laneApply, activeCompPath]
|
|
80010
80148
|
);
|
|
80011
|
-
const revertLive =
|
|
80149
|
+
const revertLive = useCallback117(
|
|
80012
80150
|
(element, attr2) => liveLanes.revert(
|
|
80013
80151
|
elementAttributeLiveKey(element, activeCompPath, attr2),
|
|
80014
80152
|
laneApply(element, attr2)
|
|
80015
80153
|
),
|
|
80016
80154
|
[liveLanes, laneApply, activeCompPath]
|
|
80017
80155
|
);
|
|
80018
|
-
const setQuiet =
|
|
80156
|
+
const setQuiet = useCallback117(
|
|
80019
80157
|
async (element, attr2, value, label) => {
|
|
80020
80158
|
const project = projectIdRef.current;
|
|
80021
80159
|
const pid = projectForTimelineSave(isRecordingRef?.current, project, showToast);
|
|
@@ -80067,14 +80205,16 @@ function useSetElementAttribute({
|
|
|
80067
80205
|
}
|
|
80068
80206
|
|
|
80069
80207
|
// src/hooks/timelineElementsAttribute.ts
|
|
80070
|
-
import { useCallback as
|
|
80071
|
-
function editsByFile(edits, activeCompPath) {
|
|
80208
|
+
import { useCallback as useCallback118 } from "react";
|
|
80209
|
+
function editsByFile(edits, attr2, activeCompPath) {
|
|
80072
80210
|
const byFile = /* @__PURE__ */ new Map();
|
|
80073
80211
|
for (const { element, value } of edits) {
|
|
80074
|
-
const target = buildPatchTarget(element);
|
|
80075
|
-
if (!target) throw new Error("A clip has no id to save it by");
|
|
80076
80212
|
const path = element.sourceFile || activeCompPath || "index.html";
|
|
80077
|
-
|
|
80213
|
+
const change = {
|
|
80214
|
+
element,
|
|
80215
|
+
buildPatches: (html2, target) => applyPatchByTarget(html2, target, { type: "attribute", property: attr2, value })
|
|
80216
|
+
};
|
|
80217
|
+
byFile.set(path, [...byFile.get(path) ?? [], change]);
|
|
80078
80218
|
}
|
|
80079
80219
|
return byFile;
|
|
80080
80220
|
}
|
|
@@ -80096,7 +80236,7 @@ function useSetElementsAttribute({
|
|
|
80096
80236
|
pendingTimelineEditPathRef,
|
|
80097
80237
|
isRecordingRef
|
|
80098
80238
|
}) {
|
|
80099
|
-
return
|
|
80239
|
+
return useCallback118(
|
|
80100
80240
|
async (edits, attr2, label) => {
|
|
80101
80241
|
const projectId = projectForTimelineSave(
|
|
80102
80242
|
isRecordingRef?.current,
|
|
@@ -80106,14 +80246,11 @@ function useSetElementsAttribute({
|
|
|
80106
80246
|
if (typeof projectId !== "string") return projectId;
|
|
80107
80247
|
if (edits.length === 0) return { status: "saved" };
|
|
80108
80248
|
try {
|
|
80109
|
-
const byFile = editsByFile(edits, activeCompPath);
|
|
80249
|
+
const byFile = editsByFile(edits, attr2, activeCompPath);
|
|
80110
80250
|
const files = Object.fromEntries(
|
|
80111
|
-
[...byFile].map(([path,
|
|
80251
|
+
[...byFile].map(([path, changes]) => [
|
|
80112
80252
|
path,
|
|
80113
|
-
(before) =>
|
|
80114
|
-
(html2, { target, value }) => applyPatchByTarget(html2, target, { type: "attribute", property: attr2, value }),
|
|
80115
|
-
before
|
|
80116
|
-
)
|
|
80253
|
+
(before) => patchTimelineChangesInSource(before, path, changes)
|
|
80117
80254
|
])
|
|
80118
80255
|
);
|
|
80119
80256
|
for (const path of byFile.keys()) pendingTimelineEditPathRef.current.add(path);
|
|
@@ -80147,7 +80284,7 @@ function useSetElementsAttribute({
|
|
|
80147
80284
|
}
|
|
80148
80285
|
|
|
80149
80286
|
// src/hooks/useTimelineDeleteOps.ts
|
|
80150
|
-
import { useCallback as
|
|
80287
|
+
import { useCallback as useCallback119, useRef as useRef143 } from "react";
|
|
80151
80288
|
function applyRippleShifts(survivors, changes) {
|
|
80152
80289
|
if (!changes) return survivors;
|
|
80153
80290
|
const newStartByElement = new Map(changes.map((c) => [c.element, c.start]));
|
|
@@ -80173,8 +80310,8 @@ function useTimelineDeleteOps({
|
|
|
80173
80310
|
previewIframeRef,
|
|
80174
80311
|
handleTimelineGroupMove
|
|
80175
80312
|
}) {
|
|
80176
|
-
const rippleNoticeShownRef =
|
|
80177
|
-
const handleTimelineElementsDelete =
|
|
80313
|
+
const rippleNoticeShownRef = useRef143(false);
|
|
80314
|
+
const handleTimelineElementsDelete = useCallback119(
|
|
80178
80315
|
// fallow-ignore-next-line complexity
|
|
80179
80316
|
async (selection, alsoUnlink = []) => {
|
|
80180
80317
|
if (isRecordingRef?.current) {
|
|
@@ -80308,7 +80445,7 @@ function useTimelineDeleteOps({
|
|
|
80308
80445
|
handleTimelineGroupMove
|
|
80309
80446
|
]
|
|
80310
80447
|
);
|
|
80311
|
-
const handleTimelineElementDelete =
|
|
80448
|
+
const handleTimelineElementDelete = useCallback119(
|
|
80312
80449
|
async (element) => {
|
|
80313
80450
|
await handleTimelineElementsDelete([element]);
|
|
80314
80451
|
},
|
|
@@ -80318,13 +80455,13 @@ function useTimelineDeleteOps({
|
|
|
80318
80455
|
}
|
|
80319
80456
|
|
|
80320
80457
|
// src/hooks/useTimelineEditGuard.ts
|
|
80321
|
-
import { useCallback as
|
|
80458
|
+
import { useCallback as useCallback120, useRef as useRef144 } from "react";
|
|
80322
80459
|
function useTimelineEditGuard(canEdit, showToast) {
|
|
80323
80460
|
const refuseEdit = useTimelineEditRefusal(canEdit, showToast);
|
|
80324
|
-
const refuseEditRef =
|
|
80461
|
+
const refuseEditRef = useRef144(refuseEdit);
|
|
80325
80462
|
refuseEditRef.current = refuseEdit;
|
|
80326
|
-
const guardedRef =
|
|
80327
|
-
const guard =
|
|
80463
|
+
const guardedRef = useRef144(/* @__PURE__ */ new WeakMap());
|
|
80464
|
+
const guard = useCallback120(
|
|
80328
80465
|
(resolveTargets, fn, onRefused) => {
|
|
80329
80466
|
const key2 = fn;
|
|
80330
80467
|
const cached5 = guardedRef.current.get(key2);
|
|
@@ -80351,7 +80488,7 @@ function useTimelineEditGuard(canEdit, showToast) {
|
|
|
80351
80488
|
}
|
|
80352
80489
|
|
|
80353
80490
|
// src/hooks/useTimelineLinkEditing.ts
|
|
80354
|
-
import { useCallback as
|
|
80491
|
+
import { useCallback as useCallback121 } from "react";
|
|
80355
80492
|
|
|
80356
80493
|
// src/hooks/timelineLinkEditPlan.ts
|
|
80357
80494
|
var keyOf15 = (el) => el.key ?? el.id;
|
|
@@ -80478,7 +80615,7 @@ function useTimelineLinkEditing({
|
|
|
80478
80615
|
forceReloadSdkSession,
|
|
80479
80616
|
handleTimelineElementsDelete
|
|
80480
80617
|
}) {
|
|
80481
|
-
const handleLinkEdit =
|
|
80618
|
+
const handleLinkEdit = useCallback121(
|
|
80482
80619
|
async (edit) => {
|
|
80483
80620
|
if (isRecordingRef?.current) {
|
|
80484
80621
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -80533,7 +80670,7 @@ function useTimelineLinkEditing({
|
|
|
80533
80670
|
writeProjectFile
|
|
80534
80671
|
]
|
|
80535
80672
|
);
|
|
80536
|
-
const handleLinkedElementsDelete =
|
|
80673
|
+
const handleLinkedElementsDelete = useCallback121(
|
|
80537
80674
|
(selection) => {
|
|
80538
80675
|
if (isLinkedSelectionOn()) return handleTimelineElementsDelete(withLinkPartners(selection));
|
|
80539
80676
|
const removed = new Set(selection.map(keyOf16));
|
|
@@ -80544,11 +80681,11 @@ function useTimelineLinkEditing({
|
|
|
80544
80681
|
},
|
|
80545
80682
|
[handleTimelineElementsDelete]
|
|
80546
80683
|
);
|
|
80547
|
-
const handleLinkedElementDelete =
|
|
80684
|
+
const handleLinkedElementDelete = useCallback121(
|
|
80548
80685
|
(element) => handleLinkedElementsDelete([element]),
|
|
80549
80686
|
[handleLinkedElementsDelete]
|
|
80550
80687
|
);
|
|
80551
|
-
const handleDeleteElementOnly =
|
|
80688
|
+
const handleDeleteElementOnly = useCallback121(
|
|
80552
80689
|
(element) => {
|
|
80553
80690
|
const orphans = clipsToUnlink([element], usePlayerStore.getState().elements).filter(
|
|
80554
80691
|
(el) => keyOf16(el) !== keyOf16(element)
|
|
@@ -80566,10 +80703,10 @@ function useTimelineLinkEditing({
|
|
|
80566
80703
|
}
|
|
80567
80704
|
|
|
80568
80705
|
// src/hooks/useTrackPendingTimelineEdit.ts
|
|
80569
|
-
import { useCallback as
|
|
80706
|
+
import { useCallback as useCallback122, useRef as useRef145 } from "react";
|
|
80570
80707
|
function useTrackPendingTimelineEdit() {
|
|
80571
|
-
const wrappedRef =
|
|
80572
|
-
return
|
|
80708
|
+
const wrappedRef = useRef145(/* @__PURE__ */ new WeakMap());
|
|
80709
|
+
return useCallback122((fn) => {
|
|
80573
80710
|
const key2 = fn;
|
|
80574
80711
|
const cached5 = wrappedRef.current.get(key2);
|
|
80575
80712
|
if (cached5) return cached5;
|
|
@@ -80580,11 +80717,11 @@ function useTrackPendingTimelineEdit() {
|
|
|
80580
80717
|
}
|
|
80581
80718
|
|
|
80582
80719
|
// src/hooks/timelineAudioGroupCreate.ts
|
|
80583
|
-
import { useCallback as
|
|
80720
|
+
import { useCallback as useCallback124 } from "react";
|
|
80584
80721
|
import { HF_AUDIO_GROUP_ATTR as HF_AUDIO_GROUP_ATTR5, HF_AUDIO_GROUP_TAG as HF_AUDIO_GROUP_TAG6 } from "@hyperframes/core/audio-groups";
|
|
80585
80722
|
|
|
80586
80723
|
// src/hooks/timelineTrackVisibility.ts
|
|
80587
|
-
import { useCallback as
|
|
80724
|
+
import { useCallback as useCallback123 } from "react";
|
|
80588
80725
|
function getTimelineElementTargetPath(element, activeCompPath) {
|
|
80589
80726
|
return element.sourceFile || activeCompPath || "index.html";
|
|
80590
80727
|
}
|
|
@@ -80735,7 +80872,7 @@ function useTimelineTrackVisibilityEditing({
|
|
|
80735
80872
|
forceReloadSdkSession
|
|
80736
80873
|
}) {
|
|
80737
80874
|
const timelineElements = usePlayerStore((state) => state.elements);
|
|
80738
|
-
return
|
|
80875
|
+
return useCallback123(
|
|
80739
80876
|
async (track2, hidden, displayNumber) => {
|
|
80740
80877
|
if (isRecordingRef?.current) {
|
|
80741
80878
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -80789,7 +80926,7 @@ function useTimelineElementVisibilityEditing({
|
|
|
80789
80926
|
forceReloadSdkSession
|
|
80790
80927
|
}) {
|
|
80791
80928
|
const timelineElements = usePlayerStore((state) => state.elements);
|
|
80792
|
-
return
|
|
80929
|
+
return useCallback123(
|
|
80793
80930
|
async (elementKey3, hidden) => {
|
|
80794
80931
|
if (isRecordingRef?.current) {
|
|
80795
80932
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -80964,7 +81101,7 @@ function useAudioGroupCarveAssignment({
|
|
|
80964
81101
|
checkEditable
|
|
80965
81102
|
}) {
|
|
80966
81103
|
const timelineElements = usePlayerStore((state) => state.elements);
|
|
80967
|
-
return
|
|
81104
|
+
return useCallback124(
|
|
80968
81105
|
async (clipIds, groupId, groupLabel2) => {
|
|
80969
81106
|
if (isRecordingRef?.current) {
|
|
80970
81107
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -81019,7 +81156,7 @@ function useAudioGroupCarveAssignment({
|
|
|
81019
81156
|
}
|
|
81020
81157
|
|
|
81021
81158
|
// src/hooks/useTimelineGroupEditing.ts
|
|
81022
|
-
import { useCallback as
|
|
81159
|
+
import { useCallback as useCallback125 } from "react";
|
|
81023
81160
|
function targetPathFor(element, activeCompPath) {
|
|
81024
81161
|
return element.sourceFile || activeCompPath || "index.html";
|
|
81025
81162
|
}
|
|
@@ -81052,7 +81189,7 @@ function useTimelineGroupEditing({
|
|
|
81052
81189
|
showToast,
|
|
81053
81190
|
writeProjectFile
|
|
81054
81191
|
}) {
|
|
81055
|
-
const enqueueGroupOperation =
|
|
81192
|
+
const enqueueGroupOperation = useCallback125(
|
|
81056
81193
|
(label, operation) => {
|
|
81057
81194
|
if (isRecordingRef?.current) {
|
|
81058
81195
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -81071,7 +81208,7 @@ function useTimelineGroupEditing({
|
|
|
81071
81208
|
},
|
|
81072
81209
|
[editQueueRef, isRecordingRef, projectIdRef, showToast]
|
|
81073
81210
|
);
|
|
81074
|
-
const persistServerBatch =
|
|
81211
|
+
const persistServerBatch = useCallback125(
|
|
81075
81212
|
async (projectId, label, batchChanges, coalesceKey, coalesceMs) => {
|
|
81076
81213
|
await persistTimelineBatchEdit({
|
|
81077
81214
|
projectId,
|
|
@@ -81094,7 +81231,7 @@ function useTimelineGroupEditing({
|
|
|
81094
81231
|
writeProjectFile
|
|
81095
81232
|
]
|
|
81096
81233
|
);
|
|
81097
|
-
const trySdkBatchPersist =
|
|
81234
|
+
const trySdkBatchPersist = useCallback125(
|
|
81098
81235
|
async (input) => {
|
|
81099
81236
|
const sharedPath = allChangesSharePath(input.changes, activeCompPath);
|
|
81100
81237
|
const canUseSdk = !input.needsExtension && sharedPath !== null && input.eligible && input.sdkChanges.every((change) => change !== null);
|
|
@@ -81130,7 +81267,7 @@ function useTimelineGroupEditing({
|
|
|
81130
81267
|
writeProjectFile
|
|
81131
81268
|
]
|
|
81132
81269
|
);
|
|
81133
|
-
const handleTimelineGroupMove =
|
|
81270
|
+
const handleTimelineGroupMove = useCallback125(
|
|
81134
81271
|
(changes, options) => {
|
|
81135
81272
|
if (changes.length === 0) return Promise.resolve();
|
|
81136
81273
|
for (const change of changes) {
|
|
@@ -81229,7 +81366,7 @@ function useTimelineGroupEditing({
|
|
|
81229
81366
|
writeProjectFile
|
|
81230
81367
|
]
|
|
81231
81368
|
);
|
|
81232
|
-
const handleTimelineGroupResize =
|
|
81369
|
+
const handleTimelineGroupResize = useCallback125(
|
|
81233
81370
|
(changes, options) => {
|
|
81234
81371
|
if (changes.length === 0) return Promise.resolve();
|
|
81235
81372
|
for (const change of changes) {
|
|
@@ -81329,7 +81466,7 @@ function useTimelineGroupEditing({
|
|
|
81329
81466
|
}
|
|
81330
81467
|
|
|
81331
81468
|
// src/hooks/useTimelineClipTimingEditing.ts
|
|
81332
|
-
import { useCallback as
|
|
81469
|
+
import { useCallback as useCallback126 } from "react";
|
|
81333
81470
|
function useTimelineClipTimingEditing({
|
|
81334
81471
|
activeCompPath,
|
|
81335
81472
|
timelineElements,
|
|
@@ -81348,7 +81485,7 @@ function useTimelineClipTimingEditing({
|
|
|
81348
81485
|
editQueueRef,
|
|
81349
81486
|
projectIdRef
|
|
81350
81487
|
}) {
|
|
81351
|
-
const enqueueEdit =
|
|
81488
|
+
const enqueueEdit = useCallback126(
|
|
81352
81489
|
(element, label, buildPatches, step) => {
|
|
81353
81490
|
if (isRecordingRef?.current) {
|
|
81354
81491
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -81388,7 +81525,7 @@ function useTimelineClipTimingEditing({
|
|
|
81388
81525
|
projectIdRef
|
|
81389
81526
|
]
|
|
81390
81527
|
);
|
|
81391
|
-
const handleTimelineElementMove =
|
|
81528
|
+
const handleTimelineElementMove = useCallback126(
|
|
81392
81529
|
// fallow-ignore-next-line complexity
|
|
81393
81530
|
(element, updates) => {
|
|
81394
81531
|
const commitMove = () => {
|
|
@@ -81495,7 +81632,7 @@ function useTimelineClipTimingEditing({
|
|
|
81495
81632
|
projectIdRef
|
|
81496
81633
|
]
|
|
81497
81634
|
);
|
|
81498
|
-
const handleTimelineElementResize =
|
|
81635
|
+
const handleTimelineElementResize = useCallback126(
|
|
81499
81636
|
// fallow-ignore-next-line complexity
|
|
81500
81637
|
(element, updates) => {
|
|
81501
81638
|
const authoredStart = toAuthoredStart(element, updates.start);
|
|
@@ -81581,11 +81718,11 @@ function useTimelineClipTimingEditing({
|
|
|
81581
81718
|
}
|
|
81582
81719
|
|
|
81583
81720
|
// src/hooks/useBlockedTimelineEditToast.ts
|
|
81584
|
-
import { useCallback as
|
|
81721
|
+
import { useCallback as useCallback127, useRef as useRef146 } from "react";
|
|
81585
81722
|
var BLOCKED_TOAST_INTERVAL_MS = 1500;
|
|
81586
81723
|
function useBlockedTimelineEditToast(showToast) {
|
|
81587
|
-
const lastAtRef =
|
|
81588
|
-
return
|
|
81724
|
+
const lastAtRef = useRef146(0);
|
|
81725
|
+
return useCallback127(
|
|
81589
81726
|
(_element) => {
|
|
81590
81727
|
const now2 = Date.now();
|
|
81591
81728
|
if (now2 - lastAtRef.current < BLOCKED_TOAST_INTERVAL_MS) return;
|
|
@@ -81617,9 +81754,9 @@ function useTimelineEditing({
|
|
|
81617
81754
|
handleDomZIndexReorderCommitRef,
|
|
81618
81755
|
canEdit
|
|
81619
81756
|
}) {
|
|
81620
|
-
const projectIdRef =
|
|
81757
|
+
const projectIdRef = useRef147(projectId);
|
|
81621
81758
|
projectIdRef.current = projectId;
|
|
81622
|
-
const editQueueRef =
|
|
81759
|
+
const editQueueRef = useRef147(Promise.resolve());
|
|
81623
81760
|
const track2 = useTrackPendingTimelineEdit();
|
|
81624
81761
|
const checkEditable = useTimelineEditGate(canEdit, showToast);
|
|
81625
81762
|
const guard = useTimelineEditGuard(canEdit, showToast);
|
|
@@ -81877,7 +82014,7 @@ function useTimelineEditing({
|
|
|
81877
82014
|
}
|
|
81878
82015
|
|
|
81879
82016
|
// src/hooks/timelineMoveAdapter.ts
|
|
81880
|
-
import { useCallback as
|
|
82017
|
+
import { useCallback as useCallback128 } from "react";
|
|
81881
82018
|
function persistTimelineMoveEditsAtomically(edits, coalesceKey, operation, deps) {
|
|
81882
82019
|
return deps.handleTimelineGroupMove(
|
|
81883
82020
|
edits.map(({ element, updates }) => ({
|
|
@@ -81894,7 +82031,7 @@ function persistTimelineMoveEditsAtomically(edits, coalesceKey, operation, deps)
|
|
|
81894
82031
|
);
|
|
81895
82032
|
}
|
|
81896
82033
|
function useTimelineMoveEditsHandler(handleTimelineGroupMove) {
|
|
81897
|
-
return
|
|
82034
|
+
return useCallback128(
|
|
81898
82035
|
async (edits, coalesceKey, operation = "timing") => {
|
|
81899
82036
|
const deps = { handleTimelineGroupMove };
|
|
81900
82037
|
await persistTimelineMoveEditsAtomically(edits, coalesceKey, operation, deps);
|
|
@@ -81904,10 +82041,10 @@ function useTimelineMoveEditsHandler(handleTimelineGroupMove) {
|
|
|
81904
82041
|
}
|
|
81905
82042
|
|
|
81906
82043
|
// src/hooks/useDomEditSession.ts
|
|
81907
|
-
import { useCallback as
|
|
82044
|
+
import { useCallback as useCallback153 } from "react";
|
|
81908
82045
|
|
|
81909
82046
|
// src/hooks/useAskAgentModal.ts
|
|
81910
|
-
import { useState as
|
|
82047
|
+
import { useState as useState127, useCallback as useCallback129, useRef as useRef148, useEffect as useEffect121 } from "react";
|
|
81911
82048
|
function useAskAgentModal({
|
|
81912
82049
|
activeCompPath,
|
|
81913
82050
|
projectDir,
|
|
@@ -81916,15 +82053,15 @@ function useAskAgentModal({
|
|
|
81916
82053
|
domEditSelectionRef,
|
|
81917
82054
|
domEditSelection
|
|
81918
82055
|
}) {
|
|
81919
|
-
const [agentPromptTagSnippet, setAgentPromptTagSnippet] =
|
|
81920
|
-
const [agentPromptSelectionContext, setAgentPromptSelectionContext] =
|
|
81921
|
-
const [agentModalAnchorPoint, setAgentModalAnchorPoint] =
|
|
82056
|
+
const [agentPromptTagSnippet, setAgentPromptTagSnippet] = useState127();
|
|
82057
|
+
const [agentPromptSelectionContext, setAgentPromptSelectionContext] = useState127();
|
|
82058
|
+
const [agentModalAnchorPoint, setAgentModalAnchorPoint] = useState127(
|
|
81922
82059
|
null
|
|
81923
82060
|
);
|
|
81924
|
-
const [copiedAgentPrompt, setCopiedAgentPrompt] =
|
|
81925
|
-
const [agentModalOpen, setAgentModalOpen] =
|
|
81926
|
-
const copiedAgentTimerRef =
|
|
81927
|
-
const preloadAgentPromptSnippet =
|
|
82061
|
+
const [copiedAgentPrompt, setCopiedAgentPrompt] = useState127(false);
|
|
82062
|
+
const [agentModalOpen, setAgentModalOpen] = useState127(false);
|
|
82063
|
+
const copiedAgentTimerRef = useRef148(null);
|
|
82064
|
+
const preloadAgentPromptSnippet = useCallback129(
|
|
81928
82065
|
async (selection) => {
|
|
81929
82066
|
const pid = projectIdRef.current;
|
|
81930
82067
|
if (!pid) return;
|
|
@@ -81946,7 +82083,7 @@ function useAskAgentModal({
|
|
|
81946
82083
|
},
|
|
81947
82084
|
[activeCompPath, domEditSelectionRef, projectIdRef]
|
|
81948
82085
|
);
|
|
81949
|
-
const handleAskAgent =
|
|
82086
|
+
const handleAskAgent = useCallback129(() => {
|
|
81950
82087
|
if (!domEditSelection) return;
|
|
81951
82088
|
setAgentPromptTagSnippet(void 0);
|
|
81952
82089
|
setAgentPromptSelectionContext(void 0);
|
|
@@ -81954,7 +82091,7 @@ function useAskAgentModal({
|
|
|
81954
82091
|
void preloadAgentPromptSnippet(domEditSelection);
|
|
81955
82092
|
setAgentModalOpen(true);
|
|
81956
82093
|
}, [domEditSelection, preloadAgentPromptSnippet]);
|
|
81957
|
-
const handleAgentModalSubmit =
|
|
82094
|
+
const handleAgentModalSubmit = useCallback129(
|
|
81958
82095
|
async (userInstruction) => {
|
|
81959
82096
|
if (!domEditSelection) return;
|
|
81960
82097
|
const targetPath = domEditSelection.sourceFile || activeCompPath || "index.html";
|
|
@@ -82019,7 +82156,7 @@ function useAskAgentModal({
|
|
|
82019
82156
|
}
|
|
82020
82157
|
|
|
82021
82158
|
// src/hooks/useDomSelection.ts
|
|
82022
|
-
import { useState as
|
|
82159
|
+
import { useState as useState128, useCallback as useCallback130, useRef as useRef149, useEffect as useEffect123 } from "react";
|
|
82023
82160
|
|
|
82024
82161
|
// src/utils/domEditHelpers.ts
|
|
82025
82162
|
function domEditSelectionsTargetSame(a, b) {
|
|
@@ -82263,23 +82400,23 @@ function useDomSelection({
|
|
|
82263
82400
|
refreshKey,
|
|
82264
82401
|
rightPanelTab
|
|
82265
82402
|
}) {
|
|
82266
|
-
const [domEditSelection, setDomEditSelection] =
|
|
82267
|
-
const [domEditGroupSelections, setDomEditGroupSelections] =
|
|
82268
|
-
const [domEditHoverSelection, setDomEditHoverSelection] =
|
|
82269
|
-
const [activeGroupElement, setActiveGroupElementState] =
|
|
82270
|
-
const rightPanelTabRef =
|
|
82403
|
+
const [domEditSelection, setDomEditSelection] = useState128(null);
|
|
82404
|
+
const [domEditGroupSelections, setDomEditGroupSelections] = useState128([]);
|
|
82405
|
+
const [domEditHoverSelection, setDomEditHoverSelection] = useState128(null);
|
|
82406
|
+
const [activeGroupElement, setActiveGroupElementState] = useState128(null);
|
|
82407
|
+
const rightPanelTabRef = useRef149(rightPanelTab);
|
|
82271
82408
|
rightPanelTabRef.current = rightPanelTab;
|
|
82272
|
-
const domEditSelectionRef =
|
|
82273
|
-
const domEditGroupSelectionsRef =
|
|
82274
|
-
const domEditHoverSelectionRef =
|
|
82275
|
-
const activeGroupElementRef =
|
|
82276
|
-
const compositionIdentityRef =
|
|
82277
|
-
const timelineSelectSeqRef =
|
|
82409
|
+
const domEditSelectionRef = useRef149(domEditSelection);
|
|
82410
|
+
const domEditGroupSelectionsRef = useRef149(domEditGroupSelections);
|
|
82411
|
+
const domEditHoverSelectionRef = useRef149(domEditHoverSelection);
|
|
82412
|
+
const activeGroupElementRef = useRef149(activeGroupElement);
|
|
82413
|
+
const compositionIdentityRef = useRef149({ activeCompPath, projectId });
|
|
82414
|
+
const timelineSelectSeqRef = useRef149(0);
|
|
82278
82415
|
domEditSelectionRef.current = domEditSelection;
|
|
82279
82416
|
domEditGroupSelectionsRef.current = domEditGroupSelections;
|
|
82280
82417
|
domEditHoverSelectionRef.current = domEditHoverSelection;
|
|
82281
82418
|
activeGroupElementRef.current = activeGroupElement;
|
|
82282
|
-
const announceTimelineSelection2 =
|
|
82419
|
+
const announceTimelineSelection2 = useCallback130(
|
|
82283
82420
|
(group, primary, replaceSet) => announceTimelineSelection(
|
|
82284
82421
|
{
|
|
82285
82422
|
timelineElements,
|
|
@@ -82300,7 +82437,7 @@ function useDomSelection({
|
|
|
82300
82437
|
timelineElements
|
|
82301
82438
|
]
|
|
82302
82439
|
);
|
|
82303
|
-
const applyDomSelection =
|
|
82440
|
+
const applyDomSelection = useCallback130(
|
|
82304
82441
|
// fallow-ignore-next-line complexity
|
|
82305
82442
|
(selection, options) => {
|
|
82306
82443
|
if (!selection) {
|
|
@@ -82359,10 +82496,10 @@ function useDomSelection({
|
|
|
82359
82496
|
},
|
|
82360
82497
|
[announceTimelineSelection2, setRightCollapsed, setRightPanelTab]
|
|
82361
82498
|
);
|
|
82362
|
-
const clearDomSelection =
|
|
82499
|
+
const clearDomSelection = useCallback130(() => {
|
|
82363
82500
|
applyDomSelection(null, { revealPanel: false });
|
|
82364
82501
|
}, [applyDomSelection]);
|
|
82365
|
-
const setActiveGroupElement =
|
|
82502
|
+
const setActiveGroupElement = useCallback130(
|
|
82366
82503
|
(el) => {
|
|
82367
82504
|
if (activeGroupElementRef.current === el) return;
|
|
82368
82505
|
activeGroupElementRef.current = el;
|
|
@@ -82371,7 +82508,7 @@ function useDomSelection({
|
|
|
82371
82508
|
},
|
|
82372
82509
|
[applyDomSelection]
|
|
82373
82510
|
);
|
|
82374
|
-
const buildDomSelectionFromTarget =
|
|
82511
|
+
const buildDomSelectionFromTarget = useCallback130(
|
|
82375
82512
|
(target, options, iframe = previewIframeRef.current) => {
|
|
82376
82513
|
return resolveFoundSelection(iframe, target, {
|
|
82377
82514
|
activeCompositionPath: activeCompPath,
|
|
@@ -82386,7 +82523,7 @@ function useDomSelection({
|
|
|
82386
82523
|
},
|
|
82387
82524
|
[activeCompPath, isMasterView, previewIframeRef, projectId]
|
|
82388
82525
|
);
|
|
82389
|
-
const resolveDomSelectionFromPreviewPoint =
|
|
82526
|
+
const resolveDomSelectionFromPreviewPoint = useCallback130(
|
|
82390
82527
|
// fallow-ignore-next-line complexity
|
|
82391
82528
|
async (clientX, clientY, options) => {
|
|
82392
82529
|
const iframe = previewIframeRef.current;
|
|
@@ -82411,7 +82548,7 @@ function useDomSelection({
|
|
|
82411
82548
|
},
|
|
82412
82549
|
[buildDomSelectionFromTarget, captionEditMode, previewIframeRef]
|
|
82413
82550
|
);
|
|
82414
|
-
const resolveAllDomSelectionsFromPreviewPoint =
|
|
82551
|
+
const resolveAllDomSelectionsFromPreviewPoint = useCallback130(
|
|
82415
82552
|
// fallow-ignore-next-line complexity
|
|
82416
82553
|
async (clientX, clientY) => {
|
|
82417
82554
|
const iframe = previewIframeRef.current;
|
|
@@ -82430,14 +82567,14 @@ function useDomSelection({
|
|
|
82430
82567
|
},
|
|
82431
82568
|
[buildDomSelectionFromTarget, captionEditMode, previewIframeRef]
|
|
82432
82569
|
);
|
|
82433
|
-
const updateDomEditHoverSelection =
|
|
82570
|
+
const updateDomEditHoverSelection = useCallback130((selection) => {
|
|
82434
82571
|
const current2 = domEditHoverSelectionRef.current;
|
|
82435
82572
|
const sameHandle = current2?.handle === selection?.handle;
|
|
82436
82573
|
if (domEditSelectionsTargetSame(current2, selection) && sameHandle) return;
|
|
82437
82574
|
domEditHoverSelectionRef.current = selection;
|
|
82438
82575
|
setDomEditHoverSelection(selection);
|
|
82439
82576
|
}, []);
|
|
82440
|
-
const buildDomSelectionForTimelineElement =
|
|
82577
|
+
const buildDomSelectionForTimelineElement = useCallback130(
|
|
82441
82578
|
// fallow-ignore-next-line complexity
|
|
82442
82579
|
async (element) => {
|
|
82443
82580
|
const iframe = previewIframeRef.current;
|
|
@@ -82462,7 +82599,7 @@ function useDomSelection({
|
|
|
82462
82599
|
},
|
|
82463
82600
|
[activeCompPath, buildDomSelectionFromTarget, compIdToSrc, isMasterView, previewIframeRef]
|
|
82464
82601
|
);
|
|
82465
|
-
const handleTimelineElementSelect =
|
|
82602
|
+
const handleTimelineElementSelect = useCallback130(
|
|
82466
82603
|
async (element) => {
|
|
82467
82604
|
const seq = ++timelineSelectSeqRef.current;
|
|
82468
82605
|
if (!element) {
|
|
@@ -82480,9 +82617,9 @@ function useDomSelection({
|
|
|
82480
82617
|
},
|
|
82481
82618
|
[applyDomSelection, buildDomSelectionForTimelineElement, previewIframeRef]
|
|
82482
82619
|
);
|
|
82483
|
-
const refreshDomEditGroupSelectionsFromPreviewRef =
|
|
82620
|
+
const refreshDomEditGroupSelectionsFromPreviewRef = useRef149(async () => {
|
|
82484
82621
|
});
|
|
82485
|
-
const refreshDomEditSelectionFromPreview =
|
|
82622
|
+
const refreshDomEditSelectionFromPreview = useCallback130(
|
|
82486
82623
|
// fallow-ignore-next-line complexity
|
|
82487
82624
|
async (selection, iframe = previewIframeRef.current) => {
|
|
82488
82625
|
const stillSelected = () => domEditSelectionsTargetSame(domEditSelectionRef.current, selection);
|
|
@@ -82516,7 +82653,7 @@ function useDomSelection({
|
|
|
82516
82653
|
},
|
|
82517
82654
|
[activeCompPath, applyDomSelection, buildDomSelectionFromTarget, previewIframeRef]
|
|
82518
82655
|
);
|
|
82519
|
-
const refreshDomEditGroupSelectionsFromPreview =
|
|
82656
|
+
const refreshDomEditGroupSelectionsFromPreview = useCallback130(
|
|
82520
82657
|
// fallow-ignore-next-line complexity
|
|
82521
82658
|
async (selections, iframe = previewIframeRef.current) => {
|
|
82522
82659
|
const nextGroup = [];
|
|
@@ -82572,7 +82709,7 @@ function useDomSelection({
|
|
|
82572
82709
|
applyDomSelection(null, { revealPanel: false });
|
|
82573
82710
|
}, [applyDomSelection, captionEditMode]);
|
|
82574
82711
|
useStudioTestHooks({ previewIframeRef, buildDomSelectionFromTarget, applyDomSelection });
|
|
82575
|
-
const applyMarqueeSelection =
|
|
82712
|
+
const applyMarqueeSelection = useCallback130(
|
|
82576
82713
|
// fallow-ignore-next-line complexity
|
|
82577
82714
|
(selections, mode) => {
|
|
82578
82715
|
logSelect("marquee", { hits: selections.length, mode });
|
|
@@ -82646,7 +82783,7 @@ function useDomSelection({
|
|
|
82646
82783
|
}
|
|
82647
82784
|
|
|
82648
82785
|
// src/hooks/usePreviewInteraction.ts
|
|
82649
|
-
import { useCallback as
|
|
82786
|
+
import { useCallback as useCallback131, useRef as useRef150 } from "react";
|
|
82650
82787
|
var CYCLE_RADIUS_PX = 6;
|
|
82651
82788
|
var CYCLE_WINDOW_MS = 600;
|
|
82652
82789
|
var DOUBLE_CLICK_MS = 400;
|
|
@@ -82663,10 +82800,10 @@ function usePreviewInteraction({
|
|
|
82663
82800
|
setActiveGroupElement,
|
|
82664
82801
|
onClickToSource
|
|
82665
82802
|
}) {
|
|
82666
|
-
const cycleRef =
|
|
82667
|
-
const lastDownRef =
|
|
82668
|
-
const hoverSeqRef =
|
|
82669
|
-
const pausePreviewPlayback =
|
|
82803
|
+
const cycleRef = useRef150(null);
|
|
82804
|
+
const lastDownRef = useRef150(null);
|
|
82805
|
+
const hoverSeqRef = useRef150(0);
|
|
82806
|
+
const pausePreviewPlayback = useCallback131(() => {
|
|
82670
82807
|
const pausedTime = pauseStudioPreviewPlayback(previewIframeRef.current);
|
|
82671
82808
|
const playerStore = usePlayerStore.getState();
|
|
82672
82809
|
playerStore.setIsPlaying(false);
|
|
@@ -82675,7 +82812,7 @@ function usePreviewInteraction({
|
|
|
82675
82812
|
liveTime.notify(pausedTime);
|
|
82676
82813
|
}
|
|
82677
82814
|
}, [previewIframeRef]);
|
|
82678
|
-
const handlePreviewCanvasMouseDown =
|
|
82815
|
+
const handlePreviewCanvasMouseDown = useCallback131(
|
|
82679
82816
|
// fallow-ignore-next-line complexity
|
|
82680
82817
|
async (e, options) => {
|
|
82681
82818
|
if (captionEditMode || compositionLoading) return;
|
|
@@ -82778,7 +82915,7 @@ function usePreviewInteraction({
|
|
|
82778
82915
|
setActiveGroupElement
|
|
82779
82916
|
]
|
|
82780
82917
|
);
|
|
82781
|
-
const handlePreviewCanvasPointerMove =
|
|
82918
|
+
const handlePreviewCanvasPointerMove = useCallback131(
|
|
82782
82919
|
// fallow-ignore-next-line complexity
|
|
82783
82920
|
async (e, options) => {
|
|
82784
82921
|
const seq = ++hoverSeqRef.current;
|
|
@@ -82800,11 +82937,11 @@ function usePreviewInteraction({
|
|
|
82800
82937
|
updateDomEditHoverSelection
|
|
82801
82938
|
]
|
|
82802
82939
|
);
|
|
82803
|
-
const handlePreviewCanvasPointerLeave =
|
|
82940
|
+
const handlePreviewCanvasPointerLeave = useCallback131(() => {
|
|
82804
82941
|
hoverSeqRef.current += 1;
|
|
82805
82942
|
updateDomEditHoverSelection(null);
|
|
82806
82943
|
}, [updateDomEditHoverSelection]);
|
|
82807
|
-
const handleBlockedDomMove =
|
|
82944
|
+
const handleBlockedDomMove = useCallback131(
|
|
82808
82945
|
(selection, reason) => {
|
|
82809
82946
|
showToast(
|
|
82810
82947
|
reason ?? selection.capabilities.reasonIfDisabled ?? "This element can't be adjusted directly from the preview.",
|
|
@@ -82813,7 +82950,7 @@ function usePreviewInteraction({
|
|
|
82813
82950
|
},
|
|
82814
82951
|
[showToast]
|
|
82815
82952
|
);
|
|
82816
|
-
const handleDomManualDragStart =
|
|
82953
|
+
const handleDomManualDragStart = useCallback131(() => {
|
|
82817
82954
|
pausePreviewPlayback();
|
|
82818
82955
|
}, [pausePreviewPlayback]);
|
|
82819
82956
|
return {
|
|
@@ -82826,7 +82963,7 @@ function usePreviewInteraction({
|
|
|
82826
82963
|
}
|
|
82827
82964
|
|
|
82828
82965
|
// src/hooks/useDomEditCommits.ts
|
|
82829
|
-
import { useCallback as
|
|
82966
|
+
import { useCallback as useCallback137 } from "react";
|
|
82830
82967
|
import { findUnsafeDomPatchValues as findUnsafeDomPatchValues3 } from "@hyperframes/core/studio-api/finite-mutation";
|
|
82831
82968
|
|
|
82832
82969
|
// src/utils/studioFontHelpers.ts
|
|
@@ -82880,7 +83017,7 @@ function importedFontFaceCssFor(asset, sourceFile) {
|
|
|
82880
83017
|
}
|
|
82881
83018
|
|
|
82882
83019
|
// src/hooks/useDomEditPersist.ts
|
|
82883
|
-
import { useCallback as
|
|
83020
|
+
import { useCallback as useCallback132, useRef as useRef151 } from "react";
|
|
82884
83021
|
import { findUnsafeDomPatchValues as findUnsafeDomPatchValues2 } from "@hyperframes/core/studio-api/finite-mutation";
|
|
82885
83022
|
|
|
82886
83023
|
// src/hooks/gsapScriptCommitHelpers.ts
|
|
@@ -83104,8 +83241,8 @@ function useDomEditPersist({
|
|
|
83104
83241
|
forceReloadSdkSession,
|
|
83105
83242
|
onTrySdkPersist
|
|
83106
83243
|
}) {
|
|
83107
|
-
const reportedUnresolvableRef =
|
|
83108
|
-
const performPersistDomEditOperations =
|
|
83244
|
+
const reportedUnresolvableRef = useRef151(/* @__PURE__ */ new Set());
|
|
83245
|
+
const performPersistDomEditOperations = useCallback132(
|
|
83109
83246
|
// fallow-ignore-next-line complexity
|
|
83110
83247
|
async (selection, operations, options, expectedProjectId) => {
|
|
83111
83248
|
if (projectIdRef.current !== expectedProjectId) {
|
|
@@ -83231,7 +83368,7 @@ function useDomEditPersist({
|
|
|
83231
83368
|
previewIframeRef
|
|
83232
83369
|
]
|
|
83233
83370
|
);
|
|
83234
|
-
const persistDomEditOperations =
|
|
83371
|
+
const persistDomEditOperations = useCallback132(
|
|
83235
83372
|
(selection, operations, options) => {
|
|
83236
83373
|
const expectedProjectId = projectIdRef.current;
|
|
83237
83374
|
if (!expectedProjectId) return Promise.reject(new Error("No active project"));
|
|
@@ -83246,13 +83383,13 @@ function useDomEditPersist({
|
|
|
83246
83383
|
}
|
|
83247
83384
|
|
|
83248
83385
|
// src/hooks/useDomEditPositionPatchCommit.ts
|
|
83249
|
-
import { useCallback as
|
|
83386
|
+
import { useCallback as useCallback133 } from "react";
|
|
83250
83387
|
function useDomEditPositionPatchCommit({
|
|
83251
83388
|
activeCompPath,
|
|
83252
83389
|
persistDomEditOperations,
|
|
83253
83390
|
showToast
|
|
83254
83391
|
}) {
|
|
83255
|
-
return
|
|
83392
|
+
return useCallback133(
|
|
83256
83393
|
(selection, patches, options) => {
|
|
83257
83394
|
return persistDomEditOperations(selection, patches, {
|
|
83258
83395
|
label: options.label,
|
|
@@ -83283,7 +83420,7 @@ function useDomEditPositionPatchCommit({
|
|
|
83283
83420
|
}
|
|
83284
83421
|
|
|
83285
83422
|
// src/hooks/useDomEditTextCommits.ts
|
|
83286
|
-
import { useCallback as
|
|
83423
|
+
import { useCallback as useCallback135, useRef as useRef153 } from "react";
|
|
83287
83424
|
|
|
83288
83425
|
// src/hooks/refreshTimelineRowText.ts
|
|
83289
83426
|
function refreshTimelineRowText(el) {
|
|
@@ -83435,7 +83572,7 @@ async function commitDomStyles(context, selection, stylesInEitherCase) {
|
|
|
83435
83572
|
}
|
|
83436
83573
|
|
|
83437
83574
|
// src/hooks/useDomEditAttributeCommits.ts
|
|
83438
|
-
import { useCallback as
|
|
83575
|
+
import { useCallback as useCallback134, useRef as useRef152 } from "react";
|
|
83439
83576
|
import { HF_AUDIO_GROUP_ATTR as HF_AUDIO_GROUP_ATTR6, HF_AUDIO_GROUP_TAG as HF_AUDIO_GROUP_TAG8 } from "@hyperframes/core/audio-groups";
|
|
83440
83577
|
function resolveFullAttrName(attr2, prefixData) {
|
|
83441
83578
|
return prefixData && !attr2.startsWith("data-") ? `data-${attr2}` : attr2;
|
|
@@ -83486,8 +83623,8 @@ function useDomEditAttributeCommits({
|
|
|
83486
83623
|
refreshDomEditSelectionFromPreview,
|
|
83487
83624
|
persistDomEditOperations
|
|
83488
83625
|
}) {
|
|
83489
|
-
const domAttributeCommitVersionRef =
|
|
83490
|
-
const commitDataAttribute =
|
|
83626
|
+
const domAttributeCommitVersionRef = useRef152(/* @__PURE__ */ new Map());
|
|
83627
|
+
const commitDataAttribute = useCallback134(
|
|
83491
83628
|
async (attr2, value, options) => {
|
|
83492
83629
|
if (!domEditSelection) return;
|
|
83493
83630
|
const iframe = previewIframeRef.current;
|
|
@@ -83547,7 +83684,7 @@ function useDomEditAttributeCommits({
|
|
|
83547
83684
|
previewIframeRef
|
|
83548
83685
|
]
|
|
83549
83686
|
);
|
|
83550
|
-
const commitAttributeOps =
|
|
83687
|
+
const commitAttributeOps = useCallback134(
|
|
83551
83688
|
async (selection, ops, options) => {
|
|
83552
83689
|
const iframe = previewIframeRef.current;
|
|
83553
83690
|
const entries = ops.map((op) => ({
|
|
@@ -83617,7 +83754,7 @@ function useDomEditAttributeCommits({
|
|
|
83617
83754
|
previewIframeRef
|
|
83618
83755
|
]
|
|
83619
83756
|
);
|
|
83620
|
-
const handleDomAttributesCommit =
|
|
83757
|
+
const handleDomAttributesCommit = useCallback134(
|
|
83621
83758
|
async (selection, attrs) => {
|
|
83622
83759
|
await commitAttributeOps(
|
|
83623
83760
|
selection,
|
|
@@ -83636,7 +83773,7 @@ function useDomEditAttributeCommits({
|
|
|
83636
83773
|
},
|
|
83637
83774
|
[commitAttributeOps]
|
|
83638
83775
|
);
|
|
83639
|
-
const handleDomAttributeBatchCommit =
|
|
83776
|
+
const handleDomAttributeBatchCommit = useCallback134(
|
|
83640
83777
|
(selection, ops, options) => commitAttributeOps(selection, ops, {
|
|
83641
83778
|
label: options.label,
|
|
83642
83779
|
coalescePrefix: "attr-batch",
|
|
@@ -83647,7 +83784,7 @@ function useDomEditAttributeCommits({
|
|
|
83647
83784
|
}),
|
|
83648
83785
|
[commitAttributeOps]
|
|
83649
83786
|
);
|
|
83650
|
-
const handleDomAttributeCommit =
|
|
83787
|
+
const handleDomAttributeCommit = useCallback134(
|
|
83651
83788
|
async (attr2, value) => {
|
|
83652
83789
|
await commitDataAttribute(attr2, value, {
|
|
83653
83790
|
label: `Edit ${attr2.replace(/-/g, " ")}`,
|
|
@@ -83658,7 +83795,7 @@ function useDomEditAttributeCommits({
|
|
|
83658
83795
|
},
|
|
83659
83796
|
[commitDataAttribute]
|
|
83660
83797
|
);
|
|
83661
|
-
const handleDomAttributeLiveCommit =
|
|
83798
|
+
const handleDomAttributeLiveCommit = useCallback134(
|
|
83662
83799
|
async (attr2, value, onSettled, live) => {
|
|
83663
83800
|
await commitDataAttribute(attr2, value, {
|
|
83664
83801
|
label: `Edit ${attr2.replace(/^(data-)?/, "").replace(/-/g, " ")}`,
|
|
@@ -83670,7 +83807,7 @@ function useDomEditAttributeCommits({
|
|
|
83670
83807
|
},
|
|
83671
83808
|
[commitDataAttribute]
|
|
83672
83809
|
);
|
|
83673
|
-
const handleDomAttributeQuietCommit =
|
|
83810
|
+
const handleDomAttributeQuietCommit = useCallback134(
|
|
83674
83811
|
async (attr2, value) => {
|
|
83675
83812
|
await commitDataAttribute(attr2, value, {
|
|
83676
83813
|
label: `Edit ${attr2.replace(/^(data-)?/, "").replace(/-/g, " ")}`,
|
|
@@ -83681,7 +83818,7 @@ function useDomEditAttributeCommits({
|
|
|
83681
83818
|
},
|
|
83682
83819
|
[commitDataAttribute]
|
|
83683
83820
|
);
|
|
83684
|
-
const handleDomHtmlAttributeCommit =
|
|
83821
|
+
const handleDomHtmlAttributeCommit = useCallback134(
|
|
83685
83822
|
async (attr2, value) => {
|
|
83686
83823
|
if (!domEditSelection) return;
|
|
83687
83824
|
const iframe = previewIframeRef.current;
|
|
@@ -83777,12 +83914,12 @@ function useDomEditTextCommits({
|
|
|
83777
83914
|
resolveImportedFontAsset,
|
|
83778
83915
|
readOnlyPreview
|
|
83779
83916
|
}) {
|
|
83780
|
-
const latestReadOnlyPreviewRef =
|
|
83917
|
+
const latestReadOnlyPreviewRef = useRef153(readOnlyPreview);
|
|
83781
83918
|
latestReadOnlyPreviewRef.current = readOnlyPreview;
|
|
83782
|
-
const latestSelectionRef =
|
|
83919
|
+
const latestSelectionRef = useRef153(domEditSelection);
|
|
83783
83920
|
latestSelectionRef.current = domEditSelection;
|
|
83784
|
-
const domTextCommitVersionRef =
|
|
83785
|
-
const domStyleCommitVersionRef =
|
|
83921
|
+
const domTextCommitVersionRef = useRef153(/* @__PURE__ */ new Map());
|
|
83922
|
+
const domStyleCommitVersionRef = useRef153(/* @__PURE__ */ new Map());
|
|
83786
83923
|
const {
|
|
83787
83924
|
handleDomAttributeCommit,
|
|
83788
83925
|
handleDomAttributeLiveCommit,
|
|
@@ -83798,7 +83935,7 @@ function useDomEditTextCommits({
|
|
|
83798
83935
|
refreshDomEditSelectionFromPreview,
|
|
83799
83936
|
persistDomEditOperations
|
|
83800
83937
|
});
|
|
83801
|
-
const handleDomStyleCommitForSelection =
|
|
83938
|
+
const handleDomStyleCommitForSelection = useCallback135(
|
|
83802
83939
|
(selection, propertyOrStylesAsOnePatch, value = "") => commitDomStyles(
|
|
83803
83940
|
{
|
|
83804
83941
|
activeCompPath,
|
|
@@ -83821,11 +83958,11 @@ function useDomEditTextCommits({
|
|
|
83821
83958
|
previewIframeRef
|
|
83822
83959
|
]
|
|
83823
83960
|
);
|
|
83824
|
-
const handleDomStyleCommit =
|
|
83961
|
+
const handleDomStyleCommit = useCallback135(
|
|
83825
83962
|
(property, value) => domEditSelection ? handleDomStyleCommitForSelection(domEditSelection, property, value) : Promise.resolve(domEditCommitDeclined("no-selection")),
|
|
83826
83963
|
[domEditSelection, handleDomStyleCommitForSelection]
|
|
83827
83964
|
);
|
|
83828
|
-
const handleDomTextCommitForSelection =
|
|
83965
|
+
const handleDomTextCommitForSelection = useCallback135(
|
|
83829
83966
|
async (selection, value, fieldKey) => {
|
|
83830
83967
|
if (!isTextEditableSelection(selection)) {
|
|
83831
83968
|
return domEditCommitDeclined("not-text-editable");
|
|
@@ -83887,11 +84024,11 @@ function useDomEditTextCommits({
|
|
|
83887
84024
|
showToast
|
|
83888
84025
|
]
|
|
83889
84026
|
);
|
|
83890
|
-
const handleDomTextCommit =
|
|
84027
|
+
const handleDomTextCommit = useCallback135(
|
|
83891
84028
|
(value, fieldKey) => domEditSelection ? handleDomTextCommitForSelection(domEditSelection, value, fieldKey) : Promise.resolve(domEditCommitDeclined("no-selection")),
|
|
83892
84029
|
[domEditSelection, handleDomTextCommitForSelection]
|
|
83893
84030
|
);
|
|
83894
|
-
const handleDomRichTextCommit =
|
|
84031
|
+
const handleDomRichTextCommit = useCallback135(
|
|
83895
84032
|
async ({ element, html: html2, previousHtml }) => {
|
|
83896
84033
|
const putBack = () => {
|
|
83897
84034
|
if (element.isConnected && element.innerHTML === html2) element.innerHTML = previousHtml;
|
|
@@ -83965,7 +84102,7 @@ function useDomEditTextCommits({
|
|
|
83965
84102
|
showToast
|
|
83966
84103
|
]
|
|
83967
84104
|
);
|
|
83968
|
-
const commitDomTextFields =
|
|
84105
|
+
const commitDomTextFields = useCallback135(
|
|
83969
84106
|
async (selection, nextTextFields, options) => {
|
|
83970
84107
|
const isLatestTextCommit = bumpDomEditCommitMapVersion(
|
|
83971
84108
|
domTextCommitVersionRef.current,
|
|
@@ -84030,7 +84167,7 @@ function useDomEditTextCommits({
|
|
|
84030
84167
|
showToast
|
|
84031
84168
|
]
|
|
84032
84169
|
);
|
|
84033
|
-
const handleDomTextFieldStyleCommit =
|
|
84170
|
+
const handleDomTextFieldStyleCommit = useCallback135(
|
|
84034
84171
|
async (fieldKey, property, value) => {
|
|
84035
84172
|
if (!domEditSelection) return;
|
|
84036
84173
|
const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
|
|
@@ -84071,7 +84208,7 @@ function useDomEditTextCommits({
|
|
|
84071
84208
|
previewIframeRef
|
|
84072
84209
|
]
|
|
84073
84210
|
);
|
|
84074
|
-
const handleDomAddTextField =
|
|
84211
|
+
const handleDomAddTextField = useCallback135(
|
|
84075
84212
|
async (afterFieldKey) => {
|
|
84076
84213
|
if (!domEditSelection) return null;
|
|
84077
84214
|
if (!domEditSelection.textFields.some((field) => field.source === "child")) return null;
|
|
@@ -84091,7 +84228,7 @@ function useDomEditTextCommits({
|
|
|
84091
84228
|
},
|
|
84092
84229
|
[commitDomTextFields, domEditSelection]
|
|
84093
84230
|
);
|
|
84094
|
-
const handleDomRemoveTextField =
|
|
84231
|
+
const handleDomRemoveTextField = useCallback135(
|
|
84095
84232
|
async (fieldKey) => {
|
|
84096
84233
|
if (!domEditSelection) return;
|
|
84097
84234
|
const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
|
|
@@ -84125,7 +84262,7 @@ function useDomEditTextCommits({
|
|
|
84125
84262
|
}
|
|
84126
84263
|
|
|
84127
84264
|
// src/hooks/useDomGeometryCommits.ts
|
|
84128
|
-
import { useCallback as
|
|
84265
|
+
import { useCallback as useCallback136 } from "react";
|
|
84129
84266
|
|
|
84130
84267
|
// src/components/editor/elementPositionOffset.ts
|
|
84131
84268
|
var layoutBox = (el) => ({
|
|
@@ -84269,7 +84406,7 @@ function useDomGeometryCommits({
|
|
|
84269
84406
|
commitPositionPatchToHtml,
|
|
84270
84407
|
readOnlyPreview
|
|
84271
84408
|
}) {
|
|
84272
|
-
const stageElementPositionOffset =
|
|
84409
|
+
const stageElementPositionOffset = useCallback136(
|
|
84273
84410
|
(selection, next, plainTranslate, coalesceKey) => stageElementOffset(
|
|
84274
84411
|
{ commitPositionPatchToHtml, showToast, readOnlyPreview },
|
|
84275
84412
|
selection,
|
|
@@ -84279,7 +84416,7 @@ function useDomGeometryCommits({
|
|
|
84279
84416
|
),
|
|
84280
84417
|
[commitPositionPatchToHtml, readOnlyPreview, showToast]
|
|
84281
84418
|
);
|
|
84282
|
-
const handleDomBoxSizeCommit =
|
|
84419
|
+
const handleDomBoxSizeCommit = useCallback136(
|
|
84283
84420
|
(selection, next, offset, restore2, undoKey) => {
|
|
84284
84421
|
if (readOnlyPreview) return Promise.resolve(void 0);
|
|
84285
84422
|
const element = selection.element;
|
|
@@ -84307,11 +84444,11 @@ function useDomGeometryCommits({
|
|
|
84307
84444
|
},
|
|
84308
84445
|
[commitPositionPatchToHtml, readOnlyPreview]
|
|
84309
84446
|
);
|
|
84310
|
-
const handleDomRotationCommit =
|
|
84447
|
+
const handleDomRotationCommit = useCallback136(
|
|
84311
84448
|
(selection, next) => savePlainRotation({ commitPositionPatchToHtml, readOnlyPreview }, selection, next),
|
|
84312
84449
|
[commitPositionPatchToHtml, readOnlyPreview]
|
|
84313
84450
|
);
|
|
84314
|
-
const handleDomManualEditsReset =
|
|
84451
|
+
const handleDomManualEditsReset = useCallback136(
|
|
84315
84452
|
(selection) => {
|
|
84316
84453
|
const element = selection.element;
|
|
84317
84454
|
const beforeOffset = captureStudioPathOffset(element);
|
|
@@ -84371,7 +84508,7 @@ function useDomEditCommits({
|
|
|
84371
84508
|
onReorderShadow,
|
|
84372
84509
|
readOnlyPreview
|
|
84373
84510
|
}) {
|
|
84374
|
-
const resolveImportedFontAsset =
|
|
84511
|
+
const resolveImportedFontAsset = useCallback137(
|
|
84375
84512
|
(fontFamilyValue) => {
|
|
84376
84513
|
const family = primaryFontFamilyValue(fontFamilyValue);
|
|
84377
84514
|
if (!family) return null;
|
|
@@ -84403,7 +84540,7 @@ function useDomEditCommits({
|
|
|
84403
84540
|
forceReloadSdkSession,
|
|
84404
84541
|
onTrySdkPersist
|
|
84405
84542
|
});
|
|
84406
|
-
const commitDomEditPatchBatches =
|
|
84543
|
+
const commitDomEditPatchBatches = useCallback137(
|
|
84407
84544
|
(batches, options) => {
|
|
84408
84545
|
const expectedProjectId = projectIdRef.current;
|
|
84409
84546
|
if (!expectedProjectId) return Promise.reject(new Error("No active project"));
|
|
@@ -84574,7 +84711,7 @@ function useDomEditCommits({
|
|
|
84574
84711
|
}
|
|
84575
84712
|
|
|
84576
84713
|
// src/hooks/useGroupCommits.ts
|
|
84577
|
-
import { useCallback as
|
|
84714
|
+
import { useCallback as useCallback138 } from "react";
|
|
84578
84715
|
function resolveAuthoredTrack(selection, timelineElements) {
|
|
84579
84716
|
const id = findMatchingTimelineElementId(selection, timelineElements);
|
|
84580
84717
|
if (!id) return void 0;
|
|
@@ -84653,7 +84790,7 @@ async function commitStructuralMutation(pid, targetPath, route, body, label, dep
|
|
|
84653
84790
|
}
|
|
84654
84791
|
function useGroupCommits(params) {
|
|
84655
84792
|
const { activeCompPath, showToast, projectIdRef, timelineElements } = params;
|
|
84656
|
-
const groupSelection =
|
|
84793
|
+
const groupSelection = useCallback138(
|
|
84657
84794
|
async (members) => {
|
|
84658
84795
|
const pid = projectIdRef.current;
|
|
84659
84796
|
if (!pid || members.length === 0) return null;
|
|
@@ -84682,7 +84819,7 @@ function useGroupCommits(params) {
|
|
|
84682
84819
|
},
|
|
84683
84820
|
[activeCompPath, projectIdRef, showToast, params, timelineElements]
|
|
84684
84821
|
);
|
|
84685
|
-
const ungroupSelection =
|
|
84822
|
+
const ungroupSelection = useCallback138(
|
|
84686
84823
|
async (group) => {
|
|
84687
84824
|
const pid = projectIdRef.current;
|
|
84688
84825
|
if (!pid) return;
|
|
@@ -84707,7 +84844,7 @@ function useGroupCommits(params) {
|
|
|
84707
84844
|
}
|
|
84708
84845
|
|
|
84709
84846
|
// src/hooks/useGsapScriptCommits.ts
|
|
84710
|
-
import { useCallback as
|
|
84847
|
+
import { useCallback as useCallback144, useMemo as useMemo74, useRef as useRef155 } from "react";
|
|
84711
84848
|
import { findUnsafeMutationValues } from "@hyperframes/core/studio-api/finite-mutation";
|
|
84712
84849
|
|
|
84713
84850
|
// src/hooks/gsapRuntimePatch.ts
|
|
@@ -84908,7 +85045,7 @@ function gsapWriteFile(selection, activeCompPath) {
|
|
|
84908
85045
|
}
|
|
84909
85046
|
|
|
84910
85047
|
// src/hooks/useGsapAnimationOps.ts
|
|
84911
|
-
import { useCallback as
|
|
85048
|
+
import { useCallback as useCallback139 } from "react";
|
|
84912
85049
|
function useGsapAnimationOps({
|
|
84913
85050
|
projectIdRef,
|
|
84914
85051
|
activeCompPath,
|
|
@@ -84919,7 +85056,7 @@ function useGsapAnimationOps({
|
|
|
84919
85056
|
sdkDeps,
|
|
84920
85057
|
writeProjectFile
|
|
84921
85058
|
}) {
|
|
84922
|
-
const updateGsapMeta =
|
|
85059
|
+
const updateGsapMeta = useCallback139(
|
|
84923
85060
|
async (selection, animationId, updates) => {
|
|
84924
85061
|
if (sdkSession && sdkDeps) {
|
|
84925
85062
|
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
|
@@ -84940,7 +85077,7 @@ function useGsapAnimationOps({
|
|
|
84940
85077
|
},
|
|
84941
85078
|
[commitMutationSafely, activeCompPath, sdkSession, sdkDeps]
|
|
84942
85079
|
);
|
|
84943
|
-
const deleteGsapAnimation =
|
|
85080
|
+
const deleteGsapAnimation = useCallback139(
|
|
84944
85081
|
async (selection, animationId) => {
|
|
84945
85082
|
if (sdkSession && sdkDeps) {
|
|
84946
85083
|
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
|
@@ -84961,7 +85098,7 @@ function useGsapAnimationOps({
|
|
|
84961
85098
|
},
|
|
84962
85099
|
[commitMutationSafely, activeCompPath, sdkSession, sdkDeps]
|
|
84963
85100
|
);
|
|
84964
|
-
const deleteAllForSelector =
|
|
85101
|
+
const deleteAllForSelector = useCallback139(
|
|
84965
85102
|
async (selection, targetSelector) => {
|
|
84966
85103
|
if (sdkSession && sdkDeps) {
|
|
84967
85104
|
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
|
@@ -84982,7 +85119,7 @@ function useGsapAnimationOps({
|
|
|
84982
85119
|
},
|
|
84983
85120
|
[commitMutation, activeCompPath, sdkSession, sdkDeps]
|
|
84984
85121
|
);
|
|
84985
|
-
const addGsapAnimation =
|
|
85122
|
+
const addGsapAnimation = useCallback139(
|
|
84986
85123
|
// fallow-ignore-next-line complexity
|
|
84987
85124
|
async (selection, method, _currentTime) => {
|
|
84988
85125
|
const address = ensureElementAddressable(selection);
|
|
@@ -85057,7 +85194,7 @@ function useGsapAnimationOps({
|
|
|
85057
85194
|
writeProjectFile
|
|
85058
85195
|
]
|
|
85059
85196
|
);
|
|
85060
|
-
const addWithKeyframes =
|
|
85197
|
+
const addWithKeyframes = useCallback139(
|
|
85061
85198
|
async (selection, targetSelector, position, duration, keyframes, ease, label = "Add animation with keyframes") => {
|
|
85062
85199
|
if (sdkSession && sdkDeps) {
|
|
85063
85200
|
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
|
@@ -85089,7 +85226,7 @@ function useGsapAnimationOps({
|
|
|
85089
85226
|
},
|
|
85090
85227
|
[commitMutation, activeCompPath, sdkSession, sdkDeps]
|
|
85091
85228
|
);
|
|
85092
|
-
const replaceWithKeyframes =
|
|
85229
|
+
const replaceWithKeyframes = useCallback139(
|
|
85093
85230
|
async (selection, animationId, targetSelector, position, duration, keyframes, ease, label = "Replace animation with keyframes") => {
|
|
85094
85231
|
if (sdkSession && sdkDeps) {
|
|
85095
85232
|
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
|
@@ -85134,9 +85271,9 @@ function useGsapAnimationOps({
|
|
|
85134
85271
|
}
|
|
85135
85272
|
|
|
85136
85273
|
// src/hooks/useGsapArcPathOps.ts
|
|
85137
|
-
import { useCallback as
|
|
85274
|
+
import { useCallback as useCallback140 } from "react";
|
|
85138
85275
|
function useGsapArcPathOps(commitMutationSafely) {
|
|
85139
|
-
const setArcPath =
|
|
85276
|
+
const setArcPath = useCallback140(
|
|
85140
85277
|
(selection, animationId, config) => {
|
|
85141
85278
|
commitMutationSafely(
|
|
85142
85279
|
selection,
|
|
@@ -85146,7 +85283,7 @@ function useGsapArcPathOps(commitMutationSafely) {
|
|
|
85146
85283
|
},
|
|
85147
85284
|
[commitMutationSafely]
|
|
85148
85285
|
);
|
|
85149
|
-
const updateArcSegment =
|
|
85286
|
+
const updateArcSegment = useCallback140(
|
|
85150
85287
|
(selection, animationId, segmentIndex, update) => {
|
|
85151
85288
|
commitMutationSafely(
|
|
85152
85289
|
selection,
|
|
@@ -85156,7 +85293,7 @@ function useGsapArcPathOps(commitMutationSafely) {
|
|
|
85156
85293
|
},
|
|
85157
85294
|
[commitMutationSafely]
|
|
85158
85295
|
);
|
|
85159
|
-
const removeArcPath =
|
|
85296
|
+
const removeArcPath = useCallback140(
|
|
85160
85297
|
(selection, animationId) => {
|
|
85161
85298
|
commitMutationSafely(
|
|
85162
85299
|
selection,
|
|
@@ -85170,7 +85307,7 @@ function useGsapArcPathOps(commitMutationSafely) {
|
|
|
85170
85307
|
}
|
|
85171
85308
|
|
|
85172
85309
|
// src/hooks/useGsapKeyframeOps.ts
|
|
85173
|
-
import { useCallback as
|
|
85310
|
+
import { useCallback as useCallback141 } from "react";
|
|
85174
85311
|
|
|
85175
85312
|
// src/utils/optimisticUpdate.ts
|
|
85176
85313
|
async function executeOptimistic(options) {
|
|
@@ -85271,7 +85408,7 @@ function useGsapKeyframeOps({
|
|
|
85271
85408
|
sdkSession,
|
|
85272
85409
|
sdkDeps
|
|
85273
85410
|
}) {
|
|
85274
|
-
const addKeyframe =
|
|
85411
|
+
const addKeyframe = useCallback141(
|
|
85275
85412
|
(selection, animationId, percentage, property, value) => {
|
|
85276
85413
|
const sourceFile = selection.sourceFile || activeCompPath || "index.html";
|
|
85277
85414
|
const mutation = {
|
|
@@ -85336,7 +85473,7 @@ function useGsapKeyframeOps({
|
|
|
85336
85473
|
},
|
|
85337
85474
|
[activeCompPath, commitMutation, trackGsapSaveFailure, sdkSession, sdkDeps]
|
|
85338
85475
|
);
|
|
85339
|
-
const addKeyframeBatch =
|
|
85476
|
+
const addKeyframeBatch = useCallback141(
|
|
85340
85477
|
async (selection, animationId, percentage, properties, commitOverrides) => {
|
|
85341
85478
|
if (sdkSession && sdkDeps) {
|
|
85342
85479
|
const sourceFile = selection.sourceFile || activeCompPath || "index.html";
|
|
@@ -85367,7 +85504,7 @@ function useGsapKeyframeOps({
|
|
|
85367
85504
|
},
|
|
85368
85505
|
[commitMutation, activeCompPath, sdkSession, sdkDeps]
|
|
85369
85506
|
);
|
|
85370
|
-
const removeKeyframe =
|
|
85507
|
+
const removeKeyframe = useCallback141(
|
|
85371
85508
|
(selection, animationId, percentage, commitOverrides) => {
|
|
85372
85509
|
const sourceFile = selection.sourceFile || activeCompPath || "index.html";
|
|
85373
85510
|
const mutation = { type: "remove-keyframe", animationId, percentage };
|
|
@@ -85407,7 +85544,7 @@ function useGsapKeyframeOps({
|
|
|
85407
85544
|
},
|
|
85408
85545
|
[activeCompPath, commitMutation, trackGsapSaveFailure, sdkSession, sdkDeps]
|
|
85409
85546
|
);
|
|
85410
|
-
const moveKeyframe =
|
|
85547
|
+
const moveKeyframe = useCallback141(
|
|
85411
85548
|
async (selection, animationId, fromPercentage, toPercentage) => {
|
|
85412
85549
|
const mutation = { type: "move-keyframe", animationId, fromPercentage, toPercentage };
|
|
85413
85550
|
try {
|
|
@@ -85427,7 +85564,7 @@ function useGsapKeyframeOps({
|
|
|
85427
85564
|
},
|
|
85428
85565
|
[commitMutation, trackGsapSaveFailure]
|
|
85429
85566
|
);
|
|
85430
|
-
const resizeKeyframedTween =
|
|
85567
|
+
const resizeKeyframedTween = useCallback141(
|
|
85431
85568
|
async (selection, animationId, position, duration, pctRemap) => {
|
|
85432
85569
|
const mutation = {
|
|
85433
85570
|
type: "resize-keyframed-tween",
|
|
@@ -85453,7 +85590,7 @@ function useGsapKeyframeOps({
|
|
|
85453
85590
|
},
|
|
85454
85591
|
[commitMutation, trackGsapSaveFailure]
|
|
85455
85592
|
);
|
|
85456
|
-
const convertToKeyframes =
|
|
85593
|
+
const convertToKeyframes = useCallback141(
|
|
85457
85594
|
async (selection, animationId, resolvedFromValues, duration, commitOverrides = { softReload: true }) => {
|
|
85458
85595
|
if (sdkSession && sdkDeps) {
|
|
85459
85596
|
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
|
@@ -85481,7 +85618,7 @@ function useGsapKeyframeOps({
|
|
|
85481
85618
|
},
|
|
85482
85619
|
[commitMutation, activeCompPath, sdkSession, sdkDeps]
|
|
85483
85620
|
);
|
|
85484
|
-
const removeAllKeyframes =
|
|
85621
|
+
const removeAllKeyframes = useCallback141(
|
|
85485
85622
|
async (selection, animationId, action = "remove_all", telemetry = true) => {
|
|
85486
85623
|
const targetPath = selection.sourceFile || activeCompPath || "index.html";
|
|
85487
85624
|
const clearCache = () => {
|
|
@@ -85525,7 +85662,7 @@ function useGsapKeyframeOps({
|
|
|
85525
85662
|
},
|
|
85526
85663
|
[commitMutationSafely, activeCompPath, sdkSession, sdkDeps]
|
|
85527
85664
|
);
|
|
85528
|
-
const commitKeyframeAtTime =
|
|
85665
|
+
const commitKeyframeAtTime = useCallback141(
|
|
85529
85666
|
(selection, absoluteTime, animations, properties) => commitKeyframeAtTimeImpl(selection, absoluteTime, animations, properties, commitMutation),
|
|
85530
85667
|
[commitMutation]
|
|
85531
85668
|
);
|
|
@@ -85542,7 +85679,7 @@ function useGsapKeyframeOps({
|
|
|
85542
85679
|
}
|
|
85543
85680
|
|
|
85544
85681
|
// src/hooks/useGsapPropertyDebounce.ts
|
|
85545
|
-
import { useCallback as
|
|
85682
|
+
import { useCallback as useCallback142, useEffect as useEffect124, useRef as useRef154 } from "react";
|
|
85546
85683
|
import { parseGsapScriptAcorn as parseGsapScriptAcorn2 } from "@hyperframes/core/gsap-parser-acorn";
|
|
85547
85684
|
var DEBOUNCE_MS = 150;
|
|
85548
85685
|
function mergeTweenProperties(sdkSession, animationId, edited, kind) {
|
|
@@ -85558,11 +85695,11 @@ function mergeTweenProperties(sdkSession, animationId, edited, kind) {
|
|
|
85558
85695
|
}
|
|
85559
85696
|
}
|
|
85560
85697
|
function useGsapPropertyDebounce(commitMutationSafely, sdk) {
|
|
85561
|
-
const pendingPropertyEditRef =
|
|
85562
|
-
const debounceTimerRef =
|
|
85563
|
-
const sdkRef =
|
|
85698
|
+
const pendingPropertyEditRef = useRef154(null);
|
|
85699
|
+
const debounceTimerRef = useRef154(null);
|
|
85700
|
+
const sdkRef = useRef154(sdk);
|
|
85564
85701
|
sdkRef.current = sdk;
|
|
85565
|
-
const flushPendingPropertyEdit =
|
|
85702
|
+
const flushPendingPropertyEdit = useCallback142(async () => {
|
|
85566
85703
|
const pending2 = pendingPropertyEditRef.current;
|
|
85567
85704
|
if (!pending2) return;
|
|
85568
85705
|
pendingPropertyEditRef.current = null;
|
|
@@ -85602,7 +85739,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
|
|
|
85602
85739
|
sdkRef.current?.onFlushError?.(error, selection, mutation, label);
|
|
85603
85740
|
}
|
|
85604
85741
|
}, [commitMutationSafely]);
|
|
85605
|
-
const updateGsapProperty =
|
|
85742
|
+
const updateGsapProperty = useCallback142(
|
|
85606
85743
|
(selection, animationId, property, value) => {
|
|
85607
85744
|
pendingPropertyEditRef.current = { selection, animationId, property, value };
|
|
85608
85745
|
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
@@ -85618,7 +85755,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
|
|
|
85618
85755
|
void flushPendingPropertyEdit();
|
|
85619
85756
|
};
|
|
85620
85757
|
}, [flushPendingPropertyEdit]);
|
|
85621
|
-
const addGsapProperty =
|
|
85758
|
+
const addGsapProperty = useCallback142(
|
|
85622
85759
|
// fallow-ignore-next-line complexity
|
|
85623
85760
|
async (selection, animationId, property) => {
|
|
85624
85761
|
let defaultValue = KEYFRAME_PROPERTY_DEFAULTS[property] ?? 0;
|
|
@@ -85662,7 +85799,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
|
|
|
85662
85799
|
},
|
|
85663
85800
|
[commitMutationSafely]
|
|
85664
85801
|
);
|
|
85665
|
-
const removeProperty =
|
|
85802
|
+
const removeProperty = useCallback142(
|
|
85666
85803
|
async (selection, animationId, property, from) => {
|
|
85667
85804
|
const { sdkSession, sdkDeps, activeCompPath } = sdkRef.current ?? {};
|
|
85668
85805
|
if (sdkSession && sdkDeps) {
|
|
@@ -85698,11 +85835,11 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
|
|
|
85698
85835
|
},
|
|
85699
85836
|
[commitMutationSafely]
|
|
85700
85837
|
);
|
|
85701
|
-
const removeGsapProperty =
|
|
85838
|
+
const removeGsapProperty = useCallback142(
|
|
85702
85839
|
(selection, animationId, property) => removeProperty(selection, animationId, property, false),
|
|
85703
85840
|
[removeProperty]
|
|
85704
85841
|
);
|
|
85705
|
-
const updateGsapFromProperty =
|
|
85842
|
+
const updateGsapFromProperty = useCallback142(
|
|
85706
85843
|
async (selection, animationId, property, value) => {
|
|
85707
85844
|
const { sdkSession, sdkDeps, activeCompPath } = sdkRef.current ?? {};
|
|
85708
85845
|
if (sdkSession && sdkDeps) {
|
|
@@ -85741,7 +85878,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
|
|
|
85741
85878
|
},
|
|
85742
85879
|
[commitMutationSafely]
|
|
85743
85880
|
);
|
|
85744
|
-
const addGsapFromProperty =
|
|
85881
|
+
const addGsapFromProperty = useCallback142(
|
|
85745
85882
|
async (selection, animationId, property) => {
|
|
85746
85883
|
const defaultValue = KEYFRAME_PROPERTY_DEFAULTS[property] ?? 0;
|
|
85747
85884
|
const { sdkSession, sdkDeps, activeCompPath } = sdkRef.current ?? {};
|
|
@@ -85775,7 +85912,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
|
|
|
85775
85912
|
},
|
|
85776
85913
|
[commitMutationSafely]
|
|
85777
85914
|
);
|
|
85778
|
-
const removeGsapFromProperty =
|
|
85915
|
+
const removeGsapFromProperty = useCallback142(
|
|
85779
85916
|
(selection, animationId, property) => removeProperty(selection, animationId, property, true),
|
|
85780
85917
|
[removeProperty]
|
|
85781
85918
|
);
|
|
@@ -85790,12 +85927,12 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
|
|
|
85790
85927
|
}
|
|
85791
85928
|
|
|
85792
85929
|
// src/hooks/useSafeGsapCommitMutation.ts
|
|
85793
|
-
import { useCallback as
|
|
85930
|
+
import { useCallback as useCallback143 } from "react";
|
|
85794
85931
|
function getGsapMutationType(mutation) {
|
|
85795
85932
|
return typeof mutation.type === "string" ? mutation.type : "gsap";
|
|
85796
85933
|
}
|
|
85797
85934
|
function useGsapSaveFailureTelemetry(activeCompPath) {
|
|
85798
|
-
return
|
|
85935
|
+
return useCallback143(
|
|
85799
85936
|
(error, selection, mutation, label) => {
|
|
85800
85937
|
trackStudioSaveFailure({
|
|
85801
85938
|
source: "gsap_commit",
|
|
@@ -85812,7 +85949,7 @@ function useGsapSaveFailureTelemetry(activeCompPath) {
|
|
|
85812
85949
|
);
|
|
85813
85950
|
}
|
|
85814
85951
|
function useSafeGsapCommitMutation(commitMutation, trackGsapSaveFailure, showToast) {
|
|
85815
|
-
return
|
|
85952
|
+
return useCallback143(
|
|
85816
85953
|
(selection, mutation, options) => (
|
|
85817
85954
|
// Return the chain so awaiting consumers (gesture commit, enable-keyframes)
|
|
85818
85955
|
// run their post-actions AFTER the server save settles, not immediately.
|
|
@@ -85983,10 +86120,10 @@ function instantPatchesFor(options) {
|
|
|
85983
86120
|
}
|
|
85984
86121
|
function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef, editHistory, reloadPreview, onCacheInvalidate, onFileContentChanged, showToast, sdkSession, publishSdkSession, writeProjectFile, forceReloadSdkSession }) {
|
|
85985
86122
|
const activeProjectId = projectIdRef.current;
|
|
85986
|
-
const activeCompPathRef =
|
|
86123
|
+
const activeCompPathRef = useRef155(activeCompPath);
|
|
85987
86124
|
activeCompPathRef.current = activeCompPath;
|
|
85988
|
-
const serializerRef =
|
|
85989
|
-
const recordMutationEdit =
|
|
86125
|
+
const serializerRef = useRef155(createKeyedSerializer());
|
|
86126
|
+
const recordMutationEdit = useCallback144(async (targetPath, selection, result, options) => {
|
|
85990
86127
|
if (result.before == null || result.after == null) return;
|
|
85991
86128
|
await editHistory.recordEdit({
|
|
85992
86129
|
label: options.label,
|
|
@@ -85996,7 +86133,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
|
|
|
85996
86133
|
files: { [targetPath]: { before: result.before, after: result.after } }
|
|
85997
86134
|
});
|
|
85998
86135
|
}, [editHistory]);
|
|
85999
|
-
const finalizeSuccessfulMutation =
|
|
86136
|
+
const finalizeSuccessfulMutation = useCallback144(async (projectId, compositionPath, selection, mutation, targetPath, result, options) => {
|
|
86000
86137
|
if (projectIdRef.current !== projectId) return;
|
|
86001
86138
|
const previewIsActive = isActiveCommitTarget(
|
|
86002
86139
|
projectIdRef,
|
|
@@ -86033,7 +86170,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
|
|
|
86033
86170
|
nestedFiles
|
|
86034
86171
|
});
|
|
86035
86172
|
}, [projectIdRef, previewIframeRef, reloadPreview, onCacheInvalidate, onFileContentChanged, forceReloadSdkSession, recordMutationEdit]);
|
|
86036
|
-
const runCommit =
|
|
86173
|
+
const runCommit = useCallback144((pid, compositionPath, targetPath, selection, mutation, options) => whileScriptWrites(async () => {
|
|
86037
86174
|
const result = await runMutationRequest(
|
|
86038
86175
|
[mutation],
|
|
86039
86176
|
options,
|
|
@@ -86045,7 +86182,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
|
|
|
86045
86182
|
options.onResult?.(result);
|
|
86046
86183
|
await finalizeSuccessfulMutation(pid, compositionPath, selection, mutation, targetPath, result, options);
|
|
86047
86184
|
}), [showToast, finalizeSuccessfulMutation]);
|
|
86048
|
-
const runBatchCommit =
|
|
86185
|
+
const runBatchCommit = useCallback144((pid, compositionPath, targetPath, calls, options) => whileScriptWrites(async () => {
|
|
86049
86186
|
const first = calls[0];
|
|
86050
86187
|
const last = calls.at(-1);
|
|
86051
86188
|
if (!first || !last) return;
|
|
@@ -86102,7 +86239,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
|
|
|
86102
86239
|
return commit2;
|
|
86103
86240
|
}, [runCommit, runBatchCommit, activeCompPath, activeProjectId, writeProjectFile]);
|
|
86104
86241
|
const trackGsapSaveFailure = useGsapSaveFailureTelemetry(activeCompPath);
|
|
86105
|
-
const handleGsapSaveFailure =
|
|
86242
|
+
const handleGsapSaveFailure = useCallback144(
|
|
86106
86243
|
(error, selection, mutation, label) => {
|
|
86107
86244
|
trackGsapSaveFailure(error, selection, mutation, label);
|
|
86108
86245
|
if (!isStudioSaveErrorAlreadyToasted(error)) {
|
|
@@ -86112,7 +86249,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
|
|
|
86112
86249
|
[showToast, trackGsapSaveFailure]
|
|
86113
86250
|
);
|
|
86114
86251
|
const commitMutationSafely = useSafeGsapCommitMutation(commitMutation, handleGsapSaveFailure);
|
|
86115
|
-
const sdkRefresh =
|
|
86252
|
+
const sdkRefresh = useCallback144(
|
|
86116
86253
|
(after) => {
|
|
86117
86254
|
const script = extractGsapScriptText(after);
|
|
86118
86255
|
if (script) {
|
|
@@ -86124,7 +86261,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
|
|
|
86124
86261
|
},
|
|
86125
86262
|
[previewIframeRef, reloadPreview, onCacheInvalidate]
|
|
86126
86263
|
);
|
|
86127
|
-
const readProjectFileContent2 =
|
|
86264
|
+
const readProjectFileContent2 = useCallback144(
|
|
86128
86265
|
(path) => {
|
|
86129
86266
|
if (!activeProjectId) throw new Error("No active project");
|
|
86130
86267
|
return readProjectFileContent(activeProjectId, path);
|
|
@@ -86180,10 +86317,10 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
|
|
|
86180
86317
|
}
|
|
86181
86318
|
|
|
86182
86319
|
// src/hooks/useDomEditWiring.ts
|
|
86183
|
-
import { useCallback as
|
|
86320
|
+
import { useCallback as useCallback147, useEffect as useEffect126, useRef as useRef158 } from "react";
|
|
86184
86321
|
|
|
86185
86322
|
// src/hooks/useDomEditPreviewSync.ts
|
|
86186
|
-
import { useEffect as useEffect125, useRef as
|
|
86323
|
+
import { useEffect as useEffect125, useRef as useRef156 } from "react";
|
|
86187
86324
|
function useDomEditPreviewSync({
|
|
86188
86325
|
previewIframe,
|
|
86189
86326
|
captionEditMode,
|
|
@@ -86233,7 +86370,7 @@ function useDomEditPreviewSync({
|
|
|
86233
86370
|
applyStudioManualEditsToPreviewRef,
|
|
86234
86371
|
gsapCacheVersion
|
|
86235
86372
|
]);
|
|
86236
|
-
const openSourceRef =
|
|
86373
|
+
const openSourceRef = useRef156(openSourceForSelection);
|
|
86237
86374
|
openSourceRef.current = openSourceForSelection;
|
|
86238
86375
|
useEffect125(
|
|
86239
86376
|
// fallow-ignore-next-line complexity
|
|
@@ -86252,7 +86389,7 @@ function useDomEditPreviewSync({
|
|
|
86252
86389
|
}
|
|
86253
86390
|
|
|
86254
86391
|
// src/hooks/useGsapAnimationFetchFallback.ts
|
|
86255
|
-
import { useCallback as
|
|
86392
|
+
import { useCallback as useCallback145 } from "react";
|
|
86256
86393
|
var FETCH_ERROR_RETRIES = 1;
|
|
86257
86394
|
var FETCH_ERROR_DELAY_MS = 120;
|
|
86258
86395
|
var delay = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
@@ -86280,7 +86417,7 @@ async function fetchElementAnimationsWithRetry(projectId, gsapSourceFile, target
|
|
|
86280
86417
|
}
|
|
86281
86418
|
}
|
|
86282
86419
|
function useGsapAnimationFetchFallback(projectId) {
|
|
86283
|
-
return
|
|
86420
|
+
return useCallback145(
|
|
86284
86421
|
(selection, options) => async () => {
|
|
86285
86422
|
if (!projectId) return [];
|
|
86286
86423
|
const target = { id: selection.id ?? null, selector: selection.selector ?? null };
|
|
@@ -86298,7 +86435,7 @@ function useGsapAnimationFetchFallback(projectId) {
|
|
|
86298
86435
|
}
|
|
86299
86436
|
|
|
86300
86437
|
// src/hooks/useGsapSelectionHandlers.ts
|
|
86301
|
-
import { useCallback as
|
|
86438
|
+
import { useCallback as useCallback146, useRef as useRef157 } from "react";
|
|
86302
86439
|
function useGsapSelectionHandlers({
|
|
86303
86440
|
domEditSelection,
|
|
86304
86441
|
updateGsapProperty,
|
|
@@ -86322,13 +86459,13 @@ function useGsapSelectionHandlers({
|
|
|
86322
86459
|
selectedGsapAnimations,
|
|
86323
86460
|
showToast
|
|
86324
86461
|
}) {
|
|
86325
|
-
const lastSelectionRef =
|
|
86462
|
+
const lastSelectionRef = useRef157(null);
|
|
86326
86463
|
if (domEditSelection) lastSelectionRef.current = domEditSelection;
|
|
86327
|
-
const resolveWriteSelection2 =
|
|
86464
|
+
const resolveWriteSelection2 = useCallback146(
|
|
86328
86465
|
(selectionOverride) => selectionOverride === void 0 ? domEditSelection ?? lastSelectionRef.current : selectionOverride,
|
|
86329
86466
|
[domEditSelection]
|
|
86330
86467
|
);
|
|
86331
|
-
const trackGsapHandlerFailure =
|
|
86468
|
+
const trackGsapHandlerFailure = useCallback146(
|
|
86332
86469
|
(error, selection, mutationType, label) => {
|
|
86333
86470
|
trackStudioSaveFailure({
|
|
86334
86471
|
source: "gsap_commit",
|
|
@@ -86346,7 +86483,7 @@ function useGsapSelectionHandlers({
|
|
|
86346
86483
|
},
|
|
86347
86484
|
[showToast]
|
|
86348
86485
|
);
|
|
86349
|
-
const observeGsapMutation =
|
|
86486
|
+
const observeGsapMutation = useCallback146(
|
|
86350
86487
|
(mutation, selection, mutationType, label) => mutation.then(
|
|
86351
86488
|
() => true,
|
|
86352
86489
|
(error) => {
|
|
@@ -86356,14 +86493,14 @@ function useGsapSelectionHandlers({
|
|
|
86356
86493
|
),
|
|
86357
86494
|
[trackGsapHandlerFailure]
|
|
86358
86495
|
);
|
|
86359
|
-
const handleGsapUpdateProperty =
|
|
86496
|
+
const handleGsapUpdateProperty = useCallback146(
|
|
86360
86497
|
(animId, prop, value) => {
|
|
86361
86498
|
if (!domEditSelection) return;
|
|
86362
86499
|
updateGsapProperty(domEditSelection, animId, prop, value);
|
|
86363
86500
|
},
|
|
86364
86501
|
[domEditSelection, updateGsapProperty]
|
|
86365
86502
|
);
|
|
86366
|
-
const handleGsapUpdateMeta =
|
|
86503
|
+
const handleGsapUpdateMeta = useCallback146(
|
|
86367
86504
|
(animId, updates, selectionOverride) => {
|
|
86368
86505
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86369
86506
|
if (!sel) return Promise.resolve(false);
|
|
@@ -86376,7 +86513,7 @@ function useGsapSelectionHandlers({
|
|
|
86376
86513
|
},
|
|
86377
86514
|
[resolveWriteSelection2, observeGsapMutation, updateGsapMeta]
|
|
86378
86515
|
);
|
|
86379
|
-
const handleGsapDeleteAnimation =
|
|
86516
|
+
const handleGsapDeleteAnimation = useCallback146(
|
|
86380
86517
|
(animId, selectionOverride) => {
|
|
86381
86518
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86382
86519
|
if (!sel) return Promise.resolve(false);
|
|
@@ -86389,7 +86526,7 @@ function useGsapSelectionHandlers({
|
|
|
86389
86526
|
},
|
|
86390
86527
|
[resolveWriteSelection2, deleteGsapAnimation, observeGsapMutation]
|
|
86391
86528
|
);
|
|
86392
|
-
const handleGsapDeleteAllForElement =
|
|
86529
|
+
const handleGsapDeleteAllForElement = useCallback146(
|
|
86393
86530
|
(targetSelector) => {
|
|
86394
86531
|
const sel = domEditSelection ?? lastSelectionRef.current;
|
|
86395
86532
|
if (!sel) return;
|
|
@@ -86403,7 +86540,7 @@ function useGsapSelectionHandlers({
|
|
|
86403
86540
|
},
|
|
86404
86541
|
[domEditSelection, deleteAllForSelector, observeGsapMutation]
|
|
86405
86542
|
);
|
|
86406
|
-
const handleGsapAddAnimation =
|
|
86543
|
+
const handleGsapAddAnimation = useCallback146(
|
|
86407
86544
|
(method, selectionOverride) => {
|
|
86408
86545
|
const selection = resolveWriteSelection2(selectionOverride);
|
|
86409
86546
|
if (!selection) return Promise.resolve(false);
|
|
@@ -86422,7 +86559,7 @@ function useGsapSelectionHandlers({
|
|
|
86422
86559
|
},
|
|
86423
86560
|
[resolveWriteSelection2, addGsapAnimation, handleDomManualEditsReset, observeGsapMutation]
|
|
86424
86561
|
);
|
|
86425
|
-
const handleGsapAddProperty =
|
|
86562
|
+
const handleGsapAddProperty = useCallback146(
|
|
86426
86563
|
(animId, prop) => {
|
|
86427
86564
|
if (!domEditSelection) return;
|
|
86428
86565
|
observeGsapMutation(
|
|
@@ -86434,7 +86571,7 @@ function useGsapSelectionHandlers({
|
|
|
86434
86571
|
},
|
|
86435
86572
|
[domEditSelection, addGsapProperty, observeGsapMutation]
|
|
86436
86573
|
);
|
|
86437
|
-
const handleGsapRemoveProperty =
|
|
86574
|
+
const handleGsapRemoveProperty = useCallback146(
|
|
86438
86575
|
(animId, prop) => {
|
|
86439
86576
|
if (!domEditSelection) return;
|
|
86440
86577
|
observeGsapMutation(
|
|
@@ -86446,7 +86583,7 @@ function useGsapSelectionHandlers({
|
|
|
86446
86583
|
},
|
|
86447
86584
|
[domEditSelection, observeGsapMutation, removeGsapProperty]
|
|
86448
86585
|
);
|
|
86449
|
-
const handleGsapUpdateFromProperty =
|
|
86586
|
+
const handleGsapUpdateFromProperty = useCallback146(
|
|
86450
86587
|
(animId, prop, value) => {
|
|
86451
86588
|
if (!domEditSelection) return;
|
|
86452
86589
|
observeGsapMutation(
|
|
@@ -86458,7 +86595,7 @@ function useGsapSelectionHandlers({
|
|
|
86458
86595
|
},
|
|
86459
86596
|
[domEditSelection, observeGsapMutation, updateGsapFromProperty]
|
|
86460
86597
|
);
|
|
86461
|
-
const handleGsapAddFromProperty =
|
|
86598
|
+
const handleGsapAddFromProperty = useCallback146(
|
|
86462
86599
|
(animId, prop) => {
|
|
86463
86600
|
if (!domEditSelection) return;
|
|
86464
86601
|
observeGsapMutation(
|
|
@@ -86470,7 +86607,7 @@ function useGsapSelectionHandlers({
|
|
|
86470
86607
|
},
|
|
86471
86608
|
[domEditSelection, addGsapFromProperty, observeGsapMutation]
|
|
86472
86609
|
);
|
|
86473
|
-
const handleGsapRemoveFromProperty =
|
|
86610
|
+
const handleGsapRemoveFromProperty = useCallback146(
|
|
86474
86611
|
(animId, prop) => {
|
|
86475
86612
|
if (!domEditSelection) return;
|
|
86476
86613
|
observeGsapMutation(
|
|
@@ -86482,7 +86619,7 @@ function useGsapSelectionHandlers({
|
|
|
86482
86619
|
},
|
|
86483
86620
|
[domEditSelection, observeGsapMutation, removeGsapFromProperty]
|
|
86484
86621
|
);
|
|
86485
|
-
const handleGsapAddKeyframe =
|
|
86622
|
+
const handleGsapAddKeyframe = useCallback146(
|
|
86486
86623
|
(animId, percentage, property, value, selectionOverride) => {
|
|
86487
86624
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86488
86625
|
if (!sel) return;
|
|
@@ -86490,7 +86627,7 @@ function useGsapSelectionHandlers({
|
|
|
86490
86627
|
},
|
|
86491
86628
|
[resolveWriteSelection2, addKeyframe]
|
|
86492
86629
|
);
|
|
86493
|
-
const handleGsapAddKeyframeBatch =
|
|
86630
|
+
const handleGsapAddKeyframeBatch = useCallback146(
|
|
86494
86631
|
(animId, percentage, properties, commitOverrides, selectionOverride) => {
|
|
86495
86632
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86496
86633
|
if (!sel) return Promise.resolve();
|
|
@@ -86502,7 +86639,7 @@ function useGsapSelectionHandlers({
|
|
|
86502
86639
|
},
|
|
86503
86640
|
[resolveWriteSelection2, addKeyframeBatch, trackGsapHandlerFailure]
|
|
86504
86641
|
);
|
|
86505
|
-
const handleGsapRemoveKeyframe =
|
|
86642
|
+
const handleGsapRemoveKeyframe = useCallback146(
|
|
86506
86643
|
(animId, percentage, commitOverrides, selectionOverride) => {
|
|
86507
86644
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86508
86645
|
if (!sel) return;
|
|
@@ -86511,7 +86648,7 @@ function useGsapSelectionHandlers({
|
|
|
86511
86648
|
},
|
|
86512
86649
|
[resolveWriteSelection2, removeKeyframe]
|
|
86513
86650
|
);
|
|
86514
|
-
const handleGsapMoveKeyframeToPlayhead =
|
|
86651
|
+
const handleGsapMoveKeyframeToPlayhead = useCallback146(
|
|
86515
86652
|
(animId, fromPercentage, selectionOverride, animationOverride) => {
|
|
86516
86653
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86517
86654
|
if (!sel) return;
|
|
@@ -86522,7 +86659,7 @@ function useGsapSelectionHandlers({
|
|
|
86522
86659
|
},
|
|
86523
86660
|
[resolveWriteSelection2, selectedGsapAnimations, moveKeyframe]
|
|
86524
86661
|
);
|
|
86525
|
-
const handleGsapMoveKeyframe =
|
|
86662
|
+
const handleGsapMoveKeyframe = useCallback146(
|
|
86526
86663
|
(animId, fromPercentage, toPercentage, selectionOverride) => {
|
|
86527
86664
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86528
86665
|
if (!sel) return Promise.resolve(false);
|
|
@@ -86531,7 +86668,7 @@ function useGsapSelectionHandlers({
|
|
|
86531
86668
|
},
|
|
86532
86669
|
[resolveWriteSelection2, moveKeyframe]
|
|
86533
86670
|
);
|
|
86534
|
-
const handleGsapResizeKeyframedTween =
|
|
86671
|
+
const handleGsapResizeKeyframedTween = useCallback146(
|
|
86535
86672
|
(animId, position, duration, pctRemap, selectionOverride) => {
|
|
86536
86673
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86537
86674
|
if (!sel) return Promise.resolve(false);
|
|
@@ -86540,7 +86677,7 @@ function useGsapSelectionHandlers({
|
|
|
86540
86677
|
},
|
|
86541
86678
|
[resolveWriteSelection2, resizeKeyframedTween]
|
|
86542
86679
|
);
|
|
86543
|
-
const handleGsapConvertToKeyframes =
|
|
86680
|
+
const handleGsapConvertToKeyframes = useCallback146(
|
|
86544
86681
|
(animId, resolvedFromValues, duration, commitOverrides, selectionOverride) => {
|
|
86545
86682
|
const sel = resolveWriteSelection2(selectionOverride);
|
|
86546
86683
|
if (!sel) return Promise.resolve();
|
|
@@ -86552,7 +86689,7 @@ function useGsapSelectionHandlers({
|
|
|
86552
86689
|
},
|
|
86553
86690
|
[resolveWriteSelection2, convertToKeyframes, trackGsapHandlerFailure]
|
|
86554
86691
|
);
|
|
86555
|
-
const handleGsapRemoveAllKeyframes =
|
|
86692
|
+
const handleGsapRemoveAllKeyframes = useCallback146(
|
|
86556
86693
|
(animId, selectionOverride, telemetry = true) => {
|
|
86557
86694
|
const selection = resolveWriteSelection2(selectionOverride);
|
|
86558
86695
|
if (!selection) return Promise.resolve(false);
|
|
@@ -86563,7 +86700,7 @@ function useGsapSelectionHandlers({
|
|
|
86563
86700
|
},
|
|
86564
86701
|
[resolveWriteSelection2, trackGsapHandlerFailure, removeAllKeyframes]
|
|
86565
86702
|
);
|
|
86566
|
-
const handleResetSelectedElementKeyframes =
|
|
86703
|
+
const handleResetSelectedElementKeyframes = useCallback146(() => {
|
|
86567
86704
|
if (!domEditSelection) return false;
|
|
86568
86705
|
const withKeyframes = selectedGsapAnimations.find((a) => a.keyframes);
|
|
86569
86706
|
if (!withKeyframes) return false;
|
|
@@ -86638,7 +86775,7 @@ function useDomEditWiring(params) {
|
|
|
86638
86775
|
removeAllKeyframes,
|
|
86639
86776
|
handleDomManualEditsReset
|
|
86640
86777
|
} = params;
|
|
86641
|
-
const onClickToSource =
|
|
86778
|
+
const onClickToSource = useCallback147(
|
|
86642
86779
|
(selection) => {
|
|
86643
86780
|
if (!openSourceForSelection) return;
|
|
86644
86781
|
if (!selection.sourceFile) return;
|
|
@@ -86660,7 +86797,7 @@ function useDomEditWiring(params) {
|
|
|
86660
86797
|
const key2 = matchKey ? matchKey.key ?? matchKey.id : null;
|
|
86661
86798
|
if (key2 && key2 !== selectedElementId) setSelectedElementId(key2);
|
|
86662
86799
|
}, [domEditSelection?.id]);
|
|
86663
|
-
const prevRefreshKeyRef =
|
|
86800
|
+
const prevRefreshKeyRef = useRef158(refreshKey);
|
|
86664
86801
|
useEffect126(() => {
|
|
86665
86802
|
if (refreshKey !== prevRefreshKeyRef.current) {
|
|
86666
86803
|
prevRefreshKeyRef.current = refreshKey;
|
|
@@ -86736,7 +86873,7 @@ function useDomEditWiring(params) {
|
|
|
86736
86873
|
}
|
|
86737
86874
|
|
|
86738
86875
|
// src/hooks/useGsapAwareGroupMove.ts
|
|
86739
|
-
import { useCallback as
|
|
86876
|
+
import { useCallback as useCallback148 } from "react";
|
|
86740
86877
|
|
|
86741
86878
|
// src/hooks/gsapGroupPreflight.ts
|
|
86742
86879
|
function firstPreflightFailure(results, updates, savedOnElement, activeCompPath) {
|
|
@@ -86766,7 +86903,7 @@ function useGsapAwareGroupMove({
|
|
|
86766
86903
|
stageElementPositionOffset,
|
|
86767
86904
|
showToast
|
|
86768
86905
|
}) {
|
|
86769
|
-
const handleGsapAwareGroupPathOffsetCommit =
|
|
86906
|
+
const handleGsapAwareGroupPathOffsetCommit = useCallback148(
|
|
86770
86907
|
async (updates, options = {}) => {
|
|
86771
86908
|
const writes = observeGsapGesture(gsapCommitMutation);
|
|
86772
86909
|
const writer = writes.commit;
|
|
@@ -86908,7 +87045,7 @@ function useGsapAwareGroupMove({
|
|
|
86908
87045
|
}
|
|
86909
87046
|
|
|
86910
87047
|
// src/hooks/useGsapAwareEditing.ts
|
|
86911
|
-
import { useCallback as
|
|
87048
|
+
import { useCallback as useCallback151 } from "react";
|
|
86912
87049
|
|
|
86913
87050
|
// src/hooks/gsapResizePreflight.ts
|
|
86914
87051
|
function resizeRoute(animations, fetchedAnimations) {
|
|
@@ -86941,7 +87078,7 @@ function preflightGsapResizeIntercept(selection, animations, iframe, fetchedAnim
|
|
|
86941
87078
|
}
|
|
86942
87079
|
|
|
86943
87080
|
// src/hooks/useEnableKeyframes.ts
|
|
86944
|
-
import { useCallback as
|
|
87081
|
+
import { useCallback as useCallback149 } from "react";
|
|
86945
87082
|
var enableKeyframesTransactionCounter = 0;
|
|
86946
87083
|
function animatedProps(anim) {
|
|
86947
87084
|
if (!anim) return ["x", "y"];
|
|
@@ -87199,7 +87336,7 @@ async function applyArcKeyframeAtPlayhead(session, sel, arcAnim, t2, iframe) {
|
|
|
87199
87336
|
);
|
|
87200
87337
|
}
|
|
87201
87338
|
function useEnableKeyframes(sessionRef) {
|
|
87202
|
-
return
|
|
87339
|
+
return useCallback149(async () => {
|
|
87203
87340
|
const session = sessionRef.current;
|
|
87204
87341
|
if (!session) return;
|
|
87205
87342
|
const sel = session.domEditSelection;
|
|
@@ -87574,7 +87711,7 @@ async function tryGsapResizeIntercept(selection, size, animations, iframe, commi
|
|
|
87574
87711
|
}
|
|
87575
87712
|
|
|
87576
87713
|
// src/hooks/useAnimatedPropertyCommit.ts
|
|
87577
|
-
import { useCallback as
|
|
87714
|
+
import { useCallback as useCallback150 } from "react";
|
|
87578
87715
|
import { classifyPropertyGroup as classifyPropertyGroup4 } from "@hyperframes/core/gsap-parser";
|
|
87579
87716
|
function pickBestAnimation(animations, selector, property) {
|
|
87580
87717
|
const targetGroup = property ? classifyPropertyGroup4(property) : void 0;
|
|
@@ -87813,7 +87950,7 @@ async function commitKeyframeProps(selection, anim, props, propEntries, primaryP
|
|
|
87813
87950
|
}
|
|
87814
87951
|
function useAnimatedPropertyCommit(deps) {
|
|
87815
87952
|
const { selectedGsapAnimations, gsapCommitMutation, previewIframeRef, bumpGsapCache } = deps;
|
|
87816
|
-
const commitAnimatedProperties =
|
|
87953
|
+
const commitAnimatedProperties = useCallback150(
|
|
87817
87954
|
// This is the single routing boundary for set, keyframe, whole-tween, and first-group writes.
|
|
87818
87955
|
// fallow-ignore-next-line complexity
|
|
87819
87956
|
async (selection, props, commit2 = gsapCommitMutation) => {
|
|
@@ -87919,7 +88056,7 @@ function useAnimatedPropertyCommit(deps) {
|
|
|
87919
88056
|
},
|
|
87920
88057
|
[selectedGsapAnimations, gsapCommitMutation, previewIframeRef, bumpGsapCache]
|
|
87921
88058
|
);
|
|
87922
|
-
const commitAnimatedProperty =
|
|
88059
|
+
const commitAnimatedProperty = useCallback150(
|
|
87923
88060
|
(selection, property, value) => commitAnimatedProperties(selection, { [property]: value }),
|
|
87924
88061
|
[commitAnimatedProperties]
|
|
87925
88062
|
);
|
|
@@ -87946,14 +88083,14 @@ function useGsapAwareEditing({
|
|
|
87946
88083
|
setArcPath,
|
|
87947
88084
|
updateArcSegment
|
|
87948
88085
|
}) {
|
|
87949
|
-
const getGsapAnimationsForSelection =
|
|
88086
|
+
const getGsapAnimationsForSelection = useCallback151(
|
|
87950
88087
|
(selection) => {
|
|
87951
88088
|
if (domEditSelection?.element === selection.element) return selectedGsapAnimations;
|
|
87952
88089
|
return makeFetchFallback(selection, { failOnFetchError: true })();
|
|
87953
88090
|
},
|
|
87954
88091
|
[domEditSelection, selectedGsapAnimations, makeFetchFallback]
|
|
87955
88092
|
);
|
|
87956
|
-
const handleGsapAwarePathOffsetCommit =
|
|
88093
|
+
const handleGsapAwarePathOffsetCommit = useCallback151(
|
|
87957
88094
|
async (selection, next, modifiers) => {
|
|
87958
88095
|
const writes = observeGsapGesture(gsapCommitMutation);
|
|
87959
88096
|
if (modifiers?.plainTranslate ?? editsPlainCss(selection.element, "move")) {
|
|
@@ -88007,7 +88144,7 @@ function useGsapAwareEditing({
|
|
|
88007
88144
|
stageElementPositionOffset,
|
|
88008
88145
|
showToast
|
|
88009
88146
|
});
|
|
88010
|
-
const handleGsapAwareBoxSizeCommit =
|
|
88147
|
+
const handleGsapAwareBoxSizeCommit = useCallback151(
|
|
88011
88148
|
async (selection, next, offset, restore2 = () => void 0, route) => {
|
|
88012
88149
|
const writes = observeGsapGesture(gsapCommitMutation);
|
|
88013
88150
|
if (route?.plainTranslate ?? editsPlainCss(selection.element, "resize")) {
|
|
@@ -88151,7 +88288,7 @@ function useGsapAwareEditing({
|
|
|
88151
88288
|
getGsapAnimationsForSelection
|
|
88152
88289
|
]
|
|
88153
88290
|
);
|
|
88154
|
-
const handleGsapAwareRotationCommit =
|
|
88291
|
+
const handleGsapAwareRotationCommit = useCallback151(
|
|
88155
88292
|
async (selection, next) => {
|
|
88156
88293
|
const writes = observeGsapGesture(gsapCommitMutation);
|
|
88157
88294
|
if (next.plain === void 0 ? editsPlainCss(selection.element, "rotate") : next.plain) {
|
|
@@ -88198,7 +88335,7 @@ function useGsapAwareEditing({
|
|
|
88198
88335
|
previewIframeRef,
|
|
88199
88336
|
bumpGsapCache
|
|
88200
88337
|
});
|
|
88201
|
-
const commitAnimatedProperties =
|
|
88338
|
+
const commitAnimatedProperties = useCallback151(
|
|
88202
88339
|
async (selection, properties) => {
|
|
88203
88340
|
try {
|
|
88204
88341
|
await writeSizeWithCrop(
|
|
@@ -88220,25 +88357,25 @@ function useGsapAwareEditing({
|
|
|
88220
88357
|
trackGsapInteractionFailure
|
|
88221
88358
|
]
|
|
88222
88359
|
);
|
|
88223
|
-
const commitAnimatedProperty =
|
|
88360
|
+
const commitAnimatedProperty = useCallback151(
|
|
88224
88361
|
(selection, property, value) => commitAnimatedProperties(selection, { [property]: value }),
|
|
88225
88362
|
[commitAnimatedProperties]
|
|
88226
88363
|
);
|
|
88227
|
-
const handleSetArcPath =
|
|
88364
|
+
const handleSetArcPath = useCallback151(
|
|
88228
88365
|
(animId, config) => {
|
|
88229
88366
|
if (!domEditSelection) return;
|
|
88230
88367
|
setArcPath(domEditSelection, animId, config);
|
|
88231
88368
|
},
|
|
88232
88369
|
[domEditSelection, setArcPath]
|
|
88233
88370
|
);
|
|
88234
|
-
const handleUpdateArcSegment =
|
|
88371
|
+
const handleUpdateArcSegment = useCallback151(
|
|
88235
88372
|
(animId, segmentIndex, update) => {
|
|
88236
88373
|
if (!domEditSelection) return;
|
|
88237
88374
|
updateArcSegment(domEditSelection, animId, segmentIndex, update);
|
|
88238
88375
|
},
|
|
88239
88376
|
[domEditSelection, updateArcSegment]
|
|
88240
88377
|
);
|
|
88241
|
-
const noopCommit =
|
|
88378
|
+
const noopCommit = useCallback151(async () => {
|
|
88242
88379
|
}, []);
|
|
88243
88380
|
const trackGsapSaveFailure = useGsapSaveFailureTelemetry(null);
|
|
88244
88381
|
const safeGsapCommit = useSafeGsapCommitMutation(
|
|
@@ -88246,14 +88383,14 @@ function useGsapAwareEditing({
|
|
|
88246
88383
|
trackGsapSaveFailure,
|
|
88247
88384
|
showToast
|
|
88248
88385
|
);
|
|
88249
|
-
const commitMutation =
|
|
88386
|
+
const commitMutation = useCallback151(
|
|
88250
88387
|
async (mutation, options, selection = domEditSelection) => {
|
|
88251
88388
|
if (!selection) return;
|
|
88252
88389
|
await safeGsapCommit(selection, mutation, options);
|
|
88253
88390
|
},
|
|
88254
88391
|
[domEditSelection, safeGsapCommit]
|
|
88255
88392
|
);
|
|
88256
|
-
const handleUnroll =
|
|
88393
|
+
const handleUnroll = useCallback151(() => {
|
|
88257
88394
|
void commitMutation(
|
|
88258
88395
|
{ type: "unroll-timeline" },
|
|
88259
88396
|
{ label: "Unroll to literal tweens", softReload: true }
|
|
@@ -88275,7 +88412,7 @@ function useGsapAwareEditing({
|
|
|
88275
88412
|
}
|
|
88276
88413
|
|
|
88277
88414
|
// src/hooks/useStudioSelectionPublisher.ts
|
|
88278
|
-
import { useEffect as useEffect127, useRef as
|
|
88415
|
+
import { useEffect as useEffect127, useRef as useRef159 } from "react";
|
|
88279
88416
|
|
|
88280
88417
|
// src/utils/studioSelectionSnapshot.ts
|
|
88281
88418
|
function round34(value) {
|
|
@@ -88366,8 +88503,8 @@ function useStudioSelectionPublisher({
|
|
|
88366
88503
|
previewDocumentVersion,
|
|
88367
88504
|
refreshDomEditSelectionFromPreview
|
|
88368
88505
|
}) {
|
|
88369
|
-
const lastSelectionRefreshKeyRef =
|
|
88370
|
-
const pendingSelectionRefreshKeyRef =
|
|
88506
|
+
const lastSelectionRefreshKeyRef = useRef159(refreshKey);
|
|
88507
|
+
const pendingSelectionRefreshKeyRef = useRef159(null);
|
|
88371
88508
|
useEffect127(() => {
|
|
88372
88509
|
if (!projectId) return;
|
|
88373
88510
|
const selection = domEditSelection && selectionElementLive(domEditSelection) ? buildStudioSelectionSnapshot({
|
|
@@ -88404,12 +88541,12 @@ function useStudioSelectionPublisher({
|
|
|
88404
88541
|
}
|
|
88405
88542
|
|
|
88406
88543
|
// src/hooks/useKeyframeEaseCommits.ts
|
|
88407
|
-
import { useCallback as
|
|
88544
|
+
import { useCallback as useCallback152 } from "react";
|
|
88408
88545
|
function useKeyframeEaseCommits({
|
|
88409
88546
|
gsapCommitMutation,
|
|
88410
88547
|
domEditSelectionRef
|
|
88411
88548
|
}) {
|
|
88412
|
-
const handleUpdateSegmentEase =
|
|
88549
|
+
const handleUpdateSegmentEase = useCallback152(
|
|
88413
88550
|
(targets, ease) => {
|
|
88414
88551
|
const selection = domEditSelectionRef.current;
|
|
88415
88552
|
if (!selection || targets.length === 0) return;
|
|
@@ -88443,11 +88580,11 @@ function useKeyframeEaseCommits({
|
|
|
88443
88580
|
},
|
|
88444
88581
|
[gsapCommitMutation, domEditSelectionRef]
|
|
88445
88582
|
);
|
|
88446
|
-
const handleUpdateKeyframeEase =
|
|
88583
|
+
const handleUpdateKeyframeEase = useCallback152(
|
|
88447
88584
|
(animationId, percentage, ease) => handleUpdateSegmentEase([{ animationId, tweenPercentage: percentage }], ease),
|
|
88448
88585
|
[handleUpdateSegmentEase]
|
|
88449
88586
|
);
|
|
88450
|
-
const handleSetAllKeyframeEases =
|
|
88587
|
+
const handleSetAllKeyframeEases = useCallback152(
|
|
88451
88588
|
(animationId, ease) => {
|
|
88452
88589
|
const sel = domEditSelectionRef.current;
|
|
88453
88590
|
if (!sel) return;
|
|
@@ -88467,7 +88604,7 @@ function useKeyframeEaseCommits({
|
|
|
88467
88604
|
}
|
|
88468
88605
|
|
|
88469
88606
|
// src/hooks/useCommitPreflightCapabilities.ts
|
|
88470
|
-
import { useEffect as useEffect128, useMemo as useMemo75, useRef as
|
|
88607
|
+
import { useEffect as useEffect128, useMemo as useMemo75, useRef as useRef160, useState as useState129 } from "react";
|
|
88471
88608
|
function runCommitPreflights(selection, fileAnimations, iframe, group) {
|
|
88472
88609
|
const target = { id: selection.id ?? null, selector: selection.selector ?? null };
|
|
88473
88610
|
const animations = getAnimationsForElement(fileAnimations, target, selection.element);
|
|
@@ -88527,8 +88664,8 @@ function useCommitPreflightCapabilities({
|
|
|
88527
88664
|
previewIframeRef,
|
|
88528
88665
|
version
|
|
88529
88666
|
}) {
|
|
88530
|
-
const parsesRef =
|
|
88531
|
-
const [parseTick, setParseTick] =
|
|
88667
|
+
const parsesRef = useRef160(/* @__PURE__ */ new Map());
|
|
88668
|
+
const [parseTick, setParseTick] = useState129(0);
|
|
88532
88669
|
useEffect128(() => {
|
|
88533
88670
|
if (!enabled || !projectId) return;
|
|
88534
88671
|
const targets = selection ? [selection, ...groupSelections] : groupSelections;
|
|
@@ -88586,11 +88723,11 @@ function timelineElementsForDelete(members, elements) {
|
|
|
88586
88723
|
}
|
|
88587
88724
|
|
|
88588
88725
|
// src/hooks/useLivePreviewIframe.ts
|
|
88589
|
-
import { useEffect as useEffect129, useRef as
|
|
88726
|
+
import { useEffect as useEffect129, useRef as useRef161, useState as useState130 } from "react";
|
|
88590
88727
|
function useLivePreviewIframe2(host) {
|
|
88591
|
-
const [promoted, setPromoted] =
|
|
88728
|
+
const [promoted, setPromoted] = useState130();
|
|
88592
88729
|
const live = host && promoted?.host === host ? promoted.live : host;
|
|
88593
|
-
const liveRef =
|
|
88730
|
+
const liveRef = useRef161(live);
|
|
88594
88731
|
liveRef.current = live;
|
|
88595
88732
|
useEffect129(() => {
|
|
88596
88733
|
if (!host) return;
|
|
@@ -88882,7 +89019,7 @@ function useDomEditSession({
|
|
|
88882
89019
|
forceReloadSdkSession,
|
|
88883
89020
|
timelineElements
|
|
88884
89021
|
});
|
|
88885
|
-
const handleDomEditElementDelete =
|
|
89022
|
+
const handleDomEditElementDelete = useCallback153(
|
|
88886
89023
|
async (selection, options) => {
|
|
88887
89024
|
if (isRecordingRef?.current) {
|
|
88888
89025
|
showToast("Cannot edit timeline while recording", "error");
|
|
@@ -88905,7 +89042,7 @@ function useDomEditSession({
|
|
|
88905
89042
|
timelineElements
|
|
88906
89043
|
]
|
|
88907
89044
|
);
|
|
88908
|
-
const handleGroupSelection =
|
|
89045
|
+
const handleGroupSelection = useCallback153(() => {
|
|
88909
89046
|
const group = domEditGroupSelectionsRef.current;
|
|
88910
89047
|
const single = domEditSelectionRef.current;
|
|
88911
89048
|
const members = group.length > 0 ? group : single ? [single] : [];
|
|
@@ -88923,7 +89060,7 @@ function useDomEditSession({
|
|
|
88923
89060
|
trackStudioEvent("group", { action: "create", count: members.length });
|
|
88924
89061
|
void groupSelection(members);
|
|
88925
89062
|
}, [domEditGroupSelectionsRef, domEditSelectionRef, groupSelection, showToast]);
|
|
88926
|
-
const handleUngroupSelection =
|
|
89063
|
+
const handleUngroupSelection = useCallback153(() => {
|
|
88927
89064
|
const sel = domEditSelectionRef.current;
|
|
88928
89065
|
if (!sel || selectionDataAttribute(sel, "data-hf-group") === null) {
|
|
88929
89066
|
showToast("Select a group to ungroup", "info");
|
|
@@ -89028,7 +89165,7 @@ function useDomEditSession({
|
|
|
89028
89165
|
setArcPath,
|
|
89029
89166
|
updateArcSegment
|
|
89030
89167
|
});
|
|
89031
|
-
const handleDomGroupMoveBy =
|
|
89168
|
+
const handleDomGroupMoveBy = useCallback153(
|
|
89032
89169
|
(moves) => moveDomGroupBy(
|
|
89033
89170
|
moves,
|
|
89034
89171
|
(updates) => handleGsapAwareGroupPathOffsetCommit(updates, { refusalToast: false })
|
|
@@ -89154,7 +89291,7 @@ function useSdkSelectionSync(session, domEditSelection, domEditGroupSelections)
|
|
|
89154
89291
|
import { useEffect as useEffect132 } from "react";
|
|
89155
89292
|
|
|
89156
89293
|
// src/hooks/useSdkSession.ts
|
|
89157
|
-
import { useState as
|
|
89294
|
+
import { useState as useState131, useEffect as useEffect131, useCallback as useCallback154, useRef as useRef162 } from "react";
|
|
89158
89295
|
import { openComposition as openComposition3 } from "@hyperframes/sdk";
|
|
89159
89296
|
|
|
89160
89297
|
// src/hooks/externalFileReloadBus.ts
|
|
@@ -89264,20 +89401,20 @@ function disposeSdkSession(session) {
|
|
|
89264
89401
|
}
|
|
89265
89402
|
}
|
|
89266
89403
|
function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded = false, onAbsentRead) {
|
|
89267
|
-
const [ownedSession, setOwnedSession] =
|
|
89268
|
-
const ownedSessionRef =
|
|
89269
|
-
const sessionOwnersRef =
|
|
89270
|
-
const generationRef =
|
|
89271
|
-
const projectIdRef =
|
|
89404
|
+
const [ownedSession, setOwnedSession] = useState131(null);
|
|
89405
|
+
const ownedSessionRef = useRef162(null);
|
|
89406
|
+
const sessionOwnersRef = useRef162(/* @__PURE__ */ new WeakMap());
|
|
89407
|
+
const generationRef = useRef162(0);
|
|
89408
|
+
const projectIdRef = useRef162(projectId);
|
|
89272
89409
|
projectIdRef.current = projectId;
|
|
89273
|
-
const activeCompPathRef =
|
|
89410
|
+
const activeCompPathRef = useRef162(activeCompPath);
|
|
89274
89411
|
activeCompPathRef.current = activeCompPath;
|
|
89275
|
-
const [reloadToken, setReloadToken] =
|
|
89276
|
-
const reloadTokenRef =
|
|
89412
|
+
const [reloadToken, setReloadToken] = useState131(0);
|
|
89413
|
+
const reloadTokenRef = useRef162(reloadToken);
|
|
89277
89414
|
reloadTokenRef.current = reloadToken;
|
|
89278
|
-
const [unreachableProject, setUnreachableProject] =
|
|
89279
|
-
const [compositionMissing, setCompositionMissing] =
|
|
89280
|
-
const refreshedAbsentPathsRef =
|
|
89415
|
+
const [unreachableProject, setUnreachableProject] = useState131(null);
|
|
89416
|
+
const [compositionMissing, setCompositionMissing] = useState131(false);
|
|
89417
|
+
const refreshedAbsentPathsRef = useRef162(/* @__PURE__ */ new Set());
|
|
89281
89418
|
useEffect131(() => {
|
|
89282
89419
|
refreshedAbsentPathsRef.current.clear();
|
|
89283
89420
|
}, [projectId]);
|
|
@@ -89370,8 +89507,8 @@ function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded
|
|
|
89370
89507
|
}
|
|
89371
89508
|
};
|
|
89372
89509
|
}, [projectId, activeCompPath, reloadToken]);
|
|
89373
|
-
const forceReload =
|
|
89374
|
-
const publish =
|
|
89510
|
+
const forceReload = useCallback154(() => setReloadToken((t2) => t2 + 1), []);
|
|
89511
|
+
const publish = useCallback154(({ candidate, expectedSession, targetPath }) => {
|
|
89375
89512
|
const expectedOwner = sessionOwnersRef.current.get(expectedSession);
|
|
89376
89513
|
const current2 = ownedSessionRef.current;
|
|
89377
89514
|
if (!isSessionOwnerActive(
|
|
@@ -89414,7 +89551,7 @@ function useStudioSdkSessions(projectId, activeCompPath, masterCompPath, fileTre
|
|
|
89414
89551
|
}
|
|
89415
89552
|
|
|
89416
89553
|
// src/hooks/useStudioExternalFileChanges.ts
|
|
89417
|
-
import { useCallback as
|
|
89554
|
+
import { useCallback as useCallback156 } from "react";
|
|
89418
89555
|
|
|
89419
89556
|
// src/utils/externalConflictStorage.ts
|
|
89420
89557
|
var DB_NAME = "hyperframes-studio-external-conflicts";
|
|
@@ -89515,7 +89652,7 @@ async function deleteExternalConflictSnapshot(projectId, filePath) {
|
|
|
89515
89652
|
}
|
|
89516
89653
|
|
|
89517
89654
|
// src/hooks/useExternalFileChangeCoordinator.ts
|
|
89518
|
-
import { useCallback as
|
|
89655
|
+
import { useCallback as useCallback155, useEffect as useEffect133, useRef as useRef163, useState as useState132 } from "react";
|
|
89519
89656
|
function testHotAdapter() {
|
|
89520
89657
|
const value = globalThis.__HF_STUDIO_HOT_TEST_ADAPTER__;
|
|
89521
89658
|
if (!value || typeof value !== "object") return null;
|
|
@@ -89572,15 +89709,15 @@ function useExternalFileChangeCoordinator({
|
|
|
89572
89709
|
onAcceptedPersistedFileChange,
|
|
89573
89710
|
refreshFileTree
|
|
89574
89711
|
}) {
|
|
89575
|
-
const [blocked, setBlockedState] =
|
|
89576
|
-
const generationRef =
|
|
89577
|
-
const mountedRef =
|
|
89578
|
-
const lastEventIdentityRef =
|
|
89579
|
-
const blockedRef =
|
|
89580
|
-
const snapshotWriteTailRef =
|
|
89581
|
-
const drainingRef =
|
|
89582
|
-
const pendingPayloadRef =
|
|
89583
|
-
const setBlocked =
|
|
89712
|
+
const [blocked, setBlockedState] = useState132(null);
|
|
89713
|
+
const generationRef = useRef163(0);
|
|
89714
|
+
const mountedRef = useRef163(true);
|
|
89715
|
+
const lastEventIdentityRef = useRef163(null);
|
|
89716
|
+
const blockedRef = useRef163(null);
|
|
89717
|
+
const snapshotWriteTailRef = useRef163(Promise.resolve());
|
|
89718
|
+
const drainingRef = useRef163(false);
|
|
89719
|
+
const pendingPayloadRef = useRef163(null);
|
|
89720
|
+
const setBlocked = useCallback155((next) => {
|
|
89584
89721
|
const held = blockedRef.current;
|
|
89585
89722
|
const current2 = next && held ? { ...next, payload: mergeFileChangePayloads(held.payload, next.payload) } : next;
|
|
89586
89723
|
blockedRef.current = current2;
|
|
@@ -89639,7 +89776,7 @@ function useExternalFileChangeCoordinator({
|
|
|
89639
89776
|
cancelled = true;
|
|
89640
89777
|
};
|
|
89641
89778
|
}, [loadConflictSnapshot, projectId, recoveryFilePath, setBlocked]);
|
|
89642
|
-
const deliverOwed =
|
|
89779
|
+
const deliverOwed = useCallback155(
|
|
89643
89780
|
(owed, accept = true) => {
|
|
89644
89781
|
const path = readStudioFileChangePath(owed) ?? ".";
|
|
89645
89782
|
const affectsPreview = readFileChangeAffectsPreview(owed);
|
|
@@ -89654,7 +89791,7 @@ function useExternalFileChangeCoordinator({
|
|
|
89654
89791
|
},
|
|
89655
89792
|
[onAcceptedPersistedFileChange, reloadPreview, reloadSdkSession, refreshFileTree]
|
|
89656
89793
|
);
|
|
89657
|
-
const persistSnapshotInOrder =
|
|
89794
|
+
const persistSnapshotInOrder = useCallback155(async (write) => {
|
|
89658
89795
|
const next = snapshotWriteTailRef.current.catch(() => void 0).then(write);
|
|
89659
89796
|
snapshotWriteTailRef.current = next.then(
|
|
89660
89797
|
() => void 0,
|
|
@@ -89662,7 +89799,7 @@ function useExternalFileChangeCoordinator({
|
|
|
89662
89799
|
);
|
|
89663
89800
|
await next;
|
|
89664
89801
|
}, []);
|
|
89665
|
-
const drainOnePending =
|
|
89802
|
+
const drainOnePending = useCallback155(
|
|
89666
89803
|
// fallow-ignore-next-line complexity
|
|
89667
89804
|
async (payload) => {
|
|
89668
89805
|
const path = readStudioFileChangePath(payload);
|
|
@@ -89764,9 +89901,9 @@ function useExternalFileChangeCoordinator({
|
|
|
89764
89901
|
deliverOwed
|
|
89765
89902
|
]
|
|
89766
89903
|
);
|
|
89767
|
-
const drainOnePendingRef =
|
|
89904
|
+
const drainOnePendingRef = useRef163(drainOnePending);
|
|
89768
89905
|
drainOnePendingRef.current = drainOnePending;
|
|
89769
|
-
const startDrainLoop =
|
|
89906
|
+
const startDrainLoop = useCallback155(async () => {
|
|
89770
89907
|
if (drainingRef.current) return;
|
|
89771
89908
|
drainingRef.current = true;
|
|
89772
89909
|
try {
|
|
@@ -89780,7 +89917,7 @@ function useExternalFileChangeCoordinator({
|
|
|
89780
89917
|
drainingRef.current = false;
|
|
89781
89918
|
}
|
|
89782
89919
|
}, []);
|
|
89783
|
-
const processChange =
|
|
89920
|
+
const processChange = useCallback155(
|
|
89784
89921
|
// fallow-ignore-next-line complexity
|
|
89785
89922
|
(payload) => {
|
|
89786
89923
|
const path = readStudioFileChangePath(payload);
|
|
@@ -89824,7 +89961,7 @@ function useExternalFileChangeCoordinator({
|
|
|
89824
89961
|
},
|
|
89825
89962
|
[projectId, pendingTimelineEditPathRef, startDrainLoop, onAcceptedPersistedFileChange]
|
|
89826
89963
|
);
|
|
89827
|
-
const processChangeRef =
|
|
89964
|
+
const processChangeRef = useRef163(processChange);
|
|
89828
89965
|
processChangeRef.current = processChange;
|
|
89829
89966
|
useEffect133(() => {
|
|
89830
89967
|
const handler = (delivery) => {
|
|
@@ -89844,14 +89981,14 @@ function useExternalFileChangeCoordinator({
|
|
|
89844
89981
|
const catchUp = () => processChangeRef.current({ path: "." });
|
|
89845
89982
|
return sseFileChangeChannel(handler, catchUp);
|
|
89846
89983
|
}, []);
|
|
89847
|
-
const retry =
|
|
89984
|
+
const retry = useCallback155(async () => {
|
|
89848
89985
|
const current2 = blockedRef.current;
|
|
89849
89986
|
if (!current2 || current2.status === "conflict" || current2.recovered) return;
|
|
89850
89987
|
resetSaveQueues?.();
|
|
89851
89988
|
lastEventIdentityRef.current = null;
|
|
89852
89989
|
processChange(current2.payload);
|
|
89853
89990
|
}, [processChange, resetSaveQueues]);
|
|
89854
|
-
const useExternalFile =
|
|
89991
|
+
const useExternalFile = useCallback155(
|
|
89855
89992
|
// fallow-ignore-next-line complexity
|
|
89856
89993
|
async () => {
|
|
89857
89994
|
const current2 = blockedRef.current;
|
|
@@ -89877,7 +90014,7 @@ function useExternalFileChangeCoordinator({
|
|
|
89877
90014
|
resetSaveQueues
|
|
89878
90015
|
]
|
|
89879
90016
|
);
|
|
89880
|
-
const keepStudioFile =
|
|
90017
|
+
const keepStudioFile = useCallback155(async () => {
|
|
89881
90018
|
const current2 = blockedRef.current;
|
|
89882
90019
|
if (!current2 || !projectId) return;
|
|
89883
90020
|
if (current2.generation !== generationRef.current) return;
|
|
@@ -89951,19 +90088,19 @@ function useStudioExternalFileChanges({
|
|
|
89951
90088
|
const { flushPendingSourceSave, discardPendingSourceSave } = fileManager;
|
|
89952
90089
|
const { drainPendingDomEditSaves, resetDomEditSaveQueueBreaker } = previewPersistence;
|
|
89953
90090
|
const bumpThumbnailRevisions = usePlayerStore((state) => state.bumpThumbnailRevisions);
|
|
89954
|
-
const onAcceptedPersistedFileChange =
|
|
90091
|
+
const onAcceptedPersistedFileChange = useCallback156(
|
|
89955
90092
|
(_path, affectedCompositions) => {
|
|
89956
90093
|
onOutsideChange?.();
|
|
89957
90094
|
bumpThumbnailRevisions(affectedCompositions);
|
|
89958
90095
|
},
|
|
89959
90096
|
[bumpThumbnailRevisions, onOutsideChange]
|
|
89960
90097
|
);
|
|
89961
|
-
const drainPendingChanges =
|
|
90098
|
+
const drainPendingChanges = useCallback156(async () => {
|
|
89962
90099
|
const source = await flushPendingSourceSave();
|
|
89963
90100
|
if (source.status !== "clean") return source;
|
|
89964
90101
|
return drainPendingDomEditSaves();
|
|
89965
90102
|
}, [drainPendingDomEditSaves, flushPendingSourceSave]);
|
|
89966
|
-
const discardPendingChanges =
|
|
90103
|
+
const discardPendingChanges = useCallback156(() => {
|
|
89967
90104
|
discardPendingSourceSave();
|
|
89968
90105
|
resetDomEditSaveQueueBreaker();
|
|
89969
90106
|
}, [discardPendingSourceSave, resetDomEditSaveQueueBreaker]);
|
|
@@ -89991,7 +90128,7 @@ function useStudioExternalFileChanges({
|
|
|
89991
90128
|
}
|
|
89992
90129
|
|
|
89993
90130
|
// src/hooks/useBlockHandlers.ts
|
|
89994
|
-
import { useCallback as
|
|
90131
|
+
import { useCallback as useCallback157, useMemo as useMemo76, useRef as useRef164, useState as useState133 } from "react";
|
|
89995
90132
|
|
|
89996
90133
|
// src/utils/blockInstaller.ts
|
|
89997
90134
|
function getMaxZIndexFromIframe(iframe) {
|
|
@@ -90184,7 +90321,7 @@ function useBlockHandlers({
|
|
|
90184
90321
|
setRightCollapsed,
|
|
90185
90322
|
setRightPanelTab
|
|
90186
90323
|
}) {
|
|
90187
|
-
const [activeBlockParams, setActiveBlockParams] =
|
|
90324
|
+
const [activeBlockParams, setActiveBlockParams] = useState133(null);
|
|
90188
90325
|
const blockCtx = useMemo76(
|
|
90189
90326
|
() => ({
|
|
90190
90327
|
activeCompPath: blockCtxDeps.activeCompPath,
|
|
@@ -90208,9 +90345,9 @@ function useBlockHandlers({
|
|
|
90208
90345
|
blockCtxDeps.showToast
|
|
90209
90346
|
]
|
|
90210
90347
|
);
|
|
90211
|
-
const installingBlockRef =
|
|
90348
|
+
const installingBlockRef = useRef164(false);
|
|
90212
90349
|
const { showToast, dismissToast } = blockCtxDeps;
|
|
90213
|
-
const runBlockInstall =
|
|
90350
|
+
const runBlockInstall = useCallback157(
|
|
90214
90351
|
async (blockName, install) => {
|
|
90215
90352
|
if (installingBlockRef.current) {
|
|
90216
90353
|
showToast("A block is already installing. One moment\u2026", "info");
|
|
@@ -90227,7 +90364,7 @@ function useBlockHandlers({
|
|
|
90227
90364
|
},
|
|
90228
90365
|
[showToast, dismissToast]
|
|
90229
90366
|
);
|
|
90230
|
-
const handleAddBlock =
|
|
90367
|
+
const handleAddBlock = useCallback157(
|
|
90231
90368
|
(blockName) => {
|
|
90232
90369
|
if (!projectId) return;
|
|
90233
90370
|
void (async () => {
|
|
@@ -90257,7 +90394,7 @@ function useBlockHandlers({
|
|
|
90257
90394
|
},
|
|
90258
90395
|
[projectId, blockCtx, previewIframeRef, runBlockInstall, setRightCollapsed, setRightPanelTab]
|
|
90259
90396
|
);
|
|
90260
|
-
const handleTimelineBlockDrop =
|
|
90397
|
+
const handleTimelineBlockDrop = useCallback157(
|
|
90261
90398
|
(blockName, placement) => {
|
|
90262
90399
|
if (!projectId) return;
|
|
90263
90400
|
void runBlockInstall(
|
|
@@ -90276,7 +90413,7 @@ function useBlockHandlers({
|
|
|
90276
90413
|
},
|
|
90277
90414
|
[projectId, blockCtx, previewIframeRef, runBlockInstall]
|
|
90278
90415
|
);
|
|
90279
|
-
const handleAddMediaOverlay =
|
|
90416
|
+
const handleAddMediaOverlay = useCallback157(
|
|
90280
90417
|
async (blockName, placement) => {
|
|
90281
90418
|
if (!projectId) return;
|
|
90282
90419
|
const { compositionPath, ...timelinePlacement } = placement;
|
|
@@ -90295,7 +90432,7 @@ function useBlockHandlers({
|
|
|
90295
90432
|
},
|
|
90296
90433
|
[projectId, blockCtx, previewIframeRef, runBlockInstall]
|
|
90297
90434
|
);
|
|
90298
|
-
const handlePreviewBlockDrop =
|
|
90435
|
+
const handlePreviewBlockDrop = useCallback157(
|
|
90299
90436
|
(blockName, position) => {
|
|
90300
90437
|
if (!projectId) return;
|
|
90301
90438
|
void runBlockInstall(
|
|
@@ -90325,7 +90462,7 @@ function useBlockHandlers({
|
|
|
90325
90462
|
}
|
|
90326
90463
|
|
|
90327
90464
|
// src/hooks/useAppHotkeys.ts
|
|
90328
|
-
import { useCallback as
|
|
90465
|
+
import { useCallback as useCallback159, useEffect as useEffect134, useRef as useRef165 } from "react";
|
|
90329
90466
|
|
|
90330
90467
|
// src/hooks/appHotkeysDispatch.ts
|
|
90331
90468
|
function handleUndoRedoKey(event, onUndo, onRedo) {
|
|
@@ -90523,7 +90660,7 @@ function dispatchPlainKey(event, _key, cb) {
|
|
|
90523
90660
|
}
|
|
90524
90661
|
|
|
90525
90662
|
// src/hooks/useEditHistoryActions.ts
|
|
90526
|
-
import { useCallback as
|
|
90663
|
+
import { useCallback as useCallback158, useMemo as useMemo77 } from "react";
|
|
90527
90664
|
function useEditHistoryActions({
|
|
90528
90665
|
editHistory,
|
|
90529
90666
|
readOptionalProjectFile,
|
|
@@ -90537,15 +90674,15 @@ function useEditHistoryActions({
|
|
|
90537
90674
|
activeCompPath,
|
|
90538
90675
|
forceReloadSdkSession
|
|
90539
90676
|
}) {
|
|
90540
|
-
const readHistoryFile =
|
|
90677
|
+
const readHistoryFile = useCallback158(
|
|
90541
90678
|
(path) => path === STUDIO_MOTION_PATH ? readOptionalProjectFile(path) : readProjectFile(path),
|
|
90542
90679
|
[readOptionalProjectFile, readProjectFile]
|
|
90543
90680
|
);
|
|
90544
|
-
const serializeHistoryFiles =
|
|
90681
|
+
const serializeHistoryFiles = useCallback158(
|
|
90545
90682
|
(paths, task) => serializeStudioFileMutations(writeProjectFile, paths, task),
|
|
90546
90683
|
[writeProjectFile]
|
|
90547
90684
|
);
|
|
90548
|
-
const apply =
|
|
90685
|
+
const apply = useCallback158(
|
|
90549
90686
|
async (direction) => {
|
|
90550
90687
|
const noun = direction === "undo" ? "Undo" : "Redo";
|
|
90551
90688
|
if (direction === "undo" && cancelNewestStudioWaitingPress()) return;
|
|
@@ -90609,8 +90746,8 @@ function useEditHistoryActions({
|
|
|
90609
90746
|
forceReloadSdkSession
|
|
90610
90747
|
]
|
|
90611
90748
|
);
|
|
90612
|
-
const undo =
|
|
90613
|
-
const redo =
|
|
90749
|
+
const undo = useCallback158(() => whileScriptWrites(() => apply("undo")), [apply]);
|
|
90750
|
+
const redo = useCallback158(() => whileScriptWrites(() => apply("redo")), [apply]);
|
|
90614
90751
|
return useMemo77(() => ({ undo, redo }), [undo, redo]);
|
|
90615
90752
|
}
|
|
90616
90753
|
function fromShown(files, shown3) {
|
|
@@ -90685,7 +90822,7 @@ function useAppHotkeys({
|
|
|
90685
90822
|
forceReloadSdkSession,
|
|
90686
90823
|
readOnlyPreview
|
|
90687
90824
|
}) {
|
|
90688
|
-
const previewHistoryCleanupRef =
|
|
90825
|
+
const previewHistoryCleanupRef = useRef165(null);
|
|
90689
90826
|
const fileHistory = useEditHistoryActions({
|
|
90690
90827
|
editHistory,
|
|
90691
90828
|
readOptionalProjectFile,
|
|
@@ -90699,7 +90836,7 @@ function useAppHotkeys({
|
|
|
90699
90836
|
activeCompPath,
|
|
90700
90837
|
forceReloadSdkSession
|
|
90701
90838
|
});
|
|
90702
|
-
const applyHistory =
|
|
90839
|
+
const applyHistory = useCallback159(
|
|
90703
90840
|
async (direction) => {
|
|
90704
90841
|
const captionState = useCaptionStore.getState();
|
|
90705
90842
|
if (captionState.isEditMode && isCaptionPreviewVisible()) {
|
|
@@ -90715,9 +90852,9 @@ function useAppHotkeys({
|
|
|
90715
90852
|
},
|
|
90716
90853
|
[editHistory.state, fileHistory, showToast]
|
|
90717
90854
|
);
|
|
90718
|
-
const handleUndo =
|
|
90719
|
-
const handleRedo =
|
|
90720
|
-
const cbRef =
|
|
90855
|
+
const handleUndo = useCallback159(() => applyHistory("undo"), [applyHistory]);
|
|
90856
|
+
const handleRedo = useCallback159(() => applyHistory("redo"), [applyHistory]);
|
|
90857
|
+
const cbRef = useRef165(null);
|
|
90721
90858
|
cbRef.current = {
|
|
90722
90859
|
handleTimelineElementsDelete,
|
|
90723
90860
|
handleLinkEdit,
|
|
@@ -90739,7 +90876,7 @@ function useAppHotkeys({
|
|
|
90739
90876
|
showToast,
|
|
90740
90877
|
readOnlyPreview
|
|
90741
90878
|
};
|
|
90742
|
-
const handleAppKeyDown =
|
|
90879
|
+
const handleAppKeyDown = useCallback159((event) => {
|
|
90743
90880
|
const cb = cbRef.current;
|
|
90744
90881
|
const key2 = event.key.toLowerCase();
|
|
90745
90882
|
if (dispatchLinkShortcut(event, cb)) return;
|
|
@@ -90750,7 +90887,7 @@ function useAppHotkeys({
|
|
|
90750
90887
|
window.addEventListener("keydown", handleAppKeyDown, true);
|
|
90751
90888
|
return () => window.removeEventListener("keydown", handleAppKeyDown, true);
|
|
90752
90889
|
}, [handleAppKeyDown]);
|
|
90753
|
-
const syncPreviewHotkeys =
|
|
90890
|
+
const syncPreviewHotkeys = useCallback159(
|
|
90754
90891
|
(iframe) => {
|
|
90755
90892
|
previewHistoryCleanupRef.current?.();
|
|
90756
90893
|
previewHistoryCleanupRef.current = null;
|
|
@@ -90780,7 +90917,7 @@ function useAppHotkeys({
|
|
|
90780
90917
|
}
|
|
90781
90918
|
|
|
90782
90919
|
// src/hooks/useClipboard.ts
|
|
90783
|
-
import { useCallback as
|
|
90920
|
+
import { useCallback as useCallback160, useRef as useRef166 } from "react";
|
|
90784
90921
|
import { EXCLUDED_TAGS, mintHfId, walkCompositionDescendants as walkCompositionDescendants2 } from "@hyperframes/parsers/hf-ids";
|
|
90785
90922
|
|
|
90786
90923
|
// src/utils/clipboardPayload.ts
|
|
@@ -91057,10 +91194,10 @@ function useClipboard({
|
|
|
91057
91194
|
previewIframeRef,
|
|
91058
91195
|
waitForPendingDomEditSaves
|
|
91059
91196
|
}) {
|
|
91060
|
-
const clipboardRef =
|
|
91061
|
-
const projectIdRef =
|
|
91197
|
+
const clipboardRef = useRef166(null);
|
|
91198
|
+
const projectIdRef = useRef166(projectId);
|
|
91062
91199
|
projectIdRef.current = projectId;
|
|
91063
|
-
const readSaved =
|
|
91200
|
+
const readSaved = useCallback160(
|
|
91064
91201
|
async (path) => {
|
|
91065
91202
|
const pid = projectIdRef.current;
|
|
91066
91203
|
if (!pid) throw new Error("No project is open.");
|
|
@@ -91074,7 +91211,7 @@ function useClipboard({
|
|
|
91074
91211
|
},
|
|
91075
91212
|
[waitForPendingDomEditSaves, writeProjectFile]
|
|
91076
91213
|
);
|
|
91077
|
-
const findSelectedClips =
|
|
91214
|
+
const findSelectedClips = useCallback160(() => {
|
|
91078
91215
|
const selected = getSelectedElements();
|
|
91079
91216
|
if (selected.length === 0) return null;
|
|
91080
91217
|
const lives = [];
|
|
@@ -91088,7 +91225,7 @@ function useClipboard({
|
|
|
91088
91225
|
}
|
|
91089
91226
|
return { elements: selected, lives };
|
|
91090
91227
|
}, [activeCompPath, previewIframeRef, showToast]);
|
|
91091
|
-
const readClips =
|
|
91228
|
+
const readClips = useCallback160(
|
|
91092
91229
|
async (targets) => {
|
|
91093
91230
|
const paths = targets.elements.map((el) => el.sourceFile || activeCompPath || "index.html");
|
|
91094
91231
|
const markup = await readSavedMarkup(readSaved, paths, targets.lives);
|
|
@@ -91104,7 +91241,7 @@ function useClipboard({
|
|
|
91104
91241
|
},
|
|
91105
91242
|
[activeCompPath, readSaved]
|
|
91106
91243
|
);
|
|
91107
|
-
const copyTimelineSelection =
|
|
91244
|
+
const copyTimelineSelection = useCallback160(() => {
|
|
91108
91245
|
const targets = findSelectedClips();
|
|
91109
91246
|
if (!targets) return null;
|
|
91110
91247
|
const sourceFile = targets.elements[0]?.sourceFile || activeCompPath || "index.html";
|
|
@@ -91119,7 +91256,7 @@ function useClipboard({
|
|
|
91119
91256
|
};
|
|
91120
91257
|
});
|
|
91121
91258
|
}, [activeCompPath, findSelectedClips, readClips, showToast]);
|
|
91122
|
-
const copyDomSelection =
|
|
91259
|
+
const copyDomSelection = useCallback160(
|
|
91123
91260
|
(domSelection) => {
|
|
91124
91261
|
const live = getSelectedDomElement(previewIframeRef, domSelection, activeCompPath);
|
|
91125
91262
|
if (!live) {
|
|
@@ -91141,7 +91278,7 @@ function useClipboard({
|
|
|
91141
91278
|
},
|
|
91142
91279
|
[activeCompPath, previewIframeRef, readSaved, showToast]
|
|
91143
91280
|
);
|
|
91144
|
-
const copyToClipboard =
|
|
91281
|
+
const copyToClipboard = useCallback160(() => {
|
|
91145
91282
|
const domSelection = domEditSelectionRef.current;
|
|
91146
91283
|
let pending2;
|
|
91147
91284
|
if (usePlayerStore.getState().selectedElementId) pending2 = copyTimelineSelection();
|
|
@@ -91163,8 +91300,8 @@ function useClipboard({
|
|
|
91163
91300
|
});
|
|
91164
91301
|
return own;
|
|
91165
91302
|
}, [copyDomSelection, copyTimelineSelection, domEditSelectionRef, showToast]);
|
|
91166
|
-
const handleCopy2 =
|
|
91167
|
-
const handlePaste2 =
|
|
91303
|
+
const handleCopy2 = useCallback160(() => copyToClipboard() !== null, [copyToClipboard]);
|
|
91304
|
+
const handlePaste2 = useCallback160(
|
|
91168
91305
|
async (options) => {
|
|
91169
91306
|
const payload = await clipboardRef.current;
|
|
91170
91307
|
if (!payload) {
|
|
@@ -91212,7 +91349,7 @@ function useClipboard({
|
|
|
91212
91349
|
},
|
|
91213
91350
|
[activeCompPath, recordEdit, reloadPreview, showToast, writeProjectFile]
|
|
91214
91351
|
);
|
|
91215
|
-
const handleDuplicate =
|
|
91352
|
+
const handleDuplicate = useCallback160(
|
|
91216
91353
|
async (options) => {
|
|
91217
91354
|
const targets = findSelectedClips();
|
|
91218
91355
|
if (!targets) return false;
|
|
@@ -91264,7 +91401,7 @@ function useClipboard({
|
|
|
91264
91401
|
writeProjectFile
|
|
91265
91402
|
]
|
|
91266
91403
|
);
|
|
91267
|
-
const handleCut =
|
|
91404
|
+
const handleCut = useCallback160(async () => {
|
|
91268
91405
|
const selected = getSelectedElements();
|
|
91269
91406
|
const domSelection = domEditSelectionRef.current;
|
|
91270
91407
|
const copied = copyToClipboard();
|
|
@@ -91284,12 +91421,12 @@ function useClipboard({
|
|
|
91284
91421
|
handleTimelineElementsDelete,
|
|
91285
91422
|
handleDomEditElementDelete
|
|
91286
91423
|
]);
|
|
91287
|
-
const canPaste =
|
|
91424
|
+
const canPaste = useCallback160(() => clipboardRef.current !== null, []);
|
|
91288
91425
|
return { handleCopy: handleCopy2, handlePaste: handlePaste2, handleCut, handleDuplicate, canPaste };
|
|
91289
91426
|
}
|
|
91290
91427
|
|
|
91291
91428
|
// src/hooks/useCaptionDetection.ts
|
|
91292
|
-
import { useEffect as useEffect135, useRef as
|
|
91429
|
+
import { useEffect as useEffect135, useRef as useRef167 } from "react";
|
|
91293
91430
|
|
|
91294
91431
|
// src/captions/parser.ts
|
|
91295
91432
|
import {
|
|
@@ -91584,7 +91721,7 @@ function useCaptionDetection({
|
|
|
91584
91721
|
setRightCollapsed
|
|
91585
91722
|
}) {
|
|
91586
91723
|
const livePreviewIframe = useLivePreviewIframe();
|
|
91587
|
-
const prevCompPathRef =
|
|
91724
|
+
const prevCompPathRef = useRef167(activeCompPath);
|
|
91588
91725
|
useEffect135(() => {
|
|
91589
91726
|
if (prevCompPathRef.current !== activeCompPath) {
|
|
91590
91727
|
prevCompPathRef.current = activeCompPath;
|
|
@@ -91685,12 +91822,12 @@ function useCaptionDetection({
|
|
|
91685
91822
|
}
|
|
91686
91823
|
|
|
91687
91824
|
// src/hooks/useConsoleErrorCapture.ts
|
|
91688
|
-
import { useCallback as
|
|
91825
|
+
import { useCallback as useCallback161, useEffect as useEffect136, useRef as useRef168, useState as useState134 } from "react";
|
|
91689
91826
|
import { STUDIO_PREVIEW_ERRORS } from "@hyperframes/core/studio-preview-mark";
|
|
91690
91827
|
function useConsoleErrorCapture(previewIframe) {
|
|
91691
|
-
const [consoleErrors, setConsoleErrors] =
|
|
91692
|
-
const consoleErrorsRef =
|
|
91693
|
-
const resetErrors =
|
|
91828
|
+
const [consoleErrors, setConsoleErrors] = useState134(null);
|
|
91829
|
+
const consoleErrorsRef = useRef168([]);
|
|
91830
|
+
const resetErrors = useCallback161(() => {
|
|
91694
91831
|
consoleErrorsRef.current = [];
|
|
91695
91832
|
setConsoleErrors(null);
|
|
91696
91833
|
}, []);
|
|
@@ -91754,34 +91891,34 @@ function useConsoleErrorCapture(previewIframe) {
|
|
|
91754
91891
|
}
|
|
91755
91892
|
|
|
91756
91893
|
// src/hooks/useFrameCapture.ts
|
|
91757
|
-
import { useMemo as useMemo78, useState as
|
|
91894
|
+
import { useMemo as useMemo78, useState as useState135, useCallback as useCallback162, useRef as useRef169 } from "react";
|
|
91758
91895
|
function useFrameCapture({
|
|
91759
91896
|
projectId,
|
|
91760
91897
|
activeCompPath,
|
|
91761
91898
|
showToast,
|
|
91762
91899
|
waitForPendingDomEditSaves
|
|
91763
91900
|
}) {
|
|
91764
|
-
const [captureFrameTime, setCaptureFrameTime] =
|
|
91901
|
+
const [captureFrameTime, setCaptureFrameTime] = useState135(
|
|
91765
91902
|
() => usePlayerStore.getState().currentTime
|
|
91766
91903
|
);
|
|
91767
|
-
const [capturing, setCapturing] =
|
|
91768
|
-
const capturingRef =
|
|
91769
|
-
const livePlayheadRef =
|
|
91904
|
+
const [capturing, setCapturing] = useState135(false);
|
|
91905
|
+
const capturingRef = useRef169(false);
|
|
91906
|
+
const livePlayheadRef = useRef169(captureFrameTime);
|
|
91770
91907
|
useMountEffect(
|
|
91771
91908
|
() => liveTime.subscribe((time) => {
|
|
91772
91909
|
livePlayheadRef.current = time;
|
|
91773
91910
|
})
|
|
91774
91911
|
);
|
|
91775
|
-
const playheadTime =
|
|
91912
|
+
const playheadTime = useCallback162(() => {
|
|
91776
91913
|
const { isPlaying, currentTime } = usePlayerStore.getState();
|
|
91777
91914
|
return isPlaying ? livePlayheadRef.current : currentTime;
|
|
91778
91915
|
}, []);
|
|
91779
|
-
const [captureStamp, setCaptureStamp] =
|
|
91780
|
-
const refreshCaptureFrameTime =
|
|
91916
|
+
const [captureStamp, setCaptureStamp] = useState135(Date.now);
|
|
91917
|
+
const refreshCaptureFrameTime = useCallback162(() => {
|
|
91781
91918
|
setCaptureFrameTime(playheadTime());
|
|
91782
91919
|
setCaptureStamp(Date.now());
|
|
91783
91920
|
}, [playheadTime]);
|
|
91784
|
-
const handleCaptureFrameClick =
|
|
91921
|
+
const handleCaptureFrameClick = useCallback162(
|
|
91785
91922
|
async (event) => {
|
|
91786
91923
|
if (!projectId) return;
|
|
91787
91924
|
event.preventDefault();
|
|
@@ -91865,7 +92002,7 @@ function useFrameCapture({
|
|
|
91865
92002
|
}
|
|
91866
92003
|
|
|
91867
92004
|
// src/hooks/useLintModal.ts
|
|
91868
|
-
import { useState as
|
|
92005
|
+
import { useState as useState136, useCallback as useCallback163, useEffect as useEffect137, useRef as useRef170, useMemo as useMemo79 } from "react";
|
|
91869
92006
|
function parseFinding(f) {
|
|
91870
92007
|
return {
|
|
91871
92008
|
severity: f.severity === "error" ? "error" : "warning",
|
|
@@ -91881,11 +92018,11 @@ async function fetchLintFindings(projectId) {
|
|
|
91881
92018
|
return (data.findings ?? []).map(parseFinding);
|
|
91882
92019
|
}
|
|
91883
92020
|
function useLintModal(projectId, refreshKey) {
|
|
91884
|
-
const [lintModal, setLintModal] =
|
|
91885
|
-
const [linting, setLinting] =
|
|
91886
|
-
const [backgroundFindings, setBackgroundFindings] =
|
|
91887
|
-
const autoLintRanRef =
|
|
91888
|
-
const runBackgroundLint =
|
|
92021
|
+
const [lintModal, setLintModal] = useState136(null);
|
|
92022
|
+
const [linting, setLinting] = useState136(false);
|
|
92023
|
+
const [backgroundFindings, setBackgroundFindings] = useState136([]);
|
|
92024
|
+
const autoLintRanRef = useRef170(false);
|
|
92025
|
+
const runBackgroundLint = useCallback163(async () => {
|
|
91889
92026
|
if (!projectId) return;
|
|
91890
92027
|
if (!isPreviewBooted(projectId) && !await whenPreviewBooted(projectId)) return;
|
|
91891
92028
|
try {
|
|
@@ -91893,7 +92030,7 @@ function useLintModal(projectId, refreshKey) {
|
|
|
91893
92030
|
} catch {
|
|
91894
92031
|
}
|
|
91895
92032
|
}, [projectId]);
|
|
91896
|
-
const handleLint =
|
|
92033
|
+
const handleLint = useCallback163(async () => {
|
|
91897
92034
|
if (!projectId) return;
|
|
91898
92035
|
setLinting(true);
|
|
91899
92036
|
try {
|
|
@@ -91907,7 +92044,7 @@ function useLintModal(projectId, refreshKey) {
|
|
|
91907
92044
|
setLinting(false);
|
|
91908
92045
|
}
|
|
91909
92046
|
}, [projectId]);
|
|
91910
|
-
const prevProjectIdRef =
|
|
92047
|
+
const prevProjectIdRef = useRef170(projectId);
|
|
91911
92048
|
useEffect137(() => {
|
|
91912
92049
|
if (projectId !== prevProjectIdRef.current) {
|
|
91913
92050
|
autoLintRanRef.current = false;
|
|
@@ -91922,8 +92059,8 @@ function useLintModal(projectId, refreshKey) {
|
|
|
91922
92059
|
const timer = setTimeout(() => void runBackgroundLint(), 1e3);
|
|
91923
92060
|
return () => clearTimeout(timer);
|
|
91924
92061
|
}, [projectId, refreshKey, runBackgroundLint]);
|
|
91925
|
-
const closeLintModal =
|
|
91926
|
-
const groupFindings =
|
|
92062
|
+
const closeLintModal = useCallback163(() => setLintModal(null), []);
|
|
92063
|
+
const groupFindings = useCallback163(
|
|
91927
92064
|
(keyFn) => {
|
|
91928
92065
|
const map = /* @__PURE__ */ new Map();
|
|
91929
92066
|
for (const f of backgroundFindings) {
|
|
@@ -91959,64 +92096,6 @@ function useLintModal(projectId, refreshKey) {
|
|
|
91959
92096
|
};
|
|
91960
92097
|
}
|
|
91961
92098
|
|
|
91962
|
-
// src/hooks/useToast.ts
|
|
91963
|
-
import { useState as useState136, useCallback as useCallback163, useRef as useRef170 } from "react";
|
|
91964
|
-
var AUTO_DISMISS_MS2 = 4e3;
|
|
91965
|
-
var EXIT_MS2 = 160;
|
|
91966
|
-
var MAX_TOASTS = 3;
|
|
91967
|
-
var nextToastId = 1;
|
|
91968
|
-
function useToast() {
|
|
91969
|
-
const [toasts, setToasts] = useState136([]);
|
|
91970
|
-
const timersRef = useRef170(/* @__PURE__ */ new Map());
|
|
91971
|
-
const clearTimer = useCallback163((id) => {
|
|
91972
|
-
const timer = timersRef.current.get(id);
|
|
91973
|
-
if (timer) {
|
|
91974
|
-
clearTimeout(timer);
|
|
91975
|
-
timersRef.current.delete(id);
|
|
91976
|
-
}
|
|
91977
|
-
}, []);
|
|
91978
|
-
const removeToast = useCallback163(
|
|
91979
|
-
(id) => {
|
|
91980
|
-
clearTimer(id);
|
|
91981
|
-
setToasts((prev) => prev.filter((t2) => t2.id !== id));
|
|
91982
|
-
},
|
|
91983
|
-
[clearTimer]
|
|
91984
|
-
);
|
|
91985
|
-
const dismissToast = useCallback163(
|
|
91986
|
-
(id) => {
|
|
91987
|
-
clearTimer(id);
|
|
91988
|
-
setToasts((prev) => prev.map((t2) => t2.id === id ? { ...t2, leaving: true } : t2));
|
|
91989
|
-
const timer = setTimeout(() => removeToast(id), EXIT_MS2);
|
|
91990
|
-
timersRef.current.set(id, timer);
|
|
91991
|
-
},
|
|
91992
|
-
[clearTimer, removeToast]
|
|
91993
|
-
);
|
|
91994
|
-
const showToast = useCallback163(
|
|
91995
|
-
(message, tone = "error") => {
|
|
91996
|
-
const id = nextToastId++;
|
|
91997
|
-
setToasts((prev) => {
|
|
91998
|
-
const next = [...prev, { id, message, tone }];
|
|
91999
|
-
while (next.length > MAX_TOASTS) {
|
|
92000
|
-
const dropped2 = next.shift();
|
|
92001
|
-
if (dropped2) clearTimer(dropped2.id);
|
|
92002
|
-
}
|
|
92003
|
-
return next;
|
|
92004
|
-
});
|
|
92005
|
-
if (tone !== "error") {
|
|
92006
|
-
const timer = setTimeout(() => dismissToast(id), AUTO_DISMISS_MS2);
|
|
92007
|
-
timersRef.current.set(id, timer);
|
|
92008
|
-
}
|
|
92009
|
-
return id;
|
|
92010
|
-
},
|
|
92011
|
-
[clearTimer, dismissToast]
|
|
92012
|
-
);
|
|
92013
|
-
useMountEffect(() => () => {
|
|
92014
|
-
for (const timer of timersRef.current.values()) clearTimeout(timer);
|
|
92015
|
-
timersRef.current.clear();
|
|
92016
|
-
});
|
|
92017
|
-
return { toasts, showToast, dismissToast };
|
|
92018
|
-
}
|
|
92019
|
-
|
|
92020
92099
|
// src/hooks/useStudioUrlState.ts
|
|
92021
92100
|
import { useCallback as useCallback164, useEffect as useEffect138, useRef as useRef171, useState as useState137 } from "react";
|
|
92022
92101
|
|
|
@@ -104283,7 +104362,9 @@ function ownSourceFile(live, iframe) {
|
|
|
104283
104362
|
return getSourceFileForElement(live, previewed).sourceFile;
|
|
104284
104363
|
}
|
|
104285
104364
|
function patchByHfId(files, hfId, ownFile, op) {
|
|
104286
|
-
const matches = Object.keys(files).filter(
|
|
104365
|
+
const matches = Object.keys(files).filter(
|
|
104366
|
+
(file) => readTagSnippetByTarget(files[file] ?? "", { hfId }) !== void 0
|
|
104367
|
+
);
|
|
104287
104368
|
const path = matches.includes(ownFile) ? ownFile : matches.length === 1 ? matches[0] : void 0;
|
|
104288
104369
|
const before = path ? files[path] : void 0;
|
|
104289
104370
|
return path && before ? { path, before, after: applyPatchByTarget(before, { hfId }, op) } : null;
|