@hyperframes/studio 0.8.103 → 0.8.105

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 (200) hide show
  1. package/dist/assets/{hyperframes-player-DG795Hwu.js → hyperframes-player-tnfCiVdR.js} +1 -1
  2. package/dist/assets/{index-BiEtDkae.js → index-Ca6LZlVb.js} +1 -1
  3. package/dist/assets/index-Cre9X4RS.css +1 -0
  4. package/dist/assets/{index-BPJRf2X9.js → index-DEDhPmPD.js} +215 -215
  5. package/dist/assets/{index-DuCZ3pQw.js → index-zpe332hb.js} +1 -1
  6. package/dist/{chunk-62DDWOSH.js → chunk-EEXSYY5F.js} +19 -18
  7. package/dist/chunk-EEXSYY5F.js.map +1 -0
  8. package/dist/{chunk-6GAO75IU.js → chunk-NCUBAVGK.js} +10 -8
  9. package/dist/chunk-NCUBAVGK.js.map +1 -0
  10. package/dist/{chunk-HIGHVWYD.js → chunk-QADHJFDF.js} +2 -2
  11. package/dist/index.css +6 -1
  12. package/dist/index.css.map +1 -1
  13. package/dist/index.d.ts +181 -168
  14. package/dist/index.html +2 -2
  15. package/dist/index.js +1018 -919
  16. package/dist/index.js.map +1 -1
  17. package/dist/player.js +2 -2
  18. package/dist/styles/tailwind-preset.js.map +1 -1
  19. package/dist/styles.css +1 -1
  20. package/dist/ui.js +2 -2
  21. package/package.json +8 -8
  22. package/src/captions/components/CaptionAnimationPanel.tsx +2 -2
  23. package/src/captions/components/CaptionPropertyPanel.tsx +2 -2
  24. package/src/captions/components/CaptionTimeline.tsx +3 -3
  25. package/src/components/AskAgentModal.tsx +1 -1
  26. package/src/components/LintModal.tsx +35 -35
  27. package/src/components/StudioErrorBoundary.tsx +1 -1
  28. package/src/components/StudioHeader.dom.test.tsx +4 -4
  29. package/src/components/StudioHeader.tsx +2 -1
  30. package/src/components/StudioToast.tsx +7 -16
  31. package/src/components/TimelineToolPicker.tsx +1 -1
  32. package/src/components/TimelineToolbar.tsx +11 -11
  33. package/src/components/dock/Dock.tsx +1 -1
  34. package/src/components/dock/dock.css +9 -1
  35. package/src/components/editor/AnimationCard.tsx +5 -5
  36. package/src/components/editor/AnimationCardParts.tsx +1 -1
  37. package/src/components/editor/BlockParamsPanel.tsx +3 -3
  38. package/src/components/editor/BorderRadiusEditor.tsx +8 -15
  39. package/src/components/editor/CanvasContextMenu.tsx +1 -1
  40. package/src/components/editor/ComputedTweenNotice.tsx +1 -1
  41. package/src/components/editor/DomEditOverlay.tsx +5 -6
  42. package/src/components/editor/DomEditRotateHandle.tsx +1 -1
  43. package/src/components/editor/EaseCurveSection.tsx +14 -19
  44. package/src/components/editor/EaseModeControls.tsx +2 -2
  45. package/src/components/editor/EaseParamFields.tsx +8 -8
  46. package/src/components/editor/FileTree.tsx +1 -1
  47. package/src/components/editor/FileTreeIcons.tsx +47 -26
  48. package/src/components/editor/FileTreeNodes.tsx +11 -8
  49. package/src/components/editor/GestureRecordControl.tsx +3 -3
  50. package/src/components/editor/GsapAddAnimationControl.tsx +1 -1
  51. package/src/components/editor/GsapAnimationSection.tsx +2 -2
  52. package/src/components/editor/InlineTextToolbar.tsx +4 -4
  53. package/src/components/editor/InspectorHeaderActions.tsx +1 -1
  54. package/src/components/editor/KeyframeDiamond.tsx +6 -4
  55. package/src/components/editor/KeyframeNavigation.tsx +4 -4
  56. package/src/components/editor/LayersPanel.tsx +3 -3
  57. package/src/components/editor/PromotableControl.tsx +2 -2
  58. package/src/components/editor/PropertyPanel.tsx +3 -3
  59. package/src/components/editor/PropertyPanelEmptyState.tsx +4 -4
  60. package/src/components/editor/PropertyPanelFlatFooter.tsx +2 -2
  61. package/src/components/editor/PropertyPanelFlatHeader.test.tsx +1 -1
  62. package/src/components/editor/PropertyPanelFlatHeader.tsx +2 -2
  63. package/src/components/editor/SnapToolbar.tsx +5 -5
  64. package/src/components/editor/TimelineFxPopover.tsx +4 -4
  65. package/src/components/editor/Transform3DCube.tsx +1 -1
  66. package/src/components/editor/anchoredResizeCommitFeedsOffset.test.ts +46 -6
  67. package/src/components/editor/anchoredResizeReleaseShift.test.ts +0 -84
  68. package/src/components/editor/domEditOverlayGestures.ts +13 -19
  69. package/src/components/editor/domEditOverlayStartGesture.test.ts +170 -13
  70. package/src/components/editor/domEditOverlayStartGesture.ts +15 -25
  71. package/src/components/editor/easeCurveSvg.tsx +1 -1
  72. package/src/components/editor/manualEdits.test.ts +3 -9
  73. package/src/components/editor/manualEdits.ts +0 -1
  74. package/src/components/editor/manualEditsDom.ts +3 -13
  75. package/src/components/editor/manualEditsDomPatches.test.ts +3 -131
  76. package/src/components/editor/manualEditsDomPatches.ts +1 -53
  77. package/src/components/editor/manualEditsSnapshot.ts +3 -0
  78. package/src/components/editor/manualEditsTypes.ts +2 -0
  79. package/src/components/editor/manualOffsetDrag.test.ts +41 -0
  80. package/src/components/editor/manualOffsetDrag.ts +6 -27
  81. package/src/components/editor/persistSeam.integration.test.ts +0 -18
  82. package/src/components/editor/plainTranslate.ts +42 -6
  83. package/src/components/editor/propertyPanelColorCurveGraph.tsx +2 -2
  84. package/src/components/editor/propertyPanelColorGradingControls.tsx +1 -1
  85. package/src/components/editor/propertyPanelColorGradingSection.tsx +8 -8
  86. package/src/components/editor/propertyPanelColorGradingSlider.tsx +1 -1
  87. package/src/components/editor/propertyPanelColorSecondary.tsx +4 -4
  88. package/src/components/editor/propertyPanelFill.tsx +6 -6
  89. package/src/components/editor/propertyPanelFlatColorGradingAccessory.tsx +3 -3
  90. package/src/components/editor/propertyPanelFlatColorGradingSection.test.tsx +1 -1
  91. package/src/components/editor/propertyPanelFlatColorGradingSection.tsx +6 -9
  92. package/src/components/editor/propertyPanelFlatEffectsSection.tsx +4 -4
  93. package/src/components/editor/propertyPanelFlatMediaSection.tsx +2 -2
  94. package/src/components/editor/propertyPanelFlatMotionSection.tsx +2 -2
  95. package/src/components/editor/propertyPanelFlatOverlaysSection.tsx +2 -2
  96. package/src/components/editor/propertyPanelFlatPrimitives.test.tsx +4 -3
  97. package/src/components/editor/propertyPanelFlatPrimitives.tsx +1 -1
  98. package/src/components/editor/propertyPanelFlatSliderReadout.tsx +1 -1
  99. package/src/components/editor/propertyPanelFont.tsx +2 -2
  100. package/src/components/editor/propertyPanelFxCarveModule.tsx +1 -1
  101. package/src/components/editor/propertyPanelFxControls.tsx +2 -2
  102. package/src/components/editor/propertyPanelFxEqModule.tsx +2 -2
  103. package/src/components/editor/propertyPanelFxNodeRow.tsx +1 -1
  104. package/src/components/editor/propertyPanelFxPresetRun.tsx +1 -1
  105. package/src/components/editor/propertyPanelMediaSection.tsx +1 -1
  106. package/src/components/editor/propertyPanelPrimitives.tsx +1 -1
  107. package/src/components/editor/propertyPanelSections.tsx +2 -2
  108. package/src/components/editor/propertyPanelTransformCommit.test.ts +29 -0
  109. package/src/components/editor/propertyPanelTransformCommit.ts +8 -5
  110. package/src/components/editor/propertyPanelTypes.ts +1 -0
  111. package/src/components/editor/propertyPanelValueTier.test.ts +1 -1
  112. package/src/components/editor/propertyPanelValueTier.ts +1 -1
  113. package/src/components/editor/rotateInlineSave.test.ts +111 -0
  114. package/src/components/editor/rotationDraft.test.ts +111 -0
  115. package/src/components/editor/rotationDraft.ts +145 -0
  116. package/src/components/editor/useDomEditNudge.test.tsx +33 -0
  117. package/src/components/editor/useDomEditNudge.ts +6 -2
  118. package/src/components/editor/useDomEditOverlayGestures.ts +22 -24
  119. package/src/components/feedback/StudioFeedbackCard.tsx +11 -23
  120. package/src/components/nle/AssetPreviewOverlay.tsx +1 -1
  121. package/src/components/nle/AudioMeterStrip.tsx +2 -2
  122. package/src/components/nle/NLEPreview.test.ts +8 -4
  123. package/src/components/nle/PreviewOverlays.tsx +1 -1
  124. package/src/components/nle/PreviewPane.tsx +3 -3
  125. package/src/components/nle/PreviewPoster.tsx +29 -1
  126. package/src/components/nle/PreviewZoomOverlay.tsx +1 -1
  127. package/src/components/panels/SlideshowPanel.tsx +4 -4
  128. package/src/components/panels/SlideshowSubPanels.tsx +19 -21
  129. package/src/components/panels/VariablesBindElement.tsx +1 -1
  130. package/src/components/panels/VariablesDeclarationForm.tsx +1 -1
  131. package/src/components/panels/VariablesPanel.tsx +4 -6
  132. package/src/components/panels/VariablesRowAction.tsx +1 -1
  133. package/src/components/renders/FfmpegRequiredNotice.tsx +4 -4
  134. package/src/components/renders/RenderQueue.tsx +2 -2
  135. package/src/components/renders/RenderQueueItem.tsx +3 -3
  136. package/src/components/sidebar/AssetCard.tsx +3 -3
  137. package/src/components/sidebar/AssetContextMenu.tsx +7 -7
  138. package/src/components/sidebar/AssetsTab.tsx +6 -6
  139. package/src/components/sidebar/AudioRow.tsx +5 -3
  140. package/src/components/sidebar/BlocksTab.tsx +6 -6
  141. package/src/components/sidebar/CompositionsTab.drag.test.tsx +3 -69
  142. package/src/components/sidebar/CompositionsTab.rootBadge.test.tsx +4 -50
  143. package/src/components/sidebar/CompositionsTab.thumbnails.test.tsx +256 -0
  144. package/src/components/sidebar/CompositionsTab.tsx +65 -12
  145. package/src/components/sidebar/PromptPreviewModal.tsx +3 -3
  146. package/src/components/sidebar/SidebarLintButton.tsx +3 -3
  147. package/src/components/sidebar/compositionsTabTestUtils.tsx +39 -0
  148. package/src/components/timelineToolbarStyles.ts +3 -3
  149. package/src/components/ui/Button.tsx +4 -4
  150. package/src/components/ui/HyperframesLogo.tsx +19 -18
  151. package/src/components/ui/Input.tsx +1 -1
  152. package/src/components/ui/Menu.tsx +4 -2
  153. package/src/hooks/draggedGsapPosition.ts +28 -0
  154. package/src/hooks/elementOffsetStager.ts +34 -13
  155. package/src/hooks/gsapRuntimeBridge.ts +5 -3
  156. package/src/hooks/gsapRuntimeKeyframes.ts +36 -2
  157. package/src/hooks/plainRotation.test.ts +122 -0
  158. package/src/hooks/plainRotation.ts +42 -0
  159. package/src/hooks/useClipboard.source.test.ts +42 -4
  160. package/src/hooks/useClipboard.ts +13 -3
  161. package/src/hooks/useDomEditCommits.ts +0 -3
  162. package/src/hooks/useDomEditSession.ts +5 -5
  163. package/src/hooks/useDomGeometryCommit.test.tsx +79 -1
  164. package/src/hooks/useDomGeometryCommit.ts +16 -17
  165. package/src/hooks/useDomGeometryCommits.test.tsx +233 -33
  166. package/src/hooks/useDomGeometryCommits.ts +27 -80
  167. package/src/hooks/useGsapAwareEditing.test.tsx +194 -11
  168. package/src/hooks/useGsapAwareEditing.ts +43 -42
  169. package/src/hooks/useInlineTextEdit.test.tsx +33 -3
  170. package/src/hooks/useInlineTextEdit.ts +2 -2
  171. package/src/player/components/ClipContextMenu.tsx +1 -1
  172. package/src/player/components/CompositionThumbnail.tsx +23 -11
  173. package/src/player/components/EditModal.tsx +6 -6
  174. package/src/player/components/KeyframeDiamondContextMenu.tsx +2 -2
  175. package/src/player/components/PlayerControls.tsx +3 -3
  176. package/src/player/components/ShortcutsPanel.tsx +8 -20
  177. package/src/player/components/TimelineCanvas.tsx +1 -1
  178. package/src/player/components/TimelineClip.tsx +2 -2
  179. package/src/player/components/TimelineEmptyState.tsx +2 -2
  180. package/src/player/components/TimelineLanes.tsx +0 -1
  181. package/src/player/components/TrackClipCount.tsx +1 -1
  182. package/src/player/components/VolumeControl.tsx +1 -1
  183. package/src/player/components/timelineClipChildren.tsx +1 -1
  184. package/src/player/components/timelineMotionStyles.test.ts +6 -22
  185. package/src/player/components/trackHeaderLabelRows.tsx +16 -16
  186. package/src/player/lib/thumbnailScheduler.ts +4 -5
  187. package/src/player/lib/timelineViewportBudgets.test.ts +1 -1
  188. package/src/player/lib/timelineViewportBudgets.ts +1 -1
  189. package/src/styles/hex-baseline.json +7 -19
  190. package/src/styles/studio.css +0 -9
  191. package/src/styles/tailwind-preset.shared.js +2 -1
  192. package/src/styles/theme.css +204 -147
  193. package/src/styles/theme.test.ts +13 -9
  194. package/src/utils/blockCategories.ts +41 -9
  195. package/src/utils/clipboardPayload.ts +2 -0
  196. package/dist/assets/index-CQN3M56N.css +0 -1
  197. package/dist/chunk-62DDWOSH.js.map +0 -1
  198. package/dist/chunk-6GAO75IU.js.map +0 -1
  199. package/src/hooks/gsapTargetCache.ts +0 -62
  200. /package/dist/{chunk-HIGHVWYD.js.map → chunk-QADHJFDF.js.map} +0 -0
@@ -1,7 +1,14 @@
1
1
  import { buildProjectApiPath } from "../../utils/projectRouting";
2
- import { memo, useCallback, useEffect, useRef, useState } from "react";
2
+ import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
+ import { useThumbnailLease } from "../../hooks/useThumbnailLease";
4
+ import {
5
+ thumbnailScheduler,
6
+ type ThumbnailRequest,
7
+ type ThumbnailSnapshot,
8
+ } from "../../player/lib/thumbnailScheduler";
3
9
  import {
4
10
  buildCompositionThumbnailUrl,
11
+ compositionThumbnailRequest,
5
12
  resolveThumbnailSeekTime,
6
13
  THUMBNAIL_SEEK_TIME_SECONDS,
7
14
  } from "../../player/components/CompositionThumbnail";
@@ -125,6 +132,38 @@ export function syncIframePlayback(iframe: HTMLIFrameElement | null, shouldPlay:
125
132
  }
126
133
  }
127
134
 
135
+ const imageUrlOf = (snapshot: ThumbnailSnapshot) =>
136
+ snapshot.status === "ready" && snapshot.value.kind === "image" ? snapshot.value.url : null;
137
+
138
+ // A layout effect takes the old frame's lease before the passive cleanup drops the first one.
139
+ function useLastFrame(request: ThumbnailRequest | null, snapshot: ThumbnailSnapshot) {
140
+ const current = imageUrlOf(snapshot);
141
+ const [kept, setKept] = useState<{ request: ThumbnailRequest; url: string } | null>(null);
142
+ if (request && current && kept?.request !== request) setKept({ request, url: current });
143
+ useLayoutEffect(() => {
144
+ if (!kept || kept.request === request) return;
145
+ const lease = thumbnailScheduler.acquire(kept.request, () => {});
146
+ return () => lease.release();
147
+ }, [kept, request]);
148
+ return current ?? kept?.url ?? null;
149
+ }
150
+
151
+ function useNearViewport<T extends Element>(): [(element: T | null) => void, boolean] {
152
+ const [element, setElement] = useState<T | null>(null);
153
+ const [near, setNear] = useState(false);
154
+ useEffect(() => {
155
+ if (!element || near) return;
156
+ if (typeof IntersectionObserver === "undefined") return setNear(true);
157
+ const observer = new IntersectionObserver(
158
+ (entries) => entries.some((entry) => entry.isIntersecting) && setNear(true),
159
+ { root: element.closest("[data-composition-list]"), rootMargin: "200px" },
160
+ );
161
+ observer.observe(element);
162
+ return () => observer.disconnect();
163
+ }, [element, near]);
164
+ return [setElement, near];
165
+ }
166
+
128
167
  function CompCard({
129
168
  projectId,
130
169
  comp,
@@ -153,7 +192,6 @@ function CompCard({
153
192
  const [hovered, setHovered] = useState(false);
154
193
  const [stageSize, setStageSize] = useState(DEFAULT_PREVIEW_STAGE);
155
194
  const [livePreviewLoaded, setLivePreviewLoaded] = useState(false);
156
- const [failedThumbnailUrl, setFailedThumbnailUrl] = useState<string | null>(null);
157
195
  const iframeRef = useRef<HTMLIFrameElement | null>(null);
158
196
  const hoverTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
159
197
  const syncTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -192,7 +230,21 @@ function CompCard({
192
230
  const name = comp.replace(/^compositions\//, "").replace(/\.html$/, "");
193
231
  const previewUrl = compositionPreviewUrl(projectId, comp);
194
232
  const thumbnailUrl = compositionCardThumbnailUrl(projectId, comp, contentRevision);
195
- const thumbnailFailed = failedThumbnailUrl === thumbnailUrl;
233
+ const [thumbnailBox, nearViewport] = useNearViewport<HTMLDivElement>();
234
+ const timelineSessionEpoch = usePlayerStore((state) => state.timelineSessionEpoch);
235
+ const thumbnailRequest = useMemo(
236
+ () =>
237
+ previewBooted && nearViewport
238
+ ? compositionThumbnailRequest(thumbnailUrl, projectId, {
239
+ sessionEpoch: timelineSessionEpoch,
240
+ rich: true,
241
+ })
242
+ : null,
243
+ [previewBooted, nearViewport, thumbnailUrl, projectId, timelineSessionEpoch],
244
+ );
245
+ const thumbnail = useThumbnailLease(thumbnailRequest);
246
+ const frameUrl = useLastFrame(thumbnailRequest, thumbnail);
247
+ const thumbnailFailed = thumbnail.status === "error";
196
248
  const previewScale = resolveCompositionPreviewScale({
197
249
  cardWidth: CARD_W,
198
250
  cardHeight: CARD_H,
@@ -250,19 +302,20 @@ function CompCard({
250
302
  : "border-l-2 border-transparent hover:bg-neutral-800/50"
251
303
  }`}
252
304
  >
253
- <div className="w-20 h-[45px] rounded-sm overflow-hidden bg-neutral-900 shrink-0 relative">
305
+ <div
306
+ ref={thumbnailBox}
307
+ className="w-20 h-[45px] rounded-sm overflow-hidden bg-neutral-900 shrink-0 relative"
308
+ >
254
309
  {thumbnailFailed ? (
255
310
  <div className="absolute inset-0 flex items-center justify-center px-1 text-center text-[8px] leading-tight text-neutral-600">
256
311
  Preview unavailable
257
312
  </div>
258
- ) : !previewBooted ? null : (
313
+ ) : !frameUrl ? null : (
259
314
  <img
260
- src={thumbnailUrl}
315
+ src={frameUrl}
261
316
  alt=""
262
317
  draggable={false}
263
- loading="lazy"
264
318
  decoding="async"
265
- onError={() => setFailedThumbnailUrl(thumbnailUrl)}
266
319
  className={`absolute inset-0 h-full w-full object-contain transition-opacity ${
267
320
  livePreviewLoaded ? "opacity-0" : "opacity-100"
268
321
  }`}
@@ -320,7 +373,7 @@ function CompCard({
320
373
  {lintInfo && lintInfo.count > 0 && (
321
374
  <span
322
375
  aria-label={`${lintInfo.count} lint finding${lintInfo.count === 1 ? "" : "s"}`}
323
- className="shrink-0 min-w-[16px] text-center rounded-full bg-amber-500/20 px-1 text-[8px] font-bold text-amber-400"
376
+ className="shrink-0 min-w-[16px] text-center rounded-full bg-amber-500/20 px-1 text-[8px] font-bold text-warning-ink"
324
377
  >
325
378
  {lintInfo.count}
326
379
  </span>
@@ -337,7 +390,7 @@ function CompCard({
337
390
  event.stopPropagation();
338
391
  onAddToTimeline();
339
392
  }}
340
- className="flex h-8 w-8 shrink-0 items-center justify-center rounded-sm text-neutral-600 opacity-0 transition-[color,background-color,opacity] hover:bg-neutral-800 hover:text-studio-accent group-hover/card:opacity-100 group-focus-within/card:opacity-100 focus:opacity-100"
393
+ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-sm text-neutral-600 opacity-0 transition-[color,background-color,opacity] hover:bg-neutral-800 hover:text-accent-ink group-hover/card:opacity-100 group-focus-within/card:opacity-100 focus:opacity-100"
341
394
  >
342
395
  <span aria-hidden="true">+</span>
343
396
  </button>
@@ -358,7 +411,7 @@ function CompCard({
358
411
  className={`flex h-6 w-6 shrink-0 items-center justify-center rounded transition-colors ${
359
412
  isRendering
360
413
  ? "text-neutral-600 cursor-not-allowed"
361
- : "text-neutral-600 hover:text-studio-accent hover:bg-neutral-800"
414
+ : "text-neutral-600 hover:text-accent-ink hover:bg-neutral-800"
362
415
  }`}
363
416
  >
364
417
  <svg
@@ -405,7 +458,7 @@ export const CompositionsTab = memo(function CompositionsTab({
405
458
  }
406
459
 
407
460
  return (
408
- <div className="flex-1 overflow-y-auto">
461
+ <div className="flex-1 overflow-y-auto" data-composition-list>
409
462
  {compositions.map((comp) => (
410
463
  <CompCard
411
464
  key={`${projectId}:${comp}`}
@@ -106,10 +106,10 @@ export function PromptPreviewModal({
106
106
  <button
107
107
  className={`px-4 py-1.5 rounded-lg text-xs font-medium transition-colors active:scale-[0.97] ${
108
108
  copyState === "copied"
109
- ? "bg-emerald-500 text-white"
109
+ ? "bg-accent text-on-accent"
110
110
  : copyState === "failed"
111
- ? "bg-red-500 text-white"
112
- : "bg-studio-accent/90 text-neutral-950 hover:bg-studio-accent"
111
+ ? "bg-danger text-on-danger"
112
+ : "bg-accent text-on-accent hover:bg-accent-hover"
113
113
  }`}
114
114
  onClick={handleCopy}
115
115
  >
@@ -17,7 +17,7 @@ export function SidebarLintButton({
17
17
  type="button"
18
18
  onClick={onLint}
19
19
  disabled={linting}
20
- className="w-full flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-md text-[11px] font-medium text-neutral-500 enabled:hover:text-amber-300 enabled:hover:bg-neutral-800 enabled:active:scale-[0.98] transition-colors disabled:opacity-40"
20
+ className="w-full flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-md text-[11px] font-medium text-neutral-500 enabled:hover:text-warning-ink enabled:hover:bg-neutral-800 enabled:active:scale-[0.98] transition-colors disabled:opacity-40"
21
21
  >
22
22
  <svg
23
23
  width="12"
@@ -38,8 +38,8 @@ export function SidebarLintButton({
38
38
  style={hasError ? { animationIterationCount: ERROR_PULSES_BEFORE_IDLE } : undefined}
39
39
  className={
40
40
  hasError
41
- ? "ml-1 min-w-[16px] rounded-full bg-panel-danger/25 px-1 text-[9px] font-bold text-panel-danger animate-pulse motion-reduce:animate-none"
42
- : "ml-1 min-w-[16px] rounded-full bg-amber-500/20 px-1 text-[9px] font-bold text-amber-400"
41
+ ? "ml-1 min-w-[16px] rounded-full bg-danger px-1 text-[9px] font-bold text-on-danger animate-pulse motion-reduce:animate-none"
42
+ : "ml-1 min-w-[16px] rounded-full bg-amber-500/20 px-1 text-[9px] font-bold text-warning-ink"
43
43
  }
44
44
  >
45
45
  {findingCount}
@@ -0,0 +1,39 @@
1
+ import { act, type ComponentProps } from "react";
2
+ import { createRoot, type Root } from "react-dom/client";
3
+ import { afterEach, vi } from "vitest";
4
+ import { thumbnailScheduler } from "../../player/lib/thumbnailScheduler";
5
+ import { usePlayerStore } from "../../player/store/playerStore";
6
+ import { CompositionsTab } from "./CompositionsTab";
7
+
8
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
9
+ (
10
+ window as unknown as { happyDOM: { settings: { disableIframePageLoading: boolean } } }
11
+ ).happyDOM.settings.disableIframePageLoading = true;
12
+
13
+ let root: Root | null = null;
14
+
15
+ afterEach(() => {
16
+ if (root) act(() => root?.unmount());
17
+ root = null;
18
+ thumbnailScheduler.invalidateProject("demo");
19
+ document.body.innerHTML = "";
20
+ usePlayerStore.setState({ thumbnailRevisions: {} });
21
+ });
22
+
23
+ export function mountCompositionsTab(props: Partial<ComponentProps<typeof CompositionsTab>> = {}) {
24
+ const host = document.createElement("div");
25
+ document.body.append(host);
26
+ root = createRoot(host);
27
+ act(() => {
28
+ root?.render(
29
+ <CompositionsTab
30
+ projectId="demo"
31
+ compositions={["compositions/headline.html"]}
32
+ activeComposition={null}
33
+ onSelect={vi.fn()}
34
+ {...props}
35
+ />,
36
+ );
37
+ });
38
+ return host;
39
+ }
@@ -1,5 +1,5 @@
1
1
  // CapCut-flat icon buttons: a transparent 28px hit area with a subtle hover wash.
2
2
  export const flatBtn = "flex h-7 w-7 items-center justify-center rounded-md transition-colors";
3
- export const flatIdle = `${flatBtn} text-neutral-400 hover:bg-white/6 hover:text-neutral-200 active:scale-[0.98]`;
4
- export const flatActive = `${flatBtn} bg-white/8 text-neutral-100 active:scale-[0.98]`;
5
- export const flatDisabled = `${flatBtn} text-neutral-700 cursor-not-allowed`;
3
+ export const flatIdle = `${flatBtn} text-text-2 hover:bg-hover hover:text-text-0 active:bg-press active:scale-[0.98]`;
4
+ export const flatActive = `${flatBtn} bg-on text-text-0 hover:bg-on-hover active:scale-[0.98]`;
5
+ export const flatDisabled = `${flatBtn} text-text-off cursor-not-allowed`;
@@ -50,8 +50,8 @@ export const buttonBase = cn(
50
50
  */
51
51
  export const buttonVariants: Record<ButtonVariant, string> = {
52
52
  primary: cn(
53
- "bg-accent text-bg-0 font-semibold",
54
- "enabled:hover:brightness-110 data-[preview-state=hover]:brightness-110",
53
+ "bg-accent text-on-accent font-semibold",
54
+ "enabled:hover:bg-accent-hover data-[preview-state=hover]:bg-accent-hover",
55
55
  "enabled:active:scale-[0.98] data-[preview-state=active]:scale-[0.98]",
56
56
  ),
57
57
  secondary: cn(
@@ -60,8 +60,8 @@ export const buttonVariants: Record<ButtonVariant, string> = {
60
60
  "enabled:active:scale-[0.98] data-[preview-state=active]:scale-[0.98]",
61
61
  ),
62
62
  danger: cn(
63
- "bg-danger text-text-0 font-medium",
64
- "enabled:hover:brightness-110 data-[preview-state=hover]:brightness-110",
63
+ "bg-danger text-on-danger font-medium",
64
+ "enabled:hover:brightness-95 data-[preview-state=hover]:brightness-95",
65
65
  "enabled:active:scale-[0.98] data-[preview-state=active]:scale-[0.98]",
66
66
  ),
67
67
  ghost: cn(
@@ -1,6 +1,6 @@
1
1
  export function HyperframesLogo() {
2
2
  // Full logo from logo-dark.svg (263×79): heygen label + gradient mark + hyperframes wordmark.
3
- // All fill="black" paths inverted to white for the dark header.
3
+ // The wordmark paths take the text colour, so the logo reads in both themes.
4
4
  const height = 28;
5
5
  const width = Math.round(height * (263 / 79));
6
6
  return (
@@ -9,6 +9,7 @@ export function HyperframesLogo() {
9
9
  height={height}
10
10
  viewBox="0 0 263 79"
11
11
  fill="none"
12
+ className="text-text-0"
12
13
  xmlns="http://www.w3.org/2000/svg"
13
14
  aria-label="Hyperframes"
14
15
  >
@@ -39,27 +40,27 @@ export function HyperframesLogo() {
39
40
  {/* heygen label */}
40
41
  <path
41
42
  d="M0 16.6738H4.96V23.3838H11.53V16.6738H16.49V35.4538H11.53V27.6738H4.96V35.4538H0V16.6738Z"
42
- fill="white"
43
+ fill="currentColor"
43
44
  />
44
45
  <path
45
46
  d="M17.8899 28.0137C17.8899 23.4237 21.2399 20.0237 25.7999 20.0237C30.0099 20.0237 32.9399 23.0837 32.9399 27.5637C32.9399 28.2037 32.8599 28.8237 32.8299 29.3337H22.6099C23.0399 31.1337 24.6199 32.1237 27.1399 32.1237C28.7199 32.1237 30.2199 31.7237 31.2999 31.0237V34.6737C30.1699 35.3937 28.2999 35.8537 26.3599 35.8537C21.2599 35.8537 17.8799 32.6037 17.8799 28.0237L17.8899 28.0137ZM28.5699 26.1937C28.4899 24.5337 27.3899 23.5637 25.7499 23.5637C24.1099 23.5637 22.9599 24.5337 22.6099 26.1937H28.5699Z"
46
- fill="white"
47
+ fill="currentColor"
47
48
  />
48
49
  <path
49
50
  d="M37.85 33.8638L32 20.4238H37.29L40.46 28.1538L43.6 20.4238H48.48L40.33 39.5738H35.26L37.86 33.8638H37.85Z"
50
- fill="white"
51
+ fill="currentColor"
51
52
  />
52
53
  <path
53
54
  d="M48.1797 26.1138C48.1797 20.4238 52.7097 16.2438 58.9397 16.2438C61.2997 16.2438 63.5297 16.8038 64.8197 17.7238V21.9338C63.5597 20.9138 61.6797 20.2938 59.7497 20.2938C55.7797 20.2938 53.2597 22.6238 53.2597 26.1438C53.2597 29.6638 55.5697 31.8838 58.8897 31.8838C59.6397 31.8838 60.4997 31.7538 61.1997 31.5038V27.8838H57.4697V24.2338H65.5197V33.7038C63.6697 35.0938 61.1997 35.8738 58.5997 35.8738C52.5397 35.8738 48.1897 31.7438 48.1897 26.1138H48.1797Z"
54
- fill="white"
55
+ fill="currentColor"
55
56
  />
56
57
  <path
57
58
  d="M66.6604 28.0137C66.6604 23.4237 70.0104 20.0237 74.5704 20.0237C78.7804 20.0237 81.7104 23.0837 81.7104 27.5637C81.7104 28.2037 81.6304 28.8237 81.6004 29.3337H71.3804C71.8104 31.1337 73.3904 32.1237 75.9104 32.1237C77.4904 32.1237 78.9904 31.7237 80.0704 31.0237V34.6737C78.9404 35.3937 77.0704 35.8537 75.1304 35.8537C70.0304 35.8537 66.6504 32.6037 66.6504 28.0237L66.6604 28.0137ZM77.3404 26.1937C77.2604 24.5337 76.1604 23.5637 74.5204 23.5637C72.8804 23.5637 71.7304 24.5337 71.3804 26.1937H77.3404Z"
58
- fill="white"
59
+ fill="currentColor"
59
60
  />
60
61
  <path
61
62
  d="M82.9688 20.4238H87.8488V22.4138C88.7588 20.9638 90.3488 20.1038 92.3288 20.1038C95.4988 20.1038 97.3988 22.3338 97.3988 25.8138V35.4438H92.5188V26.8638C92.5188 25.0438 91.8188 24.1838 90.4788 24.1838C88.9488 24.1838 87.8488 25.3638 87.8488 27.2638V35.4438H82.9688V20.4238Z"
62
- fill="white"
63
+ fill="currentColor"
63
64
  />
64
65
  {/* gradient icon mark */}
65
66
  <path
@@ -73,47 +74,47 @@ export function HyperframesLogo() {
73
74
  {/* hyperframes wordmark */}
74
75
  <path
75
76
  d="M0 71.9996V42.7256H7.7367V53.1806H17.9826V42.7256H25.7193V71.9996H17.9826V59.8718H7.7367V71.9996H0Z"
76
- fill="white"
77
+ fill="currentColor"
77
78
  />
78
79
  <path
79
80
  d="M31.9606 78.4405L36.0171 69.5329L26.9004 48.5811H35.1389L40.0737 60.6252L44.9666 48.5811H52.5779L39.8646 78.4405H31.9606Z"
80
- fill="white"
81
+ fill="currentColor"
81
82
  />
82
83
  <path
83
84
  d="M53.3711 78.4404V48.5809H60.9823V52.052C62.446 49.501 65.0807 48.0791 68.3008 48.0791C74.3647 48.0791 78.9649 53.3066 78.9649 60.2487C78.9649 67.2745 74.3229 72.4602 68.259 72.4602C65.0807 72.4602 62.446 71.1637 60.9823 68.78V78.4404H53.3711ZM66.1262 66.1872C69.2627 66.1872 71.3119 63.7616 71.3119 60.2905C71.3119 56.8195 69.2627 54.4357 66.1262 54.4357C62.7388 54.4357 60.9823 57.2795 60.9823 59.7051V60.9178C60.9823 63.3434 62.7388 66.1872 66.1262 66.1872Z"
84
- fill="white"
85
+ fill="currentColor"
85
86
  />
86
87
  <path
87
88
  d="M93.4397 72.6269C85.4939 72.6269 80.2246 67.5667 80.2246 60.4155C80.2246 53.2643 85.4521 47.9531 92.5615 47.9531C99.1273 47.9531 103.686 52.7206 103.686 59.7045C103.686 60.7082 103.56 61.6701 103.518 62.4647H87.5849C88.2541 65.2666 90.7214 66.8139 94.6525 66.8139C97.1199 66.8139 99.4618 66.1866 101.135 65.0993V70.7868C99.3782 71.916 96.4508 72.6269 93.4397 72.6269ZM87.5849 57.5717H96.869C96.7435 54.9789 95.0289 53.4734 92.4779 53.4734C89.9687 53.4734 88.1286 54.9789 87.5849 57.5717Z"
88
- fill="white"
89
+ fill="currentColor"
89
90
  />
90
91
  <path
91
92
  d="M105.645 72V48.5808H113.214V52.9719C114.218 50.0445 116.183 48.2881 118.692 48.2881C119.361 48.2881 119.989 48.4135 120.407 48.6645V55.8993C119.822 55.5648 119.111 55.4393 118.274 55.4393C115.138 55.4393 113.256 57.6558 113.256 61.2941V72H105.645Z"
92
- fill="white"
93
+ fill="currentColor"
93
94
  />
94
95
  <path
95
96
  d="M122.643 71.9996V42.7256H139.371V49.124H130.379V54.477H138.911V60.5827H130.379V71.9996H122.643Z"
96
- fill="white"
97
+ fill="currentColor"
97
98
  />
98
99
  <path
99
100
  d="M141.258 72V48.5808H148.827V52.9719C149.831 50.0445 151.796 48.2881 154.306 48.2881C154.975 48.2881 155.602 48.4135 156.02 48.6645V55.8993C155.435 55.5648 154.724 55.4393 153.887 55.4393C150.751 55.4393 148.869 57.6558 148.869 61.2941V72H141.258Z"
100
- fill="white"
101
+ fill="currentColor"
101
102
  />
102
103
  <path
103
104
  d="M167.26 72.4602C161.154 72.4602 156.596 67.2745 156.596 60.3324C156.596 53.3066 161.196 48.0791 167.302 48.0791C170.438 48.0791 173.031 49.4173 174.536 51.8429V48.5809H182.148V72.0001H174.536V68.4873C173.031 71.0801 170.438 72.4602 167.26 72.4602ZM169.393 66.1872C172.78 66.1872 174.536 63.3434 174.536 60.876V59.6632C174.536 57.2377 172.78 54.4357 169.393 54.4357C166.298 54.4357 164.207 56.7777 164.207 60.2905C164.207 63.7616 166.298 66.1872 169.393 66.1872Z"
104
- fill="white"
105
+ fill="currentColor"
105
106
  />
106
107
  <path
107
108
  d="M184.998 72.0001V48.5809H192.609V51.6756C193.989 49.4173 196.373 48.0791 199.426 48.0791C202.521 48.0791 204.779 49.5428 206.075 52.052C207.497 49.5846 210.132 48.0791 213.352 48.0791C218.245 48.0791 221.214 51.592 221.214 57.0286V72.0001H213.603V58.5341C213.603 55.774 212.557 54.4357 210.634 54.4357C208.459 54.4357 206.912 56.234 206.912 59.0778V72.0001H199.3V58.5341C199.3 55.774 198.255 54.4357 196.373 54.4357C194.157 54.4357 192.609 56.234 192.609 59.0778V72.0001H184.998Z"
108
- fill="white"
109
+ fill="currentColor"
109
110
  />
110
111
  <path
111
112
  d="M236.338 72.6269C228.392 72.6269 223.123 67.5667 223.123 60.4155C223.123 53.2643 228.351 47.9531 235.46 47.9531C242.026 47.9531 246.584 52.7206 246.584 59.7045C246.584 60.7082 246.459 61.6701 246.417 62.4647H230.483C231.152 65.2666 233.62 66.8139 237.551 66.8139C240.018 66.8139 242.36 66.1866 244.033 65.0993V70.7868C242.277 71.916 239.349 72.6269 236.338 72.6269ZM230.483 57.5717H239.767C239.642 54.9789 237.927 53.4734 235.376 53.4734C232.867 53.4734 231.027 54.9789 230.483 57.5717Z"
112
- fill="white"
113
+ fill="currentColor"
113
114
  />
114
115
  <path
115
116
  d="M252.115 72.502C250.192 72.502 248.268 72.0838 246.93 71.3728V65.6853C247.808 66.3126 248.937 66.689 250.066 66.689C251.739 66.689 252.784 65.8526 252.784 64.5562C252.784 63.8452 252.492 63.0925 251.655 62.0888L249.899 59.956C248.728 58.4923 248.226 56.9031 248.226 55.2721C248.226 51.0065 251.864 48.0791 256.883 48.0791C258.723 48.0791 260.438 48.4555 261.65 49.0828V54.7703C260.898 54.2266 259.768 53.8503 258.723 53.8503C257.092 53.8503 256.046 54.6867 256.046 55.8994C256.046 56.6522 256.423 57.405 257.259 58.4086L258.974 60.4996C260.187 62.047 260.73 63.5943 260.73 65.2671C260.73 69.5746 257.05 72.502 252.115 72.502Z"
116
- fill="white"
117
+ fill="currentColor"
117
118
  />
118
119
  </svg>
119
120
  );
@@ -23,7 +23,7 @@ export const fieldBase = cn(
23
23
  // `aria-invalid` is not one of Tailwind's built-in aria variants, so the
24
24
  // arbitrary form is the one that compiles. The token gate would have caught
25
25
  // the bare `aria-invalid:` spelling as a class that resolves to nothing.
26
- "aria-[invalid]:border-danger",
26
+ "aria-[invalid]:border-danger-ink",
27
27
  "has-[:disabled]:opacity-40 has-[:disabled]:cursor-not-allowed",
28
28
  );
29
29
 
@@ -67,7 +67,9 @@ const itemBase = cn(
67
67
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-40",
68
68
  );
69
69
 
70
- const itemDanger = cn("text-danger data-[highlighted]:bg-danger/15 data-[highlighted]:text-danger");
70
+ const itemDanger = cn(
71
+ "text-danger-ink data-[highlighted]:bg-danger/15 data-[highlighted]:text-danger-ink",
72
+ );
71
73
 
72
74
  export type MenuItemTone = "default" | "danger";
73
75
 
@@ -229,7 +231,7 @@ export function MenuCheckboxItem({
229
231
  return (
230
232
  <BaseMenu.CheckboxItem className={cn(itemBase, className)} {...props}>
231
233
  <span className="truncate">{children}</span>
232
- <span className="flex size-3 shrink-0 items-center justify-center text-accent">
234
+ <span className="flex size-3 shrink-0 items-center justify-center text-accent-ink">
233
235
  <BaseMenu.CheckboxItemIndicator>✓</BaseMenu.CheckboxItemIndicator>
234
236
  </span>
235
237
  </BaseMenu.CheckboxItem>
@@ -8,6 +8,34 @@ import { roundTo3 } from "../utils/rounding";
8
8
  * it without pulling the GSAP commit graph into its module scope.
9
9
  */
10
10
 
11
+ const cssValue = (style: CSSStyleDeclaration, prop: string) => {
12
+ const value = style.getPropertyValue(prop).trim();
13
+ return value === "none" ? "" : value;
14
+ };
15
+
16
+ // Without GSAP, the rotation GSAP will parse from the CSS `rotate`, `scale` and `transform`; with
17
+ // `withRotate` false, only the part `scale` and `transform` draw. GSAP folds them into one transform,
18
+ // and a list the browser rejects (e.g. `rotate: x 30deg`) leaves it only the plain transform.
19
+ export function readCssRotation(element: HTMLElement, withRotate = true): number {
20
+ const view = element.ownerDocument.defaultView;
21
+ if (!view) return 0;
22
+ const style = view.getComputedStyle(element);
23
+ const rotate = withRotate ? cssValue(style, "rotate") : "";
24
+ const scale = cssValue(style, "scale");
25
+ const transform = cssValue(style, "transform");
26
+ const angle = (list: string) => {
27
+ if (!list) return 0;
28
+ const m = new view.DOMMatrix(list);
29
+ return (Math.atan2(m.b, m.a) * 180) / Math.PI;
30
+ };
31
+ const folded = [rotate && `rotate(${rotate})`, scale && `scale(${scale.split(/\s+/).join(",")})`];
32
+ try {
33
+ return angle([...folded, transform].join(" ").trim());
34
+ } catch {
35
+ return angle(transform);
36
+ }
37
+ }
38
+
11
39
  /**
12
40
  * Translate a studio drag offset into absolute GSAP x/y, accounting for the
13
41
  * element's rotation and its drag-start base pose. Reads the drag-start
@@ -5,8 +5,13 @@ import {
5
5
  } from "../components/editor/elementPositionOffset";
6
6
  import { LAYER_REVEAL_PRIOR_POSITION_ATTR } from "../player/lib/timelineElementHelpers";
7
7
  import type { PatchOperation } from "../utils/sourcePatcher";
8
- import { translatePatch } from "../components/editor/plainTranslate";
9
- import { gsapWritesPosition } from "./gsapRuntimeKeyframes";
8
+ import { writePlainMove } from "../components/editor/plainTranslate";
9
+ import { captureStudioPathOffset, restoreStudioPathOffset } from "../components/editor/manualEdits";
10
+ import { gsapHoldsTranslate } from "./gsapRuntimeKeyframes";
11
+ import { markStudioSaveErrorAlreadyToasted } from "../utils/studioSaveDiagnostics";
12
+
13
+ const GSAP_TOOK_OVER =
14
+ "The animation took over this layer's position during the move, so it was not saved.";
10
15
 
11
16
  const ELEMENT_OFFSET_REFUSED: Record<ElementOffsetRefusal, string> = {
12
17
  anchored: "This layer is anchored from its right or bottom edge. Move it in the Code tab.",
@@ -23,15 +28,29 @@ export interface ElementOffsetStagerDeps {
23
28
  readOnlyPreview?: boolean;
24
29
  }
25
30
 
31
+ function gsapOf(el: HTMLElement): { set: (t: Element, v: object) => void } | undefined {
32
+ return (el.ownerDocument.defaultView as { gsap?: { set: (t: Element, v: object) => void } })
33
+ ?.gsap;
34
+ }
35
+
26
36
  /** The drag draft moved GSAP's x/y; left/top carries the move now, so put them back. */
27
37
  function settleGsapDraftAtGestureStart(el: HTMLElement): void {
28
- const gsap = (el.ownerDocument.defaultView as { gsap?: { set: (t: Element, v: object) => void } })
29
- ?.gsap;
38
+ const gsap = gsapOf(el);
30
39
  const x = Number.parseFloat(el.getAttribute("data-hf-drag-gsap-base-x") ?? "");
31
40
  const y = Number.parseFloat(el.getAttribute("data-hf-drag-gsap-base-y") ?? "");
32
41
  if (gsap && Number.isFinite(x) && Number.isFinite(y)) gsap.set(el, { x, y });
33
42
  }
34
43
 
44
+ export function refuseGsapTakeover(
45
+ el: HTMLElement,
46
+ showToast: ElementOffsetStagerDeps["showToast"],
47
+ ) {
48
+ if (!gsapHoldsTranslate(el)) return;
49
+ gsapOf(el)?.set(el, { x: 0, y: 0, xPercent: 0, yPercent: 0 });
50
+ showToast(GSAP_TOOK_OVER, "error");
51
+ throw markStudioSaveErrorAlreadyToasted(new Error(GSAP_TOOK_OVER));
52
+ }
53
+
35
54
  let plainMoveCounter = 0;
36
55
 
37
56
  /** GSAP does not position the element: `next` is its whole translate, live now and saved as drawn. */
@@ -41,34 +60,36 @@ function stagePlainTranslate(
41
60
  next: { x: number; y: number },
42
61
  coalesceKey?: string,
43
62
  ): { save: () => Promise<void>; rollback: () => void } {
44
- const style = selection.element.style;
45
- const before = style.getPropertyValue("translate");
46
- const patch = translatePatch(next);
47
- style.setProperty("translate", patch.value);
63
+ const el = selection.element;
64
+ const before = captureStudioPathOffset(el);
65
+ const patches = writePlainMove(el, next);
66
+ const written = el.style.getPropertyValue("translate");
48
67
  const rollback = () => {
49
- if (style.getPropertyValue("translate") === patch.value) style.setProperty("translate", before);
68
+ if (el.style.getPropertyValue("translate") === written) restoreStudioPathOffset(el, before);
50
69
  };
51
70
  const key = coalesceKey ?? `move:${++plainMoveCounter}`;
52
71
  const options = { label: "Move layer", coalesceKey: key, coalesceMs: Number.POSITIVE_INFINITY };
53
72
  const save = () =>
54
- commitPositionPatchToHtml(selection, [patch], options).catch((error) => {
73
+ commitPositionPatchToHtml(selection, patches, options).catch((error) => {
55
74
  rollback();
56
75
  throw error;
57
76
  });
58
77
  return { save, rollback };
59
78
  }
60
79
 
61
- /** Applies a move on the element itself live now: its translate when GSAP does not position it,
62
- * else left/top for a shared-tween element. Throws, after a toast, when it cannot. */
80
+ /** Applies a move on the element itself live now: its translate on the plain route, else
81
+ * left/top for a shared-tween element. Throws, after a toast, when it cannot. */
63
82
  export function stageElementOffset(
64
83
  { commitPositionPatchToHtml, showToast, readOnlyPreview }: ElementOffsetStagerDeps,
65
84
  selection: DomEditSelection,
66
85
  next: { x: number; y: number },
86
+ plainTranslate: boolean,
67
87
  coalesceKey?: string,
68
88
  ): { save: () => Promise<void>; rollback: () => void } {
69
89
  const el = selection.element;
70
90
  if (readOnlyPreview) return { save: () => Promise.resolve(), rollback: () => undefined };
71
- if (!gsapWritesPosition(el)) {
91
+ if (plainTranslate) {
92
+ refuseGsapTakeover(el, showToast);
72
93
  return stagePlainTranslate(commitPositionPatchToHtml, selection, next, coalesceKey);
73
94
  }
74
95
  const previous = { position: el.style.position, left: el.style.left, top: el.style.top };
@@ -35,7 +35,11 @@ import {
35
35
  pickClosestToPlayhead,
36
36
  readGsapPositionFromIframe,
37
37
  } from "./gsapPositionDetection";
38
- import { hasNonHoldTweenForElement, POSITION_CHANNELS } from "./gsapRuntimeKeyframes";
38
+ import {
39
+ hasNonHoldTweenForElement,
40
+ POSITION_CHANNELS,
41
+ ROTATION_CHANNELS,
42
+ } from "./gsapRuntimeKeyframes";
39
43
  import { getAnimationsForElement } from "./gsapElementMatch";
40
44
  import {
41
45
  animationWritesAnyProperty,
@@ -44,8 +48,6 @@ import {
44
48
  } from "./gsapEditOutcome";
45
49
 
46
50
  const POSITION_CHANNEL_SET = new Set<string>(POSITION_CHANNELS);
47
-
48
- const ROTATION_CHANNELS: string[] = ["rotation", "rotationX", "rotationY", "rotationZ"];
49
51
  const ROTATION_CHANNEL_SET = new Set<string>(ROTATION_CHANNELS);
50
52
 
51
53
  // ── Property-group tween resolution ───────────────────────────────────────
@@ -11,6 +11,7 @@
11
11
  import { buildArcPath, type ArcPathConfig } from "@hyperframes/core/gsap-parser-acorn";
12
12
  import { parsePercentageKeyframes, toAbsoluteTime } from "./gsapShared";
13
13
  import { roundTo3 } from "../utils/rounding";
14
+ import { BOX_SIZE_STYLE_PROPS } from "../components/editor/manualEditsDomPatches";
14
15
 
15
16
  /**
16
17
  * A GSAP tween's `vars` object — intentionally open: it mixes channel values
@@ -439,11 +440,44 @@ function gsapWritesChannels(el: Element, channels: string[]): boolean {
439
440
  );
440
441
  }
441
442
 
443
+ // GSAP's CSSPlugin also takes rotate, rotateX/Y/Z for rotation.
444
+ export const ROTATION_CHANNELS: string[] = [
445
+ ...["rotation", "rotationX", "rotationY", "rotationZ"],
446
+ ...["rotate", "rotateX", "rotateY", "rotateZ"],
447
+ ];
448
+
449
+ const gsapRendersTransform = (el: Element) =>
450
+ !!(el as { _gsap?: { renderTransform?: unknown } })._gsap?.renderTransform;
451
+
442
452
  /** GSAP owns this element's position: a tween or hold writes it, or GSAP already renders its
443
453
  * transform (a CSS translate would then apply twice). Everything else moves by plain CSS. */
444
454
  export function gsapWritesPosition(el: Element): boolean {
445
- const cache = (el as { _gsap?: { renderTransform?: unknown } })._gsap;
446
- return !!cache?.renderTransform || gsapWritesChannels(el, MOVE_CHANNELS);
455
+ return gsapRendersTransform(el) || gsapWritesChannels(el, MOVE_CHANNELS);
456
+ }
457
+
458
+ /** `gsapWritesPosition` for a rotate: everything else turns by its own CSS `rotate`. */
459
+ export function gsapWritesRotation(el: Element): boolean {
460
+ return gsapRendersTransform(el) || gsapWritesChannels(el, ROTATION_CHANNELS);
461
+ }
462
+
463
+ export function gsapHoldsTranslate(el: Element): boolean {
464
+ const cache = (el as { _gsap?: Record<string, unknown> })._gsap;
465
+ return ["x", "y", "xPercent", "yPercent"].some(
466
+ (key) => !!Number.parseFloat(String(cache?.[key])),
467
+ );
468
+ }
469
+
470
+ const BOX_CHANNELS = [
471
+ ...BOX_SIZE_STYLE_PROPS.map((prop) =>
472
+ prop.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase()),
473
+ ),
474
+ "scaleX",
475
+ "scaleY",
476
+ ];
477
+
478
+ /** GSAP owns this element's box: its position, or any property the CSS box writer sets. Else a resize writes CSS. */
479
+ export function gsapWritesBox(el: Element): boolean {
480
+ return gsapWritesPosition(el) || gsapWritesChannels(el, BOX_CHANNELS);
447
481
  }
448
482
 
449
483
  /** `hasNonHoldTweenForElement` for an element in hand, read from its own window's timelines. */