@hyperframes/studio 0.7.71 → 0.7.73

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 (79) hide show
  1. package/dist/assets/{hyperframes-player-C1X90psg.js → hyperframes-player-DGlzhf_s.js} +1 -1
  2. package/dist/assets/index-B37rWXo4.css +1 -0
  3. package/dist/assets/{index-DzxDHPR1.js → index-CbVTOJ-E.js} +1 -1
  4. package/dist/assets/{index-nY4lLBqM.js → index-CcA5WVJv.js} +1 -1
  5. package/dist/assets/index-DXcLI2wu.js +428 -0
  6. package/dist/index.d.ts +8 -0
  7. package/dist/index.html +2 -2
  8. package/dist/index.js +7762 -4261
  9. package/dist/index.js.map +1 -1
  10. package/package.json +7 -7
  11. package/src/App.tsx +4 -4
  12. package/src/components/StudioLeftSidebar.tsx +2 -3
  13. package/src/components/StudioRightPanel.tsx +10 -4
  14. package/src/components/editor/AnimationCard.test.tsx +100 -0
  15. package/src/components/editor/AnimationCard.tsx +5 -2
  16. package/src/components/editor/EaseCurveSection.test.tsx +348 -0
  17. package/src/components/editor/EaseCurveSection.tsx +444 -237
  18. package/src/components/editor/EaseParamFields.test.tsx +188 -0
  19. package/src/components/editor/EaseParamFields.tsx +246 -0
  20. package/src/components/editor/PropertyPanel.test.tsx +9 -7
  21. package/src/components/editor/PropertyPanelFlat.tsx +75 -88
  22. package/src/components/editor/colorGradingFrameAnalysis.test.ts +101 -0
  23. package/src/components/editor/colorGradingFrameAnalysis.ts +203 -0
  24. package/src/components/editor/colorGradingScopePatch.test.ts +3 -3
  25. package/src/components/editor/easeCurveSvg.tsx +65 -0
  26. package/src/components/editor/easePresetLibrary.test.ts +114 -0
  27. package/src/components/editor/easePresetLibrary.ts +49 -0
  28. package/src/components/editor/gsapAnimationConstants.ts +15 -13
  29. package/src/components/editor/propertyPanelColorCurveGraph.tsx +549 -0
  30. package/src/components/editor/propertyPanelColorCurves.test.tsx +158 -0
  31. package/src/components/editor/propertyPanelColorCurves.tsx +185 -0
  32. package/src/components/editor/propertyPanelColorGradingControls.tsx +115 -77
  33. package/src/components/editor/propertyPanelColorScopes.tsx +258 -0
  34. package/src/components/editor/propertyPanelColorSecondary.test.tsx +181 -0
  35. package/src/components/editor/propertyPanelColorSecondary.tsx +448 -0
  36. package/src/components/editor/propertyPanelColorWheels.test.tsx +119 -0
  37. package/src/components/editor/propertyPanelColorWheels.tsx +334 -0
  38. package/src/components/editor/propertyPanelFlatColorGradingAccessory.tsx +109 -0
  39. package/src/components/editor/propertyPanelFlatColorGradingSection.test.tsx +239 -41
  40. package/src/components/editor/propertyPanelFlatColorGradingSection.tsx +260 -300
  41. package/src/components/editor/propertyPanelFlatEffectControl.tsx +96 -0
  42. package/src/components/editor/propertyPanelFlatEffectSpecs.ts +305 -0
  43. package/src/components/editor/propertyPanelFlatEffectsSection.test.tsx +331 -0
  44. package/src/components/editor/propertyPanelFlatEffectsSection.tsx +503 -0
  45. package/src/components/editor/propertyPanelFlatOverlaysSection.test.tsx +113 -0
  46. package/src/components/editor/propertyPanelFlatOverlaysSection.tsx +108 -0
  47. package/src/components/editor/propertyPanelFlatPrimitives.tsx +2 -0
  48. package/src/components/editor/propertyPanelGradingNumberField.test.tsx +79 -0
  49. package/src/components/editor/propertyPanelGradingNumberField.tsx +116 -0
  50. package/src/components/editor/propertyPanelPresetPreview.ts +36 -0
  51. package/src/components/editor/propertyPanelTypes.ts +13 -0
  52. package/src/components/editor/useColorGradingController.test.ts +331 -10
  53. package/src/components/editor/useColorGradingController.ts +57 -90
  54. package/src/components/editor/useColorGradingPreviews.ts +350 -0
  55. package/src/components/editor/useColorGradingScopes.test.tsx +143 -0
  56. package/src/components/editor/useColorGradingScopes.ts +62 -0
  57. package/src/components/editor/useInspectorGestureTransaction.ts +30 -1
  58. package/src/components/nle/NLEContext.tsx +1 -1
  59. package/src/contexts/PanelLayoutContext.tsx +3 -6
  60. package/src/hooks/useBlockCatalog.ts +31 -13
  61. package/src/hooks/useBlockHandlers.ts +22 -0
  62. package/src/hooks/useGsapScriptCommits.test.tsx +15 -0
  63. package/src/hooks/useGsapScriptCommits.ts +14 -1
  64. package/src/hooks/usePanelLayout.test.ts +68 -1
  65. package/src/hooks/usePanelLayout.ts +72 -34
  66. package/src/icons/SystemIcons.tsx +4 -0
  67. package/src/player/components/PlayerControls.tsx +68 -229
  68. package/src/player/components/ShortcutsPanel.tsx +2 -4
  69. package/src/player/components/SpeedMenu.tsx +1 -2
  70. package/src/telemetry/events.test.ts +9 -0
  71. package/src/telemetry/events.ts +5 -0
  72. package/src/utils/blockInstaller.test.ts +67 -0
  73. package/src/utils/blockInstaller.ts +162 -109
  74. package/src/utils/studioUiPreferences.test.ts +5 -0
  75. package/src/utils/studioUiPreferences.ts +8 -0
  76. package/dist/assets/index-CSCh2Vrp.js +0 -428
  77. package/dist/assets/index-Ceyz8Qt2.css +0 -1
  78. package/src/player/components/PlayerControls.test.ts +0 -20
  79. package/src/player/components/useSeekBarDrag.ts +0 -169
@@ -0,0 +1,65 @@
1
+ import { evaluateWiggleEase, parseWiggleEase } from "@hyperframes/core/wiggle-ease";
2
+ import { evaluateSpringEase, parseSpringBounce } from "@hyperframes/core/spring-ease";
3
+ import { resolveEaseCurveTuple } from "./gsapAnimationConstants";
4
+
5
+ export function sampledPath(
6
+ samples: number,
7
+ x: (progress: number) => number,
8
+ y: (value: number) => number,
9
+ evaluate: (progress: number) => number,
10
+ ): string {
11
+ return Array.from({ length: samples + 1 }, (_, index) => {
12
+ const progress = index / samples;
13
+ return `${index === 0 ? "M" : "L"}${x(progress)},${y(evaluate(progress))}`;
14
+ }).join(" ");
15
+ }
16
+
17
+ export function holdCurvePath(left: number, bottom: number, right: number, top: number): string {
18
+ return `M${left},${bottom} L${right},${bottom} L${right},${top}`;
19
+ }
20
+
21
+ export function MiniCurveSvg({
22
+ ease,
23
+ active,
24
+ size = 24,
25
+ }: {
26
+ ease: string;
27
+ active: boolean;
28
+ size?: number;
29
+ }) {
30
+ const springBounce = parseSpringBounce(ease);
31
+ const wiggle = parseWiggleEase(ease);
32
+ const curve = resolveEaseCurveTuple(ease);
33
+ const [x1, y1, x2, y2] = curve;
34
+ const s = size;
35
+ const p = size / 8;
36
+ const g = s - p * 2;
37
+ const sx = (px: number) => p + g * px;
38
+ const sy = (py: number) => s - p - g * py;
39
+ const d =
40
+ ease === "hold"
41
+ ? holdCurvePath(p, s - p, s - p, p)
42
+ : wiggle
43
+ ? sampledPath(64, sx, sy, (progress) =>
44
+ evaluateWiggleEase(progress, wiggle.wiggles, wiggle.type, wiggle.amplitude),
45
+ )
46
+ : springBounce !== null
47
+ ? sampledPath(
48
+ 24,
49
+ sx,
50
+ (value) => sy(value / 1.2),
51
+ (progress) => evaluateSpringEase(progress, springBounce),
52
+ )
53
+ : `M${p},${s - p} C${sx(x1)},${sy(y1)} ${sx(x2)},${sy(y2)} ${s - p},${p}`;
54
+ return (
55
+ <svg width={s} height={s} viewBox={`0 0 ${s} ${s}`}>
56
+ <path
57
+ d={d}
58
+ fill="none"
59
+ stroke={active ? "#3CE6AC" : "#737373"}
60
+ strokeWidth="1.5"
61
+ strokeLinecap="round"
62
+ />
63
+ </svg>
64
+ );
65
+ }
@@ -0,0 +1,114 @@
1
+ // Imports the parsers SOURCE (not the published subpath) so newly-added eases
2
+ // like circ.inOut resolve before the parsers dist is rebuilt.
3
+ import { SUPPORTED_EASES } from "../../../../parsers/src/gsapConstants";
4
+ import { parseSpringBounce } from "@hyperframes/core/spring-ease";
5
+ import { parseWiggleEase } from "@hyperframes/core/wiggle-ease";
6
+ import { describe, expect, it } from "vitest";
7
+ import { EASE_PRESETS, easePresetLabel } from "./easePresetLibrary";
8
+ import { resolveEaseCurveTuple } from "./gsapAnimationConstants";
9
+
10
+ const CUSTOM_EASE_PATTERN =
11
+ /^custom\(M0,0 C-?\d+(?:\.\d+)?,-?\d+(?:\.\d+)? -?\d+(?:\.\d+)?,-?\d+(?:\.\d+)? 1,1\)$/;
12
+
13
+ describe("EASE_PRESETS", () => {
14
+ it("contains the complete 32-preset Graphs library with unique fields", () => {
15
+ expect(EASE_PRESETS).toHaveLength(32);
16
+ expect(new Set(EASE_PRESETS.map(({ id }) => id))).toHaveLength(32);
17
+ expect(new Set(EASE_PRESETS.map(({ label }) => label))).toHaveLength(32);
18
+ expect(new Set(EASE_PRESETS.map(({ ease }) => ease))).toHaveLength(32);
19
+ });
20
+
21
+ it("preserves the required standard, Flow, and Bounce mappings", () => {
22
+ const easeByLabel = Object.fromEntries(EASE_PRESETS.map(({ label, ease }) => [label, ease]));
23
+
24
+ expect(easeByLabel).toMatchObject({
25
+ Linear: "none",
26
+ "Ease In": "power1.in",
27
+ "Quad In": "power2.in",
28
+ "Cubic In": "power3.in",
29
+ "Ease Out": "power1.out",
30
+ "Quad Out": "power2.out",
31
+ "Cubic Out": "power3.out",
32
+ "Ease In & Out": "power1.inOut",
33
+ "Quad Ease": "power2.inOut",
34
+ "Cubic Ease": "power3.inOut",
35
+ "Circular Ease": "circ.inOut",
36
+ "Ease In Back": "back.in",
37
+ "Ease Out Back": "back.out",
38
+ "Flow 1": "wiggle(1,easeInOut,0.20)",
39
+ "Flow 2": "wiggle(2,easeInOut,0.15)",
40
+ "Flow 3": "wiggle(3,easeInOut,0.12)",
41
+ "Flow 4": "wiggle(4,easeInOut,0.10)",
42
+ "Flow 5": "wiggle(5,easeInOut,0.08)",
43
+ "Flow 6": "wiggle(6,easeInOut,0.07)",
44
+ "Flow 7": "wiggle(7,easeInOut,0.06)",
45
+ "Bounce 1": "wiggle(4,easeOut,0.22)",
46
+ "Bounce 2": "wiggle(6,easeOut,0.26)",
47
+ "Bounce 3": "wiggle(9,uniform,0.32)",
48
+ "Bounce 4": "wiggle(5,anticipate,0.28)",
49
+ Hold: "hold",
50
+ });
51
+
52
+ const flows = EASE_PRESETS.filter(({ id }) => id.startsWith("flow-"));
53
+ expect(flows.map(({ label }) => label)).toEqual([
54
+ "Flow 1",
55
+ "Flow 2",
56
+ "Flow 3",
57
+ "Flow 4",
58
+ "Flow 5",
59
+ "Flow 6",
60
+ "Flow 7",
61
+ ]);
62
+ expect(flows.every(({ ease }) => parseWiggleEase(ease) !== null)).toBe(true);
63
+ });
64
+
65
+ it("uses supported or valid custom eases that all resolve to finite geometry", () => {
66
+ for (const preset of EASE_PRESETS) {
67
+ expect(
68
+ SUPPORTED_EASES.includes(preset.ease as (typeof SUPPORTED_EASES)[number]) ||
69
+ CUSTOM_EASE_PATTERN.test(preset.ease) ||
70
+ parseSpringBounce(preset.ease) !== null ||
71
+ parseWiggleEase(preset.ease) !== null,
72
+ `${preset.label} has unsupported ease ${preset.ease}`,
73
+ ).toBe(true);
74
+ expect(resolveEaseCurveTuple(preset.ease).every(Number.isFinite)).toBe(true);
75
+ }
76
+ });
77
+
78
+ it("assigns every preset a valid kind", () => {
79
+ const kinds = new Set(["curve", "spring", "wiggle"]);
80
+
81
+ for (const preset of EASE_PRESETS) {
82
+ expect(kinds.has(preset.kind)).toBe(true);
83
+ }
84
+ });
85
+
86
+ it("uses valid bounce values for spring presets", () => {
87
+ for (const preset of EASE_PRESETS.filter(({ kind }) => kind === "spring")) {
88
+ const bounce = parseSpringBounce(preset.ease);
89
+
90
+ expect(bounce).not.toBeNull();
91
+ expect(bounce).toBeGreaterThanOrEqual(0);
92
+ expect(bounce).toBeLessThanOrEqual(1);
93
+ }
94
+ });
95
+
96
+ it("uses parseable eases for wiggle presets", () => {
97
+ for (const preset of EASE_PRESETS.filter(({ kind }) => kind === "wiggle")) {
98
+ expect(parseWiggleEase(preset.ease)).not.toBeNull();
99
+ }
100
+ });
101
+
102
+ it("preserves stable preset ids", () => {
103
+ for (const id of ["flow-7", "hold", "rebound-in"]) {
104
+ expect(EASE_PRESETS.some((preset) => preset.id === id)).toBe(true);
105
+ }
106
+ });
107
+
108
+ it("resolves preset labels by exact ease", () => {
109
+ expect(easePresetLabel("spring(0.6)")).toBe("Bouncy");
110
+ expect(easePresetLabel("back.in")).toBe("Ease In Back");
111
+ expect(easePresetLabel("wiggle(9,uniform,0.32)")).toBe("Bounce 3");
112
+ expect(easePresetLabel("custom(x)")).toBeNull();
113
+ });
114
+ });
@@ -0,0 +1,49 @@
1
+ export const EASE_PRESETS = [
2
+ { id: "linear", label: "Linear", ease: "none", kind: "curve" },
3
+ { id: "ease-in", label: "Ease In", ease: "power1.in", kind: "curve" },
4
+ { id: "quad-in", label: "Quad In", ease: "power2.in", kind: "curve" },
5
+ { id: "cubic-in", label: "Cubic In", ease: "power3.in", kind: "curve" },
6
+ { id: "ease-out", label: "Ease Out", ease: "power1.out", kind: "curve" },
7
+ { id: "quad-out", label: "Quad Out", ease: "power2.out", kind: "curve" },
8
+ { id: "cubic-out", label: "Cubic Out", ease: "power3.out", kind: "curve" },
9
+ { id: "ease", label: "Ease In & Out", ease: "power1.inOut", kind: "curve" },
10
+ { id: "quad-ease", label: "Quad Ease", ease: "power2.inOut", kind: "curve" },
11
+ { id: "cubic-ease", label: "Cubic Ease", ease: "power3.inOut", kind: "curve" },
12
+ { id: "circular-ease", label: "Circular Ease", ease: "circ.inOut", kind: "curve" },
13
+ { id: "rebound-in", label: "Ease In Back", ease: "back.in", kind: "curve" },
14
+ { id: "rebound-out", label: "Ease Out Back", ease: "back.out", kind: "curve" },
15
+ { id: "flow-1", label: "Flow 1", ease: "wiggle(1,easeInOut,0.20)", kind: "wiggle" },
16
+ { id: "flow-2", label: "Flow 2", ease: "wiggle(2,easeInOut,0.15)", kind: "wiggle" },
17
+ { id: "flow-3", label: "Flow 3", ease: "wiggle(3,easeInOut,0.12)", kind: "wiggle" },
18
+ { id: "flow-4", label: "Flow 4", ease: "wiggle(4,easeInOut,0.10)", kind: "wiggle" },
19
+ { id: "flow-5", label: "Flow 5", ease: "wiggle(5,easeInOut,0.08)", kind: "wiggle" },
20
+ { id: "flow-6", label: "Flow 6", ease: "wiggle(6,easeInOut,0.07)", kind: "wiggle" },
21
+ { id: "flow-7", label: "Flow 7", ease: "wiggle(7,easeInOut,0.06)", kind: "wiggle" },
22
+ { id: "bounce-1", label: "Bounce 1", ease: "wiggle(4,easeOut,0.22)", kind: "wiggle" },
23
+ { id: "bounce-2", label: "Bounce 2", ease: "wiggle(6,easeOut,0.26)", kind: "wiggle" },
24
+ { id: "bounce-3", label: "Bounce 3", ease: "wiggle(9,uniform,0.32)", kind: "wiggle" },
25
+ { id: "bounce-4", label: "Bounce 4", ease: "wiggle(5,anticipate,0.28)", kind: "wiggle" },
26
+ { id: "hold", label: "Hold", ease: "hold", kind: "curve" },
27
+ {
28
+ id: "rebound-ease",
29
+ label: "Ease In & Out Back",
30
+ ease: "back.inOut",
31
+ kind: "curve",
32
+ },
33
+ { id: "expo-in", label: "Expo In", ease: "expo.in", kind: "curve" },
34
+ { id: "expo-out", label: "Expo Out", ease: "expo.out", kind: "curve" },
35
+ // Runtime spring(bounce) approximates Figma stiffness and damping with bounce alone.
36
+ { id: "spring-gentle", label: "Gentle", ease: "spring(0.15)", kind: "spring" },
37
+ { id: "spring-quick", label: "Quick", ease: "spring(0.4)", kind: "spring" },
38
+ { id: "spring-bouncy", label: "Bouncy", ease: "spring(0.6)", kind: "spring" },
39
+ { id: "spring-slow", label: "Slow", ease: "spring(0.25)", kind: "spring" },
40
+ ] as const satisfies ReadonlyArray<{
41
+ id: string;
42
+ label: string;
43
+ ease: string;
44
+ kind: "curve" | "spring" | "wiggle";
45
+ }>;
46
+
47
+ export function easePresetLabel(ease: string): string | null {
48
+ return EASE_PRESETS.find((preset) => preset.ease === ease)?.label ?? null;
49
+ }
@@ -1,4 +1,4 @@
1
- import { controlPointsForGsapEase } from "./studioMotion";
1
+ import { controlPointsForGsapEase, parseStudioCustomEaseData } from "./studioMotion";
2
2
 
3
3
  export const METHOD_LABELS: Record<string, string> = {
4
4
  set: "Set",
@@ -116,9 +116,14 @@ export const EASE_CURVES: Record<string, [number, number, number, number]> = {
116
116
  "back.out": [0.34, 1.56, 0.64, 1],
117
117
  "back.in": [0.36, 0, 0.66, -0.56],
118
118
  "back.inOut": [0.68, -0.55, 0.27, 1.55],
119
+ "circ.inOut": [0.785, 0.135, 0.15, 0.86],
119
120
  "expo.out": [0.16, 1, 0.3, 1],
120
121
  "expo.in": [0.7, 0, 0.84, 0],
121
122
  "expo.inOut": [0.87, 0, 0.13, 1],
123
+ "bounce.out": [0.34, 1.56, 0.64, 0.74],
124
+ "bounce.in": [0.36, 0.26, 0.66, -0.56],
125
+ "elastic.out(1,0.3)": [0.16, 1.45, 0.28, 0.82],
126
+ "elastic.inOut(1,0.3)": [0.68, -0.55, 0.32, 1.55],
122
127
  // After Effects polarity: "in" eases into the keyframe (slow END, CP2 y=1),
123
128
  // "out" eases out of it (slow START, CP1 y=0). Matches the "(AE)" labels.
124
129
  "ae-ease": [0.333, 0, 0.667, 1],
@@ -126,18 +131,15 @@ export const EASE_CURVES: Record<string, [number, number, number, number]> = {
126
131
  "ae-ease-out": [0.333, 0, 0.667, 0.667],
127
132
  };
128
133
 
129
- export function parseCustomEaseFromString(ease: string): {
130
- x1: number;
131
- y1: number;
132
- x2: number;
133
- y2: number;
134
- } {
135
- const match = ease.match(/^custom\((.+)\)$/);
136
- if (!match) return controlPointsForGsapEase("power2.out");
137
- const data = match[1];
138
- const nums = data.match(/[\d.]+/g)?.map(Number);
139
- if (!nums || nums.length < 6) return controlPointsForGsapEase("power2.out");
140
- return { x1: nums[2], y1: nums[3], x2: nums[4], y2: nums[5] };
134
+ export function resolveEaseCurveTuple(ease: string): [number, number, number, number] {
135
+ if (ease.startsWith("custom(")) {
136
+ const points = parseStudioCustomEaseData(ease.match(/^custom\((.+)\)$/)?.[1]);
137
+ if (points) return [points.x1, points.y1, points.x2, points.y2];
138
+ }
139
+ const curve = EASE_CURVES[ease];
140
+ if (curve) return curve;
141
+ const points = controlPointsForGsapEase(ease);
142
+ return [points.x1, points.y1, points.x2, points.y2];
141
143
  }
142
144
 
143
145
  export const PERCENT_PROPS = new Set(["opacity", "autoAlpha"]);