@hyperframes/studio 0.8.52 → 0.8.53

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 (75) hide show
  1. package/dist/assets/{hyperframes-player-I5YRzB02.js → hyperframes-player-DKWM-Ons.js} +1 -1
  2. package/dist/assets/index-DrHQAuGO.css +1 -0
  3. package/dist/assets/index-HfP3sap2.js +390 -0
  4. package/dist/assets/{index-BTAfgesM.js → index-UvW6BEwf.js} +1 -1
  5. package/dist/assets/{index-Du5x7KUR.js → index-Y4OnpTEM.js} +1 -1
  6. package/dist/index.css +29 -0
  7. package/dist/index.css.map +1 -0
  8. package/dist/index.d.ts +13 -6
  9. package/dist/index.html +2 -2
  10. package/dist/index.js +7664 -7953
  11. package/dist/index.js.map +1 -1
  12. package/dist/styles.css +1 -0
  13. package/package.json +8 -7
  14. package/src/App.tsx +42 -48
  15. package/src/components/EditorShell.selectionSync.test.tsx +9 -4
  16. package/src/components/EditorShell.tsx +52 -56
  17. package/src/components/StudioHeader.dom.test.tsx +1 -1
  18. package/src/components/StudioHeader.test.ts +0 -12
  19. package/src/components/StudioHeader.tsx +10 -13
  20. package/src/components/StudioLeftPanels.tsx +202 -0
  21. package/src/components/{StudioRightPanel.tsx → StudioRightPanels.tsx} +57 -206
  22. package/src/components/{StudioRightPanel.types.ts → StudioRightPanels.types.ts} +4 -3
  23. package/src/components/dock/Dock.test.tsx +16 -2
  24. package/src/components/dock/Dock.tsx +13 -3
  25. package/src/components/dock/dockLayoutStore.test.ts +28 -0
  26. package/src/components/dock/dockLayoutStore.ts +21 -4
  27. package/src/components/editor/SnapToolbar.test.tsx +0 -3
  28. package/src/components/nle/NLEContext.tsx +0 -43
  29. package/src/components/nle/TimelinePane.tsx +46 -67
  30. package/src/components/panels/SlideshowPanel.tsx +1 -1
  31. package/src/components/panels/VariablesPanel.tsx +1 -1
  32. package/src/components/renders/RenderQueue.test.tsx +133 -25
  33. package/src/components/renders/RenderQueue.tsx +99 -92
  34. package/src/components/renders/RenderQueueItem.tsx +69 -64
  35. package/src/components/renders/RenderQueuePanel.tsx +1 -1
  36. package/src/components/sidebar/{LeftSidebar.masterComposition.test.tsx → CompositionsPanel.masterComposition.test.tsx} +6 -9
  37. package/src/components/sidebar/CompositionsPanel.tsx +15 -0
  38. package/src/components/sidebar/{LeftSidebar.lintBadge.test.tsx → SidebarLintButton.test.tsx} +6 -11
  39. package/src/components/sidebar/SidebarLintButton.tsx +50 -0
  40. package/src/components/ui/Select.tsx +4 -0
  41. package/src/contexts/PanelLayoutContext.tsx +3 -57
  42. package/src/headerExports.test.tsx +23 -0
  43. package/src/hooks/appHotkeysDispatch.ts +3 -4
  44. package/src/hooks/useAppHotkeys.previewForwarding.test.tsx +0 -2
  45. package/src/hooks/useAppHotkeys.test.ts +0 -1
  46. package/src/hooks/useAppHotkeys.textEditing.test.tsx +0 -3
  47. package/src/hooks/useAppHotkeys.ts +0 -4
  48. package/src/hooks/useDomEditPreviewSync.ts +4 -6
  49. package/src/hooks/useDomEditSession.ts +0 -7
  50. package/src/hooks/useDomEditWiring.ts +4 -9
  51. package/src/hooks/usePanelLayout.test.ts +108 -296
  52. package/src/hooks/usePanelLayout.ts +50 -255
  53. package/src/hooks/useRightPanelIntents.test.ts +181 -0
  54. package/src/hooks/useRightPanelIntents.ts +64 -0
  55. package/src/hooks/useSlideshowTabState.test.ts +9 -31
  56. package/src/hooks/useSlideshowTabState.ts +6 -19
  57. package/src/hooks/useStudioContextValue.test.ts +6 -18
  58. package/src/hooks/useStudioContextValue.ts +5 -26
  59. package/src/index.ts +2 -1
  60. package/src/main.tsx +26 -0
  61. package/src/player/components/Timeline.tsx +1 -1
  62. package/src/player/lib/timelinePerformanceDiagnostics.test.ts +3 -2
  63. package/src/player/lib/timelinePerformanceDiagnostics.ts +1 -1
  64. package/src/utils/studioHelpers.ts +0 -7
  65. package/src/utils/studioUiPreferences.test.ts +10 -16
  66. package/src/utils/studioUiPreferences.ts +0 -16
  67. package/dist/assets/index-CxAu_Okg.css +0 -1
  68. package/dist/assets/index-DocJlW2v.js +0 -376
  69. package/src/components/StudioLeftSidebar.tsx +0 -207
  70. package/src/components/nle/TimelineResizeDivider.tsx +0 -101
  71. package/src/components/sidebar/LeftSidebar.storage.test.ts +0 -28
  72. package/src/components/sidebar/LeftSidebar.tsx +0 -348
  73. package/src/hooks/useInspectorSplitResize.ts +0 -51
  74. package/src/utils/fitPanels.test.ts +0 -164
  75. package/src/utils/fitPanels.ts +0 -151
@@ -1,51 +0,0 @@
1
- import { useCallback, useRef, useState, type PointerEvent as ReactPointerEvent } from "react";
2
-
3
- const MIN_INSPECTOR_SPLIT_PERCENT = 20;
4
- const MAX_INSPECTOR_SPLIT_PERCENT = 75;
5
-
6
- export function useInspectorSplitResize() {
7
- const [layersPanePercent, setLayersPanePercent] = useState(40);
8
- const splitContainerRef = useRef<HTMLDivElement>(null);
9
- const splitDragRef = useRef<{
10
- startY: number;
11
- startPercent: number;
12
- height: number;
13
- } | null>(null);
14
-
15
- const handleInspectorSplitResizeStart = useCallback(
16
- (event: ReactPointerEvent<HTMLDivElement>) => {
17
- event.preventDefault();
18
- event.currentTarget.setPointerCapture(event.pointerId);
19
- const height = splitContainerRef.current?.getBoundingClientRect().height ?? 0;
20
- splitDragRef.current = {
21
- startY: event.clientY,
22
- startPercent: layersPanePercent,
23
- height,
24
- };
25
- },
26
- [layersPanePercent],
27
- );
28
-
29
- const handleInspectorSplitResizeMove = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {
30
- const drag = splitDragRef.current;
31
- if (!drag || drag.height <= 0) return;
32
- const deltaPercent = ((event.clientY - drag.startY) / drag.height) * 100;
33
- const next = Math.min(
34
- MAX_INSPECTOR_SPLIT_PERCENT,
35
- Math.max(MIN_INSPECTOR_SPLIT_PERCENT, drag.startPercent + deltaPercent),
36
- );
37
- setLayersPanePercent(next);
38
- }, []);
39
-
40
- const handleInspectorSplitResizeEnd = useCallback(() => {
41
- splitDragRef.current = null;
42
- }, []);
43
-
44
- return {
45
- layersPanePercent,
46
- splitContainerRef,
47
- handleInspectorSplitResizeStart,
48
- handleInspectorSplitResizeMove,
49
- handleInspectorSplitResizeEnd,
50
- };
51
- }
@@ -1,164 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import {
3
- MIN_PREVIEW_H,
4
- MIN_PREVIEW_W,
5
- MIN_TIMELINE_H,
6
- RAIL_W,
7
- defaultPanelWidths,
8
- fitPanelWidths,
9
- fitTimelineHeight,
10
- } from "./fitPanels";
11
-
12
- function fitAt(viewportWidth: number) {
13
- return fitPanelWidths(viewportWidth, defaultPanelWidths(viewportWidth));
14
- }
15
-
16
- describe("defaultPanelWidths", () => {
17
- // Frozen literals, deliberately NOT compared against the live hook: the hook
18
- // now delegates here, so asserting against it would be circular and would
19
- // silently stop guarding the "wide windows are untouched" promise.
20
- it.each([
21
- [1680, 384, 424],
22
- [1512, 384, 424],
23
- [1280, 329, 364],
24
- ])("keeps %ipx identical to the pre-change defaults", (vw, left, right) => {
25
- expect(defaultPanelWidths(vw)).toEqual({ left, right });
26
- });
27
- });
28
-
29
- describe("fitPanelWidths", () => {
30
- it.each([1680, 1512, 1280])("leaves %ipx untouched by reconciliation", (vw) => {
31
- const preferred = defaultPanelWidths(vw);
32
- const fitted = fitPanelWidths(vw, preferred);
33
- expect(fitted.left).toBe(preferred.left);
34
- expect(fitted.right).toBe(preferred.right);
35
- expect(fitted.autoCollapseLeft).toBe(false);
36
- expect(fitted.autoCollapseRight).toBe(false);
37
- });
38
-
39
- it.each([1680, 1512, 1280, 1100, 960, 860, 760, 640, 560, 480])(
40
- "never starves the preview at %ipx",
41
- (vw) => {
42
- expect(fitAt(vw).preview).toBeGreaterThanOrEqual(MIN_PREVIEW_W);
43
- },
44
- );
45
-
46
- it("matches the projected preview widths from the plan", () => {
47
- const projected: Array<[number, number]> = [
48
- [1680, 866],
49
- [1512, 698],
50
- [1280, 581],
51
- [1100, 499],
52
- [960, 427],
53
- [860, 360],
54
- [760, 432],
55
- [640, 592],
56
- [560, 512],
57
- [480, 432],
58
- ];
59
- for (const [vw, preview] of projected) {
60
- expect({ vw, preview: fitAt(vw).preview }).toEqual({ vw, preview });
61
- }
62
- });
63
-
64
- it("fits everything at its minimum at exactly 860, the derived threshold", () => {
65
- const fitted = fitAt(860);
66
- expect(fitted).toMatchObject({
67
- left: 214,
68
- right: 280,
69
- preview: MIN_PREVIEW_W,
70
- autoCollapseLeft: false,
71
- });
72
- });
73
-
74
- it("rails the sidebar one pixel below the threshold", () => {
75
- expect(fitAt(860).autoCollapseLeft).toBe(false);
76
- expect(fitAt(859).autoCollapseLeft).toBe(true);
77
- expect(fitAt(859).left).toBe(RAIL_W);
78
- });
79
-
80
- it("hides the inspector one pixel below its own threshold", () => {
81
- expect(fitAt(700).autoCollapseRight).toBe(false);
82
- expect(fitAt(700).right).toBeGreaterThan(0);
83
- expect(fitAt(699).autoCollapseRight).toBe(true);
84
- expect(fitAt(699).right).toBe(0);
85
- });
86
-
87
- it("never drives an EXPANDED sidebar below its usable minimum", () => {
88
- // Guards the leftFloor/rightFloor split: the squeeze fallback may only reach
89
- // the rail width when the panel is actually railed.
90
- const fitted = fitPanelWidths(900, { left: 600, right: 600 });
91
- expect(fitted.left).toBeGreaterThanOrEqual(200);
92
- expect(fitted.right).toBeGreaterThanOrEqual(280);
93
- });
94
-
95
- it("caps a single panel at 40% of the window", () => {
96
- expect(fitPanelWidths(1600, { left: 900, right: 280 }).left).toBe(640);
97
- });
98
-
99
- it("lets the preview floor win when the cap alone is not enough", () => {
100
- // 40% of 1000 is 400, but 400 + 280 + 6 leaves the preview at 314.
101
- const fitted = fitPanelWidths(1000, { left: 900, right: 280 });
102
- expect(fitted.left).toBe(354);
103
- expect(fitted.preview).toBe(MIN_PREVIEW_W);
104
- });
105
-
106
- it("survives a viewport narrower than the preview floor alone", () => {
107
- const fitted = fitAt(300);
108
- expect(fitted.preview).toBeGreaterThanOrEqual(0);
109
- expect(Number.isNaN(fitted.preview)).toBe(false);
110
- expect(fitted.left).toBe(RAIL_W);
111
- });
112
-
113
- it("returns preferences untouched before the shell is measured", () => {
114
- const preferred = { left: 320, right: 400 };
115
- expect(fitPanelWidths(0, preferred)).toMatchObject({ ...preferred, preview: 0 });
116
- expect(fitPanelWidths(Number.NaN, preferred)).toMatchObject(preferred);
117
- });
118
-
119
- it("is idempotent, so a resize loop cannot oscillate", () => {
120
- for (const vw of [1512, 1100, 860, 760, 560]) {
121
- const once = fitPanelWidths(vw, defaultPanelWidths(vw));
122
- const twice = fitPanelWidths(vw, once);
123
- expect(twice).toEqual(once);
124
- }
125
- });
126
- });
127
-
128
- describe("fitTimelineHeight", () => {
129
- it("keeps a height that fits", () => {
130
- expect(fitTimelineHeight(717, 429)).toBe(429);
131
- });
132
-
133
- it("reclaims height for the preview when the shell shrinks", () => {
134
- // The measured bug: mounted at 760 tall, dragged to 520. Preview was 47px.
135
- expect(fitTimelineHeight(477, 429)).toBe(477 - MIN_PREVIEW_H);
136
- expect(477 - fitTimelineHeight(477, 429)).toBeGreaterThanOrEqual(MIN_PREVIEW_H);
137
- });
138
-
139
- it("raises a too-small preference to the timeline minimum", () => {
140
- expect(fitTimelineHeight(717, 10)).toBe(MIN_TIMELINE_H);
141
- });
142
-
143
- it("keeps the timeline usable when the shell is shorter than both minimums", () => {
144
- expect(fitTimelineHeight(120, 429)).toBe(MIN_TIMELINE_H);
145
- });
146
-
147
- it("returns the preference before the shell is measured", () => {
148
- expect(fitTimelineHeight(0, 429)).toBe(429);
149
- });
150
-
151
- it("is idempotent", () => {
152
- const once = fitTimelineHeight(477, 429);
153
- expect(fitTimelineHeight(477, once)).toBe(once);
154
- });
155
-
156
- it("would return the preferred height if callers kept one", () => {
157
- // The helper is preference-preserving; the vertical CALLER still stores the
158
- // clamped value, so a shrink-then-grow does not restore the old height the
159
- // way panel widths do. Tracked as a known asymmetry, not fixed here.
160
- const preferred = 429;
161
- expect(fitTimelineHeight(477, preferred)).toBe(277);
162
- expect(fitTimelineHeight(717, preferred)).toBe(429);
163
- });
164
- });
@@ -1,151 +0,0 @@
1
- /**
2
- * Panel reconciliation for the Studio shell.
3
- *
4
- * The shell is `[sidebar | preview | inspector]` over a full-width timeline.
5
- * Only the preview is flexible (`flex-1 min-w-0`), so without an explicit floor
6
- * it absorbs every squeeze: at a 560px window the old 240/320 panel floors alone
7
- * overflowed the viewport and the preview rendered at 2px, on a *fresh* load.
8
- * The same held vertically once the window was resized after mount.
9
- *
10
- * Every caller (mount, resize, drag, keyboard nudge, preference restore) routes
11
- * through {@link fitPanelWidths} / {@link fitTimelineHeight} so exactly one place
12
- * decides who yields. The rule is: the preview gets its floor first, panels
13
- * shrink toward their minimums, then collapse to rails.
14
- */
15
-
16
- /** Smallest preview box worth editing in. Chosen, not derived — see the plan. */
17
- export const MIN_PREVIEW_W = 360;
18
- export const MIN_PREVIEW_H = 200;
19
-
20
- const MIN_LEFT = 200;
21
- const MIN_RIGHT = 280;
22
- /**
23
- * Collapsed sidebar rail, as a layout FOOTPRINT: the `w-10` box (40) plus the
24
- * `mr-0.5` gap (2) it contributes to the flex row. Measured in the browser at a
25
- * 760px window: rail box 40, margin-right 2, preview starts at x=43.
26
- */
27
- export const RAIL_W = 42;
28
- export const MIN_TIMELINE_H = 100;
29
-
30
- /** The two 3px resize seams between the three top-row panels. */
31
- const PANEL_SEAM_W = 6;
32
-
33
- /** No single panel may claim more than this share of the window. */
34
- const PANEL_MAX_RATIO = 0.4;
35
-
36
- /*
37
- * Thresholds below are DERIVED from the minimums above, not chosen:
38
- *
39
- * MIN_LEFT 200 + MIN_RIGHT 280 + MIN_PREVIEW_W 360 + PANEL_SEAM_W 6 = 846
40
- * -> below ~860 the sidebar can no longer fit at its minimum.
41
- * RAIL_W 40 + MIN_RIGHT 280 + MIN_PREVIEW_W 360 + PANEL_SEAM_W 6 = 686
42
- * -> below ~700 the inspector can no longer fit either.
43
- *
44
- * Change a minimum and move the matching threshold with it.
45
- */
46
- const RAIL_LEFT_BELOW = 860;
47
- const RAIL_RIGHT_BELOW = 700;
48
-
49
- /**
50
- * True when the window is narrow enough to force at least one panel to a rail.
51
- * The sidebar threshold is the wider of the two, so it is the whole condition.
52
- */
53
- export function railsEngaged(viewportWidth: number): boolean {
54
- return viewportWidth < RAIL_LEFT_BELOW;
55
- }
56
-
57
- export interface PanelWidths {
58
- left: number;
59
- right: number;
60
- }
61
-
62
- export interface FittedPanelWidths extends PanelWidths {
63
- preview: number;
64
- /**
65
- * Width-driven collapse. Derived per render; NEVER persisted and never written
66
- * back to the user's own collapse preference — `leftCollapsed` lives in
67
- * localStorage and `rightCollapsed` is synced into the shareable Studio URL,
68
- * so a ten-second window drag must not rewrite either.
69
- */
70
- autoCollapseLeft: boolean;
71
- autoCollapseRight: boolean;
72
- }
73
-
74
- function clamp(value: number, min: number, max: number): number {
75
- return Math.max(min, Math.min(max, value));
76
- }
77
-
78
- /**
79
- * The width each panel wants on a given viewport, before reconciliation.
80
- * Upper bounds (384 / 424) are unchanged from the original implementation, which
81
- * is what keeps windows at or above 1280px byte-identical to before.
82
- */
83
- export function defaultPanelWidths(viewportWidth: number): PanelWidths {
84
- return {
85
- left: Math.max(MIN_LEFT, Math.min(384, Math.round(viewportWidth * 0.257))),
86
- right: Math.max(MIN_RIGHT, Math.min(424, Math.round(viewportWidth * 0.284))),
87
- };
88
- }
89
-
90
- /**
91
- * Resolve preferred panel widths against the viewport, reserving the preview.
92
- *
93
- * Order of yielding: window-relative cap, then the inspector shrinks toward its
94
- * minimum, then the sidebar, then rails. A viewport of 0 (element not measured
95
- * yet) returns the preferences untouched so a pre-measurement frame cannot
96
- * clobber a real preference.
97
- */
98
- // fallow-ignore-next-line complexity
99
- export function fitPanelWidths(
100
- viewportWidth: number,
101
- preferred: PanelWidths,
102
- /**
103
- * Sides the user explicitly reopened while the window was narrow. A side
104
- * listed here keeps its real width instead of the rail: without this the
105
- * panel would render expanded at 42px and squash its own content.
106
- */
107
- reopened: { left: boolean; right: boolean } = { left: false, right: false },
108
- ): FittedPanelWidths {
109
- const vw = Number.isFinite(viewportWidth) ? Math.max(0, viewportWidth) : 0;
110
- if (vw <= 0) {
111
- return { ...preferred, preview: 0, autoCollapseLeft: false, autoCollapseRight: false };
112
- }
113
-
114
- const autoCollapseLeft = vw < RAIL_LEFT_BELOW && !reopened.left;
115
- const autoCollapseRight = vw < RAIL_RIGHT_BELOW && !reopened.right;
116
- const cap = Math.floor(vw * PANEL_MAX_RATIO);
117
-
118
- // A railed panel's floor is its rail width; an open panel's floor is its
119
- // minimum usable width. Without this split the squeeze fallback below would
120
- // drive an *expanded* sidebar down to 40px and render its content unusable.
121
- const leftFloor = autoCollapseLeft ? RAIL_W : MIN_LEFT;
122
- const rightFloor = autoCollapseRight ? 0 : MIN_RIGHT;
123
-
124
- let left = autoCollapseLeft ? RAIL_W : clamp(preferred.left, MIN_LEFT, Math.max(MIN_LEFT, cap));
125
- let right = autoCollapseRight ? 0 : clamp(preferred.right, MIN_RIGHT, Math.max(MIN_RIGHT, cap));
126
-
127
- const budget = vw - MIN_PREVIEW_W - PANEL_SEAM_W;
128
- if (left + right > budget) right = Math.max(rightFloor, budget - left);
129
- if (left + right > budget) left = Math.max(leftFloor, budget - right);
130
-
131
- return {
132
- left,
133
- right,
134
- preview: Math.max(0, vw - left - right - PANEL_SEAM_W),
135
- autoCollapseLeft,
136
- autoCollapseRight,
137
- };
138
- }
139
-
140
- /**
141
- * Resolve a preferred timeline height against the shell's measured height.
142
- *
143
- * Subsumes the clamping that used to be inlined in TimelineResizeDivider's
144
- * pointer and keyboard handlers and duplicated (mount-only) in NLEContext.
145
- */
146
- export function fitTimelineHeight(containerHeight: number, preferred: number): number {
147
- const h = Number.isFinite(containerHeight) ? containerHeight : 0;
148
- const wanted = Number.isFinite(preferred) ? preferred : MIN_TIMELINE_H;
149
- if (h <= 0) return Math.max(MIN_TIMELINE_H, wanted);
150
- return clamp(wanted, MIN_TIMELINE_H, Math.max(MIN_TIMELINE_H, h - MIN_PREVIEW_H));
151
- }