@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/dist/assets/{hyperframes-player-Cm1Cj3TU.js → hyperframes-player-BpOOAOcm.js} +1 -1
- package/dist/assets/{index-DDsV6l9T.js → index-BEcHKkGY.js} +64 -64
- package/dist/assets/{index-DAp0QmWa.js → index-DASBNWML.js} +1 -1
- package/dist/assets/{index--Z5JgizA.js → index-DbSXe5_2.js} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.html +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/hooks/usePersistentEditHistory.test.ts +25 -1
- package/src/hooks/usePersistentEditHistory.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio",
|
|
3
|
-
"version": "0.8.
|
|
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/
|
|
64
|
-
"@hyperframes/
|
|
65
|
-
"@hyperframes/
|
|
66
|
-
"@hyperframes/
|
|
67
|
-
"@hyperframes/
|
|
68
|
-
"@hyperframes/studio-server": "0.8.
|
|
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.
|
|
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:
|
|
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,
|
|
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,
|