@hyperframes/studio 0.8.114 → 0.8.116

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 (266) hide show
  1. package/dist/assets/{hyperframes-player-aXNJKiIg.js → hyperframes-player-mGYvPVpw.js} +1 -1
  2. package/dist/assets/{index-Bn2RJNTJ.js → index-BWHt0-ir.js} +1 -1
  3. package/dist/assets/{index-Dz7doz9l.js → index-DYNaXPVf.js} +203 -203
  4. package/dist/assets/{index-C9N-DGjC.js → index-Dr3hNpvS.js} +1 -1
  5. package/dist/assets/{index-BYnsJnJV.css → index-t1LH6H5H.css} +1 -1
  6. package/dist/{chunk-BIUXP3PG.js → chunk-3F47EFCT.js} +142 -277
  7. package/dist/chunk-3F47EFCT.js.map +1 -0
  8. package/dist/{chunk-K47E2ZJA.js → chunk-5EKWJZLM.js} +504 -17
  9. package/dist/chunk-5EKWJZLM.js.map +1 -0
  10. package/dist/{chunk-VWT7STY3.js → chunk-J6Q572FA.js} +2 -2
  11. package/dist/{domEditingLayers-V67MS4WP.js → domEditingLayers-OL7GLSS4.js} +3 -5
  12. package/dist/index.d.ts +146 -40
  13. package/dist/index.html +2 -2
  14. package/dist/index.js +4021 -3591
  15. package/dist/index.js.map +1 -1
  16. package/dist/player.js +2 -2
  17. package/dist/styles.css +1 -1
  18. package/package.json +9 -8
  19. package/src/App.tsx +2 -2
  20. package/src/captions/hooks/useCaptionSync.ts +10 -6
  21. package/src/components/LinkedSelectionToggle.tsx +3 -2
  22. package/src/components/ProjectUnreachableBanner.tsx +3 -3
  23. package/src/components/dock/Dock.tsx +5 -7
  24. package/src/components/editor/CanvasContextMenu.tsx +3 -2
  25. package/src/components/editor/DomEditCropHandles.test.tsx +27 -0
  26. package/src/components/editor/DomEditCropHandles.tsx +7 -4
  27. package/src/components/editor/DomEditOverlay.tsx +5 -1
  28. package/src/components/editor/FileTreeNodes.tsx +13 -10
  29. package/src/components/editor/MotionPathOverlay.tsx +7 -2
  30. package/src/components/editor/PropertyPanelEmptyState.tsx +12 -2
  31. package/src/components/editor/SnapToolbar.test.tsx +100 -1
  32. package/src/components/editor/SnapToolbar.tsx +43 -5
  33. package/src/components/editor/anchoredResizeCommitFeedsOffset.test.ts +48 -1
  34. package/src/components/editor/audioFxTelemetry.ts +2 -3
  35. package/src/components/editor/commitPreflightHandles.test.tsx +2 -2
  36. package/src/components/editor/cropResize.ts +4 -3
  37. package/src/components/editor/domEditingDom.ts +4 -0
  38. package/src/components/editor/domEditingLayers.ts +1 -5
  39. package/src/components/editor/domGroupMoveBy.test.tsx +252 -0
  40. package/src/components/editor/domGroupMoveBy.ts +95 -0
  41. package/src/components/editor/dragUndoPaint.test.ts +5 -5
  42. package/src/components/editor/gestureHoldsPreviewReload.test.tsx +33 -0
  43. package/src/components/editor/manualEditingAvailability.ts +8 -0
  44. package/src/components/editor/manualEdits.ts +1 -0
  45. package/src/components/editor/manualEditsParsing.ts +7 -0
  46. package/src/components/editor/manualOffsetDrag.ts +5 -6
  47. package/src/components/editor/marqueeCommit.test.tsx +106 -37
  48. package/src/components/editor/marqueeCommit.ts +24 -8
  49. package/src/components/editor/motionPathCommit.test.ts +29 -1
  50. package/src/components/editor/motionPathCommit.ts +21 -9
  51. package/src/components/editor/motionPathSelection.test.ts +6 -31
  52. package/src/components/editor/probeSourceElement.test.ts +45 -0
  53. package/src/components/editor/probeSourceElement.ts +41 -16
  54. package/src/components/editor/propertyPanelFlatTextSection.tsx +10 -7
  55. package/src/components/editor/propertyPanelFont.tsx +3 -2
  56. package/src/components/editor/propertyPanelFxAddMenu.tsx +11 -2
  57. package/src/components/editor/propertyPanelFxCarveModule.tsx +15 -5
  58. package/src/components/editor/propertyPanelFxNodeOpenBody.tsx +3 -0
  59. package/src/components/editor/propertyPanelFxNodeParams.tsx +15 -2
  60. package/src/components/editor/propertyPanelFxNodeRow.tsx +3 -0
  61. package/src/components/editor/propertyPanelFxPresetRun.tsx +10 -2
  62. package/src/components/editor/propertyPanelFxSection.test.tsx +56 -0
  63. package/src/components/editor/propertyPanelFxSection.tsx +30 -28
  64. package/src/components/editor/propertyPanelTypes.ts +6 -3
  65. package/src/components/editor/useColorGradingController.ts +2 -1
  66. package/src/components/editor/useDomEditNudge.test.tsx +37 -0
  67. package/src/components/editor/useDomEditNudge.ts +2 -0
  68. package/src/components/editor/useDomEditOverlayGestures.ts +5 -0
  69. package/src/components/editor/useDomEditZOrder.ts +12 -2
  70. package/src/components/editor/useFxCarveNodes.ts +2 -1
  71. package/src/components/editor/useFxLevelling.ts +2 -1
  72. package/src/components/feedback/projectProvenance.ts +2 -1
  73. package/src/components/nle/NLEContext.test.ts +1 -0
  74. package/src/components/nle/NLEContext.tsx +2 -1
  75. package/src/components/nle/NLEPreview.tsx +12 -10
  76. package/src/components/nle/PreviewPoster.tsx +2 -1
  77. package/src/components/nle/useTimelineEditCallbacks.test.tsx +1 -0
  78. package/src/components/nle/useTimelineEditCallbacks.ts +7 -1
  79. package/src/components/renders/useFfmpegStatus.ts +2 -1
  80. package/src/components/renders/useRenderQueue.ts +5 -4
  81. package/src/components/sidebar/AssetContextMenu.tsx +4 -4
  82. package/src/components/sidebar/AssetsTab.tsx +2 -1
  83. package/src/components/sidebar/GlobalAssetsView.tsx +2 -1
  84. package/src/components/ui/menuStyle.test.ts +61 -0
  85. package/src/components/ui/menuStyle.ts +10 -0
  86. package/src/contexts/DomEditContext.tsx +5 -1
  87. package/src/contexts/TimelineEditContext.tsx +1 -0
  88. package/src/domEditExports.test.tsx +9 -1
  89. package/src/hooks/domEditCommitRunner.ts +1 -1
  90. package/src/hooks/domSelectionTestHarness.ts +23 -0
  91. package/src/hooks/domStyleCommit.propertyNames.test.ts +73 -0
  92. package/src/hooks/domStyleCommit.ts +8 -1
  93. package/src/hooks/draggedGsapPosition.ts +10 -0
  94. package/src/hooks/elementOffsetStager.ts +5 -4
  95. package/src/hooks/gsapDragCommit.test.ts +75 -164
  96. package/src/hooks/gsapDragCommit.ts +4 -125
  97. package/src/hooks/gsapDragPositionCommit.ts +36 -384
  98. package/src/hooks/gsapEditOutcome.ts +22 -2
  99. package/src/hooks/gsapGestureOutcome.test.ts +161 -0
  100. package/src/hooks/gsapGestureOutcome.ts +64 -0
  101. package/src/hooks/gsapGroupPreflight.ts +34 -0
  102. package/src/hooks/gsapKeyframeCommit.ts +3 -12
  103. package/src/hooks/gsapMutationClient.ts +4 -3
  104. package/src/hooks/gsapParsedTween.test-helpers.ts +75 -0
  105. package/src/hooks/gsapParsedTween.test.ts +62 -0
  106. package/src/hooks/gsapParsedTween.ts +243 -0
  107. package/src/hooks/gsapPositionDetection.test.ts +78 -0
  108. package/src/hooks/gsapPositionDetection.ts +52 -33
  109. package/src/hooks/gsapResizeDropPoint.test.ts +4 -3
  110. package/src/hooks/gsapResizeElementSize.test.tsx +1 -0
  111. package/src/hooks/gsapResizeGeometrySweep.test.ts +13 -25
  112. package/src/hooks/gsapResizeIntercept.test.ts +96 -11
  113. package/src/hooks/gsapResizeIntercept.ts +79 -168
  114. package/src/hooks/gsapResizeSweep.test.ts +16 -33
  115. package/src/hooks/gsapRuntimeBridge.sharedTween.test.ts +6 -8
  116. package/src/hooks/gsapRuntimeBridge.test.ts +41 -6
  117. package/src/hooks/gsapRuntimeBridge.ts +105 -131
  118. package/src/hooks/gsapScriptCommitHelpers.ts +2 -1
  119. package/src/hooks/gsapScriptCommitTypes.ts +13 -0
  120. package/src/hooks/gsapShared.ts +7 -0
  121. package/src/hooks/gsapShared.writeTarget.test.ts +45 -57
  122. package/src/hooks/gsapValueAtPlayhead.browser.test.ts +83 -0
  123. package/src/hooks/gsapValueAtPlayhead.realGsap.test.ts +179 -0
  124. package/src/hooks/gsapValueAtPlayhead.test.ts +552 -0
  125. package/src/hooks/gsapValueAtPlayhead.ts +292 -0
  126. package/src/hooks/gsapWholePropertyOffsetCommit.test.ts +43 -0
  127. package/src/hooks/gsapWholePropertyOffsetCommit.ts +2 -3
  128. package/src/hooks/keyframeCacheAstLoad.ts +8 -6
  129. package/src/hooks/newTweenTarget.test.ts +41 -76
  130. package/src/hooks/plainRotation.ts +3 -2
  131. package/src/hooks/previewPromotionSelection.test.tsx +1 -1
  132. package/src/hooks/refreshTimelineRowText.test.ts +65 -0
  133. package/src/hooks/refreshTimelineRowText.ts +29 -0
  134. package/src/hooks/timelineTimingSync.test.ts +1 -0
  135. package/src/hooks/timelineTimingSync.ts +2 -1
  136. package/src/hooks/useAnimatedPropertyCommit.test.tsx +46 -5
  137. package/src/hooks/useAnimatedPropertyCommit.ts +2 -2
  138. package/src/hooks/useAskAgentModal.ts +2 -1
  139. package/src/hooks/useBlockCatalog.ts +2 -1
  140. package/src/hooks/useBlockedTimelineEditToast.ts +12 -3
  141. package/src/hooks/useCaptionDetection.ts +2 -1
  142. package/src/hooks/useCompositionContentLoader.ts +2 -1
  143. package/src/hooks/useDomEditCommitsHelpers.ts +3 -2
  144. package/src/hooks/useDomEditPositionPatchCommit.ts +18 -23
  145. package/src/hooks/useDomEditSession.test.tsx +30 -1
  146. package/src/hooks/useDomEditSession.ts +10 -0
  147. package/src/hooks/useDomEditTextCommits.test.tsx +41 -0
  148. package/src/hooks/useDomEditTextCommits.ts +13 -3
  149. package/src/hooks/useDomEditWiring.ts +4 -2
  150. package/src/hooks/useDomGeometryCommit.test.tsx +25 -6
  151. package/src/hooks/useDomGeometryCommit.ts +8 -4
  152. package/src/hooks/useDomGeometryCommits.test.tsx +1 -0
  153. package/src/hooks/useDomGeometryCommits.ts +3 -2
  154. package/src/hooks/useDomSelection.test.ts +26 -0
  155. package/src/hooks/useDomSelection.ts +10 -3
  156. package/src/hooks/useDomSelectionTypes.ts +6 -1
  157. package/src/hooks/useEditHistoryActions.paint.test.tsx +82 -20
  158. package/src/hooks/useEditHistoryActions.test.tsx +15 -0
  159. package/src/hooks/useEditHistoryActions.ts +16 -5
  160. package/src/hooks/useElementLifecycleOps.ts +2 -1
  161. package/src/hooks/useEnableKeyframes.test.ts +34 -3
  162. package/src/hooks/useEnableKeyframes.ts +7 -4
  163. package/src/hooks/useExternalFileChangeCoordinator.test.tsx +121 -0
  164. package/src/hooks/useExternalFileChangeCoordinator.ts +35 -8
  165. package/src/hooks/useFileManager.projectOwnership.test.tsx +6 -1
  166. package/src/hooks/useFileManager.ts +14 -10
  167. package/src/hooks/useFileTree.ts +3 -2
  168. package/src/hooks/useFrameCapture.ts +5 -1
  169. package/src/hooks/useFreezeFrame.ts +3 -2
  170. package/src/hooks/useGestureCommit.test.tsx +225 -55
  171. package/src/hooks/useGestureCommit.ts +86 -55
  172. package/src/hooks/useGroupCommits.ts +2 -1
  173. package/src/hooks/useGsapAwareEditing.groupPlan.test.tsx +160 -0
  174. package/src/hooks/useGsapAwareEditing.test.tsx +28 -35
  175. package/src/hooks/useGsapAwareEditing.testHelpers.tsx +42 -0
  176. package/src/hooks/useGsapAwareEditing.ts +101 -195
  177. package/src/hooks/useGsapAwareGroupMove.ts +179 -0
  178. package/src/hooks/useGsapInteractionFailureTelemetry.ts +10 -4
  179. package/src/hooks/useGsapKeyframeOps.sdkUsage.test.tsx +114 -0
  180. package/src/hooks/useGsapKeyframeOps.ts +36 -10
  181. package/src/hooks/useGsapScriptCommits.test.tsx +60 -1
  182. package/src/hooks/useGsapScriptCommits.ts +15 -10
  183. package/src/hooks/useGsapSelectionHandlers.test.tsx +1 -1
  184. package/src/hooks/useGsapSelectionHandlers.ts +24 -18
  185. package/src/hooks/useGsapTweenCache.ts +18 -12
  186. package/src/hooks/useLintModal.ts +2 -1
  187. package/src/hooks/usePersistentEditHistory.test.ts +277 -1
  188. package/src/hooks/usePersistentEditHistory.ts +47 -8
  189. package/src/hooks/usePopulateKeyframeCacheForFile.test.tsx +76 -2
  190. package/src/hooks/usePreviewInteraction.test.ts +21 -0
  191. package/src/hooks/usePreviewInteraction.ts +2 -0
  192. package/src/hooks/usePreviewPersistence.history.test.tsx +14 -3
  193. package/src/hooks/usePreviewPersistence.ts +13 -11
  194. package/src/hooks/useProjectFileWriter.ts +20 -19
  195. package/src/hooks/useRemoveBackground.ts +2 -1
  196. package/src/hooks/useRenderClipContent.test.ts +18 -0
  197. package/src/hooks/useRenderClipContent.ts +4 -5
  198. package/src/hooks/useSdkSession.ts +2 -1
  199. package/src/hooks/useServerConnection.ts +4 -3
  200. package/src/hooks/useStudioSelectionPublisher.ts +2 -1
  201. package/src/hooks/useThumbnailStill.test.ts +100 -0
  202. package/src/hooks/useThumbnailStill.ts +37 -0
  203. package/src/hooks/useTimelineDeleteOps.test.tsx +30 -22
  204. package/src/hooks/useTimelineDeleteOps.ts +22 -27
  205. package/src/hooks/useTimelineEditing.test.tsx +1 -1
  206. package/src/index.ts +4 -0
  207. package/src/player/components/AudioWaveform.tsx +3 -2
  208. package/src/player/components/AutomationSelectionMenu.tsx +3 -2
  209. package/src/player/components/ClipContextMenu.test.tsx +73 -0
  210. package/src/player/components/ClipContextMenu.tsx +33 -31
  211. package/src/player/components/CompositionThumbnail.tsx +2 -1
  212. package/src/player/components/KeyframeDiamondContextMenu.tsx +8 -9
  213. package/src/player/components/OutOfSyncBadge.tsx +5 -5
  214. package/src/player/components/TextClipContent.test.ts +19 -0
  215. package/src/player/components/TextClipContent.tsx +27 -0
  216. package/src/player/components/TrackGapContextMenu.tsx +3 -6
  217. package/src/player/components/clipMenuNormalize.ts +2 -1
  218. package/src/player/components/clipMenuToolItems.test.tsx +23 -0
  219. package/src/player/components/clipMenuToolItems.tsx +13 -9
  220. package/src/player/components/clipPeakMap.ts +2 -1
  221. package/src/player/components/timelineCallbacks.ts +1 -0
  222. package/src/player/components/timelineClipDragGestureLifecycle.ts +1 -1
  223. package/src/player/components/timelineClipGestureHandlers.test.ts +94 -0
  224. package/src/player/components/timelineClipGestureHandlers.ts +20 -2
  225. package/src/player/components/timelineEditing.ts +3 -1
  226. package/src/player/components/timelineLinkSelection.ts +35 -1
  227. package/src/player/components/useTimelineClipDrag.keyboard.test.tsx +14 -0
  228. package/src/player/components/useTimelineClipDrag.ts +6 -7
  229. package/src/player/hooks/timelinePlayerSync.test.ts +6 -0
  230. package/src/player/hooks/timelinePlayerSync.ts +6 -1
  231. package/src/player/hooks/useTimelinePlayer.ts +5 -1
  232. package/src/player/lib/thumbnailScheduler.test.ts +16 -0
  233. package/src/player/lib/thumbnailScheduler.ts +10 -2
  234. package/src/player/lib/timelineElementHelpers.test.ts +87 -1
  235. package/src/player/lib/timelineElementHelpers.ts +6 -15
  236. package/src/player/lib/timelineText.ts +40 -0
  237. package/src/player/sceneSwap.ts +2 -1
  238. package/src/player/store/timelineElement.ts +12 -0
  239. package/src/styles/theme.css +3 -0
  240. package/src/telemetry/client.ts +2 -1
  241. package/src/utils/blockInstaller.ts +2 -1
  242. package/src/utils/elementGsap.test.ts +9 -0
  243. package/src/utils/elementGsap.ts +7 -0
  244. package/src/utils/gsapSoftReload.ts +2 -3
  245. package/src/utils/gsapUndoRestore.browser.test.ts +51 -45
  246. package/src/utils/gsapUndoRestore.ts +3 -6
  247. package/src/utils/keyframeUsage.ts +79 -0
  248. package/src/utils/previewFeatureUsage.test.ts +32 -0
  249. package/src/utils/previewFeatureUsage.ts +46 -0
  250. package/src/utils/previewPrefetch.ts +2 -1
  251. package/src/utils/razorSplitTransaction.ts +12 -8
  252. package/src/utils/softReloadTargets.ts +1 -3
  253. package/src/utils/studioApiFetch.test.ts +75 -0
  254. package/src/utils/studioApiFetch.ts +13 -0
  255. package/src/utils/studioFileHistory.ts +4 -1
  256. package/src/utils/studioHelpers.ts +7 -1
  257. package/src/utils/studioPendingEdits.test.ts +23 -6
  258. package/src/utils/studioPendingEdits.ts +32 -8
  259. package/src/utils/studioTelemetry.test.ts +107 -0
  260. package/src/utils/studioTelemetry.ts +51 -5
  261. package/src/utils/timelineCompositionInsert.ts +3 -2
  262. package/src/webmcp/StudioAgentTools.tsx +4 -3
  263. package/dist/chunk-BIUXP3PG.js.map +0 -1
  264. package/dist/chunk-K47E2ZJA.js.map +0 -1
  265. /package/dist/{chunk-VWT7STY3.js.map → chunk-J6Q572FA.js.map} +0 -0
  266. /package/dist/{domEditingLayers-V67MS4WP.js.map → domEditingLayers-OL7GLSS4.js.map} +0 -0
@@ -1,33 +1,155 @@
1
1
  import {
2
+ buildElementLabel,
2
3
  buildProjectApiPath,
3
- getSourceScopedSelectorIndex,
4
+ buildStableSelector,
5
+ escapeCssString,
6
+ findClosestByAttribute,
7
+ getCompositionSourceMapRevision,
8
+ getCuratedComputedStyles,
9
+ getDataAttributes,
10
+ getInlineStyles,
11
+ getSelectorIndex,
12
+ getSourceFileForElement,
4
13
  isAudibleVideoNode,
14
+ isEditableTextLeaf,
15
+ isElementVisibleThroughAncestors,
16
+ isHtmlElement,
17
+ normalizeTimelineCompositionSource,
18
+ parsePx,
19
+ querySelectorAllSafely,
5
20
  withSelectorIndexPass
6
- } from "./chunk-K47E2ZJA.js";
21
+ } from "./chunk-5EKWJZLM.js";
22
+ import {
23
+ __export
24
+ } from "./chunk-PZ5AY32C.js";
25
+
26
+ // src/components/editor/manualEditingAvailability.ts
27
+ var manualEditingAvailability_exports = {};
28
+ __export(manualEditingAvailability_exports, {
29
+ STUDIO_API_SAME_ORIGIN_CREDENTIALS: () => STUDIO_API_SAME_ORIGIN_CREDENTIALS,
30
+ STUDIO_FLAT_INSPECTOR_ENABLED: () => STUDIO_FLAT_INSPECTOR_ENABLED,
31
+ STUDIO_SDK_CUTOVER_ENABLED: () => STUDIO_SDK_CUTOVER_ENABLED,
32
+ STUDIO_SDK_CUTOVER_FAMILIES: () => STUDIO_SDK_CUTOVER_FAMILIES,
33
+ STUDIO_SDK_RESOLVER_SHADOW_ENABLED: () => STUDIO_SDK_RESOLVER_SHADOW_ENABLED,
34
+ resolveStudioBooleanEnvFlag: () => resolveStudioBooleanEnvFlag
35
+ });
36
+
37
+ // src/utils/sdkCutoverPolicy.ts
38
+ var STUDIO_SDK_OPERATION_FAMILIES = [
39
+ "dom",
40
+ "timing",
41
+ "gsap-animation",
42
+ "gsap-keyframe",
43
+ "lifecycle"
44
+ ];
45
+ function resolveEnabledSdkFamilies(env2, masterEnabled) {
46
+ if (!masterEnabled) return /* @__PURE__ */ new Set();
47
+ const raw = env2["VITE_STUDIO_SDK_CUTOVER_FAMILIES"];
48
+ if (typeof raw !== "string" || raw.trim() === "") return new Set(STUDIO_SDK_OPERATION_FAMILIES);
49
+ const requested = raw.split(",").map((family) => family.trim()).filter(Boolean);
50
+ const known = new Set(STUDIO_SDK_OPERATION_FAMILIES);
51
+ const unknown = requested.filter((family) => !known.has(family));
52
+ if (unknown.length > 0) {
53
+ throw new Error(`Unknown Studio SDK cutover families: ${unknown.join(", ")}`);
54
+ }
55
+ return new Set(requested);
56
+ }
57
+ function isSdkFamilyEnabled(masterEnabled, configured, family) {
58
+ return masterEnabled && (configured?.has(family) ?? true);
59
+ }
60
+
61
+ // src/components/editor/manualEditingAvailability.ts
62
+ var TRUTHY_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on", "enabled"]);
63
+ var FALSY_ENV_VALUES = /* @__PURE__ */ new Set(["0", "false", "no", "off", "disabled"]);
64
+ function resolveStudioBooleanEnvFlag(env2, names, fallback) {
65
+ for (const name of names) {
66
+ const value = env2[name];
67
+ if (typeof value === "boolean") return value;
68
+ if (typeof value !== "string") continue;
69
+ const normalized = value.trim().toLowerCase();
70
+ if (!normalized) continue;
71
+ if (TRUTHY_ENV_VALUES.has(normalized)) return true;
72
+ if (FALSY_ENV_VALUES.has(normalized)) return false;
73
+ }
74
+ return fallback;
75
+ }
76
+ var runtimeEnv = typeof window !== "undefined" ? window.__HF_STUDIO_ENV__ ?? {} : {};
77
+ var env = { ...import.meta.env ?? {}, ...runtimeEnv };
78
+ var STUDIO_SDK_CUTOVER_ENABLED = resolveStudioBooleanEnvFlag(
79
+ env,
80
+ ["VITE_STUDIO_SDK_CUTOVER_ENABLED"],
81
+ true
82
+ );
83
+ var STUDIO_SDK_CUTOVER_FAMILIES = resolveEnabledSdkFamilies(
84
+ env,
85
+ STUDIO_SDK_CUTOVER_ENABLED
86
+ );
87
+ var STUDIO_SDK_RESOLVER_SHADOW_ENABLED = resolveStudioBooleanEnvFlag(
88
+ env,
89
+ ["VITE_STUDIO_SDK_RESOLVER_SHADOW_ENABLED"],
90
+ true
91
+ );
92
+ var STUDIO_FLAT_INSPECTOR_ENABLED = resolveStudioBooleanEnvFlag(
93
+ env,
94
+ ["VITE_STUDIO_ENABLE_FLAT_INSPECTOR", "VITE_STUDIO_FLAT_INSPECTOR_ENABLED"],
95
+ true
96
+ );
97
+ var STUDIO_API_SAME_ORIGIN_CREDENTIALS = resolveStudioBooleanEnvFlag(
98
+ env,
99
+ ["VITE_STUDIO_API_SAME_ORIGIN_CREDENTIALS"],
100
+ false
101
+ );
102
+
103
+ // src/utils/studioApiFetch.ts
104
+ var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
105
+ function studioApiCredentials() {
106
+ if (STUDIO_API_SAME_ORIGIN_CREDENTIALS) return "same-origin";
107
+ const host = globalThis.location?.hostname;
108
+ return !host || LOOPBACK_HOSTS.has(host) ? "omit" : "same-origin";
109
+ }
110
+ function studioApiFetch(input, init) {
111
+ return globalThis.fetch(input, { ...init, credentials: studioApiCredentials() });
112
+ }
7
113
 
8
114
  // src/components/editor/probeSourceElement.ts
9
- async function probeSourceElement(projectId, sourceFile, target) {
115
+ var pending = /* @__PURE__ */ new Map();
116
+ async function sendBatch(projectId, sourceFile, probes) {
117
+ let exists = [];
10
118
  try {
11
- const response = await fetch(
119
+ const response = await studioApiFetch(
12
120
  buildProjectApiPath(
13
121
  projectId,
14
- `/file-mutations/probe-element/${encodeURIComponent(sourceFile)}`
122
+ `/file-mutations/probe-elements/${encodeURIComponent(sourceFile)}`
15
123
  ),
16
124
  {
17
125
  method: "POST",
18
126
  headers: { "Content-Type": "application/json" },
19
- body: JSON.stringify({ target })
127
+ body: JSON.stringify({ targets: probes.map((probe) => probe.target) })
20
128
  }
21
129
  );
22
- if (!response.ok) return true;
23
- const data = await response.json();
24
- if (data && typeof data === "object" && "exists" in data && data.exists === false) {
25
- return false;
130
+ if (response.ok) {
131
+ const data = await response.json();
132
+ if (Array.isArray(data?.exists)) exists = data.exists;
26
133
  }
27
- return true;
28
134
  } catch {
29
- return true;
30
135
  }
136
+ probes.forEach((probe, index) => probe.resolve(exists[index] !== false));
137
+ }
138
+ function probeSourceElement(projectId, sourceFile, target) {
139
+ return new Promise((resolve) => {
140
+ const key = `${projectId}\0${sourceFile}`;
141
+ let probes = pending.get(key);
142
+ if (!probes) {
143
+ const batch = [];
144
+ probes = batch;
145
+ pending.set(key, batch);
146
+ setTimeout(() => {
147
+ pending.delete(key);
148
+ void sendBatch(projectId, sourceFile, batch);
149
+ }, 0);
150
+ }
151
+ probes.push({ target, resolve });
152
+ });
31
153
  }
32
154
 
33
155
  // src/components/editor/domEditingLayers.ts
@@ -36,258 +158,6 @@ import {
36
158
  resolveEditingSections
37
159
  } from "@hyperframes/core/editing";
38
160
 
39
- // src/components/editor/domEditingDom.ts
40
- import { COLOR_GRADING_SOURCE_HIDDEN_ATTR } from "@hyperframes/core/color-grading";
41
-
42
- // src/components/editor/domEditingTypes.ts
43
- var CURATED_STYLE_PROPERTIES = [
44
- "position",
45
- "display",
46
- "top",
47
- "left",
48
- "right",
49
- "bottom",
50
- "inset",
51
- "width",
52
- "height",
53
- "gap",
54
- "justify-content",
55
- "align-items",
56
- "flex-direction",
57
- "font-size",
58
- "font-style",
59
- "font-weight",
60
- "font-family",
61
- "line-height",
62
- "letter-spacing",
63
- "text-align",
64
- "text-transform",
65
- "color",
66
- "background-color",
67
- "background-image",
68
- "opacity",
69
- "mix-blend-mode",
70
- "border-radius",
71
- "border-width",
72
- "border-style",
73
- "border-color",
74
- "border-top-width",
75
- "border-top-style",
76
- "border-top-color",
77
- "outline-color",
78
- "overflow",
79
- "clip-path",
80
- "box-shadow",
81
- "filter",
82
- "backdrop-filter",
83
- "z-index",
84
- "transform",
85
- "object-fit",
86
- "object-position"
87
- ];
88
-
89
- // src/components/editor/domEditingDom.ts
90
- import { parsePx } from "@hyperframes/core/editing";
91
- function isHtmlElement(value) {
92
- return typeof value === "object" && value !== null && "nodeType" in value && typeof value.nodeType === "number" && value.nodeType === 1;
93
- }
94
- function isTextBearingTag(tagName) {
95
- return ["div", "span", "p", "strong", "h1", "h2", "h3", "h4", "h5", "h6"].includes(tagName);
96
- }
97
- function elementRendersItself(win, el) {
98
- const computed = win.getComputedStyle(el);
99
- if (computed.display === "none" || computed.visibility === "hidden") return false;
100
- const opacity = Number.parseFloat(computed.opacity);
101
- return !(Number.isFinite(opacity) && opacity <= 0.01 && !el.hasAttribute(COLOR_GRADING_SOURCE_HIDDEN_ATTR));
102
- }
103
- function isElementVisibleThroughAncestors(el, memo) {
104
- const win = el.ownerDocument.defaultView;
105
- if (!win) return true;
106
- const pending = [];
107
- let inherited = true;
108
- for (let node = el; node; node = node.parentElement) {
109
- const answered = memo?.get(node);
110
- if (answered !== void 0) {
111
- inherited = answered;
112
- break;
113
- }
114
- pending.push(node);
115
- }
116
- for (let i = pending.length - 1; i >= 0; i -= 1) {
117
- const node = pending[i];
118
- inherited = inherited && elementRendersItself(win, node);
119
- memo?.set(node, inherited);
120
- }
121
- return inherited;
122
- }
123
- function getCuratedComputedStyles(el) {
124
- const styles = {};
125
- const computed = el.ownerDocument.defaultView?.getComputedStyle(el);
126
- if (!computed) return styles;
127
- for (const prop of CURATED_STYLE_PROPERTIES) {
128
- const value = computed.getPropertyValue(prop);
129
- if (value) styles[prop] = value;
130
- }
131
- return styles;
132
- }
133
- function getInlineStyles(el) {
134
- const styles = {};
135
- for (const property of CURATED_STYLE_PROPERTIES) {
136
- const value = el.style.getPropertyValue(property);
137
- if (value) styles[property] = value;
138
- }
139
- return styles;
140
- }
141
- function getDataAttributes(el) {
142
- const attrs = {};
143
- for (const attr of el.attributes) {
144
- if (attr.name.startsWith("data-")) {
145
- attrs[attr.name.slice(5)] = attr.value;
146
- }
147
- }
148
- return attrs;
149
- }
150
- function findClosestByAttribute(el, attributeNames) {
151
- let current = el;
152
- while (current) {
153
- const candidate = current;
154
- if (attributeNames.some((attribute) => candidate.hasAttribute(attribute))) {
155
- return candidate;
156
- }
157
- current = current.parentElement;
158
- }
159
- return null;
160
- }
161
- var compositionSourceMap = /* @__PURE__ */ new Map();
162
- var compositionSourceMapRevision = 0;
163
- function setCompositionSourceMap(map) {
164
- compositionSourceMap = map;
165
- compositionSourceMapRevision += 1;
166
- }
167
- function getCompositionSourceMapRevision() {
168
- return compositionSourceMapRevision;
169
- }
170
- function sourceFromCompositionId(ownerRoot) {
171
- if (!ownerRoot || compositionSourceMap.size === 0) return void 0;
172
- const authored = ownerRoot.getAttribute("data-hf-original-composition-id");
173
- const current = ownerRoot.getAttribute("data-composition-id");
174
- return (authored ? compositionSourceMap.get(authored) : void 0) ?? (current ? compositionSourceMap.get(current) : void 0);
175
- }
176
- function getSourceFileForElement(el, activeCompositionPath) {
177
- const sourceHost = findClosestByAttribute(el, ["data-composition-file", "data-composition-src"]);
178
- const ownerRoot = findClosestByAttribute(el, ["data-composition-id"]);
179
- const sourceFile = sourceHost?.getAttribute("data-composition-file") ?? sourceHost?.getAttribute("data-composition-src") ?? ownerRoot?.getAttribute("data-composition-file") ?? ownerRoot?.getAttribute("data-composition-src") ?? sourceFromCompositionId(ownerRoot) ?? activeCompositionPath ?? "index.html";
180
- return {
181
- sourceFile,
182
- compositionPath: sourceFile
183
- };
184
- }
185
- function normalizeTimelineCompositionSource(value) {
186
- const trimmed = value?.trim();
187
- if (!trimmed) return void 0;
188
- if (!/^([a-z][a-z0-9+.-]*:|\/)/i.test(trimmed)) return trimmed;
189
- let pathname = trimmed;
190
- try {
191
- pathname = new URL(trimmed, "http://studio.local").pathname;
192
- } catch {
193
- pathname = trimmed;
194
- }
195
- for (const marker of ["/preview/comp/", "/preview/"]) {
196
- const markerIndex = pathname.indexOf(marker);
197
- if (markerIndex < 0) continue;
198
- const sourcePath = pathname.slice(markerIndex + marker.length).replace(/^\/+/, "");
199
- return sourcePath || trimmed;
200
- }
201
- return trimmed;
202
- }
203
- function escapeCssIdentifier(value) {
204
- const css = globalThis.CSS;
205
- if (typeof css?.escape === "function") return css.escape(value);
206
- if (value === "-") return "\\-";
207
- let escaped = "";
208
- for (let index = 0; index < value.length; index += 1) {
209
- const char = value[index] ?? "";
210
- const code = char.charCodeAt(0);
211
- if (code === 0) {
212
- escaped += "\uFFFD";
213
- continue;
214
- }
215
- const isDigit = code >= 48 && code <= 57;
216
- const isUpperAlpha = code >= 65 && code <= 90;
217
- const isLowerAlpha = code >= 97 && code <= 122;
218
- const isControl = code >= 1 && code <= 31 || code === 127;
219
- const isLeadingDigit = index === 0 && isDigit;
220
- const isSecondDigitAfterDash = index === 1 && value.startsWith("-") && isDigit;
221
- if (isControl || isLeadingDigit || isSecondDigitAfterDash) {
222
- escaped += `\\${code.toString(16)} `;
223
- continue;
224
- }
225
- if (isUpperAlpha || isLowerAlpha || isDigit || char === "-" || char === "_" || code >= 128) {
226
- escaped += char;
227
- continue;
228
- }
229
- escaped += `\\${char}`;
230
- }
231
- return escaped;
232
- }
233
- function escapeCssString(value) {
234
- return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\a ").replace(/\r/g, "\\d ").replace(/\f/g, "\\c ");
235
- }
236
- function querySelectorAllSafely(doc, selector) {
237
- try {
238
- return Array.from(doc.querySelectorAll(selector));
239
- } catch {
240
- return [];
241
- }
242
- }
243
- function humanizeIdentifier(value) {
244
- return value.replace(/\.html$/i, "").replace(/^compositions\//i, "").split("/").at(-1)?.replace(/[-_]+/g, " ").replace(/\b\w/g, (char) => char.toUpperCase()) ?? value;
245
- }
246
- function buildStableSelector(el) {
247
- if (el.id) return `#${escapeCssIdentifier(el.id)}`;
248
- const compositionId = el.getAttribute("data-composition-id");
249
- if (compositionId) return `[data-composition-id="${escapeCssString(compositionId)}"]`;
250
- const group = el.getAttribute("data-hf-group");
251
- if (group) return `[data-hf-group="${escapeCssString(group)}"]`;
252
- return getPreferredClassSelector(el);
253
- }
254
- function getPreferredClassSelector(el) {
255
- const classes = Array.from(el.classList).map((value) => value.trim()).filter(Boolean);
256
- if (classes.length === 0) return void 0;
257
- const preferred = classes.find((value) => value !== "clip" && !value.startsWith("__hf-")) ?? classes[0];
258
- return preferred ? `.${escapeCssIdentifier(preferred)}` : void 0;
259
- }
260
- function buildElementLabel(el) {
261
- const compositionId = el.getAttribute("data-hf-original-composition-id") ?? el.getAttribute("data-composition-id");
262
- if (compositionId && compositionId !== "main") {
263
- return humanizeIdentifier(compositionId);
264
- }
265
- const compositionSrc = el.getAttribute("data-composition-src") ?? el.getAttribute("data-composition-file");
266
- if (compositionSrc) {
267
- return humanizeIdentifier(compositionSrc);
268
- }
269
- const group = el.getAttribute("data-hf-group");
270
- if (group) return group;
271
- if (el.id) return humanizeIdentifier(el.id);
272
- const preferredClass = getPreferredClassSelector(el);
273
- if (preferredClass) {
274
- return humanizeIdentifier(preferredClass.replace(/^\./, ""));
275
- }
276
- const text = (el.textContent ?? "").trim().replace(/\s+/g, " ");
277
- if (text) return text.length > 40 ? `${text.slice(0, 39)}\u2026` : text;
278
- return el.tagName.toLowerCase();
279
- }
280
- function getSelectorIndex(doc, el, selector, sourceFile, activeCompositionPath) {
281
- if (!selector?.startsWith(".")) return void 0;
282
- return getSourceScopedSelectorIndex(
283
- doc,
284
- el,
285
- selector,
286
- sourceFile,
287
- (candidate) => isHtmlElement(candidate) ? getSourceFileForElement(candidate, activeCompositionPath).sourceFile : void 0
288
- );
289
- }
290
-
291
161
  // src/components/editor/domEditingGroups.ts
292
162
  function groupScopedLayerRoots(root, activeGroupElement) {
293
163
  const els = activeGroupElement?.isConnected ? Array.from(activeGroupElement.children) : [root];
@@ -660,9 +530,6 @@ function drainPendingLayerMutations(observer, cache) {
660
530
  }
661
531
 
662
532
  // src/components/editor/domEditingLayers.ts
663
- function isEditableTextLeaf(el) {
664
- return isTextBearingTag(el.tagName.toLowerCase()) && el.children.length === 0;
665
- }
666
533
  function sameTagChildIndex(el) {
667
534
  let index = 0;
668
535
  let sibling = el.previousElementSibling;
@@ -1024,14 +891,13 @@ function buildDomEditPatchTarget(selection) {
1024
891
  }
1025
892
 
1026
893
  export {
1027
- isHtmlElement,
1028
- isElementVisibleThroughAncestors,
1029
- setCompositionSourceMap,
1030
- getSourceFileForElement,
1031
- normalizeTimelineCompositionSource,
1032
- escapeCssString,
1033
- buildStableSelector,
1034
- getSelectorIndex,
894
+ isSdkFamilyEnabled,
895
+ STUDIO_SDK_CUTOVER_ENABLED,
896
+ STUDIO_SDK_CUTOVER_FAMILIES,
897
+ STUDIO_SDK_RESOLVER_SHADOW_ENABLED,
898
+ STUDIO_FLAT_INSPECTOR_ENABLED,
899
+ manualEditingAvailability_exports,
900
+ studioApiFetch,
1035
901
  isElementComputedVisible,
1036
902
  getDomLayerPatchTarget,
1037
903
  resolveAllVisualDomEditTargets,
@@ -1041,7 +907,6 @@ export {
1041
907
  DOM_EDIT_LAYER_OBSERVER_INIT,
1042
908
  createDomEditLayerWalkCache,
1043
909
  drainPendingLayerMutations,
1044
- isEditableTextLeaf,
1045
910
  collectDomEditTextFields,
1046
911
  serializeDomEditTextFields,
1047
912
  buildDefaultDomEditTextField,
@@ -1063,4 +928,4 @@ export {
1063
928
  readHfId,
1064
929
  buildDomEditPatchTarget
1065
930
  };
1066
- //# sourceMappingURL=chunk-BIUXP3PG.js.map
931
+ //# sourceMappingURL=chunk-3F47EFCT.js.map