@hyperframes/studio 0.8.199 → 0.8.201

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.
Files changed (35) hide show
  1. package/dist/assets/{hyperframes-player-BDtBfwof.js → hyperframes-player-BNeO6YSP.js} +1 -1
  2. package/dist/assets/{index-BFfBBQMu.js → index-CZWE0FI8.js} +162 -162
  3. package/dist/assets/{index--W_0fuR8.js → index-DiNYtcMK.js} +1 -1
  4. package/dist/{chunk-ORLUDHTU.js → chunk-J6T4KD7Y.js} +33 -0
  5. package/dist/index.html +1 -1
  6. package/dist/index.js +227 -110
  7. package/dist/player.js +1 -1
  8. package/package.json +8 -8
  9. package/src/components/TimelineToolbar.test.tsx +117 -3
  10. package/src/components/TimelineToolbar.tsx +32 -1
  11. package/src/components/panels/VariablesBindElement.test.tsx +105 -0
  12. package/src/components/panels/VariablesBindElement.tsx +2 -2
  13. package/src/components/panels/VariablesDeclarationForm.test.ts +106 -0
  14. package/src/components/panels/VariablesDeclarationForm.tsx +21 -3
  15. package/src/components/panels/VariablesValueControls.tsx +6 -0
  16. package/src/components/ui/VideoFrameThumbnail.test.tsx +9 -0
  17. package/src/components/ui/VideoFrameThumbnail.tsx +1 -3
  18. package/src/hooks/appHotkeysDispatch.ts +7 -0
  19. package/src/hooks/useAppHotkeys.test.ts +75 -0
  20. package/src/hooks/useDomSelection.ts +5 -1
  21. package/src/player/components/EditModal.test.tsx +34 -0
  22. package/src/player/components/EditModal.tsx +4 -2
  23. package/src/player/components/studioShortcuts.ts +3 -0
  24. package/src/player/components/timelineMotion.test.ts +13 -0
  25. package/src/player/components/timelineMotion.ts +12 -6
  26. package/src/player/components/timelineZoom.test.ts +48 -0
  27. package/src/player/components/timelineZoom.ts +55 -0
  28. package/src/player/components/timelineZoomInput.test.ts +27 -0
  29. package/src/player/components/timelineZoomInput.ts +55 -8
  30. package/src/player/hooks/timelineSyncHydration.test.ts +20 -0
  31. package/src/player/hooks/timelineSyncHydration.ts +13 -2
  32. package/src/player/lib/timelineIframeHelpers.test.ts +41 -0
  33. package/src/player/lib/timelineIframeHelpers.ts +5 -2
  34. package/src/utils/sceneHold.test.ts +29 -0
  35. package/src/utils/sceneHold.ts +21 -0
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  PANEL_IDS,
8
8
  Player,
9
9
  STUDIO_PREVIEW_FPS,
10
+ TIMELINE_RANGE_MARGIN_PX,
10
11
  announcePreviewDocumentLoaded,
11
12
  announcePreviewPromoted,
12
13
  applyPreviewVariablesToUrl,
@@ -35,6 +36,7 @@ import {
35
36
  panelsInZone,
36
37
  parseDockLayout,
37
38
  patchElements,
39
+ positiveClipSpan,
38
40
  readStudioUiPreferences,
39
41
  sceneSwapFor,
40
42
  secondsToFrame,
@@ -47,8 +49,9 @@ import {
47
49
  usePlayerStore,
48
50
  usePreviewVariablesStore,
49
51
  whenPreviewBooted,
50
- writeStudioUiPreferences
51
- } from "./chunk-ORLUDHTU.js";
52
+ writeStudioUiPreferences,
53
+ zoomToSelectedClips
54
+ } from "./chunk-J6T4KD7Y.js";
52
55
  import {
53
56
  Button,
54
57
  ContextMenu,
@@ -607,10 +610,12 @@ var STUDIO_PLAIN_KEYS = {
607
610
  split: "s",
608
611
  record: "r",
609
612
  addKeyframe: "k",
610
- audioGain: "g"
613
+ audioGain: "g",
614
+ zoomSelection: "z"
611
615
  };
612
616
  var hintKey = (key2) => key2.toUpperCase();
613
617
  var SPLIT_SHORTCUT_HINT = hintKey(STUDIO_PLAIN_KEYS.split);
618
+ var ZOOM_SELECTION_SHORTCUT_HINT = hintKey(STUDIO_PLAIN_KEYS.zoomSelection);
614
619
  var DEFAULT_SHORTCUT_SECTIONS = [
615
620
  {
616
621
  title: "Playback",
@@ -643,6 +648,7 @@ var DEFAULT_SHORTCUT_SECTIONS = [
643
648
  { key: "\u2318V", label: "Paste element" },
644
649
  { key: "\u2318X", label: "Cut element" },
645
650
  { key: SPLIT_SHORTCUT_HINT, label: "Split clip at playhead" },
651
+ { key: ZOOM_SELECTION_SHORTCUT_HINT, label: "Zoom timeline to selected clips" },
646
652
  { key: hintKey(STUDIO_PLAIN_KEYS.audioGain), label: "Audio Gain for clips with sound" },
647
653
  { key: "\u21E7Click", label: "Razor tool: split all tracks" },
648
654
  { key: "[", label: "Select clips starting before the playhead" },
@@ -1451,15 +1457,19 @@ var onIdle = (callback) => {
1451
1457
  if (typeof requestIdleCallback === "function") requestIdleCallback(callback, { timeout: 1e3 });
1452
1458
  else setTimeout(callback, 0);
1453
1459
  };
1460
+ var busy = () => moving || usePlayerStore.getState().isPlaying;
1454
1461
  function whenTimelineIdle() {
1455
1462
  return new Promise((resolve) => {
1456
1463
  const check = () => {
1457
- if (!moving) return resolve();
1458
- const stop2 = subscribeTimelineMotion(() => {
1459
- if (moving) return;
1460
- stop2();
1464
+ if (!busy()) return resolve();
1465
+ const wake = () => {
1466
+ if (busy()) return;
1467
+ stopMotion();
1468
+ stopPlayback();
1461
1469
  onIdle(check);
1462
- });
1470
+ };
1471
+ const stopMotion = subscribeTimelineMotion(wake);
1472
+ const stopPlayback = usePlayerStore.subscribe(wake);
1463
1473
  };
1464
1474
  onIdle(check);
1465
1475
  });
@@ -2391,7 +2401,6 @@ function getTimelineScrollTopForGeometryChange(previous, next, scrollTop, dragAu
2391
2401
  }
2392
2402
 
2393
2403
  // src/player/components/timelineZoomInput.ts
2394
- var RANGE_MARGIN_PX = 24;
2395
2404
  var SMOOTH_ZOOM_MS = 220;
2396
2405
  var MAX_PREVIEW_SCALE = 4;
2397
2406
  var EDGE_SLACK_PX = 2;
@@ -2617,8 +2626,8 @@ function registerTimelineZoomViewport(next) {
2617
2626
  }
2618
2627
  var reducedMotion = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
2619
2628
  function rangeBox(view) {
2620
- const x = view.contentOrigin + RANGE_MARGIN_PX;
2621
- return { x, width: Math.max(1, view.scroll.clientWidth - x - RANGE_MARGIN_PX) };
2629
+ const x = view.contentOrigin + TIMELINE_RANGE_MARGIN_PX;
2630
+ return { x, width: Math.max(1, view.scroll.clientWidth - x - TIMELINE_RANGE_MARGIN_PX) };
2622
2631
  }
2623
2632
  function currentTimelineRange() {
2624
2633
  const view = viewport;
@@ -2635,8 +2644,13 @@ function easeToRange(start, end, { smooth = true, signal }, byPerson) {
2635
2644
  const view = viewport;
2636
2645
  const fitPps = usePlayerStore.getState().timelineFitPps;
2637
2646
  stopEase();
2638
- if (!view || !(end > start) || !(fitPps > 0) || signal?.aborted)
2639
- return Promise.resolve("cancelled");
2647
+ const zoom = view && !signal?.aborted ? zoomToSelectedClips({
2648
+ clips: [{ start, end }],
2649
+ viewportWidth: view.scroll.clientWidth,
2650
+ contentOrigin: view.contentOrigin,
2651
+ fitPixelsPerSecond: fitPps
2652
+ }) : null;
2653
+ if (!view || !zoom) return Promise.resolve("cancelled");
2640
2654
  let resolveThis = () => {
2641
2655
  };
2642
2656
  const result = new Promise((resolve) => resolveThis = resolve);
@@ -2644,8 +2658,8 @@ function easeToRange(start, end, { smooth = true, signal }, byPerson) {
2644
2658
  signal?.addEventListener("abort", () => resolveEase === resolveThis && stopEase(), {
2645
2659
  once: true
2646
2660
  });
2647
- const { x, width } = rangeBox(view);
2648
- const toPercent = clampTimelineZoomPercent(width / (end - start) / fitPps * 100, fitPps);
2661
+ const { x } = rangeBox(view);
2662
+ const toPercent = zoom.zoomPercent;
2649
2663
  const finish = () => {
2650
2664
  commitPreview();
2651
2665
  stopEase("done");
@@ -2695,7 +2709,7 @@ function zoomTimelineStep(direction) {
2695
2709
  fitPps
2696
2710
  );
2697
2711
  const view = viewport;
2698
- if (!view || !(fitPps > 0)) {
2712
+ if (!view || !(fitPps > 0) || !(view.scroll.clientWidth > view.contentOrigin)) {
2699
2713
  requestTimelineZoom(nextPercent);
2700
2714
  return;
2701
2715
  }
@@ -2706,6 +2720,29 @@ function zoomTimelineStep(direction) {
2706
2720
  const start = at.time - (at.x - x) / nextPps;
2707
2721
  void easeToRange(start, start + width / nextPps, {}, true);
2708
2722
  }
2723
+ function selectedClipSpans(state) {
2724
+ const keys = new Set(state.selectedElementIds);
2725
+ if (state.selectedElementId) keys.add(state.selectedElementId);
2726
+ const clips = [];
2727
+ for (const el of state.elements) {
2728
+ if (!keys.has(el.key ?? el.id)) continue;
2729
+ clips.push({ start: el.start, end: el.start + el.duration });
2730
+ }
2731
+ return clips;
2732
+ }
2733
+ function canZoomToSelectedClips(state) {
2734
+ return positiveClipSpan(selectedClipSpans(state)) !== null;
2735
+ }
2736
+ function zoomTimelineToSelectedClips() {
2737
+ const view = viewport;
2738
+ const state = usePlayerStore.getState();
2739
+ if (!view || !(state.timelineFitPps > 0) || !(view.scroll.clientWidth > view.contentOrigin))
2740
+ return false;
2741
+ const span = positiveClipSpan(selectedClipSpans(state));
2742
+ if (!span) return false;
2743
+ void zoomTimelineToRange(span.start, span.end);
2744
+ return true;
2745
+ }
2709
2746
 
2710
2747
  // src/player/components/timelinePlayheadTransform.ts
2711
2748
  function getTimelinePlayheadTransform(time, pixelsPerSecond, contentOrigin, atRest2, devicePixelRatio2 = globalThis.devicePixelRatio || 1) {
@@ -3817,10 +3854,10 @@ var isNearer = (candidate, best, start) => {
3817
3854
  return gap < 0 || gap === 0 && candidate > best;
3818
3855
  };
3819
3856
  function resolveNearestFreeStart(elements, track2, start, duration, excludeKey, minStart = 0, origin2 = null) {
3820
- const busy = elements.filter((el) => (el.key ?? el.id) !== excludeKey && el.track === track2).sort((a, b) => a.start - b.start);
3857
+ const busy2 = elements.filter((el) => (el.key ?? el.id) !== excludeKey && el.track === track2).sort((a, b) => a.start - b.start);
3821
3858
  let best = Number.POSITIVE_INFINITY;
3822
3859
  let gapStart = minStart;
3823
- for (const el of [...busy, null]) {
3860
+ for (const el of [...busy2, null]) {
3824
3861
  const latest2 = el ? floorCenti(el.start - duration) : Number.POSITIVE_INFINITY;
3825
3862
  if (latest2 >= gapStart) {
3826
3863
  const candidate = Math.min(Math.max(start, gapStart), latest2);
@@ -3830,7 +3867,7 @@ function resolveNearestFreeStart(elements, track2, start, duration, excludeKey,
3830
3867
  }
3831
3868
  if (origin2 === null || origin2 < minStart || !isNearer(origin2, best, start)) return best;
3832
3869
  const [from, to] = [origin2 + 1e-6, origin2 + duration - 1e-6];
3833
- const clear2 = busy.every((el) => !timeRangesOverlap(from, to, el.start, el.start + el.duration));
3870
+ const clear2 = busy2.every((el) => !timeRangesOverlap(from, to, el.start, el.start + el.duration));
3834
3871
  return clear2 ? origin2 : best;
3835
3872
  }
3836
3873
  function groupHeaderAim(input) {
@@ -25773,6 +25810,7 @@ import { useEffect as useEffect34, useMemo as useMemo35 } from "react";
25773
25810
 
25774
25811
  // src/player/components/EditModal.tsx
25775
25812
  import { useState as useState31, useCallback as useCallback36, useMemo as useMemo34, useRef as useRef44 } from "react";
25813
+ import { createPortal as createPortal5 } from "react-dom";
25776
25814
 
25777
25815
  // src/utils/clipboard.ts
25778
25816
  function copyWithSelection(text) {
@@ -25925,75 +25963,78 @@ function EditPopover({ rangeStart, rangeEnd, anchorX, anchorY, onClose }) {
25925
25963
  top: Math.max(8, anchorY - 280),
25926
25964
  zIndex: 200
25927
25965
  };
25928
- return /* @__PURE__ */ jsx65("div", { ref: popoverRef, style, children: /* @__PURE__ */ jsxs41("div", { className: "w-80 bg-neutral-900 border border-neutral-700/60 rounded-xl shadow-2xl shadow-black/40 overflow-hidden", children: [
25929
- /* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between px-4 py-2.5 border-b border-neutral-800/60", children: [
25930
- /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2", children: [
25931
- /* @__PURE__ */ jsx65("div", { className: "w-1.5 h-1.5 rounded-full bg-studio-accent" }),
25932
- /* @__PURE__ */ jsxs41("span", { className: "text-[11px] font-medium text-neutral-300", children: [
25933
- formatTime(start),
25934
- " to ",
25935
- formatTime(end)
25966
+ return createPortal5(
25967
+ /* @__PURE__ */ jsx65("div", { ref: popoverRef, style, children: /* @__PURE__ */ jsxs41("div", { className: "w-80 bg-neutral-900 border border-neutral-700/60 rounded-xl shadow-2xl shadow-black/40 overflow-hidden", children: [
25968
+ /* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between px-4 py-2.5 border-b border-neutral-800/60", children: [
25969
+ /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2", children: [
25970
+ /* @__PURE__ */ jsx65("div", { className: "w-1.5 h-1.5 rounded-full bg-studio-accent" }),
25971
+ /* @__PURE__ */ jsxs41("span", { className: "text-[11px] font-medium text-neutral-300", children: [
25972
+ formatTime(start),
25973
+ " to ",
25974
+ formatTime(end)
25975
+ ] })
25976
+ ] }),
25977
+ /* @__PURE__ */ jsxs41("span", { className: "text-[10px] text-neutral-600", children: [
25978
+ elementsInRange.length,
25979
+ " element",
25980
+ elementsInRange.length !== 1 ? "s" : ""
25936
25981
  ] })
25937
25982
  ] }),
25938
- /* @__PURE__ */ jsxs41("span", { className: "text-[10px] text-neutral-600", children: [
25939
- elementsInRange.length,
25940
- " element",
25941
- elementsInRange.length !== 1 ? "s" : ""
25942
- ] })
25943
- ] }),
25944
- elementsInRange.length > 0 && /* @__PURE__ */ jsx65("div", { className: "px-4 py-2 border-b border-neutral-800/40 max-h-24 overflow-y-auto", children: elementsInRange.map((el) => /* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between py-0.5", children: [
25945
- /* @__PURE__ */ jsxs41("span", { className: "text-[10px] font-mono text-accent-ink/80", children: [
25946
- "#",
25947
- el.id
25948
- ] }),
25949
- /* @__PURE__ */ jsx65("span", { className: "text-[10px] text-neutral-600", children: el.tag })
25950
- ] }, el.id)) }),
25951
- /* @__PURE__ */ jsx65("div", { className: "p-3", children: /* @__PURE__ */ jsx65(
25952
- "textarea",
25953
- {
25954
- ref: textareaRef,
25955
- value: prompt,
25956
- onChange: (e) => setPrompt(e.target.value),
25957
- onKeyDown: (e) => {
25958
- if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
25959
- e.preventDefault();
25960
- handleCopy2();
25961
- }
25962
- },
25963
- placeholder: "What should change?",
25964
- rows: 2,
25965
- className: "w-full px-3 py-2 text-xs bg-neutral-800/60 border border-neutral-700/40 rounded-lg text-neutral-200 placeholder:text-neutral-600 resize-none focus:outline-hidden focus:border-studio-accent/40 transition-colors"
25966
- }
25967
- ) }),
25968
- copyError && /* @__PURE__ */ jsx65("p", { className: "px-3 pb-2 text-[10px] text-danger-ink", role: "alert", children: "Copy failed. Check clipboard permissions and try again." }),
25969
- /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-2 gap-2 px-3 pb-3", children: [
25970
- /* @__PURE__ */ jsx65(
25971
- "button",
25972
- {
25973
- onClick: handleCopyPrompt,
25974
- disabled: !buildPromptCopyText(prompt),
25975
- className: `py-1.5 text-[11px] font-medium rounded-lg transition-all border ${copiedPromptOnly ? "bg-accent/15 text-accent-ink border-accent/30" : "bg-neutral-800/70 text-neutral-200 border-neutral-700/50 hover:bg-neutral-800"} disabled:opacity-50 disabled:cursor-not-allowed`,
25976
- children: copiedPromptOnly ? "Prompt Copied!" : "Copy Prompt"
25977
- }
25978
- ),
25979
- /* @__PURE__ */ jsxs41(
25980
- "button",
25983
+ elementsInRange.length > 0 && /* @__PURE__ */ jsx65("div", { className: "px-4 py-2 border-b border-neutral-800/40 max-h-24 overflow-y-auto", children: elementsInRange.map((el) => /* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between py-0.5", children: [
25984
+ /* @__PURE__ */ jsxs41("span", { className: "text-[10px] font-mono text-accent-ink/80", children: [
25985
+ "#",
25986
+ el.id
25987
+ ] }),
25988
+ /* @__PURE__ */ jsx65("span", { className: "text-[10px] text-neutral-600", children: el.tag })
25989
+ ] }, el.id)) }),
25990
+ /* @__PURE__ */ jsx65("div", { className: "p-3", children: /* @__PURE__ */ jsx65(
25991
+ "textarea",
25981
25992
  {
25982
- onClick: handleCopy2,
25983
- className: `py-1.5 text-[11px] font-medium rounded-lg transition-all ${copiedAgentPrompt ? "bg-accent/15 text-accent-ink border border-accent/30" : "bg-studio-accent/15 text-accent-ink border border-studio-accent/25 hover:bg-studio-accent/25"}`,
25984
- children: [
25985
- copiedAgentPrompt ? "Copied!" : "Copy to Agent",
25986
- !copiedAgentPrompt && /* @__PURE__ */ jsx65("span", { className: "text-[9px] text-text-muted ml-1.5", children: "Cmd+Enter" })
25987
- ]
25993
+ ref: textareaRef,
25994
+ value: prompt,
25995
+ onChange: (e) => setPrompt(e.target.value),
25996
+ onKeyDown: (e) => {
25997
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
25998
+ e.preventDefault();
25999
+ handleCopy2();
26000
+ }
26001
+ },
26002
+ placeholder: "What should change?",
26003
+ rows: 2,
26004
+ className: "w-full px-3 py-2 text-xs bg-neutral-800/60 border border-neutral-700/40 rounded-lg text-neutral-200 placeholder:text-neutral-600 resize-none focus:outline-hidden focus:border-studio-accent/40 transition-colors"
25988
26005
  }
25989
- )
25990
- ] })
25991
- ] }) });
26006
+ ) }),
26007
+ copyError && /* @__PURE__ */ jsx65("p", { className: "px-3 pb-2 text-[10px] text-danger-ink", role: "alert", children: "Copy failed. Check clipboard permissions and try again." }),
26008
+ /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-2 gap-2 px-3 pb-3", children: [
26009
+ /* @__PURE__ */ jsx65(
26010
+ "button",
26011
+ {
26012
+ onClick: handleCopyPrompt,
26013
+ disabled: !buildPromptCopyText(prompt),
26014
+ className: `py-1.5 text-[11px] font-medium rounded-lg transition-all border ${copiedPromptOnly ? "bg-accent/15 text-accent-ink border-accent/30" : "bg-neutral-800/70 text-neutral-200 border-neutral-700/50 hover:bg-neutral-800"} disabled:opacity-50 disabled:cursor-not-allowed`,
26015
+ children: copiedPromptOnly ? "Prompt Copied!" : "Copy Prompt"
26016
+ }
26017
+ ),
26018
+ /* @__PURE__ */ jsxs41(
26019
+ "button",
26020
+ {
26021
+ onClick: handleCopy2,
26022
+ className: `py-1.5 text-[11px] font-medium rounded-lg transition-all ${copiedAgentPrompt ? "bg-accent/15 text-accent-ink border border-accent/30" : "bg-studio-accent/15 text-accent-ink border border-studio-accent/25 hover:bg-studio-accent/25"}`,
26023
+ children: [
26024
+ copiedAgentPrompt ? "Copied!" : "Copy to Agent",
26025
+ !copiedAgentPrompt && /* @__PURE__ */ jsx65("span", { className: "text-[9px] text-text-muted ml-1.5", children: "Cmd+Enter" })
26026
+ ]
26027
+ }
26028
+ )
26029
+ ] })
26030
+ ] }) }),
26031
+ document.body
26032
+ );
25992
26033
  }
25993
26034
 
25994
26035
  // src/player/components/KeyframeDiamondContextMenu.tsx
25995
26036
  import { useState as useState32 } from "react";
25996
- import { createPortal as createPortal5 } from "react-dom";
26037
+ import { createPortal as createPortal6 } from "react-dom";
25997
26038
  import { jsx as jsx66, jsxs as jsxs42 } from "react/jsx-runtime";
25998
26039
  var ITEM_CLS = `${menuClasses.row} ${menuClasses.rowEnabled} flex items-center gap-2`;
25999
26040
  var DESTRUCTIVE_ITEM_CLS = `${menuClasses.row} text-danger-ink hover:bg-neutral-800 focus-visible:bg-neutral-800 cursor-pointer flex items-center gap-2`;
@@ -26032,7 +26073,7 @@ function KeyframeDiamondContextMenu({
26032
26073
  const overflowY = state.y + menuHeight - window.innerHeight;
26033
26074
  const adjustedX = state.x + menuWidth > window.innerWidth ? state.x - menuWidth : state.x;
26034
26075
  const adjustedY = Math.max(8, overflowY > 0 ? state.y - overflowY - 8 : state.y);
26035
- return createPortal5(
26076
+ return createPortal6(
26036
26077
  /* @__PURE__ */ jsxs42(
26037
26078
  "div",
26038
26079
  {
@@ -26121,7 +26162,7 @@ function KeyframeDiamondContextMenu({
26121
26162
 
26122
26163
  // src/player/components/ClipContextMenu.tsx
26123
26164
  import { memo as memo19, useLayoutEffect as useLayoutEffect9, useState as useState34 } from "react";
26124
- import { createPortal as createPortal6 } from "react-dom";
26165
+ import { createPortal as createPortal7 } from "react-dom";
26125
26166
 
26126
26167
  // src/player/components/clipMenuToolItems.tsx
26127
26168
  import { useEffect as useEffect33, useRef as useRef45, useState as useState33 } from "react";
@@ -27455,7 +27496,7 @@ var ClipContextMenu = memo19(function ClipContextMenu2({
27455
27496
  const menuHeight = useMeasuredHeight(menuRef, `${x},${y},${element.key ?? element.id}`);
27456
27497
  const overflowY = y + menuHeight - window.innerHeight;
27457
27498
  const adjustedY = overflowY > 0 ? Math.max(MENU_MARGIN, y - overflowY - MENU_MARGIN) : y;
27458
- return createPortal6(
27499
+ return createPortal7(
27459
27500
  /* @__PURE__ */ jsxs46(
27460
27501
  "div",
27461
27502
  {
@@ -27599,7 +27640,7 @@ var ClipContextMenu = memo19(function ClipContextMenu2({
27599
27640
 
27600
27641
  // src/player/components/TrackGapContextMenu.tsx
27601
27642
  import { memo as memo20 } from "react";
27602
- import { createPortal as createPortal7 } from "react-dom";
27643
+ import { createPortal as createPortal8 } from "react-dom";
27603
27644
  import { jsx as jsx71, jsxs as jsxs47 } from "react/jsx-runtime";
27604
27645
  var TrackGapContextMenu = memo20(function TrackGapContextMenu2({
27605
27646
  x,
@@ -27622,7 +27663,7 @@ var TrackGapContextMenu = memo20(function TrackGapContextMenu2({
27622
27663
  const itemClass2 = (enabled) => `${menuClasses.row} flex items-center justify-between ${enabled ? menuClasses.rowEnabled : menuClasses.rowDisabled}`;
27623
27664
  const closeGapTitle = canCloseGap ? void 0 : gapWidth == null ? "No gap here" : "A clip on this track can't be moved";
27624
27665
  const closeAllTitle = canCloseAllGaps ? void 0 : hasAnyGaps ? "A clip on this track can't be moved" : "No gaps on this track";
27625
- return createPortal7(
27666
+ return createPortal8(
27626
27667
  /* @__PURE__ */ jsxs47(
27627
27668
  "div",
27628
27669
  {
@@ -29609,7 +29650,7 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
29609
29650
  const rootCompId = rootComp?.getAttribute("data-composition-id");
29610
29651
  const hosts = doc.querySelectorAll("[data-composition-id][data-start]");
29611
29652
  const missing = [];
29612
- const resolveEnd = createReferenceEndResolver(createTimedElementLookup(doc), iframeWin);
29653
+ let resolveEnd;
29613
29654
  const masterTime = createRuntimeStartTimeResolver({
29614
29655
  timelineRegistry: iframeWin.__timelines,
29615
29656
  includeAuthoredTimingAttrs: true,
@@ -29620,6 +29661,7 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
29620
29661
  const compId = el.getAttribute("data-composition-id");
29621
29662
  if (!compId || compId === rootCompId) continue;
29622
29663
  if (existingIds.has(el.id) || existingIds.has(compId)) continue;
29664
+ resolveEnd ??= createReferenceEndResolver(createTimedElementLookup(doc), iframeWin);
29623
29665
  const entry2 = buildMissingCompositionEntry({
29624
29666
  doc,
29625
29667
  iframeWin,
@@ -29632,6 +29674,8 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
29632
29674
  });
29633
29675
  if (entry2) missing.push(entry2);
29634
29676
  }
29677
+ if (!doc.querySelector("[data-composition-src], [data-composition-file]"))
29678
+ return { missing, updatedEls: currentEls, patched: false };
29635
29679
  let patched = false;
29636
29680
  const findHost = previewElementFinder(doc);
29637
29681
  const updatedEls = currentEls.map((existing) => {
@@ -30007,12 +30051,17 @@ function collectHostDomChildren(hostId, parentEl, parentId, parentMap, out) {
30007
30051
  if (isGroup) collectHostDomChildren(hostId, child, child.id, parentMap, out);
30008
30052
  }
30009
30053
  }
30054
+ function clipHostOf(iframeDoc, clip) {
30055
+ const host = findClipElementById(iframeDoc, clip);
30056
+ const view = iframeDoc.defaultView;
30057
+ return (host && view?.__hfParkedSceneMarkup?.(host)) ?? host;
30058
+ }
30010
30059
  function collectSubCompositionDomChildren(iframeDoc, clips, parentMap) {
30011
30060
  const out = [];
30012
30061
  if (!iframeDoc) return out;
30013
30062
  for (const clip of clips) {
30014
30063
  if (clip.kind !== "composition" || !clip.id) continue;
30015
- const hostEl = findClipElementById(iframeDoc, clip);
30064
+ const hostEl = clipHostOf(iframeDoc, clip);
30016
30065
  if (!hostEl) continue;
30017
30066
  const innerRoot = hostEl.querySelector("[data-hf-inner-root]") ?? hostEl;
30018
30067
  collectHostDomChildren(clip.id, innerRoot, clip.id, parentMap, out);
@@ -30036,7 +30085,7 @@ function collectSubCompositionHostState(iframeDoc, clips) {
30036
30085
  if (!iframeDoc) return out;
30037
30086
  for (const clip of clips) {
30038
30087
  if (clip.kind !== "composition" || !clip.id) continue;
30039
- const hostEl = findClipElementById(iframeDoc, clip);
30088
+ const hostEl = clipHostOf(iframeDoc, clip);
30040
30089
  if (!hostEl) continue;
30041
30090
  for (const el of Array.from(hostEl.querySelectorAll("[id]"))) {
30042
30091
  const state = readSubCompositionHostState(el);
@@ -41587,7 +41636,7 @@ function resolveBoxChromeClass(hasCropOutline, boxClipPath) {
41587
41636
 
41588
41637
  // src/components/editor/CanvasContextMenu.tsx
41589
41638
  import { memo as memo29 } from "react";
41590
- import { createPortal as createPortal8 } from "react-dom";
41639
+ import { createPortal as createPortal9 } from "react-dom";
41591
41640
  import { jsx as jsx101, jsxs as jsxs70 } from "react/jsx-runtime";
41592
41641
  var Z_ACTION_ICONS = {
41593
41642
  "bring-forward": [
@@ -41688,7 +41737,7 @@ var CanvasContextMenu = memo29(function CanvasContextMenu2({
41688
41737
  const stopBubble = (e) => {
41689
41738
  e.stopPropagation();
41690
41739
  };
41691
- return createPortal8(
41740
+ return createPortal9(
41692
41741
  /* @__PURE__ */ jsxs70(
41693
41742
  "div",
41694
41743
  {
@@ -41755,7 +41804,7 @@ import { useEffect as useEffect53, useRef as useRef70 } from "react";
41755
41804
 
41756
41805
  // src/components/editor/InlineTextCaret.tsx
41757
41806
  import { useEffect as useEffect50, useState as useState50 } from "react";
41758
- import { createPortal as createPortal9 } from "react-dom";
41807
+ import { createPortal as createPortal10 } from "react-dom";
41759
41808
  import { jsx as jsx102 } from "react/jsx-runtime";
41760
41809
  var CARET_PX = 2;
41761
41810
  function InlineTextCaret({
@@ -41826,7 +41875,7 @@ function InlineTextCaret({
41826
41875
  };
41827
41876
  }, [element, iframe]);
41828
41877
  if (!placement || !iframe) return null;
41829
- return createPortal9(
41878
+ return createPortal10(
41830
41879
  /* @__PURE__ */ jsx102(
41831
41880
  "div",
41832
41881
  {
@@ -41916,7 +41965,7 @@ function neighbours({ startContainer: at, startOffset: offset }) {
41916
41965
 
41917
41966
  // src/components/editor/InlineTextToolbar.tsx
41918
41967
  import { useCallback as useCallback58, useEffect as useEffect51, useState as useState51 } from "react";
41919
- import { createPortal as createPortal10 } from "react-dom";
41968
+ import { createPortal as createPortal11 } from "react-dom";
41920
41969
 
41921
41970
  // src/components/editor/inlineTextStyleRange.ts
41922
41971
  import {
@@ -42327,7 +42376,7 @@ function InlineTextToolbar({
42327
42376
  );
42328
42377
  if (!placement || !iframe) return null;
42329
42378
  const styles = placement.styles;
42330
- return createPortal10(
42379
+ return createPortal11(
42331
42380
  /* @__PURE__ */ jsxs71(
42332
42381
  "div",
42333
42382
  {
@@ -51678,7 +51727,7 @@ import {
51678
51727
  useRef as useRef82,
51679
51728
  useState as useState60
51680
51729
  } from "react";
51681
- import { createPortal as createPortal11 } from "react-dom";
51730
+ import { createPortal as createPortal12 } from "react-dom";
51682
51731
  import {
51683
51732
  DockviewReact
51684
51733
  } from "dockview-react";
@@ -52316,7 +52365,7 @@ function Panel({ id, title, children }) {
52316
52365
  }, [controller, id, label, open]);
52317
52366
  const definition = PANEL_DEFINITIONS[id];
52318
52367
  const shown3 = visible || definition.keepMounted;
52319
- return element && shown3 ? createPortal11(children, element) : null;
52368
+ return element && shown3 ? createPortal12(children, element) : null;
52320
52369
  }
52321
52370
  function WindowMenu() {
52322
52371
  const openPanels = useDockLayoutStore((state) => state.openPanels);
@@ -56644,7 +56693,7 @@ import { useEffect as useEffect81, useRef as useRef95, useState as useState78 }
56644
56693
 
56645
56694
  // src/components/editor/propertyPanelColor.tsx
56646
56695
  import { useCallback as useCallback83, useEffect as useEffect76, useLayoutEffect as useLayoutEffect12, useRef as useRef91, useState as useState70 } from "react";
56647
- import { createPortal as createPortal12 } from "react-dom";
56696
+ import { createPortal as createPortal13 } from "react-dom";
56648
56697
  import { jsx as jsx131, jsxs as jsxs93 } from "react/jsx-runtime";
56649
56698
  var COLOR_PICKER_SIZE = { width: 292, height: 386 };
56650
56699
  function ColorSlider({
@@ -56901,7 +56950,7 @@ function ColorField({
56901
56950
  beginColorGesture();
56902
56951
  previewColorGesture(normalized);
56903
56952
  };
56904
- const picker = open ? createPortal12(
56953
+ const picker = open ? createPortal13(
56905
56954
  /* @__PURE__ */ jsxs93(
56906
56955
  "div",
56907
56956
  {
@@ -57660,6 +57709,11 @@ import { useMemo as useMemo54, useState as useState73 } from "react";
57660
57709
  import { useState as useState72 } from "react";
57661
57710
  import { jsx as jsx133, jsxs as jsxs95 } from "react/jsx-runtime";
57662
57711
  var VARIABLES_INPUT_CLASS = "w-full bg-neutral-900 border border-neutral-800 rounded-sm px-2 py-1 text-[10px] text-neutral-200 focus:outline-hidden focus:border-neutral-700";
57712
+ function variableDefaultText(decl) {
57713
+ if (decl.type === "font" && typeof decl.default === "object") return decl.default.name;
57714
+ if (decl.type === "image" && typeof decl.default === "object") return decl.default.url;
57715
+ return String(decl.default);
57716
+ }
57663
57717
  function DraftTextInput({
57664
57718
  value,
57665
57719
  onCommit,
@@ -57968,7 +58022,7 @@ function VariablesBindElement({
57968
58022
  '" already exists. This element will use its current value',
57969
58023
  existingDecl.default !== void 0 && /* @__PURE__ */ jsxs96("span", { className: "font-mono", children: [
57970
58024
  " (",
57971
- String(existingDecl.default),
58025
+ variableDefaultText(existingDecl),
57972
58026
  ")"
57973
58027
  ] }),
57974
58028
  `, not the element's own, so binding won't change "`,
@@ -70806,14 +70860,14 @@ function FlatOverlaysSection({
70806
70860
  if (error) {
70807
70861
  return /* @__PURE__ */ jsx188("div", { className: "py-4 text-center text-[10px] text-danger-ink", children: error });
70808
70862
  }
70809
- const busy = adding !== null;
70863
+ const busy2 = adding !== null;
70810
70864
  return /* @__PURE__ */ jsx188("div", { "data-flat-overlays": "true", className: FLAT_PREVIEW_GRID, children: overlays.map((overlay) => /* @__PURE__ */ jsxs144(
70811
70865
  "button",
70812
70866
  {
70813
70867
  type: "button",
70814
70868
  "data-flat-overlay": overlay.name,
70815
70869
  "aria-label": `Add ${overlay.title}`,
70816
- disabled: busy,
70870
+ disabled: busy2,
70817
70871
  title: overlay.description,
70818
70872
  onPointerEnter: () => setPreviewing(overlay.name),
70819
70873
  onPointerLeave: () => setPreviewing(null),
@@ -79623,6 +79677,20 @@ function seedDomEditGroupWithSelection(group, selection) {
79623
79677
  return [selection, ...group];
79624
79678
  }
79625
79679
 
79680
+ // src/utils/sceneHold.ts
79681
+ function holdScenesOf(iframe, element) {
79682
+ let hold;
79683
+ try {
79684
+ hold = iframe?.contentWindow?.__hfHoldScenes;
79685
+ } catch {
79686
+ return void 0;
79687
+ }
79688
+ if (!hold) return void 0;
79689
+ const names = element ? [...element.compositionAncestors ?? [], element.parentCompositionId ?? ""] : [];
79690
+ return hold(names.filter(Boolean)).catch(() => {
79691
+ });
79692
+ }
79693
+
79626
79694
  // src/hooks/useStudioTestHooks.ts
79627
79695
  import { useEffect as useEffect116 } from "react";
79628
79696
 
@@ -79995,6 +80063,8 @@ function useDomSelection({
79995
80063
  return null;
79996
80064
  }
79997
80065
  if (!doc) return null;
80066
+ const held = holdScenesOf(iframe, element);
80067
+ if (held) await held;
79998
80068
  reapplyPositionEditsAfterSeek(doc);
79999
80069
  const targetElement = findElementForTimelineElement(doc, element, {
80000
80070
  activeCompositionPath: activeCompPath,
@@ -80011,6 +80081,7 @@ function useDomSelection({
80011
80081
  async (element) => {
80012
80082
  const seq = ++timelineSelectSeqRef.current;
80013
80083
  if (!element) {
80084
+ void holdScenesOf(previewIframeRef.current, null);
80014
80085
  applyDomSelection(null, { revealPanel: false });
80015
80086
  return;
80016
80087
  }
@@ -80022,7 +80093,7 @@ function useDomSelection({
80022
80093
  }
80023
80094
  applyDomSelection(null, { revealPanel: false, announce: false });
80024
80095
  },
80025
- [applyDomSelection, buildDomSelectionForTimelineElement]
80096
+ [applyDomSelection, buildDomSelectionForTimelineElement, previewIframeRef]
80026
80097
  );
80027
80098
  const refreshDomEditGroupSelectionsFromPreviewRef = useRef143(async () => {
80028
80099
  });
@@ -87966,6 +88037,11 @@ function dispatchModifierKey(event, key2, cb) {
87966
88037
  }
87967
88038
  function dispatchPlainKey(event, key2, cb) {
87968
88039
  if (ownsPlainKeys(event.target)) return;
88040
+ if (key2 === STUDIO_PLAIN_KEYS.zoomSelection && !event.shiftKey && !event.altKey) {
88041
+ if (!zoomTimelineToSelectedClips()) return;
88042
+ event.preventDefault();
88043
+ return;
88044
+ }
87969
88045
  if (key2 === STUDIO_PLAIN_KEYS.fullscreen && !event.shiftKey && !event.altKey) {
87970
88046
  event.preventDefault();
87971
88047
  if (document.fullscreenElement) void document.exitFullscreen();
@@ -92686,7 +92762,7 @@ function VideoFrameThumbnail({
92686
92762
  return /* @__PURE__ */ jsx219("div", { className: "w-full h-full bg-neutral-800 flex items-center justify-center", children: /* @__PURE__ */ jsx219("span", { className: "text-[9px] font-medium text-neutral-600", children: fallbackLabel ?? "VIDEO" }) });
92687
92763
  }
92688
92764
  if (!frame3) {
92689
- return /* @__PURE__ */ jsx219("div", { className: "w-full h-full bg-neutral-800 animate-pulse motion-reduce:animate-none" });
92765
+ return /* @__PURE__ */ jsx219("div", { "data-thumbnail-loading": true, className: "w-full h-full bg-panel-surface" });
92690
92766
  }
92691
92767
  return /* @__PURE__ */ jsx219("img", { src: frame3, alt: "", draggable: false, className: "w-full h-full object-contain" });
92692
92768
  }
@@ -93372,7 +93448,7 @@ var AssetsTab = memo48(function AssetsTab2({
93372
93448
 
93373
93449
  // src/components/sidebar/BlocksTab.tsx
93374
93450
  import { memo as memo49, useState as useState145, useCallback as useCallback170, useRef as useRef176, useEffect as useEffect144 } from "react";
93375
- import { createPortal as createPortal13 } from "react-dom";
93451
+ import { createPortal as createPortal14 } from "react-dom";
93376
93452
 
93377
93453
  // src/components/sidebar/PromptPreviewModal.tsx
93378
93454
  import { useState as useState144, useCallback as useCallback169, useEffect as useEffect143, useRef as useRef175 } from "react";
@@ -93563,7 +93639,7 @@ var BlocksTab = memo49(function BlocksTab2({ onAddBlock, onPreviewBlock }) {
93563
93639
  }
93564
93640
  )
93565
93641
  ] }),
93566
- promptModal && createPortal13(
93642
+ promptModal && createPortal14(
93567
93643
  /* @__PURE__ */ jsx223(
93568
93644
  PromptPreviewModal,
93569
93645
  {
@@ -95865,7 +95941,7 @@ import { memo as memo59 } from "react";
95865
95941
 
95866
95942
  // src/components/renders/RenderQueue.tsx
95867
95943
  import { memo as memo58, useState as useState154, useRef as useRef183, useEffect as useEffect150, useLayoutEffect as useLayoutEffect16, useId as useId4 } from "react";
95868
- import { createPortal as createPortal14 } from "react-dom";
95944
+ import { createPortal as createPortal15 } from "react-dom";
95869
95945
  import { CANVAS_DIMENSIONS } from "@hyperframes/parsers";
95870
95946
 
95871
95947
  // src/components/renders/RenderQueueItem.tsx
@@ -96334,7 +96410,7 @@ function FormatInfoTooltip({ format }) {
96334
96410
  )
96335
96411
  }
96336
96412
  ),
96337
- open && createPortal14(
96413
+ open && createPortal15(
96338
96414
  /* @__PURE__ */ jsxs187(
96339
96415
  "div",
96340
96416
  {
@@ -97854,10 +97930,11 @@ function draftFromDeclaration(decl) {
97854
97930
  const numeric = decl.type === "number" ? decl : null;
97855
97931
  return {
97856
97932
  ...EMPTY_DRAFT,
97933
+ original: decl,
97857
97934
  id: decl.id,
97858
97935
  label: decl.label,
97859
97936
  type: decl.type,
97860
- defaultRaw: String(decl.default),
97937
+ defaultRaw: variableDefaultText(decl),
97861
97938
  description: decl.description ?? "",
97862
97939
  min: numeric?.min !== void 0 ? String(numeric.min) : "",
97863
97940
  max: numeric?.max !== void 0 ? String(numeric.max) : "",
@@ -97926,6 +98003,22 @@ function declarationFromDraft(draft) {
97926
98003
  return { ...base2, type: "boolean", default: draft.defaultRaw.trim() === "true" };
97927
98004
  case "enum":
97928
98005
  return enumDeclFromDraft(base2, draft);
98006
+ case "font": {
98007
+ const value = draft.original?.type === "font" ? draft.original.default : void 0;
98008
+ return {
98009
+ ...base2,
98010
+ type: "font",
98011
+ default: typeof value === "object" ? { ...value, name: draft.defaultRaw } : draft.defaultRaw
98012
+ };
98013
+ }
98014
+ case "image": {
98015
+ const value = draft.original?.type === "image" ? draft.original.default : void 0;
98016
+ return {
98017
+ ...base2,
98018
+ type: "image",
98019
+ default: typeof value === "object" ? { ...value, url: draft.defaultRaw } : draft.defaultRaw
98020
+ };
98021
+ }
97929
98022
  default:
97930
98023
  return { ...base2, type: draft.type, default: draft.defaultRaw };
97931
98024
  }
@@ -99542,6 +99635,7 @@ function useStudioSidePanels(left, right, projectId) {
99542
99635
  import { memo as memo63, useEffect as useEffect157, useRef as useRef187 } from "react";
99543
99636
  import {
99544
99637
  ArrowsOutLineHorizontal,
99638
+ FrameCorners as FrameCorners2,
99545
99639
  Image as Image3,
99546
99640
  Magnet,
99547
99641
  MagnifyingGlassMinus,
@@ -99739,7 +99833,7 @@ function TimelineToolPicker({ showSelectAroundPlayhead = true }) {
99739
99833
 
99740
99834
  // src/components/LinkedSelectionToggle.tsx
99741
99835
  import { useCallback as useCallback192, useState as useState162 } from "react";
99742
- import { createPortal as createPortal15 } from "react-dom";
99836
+ import { createPortal as createPortal16 } from "react-dom";
99743
99837
  import { LinkSimple } from "@phosphor-icons/react";
99744
99838
  import { Fragment as Fragment69, jsx as jsx252, jsxs as jsxs199 } from "react/jsx-runtime";
99745
99839
  function SyncIndicatorMenu({ x, y, onClose }) {
@@ -99747,7 +99841,7 @@ function SyncIndicatorMenu({ x, y, onClose }) {
99747
99841
  useMenuKeyboardNav(menuRef);
99748
99842
  const visible = useLinkedClipPreferences((s) => s.syncIndicatorsVisible);
99749
99843
  const setVisible = useLinkedClipPreferences((s) => s.setSyncIndicatorsVisible);
99750
- return createPortal15(
99844
+ return createPortal16(
99751
99845
  /* @__PURE__ */ jsx252(
99752
99846
  "div",
99753
99847
  {
@@ -99893,7 +99987,13 @@ var TimelineToolbar = memo63(function TimelineToolbar2({
99893
99987
  const currentTime = usePlayerStore((s) => s.currentTime);
99894
99988
  const beatAnalysisReady = usePlayerStore((s) => s.beatAnalysis !== null);
99895
99989
  const selectedElementId = usePlayerStore((s) => s.selectedElementId);
99990
+ const selectedElementIds = usePlayerStore((s) => s.selectedElementIds);
99896
99991
  const elements = usePlayerStore((s) => s.elements);
99992
+ const canZoomSelection = canZoomToSelectedClips({
99993
+ elements,
99994
+ selectedElementId,
99995
+ selectedElementIds
99996
+ });
99897
99997
  const timelineFitPps = usePlayerStore((s) => s.timelineFitPps);
99898
99998
  const { zoomMode, setZoomMode, setManualZoomPercent } = useTimelineZoom();
99899
99999
  const displayedTimelineZoomPercent = useShownTimelineZoomPercent();
@@ -100118,6 +100218,23 @@ var TimelineToolbar = memo63(function TimelineToolbar2({
100118
100218
  )
100119
100219
  }
100120
100220
  ),
100221
+ /* @__PURE__ */ jsx253(
100222
+ Tooltip,
100223
+ {
100224
+ label: canZoomSelection ? `Zoom to selected clips (${ZOOM_SELECTION_SHORTCUT_HINT})` : "Select a clip to zoom the timeline",
100225
+ children: /* @__PURE__ */ jsx253(
100226
+ "button",
100227
+ {
100228
+ type: "button",
100229
+ disabled: !canZoomSelection,
100230
+ "aria-label": canZoomSelection ? "Zoom to selected clips" : "Select a clip to zoom the timeline",
100231
+ onClick: () => zoomTimelineToSelectedClips(),
100232
+ className: canZoomSelection ? flatIdle : flatDisabled,
100233
+ children: /* @__PURE__ */ jsx253(FrameCorners2, { size: 16, "aria-hidden": "true" })
100234
+ }
100235
+ )
100236
+ }
100237
+ ),
100121
100238
  /* @__PURE__ */ jsx253(Tooltip, { label: "Fit timeline to width", children: /* @__PURE__ */ jsx253(
100122
100239
  "button",
100123
100240
  {