@hyperframes/studio 0.9.18 → 0.9.20

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 (52) hide show
  1. package/dist/assets/{hyperframes-player-pLs7eSzg.js → hyperframes-player-ZQZslutT.js} +3 -3
  2. package/dist/assets/index-Bgfyny02.css +1 -0
  3. package/dist/assets/{index-DZ7OLB7p.js → index-Bn5atbhb.js} +1 -1
  4. package/dist/assets/{index-D_iVCwL3.js → index-Bz2pYyGM.js} +196 -196
  5. package/dist/index.d.ts +1 -4
  6. package/dist/index.html +2 -2
  7. package/dist/index.js +6571 -5519
  8. package/dist/styles.css +1 -1
  9. package/package.json +8 -8
  10. package/src/components/DesktopGuideCard.tsx +21 -4
  11. package/src/components/EditorShell.tsx +10 -7
  12. package/src/components/OpenInDesktopButton.dom.test.tsx +64 -8
  13. package/src/components/OpenInDesktopButton.tsx +31 -14
  14. package/src/components/editor/DomEditGestureReadout.test.tsx +177 -0
  15. package/src/components/editor/DomEditGestureReadout.tsx +58 -0
  16. package/src/components/editor/DomEditOverlay.tsx +6 -0
  17. package/src/components/editor/domEditGestureReadoutState.ts +55 -0
  18. package/src/components/editor/domEditOverlayGestures.ts +12 -0
  19. package/src/components/editor/domEditOverlayStartGesture.ts +2 -0
  20. package/src/components/editor/useDomEditOverlayGestures.ts +12 -13
  21. package/src/components/nle/NLEPreview.test.ts +72 -0
  22. package/src/components/nle/NLEPreview.tsx +8 -9
  23. package/src/components/nle/PreviewZoomOverlay.tsx +155 -9
  24. package/src/components/nle/previewZoom.test.ts +98 -0
  25. package/src/components/nle/previewZoom.ts +65 -1
  26. package/src/components/panels/MotionBlurPanel.test.tsx +4 -0
  27. package/src/components/panels/MotionBlurPanel.tsx +1 -1
  28. package/src/components/storyboard/ApproveBoardButton.dom.test.tsx +48 -0
  29. package/src/components/storyboard/ApproveBoardButton.tsx +33 -0
  30. package/src/components/storyboard/PreviewStage.dom.test.tsx +114 -0
  31. package/src/components/storyboard/PreviewStage.player.dom.test.tsx +72 -0
  32. package/src/components/storyboard/PreviewStage.tsx +93 -0
  33. package/src/components/storyboard/StoryboardBoardView.tsx +322 -0
  34. package/src/components/storyboard/storyboardBoard.test.ts +183 -0
  35. package/src/components/storyboard/storyboardBoard.ts +148 -0
  36. package/src/components/storyboard/useStoryboardBoard.ts +99 -0
  37. package/src/hooks/elementPickerHoverLabel.browser.test.ts +85 -0
  38. package/src/hooks/elementPickerHoverLabel.test.ts +106 -0
  39. package/src/hooks/elementPickerHoverLabel.ts +173 -0
  40. package/src/hooks/fileChangeFanout.test.ts +20 -0
  41. package/src/hooks/fileChangeFanout.ts +13 -0
  42. package/src/hooks/useElementPicker.test.ts +254 -3
  43. package/src/hooks/useElementPicker.ts +237 -48
  44. package/src/hooks/useExternalFileChangeCoordinator.ts +6 -1
  45. package/src/player/components/timelineProviderStateBuilders.test.ts +3 -6
  46. package/src/player/components/timelineProviderStateBuilders.ts +1 -2
  47. package/src/player/components/timelineShellMeta.tsx +0 -2
  48. package/src/player/components/useTimelineProviderState.tsx +1 -2
  49. package/src/player/components/useTimelineShiftModifier.test.tsx +40 -0
  50. package/src/player/components/useTimelineShiftModifier.ts +7 -7
  51. package/src/styles/theme.css +2 -0
  52. package/dist/assets/index-CNZk2EFC.css +0 -1
@@ -17,7 +17,6 @@ function inputs(overrides: Partial<TimelineMetaBuilderInputs> = {}): TimelineMet
17
17
  "data-timeline-element-count": 2,
18
18
  isDragOver: false,
19
19
  activeTool: "select",
20
- shiftHeld: false,
21
20
  accentClass: "ring",
22
21
  onMouseMove: vi.fn(),
23
22
  onMouseLeave: vi.fn(),
@@ -61,11 +60,9 @@ describe("buildTimelineMeta", () => {
61
60
  expect(meta.containerProps.className).toContain("cursor-crosshair");
62
61
  });
63
62
 
64
- it("uses the shift branch for the container class", () => {
65
- const meta = buildTimelineMeta(
66
- inputs({ container: { ...inputs().container, shiftHeld: true } }),
67
- );
68
- expect(meta.containerProps.className).toContain("cursor-crosshair");
63
+ it("leaves Shift's cursor to the container's data attribute", () => {
64
+ const meta = buildTimelineMeta(inputs());
65
+ expect(meta.containerProps.className).toContain("data-[shift-held]:cursor-crosshair");
69
66
  });
70
67
 
71
68
  it("uses the default container class without an accent", () => {
@@ -43,7 +43,6 @@ export function shouldIgnoreTimelinePointerDown(target: EventTarget | null): boo
43
43
  type ContainerInputs = Omit<TimelineContainerProps, "className"> & {
44
44
  isDragOver: boolean;
45
45
  activeTool: string;
46
- shiftHeld: boolean;
47
46
  accentClass: string;
48
47
  };
49
48
 
@@ -77,7 +76,7 @@ export function buildTimelineMeta({
77
76
  razorGuide,
78
77
  }: TimelineMetaBuilderInputs): TimelineMeta {
79
78
  const { labelMode, zoomMode, contentOrigin, ...viewportProps } = viewport;
80
- const containerClassName = `relative border-t select-none h-full overflow-hidden ${container.isDragOver ? container.accentClass : ""} ${container.activeTool === "razor" ? "cursor-crosshair" : container.shiftHeld ? "cursor-crosshair" : "cursor-default"}`;
79
+ const containerClassName = `relative border-t select-none h-full overflow-hidden ${container.isDragOver ? container.accentClass : ""} ${container.activeTool === "razor" ? "cursor-crosshair" : "cursor-default data-[shift-held]:cursor-crosshair"}`;
81
80
  const viewportClassName = `${zoomMode === "fit" ? "overflow-x-hidden" : "overflow-x-auto"} overflow-y-auto h-full outline-hidden`;
82
81
  return {
83
82
  emptyState,
@@ -29,7 +29,6 @@ export interface TimelineShellMetaInputs {
29
29
  focusProps: Pick<TimelineViewportProps, "onFocus" | "onBlur">;
30
30
  elementCount: number;
31
31
  activeTool: string;
32
- shiftHeld: boolean;
33
32
  labelMode: boolean;
34
33
  contentOrigin: number;
35
34
  zoomMode: "fit" | "manual";
@@ -56,7 +55,6 @@ export function buildTimelineShellMeta(input: TimelineShellMetaInputs): Timeline
56
55
  "data-timeline-element-count": input.elementCount,
57
56
  isDragOver: input.isDragOver,
58
57
  activeTool,
59
- shiftHeld: input.shiftHeld,
60
58
  accentClass: "ring-1 ring-inset ring-studio-accent/60",
61
59
  onMouseMove: razor.updateRazorGuide,
62
60
  onMouseLeave: razor.clearRazorGuide,
@@ -138,7 +138,7 @@ export function useTimelineProviderState({
138
138
  const activeTool = usePlayerStore((s) => s.activeTool);
139
139
  const [hoveredClip, setHoveredClip] = useState<string | null>(null);
140
140
  const isDragging = useRef(false);
141
- const shiftHeld = useTimelineShiftModifier();
141
+ useTimelineShiftModifier(containerRef);
142
142
  const [showPopover, setShowPopover] = useState(false);
143
143
  const [kfContextMenu, setKfContextMenu] = useState<KeyframeDiamondContextMenuState | null>(null);
144
144
  const [clipContextMenu, setClipContextMenu] = useState<ClipContextMenuState | null>(null);
@@ -564,7 +564,6 @@ export function useTimelineProviderState({
564
564
  focusProps: timelineFocus.timelineFocusProps,
565
565
  elementCount: timelineElements.length,
566
566
  activeTool,
567
- shiftHeld,
568
567
  labelMode,
569
568
  contentOrigin,
570
569
  zoomMode,
@@ -0,0 +1,40 @@
1
+ // @vitest-environment jsdom
2
+ import { act, createElement, Profiler, useRef } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ import { expect, it } from "vitest";
5
+ import { useTimelineShiftModifier } from "./useTimelineShiftModifier";
6
+
7
+ (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
8
+
9
+ function Timeline() {
10
+ const container = useRef<HTMLDivElement>(null);
11
+ useTimelineShiftModifier(container);
12
+ return createElement("div", { ref: container, "data-testid": "timeline" });
13
+ }
14
+
15
+ const key = (type: string, name: string) =>
16
+ act(() => void window.dispatchEvent(new KeyboardEvent(type, { key: name })));
17
+
18
+ it("Shift marks the timeline for its cursor without rendering it", () => {
19
+ const host = document.createElement("div");
20
+ const root = createRoot(host);
21
+ let commits = 0;
22
+ act(() =>
23
+ root.render(
24
+ createElement(Profiler, { id: "t", onRender: () => (commits += 1) }, createElement(Timeline)),
25
+ ),
26
+ );
27
+ const timeline = host.querySelector("[data-testid=timeline]")!;
28
+ const start = commits;
29
+ key("keydown", "Shift");
30
+ expect(timeline.hasAttribute("data-shift-held")).toBe(true);
31
+ key("keydown", "a");
32
+ expect(timeline.hasAttribute("data-shift-held")).toBe(true);
33
+ key("keyup", "Shift");
34
+ expect(timeline.hasAttribute("data-shift-held")).toBe(false);
35
+ key("keydown", "Shift");
36
+ act(() => void window.dispatchEvent(new Event("blur")));
37
+ expect(timeline.hasAttribute("data-shift-held")).toBe(false);
38
+ expect(commits).toBe(start);
39
+ act(() => root.unmount());
40
+ });
@@ -1,12 +1,13 @@
1
- import { useState } from "react";
1
+ import type { RefObject } from "react";
2
2
  import { useMountEffect } from "../../hooks/useMountEffect";
3
3
 
4
- export function useTimelineShiftModifier(): boolean {
5
- const [shiftHeld, setShiftHeld] = useState(false);
4
+ export function useTimelineShiftModifier(container: RefObject<HTMLElement | null>): void {
6
5
  useMountEffect(() => {
7
- const handleKey = (event: KeyboardEvent) =>
8
- event.key === "Shift" && setShiftHeld(event.type === "keydown");
9
- const handleBlur = () => setShiftHeld(false);
6
+ const hold = (held: boolean) => container.current?.toggleAttribute("data-shift-held", held);
7
+ const handleKey = (event: KeyboardEvent) => {
8
+ if (event.key === "Shift") hold(event.type === "keydown");
9
+ };
10
+ const handleBlur = () => hold(false);
10
11
  window.addEventListener("keydown", handleKey);
11
12
  window.addEventListener("keyup", handleKey);
12
13
  window.addEventListener("blur", handleBlur);
@@ -16,5 +17,4 @@ export function useTimelineShiftModifier(): boolean {
16
17
  window.removeEventListener("blur", handleBlur);
17
18
  };
18
19
  });
19
- return shiftHeld;
20
20
  }
@@ -70,6 +70,8 @@
70
70
  --color-ring: var(--color-accent-ink);
71
71
  --color-selection: light-dark(oklch(0.5 0.13 240), #4ba3d2);
72
72
  --color-playhead: var(--color-text-0);
73
+ /* Over the composition's own pixels, so mid-grey to read on light and dark content alike. */
74
+ --color-pixel-grid: oklch(0.6 0 0 / 0.5);
73
75
  --color-danger: oklch(0.56 0.19 25);
74
76
  --color-danger-ink: light-dark(oklch(0.45 0.17 25), oklch(0.791 0.12 25));
75
77
  --color-warning-ink: light-dark(oklch(0.5 0.12 70), oklch(82.8% 0.189 84.429));