@hyperframes/studio 0.9.28-alpha.0 → 0.9.28-alpha.2

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.9.28-alpha.0",
3
+ "version": "0.9.28-alpha.2",
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.65.2",
63
- "@hyperframes/parsers": "0.9.28-alpha.0",
64
- "@hyperframes/core": "0.9.28-alpha.0",
65
- "@hyperframes/sdk": "0.9.28-alpha.0",
66
- "@hyperframes/player": "0.9.28-alpha.0",
67
- "@hyperframes/studio-server": "0.9.28-alpha.0",
68
- "@hyperframes/shader-transitions": "0.9.28-alpha.0"
63
+ "@hyperframes/core": "0.9.28-alpha.2",
64
+ "@hyperframes/parsers": "0.9.28-alpha.2",
65
+ "@hyperframes/player": "0.9.28-alpha.2",
66
+ "@hyperframes/shader-transitions": "0.9.28-alpha.2",
67
+ "@hyperframes/studio-server": "0.9.28-alpha.2",
68
+ "@hyperframes/sdk": "0.9.28-alpha.2"
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.9.28-alpha.0"
85
+ "@hyperframes/producer": "0.9.28-alpha.2"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "react": "19",
@@ -497,7 +497,9 @@ it("refuses an upgrade destination outside the public pricing flow", async () =>
497
497
  snapshot.spaces[0]!.plan = "free";
498
498
  snapshot.spaces[0]!.upgradeUrl = "https://example.com/checkout";
499
499
  await mount();
500
- expect(host.textContent).not.toContain("Upgrade to Pro");
500
+ expect(
501
+ [...host.querySelectorAll("a")].some((link) => link.textContent?.includes("Upgrade to Pro")),
502
+ ).toBe(false);
501
503
  });
502
504
 
503
505
  it.each([false, true])(
@@ -546,3 +548,38 @@ it("bootstraps sharing when the CLI advertises its bridge", async () => {
546
548
  marker.remove();
547
549
  }
548
550
  });
551
+
552
+ it("acknowledges an unchanged update", async () => {
553
+ snapshot.share = {
554
+ ...snapshot.share,
555
+ state: "ready",
556
+ url: "https://hyperframes.dev/r/test",
557
+ audience: "public",
558
+ spaceId: "team1",
559
+ };
560
+ job = { ...job, state: "done", result: { ...snapshot.share, upToDate: true } };
561
+ await act(async () => root.render(<QuickShareContent token={token} />));
562
+ await act(async () => button("Update shared version")?.click());
563
+ expect(host.textContent).toContain("Already up to date.");
564
+ });
565
+ it("resets the copied acknowledgement after two seconds", async () => {
566
+ vi.useFakeTimers();
567
+ Object.defineProperty(navigator, "clipboard", {
568
+ configurable: true,
569
+ value: { writeText: vi.fn().mockResolvedValue(undefined) },
570
+ });
571
+ snapshot.share = {
572
+ ...snapshot.share,
573
+ state: "ready",
574
+ url: "https://hyperframes.dev/r/test",
575
+ audience: "public",
576
+ spaceId: "team1",
577
+ };
578
+ await act(async () => root.render(<QuickShareContent token={token} />));
579
+ await act(async () => button("Copy link")?.click());
580
+ expect(button("Copied")).toBeDefined();
581
+ await act(async () => vi.advanceTimersByTime(2000));
582
+ expect(button("Copied")).toBeUndefined();
583
+ expect(button("Copy link")).toBeDefined();
584
+ vi.useRealTimers();
585
+ });
@@ -69,6 +69,7 @@ export function QuickShareContent({
69
69
  {progress ? (
70
70
  <p role="status">{progress} You can close this panel; keep Studio running.</p>
71
71
  ) : null}
72
+ {model.notice ? <p role="status">{model.notice}</p> : null}
72
73
  <ShareLogin model={model} />
73
74
  {error ? (
74
75
  <p role="alert" className="text-step-11 text-text-2">
@@ -61,6 +61,7 @@ export function ShareAudience({
61
61
  {choices.map((value) => {
62
62
  const option = AUDIENCES[value];
63
63
  const OptionIcon = option.icon;
64
+ const needsPro = requiresPro(space, value, snapshot.share.audience);
64
65
  return (
65
66
  <MenuRadioItem
66
67
  key={value}
@@ -77,9 +78,16 @@ export function ShareAudience({
77
78
  <OptionIcon size={15} aria-hidden="true" />
78
79
  </span>
79
80
  <span className="min-w-0 leading-snug">
80
- <span className="block font-semibold">{option.label}</span>
81
+ <span className="flex items-center gap-2 font-semibold">
82
+ {option.label}
83
+ {needsPro ? (
84
+ <span className="rounded bg-press px-1.5 py-0.5 text-step-10 font-semibold">
85
+ Pro
86
+ </span>
87
+ ) : null}
88
+ </span>
81
89
  <span className="block whitespace-normal text-step-11 text-text-3">
82
- {option.detail}
90
+ {needsPro ? "Upgrade to Pro to use this option" : option.detail}
83
91
  </span>
84
92
  </span>
85
93
  </span>
@@ -87,6 +95,26 @@ export function ShareAudience({
87
95
  );
88
96
  })}
89
97
  </MenuRadioGroup>
98
+ {space?.plan === "free" &&
99
+ (!space.audiences.includes("team") || !space.audiences.includes("invite")) ? (
100
+ <p className="mx-2 mt-1 border-t border-border px-1 py-2 text-step-11 text-text-2">
101
+ Free includes anyone-with-the-link sharing. Upgrade to Pro for workspace and invite-only
102
+ sharing.
103
+ </p>
104
+ ) : null}
90
105
  </Menu>
91
106
  );
92
107
  }
108
+
109
+ function requiresPro(
110
+ space: LocalShareSnapshot["spaces"][number] | undefined,
111
+ value: LocalShareAudience,
112
+ current: LocalShareAudience | null,
113
+ ) {
114
+ return (
115
+ space?.plan === "free" &&
116
+ !space.audiences.includes(value) &&
117
+ value !== current &&
118
+ (value === "team" || value === "invite")
119
+ );
120
+ }
@@ -29,7 +29,8 @@ export function useQuickShare(token: string, beforeShare?: () => Promise<void>)
29
29
  const reconnectOnReturn = useRef(false);
30
30
  const [error, setError] = useState<string | null>(null);
31
31
  const [errorCode, setErrorCode] = useState<string | null>(null);
32
- const [copied, setCopied] = useState(false);
32
+ const { copied, setCopied, acknowledgeCopy } = useCopyAcknowledgement();
33
+ const [notice, setNotice] = useState("");
33
34
  const opened = useRef(false);
34
35
  const lifetime = useRef<AbortController | null>(null);
35
36
  const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -59,6 +60,7 @@ export function useQuickShare(token: string, beforeShare?: () => Promise<void>)
59
60
  const result = job.result;
60
61
  if (result) setSnapshot((prior) => (prior ? { ...prior, share: result, job } : prior));
61
62
  await refresh(signal, job.state === "failed");
63
+ if (!signal.aborted) setNotice(completionNotice(job));
62
64
  }
63
65
  async function refresh(signal: AbortSignal, preserveSelection = false) {
64
66
  setError(null);
@@ -108,6 +110,7 @@ export function useQuickShare(token: string, beforeShare?: () => Promise<void>)
108
110
  setError(null);
109
111
  setErrorCode(null);
110
112
  setCopied(false);
113
+ setNotice("");
111
114
  setProgress("Preparing share…");
112
115
  try {
113
116
  if (["share", "update"].includes(action.action)) await beforeShare?.();
@@ -166,7 +169,8 @@ export function useQuickShare(token: string, beforeShare?: () => Promise<void>)
166
169
  async function copy(url: string) {
167
170
  try {
168
171
  await navigator.clipboard.writeText(url);
169
- setCopied(true);
172
+ if (lifetime.current?.signal.aborted) return;
173
+ acknowledgeCopy();
170
174
  shareInteraction(token, { event: "share_link_copied", via: "copy" });
171
175
  } catch {
172
176
  setError("Couldn’t copy. Open the shared page and copy its address.");
@@ -181,9 +185,26 @@ export function useQuickShare(token: string, beforeShare?: () => Promise<void>)
181
185
  error,
182
186
  errorCode,
183
187
  copied,
188
+ notice,
184
189
  progress,
185
190
  run,
186
191
  copy,
187
192
  };
188
193
  }
189
194
  export type QuickShareModel = ReturnType<typeof useQuickShare>;
195
+
196
+ function completionNotice(job: LocalShareJob) {
197
+ return job.state === "done" && job.result?.upToDate ? "Already up to date." : "";
198
+ }
199
+
200
+ function useCopyAcknowledgement() {
201
+ const [copied, setCopied] = useState(false);
202
+ const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
203
+ useMountEffect(() => () => clearTimeout(timer.current));
204
+ function acknowledgeCopy() {
205
+ clearTimeout(timer.current);
206
+ setCopied(true);
207
+ timer.current = setTimeout(() => setCopied(false), 2000);
208
+ }
209
+ return { copied, setCopied, acknowledgeCopy };
210
+ }