@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
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { isRichTextFormattingTag } from "@hyperframes/core/rich-text-sanitize";
|
|
2
|
+
import type { DomEditSelection } from "./domEditingTypes";
|
|
3
|
+
import { isTextEditableSelection } from "./domEditingLayers";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Whether this element's text can be edited where it sits.
|
|
7
|
+
*
|
|
8
|
+
* Its own function rather than a condition inside a handler, because this is
|
|
9
|
+
* the rule most likely to change: it is the whole answer to "why did nothing
|
|
10
|
+
* happen when I double-clicked that".
|
|
11
|
+
*
|
|
12
|
+
* The bar is deliberately the same as the design panel's, plus one thing the
|
|
13
|
+
* panel can do that editing in place cannot. An element with several text
|
|
14
|
+
* fields is edited a field at a time there, and making the whole element
|
|
15
|
+
* editable would flatten its children into one string, so those keep the panel.
|
|
16
|
+
*/
|
|
17
|
+
export function canEditTextInline(selection: DomEditSelection | null): boolean {
|
|
18
|
+
if (!selection) return false;
|
|
19
|
+
if (!isTextEditableSelection(selection)) return false;
|
|
20
|
+
// The composition host is the document, not a piece of copy in it.
|
|
21
|
+
if (selection.isCompositionHost) return false;
|
|
22
|
+
if (selection.isInsideLockedComposition) return false;
|
|
23
|
+
if (selection.textFields.length <= 1) return true;
|
|
24
|
+
// A styled element reports one field per run of characters, but it is still
|
|
25
|
+
// one piece of copy and the caret edits all of it at once.
|
|
26
|
+
return canEditElementTextInline(selection.element);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Whether this element's text can be edited in place, judged from the element
|
|
31
|
+
* alone.
|
|
32
|
+
*
|
|
33
|
+
* The press path cannot use the selection-shaped gate above: building a
|
|
34
|
+
* selection is asynchronous, and a press has to decide now whether it is a
|
|
35
|
+
* text edit or the start of a drag. This asks the same question of the DOM.
|
|
36
|
+
*
|
|
37
|
+
* A structural child keeps an element out: those are separate text fields, the
|
|
38
|
+
* panel edits them one at a time, and making the whole element editable would
|
|
39
|
+
* flatten them into a single string.
|
|
40
|
+
*
|
|
41
|
+
* A formatting child does not. Styling a run of characters puts a span inside
|
|
42
|
+
* the element, so a rule of "no element children" would have let the editor
|
|
43
|
+
* lock every element it had ever styled out of itself, permanently, on the
|
|
44
|
+
* first colour change. What counts as formatting is the sanitiser's allowlist,
|
|
45
|
+
* so the editor and the thing that writes the file agree on it.
|
|
46
|
+
*/
|
|
47
|
+
export function canEditElementTextInline(element: HTMLElement | null): boolean {
|
|
48
|
+
if (!element) return false;
|
|
49
|
+
const tag = element.tagName;
|
|
50
|
+
if (tag === "BODY" || tag === "HTML") return false;
|
|
51
|
+
if (!hasOnlyFormattingChildren(element)) return false;
|
|
52
|
+
if (element.isContentEditable) return false;
|
|
53
|
+
return (element.textContent ?? "").trim().length > 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function hasOnlyFormattingChildren(element: HTMLElement): boolean {
|
|
57
|
+
const HTMLElementClass = element.ownerDocument.defaultView?.HTMLElement;
|
|
58
|
+
if (!HTMLElementClass) return false;
|
|
59
|
+
for (const child of Array.from(element.children)) {
|
|
60
|
+
if (!isRichTextFormattingTag(child.tagName)) return false;
|
|
61
|
+
if (!(child instanceof HTMLElementClass)) return false;
|
|
62
|
+
// Formatting nests, and a structural child hidden inside a span is still
|
|
63
|
+
// structural.
|
|
64
|
+
if (!hasOnlyFormattingChildren(child)) return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Where and when a press landed, for recognising the next one as a pair. */
|
|
70
|
+
export interface PressMark {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
at: number;
|
|
74
|
+
element: HTMLElement | null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Long enough to be deliberate, short enough not to catch two separate clicks. */
|
|
78
|
+
const DOUBLE_PRESS_MS = 450;
|
|
79
|
+
/** A double press is two presses in the same place, not a tiny drag. */
|
|
80
|
+
const DOUBLE_PRESS_SLOP_PX = 6;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Whether this press pairs with the last one into a double press.
|
|
84
|
+
*
|
|
85
|
+
* Studio cannot use `dblclick` or a click count for this. The selection box
|
|
86
|
+
* takes pointer capture on the first press and prevents its default, which
|
|
87
|
+
* suppresses the compatibility mouse events and stops the browser pairing the
|
|
88
|
+
* two presses at all: no `dblclick` is dispatched, and `detail` stays 1.
|
|
89
|
+
*/
|
|
90
|
+
export function isDoublePress(previous: PressMark | null, next: PressMark): boolean {
|
|
91
|
+
if (!previous) return false;
|
|
92
|
+
return (
|
|
93
|
+
next.element !== null &&
|
|
94
|
+
previous.element === next.element &&
|
|
95
|
+
next.at - previous.at <= DOUBLE_PRESS_MS &&
|
|
96
|
+
Math.abs(next.x - previous.x) <= DOUBLE_PRESS_SLOP_PX &&
|
|
97
|
+
Math.abs(next.y - previous.y) <= DOUBLE_PRESS_SLOP_PX
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
|
|
3
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
4
|
+
import { canEditElementTextInline } from "./domEditInlineText";
|
|
5
|
+
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
document.body.innerHTML = "";
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
function mount(html: string): HTMLElement {
|
|
11
|
+
document.body.innerHTML = html;
|
|
12
|
+
return document.body.firstElementChild as HTMLElement;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe("canEditElementTextInline", () => {
|
|
16
|
+
it("opens a plain piece of copy", () => {
|
|
17
|
+
expect(canEditElementTextInline(mount("<h1>hello world</h1>"))).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// The trap this exists for: styling a run of characters puts a span inside
|
|
21
|
+
// the element, and a rule of "no element children" would have let the editor
|
|
22
|
+
// lock every element it had ever styled out of itself, permanently.
|
|
23
|
+
it("still opens an element that has been styled", () => {
|
|
24
|
+
const element = mount('<h1>hell<span style="color: red">o</span> world</h1>');
|
|
25
|
+
expect(canEditElementTextInline(element)).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("opens an element whose formatting is nested", () => {
|
|
29
|
+
const element = mount('<h1><b><span style="color: red">deep</span></b></h1>');
|
|
30
|
+
expect(canEditElementTextInline(element)).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("keeps out an element with a structural child, which the panel edits field by field", () => {
|
|
34
|
+
expect(canEditElementTextInline(mount("<div><h1>a</h1><p>b</p></div>"))).toBe(false);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("keeps out an element hiding something structural inside its formatting", () => {
|
|
38
|
+
expect(canEditElementTextInline(mount("<h1><span><div>a</div></span></h1>"))).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("keeps out the document itself", () => {
|
|
42
|
+
expect(canEditElementTextInline(document.body)).toBe(false);
|
|
43
|
+
expect(canEditElementTextInline(document.documentElement)).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("keeps out an element that is already being edited", () => {
|
|
47
|
+
const element = mount("<h1>hello</h1>");
|
|
48
|
+
element.setAttribute("contenteditable", "true");
|
|
49
|
+
expect(canEditElementTextInline(element)).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("keeps out an element with no words in it", () => {
|
|
53
|
+
expect(canEditElementTextInline(mount("<h1> </h1>"))).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("keeps out nothing at all", () => {
|
|
57
|
+
expect(canEditElementTextInline(null)).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -519,12 +519,13 @@ export function buildDomEditTextPatchOperation(
|
|
|
519
519
|
value: string,
|
|
520
520
|
childLocator?: DomEditChildLocator,
|
|
521
521
|
): PatchOperation {
|
|
522
|
-
return {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
522
|
+
return { type: "text-content", property: "text", value, ...childLocator };
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/** Replace an element's contents with markup, for a change no per-child operation
|
|
526
|
+
* can express (a text layer added, removed or reordered). Sanitized at both ends. */
|
|
527
|
+
export function buildDomEditRichTextPatchOperation(value: string): PatchOperation {
|
|
528
|
+
return { type: "rich-text", property: "", value };
|
|
528
529
|
}
|
|
529
530
|
|
|
530
531
|
// ─── Non-editable reason ─────────────────────────────────────────────────────
|