@hyperframes/studio 0.8.130 → 0.8.131

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio",
3
- "version": "0.8.130",
3
+ "version": "0.8.131",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,12 +60,12 @@
60
60
  "dockview-react": "8.3.1",
61
61
  "gsap": "^3.13.0",
62
62
  "mediabunny": "^1.45.3",
63
- "@hyperframes/parsers": "0.8.130",
64
- "@hyperframes/player": "0.8.130",
65
- "@hyperframes/core": "0.8.130",
66
- "@hyperframes/sdk": "0.8.130",
67
- "@hyperframes/shader-transitions": "0.8.130",
68
- "@hyperframes/studio-server": "0.8.130"
63
+ "@hyperframes/core": "0.8.131",
64
+ "@hyperframes/parsers": "0.8.131",
65
+ "@hyperframes/player": "0.8.131",
66
+ "@hyperframes/shader-transitions": "0.8.131",
67
+ "@hyperframes/sdk": "0.8.131",
68
+ "@hyperframes/studio-server": "0.8.131"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@tailwindcss/vite": "^4.3.3",
@@ -81,7 +81,7 @@
81
81
  "vite": "^6.4.2",
82
82
  "vitest": "^4.1.11",
83
83
  "zustand": "^5.0.0",
84
- "@hyperframes/producer": "0.8.130"
84
+ "@hyperframes/producer": "0.8.131"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "react": "19",
@@ -62,7 +62,7 @@ async function studio({ withHistory = true } = {}) {
62
62
  const file = () => readFileSync(join(dir, "index.html"), "utf8");
63
63
  const save = (content: string) => writeFileSync(join(dir, "index.html"), content);
64
64
  const readFile = async (path: string) => readFileSync(join(dir, path), "utf8");
65
- return { dir, hook: () => hook, file, save, readFile };
65
+ return { dir, history, hook: () => hook, file, save, readFile };
66
66
  }
67
67
 
68
68
  it("an edit Studio saved is undone and redone by the project's history, with the preview's before and after", async () => {
@@ -411,6 +411,30 @@ it("a key one page holds does not join another page's edit under the same key",
411
411
  expect(file()).toBe("B");
412
412
  });
413
413
 
414
+ it("a host's write claimed under claimKey joins Studio's save under the same key: one undo takes back both", async () => {
415
+ const { dir, history, hook, file, save, readFile } = await studio();
416
+ const key = "drop:1";
417
+ writeFileSync(join(dir, "clip.mp4"), "media");
418
+ await history.claim({ kind: "person", name: "You" }, "Dropped on timeline", ["clip.mp4"], {
419
+ coalesceKey: hook().claimKey(key),
420
+ idleMs: Infinity,
421
+ });
422
+ save("B");
423
+ await act(() =>
424
+ hook().recordEdit({
425
+ label: "Dropped on timeline",
426
+ coalesceKey: key,
427
+ coalesceMs: Infinity,
428
+ files: { "index.html": { before: "A", after: "B" } },
429
+ }),
430
+ );
431
+
432
+ await act(() => hook().undo({ readFile }));
433
+
434
+ expect(file()).toBe("A");
435
+ expect(existsSync(join(dir, "clip.mp4"))).toBe(false);
436
+ });
437
+
414
438
  it("an undo before the history view shows a drag's held claim still waits on the files it wrote", async () => {
415
439
  const { hook, save, readFile } = await studio();
416
440
  const server = globalThis.fetch;
@@ -209,6 +209,7 @@ export function usePersistentEditHistory({ projectId }: UsePersistentEditHistory
209
209
  projectIdRef.current = projectId;
210
210
  const [own] = useState(createOwnHistory);
211
211
  const [pageKeyScope] = useState(generateId);
212
+ const claimKey = useCallback((key: string) => `${pageKeyScope}:${key}`, [pageKeyScope]);
212
213
 
213
214
  const refresh = useCallback(async () => {
214
215
  if (!projectId) return;
@@ -246,7 +247,7 @@ export function usePersistentEditHistory({ projectId }: UsePersistentEditHistory
246
247
  paths,
247
248
  overwrote: await overwroteVersions(files),
248
249
  ...(coalesceKey && {
249
- coalesceKey: `${pageKeyScope}:${coalesceKey}`,
250
+ coalesceKey: claimKey(coalesceKey),
250
251
  idleMs: coalesceMs ?? DEFAULT_COALESCE_MS,
251
252
  }),
252
253
  });
@@ -258,7 +259,7 @@ export function usePersistentEditHistory({ projectId }: UsePersistentEditHistory
258
259
  heldClaimRef.current = claimed && coalesceKey ? { paths, at: Date.now() } : null;
259
260
  await refresh();
260
261
  },
261
- [projectId, refresh, own, pageKeyScope],
262
+ [projectId, refresh, own, claimKey],
262
263
  );
263
264
 
264
265
  const step = useCallback(
@@ -341,6 +342,7 @@ export function usePersistentEditHistory({ projectId }: UsePersistentEditHistory
341
342
  redoPaths: view.forward?.paths ?? [],
342
343
  state,
343
344
  recordEdit,
345
+ claimKey,
344
346
  undo,
345
347
  redo,
346
348
  predict: own.predict,