@hyperframes/studio 0.8.200 → 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 (30) hide show
  1. package/dist/assets/{hyperframes-player-LmRUJE8q.js → hyperframes-player-BNeO6YSP.js} +1 -1
  2. package/dist/assets/{index-BmTWk8xf.js → index-CZWE0FI8.js} +162 -162
  3. package/dist/assets/{index-CKNiEwbW.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 +202 -107
  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/player/components/EditModal.test.tsx +34 -0
  21. package/src/player/components/EditModal.tsx +4 -2
  22. package/src/player/components/studioShortcuts.ts +3 -0
  23. package/src/player/components/timelineMotion.test.ts +13 -0
  24. package/src/player/components/timelineMotion.ts +12 -6
  25. package/src/player/components/timelineZoom.test.ts +48 -0
  26. package/src/player/components/timelineZoom.ts +55 -0
  27. package/src/player/components/timelineZoomInput.test.ts +27 -0
  28. package/src/player/components/timelineZoomInput.ts +55 -8
  29. package/src/player/lib/timelineIframeHelpers.test.ts +41 -0
  30. package/src/player/lib/timelineIframeHelpers.ts +5 -2
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) => {
@@ -41592,7 +41636,7 @@ function resolveBoxChromeClass(hasCropOutline, boxClipPath) {
41592
41636
 
41593
41637
  // src/components/editor/CanvasContextMenu.tsx
41594
41638
  import { memo as memo29 } from "react";
41595
- import { createPortal as createPortal8 } from "react-dom";
41639
+ import { createPortal as createPortal9 } from "react-dom";
41596
41640
  import { jsx as jsx101, jsxs as jsxs70 } from "react/jsx-runtime";
41597
41641
  var Z_ACTION_ICONS = {
41598
41642
  "bring-forward": [
@@ -41693,7 +41737,7 @@ var CanvasContextMenu = memo29(function CanvasContextMenu2({
41693
41737
  const stopBubble = (e) => {
41694
41738
  e.stopPropagation();
41695
41739
  };
41696
- return createPortal8(
41740
+ return createPortal9(
41697
41741
  /* @__PURE__ */ jsxs70(
41698
41742
  "div",
41699
41743
  {
@@ -41760,7 +41804,7 @@ import { useEffect as useEffect53, useRef as useRef70 } from "react";
41760
41804
 
41761
41805
  // src/components/editor/InlineTextCaret.tsx
41762
41806
  import { useEffect as useEffect50, useState as useState50 } from "react";
41763
- import { createPortal as createPortal9 } from "react-dom";
41807
+ import { createPortal as createPortal10 } from "react-dom";
41764
41808
  import { jsx as jsx102 } from "react/jsx-runtime";
41765
41809
  var CARET_PX = 2;
41766
41810
  function InlineTextCaret({
@@ -41831,7 +41875,7 @@ function InlineTextCaret({
41831
41875
  };
41832
41876
  }, [element, iframe]);
41833
41877
  if (!placement || !iframe) return null;
41834
- return createPortal9(
41878
+ return createPortal10(
41835
41879
  /* @__PURE__ */ jsx102(
41836
41880
  "div",
41837
41881
  {
@@ -41921,7 +41965,7 @@ function neighbours({ startContainer: at, startOffset: offset }) {
41921
41965
 
41922
41966
  // src/components/editor/InlineTextToolbar.tsx
41923
41967
  import { useCallback as useCallback58, useEffect as useEffect51, useState as useState51 } from "react";
41924
- import { createPortal as createPortal10 } from "react-dom";
41968
+ import { createPortal as createPortal11 } from "react-dom";
41925
41969
 
41926
41970
  // src/components/editor/inlineTextStyleRange.ts
41927
41971
  import {
@@ -42332,7 +42376,7 @@ function InlineTextToolbar({
42332
42376
  );
42333
42377
  if (!placement || !iframe) return null;
42334
42378
  const styles = placement.styles;
42335
- return createPortal10(
42379
+ return createPortal11(
42336
42380
  /* @__PURE__ */ jsxs71(
42337
42381
  "div",
42338
42382
  {
@@ -51683,7 +51727,7 @@ import {
51683
51727
  useRef as useRef82,
51684
51728
  useState as useState60
51685
51729
  } from "react";
51686
- import { createPortal as createPortal11 } from "react-dom";
51730
+ import { createPortal as createPortal12 } from "react-dom";
51687
51731
  import {
51688
51732
  DockviewReact
51689
51733
  } from "dockview-react";
@@ -52321,7 +52365,7 @@ function Panel({ id, title, children }) {
52321
52365
  }, [controller, id, label, open]);
52322
52366
  const definition = PANEL_DEFINITIONS[id];
52323
52367
  const shown3 = visible || definition.keepMounted;
52324
- return element && shown3 ? createPortal11(children, element) : null;
52368
+ return element && shown3 ? createPortal12(children, element) : null;
52325
52369
  }
52326
52370
  function WindowMenu() {
52327
52371
  const openPanels = useDockLayoutStore((state) => state.openPanels);
@@ -56649,7 +56693,7 @@ import { useEffect as useEffect81, useRef as useRef95, useState as useState78 }
56649
56693
 
56650
56694
  // src/components/editor/propertyPanelColor.tsx
56651
56695
  import { useCallback as useCallback83, useEffect as useEffect76, useLayoutEffect as useLayoutEffect12, useRef as useRef91, useState as useState70 } from "react";
56652
- import { createPortal as createPortal12 } from "react-dom";
56696
+ import { createPortal as createPortal13 } from "react-dom";
56653
56697
  import { jsx as jsx131, jsxs as jsxs93 } from "react/jsx-runtime";
56654
56698
  var COLOR_PICKER_SIZE = { width: 292, height: 386 };
56655
56699
  function ColorSlider({
@@ -56906,7 +56950,7 @@ function ColorField({
56906
56950
  beginColorGesture();
56907
56951
  previewColorGesture(normalized);
56908
56952
  };
56909
- const picker = open ? createPortal12(
56953
+ const picker = open ? createPortal13(
56910
56954
  /* @__PURE__ */ jsxs93(
56911
56955
  "div",
56912
56956
  {
@@ -57665,6 +57709,11 @@ import { useMemo as useMemo54, useState as useState73 } from "react";
57665
57709
  import { useState as useState72 } from "react";
57666
57710
  import { jsx as jsx133, jsxs as jsxs95 } from "react/jsx-runtime";
57667
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
+ }
57668
57717
  function DraftTextInput({
57669
57718
  value,
57670
57719
  onCommit,
@@ -57973,7 +58022,7 @@ function VariablesBindElement({
57973
58022
  '" already exists. This element will use its current value',
57974
58023
  existingDecl.default !== void 0 && /* @__PURE__ */ jsxs96("span", { className: "font-mono", children: [
57975
58024
  " (",
57976
- String(existingDecl.default),
58025
+ variableDefaultText(existingDecl),
57977
58026
  ")"
57978
58027
  ] }),
57979
58028
  `, not the element's own, so binding won't change "`,
@@ -70811,14 +70860,14 @@ function FlatOverlaysSection({
70811
70860
  if (error) {
70812
70861
  return /* @__PURE__ */ jsx188("div", { className: "py-4 text-center text-[10px] text-danger-ink", children: error });
70813
70862
  }
70814
- const busy = adding !== null;
70863
+ const busy2 = adding !== null;
70815
70864
  return /* @__PURE__ */ jsx188("div", { "data-flat-overlays": "true", className: FLAT_PREVIEW_GRID, children: overlays.map((overlay) => /* @__PURE__ */ jsxs144(
70816
70865
  "button",
70817
70866
  {
70818
70867
  type: "button",
70819
70868
  "data-flat-overlay": overlay.name,
70820
70869
  "aria-label": `Add ${overlay.title}`,
70821
- disabled: busy,
70870
+ disabled: busy2,
70822
70871
  title: overlay.description,
70823
70872
  onPointerEnter: () => setPreviewing(overlay.name),
70824
70873
  onPointerLeave: () => setPreviewing(null),
@@ -87988,6 +88037,11 @@ function dispatchModifierKey(event, key2, cb) {
87988
88037
  }
87989
88038
  function dispatchPlainKey(event, key2, cb) {
87990
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
+ }
87991
88045
  if (key2 === STUDIO_PLAIN_KEYS.fullscreen && !event.shiftKey && !event.altKey) {
87992
88046
  event.preventDefault();
87993
88047
  if (document.fullscreenElement) void document.exitFullscreen();
@@ -92708,7 +92762,7 @@ function VideoFrameThumbnail({
92708
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" }) });
92709
92763
  }
92710
92764
  if (!frame3) {
92711
- 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" });
92712
92766
  }
92713
92767
  return /* @__PURE__ */ jsx219("img", { src: frame3, alt: "", draggable: false, className: "w-full h-full object-contain" });
92714
92768
  }
@@ -93394,7 +93448,7 @@ var AssetsTab = memo48(function AssetsTab2({
93394
93448
 
93395
93449
  // src/components/sidebar/BlocksTab.tsx
93396
93450
  import { memo as memo49, useState as useState145, useCallback as useCallback170, useRef as useRef176, useEffect as useEffect144 } from "react";
93397
- import { createPortal as createPortal13 } from "react-dom";
93451
+ import { createPortal as createPortal14 } from "react-dom";
93398
93452
 
93399
93453
  // src/components/sidebar/PromptPreviewModal.tsx
93400
93454
  import { useState as useState144, useCallback as useCallback169, useEffect as useEffect143, useRef as useRef175 } from "react";
@@ -93585,7 +93639,7 @@ var BlocksTab = memo49(function BlocksTab2({ onAddBlock, onPreviewBlock }) {
93585
93639
  }
93586
93640
  )
93587
93641
  ] }),
93588
- promptModal && createPortal13(
93642
+ promptModal && createPortal14(
93589
93643
  /* @__PURE__ */ jsx223(
93590
93644
  PromptPreviewModal,
93591
93645
  {
@@ -95887,7 +95941,7 @@ import { memo as memo59 } from "react";
95887
95941
 
95888
95942
  // src/components/renders/RenderQueue.tsx
95889
95943
  import { memo as memo58, useState as useState154, useRef as useRef183, useEffect as useEffect150, useLayoutEffect as useLayoutEffect16, useId as useId4 } from "react";
95890
- import { createPortal as createPortal14 } from "react-dom";
95944
+ import { createPortal as createPortal15 } from "react-dom";
95891
95945
  import { CANVAS_DIMENSIONS } from "@hyperframes/parsers";
95892
95946
 
95893
95947
  // src/components/renders/RenderQueueItem.tsx
@@ -96356,7 +96410,7 @@ function FormatInfoTooltip({ format }) {
96356
96410
  )
96357
96411
  }
96358
96412
  ),
96359
- open && createPortal14(
96413
+ open && createPortal15(
96360
96414
  /* @__PURE__ */ jsxs187(
96361
96415
  "div",
96362
96416
  {
@@ -97876,10 +97930,11 @@ function draftFromDeclaration(decl) {
97876
97930
  const numeric = decl.type === "number" ? decl : null;
97877
97931
  return {
97878
97932
  ...EMPTY_DRAFT,
97933
+ original: decl,
97879
97934
  id: decl.id,
97880
97935
  label: decl.label,
97881
97936
  type: decl.type,
97882
- defaultRaw: String(decl.default),
97937
+ defaultRaw: variableDefaultText(decl),
97883
97938
  description: decl.description ?? "",
97884
97939
  min: numeric?.min !== void 0 ? String(numeric.min) : "",
97885
97940
  max: numeric?.max !== void 0 ? String(numeric.max) : "",
@@ -97948,6 +98003,22 @@ function declarationFromDraft(draft) {
97948
98003
  return { ...base2, type: "boolean", default: draft.defaultRaw.trim() === "true" };
97949
98004
  case "enum":
97950
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
+ }
97951
98022
  default:
97952
98023
  return { ...base2, type: draft.type, default: draft.defaultRaw };
97953
98024
  }
@@ -99564,6 +99635,7 @@ function useStudioSidePanels(left, right, projectId) {
99564
99635
  import { memo as memo63, useEffect as useEffect157, useRef as useRef187 } from "react";
99565
99636
  import {
99566
99637
  ArrowsOutLineHorizontal,
99638
+ FrameCorners as FrameCorners2,
99567
99639
  Image as Image3,
99568
99640
  Magnet,
99569
99641
  MagnifyingGlassMinus,
@@ -99761,7 +99833,7 @@ function TimelineToolPicker({ showSelectAroundPlayhead = true }) {
99761
99833
 
99762
99834
  // src/components/LinkedSelectionToggle.tsx
99763
99835
  import { useCallback as useCallback192, useState as useState162 } from "react";
99764
- import { createPortal as createPortal15 } from "react-dom";
99836
+ import { createPortal as createPortal16 } from "react-dom";
99765
99837
  import { LinkSimple } from "@phosphor-icons/react";
99766
99838
  import { Fragment as Fragment69, jsx as jsx252, jsxs as jsxs199 } from "react/jsx-runtime";
99767
99839
  function SyncIndicatorMenu({ x, y, onClose }) {
@@ -99769,7 +99841,7 @@ function SyncIndicatorMenu({ x, y, onClose }) {
99769
99841
  useMenuKeyboardNav(menuRef);
99770
99842
  const visible = useLinkedClipPreferences((s) => s.syncIndicatorsVisible);
99771
99843
  const setVisible = useLinkedClipPreferences((s) => s.setSyncIndicatorsVisible);
99772
- return createPortal15(
99844
+ return createPortal16(
99773
99845
  /* @__PURE__ */ jsx252(
99774
99846
  "div",
99775
99847
  {
@@ -99915,7 +99987,13 @@ var TimelineToolbar = memo63(function TimelineToolbar2({
99915
99987
  const currentTime = usePlayerStore((s) => s.currentTime);
99916
99988
  const beatAnalysisReady = usePlayerStore((s) => s.beatAnalysis !== null);
99917
99989
  const selectedElementId = usePlayerStore((s) => s.selectedElementId);
99990
+ const selectedElementIds = usePlayerStore((s) => s.selectedElementIds);
99918
99991
  const elements = usePlayerStore((s) => s.elements);
99992
+ const canZoomSelection = canZoomToSelectedClips({
99993
+ elements,
99994
+ selectedElementId,
99995
+ selectedElementIds
99996
+ });
99919
99997
  const timelineFitPps = usePlayerStore((s) => s.timelineFitPps);
99920
99998
  const { zoomMode, setZoomMode, setManualZoomPercent } = useTimelineZoom();
99921
99999
  const displayedTimelineZoomPercent = useShownTimelineZoomPercent();
@@ -100140,6 +100218,23 @@ var TimelineToolbar = memo63(function TimelineToolbar2({
100140
100218
  )
100141
100219
  }
100142
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
+ ),
100143
100238
  /* @__PURE__ */ jsx253(Tooltip, { label: "Fit timeline to width", children: /* @__PURE__ */ jsx253(
100144
100239
  "button",
100145
100240
  {