@hyperframes/studio 0.7.106 → 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.
- package/dist/assets/{hyperframes-player-CvVcx_CV.js → hyperframes-player-QqavTWRK.js} +1 -1
- package/dist/assets/{index-CRzCCuPH.js → index-BQjXA1pz.js} +1 -1
- package/dist/assets/{index-BbYg_isc.js → index-BhHHMprP.js} +1 -1
- package/dist/assets/index-DNkh9mbV.css +1 -0
- package/dist/assets/index-GqONLcOl.js +428 -0
- package/dist/{chunk-OBAG3GWK.js → chunk-AZYHQC6V.js} +6 -7
- package/dist/chunk-AZYHQC6V.js.map +1 -0
- package/dist/{domEditingLayers-AT7G6F4L.js → domEditingLayers-7AMZ7GFI.js} +4 -2
- package/dist/index.d.ts +86 -3
- package/dist/index.html +2 -2
- package/dist/index.js +24325 -17831
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/EditorShell.tsx +0 -2
- package/src/components/StudioErrorBoundary.test.tsx +97 -0
- package/src/components/StudioErrorBoundary.tsx +7 -0
- package/src/components/StudioOverlays.tsx +15 -13
- package/src/components/StudioRightPanel.tsx +18 -1
- package/src/components/TimelineToolbar.test.tsx +46 -0
- package/src/components/TimelineToolbar.tsx +17 -0
- package/src/components/editor/DomEditOverlay.tsx +36 -18
- package/src/components/editor/DomEditSelectionChrome.test.tsx +85 -0
- package/src/components/editor/DomEditSelectionChrome.tsx +29 -3
- package/src/components/editor/InlineTextToolbar.test.tsx +296 -0
- package/src/components/editor/InlineTextToolbar.tsx +281 -0
- package/src/components/editor/OffCanvasIndicators.tsx +38 -0
- package/src/components/editor/PropertyPanel.test.tsx +5 -1
- package/src/components/editor/PropertyPanel.tsx +7 -23
- package/src/components/editor/PropertyPanelFlat.tsx +25 -0
- package/src/components/editor/audioFxSummary.test.ts +75 -0
- package/src/components/editor/audioFxSummary.ts +36 -0
- package/src/components/editor/audioFxTelemetry.test.ts +129 -0
- package/src/components/editor/audioFxTelemetry.ts +230 -0
- package/src/components/editor/domEditInlineText.test.ts +86 -0
- package/src/components/editor/domEditInlineText.ts +99 -0
- package/src/components/editor/domEditInlineTextElement.test.ts +59 -0
- package/src/components/editor/domEditing.ts +1 -0
- package/src/components/editor/domEditingLayers.ts +7 -6
- package/src/components/editor/inlineTextStyleRange.test.ts +743 -0
- package/src/components/editor/inlineTextStyleRange.ts +593 -0
- package/src/components/editor/inlineTextStyleRead.ts +47 -0
- package/src/components/editor/propertyPanelAudioFxGroup.test.tsx +1830 -0
- package/src/components/editor/propertyPanelAudioFxGroup.tsx +299 -0
- package/src/components/editor/propertyPanelAudioFxGroupUtils.ts +21 -0
- package/src/components/editor/propertyPanelAutomation.test.ts +60 -0
- package/src/components/editor/propertyPanelAutomation.ts +97 -0
- package/src/components/editor/propertyPanelFlatMediaSection.tsx +37 -9
- package/src/components/editor/propertyPanelFlatProps.ts +1 -0
- package/src/components/editor/propertyPanelFxAddMenu.tsx +209 -0
- package/src/components/editor/propertyPanelFxBandRuler.tsx +72 -0
- package/src/components/editor/propertyPanelFxCarveModule.tsx +382 -0
- package/src/components/editor/propertyPanelFxControls.test.tsx +115 -0
- package/src/components/editor/propertyPanelFxControls.tsx +356 -0
- package/src/components/editor/propertyPanelFxEqModule.tsx +196 -0
- package/src/components/editor/propertyPanelFxFamily.ts +83 -0
- package/src/components/editor/propertyPanelFxNodeOpenBody.tsx +269 -0
- package/src/components/editor/propertyPanelFxNodeParams.tsx +112 -0
- package/src/components/editor/propertyPanelFxNodeRow.tsx +339 -0
- package/src/components/editor/propertyPanelFxPresetMenu.tsx +159 -0
- package/src/components/editor/propertyPanelFxPresetRun.tsx +215 -0
- package/src/components/editor/propertyPanelFxPresetStyle.test.ts +142 -0
- package/src/components/editor/propertyPanelFxPresetStyle.ts +216 -0
- package/src/components/editor/propertyPanelFxRackChain.tsx +202 -0
- package/src/components/editor/propertyPanelFxSection.test.tsx +1747 -0
- package/src/components/editor/propertyPanelFxSection.tsx +550 -0
- package/src/components/editor/propertyPanelFxSectionTypes.ts +91 -0
- package/src/components/editor/propertyPanelTypes.ts +5 -0
- package/src/components/editor/useDomEditNudge.ts +2 -2
- package/src/components/editor/useFxAudition.ts +95 -0
- package/src/components/editor/useFxCarve.ts +0 -0
- package/src/components/editor/useFxChainObserved.ts +83 -0
- package/src/components/editor/useFxLevelling.ts +235 -0
- package/src/components/editor/useInlineTextEditing.tsx +119 -0
- package/src/components/editor/useVolumeAutomation.test.tsx +122 -0
- package/src/components/editor/useVolumeAutomation.ts +54 -0
- package/src/components/feedback/CrashFeedbackPrompt.tsx +27 -0
- package/src/components/feedback/StudioFeedbackCard.tsx +373 -0
- package/src/components/feedback/feedbackTrigger.test.ts +168 -0
- package/src/components/feedback/feedbackTrigger.ts +269 -0
- package/src/components/feedback/projectProvenance.test.ts +120 -0
- package/src/components/feedback/projectProvenance.ts +83 -0
- package/src/components/renders/useRenderQueue.ts +62 -4
- package/src/components/storyboard/StoryboardFrameFocus.tsx +2 -2
- package/src/components/storyboard/StoryboardViewModeGuard.test.tsx +19 -2
- package/src/contexts/DomEditContext.tsx +15 -0
- package/src/hooks/domEditPersistFailure.ts +0 -7
- package/src/hooks/useAppHotkeys.test.ts +198 -0
- package/src/hooks/useAppHotkeys.ts +31 -4
- package/src/hooks/useAutomationSelectionKeyboard.test.tsx +429 -0
- package/src/hooks/useAutomationSelectionKeyboard.ts +371 -0
- package/src/hooks/useDomEditAttributeCommits.ts +90 -10
- package/src/hooks/useDomEditCommits.test.tsx +141 -21
- package/src/hooks/useDomEditCommits.ts +4 -0
- package/src/hooks/useDomEditSession.ts +4 -0
- package/src/hooks/useDomEditTextCommits.ts +112 -11
- package/src/hooks/useElementLifecycleOps.ts +3 -0
- package/src/hooks/useFileTree.ts +8 -3
- package/src/hooks/useInlineTextEdit.test.tsx +555 -0
- package/src/hooks/useInlineTextEdit.ts +320 -0
- package/src/hooks/useLivePlayheadTime.ts +49 -0
- package/src/hooks/usePreviewPersistence.ts +7 -0
- package/src/hooks/useTimelineEditing.ts +3 -0
- package/src/player/components/AutomationSelectionMenu.tsx +76 -0
- package/src/player/components/AutomationValueInput.tsx +51 -0
- package/src/player/components/LayerDisclosureRow.tsx +5 -4
- package/src/player/components/Timeline.test.ts +84 -0
- package/src/player/components/TimelineAutomationLane.test.tsx +1720 -0
- package/src/player/components/TimelineAutomationLane.tsx +674 -0
- package/src/player/components/TimelineAutomationLaneSlot.test.tsx +193 -0
- package/src/player/components/TimelineLanes.test.tsx +24 -5
- package/src/player/components/TimelineLanes.tsx +142 -154
- package/src/player/components/TimelineTrackHeader.test.tsx +212 -1
- package/src/player/components/TimelineTrackHeader.tsx +166 -6
- package/src/player/components/TimelineTrackRow.tsx +8 -1
- package/src/player/components/automationClipboard.test.ts +94 -0
- package/src/player/components/automationClipboard.ts +136 -0
- package/src/player/components/automationGestureKeys.test.ts +49 -0
- package/src/player/components/automationGestureKeys.ts +49 -0
- package/src/player/components/automationLaneData.test.ts +270 -0
- package/src/player/components/automationLaneData.ts +258 -0
- package/src/player/components/automationLaneDragMath.ts +194 -0
- package/src/player/components/automationLaneGeometry.test.ts +239 -0
- package/src/player/components/automationLaneGeometry.ts +287 -0
- package/src/player/components/automationLaneHeight.ts +15 -0
- package/src/player/components/automationLanePointer.ts +20 -0
- package/src/player/components/automationLaneSelection.test.ts +183 -0
- package/src/player/components/automationLaneSelection.ts +135 -0
- package/src/player/components/automationShapes.test.ts +82 -0
- package/src/player/components/automationShapes.ts +70 -0
- package/src/player/components/automationSimplify.test.ts +48 -0
- package/src/player/components/automationSimplify.ts +51 -0
- package/src/player/components/timelineClipGestureHandlers.ts +223 -0
- package/src/player/components/timelineLaneProps.ts +19 -0
- package/src/player/components/timelineLayout.ts +11 -5
- package/src/player/components/useAutomationEdgeStretch.test.ts +27 -0
- package/src/player/components/useAutomationEdgeStretch.ts +269 -0
- package/src/player/components/useAutomationLaneGestures.ts +537 -0
- package/src/player/components/useAutomationLanes.test.tsx +112 -0
- package/src/player/components/useAutomationLanes.ts +170 -0
- package/src/player/components/useAutomationRangeDrag.ts +114 -0
- package/src/player/components/useTimelineTrackLayout.test.ts +107 -1
- package/src/player/components/useTimelineTrackLayout.ts +83 -7
- package/src/player/hooks/useExpandedTimelineElements.ts +7 -0
- package/src/player/hooks/useTimelinePlayer.ts +13 -1
- package/src/player/lib/automationStoreSync.test.ts +83 -0
- package/src/player/lib/automationStoreSync.ts +56 -0
- package/src/player/lib/playbackShortcuts.ts +5 -4
- package/src/player/lib/timelineDOM.test.ts +33 -0
- package/src/player/lib/timelineDOM.ts +12 -0
- package/src/player/store/automationSelectionSlice.test.ts +30 -0
- package/src/player/store/automationSelectionSlice.ts +54 -0
- package/src/player/store/playerStore.test.ts +15 -0
- package/src/player/store/playerStore.ts +54 -65
- package/src/player/store/timelineElement.ts +78 -0
- package/src/styles/studio.css +89 -0
- package/src/telemetry/agentRuntime.test.ts +45 -0
- package/src/telemetry/agentRuntime.ts +62 -0
- package/src/telemetry/breadcrumbs.test.ts +68 -0
- package/src/telemetry/breadcrumbs.ts +70 -0
- package/src/telemetry/client.ts +5 -0
- package/src/telemetry/events.ts +84 -3
- package/src/telemetry/system.ts +8 -0
- package/src/utils/sourcePatcher.ts +5 -1
- package/src/utils/studioFileHistory.test.ts +49 -0
- package/src/utils/studioFileHistory.ts +17 -1
- package/src/utils/studioHelpers.ts +2 -5
- package/src/utils/studioTelemetry.ts +16 -10
- package/src/utils/timelineDiscovery.ts +3 -24
- package/src/utils/typingTarget.test.ts +54 -0
- package/src/utils/typingTarget.ts +43 -0
- package/dist/assets/index-DerI0ikN.js +0 -428
- package/dist/assets/index-tBPidglp.css +0 -1
- package/dist/chunk-OBAG3GWK.js.map +0 -1
- package/src/components/StudioFeedbackBar.tsx +0 -217
- /package/dist/{domEditingLayers-AT7G6F4L.js.map → domEditingLayers-7AMZ7GFI.js.map} +0 -0
|
@@ -6,6 +6,7 @@ import { slugifyDesignInput } from "../../utils/designInputTracking";
|
|
|
6
6
|
import { isTextEditableSelection } from "./domEditing";
|
|
7
7
|
import type { PropertyPanelFlatProps } from "./propertyPanelFlatProps";
|
|
8
8
|
import { formatPxMetricValue } from "./propertyPanelHelpers";
|
|
9
|
+
import { audioFxSummary } from "./audioFxSummary";
|
|
9
10
|
import { PropertyPanelFlatHeader } from "./PropertyPanelFlatHeader";
|
|
10
11
|
import { PropertyPanelFlatFooter } from "./PropertyPanelFlatFooter";
|
|
11
12
|
import { FlatGroupHeader } from "./propertyPanelFlatPrimitives";
|
|
@@ -13,6 +14,9 @@ import { FlatTextSection } from "./propertyPanelFlatTextSection";
|
|
|
13
14
|
import { FlatStyleSection } from "./propertyPanelFlatStyleSections";
|
|
14
15
|
import { FlatLayoutSection } from "./propertyPanelFlatLayoutSection";
|
|
15
16
|
import { FlatMotionSection } from "./propertyPanelFlatMotionSection";
|
|
17
|
+
import { isCanaryEnabled } from "../../telemetry/canary";
|
|
18
|
+
import { AudioFxGroup } from "./propertyPanelAudioFxGroup.js";
|
|
19
|
+
import { useVolumeAutomation } from "./useVolumeAutomation";
|
|
16
20
|
import { FlatMediaSection } from "./propertyPanelFlatMediaSection";
|
|
17
21
|
import { deriveElementTiming } from "./propertyPanelFlatTimingDerivation";
|
|
18
22
|
import { createGsapLivePreview } from "./gsapLivePreview";
|
|
@@ -64,6 +68,7 @@ export function PropertyPanelFlat({
|
|
|
64
68
|
onSetAttribute,
|
|
65
69
|
onSetAttributes,
|
|
66
70
|
onSetAttributeLive,
|
|
71
|
+
onSetAttributeQuiet,
|
|
67
72
|
onApplyColorGradingScope,
|
|
68
73
|
onSetHtmlAttribute,
|
|
69
74
|
onRemoveBackground,
|
|
@@ -252,6 +257,8 @@ export function PropertyPanelFlat({
|
|
|
252
257
|
const showMotionEffects = gsapEffectHandlers !== null;
|
|
253
258
|
const showMotionGroup = showMotionTiming || showMotionEffects;
|
|
254
259
|
|
|
260
|
+
const volumeAutomation = useVolumeAutomation(element, onSetAttributeQuiet ?? onSetAttributeLive);
|
|
261
|
+
|
|
255
262
|
const groups: FlatGroupDescriptor[] = [];
|
|
256
263
|
if (isTextEditable) {
|
|
257
264
|
groups.push({
|
|
@@ -420,6 +427,23 @@ export function PropertyPanelFlat({
|
|
|
420
427
|
});
|
|
421
428
|
}
|
|
422
429
|
}
|
|
430
|
+
// Behind `audio-fx-rack`, at 0%. Gates the AUTHORING surface only: the runtime
|
|
431
|
+
// and render still honour a `data-fx-chain` already on an element, so a
|
|
432
|
+
// composition written through the skill does not go silently dry off-cohort.
|
|
433
|
+
if (sections.audioFx && isCanaryEnabled("audio-fx-rack")) {
|
|
434
|
+
groups.push({
|
|
435
|
+
id: "audio-fx",
|
|
436
|
+
title: "Audio FX",
|
|
437
|
+
summary: audioFxSummary(element),
|
|
438
|
+
content: (
|
|
439
|
+
<AudioFxGroup
|
|
440
|
+
element={element}
|
|
441
|
+
onSetAttributeQuiet={onSetAttributeQuiet ?? onSetAttributeLive}
|
|
442
|
+
onSetAttributeLive={onSetAttributeLive}
|
|
443
|
+
/>
|
|
444
|
+
),
|
|
445
|
+
});
|
|
446
|
+
}
|
|
423
447
|
if (sections.media) {
|
|
424
448
|
groups.push({
|
|
425
449
|
id: "media",
|
|
@@ -434,6 +458,7 @@ export function PropertyPanelFlat({
|
|
|
434
458
|
onSetAttribute={onSetAttribute}
|
|
435
459
|
onSetHtmlAttribute={onSetHtmlAttribute}
|
|
436
460
|
onRemoveBackground={onRemoveBackground}
|
|
461
|
+
{...volumeAutomation}
|
|
437
462
|
/>
|
|
438
463
|
),
|
|
439
464
|
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { audioFxSummary } from "./audioFxSummary";
|
|
3
|
+
import type { DomEditSelection } from "./domEditingTypes";
|
|
4
|
+
|
|
5
|
+
const el = (dataAttributes: Record<string, string>): DomEditSelection =>
|
|
6
|
+
({ dataAttributes }) as unknown as DomEditSelection;
|
|
7
|
+
|
|
8
|
+
const chain = (nodes: unknown[]) => JSON.stringify({ version: 1, nodes });
|
|
9
|
+
|
|
10
|
+
describe("audioFxSummary", () => {
|
|
11
|
+
it("counts a carve as one module, not as the filters behind it", () => {
|
|
12
|
+
// Six bands and a level stage reading "7 effects" is the misreading the
|
|
13
|
+
// grouping exists to prevent.
|
|
14
|
+
const summary = audioFxSummary(
|
|
15
|
+
el({
|
|
16
|
+
"fx-chain": chain([
|
|
17
|
+
{ type: "peaking", id: "n1", fromCarve: true, params: { frequency: 400 } },
|
|
18
|
+
{ type: "peaking", id: "n2", fromCarve: true, params: { frequency: 1600 } },
|
|
19
|
+
{ type: "gain", id: "n3", fromCarve: true, params: { gain: -6 } },
|
|
20
|
+
]),
|
|
21
|
+
"fx-carve": JSON.stringify({ source: "vo", strength: 0.25 }),
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
24
|
+
expect(summary).toBe("carve");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("counts hand-built effects alongside the module", () => {
|
|
28
|
+
expect(
|
|
29
|
+
audioFxSummary(
|
|
30
|
+
el({
|
|
31
|
+
"fx-chain": chain([
|
|
32
|
+
{ type: "peaking", id: "n1", fromCarve: true, params: { frequency: 400 } },
|
|
33
|
+
{ type: "lowpass", id: "n2", params: { frequency: 8000 } },
|
|
34
|
+
{ type: "delay", id: "n3", params: { time: 200 } },
|
|
35
|
+
]),
|
|
36
|
+
}),
|
|
37
|
+
),
|
|
38
|
+
).toBe("2 effects + carve");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("says how many when there is no carve", () => {
|
|
42
|
+
expect(audioFxSummary(el({ "fx-chain": chain([{ type: "lowpass", id: "n1" }]) }))).toBe(
|
|
43
|
+
"1 effect",
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("names a carve that is on but has not compiled to filters yet", () => {
|
|
48
|
+
// Switching it on with no voice chosen leaves the control in this section with
|
|
49
|
+
// nothing behind it; the summary should still say the section holds one.
|
|
50
|
+
expect(audioFxSummary(el({ "fx-carve": JSON.stringify({ source: "", strength: 0.25 }) }))).toBe(
|
|
51
|
+
"carve",
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("ignores bypassed effects, as it always did", () => {
|
|
56
|
+
expect(
|
|
57
|
+
audioFxSummary(
|
|
58
|
+
el({
|
|
59
|
+
"fx-chain": chain([
|
|
60
|
+
{ type: "lowpass", id: "n1", enabled: false },
|
|
61
|
+
{ type: "delay", id: "n2" },
|
|
62
|
+
]),
|
|
63
|
+
}),
|
|
64
|
+
),
|
|
65
|
+
).toBe("1 effect");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("says none for a track with neither", () => {
|
|
69
|
+
expect(audioFxSummary(el({}))).toBe("none");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("says so when the chain cannot be read", () => {
|
|
73
|
+
expect(audioFxSummary(el({ "fx-chain": "{not json" }))).toBe("unreadable");
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the collapsed Audio FX group says it holds.
|
|
3
|
+
*
|
|
4
|
+
* It has to describe the rack the author would see on opening it, which counts a
|
|
5
|
+
* carve as one module rather than as the filters it compiles to. Six peaking
|
|
6
|
+
* bands and a level stage reading "7 effects" invited exactly the misreading the
|
|
7
|
+
* grouping exists to prevent — that they are seven things to manage.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { HF_AUDIO_FX_DATA_KEY, parseAudioFxChain } from "@hyperframes/core/audio-fx";
|
|
11
|
+
import type { DomEditSelection } from "./domEditingTypes";
|
|
12
|
+
|
|
13
|
+
export function audioFxSummary(element: DomEditSelection): string {
|
|
14
|
+
const raw = element.dataAttributes?.[HF_AUDIO_FX_DATA_KEY];
|
|
15
|
+
const carveAttr = element.dataAttributes?.["fx-carve"];
|
|
16
|
+
let handBuilt = 0;
|
|
17
|
+
let carveNodes = 0;
|
|
18
|
+
if (raw) {
|
|
19
|
+
try {
|
|
20
|
+
for (const node of parseAudioFxChain(raw).nodes) {
|
|
21
|
+
if (node.enabled === false) continue;
|
|
22
|
+
if (node.fromCarve) carveNodes += 1;
|
|
23
|
+
else handBuilt += 1;
|
|
24
|
+
}
|
|
25
|
+
} catch {
|
|
26
|
+
return "unreadable";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const parts: string[] = [];
|
|
30
|
+
if (handBuilt > 0) parts.push(`${handBuilt} effect${handBuilt === 1 ? "" : "s"}`);
|
|
31
|
+
// One name for the module however many filters are behind it. Named when the
|
|
32
|
+
// carve is switched on at all, because the control is in this section whether or
|
|
33
|
+
// not it has compiled to anything yet.
|
|
34
|
+
if (carveNodes > 0 || carveAttr) parts.push("carve");
|
|
35
|
+
return parts.length > 0 ? parts.join(" + ") : "none";
|
|
36
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it, vi, beforeEach } from "vitest";
|
|
4
|
+
import type { HfAudioFxChain } from "@hyperframes/core/audio-fx";
|
|
5
|
+
|
|
6
|
+
const trackStudioEvent = vi.fn();
|
|
7
|
+
vi.mock("../../utils/studioTelemetry", () => ({
|
|
8
|
+
trackStudioEvent: (...args: unknown[]) => trackStudioEvent(...args),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
const { chainShape, nodeOrigin, trackChainObserved, trackParamCommitted, trackPresetApplied } =
|
|
12
|
+
await import("./audioFxTelemetry");
|
|
13
|
+
|
|
14
|
+
beforeEach(() => trackStudioEvent.mockReset());
|
|
15
|
+
|
|
16
|
+
const chainOf = (nodes: HfAudioFxChain["nodes"]): HfAudioFxChain => ({ version: 1, nodes });
|
|
17
|
+
|
|
18
|
+
describe("what the rack reports", () => {
|
|
19
|
+
it("namespaces every event so the feature can be found as one thing", () => {
|
|
20
|
+
trackPresetApplied("voice-clean", "voice", 5, "append", { trackKind: "voice" });
|
|
21
|
+
expect(trackStudioEvent).toHaveBeenCalledWith("audio_fx_preset_applied", expect.anything());
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("carries what the track is, so a preset's use can be read per material", () => {
|
|
25
|
+
trackPresetApplied("telephone", "character", 7, "append", { trackKind: "music" });
|
|
26
|
+
expect(trackStudioEvent.mock.calls[0]?.[1]).toMatchObject({
|
|
27
|
+
preset: "telephone",
|
|
28
|
+
family: "character",
|
|
29
|
+
track_kind: "music",
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("says 'unknown' rather than nothing when the track is unclassified", () => {
|
|
34
|
+
// Absent and "unclassified" are different facts; encoding them the same way
|
|
35
|
+
// is what makes a breakdown read as a gap that is not there.
|
|
36
|
+
trackPresetApplied("hall", "space", 1, "append", {});
|
|
37
|
+
expect(trackStudioEvent.mock.calls[0]?.[1]).toMatchObject({ track_kind: "unknown" });
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("separates the two surfaces a parameter can be set from", () => {
|
|
41
|
+
// The whole one-knob design rests on which of these people use.
|
|
42
|
+
trackParamCommitted("compressor", "ratio", 4, "details", {});
|
|
43
|
+
expect(trackStudioEvent.mock.calls[0]?.[1]).toMatchObject({
|
|
44
|
+
effect: "compressor",
|
|
45
|
+
param: "ratio",
|
|
46
|
+
value: 4,
|
|
47
|
+
surface: "details",
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("a chain reduced to counts", () => {
|
|
53
|
+
it("names where each node came from", () => {
|
|
54
|
+
expect(nodeOrigin({ type: "peaking", fromPreset: "voice-clean" })).toBe("preset");
|
|
55
|
+
expect(nodeOrigin({ type: "peaking", fromCarve: true })).toBe("carve");
|
|
56
|
+
expect(nodeOrigin({ type: "gain", fromLeveller: true })).toBe("leveller");
|
|
57
|
+
expect(nodeOrigin({ type: "highpass" })).toBe("hand");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("counts by origin, which is what separates hand-built from generated", () => {
|
|
61
|
+
const shape = chainShape(
|
|
62
|
+
chainOf([
|
|
63
|
+
{ type: "highpass", fromPreset: "voice-clean" },
|
|
64
|
+
{ type: "peaking", fromPreset: "voice-clean" },
|
|
65
|
+
{ type: "peaking", fromCarve: true },
|
|
66
|
+
{ type: "lowpass" },
|
|
67
|
+
]),
|
|
68
|
+
);
|
|
69
|
+
expect(shape).toMatchObject({
|
|
70
|
+
node_count: 4,
|
|
71
|
+
nodes_from_preset: 2,
|
|
72
|
+
nodes_from_carve: 1,
|
|
73
|
+
nodes_by_hand: 1,
|
|
74
|
+
preset_count: 1,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("counts distinct presets, not preset nodes — stacking is the question", () => {
|
|
79
|
+
const shape = chainShape(
|
|
80
|
+
chainOf([
|
|
81
|
+
{ type: "highpass", fromPreset: "voice-clean" },
|
|
82
|
+
{ type: "lowpass", fromPreset: "telephone" },
|
|
83
|
+
{ type: "peaking", fromPreset: "telephone" },
|
|
84
|
+
]),
|
|
85
|
+
);
|
|
86
|
+
expect(shape.preset_count).toBe(2);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("survives an empty or absent chain", () => {
|
|
90
|
+
expect(chainShape(null)).toMatchObject({ node_count: 0, preset_count: 0 });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("ships no chain contents — only counts and flags", () => {
|
|
94
|
+
// The standing rule: nothing user-authored leaves the browser. A parameter
|
|
95
|
+
// value or an element id in here would be the author's own data.
|
|
96
|
+
const shape = chainShape(chainOf([{ type: "peaking", id: "n1", params: { frequency: 3000 } }]));
|
|
97
|
+
const serialized = JSON.stringify(shape);
|
|
98
|
+
expect(serialized).not.toContain("3000");
|
|
99
|
+
expect(serialized).not.toContain("n1");
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe("effects this session did not apply", () => {
|
|
104
|
+
it("calls a chain with no panel edits behind it authored outside", () => {
|
|
105
|
+
// This is the agent signal. An agent edits the composition and the panel
|
|
106
|
+
// simply finds the work done — none of its own events ever fire.
|
|
107
|
+
trackChainObserved(
|
|
108
|
+
chainOf([{ type: "highpass", fromPreset: "voice-clean" }]),
|
|
109
|
+
{ firstSight: true, panelEdits: 0, hasCarve: false, hasAutomation: false },
|
|
110
|
+
{ trackKind: "voice" },
|
|
111
|
+
);
|
|
112
|
+
expect(trackStudioEvent).toHaveBeenCalledWith(
|
|
113
|
+
"audio_fx_chain_observed",
|
|
114
|
+
expect.objectContaining({ authored_outside: true, first_sight: true }),
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("does not, when this session's own edits explain it", () => {
|
|
119
|
+
trackChainObserved(
|
|
120
|
+
chainOf([{ type: "highpass" }]),
|
|
121
|
+
{ firstSight: false, panelEdits: 3, hasCarve: false, hasAutomation: false },
|
|
122
|
+
{},
|
|
123
|
+
);
|
|
124
|
+
expect(trackStudioEvent.mock.calls[0]?.[1]).toMatchObject({
|
|
125
|
+
authored_outside: false,
|
|
126
|
+
panel_edits: 3,
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it, vi } from "vitest";
|
|
4
|
+
import type { DomEditSelection, DomEditTextField } from "./domEditingTypes";
|
|
5
|
+
|
|
6
|
+
const editable = vi.hoisted(() => ({ current: true }));
|
|
7
|
+
vi.mock("./domEditingLayers", () => ({
|
|
8
|
+
isTextEditableSelection: () => editable.current,
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
const { canEditTextInline, isDoublePress } = await import("./domEditInlineText");
|
|
12
|
+
|
|
13
|
+
function field(key: string): DomEditTextField {
|
|
14
|
+
return {
|
|
15
|
+
key,
|
|
16
|
+
label: key,
|
|
17
|
+
value: "text",
|
|
18
|
+
tagName: "SPAN",
|
|
19
|
+
attributes: [],
|
|
20
|
+
inlineStyles: {},
|
|
21
|
+
computedStyles: {},
|
|
22
|
+
source: "self",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function selection(partial: Partial<DomEditSelection> = {}): DomEditSelection {
|
|
27
|
+
return {
|
|
28
|
+
label: "Heading",
|
|
29
|
+
tagName: "H1",
|
|
30
|
+
isCompositionHost: false,
|
|
31
|
+
isInsideLockedComposition: false,
|
|
32
|
+
textFields: [field("self")],
|
|
33
|
+
...partial,
|
|
34
|
+
} as DomEditSelection;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe("canEditTextInline", () => {
|
|
38
|
+
it("allows an element the panel would let you edit text on", () => {
|
|
39
|
+
editable.current = true;
|
|
40
|
+
expect(canEditTextInline(selection())).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// The bar is the panel's bar: nothing becomes editable here that is not
|
|
44
|
+
// editable there.
|
|
45
|
+
it("refuses an element whose text the panel cannot edit either", () => {
|
|
46
|
+
editable.current = false;
|
|
47
|
+
expect(canEditTextInline(selection())).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Editing the whole element would flatten its children into one string.
|
|
51
|
+
it("refuses an element with several text fields", () => {
|
|
52
|
+
editable.current = true;
|
|
53
|
+
expect(canEditTextInline(selection({ textFields: [field("a"), field("b")] }))).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("allows an element with no separate text fields", () => {
|
|
57
|
+
editable.current = true;
|
|
58
|
+
expect(canEditTextInline(selection({ textFields: [] }))).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("refuses the composition host, which is the document rather than copy", () => {
|
|
62
|
+
editable.current = true;
|
|
63
|
+
expect(canEditTextInline(selection({ isCompositionHost: true }))).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("refuses anything inside a locked composition", () => {
|
|
67
|
+
editable.current = true;
|
|
68
|
+
expect(canEditTextInline(selection({ isInsideLockedComposition: true }))).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("refuses nothing at all", () => {
|
|
72
|
+
editable.current = true;
|
|
73
|
+
expect(canEditTextInline(null)).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe("isDoublePress", () => {
|
|
78
|
+
it("pairs presses only when they land on the same element", () => {
|
|
79
|
+
const first = document.createElement("div");
|
|
80
|
+
const second = document.createElement("div");
|
|
81
|
+
const previous = { x: 10, y: 10, at: 100, element: first };
|
|
82
|
+
|
|
83
|
+
expect(isDoublePress(previous, { x: 12, y: 12, at: 200, element: first })).toBe(true);
|
|
84
|
+
expect(isDoublePress(previous, { x: 12, y: 12, at: 200, element: second })).toBe(false);
|
|
85
|
+
});
|
|
86
|
+
});
|