@hyperframes/studio 0.8.204 → 0.8.206

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 (38) hide show
  1. package/dist/assets/hyperframes-player-lCVwx9d3.js +478 -0
  2. package/dist/assets/{index-DpxSurnJ.js → index-BNuxGFZK.js} +1 -1
  3. package/dist/assets/{index-DmST2bTJ.js → index-CwreIGoq.js} +132 -132
  4. package/dist/{chunk-Z5NKM57J.js → chunk-3EAFE522.js} +8 -4
  5. package/dist/{chunk-2YCKGJFD.js → chunk-DAZTBGYM.js} +1 -1
  6. package/dist/{chunk-T43DM7Q6.js → chunk-OGIOFEC7.js} +4 -2
  7. package/dist/{domEditingLayers-WMDSHU5P.js → domEditingLayers-7Z6J4UOK.js} +2 -2
  8. package/dist/index.d.ts +4 -3
  9. package/dist/index.html +1 -1
  10. package/dist/index.js +699 -554
  11. package/dist/player.js +2 -2
  12. package/package.json +8 -8
  13. package/src/components/DesktopGuideCard.tsx +1 -1
  14. package/src/components/MediaPreview.test.tsx +69 -0
  15. package/src/components/MediaPreview.tsx +10 -5
  16. package/src/components/OpenInDesktopButton.dom.test.tsx +27 -5
  17. package/src/components/editor/domEditLayerWalkCache.test.ts +48 -0
  18. package/src/components/editor/domEditLayerWalkCache.ts +6 -0
  19. package/src/components/editor/domEditingLayers.ts +3 -2
  20. package/src/components/renders/GifLoopInput.tsx +40 -0
  21. package/src/components/renders/GpuEncodingToggle.tsx +1 -1
  22. package/src/components/renders/RenderDurationNote.tsx +19 -0
  23. package/src/components/renders/RenderPreview.tsx +41 -0
  24. package/src/components/renders/RenderQueue.test.tsx +77 -0
  25. package/src/components/renders/RenderQueue.tsx +46 -41
  26. package/src/components/renders/RenderQueueInfo.tsx +61 -0
  27. package/src/components/renders/RenderQueueItem.test.tsx +46 -0
  28. package/src/components/renders/RenderQueueItem.tsx +10 -80
  29. package/src/components/renders/RenderQueuePanel.tsx +2 -1
  30. package/src/components/renders/renderSettings.ts +61 -2
  31. package/src/components/renders/useRenderQueue.ts +10 -2
  32. package/src/components/renders/useRenderQueueComposition.test.tsx +13 -0
  33. package/src/components/sidebar/PromptPreviewModal.test.tsx +22 -0
  34. package/src/components/sidebar/PromptPreviewModal.tsx +1 -0
  35. package/src/player/hooks/previewMessageRouter.test.ts +34 -0
  36. package/src/player/hooks/previewMessageRouter.ts +14 -3
  37. package/src/utils/sourceScopedSelectorIndex.ts +5 -2
  38. package/dist/assets/hyperframes-player-CttA4PW7.js +0 -478
@@ -69,15 +69,24 @@ function acceptedPreviewMessage(
69
69
  return acceptStudioRuntimeMessage(data) ? data : null;
70
70
  }
71
71
 
72
+ /** Whether enrichment is due: no timeline message and no enrichment of ours for 500 ms. Marks it run. */
73
+ function enrichDue(lastTimelineMessage: number, enriched: { at: number }): boolean {
74
+ const now = Date.now();
75
+ if (now - lastTimelineMessage <= 500 || now - enriched.at <= 500) return false;
76
+ enriched.at = now;
77
+ return true;
78
+ }
79
+
72
80
  /**
73
81
  * A `state` tick doubles as a recovery hook: if the store still has no
74
82
  * elements, read the manifest straight off the iframe, and if no `timeline`
75
- * message has arrived recently, re-run enrichment.
83
+ * message has arrived recently, re-run enrichment (at most every 500 ms: it queries the whole document).
76
84
  */
77
85
  function handleStateMessage(
78
86
  deps: PreviewMessageRouterDeps,
79
87
  iframe: HTMLIFrameElement | null,
80
88
  playingHoldsClipListPosts: boolean,
89
+ enriched: { at: number },
81
90
  ): void {
82
91
  try {
83
92
  if (usePlayerStore.getState().elements.length === 0) {
@@ -86,7 +95,7 @@ function handleStateMessage(
86
95
  deps.processTimelineMessageRef.current(manifest);
87
96
  }
88
97
  }
89
- if (!playingHoldsClipListPosts && Date.now() - deps.lastTimelineMessageRef.current > 500) {
98
+ if (!playingHoldsClipListPosts && enrichDue(deps.lastTimelineMessageRef.current, enriched)) {
90
99
  deps.enrichMissingCompositionsRef.current();
91
100
  }
92
101
  } catch {}
@@ -135,11 +144,13 @@ function applyStoreReport(data: PreviewMessage): boolean {
135
144
  export function createPreviewMessageHandler(
136
145
  deps: PreviewMessageRouterDeps,
137
146
  ): (e: MessageEvent) => void {
147
+ const enriched = { at: 0 };
138
148
  return (e: MessageEvent) => {
139
149
  const iframe = deps.iframeRef.current;
140
150
  const data = acceptedPreviewMessage(e, iframe);
141
151
  if (!data) return;
142
- if (data.type === "state") return handleStateMessage(deps, iframe, data.isPlaying === true);
152
+ if (data.type === "state")
153
+ return handleStateMessage(deps, iframe, data.isPlaying === true, enriched);
143
154
  if (applyStoreReport(data)) return;
144
155
  if (data.type === "ready") {
145
156
  const level = usePlayerStore.getState().previewQuality;
@@ -9,6 +9,7 @@
9
9
  /** Every element matching one selector, mapped to the source file it belongs to
10
10
  * and its occurrence index within that file. One document query fills it. */
11
11
  type SelectorOccurrences = Map<Element, { scope: string; index: number }>;
12
+ export type KeptIndexes = Map<Document, Map<string, SelectorOccurrences>>;
12
13
 
13
14
  interface SelectorIndexPass {
14
15
  doc: Document;
@@ -33,9 +34,11 @@ let activePass: SelectorIndexPass | null = null;
33
34
  * (the resolver may be a fresh closure per call, as long as it answers the
34
35
  * same). Outside a pass the index is per-call, exactly as before.
35
36
  */
36
- export function withSelectorIndexPass<T>(doc: Document, run: () => T): T {
37
+ export function withSelectorIndexPass<T>(doc: Document, run: () => T, kept?: KeptIndexes): T {
37
38
  const previous = activePass;
38
- activePass = { doc, bySelector: new Map() };
39
+ const bySelector = kept?.get(doc) ?? new Map();
40
+ kept?.set(doc, bySelector);
41
+ activePass = { doc, bySelector };
39
42
  try {
40
43
  return run();
41
44
  } finally {