@hyperframes/studio 0.7.105 → 0.7.107
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-Jx07OQgw.js → hyperframes-player-BLrfwq5o.js} +1 -1
- package/dist/assets/{index-CryZ0PGi.js → index-BA9yhzfR.js} +1 -1
- package/dist/assets/{index-Dqi2GmOp.js → index-BSBk5srs.js} +1 -1
- package/dist/assets/{index-DuxKGsHZ.js → index-dF-CmLZu.js} +218 -218
- package/dist/assets/index-zQ4JFwwB.css +1 -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 +1 -1
- package/dist/index.html +2 -2
- package/dist/index.js +5335 -3954
- package/dist/index.js.map +1 -1
- package/package.json +8 -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/editor/DomEditOverlay.tsx +36 -18
- package/src/components/editor/DomEditSelectionChrome.test.tsx +119 -31
- 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/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/domEditOverlayCrop.test.ts +136 -2
- package/src/components/editor/domEditOverlayCrop.ts +99 -15
- package/src/components/editor/domEditOverlayGeometry.test.ts +13 -0
- package/src/components/editor/domEditOverlayGeometry.ts +13 -10
- package/src/components/editor/domEditOverlayTransform.ts +88 -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/useDomEditNudge.ts +2 -2
- package/src/components/editor/useInlineTextEditing.tsx +119 -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 +4 -0
- package/src/hooks/domEditPersistFailure.ts +0 -7
- package/src/hooks/useAppHotkeys.ts +4 -4
- package/src/hooks/useDomEditCommits.test.tsx +103 -21
- package/src/hooks/useDomEditCommits.ts +2 -0
- package/src/hooks/useDomEditSession.ts +2 -0
- package/src/hooks/useDomEditTextCommits.ts +110 -11
- package/src/hooks/useFileTree.ts +8 -3
- package/src/hooks/useInlineTextEdit.test.tsx +555 -0
- package/src/hooks/useInlineTextEdit.ts +320 -0
- package/src/player/lib/playbackShortcuts.ts +5 -4
- 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/utils/sourcePatcher.ts +5 -1
- package/src/utils/studioHelpers.ts +2 -5
- 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-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,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One walk from an element up to its composition root, composing the transform
|
|
3
|
+
* it actually paints under.
|
|
4
|
+
*
|
|
5
|
+
* The overlay measures an element's angle in two places — the selection box and
|
|
6
|
+
* the crop frame — and they need different arithmetic: one works in DOMMatrix
|
|
7
|
+
* because it goes on to transform corner points, the other in plain 2D
|
|
8
|
+
* components because it only needs an angle and a scale. What they must never
|
|
9
|
+
* differ on is *which* transforms count and in what order, because when they
|
|
10
|
+
* disagree the chrome disagrees with itself: the selection box drawn at one
|
|
11
|
+
* angle and the crop outline at another, on the same element.
|
|
12
|
+
*
|
|
13
|
+
* So the walk lives here once and takes the arithmetic as a parameter. Adding
|
|
14
|
+
* an individual property CSS grew later — `translate`, `scale` — means adding
|
|
15
|
+
* one step here and one method to each algebra, rather than finding both walks
|
|
16
|
+
* and hoping.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** The composition's own root; the walk stops there rather than at the document. */
|
|
20
|
+
const COMPOSITION_ROOT_ATTR = "data-composition-id";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The arithmetic the walk needs, whatever the caller's matrix type is.
|
|
24
|
+
*
|
|
25
|
+
* `fromTransform` returns null for a transform the caller cannot use — a
|
|
26
|
+
* perspective matrix, say — which aborts the walk rather than composing a
|
|
27
|
+
* matrix that describes something other than what is painted.
|
|
28
|
+
*/
|
|
29
|
+
export interface PlanarTransformOps<M> {
|
|
30
|
+
identity(): M;
|
|
31
|
+
fromTransform(value: string): M | null;
|
|
32
|
+
fromRotate(degrees: number): M;
|
|
33
|
+
/** `outer` applied around `inner`, as an ancestor composes over a child. */
|
|
34
|
+
compose(outer: M, inner: M): M;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The planar rotation in the CSS `rotate` property, in degrees.
|
|
39
|
+
*
|
|
40
|
+
* Computes to `none`, an angle (`-22deg`), or an axis plus an angle
|
|
41
|
+
* (`0 0 1 -22deg`). Only a rotation about z stays in the overlay's plane; any
|
|
42
|
+
* other axis is 3D and reports 0, which leaves the caller on its axis-aligned
|
|
43
|
+
* fallback rather than drawing a box at a plausible-looking wrong angle.
|
|
44
|
+
*/
|
|
45
|
+
export function individualRotateDegrees(value: string | undefined): number {
|
|
46
|
+
if (!value || value === "none") return 0;
|
|
47
|
+
const parts = value.trim().split(/\s+/);
|
|
48
|
+
const angle = parts.at(-1);
|
|
49
|
+
if (!angle?.endsWith("deg")) return 0;
|
|
50
|
+
if (parts.length === 4) {
|
|
51
|
+
const [x, y, z] = parts;
|
|
52
|
+
if (Number(x) !== 0 || Number(y) !== 0 || Math.abs(Number(z)) !== 1) return 0;
|
|
53
|
+
const deg = Number.parseFloat(angle);
|
|
54
|
+
return Number.isFinite(deg) ? deg * Math.sign(Number(z)) : 0;
|
|
55
|
+
}
|
|
56
|
+
if (parts.length !== 1) return 0;
|
|
57
|
+
const deg = Number.parseFloat(angle);
|
|
58
|
+
return Number.isFinite(deg) ? deg : 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The element's transform composed with every ancestor's, up to the composition
|
|
63
|
+
* root.
|
|
64
|
+
*
|
|
65
|
+
* Within a node, CSS applies the individual properties before `transform`, so
|
|
66
|
+
* `rotate` composes on the left of it. Between nodes, an ancestor applies
|
|
67
|
+
* outside its child. Null means some node's transform was unusable and the
|
|
68
|
+
* caller should fall back rather than guess.
|
|
69
|
+
*/
|
|
70
|
+
export function composeElementTransform<M>(
|
|
71
|
+
element: HTMLElement,
|
|
72
|
+
ops: PlanarTransformOps<M>,
|
|
73
|
+
getStyle: (node: HTMLElement) => CSSStyleDeclaration | null,
|
|
74
|
+
): M | null {
|
|
75
|
+
let acc = ops.identity();
|
|
76
|
+
for (let node: HTMLElement | null = element; node; node = node.parentElement) {
|
|
77
|
+
const style = getStyle(node);
|
|
78
|
+
if (!style) return null;
|
|
79
|
+
const transform = style.transform;
|
|
80
|
+
let own = transform && transform !== "none" ? ops.fromTransform(transform) : ops.identity();
|
|
81
|
+
if (!own) return null;
|
|
82
|
+
const spin = individualRotateDegrees(style.rotate);
|
|
83
|
+
if (spin !== 0) own = ops.compose(ops.fromRotate(spin), own);
|
|
84
|
+
acc = ops.compose(own, acc);
|
|
85
|
+
if (node.hasAttribute(COMPOSITION_ROOT_ATTR)) break;
|
|
86
|
+
}
|
|
87
|
+
return acc;
|
|
88
|
+
}
|
|
@@ -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 ─────────────────────────────────────────────────────
|