@hyperframes/studio 0.8.216 → 0.8.218

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.
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-C-DCQ7nQ.js";/*!
1
+ import{n as Qi}from"./index-BLgjf320.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public
package/dist/index.html CHANGED
@@ -14,7 +14,7 @@
14
14
  document.documentElement.dataset.theme = "paper";
15
15
  }
16
16
  </script>
17
- <script type="module" crossorigin src="/assets/index-C-DCQ7nQ.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-BLgjf320.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-RUPGNyct.css">
19
19
  </head>
20
20
  <body>
package/dist/index.js CHANGED
@@ -32197,6 +32197,17 @@ function shadowPlayerReachable(iframe) {
32197
32197
  return false;
32198
32198
  }
32199
32199
  }
32200
+ function shadowPagePhase(iframe) {
32201
+ const doc = iframe?.contentDocument;
32202
+ if (!doc || doc.URL === "about:blank") return "no-page";
32203
+ const win = iframe.contentWindow;
32204
+ if (doc.readyState === "loading") return "page-loading";
32205
+ if (win.__hfStartupError) return "startup-error";
32206
+ if (!win.__hyperframes) return "runtime-not-run";
32207
+ if (!win.__hyperframeRuntimeBootstrapped) return "scripts-waiting";
32208
+ return "no-player";
32209
+ }
32210
+ var pageGotTo = (iframe) => shadowPlayerReachable(iframe) ? "" : ` Its page had got to: ${shadowPagePhase(iframe)}.`;
32200
32211
  function isDocumentHidden() {
32201
32212
  return typeof document !== "undefined" && document.visibilityState === "hidden";
32202
32213
  }
@@ -32253,6 +32264,7 @@ function useShadowPreviewReload({
32253
32264
  (gen, cause) => {
32254
32265
  if (gen !== shadowGenRef.current) return;
32255
32266
  const waitingFor = !shadowPlayerReachable(shadowIframeRef.current) ? "the page and its runtime to load" : pendingCommitRef.current?.gen !== gen ? "its timeline to be ready" : "its loaders to clear";
32267
+ const got = pageGotTo(shadowIframeRef.current);
32256
32268
  shadowGenRef.current += 1;
32257
32269
  stopPendingShadow();
32258
32270
  shadowIframeRef.current = null;
@@ -32260,7 +32272,7 @@ function useShadowPreviewReload({
32260
32272
  pendingSeekRef.current = null;
32261
32273
  setPreviewSlots(planShadowDiscard);
32262
32274
  setPreviewReloading(false);
32263
- const message = `The preview did not reload (${cause}). It was still waiting for ${waitingFor}. The previous preview is still showing.`;
32275
+ const message = `The preview did not reload (${cause}). It was still waiting for ${waitingFor}.${got} The previous preview is still showing.`;
32264
32276
  logReload("shadow-failed", { cause, waitingFor });
32265
32277
  const refused = refusedPreviewStatus(cause);
32266
32278
  const pageMissingNow = refused !== null && refused < 500;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio",
3
- "version": "0.8.216",
3
+ "version": "0.8.218",
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/core": "0.8.216",
64
- "@hyperframes/parsers": "0.8.216",
65
- "@hyperframes/player": "0.8.216",
66
- "@hyperframes/sdk": "0.8.216",
67
- "@hyperframes/shader-transitions": "0.8.216",
68
- "@hyperframes/studio-server": "0.8.216"
63
+ "@hyperframes/parsers": "0.8.218",
64
+ "@hyperframes/player": "0.8.218",
65
+ "@hyperframes/shader-transitions": "0.8.218",
66
+ "@hyperframes/studio-server": "0.8.218",
67
+ "@hyperframes/sdk": "0.8.218",
68
+ "@hyperframes/core": "0.8.218"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@tailwindcss/vite": "^4.3.3",
@@ -82,7 +82,7 @@
82
82
  "vite": "^6.4.2",
83
83
  "vitest": "^4.1.11",
84
84
  "zustand": "^5.0.0",
85
- "@hyperframes/producer": "0.8.216"
85
+ "@hyperframes/producer": "0.8.218"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "react": "19",
@@ -44,6 +44,20 @@ function shadowPlayerReachable(iframe: HTMLIFrameElement | null): boolean {
44
44
  }
45
45
  }
46
46
 
47
+ function shadowPagePhase(iframe: HTMLIFrameElement | null): string {
48
+ const doc = iframe?.contentDocument;
49
+ if (!doc || doc.URL === "about:blank") return "no-page";
50
+ const win = iframe!.contentWindow as unknown as Record<string, unknown>;
51
+ if (doc.readyState === "loading") return "page-loading";
52
+ if (win.__hfStartupError) return "startup-error";
53
+ if (!win.__hyperframes) return "runtime-not-run";
54
+ if (!win.__hyperframeRuntimeBootstrapped) return "scripts-waiting";
55
+ return "no-player";
56
+ }
57
+
58
+ const pageGotTo = (iframe: HTMLIFrameElement | null) =>
59
+ shadowPlayerReachable(iframe) ? "" : ` Its page had got to: ${shadowPagePhase(iframe)}.`;
60
+
47
61
  function isDocumentHidden(): boolean {
48
62
  return typeof document !== "undefined" && document.visibilityState === "hidden";
49
63
  }
@@ -123,6 +137,7 @@ export function useShadowPreviewReload({
123
137
  : pendingCommitRef.current?.gen !== gen
124
138
  ? "its timeline to be ready"
125
139
  : "its loaders to clear";
140
+ const got = pageGotTo(shadowIframeRef.current);
126
141
  shadowGenRef.current += 1;
127
142
  stopPendingShadow();
128
143
  shadowIframeRef.current = null;
@@ -130,7 +145,7 @@ export function useShadowPreviewReload({
130
145
  pendingSeekRef.current = null;
131
146
  setPreviewSlots(planShadowDiscard);
132
147
  setPreviewReloading(false);
133
- const message = `The preview did not reload (${cause}). It was still waiting for ${waitingFor}. The previous preview is still showing.`;
148
+ const message = `The preview did not reload (${cause}). It was still waiting for ${waitingFor}.${got} The previous preview is still showing.`;
134
149
  logReload("shadow-failed", { cause, waitingFor });
135
150
  const refused = refusedPreviewStatus(cause);
136
151
  const pageMissingNow = refused !== null && refused < 500;
@@ -405,6 +405,36 @@ describe("shadow reload readiness and failure", () => {
405
405
  unmount(root);
406
406
  });
407
407
 
408
+ const loaded = { URL: "http://127.0.0.1/preview", readyState: "complete" };
409
+ it.each([
410
+ ["no-page", {}, { ...loaded, URL: "about:blank" }],
411
+ ["page-loading", {}, { ...loaded, readyState: "loading" }],
412
+ ["startup-error", { __hfStartupError: "failed", __hyperframes: {} }, loaded],
413
+ ["runtime-not-run", {}, loaded],
414
+ // Its runtime ran, but the composition's scripts never finished (fonts that never load, say).
415
+ ["scripts-waiting", { __hyperframes: {} }, loaded],
416
+ ["no-player", { __hyperframes: {}, __hyperframeRuntimeBootstrapped: true }, loaded],
417
+ ])(
418
+ "says its page got to %s when a shadow gives up waiting for the runtime",
419
+ (phase, win, doc) => {
420
+ vi.useFakeTimers();
421
+ vi.spyOn(console, "error").mockImplementation(() => {});
422
+ const onPreviewReloadFailed = vi.fn();
423
+ const { getApi, gen, root } = beginReload({ onPreviewReloadFailed });
424
+ const shadow = makeFakeIframe(win);
425
+ Object.defineProperty(shadow, "contentDocument", { value: doc });
426
+ act(() => {
427
+ getApi().setShadowIframeNode(shadow);
428
+ getApi().onShadowIframeLoad(gen);
429
+ });
430
+ act(() => void vi.advanceTimersByTime(FULL_WAIT_MS));
431
+ expect(onPreviewReloadFailed).toHaveBeenCalledWith(
432
+ expect.stringContaining(`Its page had got to: ${phase}.`),
433
+ );
434
+ unmount(root);
435
+ },
436
+ );
437
+
408
438
  it("names the timeline when a shadow's runtime runs but never reports a length", () => {
409
439
  vi.useFakeTimers();
410
440
  vi.spyOn(console, "error").mockImplementation(() => {});