@hyperframes/studio 0.9.64 → 0.9.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/hyperframes-player-VGx6ow_e.js +573 -0
- package/dist/assets/{index-CVmmHGol.js → index-B8Xt_Oyw.js} +190 -186
- package/dist/assets/{index-DN167Uqf.js → index-BH18TdX9.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-C8rhpGPx.js → pausedVideoDecoder-Bx3fGNkU.js} +1 -1
- package/dist/{chunk-VDDEXNVX.js → chunk-ESTBKVCB.js} +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.html +1 -1
- package/dist/index.js +1580 -882
- package/dist/player.js +1 -1
- package/package.json +8 -8
- package/src/captions/components/CaptionOverlay.sealed.test.ts +2 -25
- package/src/captions/hooks/useCaptionSync.ts +4 -1
- package/src/components/editor/LayersPanel.opaque.test.ts +4 -29
- package/src/components/editor/MotionPathOverlay.sealed.test.tsx +85 -0
- package/src/components/editor/MotionPathOverlay.tsx +26 -12
- package/src/components/editor/domEditOverlayCrop.ts +78 -15
- package/src/components/editor/domEditOverlayCropFrameLift.test.ts +64 -0
- package/src/components/editor/domEditOverlayStartGesture.ts +0 -14
- package/src/components/editor/gestureUndoRevert.ts +3 -6
- package/src/components/editor/gsapMoveSealedPreview.test.ts +247 -0
- package/src/components/editor/manualEditsSnapshot.ts +2 -0
- package/src/components/editor/manualOffsetDrag.ts +13 -18
- package/src/components/editor/plainTranslate.test.ts +22 -1
- package/src/components/editor/plainTranslate.ts +8 -6
- package/src/components/editor/previewDrafts.test.ts +13 -39
- package/src/components/editor/previewDrafts.ts +4 -0
- package/src/components/editor/previewGestureStartRead.test.ts +59 -32
- package/src/components/editor/previewGestureStartRead.ts +9 -0
- package/src/components/editor/previewLayers.test.ts +3 -20
- package/src/components/editor/previewOverlayRects.test.ts +3 -20
- package/src/components/editor/previewPointerTargets.test.ts +3 -20
- package/src/components/editor/previewSelection.test.ts +51 -35
- package/src/components/editor/previewSelection.ts +18 -0
- package/src/components/editor/useColorGradingController.sealed.test.ts +5 -30
- package/src/components/editor/useMotionPathData.reply.test.ts +40 -0
- package/src/components/editor/useMotionPathData.sealed.test.ts +57 -0
- package/src/components/editor/useMotionPathData.test.tsx +1 -1
- package/src/components/editor/useMotionPathData.ts +83 -33
- package/src/components/nle/CompositionBreadcrumb.tsx +2 -5
- package/src/components/nle/NLEContext.drillDown.test.ts +85 -0
- package/src/components/nle/NLEContext.tsx +21 -23
- package/src/components/nle/NLEPreview.test.ts +18 -3
- package/src/components/nle/NLEPreview.tsx +10 -1
- package/src/components/nle/audioSealedPreview.test.ts +5 -32
- package/src/components/panels/motionBlurPanelModel.sealed.test.ts +30 -0
- package/src/components/panels/motionBlurPanelModel.ts +37 -7
- package/src/hooks/appHotkeysDispatch.ts +38 -1
- package/src/hooks/domEditCommits.sealed.test.ts +191 -0
- package/src/hooks/domStyleCommit.ts +18 -7
- package/src/hooks/draggedGsapPosition.ts +20 -0
- package/src/hooks/gsapEditOutcome.ts +3 -0
- package/src/hooks/gsapFrameSnapshot.test.ts +113 -0
- package/src/hooks/gsapFrameSnapshot.ts +246 -0
- package/src/hooks/gsapParsedTween.ts +16 -9
- package/src/hooks/gsapResizeIntercept.ts +7 -2
- package/src/hooks/gsapRuntimeBridge.ts +4 -0
- package/src/hooks/gsapRuntimeKeyframes.ts +23 -15
- package/src/hooks/gsapShared.ts +4 -0
- package/src/hooks/gsapSnapshotReply.ts +105 -0
- package/src/hooks/useAppHotkeys.previewForwarding.test.tsx +134 -0
- package/src/hooks/useAppHotkeys.ts +36 -1
- package/src/hooks/useDomEditAttributeCommits.ts +43 -19
- package/src/hooks/useDomEditCommits.test.tsx +1 -1
- package/src/hooks/useDomEditPreviewSync.test.ts +36 -1
- package/src/hooks/useDomEditPreviewSync.ts +3 -3
- package/src/hooks/useEditorSave.ts +2 -1
- package/src/hooks/useEnableKeyframes.sealed.test.ts +70 -0
- package/src/hooks/useEnableKeyframes.ts +9 -2
- package/src/hooks/useGsapTweenCache.ts +9 -3
- package/src/hooks/usePreviewPersistence.ts +18 -11
- package/src/hooks/useSdkSession.lifecycle.test.tsx +1 -0
- package/src/hooks/useSdkSession.ts +2 -0
- package/src/hooks/useSlideshowTabState.test.ts +47 -3
- package/src/hooks/useSlideshowTabState.ts +32 -16
- package/src/player/hooks/timelinePlayerTestHarness.ts +2 -1
- package/src/player/hooks/usePlaybackKeyboard.ts +1 -1
- package/src/player/hooks/useTimelineSyncCallbacks.sealed.test.ts +2 -29
- package/src/player/lib/previewChannel.test.ts +10 -0
- package/src/player/lib/previewChannel.ts +9 -0
- package/src/player/lib/previewElements.test.ts +34 -1
- package/src/player/lib/previewElements.ts +101 -18
- package/src/player/lib/sealedPreviewFrame.test-helpers.ts +38 -0
- package/src/player/lib/timelineIframeHelpers.ts +1 -1
- package/src/telemetry/client.ts +4 -2
- package/src/telemetry/eventShape.test.ts +189 -0
- package/src/telemetry/eventShape.ts +192 -0
- package/src/utils/blockInstaller.test.ts +82 -48
- package/src/utils/blockInstaller.ts +6 -14
- package/src/utils/domEditSaveQueue.test.ts +12 -2
- package/src/utils/domEditSaveQueue.ts +4 -4
- package/src/utils/previewCompositionSize.test.ts +61 -0
- package/src/utils/previewCompositionSize.ts +21 -1
- package/src/utils/sdkEditTransaction.ts +6 -2
- package/src/utils/sdkResolverShadow.ts +16 -15
- package/src/utils/studioSaveDiagnostics.test.ts +21 -3
- package/src/utils/studioSaveDiagnostics.ts +71 -6
- package/src/utils/studioTelemetry.ts +6 -1
- package/dist/assets/hyperframes-player-mSF_GvRs.js +0 -573
- package/src/components/editor/motionPathHome.ts +0 -75
package/dist/index.js
CHANGED
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
whileScriptWrites,
|
|
93
93
|
writeStudioUiPreferences,
|
|
94
94
|
zoomToSelectedClips
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-ESTBKVCB.js";
|
|
96
96
|
import {
|
|
97
97
|
Button,
|
|
98
98
|
ContextMenu,
|
|
@@ -285,8 +285,8 @@ function findClash(keys) {
|
|
|
285
285
|
function studioKeyClash(action, text3, keys = current) {
|
|
286
286
|
const wanted = parseCombo(text3);
|
|
287
287
|
const holds = (other) => {
|
|
288
|
-
const
|
|
289
|
-
return !!
|
|
288
|
+
const held2 = parseCombo(keys[other]);
|
|
289
|
+
return !!held2 && !!wanted && comboClashKey(held2) === comboClashKey(wanted);
|
|
290
290
|
};
|
|
291
291
|
const keyed = Object.keys(keys);
|
|
292
292
|
return keyed.find((o) => o !== action && !sharedByDesign(action, o) && holds(o)) ?? null;
|
|
@@ -419,7 +419,7 @@ function buildShortcutSections(keys) {
|
|
|
419
419
|
var DEFAULT_SHORTCUT_SECTIONS = buildShortcutSections(DEFAULT_STUDIO_KEYS);
|
|
420
420
|
|
|
421
421
|
// src/components/nle/PreviewPane.tsx
|
|
422
|
-
import { useCallback as useCallback52, useRef as useRef61, useSyncExternalStore as
|
|
422
|
+
import { useCallback as useCallback52, useRef as useRef61, useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
423
423
|
|
|
424
424
|
// src/player/components/PlayerControls.tsx
|
|
425
425
|
import { useRef as useRef4, useEffect as useEffect4, memo as memo5 } from "react";
|
|
@@ -705,6 +705,180 @@ function tabIdProperty() {
|
|
|
705
705
|
return resolveTabId();
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
+
// src/telemetry/eventShape.ts
|
|
709
|
+
import { redactTelemetryString } from "@hyperframes/core/telemetry-redaction";
|
|
710
|
+
|
|
711
|
+
// src/hooks/sdkSelfWriteRegistry.ts
|
|
712
|
+
var SELF_WRITE_TTL_MS = 2e3;
|
|
713
|
+
var registry = /* @__PURE__ */ new Map();
|
|
714
|
+
function hashContent(content) {
|
|
715
|
+
let h = 2166136261;
|
|
716
|
+
for (let i = 0; i < content.length; i++) {
|
|
717
|
+
h ^= content.charCodeAt(i);
|
|
718
|
+
h = Math.imul(h, 16777619);
|
|
719
|
+
}
|
|
720
|
+
return (h >>> 0).toString(16);
|
|
721
|
+
}
|
|
722
|
+
function prune(entries, now2) {
|
|
723
|
+
return entries.filter((e) => now2 - e.at < SELF_WRITE_TTL_MS);
|
|
724
|
+
}
|
|
725
|
+
function markSelfWrite(path, content, now2 = Date.now()) {
|
|
726
|
+
const next = prune(registry.get(path) ?? [], now2);
|
|
727
|
+
next.push({ hash: hashContent(content), at: now2 });
|
|
728
|
+
registry.set(path, next);
|
|
729
|
+
}
|
|
730
|
+
function isSelfWriteEcho(path, content, now2 = Date.now()) {
|
|
731
|
+
const entries = prune(registry.get(path) ?? [], now2);
|
|
732
|
+
const hash = hashContent(content);
|
|
733
|
+
const idx = entries.findIndex((e) => e.hash === hash);
|
|
734
|
+
if (idx === -1) {
|
|
735
|
+
registry.set(path, entries);
|
|
736
|
+
return false;
|
|
737
|
+
}
|
|
738
|
+
entries.splice(idx, 1);
|
|
739
|
+
registry.set(path, entries);
|
|
740
|
+
return true;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// src/telemetry/eventShape.ts
|
|
744
|
+
var PATH_KEYS = /* @__PURE__ */ new Set([
|
|
745
|
+
"file_path",
|
|
746
|
+
"target_source_file",
|
|
747
|
+
"source_file",
|
|
748
|
+
"path",
|
|
749
|
+
"composition",
|
|
750
|
+
"render_composition"
|
|
751
|
+
]);
|
|
752
|
+
var SELECTOR_KEYS = /* @__PURE__ */ new Set(["target_selector", "selector", "target_id", "animationId"]);
|
|
753
|
+
var MESSAGE_KEYS = /* @__PURE__ */ new Set(["error_message", "error", "render_error", "render_stage"]);
|
|
754
|
+
var KEPT_AS_TYPED = {
|
|
755
|
+
studio_feedback: /* @__PURE__ */ new Set(["comment"])
|
|
756
|
+
};
|
|
757
|
+
var SALT_KEY = "hyperframes-studio:telemetrySalt";
|
|
758
|
+
var sessionSalt;
|
|
759
|
+
function newSalt() {
|
|
760
|
+
const bytes = new Uint8Array(16);
|
|
761
|
+
crypto.getRandomValues(bytes);
|
|
762
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
763
|
+
}
|
|
764
|
+
function installSalt() {
|
|
765
|
+
try {
|
|
766
|
+
const saved2 = localStorage.getItem(SALT_KEY);
|
|
767
|
+
if (saved2 && /^[0-9a-f]{32}$/.test(saved2)) return saved2;
|
|
768
|
+
const salt = newSalt();
|
|
769
|
+
localStorage.setItem(SALT_KEY, salt);
|
|
770
|
+
return salt;
|
|
771
|
+
} catch {
|
|
772
|
+
sessionSalt ??= newSalt();
|
|
773
|
+
return sessionSalt;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
var hashOf = (value) => hashContent(`${installSalt()}\0${value}`).padStart(8, "0");
|
|
777
|
+
var KINDS = {
|
|
778
|
+
html: "composition",
|
|
779
|
+
htm: "composition",
|
|
780
|
+
js: "script",
|
|
781
|
+
mjs: "script",
|
|
782
|
+
cjs: "script",
|
|
783
|
+
ts: "script",
|
|
784
|
+
tsx: "script",
|
|
785
|
+
jsx: "script",
|
|
786
|
+
css: "style",
|
|
787
|
+
scss: "style",
|
|
788
|
+
less: "style"
|
|
789
|
+
};
|
|
790
|
+
function pathFacts(key, value) {
|
|
791
|
+
const paths = value.split(",").filter((p) => p.trim().length > 0);
|
|
792
|
+
const first = paths[0] ?? value;
|
|
793
|
+
const segments = first.split(/[\\/]/).filter(Boolean);
|
|
794
|
+
const name = segments.at(-1) ?? "";
|
|
795
|
+
const dot = name.lastIndexOf(".");
|
|
796
|
+
const raw = dot > 0 ? name.slice(dot + 1).toLowerCase() : "";
|
|
797
|
+
const ext2 = /^[a-z0-9]{1,8}$/.test(raw) ? raw : "none";
|
|
798
|
+
const kind = ext2 === "none" ? "other" : KINDS[ext2] ?? "asset";
|
|
799
|
+
return {
|
|
800
|
+
[`${key}_ext`]: ext2,
|
|
801
|
+
[`${key}_kind`]: kind,
|
|
802
|
+
[`${key}_depth`]: Math.max(segments.length - 1, 0),
|
|
803
|
+
[`${key}_hash`]: hashOf(first),
|
|
804
|
+
...paths.length > 1 ? { [`${key}_count`]: paths.length } : {}
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
function selectorFacts(key, value) {
|
|
808
|
+
const s = value.trim();
|
|
809
|
+
const kind = key === "target_id" ? "id" : s.startsWith("#") ? "id" : s.startsWith(".") ? "class" : s.startsWith("[") ? "attribute" : "other";
|
|
810
|
+
return { [`${key}_kind`]: kind, [`${key}_hash`]: hashOf(s) };
|
|
811
|
+
}
|
|
812
|
+
function messageFacts(key, value) {
|
|
813
|
+
const line = redactTelemetryString(value.split("\n", 1)[0] ?? "", Number.MAX_SAFE_INTEGER).replace(/\b(?:https?|blob|data|file|[a-z-]+-extension):\S*/gi, "<url>").replace(/(^|[\s(])[#.][A-Za-z_][\w-]*/g, "$1<sel>").replace(/(["'`]).*?\1/g, "?").replace(/\d+/g, "#");
|
|
814
|
+
const status = /(?:\(|HTTP |status |failed: )([1-5]\d\d)\b/.exec(value)?.[1];
|
|
815
|
+
return {
|
|
816
|
+
[`${key}_shape`]: hashOf(line),
|
|
817
|
+
...status ? { [`${key}_status`]: Number(status) } : {}
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
function bundleFile(url) {
|
|
821
|
+
if (!/^https?:\/\//i.test(url)) return null;
|
|
822
|
+
try {
|
|
823
|
+
const at = new URL(url);
|
|
824
|
+
if (at.origin !== location.origin || at.pathname.startsWith("/api/")) return null;
|
|
825
|
+
const name = at.pathname.split("/").pop() ?? "";
|
|
826
|
+
return /^[\w.-]+\.(?:m?js|tsx?|jsx?)$/.test(name) ? name : null;
|
|
827
|
+
} catch {
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
var V8_FRAME = /^\s*at (?:(.+?) \()?(.+?):(\d+):(\d+)\)?\s*$/;
|
|
832
|
+
var GECKO_FRAME = /^(.*?)@(.+?):(\d+):(\d+)\s*$/;
|
|
833
|
+
function shapedFrames(stack) {
|
|
834
|
+
const frames = [];
|
|
835
|
+
for (const line of stack.split("\n")) {
|
|
836
|
+
const m = V8_FRAME.exec(line) ?? GECKO_FRAME.exec(line);
|
|
837
|
+
if (!m) continue;
|
|
838
|
+
const file = bundleFile(m[2] ?? "");
|
|
839
|
+
frames.push(file ? `${m[1]?.trim() || "<anonymous>"}@${file}:${m[3]}:${m[4]}` : "?");
|
|
840
|
+
if (frames.length === 20) break;
|
|
841
|
+
}
|
|
842
|
+
return frames.join("\n");
|
|
843
|
+
}
|
|
844
|
+
var componentNames = (stack) => [...stack.matchAll(/^\s*(?:at|in)\s+([A-Za-z_$][\w$.]*)/gm)].slice(0, 30).map((m) => m[1]).join("\n");
|
|
845
|
+
var ATTRIBUTE_SELECTOR = /\[[\w:-]+(?:[~|^$*]?=[^\]]*)?\]/;
|
|
846
|
+
var ID_OR_CLASS = /^\s*[#.][A-Za-z_-][\w-]*/;
|
|
847
|
+
var HEX_COLOUR = /^#[0-9a-f]{3,8}$/i;
|
|
848
|
+
function readsAsPathOrSelector(value) {
|
|
849
|
+
if (redactTelemetryString(value, Number.MAX_SAFE_INTEGER) !== value) return true;
|
|
850
|
+
return ATTRIBUTE_SELECTOR.test(value) || ID_OR_CLASS.test(value) && !HEX_COLOUR.test(value.trim());
|
|
851
|
+
}
|
|
852
|
+
var single = (shape) => (key, value) => {
|
|
853
|
+
const shaped = shape(value);
|
|
854
|
+
return shaped === null ? null : { [key]: shaped };
|
|
855
|
+
};
|
|
856
|
+
var otherValue = (key, value) => readsAsPathOrSelector(value) ? null : { [key]: value };
|
|
857
|
+
var SHAPERS = {
|
|
858
|
+
...Object.fromEntries([...MESSAGE_KEYS].map((key) => [key, messageFacts])),
|
|
859
|
+
...Object.fromEntries([...PATH_KEYS].map((key) => [key, pathFacts])),
|
|
860
|
+
...Object.fromEntries([...SELECTOR_KEYS].map((key) => [key, selectorFacts])),
|
|
861
|
+
stack_trace: single(shapedFrames),
|
|
862
|
+
component_stack: single(componentNames),
|
|
863
|
+
filename: single(bundleFile)
|
|
864
|
+
};
|
|
865
|
+
function shapeEventProperties(event, properties) {
|
|
866
|
+
const kept = KEPT_AS_TYPED[event];
|
|
867
|
+
const out = {};
|
|
868
|
+
const dropped2 = [];
|
|
869
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
870
|
+
if (typeof value !== "string" || value === "" || kept?.has(key)) {
|
|
871
|
+
out[key] = value;
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
874
|
+
const facts = (SHAPERS[key] ?? otherValue)(key, value);
|
|
875
|
+
if (facts) Object.assign(out, facts);
|
|
876
|
+
else dropped2.push(key);
|
|
877
|
+
}
|
|
878
|
+
if (dropped2.length > 0) out.dropped_fields = dropped2.join(",");
|
|
879
|
+
return out;
|
|
880
|
+
}
|
|
881
|
+
|
|
708
882
|
// src/utils/studioTelemetry.ts
|
|
709
883
|
var POSTHOG_API_KEY2 = "phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx";
|
|
710
884
|
var POSTHOG_HOST = "https://us.i.posthog.com";
|
|
@@ -778,7 +952,11 @@ function trackStudioEvent(event, properties = {}) {
|
|
|
778
952
|
// Canary assignments on every event, matching the CLI and the newer
|
|
779
953
|
// studio client — "every telemetry event carries the assignment" has to
|
|
780
954
|
// include this path or a cohort breakdown silently omits `studio:*`.
|
|
781
|
-
properties: {
|
|
955
|
+
properties: {
|
|
956
|
+
...canaryEventProperties(),
|
|
957
|
+
...shapeEventProperties(`studio:${event}`, properties),
|
|
958
|
+
...getSessionProperties()
|
|
959
|
+
},
|
|
782
960
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
783
961
|
});
|
|
784
962
|
if (!flushTimer) {
|
|
@@ -1680,9 +1858,9 @@ function subscribeTimelineMotion(listener2) {
|
|
|
1680
1858
|
}
|
|
1681
1859
|
function useValueAtRest(value) {
|
|
1682
1860
|
const moving2 = useSyncExternalStore2(subscribeTimelineMotion, isTimelineMoving, () => false);
|
|
1683
|
-
const [
|
|
1684
|
-
if (!moving2 && !Object.is(
|
|
1685
|
-
return moving2 ?
|
|
1861
|
+
const [held2, setHeld] = useState3(value);
|
|
1862
|
+
if (!moving2 && !Object.is(held2, value)) setHeld(value);
|
|
1863
|
+
return moving2 ? held2 : value;
|
|
1686
1864
|
}
|
|
1687
1865
|
|
|
1688
1866
|
// src/contexts/FileManagerContext.tsx
|
|
@@ -1692,7 +1870,7 @@ import { useContext, useMemo } from "react";
|
|
|
1692
1870
|
import { createContext } from "react";
|
|
1693
1871
|
var REGISTRY = "__hfStudioContexts";
|
|
1694
1872
|
var seenNames = /* @__PURE__ */ new Map();
|
|
1695
|
-
function
|
|
1873
|
+
function registry2() {
|
|
1696
1874
|
const host = globalThis;
|
|
1697
1875
|
const existing = host[REGISTRY];
|
|
1698
1876
|
if (existing) return existing;
|
|
@@ -1701,7 +1879,7 @@ function registry() {
|
|
|
1701
1879
|
return created;
|
|
1702
1880
|
}
|
|
1703
1881
|
function createStableContext(name, defaultValue) {
|
|
1704
|
-
const store =
|
|
1882
|
+
const store = registry2();
|
|
1705
1883
|
if (store.has(name) && seenNames.get(name) !== defaultValue) {
|
|
1706
1884
|
console.warn(
|
|
1707
1885
|
`[hmrStableContext] "${name}" was registered twice with different defaults: two contexts are sharing one identity. Use module path + export name.`
|
|
@@ -5217,6 +5395,495 @@ function matchesSelector(tweenSelector, querySelector) {
|
|
|
5217
5395
|
return tweenSelector.split(",").some((part) => part.trim() === querySelector);
|
|
5218
5396
|
}
|
|
5219
5397
|
|
|
5398
|
+
// src/hooks/gsapFrameSnapshot.ts
|
|
5399
|
+
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
5400
|
+
|
|
5401
|
+
// src/player/store/previewIframeStore.ts
|
|
5402
|
+
import { create as create3 } from "zustand";
|
|
5403
|
+
var usePreviewIframeStore = create3((set) => ({
|
|
5404
|
+
iframe: null,
|
|
5405
|
+
// Return the same state reference on a no-op set so zustand skips the
|
|
5406
|
+
// notify (Object.is check in setState) instead of merging a new object
|
|
5407
|
+
// every time a caller re-pushes the current value.
|
|
5408
|
+
setIframe: (iframe) => set((state) => Object.is(state.iframe, iframe) ? state : { iframe })
|
|
5409
|
+
}));
|
|
5410
|
+
var useLivePreviewIframe = () => usePreviewIframeStore((s) => s.iframe);
|
|
5411
|
+
function useOwnPreviewIframe() {
|
|
5412
|
+
useMountEffect(() => () => usePreviewIframeStore.getState().setIframe(null));
|
|
5413
|
+
return useLivePreviewIframe();
|
|
5414
|
+
}
|
|
5415
|
+
|
|
5416
|
+
// src/components/editor/previewDrafts.ts
|
|
5417
|
+
import { MAX_DESCRIBE_HANDLES } from "@hyperframes/core/runtime/editing-port";
|
|
5418
|
+
var standIns = /* @__PURE__ */ new WeakMap();
|
|
5419
|
+
var queues = /* @__PURE__ */ new WeakMap();
|
|
5420
|
+
var previewStandInHandle = (standIn) => standIns.get(standIn)?.handle;
|
|
5421
|
+
function registerPreviewStandIn(standIn, iframe, handle) {
|
|
5422
|
+
standIns.set(standIn, { iframe, handle });
|
|
5423
|
+
}
|
|
5424
|
+
var previewStandIn = (standIn) => standIns.get(standIn);
|
|
5425
|
+
function queueFor(iframe) {
|
|
5426
|
+
let queue2 = queues.get(iframe);
|
|
5427
|
+
if (!queue2) {
|
|
5428
|
+
queue2 = { ops: [], drawn: /* @__PURE__ */ new Map(), sending: false };
|
|
5429
|
+
queues.set(iframe, queue2);
|
|
5430
|
+
}
|
|
5431
|
+
return queue2;
|
|
5432
|
+
}
|
|
5433
|
+
function send(iframe, queue2) {
|
|
5434
|
+
if (queue2.sending || !queue2.ops.length) return;
|
|
5435
|
+
const drafts = queue2.ops.splice(0, MAX_DESCRIBE_HANDLES);
|
|
5436
|
+
queue2.sending = true;
|
|
5437
|
+
void previewRequest(iframe, "draft", { drafts }).finally(() => {
|
|
5438
|
+
queue2.sending = false;
|
|
5439
|
+
send(iframe, queue2);
|
|
5440
|
+
});
|
|
5441
|
+
}
|
|
5442
|
+
function drawPreviewDraft(element, part) {
|
|
5443
|
+
const target = standIns.get(element);
|
|
5444
|
+
if (!target) return;
|
|
5445
|
+
const queue2 = queueFor(target.iframe);
|
|
5446
|
+
const drawn = { translate: null, size: null, ...queue2.drawn.get(target.handle), ...part };
|
|
5447
|
+
queue2.drawn.set(target.handle, drawn);
|
|
5448
|
+
const op = { handle: target.handle, ...drawn };
|
|
5449
|
+
const last = queue2.ops.map((queued) => queued.handle).lastIndexOf(target.handle);
|
|
5450
|
+
const waiting = queue2.ops[last];
|
|
5451
|
+
if (waiting && !("end" in waiting)) queue2.ops[last] = op;
|
|
5452
|
+
else queue2.ops.push(op);
|
|
5453
|
+
send(target.iframe, queue2);
|
|
5454
|
+
}
|
|
5455
|
+
function endPreviewDraft(element, end) {
|
|
5456
|
+
const target = standIns.get(element);
|
|
5457
|
+
if (!target) return;
|
|
5458
|
+
const queue2 = queueFor(target.iframe);
|
|
5459
|
+
if (!queue2.drawn.delete(target.handle)) return;
|
|
5460
|
+
queue2.ops.push({ handle: target.handle, end });
|
|
5461
|
+
send(target.iframe, queue2);
|
|
5462
|
+
}
|
|
5463
|
+
|
|
5464
|
+
// src/hooks/gsapSnapshotReply.ts
|
|
5465
|
+
import {
|
|
5466
|
+
MAX_SNAPSHOT_CHANNELS,
|
|
5467
|
+
MAX_SNAPSHOT_FIELDS,
|
|
5468
|
+
MAX_SNAPSHOT_TARGETS,
|
|
5469
|
+
MAX_SNAPSHOT_TEXT,
|
|
5470
|
+
MAX_SNAPSHOT_TWEENS,
|
|
5471
|
+
MAX_VARS_DEPTH
|
|
5472
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
5473
|
+
|
|
5474
|
+
// src/player/lib/previewElements.ts
|
|
5475
|
+
import {
|
|
5476
|
+
EDITING_ELEMENT_HANDLE,
|
|
5477
|
+
MAX_DESCRIBE_HANDLES as MAX_DESCRIBE_HANDLES2,
|
|
5478
|
+
MAX_DRAFT_PX,
|
|
5479
|
+
MAX_ELEMENT_ENTRIES,
|
|
5480
|
+
MAX_ELEMENT_TEXT,
|
|
5481
|
+
MAX_ELEMENT_VALUE,
|
|
5482
|
+
MAX_GEOMETRY_CHILDREN,
|
|
5483
|
+
MAX_SNAP_TARGETS,
|
|
5484
|
+
MAX_SOURCE_GROUPS
|
|
5485
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
5486
|
+
var isFields = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5487
|
+
var isHandle = (value) => typeof value === "string" && EDITING_ELEMENT_HANDLE.test(value);
|
|
5488
|
+
var isText = (value) => typeof value === "string";
|
|
5489
|
+
var isValue = (value) => isText(value) && value.length <= MAX_ELEMENT_VALUE;
|
|
5490
|
+
var isLongText = (value) => isText(value) && value.length <= MAX_ELEMENT_TEXT;
|
|
5491
|
+
var isValueOrNull = (value) => value === null || isValue(value);
|
|
5492
|
+
var isEntries = (value) => Array.isArray(value) && value.length <= MAX_ELEMENT_ENTRIES;
|
|
5493
|
+
var isCount = (value) => Number.isSafeInteger(value) && value >= 0;
|
|
5494
|
+
var isSource = (value) => isFields(value) && isValueOrNull(value.file) && isValueOrNull(value.compositionId) && isValueOrNull(value.originalCompositionId);
|
|
5495
|
+
var isStyles = (value) => isFields(value) && isEntries(Object.keys(value)) && Object.entries(value).every(([name, style]) => isValue(name) && isValue(style));
|
|
5496
|
+
function hasPlainFields(value) {
|
|
5497
|
+
const { matchesBefore, attributes, children } = value;
|
|
5498
|
+
const groupsOk = matchesBefore === null || Array.isArray(matchesBefore) && matchesBefore.length <= MAX_SOURCE_GROUPS && matchesBefore.every((g) => isFields(g) && isSource(g.source) && isCount(g.count));
|
|
5499
|
+
const attributesOk = isEntries(attributes) && attributes.every((a) => Array.isArray(a) && a.length === 2 && a.every(isValue));
|
|
5500
|
+
const childrenOk = isEntries(children) && children.every((c) => isFields(c) && (isHandle(c.handle) || isLongText(c.text)));
|
|
5501
|
+
return groupsOk && attributesOk && childrenOk && typeof value.truncated === "boolean";
|
|
5502
|
+
}
|
|
5503
|
+
var isRect = (value) => isFields(value) && [value.x, value.y, value.width, value.height].every(Number.isFinite);
|
|
5504
|
+
function readHit(value) {
|
|
5505
|
+
if (!isFields(value) || !isHandle(value.handle) || !isValue(value.tag)) return null;
|
|
5506
|
+
return isRect(value.rect) ? value : null;
|
|
5507
|
+
}
|
|
5508
|
+
function readPreviewElement(value) {
|
|
5509
|
+
if (!readHit(value) || !isFields(value)) return null;
|
|
5510
|
+
if (value.parent !== null && !isHandle(value.parent)) return null;
|
|
5511
|
+
if (value.label !== void 0 && !isValue(value.label)) return null;
|
|
5512
|
+
if (!isValueOrNull(value.id) || !isValueOrNull(value.selector)) return null;
|
|
5513
|
+
if (!isSource(value.source) || typeof value.locked !== "boolean") return null;
|
|
5514
|
+
if (!isStyles(value.inlineStyles) || !isLongText(value.text)) return null;
|
|
5515
|
+
return hasPlainFields(value) ? value : null;
|
|
5516
|
+
}
|
|
5517
|
+
async function previewElementsAtPoint(iframe, x, y) {
|
|
5518
|
+
const reply = await previewRequest(iframe, "elements-at-point", { x, y });
|
|
5519
|
+
const elements = reply?.elements;
|
|
5520
|
+
if (!Array.isArray(elements)) return null;
|
|
5521
|
+
return elements.map(readHit).filter((element) => element !== null);
|
|
5522
|
+
}
|
|
5523
|
+
async function previewPointerTargets(iframe, rootFractionX, rootFractionY) {
|
|
5524
|
+
const params = { x: rootFractionX, y: rootFractionY };
|
|
5525
|
+
const reply = await previewRequest(iframe, "pointer-targets", params);
|
|
5526
|
+
const stack = reply?.stack;
|
|
5527
|
+
if (!reply || !Array.isArray(stack)) return null;
|
|
5528
|
+
return { target: readHit(reply.target), stack: stack.map(readHit).filter((hit) => hit !== null) };
|
|
5529
|
+
}
|
|
5530
|
+
async function describePreviewElements(iframe, handles) {
|
|
5531
|
+
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES2) return null;
|
|
5532
|
+
const reply = await previewRequest(iframe, "describe", { handles: [...handles] });
|
|
5533
|
+
const elements = reply?.elements;
|
|
5534
|
+
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
5535
|
+
return elements.map((entry3, index2) => {
|
|
5536
|
+
const element = readPreviewElement(entry3);
|
|
5537
|
+
return element?.handle === handles[index2] ? element : null;
|
|
5538
|
+
});
|
|
5539
|
+
}
|
|
5540
|
+
async function previewAncestors(iframe, handles) {
|
|
5541
|
+
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES2) return null;
|
|
5542
|
+
const reply = await previewRequest(iframe, "ancestors", { handles: [...handles] });
|
|
5543
|
+
const chains = reply?.ancestors;
|
|
5544
|
+
if (!Array.isArray(chains) || chains.length !== handles.length) return null;
|
|
5545
|
+
return chains.map(
|
|
5546
|
+
(chain) => Array.isArray(chain) && chain.every(isHandle) ? chain : null
|
|
5547
|
+
);
|
|
5548
|
+
}
|
|
5549
|
+
async function queryPreviewElements(iframe, selector) {
|
|
5550
|
+
const reply = await previewRequest(iframe, "query", { selector });
|
|
5551
|
+
const matches = reply?.matches;
|
|
5552
|
+
if (!Array.isArray(matches) || typeof reply?.truncated !== "boolean") return null;
|
|
5553
|
+
const ok = matches.every((m) => isFields(m) && isHandle(m.handle) && isSource(m.source));
|
|
5554
|
+
return ok ? { matches, truncated: reply.truncated } : null;
|
|
5555
|
+
}
|
|
5556
|
+
function previewElementSourceFile(element, activeCompositionPath) {
|
|
5557
|
+
return resolveElementSourceFile(element.source, activeCompositionPath);
|
|
5558
|
+
}
|
|
5559
|
+
function previewElementSelectorIndex(element, activeCompositionPath) {
|
|
5560
|
+
if (!element.selector?.startsWith(".") || !element.matchesBefore) return void 0;
|
|
5561
|
+
const file = previewElementSourceFile(element, activeCompositionPath);
|
|
5562
|
+
return element.matchesBefore.filter((group) => resolveElementSourceFile(group.source, activeCompositionPath) === file).reduce((sum, group) => sum + group.count, 0);
|
|
5563
|
+
}
|
|
5564
|
+
var isPoint = (value) => isFields(value) && Number.isFinite(value.x) && Number.isFinite(value.y);
|
|
5565
|
+
var isSizeOrNull = (value) => value === null || Number.isFinite(value) && value > 0;
|
|
5566
|
+
var CORNERS = ["nw", "ne", "se", "sw"];
|
|
5567
|
+
var isCorners = (value) => value === null || isFields(value) && CORNERS.every((corner) => isPoint(value[corner]));
|
|
5568
|
+
var isSourceBox = (value) => value === null || isFields(value) && Number.isFinite(value.width) && Number.isFinite(value.height) && isSizeOrNull(value.declaredWidth) && isSizeOrNull(value.declaredHeight);
|
|
5569
|
+
var isClipPath = isValueOrNull;
|
|
5570
|
+
var isBox = (value) => isFields(value) && isRect(value.rect) && Number.isFinite(value.angle) && isCorners(value.corners) && isSourceBox(value.source) && isClipPath(value.clipPath);
|
|
5571
|
+
var readGeometry = (value) => {
|
|
5572
|
+
if (!isBox(value) || !isFields(value) || typeof value.visible !== "boolean") return null;
|
|
5573
|
+
const { members } = value;
|
|
5574
|
+
const membersOk = members === null || Array.isArray(members) && members.length <= MAX_ELEMENT_ENTRIES && members.every(isRect);
|
|
5575
|
+
return membersOk ? value : null;
|
|
5576
|
+
};
|
|
5577
|
+
async function previewGeometry(iframe, handles, children) {
|
|
5578
|
+
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES2) return null;
|
|
5579
|
+
const params = { handles: [...handles], ...children ? { children } : {} };
|
|
5580
|
+
const reply = await previewRequest(iframe, "geometry", params);
|
|
5581
|
+
const elements = reply?.elements;
|
|
5582
|
+
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
5583
|
+
const boxes = reply?.children;
|
|
5584
|
+
const childrenOk = Array.isArray(boxes) && boxes.length <= MAX_GEOMETRY_CHILDREN && boxes.every(isBox);
|
|
5585
|
+
return {
|
|
5586
|
+
elements: elements.map(readGeometry),
|
|
5587
|
+
children: children && childrenOk ? boxes : null
|
|
5588
|
+
};
|
|
5589
|
+
}
|
|
5590
|
+
var isFlag = (value) => typeof value === "boolean";
|
|
5591
|
+
var isFiniteFields = (value, keys) => isFields(value) && keys.every((key) => Number.isFinite(value[key]));
|
|
5592
|
+
var isLayout = (value) => isFields(value) && [value.width, value.height].every(
|
|
5593
|
+
(side) => Number.isFinite(side) && side >= 0 && side <= MAX_DRAFT_PX
|
|
5594
|
+
);
|
|
5595
|
+
var readGestureStart = (value) => {
|
|
5596
|
+
if (!readGeometry(value) || !isFields(value)) return null;
|
|
5597
|
+
const { layout, move, gsap: gsap3 } = value;
|
|
5598
|
+
const valid = [
|
|
5599
|
+
isLayout(layout),
|
|
5600
|
+
move === null || isFiniteFields(move, ["a", "b", "c", "d"]),
|
|
5601
|
+
gsap3 === null || isFields(gsap3) && isFiniteFields(gsap3, ["x", "y"]) && isFlag(gsap3.moving)
|
|
5602
|
+
];
|
|
5603
|
+
return valid.includes(false) ? null : value;
|
|
5604
|
+
};
|
|
5605
|
+
async function previewGestureStart(iframe, handles) {
|
|
5606
|
+
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES2) return null;
|
|
5607
|
+
const reply = await previewRequest(iframe, "gesture-start", { handles: [...handles] });
|
|
5608
|
+
const elements = reply?.elements;
|
|
5609
|
+
const snap = reply?.snap;
|
|
5610
|
+
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
5611
|
+
if (!Array.isArray(snap) || snap.length > MAX_SNAP_TARGETS || !snap.every(isBox)) return null;
|
|
5612
|
+
return { elements: elements.map(readGestureStart), snap };
|
|
5613
|
+
}
|
|
5614
|
+
var LAYER_KINDS = /* @__PURE__ */ new Set(["image", "video", "audio", "vector", "group", "text", "shape"]);
|
|
5615
|
+
var isLayer = (value) => isFields(value) && isHandle(value.handle) && isCount(value.depth) && isCount(value.childCount) && Number.isFinite(value.zIndex) && LAYER_KINDS.has(value.kind);
|
|
5616
|
+
async function previewLayers(iframe, group, offset = 0) {
|
|
5617
|
+
const params = { ...group ? { group } : {}, ...offset ? { offset } : {} };
|
|
5618
|
+
const reply = await previewRequest(iframe, "layers", params);
|
|
5619
|
+
const layers = reply?.layers;
|
|
5620
|
+
const { truncated, missingGroup } = reply ?? {};
|
|
5621
|
+
if (!Array.isArray(layers) || typeof truncated !== "boolean") return null;
|
|
5622
|
+
if (typeof missingGroup !== "boolean") return null;
|
|
5623
|
+
return layers.every(isLayer) ? { layers, truncated, missingGroup } : null;
|
|
5624
|
+
}
|
|
5625
|
+
var isEditEntries = (value, priority = false) => Array.isArray(value) && value.every(
|
|
5626
|
+
(entry3) => Array.isArray(entry3) && isText(entry3[0]) && (entry3[1] === null || isText(entry3[1])) && (entry3.length === 2 || priority && entry3.length === 3 && entry3[2] === "important")
|
|
5627
|
+
);
|
|
5628
|
+
var latestWriters = /* @__PURE__ */ new WeakMap();
|
|
5629
|
+
function editPreviewElement(iframe, handle, edit) {
|
|
5630
|
+
const send3 = (styles, attributes) => previewRequest(iframe, "edit-element", { handle, styles, attributes });
|
|
5631
|
+
const writers = latestWriters.get(iframe) ?? /* @__PURE__ */ new Map();
|
|
5632
|
+
latestWriters.set(iframe, writers);
|
|
5633
|
+
const self = /* @__PURE__ */ Symbol("edit");
|
|
5634
|
+
const key = (part, name) => `${handle} ${part} ${name}`;
|
|
5635
|
+
for (const [name] of edit.styles ?? []) writers.set(key("style", name), self);
|
|
5636
|
+
for (const [name] of edit.attributes ?? []) writers.set(key("attr", name), self);
|
|
5637
|
+
const reply = send3(edit.styles ?? [], edit.attributes ?? []);
|
|
5638
|
+
return {
|
|
5639
|
+
drawn: reply.then((before) => before?.applied === true),
|
|
5640
|
+
restore(names) {
|
|
5641
|
+
const owns = (part, name) => (!names || names.includes(name)) && writers.get(key(part, name)) === self;
|
|
5642
|
+
void reply.then((before) => {
|
|
5643
|
+
if (!before?.applied || !isEditEntries(before.styles, true)) return;
|
|
5644
|
+
if (!isEditEntries(before.attributes)) return;
|
|
5645
|
+
const styles = before.styles.filter(([name]) => owns("style", name));
|
|
5646
|
+
const attributes = before.attributes.filter(([name]) => owns("attr", name));
|
|
5647
|
+
if (styles.length || attributes.length) void send3(styles, attributes);
|
|
5648
|
+
});
|
|
5649
|
+
}
|
|
5650
|
+
};
|
|
5651
|
+
}
|
|
5652
|
+
var SEALED_DRAW_WAIT_MS = 300;
|
|
5653
|
+
function afterSealedDraw(edit, save) {
|
|
5654
|
+
if (!edit) return save(true);
|
|
5655
|
+
let timer;
|
|
5656
|
+
const late = new Promise((resolve2) => {
|
|
5657
|
+
timer = setTimeout(resolve2, SEALED_DRAW_WAIT_MS, false);
|
|
5658
|
+
});
|
|
5659
|
+
return Promise.race([edit.drawn, late]).then((drawn) => {
|
|
5660
|
+
clearTimeout(timer);
|
|
5661
|
+
return save(drawn);
|
|
5662
|
+
});
|
|
5663
|
+
}
|
|
5664
|
+
|
|
5665
|
+
// src/hooks/gsapSnapshotReply.ts
|
|
5666
|
+
var isText2 = (value) => typeof value === "string" && value.length <= MAX_SNAPSHOT_TEXT;
|
|
5667
|
+
var isTextOrNull = (value) => value === null || isText2(value);
|
|
5668
|
+
var isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
5669
|
+
var isNumberOrNull = (value) => value === null || isNumber(value);
|
|
5670
|
+
var isList = (value, max) => Array.isArray(value) && value.length <= max;
|
|
5671
|
+
function readGsapSnapshot(value) {
|
|
5672
|
+
if (!isFields(value) || !isNumberOrNull(value.time) || !isTextOrNull(value.defaultEase))
|
|
5673
|
+
return null;
|
|
5674
|
+
const budget = { tweens: MAX_SNAPSHOT_TWEENS, fields: MAX_SNAPSHOT_FIELDS };
|
|
5675
|
+
const { timelines, targets } = value;
|
|
5676
|
+
const ok = isList(timelines, MAX_SNAPSHOT_TWEENS) && timelines.every((line) => isTimeline(line, budget)) && isList(targets, MAX_SNAPSHOT_TARGETS) && targets.every(isTarget);
|
|
5677
|
+
return ok ? value : null;
|
|
5678
|
+
}
|
|
5679
|
+
function isTimeline(value, budget) {
|
|
5680
|
+
return isFields(value) && isText2(value.id) && isNumberOrNull(value.time) && isTextOrNull(value.defaultEase) && isList(value.tweens, MAX_SNAPSHOT_TWEENS) && value.tweens.every((tween) => isTween(tween, budget));
|
|
5681
|
+
}
|
|
5682
|
+
function isTween(value, budget) {
|
|
5683
|
+
if ((budget.tweens -= 1) < 0 || !isFields(value)) return false;
|
|
5684
|
+
return isTargetHandles(value.targets) && isFields(value.vars) && isVars(value.vars, budget, 0) && isTiming(value) && isParsed(value.parsed) && areParts(value.parts, budget);
|
|
5685
|
+
}
|
|
5686
|
+
var isTargetHandles = (value) => isList(value, MAX_SNAPSHOT_TARGETS) && value.every(isHandle);
|
|
5687
|
+
var isTiming = (tween) => isNumber(tween.start) && isNumber(tween.duration) && typeof tween.from === "boolean" && typeof tween.initted === "boolean";
|
|
5688
|
+
var isChannel = (value) => isFields(value) && isText2(value.p) && isNumber(value.s) && isNumber(value.c);
|
|
5689
|
+
var isParsed = (value) => isList(value, MAX_SNAPSHOT_CHANNELS) && value.every(isChannel);
|
|
5690
|
+
function areParts(value, budget) {
|
|
5691
|
+
return isList(value, MAX_SNAPSHOT_TWEENS) && value.every((part) => isTween(part, budget));
|
|
5692
|
+
}
|
|
5693
|
+
function isVars(value, budget, depth) {
|
|
5694
|
+
if ((budget.fields -= 1) < 0) return false;
|
|
5695
|
+
if (value === null || typeof value === "boolean" || isNumber(value) || isText2(value)) return true;
|
|
5696
|
+
if (depth >= MAX_VARS_DEPTH) return false;
|
|
5697
|
+
if (Array.isArray(value)) return value.every((item) => isVars(item, budget, depth + 1));
|
|
5698
|
+
return isFields(value) && Object.entries(value).every(([key, item]) => isText2(key) && isVars(item, budget, depth + 1));
|
|
5699
|
+
}
|
|
5700
|
+
function isTarget(value) {
|
|
5701
|
+
if (!isFields(value) || !isFields(value.values)) return false;
|
|
5702
|
+
const values = Object.entries(value.values);
|
|
5703
|
+
return isHandle(value.handle) && isText2(value.id) && isText2(value.className) && values.length <= MAX_SNAPSHOT_CHANNELS && values.every(([key, number]) => isText2(key) && isNumber(number));
|
|
5704
|
+
}
|
|
5705
|
+
|
|
5706
|
+
// src/hooks/gsapFrameSnapshot.ts
|
|
5707
|
+
var held = /* @__PURE__ */ new WeakMap();
|
|
5708
|
+
var asking = /* @__PURE__ */ new WeakMap();
|
|
5709
|
+
var watched = /* @__PURE__ */ new WeakSet();
|
|
5710
|
+
var listeners3 = /* @__PURE__ */ new Set();
|
|
5711
|
+
var version = 0;
|
|
5712
|
+
var pausedPlayhead = () => {
|
|
5713
|
+
const { isPlaying, currentTime } = usePlayerStore.getState();
|
|
5714
|
+
return isPlaying ? null : currentTime;
|
|
5715
|
+
};
|
|
5716
|
+
function fresh(snapshot3) {
|
|
5717
|
+
const playhead = pausedPlayhead();
|
|
5718
|
+
return playhead !== null && snapshot3.readAt === playhead;
|
|
5719
|
+
}
|
|
5720
|
+
var SEEK_TOLERANCE_S = 1 / 120;
|
|
5721
|
+
var seekLanded = (frameTime, readAt) => frameTime !== null && readAt !== null && Math.abs(frameTime - readAt) <= SEEK_TOLERANCE_S;
|
|
5722
|
+
var watchingPlayhead = false;
|
|
5723
|
+
function watchPlayhead() {
|
|
5724
|
+
if (watchingPlayhead) return;
|
|
5725
|
+
watchingPlayhead = true;
|
|
5726
|
+
usePlayerStore.subscribe((state, before) => {
|
|
5727
|
+
if (state.isPlaying || state.currentTime === before.currentTime) return;
|
|
5728
|
+
const { iframe } = usePreviewIframeStore.getState();
|
|
5729
|
+
if (iframe && held.has(previewEditingClient(iframe))) void refreshGsapSnapshot(iframe);
|
|
5730
|
+
});
|
|
5731
|
+
}
|
|
5732
|
+
function announce() {
|
|
5733
|
+
version += 1;
|
|
5734
|
+
for (const listener2 of listeners3) listener2();
|
|
5735
|
+
}
|
|
5736
|
+
function refreshGsapSnapshot(iframe) {
|
|
5737
|
+
const client = previewEditingClient(iframe);
|
|
5738
|
+
const pending2 = asking.get(client) ?? read(iframe, client);
|
|
5739
|
+
asking.set(client, pending2);
|
|
5740
|
+
return pending2;
|
|
5741
|
+
}
|
|
5742
|
+
async function settleGsapSnapshot(iframe) {
|
|
5743
|
+
if (!iframe || !previewFrameOpaque(iframe)) return true;
|
|
5744
|
+
const client = previewEditingClient(iframe);
|
|
5745
|
+
for (let reads = 0; reads < 2; reads++) {
|
|
5746
|
+
const snapshot3 = held.get(client);
|
|
5747
|
+
if (snapshot3 && fresh(snapshot3)) return true;
|
|
5748
|
+
await refreshGsapSnapshot(iframe);
|
|
5749
|
+
}
|
|
5750
|
+
return held.has(client);
|
|
5751
|
+
}
|
|
5752
|
+
async function read(iframe, client) {
|
|
5753
|
+
watchPlayhead();
|
|
5754
|
+
if (!watched.has(client)) {
|
|
5755
|
+
watched.add(client);
|
|
5756
|
+
const stop2 = onPreviewContentReplaced(iframe, () => {
|
|
5757
|
+
stop2();
|
|
5758
|
+
held.delete(client);
|
|
5759
|
+
watched.delete(client);
|
|
5760
|
+
void refreshGsapSnapshot(iframe);
|
|
5761
|
+
});
|
|
5762
|
+
}
|
|
5763
|
+
const readAt = pausedPlayhead();
|
|
5764
|
+
try {
|
|
5765
|
+
const snapshot3 = readGsapSnapshot(await previewRequest(iframe, "gsap-snapshot", {}));
|
|
5766
|
+
const before = held.get(client);
|
|
5767
|
+
if (!snapshot3) {
|
|
5768
|
+
if (before) held.delete(client);
|
|
5769
|
+
return;
|
|
5770
|
+
}
|
|
5771
|
+
const json2 = JSON.stringify(snapshot3);
|
|
5772
|
+
const stamp = pausedPlayhead() === readAt && seekLanded(snapshot3.time, readAt) ? readAt : null;
|
|
5773
|
+
if (before?.json === json2 && before.readAt === stamp) return;
|
|
5774
|
+
held.set(client, hold(snapshot3, json2, stamp));
|
|
5775
|
+
announce();
|
|
5776
|
+
} finally {
|
|
5777
|
+
asking.delete(client);
|
|
5778
|
+
}
|
|
5779
|
+
}
|
|
5780
|
+
function heldSnapshot(iframe) {
|
|
5781
|
+
if (!iframe || !previewFrameOpaque(iframe)) return null;
|
|
5782
|
+
const snapshot3 = held.get(previewEditingClient(iframe)) ?? null;
|
|
5783
|
+
if (!snapshot3 || !fresh(snapshot3) && pausedPlayhead() !== null)
|
|
5784
|
+
void refreshGsapSnapshot(iframe);
|
|
5785
|
+
return snapshot3;
|
|
5786
|
+
}
|
|
5787
|
+
function frameTimelines(iframe) {
|
|
5788
|
+
return heldSnapshot(iframe)?.timelines ?? null;
|
|
5789
|
+
}
|
|
5790
|
+
function frameDocument(iframe) {
|
|
5791
|
+
return heldSnapshot(iframe)?.document ?? null;
|
|
5792
|
+
}
|
|
5793
|
+
function frameQuery(iframe, selector) {
|
|
5794
|
+
try {
|
|
5795
|
+
return frameDocument(iframe)?.querySelector(selector) ?? null;
|
|
5796
|
+
} catch {
|
|
5797
|
+
return null;
|
|
5798
|
+
}
|
|
5799
|
+
}
|
|
5800
|
+
function frameTarget(iframe, element) {
|
|
5801
|
+
const snapshot3 = heldSnapshot(iframe);
|
|
5802
|
+
if (!snapshot3) return null;
|
|
5803
|
+
const handle = previewStandInHandle(element);
|
|
5804
|
+
const byHandle = handle ? snapshot3.byHandle.get(handle) : void 0;
|
|
5805
|
+
if (byHandle) return byHandle;
|
|
5806
|
+
return element.id ? snapshot3.document.getElementById(element.id) : null;
|
|
5807
|
+
}
|
|
5808
|
+
function frameDefaultEase(iframe) {
|
|
5809
|
+
return heldSnapshot(iframe)?.defaultEase ?? null;
|
|
5810
|
+
}
|
|
5811
|
+
function frameGsap(iframe) {
|
|
5812
|
+
const snapshot3 = heldSnapshot(iframe);
|
|
5813
|
+
if (!iframe || !snapshot3 || !fresh(snapshot3)) return null;
|
|
5814
|
+
return {
|
|
5815
|
+
getProperty(element, prop) {
|
|
5816
|
+
const target = snapshot3.values.has(element) ? element : frameTarget(iframe, element);
|
|
5817
|
+
return (target && snapshot3.values.get(target)?.[prop]) ?? Number.NaN;
|
|
5818
|
+
}
|
|
5819
|
+
};
|
|
5820
|
+
}
|
|
5821
|
+
function subscribe(listener2) {
|
|
5822
|
+
listeners3.add(listener2);
|
|
5823
|
+
return () => listeners3.delete(listener2);
|
|
5824
|
+
}
|
|
5825
|
+
function useGsapSnapshotVersion() {
|
|
5826
|
+
return useSyncExternalStore4(
|
|
5827
|
+
subscribe,
|
|
5828
|
+
() => version,
|
|
5829
|
+
() => version
|
|
5830
|
+
);
|
|
5831
|
+
}
|
|
5832
|
+
function hold(snapshot3, json2, readAt) {
|
|
5833
|
+
const document2 = window.document.implementation.createHTMLDocument("");
|
|
5834
|
+
const byHandle = /* @__PURE__ */ new Map();
|
|
5835
|
+
const values = /* @__PURE__ */ new WeakMap();
|
|
5836
|
+
for (const target of snapshot3.targets) {
|
|
5837
|
+
const element = document2.createElement("div");
|
|
5838
|
+
if (target.id) element.id = target.id;
|
|
5839
|
+
if (target.className) element.setAttribute("class", target.className);
|
|
5840
|
+
document2.body.append(element);
|
|
5841
|
+
byHandle.set(target.handle, element);
|
|
5842
|
+
values.set(element, target.values);
|
|
5843
|
+
}
|
|
5844
|
+
const held2 = {
|
|
5845
|
+
readAt,
|
|
5846
|
+
json: json2,
|
|
5847
|
+
// Ids are the frame's: a timeline named __proto__ must stay a timeline.
|
|
5848
|
+
timelines: /* @__PURE__ */ Object.create(null),
|
|
5849
|
+
document: document2,
|
|
5850
|
+
byHandle,
|
|
5851
|
+
values,
|
|
5852
|
+
defaultEase: snapshot3.defaultEase
|
|
5853
|
+
};
|
|
5854
|
+
for (const line of snapshot3.timelines) {
|
|
5855
|
+
const timeline = {
|
|
5856
|
+
vars: { defaults: { ease: line.defaultEase ?? void 0 } },
|
|
5857
|
+
time: () => fresh(held2) ? line.time : null,
|
|
5858
|
+
getChildren: () => tweens
|
|
5859
|
+
};
|
|
5860
|
+
const tweens = line.tweens.map((tween) => liveShaped(tween, byHandle, timeline));
|
|
5861
|
+
held2.timelines[line.id] = timeline;
|
|
5862
|
+
}
|
|
5863
|
+
return held2;
|
|
5864
|
+
}
|
|
5865
|
+
function liveShaped(tween, byHandle, parent) {
|
|
5866
|
+
const targets = tween.targets.flatMap((handle) => byHandle.get(handle) ?? []);
|
|
5867
|
+
const _pt = tween.parsed.reduceRight(
|
|
5868
|
+
(next, { p, s, c }) => ({ p, s, c, _next: next }),
|
|
5869
|
+
void 0
|
|
5870
|
+
);
|
|
5871
|
+
const parts = tween.parts.map(
|
|
5872
|
+
(part) => liveShaped(part, byHandle)
|
|
5873
|
+
);
|
|
5874
|
+
return {
|
|
5875
|
+
vars: tween.vars,
|
|
5876
|
+
_from: tween.from,
|
|
5877
|
+
_initted: tween.initted,
|
|
5878
|
+
_pt,
|
|
5879
|
+
parent,
|
|
5880
|
+
targets: () => targets,
|
|
5881
|
+
startTime: () => tween.start,
|
|
5882
|
+
duration: () => tween.duration,
|
|
5883
|
+
...parts.length > 0 && { timeline: { getChildren: () => parts } }
|
|
5884
|
+
};
|
|
5885
|
+
}
|
|
5886
|
+
|
|
5220
5887
|
// src/hooks/gsapShared.ts
|
|
5221
5888
|
import { KEYFRAME_PROPERTY_DEFAULTS } from "@hyperframes/core/keyframe-defaults";
|
|
5222
5889
|
function keyframeEases(anim) {
|
|
@@ -5360,6 +6027,7 @@ function computeElementPercentage(currentTime, selection, animation2) {
|
|
|
5360
6027
|
return absoluteToPercentage(currentTime, elStart, elDuration);
|
|
5361
6028
|
}
|
|
5362
6029
|
function getIframeGsap(iframe) {
|
|
6030
|
+
if (iframe && previewFrameOpaque(iframe)) return frameGsap(iframe);
|
|
5363
6031
|
if (!iframe?.contentWindow) return null;
|
|
5364
6032
|
try {
|
|
5365
6033
|
const gsap3 = iframe.contentWindow.gsap;
|
|
@@ -5369,6 +6037,7 @@ function getIframeGsap(iframe) {
|
|
|
5369
6037
|
}
|
|
5370
6038
|
}
|
|
5371
6039
|
function queryIframeElement(iframe, selector) {
|
|
6040
|
+
if (iframe && previewFrameOpaque(iframe)) return frameQuery(iframe, selector);
|
|
5372
6041
|
try {
|
|
5373
6042
|
return iframe?.contentDocument?.querySelector(selector) ?? null;
|
|
5374
6043
|
} catch {
|
|
@@ -5542,7 +6211,7 @@ function synthesizeFlatTweenKeyframes(anim) {
|
|
|
5542
6211
|
import { memo as memo9, useEffect as useEffect11, useRef as useRef11, useState as useState7 } from "react";
|
|
5543
6212
|
|
|
5544
6213
|
// src/player/components/BeatStrip.tsx
|
|
5545
|
-
import { memo as memo6, useSyncExternalStore as
|
|
6214
|
+
import { memo as memo6, useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
5546
6215
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
5547
6216
|
var BEAT_BAND_H = 14;
|
|
5548
6217
|
var BEAT_HIT_W = 24;
|
|
@@ -5796,7 +6465,7 @@ var BeatStrip = memo6(function BeatStrip2({
|
|
|
5796
6465
|
pps,
|
|
5797
6466
|
renderTimeRange
|
|
5798
6467
|
}) {
|
|
5799
|
-
const activeActor =
|
|
6468
|
+
const activeActor = useSyncExternalStore5(
|
|
5800
6469
|
subscribeBeatDrag,
|
|
5801
6470
|
getBeatDragSnapshot,
|
|
5802
6471
|
getBeatDragSnapshot
|
|
@@ -7576,14 +8245,15 @@ function shouldTrack() {
|
|
|
7576
8245
|
}
|
|
7577
8246
|
function trackEvent(event, properties = {}) {
|
|
7578
8247
|
if (!shouldTrack()) return;
|
|
7579
|
-
|
|
8248
|
+
const shaped = shapeEventProperties(event, properties);
|
|
8249
|
+
recordBreadcrumb(event, shaped);
|
|
7580
8250
|
const sys = getBrowserSystemMeta();
|
|
7581
8251
|
eventQueue.push({
|
|
7582
8252
|
event,
|
|
7583
8253
|
// Canary assignments as `$feature/canary-<name>`, mirroring the CLI so a
|
|
7584
8254
|
// rollout spanning both surfaces reads as one flag in PostHog. Resolved
|
|
7585
8255
|
// after the shouldTrack guard, so opted-out users never pay for it.
|
|
7586
|
-
properties: { ...
|
|
8256
|
+
properties: { ...shaped, ...sys, ...canaryEventProperties() },
|
|
7587
8257
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
7588
8258
|
});
|
|
7589
8259
|
if (flushTimer2 === null) {
|
|
@@ -7605,9 +8275,9 @@ function flush() {
|
|
|
7605
8275
|
timestamp: e.timestamp
|
|
7606
8276
|
}));
|
|
7607
8277
|
eventQueue = [];
|
|
7608
|
-
|
|
8278
|
+
send2(`${POSTHOG_HOST2}/batch/`, JSON.stringify({ api_key: POSTHOG_API_KEY3, batch }));
|
|
7609
8279
|
}
|
|
7610
|
-
function
|
|
8280
|
+
function send2(url, payload) {
|
|
7611
8281
|
try {
|
|
7612
8282
|
void studioApiFetch(url, {
|
|
7613
8283
|
method: "POST",
|
|
@@ -9797,16 +10467,31 @@ function rollbackLatestTimelineOptimisticGesture(updateElement, gesture, rollbac
|
|
|
9797
10467
|
|
|
9798
10468
|
// src/utils/studioSaveDiagnostics.ts
|
|
9799
10469
|
var STUDIO_SAVE_ATTEMPT_PROPERTY = "__studioSaveAttempt";
|
|
10470
|
+
var SERVER_WHY = /* @__PURE__ */ new Set([
|
|
10471
|
+
"nul",
|
|
10472
|
+
"dangling_symlink",
|
|
10473
|
+
"outside_project",
|
|
10474
|
+
"protected_path",
|
|
10475
|
+
"busy",
|
|
10476
|
+
"permission",
|
|
10477
|
+
"not_a_file",
|
|
10478
|
+
"too_large",
|
|
10479
|
+
"binary",
|
|
10480
|
+
"link",
|
|
10481
|
+
"project_dir_missing"
|
|
10482
|
+
]);
|
|
9800
10483
|
var StudioSaveHttpError = class extends Error {
|
|
9801
10484
|
statusCode;
|
|
9802
10485
|
alreadyToasted;
|
|
9803
10486
|
heldFile;
|
|
10487
|
+
why;
|
|
9804
10488
|
constructor(message, statusCode, options = {}) {
|
|
9805
10489
|
super(message);
|
|
9806
10490
|
this.name = "StudioSaveHttpError";
|
|
9807
10491
|
this.statusCode = statusCode;
|
|
9808
10492
|
this.alreadyToasted = options.alreadyToasted ?? false;
|
|
9809
10493
|
this.heldFile = options.heldFile ?? false;
|
|
10494
|
+
this.why = options.why ?? null;
|
|
9810
10495
|
}
|
|
9811
10496
|
};
|
|
9812
10497
|
var StudioSaveNetworkError = class extends Error {
|
|
@@ -9904,7 +10589,7 @@ function buildStudioSaveFailureProperties(input) {
|
|
|
9904
10589
|
const attempt = input.attempt ?? getStudioSaveAttempt(input.error) ?? void 0;
|
|
9905
10590
|
return {
|
|
9906
10591
|
source: input.source,
|
|
9907
|
-
|
|
10592
|
+
...studioSaveErrorCodes(input.error),
|
|
9908
10593
|
status_code: statusCode,
|
|
9909
10594
|
file_path: input.filePath ?? input.targetSourceFile ?? void 0,
|
|
9910
10595
|
mutation_type: input.mutationType ?? void 0,
|
|
@@ -9916,6 +10601,38 @@ function buildStudioSaveFailureProperties(input) {
|
|
|
9916
10601
|
block_detail: gsapBlockDetail(input.error)
|
|
9917
10602
|
};
|
|
9918
10603
|
}
|
|
10604
|
+
var isNamed = (name) => (error) => error instanceof Error && error.name === name;
|
|
10605
|
+
var ERROR_KEYS = [
|
|
10606
|
+
["conflict", (error) => findCause(error, StudioFileConflictError) !== null],
|
|
10607
|
+
["held", (error) => findCause(error, StudioSaveHttpError)?.heldFile === true],
|
|
10608
|
+
["http", (error) => findCause(error, StudioSaveHttpError) !== null],
|
|
10609
|
+
["network", (error) => findCause(error, StudioSaveNetworkError) !== null],
|
|
10610
|
+
["aborted", isNamed("AbortError")],
|
|
10611
|
+
["blocked", isNamed("GsapEditBlockedError")]
|
|
10612
|
+
];
|
|
10613
|
+
function studioSaveErrorCodes(error) {
|
|
10614
|
+
const failure2 = error instanceof Error ? error : null;
|
|
10615
|
+
const http = findCause(error, StudioSaveHttpError);
|
|
10616
|
+
const errorKey = ERROR_KEYS.find(([, matches]) => matches(error))?.[0] ?? "unknown";
|
|
10617
|
+
return {
|
|
10618
|
+
error_class: failure2?.name ?? typeof error,
|
|
10619
|
+
error_key: errorKey,
|
|
10620
|
+
server_why: http ? http.why ?? "other" : void 0,
|
|
10621
|
+
block_reason: blockReason(error)
|
|
10622
|
+
};
|
|
10623
|
+
}
|
|
10624
|
+
function findCause(error, type) {
|
|
10625
|
+
for (let at = error, depth = 0; at && typeof at === "object" && depth < 5; depth++) {
|
|
10626
|
+
if (at instanceof type) return at;
|
|
10627
|
+
at = at.cause;
|
|
10628
|
+
}
|
|
10629
|
+
return null;
|
|
10630
|
+
}
|
|
10631
|
+
function blockReason(error) {
|
|
10632
|
+
if (!(error instanceof Error) || error.name !== "GsapEditBlockedError") return void 0;
|
|
10633
|
+
const reason = error.reason;
|
|
10634
|
+
return typeof reason === "string" ? reason : void 0;
|
|
10635
|
+
}
|
|
9919
10636
|
function gsapBlockDetail(error) {
|
|
9920
10637
|
if (!(error instanceof Error) || error.name !== "GsapEditBlockedError") return void 0;
|
|
9921
10638
|
const detail = error.detail;
|
|
@@ -9955,9 +10672,22 @@ async function createStudioSaveHttpError(response, fallbackMessage, options = {}
|
|
|
9955
10672
|
body = "";
|
|
9956
10673
|
}
|
|
9957
10674
|
const detail = body.trim().slice(0, 300);
|
|
9958
|
-
const
|
|
9959
|
-
const
|
|
9960
|
-
|
|
10675
|
+
const held2 = heldFileMessage(body, options.path);
|
|
10676
|
+
const why = serverWhy(body);
|
|
10677
|
+
const message = held2 ?? (detail ? `${fallbackMessage} (${response.status}): ${detail}` : `${fallbackMessage} (${response.status})`);
|
|
10678
|
+
return new StudioSaveHttpError(message, response.status, {
|
|
10679
|
+
...options,
|
|
10680
|
+
heldFile: held2 !== null,
|
|
10681
|
+
why
|
|
10682
|
+
});
|
|
10683
|
+
}
|
|
10684
|
+
function serverWhy(body) {
|
|
10685
|
+
try {
|
|
10686
|
+
const why = JSON.parse(body).why;
|
|
10687
|
+
return typeof why === "string" && SERVER_WHY.has(why) ? why : null;
|
|
10688
|
+
} catch {
|
|
10689
|
+
return null;
|
|
10690
|
+
}
|
|
9961
10691
|
}
|
|
9962
10692
|
var heldFileWords = (error) => error instanceof StudioSaveHttpError && error.heldFile ? error.message : null;
|
|
9963
10693
|
async function retryStudioSave(operation, options = {}) {
|
|
@@ -10003,8 +10733,8 @@ import { isTypingTarget as isTypingTarget2 } from "@hyperframes/core/typing-targ
|
|
|
10003
10733
|
var STUDIO_FLUSH_PENDING_EDITS_EVENT = "hf-studio-flush-pending-edits";
|
|
10004
10734
|
var pendingEdits = /* @__PURE__ */ new Map();
|
|
10005
10735
|
var historyClaims = () => 0;
|
|
10006
|
-
function setStudioPendingEditClaimClock(
|
|
10007
|
-
historyClaims =
|
|
10736
|
+
function setStudioPendingEditClaimClock(read3) {
|
|
10737
|
+
historyClaims = read3 ?? (() => 0);
|
|
10008
10738
|
}
|
|
10009
10739
|
var allSettled = null;
|
|
10010
10740
|
function setStudioPendingEditsSettled(run) {
|
|
@@ -12286,10 +13016,10 @@ function useTimelineRangeSelection({
|
|
|
12286
13016
|
store.setSelectedElementId(null);
|
|
12287
13017
|
}
|
|
12288
13018
|
};
|
|
12289
|
-
const
|
|
12290
|
-
window.addEventListener("keydown", onBandEscape, { capture: true, signal:
|
|
12291
|
-
window.addEventListener("keydown", onKeyDown, { signal:
|
|
12292
|
-
return () =>
|
|
13019
|
+
const listeners6 = new AbortController();
|
|
13020
|
+
window.addEventListener("keydown", onBandEscape, { capture: true, signal: listeners6.signal });
|
|
13021
|
+
window.addEventListener("keydown", onKeyDown, { signal: listeners6.signal });
|
|
13022
|
+
return () => listeners6.abort();
|
|
12293
13023
|
}, [cancelActiveGesture, isDragging]);
|
|
12294
13024
|
const previousSessionEpochRef = useRef14(sessionEpoch);
|
|
12295
13025
|
useEffect13(() => {
|
|
@@ -13639,12 +14369,12 @@ function freshLaneClips(gsapAnimations, clips) {
|
|
|
13639
14369
|
for (const key of clips) {
|
|
13640
14370
|
if (!gsapAnimations.has(key)) clips.delete(key);
|
|
13641
14371
|
}
|
|
13642
|
-
const
|
|
14372
|
+
const fresh2 = [];
|
|
13643
14373
|
for (const [key, animations] of gsapAnimations) {
|
|
13644
14374
|
if (clips.has(key)) continue;
|
|
13645
|
-
if (animations.some(animationContributesLane))
|
|
14375
|
+
if (animations.some(animationContributesLane)) fresh2.push(key);
|
|
13646
14376
|
}
|
|
13647
|
-
return
|
|
14377
|
+
return fresh2;
|
|
13648
14378
|
}
|
|
13649
14379
|
function useAutoExpandKeyframedClips(gsapAnimations) {
|
|
13650
14380
|
const expandClips = usePlayerStore((s) => s.expandClips);
|
|
@@ -13658,10 +14388,10 @@ function useAutoExpandKeyframedClips(gsapAnimations) {
|
|
|
13658
14388
|
} else {
|
|
13659
14389
|
seen.current.source = gsapAnimations;
|
|
13660
14390
|
}
|
|
13661
|
-
const
|
|
13662
|
-
if (
|
|
13663
|
-
for (const key of
|
|
13664
|
-
expandClips(
|
|
14391
|
+
const fresh2 = freshLaneClips(gsapAnimations, seen.current.clips);
|
|
14392
|
+
if (fresh2.length === 0) return;
|
|
14393
|
+
for (const key of fresh2) seen.current.clips.add(key);
|
|
14394
|
+
expandClips(fresh2);
|
|
13665
14395
|
}, [gsapAnimations, expandClips, projectId]);
|
|
13666
14396
|
}
|
|
13667
14397
|
|
|
@@ -13813,9 +14543,9 @@ function ClipLintDot({ element }) {
|
|
|
13813
14543
|
}
|
|
13814
14544
|
);
|
|
13815
14545
|
}
|
|
13816
|
-
function ClipContentOnceShown({ hold, children }) {
|
|
13817
|
-
const [shown3, setShown] = useState13(!
|
|
13818
|
-
if (!shown3 && !
|
|
14546
|
+
function ClipContentOnceShown({ hold: hold2, children }) {
|
|
14547
|
+
const [shown3, setShown] = useState13(!hold2);
|
|
14548
|
+
if (!shown3 && !hold2) setShown(true);
|
|
13819
14549
|
return shown3 ? children : null;
|
|
13820
14550
|
}
|
|
13821
14551
|
function renderClipChildren(element, clipStyle, renderClipContent, renderClipOverlay, context = { priority: "visible", rich: false }) {
|
|
@@ -14089,11 +14819,11 @@ function useTimelinePerformanceTelemetry(context) {
|
|
|
14089
14819
|
// src/player/components/useTimelineShiftModifier.ts
|
|
14090
14820
|
function useTimelineShiftModifier(container) {
|
|
14091
14821
|
useMountEffect(() => {
|
|
14092
|
-
const
|
|
14822
|
+
const hold2 = (held2) => container.current?.toggleAttribute("data-shift-held", held2);
|
|
14093
14823
|
const handleKey = (event) => {
|
|
14094
|
-
if (event.key === "Shift")
|
|
14824
|
+
if (event.key === "Shift") hold2(event.type === "keydown");
|
|
14095
14825
|
};
|
|
14096
|
-
const handleBlur = () =>
|
|
14826
|
+
const handleBlur = () => hold2(false);
|
|
14097
14827
|
window.addEventListener("keydown", handleKey);
|
|
14098
14828
|
window.addEventListener("keyup", handleKey);
|
|
14099
14829
|
window.addEventListener("blur", handleBlur);
|
|
@@ -15363,11 +16093,11 @@ import { memo as memo18 } from "react";
|
|
|
15363
16093
|
import { memo as memo10 } from "react";
|
|
15364
16094
|
|
|
15365
16095
|
// src/player/components/useSettledScrollLeft.ts
|
|
15366
|
-
import { useCallback as useCallback24, useRef as useRef28, useSyncExternalStore as
|
|
16096
|
+
import { useCallback as useCallback24, useRef as useRef28, useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
15367
16097
|
function useSettledScrollLeft(scrollRef) {
|
|
15368
16098
|
const scrollingRef = useRef28(false);
|
|
15369
16099
|
const settledRef = useRef28(0);
|
|
15370
|
-
const
|
|
16100
|
+
const subscribe3 = useCallback24(
|
|
15371
16101
|
(onChange) => {
|
|
15372
16102
|
const el = scrollRef.current;
|
|
15373
16103
|
settledRef.current = el?.scrollLeft ?? 0;
|
|
@@ -15394,8 +16124,8 @@ function useSettledScrollLeft(scrollRef) {
|
|
|
15394
16124
|
},
|
|
15395
16125
|
[scrollRef]
|
|
15396
16126
|
);
|
|
15397
|
-
return
|
|
15398
|
-
|
|
16127
|
+
return useSyncExternalStore6(
|
|
16128
|
+
subscribe3,
|
|
15399
16129
|
() => scrollingRef.current ? null : settledRef.current,
|
|
15400
16130
|
() => null
|
|
15401
16131
|
);
|
|
@@ -16194,7 +16924,7 @@ import { memo as memo11, useCallback as useCallback27, useContext as useContext7
|
|
|
16194
16924
|
import { fadeGain } from "@hyperframes/core/audio-fade";
|
|
16195
16925
|
|
|
16196
16926
|
// src/hooks/useThumbnailLease.ts
|
|
16197
|
-
import { useCallback as useCallback25, useLayoutEffect as useLayoutEffect8, useRef as useRef30, useSyncExternalStore as
|
|
16927
|
+
import { useCallback as useCallback25, useLayoutEffect as useLayoutEffect8, useRef as useRef30, useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
16198
16928
|
var IDLE = Object.freeze({ status: "idle" });
|
|
16199
16929
|
function useThumbnailLease(request2, scheduler = thumbnailScheduler) {
|
|
16200
16930
|
const requestRef = useRef30(request2);
|
|
@@ -16202,7 +16932,7 @@ function useThumbnailLease(request2, scheduler = thumbnailScheduler) {
|
|
|
16202
16932
|
const leaseRef = useRef30(null);
|
|
16203
16933
|
const identity = request2 ? createThumbnailRequestIdentity(request2) : null;
|
|
16204
16934
|
const priority = request2?.priority;
|
|
16205
|
-
const
|
|
16935
|
+
const subscribe3 = useCallback25(
|
|
16206
16936
|
(listener2) => {
|
|
16207
16937
|
const current2 = requestRef.current;
|
|
16208
16938
|
if (!current2 || identity === null) return () => {
|
|
@@ -16223,7 +16953,7 @@ function useThumbnailLease(request2, scheduler = thumbnailScheduler) {
|
|
|
16223
16953
|
useLayoutEffect8(() => {
|
|
16224
16954
|
if (priority) leaseRef.current?.updatePriority(priority);
|
|
16225
16955
|
}, [priority]);
|
|
16226
|
-
return
|
|
16956
|
+
return useSyncExternalStore7(subscribe3, getSnapshot, () => IDLE);
|
|
16227
16957
|
}
|
|
16228
16958
|
|
|
16229
16959
|
// src/hooks/useThumbnailStripSize.ts
|
|
@@ -16263,7 +16993,7 @@ var isNear = ({
|
|
|
16263
16993
|
}) => left < innerWidth + NEAR_PX && left + width > -NEAR_PX && top < innerHeight + NEAR_PX && top + height > -NEAR_PX;
|
|
16264
16994
|
var NOTHING_IN_VIEW = { inViewStart: 0, inViewEnd: 0 };
|
|
16265
16995
|
var spanOf = (box) => isNear(box) ? spanAt(box.left) : NOTHING_IN_VIEW;
|
|
16266
|
-
var
|
|
16996
|
+
var read2 = (target, strip) => {
|
|
16267
16997
|
const { left, top, width, height } = target.getBoundingClientRect();
|
|
16268
16998
|
strip.box = { left, top, width, height };
|
|
16269
16999
|
strip.readAt = offsetOf(strip.scroller);
|
|
@@ -16276,7 +17006,7 @@ var remeasureAfterPreview = () => {
|
|
|
16276
17006
|
[...strips].map(
|
|
16277
17007
|
([target, strip]) => [
|
|
16278
17008
|
strip.apply,
|
|
16279
|
-
{ width: target.clientWidth, height: target.clientHeight, ...
|
|
17009
|
+
{ width: target.clientWidth, height: target.clientHeight, ...read2(target, strip) }
|
|
16280
17010
|
]
|
|
16281
17011
|
)
|
|
16282
17012
|
);
|
|
@@ -16297,7 +17027,7 @@ var refresh = () => {
|
|
|
16297
17027
|
width: box.width,
|
|
16298
17028
|
height: box.height
|
|
16299
17029
|
};
|
|
16300
|
-
if (strip.showing || isNear(moved)) updates.push([strip.apply,
|
|
17030
|
+
if (strip.showing || isNear(moved)) updates.push([strip.apply, read2(target, strip)]);
|
|
16301
17031
|
}
|
|
16302
17032
|
commit(updates);
|
|
16303
17033
|
};
|
|
@@ -16307,7 +17037,7 @@ var scheduleRefresh = () => {
|
|
|
16307
17037
|
var measure = (entries) => isTimelineZoomPreviewing() || commit(
|
|
16308
17038
|
entries.flatMap(({ target, size }) => {
|
|
16309
17039
|
const strip = strips.get(target);
|
|
16310
|
-
return strip ? [[strip.apply, { ...size, ...
|
|
17040
|
+
return strip ? [[strip.apply, { ...size, ...read2(target, strip) }]] : [];
|
|
16311
17041
|
})
|
|
16312
17042
|
);
|
|
16313
17043
|
var onPresence = (entries) => measure(entries.filter((entry3) => entry3.isIntersecting));
|
|
@@ -16385,7 +17115,7 @@ function useThumbnailStripSize() {
|
|
|
16385
17115
|
showing: false
|
|
16386
17116
|
};
|
|
16387
17117
|
strips.set(target, strip);
|
|
16388
|
-
apply({ width: target.clientWidth, height: target.clientHeight, ...
|
|
17118
|
+
apply({ width: target.clientWidth, height: target.clientHeight, ...read2(target, strip) });
|
|
16389
17119
|
resize.observe(target);
|
|
16390
17120
|
presence?.observe(target);
|
|
16391
17121
|
return () => {
|
|
@@ -16961,21 +17691,6 @@ import { HF_AUDIO_CARVE_ATTR } from "@hyperframes/core/audio-carve";
|
|
|
16961
17691
|
import { HF_AUDIO_FX_ATTR } from "@hyperframes/core/audio-fx";
|
|
16962
17692
|
import { HF_COLOR_GRADING_ATTR } from "@hyperframes/core/color-grading";
|
|
16963
17693
|
|
|
16964
|
-
// src/player/store/previewIframeStore.ts
|
|
16965
|
-
import { create as create3 } from "zustand";
|
|
16966
|
-
var usePreviewIframeStore = create3((set) => ({
|
|
16967
|
-
iframe: null,
|
|
16968
|
-
// Return the same state reference on a no-op set so zustand skips the
|
|
16969
|
-
// notify (Object.is check in setState) instead of merging a new object
|
|
16970
|
-
// every time a caller re-pushes the current value.
|
|
16971
|
-
setIframe: (iframe) => set((state) => Object.is(state.iframe, iframe) ? state : { iframe })
|
|
16972
|
-
}));
|
|
16973
|
-
var useLivePreviewIframe = () => usePreviewIframeStore((s) => s.iframe);
|
|
16974
|
-
function useOwnPreviewIframe() {
|
|
16975
|
-
useMountEffect(() => () => usePreviewIframeStore.getState().setIframe(null));
|
|
16976
|
-
return useLivePreviewIframe();
|
|
16977
|
-
}
|
|
16978
|
-
|
|
16979
17694
|
// src/hooks/timelineEditingHelpers.ts
|
|
16980
17695
|
import { isHtmlElement as isHtmlElement4 } from "@hyperframes/core/runtime/dom-realm";
|
|
16981
17696
|
import { applyAuthoredTiming } from "@hyperframes/core/studio-preview-mark";
|
|
@@ -17695,11 +18410,11 @@ function fileDocs(ownFile, written, nestedFiles) {
|
|
|
17695
18410
|
|
|
17696
18411
|
// src/utils/gsapSoftReload.ts
|
|
17697
18412
|
var pendingReadyRetry = null;
|
|
17698
|
-
function previewMotionPathUrl(doc,
|
|
18413
|
+
function previewMotionPathUrl(doc, version2) {
|
|
17699
18414
|
const baseUrl = doc.head.querySelector(
|
|
17700
18415
|
`meta[name="${GSAP_BASE_URL_META}"]`
|
|
17701
18416
|
)?.content;
|
|
17702
|
-
return motionPathPluginUrl(
|
|
18417
|
+
return motionPathPluginUrl(version2, baseUrl);
|
|
17703
18418
|
}
|
|
17704
18419
|
function ensureMotionPathPluginLoaded(iframe) {
|
|
17705
18420
|
if (pendingReadyRetry) window.removeEventListener("message", pendingReadyRetry);
|
|
@@ -18060,10 +18775,10 @@ async function postOwnedGsapMutation(route, projectId, filePath, body, fallback)
|
|
|
18060
18775
|
cause: error
|
|
18061
18776
|
});
|
|
18062
18777
|
}
|
|
18063
|
-
const
|
|
18778
|
+
const held2 = response.ok ? null : await heldFileWordsOf(response, filePath);
|
|
18064
18779
|
const payload = await response.json().catch(() => null);
|
|
18065
18780
|
if (!response.ok) {
|
|
18066
|
-
throw new GsapPreviewConvergenceError(
|
|
18781
|
+
throw new GsapPreviewConvergenceError(held2 ?? readMutationError(payload, fallback));
|
|
18067
18782
|
}
|
|
18068
18783
|
return readMutationStatus(payload);
|
|
18069
18784
|
}
|
|
@@ -20225,11 +20940,11 @@ function computeSinglePointMove(input) {
|
|
|
20225
20940
|
}
|
|
20226
20941
|
const floor = (lane.points[dragIndex - 1]?.t ?? -Infinity) + MIN_POINT_GAP_SEC;
|
|
20227
20942
|
const ceiling = (lane.points[dragIndex + 1]?.t ?? Infinity) - MIN_POINT_GAP_SEC;
|
|
20228
|
-
const
|
|
20943
|
+
const held2 = lane.points[dragIndex]?.t ?? t2;
|
|
20229
20944
|
t2 = ceiling >= floor ? Math.min(ceiling, Math.max(floor, Math.min(duration, Math.max(0, t2)))) : (
|
|
20230
20945
|
// Neighbours closer together than the gap leave nowhere to go, so the
|
|
20231
20946
|
// point stays where it is rather than being flung to one side.
|
|
20232
|
-
|
|
20947
|
+
held2
|
|
20233
20948
|
);
|
|
20234
20949
|
return { t: t2, v, shiftAxis };
|
|
20235
20950
|
}
|
|
@@ -26503,7 +27218,7 @@ var DUCK_TOAST = {
|
|
|
26503
27218
|
};
|
|
26504
27219
|
function usePreviewDocument(iframe) {
|
|
26505
27220
|
const sealed = iframe !== null && previewFrameOpaque(iframe);
|
|
26506
|
-
const [
|
|
27221
|
+
const [read3, setRead] = useState33(null);
|
|
26507
27222
|
useEffect35(() => {
|
|
26508
27223
|
if (!iframe || !sealed) return;
|
|
26509
27224
|
let current2 = true;
|
|
@@ -26513,7 +27228,7 @@ function usePreviewDocument(iframe) {
|
|
|
26513
27228
|
};
|
|
26514
27229
|
}, [iframe, sealed]);
|
|
26515
27230
|
if (!sealed) return { doc: iframe?.contentDocument ?? null, copy: null };
|
|
26516
|
-
const copy =
|
|
27231
|
+
const copy = read3?.iframe === iframe ? read3.doc : null;
|
|
26517
27232
|
return { doc: copy, copy };
|
|
26518
27233
|
}
|
|
26519
27234
|
function voiceGrouper(onGroupClips, copy) {
|
|
@@ -28055,12 +28770,12 @@ async function open(source, pooled) {
|
|
|
28055
28770
|
const info = { aspect: displayWidth / displayHeight, metadataDuration };
|
|
28056
28771
|
return { mediabunny, track: track2, info, etag: options.etagOf() };
|
|
28057
28772
|
}
|
|
28058
|
-
function pooledSource(source,
|
|
28773
|
+
function pooledSource(source, version2) {
|
|
28059
28774
|
const current2 = pool.get(source);
|
|
28060
|
-
if (current2 && current2.version ===
|
|
28775
|
+
if (current2 && current2.version === version2) return current2;
|
|
28061
28776
|
if (current2) retire(source, current2);
|
|
28062
28777
|
const entry3 = {
|
|
28063
|
-
version,
|
|
28778
|
+
version: version2,
|
|
28064
28779
|
input: null,
|
|
28065
28780
|
cancelReads: null,
|
|
28066
28781
|
ready: false,
|
|
@@ -28085,8 +28800,8 @@ function untilAborted(pending2, signal) {
|
|
|
28085
28800
|
void pending2.then(resolve2, reject).finally(() => signal.removeEventListener("abort", onAbort));
|
|
28086
28801
|
});
|
|
28087
28802
|
}
|
|
28088
|
-
async function acquireThumbnailSource(source,
|
|
28089
|
-
const entry3 = pooledSource(source,
|
|
28803
|
+
async function acquireThumbnailSource(source, version2, signal, idleMs) {
|
|
28804
|
+
const entry3 = pooledSource(source, version2);
|
|
28090
28805
|
const waitedForOpen = !entry3.ready;
|
|
28091
28806
|
entry3.users += 1;
|
|
28092
28807
|
if (entry3.idleTimer !== null) clearTimeout(entry3.idleTimer);
|
|
@@ -28144,8 +28859,8 @@ function evict(frame3, key) {
|
|
|
28144
28859
|
else sharedFrames.delete(key);
|
|
28145
28860
|
URL.revokeObjectURL(frame3.url);
|
|
28146
28861
|
}
|
|
28147
|
-
function releaseSharedFrames(
|
|
28148
|
-
for (const { key, frame: frame3 } of
|
|
28862
|
+
function releaseSharedFrames(held2, budgetBytes) {
|
|
28863
|
+
for (const { key, frame: frame3 } of held2.splice(0)) {
|
|
28149
28864
|
if (--frame3.users > 0) continue;
|
|
28150
28865
|
released.set(frame3, key);
|
|
28151
28866
|
releasedBytes += frame3.bytes;
|
|
@@ -28467,20 +29182,20 @@ async function takeStoredFrames({ timestamps, window: window2 }, slots, keyOf17,
|
|
|
28467
29182
|
}
|
|
28468
29183
|
function versionRead(request2, source) {
|
|
28469
29184
|
if (!source.etag) return void 0;
|
|
28470
|
-
const
|
|
28471
|
-
storedVersions.set(openOf(request2), Promise.resolve(
|
|
28472
|
-
return
|
|
29185
|
+
const version2 = { source: request2.source, etag: source.etag };
|
|
29186
|
+
storedVersions.set(openOf(request2), Promise.resolve(version2));
|
|
29187
|
+
return version2;
|
|
28473
29188
|
}
|
|
28474
|
-
function storeForNextSession(request2, info, budgets, resources,
|
|
28475
|
-
if (!
|
|
28476
|
-
const id = `${
|
|
29189
|
+
function storeForNextSession(request2, info, budgets, resources, version2) {
|
|
29190
|
+
if (!version2) return;
|
|
29191
|
+
const id = `${version2.source}\0${version2.etag}`;
|
|
28477
29192
|
if (!storedInfos.has(id)) {
|
|
28478
29193
|
storedInfos.add(id);
|
|
28479
|
-
void rememberVersion(
|
|
29194
|
+
void rememberVersion(version2).then(() => storeInfo(version2, info));
|
|
28480
29195
|
}
|
|
28481
29196
|
const nameOf = storedFrameName(request2.fit ?? "cover", info, budgets);
|
|
28482
29197
|
const { timestamps } = stripTimes(request2, info, budgets);
|
|
28483
|
-
resources.store = (slot, decodedAt, blob) => void storeFrame(
|
|
29198
|
+
resources.store = (slot, decodedAt, blob) => void storeFrame(version2, nameOf(timestamps[slot]), decodedAt, blob);
|
|
28484
29199
|
}
|
|
28485
29200
|
async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPORT_BUDGETS) {
|
|
28486
29201
|
const fit = request2.fit ?? "cover";
|
|
@@ -30484,13 +31199,13 @@ function useTimelineSyncCallbacks({
|
|
|
30484
31199
|
if (!data.clips) return;
|
|
30485
31200
|
usePlayerStore.getState().setClipManifest(data.clips);
|
|
30486
31201
|
const iframe = iframeRef.current;
|
|
30487
|
-
const
|
|
31202
|
+
const read3 = ++timelineReads.current;
|
|
30488
31203
|
if (!iframe || !previewFrameOpaque(iframe)) {
|
|
30489
31204
|
applyTimelineMessage(data, safeContentDocument(iframe));
|
|
30490
31205
|
return;
|
|
30491
31206
|
}
|
|
30492
31207
|
void previewDocumentCopy(iframe).then((doc) => {
|
|
30493
|
-
if (
|
|
31208
|
+
if (read3 === timelineReads.current && iframeRef.current === iframe)
|
|
30494
31209
|
applyTimelineMessage(data, doc);
|
|
30495
31210
|
});
|
|
30496
31211
|
},
|
|
@@ -30764,10 +31479,10 @@ function endsIn(tween, prop) {
|
|
|
30764
31479
|
const pair = [pt.s, pt.s + pt.c];
|
|
30765
31480
|
return tween._from ? [pair[1], pair[0]] : pair;
|
|
30766
31481
|
}
|
|
30767
|
-
function withParsedStart(
|
|
31482
|
+
function withParsedStart(read3, live) {
|
|
30768
31483
|
const tween = live;
|
|
30769
|
-
const first =
|
|
30770
|
-
if (!Array.isArray(tween.vars?.keyframes) && !((first?.percentage ?? 0) > 0)) return
|
|
31484
|
+
const first = read3.keyframes[0];
|
|
31485
|
+
if (!Array.isArray(tween.vars?.keyframes) && !((first?.percentage ?? 0) > 0)) return read3;
|
|
30771
31486
|
const children = tween.timeline?.getChildren?.() ?? [tween];
|
|
30772
31487
|
const start = {};
|
|
30773
31488
|
for (const prop of ["x", "y", "width", "height"]) {
|
|
@@ -30775,26 +31490,29 @@ function withParsedStart(read2, live) {
|
|
|
30775
31490
|
if (ends) start[prop] = ends[0];
|
|
30776
31491
|
}
|
|
30777
31492
|
const moved = Object.entries(start).some(([prop, value]) => value !== first?.properties[prop]);
|
|
30778
|
-
return moved ? { ...
|
|
31493
|
+
return moved ? { ...read3, start } : read3;
|
|
30779
31494
|
}
|
|
30780
31495
|
function findParsedTween(iframe, element, anim) {
|
|
30781
|
-
if (!iframe
|
|
30782
|
-
const
|
|
31496
|
+
if (!iframe) return null;
|
|
31497
|
+
const sealed = previewFrameOpaque(iframe);
|
|
31498
|
+
const win = sealed ? null : iframe.contentWindow;
|
|
31499
|
+
const timelines = sealed ? frameTimelines(iframe) : win?.__timelines;
|
|
31500
|
+
const target = sealed ? frameTarget(iframe, element) : element;
|
|
30783
31501
|
const start = resolveTweenStart(anim);
|
|
30784
|
-
if (!
|
|
31502
|
+
if (!timelines || !target || start == null) return null;
|
|
30785
31503
|
const steps = anim.keyframes?.keyframes.map((kf) => kf.properties) ?? [anim.properties];
|
|
30786
31504
|
const props = [...new Set(steps.flatMap((step) => Object.keys(step)))];
|
|
30787
31505
|
const keyframed = Boolean(anim.keyframes);
|
|
30788
|
-
for (const timeline of Object.values(
|
|
31506
|
+
for (const timeline of Object.values(timelines)) {
|
|
30789
31507
|
for (const tween of timeline?.getChildren?.(true) ?? []) {
|
|
30790
31508
|
const targets = tween.targets?.() ?? [];
|
|
30791
|
-
if (!targets.includes(
|
|
31509
|
+
if (!targets.includes(target) && !targets.some((t2) => target.id && t2.id === target.id))
|
|
30792
31510
|
continue;
|
|
30793
31511
|
if (!startsAt(tween, start)) continue;
|
|
30794
31512
|
const vars = tween.vars ?? {};
|
|
30795
31513
|
const carries = keyframed ? "keyframes" in vars : props.some((p) => p in vars);
|
|
30796
31514
|
if (!carries || !((tween.duration?.() ?? 0) > 0)) continue;
|
|
30797
|
-
parseUnplayed(win, element, tween, props);
|
|
31515
|
+
if (win) parseUnplayed(win, element, tween, props);
|
|
30798
31516
|
return tween;
|
|
30799
31517
|
}
|
|
30800
31518
|
}
|
|
@@ -30813,7 +31531,7 @@ function withLiveTiming(anim, tween) {
|
|
|
30813
31531
|
};
|
|
30814
31532
|
}
|
|
30815
31533
|
function parseUnplayed(win, element, tween, props) {
|
|
30816
|
-
const seek = !
|
|
31534
|
+
const seek = !isParsed2(tween) && seekable(win, tween);
|
|
30817
31535
|
if (!seek) return;
|
|
30818
31536
|
const { parent, gsap: gsap3 } = seek;
|
|
30819
31537
|
const before = layerStates(tween, element);
|
|
@@ -30829,7 +31547,7 @@ function parseUnplayed(win, element, tween, props) {
|
|
|
30829
31547
|
restore(before);
|
|
30830
31548
|
}
|
|
30831
31549
|
}
|
|
30832
|
-
function
|
|
31550
|
+
function isParsed2(tween) {
|
|
30833
31551
|
const parts = tween.timeline?.getChildren?.() ?? [];
|
|
30834
31552
|
return Boolean(tween._initted) && parts.every((part) => part._initted);
|
|
30835
31553
|
}
|
|
@@ -30886,8 +31604,10 @@ function partsFrom(tween, end) {
|
|
|
30886
31604
|
}
|
|
30887
31605
|
function parsedTweenEase(iframe, tween) {
|
|
30888
31606
|
if (!tween) return null;
|
|
30889
|
-
const
|
|
30890
|
-
const
|
|
31607
|
+
const sealed = iframe ? previewFrameOpaque(iframe) : false;
|
|
31608
|
+
const win = sealed ? null : iframe?.contentWindow;
|
|
31609
|
+
const fallback = sealed ? frameDefaultEase(iframe) : win?.gsap?.defaults?.().ease;
|
|
31610
|
+
const ease = tween.vars?.ease ?? tween.parent?.vars?.defaults?.ease ?? fallback;
|
|
30891
31611
|
if (typeof ease === "string") return ease;
|
|
30892
31612
|
const named = (name) => win?.gsap?.parseEase?.(name) === ease;
|
|
30893
31613
|
return typeof ease === "function" ? BUILT_IN_EASES.find(named) ?? null : null;
|
|
@@ -31078,6 +31798,17 @@ function timelinesOf(iframe) {
|
|
|
31078
31798
|
return null;
|
|
31079
31799
|
}
|
|
31080
31800
|
}
|
|
31801
|
+
function readableTimelines(iframe) {
|
|
31802
|
+
return iframe && previewFrameOpaque(iframe) ? frameTimelines(iframe) : timelinesOf(iframe);
|
|
31803
|
+
}
|
|
31804
|
+
function readableTarget(iframe, selector) {
|
|
31805
|
+
if (iframe && previewFrameOpaque(iframe)) return frameQuery(iframe, selector);
|
|
31806
|
+
try {
|
|
31807
|
+
return iframe?.contentDocument?.querySelector(selector) ?? null;
|
|
31808
|
+
} catch {
|
|
31809
|
+
return null;
|
|
31810
|
+
}
|
|
31811
|
+
}
|
|
31081
31812
|
function isZeroDurationSet(duration) {
|
|
31082
31813
|
return !(duration > 0);
|
|
31083
31814
|
}
|
|
@@ -31173,18 +31904,13 @@ function resolveRuntimeTween(iframe, selector, kind, compositionId, channels) {
|
|
|
31173
31904
|
}
|
|
31174
31905
|
return channelMatch ?? first;
|
|
31175
31906
|
}
|
|
31176
|
-
function readCarriesChannel(
|
|
31177
|
-
return
|
|
31907
|
+
function readCarriesChannel(read3, channels) {
|
|
31908
|
+
return read3.keyframes.some((kf) => channels.some((c) => kf.properties[c] != null));
|
|
31178
31909
|
}
|
|
31179
31910
|
function readRuntimeKeyframes(iframe, selector, compositionId, requireChannels) {
|
|
31180
|
-
const timelines =
|
|
31911
|
+
const timelines = readableTimelines(iframe);
|
|
31181
31912
|
if (!timelines) return null;
|
|
31182
|
-
|
|
31183
|
-
try {
|
|
31184
|
-
targetEl = iframe?.contentDocument?.querySelector(selector) ?? null;
|
|
31185
|
-
} catch {
|
|
31186
|
-
return null;
|
|
31187
|
-
}
|
|
31913
|
+
const targetEl = readableTarget(iframe, selector);
|
|
31188
31914
|
if (!targetEl) return null;
|
|
31189
31915
|
const tlIds = compositionId ? [compositionId] : Object.keys(timelines).filter((k) => typeof timelines[k]?.getChildren === "function");
|
|
31190
31916
|
if (tlIds.length === 0) return null;
|
|
@@ -31197,26 +31923,21 @@ function readRuntimeKeyframes(iframe, selector, compositionId, requireChannels)
|
|
|
31197
31923
|
if (!tween.vars || !matchesElement(tween, targetEl)) continue;
|
|
31198
31924
|
const dur = typeof tween.duration === "function" ? tween.duration() : 0;
|
|
31199
31925
|
if (isZeroDurationSet(dur)) continue;
|
|
31200
|
-
const
|
|
31201
|
-
if (!
|
|
31202
|
-
if (requireChannels && !readCarriesChannel(
|
|
31203
|
-
if (firstRead === null) firstRead = withParsedStart(
|
|
31926
|
+
const read3 = readTween(tween.vars);
|
|
31927
|
+
if (!read3) continue;
|
|
31928
|
+
if (requireChannels && !readCarriesChannel(read3, requireChannels)) continue;
|
|
31929
|
+
if (firstRead === null) firstRead = withParsedStart(read3, tween);
|
|
31204
31930
|
if (now2 != null) {
|
|
31205
31931
|
const start = typeof tween.startTime === "function" ? tween.startTime() : 0;
|
|
31206
|
-
if (now2 >= start - 1e-3 && now2 <= start + dur + 1e-3) return withParsedStart(
|
|
31932
|
+
if (now2 >= start - 1e-3 && now2 <= start + dur + 1e-3) return withParsedStart(read3, tween);
|
|
31207
31933
|
}
|
|
31208
31934
|
}
|
|
31209
31935
|
}
|
|
31210
31936
|
return firstRead;
|
|
31211
31937
|
}
|
|
31212
31938
|
function hasNonHoldTweenForElement(iframe, selector, compositionId, channels) {
|
|
31213
|
-
|
|
31214
|
-
|
|
31215
|
-
targetEl = iframe?.contentDocument?.querySelector(selector) ?? null;
|
|
31216
|
-
} catch {
|
|
31217
|
-
return false;
|
|
31218
|
-
}
|
|
31219
|
-
return !!targetEl && hasNonHoldTween(timelinesOf(iframe), targetEl, channels, compositionId);
|
|
31939
|
+
const targetEl = readableTarget(iframe, selector);
|
|
31940
|
+
return !!targetEl && hasNonHoldTween(readableTimelines(iframe), targetEl, channels, compositionId);
|
|
31220
31941
|
}
|
|
31221
31942
|
var POSITION_CHANNELS = [
|
|
31222
31943
|
"x",
|
|
@@ -31289,43 +32010,43 @@ function hasNonHoldTween(timelines, targetEl, channels, compositionId) {
|
|
|
31289
32010
|
const dur = typeof tween.duration === "function" ? tween.duration() : 0;
|
|
31290
32011
|
if (isZeroDurationSet(dur)) continue;
|
|
31291
32012
|
if (channels && keyframeVarsCarryChannel(tween.vars, channels)) return true;
|
|
31292
|
-
const
|
|
31293
|
-
if (
|
|
32013
|
+
const read3 = readTween(tween.vars);
|
|
32014
|
+
if (read3 && (!channels || readCarriesChannel(read3, channels))) return true;
|
|
31294
32015
|
}
|
|
31295
32016
|
}
|
|
31296
32017
|
return false;
|
|
31297
32018
|
}
|
|
31298
|
-
function toClipRelative(
|
|
31299
|
-
const { keyframes, runEase } =
|
|
32019
|
+
function toClipRelative(read3, tweenStart, tweenDuration, clip) {
|
|
32020
|
+
const { keyframes, runEase } = read3;
|
|
31300
32021
|
if (!clip || clip.duration <= 0) return keyframes;
|
|
31301
32022
|
return keyframes.map((kf) => {
|
|
31302
32023
|
const abs = toAbsoluteTime(tweenStart, tweenDuration, timeAtProgress(runEase, kf.percentage));
|
|
31303
32024
|
return { ...kf, percentage: Math.round((abs - clip.start) / clip.duration * 1e5) / 1e3 };
|
|
31304
32025
|
});
|
|
31305
32026
|
}
|
|
31306
|
-
function buildEntry(
|
|
32027
|
+
function buildEntry(read3, start, duration, clip) {
|
|
31307
32028
|
return {
|
|
31308
|
-
keyframes: toClipRelative(
|
|
32029
|
+
keyframes: toClipRelative(read3, start, duration, clip),
|
|
31309
32030
|
tweenStart: start,
|
|
31310
32031
|
tweenDuration: duration,
|
|
31311
|
-
...
|
|
31312
|
-
...
|
|
32032
|
+
...read3.easeEach ? { easeEach: read3.easeEach } : {},
|
|
32033
|
+
...read3.arcPath ? { arcPath: read3.arcPath } : {}
|
|
31313
32034
|
};
|
|
31314
32035
|
}
|
|
31315
32036
|
function addScanEntry(result, tween, clipById) {
|
|
31316
32037
|
if (!tween.targets || !tween.vars) return;
|
|
31317
32038
|
const { start, duration } = tweenTiming(tween);
|
|
31318
32039
|
if (isZeroDurationSet(duration)) return;
|
|
31319
|
-
const
|
|
31320
|
-
if (!
|
|
32040
|
+
const read3 = readTween(tween.vars);
|
|
32041
|
+
if (!read3) return;
|
|
31321
32042
|
for (const target of tween.targets()) {
|
|
31322
32043
|
const id = target.id;
|
|
31323
|
-
if (id && !result.has(id)) result.set(id, buildEntry(
|
|
32044
|
+
if (id && !result.has(id)) result.set(id, buildEntry(read3, start, duration, clipById?.get(id)));
|
|
31324
32045
|
}
|
|
31325
32046
|
}
|
|
31326
32047
|
function scanAllRuntimeKeyframes(iframe, clipById) {
|
|
31327
32048
|
const result = /* @__PURE__ */ new Map();
|
|
31328
|
-
const timelines =
|
|
32049
|
+
const timelines = readableTimelines(iframe);
|
|
31329
32050
|
if (!timelines) return result;
|
|
31330
32051
|
for (const timeline of Object.values(timelines)) {
|
|
31331
32052
|
if (!timeline?.getChildren) continue;
|
|
@@ -31928,13 +32649,13 @@ function useShadowPreviewReload({
|
|
|
31928
32649
|
release2?.();
|
|
31929
32650
|
}, []);
|
|
31930
32651
|
const restoreLive = useCallback40(
|
|
31931
|
-
(
|
|
32652
|
+
(held2) => {
|
|
31932
32653
|
dropRestoring();
|
|
31933
|
-
setPreviewSlots([
|
|
31934
|
-
pendingSeekRef.current =
|
|
31935
|
-
restoringRef.current =
|
|
32654
|
+
setPreviewSlots([held2.liveSlot]);
|
|
32655
|
+
pendingSeekRef.current = held2.time;
|
|
32656
|
+
restoringRef.current = held2.release;
|
|
31936
32657
|
setTimeout(() => {
|
|
31937
|
-
if (restoringRef.current ===
|
|
32658
|
+
if (restoringRef.current === held2.release) dropRestoring();
|
|
31938
32659
|
}, SHADOW_READY_TIMEOUT_MS);
|
|
31939
32660
|
},
|
|
31940
32661
|
[pendingSeekRef, dropRestoring]
|
|
@@ -31964,9 +32685,9 @@ function useShadowPreviewReload({
|
|
|
31964
32685
|
shadowIframeRef.current = null;
|
|
31965
32686
|
isRefreshingRef.current = false;
|
|
31966
32687
|
pendingSeekRef.current = null;
|
|
31967
|
-
const
|
|
32688
|
+
const held2 = heldRef.current;
|
|
31968
32689
|
heldRef.current = null;
|
|
31969
|
-
if (
|
|
32690
|
+
if (held2) restoreLive(held2);
|
|
31970
32691
|
else setPreviewSlots(planShadowDiscard);
|
|
31971
32692
|
setPreviewReloading(false);
|
|
31972
32693
|
const message = `The preview did not reload (${cause}). It was still waiting for ${waitingFor}.${got} The previous preview is still showing.`;
|
|
@@ -32029,11 +32750,11 @@ function useShadowPreviewReload({
|
|
|
32029
32750
|
if (!promotable || heldOrStale(gen)) return;
|
|
32030
32751
|
const { shadow, pending: pending2 } = promotable;
|
|
32031
32752
|
stopPendingShadow();
|
|
32032
|
-
const
|
|
32753
|
+
const held2 = heldRef.current;
|
|
32033
32754
|
heldRef.current = null;
|
|
32034
32755
|
const live = getAdapter();
|
|
32035
|
-
const liveTime2 =
|
|
32036
|
-
const playing =
|
|
32756
|
+
const liveTime2 = held2 ? held2.time : live?.getTime();
|
|
32757
|
+
const playing = held2 ? held2.playing : usePlayerStore.getState().isPlaying;
|
|
32037
32758
|
live?.pause();
|
|
32038
32759
|
const retired = iframeRef.current;
|
|
32039
32760
|
iframeRef.current = shadow;
|
|
@@ -32044,7 +32765,7 @@ function useShadowPreviewReload({
|
|
|
32044
32765
|
applyPreviewAudioState();
|
|
32045
32766
|
setPreviewSlots((prev) => planShadowPromotion(prev, gen));
|
|
32046
32767
|
if (liveTime2 != null) handOverPlaybackRef.current(liveTime2, playing);
|
|
32047
|
-
if (
|
|
32768
|
+
if (held2) releaseAfterPaint(shadow, held2.release);
|
|
32048
32769
|
announcePreviewPromoted({ retired, live: shadow });
|
|
32049
32770
|
onPromotedRef.current?.();
|
|
32050
32771
|
setPreviewReloading(false);
|
|
@@ -32217,13 +32938,13 @@ function useShadowPreviewReload({
|
|
|
32217
32938
|
isRefreshingRef.current = false;
|
|
32218
32939
|
pendingSeekRef.current = null;
|
|
32219
32940
|
usePlayerStore.getState().setTimelineReady(false);
|
|
32220
|
-
const
|
|
32941
|
+
const held2 = heldRef.current;
|
|
32221
32942
|
heldRef.current = null;
|
|
32222
32943
|
holdingUrlRef.current = null;
|
|
32223
32944
|
holdTokenRef.current += 1;
|
|
32224
32945
|
dropRestoring();
|
|
32225
|
-
setPreviewSlots(
|
|
32226
|
-
|
|
32946
|
+
setPreviewSlots(held2 ? [held2.liveSlot] : planShadowDiscard);
|
|
32947
|
+
held2?.release();
|
|
32227
32948
|
setPreviewReloading(false);
|
|
32228
32949
|
}, [retry, stopPendingShadow, isRefreshingRef, pendingSeekRef, dropRestoring]);
|
|
32229
32950
|
useMountEffect(() => {
|
|
@@ -33443,6 +34164,13 @@ var useAssetPreviewStore = create7((set) => ({
|
|
|
33443
34164
|
|
|
33444
34165
|
// src/components/nle/NLEContext.tsx
|
|
33445
34166
|
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
34167
|
+
async function hostCompositionSrc(iframe, compId) {
|
|
34168
|
+
const selector = `[data-composition-id="${CSS.escape(compId)}"][data-composition-src]`;
|
|
34169
|
+
const handle = (await queryPreviewElements(iframe, selector))?.matches[0]?.handle;
|
|
34170
|
+
if (!handle) return void 0;
|
|
34171
|
+
const [host] = await describePreviewElements(iframe, [handle]) ?? [];
|
|
34172
|
+
return host?.attributes.find(([name]) => name === "data-composition-src")?.[1] || void 0;
|
|
34173
|
+
}
|
|
33446
34174
|
function shouldDisableTimelineWhileCompositionLoading(compositionLoading) {
|
|
33447
34175
|
return compositionLoading;
|
|
33448
34176
|
}
|
|
@@ -33526,25 +34254,12 @@ function NLEProvider({
|
|
|
33526
34254
|
if (!element.compositionSrc) return;
|
|
33527
34255
|
usePlayerStore.getState().setSelectedElementId(null);
|
|
33528
34256
|
const compId = element.id;
|
|
33529
|
-
|
|
33530
|
-
|
|
33531
|
-
|
|
33532
|
-
|
|
33533
|
-
|
|
33534
|
-
|
|
33535
|
-
`[data-composition-id="${CSS.escape(compId)}"][data-composition-src]`
|
|
33536
|
-
);
|
|
33537
|
-
if (host) {
|
|
33538
|
-
resolvedPath = host.getAttribute("data-composition-src") || void 0;
|
|
33539
|
-
}
|
|
33540
|
-
}
|
|
33541
|
-
} catch {
|
|
33542
|
-
}
|
|
33543
|
-
}
|
|
33544
|
-
drillDown({
|
|
33545
|
-
id: compId,
|
|
33546
|
-
compositionSrc: resolvedPath ?? element.compositionSrc
|
|
33547
|
-
});
|
|
34257
|
+
const known = compIdToSrc.get(compId);
|
|
34258
|
+
const iframe = iframeRef_.current;
|
|
34259
|
+
const resolve2 = known || !iframe ? Promise.resolve(known) : hostCompositionSrc(iframe, compId);
|
|
34260
|
+
void resolve2.then(
|
|
34261
|
+
(resolvedPath) => drillDown({ id: compId, compositionSrc: resolvedPath ?? element.compositionSrc })
|
|
34262
|
+
);
|
|
33548
34263
|
},
|
|
33549
34264
|
[compIdToSrc, drillDown, iframeRef_]
|
|
33550
34265
|
);
|
|
@@ -33690,7 +34405,7 @@ function usePlayerHandle() {
|
|
|
33690
34405
|
},
|
|
33691
34406
|
[ready, seekPlayer]
|
|
33692
34407
|
);
|
|
33693
|
-
const
|
|
34408
|
+
const subscribe3 = useCallback45((listener2) => {
|
|
33694
34409
|
let previous = usePlayerStore.getState();
|
|
33695
34410
|
return usePlayerStore.subscribe((state) => {
|
|
33696
34411
|
const structuralChange = state.timelineReady !== previous.timelineReady || state.isPlaying !== previous.isPlaying || state.duration !== previous.duration || state.elements !== previous.elements;
|
|
@@ -33714,13 +34429,21 @@ function usePlayerHandle() {
|
|
|
33714
34429
|
},
|
|
33715
34430
|
duration,
|
|
33716
34431
|
elements: handleElements,
|
|
33717
|
-
subscribe:
|
|
34432
|
+
subscribe: subscribe3,
|
|
33718
34433
|
subscribeTime
|
|
33719
34434
|
};
|
|
33720
34435
|
}
|
|
33721
34436
|
|
|
33722
34437
|
// src/utils/previewCompositionSize.ts
|
|
34438
|
+
var isPositive = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
34439
|
+
function readyPlayerCompositionSize(iframe) {
|
|
34440
|
+
const player = resolvePreviewPlayerHost(iframe);
|
|
34441
|
+
if (!player?.ready) return null;
|
|
34442
|
+
const { compositionWidth: width, compositionHeight: height } = player;
|
|
34443
|
+
return isPositive(width) && isPositive(height) ? { width, height } : null;
|
|
34444
|
+
}
|
|
33723
34445
|
function readPreviewCompositionSize(iframe) {
|
|
34446
|
+
if (iframe && previewFrameOpaque(iframe)) return readyPlayerCompositionSize(iframe);
|
|
33724
34447
|
try {
|
|
33725
34448
|
const doc = iframe?.contentDocument;
|
|
33726
34449
|
const root = doc?.querySelector("[data-composition-id][data-width][data-height]") ?? doc?.querySelector("[data-width][data-height]");
|
|
@@ -34415,6 +35138,14 @@ var NLEPreview = memo24(function NLEPreview2({
|
|
|
34415
35138
|
useEffect42(() => {
|
|
34416
35139
|
onCompositionSizeChangeRef.current?.(compositionSize);
|
|
34417
35140
|
}, [compositionSize]);
|
|
35141
|
+
const showLive = poster.onLiveReadyToShowChange;
|
|
35142
|
+
const onLiveReadyToShowChange = useCallback49(
|
|
35143
|
+
(ready) => {
|
|
35144
|
+
showLive(ready);
|
|
35145
|
+
if (ready) updateCompositionSizeFromPreview();
|
|
35146
|
+
},
|
|
35147
|
+
[showLive, updateCompositionSizeFromPreview]
|
|
35148
|
+
);
|
|
34418
35149
|
const setPreviewIframeRef = useCallback49(
|
|
34419
35150
|
(node) => {
|
|
34420
35151
|
previewIframeRef.current = node;
|
|
@@ -34696,7 +35427,7 @@ var NLEPreview = memo24(function NLEPreview2({
|
|
|
34696
35427
|
applyInitialZoom();
|
|
34697
35428
|
},
|
|
34698
35429
|
onCompositionLoadingChange,
|
|
34699
|
-
onReadyToShowChange:
|
|
35430
|
+
onReadyToShowChange: onLiveReadyToShowChange,
|
|
34700
35431
|
onPreviewError: poster.onPreviewError,
|
|
34701
35432
|
onPainted: (details) => reportPreviewFirstFrame(slot, details),
|
|
34702
35433
|
portrait,
|
|
@@ -34782,10 +35513,7 @@ function CompositionBreadcrumb({ stack, onNavigate }) {
|
|
|
34782
35513
|
{
|
|
34783
35514
|
type: "button",
|
|
34784
35515
|
onClick: () => {
|
|
34785
|
-
trackStudioEvent("navigation", {
|
|
34786
|
-
action: "back",
|
|
34787
|
-
target: stack[stack.length - 2]?.label
|
|
34788
|
-
});
|
|
35516
|
+
trackStudioEvent("navigation", { action: "back", level: stack.length - 2 });
|
|
34789
35517
|
onNavigate(stack.length - 2);
|
|
34790
35518
|
},
|
|
34791
35519
|
className: "flex items-center gap-1 px-1.5 py-0.5 rounded-sm text-xs text-text-3 hover:text-text-0 hover:bg-hover active:scale-[0.98] transition-colors",
|
|
@@ -34803,7 +35531,7 @@ function CompositionBreadcrumb({ stack, onNavigate }) {
|
|
|
34803
35531
|
{
|
|
34804
35532
|
type: "button",
|
|
34805
35533
|
onClick: () => {
|
|
34806
|
-
trackStudioEvent("navigation", { action: "breadcrumb",
|
|
35534
|
+
trackStudioEvent("navigation", { action: "breadcrumb", level: i });
|
|
34807
35535
|
onNavigate(i);
|
|
34808
35536
|
},
|
|
34809
35537
|
className: "text-xs text-text-3 hover:text-text-1 transition-colors",
|
|
@@ -35509,7 +36237,7 @@ function PreviewPane({
|
|
|
35509
36237
|
onBlockDrop: onPreviewBlockDrop
|
|
35510
36238
|
});
|
|
35511
36239
|
const containerRef = useRef61(null);
|
|
35512
|
-
const fullscreenElement =
|
|
36240
|
+
const fullscreenElement = useSyncExternalStore8(subscribeFullscreen, getFullscreenElement);
|
|
35513
36241
|
const isFullscreen = fullscreenElement === containerRef.current && fullscreenElement != null;
|
|
35514
36242
|
const toggleFullscreen = useCallback52(() => {
|
|
35515
36243
|
if (!containerRef.current) return;
|
|
@@ -36295,13 +37023,13 @@ import { useEffect as useEffect47, useRef as useRef63, useState as useState47 }
|
|
|
36295
37023
|
import { encodeUrlPath as encodeUrlPath3 } from "@hyperframes/parsers";
|
|
36296
37024
|
|
|
36297
37025
|
// src/hooks/fileChangeFanout.ts
|
|
36298
|
-
var
|
|
37026
|
+
var listeners4 = /* @__PURE__ */ new Set();
|
|
36299
37027
|
function onExternalFileChange(listener2) {
|
|
36300
|
-
|
|
36301
|
-
return () =>
|
|
37028
|
+
listeners4.add(listener2);
|
|
37029
|
+
return () => listeners4.delete(listener2);
|
|
36302
37030
|
}
|
|
36303
37031
|
function announceExternalFileChange(payload) {
|
|
36304
|
-
for (const listener2 of
|
|
37032
|
+
for (const listener2 of listeners4) listener2(payload);
|
|
36305
37033
|
}
|
|
36306
37034
|
|
|
36307
37035
|
// src/components/storyboard/useStoryboardBoard.ts
|
|
@@ -36318,7 +37046,7 @@ function useStoryboardBoard(projectId) {
|
|
|
36318
37046
|
const loaded = files?.fileTreeLoaded === true;
|
|
36319
37047
|
const path = fileTree ? findBoardFile(fileTree) : null;
|
|
36320
37048
|
const [revision, setRevision] = useState47(0);
|
|
36321
|
-
const [
|
|
37049
|
+
const [read3, setRead] = useState47({ state: "loading" });
|
|
36322
37050
|
const [appeared, setAppeared] = useState47(false);
|
|
36323
37051
|
const firstListing = useRef63(null);
|
|
36324
37052
|
if (loaded && firstListing.current === null) firstListing.current = path !== null;
|
|
@@ -36357,7 +37085,7 @@ function useStoryboardBoard(projectId) {
|
|
|
36357
37085
|
live = false;
|
|
36358
37086
|
};
|
|
36359
37087
|
}, [projectId, path, revision]);
|
|
36360
|
-
return { path, revision, read:
|
|
37088
|
+
return { path, revision, read: read3, appeared };
|
|
36361
37089
|
}
|
|
36362
37090
|
|
|
36363
37091
|
// src/components/storyboard/StoryboardBoardView.tsx
|
|
@@ -36366,13 +37094,13 @@ var frameStart = (time) => {
|
|
|
36366
37094
|
const at = /(\d+(?:\.\d+)?)/.exec(time)?.[1];
|
|
36367
37095
|
return at === void 0 ? null : Number(at);
|
|
36368
37096
|
};
|
|
36369
|
-
function boardMode(
|
|
36370
|
-
if (
|
|
37097
|
+
function boardMode(read3, asWritten) {
|
|
37098
|
+
if (read3.state === "failed")
|
|
36371
37099
|
return { mode: "page", frames: [], reason: "Couldn't read the page, shown as written" };
|
|
36372
|
-
if (
|
|
36373
|
-
if (!
|
|
37100
|
+
if (read3.state === "loading") return { mode: "loading", frames: [], reason: null };
|
|
37101
|
+
if (!read3.frames.length)
|
|
36374
37102
|
return { mode: "page", frames: [], reason: "No frames found, shown as written" };
|
|
36375
|
-
return { mode: asWritten ? "page" : "frames", frames:
|
|
37103
|
+
return { mode: asWritten ? "page" : "frames", frames: read3.frames, reason: null };
|
|
36376
37104
|
}
|
|
36377
37105
|
function StoryboardBoardView({ projectId, board, onShowInPreview }) {
|
|
36378
37106
|
const [asWritten, setAsWritten] = useState48(false);
|
|
@@ -36809,15 +37537,15 @@ function readHook(iframe) {
|
|
|
36809
37537
|
return null;
|
|
36810
37538
|
}
|
|
36811
37539
|
}
|
|
36812
|
-
var
|
|
36813
|
-
var stereo = (value) =>
|
|
37540
|
+
var isFields2 = (value) => typeof value === "object" && value !== null;
|
|
37541
|
+
var stereo = (value) => isFields2(value) && Number.isFinite(value.l) && Number.isFinite(value.r) ? { l: value.l, r: value.r } : void 0;
|
|
36814
37542
|
function meterLevels(value) {
|
|
36815
|
-
if (!
|
|
37543
|
+
if (!isFields2(value) || !isFields2(value.groups)) return void 0;
|
|
36816
37544
|
const master = stereo(value.master);
|
|
36817
37545
|
if (!master) return void 0;
|
|
36818
37546
|
const groups = Object.entries(value.groups).flatMap(([id, level]) => {
|
|
36819
|
-
const
|
|
36820
|
-
return
|
|
37547
|
+
const read3 = stereo(level);
|
|
37548
|
+
return read3 ? [[id, read3]] : [];
|
|
36821
37549
|
});
|
|
36822
37550
|
return { master, groups: Object.fromEntries(groups) };
|
|
36823
37551
|
}
|
|
@@ -36832,7 +37560,7 @@ function createSealedMeter() {
|
|
|
36832
37560
|
frame3 = null;
|
|
36833
37561
|
levels = void 0;
|
|
36834
37562
|
};
|
|
36835
|
-
const
|
|
37563
|
+
const read3 = (iframe, now2) => {
|
|
36836
37564
|
if (iframe !== frame3) stop2();
|
|
36837
37565
|
frame3 = iframe;
|
|
36838
37566
|
if (busy2 || now2 - askedAt < SEALED_METER_READ_MS) return levels;
|
|
@@ -36845,7 +37573,7 @@ function createSealedMeter() {
|
|
|
36845
37573
|
});
|
|
36846
37574
|
return levels;
|
|
36847
37575
|
};
|
|
36848
|
-
return { read:
|
|
37576
|
+
return { read: read3, stop: stop2 };
|
|
36849
37577
|
}
|
|
36850
37578
|
function paintPeak(el, peak) {
|
|
36851
37579
|
if (!el) return;
|
|
@@ -37294,7 +38022,7 @@ function resolveCaptionNudge(event, target) {
|
|
|
37294
38022
|
import {
|
|
37295
38023
|
isPlainRecord as isPlainRecord2,
|
|
37296
38024
|
MAX_CAPTION_TRANSFORM,
|
|
37297
|
-
MAX_DESCRIBE_HANDLES
|
|
38025
|
+
MAX_DESCRIBE_HANDLES as MAX_DESCRIBE_HANDLES3
|
|
37298
38026
|
} from "@hyperframes/core/runtime/editing-port";
|
|
37299
38027
|
function overlayPlacement(iframe, overlayEl) {
|
|
37300
38028
|
const iframeDisplayRect = iframe.getBoundingClientRect();
|
|
@@ -37542,7 +38270,7 @@ async function readFrameWordBoxes(iframe, model, overlayEl) {
|
|
|
37542
38270
|
var transformQueues = /* @__PURE__ */ new WeakMap();
|
|
37543
38271
|
function sendTransforms(iframe, queue2) {
|
|
37544
38272
|
if (queue2.sending || !queue2.ops.length) return;
|
|
37545
|
-
const ops = queue2.ops.splice(0,
|
|
38273
|
+
const ops = queue2.ops.splice(0, MAX_DESCRIBE_HANDLES3);
|
|
37546
38274
|
queue2.sending = true;
|
|
37547
38275
|
const entries = ops.map((op) => op.entry);
|
|
37548
38276
|
void previewRequest(iframe, "caption-transform", { entries }).then((reply) => {
|
|
@@ -37633,7 +38361,7 @@ function restoreSealedDrag(drag) {
|
|
|
37633
38361
|
}
|
|
37634
38362
|
function pressSealedDrag(iframe, type, word, segmentId, press) {
|
|
37635
38363
|
const start = frameWordTransform(iframe, word).then(
|
|
37636
|
-
(
|
|
38364
|
+
(read3) => read3 && toDragStart(type, read3, press)
|
|
37637
38365
|
);
|
|
37638
38366
|
return { iframe, word, segmentId, start, last: start.then(restOf) };
|
|
37639
38367
|
}
|
|
@@ -38334,6 +39062,7 @@ function buildInsetClipPathValue(insetPx, radiusValue) {
|
|
|
38334
39062
|
}
|
|
38335
39063
|
|
|
38336
39064
|
// src/components/editor/domEditOverlayCrop.ts
|
|
39065
|
+
import { MAX_DRAFT_PX as MAX_DRAFT_PX2, MAX_ELEMENT_VALUE as MAX_ELEMENT_VALUE2 } from "@hyperframes/core/runtime/editing-port";
|
|
38337
39066
|
function cropRectFromInsets(rect, insets, scaleX, scaleY) {
|
|
38338
39067
|
const sx = scaleX > 0 ? scaleX : 1;
|
|
38339
39068
|
const sy = scaleY > 0 ? scaleY : 1;
|
|
@@ -38347,13 +39076,42 @@ function cropRectFromInsets(rect, insets, scaleX, scaleY) {
|
|
|
38347
39076
|
};
|
|
38348
39077
|
}
|
|
38349
39078
|
var cropLifts = /* @__PURE__ */ new WeakMap();
|
|
39079
|
+
var UNLIFT_TRIES = 3;
|
|
38350
39080
|
function liftSelector(element) {
|
|
38351
39081
|
const quote = (value) => `"${value.replace(/["\\]/g, "\\$&")}"`;
|
|
38352
39082
|
const hfId = element.getAttribute("data-hf-id");
|
|
38353
39083
|
if (hfId) return `[data-hf-id=${quote(hfId)}]`;
|
|
38354
39084
|
return element.id ? `[id=${quote(element.id)}]` : null;
|
|
38355
39085
|
}
|
|
39086
|
+
function unliftInFrame(element, record2, tries = UNLIFT_TRIES) {
|
|
39087
|
+
const target = previewStandIn(element);
|
|
39088
|
+
if (!target) return;
|
|
39089
|
+
void previewRequest(target.iframe, "crop-lift", { handle: target.handle, lift: false }).then(
|
|
39090
|
+
(reply) => {
|
|
39091
|
+
if (cropLifts.get(element) !== record2) return;
|
|
39092
|
+
if (reply?.lifted === false) cropLifts.delete(element);
|
|
39093
|
+
else if (tries > 1) unliftInFrame(element, record2, tries - 1);
|
|
39094
|
+
}
|
|
39095
|
+
);
|
|
39096
|
+
}
|
|
39097
|
+
function liftInFrame(element) {
|
|
39098
|
+
const target = previewStandIn(element);
|
|
39099
|
+
if (!target) return false;
|
|
39100
|
+
const record2 = { rule: null, sheetClip: frameClipPaths.get(element)?.computed ?? "" };
|
|
39101
|
+
cropLifts.set(element, record2);
|
|
39102
|
+
void previewRequest(target.iframe, "crop-lift", { handle: target.handle, lift: true }).then(
|
|
39103
|
+
(reply) => {
|
|
39104
|
+
if (cropLifts.get(element) !== record2 || !reply) return;
|
|
39105
|
+
if (!reply.lifted) cropLifts.delete(element);
|
|
39106
|
+
else if (typeof reply.clipPath === "string" && reply.clipPath.length <= MAX_ELEMENT_VALUE2)
|
|
39107
|
+
record2.sheetClip = reply.clipPath.trim();
|
|
39108
|
+
}
|
|
39109
|
+
);
|
|
39110
|
+
return true;
|
|
39111
|
+
}
|
|
38356
39112
|
function liftElementCrop(element) {
|
|
39113
|
+
const held2 = cropLifts.get(element);
|
|
39114
|
+
if (held2 && !held2.dropped || liftInFrame(element)) return;
|
|
38357
39115
|
const selector = liftSelector(element);
|
|
38358
39116
|
if (!selector || cropLifts.has(element)) return;
|
|
38359
39117
|
const doc = element.ownerDocument;
|
|
@@ -38363,28 +39121,49 @@ function liftElementCrop(element) {
|
|
|
38363
39121
|
cropLifts.set(element, { rule });
|
|
38364
39122
|
}
|
|
38365
39123
|
function dropElementCropLift(element) {
|
|
38366
|
-
cropLifts.get(element)
|
|
38367
|
-
|
|
39124
|
+
const lift = cropLifts.get(element);
|
|
39125
|
+
if (!lift || lift.dropped) return;
|
|
39126
|
+
if (lift.rule) {
|
|
39127
|
+
lift.rule.remove();
|
|
39128
|
+
cropLifts.delete(element);
|
|
39129
|
+
return;
|
|
39130
|
+
}
|
|
39131
|
+
lift.dropped = true;
|
|
39132
|
+
unliftInFrame(element, lift);
|
|
38368
39133
|
}
|
|
38369
39134
|
function isElementCropLifted(element) {
|
|
38370
|
-
return cropLifts.has(element);
|
|
38371
|
-
}
|
|
38372
|
-
var computedClipPath = (element) => element.ownerDocument.defaultView?.getComputedStyle(element).clipPath.trim() || "";
|
|
38373
|
-
function readElementClipPath(element) {
|
|
38374
|
-
const inline = element.style.getPropertyValue("clip-path").trim();
|
|
38375
39135
|
const lift = cropLifts.get(element);
|
|
38376
|
-
|
|
38377
|
-
|
|
39136
|
+
return !!lift && !lift.dropped;
|
|
39137
|
+
}
|
|
39138
|
+
var frameClipPaths = /* @__PURE__ */ new WeakMap();
|
|
39139
|
+
function rememberFrameClipPath(element, inline, computed) {
|
|
39140
|
+
frameClipPaths.set(element, { inline: inline.trim(), computed: computed.trim() });
|
|
39141
|
+
}
|
|
39142
|
+
var computedClipPath = (element) => {
|
|
39143
|
+
const view = element.ownerDocument.defaultView;
|
|
39144
|
+
if (!view) return frameClipPaths.get(element)?.computed ?? "";
|
|
39145
|
+
return view.getComputedStyle(element).clipPath.trim();
|
|
39146
|
+
};
|
|
39147
|
+
function sheetClipUnder(element, lift) {
|
|
39148
|
+
if (lift.sheetClip === void 0 && lift.rule) {
|
|
38378
39149
|
const { parentNode, nextSibling } = lift.rule;
|
|
38379
39150
|
lift.rule.remove();
|
|
38380
39151
|
lift.sheetClip = computedClipPath(element);
|
|
38381
39152
|
parentNode?.insertBefore(lift.rule, nextSibling);
|
|
38382
39153
|
}
|
|
38383
|
-
return lift.sheetClip;
|
|
39154
|
+
return lift.sheetClip ?? "";
|
|
39155
|
+
}
|
|
39156
|
+
function readElementClipPath(element) {
|
|
39157
|
+
const inline = element.style.getPropertyValue("clip-path").trim() || frameClipPaths.get(element)?.inline;
|
|
39158
|
+
if (inline) return inline;
|
|
39159
|
+
const lift = cropLifts.get(element);
|
|
39160
|
+
return lift && !lift.dropped ? sheetClipUnder(element, lift) : computedClipPath(element);
|
|
38384
39161
|
}
|
|
38385
39162
|
function parseCropClipPath(value) {
|
|
38386
39163
|
if (!value || value === "none") return { top: 0, right: 0, bottom: 0, left: 0, radius: 0 };
|
|
38387
|
-
|
|
39164
|
+
const sides = parseInsetClipPathSides(value);
|
|
39165
|
+
const sane = sides && Object.values(sides).every((side) => Math.abs(side) <= MAX_DRAFT_PX2);
|
|
39166
|
+
return sane ? sides : null;
|
|
38388
39167
|
}
|
|
38389
39168
|
function readElementCropInsets(element) {
|
|
38390
39169
|
return parseCropClipPath(readElementClipPath(element));
|
|
@@ -38861,152 +39640,9 @@ function isDomEditGestureTap(g, e) {
|
|
|
38861
39640
|
// src/components/editor/previewLayers.ts
|
|
38862
39641
|
import { MAX_DESCRIBE_HANDLES as MAX_DESCRIBE_HANDLES5 } from "@hyperframes/core/runtime/editing-port";
|
|
38863
39642
|
|
|
38864
|
-
// src/player/lib/previewElements.ts
|
|
38865
|
-
import {
|
|
38866
|
-
EDITING_ELEMENT_HANDLE,
|
|
38867
|
-
MAX_DESCRIBE_HANDLES as MAX_DESCRIBE_HANDLES2,
|
|
38868
|
-
MAX_ELEMENT_ENTRIES,
|
|
38869
|
-
MAX_ELEMENT_VALUE,
|
|
38870
|
-
MAX_GEOMETRY_CHILDREN,
|
|
38871
|
-
MAX_SNAP_TARGETS
|
|
38872
|
-
} from "@hyperframes/core/runtime/editing-port";
|
|
38873
|
-
var isFields2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
38874
|
-
var isHandle = (value) => typeof value === "string" && EDITING_ELEMENT_HANDLE.test(value);
|
|
38875
|
-
var isText = (value) => typeof value === "string";
|
|
38876
|
-
var isTextOrNull = (value) => value === null || typeof value === "string";
|
|
38877
|
-
var isCount = (value) => Number.isSafeInteger(value) && value >= 0;
|
|
38878
|
-
var isSource = (value) => isFields2(value) && isTextOrNull(value.file) && isTextOrNull(value.compositionId) && isTextOrNull(value.originalCompositionId);
|
|
38879
|
-
var isTextRecord = (value) => isFields2(value) && Object.values(value).every(isText);
|
|
38880
|
-
function hasPlainFields(value) {
|
|
38881
|
-
const { matchesBefore, attributes, children } = value;
|
|
38882
|
-
const groupsOk = matchesBefore === null || Array.isArray(matchesBefore) && matchesBefore.every((g) => isFields2(g) && isSource(g.source) && isCount(g.count));
|
|
38883
|
-
const attributesOk = Array.isArray(attributes) && attributes.every((a) => Array.isArray(a) && a.length === 2 && a.every(isText));
|
|
38884
|
-
const childrenOk = Array.isArray(children) && children.every((c) => isFields2(c) && (isHandle(c.handle) || isText(c.text)));
|
|
38885
|
-
return groupsOk && attributesOk && childrenOk && typeof value.truncated === "boolean";
|
|
38886
|
-
}
|
|
38887
|
-
var isRect = (value) => isFields2(value) && [value.x, value.y, value.width, value.height].every(Number.isFinite);
|
|
38888
|
-
function readHit(value) {
|
|
38889
|
-
if (!isFields2(value) || !isHandle(value.handle) || !isText(value.tag)) return null;
|
|
38890
|
-
return isRect(value.rect) ? value : null;
|
|
38891
|
-
}
|
|
38892
|
-
function readPreviewElement(value) {
|
|
38893
|
-
if (!readHit(value) || !isFields2(value)) return null;
|
|
38894
|
-
if (value.parent !== null && !isHandle(value.parent)) return null;
|
|
38895
|
-
if (value.label !== void 0 && !isText(value.label)) return null;
|
|
38896
|
-
if (!isTextOrNull(value.id) || !isTextOrNull(value.selector)) return null;
|
|
38897
|
-
if (!isSource(value.source) || typeof value.locked !== "boolean") return null;
|
|
38898
|
-
if (!isTextRecord(value.inlineStyles) || !isText(value.text)) return null;
|
|
38899
|
-
return hasPlainFields(value) ? value : null;
|
|
38900
|
-
}
|
|
38901
|
-
async function previewElementsAtPoint(iframe, x, y) {
|
|
38902
|
-
const reply = await previewRequest(iframe, "elements-at-point", { x, y });
|
|
38903
|
-
const elements = reply?.elements;
|
|
38904
|
-
if (!Array.isArray(elements)) return null;
|
|
38905
|
-
return elements.map(readHit).filter((element) => element !== null);
|
|
38906
|
-
}
|
|
38907
|
-
async function previewPointerTargets(iframe, rootFractionX, rootFractionY) {
|
|
38908
|
-
const params = { x: rootFractionX, y: rootFractionY };
|
|
38909
|
-
const reply = await previewRequest(iframe, "pointer-targets", params);
|
|
38910
|
-
const stack = reply?.stack;
|
|
38911
|
-
if (!reply || !Array.isArray(stack)) return null;
|
|
38912
|
-
return { target: readHit(reply.target), stack: stack.map(readHit).filter((hit) => hit !== null) };
|
|
38913
|
-
}
|
|
38914
|
-
async function describePreviewElements(iframe, handles) {
|
|
38915
|
-
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES2) return null;
|
|
38916
|
-
const reply = await previewRequest(iframe, "describe", { handles: [...handles] });
|
|
38917
|
-
const elements = reply?.elements;
|
|
38918
|
-
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
38919
|
-
return elements.map((entry3, index2) => {
|
|
38920
|
-
const element = readPreviewElement(entry3);
|
|
38921
|
-
return element?.handle === handles[index2] ? element : null;
|
|
38922
|
-
});
|
|
38923
|
-
}
|
|
38924
|
-
async function previewAncestors(iframe, handles) {
|
|
38925
|
-
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES2) return null;
|
|
38926
|
-
const reply = await previewRequest(iframe, "ancestors", { handles: [...handles] });
|
|
38927
|
-
const chains = reply?.ancestors;
|
|
38928
|
-
if (!Array.isArray(chains) || chains.length !== handles.length) return null;
|
|
38929
|
-
return chains.map(
|
|
38930
|
-
(chain) => Array.isArray(chain) && chain.every(isHandle) ? chain : null
|
|
38931
|
-
);
|
|
38932
|
-
}
|
|
38933
|
-
async function queryPreviewElements(iframe, selector) {
|
|
38934
|
-
const reply = await previewRequest(iframe, "query", { selector });
|
|
38935
|
-
const matches = reply?.matches;
|
|
38936
|
-
if (!Array.isArray(matches) || typeof reply?.truncated !== "boolean") return null;
|
|
38937
|
-
const ok = matches.every((m) => isFields2(m) && isHandle(m.handle) && isSource(m.source));
|
|
38938
|
-
return ok ? { matches, truncated: reply.truncated } : null;
|
|
38939
|
-
}
|
|
38940
|
-
function previewElementSourceFile(element, activeCompositionPath) {
|
|
38941
|
-
return resolveElementSourceFile(element.source, activeCompositionPath);
|
|
38942
|
-
}
|
|
38943
|
-
function previewElementSelectorIndex(element, activeCompositionPath) {
|
|
38944
|
-
if (!element.selector?.startsWith(".") || !element.matchesBefore) return void 0;
|
|
38945
|
-
const file = previewElementSourceFile(element, activeCompositionPath);
|
|
38946
|
-
return element.matchesBefore.filter((group) => resolveElementSourceFile(group.source, activeCompositionPath) === file).reduce((sum, group) => sum + group.count, 0);
|
|
38947
|
-
}
|
|
38948
|
-
var isPoint = (value) => isFields2(value) && Number.isFinite(value.x) && Number.isFinite(value.y);
|
|
38949
|
-
var isSizeOrNull = (value) => value === null || Number.isFinite(value) && value > 0;
|
|
38950
|
-
var CORNERS = ["nw", "ne", "se", "sw"];
|
|
38951
|
-
var isCorners = (value) => value === null || isFields2(value) && CORNERS.every((corner) => isPoint(value[corner]));
|
|
38952
|
-
var isSourceBox = (value) => value === null || isFields2(value) && Number.isFinite(value.width) && Number.isFinite(value.height) && isSizeOrNull(value.declaredWidth) && isSizeOrNull(value.declaredHeight);
|
|
38953
|
-
var isClipPath = (value) => value === null || isText(value) && value.length <= MAX_ELEMENT_VALUE;
|
|
38954
|
-
var isBox = (value) => isFields2(value) && isRect(value.rect) && Number.isFinite(value.angle) && isCorners(value.corners) && isSourceBox(value.source) && isClipPath(value.clipPath);
|
|
38955
|
-
var readGeometry = (value) => {
|
|
38956
|
-
if (!isBox(value) || !isFields2(value) || typeof value.visible !== "boolean") return null;
|
|
38957
|
-
const { members } = value;
|
|
38958
|
-
const membersOk = members === null || Array.isArray(members) && members.length <= MAX_ELEMENT_ENTRIES && members.every(isRect);
|
|
38959
|
-
return membersOk ? value : null;
|
|
38960
|
-
};
|
|
38961
|
-
async function previewGeometry(iframe, handles, children) {
|
|
38962
|
-
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES2) return null;
|
|
38963
|
-
const params = { handles: [...handles], ...children ? { children } : {} };
|
|
38964
|
-
const reply = await previewRequest(iframe, "geometry", params);
|
|
38965
|
-
const elements = reply?.elements;
|
|
38966
|
-
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
38967
|
-
const boxes = reply?.children;
|
|
38968
|
-
const childrenOk = Array.isArray(boxes) && boxes.length <= MAX_GEOMETRY_CHILDREN && boxes.every(isBox);
|
|
38969
|
-
return {
|
|
38970
|
-
elements: elements.map(readGeometry),
|
|
38971
|
-
children: children && childrenOk ? boxes : null
|
|
38972
|
-
};
|
|
38973
|
-
}
|
|
38974
|
-
var isFlag = (value) => typeof value === "boolean";
|
|
38975
|
-
var isFiniteFields = (value, keys) => isFields2(value) && keys.every((key) => Number.isFinite(value[key]));
|
|
38976
|
-
var readGestureStart = (value) => {
|
|
38977
|
-
if (!readGeometry(value) || !isFields2(value)) return null;
|
|
38978
|
-
const { layout, move, gsap: gsap3 } = value;
|
|
38979
|
-
const valid = [
|
|
38980
|
-
isFiniteFields(layout, ["width", "height"]),
|
|
38981
|
-
move === null || isFiniteFields(move, ["a", "b", "c", "d"]),
|
|
38982
|
-
gsap3 === null || isFields2(gsap3) && isFiniteFields(gsap3, ["x", "y"]) && isFlag(gsap3.moving)
|
|
38983
|
-
];
|
|
38984
|
-
return valid.includes(false) ? null : value;
|
|
38985
|
-
};
|
|
38986
|
-
async function previewGestureStart(iframe, handles) {
|
|
38987
|
-
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES2) return null;
|
|
38988
|
-
const reply = await previewRequest(iframe, "gesture-start", { handles: [...handles] });
|
|
38989
|
-
const elements = reply?.elements;
|
|
38990
|
-
const snap = reply?.snap;
|
|
38991
|
-
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
38992
|
-
if (!Array.isArray(snap) || snap.length > MAX_SNAP_TARGETS || !snap.every(isBox)) return null;
|
|
38993
|
-
return { elements: elements.map(readGestureStart), snap };
|
|
38994
|
-
}
|
|
38995
|
-
var LAYER_KINDS = /* @__PURE__ */ new Set(["image", "video", "audio", "vector", "group", "text", "shape"]);
|
|
38996
|
-
var isLayer = (value) => isFields2(value) && isHandle(value.handle) && isCount(value.depth) && isCount(value.childCount) && Number.isFinite(value.zIndex) && LAYER_KINDS.has(value.kind);
|
|
38997
|
-
async function previewLayers(iframe, group, offset = 0) {
|
|
38998
|
-
const params = { ...group ? { group } : {}, ...offset ? { offset } : {} };
|
|
38999
|
-
const reply = await previewRequest(iframe, "layers", params);
|
|
39000
|
-
const layers = reply?.layers;
|
|
39001
|
-
const { truncated, missingGroup } = reply ?? {};
|
|
39002
|
-
if (!Array.isArray(layers) || typeof truncated !== "boolean") return null;
|
|
39003
|
-
if (typeof missingGroup !== "boolean") return null;
|
|
39004
|
-
return layers.every(isLayer) ? { layers, truncated, missingGroup } : null;
|
|
39005
|
-
}
|
|
39006
|
-
|
|
39007
39643
|
// src/components/editor/previewOverlayRects.ts
|
|
39008
39644
|
import {
|
|
39009
|
-
MAX_DESCRIBE_HANDLES as
|
|
39645
|
+
MAX_DESCRIBE_HANDLES as MAX_DESCRIBE_HANDLES4,
|
|
39010
39646
|
ROTATION_GATE_EPSILON_DEG as ROTATION_GATE_EPSILON_DEG2
|
|
39011
39647
|
} from "@hyperframes/core/runtime/editing-port";
|
|
39012
39648
|
var clientRect = ({ x, y, width, height }) => ({ left: x, top: y, width, height });
|
|
@@ -39045,15 +39681,15 @@ async function measurePreviewOverlay(iframe, overlayEl, targets) {
|
|
|
39045
39681
|
const reply = handles.length ? await previewGeometry(iframe, handles, targets.selection ?? void 0) : { elements: [], children: null };
|
|
39046
39682
|
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
39047
39683
|
if (!reply || !scale) return null;
|
|
39048
|
-
const
|
|
39049
|
-
const selected =
|
|
39684
|
+
const read3 = (handle) => handle ? reply.elements[handles.indexOf(handle)] ?? null : null;
|
|
39685
|
+
const selected = read3(targets.selection);
|
|
39050
39686
|
const shown3 = selected?.visible ? selected : null;
|
|
39051
|
-
const hovered =
|
|
39687
|
+
const hovered = read3(targets.hover);
|
|
39052
39688
|
return {
|
|
39053
39689
|
selection: shown3 && groupAwareRect(scale, shown3, true),
|
|
39054
39690
|
children: shown3 ? (reply.children ?? []).map((box) => visibleRect(scale, box)).filter((rect) => rect.width > 2 && rect.height > 2) : [],
|
|
39055
39691
|
group: targets.group.map((handle) => {
|
|
39056
|
-
const member =
|
|
39692
|
+
const member = read3(handle);
|
|
39057
39693
|
const rect = member && groupAwareRect(scale, member, false);
|
|
39058
39694
|
return rect && { ...rect, ...hugRectForClipPath(rect, member.clipPath) };
|
|
39059
39695
|
}),
|
|
@@ -39062,8 +39698,8 @@ async function measurePreviewOverlay(iframe, overlayEl, targets) {
|
|
|
39062
39698
|
}
|
|
39063
39699
|
async function measurePreviewVisibleRects(iframe, overlayEl, handles) {
|
|
39064
39700
|
const measured = [];
|
|
39065
|
-
for (let at = 0; at < handles.length; at +=
|
|
39066
|
-
const reply = await previewGeometry(iframe, handles.slice(at, at +
|
|
39701
|
+
for (let at = 0; at < handles.length; at += MAX_DESCRIBE_HANDLES4) {
|
|
39702
|
+
const reply = await previewGeometry(iframe, handles.slice(at, at + MAX_DESCRIBE_HANDLES4));
|
|
39067
39703
|
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
39068
39704
|
if (!reply || !scale) return null;
|
|
39069
39705
|
for (const box of reply.elements) {
|
|
@@ -39079,55 +39715,9 @@ async function measurePreviewVisibleRects(iframe, overlayEl, handles) {
|
|
|
39079
39715
|
import { resolveEditingAffordances } from "@hyperframes/core/editing";
|
|
39080
39716
|
import {
|
|
39081
39717
|
MAX_ELEMENT_ENTRIES as MAX_ELEMENT_ENTRIES2,
|
|
39082
|
-
MAX_ELEMENT_VALUE as
|
|
39718
|
+
MAX_ELEMENT_VALUE as MAX_ELEMENT_VALUE3
|
|
39083
39719
|
} from "@hyperframes/core/runtime/editing-port";
|
|
39084
39720
|
|
|
39085
|
-
// src/components/editor/previewDrafts.ts
|
|
39086
|
-
import { MAX_DESCRIBE_HANDLES as MAX_DESCRIBE_HANDLES4 } from "@hyperframes/core/runtime/editing-port";
|
|
39087
|
-
var standIns = /* @__PURE__ */ new WeakMap();
|
|
39088
|
-
var queues = /* @__PURE__ */ new WeakMap();
|
|
39089
|
-
function registerPreviewStandIn(standIn, iframe, handle) {
|
|
39090
|
-
standIns.set(standIn, { iframe, handle });
|
|
39091
|
-
}
|
|
39092
|
-
function queueFor(iframe) {
|
|
39093
|
-
let queue2 = queues.get(iframe);
|
|
39094
|
-
if (!queue2) {
|
|
39095
|
-
queue2 = { ops: [], drawn: /* @__PURE__ */ new Map(), sending: false };
|
|
39096
|
-
queues.set(iframe, queue2);
|
|
39097
|
-
}
|
|
39098
|
-
return queue2;
|
|
39099
|
-
}
|
|
39100
|
-
function send2(iframe, queue2) {
|
|
39101
|
-
if (queue2.sending || !queue2.ops.length) return;
|
|
39102
|
-
const drafts = queue2.ops.splice(0, MAX_DESCRIBE_HANDLES4);
|
|
39103
|
-
queue2.sending = true;
|
|
39104
|
-
void previewRequest(iframe, "draft", { drafts }).finally(() => {
|
|
39105
|
-
queue2.sending = false;
|
|
39106
|
-
send2(iframe, queue2);
|
|
39107
|
-
});
|
|
39108
|
-
}
|
|
39109
|
-
function drawPreviewDraft(element, part) {
|
|
39110
|
-
const target = standIns.get(element);
|
|
39111
|
-
if (!target) return;
|
|
39112
|
-
const queue2 = queueFor(target.iframe);
|
|
39113
|
-
const drawn = { translate: null, size: null, ...queue2.drawn.get(target.handle), ...part };
|
|
39114
|
-
queue2.drawn.set(target.handle, drawn);
|
|
39115
|
-
const op = { handle: target.handle, ...drawn };
|
|
39116
|
-
const last = queue2.ops.map((queued) => queued.handle).lastIndexOf(target.handle);
|
|
39117
|
-
const waiting = queue2.ops[last];
|
|
39118
|
-
if (waiting && !("end" in waiting)) queue2.ops[last] = op;
|
|
39119
|
-
else queue2.ops.push(op);
|
|
39120
|
-
send2(target.iframe, queue2);
|
|
39121
|
-
}
|
|
39122
|
-
function endPreviewDraft(element, end) {
|
|
39123
|
-
const target = standIns.get(element);
|
|
39124
|
-
if (!target) return;
|
|
39125
|
-
const queue2 = queueFor(target.iframe);
|
|
39126
|
-
if (!queue2.drawn.delete(target.handle)) return;
|
|
39127
|
-
queue2.ops.push({ handle: target.handle, end });
|
|
39128
|
-
send2(target.iframe, queue2);
|
|
39129
|
-
}
|
|
39130
|
-
|
|
39131
39721
|
// src/hooks/draggedGsapPosition.ts
|
|
39132
39722
|
var cssValue = (style, prop) => {
|
|
39133
39723
|
const value = style.getPropertyValue(prop).trim();
|
|
@@ -39152,14 +39742,24 @@ function readCssRotation(element, withRotate = true) {
|
|
|
39152
39742
|
return angle(transform);
|
|
39153
39743
|
}
|
|
39154
39744
|
}
|
|
39745
|
+
var DRAG_MOVING_ATTR = "data-hf-drag-gsap-moving";
|
|
39746
|
+
function stampGestureBase(el, initialOffset, baseGsap, moving2 = false) {
|
|
39747
|
+
if (moving2) el.setAttribute(DRAG_MOVING_ATTR, "");
|
|
39748
|
+
else el.removeAttribute(DRAG_MOVING_ATTR);
|
|
39749
|
+
el.setAttribute("data-hf-drag-gsap-base-x", String(baseGsap.x));
|
|
39750
|
+
el.setAttribute("data-hf-drag-gsap-base-y", String(baseGsap.y));
|
|
39751
|
+
el.setAttribute("data-hf-drag-initial-offset-x", String(initialOffset.x));
|
|
39752
|
+
el.setAttribute("data-hf-drag-initial-offset-y", String(initialOffset.y));
|
|
39753
|
+
}
|
|
39155
39754
|
function readDragStamp(element) {
|
|
39156
|
-
const
|
|
39755
|
+
const read3 = (name) => Number.parseFloat(element.getAttribute(name) ?? "");
|
|
39157
39756
|
return {
|
|
39158
|
-
origX:
|
|
39159
|
-
origY:
|
|
39160
|
-
baseX:
|
|
39161
|
-
baseY:
|
|
39162
|
-
at: readEditMoment(element)
|
|
39757
|
+
origX: read3("data-hf-drag-initial-offset-x") || 0,
|
|
39758
|
+
origY: read3("data-hf-drag-initial-offset-y") || 0,
|
|
39759
|
+
baseX: read3("data-hf-drag-gsap-base-x"),
|
|
39760
|
+
baseY: read3("data-hf-drag-gsap-base-y"),
|
|
39761
|
+
at: readEditMoment(element),
|
|
39762
|
+
...element.getAttribute(DRAG_MOVING_ATTR) !== null && { moving: true }
|
|
39163
39763
|
};
|
|
39164
39764
|
}
|
|
39165
39765
|
function readEditMoment(element) {
|
|
@@ -39257,24 +39857,24 @@ var TRANSLATE_PX_PROPERTIES = [
|
|
|
39257
39857
|
"transform-box",
|
|
39258
39858
|
...["left", "right", "top", "bottom"].flatMap((s) => [`padding-${s}`, `border-${s}-width`])
|
|
39259
39859
|
];
|
|
39260
|
-
function referenceBox(
|
|
39261
|
-
const n = (prop) => Number.parseFloat(
|
|
39860
|
+
function referenceBox(read3, size, a, b) {
|
|
39861
|
+
const n = (prop) => Number.parseFloat(read3(prop)) || 0;
|
|
39262
39862
|
const pad2 = n(`padding-${a}`) + n(`padding-${b}`) + n(`border-${a}-width`) + n(`border-${b}-width`);
|
|
39263
|
-
const content = n(size) - (
|
|
39264
|
-
return CONTENT_BOXES.has(
|
|
39863
|
+
const content = n(size) - (read3("box-sizing") === "border-box" ? pad2 : 0);
|
|
39864
|
+
return CONTENT_BOXES.has(read3("transform-box")) ? content : content + pad2;
|
|
39265
39865
|
}
|
|
39266
|
-
function translatePx(value,
|
|
39866
|
+
function translatePx(value, read3) {
|
|
39267
39867
|
if (value === "none") return { x: 0, y: 0 };
|
|
39268
39868
|
const [x = "0px", y = "0px"] = splitTopLevelWhitespace(value);
|
|
39269
|
-
const side = (size, a, b) =>
|
|
39869
|
+
const side = (size, a, b) => read3 ? referenceBox(read3, size, a, b) : Number.NaN;
|
|
39270
39870
|
return {
|
|
39271
39871
|
x: evaluateLength(x, side("width", "left", "right")),
|
|
39272
39872
|
y: evaluateLength(y, side("height", "top", "bottom"))
|
|
39273
39873
|
};
|
|
39274
39874
|
}
|
|
39275
39875
|
var frameTranslates = /* @__PURE__ */ new WeakMap();
|
|
39276
|
-
function rememberFrameTranslate(el, px) {
|
|
39277
|
-
frameTranslates.set(el, { inline: el.style.getPropertyValue("translate"), px });
|
|
39876
|
+
function rememberFrameTranslate(el, px, computed) {
|
|
39877
|
+
frameTranslates.set(el, { inline: el.style.getPropertyValue("translate"), px, computed });
|
|
39278
39878
|
}
|
|
39279
39879
|
function readTranslatePx(el) {
|
|
39280
39880
|
const cs = el.ownerDocument.defaultView?.getComputedStyle(el);
|
|
@@ -39284,13 +39884,16 @@ function readTranslatePx(el) {
|
|
|
39284
39884
|
return translatePx(cs?.translate || inline || "none", cs && ((p) => cs.getPropertyValue(p)));
|
|
39285
39885
|
}
|
|
39286
39886
|
function readTranslatePxLeavingPercent(el) {
|
|
39287
|
-
const
|
|
39887
|
+
const cs = el.ownerDocument.defaultView?.getComputedStyle(el);
|
|
39888
|
+
const inline = el.style.getPropertyValue("translate");
|
|
39889
|
+
const frame3 = cs ? void 0 : frameTranslates.get(el);
|
|
39890
|
+
const computed = frame3?.inline === inline ? frame3.computed : cs?.translate;
|
|
39891
|
+
const value = computed || inline || "none";
|
|
39288
39892
|
const [x = "0px", y = "0px"] = value === "none" ? [] : splitTopLevelWhitespace(value);
|
|
39289
39893
|
const px = (part) => roundTo3(evaluateLength(part, 0)) || 0;
|
|
39290
39894
|
return { x: px(x), y: px(y) };
|
|
39291
39895
|
}
|
|
39292
39896
|
var UNREADABLE_TRANSLATE = "Studio can't read this layer's translate. Move it in the Code tab.";
|
|
39293
|
-
var MOVING_LAYER_UNREADABLE = "This preview can't save a move of a layer its animation moves yet. Move it in the Code tab.";
|
|
39294
39897
|
function formatTranslatePx(p) {
|
|
39295
39898
|
return `${roundTo3(p.x)}px ${roundTo3(p.y)}px`;
|
|
39296
39899
|
}
|
|
@@ -39391,7 +39994,7 @@ function readable(element) {
|
|
|
39391
39994
|
return probe2;
|
|
39392
39995
|
}
|
|
39393
39996
|
var attr = (element, name) => element.attributes.find(([key]) => key === name)?.[1] ?? null;
|
|
39394
|
-
var mayBeCut = (value) => value.length >=
|
|
39997
|
+
var mayBeCut = (value) => value.length >= MAX_ELEMENT_VALUE3 || value.startsWith("data:") && value.endsWith(",");
|
|
39395
39998
|
function valuesWhole(element) {
|
|
39396
39999
|
if (!element.truncated) return true;
|
|
39397
40000
|
const styles = Object.values(element.inlineStyles);
|
|
@@ -39479,10 +40082,10 @@ async function compositionRoot2(iframe, documentElement) {
|
|
|
39479
40082
|
height: attr(element, "data-height")
|
|
39480
40083
|
};
|
|
39481
40084
|
}
|
|
39482
|
-
function chainIndex(chain,
|
|
40085
|
+
function chainIndex(chain, read3, options) {
|
|
39483
40086
|
const active = options.activeGroupElement;
|
|
39484
40087
|
const activeHandle = active ? standInHandles.get(active) : void 0;
|
|
39485
|
-
return selectionTargetIndex(chain,
|
|
40088
|
+
return selectionTargetIndex(chain, read3, {
|
|
39486
40089
|
exactTarget: options.exactTarget,
|
|
39487
40090
|
preferClipAncestor: options.preferClipAncestor,
|
|
39488
40091
|
activeGroupIndex: active ? chain.findIndex((node) => node.handle === activeHandle) : null
|
|
@@ -39529,9 +40132,15 @@ async function resolvePreviewSelection(iframe, target, options) {
|
|
|
39529
40132
|
.../* @__PURE__ */ new Set([...CURATED_STYLE_PROPERTIES, ...TRANSLATE_PX_PROPERTIES])
|
|
39530
40133
|
]);
|
|
39531
40134
|
if (!styles) return null;
|
|
40135
|
+
rememberFrameClipPath(
|
|
40136
|
+
element,
|
|
40137
|
+
current2.inlineStyles["clip-path"] ?? "",
|
|
40138
|
+
styles["clip-path"] ?? ""
|
|
40139
|
+
);
|
|
39532
40140
|
rememberFrameTranslate(
|
|
39533
40141
|
element,
|
|
39534
|
-
translatePx(styles.translate ?? "none", (p) => styles[p] ?? "")
|
|
40142
|
+
translatePx(styles.translate ?? "none", (p) => styles[p] ?? ""),
|
|
40143
|
+
styles.translate ?? "none"
|
|
39535
40144
|
);
|
|
39536
40145
|
const computedStyles = Object.fromEntries(
|
|
39537
40146
|
CURATED_STYLE_PROPERTIES.flatMap((p) => p in styles ? [[p, styles[p]]] : [])
|
|
@@ -39641,6 +40250,10 @@ async function findPointerTargets(iframe, clientX, clientY) {
|
|
|
39641
40250
|
const described = handles.length ? await describePreviewElements(iframe, handles) : [];
|
|
39642
40251
|
return (described ?? []).filter((element) => element !== null);
|
|
39643
40252
|
}
|
|
40253
|
+
function editSealedSelection(iframe, selection, edit) {
|
|
40254
|
+
if (!iframe || !selection.handle || !previewFrameOpaque(iframe)) return null;
|
|
40255
|
+
return editPreviewElement(iframe, selection.handle, edit);
|
|
40256
|
+
}
|
|
39644
40257
|
var selectionElementLive = (selection) => selection.handle !== void 0 || selection.element.isConnected;
|
|
39645
40258
|
|
|
39646
40259
|
// src/components/editor/previewLayers.ts
|
|
@@ -40877,6 +41490,7 @@ function restoreStudioPathOffsetStyles(element, previous) {
|
|
|
40877
41490
|
}
|
|
40878
41491
|
element.removeAttribute("data-hf-drag-gsap-base-x");
|
|
40879
41492
|
element.removeAttribute("data-hf-drag-gsap-base-y");
|
|
41493
|
+
element.removeAttribute(DRAG_MOVING_ATTR);
|
|
40880
41494
|
}
|
|
40881
41495
|
}
|
|
40882
41496
|
function restoreOriginalBoxSizeProperty(element, property, attribute2) {
|
|
@@ -40983,8 +41597,8 @@ function wrapSeekReapplyFunction(win, owner, key, reapplyWhenHeldSeekLands = fal
|
|
|
40983
41597
|
const wrappedSeek = function(...args) {
|
|
40984
41598
|
const result = seek.apply(this, args);
|
|
40985
41599
|
win.__hfStudioManualEditsApply?.();
|
|
40986
|
-
const
|
|
40987
|
-
if (typeof
|
|
41600
|
+
const held2 = reapplyWhenHeldSeekLands ? result : void 0;
|
|
41601
|
+
if (typeof held2?.then === "function") void held2.then(() => win.__hfStudioManualEditsApply?.());
|
|
40988
41602
|
return result;
|
|
40989
41603
|
};
|
|
40990
41604
|
markWrapped(wrappedSeek);
|
|
@@ -41335,7 +41949,8 @@ function createManualOffsetDragMember(input) {
|
|
|
41335
41949
|
const gsapX = !plainTranslate && win?.gsap?.getProperty?.(input.element, "x") || 0;
|
|
41336
41950
|
const gsapY = !plainTranslate && win?.gsap?.getProperty?.(input.element, "y") || 0;
|
|
41337
41951
|
const baseGsap = start?.gsap ? { x: start.gsap.x, y: start.gsap.y } : { x: gsapX, y: gsapY };
|
|
41338
|
-
|
|
41952
|
+
const moving2 = start?.gsap?.moving === true;
|
|
41953
|
+
if (!plainTranslate) stampGestureBase(input.element, initialOffset, baseGsap, moving2);
|
|
41339
41954
|
if (win?.__timelines) {
|
|
41340
41955
|
const paused = [];
|
|
41341
41956
|
for (const [id, tl] of Object.entries(win.__timelines)) {
|
|
@@ -41376,6 +41991,7 @@ function createManualOffsetDragMember(input) {
|
|
|
41376
41991
|
initialOffset,
|
|
41377
41992
|
plainTranslate,
|
|
41378
41993
|
baseGsap,
|
|
41994
|
+
...moving2 && { moving: moving2 },
|
|
41379
41995
|
initialPathOffset,
|
|
41380
41996
|
gestureToken,
|
|
41381
41997
|
screenToOffset: start?.screenToOffset ?? { a: w / scaleX, b: 0, c: 0, d: w / scaleY },
|
|
@@ -41392,6 +42008,7 @@ function createManualOffsetDragMember(input) {
|
|
|
41392
42008
|
initialOffset,
|
|
41393
42009
|
plainTranslate,
|
|
41394
42010
|
baseGsap,
|
|
42011
|
+
...moving2 && { moving: moving2 },
|
|
41395
42012
|
initialPathOffset,
|
|
41396
42013
|
gestureToken,
|
|
41397
42014
|
screenToOffset: measured.matrix,
|
|
@@ -41420,15 +42037,9 @@ function applyManualOffsetDragDraft(member, dx, dy) {
|
|
|
41420
42037
|
drawMemberOffset(member, offset, false);
|
|
41421
42038
|
return offset;
|
|
41422
42039
|
}
|
|
41423
|
-
function stampGestureBase(el, initialOffset, baseGsap) {
|
|
41424
|
-
el.setAttribute("data-hf-drag-gsap-base-x", String(baseGsap.x));
|
|
41425
|
-
el.setAttribute("data-hf-drag-gsap-base-y", String(baseGsap.y));
|
|
41426
|
-
el.setAttribute("data-hf-drag-initial-offset-x", String(initialOffset.x));
|
|
41427
|
-
el.setAttribute("data-hf-drag-initial-offset-y", String(initialOffset.y));
|
|
41428
|
-
}
|
|
41429
42040
|
function applyManualOffsetCommitValue(member, offset) {
|
|
41430
42041
|
if (!member.plainTranslate)
|
|
41431
|
-
stampGestureBase(member.element, member.initialOffset, member.baseGsap);
|
|
42042
|
+
stampGestureBase(member.element, member.initialOffset, member.baseGsap, !!member.moving);
|
|
41432
42043
|
drawMemberOffset(member, offset, true);
|
|
41433
42044
|
return offset;
|
|
41434
42045
|
}
|
|
@@ -41480,6 +42091,7 @@ function endManualOffsetDragMembers(members) {
|
|
|
41480
42091
|
member.element.removeAttribute("data-hf-drag-initial-offset-y");
|
|
41481
42092
|
member.element.removeAttribute("data-hf-drag-gsap-base-x");
|
|
41482
42093
|
member.element.removeAttribute("data-hf-drag-gsap-base-y");
|
|
42094
|
+
member.element.removeAttribute(DRAG_MOVING_ATTR);
|
|
41483
42095
|
const gsapOwnsPosition = !member.plainTranslate && Boolean(getOffsetDragGsap(member.element));
|
|
41484
42096
|
if (gsapOwnsPosition) clearStudioPathOffset(member.element);
|
|
41485
42097
|
settleDraftTranslate(member.element, gsapOwnsPosition);
|
|
@@ -41527,7 +42139,7 @@ function showMemberPosition(member, position) {
|
|
|
41527
42139
|
showPlacement(member.element, position.placement);
|
|
41528
42140
|
if (position.gsap) getOffsetDragGsap(member.element)?.set(member.element, { ...position.gsap });
|
|
41529
42141
|
if (!member.plainTranslate)
|
|
41530
|
-
stampGestureBase(member.element, member.initialOffset, member.baseGsap);
|
|
42142
|
+
stampGestureBase(member.element, member.initialOffset, member.baseGsap, !!member.moving);
|
|
41531
42143
|
}
|
|
41532
42144
|
function redrawMemberOnFrame(member) {
|
|
41533
42145
|
const { element, initialOffset } = member;
|
|
@@ -42133,13 +42745,6 @@ function startGroupDrag(e, opts, at, snap) {
|
|
|
42133
42745
|
notifyBlockedPress(e, opts, blockedSelection);
|
|
42134
42746
|
return false;
|
|
42135
42747
|
}
|
|
42136
|
-
const moving2 = items.find((item) => item.start?.gsap?.moving)?.selection;
|
|
42137
|
-
if (moving2) {
|
|
42138
|
-
e.preventDefault();
|
|
42139
|
-
e.stopPropagation();
|
|
42140
|
-
opts.onBlockedMoveRef.current(moving2, MOVING_LAYER_UNREADABLE);
|
|
42141
|
-
return false;
|
|
42142
|
-
}
|
|
42143
42748
|
opts.onManualDragStartRef.current?.();
|
|
42144
42749
|
const dragItems = filterNestedDomEditGroupItems(items);
|
|
42145
42750
|
const members = [];
|
|
@@ -42240,11 +42845,6 @@ function startGesture(kind, e, opts, options) {
|
|
|
42240
42845
|
let manualEditDragToken;
|
|
42241
42846
|
let pathOffsetMember;
|
|
42242
42847
|
if (kind === "drag") {
|
|
42243
|
-
if (start?.gsap?.moving) {
|
|
42244
|
-
opts.onBlockedMoveRef.current(sel, MOVING_LAYER_UNREADABLE);
|
|
42245
|
-
e.preventDefault();
|
|
42246
|
-
return false;
|
|
42247
|
-
}
|
|
42248
42848
|
opts.onManualDragStartRef.current?.();
|
|
42249
42849
|
const result = createManualOffsetDragMember({
|
|
42250
42850
|
key: selectionCacheKey(sel),
|
|
@@ -42382,8 +42982,15 @@ function editMoment(stamp) {
|
|
|
42382
42982
|
}
|
|
42383
42983
|
|
|
42384
42984
|
// src/components/editor/previewGestureStartRead.ts
|
|
42985
|
+
var startLayouts = /* @__PURE__ */ new Map();
|
|
42986
|
+
var gestureStartLayout = (handle) => startLayouts.get(handle) ?? null;
|
|
42385
42987
|
async function measurePreviewGestureStart(iframe, overlayEl, handles) {
|
|
42386
42988
|
const reply = await previewGestureStart(iframe, handles);
|
|
42989
|
+
startLayouts.clear();
|
|
42990
|
+
reply?.elements.forEach((start, i) => {
|
|
42991
|
+
const { width = 0, height = 0 } = start?.layout ?? {};
|
|
42992
|
+
if (width >= 1 && height >= 1) startLayouts.set(handles[i], { width, height });
|
|
42993
|
+
});
|
|
42387
42994
|
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
42388
42995
|
if (!reply || !scale) return null;
|
|
42389
42996
|
const { iframeRect, overlayRect, rootScaleX: sx, rootScaleY: sy } = scale;
|
|
@@ -42467,8 +43074,8 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
42467
43074
|
return true;
|
|
42468
43075
|
};
|
|
42469
43076
|
const endHeldPress = () => {
|
|
42470
|
-
const
|
|
42471
|
-
if (
|
|
43077
|
+
const held2 = opts.waitingPressRef.current;
|
|
43078
|
+
if (held2 && !held2.released) dropPress(held2);
|
|
42472
43079
|
};
|
|
42473
43080
|
const releaseWaitingPress = (press, e) => {
|
|
42474
43081
|
press.released = e;
|
|
@@ -42507,12 +43114,12 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
42507
43114
|
);
|
|
42508
43115
|
const handles = found.map((element) => element?.handle);
|
|
42509
43116
|
if (!overlay || !handles.length || !handles.every(Boolean)) return null;
|
|
42510
|
-
const
|
|
43117
|
+
const read3 = await measurePreviewGestureStart(iframe, overlay, handles);
|
|
42511
43118
|
const shown3 = selections.flatMap((selection, i) => {
|
|
42512
|
-
const element =
|
|
43119
|
+
const element = read3?.elements[i];
|
|
42513
43120
|
return element ? [{ selection: { ...selection, handle: handles[i] }, ...element }] : [];
|
|
42514
43121
|
});
|
|
42515
|
-
return
|
|
43122
|
+
return read3 && shown3.length === selections.length ? { shown: shown3, snap: read3.snap } : null;
|
|
42516
43123
|
};
|
|
42517
43124
|
const startOnShownPreview = (e, pressed, start, draw = null, targets = () => []) => {
|
|
42518
43125
|
const at = playheadMoment();
|
|
@@ -42523,9 +43130,9 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
42523
43130
|
e.preventDefault();
|
|
42524
43131
|
e.stopPropagation();
|
|
42525
43132
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
42526
|
-
const
|
|
43133
|
+
const held2 = { setPointerCapture() {
|
|
42527
43134
|
} };
|
|
42528
|
-
const down = { ...e, currentTarget:
|
|
43135
|
+
const down = { ...e, currentTarget: held2, preventDefault() {
|
|
42529
43136
|
}, stopPropagation() {
|
|
42530
43137
|
} };
|
|
42531
43138
|
const press = {
|
|
@@ -42866,7 +43473,7 @@ function createDomEditSaveQueue(options = {}) {
|
|
|
42866
43473
|
breakerOpen = true;
|
|
42867
43474
|
options.onOpen?.({
|
|
42868
43475
|
consecutiveFailures,
|
|
42869
|
-
|
|
43476
|
+
errorCodes: studioSaveErrorCodes(error),
|
|
42870
43477
|
statusCode: getStudioSaveStatusCode(error) ?? null
|
|
42871
43478
|
});
|
|
42872
43479
|
};
|
|
@@ -42976,8 +43583,8 @@ function createDomEditOverlayGestureHandlers(opts) {
|
|
|
42976
43583
|
if (!blockedMove && !g && !groupG) {
|
|
42977
43584
|
opts.onCanvasPointerMoveRef.current(e, { preferClipAncestor: false });
|
|
42978
43585
|
}
|
|
42979
|
-
const
|
|
42980
|
-
if (
|
|
43586
|
+
const held2 = g ?? groupG;
|
|
43587
|
+
if (held2 && !movesGesture(held2, e)) return;
|
|
42981
43588
|
if (blockedMove) {
|
|
42982
43589
|
const dx2 = e.clientX - blockedMove.startX;
|
|
42983
43590
|
const dy2 = e.clientY - blockedMove.startY;
|
|
@@ -46781,11 +47388,15 @@ function redactValue(value) {
|
|
|
46781
47388
|
return `[redacted len=${value.length}]`;
|
|
46782
47389
|
}
|
|
46783
47390
|
function redactMismatches(mismatches) {
|
|
46784
|
-
return
|
|
46785
|
-
|
|
46786
|
-
|
|
46787
|
-
|
|
46788
|
-
|
|
47391
|
+
return JSON.stringify(
|
|
47392
|
+
mismatches.map((m) => ({
|
|
47393
|
+
...m,
|
|
47394
|
+
expected: redactValue(m.expected),
|
|
47395
|
+
actual: redactValue(m.actual),
|
|
47396
|
+
error: redactValue(m.error),
|
|
47397
|
+
animationId: void 0
|
|
47398
|
+
}))
|
|
47399
|
+
);
|
|
46789
47400
|
}
|
|
46790
47401
|
var emptySessionReported = /* @__PURE__ */ new WeakSet();
|
|
46791
47402
|
function reportEmptySession(session, opLabel) {
|
|
@@ -46797,7 +47408,7 @@ function reportEmptySession(session, opLabel) {
|
|
|
46797
47408
|
sessionEmpty: true,
|
|
46798
47409
|
sessionElementCount: 0,
|
|
46799
47410
|
mismatchCount: 1,
|
|
46800
|
-
mismatches:
|
|
47411
|
+
mismatches: redactMismatches([{ kind: "session_empty" }])
|
|
46801
47412
|
});
|
|
46802
47413
|
}
|
|
46803
47414
|
return true;
|
|
@@ -46832,7 +47443,7 @@ function runResolverShadow(session, hfId, ops, sourceContent, paths) {
|
|
|
46832
47443
|
// attribute count came back 0 — see the sourceHfIdCount comment above.
|
|
46833
47444
|
...strictCount === 0 ? { sourceLooseMatchOnly: true } : {},
|
|
46834
47445
|
mismatchCount: mismatches.length,
|
|
46835
|
-
mismatches:
|
|
47446
|
+
mismatches: redactMismatches(mismatches)
|
|
46836
47447
|
});
|
|
46837
47448
|
} catch {
|
|
46838
47449
|
}
|
|
@@ -46880,7 +47491,7 @@ async function recordResolverParity(session, hfId, opLabel, readSource, paths) {
|
|
|
46880
47491
|
// fail-open without the suppression/count checks" from "no reader wired".
|
|
46881
47492
|
...sourceReadFailed ? { sourceReadFailed: true } : {},
|
|
46882
47493
|
mismatchCount: 1,
|
|
46883
|
-
mismatches:
|
|
47494
|
+
mismatches: redactMismatches([
|
|
46884
47495
|
{ kind: "element_not_found", hfId }
|
|
46885
47496
|
])
|
|
46886
47497
|
});
|
|
@@ -46942,9 +47553,7 @@ async function recordAnimationResolverParity(session, animationId, opLabel, read
|
|
|
46942
47553
|
...diskChecked ? { diskChecked: true } : {},
|
|
46943
47554
|
...sourceReadFailed ? { sourceReadFailed: true } : {},
|
|
46944
47555
|
mismatchCount: 1,
|
|
46945
|
-
mismatches:
|
|
46946
|
-
{ kind: "animation_not_found", animationId }
|
|
46947
|
-
])
|
|
47556
|
+
mismatches: redactMismatches([{ kind: "animation_not_found" }])
|
|
46948
47557
|
});
|
|
46949
47558
|
} catch {
|
|
46950
47559
|
}
|
|
@@ -47116,40 +47725,6 @@ function sdkCutoverIneligibleReason(hfId, ops) {
|
|
|
47116
47725
|
|
|
47117
47726
|
// src/utils/sdkEditTransaction.ts
|
|
47118
47727
|
import { openComposition as openComposition2 } from "@hyperframes/sdk";
|
|
47119
|
-
|
|
47120
|
-
// src/hooks/sdkSelfWriteRegistry.ts
|
|
47121
|
-
var SELF_WRITE_TTL_MS = 2e3;
|
|
47122
|
-
var registry2 = /* @__PURE__ */ new Map();
|
|
47123
|
-
function hashContent(content) {
|
|
47124
|
-
let h = 2166136261;
|
|
47125
|
-
for (let i = 0; i < content.length; i++) {
|
|
47126
|
-
h ^= content.charCodeAt(i);
|
|
47127
|
-
h = Math.imul(h, 16777619);
|
|
47128
|
-
}
|
|
47129
|
-
return (h >>> 0).toString(16);
|
|
47130
|
-
}
|
|
47131
|
-
function prune(entries, now2) {
|
|
47132
|
-
return entries.filter((e) => now2 - e.at < SELF_WRITE_TTL_MS);
|
|
47133
|
-
}
|
|
47134
|
-
function markSelfWrite(path, content, now2 = Date.now()) {
|
|
47135
|
-
const next = prune(registry2.get(path) ?? [], now2);
|
|
47136
|
-
next.push({ hash: hashContent(content), at: now2 });
|
|
47137
|
-
registry2.set(path, next);
|
|
47138
|
-
}
|
|
47139
|
-
function isSelfWriteEcho(path, content, now2 = Date.now()) {
|
|
47140
|
-
const entries = prune(registry2.get(path) ?? [], now2);
|
|
47141
|
-
const hash = hashContent(content);
|
|
47142
|
-
const idx = entries.findIndex((e) => e.hash === hash);
|
|
47143
|
-
if (idx === -1) {
|
|
47144
|
-
registry2.set(path, entries);
|
|
47145
|
-
return false;
|
|
47146
|
-
}
|
|
47147
|
-
entries.splice(idx, 1);
|
|
47148
|
-
registry2.set(path, entries);
|
|
47149
|
-
return true;
|
|
47150
|
-
}
|
|
47151
|
-
|
|
47152
|
-
// src/utils/sdkEditTransaction.ts
|
|
47153
47728
|
function declinedCutover(reason, family, resolverDisagreement) {
|
|
47154
47729
|
trackStudioEvent("sdk_cutover_declined", {
|
|
47155
47730
|
reason,
|
|
@@ -47176,6 +47751,7 @@ function failedCutover(error, family, context = {}) {
|
|
|
47176
47751
|
family,
|
|
47177
47752
|
error_kind: cutoverErrorKind(err),
|
|
47178
47753
|
...err instanceof StudioSaveHttpError ? { status: err.statusCode } : {},
|
|
47754
|
+
error_name: err.name,
|
|
47179
47755
|
error: err.message
|
|
47180
47756
|
});
|
|
47181
47757
|
return { status: "failed", error: err };
|
|
@@ -47263,7 +47839,8 @@ function refreshCommittedEdit(after, deps, options) {
|
|
|
47263
47839
|
if (deps.refresh) deps.refresh(after);
|
|
47264
47840
|
else if (!options?.skipRefresh) deps.reloadPreview();
|
|
47265
47841
|
} catch (error) {
|
|
47266
|
-
|
|
47842
|
+
const err = asCutoverError(error);
|
|
47843
|
+
trackStudioEvent("sdk_cutover_refresh_failed", { error_name: err.name, error: err.message });
|
|
47267
47844
|
}
|
|
47268
47845
|
}
|
|
47269
47846
|
async function commitCandidateEdit(edit, targetPath, originalContent, deps, options) {
|
|
@@ -47284,9 +47861,11 @@ async function commitCandidateEdit(edit, targetPath, originalContent, deps, opti
|
|
|
47284
47861
|
if (publication === "rejected-inactive-target") refreshTarget = false;
|
|
47285
47862
|
}
|
|
47286
47863
|
} catch (error) {
|
|
47864
|
+
const err = asCutoverError(error);
|
|
47287
47865
|
trackStudioEvent("sdk_cutover_publish_failed", {
|
|
47288
47866
|
path: targetPath,
|
|
47289
|
-
|
|
47867
|
+
error_name: err.name,
|
|
47868
|
+
error: err.message
|
|
47290
47869
|
});
|
|
47291
47870
|
}
|
|
47292
47871
|
if (refreshTarget) refreshCommittedEdit(edit.after, deps, options);
|
|
@@ -47346,8 +47925,8 @@ function wrongCompositionFile(deps, targetPath) {
|
|
|
47346
47925
|
return deps.compositionPath != null && targetPath !== deps.compositionPath;
|
|
47347
47926
|
}
|
|
47348
47927
|
function gsapReadSource(deps, targetPath) {
|
|
47349
|
-
const
|
|
47350
|
-
return
|
|
47928
|
+
const read3 = deps.readProjectFile;
|
|
47929
|
+
return read3 ? () => read3(targetPath) : void 0;
|
|
47351
47930
|
}
|
|
47352
47931
|
async function sdkCutoverPersist(selection, ops, originalContent, targetPath, sdkSession, deps, options) {
|
|
47353
47932
|
if (!sdkFamilyEnabled("dom")) return declinedCutover("feature_disabled", "dom");
|
|
@@ -48323,7 +48902,7 @@ import {
|
|
|
48323
48902
|
useReducer,
|
|
48324
48903
|
useRef as useRef80,
|
|
48325
48904
|
useState as useState60,
|
|
48326
|
-
useSyncExternalStore as
|
|
48905
|
+
useSyncExternalStore as useSyncExternalStore9
|
|
48327
48906
|
} from "react";
|
|
48328
48907
|
|
|
48329
48908
|
// src/webmcp/handles.ts
|
|
@@ -48379,9 +48958,9 @@ function patchTargetAddress(target, activeCompositionPath, projectId) {
|
|
|
48379
48958
|
activeCompositionPath
|
|
48380
48959
|
};
|
|
48381
48960
|
}
|
|
48382
|
-
function decodeScopedParts(rest,
|
|
48961
|
+
function decodeScopedParts(rest, version2, count) {
|
|
48383
48962
|
const parts = rest.split(SEPARATOR);
|
|
48384
|
-
if (parts[0] !==
|
|
48963
|
+
if (parts[0] !== version2 || parts.length !== count + 1) return null;
|
|
48385
48964
|
return parts.slice(1).map(decodeHandlePart);
|
|
48386
48965
|
}
|
|
48387
48966
|
function parseV1ScopedValue(rest) {
|
|
@@ -49127,7 +49706,7 @@ function subscribeReducedMotion(listener2) {
|
|
|
49127
49706
|
return () => query.removeEventListener("change", listener2);
|
|
49128
49707
|
}
|
|
49129
49708
|
function useTopologyLensState() {
|
|
49130
|
-
const lifecycle =
|
|
49709
|
+
const lifecycle = useSyncExternalStore9(
|
|
49131
49710
|
studioEditLifecycle.subscribe,
|
|
49132
49711
|
studioEditLifecycle.getSnapshot,
|
|
49133
49712
|
studioEditLifecycle.getSnapshot
|
|
@@ -49156,7 +49735,7 @@ function useTopologyLensState() {
|
|
|
49156
49735
|
function TopologyLens({ iframeRef, activeCompositionPath }) {
|
|
49157
49736
|
const overlayRef = useRef80(null);
|
|
49158
49737
|
const state = useTopologyLensState();
|
|
49159
|
-
const reducedMotion2 =
|
|
49738
|
+
const reducedMotion2 = useSyncExternalStore9(subscribeReducedMotion, getReducedMotion, () => false);
|
|
49160
49739
|
const [measured, setMeasured] = useState60(null);
|
|
49161
49740
|
const callId = state.phase === "hidden" ? null : state.callId;
|
|
49162
49741
|
const handle = state.phase === "hidden" ? null : state.target.handle;
|
|
@@ -49470,7 +50049,8 @@ var GSAP_EDIT_DETAIL_COPY = {
|
|
|
49470
50049
|
"array-step-config": `${STEP_LIST} with its own tween setting (like repeat or stagger), which Studio can't keep while it edits them. ${IN_CODE}`,
|
|
49471
50050
|
"array-step-computed": `${STEP_LIST} whose value comes from code, which Studio can't keep while it edits them. ${IN_CODE}`,
|
|
49472
50051
|
"array-step-relative": `${STEP_LIST} with a relative value (like "+=40"), which an edit would apply again. ${IN_CODE}`,
|
|
49473
|
-
"array-step-random": `${STEP_LIST} with a random() value, which an edit would roll again. ${IN_CODE}
|
|
50052
|
+
"array-step-random": `${STEP_LIST} with a random() value, which an edit would roll again. ${IN_CODE}`,
|
|
50053
|
+
"frame-tweens-unreadable": "This preview couldn't read the layer's animation, so Studio can't save the move. Move it in the Code tab."
|
|
49474
50054
|
};
|
|
49475
50055
|
function gsapEditBlockMessage(reason, detail) {
|
|
49476
50056
|
return (detail && GSAP_EDIT_DETAIL_COPY[detail]) ?? GSAP_EDIT_BLOCK_COPY[reason];
|
|
@@ -50059,12 +50639,12 @@ function sizeAt(p) {
|
|
|
50059
50639
|
...finiteNumber3(p.height) && { h: p.height }
|
|
50060
50640
|
};
|
|
50061
50641
|
}
|
|
50062
|
-
function buildMotionPathGeometry(
|
|
50063
|
-
if (!
|
|
50064
|
-
const isArc = Boolean(
|
|
50642
|
+
function buildMotionPathGeometry(read3, base2 = { x: 0, y: 0 }) {
|
|
50643
|
+
if (!read3) return null;
|
|
50644
|
+
const isArc = Boolean(read3.arcPath);
|
|
50065
50645
|
const nodes = [];
|
|
50066
|
-
const tweenHasX =
|
|
50067
|
-
const tweenHasY =
|
|
50646
|
+
const tweenHasX = read3.keyframes.some((kf) => finiteNumber3(kf.properties.x));
|
|
50647
|
+
const tweenHasY = read3.keyframes.some((kf) => finiteNumber3(kf.properties.y));
|
|
50068
50648
|
if (!tweenHasX && !tweenHasY) return null;
|
|
50069
50649
|
const pointAt = (p) => {
|
|
50070
50650
|
if (tweenHasX && !finiteNumber3(p.x) || tweenHasY && !finiteNumber3(p.y)) return null;
|
|
@@ -50072,7 +50652,7 @@ function buildMotionPathGeometry(read2, base2 = { x: 0, y: 0 }) {
|
|
|
50072
50652
|
const y = tweenHasY ? p.y : base2.y;
|
|
50073
50653
|
return { x, y, ...sizeAt(p) };
|
|
50074
50654
|
};
|
|
50075
|
-
|
|
50655
|
+
read3.keyframes.forEach((kf, i) => {
|
|
50076
50656
|
const at = pointAt(kf.properties);
|
|
50077
50657
|
if (!at) return;
|
|
50078
50658
|
nodes.push({
|
|
@@ -50081,7 +50661,7 @@ function buildMotionPathGeometry(read2, base2 = { x: 0, y: 0 }) {
|
|
|
50081
50661
|
});
|
|
50082
50662
|
});
|
|
50083
50663
|
if (nodes.length < 2) return null;
|
|
50084
|
-
const start = !isArc &&
|
|
50664
|
+
const start = !isArc && read3.start ? pointAt(read3.start) : null;
|
|
50085
50665
|
return {
|
|
50086
50666
|
kind: isArc ? "arc" : "linear",
|
|
50087
50667
|
points: nodes.map((n) => `${n.x},${n.y}`).join(" "),
|
|
@@ -50536,25 +51116,25 @@ function upsert(keyframes, percentage, properties, ease) {
|
|
|
50536
51116
|
}
|
|
50537
51117
|
function heldEnds(norm, end, implicit, backfilled) {
|
|
50538
51118
|
const props = new Set(norm.keyframes.flatMap((kf) => Object.keys(kf.properties)));
|
|
50539
|
-
const
|
|
51119
|
+
const held2 = {};
|
|
50540
51120
|
for (const prop of props) {
|
|
50541
51121
|
const known = valueAt(norm.keyframes, prop, end === "start" ? "first" : "last");
|
|
50542
51122
|
const value = known && (end === "end" || known.percentage <= 0) ? known.value : backfilled[prop] ?? implicit(prop, "start");
|
|
50543
51123
|
if (value == null) return null;
|
|
50544
|
-
|
|
51124
|
+
held2[prop] = value;
|
|
50545
51125
|
}
|
|
50546
|
-
return
|
|
51126
|
+
return held2;
|
|
50547
51127
|
}
|
|
50548
51128
|
function holdOmittedChannels(steps, implicit, backfilled) {
|
|
50549
51129
|
const props = new Set(steps.flatMap((kf) => Object.keys(kf.properties)));
|
|
50550
51130
|
for (const prop of props) {
|
|
50551
|
-
let
|
|
51131
|
+
let held2;
|
|
50552
51132
|
for (const kf of steps) {
|
|
50553
|
-
if (kf.properties[prop] != null)
|
|
51133
|
+
if (kf.properties[prop] != null) held2 = kf.properties[prop];
|
|
50554
51134
|
else {
|
|
50555
|
-
|
|
50556
|
-
if (
|
|
50557
|
-
kf.properties[prop] =
|
|
51135
|
+
held2 ??= backfilled[prop] ?? implicit(prop, "start");
|
|
51136
|
+
if (held2 == null) return false;
|
|
51137
|
+
kf.properties[prop] = held2;
|
|
50558
51138
|
}
|
|
50559
51139
|
}
|
|
50560
51140
|
}
|
|
@@ -50604,8 +51184,8 @@ function planValueAtPlayhead(edit) {
|
|
|
50604
51184
|
if (eased) return refuse("eased-keyframes");
|
|
50605
51185
|
const time = edit.at.time;
|
|
50606
51186
|
const before = time < start;
|
|
50607
|
-
const
|
|
50608
|
-
if (!
|
|
51187
|
+
const held2 = heldEnds(norm, before ? "start" : "end", edit.implicitEndValue, backfilled);
|
|
51188
|
+
if (!held2) return refuse("implicit-end-unknown");
|
|
50609
51189
|
position = before ? time : start;
|
|
50610
51190
|
span = before ? start + duration - time : time - start;
|
|
50611
51191
|
for (const kf of keyframes) {
|
|
@@ -50615,9 +51195,9 @@ function planValueAtPlayhead(edit) {
|
|
|
50615
51195
|
}
|
|
50616
51196
|
const oldEdge = roundPct2(((before ? start : start + duration) - position) / span * 100);
|
|
50617
51197
|
const linear = isLinear(norm.easeEach ?? PERCENTAGE_SEGMENT_EASE) ? void 0 : "none";
|
|
50618
|
-
const edge = upsert(keyframes, oldEdge,
|
|
51198
|
+
const edge = upsert(keyframes, oldEdge, held2, linear);
|
|
50619
51199
|
if (before && linear) edge.ease ??= linear;
|
|
50620
|
-
upsert(keyframes, before ? 0 : 100, { ...
|
|
51200
|
+
upsert(keyframes, before ? 0 : 100, { ...held2, ...values }, before ? void 0 : linear);
|
|
50621
51201
|
}
|
|
50622
51202
|
if (!holdOmittedChannels(steps, edit.implicitEndValue, backfilled))
|
|
50623
51203
|
return refuse("implicit-end-unknown");
|
|
@@ -50799,81 +51379,19 @@ function commitCreatePath(targetSelector, position, x, y, commit2) {
|
|
|
50799
51379
|
);
|
|
50800
51380
|
}
|
|
50801
51381
|
|
|
50802
|
-
// src/components/editor/
|
|
50803
|
-
|
|
50804
|
-
const t2 = el.ownerDocument?.defaultView?.getComputedStyle(el).transform;
|
|
50805
|
-
if (!t2 || t2 === "none") return { x: 0, y: 0 };
|
|
50806
|
-
const m3 = t2.match(/matrix3d\(([^)]+)\)/);
|
|
50807
|
-
if (m3) {
|
|
50808
|
-
const v = m3[1].split(",").map(Number);
|
|
50809
|
-
return { x: v[12] || 0, y: v[13] || 0 };
|
|
50810
|
-
}
|
|
50811
|
-
const m = t2.match(/matrix\(([^)]+)\)/);
|
|
50812
|
-
if (m) {
|
|
50813
|
-
const v = m[1].split(",").map(Number);
|
|
50814
|
-
return { x: v[4] || 0, y: v[5] || 0 };
|
|
50815
|
-
}
|
|
50816
|
-
return { x: 0, y: 0 };
|
|
50817
|
-
}
|
|
50818
|
-
function cssTranslate(el) {
|
|
50819
|
-
const raw = el.ownerDocument?.defaultView?.getComputedStyle(el).translate ?? "none";
|
|
50820
|
-
const [x = "0", y = "0"] = raw === "none" ? [] : raw.split(" ");
|
|
50821
|
-
const px = (v, size) => v.endsWith("%") ? Number.parseFloat(v) / 100 * size : Number.parseFloat(v) || 0;
|
|
50822
|
-
return [px(x, el.offsetWidth), px(y, el.offsetHeight)];
|
|
50823
|
-
}
|
|
50824
|
-
function growShares(el, px, py) {
|
|
50825
|
-
const style = el.ownerDocument?.defaultView?.getComputedStyle(el);
|
|
50826
|
-
if (!style || !/^(absolute|fixed)$/.test(style.position)) return { ax: 0, ay: 0 };
|
|
50827
|
-
const map = el.computedStyleMap?.();
|
|
50828
|
-
const auto = (side) => String(map?.get(side) ?? "") === "auto";
|
|
50829
|
-
const share = (start, end) => auto(start) && !auto(end) ? -0.5 : 0.5;
|
|
50830
|
-
return { ax: share("left", "right") + px, ay: share("top", "bottom") + py };
|
|
50831
|
-
}
|
|
50832
|
-
function elementHome(el) {
|
|
50833
|
-
let left = 0;
|
|
50834
|
-
let top = 0;
|
|
50835
|
-
let node = el;
|
|
50836
|
-
while (node) {
|
|
50837
|
-
left += node.offsetLeft;
|
|
50838
|
-
top += node.offsetTop;
|
|
50839
|
-
if (node !== el) {
|
|
50840
|
-
const t2 = transformTranslate(node);
|
|
50841
|
-
left += t2.x;
|
|
50842
|
-
top += t2.y;
|
|
50843
|
-
}
|
|
50844
|
-
const parent = node.offsetParent;
|
|
50845
|
-
if (!parent || parent.hasAttribute("data-composition-id")) break;
|
|
50846
|
-
node = parent;
|
|
50847
|
-
}
|
|
50848
|
-
const cache2 = el._gsap;
|
|
50849
|
-
const parsed = cache2 !== void 0 && "x" in cache2 && !cache2.uncache;
|
|
50850
|
-
const [tx, ty] = cssTranslate(el);
|
|
50851
|
-
const share = (cached5, t2, size) => parsed ? (Number(cached5) || 0) / 100 : t2 && Math.round(size / 2) === Math.round(-t2) ? -0.5 : 0;
|
|
50852
|
-
const own = parsed ? { x: 0, y: 0 } : transformTranslate(el);
|
|
50853
|
-
const [px, py] = [
|
|
50854
|
-
share(cache2?.xPercent, tx + own.x, el.offsetWidth),
|
|
50855
|
-
share(cache2?.yPercent, ty + own.y, el.offsetHeight)
|
|
50856
|
-
];
|
|
50857
|
-
const x = left + el.offsetWidth * (0.5 + px) + (parsed ? tx : 0);
|
|
50858
|
-
const y = top + el.offsetHeight * (0.5 + py) + (parsed ? ty : 0);
|
|
50859
|
-
const { ax, ay } = growShares(el, px, py);
|
|
50860
|
-
return { x, y, w: el.offsetWidth, h: el.offsetHeight, ax, ay };
|
|
50861
|
-
}
|
|
51382
|
+
// src/components/editor/MotionPathOverlay.tsx
|
|
51383
|
+
import { elementHome as elementHome2, transformWDivisor as transformWDivisor2 } from "@hyperframes/core/runtime/editing-port";
|
|
50862
51384
|
|
|
50863
51385
|
// src/components/editor/useMotionPathData.ts
|
|
50864
51386
|
import { useEffect as useEffect66, useRef as useRef81, useState as useState61 } from "react";
|
|
50865
51387
|
import { isHtmlElement as isHtmlElement7 } from "@hyperframes/core/runtime/dom-realm";
|
|
50866
|
-
|
|
50867
|
-
const t2 = el.ownerDocument?.defaultView?.getComputedStyle(el).transform;
|
|
50868
|
-
if (!t2 || !t2.startsWith("matrix3d(")) return 1;
|
|
50869
|
-
const v = t2.slice("matrix3d(".length, -1).split(",");
|
|
50870
|
-
const w = Number.parseFloat(v[15] ?? "");
|
|
50871
|
-
return Number.isFinite(w) && w > 0 ? w : 1;
|
|
50872
|
-
}
|
|
51388
|
+
import { elementHome, transformWDivisor } from "@hyperframes/core/runtime/editing-port";
|
|
50873
51389
|
function rectsClose(a, b) {
|
|
50874
51390
|
return Math.abs(a.left - b.left) < 0.5 && Math.abs(a.top - b.top) < 0.5 && Math.abs(a.width - b.width) < 0.5 && Math.abs(a.height - b.height) < 0.5;
|
|
50875
51391
|
}
|
|
51392
|
+
var sealedPlugins = /* @__PURE__ */ new WeakMap();
|
|
50876
51393
|
function hasMotionPathPlugin(iframe) {
|
|
51394
|
+
if (iframe && previewFrameOpaque(iframe)) return sealedPlugins.get(iframe) ?? false;
|
|
50877
51395
|
try {
|
|
50878
51396
|
return Boolean(
|
|
50879
51397
|
iframe?.contentWindow?.MotionPathPlugin
|
|
@@ -50882,6 +51400,22 @@ function hasMotionPathPlugin(iframe) {
|
|
|
50882
51400
|
return false;
|
|
50883
51401
|
}
|
|
50884
51402
|
}
|
|
51403
|
+
var sameHome = (a, b) => Math.abs(a.x - b.x) < 0.5 && Math.abs(a.y - b.y) < 0.5 && a.w === b.w && a.h === b.h && a.ax === b.ax && a.ay === b.ay;
|
|
51404
|
+
var HOME_FIELDS = ["x", "y", "w", "h", "ax", "ay"];
|
|
51405
|
+
function readHome(value) {
|
|
51406
|
+
if (typeof value !== "object" || value === null) return null;
|
|
51407
|
+
const fields = value;
|
|
51408
|
+
const ok = HOME_FIELDS.every((name) => Number.isFinite(fields[name]));
|
|
51409
|
+
return ok ? Object.fromEntries(HOME_FIELDS.map((n) => [n, fields[n]])) : null;
|
|
51410
|
+
}
|
|
51411
|
+
async function sealedMotionPathHome(iframe, selector) {
|
|
51412
|
+
const reply = await previewRequest(iframe, "motion-path-home", { selector });
|
|
51413
|
+
if (!reply || typeof reply.plugin !== "boolean" || typeof reply.visible !== "boolean")
|
|
51414
|
+
return null;
|
|
51415
|
+
sealedPlugins.set(iframe, reply.plugin);
|
|
51416
|
+
const perspective = Number.isFinite(reply.perspective) && reply.perspective > 0 ? reply.perspective : 1;
|
|
51417
|
+
return { visible: reply.visible, home: readHome(reply.home), perspective, plugin: reply.plugin };
|
|
51418
|
+
}
|
|
50885
51419
|
function useMotionPathData(iframeRef, selector) {
|
|
50886
51420
|
const [rect, setRect] = useState61(null);
|
|
50887
51421
|
const [geometry, setGeometry] = useState61(null);
|
|
@@ -50913,35 +51447,66 @@ function useMotionPathData(iframeRef, selector) {
|
|
|
50913
51447
|
height: r.height
|
|
50914
51448
|
};
|
|
50915
51449
|
setRect((prev) => prev && rectsClose(prev, next) ? prev : next);
|
|
51450
|
+
if (previewFrameOpaque(el)) {
|
|
51451
|
+
askSealed(el);
|
|
51452
|
+
return;
|
|
51453
|
+
}
|
|
50916
51454
|
let target = null;
|
|
50917
51455
|
try {
|
|
50918
51456
|
target = el.contentDocument?.querySelector(selector) ?? null;
|
|
50919
51457
|
} catch {
|
|
50920
51458
|
}
|
|
50921
51459
|
const live = isHtmlElement7(target) ? target : null;
|
|
50922
|
-
|
|
50923
|
-
|
|
50924
|
-
|
|
50925
|
-
|
|
50926
|
-
setHome(
|
|
50927
|
-
(prev) => prev && Math.abs(prev.x - h.x) < 0.5 && Math.abs(prev.y - h.y) < 0.5 && prev.w === h.w && prev.h === h.h && prev.ax === h.ax && prev.ay === h.ay ? prev : h
|
|
50928
|
-
);
|
|
50929
|
-
const ps = 1 / transformWDivisor(live);
|
|
50930
|
-
setPScale((p) => Math.abs(p - ps) < 1e-3 ? p : ps);
|
|
51460
|
+
if (!live) apply({ visible: true, home: null, perspective: 1 });
|
|
51461
|
+
else {
|
|
51462
|
+
const visible = isElementVisibleForOverlay(live);
|
|
51463
|
+
apply({ visible, home: elementHome(live), perspective: 1 / transformWDivisor(live) });
|
|
50931
51464
|
}
|
|
50932
51465
|
}
|
|
50933
51466
|
};
|
|
50934
|
-
|
|
51467
|
+
const apply = ({ visible, home: h, perspective: ps }) => {
|
|
51468
|
+
setVisibleInPreview((prev) => prev === visible ? prev : visible);
|
|
51469
|
+
if (!h) return;
|
|
51470
|
+
setHome((prev) => prev && sameHome(prev, h) ? prev : h);
|
|
51471
|
+
setPScale((p) => Math.abs(p - ps) < 1e-3 ? p : ps);
|
|
51472
|
+
};
|
|
51473
|
+
let asking2 = false;
|
|
51474
|
+
let stopped = false;
|
|
51475
|
+
const askSealed = (frame3) => {
|
|
51476
|
+
if (asking2) return;
|
|
51477
|
+
asking2 = true;
|
|
51478
|
+
void sealedMotionPathHome(frame3, selector).then((reply) => {
|
|
51479
|
+
asking2 = false;
|
|
51480
|
+
if (reply && !stopped) apply(reply);
|
|
51481
|
+
});
|
|
51482
|
+
};
|
|
51483
|
+
const stop2 = subscribeOverlayFrame(tick);
|
|
51484
|
+
return () => {
|
|
51485
|
+
stopped = true;
|
|
51486
|
+
stop2();
|
|
51487
|
+
};
|
|
50935
51488
|
}, [selector, iframeRef, drawn]);
|
|
51489
|
+
const [, notePlugin] = useState61(false);
|
|
51490
|
+
useEffect66(() => {
|
|
51491
|
+
const frame3 = iframeRef.current;
|
|
51492
|
+
if (!selector || !frame3 || !previewFrameOpaque(frame3)) return;
|
|
51493
|
+
let current2 = true;
|
|
51494
|
+
void sealedMotionPathHome(frame3, selector).then((reply) => {
|
|
51495
|
+
if (current2 && reply) notePlugin(reply.plugin);
|
|
51496
|
+
});
|
|
51497
|
+
return () => {
|
|
51498
|
+
current2 = false;
|
|
51499
|
+
};
|
|
51500
|
+
}, [selector, iframeRef]);
|
|
50936
51501
|
useEffect66(() => {
|
|
50937
51502
|
if (!selector) {
|
|
50938
51503
|
setGeometry(null);
|
|
50939
51504
|
return;
|
|
50940
51505
|
}
|
|
50941
51506
|
const recompute = () => {
|
|
50942
|
-
const
|
|
50943
|
-
const base2 =
|
|
50944
|
-
const next = buildMotionPathGeometry(
|
|
51507
|
+
const read3 = readRuntimeKeyframes(iframeRef.current, selector, void 0, ["x", "y"]);
|
|
51508
|
+
const base2 = read3 ? readGsapPositionFromIframe(iframeRef.current, selector) : null;
|
|
51509
|
+
const next = buildMotionPathGeometry(read3, base2 ?? void 0);
|
|
50945
51510
|
setGeometry(
|
|
50946
51511
|
(prev) => prev?.kind === next?.kind && JSON.stringify([prev?.nodes, prev?.start]) === JSON.stringify([next?.nodes, next?.start]) ? prev : next
|
|
50947
51512
|
);
|
|
@@ -51038,17 +51603,24 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
|
|
|
51038
51603
|
if (e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom) {
|
|
51039
51604
|
return;
|
|
51040
51605
|
}
|
|
51041
|
-
const
|
|
51042
|
-
|
|
51606
|
+
const sealed = previewFrameOpaque(frame3);
|
|
51607
|
+
const live = sealed ? null : frame3.contentDocument?.querySelector(createSelector);
|
|
51608
|
+
if (!isHtmlElement8(live) && !(sealed && home)) return;
|
|
51043
51609
|
e.stopPropagation();
|
|
51044
51610
|
e.preventDefault();
|
|
51045
51611
|
const sc = r.width / compW;
|
|
51046
|
-
const elHome = elementHome(live);
|
|
51047
|
-
const ps = 1 / transformWDivisor(live);
|
|
51048
|
-
const px = Math.round(((e.clientX - r.left) / sc - elHome.x) / ps);
|
|
51049
|
-
const py = Math.round(((e.clientY - r.top) / sc - elHome.y) / ps);
|
|
51050
51612
|
const t2 = Math.round(usePlayerStore.getState().currentTime * 100) / 100;
|
|
51051
|
-
|
|
51613
|
+
const place = (elHome, ps) => {
|
|
51614
|
+
const px = Math.round(((e.clientX - r.left) / sc - elHome.x) / ps);
|
|
51615
|
+
const py = Math.round(((e.clientY - r.top) / sc - elHome.y) / ps);
|
|
51616
|
+
void commitCreatePath(createSelector, t2, px, py, commitMutation);
|
|
51617
|
+
};
|
|
51618
|
+
if (isHtmlElement8(live)) place(elementHome2(live), 1 / transformWDivisor2(live));
|
|
51619
|
+
else {
|
|
51620
|
+
void sealedMotionPathHome(frame3, createSelector).then(
|
|
51621
|
+
(read3) => place(read3?.home ?? home, read3?.home ? read3.perspective : pScale)
|
|
51622
|
+
);
|
|
51623
|
+
}
|
|
51052
51624
|
setMotionPathArmed(false);
|
|
51053
51625
|
};
|
|
51054
51626
|
surface.addEventListener("pointerdown", onDown2, true);
|
|
@@ -51056,7 +51628,7 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
|
|
|
51056
51628
|
surface.removeEventListener("pointerdown", onDown2, true);
|
|
51057
51629
|
surface.style.cursor = prevCursor;
|
|
51058
51630
|
};
|
|
51059
|
-
}, [armed, createSelector, compW, iframeRef, commitMutation, setMotionPathArmed]);
|
|
51631
|
+
}, [armed, createSelector, compW, iframeRef, commitMutation, setMotionPathArmed, home, pScale]);
|
|
51060
51632
|
if (!rect || rect.width <= 0 || !compositionSize || compositionSize.width <= 0) return null;
|
|
51061
51633
|
if (!visibleInPreview) return null;
|
|
51062
51634
|
if (!home) return null;
|
|
@@ -52044,9 +52616,9 @@ async function resolveGroupTween(group, animations, _selection, _commitMutation,
|
|
|
52044
52616
|
const anim = inGroup(animations);
|
|
52045
52617
|
if (anim) return { anim, animations };
|
|
52046
52618
|
if (!fetchFallbackAnimations) return null;
|
|
52047
|
-
const
|
|
52048
|
-
const freshAnim = inGroup(
|
|
52049
|
-
return freshAnim ? { anim: freshAnim, animations:
|
|
52619
|
+
const fresh2 = await fetchFallbackAnimations();
|
|
52620
|
+
const freshAnim = inGroup(fresh2);
|
|
52621
|
+
return freshAnim ? { anim: freshAnim, animations: fresh2 } : null;
|
|
52050
52622
|
}
|
|
52051
52623
|
var writesPosition = (a) => animationWritesAnyProperty(a, POSITION_CHANNEL_SET);
|
|
52052
52624
|
function positionedOnlyBySharedTween(selection, animations) {
|
|
@@ -52138,6 +52710,9 @@ async function tryGsapDragIntercept(selection, offset, allAnimations, iframe, ge
|
|
|
52138
52710
|
const stamp = options?.stamp ?? readDragStamp(selection.element);
|
|
52139
52711
|
const moment = editMoment(stamp);
|
|
52140
52712
|
const time = moment.time;
|
|
52713
|
+
if (!await settleGsapSnapshot(iframe) && stamp.moving) {
|
|
52714
|
+
return { status: "blocked", reason: "source-uneditable", detail: "frame-tweens-unreadable" };
|
|
52715
|
+
}
|
|
52141
52716
|
if (!options?.preflightPassed) {
|
|
52142
52717
|
const preflight = await preflightGsapDragIntercept(
|
|
52143
52718
|
selection,
|
|
@@ -52158,8 +52733,8 @@ async function tryGsapDragIntercept(selection, offset, allAnimations, iframe, ge
|
|
|
52158
52733
|
const commitMutation = oneUndoStep(gestureCommit);
|
|
52159
52734
|
let workingAnimations = animations;
|
|
52160
52735
|
if (animations.filter(isPositionWriteOf(selector)).length > 1 && fetchFallbackAnimations) {
|
|
52161
|
-
const
|
|
52162
|
-
const keeper = positionWriteKeeper(
|
|
52736
|
+
const fresh2 = await fetchFallbackAnimations();
|
|
52737
|
+
const keeper = positionWriteKeeper(fresh2, selector);
|
|
52163
52738
|
if (keeper) {
|
|
52164
52739
|
await commitMutation(
|
|
52165
52740
|
selection,
|
|
@@ -52172,7 +52747,7 @@ async function tryGsapDragIntercept(selection, offset, allAnimations, iframe, ge
|
|
|
52172
52747
|
);
|
|
52173
52748
|
workingAnimations = await fetchFallbackAnimations();
|
|
52174
52749
|
} else {
|
|
52175
|
-
workingAnimations =
|
|
52750
|
+
workingAnimations = fresh2;
|
|
52176
52751
|
}
|
|
52177
52752
|
}
|
|
52178
52753
|
const resolved2 = await resolveGroupTween(
|
|
@@ -52188,9 +52763,9 @@ async function tryGsapDragIntercept(selection, offset, allAnimations, iframe, ge
|
|
|
52188
52763
|
if (!posAnim) {
|
|
52189
52764
|
posAnim = findGsapPositionAnimation(workingAnimations, selector, time);
|
|
52190
52765
|
if (!posAnim && fetchFallbackAnimations) {
|
|
52191
|
-
const
|
|
52192
|
-
resolvedAnimations =
|
|
52193
|
-
posAnim = findGsapPositionAnimation(
|
|
52766
|
+
const fresh2 = await fetchFallbackAnimations();
|
|
52767
|
+
resolvedAnimations = fresh2;
|
|
52768
|
+
posAnim = findGsapPositionAnimation(fresh2, selector, time);
|
|
52194
52769
|
}
|
|
52195
52770
|
}
|
|
52196
52771
|
const gsapPos = readGsapPositionFromIframe(iframe, selector) ?? { x: 0, y: 0 };
|
|
@@ -52208,9 +52783,9 @@ async function tryGsapDragIntercept(selection, offset, allAnimations, iframe, ge
|
|
|
52208
52783
|
return { status: "blocked", reason: "source-uneditable", detail: "no-position-tween" };
|
|
52209
52784
|
}
|
|
52210
52785
|
if (fetchFallbackAnimations) {
|
|
52211
|
-
const
|
|
52212
|
-
const freshMatch =
|
|
52213
|
-
|
|
52786
|
+
const fresh2 = await fetchFallbackAnimations();
|
|
52787
|
+
const freshMatch = fresh2.find((a) => a.id === posAnim.id) ?? pickClosestToPlayhead(
|
|
52788
|
+
fresh2.filter(
|
|
52214
52789
|
(a) => a.targetSelector === posAnim.targetSelector && a.propertyGroup === posAnim.propertyGroup && isXYPositionWrite(a) === isXYPositionWrite(posAnim)
|
|
52215
52790
|
),
|
|
52216
52791
|
time
|
|
@@ -52369,7 +52944,8 @@ async function populateKeyframeCacheFromAst(projectId, sf, doc) {
|
|
|
52369
52944
|
}
|
|
52370
52945
|
|
|
52371
52946
|
// src/hooks/useGsapTweenCache.ts
|
|
52372
|
-
|
|
52947
|
+
var previewDocument = (iframe) => iframe?.contentDocument ?? frameDocument(iframe ?? null);
|
|
52948
|
+
function useGsapAnimationsForElement(projectId, sourceFile, target, version2, iframeRef) {
|
|
52373
52949
|
const [allAnimations, setAllAnimations] = useState65([]);
|
|
52374
52950
|
const [multipleTimelines, setMultipleTimelines] = useState65(false);
|
|
52375
52951
|
const [unsupportedTimelinePattern, setUnsupportedTimelinePattern] = useState65(false);
|
|
@@ -52379,7 +52955,7 @@ function useGsapAnimationsForElement(projectId, sourceFile, target, version, ifr
|
|
|
52379
52955
|
);
|
|
52380
52956
|
useEffect70(() => {
|
|
52381
52957
|
const targetKey = target?.id ?? target?.selector ?? "";
|
|
52382
|
-
const fetchKey = `${projectId}:${sourceFile}:${
|
|
52958
|
+
const fetchKey = `${projectId}:${sourceFile}:${version2}:${targetKey}`;
|
|
52383
52959
|
if (fetchKey === lastFetchKeyRef.current) return;
|
|
52384
52960
|
lastFetchKeyRef.current = fetchKey;
|
|
52385
52961
|
if (!projectId) {
|
|
@@ -52406,18 +52982,19 @@ function useGsapAnimationsForElement(projectId, sourceFile, target, version, ifr
|
|
|
52406
52982
|
return () => {
|
|
52407
52983
|
cancelled = true;
|
|
52408
52984
|
};
|
|
52409
|
-
}, [projectId, sourceFile,
|
|
52985
|
+
}, [projectId, sourceFile, version2, target?.id, target?.selector]);
|
|
52410
52986
|
const targetId = target?.id ?? null;
|
|
52411
52987
|
const targetSelector = target?.selector ?? null;
|
|
52988
|
+
const snapshotVersion = useGsapSnapshotVersion();
|
|
52412
52989
|
const rawAnimations = useMemo45(() => {
|
|
52413
52990
|
if (!targetId && !targetSelector) return [];
|
|
52414
|
-
const element = target ? findPreviewNode(iframeRef?.current
|
|
52991
|
+
const element = target ? findPreviewNode(previewDocument(iframeRef?.current), target) : null;
|
|
52415
52992
|
return getAnimationsForElement(
|
|
52416
52993
|
allAnimations,
|
|
52417
52994
|
{ id: targetId, selector: targetSelector },
|
|
52418
52995
|
element
|
|
52419
52996
|
);
|
|
52420
|
-
}, [allAnimations, target,
|
|
52997
|
+
}, [allAnimations, target, version2, iframeRef, snapshotVersion]);
|
|
52421
52998
|
const animations = useMemo45(() => {
|
|
52422
52999
|
const iframe = iframeRef?.current;
|
|
52423
53000
|
let result = rawAnimations;
|
|
@@ -52520,11 +53097,11 @@ function useGsapAnimationsForElement(projectId, sourceFile, target, version, ifr
|
|
|
52520
53097
|
return { animations, multipleTimelines, unsupportedTimelinePattern };
|
|
52521
53098
|
}
|
|
52522
53099
|
function useGsapCacheVersion() {
|
|
52523
|
-
const [
|
|
53100
|
+
const [version2, setVersion] = useState65(0);
|
|
52524
53101
|
const bump = useCallback71(() => setVersion((v) => v + 1), []);
|
|
52525
|
-
return { version, bump };
|
|
53102
|
+
return { version: version2, bump };
|
|
52526
53103
|
}
|
|
52527
|
-
function usePopulateKeyframeCacheForFile(projectId, sourceFile,
|
|
53104
|
+
function usePopulateKeyframeCacheForFile(projectId, sourceFile, version2, iframeRef) {
|
|
52528
53105
|
const elementCount = usePlayerStore((s) => s.elements.length);
|
|
52529
53106
|
const compositionSrcKey = usePlayerStore(
|
|
52530
53107
|
(s) => Array.from(new Set(s.elements.map((el) => el.compositionSrc).filter((src) => !!src))).sort().join("|")
|
|
@@ -52538,7 +53115,7 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
|
|
|
52538
53115
|
});
|
|
52539
53116
|
const runtimeScanDoneRef = useRef84("");
|
|
52540
53117
|
useEffect70(() => {
|
|
52541
|
-
const dataKey = `kf-cache:${projectId}:${
|
|
53118
|
+
const dataKey = `kf-cache:${projectId}:${version2}:${elementCount}:${domClipChildrenKey}:${compositionSrcKey}`;
|
|
52542
53119
|
if (!projectId) return;
|
|
52543
53120
|
const files = Array.from(
|
|
52544
53121
|
/* @__PURE__ */ new Set([sourceFile, ...compositionSrcKey ? compositionSrcKey.split("|") : []])
|
|
@@ -52550,20 +53127,20 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
|
|
|
52550
53127
|
if (!sameData2) pruneKeyframeCacheToFiles(files);
|
|
52551
53128
|
if (stale.length === 0) return;
|
|
52552
53129
|
runtimeScanDoneRef.current = "";
|
|
52553
|
-
const doc = iframeRef?.current
|
|
53130
|
+
const doc = previewDocument(iframeRef?.current);
|
|
52554
53131
|
for (const sf of stale) {
|
|
52555
53132
|
void populateKeyframeCacheFromAst(projectId, sf, doc).then((loaded) => {
|
|
52556
53133
|
if (!loaded && loadedRef.current.dataKey === dataKey) loadedRef.current.files.delete(sf);
|
|
52557
53134
|
});
|
|
52558
53135
|
}
|
|
52559
|
-
}, [projectId, sourceFile,
|
|
53136
|
+
}, [projectId, sourceFile, version2, elementCount, domClipChildrenKey, compositionSrcKey]);
|
|
52560
53137
|
useEffect70(() => {
|
|
52561
53138
|
if (!projectId) return;
|
|
52562
53139
|
const sf = sourceFile;
|
|
52563
53140
|
let attempts = 0;
|
|
52564
53141
|
const maxAttempts = 10;
|
|
52565
53142
|
const tryRuntimeScan = () => {
|
|
52566
|
-
if (runtimeScanDoneRef.current === `kf-cache:${projectId}:${sf}:${
|
|
53143
|
+
if (runtimeScanDoneRef.current === `kf-cache:${projectId}:${sf}:${version2}`) return true;
|
|
52567
53144
|
const iframe = iframeRef?.current;
|
|
52568
53145
|
if (!iframe) return false;
|
|
52569
53146
|
const clipById = /* @__PURE__ */ new Map();
|
|
@@ -52588,7 +53165,7 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
|
|
|
52588
53165
|
for (const key of keys) draft.keyframeCache.set(key, entry3);
|
|
52589
53166
|
}
|
|
52590
53167
|
});
|
|
52591
|
-
runtimeScanDoneRef.current = `kf-cache:${projectId}:${sf}:${
|
|
53168
|
+
runtimeScanDoneRef.current = `kf-cache:${projectId}:${sf}:${version2}`;
|
|
52592
53169
|
return true;
|
|
52593
53170
|
};
|
|
52594
53171
|
if (tryRuntimeScan()) return;
|
|
@@ -52597,7 +53174,7 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
|
|
|
52597
53174
|
if (tryRuntimeScan() || attempts >= maxAttempts) clearInterval(interval);
|
|
52598
53175
|
}, 500);
|
|
52599
53176
|
return () => clearInterval(interval);
|
|
52600
|
-
}, [projectId, sourceFile,
|
|
53177
|
+
}, [projectId, sourceFile, version2, iframeRef]);
|
|
52601
53178
|
}
|
|
52602
53179
|
|
|
52603
53180
|
// src/components/editor/keyframeRetime.ts
|
|
@@ -53428,7 +54005,7 @@ function buildFrameCaptureUrl({
|
|
|
53428
54005
|
compositionPath,
|
|
53429
54006
|
currentTime,
|
|
53430
54007
|
origin: origin2 = window.location.origin,
|
|
53431
|
-
version = Date.now()
|
|
54008
|
+
version: version2 = Date.now()
|
|
53432
54009
|
}) {
|
|
53433
54010
|
const compPath = normalizeCompositionPath(compositionPath);
|
|
53434
54011
|
const url = new URL(
|
|
@@ -53438,7 +54015,7 @@ function buildFrameCaptureUrl({
|
|
|
53438
54015
|
url.searchParams.set("t", Math.max(0, currentTime).toFixed(3));
|
|
53439
54016
|
url.searchParams.set("format", "png");
|
|
53440
54017
|
url.searchParams.set("output", "source");
|
|
53441
|
-
url.searchParams.set("v", String(
|
|
54018
|
+
url.searchParams.set("v", String(version2));
|
|
53442
54019
|
return url.toString();
|
|
53443
54020
|
}
|
|
53444
54021
|
function buildFrameCaptureFilename(compositionPath, currentTime) {
|
|
@@ -54709,7 +55286,7 @@ function installDockAccessibility(api, root) {
|
|
|
54709
55286
|
}
|
|
54710
55287
|
|
|
54711
55288
|
// src/components/dock/DockStripActions.tsx
|
|
54712
|
-
import { useCallback as useCallback75, useSyncExternalStore as
|
|
55289
|
+
import { useCallback as useCallback75, useSyncExternalStore as useSyncExternalStore10 } from "react";
|
|
54713
55290
|
import { CornersIn, CornersOut, DotsThree, X as X2 } from "@phosphor-icons/react";
|
|
54714
55291
|
|
|
54715
55292
|
// src/components/dock/dockLayoutStore.ts
|
|
@@ -54776,14 +55353,14 @@ function DockStripActions({
|
|
|
54776
55353
|
panels,
|
|
54777
55354
|
isGroupActive
|
|
54778
55355
|
}) {
|
|
54779
|
-
const
|
|
55356
|
+
const subscribe3 = useCallback75(
|
|
54780
55357
|
(onChange) => {
|
|
54781
55358
|
const subscription = containerApi.onDidMaximizedGroupChange(onChange);
|
|
54782
55359
|
return () => subscription.dispose();
|
|
54783
55360
|
},
|
|
54784
55361
|
[containerApi]
|
|
54785
55362
|
);
|
|
54786
|
-
const maximized =
|
|
55363
|
+
const maximized = useSyncExternalStore10(subscribe3, () => api.isMaximized());
|
|
54787
55364
|
const openPanels = useDockLayoutStore((state) => state.openPanels);
|
|
54788
55365
|
const togglePanel = useDockLayoutStore((state) => state.togglePanel);
|
|
54789
55366
|
const resetLayout = useDockLayoutStore((state) => state.resetLayout);
|
|
@@ -54834,7 +55411,7 @@ function DockStripActions({
|
|
|
54834
55411
|
}
|
|
54835
55412
|
|
|
54836
55413
|
// src/components/dock/DockTab.tsx
|
|
54837
|
-
import { useCallback as useCallback76, useSyncExternalStore as
|
|
55414
|
+
import { useCallback as useCallback76, useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
54838
55415
|
import {
|
|
54839
55416
|
Aperture,
|
|
54840
55417
|
BracketsCurly,
|
|
@@ -54866,14 +55443,14 @@ var TAB_ICONS = {
|
|
|
54866
55443
|
motionBlur: Aperture
|
|
54867
55444
|
};
|
|
54868
55445
|
function DockTab({ api }) {
|
|
54869
|
-
const
|
|
55446
|
+
const subscribe3 = useCallback76(
|
|
54870
55447
|
(onChange) => {
|
|
54871
55448
|
const subscription = api.onDidTitleChange(onChange);
|
|
54872
55449
|
return () => subscription.dispose();
|
|
54873
55450
|
},
|
|
54874
55451
|
[api]
|
|
54875
55452
|
);
|
|
54876
|
-
const title =
|
|
55453
|
+
const title = useSyncExternalStore11(subscribe3, () => api.title ?? "");
|
|
54877
55454
|
const TypeIcon = isPanelId(api.id) ? TAB_ICONS[api.id] : null;
|
|
54878
55455
|
return /* @__PURE__ */ jsxs86("div", { className: "hf-dock-tab", children: [
|
|
54879
55456
|
TypeIcon ? /* @__PURE__ */ jsx122(TypeIcon, { className: "hf-dock-tab-icon", size: 14, "aria-hidden": true }) : null,
|
|
@@ -59447,9 +60024,9 @@ function refreshStatus(iframe, target, reads, apply) {
|
|
|
59447
60024
|
apply(readRuntimeColorGradingStatus(iframe, target));
|
|
59448
60025
|
return;
|
|
59449
60026
|
}
|
|
59450
|
-
const
|
|
60027
|
+
const read3 = ++reads.current;
|
|
59451
60028
|
void readSealedColorGradingStatus(iframe, target).then((status) => {
|
|
59452
|
-
if (
|
|
60029
|
+
if (read3 === reads.current) apply(status);
|
|
59453
60030
|
});
|
|
59454
60031
|
}
|
|
59455
60032
|
|
|
@@ -60170,7 +60747,7 @@ function ColorField({
|
|
|
60170
60747
|
}
|
|
60171
60748
|
|
|
60172
60749
|
// src/components/editor/propertyPanelFont.tsx
|
|
60173
|
-
import { useEffect as useEffect85, useMemo as useMemo54, useRef as useRef97, useState as useState77, useSyncExternalStore as
|
|
60750
|
+
import { useEffect as useEffect85, useMemo as useMemo54, useRef as useRef97, useState as useState77, useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
60174
60751
|
|
|
60175
60752
|
// src/components/editor/fontAssets.ts
|
|
60176
60753
|
var FONT_EXT_RE = /\.(eot|otf|ttc|ttf|woff2?)$/i;
|
|
@@ -60337,7 +60914,7 @@ function FontFamilyField({
|
|
|
60337
60914
|
const [activeIndex, setActiveIndex] = useState77(-1);
|
|
60338
60915
|
const [localFonts, setLocalFonts] = useState77([]);
|
|
60339
60916
|
const [localFontData, setLocalFontData] = useState77([]);
|
|
60340
|
-
const lists =
|
|
60917
|
+
const lists = useSyncExternalStore12(subscribeFontLists, () => fontLists);
|
|
60341
60918
|
const [loadingLocalFonts, setLoadingLocalFonts] = useState77(false);
|
|
60342
60919
|
const [importingFonts, setImportingFonts] = useState77(false);
|
|
60343
60920
|
const [fontNotice, setFontNotice] = useState77(null);
|
|
@@ -71396,7 +71973,7 @@ function useColorGradingScopes({
|
|
|
71396
71973
|
window.clearTimeout(timer);
|
|
71397
71974
|
};
|
|
71398
71975
|
}, [open2, refreshKey, refreshVersion]);
|
|
71399
|
-
return { analysis, status, refresh: () => setRefreshVersion((
|
|
71976
|
+
return { analysis, status, refresh: () => setRefreshVersion((version2) => version2 + 1) };
|
|
71400
71977
|
}
|
|
71401
71978
|
|
|
71402
71979
|
// src/components/editor/propertyPanelColorScopes.tsx
|
|
@@ -75936,7 +76513,7 @@ var FileTree = memo43(function FileTree2({
|
|
|
75936
76513
|
});
|
|
75937
76514
|
|
|
75938
76515
|
// src/App.tsx
|
|
75939
|
-
import { useState as
|
|
76516
|
+
import { useState as useState173, useCallback as useCallback197, useRef as useRef195, useMemo as useMemo91 } from "react";
|
|
75940
76517
|
|
|
75941
76518
|
// src/hooks/useStableHandlers.ts
|
|
75942
76519
|
import { useRef as useRef122 } from "react";
|
|
@@ -77775,7 +78352,7 @@ function useCaptionSync(projectId) {
|
|
|
77775
78352
|
}
|
|
77776
78353
|
const seqAtSave = editSeqRef.current;
|
|
77777
78354
|
const overrides = buildOverrides(state.model);
|
|
77778
|
-
let
|
|
78355
|
+
let held2 = null;
|
|
77779
78356
|
studioApiFetch(
|
|
77780
78357
|
buildProjectApiPath(pid, `/files/${encodeURIComponent("caption-overrides.json")}`),
|
|
77781
78358
|
{
|
|
@@ -77785,15 +78362,18 @@ function useCaptionSync(projectId) {
|
|
|
77785
78362
|
}
|
|
77786
78363
|
).then(async (res) => {
|
|
77787
78364
|
if (!res.ok) {
|
|
77788
|
-
|
|
78365
|
+
held2 = await heldFileWordsOf(res, "caption-overrides.json");
|
|
77789
78366
|
throw new Error(`HTTP ${res.status}`);
|
|
77790
78367
|
}
|
|
77791
78368
|
if (editSeqRef.current === seqAtSave) pendingRef.current = false;
|
|
77792
78369
|
const s = useCaptionStore.getState();
|
|
77793
78370
|
if (s.syncError) s.setSyncError(null);
|
|
77794
78371
|
}).catch((error) => {
|
|
77795
|
-
trackEvent("studio_caption_autosave_failed", {
|
|
77796
|
-
|
|
78372
|
+
trackEvent("studio_caption_autosave_failed", {
|
|
78373
|
+
error_name: error instanceof Error ? error.name : typeof error,
|
|
78374
|
+
error: String(error)
|
|
78375
|
+
});
|
|
78376
|
+
useCaptionStore.getState().setSyncError(held2 ?? "Caption changes couldn't be saved");
|
|
77797
78377
|
});
|
|
77798
78378
|
}, []);
|
|
77799
78379
|
useMountEffect(() => {
|
|
@@ -78389,7 +78969,7 @@ function useEditorSave({
|
|
|
78389
78969
|
const fingerprint = JSON.stringify([
|
|
78390
78970
|
path,
|
|
78391
78971
|
errorName,
|
|
78392
|
-
|
|
78972
|
+
getStudioSaveErrorMessage(error),
|
|
78393
78973
|
properties.status_code
|
|
78394
78974
|
]);
|
|
78395
78975
|
const previous = lastFailureReportRef.current;
|
|
@@ -78501,24 +79081,24 @@ function useProjectFileWriter({ projectId }) {
|
|
|
78501
79081
|
);
|
|
78502
79082
|
const fileVersions = fileVersionScope.versions;
|
|
78503
79083
|
const observeProjectFileVersion = useCallback108(
|
|
78504
|
-
(path,
|
|
78505
|
-
fileVersions.set(path,
|
|
79084
|
+
(path, version2) => {
|
|
79085
|
+
fileVersions.set(path, version2);
|
|
78506
79086
|
},
|
|
78507
79087
|
[fileVersions]
|
|
78508
79088
|
);
|
|
78509
79089
|
const readProjectFile = useCallback108(
|
|
78510
79090
|
async (path) => {
|
|
78511
|
-
const { content, version } = await fetchProjectFile(projectId, path, "");
|
|
79091
|
+
const { content, version: version2 } = await fetchProjectFile(projectId, path, "");
|
|
78512
79092
|
if (typeof content !== "string") throw new Error(`Missing file contents for ${path}`);
|
|
78513
|
-
fileVersions.set(path,
|
|
79093
|
+
fileVersions.set(path, version2);
|
|
78514
79094
|
return content;
|
|
78515
79095
|
},
|
|
78516
79096
|
[fileVersions, projectId]
|
|
78517
79097
|
);
|
|
78518
79098
|
const readOptionalProjectFile = useCallback108(
|
|
78519
79099
|
async (path) => {
|
|
78520
|
-
const { content, version } = await fetchProjectFile(projectId, path, "?optional=1");
|
|
78521
|
-
fileVersions.set(path,
|
|
79100
|
+
const { content, version: version2 } = await fetchProjectFile(projectId, path, "?optional=1");
|
|
79101
|
+
fileVersions.set(path, version2);
|
|
78522
79102
|
return typeof content === "string" ? content : "";
|
|
78523
79103
|
},
|
|
78524
79104
|
[fileVersions, projectId]
|
|
@@ -78585,10 +79165,10 @@ function useProjectFileWriter({ projectId }) {
|
|
|
78585
79165
|
if (!response.ok)
|
|
78586
79166
|
throw await createStudioSaveHttpError(response, `Failed to save ${path}`, { path });
|
|
78587
79167
|
const result = await response.json();
|
|
78588
|
-
const
|
|
78589
|
-
if (!
|
|
79168
|
+
const version2 = result.version ?? response.headers.get("etag");
|
|
79169
|
+
if (!version2)
|
|
78590
79170
|
throw new Error(`Save response for ${path} did not include a content version`);
|
|
78591
|
-
fileVersions.set(path,
|
|
79171
|
+
fileVersions.set(path, version2);
|
|
78592
79172
|
});
|
|
78593
79173
|
},
|
|
78594
79174
|
[fileVersions, projectId]
|
|
@@ -79344,6 +79924,15 @@ function syncStoredElementAttribute(target, attr2, value) {
|
|
|
79344
79924
|
}
|
|
79345
79925
|
|
|
79346
79926
|
// src/hooks/usePreviewPersistence.ts
|
|
79927
|
+
function saveQueuePaused(event) {
|
|
79928
|
+
trackStudioEvent("save_queue_paused", {
|
|
79929
|
+
source: "dom_edit",
|
|
79930
|
+
...event.errorCodes,
|
|
79931
|
+
status_code: event.statusCode,
|
|
79932
|
+
consecutive_failures: event.consecutiveFailures
|
|
79933
|
+
});
|
|
79934
|
+
return event.statusCode === 409 ? "Save paused: this file changed elsewhere. Reload and review the latest version before reapplying your edit." : "Auto-save is paused. Check your connection.";
|
|
79935
|
+
}
|
|
79347
79936
|
function readIframeDocument(iframe) {
|
|
79348
79937
|
try {
|
|
79349
79938
|
return iframe.contentDocument;
|
|
@@ -79406,15 +79995,9 @@ function usePreviewPersistence({
|
|
|
79406
79995
|
if (!domEditSaveQueueRef.current) {
|
|
79407
79996
|
domEditSaveQueueRef.current = createDomEditSaveQueue({
|
|
79408
79997
|
onOpen: (event) => {
|
|
79409
|
-
const message = event
|
|
79998
|
+
const message = saveQueuePaused(event);
|
|
79410
79999
|
setDomEditSaveQueuePaused(message);
|
|
79411
80000
|
showToastRef.current(message, "error");
|
|
79412
|
-
trackStudioEvent("save_queue_paused", {
|
|
79413
|
-
source: "dom_edit",
|
|
79414
|
-
error_message: event.errorMessage,
|
|
79415
|
-
status_code: event.statusCode,
|
|
79416
|
-
consecutive_failures: event.consecutiveFailures
|
|
79417
|
-
});
|
|
79418
80001
|
},
|
|
79419
80002
|
onReset: () => {
|
|
79420
80003
|
setDomEditSaveQueuePaused(null);
|
|
@@ -79475,10 +80058,10 @@ function usePreviewPersistence({
|
|
|
79475
80058
|
(path) => projectId ? readProjectFileContent(projectId, path) : Promise.reject(new Error("No project is open to read nested files from."))
|
|
79476
80059
|
)
|
|
79477
80060
|
);
|
|
79478
|
-
const
|
|
79479
|
-
if (
|
|
80061
|
+
const held2 = heldPreviewDoc();
|
|
80062
|
+
if (held2) {
|
|
79480
80063
|
const paths = restore2.paths ?? Object.keys(restore2.files ?? {});
|
|
79481
|
-
afterStudioManualEditGestures(
|
|
80064
|
+
afterStudioManualEditGestures(held2, () => {
|
|
79482
80065
|
markScenesStale(previewIframeRef.current, paths);
|
|
79483
80066
|
reloadPreview();
|
|
79484
80067
|
});
|
|
@@ -79604,9 +80187,9 @@ async function readFileVersion(projectId, path) {
|
|
|
79604
80187
|
);
|
|
79605
80188
|
if (!response.ok) throw new Error(`Failed to read ${path} before cut (${response.status})`);
|
|
79606
80189
|
const body = await response.json();
|
|
79607
|
-
const
|
|
79608
|
-
if (!
|
|
79609
|
-
return
|
|
80190
|
+
const version2 = body.version ?? response.headers.get("etag") ?? void 0;
|
|
80191
|
+
if (!version2) throw new Error(`Missing content version for ${path}`);
|
|
80192
|
+
return version2;
|
|
79610
80193
|
}
|
|
79611
80194
|
async function requestAtomicCut(projectId, intents) {
|
|
79612
80195
|
const files = [];
|
|
@@ -79700,9 +80283,9 @@ async function readVersion(projectId, path) {
|
|
|
79700
80283
|
buildProjectApiPath(projectId, `/files/${encodeURIComponent(path)}`)
|
|
79701
80284
|
);
|
|
79702
80285
|
const body = await response.json().catch(() => null);
|
|
79703
|
-
const
|
|
79704
|
-
if (!response.ok || typeof
|
|
79705
|
-
return
|
|
80286
|
+
const version2 = typeof body === "object" && body !== null && "version" in body ? body.version : null;
|
|
80287
|
+
if (!response.ok || typeof version2 !== "string") throw new Error(`Could not read ${path}`);
|
|
80288
|
+
return version2;
|
|
79706
80289
|
}
|
|
79707
80290
|
async function requestFreezeFrame(input) {
|
|
79708
80291
|
const target = buildPatchTarget(input.element);
|
|
@@ -79727,10 +80310,10 @@ async function requestFreezeFrame(input) {
|
|
|
79727
80310
|
})
|
|
79728
80311
|
}
|
|
79729
80312
|
);
|
|
79730
|
-
const
|
|
80313
|
+
const held2 = response.ok ? null : await heldFileWordsOf(response, input.path);
|
|
79731
80314
|
const body = await response.json().catch(() => null);
|
|
79732
80315
|
if (!response.ok || !isFreezeFrameResponse(body)) {
|
|
79733
|
-
throw new Error(
|
|
80316
|
+
throw new Error(held2 ?? errorOf(body) ?? `Freeze frame failed (${response.status})`);
|
|
79734
80317
|
}
|
|
79735
80318
|
return body;
|
|
79736
80319
|
}
|
|
@@ -80577,10 +81160,10 @@ function useSetAudioGroupAttribute({
|
|
|
80577
81160
|
const key = audioGroupAttributeLiveKey(groupId, attr2);
|
|
80578
81161
|
const open2 = sealedReads.get(key);
|
|
80579
81162
|
if (open2) return open2;
|
|
80580
|
-
const
|
|
80581
|
-
sealedReads.set(key,
|
|
80582
|
-
void
|
|
80583
|
-
if (sealedReads.get(key) !==
|
|
81163
|
+
const read3 = previewDocumentCopy(iframe);
|
|
81164
|
+
sealedReads.set(key, read3);
|
|
81165
|
+
void read3.then((doc) => {
|
|
81166
|
+
if (sealedReads.get(key) !== read3) return;
|
|
80584
81167
|
const groupEl = doc?.getElementById(groupId) ?? null;
|
|
80585
81168
|
liveLanes.preview(
|
|
80586
81169
|
key,
|
|
@@ -80588,16 +81171,16 @@ function useSetAudioGroupAttribute({
|
|
|
80588
81171
|
groupLiveSource(groupEl, groupId, activeCompPath, attr2)
|
|
80589
81172
|
);
|
|
80590
81173
|
});
|
|
80591
|
-
return
|
|
81174
|
+
return read3;
|
|
80592
81175
|
},
|
|
80593
81176
|
[sealedReads, liveLanes, activeCompPath]
|
|
80594
81177
|
);
|
|
80595
81178
|
const sealedGroupElement = useCallback116(
|
|
80596
81179
|
async (iframe, groupId, attr2) => {
|
|
80597
81180
|
const key = audioGroupAttributeLiveKey(groupId, attr2);
|
|
80598
|
-
const
|
|
80599
|
-
const doc = await
|
|
80600
|
-
if (sealedReads.get(key) ===
|
|
81181
|
+
const read3 = sealedReads.get(key) ?? previewDocumentCopy(iframe);
|
|
81182
|
+
const doc = await read3;
|
|
81183
|
+
if (sealedReads.get(key) === read3) sealedReads.delete(key);
|
|
80601
81184
|
return doc?.getElementById(groupId) ?? null;
|
|
80602
81185
|
},
|
|
80603
81186
|
[sealedReads]
|
|
@@ -80607,9 +81190,9 @@ function useSetAudioGroupAttribute({
|
|
|
80607
81190
|
const key = audioGroupAttributeLiveKey(groupId, attr2);
|
|
80608
81191
|
const iframe = previewIframeRef.current;
|
|
80609
81192
|
if (iframe && previewFrameOpaque(iframe)) {
|
|
80610
|
-
const
|
|
80611
|
-
void
|
|
80612
|
-
if (sealedReads.get(key) ===
|
|
81193
|
+
const read3 = openSealedLane(iframe, groupId, attr2);
|
|
81194
|
+
void read3.then(() => {
|
|
81195
|
+
if (sealedReads.get(key) === read3) patchLiveGroupAttribute(iframe, groupId, attr2, value);
|
|
80613
81196
|
});
|
|
80614
81197
|
} else {
|
|
80615
81198
|
const target = liveGroupElement(iframe, groupId);
|
|
@@ -82860,15 +83443,15 @@ function seedDomEditGroupWithSelection(group, selection) {
|
|
|
82860
83443
|
|
|
82861
83444
|
// src/utils/sceneHold.ts
|
|
82862
83445
|
function holdScenesOf(iframe, element) {
|
|
82863
|
-
let
|
|
83446
|
+
let hold2;
|
|
82864
83447
|
try {
|
|
82865
|
-
|
|
83448
|
+
hold2 = iframe?.contentWindow?.__hfHoldScenes;
|
|
82866
83449
|
} catch {
|
|
82867
83450
|
return void 0;
|
|
82868
83451
|
}
|
|
82869
|
-
if (!
|
|
83452
|
+
if (!hold2) return void 0;
|
|
82870
83453
|
const names = element ? [...element.compositionAncestors ?? [], element.parentCompositionId ?? ""] : [];
|
|
82871
|
-
return
|
|
83454
|
+
return hold2(names.filter(Boolean)).catch(() => {
|
|
82872
83455
|
});
|
|
82873
83456
|
}
|
|
82874
83457
|
|
|
@@ -83256,8 +83839,8 @@ function useDomSelection({
|
|
|
83256
83839
|
const found = await findOpaqueTimelineElement(iframe, element, lookup2);
|
|
83257
83840
|
return found ? buildDomSelectionFromTarget(found, { preferClipAncestor: false }, iframe) : null;
|
|
83258
83841
|
}
|
|
83259
|
-
const
|
|
83260
|
-
if (
|
|
83842
|
+
const held2 = holdScenesOf(iframe, element);
|
|
83843
|
+
if (held2) await held2;
|
|
83261
83844
|
reapplyPositionEditsAfterSeek(doc);
|
|
83262
83845
|
const targetElement = findElementForTimelineElement(doc, element, lookup2);
|
|
83263
83846
|
return targetElement ? buildDomSelectionFromTarget(targetElement, {
|
|
@@ -83843,8 +84426,8 @@ async function postPatchElement(projectId, targetPath, body, showToast) {
|
|
|
83843
84426
|
}
|
|
83844
84427
|
);
|
|
83845
84428
|
if (!response.ok) {
|
|
83846
|
-
const
|
|
83847
|
-
showToast(
|
|
84429
|
+
const held2 = await heldFileWordsOf(response, targetPath);
|
|
84430
|
+
showToast(held2 ?? formatPatchRejectionMessage(await readErrorResponseBody(response)), "error");
|
|
83848
84431
|
throw await createStudioSaveHttpError(response, `Failed to patch ${targetPath}`, {
|
|
83849
84432
|
alreadyToasted: true
|
|
83850
84433
|
});
|
|
@@ -84199,6 +84782,7 @@ async function commitDomStyles(context, selection, stylesInEitherCase) {
|
|
|
84199
84782
|
}
|
|
84200
84783
|
let editedElement = null;
|
|
84201
84784
|
const previousInline = /* @__PURE__ */ new Map();
|
|
84785
|
+
let sealedEdit = null;
|
|
84202
84786
|
return runReportedDomEditCommit({
|
|
84203
84787
|
capture: () => {
|
|
84204
84788
|
const el = doc ? findElementForSelection(doc, selection, activeCompPath) : null;
|
|
@@ -84208,21 +84792,30 @@ async function commitDomStyles(context, selection, stylesInEitherCase) {
|
|
|
84208
84792
|
previousInline.set(property, el.style.getPropertyValue(property));
|
|
84209
84793
|
},
|
|
84210
84794
|
apply: () => {
|
|
84211
|
-
if (!editedElement)
|
|
84795
|
+
if (!editedElement) {
|
|
84796
|
+
sealedEdit = editSealedSelection(previewIframeRef.current, selection, {
|
|
84797
|
+
styles: liveStyles
|
|
84798
|
+
});
|
|
84799
|
+
return;
|
|
84800
|
+
}
|
|
84212
84801
|
for (const [property, value] of liveStyles) editedElement.style.setProperty(property, value);
|
|
84213
84802
|
if (fontFamily !== void 0 && doc) {
|
|
84214
84803
|
injectPreviewGoogleFont(doc, fontFamily);
|
|
84215
84804
|
if (importedFont) injectPreviewImportedFont(doc, importedFont);
|
|
84216
84805
|
}
|
|
84217
84806
|
},
|
|
84218
|
-
persist: () =>
|
|
84219
|
-
|
|
84220
|
-
|
|
84221
|
-
|
|
84222
|
-
|
|
84223
|
-
|
|
84807
|
+
persist: () => afterSealedDraw(
|
|
84808
|
+
sealedEdit,
|
|
84809
|
+
(drawn) => persistDomEditOperations(selection, operations, {
|
|
84810
|
+
label: "Edit layer style",
|
|
84811
|
+
// Live styles skip the reload; a sealed frame reloads to load a new font.
|
|
84812
|
+
skipRefresh: drawn && !(sealedEdit && fontFamily !== void 0),
|
|
84813
|
+
importedFont: importedFont ?? void 0
|
|
84814
|
+
})
|
|
84815
|
+
),
|
|
84224
84816
|
shouldRevert: ownsAny,
|
|
84225
84817
|
revert: () => {
|
|
84818
|
+
sealedEdit?.restore(owned.filter(({ isLatest }) => isLatest()).map((o) => o.property));
|
|
84226
84819
|
const el = editedElement;
|
|
84227
84820
|
if (!el) return;
|
|
84228
84821
|
for (const { property, isLatest } of owned) {
|
|
@@ -84305,6 +84898,7 @@ function useDomEditAttributeCommits({
|
|
|
84305
84898
|
const op = { type: "attribute", property: attr2, value };
|
|
84306
84899
|
let editedElement = null;
|
|
84307
84900
|
let previousValue = null;
|
|
84901
|
+
let sealedEdit = null;
|
|
84308
84902
|
await runDomEditCommit({
|
|
84309
84903
|
capture: () => {
|
|
84310
84904
|
const captured = captureAttributeElement(
|
|
@@ -84318,18 +84912,26 @@ function useDomEditAttributeCommits({
|
|
|
84318
84912
|
previousValue = captured.previousValue;
|
|
84319
84913
|
},
|
|
84320
84914
|
apply: () => {
|
|
84321
|
-
if (!editedElement) return;
|
|
84322
84915
|
const nextValue = value === null || value === "" ? null : value;
|
|
84916
|
+
if (!editedElement) {
|
|
84917
|
+
const attributes = [[fullAttr, nextValue]];
|
|
84918
|
+
sealedEdit = editSealedSelection(iframe, domEditSelection, { attributes });
|
|
84919
|
+
return;
|
|
84920
|
+
}
|
|
84323
84921
|
setOrRemovePreviewAttribute(editedElement, fullAttr, nextValue);
|
|
84324
84922
|
},
|
|
84325
84923
|
persist: options.previewOnly ? async () => {
|
|
84326
|
-
} : () =>
|
|
84327
|
-
|
|
84328
|
-
|
|
84329
|
-
|
|
84330
|
-
|
|
84924
|
+
} : () => afterSealedDraw(
|
|
84925
|
+
sealedEdit,
|
|
84926
|
+
(drawn) => persistDomEditOperations(domEditSelection, [op], {
|
|
84927
|
+
label: options.label,
|
|
84928
|
+
coalesceKey: commitKey,
|
|
84929
|
+
skipRefresh: options.skipRefresh && drawn
|
|
84930
|
+
})
|
|
84931
|
+
),
|
|
84331
84932
|
shouldRevert: () => isLatestCommit(),
|
|
84332
84933
|
revert: () => {
|
|
84934
|
+
sealedEdit?.restore();
|
|
84333
84935
|
if (!editedElement) return;
|
|
84334
84936
|
setOrRemovePreviewAttribute(editedElement, fullAttr, previousValue);
|
|
84335
84937
|
},
|
|
@@ -84365,6 +84967,7 @@ function useDomEditAttributeCommits({
|
|
|
84365
84967
|
commitKey
|
|
84366
84968
|
);
|
|
84367
84969
|
let captured = null;
|
|
84970
|
+
let sealedEdit = null;
|
|
84368
84971
|
let landed = false;
|
|
84369
84972
|
await runDomEditCommit({
|
|
84370
84973
|
capture: () => {
|
|
@@ -84376,19 +84979,30 @@ function useDomEditAttributeCommits({
|
|
|
84376
84979
|
);
|
|
84377
84980
|
},
|
|
84378
84981
|
apply: () => {
|
|
84379
|
-
if (!captured)
|
|
84982
|
+
if (!captured) {
|
|
84983
|
+
const attributes = entries.map(({ fullAttr, value }) => [
|
|
84984
|
+
fullAttr,
|
|
84985
|
+
value
|
|
84986
|
+
]);
|
|
84987
|
+
sealedEdit = editSealedSelection(iframe, selection, { attributes });
|
|
84988
|
+
return;
|
|
84989
|
+
}
|
|
84380
84990
|
for (const entry3 of entries) {
|
|
84381
84991
|
setOrRemovePreviewAttribute(captured.element, entry3.fullAttr, entry3.value);
|
|
84382
84992
|
}
|
|
84383
84993
|
},
|
|
84384
|
-
persist: () =>
|
|
84385
|
-
|
|
84386
|
-
|
|
84387
|
-
|
|
84388
|
-
|
|
84389
|
-
|
|
84994
|
+
persist: () => afterSealedDraw(
|
|
84995
|
+
sealedEdit,
|
|
84996
|
+
(drawn) => persistDomEditOperations(selection, ops, {
|
|
84997
|
+
label: options.label,
|
|
84998
|
+
coalesceKey: commitKey,
|
|
84999
|
+
skipRefresh: options.skipRefresh && drawn,
|
|
85000
|
+
prepareContent: options.prepareContent
|
|
85001
|
+
})
|
|
85002
|
+
),
|
|
84390
85003
|
shouldRevert: (error) => isLatestCommit() && !(error instanceof DomEditPersistPreparedWriteError),
|
|
84391
85004
|
revert: () => {
|
|
85005
|
+
sealedEdit?.restore();
|
|
84392
85006
|
if (!captured) return;
|
|
84393
85007
|
for (const entry3 of entries) {
|
|
84394
85008
|
setOrRemovePreviewAttribute(
|
|
@@ -84498,6 +85112,7 @@ function useDomEditAttributeCommits({
|
|
|
84498
85112
|
const op = { type: "html-attribute", property: attr2, value };
|
|
84499
85113
|
let editedElement = null;
|
|
84500
85114
|
let previousValue = null;
|
|
85115
|
+
let sealedEdit = null;
|
|
84501
85116
|
await runDomEditCommit({
|
|
84502
85117
|
capture: () => {
|
|
84503
85118
|
const captured = captureAttributeElement(
|
|
@@ -84511,12 +85126,13 @@ function useDomEditAttributeCommits({
|
|
|
84511
85126
|
previousValue = captured.previousValue;
|
|
84512
85127
|
},
|
|
84513
85128
|
apply: () => {
|
|
84514
|
-
|
|
84515
|
-
|
|
84516
|
-
|
|
84517
|
-
|
|
84518
|
-
|
|
84519
|
-
|
|
85129
|
+
const optimistic = resolveOptimisticAttributeValue(attr2, value);
|
|
85130
|
+
if (!editedElement) {
|
|
85131
|
+
const attributes = [[attr2, optimistic]];
|
|
85132
|
+
sealedEdit = editSealedSelection(iframe, domEditSelection, { attributes });
|
|
85133
|
+
return;
|
|
85134
|
+
}
|
|
85135
|
+
setOrRemovePreviewAttribute(editedElement, attr2, optimistic);
|
|
84520
85136
|
},
|
|
84521
85137
|
persist: () => persistDomEditOperations(domEditSelection, [op], {
|
|
84522
85138
|
label: `Edit ${attr2}`,
|
|
@@ -84525,6 +85141,7 @@ function useDomEditAttributeCommits({
|
|
|
84525
85141
|
}),
|
|
84526
85142
|
shouldRevert: () => isLatestCommit(),
|
|
84527
85143
|
revert: () => {
|
|
85144
|
+
sealedEdit?.restore();
|
|
84528
85145
|
if (!editedElement) return;
|
|
84529
85146
|
setOrRemovePreviewAttribute(editedElement, attr2, previousValue);
|
|
84530
85147
|
},
|
|
@@ -85444,8 +86061,8 @@ async function commitStructuralMutation(pid, targetPath, route, body, label, dep
|
|
|
85444
86061
|
}
|
|
85445
86062
|
);
|
|
85446
86063
|
if (!mutateResponse.ok) {
|
|
85447
|
-
const
|
|
85448
|
-
if (
|
|
86064
|
+
const held2 = await heldFileWordsOf(mutateResponse, targetPath);
|
|
86065
|
+
if (held2) throw new Error(held2);
|
|
85449
86066
|
const errBody = await mutateResponse.json().catch(() => null);
|
|
85450
86067
|
throw new Error(errBody?.error ?? `Failed to ${label.toLowerCase()} in ${targetPath}`);
|
|
85451
86068
|
}
|
|
@@ -87015,8 +87632,8 @@ function useDomEditPreviewSync({
|
|
|
87015
87632
|
} catch {
|
|
87016
87633
|
return;
|
|
87017
87634
|
}
|
|
87018
|
-
if (
|
|
87019
|
-
|
|
87635
|
+
if (doc) reapplyPositionEditsAfterSeek(doc);
|
|
87636
|
+
else if (!previewFrameOpaque(previewIframe)) return;
|
|
87020
87637
|
await refreshDomEditSelectionFromPreview(currentSelection, previewIframe);
|
|
87021
87638
|
};
|
|
87022
87639
|
syncPreviewHotkeys(previewIframe);
|
|
@@ -87073,10 +87690,10 @@ function selectElementAnimationsOrRetry(parsed, target, element) {
|
|
|
87073
87690
|
animations: getAnimationsForElement(parsed.animations, target, element)
|
|
87074
87691
|
};
|
|
87075
87692
|
}
|
|
87076
|
-
async function fetchElementAnimationsWithRetry(projectId, gsapSourceFile, target, element, failOnFetchError,
|
|
87693
|
+
async function fetchElementAnimationsWithRetry(projectId, gsapSourceFile, target, element, failOnFetchError, fresh2) {
|
|
87077
87694
|
for (let errorAttempts = 0; ; errorAttempts++) {
|
|
87078
|
-
const parsed = await fetchParsedAnimations(projectId, gsapSourceFile, { fresh });
|
|
87079
|
-
|
|
87695
|
+
const parsed = await fetchParsedAnimations(projectId, gsapSourceFile, { fresh: fresh2 });
|
|
87696
|
+
fresh2 = false;
|
|
87080
87697
|
const outcome = selectElementAnimationsOrRetry(parsed, target, element);
|
|
87081
87698
|
if (outcome.kind === "resolved") return outcome.animations;
|
|
87082
87699
|
if (errorAttempts >= FETCH_ERROR_RETRIES) {
|
|
@@ -87770,8 +88387,8 @@ function isPlayheadWithinTween(anim, currentTime) {
|
|
|
87770
88387
|
async function replaceSetWithSingleKeyframe(session, sel, setAnim, t2, iframe, selector) {
|
|
87771
88388
|
const position = readElementPosition(iframe, sel, setAnim);
|
|
87772
88389
|
if (Object.keys(position).length === 0) {
|
|
87773
|
-
for (const [key,
|
|
87774
|
-
if (typeof
|
|
88390
|
+
for (const [key, held2] of Object.entries(setAnim.properties ?? {})) {
|
|
88391
|
+
if (typeof held2 === "number") position[key] = held2;
|
|
87775
88392
|
}
|
|
87776
88393
|
}
|
|
87777
88394
|
if (Object.keys(position).length === 0 || !session.commitMutation) return;
|
|
@@ -87792,14 +88409,15 @@ async function replaceSetWithSingleKeyframe(session, sel, setAnim, t2, iframe, s
|
|
|
87792
88409
|
function readElementPosition(iframe, sel, anim) {
|
|
87793
88410
|
const result = {};
|
|
87794
88411
|
if (!iframe?.contentWindow) return result;
|
|
88412
|
+
const sealed = previewFrameOpaque(iframe);
|
|
87795
88413
|
let gsap3;
|
|
87796
88414
|
try {
|
|
87797
|
-
gsap3 = iframe.contentWindow.gsap;
|
|
88415
|
+
gsap3 = sealed ? frameGsap(iframe) ?? void 0 : iframe.contentWindow.gsap;
|
|
87798
88416
|
} catch {
|
|
87799
88417
|
return result;
|
|
87800
88418
|
}
|
|
87801
88419
|
const element = sel.element;
|
|
87802
|
-
if (!element
|
|
88420
|
+
if (!element || !sealed && !element.isConnected || !gsap3?.getProperty) return result;
|
|
87803
88421
|
const props = animatedProps(anim);
|
|
87804
88422
|
for (const prop of props) {
|
|
87805
88423
|
const val = Number(gsap3.getProperty(element, prop));
|
|
@@ -87873,6 +88491,7 @@ async function extendKeyframedTweenToPlayhead(session, sel, anim, currentTime, d
|
|
|
87873
88491
|
);
|
|
87874
88492
|
}
|
|
87875
88493
|
async function applyKeyframeAtPlayhead(session, sel, kfAnim, t2, iframe, commitOverrides, liveTween) {
|
|
88494
|
+
await settleGsapSnapshot(iframe);
|
|
87876
88495
|
const keepAuthoredDuration = kfAnim.durationUnresolved === true;
|
|
87877
88496
|
if (keepAuthoredDuration) {
|
|
87878
88497
|
kfAnim = withLiveTiming(kfAnim, liveTween ?? findParsedTween(iframe, sel.element, kfAnim));
|
|
@@ -87918,8 +88537,8 @@ async function promoteSetToKeyframes(session, sel, setAnim, t2, iframe) {
|
|
|
87918
88537
|
if (Object.keys(endPosition).length === 0) return;
|
|
87919
88538
|
const startPosition = {};
|
|
87920
88539
|
for (const key of Object.keys(endPosition)) {
|
|
87921
|
-
const
|
|
87922
|
-
if (typeof
|
|
88540
|
+
const held2 = setAnim.properties?.[key];
|
|
88541
|
+
if (typeof held2 === "number") startPosition[key] = held2;
|
|
87923
88542
|
}
|
|
87924
88543
|
await session.commitMutation(
|
|
87925
88544
|
{
|
|
@@ -87948,9 +88567,9 @@ async function applyArcKeyframeAtPlayhead(session, sel, arcAnim, t2, iframe) {
|
|
|
87948
88567
|
const start = resolveTweenStart(arcAnim) ?? 0;
|
|
87949
88568
|
const duration = resolveTweenDuration(arcAnim);
|
|
87950
88569
|
if (!isTimeWithinTween(t2, start, duration)) {
|
|
87951
|
-
const
|
|
87952
|
-
if (t2 <= start || typeof
|
|
87953
|
-
const extended = buildExtendedKeyframes(arcAnim, t2, { x:
|
|
88570
|
+
const held2 = readElementPosition(iframe, sel, arcAnim);
|
|
88571
|
+
if (t2 <= start || typeof held2.x !== "number" || typeof held2.y !== "number") return;
|
|
88572
|
+
const extended = buildExtendedKeyframes(arcAnim, t2, { x: held2.x, y: held2.y }, duration, "none");
|
|
87954
88573
|
await session.commitMutation(
|
|
87955
88574
|
{
|
|
87956
88575
|
type: "replace-with-keyframes",
|
|
@@ -88234,8 +88853,9 @@ async function tryGsapResizeIntercept(selection, size, animations, iframe, commi
|
|
|
88234
88853
|
let useScaleLonghands = false;
|
|
88235
88854
|
if (resizeGroup === "scale") {
|
|
88236
88855
|
const el = iframe?.contentDocument?.querySelector(selector ?? "");
|
|
88237
|
-
const
|
|
88238
|
-
const
|
|
88856
|
+
const started = selection.handle ? gestureStartLayout(selection.handle) : null;
|
|
88857
|
+
const cssW = originalBoxSize(el, STUDIO_ORIGINAL_BOX_WIDTH_ATTR, "width") ?? (started?.width || 200);
|
|
88858
|
+
const cssH = originalBoxSize(el, STUDIO_ORIGINAL_BOX_HEIGHT_ATTR, "height") ?? (started?.height || cssW);
|
|
88239
88859
|
const rawLiveScaleX = readGsapProperty(iframe, selector ?? null, "scaleX") ?? 1;
|
|
88240
88860
|
const rawLiveScaleY = readGsapProperty(iframe, selector ?? null, "scaleY") ?? 1;
|
|
88241
88861
|
const liveScaleX = rawLiveScaleX > 0 ? rawLiveScaleX : 1;
|
|
@@ -89332,7 +89952,7 @@ function useCommitPreflightCapabilities({
|
|
|
89332
89952
|
selection,
|
|
89333
89953
|
groupSelections,
|
|
89334
89954
|
previewIframeRef,
|
|
89335
|
-
version
|
|
89955
|
+
version: version2
|
|
89336
89956
|
}) {
|
|
89337
89957
|
const parsesRef = useRef160(/* @__PURE__ */ new Map());
|
|
89338
89958
|
const [parseTick, setParseTick] = useState131(0);
|
|
@@ -89342,12 +89962,12 @@ function useCommitPreflightCapabilities({
|
|
|
89342
89962
|
for (const file of new Set(targets.map(gsapSourceFileForSelection))) {
|
|
89343
89963
|
const key = parseCacheKey(projectId, file);
|
|
89344
89964
|
const known = parsesRef.current.get(key);
|
|
89345
|
-
if (known?.version ===
|
|
89346
|
-
parsesRef.current.set(key, { version, animations: known?.animations ?? null });
|
|
89965
|
+
if (known?.version === version2) continue;
|
|
89966
|
+
parsesRef.current.set(key, { version: version2, animations: known?.animations ?? null });
|
|
89347
89967
|
void fetchParsedAnimations(projectId, file).then((parsed) => {
|
|
89348
|
-
if (parsesRef.current.get(key)?.version !==
|
|
89968
|
+
if (parsesRef.current.get(key)?.version !== version2) return;
|
|
89349
89969
|
if (parsed) {
|
|
89350
|
-
parsesRef.current.set(key, { version, animations: parsed.animations });
|
|
89970
|
+
parsesRef.current.set(key, { version: version2, animations: parsed.animations });
|
|
89351
89971
|
setParseTick((tick) => tick + 1);
|
|
89352
89972
|
return;
|
|
89353
89973
|
}
|
|
@@ -89355,7 +89975,7 @@ function useCommitPreflightCapabilities({
|
|
|
89355
89975
|
else parsesRef.current.delete(key);
|
|
89356
89976
|
});
|
|
89357
89977
|
}
|
|
89358
|
-
}, [enabled, projectId, selection, groupSelections,
|
|
89978
|
+
}, [enabled, projectId, selection, groupSelections, version2]);
|
|
89359
89979
|
return useMemo75(() => {
|
|
89360
89980
|
void parseTick;
|
|
89361
89981
|
if (!enabled || !projectId) return { selection, groupSelections };
|
|
@@ -89365,7 +89985,7 @@ function useCommitPreflightCapabilities({
|
|
|
89365
89985
|
const file = gsapSourceFileForSelection(target);
|
|
89366
89986
|
const animations = parsesRef.current.get(parseCacheKey(projectId, file))?.animations;
|
|
89367
89987
|
if (!animations) return narrowCapabilities(target, null);
|
|
89368
|
-
const inputs = { animations, iframe, group, version };
|
|
89988
|
+
const inputs = { animations, iframe, group, version: version2 };
|
|
89369
89989
|
const checked = checkedPreflight(resolvedOf(target), inputs);
|
|
89370
89990
|
checked.narrowed ??= narrowCapabilities(target, checked.preflight);
|
|
89371
89991
|
return checked.narrowed;
|
|
@@ -89374,7 +89994,7 @@ function useCommitPreflightCapabilities({
|
|
|
89374
89994
|
selection: selection && narrow(selection),
|
|
89375
89995
|
groupSelections: groupSelections.map(narrow)
|
|
89376
89996
|
}));
|
|
89377
|
-
}, [enabled, projectId, selection, groupSelections, parseTick, previewIframeRef,
|
|
89997
|
+
}, [enabled, projectId, selection, groupSelections, parseTick, previewIframeRef, version2]);
|
|
89378
89998
|
}
|
|
89379
89999
|
|
|
89380
90000
|
// src/hooks/domEditDeleteMembers.ts
|
|
@@ -89714,8 +90334,8 @@ function useDomEditSession({
|
|
|
89714
90334
|
);
|
|
89715
90335
|
const handleGroupSelection = useCallback153(() => {
|
|
89716
90336
|
const group = domEditGroupSelectionsRef.current;
|
|
89717
|
-
const
|
|
89718
|
-
const members = group.length > 0 ? group :
|
|
90337
|
+
const single2 = domEditSelectionRef.current;
|
|
90338
|
+
const members = group.length > 0 ? group : single2 ? [single2] : [];
|
|
89719
90339
|
if (members.length < 2) {
|
|
89720
90340
|
showToast("Select at least 2 elements to group", "info");
|
|
89721
90341
|
return;
|
|
@@ -89965,13 +90585,13 @@ import { useState as useState133, useEffect as useEffect133, useCallback as useC
|
|
|
89965
90585
|
import { openComposition as openComposition3 } from "@hyperframes/sdk";
|
|
89966
90586
|
|
|
89967
90587
|
// src/hooks/externalFileReloadBus.ts
|
|
89968
|
-
var
|
|
90588
|
+
var listeners5 = /* @__PURE__ */ new Set();
|
|
89969
90589
|
function addExternalFileReloadListener(listener2) {
|
|
89970
|
-
|
|
89971
|
-
return () =>
|
|
90590
|
+
listeners5.add(listener2);
|
|
90591
|
+
return () => listeners5.delete(listener2);
|
|
89972
90592
|
}
|
|
89973
90593
|
function notifyExternalFileReload(path) {
|
|
89974
|
-
for (const listener2 of
|
|
90594
|
+
for (const listener2 of listeners5) {
|
|
89975
90595
|
try {
|
|
89976
90596
|
listener2(path);
|
|
89977
90597
|
} catch {
|
|
@@ -89985,13 +90605,13 @@ var EMPTY_READ_REASONS = /* @__PURE__ */ new Set([
|
|
|
89985
90605
|
"absent",
|
|
89986
90606
|
"empty_file"
|
|
89987
90607
|
]);
|
|
89988
|
-
function reportReadFailure(
|
|
90608
|
+
function reportReadFailure(read3, projectId, pathInTree) {
|
|
89989
90609
|
trackStudioEvent("sdk_session_unavailable", {
|
|
89990
90610
|
stage: "read",
|
|
89991
|
-
reason:
|
|
89992
|
-
...
|
|
89993
|
-
...
|
|
89994
|
-
...
|
|
90611
|
+
reason: read3.reason,
|
|
90612
|
+
...read3.reason === "http_error" ? { status: read3.status, why: read3.why } : {},
|
|
90613
|
+
...read3.reason === "network" ? { elapsed_ms: read3.elapsedMs, hidden: read3.hidden } : {},
|
|
90614
|
+
...read3.reason === "invalid_json" ? { content_type: read3.contentType } : {},
|
|
89995
90615
|
// Only meaningful for the empty-read reasons — the graveyard-refuted "clear
|
|
89996
90616
|
// activeCompPath when it's not in the tree" fix's proposed next step,
|
|
89997
90617
|
// scoped to instrumentation only. `null` while the tree hasn't loaded
|
|
@@ -89999,10 +90619,10 @@ function reportReadFailure(read2, projectId, pathInTree) {
|
|
|
89999
90619
|
// really "haven't looked". Carried on all three so the split keeps the
|
|
90000
90620
|
// signal that made it worth splitting: every measured case so far is
|
|
90001
90621
|
// `path_in_tree: true`, a file the tree lists and this read cannot get.
|
|
90002
|
-
...EMPTY_READ_REASONS.has(
|
|
90622
|
+
...EMPTY_READ_REASONS.has(read3.reason) ? { path_in_tree: pathInTree } : {}
|
|
90003
90623
|
});
|
|
90004
|
-
if (
|
|
90005
|
-
return
|
|
90624
|
+
if (read3.reason !== "http_error") return null;
|
|
90625
|
+
return read3.status === 404 ? projectId : null;
|
|
90006
90626
|
}
|
|
90007
90627
|
function networkReadFailure(fetchStarted) {
|
|
90008
90628
|
return {
|
|
@@ -90066,6 +90686,7 @@ function disposeSdkSession(session) {
|
|
|
90066
90686
|
session.dispose();
|
|
90067
90687
|
} catch (error) {
|
|
90068
90688
|
trackStudioEvent("sdk_session_dispose_failed", {
|
|
90689
|
+
error_name: error instanceof Error ? error.name : typeof error,
|
|
90069
90690
|
error: error instanceof Error ? error.message : String(error)
|
|
90070
90691
|
});
|
|
90071
90692
|
}
|
|
@@ -90088,11 +90709,11 @@ function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded
|
|
|
90088
90709
|
useEffect133(() => {
|
|
90089
90710
|
refreshedAbsentPathsRef.current.clear();
|
|
90090
90711
|
}, [projectId]);
|
|
90091
|
-
function handleReadFailure(
|
|
90712
|
+
function handleReadFailure(read3, forProjectId, forPath) {
|
|
90092
90713
|
const pathInTree = fileTreeLoaded ? fileTree.includes(forPath) : null;
|
|
90093
|
-
setUnreachableProject(reportReadFailure(
|
|
90094
|
-
setCompositionMissing(
|
|
90095
|
-
if (
|
|
90714
|
+
setUnreachableProject(reportReadFailure(read3, forProjectId, pathInTree));
|
|
90715
|
+
setCompositionMissing(read3.reason === "absent");
|
|
90716
|
+
if (read3.reason !== "absent") return;
|
|
90096
90717
|
const key = `${forProjectId}:${forPath}`;
|
|
90097
90718
|
if (refreshedAbsentPathsRef.current.has(key)) return;
|
|
90098
90719
|
refreshedAbsentPathsRef.current.add(key);
|
|
@@ -90128,15 +90749,15 @@ function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded
|
|
|
90128
90749
|
};
|
|
90129
90750
|
whenPreviewBooted(projectId).then(
|
|
90130
90751
|
(booted) => cancelled || !booted ? null : readProjectFileOptional(projectId, activeCompPath)
|
|
90131
|
-
).then(async (
|
|
90132
|
-
if (!
|
|
90133
|
-
if (!
|
|
90134
|
-
handleReadFailure(
|
|
90752
|
+
).then(async (read3) => {
|
|
90753
|
+
if (!read3 || cancelled) return;
|
|
90754
|
+
if (!read3.ok) {
|
|
90755
|
+
handleReadFailure(read3, projectId, activeCompPath);
|
|
90135
90756
|
return;
|
|
90136
90757
|
}
|
|
90137
90758
|
setUnreachableProject(null);
|
|
90138
90759
|
setCompositionMissing(false);
|
|
90139
|
-
const content =
|
|
90760
|
+
const content = read3.content;
|
|
90140
90761
|
const comp = await openComposition3(content, { history: false });
|
|
90141
90762
|
if (cancelled) {
|
|
90142
90763
|
disposeSdkSession(comp);
|
|
@@ -90164,6 +90785,7 @@ function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded
|
|
|
90164
90785
|
setOwnedSession(null);
|
|
90165
90786
|
trackStudioEvent("sdk_session_unavailable", {
|
|
90166
90787
|
stage: "open",
|
|
90788
|
+
error_name: error instanceof Error ? error.name : typeof error,
|
|
90167
90789
|
error: error instanceof Error ? error.message : String(error)
|
|
90168
90790
|
});
|
|
90169
90791
|
}
|
|
@@ -90310,8 +90932,8 @@ function sseFileChangeChannel(onDelivery, onReconnect) {
|
|
|
90310
90932
|
return () => eventSource.close();
|
|
90311
90933
|
}
|
|
90312
90934
|
function eventIdentity(path, payload) {
|
|
90313
|
-
const
|
|
90314
|
-
if (
|
|
90935
|
+
const version2 = readFileChangeVersion(payload);
|
|
90936
|
+
if (version2) return `${path}\0${version2}`;
|
|
90315
90937
|
const content = readFileChangeContent(payload);
|
|
90316
90938
|
return content == null ? null : `${path}\0${content.length}\0${content}`;
|
|
90317
90939
|
}
|
|
@@ -90345,8 +90967,8 @@ function useExternalFileChangeCoordinator({
|
|
|
90345
90967
|
const drainingRef = useRef163(false);
|
|
90346
90968
|
const pendingPayloadRef = useRef163(null);
|
|
90347
90969
|
const setBlocked = useCallback155((next) => {
|
|
90348
|
-
const
|
|
90349
|
-
const current2 = next &&
|
|
90970
|
+
const held2 = blockedRef.current;
|
|
90971
|
+
const current2 = next && held2 ? { ...next, payload: mergeFileChangePayloads(held2.payload, next.payload) } : next;
|
|
90350
90972
|
blockedRef.current = current2;
|
|
90351
90973
|
setBlockedState(current2);
|
|
90352
90974
|
}, []);
|
|
@@ -90758,19 +91380,9 @@ function useStudioExternalFileChanges({
|
|
|
90758
91380
|
import { useCallback as useCallback157, useMemo as useMemo76, useRef as useRef164, useState as useState135 } from "react";
|
|
90759
91381
|
|
|
90760
91382
|
// src/utils/blockInstaller.ts
|
|
90761
|
-
function
|
|
90762
|
-
|
|
90763
|
-
|
|
90764
|
-
if (!doc) return 0;
|
|
90765
|
-
let max = 0;
|
|
90766
|
-
for (const el of doc.body.querySelectorAll("*")) {
|
|
90767
|
-
const z = parseInt(getComputedStyle(el).zIndex, 10);
|
|
90768
|
-
if (Number.isFinite(z) && z > max) max = z;
|
|
90769
|
-
}
|
|
90770
|
-
return max;
|
|
90771
|
-
} catch {
|
|
90772
|
-
return 0;
|
|
90773
|
-
}
|
|
91383
|
+
async function previewMaxZIndex(iframe) {
|
|
91384
|
+
const zIndex = iframe ? (await previewRequest(iframe, "max-z-index", {}))?.zIndex : void 0;
|
|
91385
|
+
return Number.isSafeInteger(zIndex) && zIndex >= 0 ? zIndex : 0;
|
|
90774
91386
|
}
|
|
90775
91387
|
function buildUniqueCompositionId(baseName, existingIds) {
|
|
90776
91388
|
const idSet = new Set(existingIds);
|
|
@@ -90897,6 +91509,7 @@ async function addBlockToProject(opts) {
|
|
|
90897
91509
|
timelineElements: relevantElements,
|
|
90898
91510
|
currentTime: opts.currentTime ?? 0
|
|
90899
91511
|
});
|
|
91512
|
+
const zIndex = await previewMaxZIndex(opts.previewIframe ?? null) + 1;
|
|
90900
91513
|
let hostId = "";
|
|
90901
91514
|
const insertHost = (originalContent) => {
|
|
90902
91515
|
const { width, height } = resolveTimelineAssetCompositionSize(originalContent);
|
|
@@ -90911,7 +91524,7 @@ async function addBlockToProject(opts) {
|
|
|
90911
91524
|
height,
|
|
90912
91525
|
left: visualPosition ? Math.round(visualPosition.left) : 0,
|
|
90913
91526
|
top: visualPosition ? Math.round(visualPosition.top) : 0,
|
|
90914
|
-
zIndex
|
|
91527
|
+
zIndex
|
|
90915
91528
|
});
|
|
90916
91529
|
return extendRootDurationInSource(
|
|
90917
91530
|
insertTimelineAssetIntoSource(originalContent, subComposition),
|
|
@@ -91158,6 +91771,36 @@ function dispatchClipboardKey(event, cb) {
|
|
|
91158
91771
|
}
|
|
91159
91772
|
return true;
|
|
91160
91773
|
}
|
|
91774
|
+
var APP_HOTKEY_ACTIONS = [
|
|
91775
|
+
"undo",
|
|
91776
|
+
"redo",
|
|
91777
|
+
"redoAlt",
|
|
91778
|
+
"tabCompositions",
|
|
91779
|
+
"tabAssets",
|
|
91780
|
+
"group",
|
|
91781
|
+
"ungroup",
|
|
91782
|
+
"copy",
|
|
91783
|
+
"paste",
|
|
91784
|
+
"cut",
|
|
91785
|
+
"duplicate",
|
|
91786
|
+
"zoomSelection",
|
|
91787
|
+
"fullscreen",
|
|
91788
|
+
"split",
|
|
91789
|
+
"audioGain",
|
|
91790
|
+
"razorTool",
|
|
91791
|
+
"selectTool",
|
|
91792
|
+
"selectLeftward",
|
|
91793
|
+
"selectRightward",
|
|
91794
|
+
"cancel",
|
|
91795
|
+
"deleteSelected",
|
|
91796
|
+
"deleteSelectedAlt",
|
|
91797
|
+
"resetKeyframes",
|
|
91798
|
+
"record",
|
|
91799
|
+
"linkToggle",
|
|
91800
|
+
"detachAudio",
|
|
91801
|
+
"deleteLinked",
|
|
91802
|
+
"deleteLinkedAlt"
|
|
91803
|
+
];
|
|
91161
91804
|
function dispatchModifierKey(event, _key, cb) {
|
|
91162
91805
|
if (!shouldIgnoreHistoryShortcut(event.target)) {
|
|
91163
91806
|
const handled = handleUndoRedoKey(
|
|
@@ -91389,6 +92032,7 @@ function fromShown(files, shown3) {
|
|
|
91389
92032
|
}
|
|
91390
92033
|
|
|
91391
92034
|
// src/hooks/useAppHotkeys.ts
|
|
92035
|
+
import { createEditingPortClient } from "@hyperframes/core/runtime/editing-port";
|
|
91392
92036
|
function iframeContentWindow(iframe) {
|
|
91393
92037
|
try {
|
|
91394
92038
|
return iframe?.contentWindow ?? null;
|
|
@@ -91396,6 +92040,24 @@ function iframeContentWindow(iframe) {
|
|
|
91396
92040
|
return null;
|
|
91397
92041
|
}
|
|
91398
92042
|
}
|
|
92043
|
+
function forwardSealedFrameKeys2(iframe, onKeyDown) {
|
|
92044
|
+
const client = createEditingPortClient({ iframe });
|
|
92045
|
+
const watch = (combos) => void client.request("watch-keys", { combos }).catch(() => {
|
|
92046
|
+
});
|
|
92047
|
+
const watchApp = () => watch(APP_HOTKEY_ACTIONS.map(getStudioKey));
|
|
92048
|
+
watchApp();
|
|
92049
|
+
const stopRebinds = subscribeStudioKeys(watchApp);
|
|
92050
|
+
const focused = () => iframe.ownerDocument.hasFocus() && iframe.ownerDocument.activeElement === iframe;
|
|
92051
|
+
const stopKeys = client.onKey((key) => {
|
|
92052
|
+
if (key.type === "keydown" && focused()) onKeyDown(new KeyboardEvent(key.type, key));
|
|
92053
|
+
});
|
|
92054
|
+
return () => {
|
|
92055
|
+
stopRebinds();
|
|
92056
|
+
stopKeys();
|
|
92057
|
+
void client.request("watch-keys", { combos: [] }).catch(() => {
|
|
92058
|
+
}).finally(() => client.dispose());
|
|
92059
|
+
};
|
|
92060
|
+
}
|
|
91399
92061
|
function safeAddListener(t2, type, h, capture = false) {
|
|
91400
92062
|
try {
|
|
91401
92063
|
t2?.addEventListener(type, h, capture);
|
|
@@ -91519,6 +92181,10 @@ function useAppHotkeys({
|
|
|
91519
92181
|
(iframe) => {
|
|
91520
92182
|
previewHistoryCleanupRef.current?.();
|
|
91521
92183
|
previewHistoryCleanupRef.current = null;
|
|
92184
|
+
if (iframe && previewFrameOpaque(iframe)) {
|
|
92185
|
+
previewHistoryCleanupRef.current = forwardSealedFrameKeys2(iframe, handleAppKeyDown);
|
|
92186
|
+
return;
|
|
92187
|
+
}
|
|
91522
92188
|
const win = iframeContentWindow(iframe);
|
|
91523
92189
|
if (!win) return;
|
|
91524
92190
|
const appHandler = handleAppKeyDown;
|
|
@@ -92569,14 +93235,14 @@ function useConsoleErrorCapture(previewIframe) {
|
|
|
92569
93235
|
};
|
|
92570
93236
|
const readSealedErrors = (iframe) => {
|
|
92571
93237
|
let live = true;
|
|
92572
|
-
let
|
|
93238
|
+
let read3 = 0;
|
|
92573
93239
|
let timer;
|
|
92574
93240
|
const poll = async () => {
|
|
92575
93241
|
for (; ; ) {
|
|
92576
|
-
const page = await previewConsoleErrors(iframe,
|
|
93242
|
+
const page = await previewConsoleErrors(iframe, read3);
|
|
92577
93243
|
if (!live) return;
|
|
92578
93244
|
if (!page) break;
|
|
92579
|
-
|
|
93245
|
+
read3 += page.errors.length;
|
|
92580
93246
|
record2(page.errors);
|
|
92581
93247
|
if (!page.truncated || page.errors.length === 0) break;
|
|
92582
93248
|
}
|
|
@@ -94083,7 +94749,7 @@ function InspectorIcon({ size = 16 }) {
|
|
|
94083
94749
|
import { createContext as createContext8 } from "react";
|
|
94084
94750
|
|
|
94085
94751
|
// src/utils/studioTheme.ts
|
|
94086
|
-
import { useSyncExternalStore as
|
|
94752
|
+
import { useSyncExternalStore as useSyncExternalStore13 } from "react";
|
|
94087
94753
|
function shownStudioTheme() {
|
|
94088
94754
|
return document.documentElement.dataset.theme === "paper" ? "light" : "dark";
|
|
94089
94755
|
}
|
|
@@ -94093,13 +94759,13 @@ function setStudioTheme(theme) {
|
|
|
94093
94759
|
if (theme === "light") root.dataset.theme = "paper";
|
|
94094
94760
|
else delete root.dataset.theme;
|
|
94095
94761
|
}
|
|
94096
|
-
function
|
|
94762
|
+
function subscribe2(listener2) {
|
|
94097
94763
|
const observer = new MutationObserver(listener2);
|
|
94098
94764
|
observer.observe(document.documentElement, { attributeFilter: ["data-theme"] });
|
|
94099
94765
|
return () => observer.disconnect();
|
|
94100
94766
|
}
|
|
94101
94767
|
function useShownStudioTheme() {
|
|
94102
|
-
return
|
|
94768
|
+
return useSyncExternalStore13(subscribe2, shownStudioTheme);
|
|
94103
94769
|
}
|
|
94104
94770
|
|
|
94105
94771
|
// src/components/ThemeToggle.tsx
|
|
@@ -98226,15 +98892,15 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
|
|
|
98226
98892
|
if (!iframe) return;
|
|
98227
98893
|
if (previewFrameOpaque(iframe)) {
|
|
98228
98894
|
if (opaqueRead.current) return void (opaqueRead.current.again = true);
|
|
98229
|
-
const
|
|
98230
|
-
opaqueRead.current =
|
|
98895
|
+
const read3 = { again: false };
|
|
98896
|
+
opaqueRead.current = read3;
|
|
98231
98897
|
const scope = { activeCompositionPath: activeCompPath, activeGroupElement };
|
|
98232
98898
|
void collectPreviewLayerItems(iframe, scope, LAYERS_PANEL_MAX_ROWS).then((reply) => {
|
|
98233
|
-
if (opaqueRead.current !==
|
|
98899
|
+
if (opaqueRead.current !== read3) return;
|
|
98234
98900
|
opaqueRead.current = null;
|
|
98235
98901
|
if (reply?.missingGroup) return setActiveGroupElement(null);
|
|
98236
98902
|
if (reply) setLayers(sortLayersByZIndex(reply.items));
|
|
98237
|
-
if (
|
|
98903
|
+
if (read3.again) collectLayers();
|
|
98238
98904
|
});
|
|
98239
98905
|
return;
|
|
98240
98906
|
}
|
|
@@ -102289,19 +102955,43 @@ function withEdits(attributes, edits) {
|
|
|
102289
102955
|
return next;
|
|
102290
102956
|
}
|
|
102291
102957
|
function readPreviewRootAttributes(iframe) {
|
|
102958
|
+
if (iframe && previewFrameOpaque(iframe)) {
|
|
102959
|
+
void askSealedRoot(iframe);
|
|
102960
|
+
return sealedRoots.get(iframe) ?? null;
|
|
102961
|
+
}
|
|
102292
102962
|
try {
|
|
102293
102963
|
const root = iframe?.contentDocument?.querySelector("[data-composition-id]");
|
|
102294
|
-
|
|
102295
|
-
const found = {};
|
|
102296
|
-
for (const name of Object.values(MOTION_BLUR_ATTR)) {
|
|
102297
|
-
const value = root.getAttribute(name);
|
|
102298
|
-
if (value !== null) found[name] = value;
|
|
102299
|
-
}
|
|
102300
|
-
return found;
|
|
102964
|
+
return root ? blurAttributes((name) => root.getAttribute(name)) : null;
|
|
102301
102965
|
} catch {
|
|
102302
102966
|
return null;
|
|
102303
102967
|
}
|
|
102304
102968
|
}
|
|
102969
|
+
function blurAttributes(read3) {
|
|
102970
|
+
const found = {};
|
|
102971
|
+
for (const name of Object.values(MOTION_BLUR_ATTR)) {
|
|
102972
|
+
const value = read3(name);
|
|
102973
|
+
if (typeof value === "string") found[name] = value;
|
|
102974
|
+
}
|
|
102975
|
+
return found;
|
|
102976
|
+
}
|
|
102977
|
+
var sealedRoots = /* @__PURE__ */ new WeakMap();
|
|
102978
|
+
var askingRoot = /* @__PURE__ */ new WeakSet();
|
|
102979
|
+
async function askSealedRoot(iframe) {
|
|
102980
|
+
if (askingRoot.has(iframe)) return;
|
|
102981
|
+
askingRoot.add(iframe);
|
|
102982
|
+
try {
|
|
102983
|
+
const [root] = (await queryPreviewElements(iframe, "[data-composition-id]"))?.matches ?? [];
|
|
102984
|
+
const [found] = root ? await describePreviewElements(iframe, [root.handle]) ?? [] : [];
|
|
102985
|
+
if (!found) sealedRoots.delete(iframe);
|
|
102986
|
+
else
|
|
102987
|
+
sealedRoots.set(
|
|
102988
|
+
iframe,
|
|
102989
|
+
blurAttributes((name) => new Map(found.attributes).get(name))
|
|
102990
|
+
);
|
|
102991
|
+
} finally {
|
|
102992
|
+
askingRoot.delete(iframe);
|
|
102993
|
+
}
|
|
102994
|
+
}
|
|
102305
102995
|
var sameAttributes = (a, b) => a === b || a !== null && b !== null && Object.keys({ ...a, ...b }).every((name) => a[name] === b[name]);
|
|
102306
102996
|
var BLUR_LEVELS = [
|
|
102307
102997
|
{ level: "off", label: "Off" },
|
|
@@ -102334,21 +103024,21 @@ function useLivePreviewAttributes(previewIframeRef, refreshKey) {
|
|
|
102334
103024
|
const [live, setLive] = useState168(null);
|
|
102335
103025
|
const holdUntil = useRef190(0);
|
|
102336
103026
|
useEffect161(() => {
|
|
102337
|
-
const
|
|
103027
|
+
const read3 = () => {
|
|
102338
103028
|
const found = readPreviewRootAttributes(previewIframeRef.current);
|
|
102339
103029
|
if (found && Date.now() >= holdUntil.current) {
|
|
102340
103030
|
setLive((current2) => sameAttributes(current2, found) ? current2 : found);
|
|
102341
103031
|
}
|
|
102342
103032
|
};
|
|
102343
|
-
|
|
102344
|
-
const timer = setInterval(
|
|
103033
|
+
read3();
|
|
103034
|
+
const timer = setInterval(read3, POLL_MS2);
|
|
102345
103035
|
return () => clearInterval(timer);
|
|
102346
103036
|
}, [previewIframeRef, refreshKey]);
|
|
102347
|
-
const
|
|
103037
|
+
const hold2 = useCallback187((next) => {
|
|
102348
103038
|
holdUntil.current = Date.now() + SETTLE_MS;
|
|
102349
103039
|
setLive(next);
|
|
102350
103040
|
}, []);
|
|
102351
|
-
return [live,
|
|
103041
|
+
return [live, hold2];
|
|
102352
103042
|
}
|
|
102353
103043
|
var MotionBlurPanel = memo61(function MotionBlurPanel2({
|
|
102354
103044
|
sdkSession,
|
|
@@ -102360,7 +103050,7 @@ var MotionBlurPanel = memo61(function MotionBlurPanel2({
|
|
|
102360
103050
|
const { refreshKey } = useStudioPlaybackContext();
|
|
102361
103051
|
const { readProjectFile, writeProjectFile, compositions } = useFileManagerContext();
|
|
102362
103052
|
const [, rerender] = useReducer2((n) => n + 1, 0);
|
|
102363
|
-
const [live,
|
|
103053
|
+
const [live, hold2] = useLivePreviewAttributes(previewIframeRef, refreshKey);
|
|
102364
103054
|
useEffect161(() => sdkSession?.on("change", rerender), [sdkSession]);
|
|
102365
103055
|
const root = sdkSession ? findCompositionRoot(sdkSession.getRootElements()) : null;
|
|
102366
103056
|
const attributes = live ?? root?.attributes ?? null;
|
|
@@ -102395,14 +103085,14 @@ var MotionBlurPanel = memo61(function MotionBlurPanel2({
|
|
|
102395
103085
|
});
|
|
102396
103086
|
}
|
|
102397
103087
|
});
|
|
102398
|
-
|
|
103088
|
+
hold2((current3) => withEdits(current3 ?? attributes, applied));
|
|
102399
103089
|
rerender();
|
|
102400
103090
|
} catch (err) {
|
|
102401
103091
|
if (err instanceof NothingToChange) return;
|
|
102402
103092
|
showToast(err instanceof Error ? err.message : String(err), "error");
|
|
102403
103093
|
}
|
|
102404
103094
|
},
|
|
102405
|
-
[attributes, persist2,
|
|
103095
|
+
[attributes, persist2, hold2, showToast]
|
|
102406
103096
|
);
|
|
102407
103097
|
if (!settings) {
|
|
102408
103098
|
return /* @__PURE__ */ jsx254("p", { className: "p-3 text-[10px] leading-relaxed text-neutral-500", children: "Open a composition to set up motion blur." });
|
|
@@ -102520,26 +103210,34 @@ function useSlideshowPersist({
|
|
|
102520
103210
|
}
|
|
102521
103211
|
|
|
102522
103212
|
// src/hooks/useSlideshowTabState.ts
|
|
102523
|
-
import { useMemo as useMemo89 } from "react";
|
|
103213
|
+
import { useEffect as useEffect162, useMemo as useMemo89, useState as useState169 } from "react";
|
|
102524
103214
|
import { SLIDESHOW_ISLAND_TYPE as SLIDESHOW_ISLAND_TYPE2, slideshowIslandRegex as slideshowIslandRegex2 } from "@hyperframes/core/slideshow";
|
|
103215
|
+
function isSceneEntry(value) {
|
|
103216
|
+
if (!value || typeof value !== "object") return false;
|
|
103217
|
+
const s = value;
|
|
103218
|
+
return typeof s.id === "string" && typeof s.label === "string" && Number.isFinite(s.start) && Number.isFinite(s.duration);
|
|
103219
|
+
}
|
|
102525
103220
|
function useSlideshowTabState(params) {
|
|
102526
103221
|
const { editingFileContent, previewIframeRef, refreshKey, slideshowVisible } = params;
|
|
102527
103222
|
const isSlideshowComposition = useMemo89(() => {
|
|
102528
103223
|
if (!editingFileContent || !editingFileContent.includes(SLIDESHOW_ISLAND_TYPE2)) return false;
|
|
102529
103224
|
return slideshowIslandRegex2("i").test(editingFileContent);
|
|
102530
103225
|
}, [editingFileContent]);
|
|
102531
|
-
const slideshowScenes =
|
|
102532
|
-
|
|
102533
|
-
|
|
102534
|
-
|
|
102535
|
-
|
|
102536
|
-
|
|
102537
|
-
|
|
102538
|
-
|
|
102539
|
-
|
|
102540
|
-
|
|
102541
|
-
|
|
102542
|
-
}
|
|
103226
|
+
const [slideshowScenes, setSlideshowScenes] = useState169([]);
|
|
103227
|
+
useEffect162(() => {
|
|
103228
|
+
const iframe = previewIframeRef.current;
|
|
103229
|
+
if (!iframe) return setSlideshowScenes([]);
|
|
103230
|
+
let current2 = true;
|
|
103231
|
+
void previewClipManifest(iframe).then((manifest) => {
|
|
103232
|
+
if (!current2) return;
|
|
103233
|
+
const scenes = Array.isArray(manifest?.scenes) ? manifest.scenes : [];
|
|
103234
|
+
setSlideshowScenes(
|
|
103235
|
+
scenes.filter(isSceneEntry).map((s) => ({ id: s.id, label: s.label, start: s.start, duration: s.duration }))
|
|
103236
|
+
);
|
|
103237
|
+
});
|
|
103238
|
+
return () => {
|
|
103239
|
+
current2 = false;
|
|
103240
|
+
};
|
|
102543
103241
|
}, [previewIframeRef, slideshowVisible, refreshKey]);
|
|
102544
103242
|
return { isSlideshowComposition, slideshowScenes };
|
|
102545
103243
|
}
|
|
@@ -102589,7 +103287,7 @@ function DesignPanelPromoteProvider({
|
|
|
102589
103287
|
}
|
|
102590
103288
|
|
|
102591
103289
|
// src/hooks/useRemoveBackground.ts
|
|
102592
|
-
import { useCallback as useCallback190, useEffect as
|
|
103290
|
+
import { useCallback as useCallback190, useEffect as useEffect163, useRef as useRef191 } from "react";
|
|
102593
103291
|
|
|
102594
103292
|
// src/components/studioMediaJobs.ts
|
|
102595
103293
|
var MEDIA_JOB_RECONNECT_TIMEOUT_MS = 15e3;
|
|
@@ -102696,7 +103394,7 @@ function waitForMediaJob(jobId, onProgress, signal) {
|
|
|
102696
103394
|
// src/hooks/useRemoveBackground.ts
|
|
102697
103395
|
function useRemoveBackground(projectId, refreshFileTree, showToast) {
|
|
102698
103396
|
const abortRef = useRef191(null);
|
|
102699
|
-
|
|
103397
|
+
useEffect163(
|
|
102700
103398
|
() => () => {
|
|
102701
103399
|
abortRef.current?.abort();
|
|
102702
103400
|
},
|
|
@@ -103162,7 +103860,7 @@ function useStudioSidePanels(left, right, projectId) {
|
|
|
103162
103860
|
}
|
|
103163
103861
|
|
|
103164
103862
|
// src/components/TimelineToolbar.tsx
|
|
103165
|
-
import { memo as memo63, useEffect as
|
|
103863
|
+
import { memo as memo63, useEffect as useEffect165, useRef as useRef192 } from "react";
|
|
103166
103864
|
import {
|
|
103167
103865
|
ArrowsOutLineHorizontal,
|
|
103168
103866
|
FrameCorners as FrameCorners2,
|
|
@@ -103173,7 +103871,7 @@ import {
|
|
|
103173
103871
|
} from "@phosphor-icons/react";
|
|
103174
103872
|
|
|
103175
103873
|
// src/hooks/useKeyframeKeyboard.ts
|
|
103176
|
-
import { useEffect as
|
|
103874
|
+
import { useEffect as useEffect164, useCallback as useCallback193 } from "react";
|
|
103177
103875
|
import { isTypingTarget as isTypingTarget9 } from "@hyperframes/core/typing-target";
|
|
103178
103876
|
function useKeyframeKeyboard({ enabled, onAddKeyframe }) {
|
|
103179
103877
|
const handler = useCallback193(
|
|
@@ -103187,7 +103885,7 @@ function useKeyframeKeyboard({ enabled, onAddKeyframe }) {
|
|
|
103187
103885
|
},
|
|
103188
103886
|
[enabled, onAddKeyframe]
|
|
103189
103887
|
);
|
|
103190
|
-
|
|
103888
|
+
useEffect164(() => {
|
|
103191
103889
|
if (!enabled) return;
|
|
103192
103890
|
window.addEventListener("keydown", handler, { capture: true });
|
|
103193
103891
|
return () => window.removeEventListener("keydown", handler, { capture: true });
|
|
@@ -103363,7 +104061,7 @@ function TimelineToolPicker({ showSelectAroundPlayhead = true }) {
|
|
|
103363
104061
|
}
|
|
103364
104062
|
|
|
103365
104063
|
// src/components/LinkedSelectionToggle.tsx
|
|
103366
|
-
import { useCallback as useCallback194, useState as
|
|
104064
|
+
import { useCallback as useCallback194, useState as useState170 } from "react";
|
|
103367
104065
|
import { createPortal as createPortal16 } from "react-dom";
|
|
103368
104066
|
import { LinkSimple } from "@phosphor-icons/react";
|
|
103369
104067
|
import { Fragment as Fragment72, jsx as jsx262, jsxs as jsxs208 } from "react/jsx-runtime";
|
|
@@ -103406,7 +104104,7 @@ function SyncIndicatorMenu({ x, y, onClose }) {
|
|
|
103406
104104
|
function LinkedSelectionToggle() {
|
|
103407
104105
|
const linkedSelection = useLinkedClipPreferences((s) => s.linkedSelection);
|
|
103408
104106
|
const setLinkedSelection = useLinkedClipPreferences((s) => s.setLinkedSelection);
|
|
103409
|
-
const [menuAt, setMenuAt] =
|
|
104107
|
+
const [menuAt, setMenuAt] = useState170(null);
|
|
103410
104108
|
const closeMenu = useCallback194(() => setMenuAt(null), []);
|
|
103411
104109
|
return /* @__PURE__ */ jsxs208(Fragment72, { children: [
|
|
103412
104110
|
/* @__PURE__ */ jsx262(
|
|
@@ -103543,10 +104241,10 @@ var TimelineToolbar = memo63(function TimelineToolbar2({
|
|
|
103543
104241
|
enabled: showKeyframes && Boolean(onToggleKeyframe),
|
|
103544
104242
|
onAddKeyframe: onToggleKeyframe
|
|
103545
104243
|
});
|
|
103546
|
-
|
|
104244
|
+
useEffect165(() => {
|
|
103547
104245
|
if (!showKeyframes) setAutoKeyframeEnabled(false);
|
|
103548
104246
|
}, [showKeyframes, setAutoKeyframeEnabled]);
|
|
103549
|
-
|
|
104247
|
+
useEffect165(() => {
|
|
103550
104248
|
const onKeyDown = (e) => {
|
|
103551
104249
|
if (!matchesKey(e, "timelineSnap")) return;
|
|
103552
104250
|
if (isTypingTarget10(e.target)) return;
|
|
@@ -103849,7 +104547,7 @@ function StudioSplash({ waiting }) {
|
|
|
103849
104547
|
}
|
|
103850
104548
|
|
|
103851
104549
|
// src/hooks/useServerConnection.ts
|
|
103852
|
-
import { useEffect as
|
|
104550
|
+
import { useEffect as useEffect166, useState as useState171 } from "react";
|
|
103853
104551
|
async function resolveHashProject(id) {
|
|
103854
104552
|
try {
|
|
103855
104553
|
const res = await studioApiFetch(`/api/projects/${encodeURIComponent(id)}`);
|
|
@@ -103879,9 +104577,9 @@ function reportHashVerdict(stage, verdict) {
|
|
|
103879
104577
|
});
|
|
103880
104578
|
}
|
|
103881
104579
|
function useServerConnection() {
|
|
103882
|
-
const [projectId, setProjectId] =
|
|
103883
|
-
const [resolving, setResolving] =
|
|
103884
|
-
const [waitingForServer, setWaitingForServer] =
|
|
104580
|
+
const [projectId, setProjectId] = useState171(null);
|
|
104581
|
+
const [resolving, setResolving] = useState171(true);
|
|
104582
|
+
const [waitingForServer, setWaitingForServer] = useState171(false);
|
|
103885
104583
|
useMountEffect(() => {
|
|
103886
104584
|
const hashProjectId = parseProjectIdFromHash(window.location.hash);
|
|
103887
104585
|
let cancelled = false;
|
|
@@ -103923,7 +104621,7 @@ function useServerConnection() {
|
|
|
103923
104621
|
if (retryTimer !== null) clearTimeout(retryTimer);
|
|
103924
104622
|
};
|
|
103925
104623
|
});
|
|
103926
|
-
|
|
104624
|
+
useEffect166(() => {
|
|
103927
104625
|
const onHashChange = () => {
|
|
103928
104626
|
const next = parseProjectIdFromHash(window.location.hash);
|
|
103929
104627
|
if (!next || next === projectId) return;
|
|
@@ -103949,9 +104647,9 @@ function useServerConnection() {
|
|
|
103949
104647
|
}
|
|
103950
104648
|
|
|
103951
104649
|
// src/hooks/useStudioSessionStart.ts
|
|
103952
|
-
import { useEffect as
|
|
104650
|
+
import { useEffect as useEffect167 } from "react";
|
|
103953
104651
|
function useStudioSessionStart(projectId, resolving, waitingForServer) {
|
|
103954
|
-
|
|
104652
|
+
useEffect167(() => {
|
|
103955
104653
|
if (resolving || waitingForServer || hasFiredSessionStart()) return;
|
|
103956
104654
|
markSessionStartFired();
|
|
103957
104655
|
trackStudioSessionStart({ has_project: projectId != null });
|
|
@@ -103975,10 +104673,10 @@ function useTimelineAddAtPlayhead(addAsset, addComposition, projectId) {
|
|
|
103975
104673
|
}
|
|
103976
104674
|
|
|
103977
104675
|
// src/hooks/useActiveComposition.ts
|
|
103978
|
-
import { useState as
|
|
104676
|
+
import { useState as useState172 } from "react";
|
|
103979
104677
|
|
|
103980
104678
|
// src/hooks/useHydrateActiveCompPathFromUrl.ts
|
|
103981
|
-
import { useEffect as
|
|
104679
|
+
import { useEffect as useEffect168 } from "react";
|
|
103982
104680
|
function useHydrateActiveCompPathFromUrl({
|
|
103983
104681
|
hydrated,
|
|
103984
104682
|
fileTreeLoaded,
|
|
@@ -103987,7 +104685,7 @@ function useHydrateActiveCompPathFromUrl({
|
|
|
103987
104685
|
setActiveCompPath,
|
|
103988
104686
|
setHydrated
|
|
103989
104687
|
}) {
|
|
103990
|
-
|
|
104688
|
+
useEffect168(() => {
|
|
103991
104689
|
if (hydrated) return;
|
|
103992
104690
|
if (!fileTreeLoaded) return;
|
|
103993
104691
|
const nextCompPath = normalizeStudioCompositionPath(
|
|
@@ -104000,7 +104698,7 @@ function useHydrateActiveCompPathFromUrl({
|
|
|
104000
104698
|
}
|
|
104001
104699
|
|
|
104002
104700
|
// src/hooks/useAutoOpenRootComposition.ts
|
|
104003
|
-
import { useEffect as
|
|
104701
|
+
import { useEffect as useEffect169, useRef as useRef193 } from "react";
|
|
104004
104702
|
function useAutoOpenRootComposition({
|
|
104005
104703
|
projectId,
|
|
104006
104704
|
activeCompPath,
|
|
@@ -104009,7 +104707,7 @@ function useAutoOpenRootComposition({
|
|
|
104009
104707
|
onSelectComposition
|
|
104010
104708
|
}) {
|
|
104011
104709
|
const settledForProjectRef = useRef193(void 0);
|
|
104012
|
-
|
|
104710
|
+
useEffect169(() => {
|
|
104013
104711
|
if (settledForProjectRef.current === projectId) return;
|
|
104014
104712
|
if (!activeCompPathHydrated) return;
|
|
104015
104713
|
if (activeCompPath !== null) {
|
|
@@ -104079,8 +104777,8 @@ function useActiveComposition({
|
|
|
104079
104777
|
setEditingFile,
|
|
104080
104778
|
showToast
|
|
104081
104779
|
}) {
|
|
104082
|
-
const [activeCompPath, setActiveCompPath] =
|
|
104083
|
-
const [activeCompPathHydrated, setActiveCompPathHydrated] =
|
|
104780
|
+
const [activeCompPath, setActiveCompPath] = useState172(null);
|
|
104781
|
+
const [activeCompPathHydrated, setActiveCompPathHydrated] = useState172(
|
|
104084
104782
|
() => isHydratedFromUrlState(initialUrlStateRef.current)
|
|
104085
104783
|
);
|
|
104086
104784
|
useResetSelectionOnProjectSwitch({
|
|
@@ -104120,12 +104818,12 @@ function StudioApp({ readOnlyPreview = false, readOnlyPreviewReason } = {}) {
|
|
|
104120
104818
|
const { projectId, resolving, waitingForServer } = useServerConnection();
|
|
104121
104819
|
const initialUrlStateRef = useRef195(readStudioUrlStateFromWindow());
|
|
104122
104820
|
useStudioSessionStart(projectId, resolving, waitingForServer);
|
|
104123
|
-
const [compIdToSrc, setCompIdToSrc] =
|
|
104821
|
+
const [compIdToSrc, setCompIdToSrc] = useState173(/* @__PURE__ */ new Map());
|
|
104124
104822
|
const previewIframe = useOwnPreviewIframe();
|
|
104125
|
-
const [compositionLoading, setCompositionLoading] =
|
|
104126
|
-
const [refreshKey, setRefreshKeyState] =
|
|
104823
|
+
const [compositionLoading, setCompositionLoading] = useState173(true);
|
|
104824
|
+
const [refreshKey, setRefreshKeyState] = useState173(0);
|
|
104127
104825
|
const [previewDocumentVersion, refreshPreviewDocumentVersion] = usePreviewDocumentVersion();
|
|
104128
|
-
const [blockPreview, setBlockPreview] =
|
|
104826
|
+
const [blockPreview, setBlockPreview] = useState173(null);
|
|
104129
104827
|
const previewIframeRef = useRef195(null);
|
|
104130
104828
|
const captionEditMode = useCaptionStore((s) => s.isEditMode);
|
|
104131
104829
|
const captionHasSelection = useCaptionStore((s) => s.selectedSegmentIds.size > 0);
|
|
@@ -104630,7 +105328,7 @@ function StudioApp({ readOnlyPreview = false, readOnlyPreviewReason } = {}) {
|
|
|
104630
105328
|
}
|
|
104631
105329
|
|
|
104632
105330
|
// src/hooks/useElementPicker.ts
|
|
104633
|
-
import { useState as
|
|
105331
|
+
import { useState as useState174, useCallback as useCallback198, useEffect as useEffect170, useRef as useRef196 } from "react";
|
|
104634
105332
|
|
|
104635
105333
|
// src/hooks/elementPickerStyles.ts
|
|
104636
105334
|
var PICKED_STYLE_PROPERTIES = [
|
|
@@ -104832,7 +105530,7 @@ function useActivePickerIframe(iframeRef, isPickModeRef, clearHover) {
|
|
|
104832
105530
|
[clearHover, iframeRef, isPickModeRef]
|
|
104833
105531
|
);
|
|
104834
105532
|
const renderedActiveIframe = getActiveIframe();
|
|
104835
|
-
|
|
105533
|
+
useEffect170(() => {
|
|
104836
105534
|
const previous = lastRenderedActiveIframeRef.current;
|
|
104837
105535
|
if (previous !== renderedActiveIframe) {
|
|
104838
105536
|
clearHover();
|
|
@@ -104847,8 +105545,8 @@ function useActivePickerIframe(iframeRef, isPickModeRef, clearHover) {
|
|
|
104847
105545
|
return { activeIframeRef, getActiveIframe, setActiveIframe };
|
|
104848
105546
|
}
|
|
104849
105547
|
function useElementPickerSession(iframeRef) {
|
|
104850
|
-
const [isPickMode, setIsPickMode] =
|
|
104851
|
-
const [pickedElement, setPickedElement] =
|
|
105548
|
+
const [isPickMode, setIsPickMode] = useState174(false);
|
|
105549
|
+
const [pickedElement, setPickedElement] = useState174(null);
|
|
104852
105550
|
const isPickModeRef = useRef196(false);
|
|
104853
105551
|
const pickedElementRef = useRef196(null);
|
|
104854
105552
|
pickedElementRef.current = pickedElement;
|
|
@@ -104899,7 +105597,7 @@ function useElementPickerSession(iframeRef) {
|
|
|
104899
105597
|
setPickedElement(filled);
|
|
104900
105598
|
});
|
|
104901
105599
|
}, []);
|
|
104902
|
-
|
|
105600
|
+
useEffect170(() => {
|
|
104903
105601
|
if (!isPickMode) return;
|
|
104904
105602
|
const handleKeyDown = (event) => {
|
|
104905
105603
|
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing || elementOwnsEscape(event.target))
|
|
@@ -105283,7 +105981,7 @@ function findElementBlock(html2, elementId2) {
|
|
|
105283
105981
|
}
|
|
105284
105982
|
|
|
105285
105983
|
// src/hooks/useDomStyleCommit.ts
|
|
105286
|
-
import { useCallback as useCallback199, useMemo as useMemo92, useRef as useRef197, useState as
|
|
105984
|
+
import { useCallback as useCallback199, useMemo as useMemo92, useRef as useRef197, useState as useState175 } from "react";
|
|
105287
105985
|
var noop = () => {
|
|
105288
105986
|
};
|
|
105289
105987
|
function useDomStyleCommit({
|
|
@@ -105296,7 +105994,7 @@ function useDomStyleCommit({
|
|
|
105296
105994
|
}) {
|
|
105297
105995
|
const projectIdRef = useRef197(projectId);
|
|
105298
105996
|
projectIdRef.current = projectId;
|
|
105299
|
-
const [queue2] =
|
|
105997
|
+
const [queue2] = useState175(createDomEditSaveQueue);
|
|
105300
105998
|
useMountEffect(() => () => queue2.destroy());
|
|
105301
105999
|
const versions = useRef197(/* @__PURE__ */ new Map()).current;
|
|
105302
106000
|
const editHistory = useMemo92(() => ({ recordEdit }), [recordEdit]);
|
|
@@ -105331,7 +106029,7 @@ function useDomStyleCommit({
|
|
|
105331
106029
|
}
|
|
105332
106030
|
|
|
105333
106031
|
// src/hooks/useDomGeometryCommit.ts
|
|
105334
|
-
import { useCallback as useCallback200, useMemo as useMemo93, useRef as useRef198, useState as
|
|
106032
|
+
import { useCallback as useCallback200, useMemo as useMemo93, useRef as useRef198, useState as useState176 } from "react";
|
|
105335
106033
|
var noop2 = () => {
|
|
105336
106034
|
};
|
|
105337
106035
|
var NO_SELECTED_ANIMATIONS = [];
|
|
@@ -105359,7 +106057,7 @@ function useDomGeometryCommit({
|
|
|
105359
106057
|
showToast,
|
|
105360
106058
|
writeProjectFile
|
|
105361
106059
|
});
|
|
105362
|
-
const [queue2] =
|
|
106060
|
+
const [queue2] = useState176(createDomEditSaveQueue);
|
|
105363
106061
|
useMountEffect(() => () => queue2.destroy());
|
|
105364
106062
|
const persistDomEditOperations = useDomEditPersist({
|
|
105365
106063
|
activeCompPath,
|