@hyperframes/studio 0.7.107 → 0.7.108

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 (126) hide show
  1. package/dist/assets/{hyperframes-player-BLrfwq5o.js → hyperframes-player-QqavTWRK.js} +1 -1
  2. package/dist/assets/{index-BA9yhzfR.js → index-BQjXA1pz.js} +1 -1
  3. package/dist/assets/{index-BSBk5srs.js → index-BhHHMprP.js} +1 -1
  4. package/dist/assets/index-DNkh9mbV.css +1 -0
  5. package/dist/assets/index-GqONLcOl.js +428 -0
  6. package/dist/index.d.ts +85 -2
  7. package/dist/index.html +2 -2
  8. package/dist/index.js +17696 -12512
  9. package/dist/index.js.map +1 -1
  10. package/package.json +7 -7
  11. package/src/components/StudioRightPanel.tsx +18 -1
  12. package/src/components/TimelineToolbar.test.tsx +46 -0
  13. package/src/components/TimelineToolbar.tsx +17 -0
  14. package/src/components/editor/PropertyPanel.test.tsx +5 -1
  15. package/src/components/editor/PropertyPanel.tsx +7 -23
  16. package/src/components/editor/PropertyPanelFlat.tsx +25 -0
  17. package/src/components/editor/audioFxSummary.test.ts +75 -0
  18. package/src/components/editor/audioFxSummary.ts +36 -0
  19. package/src/components/editor/audioFxTelemetry.test.ts +129 -0
  20. package/src/components/editor/audioFxTelemetry.ts +230 -0
  21. package/src/components/editor/propertyPanelAudioFxGroup.test.tsx +1830 -0
  22. package/src/components/editor/propertyPanelAudioFxGroup.tsx +299 -0
  23. package/src/components/editor/propertyPanelAudioFxGroupUtils.ts +21 -0
  24. package/src/components/editor/propertyPanelAutomation.test.ts +60 -0
  25. package/src/components/editor/propertyPanelAutomation.ts +97 -0
  26. package/src/components/editor/propertyPanelFlatMediaSection.tsx +37 -9
  27. package/src/components/editor/propertyPanelFlatProps.ts +1 -0
  28. package/src/components/editor/propertyPanelFxAddMenu.tsx +209 -0
  29. package/src/components/editor/propertyPanelFxBandRuler.tsx +72 -0
  30. package/src/components/editor/propertyPanelFxCarveModule.tsx +382 -0
  31. package/src/components/editor/propertyPanelFxControls.test.tsx +115 -0
  32. package/src/components/editor/propertyPanelFxControls.tsx +356 -0
  33. package/src/components/editor/propertyPanelFxEqModule.tsx +196 -0
  34. package/src/components/editor/propertyPanelFxFamily.ts +83 -0
  35. package/src/components/editor/propertyPanelFxNodeOpenBody.tsx +269 -0
  36. package/src/components/editor/propertyPanelFxNodeParams.tsx +112 -0
  37. package/src/components/editor/propertyPanelFxNodeRow.tsx +339 -0
  38. package/src/components/editor/propertyPanelFxPresetMenu.tsx +159 -0
  39. package/src/components/editor/propertyPanelFxPresetRun.tsx +215 -0
  40. package/src/components/editor/propertyPanelFxPresetStyle.test.ts +142 -0
  41. package/src/components/editor/propertyPanelFxPresetStyle.ts +216 -0
  42. package/src/components/editor/propertyPanelFxRackChain.tsx +202 -0
  43. package/src/components/editor/propertyPanelFxSection.test.tsx +1747 -0
  44. package/src/components/editor/propertyPanelFxSection.tsx +550 -0
  45. package/src/components/editor/propertyPanelFxSectionTypes.ts +91 -0
  46. package/src/components/editor/propertyPanelTypes.ts +5 -0
  47. package/src/components/editor/useFxAudition.ts +95 -0
  48. package/src/components/editor/useFxCarve.ts +0 -0
  49. package/src/components/editor/useFxChainObserved.ts +83 -0
  50. package/src/components/editor/useFxLevelling.ts +235 -0
  51. package/src/components/editor/useVolumeAutomation.test.tsx +122 -0
  52. package/src/components/editor/useVolumeAutomation.ts +54 -0
  53. package/src/contexts/DomEditContext.tsx +11 -0
  54. package/src/hooks/useAppHotkeys.test.ts +198 -0
  55. package/src/hooks/useAppHotkeys.ts +30 -3
  56. package/src/hooks/useAutomationSelectionKeyboard.test.tsx +429 -0
  57. package/src/hooks/useAutomationSelectionKeyboard.ts +371 -0
  58. package/src/hooks/useDomEditAttributeCommits.ts +90 -10
  59. package/src/hooks/useDomEditCommits.test.tsx +38 -0
  60. package/src/hooks/useDomEditCommits.ts +2 -0
  61. package/src/hooks/useDomEditSession.ts +2 -0
  62. package/src/hooks/useDomEditTextCommits.ts +2 -0
  63. package/src/hooks/useElementLifecycleOps.ts +3 -0
  64. package/src/hooks/useLivePlayheadTime.ts +49 -0
  65. package/src/hooks/usePreviewPersistence.ts +7 -0
  66. package/src/hooks/useTimelineEditing.ts +3 -0
  67. package/src/player/components/AutomationSelectionMenu.tsx +76 -0
  68. package/src/player/components/AutomationValueInput.tsx +51 -0
  69. package/src/player/components/LayerDisclosureRow.tsx +5 -4
  70. package/src/player/components/Timeline.test.ts +84 -0
  71. package/src/player/components/TimelineAutomationLane.test.tsx +1720 -0
  72. package/src/player/components/TimelineAutomationLane.tsx +674 -0
  73. package/src/player/components/TimelineAutomationLaneSlot.test.tsx +193 -0
  74. package/src/player/components/TimelineLanes.test.tsx +24 -5
  75. package/src/player/components/TimelineLanes.tsx +142 -154
  76. package/src/player/components/TimelineTrackHeader.test.tsx +212 -1
  77. package/src/player/components/TimelineTrackHeader.tsx +166 -6
  78. package/src/player/components/TimelineTrackRow.tsx +8 -1
  79. package/src/player/components/automationClipboard.test.ts +94 -0
  80. package/src/player/components/automationClipboard.ts +136 -0
  81. package/src/player/components/automationGestureKeys.test.ts +49 -0
  82. package/src/player/components/automationGestureKeys.ts +49 -0
  83. package/src/player/components/automationLaneData.test.ts +270 -0
  84. package/src/player/components/automationLaneData.ts +258 -0
  85. package/src/player/components/automationLaneDragMath.ts +194 -0
  86. package/src/player/components/automationLaneGeometry.test.ts +239 -0
  87. package/src/player/components/automationLaneGeometry.ts +287 -0
  88. package/src/player/components/automationLaneHeight.ts +15 -0
  89. package/src/player/components/automationLanePointer.ts +20 -0
  90. package/src/player/components/automationLaneSelection.test.ts +183 -0
  91. package/src/player/components/automationLaneSelection.ts +135 -0
  92. package/src/player/components/automationShapes.test.ts +82 -0
  93. package/src/player/components/automationShapes.ts +70 -0
  94. package/src/player/components/automationSimplify.test.ts +48 -0
  95. package/src/player/components/automationSimplify.ts +51 -0
  96. package/src/player/components/timelineClipGestureHandlers.ts +223 -0
  97. package/src/player/components/timelineLaneProps.ts +19 -0
  98. package/src/player/components/timelineLayout.ts +11 -5
  99. package/src/player/components/useAutomationEdgeStretch.test.ts +27 -0
  100. package/src/player/components/useAutomationEdgeStretch.ts +269 -0
  101. package/src/player/components/useAutomationLaneGestures.ts +537 -0
  102. package/src/player/components/useAutomationLanes.test.tsx +112 -0
  103. package/src/player/components/useAutomationLanes.ts +170 -0
  104. package/src/player/components/useAutomationRangeDrag.ts +114 -0
  105. package/src/player/components/useTimelineTrackLayout.test.ts +107 -1
  106. package/src/player/components/useTimelineTrackLayout.ts +83 -7
  107. package/src/player/hooks/useExpandedTimelineElements.ts +7 -0
  108. package/src/player/hooks/useTimelinePlayer.ts +13 -1
  109. package/src/player/lib/automationStoreSync.test.ts +83 -0
  110. package/src/player/lib/automationStoreSync.ts +56 -0
  111. package/src/player/lib/timelineDOM.test.ts +33 -0
  112. package/src/player/lib/timelineDOM.ts +12 -0
  113. package/src/player/store/automationSelectionSlice.test.ts +30 -0
  114. package/src/player/store/automationSelectionSlice.ts +54 -0
  115. package/src/player/store/playerStore.test.ts +15 -0
  116. package/src/player/store/playerStore.ts +54 -65
  117. package/src/player/store/timelineElement.ts +78 -0
  118. package/src/styles/studio.css +89 -0
  119. package/src/telemetry/agentRuntime.test.ts +45 -0
  120. package/src/telemetry/agentRuntime.ts +62 -0
  121. package/src/telemetry/system.ts +8 -0
  122. package/src/utils/studioFileHistory.test.ts +49 -0
  123. package/src/utils/studioFileHistory.ts +17 -1
  124. package/src/utils/studioTelemetry.ts +16 -10
  125. package/dist/assets/index-dF-CmLZu.js +0 -428
  126. package/dist/assets/index-zQ4JFwwB.css +0 -1
@@ -0,0 +1,230 @@
1
+ /**
2
+ * What the audio FX rack reports about itself.
3
+ *
4
+ * One module rather than `trackStudioEvent` calls scattered through six
5
+ * components, for two reasons. The event names and property shapes have to
6
+ * agree across the panel or a dashboard cannot join them — and everything here
7
+ * is subject to one rule that is easy to break a callsite at a time:
8
+ *
9
+ * **Nothing user-authored leaves the browser.** Not element ids, not media
10
+ * filenames, not composition paths, not chain JSON. Every property below is
11
+ * either a fixed identifier from our own catalogue (a preset id, an effect
12
+ * type, a parameter key), a number, or a boolean. `studioTelemetry.ts` already
13
+ * strips the query string off `url_hash` for exactly this reason — the ids in
14
+ * it are the author's own. The rack sees the same class of data and must hold
15
+ * the same line.
16
+ *
17
+ * The second rule is about volume: **commit, not preview.** Every control in
18
+ * the rack has a preview path that fires continuously while a slider moves and
19
+ * a commit path that fires once when it is released. Only the commit path
20
+ * belongs here. Wiring a param event to the preview would emit tens of events
21
+ * per drag, which is both a cost and a lie — an author who nudges a knob and
22
+ * puts it back did not make thirty decisions.
23
+ */
24
+
25
+ import { trackStudioEvent } from "../../utils/studioTelemetry";
26
+ import type { HfAudioFxChain, HfAudioFxNode } from "@hyperframes/core/audio-fx";
27
+
28
+ /** Kept narrow deliberately — see the "nothing user-authored" rule above. */
29
+ type FxEventProperties = Record<string, string | number | boolean | null | undefined>;
30
+
31
+ function track(event: string, properties: FxEventProperties = {}): void {
32
+ trackStudioEvent(`audio_fx_${event}`, properties);
33
+ }
34
+
35
+ /** Where a node in the chain came from, as one word. */
36
+ export function nodeOrigin(node: HfAudioFxNode): string {
37
+ if (node.fromPreset) return "preset";
38
+ if (node.fromCarve) return "carve";
39
+ if (node.fromEq) return "eq";
40
+ if (node.fromLeveller) return "leveller";
41
+ return "hand";
42
+ }
43
+
44
+ /**
45
+ * A chain reduced to counts.
46
+ *
47
+ * Counts rather than contents: "four nodes, two of them from a preset" answers
48
+ * how the rack is used without shipping what the author built. The origin mix
49
+ * is the interesting half — it separates a chain somebody assembled by hand
50
+ * from one a preset wrote from one an analysis wrote.
51
+ */
52
+ export function chainShape(chain: HfAudioFxChain | null): FxEventProperties {
53
+ const nodes = chain?.nodes ?? [];
54
+ const byOrigin = new Map<string, number>();
55
+ for (const node of nodes) {
56
+ const origin = nodeOrigin(node);
57
+ byOrigin.set(origin, (byOrigin.get(origin) ?? 0) + 1);
58
+ }
59
+ return {
60
+ node_count: nodes.length,
61
+ nodes_from_preset: byOrigin.get("preset") ?? 0,
62
+ nodes_from_carve: byOrigin.get("carve") ?? 0,
63
+ nodes_from_eq: byOrigin.get("eq") ?? 0,
64
+ nodes_from_leveller: byOrigin.get("leveller") ?? 0,
65
+ nodes_by_hand: byOrigin.get("hand") ?? 0,
66
+ // How many distinct presets are live on this track. Stacking a character
67
+ // preset onto a cleaned voice is a supported thing to want, and this is the
68
+ // only way to find out whether anybody does it.
69
+ preset_count: new Set(nodes.map((n) => n.fromPreset).filter(Boolean)).size,
70
+ bypassed_count: nodes.filter((n) => n.enabled === false).length,
71
+ };
72
+ }
73
+
74
+ export interface FxTrackContext {
75
+ /** What the track reads as — `voice` / `music` / `sfx` / `unknown`. */
76
+ trackKind?: string;
77
+ }
78
+
79
+ const ctx = (c: FxTrackContext): FxEventProperties => ({ track_kind: c.trackKind ?? "unknown" });
80
+
81
+ // --- presets ---------------------------------------------------------------
82
+
83
+ export function trackPresetApplied(
84
+ presetId: string,
85
+ family: string,
86
+ nodeCount: number,
87
+ mode: "append" | "replace" | "reapply",
88
+ c: FxTrackContext,
89
+ ): void {
90
+ track("preset_applied", { preset: presetId, family, node_count: nodeCount, mode, ...ctx(c) });
91
+ }
92
+
93
+ export function trackPresetRemoved(presetId: string, c: FxTrackContext): void {
94
+ track("preset_removed", { preset: presetId, ...ctx(c) });
95
+ }
96
+
97
+ /** The whole-preset wet/dry knob, on release. `amount` is 0..1. */
98
+ export function trackPresetAmount(presetId: string, amount: number, c: FxTrackContext): void {
99
+ track("preset_amount", { preset: presetId, amount, ...ctx(c) });
100
+ }
101
+
102
+ export function trackPresetAutomated(presetId: string, on: boolean, c: FxTrackContext): void {
103
+ track("preset_automated", { preset: presetId, enabled: on, ...ctx(c) });
104
+ }
105
+
106
+ /**
107
+ * Hover-auditioning a preset from the shelf.
108
+ *
109
+ * Fired once per preset per time the shelf is opened, not once per hover: a
110
+ * pointer crossing the shelf passes over a dozen items in a second, and
111
+ * counting those would drown every other event in the feature and describe
112
+ * mouse travel rather than interest.
113
+ */
114
+ export function trackPresetAuditioned(presetId: string, c: FxTrackContext): void {
115
+ track("preset_auditioned", { preset: presetId, ...ctx(c) });
116
+ }
117
+
118
+ // --- nodes -----------------------------------------------------------------
119
+
120
+ /**
121
+ * `via` separates the two doors onto the same effect: a named job arrives
122
+ * already aimed at a frequency, a bare effect does not. Which one authors
123
+ * actually reach for is the question the jobs were built to answer.
124
+ */
125
+ export function trackNodeAdded(
126
+ type: string,
127
+ via: "job" | "effect" | "eq" | "leveller",
128
+ jobId: string | null,
129
+ c: FxTrackContext,
130
+ ): void {
131
+ track("node_added", { effect: type, via, job: jobId ?? "none", ...ctx(c) });
132
+ }
133
+
134
+ export function trackNodeRemoved(type: string, origin: string, c: FxTrackContext): void {
135
+ track("node_removed", { effect: type, origin, ...ctx(c) });
136
+ }
137
+
138
+ export function trackNodeBypassed(type: string, bypassed: boolean, c: FxTrackContext): void {
139
+ track("node_bypassed", { effect: type, bypassed, ...ctx(c) });
140
+ }
141
+
142
+ export function trackNodeMoved(type: string, direction: "up" | "down", c: FxTrackContext): void {
143
+ track("node_moved", { effect: type, direction, ...ctx(c) });
144
+ }
145
+
146
+ // --- parameters ------------------------------------------------------------
147
+
148
+ /**
149
+ * A committed parameter edit.
150
+ *
151
+ * `surface` is the point of the event. Every effect with a one-knob profile can
152
+ * be driven either by that derived knob or by opening Details and setting the
153
+ * mechanism directly, and the whole one-knob design rests on a claim about
154
+ * which one people use. Without this property the two are indistinguishable.
155
+ *
156
+ * The value goes too — a parameter key with no value tells you somebody touched
157
+ * "frequency" and not that every author lands on 80 Hz.
158
+ */
159
+ export function trackParamCommitted(
160
+ type: string,
161
+ param: string,
162
+ value: number | string,
163
+ surface: "knob" | "details",
164
+ c: FxTrackContext,
165
+ ): void {
166
+ track("param_committed", { effect: type, param, value, surface, ...ctx(c) });
167
+ }
168
+
169
+ /** The derived one-knob control, on release. `strength` is 0..1. */
170
+ export function trackProfileCommitted(type: string, strength: number, c: FxTrackContext): void {
171
+ track("profile_committed", { effect: type, strength, ...ctx(c) });
172
+ }
173
+
174
+ // --- the measuring modules -------------------------------------------------
175
+
176
+ export function trackCarveChanged(
177
+ action: "enabled" | "disabled" | "strength" | "sources",
178
+ props: { strength?: number; sourceCount?: number },
179
+ ): void {
180
+ track("carve_changed", {
181
+ action,
182
+ strength: props.strength,
183
+ source_count: props.sourceCount,
184
+ });
185
+ }
186
+
187
+ export function trackLeveller(action: "run" | "removed" | "auditioned"): void {
188
+ track("leveller", { action });
189
+ }
190
+
191
+ export function trackEqChanged(band: string, value: number): void {
192
+ track("eq_changed", { band, value });
193
+ }
194
+
195
+ // --- provenance ------------------------------------------------------------
196
+
197
+ /**
198
+ * What arrived on a composition that this session did not put there.
199
+ *
200
+ * This is how agent-applied effects become visible at all. An agent asked to
201
+ * fix a mix does not drive the panel — it edits the composition HTML, or runs
202
+ * `scripts/carve.mjs`, and the rack simply finds the result already present.
203
+ * None of the events above will ever fire for that work.
204
+ *
205
+ * So the panel reports the shape of what it was handed, and how many edits this
206
+ * session had made when it appeared. Fx that changed while the studio was open
207
+ * with `panel_edits` unmoved was written by something else — which, combined
208
+ * with `agent_runtime` on the same event, is as close to "an agent did this" as
209
+ * the browser can honestly get.
210
+ *
211
+ * `first_sight` distinguishes opening a composition that already had effects
212
+ * from watching effects appear in one that did not.
213
+ */
214
+ export function trackChainObserved(
215
+ chain: HfAudioFxChain | null,
216
+ props: { firstSight: boolean; panelEdits: number; hasCarve: boolean; hasAutomation: boolean },
217
+ c: FxTrackContext,
218
+ ): void {
219
+ track("chain_observed", {
220
+ ...chainShape(chain),
221
+ first_sight: props.firstSight,
222
+ panel_edits: props.panelEdits,
223
+ // The whole point: no panel edits behind a chain that is present or that
224
+ // just changed means the chain came from outside the studio.
225
+ authored_outside: props.panelEdits === 0,
226
+ has_carve: props.hasCarve,
227
+ has_automation: props.hasAutomation,
228
+ ...ctx(c),
229
+ });
230
+ }