@hyperframes/studio 0.9.38 → 0.9.39
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/{codec-Dz2VdhdD.js → codec-CY6KnWXa.js} +1 -1
- package/dist/assets/{hyperframes-player-BkaWdGLq.js → hyperframes-player-B9-CuG_h.js} +1 -1
- package/dist/assets/{index-BJTCbv8z.css → index-4VGEAZyf.css} +1 -1
- package/dist/assets/{index-DONaC7VF.js → index-Bjz2UaYv.js} +1 -1
- package/dist/assets/{index-DsNxqAwr.js → index-_pkzoYYF.js} +145 -145
- package/dist/assets/{pausedVideoDecoder-BGN2jKrN.js → pausedVideoDecoder-Dr7nKUUu.js} +1 -1
- package/dist/{chunk-63DH4LRB.js → chunk-44VRMER6.js} +2 -11
- package/dist/{chunk-45KKBU63.js → chunk-ATDO3YLX.js} +1 -1
- package/dist/chunk-FQ3VRKMC.js +148 -0
- package/dist/{chunk-YKBN653R.js → chunk-NBULUIWH.js} +252 -1
- package/dist/{domEditingLayers-7Q56QAU5.js → domEditingLayers-FRVHP6IB.js} +2 -2
- package/dist/index.d.ts +3 -85
- package/dist/index.html +2 -2
- package/dist/index.js +321 -341
- package/dist/keys-CaWcxUST.d.ts +86 -0
- package/dist/keys.d.ts +1 -0
- package/dist/keys.js +11 -0
- package/dist/player.js +2 -2
- package/dist/styles.css +1 -1
- package/package.json +12 -8
- package/src/components/editor/DomEditGestureReadout.test.tsx +204 -20
- package/src/components/editor/DomEditGestureReadout.tsx +36 -18
- package/src/components/editor/InlineTextToolbar.tsx +2 -2
- package/src/components/editor/domEditGestureReadoutPlacement.ts +144 -0
- package/src/components/editor/domEditGestureReadoutState.ts +18 -8
- package/src/components/editor/domEditingDom.ts +2 -15
- package/src/components/editor/useDomEditCompositionRect.ts +13 -4
- package/src/components/editor/useDomEditOverlayGestures.ts +1 -1
- package/src/components/editor/usePreviewCompositionRect.test.tsx +39 -0
- package/src/hooks/elementPickerStyles.ts +53 -0
- package/src/hooks/useElementPicker.test.ts +83 -3
- package/src/hooks/useElementPicker.ts +27 -66
- package/src/keys.test.ts +53 -0
- package/src/keys.ts +11 -0
- package/src/player/components/Player.tsx +2 -0
- package/src/player/components/studioKeyDefaults.ts +68 -0
- package/src/player/components/studioShortcuts.ts +2 -67
- package/src/player/hooks/playbackAdapterResolution.ts +15 -0
- package/src/player/hooks/previewMessageRouter.manifest.test.ts +67 -0
- package/src/player/hooks/previewMessageRouter.ts +38 -8
- package/src/player/hooks/timelinePlayerTestHarness.ts +26 -1
- package/src/player/hooks/useShadowPreviewReload.ts +4 -1
- package/src/player/hooks/useTimelinePlayer.ts +5 -9
- package/src/player/lib/bridgePlayback.ts +156 -0
- package/src/player/lib/previewChannel.test.ts +260 -0
- package/src/player/lib/previewChannel.ts +100 -0
- package/src/player/sceneSwap.test.ts +12 -0
- package/src/player/sceneSwap.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -10,9 +10,12 @@ import {
|
|
|
10
10
|
STUDIO_PREVIEW_FPS,
|
|
11
11
|
TIMELINE_RANGE_MARGIN_PX,
|
|
12
12
|
TIMELINE_VIEWPORT_BUDGETS,
|
|
13
|
+
acceptStudioRuntimeMessage,
|
|
14
|
+
acceptedRuntimeMessageFps,
|
|
13
15
|
announcePreviewDocumentLoaded,
|
|
14
16
|
announcePreviewPromoted,
|
|
15
17
|
applyPreviewVariablesToUrl,
|
|
18
|
+
bridgePlaybackAdapter,
|
|
16
19
|
clampTimelineZoomPercent,
|
|
17
20
|
clampToDuration,
|
|
18
21
|
collectElementPatches,
|
|
@@ -24,12 +27,14 @@ import {
|
|
|
24
27
|
effectiveThumbnailMode,
|
|
25
28
|
formatFrameTime,
|
|
26
29
|
formatTime,
|
|
30
|
+
frameOrigins,
|
|
27
31
|
frameToSeconds,
|
|
28
32
|
getNextTimelineZoomPercent,
|
|
29
33
|
getPinchTimelineZoomPercent,
|
|
30
34
|
getTimelinePixelsPerSecond,
|
|
31
35
|
getTimelineZoomPercent,
|
|
32
36
|
giveUpOnPreviewChange,
|
|
37
|
+
inspectStudioRuntimeMessage,
|
|
33
38
|
isFocusedEaseRequestCurrent,
|
|
34
39
|
isPanelId,
|
|
35
40
|
isPreviewBooted,
|
|
@@ -50,11 +55,19 @@ import {
|
|
|
50
55
|
parsePreviewFacts,
|
|
51
56
|
patchElements,
|
|
52
57
|
positiveClipSpan,
|
|
58
|
+
postFrameDisplayScale,
|
|
59
|
+
postRuntimeControlMessage,
|
|
60
|
+
previewClipManifest,
|
|
61
|
+
previewComputedStyles,
|
|
62
|
+
previewFrameOpaque,
|
|
53
63
|
previewReloadBegun,
|
|
64
|
+
previewSeekPainted,
|
|
65
|
+
previewStageSize,
|
|
54
66
|
readStudioUiPreferences,
|
|
55
67
|
requestPreviewReload,
|
|
56
68
|
sceneSwapFor,
|
|
57
69
|
secondsToFrame,
|
|
70
|
+
setFrameLoopStart,
|
|
58
71
|
setPreviewReloading,
|
|
59
72
|
stepFrameTime,
|
|
60
73
|
studioExpectedFileVersion,
|
|
@@ -74,7 +87,7 @@ import {
|
|
|
74
87
|
whileScriptWrites,
|
|
75
88
|
writeStudioUiPreferences,
|
|
76
89
|
zoomToSelectedClips
|
|
77
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-NBULUIWH.js";
|
|
78
91
|
import {
|
|
79
92
|
Button,
|
|
80
93
|
ContextMenu,
|
|
@@ -107,6 +120,14 @@ import {
|
|
|
107
120
|
fieldText,
|
|
108
121
|
popupSurface
|
|
109
122
|
} from "./chunk-52AJB4PN.js";
|
|
123
|
+
import {
|
|
124
|
+
DEFAULT_STUDIO_KEYS,
|
|
125
|
+
comboClashKey,
|
|
126
|
+
comboText,
|
|
127
|
+
formatCombo,
|
|
128
|
+
matchCombo,
|
|
129
|
+
parseCombo
|
|
130
|
+
} from "./chunk-FQ3VRKMC.js";
|
|
110
131
|
import {
|
|
111
132
|
DOM_EDIT_LAYER_OBSERVER_INIT,
|
|
112
133
|
buildDefaultDomEditTextField,
|
|
@@ -132,7 +153,7 @@ import {
|
|
|
132
153
|
resolveAllVisualDomEditTargets,
|
|
133
154
|
resolveDomEditSelection,
|
|
134
155
|
serializeDomEditTextFields
|
|
135
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-ATDO3YLX.js";
|
|
136
157
|
import {
|
|
137
158
|
LAYER_REVEAL_PRIOR_POSITION_ATTR,
|
|
138
159
|
LAYER_REVEAL_PRIOR_Z_ATTR,
|
|
@@ -201,7 +222,7 @@ import {
|
|
|
201
222
|
toHexColor,
|
|
202
223
|
withSelectorIndexPass,
|
|
203
224
|
wrapTimeline
|
|
204
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-44VRMER6.js";
|
|
205
226
|
import {
|
|
206
227
|
MediaFetchError,
|
|
207
228
|
mediaUrlSourceOptions,
|
|
@@ -214,146 +235,6 @@ import { memo as memo35, useCallback as useCallback78 } from "react";
|
|
|
214
235
|
|
|
215
236
|
// src/player/components/studioShortcuts.ts
|
|
216
237
|
import { useSyncExternalStore } from "react";
|
|
217
|
-
|
|
218
|
-
// src/player/components/studioCombo.ts
|
|
219
|
-
var NAMED = /* @__PURE__ */ new Set([
|
|
220
|
-
"Space",
|
|
221
|
-
"ArrowLeft",
|
|
222
|
-
"ArrowRight",
|
|
223
|
-
"ArrowUp",
|
|
224
|
-
"ArrowDown",
|
|
225
|
-
"Home",
|
|
226
|
-
"End",
|
|
227
|
-
"PageUp",
|
|
228
|
-
"PageDown",
|
|
229
|
-
"Delete",
|
|
230
|
-
"Backspace",
|
|
231
|
-
"Escape",
|
|
232
|
-
"Enter",
|
|
233
|
-
"Tab"
|
|
234
|
-
]);
|
|
235
|
-
var SYMBOL = {
|
|
236
|
-
ArrowLeft: "\u2190",
|
|
237
|
-
ArrowRight: "\u2192",
|
|
238
|
-
ArrowUp: "\u2191",
|
|
239
|
-
ArrowDown: "\u2193",
|
|
240
|
-
Delete: "Del",
|
|
241
|
-
Backspace: "\u232B",
|
|
242
|
-
Escape: "Esc"
|
|
243
|
-
};
|
|
244
|
-
var MODIFIERS = /* @__PURE__ */ new Set(["mod", "cmd", "ctrl", "shift", "alt"]);
|
|
245
|
-
function parseCombo(text3) {
|
|
246
|
-
const split = text3.length > 1 ? text3.slice(0, -1).lastIndexOf("+") : -1;
|
|
247
|
-
const tokens = split < 0 ? [] : text3.slice(0, split).split("+").map((t2) => t2.toLowerCase());
|
|
248
|
-
const key2 = text3.slice(split + 1);
|
|
249
|
-
const named = NAMED.has(key2);
|
|
250
|
-
const symbol = !named && !/^[A-Za-z]$/.test(key2);
|
|
251
|
-
if (tokens.some((t2) => !MODIFIERS.has(t2)) || !named && [...key2].length !== 1) return null;
|
|
252
|
-
if (symbol && tokens.includes("shift")) return null;
|
|
253
|
-
const combo = {
|
|
254
|
-
mod: tokens.includes("mod"),
|
|
255
|
-
meta: tokens.includes("cmd"),
|
|
256
|
-
ctrl: tokens.includes("ctrl"),
|
|
257
|
-
shift: tokens.includes("shift"),
|
|
258
|
-
alt: tokens.includes("alt"),
|
|
259
|
-
key: named ? key2 : key2.toLowerCase(),
|
|
260
|
-
named
|
|
261
|
-
};
|
|
262
|
-
return combo.alt && (combo.ctrl || combo.mod) ? null : combo;
|
|
263
|
-
}
|
|
264
|
-
function comboText(c) {
|
|
265
|
-
const mods = [
|
|
266
|
-
c.mod && "mod",
|
|
267
|
-
c.meta && "cmd",
|
|
268
|
-
c.ctrl && "ctrl",
|
|
269
|
-
c.alt && "alt",
|
|
270
|
-
c.shift && "shift"
|
|
271
|
-
];
|
|
272
|
-
return [...mods.filter(Boolean), c.key].join("+");
|
|
273
|
-
}
|
|
274
|
-
var namedMatches = (e, name) => e.code === name || e.key === (name === "Space" ? " " : name);
|
|
275
|
-
function charMatches(e, c) {
|
|
276
|
-
if (e.key.toLowerCase() === c.key) return true;
|
|
277
|
-
const code = /^[0-9]$/.test(c.key) ? `Digit${c.key}` : `Key${c.key.toUpperCase()}`;
|
|
278
|
-
return e.altKey && /^[a-z0-9]$/.test(c.key) && e.code === code;
|
|
279
|
-
}
|
|
280
|
-
function matchCombo(e, c) {
|
|
281
|
-
const symbol = !c.named && !/^[a-z]$/.test(c.key);
|
|
282
|
-
if (!symbol && !!e.shiftKey !== c.shift || !!e.altKey !== c.alt) return false;
|
|
283
|
-
const modsOk = c.mod ? e.metaKey || e.ctrlKey : !!e.metaKey === c.meta && !!e.ctrlKey === c.ctrl;
|
|
284
|
-
return modsOk && (c.named ? namedMatches(e, c.key) : charMatches(e, c));
|
|
285
|
-
}
|
|
286
|
-
function formatCombo(c) {
|
|
287
|
-
const mods = `${c.ctrl ? "\u2303" : ""}${c.alt ? "\u2325" : ""}${c.mod || c.meta ? "\u2318" : ""}${c.shift ? "\u21E7" : ""}`;
|
|
288
|
-
return mods + (SYMBOL[c.key] ?? (c.named ? c.key : c.key.toUpperCase()));
|
|
289
|
-
}
|
|
290
|
-
var comboClashKey = (c) => [c.mod || c.meta || c.ctrl, c.alt, c.shift, c.key].join("|");
|
|
291
|
-
|
|
292
|
-
// src/player/components/studioShortcuts.ts
|
|
293
|
-
var DEFAULT_STUDIO_KEYS = {
|
|
294
|
-
fullscreen: "f",
|
|
295
|
-
split: "s",
|
|
296
|
-
record: "r",
|
|
297
|
-
addKeyframe: "k",
|
|
298
|
-
audioGain: "g",
|
|
299
|
-
zoomSelection: "z",
|
|
300
|
-
mute: "m",
|
|
301
|
-
pause: "k",
|
|
302
|
-
shuttleBack: "j",
|
|
303
|
-
shuttleForward: "l",
|
|
304
|
-
inPoint: "i",
|
|
305
|
-
outPoint: "o",
|
|
306
|
-
seekToIn: "a",
|
|
307
|
-
seekToOut: "e",
|
|
308
|
-
selectTool: "v",
|
|
309
|
-
razorTool: "b",
|
|
310
|
-
selectLeftward: "[",
|
|
311
|
-
selectRightward: "]",
|
|
312
|
-
exitRazor: "a",
|
|
313
|
-
snap: "s",
|
|
314
|
-
grid: "g",
|
|
315
|
-
timelineSnap: "n",
|
|
316
|
-
playPause: "Space",
|
|
317
|
-
frameBack: "ArrowLeft",
|
|
318
|
-
frameForward: "ArrowRight",
|
|
319
|
-
frameBackTen: "shift+ArrowLeft",
|
|
320
|
-
frameForwardTen: "shift+ArrowRight",
|
|
321
|
-
loop: "shift+l",
|
|
322
|
-
clearInPoint: "shift+i",
|
|
323
|
-
clearOutPoint: "shift+o",
|
|
324
|
-
undo: "mod+z",
|
|
325
|
-
redo: "mod+shift+z",
|
|
326
|
-
redoAlt: "ctrl+y",
|
|
327
|
-
tabCompositions: "mod+1",
|
|
328
|
-
tabAssets: "mod+2",
|
|
329
|
-
group: "mod+g",
|
|
330
|
-
ungroup: "mod+shift+g",
|
|
331
|
-
copy: "mod+c",
|
|
332
|
-
paste: "mod+v",
|
|
333
|
-
cut: "mod+x",
|
|
334
|
-
duplicate: "mod+d",
|
|
335
|
-
linkToggle: "mod+l",
|
|
336
|
-
detachAudio: "alt+shift+d",
|
|
337
|
-
deleteLinked: "alt+Backspace",
|
|
338
|
-
deleteLinkedAlt: "alt+Delete",
|
|
339
|
-
deleteSelected: "Delete",
|
|
340
|
-
deleteSelectedAlt: "Backspace",
|
|
341
|
-
resetKeyframes: "Backspace",
|
|
342
|
-
nudgeLeft: "ArrowLeft",
|
|
343
|
-
nudgeRight: "ArrowRight",
|
|
344
|
-
nudgeUp: "ArrowUp",
|
|
345
|
-
nudgeDown: "ArrowDown",
|
|
346
|
-
nudgeLeftTen: "shift+ArrowLeft",
|
|
347
|
-
nudgeRightTen: "shift+ArrowRight",
|
|
348
|
-
nudgeUpTen: "shift+ArrowUp",
|
|
349
|
-
nudgeDownTen: "shift+ArrowDown",
|
|
350
|
-
captionSelectAll: "mod+a",
|
|
351
|
-
pickupClip: "Space",
|
|
352
|
-
pickupUp: "ArrowUp",
|
|
353
|
-
pickupDown: "ArrowDown",
|
|
354
|
-
pickupDrop: "Enter",
|
|
355
|
-
cancel: "Escape"
|
|
356
|
-
};
|
|
357
238
|
var SHARED_BY_DESIGN = [
|
|
358
239
|
["pause", "addKeyframe"],
|
|
359
240
|
["seekToIn", "exitRazor"],
|
|
@@ -29570,55 +29451,6 @@ function transitionLabelsForDocument(doc, timelines) {
|
|
|
29570
29451
|
// src/player/lib/timelineIframeHelpers.ts
|
|
29571
29452
|
import { readClipTiming } from "@hyperframes/core/composition-contract";
|
|
29572
29453
|
import { createRuntimeStartTimeResolver } from "@hyperframes/core/runtime/start-resolver";
|
|
29573
|
-
|
|
29574
|
-
// src/player/lib/runtimeProtocol.ts
|
|
29575
|
-
import {
|
|
29576
|
-
frameDisplayScale,
|
|
29577
|
-
inspectRuntimeProtocol,
|
|
29578
|
-
runtimeProtocolMetadata
|
|
29579
|
-
} from "@hyperframes/core/runtime/protocol";
|
|
29580
|
-
function createRuntimeControlMessage(action, payload = {}, fps = 30) {
|
|
29581
|
-
return {
|
|
29582
|
-
...payload,
|
|
29583
|
-
source: "hf-parent",
|
|
29584
|
-
type: "control",
|
|
29585
|
-
action,
|
|
29586
|
-
...runtimeProtocolMetadata(fps)
|
|
29587
|
-
};
|
|
29588
|
-
}
|
|
29589
|
-
function postRuntimeControlMessage(target, action, payload = {}, fps = 30) {
|
|
29590
|
-
target?.postMessage(createRuntimeControlMessage(action, payload, fps), "*");
|
|
29591
|
-
}
|
|
29592
|
-
function postFrameDisplayScale(iframe) {
|
|
29593
|
-
const scale = iframe && frameDisplayScale(iframe);
|
|
29594
|
-
if (scale) postRuntimeControlMessage(iframe.contentWindow, "set-display-scale", { scale });
|
|
29595
|
-
}
|
|
29596
|
-
function inspectStudioRuntimeMessage(value) {
|
|
29597
|
-
return inspectRuntimeProtocol(value, 30);
|
|
29598
|
-
}
|
|
29599
|
-
function dispatchRuntimeProtocolError(inspection) {
|
|
29600
|
-
if (inspection.status !== "unsupported") return;
|
|
29601
|
-
window.dispatchEvent(
|
|
29602
|
-
new CustomEvent("runtimeprotocolerror", {
|
|
29603
|
-
detail: {
|
|
29604
|
-
code: inspection.code,
|
|
29605
|
-
receivedVersion: inspection.receivedVersion
|
|
29606
|
-
}
|
|
29607
|
-
})
|
|
29608
|
-
);
|
|
29609
|
-
}
|
|
29610
|
-
function acceptStudioRuntimeMessage(value) {
|
|
29611
|
-
const inspection = inspectStudioRuntimeMessage(value);
|
|
29612
|
-
if (inspection.status !== "unsupported") return inspection;
|
|
29613
|
-
dispatchRuntimeProtocolError(inspection);
|
|
29614
|
-
return null;
|
|
29615
|
-
}
|
|
29616
|
-
function acceptedRuntimeMessageFps(value) {
|
|
29617
|
-
const inspection = inspectStudioRuntimeMessage(value);
|
|
29618
|
-
return inspection.status === "supported" ? inspection.fps : 30;
|
|
29619
|
-
}
|
|
29620
|
-
|
|
29621
|
-
// src/player/lib/timelineIframeHelpers.ts
|
|
29622
29454
|
function normalizePreviewViewport(doc, win) {
|
|
29623
29455
|
if (doc.documentElement) {
|
|
29624
29456
|
doc.documentElement.style.overflow = "hidden";
|
|
@@ -31879,7 +31711,9 @@ function useShadowReloadRetry(generation, url, begin) {
|
|
|
31879
31711
|
var SHADOW_READY_TIMEOUT_MS = 15e3;
|
|
31880
31712
|
var SHADOW_READY_BUDGETS = 3;
|
|
31881
31713
|
function restoreSeekPainted(iframe) {
|
|
31882
|
-
|
|
31714
|
+
if (!iframe) return void 0;
|
|
31715
|
+
if (previewFrameOpaque(iframe)) return previewSeekPainted(iframe, SHADOW_READY_TIMEOUT_MS);
|
|
31716
|
+
const win = iframe.contentWindow;
|
|
31883
31717
|
return win?.__hfWaitForSeekCompletion?.().catch(() => {
|
|
31884
31718
|
});
|
|
31885
31719
|
}
|
|
@@ -32207,6 +32041,51 @@ function useShadowPreviewReload({
|
|
|
32207
32041
|
};
|
|
32208
32042
|
}
|
|
32209
32043
|
|
|
32044
|
+
// src/player/lib/pausedVideoProvider.ts
|
|
32045
|
+
var installed = /* @__PURE__ */ new WeakMap();
|
|
32046
|
+
function attachPausedVideoProvider(iframe, win) {
|
|
32047
|
+
if (!win.__hf?.setPausedVideoFrameProvider || !iframe.contentDocument) return;
|
|
32048
|
+
const previous = installed.get(iframe);
|
|
32049
|
+
const setter = win.__hf.setPausedVideoFrameProvider;
|
|
32050
|
+
if (previous?.document === iframe.contentDocument && previous.setter === setter) return;
|
|
32051
|
+
previous?.provider.dispose();
|
|
32052
|
+
let disposed = false;
|
|
32053
|
+
let decoder = null;
|
|
32054
|
+
const provider = {
|
|
32055
|
+
async decode(requests, signal) {
|
|
32056
|
+
signal.throwIfAborted();
|
|
32057
|
+
if (disposed) throw new DOMException("Preview disposed", "AbortError");
|
|
32058
|
+
decoder ??= import("./pausedVideoDecoder-W2SVMXDS.js").then(
|
|
32059
|
+
({ createPausedVideoDecoder }) => createPausedVideoDecoder(iframe)
|
|
32060
|
+
);
|
|
32061
|
+
const actual = await decoder;
|
|
32062
|
+
if (disposed) {
|
|
32063
|
+
actual.dispose();
|
|
32064
|
+
throw new DOMException("Preview disposed", "AbortError");
|
|
32065
|
+
}
|
|
32066
|
+
return actual.decode(requests, signal);
|
|
32067
|
+
},
|
|
32068
|
+
async suspend() {
|
|
32069
|
+
const actual = await decoder?.catch(() => null);
|
|
32070
|
+
await actual?.suspend?.();
|
|
32071
|
+
},
|
|
32072
|
+
dispose() {
|
|
32073
|
+
if (disposed) return;
|
|
32074
|
+
disposed = true;
|
|
32075
|
+
void decoder?.then((actual) => actual.dispose()).catch(() => {
|
|
32076
|
+
});
|
|
32077
|
+
win.removeEventListener("pagehide", onPageHide);
|
|
32078
|
+
}
|
|
32079
|
+
};
|
|
32080
|
+
const onPageHide = () => {
|
|
32081
|
+
provider.dispose();
|
|
32082
|
+
installed.delete(iframe);
|
|
32083
|
+
};
|
|
32084
|
+
win.addEventListener("pagehide", onPageHide, { once: true });
|
|
32085
|
+
installed.set(iframe, { document: iframe.contentDocument, provider, setter });
|
|
32086
|
+
setter(provider);
|
|
32087
|
+
}
|
|
32088
|
+
|
|
32210
32089
|
// src/player/hooks/playbackAdapterResolution.ts
|
|
32211
32090
|
function pickTimelineAdapter(iframe, win, docDuration) {
|
|
32212
32091
|
let fallback = null;
|
|
@@ -32254,6 +32133,13 @@ function resolvePlaybackAdapter(iframe, win, refs) {
|
|
|
32254
32133
|
}
|
|
32255
32134
|
return bestAdapter;
|
|
32256
32135
|
}
|
|
32136
|
+
function resolveFramePlaybackAdapter(iframe, refs) {
|
|
32137
|
+
if (previewFrameOpaque(iframe)) return bridgePlaybackAdapter(iframe);
|
|
32138
|
+
const win = iframe.contentWindow;
|
|
32139
|
+
if (!win) return null;
|
|
32140
|
+
attachPausedVideoProvider(iframe, win);
|
|
32141
|
+
return resolvePlaybackAdapter(iframe, win, refs);
|
|
32142
|
+
}
|
|
32257
32143
|
|
|
32258
32144
|
// src/player/hooks/useTimelinePlayerLoop.ts
|
|
32259
32145
|
import { useCallback as useCallback41 } from "react";
|
|
@@ -32309,51 +32195,6 @@ function useTimelinePlayerLoop({
|
|
|
32309
32195
|
return { startRAFLoop, stopRAFLoop, stopReverseLoop };
|
|
32310
32196
|
}
|
|
32311
32197
|
|
|
32312
|
-
// src/player/lib/pausedVideoProvider.ts
|
|
32313
|
-
var installed = /* @__PURE__ */ new WeakMap();
|
|
32314
|
-
function attachPausedVideoProvider(iframe, win) {
|
|
32315
|
-
if (!win.__hf?.setPausedVideoFrameProvider || !iframe.contentDocument) return;
|
|
32316
|
-
const previous = installed.get(iframe);
|
|
32317
|
-
const setter = win.__hf.setPausedVideoFrameProvider;
|
|
32318
|
-
if (previous?.document === iframe.contentDocument && previous.setter === setter) return;
|
|
32319
|
-
previous?.provider.dispose();
|
|
32320
|
-
let disposed = false;
|
|
32321
|
-
let decoder = null;
|
|
32322
|
-
const provider = {
|
|
32323
|
-
async decode(requests, signal) {
|
|
32324
|
-
signal.throwIfAborted();
|
|
32325
|
-
if (disposed) throw new DOMException("Preview disposed", "AbortError");
|
|
32326
|
-
decoder ??= import("./pausedVideoDecoder-W2SVMXDS.js").then(
|
|
32327
|
-
({ createPausedVideoDecoder }) => createPausedVideoDecoder(iframe)
|
|
32328
|
-
);
|
|
32329
|
-
const actual = await decoder;
|
|
32330
|
-
if (disposed) {
|
|
32331
|
-
actual.dispose();
|
|
32332
|
-
throw new DOMException("Preview disposed", "AbortError");
|
|
32333
|
-
}
|
|
32334
|
-
return actual.decode(requests, signal);
|
|
32335
|
-
},
|
|
32336
|
-
async suspend() {
|
|
32337
|
-
const actual = await decoder?.catch(() => null);
|
|
32338
|
-
await actual?.suspend?.();
|
|
32339
|
-
},
|
|
32340
|
-
dispose() {
|
|
32341
|
-
if (disposed) return;
|
|
32342
|
-
disposed = true;
|
|
32343
|
-
void decoder?.then((actual) => actual.dispose()).catch(() => {
|
|
32344
|
-
});
|
|
32345
|
-
win.removeEventListener("pagehide", onPageHide);
|
|
32346
|
-
}
|
|
32347
|
-
};
|
|
32348
|
-
const onPageHide = () => {
|
|
32349
|
-
provider.dispose();
|
|
32350
|
-
installed.delete(iframe);
|
|
32351
|
-
};
|
|
32352
|
-
win.addEventListener("pagehide", onPageHide, { once: true });
|
|
32353
|
-
installed.set(iframe, { document: iframe.contentDocument, provider, setter });
|
|
32354
|
-
setter(provider);
|
|
32355
|
-
}
|
|
32356
|
-
|
|
32357
32198
|
// src/player/lib/playbackScrub.ts
|
|
32358
32199
|
function scrubMusicAtSeek(iframe, nextTime) {
|
|
32359
32200
|
const s = usePlayerStore.getState();
|
|
@@ -32653,14 +32494,27 @@ function enrichDue(lastTimelineMessage, enriched) {
|
|
|
32653
32494
|
enriched.at = now2;
|
|
32654
32495
|
return true;
|
|
32655
32496
|
}
|
|
32497
|
+
function recoverClipManifest(deps, iframe, recovery) {
|
|
32498
|
+
if (recovery.asking) return;
|
|
32499
|
+
recovery.asking = true;
|
|
32500
|
+
previewClipManifest(iframe).then((manifest) => {
|
|
32501
|
+
const stillWanted = usePlayerStore.getState().elements.length === 0 && deps.iframeRef.current === iframe && !hasTimelinePerformanceFixtureLease();
|
|
32502
|
+
if (manifest && manifest.clips.length > 0 && stillWanted)
|
|
32503
|
+
deps.processTimelineMessageRef.current(manifest);
|
|
32504
|
+
}).catch(() => {
|
|
32505
|
+
}).finally(() => recovery.asking = false);
|
|
32506
|
+
}
|
|
32507
|
+
function recoverEmptyTimeline(deps, iframe, recovery) {
|
|
32508
|
+
if (iframe && previewFrameOpaque(iframe)) return recoverClipManifest(deps, iframe, recovery);
|
|
32509
|
+
const manifest = iframe?.contentWindow?.__clipManifest;
|
|
32510
|
+
if (manifest && manifest.clips.length > 0) {
|
|
32511
|
+
deps.processTimelineMessageRef.current(manifest);
|
|
32512
|
+
}
|
|
32513
|
+
}
|
|
32656
32514
|
function handleStateMessage(deps, iframe, playingHoldsClipListPosts, enriched) {
|
|
32657
32515
|
try {
|
|
32658
|
-
if (usePlayerStore.getState().elements.length === 0)
|
|
32659
|
-
|
|
32660
|
-
if (manifest && manifest.clips.length > 0) {
|
|
32661
|
-
deps.processTimelineMessageRef.current(manifest);
|
|
32662
|
-
}
|
|
32663
|
-
}
|
|
32516
|
+
if (usePlayerStore.getState().elements.length === 0)
|
|
32517
|
+
recoverEmptyTimeline(deps, iframe, enriched);
|
|
32664
32518
|
if (!playingHoldsClipListPosts && enrichDue(deps.lastTimelineMessageRef.current, enriched)) {
|
|
32665
32519
|
deps.enrichMissingCompositionsRef.current();
|
|
32666
32520
|
}
|
|
@@ -32704,7 +32558,7 @@ function applyStoreReport(data) {
|
|
|
32704
32558
|
}
|
|
32705
32559
|
}
|
|
32706
32560
|
function createPreviewMessageHandler(deps) {
|
|
32707
|
-
const enriched = { at: 0 };
|
|
32561
|
+
const enriched = { at: 0, asking: false };
|
|
32708
32562
|
return (e) => {
|
|
32709
32563
|
const iframe = deps.iframeRef.current;
|
|
32710
32564
|
const data = acceptedPreviewMessage(e, iframe);
|
|
@@ -32841,10 +32695,8 @@ function useTimelinePlayer({
|
|
|
32841
32695
|
(overrideIframe) => {
|
|
32842
32696
|
try {
|
|
32843
32697
|
const iframe = overrideIframe !== void 0 ? overrideIframe : iframeRef.current;
|
|
32844
|
-
|
|
32845
|
-
|
|
32846
|
-
attachPausedVideoProvider(iframe, win);
|
|
32847
|
-
const adapter = resolvePlaybackAdapter(iframe, win, {
|
|
32698
|
+
if (!iframe) return null;
|
|
32699
|
+
const adapter = resolveFramePlaybackAdapter(iframe, {
|
|
32848
32700
|
cache: staticSeekAdapterRef,
|
|
32849
32701
|
warned: staticSeekWarnedRef
|
|
32850
32702
|
});
|
|
@@ -32856,10 +32708,7 @@ function useTimelinePlayer({
|
|
|
32856
32708
|
[]
|
|
32857
32709
|
);
|
|
32858
32710
|
const setLoopStart = useCallback42((seconds) => {
|
|
32859
|
-
|
|
32860
|
-
iframeRef.current?.contentWindow?.__hf?.setLoopStart?.(seconds);
|
|
32861
|
-
} catch {
|
|
32862
|
-
}
|
|
32711
|
+
if (iframeRef.current) setFrameLoopStart(iframeRef.current, seconds);
|
|
32863
32712
|
}, []);
|
|
32864
32713
|
const { startRAFLoop, stopRAFLoop, stopReverseLoop } = useTimelinePlayerLoop({
|
|
32865
32714
|
rafRef,
|
|
@@ -35150,6 +34999,15 @@ function sameRect(a, b) {
|
|
|
35150
34999
|
const d = (k) => Math.abs(a[k] - b[k]);
|
|
35151
35000
|
return d("left") < 0.5 && d("top") < 0.5 && d("width") < 0.5 && d("height") < 0.5 && d("scaleX") < 1e-3 && d("scaleY") < 1e-3;
|
|
35152
35001
|
}
|
|
35002
|
+
function declaredCompositionSize(iframe) {
|
|
35003
|
+
if (previewFrameOpaque(iframe)) return previewStageSize(iframe) ?? { width: NaN, height: NaN };
|
|
35004
|
+
const doc = iframe.contentDocument;
|
|
35005
|
+
const root = doc?.querySelector("[data-composition-id]") ?? doc?.documentElement;
|
|
35006
|
+
return {
|
|
35007
|
+
width: Number.parseFloat(root?.getAttribute("data-width") ?? ""),
|
|
35008
|
+
height: Number.parseFloat(root?.getAttribute("data-height") ?? "")
|
|
35009
|
+
};
|
|
35010
|
+
}
|
|
35153
35011
|
function useDomEditCompositionRect({
|
|
35154
35012
|
iframeRef,
|
|
35155
35013
|
overlayRef
|
|
@@ -35172,10 +35030,7 @@ function useDomEditCompositionRect({
|
|
|
35172
35030
|
const left = iRect.left - oRect.left;
|
|
35173
35031
|
const top = iRect.top - oRect.top;
|
|
35174
35032
|
if (iRect.width <= 0 || iRect.height <= 0) return;
|
|
35175
|
-
const
|
|
35176
|
-
const root = doc?.querySelector("[data-composition-id]") ?? doc?.documentElement;
|
|
35177
|
-
const dw = Number.parseFloat(root?.getAttribute("data-width") ?? "");
|
|
35178
|
-
const dh = Number.parseFloat(root?.getAttribute("data-height") ?? "");
|
|
35033
|
+
const { width: dw, height: dh } = declaredCompositionSize(iframe);
|
|
35179
35034
|
const scaleX = dw > 0 ? iRect.width / dw : 1;
|
|
35180
35035
|
const scaleY = dh > 0 ? iRect.height / dh : 1;
|
|
35181
35036
|
const next = { left, top, width: iRect.width, height: iRect.height, scaleX, scaleY };
|
|
@@ -39290,7 +39145,7 @@ function OffCanvasIndicators({
|
|
|
39290
39145
|
const selectOffCanvas = async () => {
|
|
39291
39146
|
const el = elements.current.get(r.key);
|
|
39292
39147
|
if (!el) return;
|
|
39293
|
-
const { resolveDomEditSelection: resolveDomEditSelection2 } = await import("./domEditingLayers-
|
|
39148
|
+
const { resolveDomEditSelection: resolveDomEditSelection2 } = await import("./domEditingLayers-FRVHP6IB.js");
|
|
39294
39149
|
const acp = activeCompositionPathRef.current ?? "index.html";
|
|
39295
39150
|
const sel = await resolveDomEditSelection2(el, {
|
|
39296
39151
|
activeCompositionPath: acp,
|
|
@@ -39353,22 +39208,27 @@ function createGestureReadout(overlay, iframe, rect) {
|
|
|
39353
39208
|
viewportWidth: window.innerWidth,
|
|
39354
39209
|
viewportHeight: window.innerHeight,
|
|
39355
39210
|
text: "",
|
|
39356
|
-
rect
|
|
39211
|
+
rect,
|
|
39212
|
+
baseRect: rect
|
|
39357
39213
|
};
|
|
39358
39214
|
}
|
|
39359
|
-
function
|
|
39360
|
-
if (!readout) return;
|
|
39215
|
+
function setReadout(readout, rect, text3) {
|
|
39361
39216
|
const { basis } = readout;
|
|
39362
39217
|
const x = (rect.left - (basis.iframeRect.left - basis.overlayRect.left)) / basis.rootScaleX;
|
|
39363
39218
|
const y = (rect.top - (basis.iframeRect.top - basis.overlayRect.top)) / basis.rootScaleY;
|
|
39364
|
-
readout.text = text3 ?? `
|
|
39219
|
+
readout.text = text3 ?? `X ${Math.round(x)} \xB7 Y ${Math.round(y)}`;
|
|
39365
39220
|
readout.rect = rect;
|
|
39366
39221
|
}
|
|
39367
|
-
function
|
|
39368
|
-
if (readout)
|
|
39222
|
+
function updateGestureReadout(readout, rect, text3) {
|
|
39223
|
+
if (readout) setReadout(readout, { ...rect, angle: readout.baseRect.angle }, text3);
|
|
39224
|
+
}
|
|
39225
|
+
function updateGestureReadoutAngle(readout, angle, startAngle = 0) {
|
|
39226
|
+
if (!readout) return;
|
|
39227
|
+
const turned = (readout.baseRect.angle ?? 0) + angle - startAngle;
|
|
39228
|
+
setReadout(readout, { ...readout.baseRect, angle: turned }, `\u21BB ${Math.round(angle)}\xB0`);
|
|
39369
39229
|
}
|
|
39370
39230
|
function updateGestureReadoutSize(readout, rect, size) {
|
|
39371
|
-
updateGestureReadout(readout, rect,
|
|
39231
|
+
updateGestureReadout(readout, rect, `W ${Math.round(size.width)} \xB7 H ${Math.round(size.height)}`);
|
|
39372
39232
|
}
|
|
39373
39233
|
|
|
39374
39234
|
// src/components/editor/domEditResizeLocal.ts
|
|
@@ -41916,7 +41776,7 @@ function createDomEditOverlayGestureHandlers(opts) {
|
|
|
41916
41776
|
actualAngle: g.actualRotation,
|
|
41917
41777
|
snap: e.shiftKey
|
|
41918
41778
|
});
|
|
41919
|
-
updateGestureReadoutAngle(g.readout, rotated.angle);
|
|
41779
|
+
updateGestureReadoutAngle(g.readout, rotated.angle, g.actualRotation);
|
|
41920
41780
|
applyRotationDraft(sel.element, rotated.angle, g.plainRotation);
|
|
41921
41781
|
return;
|
|
41922
41782
|
}
|
|
@@ -43502,7 +43362,7 @@ function InlineTextCaret({
|
|
|
43502
43362
|
let side = "after";
|
|
43503
43363
|
const update = () => setPlacement(composing ? null : placeAtCaret(element, iframe, color, side));
|
|
43504
43364
|
const onKey = ({ key: key2 }) => {
|
|
43505
|
-
if (!
|
|
43365
|
+
if (!MODIFIERS.has(key2)) side = SIDE_OF_KEY[key2] ?? "after";
|
|
43506
43366
|
};
|
|
43507
43367
|
const onPress = () => void (side = "after");
|
|
43508
43368
|
const composition = (on) => () => {
|
|
@@ -43574,7 +43434,7 @@ function caretColorOf(element) {
|
|
|
43574
43434
|
if (!style) return "currentColor";
|
|
43575
43435
|
return style.caretColor && style.caretColor !== "auto" ? style.caretColor : style.color;
|
|
43576
43436
|
}
|
|
43577
|
-
var
|
|
43437
|
+
var MODIFIERS = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta"]);
|
|
43578
43438
|
var SIDE_OF_KEY = { End: "before" };
|
|
43579
43439
|
function placeAtCaret(element, iframe, color, side) {
|
|
43580
43440
|
const view = element.ownerDocument.defaultView;
|
|
@@ -44682,22 +44542,134 @@ function useOffCanvasIndicators({
|
|
|
44682
44542
|
|
|
44683
44543
|
// src/components/editor/DomEditGestureReadout.tsx
|
|
44684
44544
|
import { useRef as useRef76 } from "react";
|
|
44545
|
+
|
|
44546
|
+
// src/components/editor/domEditGestureReadoutPlacement.ts
|
|
44547
|
+
var GAP_PX2 = 8;
|
|
44548
|
+
var EDGE_PX = 4;
|
|
44549
|
+
var SNAP_TOOLBAR_BAND_PX = 36;
|
|
44550
|
+
var SNAP_TOOLBAR_WIDTH_PX = 180;
|
|
44551
|
+
var CHIP_HEIGHT_PX = 32;
|
|
44552
|
+
var CHAR_PX = 8;
|
|
44553
|
+
var CHIP_PADDING_PX = 36;
|
|
44554
|
+
var SIDES = ["below", "right", "left", "above"];
|
|
44555
|
+
function visibleBox(readout) {
|
|
44556
|
+
const bounds = readout.basis.overlayRect;
|
|
44557
|
+
const stage = readout.basis.iframeRect;
|
|
44558
|
+
const stageLeft = stage.left - bounds.left;
|
|
44559
|
+
const stageTop = stage.top - bounds.top;
|
|
44560
|
+
const minY = Math.max(0, -bounds.top, stageTop) + EDGE_PX;
|
|
44561
|
+
const maxX = Math.min(bounds.width, readout.viewportWidth - bounds.left, stageLeft + stage.width) - EDGE_PX;
|
|
44562
|
+
return {
|
|
44563
|
+
minX: Math.max(0, -bounds.left, stageLeft) + EDGE_PX,
|
|
44564
|
+
minY,
|
|
44565
|
+
toolbarBottom: minY + SNAP_TOOLBAR_BAND_PX,
|
|
44566
|
+
toolbarLeft: maxX - SNAP_TOOLBAR_WIDTH_PX,
|
|
44567
|
+
maxX,
|
|
44568
|
+
maxY: Math.min(bounds.height, readout.viewportHeight - bounds.top, stageTop + stage.height) - EDGE_PX
|
|
44569
|
+
};
|
|
44570
|
+
}
|
|
44571
|
+
function clearOfToolbar(box, right, top) {
|
|
44572
|
+
return right <= box.toolbarLeft || top >= box.toolbarBottom;
|
|
44573
|
+
}
|
|
44574
|
+
function paintedBox(rect) {
|
|
44575
|
+
const radians = (rect.angle ?? 0) * Math.PI / 180;
|
|
44576
|
+
const cos = Math.abs(Math.cos(radians));
|
|
44577
|
+
const sin = Math.abs(Math.sin(radians));
|
|
44578
|
+
const width = rect.width * cos + rect.height * sin;
|
|
44579
|
+
const height = rect.width * sin + rect.height * cos;
|
|
44580
|
+
return {
|
|
44581
|
+
...rect,
|
|
44582
|
+
left: rect.left + (rect.width - width) / 2,
|
|
44583
|
+
top: rect.top + (rect.height - height) / 2,
|
|
44584
|
+
width,
|
|
44585
|
+
height
|
|
44586
|
+
};
|
|
44587
|
+
}
|
|
44588
|
+
function fitsBeside(box, x0, x1, top) {
|
|
44589
|
+
const inside = x0 >= box.minX && x1 <= box.maxX && top >= box.minY && top + CHIP_HEIGHT_PX <= box.maxY;
|
|
44590
|
+
return inside && clearOfToolbar(box, x1, top);
|
|
44591
|
+
}
|
|
44592
|
+
function chipSpots(readout, box, width) {
|
|
44593
|
+
const rect = paintedBox(readout.rect);
|
|
44594
|
+
const right = rect.left + rect.width;
|
|
44595
|
+
const bottom = rect.top + rect.height;
|
|
44596
|
+
const centre = rect.left + rect.width / 2;
|
|
44597
|
+
const middle = rect.top + rect.height / 2 - CHIP_HEIGHT_PX / 2;
|
|
44598
|
+
const toolbarBelow = readout.basis.overlayRect.top + rect.top - GAP_PX < TOOLBAR_HEIGHT_PX;
|
|
44599
|
+
const toolbarBand = toolbarBelow ? 0 : GAP_PX + TOOLBAR_HEIGHT_PX;
|
|
44600
|
+
return {
|
|
44601
|
+
below: {
|
|
44602
|
+
x: centre,
|
|
44603
|
+
y: bottom + GAP_PX2,
|
|
44604
|
+
fits: !toolbarBelow && bottom + GAP_PX2 + CHIP_HEIGHT_PX <= box.maxY
|
|
44605
|
+
},
|
|
44606
|
+
right: {
|
|
44607
|
+
x: right + GAP_PX2,
|
|
44608
|
+
y: middle,
|
|
44609
|
+
fits: fitsBeside(box, right + GAP_PX2, right + GAP_PX2 + width, middle)
|
|
44610
|
+
},
|
|
44611
|
+
left: {
|
|
44612
|
+
x: rect.left - GAP_PX2,
|
|
44613
|
+
y: middle,
|
|
44614
|
+
fits: fitsBeside(box, rect.left - GAP_PX2 - width, rect.left - GAP_PX2, middle)
|
|
44615
|
+
},
|
|
44616
|
+
above: { x: centre, y: rect.top - GAP_PX2 - toolbarBand - CHIP_HEIGHT_PX, fits: true }
|
|
44617
|
+
};
|
|
44618
|
+
}
|
|
44619
|
+
function chooseSide(kept, spots) {
|
|
44620
|
+
if (kept && spots[kept].fits) return kept;
|
|
44621
|
+
return SIDES.find((side) => spots[side].fits) ?? "above";
|
|
44622
|
+
}
|
|
44623
|
+
var TRANSFORMS = {
|
|
44624
|
+
below: "translateX(-50%)",
|
|
44625
|
+
above: "translateX(-50%)",
|
|
44626
|
+
left: "translateX(-100%)",
|
|
44627
|
+
right: "none"
|
|
44628
|
+
};
|
|
44629
|
+
function placeChip(readout, text3) {
|
|
44630
|
+
const box = visibleBox(readout);
|
|
44631
|
+
const width = text3.length * CHAR_PX + CHIP_PADDING_PX;
|
|
44632
|
+
const spots = chipSpots(readout, box, width);
|
|
44633
|
+
const side = chooseSide(readout.side, spots);
|
|
44634
|
+
const spot = spots[side];
|
|
44635
|
+
const centred = TRANSFORMS[side] === "translateX(-50%)";
|
|
44636
|
+
const left = centred ? Math.max(box.minX + width / 2, Math.min(box.maxX - width / 2, spot.x)) : spot.x;
|
|
44637
|
+
const chipRight = side === "right" ? left + width : side === "left" ? left : left + width / 2;
|
|
44638
|
+
const floor = clearOfToolbar(box, chipRight, box.minY) ? box.minY : box.toolbarBottom;
|
|
44639
|
+
const top = Math.min(box.maxY - CHIP_HEIGHT_PX, Math.max(floor, spot.y));
|
|
44640
|
+
return { side, left, top, transform: TRANSFORMS[side] };
|
|
44641
|
+
}
|
|
44642
|
+
|
|
44643
|
+
// src/components/editor/DomEditGestureReadout.tsx
|
|
44685
44644
|
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
44686
|
-
function positionGestureReadout(label, gesture) {
|
|
44645
|
+
function positionGestureReadout(label, gesture, text3) {
|
|
44687
44646
|
const readout = gesture.readout;
|
|
44688
44647
|
if (!readout) return;
|
|
44689
|
-
const
|
|
44690
|
-
|
|
44691
|
-
|
|
44692
|
-
|
|
44693
|
-
|
|
44694
|
-
|
|
44695
|
-
|
|
44696
|
-
const
|
|
44697
|
-
|
|
44698
|
-
|
|
44699
|
-
|
|
44700
|
-
|
|
44648
|
+
const placed = placeChip(readout, text3);
|
|
44649
|
+
readout.side = placed.side;
|
|
44650
|
+
label.style.left = `${placed.left}px`;
|
|
44651
|
+
label.style.top = `${placed.top}px`;
|
|
44652
|
+
label.style.transform = placed.transform;
|
|
44653
|
+
}
|
|
44654
|
+
function renderFields(label, text3) {
|
|
44655
|
+
const fields = text3.split(" \xB7 ").flatMap((field, index2) => {
|
|
44656
|
+
const [name = "", ...value] = field.split(" ");
|
|
44657
|
+
const cells = document.createElement("span");
|
|
44658
|
+
cells.className = "flex items-baseline gap-1.5";
|
|
44659
|
+
const key2 = document.createElement("span");
|
|
44660
|
+
key2.className = "text-text-4";
|
|
44661
|
+
key2.textContent = name;
|
|
44662
|
+
const figure = document.createElement("span");
|
|
44663
|
+
figure.className = "min-w-[4ch] text-right font-medium";
|
|
44664
|
+
figure.textContent = value.join(" ");
|
|
44665
|
+
cells.append(key2, figure);
|
|
44666
|
+
if (index2 === 0) return [cells];
|
|
44667
|
+
const divider = document.createElement("span");
|
|
44668
|
+
divider.className = "h-3.5 w-px bg-border";
|
|
44669
|
+
return [divider, cells];
|
|
44670
|
+
});
|
|
44671
|
+
label.replaceChildren(...fields);
|
|
44672
|
+
label.dataset.readoutText = text3;
|
|
44701
44673
|
}
|
|
44702
44674
|
function DomEditGestureReadout({ gestureRef }) {
|
|
44703
44675
|
const labelRef = useRef76(null);
|
|
@@ -44711,9 +44683,9 @@ function DomEditGestureReadout({ gestureRef }) {
|
|
|
44711
44683
|
label.style.display = "none";
|
|
44712
44684
|
return;
|
|
44713
44685
|
}
|
|
44714
|
-
if (label.
|
|
44715
|
-
label.style.display = "
|
|
44716
|
-
positionGestureReadout(label, gesture);
|
|
44686
|
+
if (label.dataset.readoutText !== text3) renderFields(label, text3);
|
|
44687
|
+
label.style.display = "flex";
|
|
44688
|
+
positionGestureReadout(label, gesture, text3);
|
|
44717
44689
|
})
|
|
44718
44690
|
);
|
|
44719
44691
|
return /* @__PURE__ */ jsx111(
|
|
@@ -44722,7 +44694,7 @@ function DomEditGestureReadout({ gestureRef }) {
|
|
|
44722
44694
|
ref: labelRef,
|
|
44723
44695
|
"aria-hidden": "true",
|
|
44724
44696
|
"data-dom-edit-gesture-readout": "true",
|
|
44725
|
-
className: "pointer-events-none absolute z-50
|
|
44697
|
+
className: "pointer-events-none absolute z-50 flex h-8 items-center gap-2 rounded-lg border border-border bg-raised px-3 text-xs whitespace-nowrap text-studio-text tabular-nums shadow-[0_8px_24px_rgba(0,0,0,0.55)]",
|
|
44726
44698
|
style: { display: "none" }
|
|
44727
44699
|
}
|
|
44728
44700
|
);
|
|
@@ -103092,6 +103064,51 @@ function StudioApp({ readOnlyPreview = false, readOnlyPreviewReason } = {}) {
|
|
|
103092
103064
|
// src/hooks/useElementPicker.ts
|
|
103093
103065
|
import { useState as useState171, useCallback as useCallback198, useEffect as useEffect167, useRef as useRef196 } from "react";
|
|
103094
103066
|
|
|
103067
|
+
// src/hooks/elementPickerStyles.ts
|
|
103068
|
+
var PICKED_STYLE_PROPERTIES = [
|
|
103069
|
+
"position",
|
|
103070
|
+
"top",
|
|
103071
|
+
"left",
|
|
103072
|
+
"right",
|
|
103073
|
+
"bottom",
|
|
103074
|
+
"width",
|
|
103075
|
+
"height",
|
|
103076
|
+
"margin-top",
|
|
103077
|
+
"margin-right",
|
|
103078
|
+
"margin-bottom",
|
|
103079
|
+
"margin-left",
|
|
103080
|
+
"padding-top",
|
|
103081
|
+
"padding-right",
|
|
103082
|
+
"padding-bottom",
|
|
103083
|
+
"padding-left",
|
|
103084
|
+
"font-size",
|
|
103085
|
+
"font-weight",
|
|
103086
|
+
"font-family",
|
|
103087
|
+
"color",
|
|
103088
|
+
"background-color",
|
|
103089
|
+
"background",
|
|
103090
|
+
"opacity",
|
|
103091
|
+
"border-radius",
|
|
103092
|
+
"transform",
|
|
103093
|
+
"z-index"
|
|
103094
|
+
];
|
|
103095
|
+
function readComputedStyles(iframe, selector) {
|
|
103096
|
+
const styles = {};
|
|
103097
|
+
try {
|
|
103098
|
+
const doc = iframe.contentDocument;
|
|
103099
|
+
const el = doc?.querySelector(selector);
|
|
103100
|
+
if (!el) return styles;
|
|
103101
|
+
const computed = iframe.contentWindow?.getComputedStyle(el);
|
|
103102
|
+
if (!computed) return styles;
|
|
103103
|
+
for (const prop of PICKED_STYLE_PROPERTIES) {
|
|
103104
|
+
const val = prop === "opacity" ? getLogicalOpacity(el, computed) : computed.getPropertyValue(prop);
|
|
103105
|
+
if (val) styles[prop] = val;
|
|
103106
|
+
}
|
|
103107
|
+
} catch {
|
|
103108
|
+
}
|
|
103109
|
+
return styles;
|
|
103110
|
+
}
|
|
103111
|
+
|
|
103095
103112
|
// src/hooks/elementPickerHoverLabel.ts
|
|
103096
103113
|
var LABEL_GAP_PX = 6;
|
|
103097
103114
|
var LABEL_MAX_CHARS = 72;
|
|
@@ -103302,7 +103319,18 @@ function useElementPickerSession(iframeRef) {
|
|
|
103302
103319
|
pickedElementRef.current = null;
|
|
103303
103320
|
setPickedElement(null);
|
|
103304
103321
|
}, []);
|
|
103305
|
-
const
|
|
103322
|
+
const originsOfWindowsThatWerePrimary = useRef196(/* @__PURE__ */ new WeakMap());
|
|
103323
|
+
const showPicked = useCallback198((next, iframe) => {
|
|
103324
|
+
pickedElementRef.current = next;
|
|
103325
|
+
setPickedElement(next);
|
|
103326
|
+
if (!previewFrameOpaque(iframe)) return;
|
|
103327
|
+
void previewComputedStyles(iframe, next.selector, PICKED_STYLE_PROPERTIES).then((styles) => {
|
|
103328
|
+
if (!styles || pickedElementRef.current !== next) return;
|
|
103329
|
+
const filled = { ...next, computedStyles: styles };
|
|
103330
|
+
pickedElementRef.current = filled;
|
|
103331
|
+
setPickedElement(filled);
|
|
103332
|
+
});
|
|
103333
|
+
}, []);
|
|
103306
103334
|
useEffect167(() => {
|
|
103307
103335
|
if (!isPickMode) return;
|
|
103308
103336
|
const handleKeyDown = (event) => {
|
|
@@ -103322,10 +103350,11 @@ function useElementPickerSession(iframeRef) {
|
|
|
103322
103350
|
const activeIframe = getActiveIframe();
|
|
103323
103351
|
if (!activeIframe) return;
|
|
103324
103352
|
if (!e.source) return;
|
|
103325
|
-
|
|
103326
|
-
|
|
103327
|
-
|
|
103328
|
-
|
|
103353
|
+
const primary = iframeRef.current;
|
|
103354
|
+
if (primary && e.source === primary.contentWindow)
|
|
103355
|
+
originsOfWindowsThatWerePrimary.current.set(e.source, frameOrigins(primary));
|
|
103356
|
+
const origins = e.source === activeIframe.contentWindow ? frameOrigins(activeIframe) : originsOfWindowsThatWerePrimary.current.get(e.source);
|
|
103357
|
+
if (!origins?.includes(e.origin)) return;
|
|
103329
103358
|
if (data.type === "element-hovered") {
|
|
103330
103359
|
if (e.source !== activeIframe.contentWindow || !isPickModeRef.current) return;
|
|
103331
103360
|
const info = toHoverInfo(data.elementInfo);
|
|
@@ -103333,20 +103362,14 @@ function useElementPickerSession(iframeRef) {
|
|
|
103333
103362
|
return;
|
|
103334
103363
|
}
|
|
103335
103364
|
if (data.type === "element-picked" && data.elementInfo) {
|
|
103336
|
-
|
|
103337
|
-
pickedElementRef.current = next;
|
|
103338
|
-
setPickedElement(next);
|
|
103365
|
+
showPicked(toPickedElement(data.elementInfo, activeIframe), activeIframe);
|
|
103339
103366
|
pickStartSelectionRef.current = void 0;
|
|
103340
103367
|
isPickModeRef.current = false;
|
|
103341
103368
|
clearHover();
|
|
103342
103369
|
setIsPickMode(false);
|
|
103343
103370
|
} else if (data.type === "element-pick-candidates") {
|
|
103344
103371
|
const el = data.candidates?.[data.selectedIndex ?? 0];
|
|
103345
|
-
if (el)
|
|
103346
|
-
const next = toPickedElement(el, activeIframe);
|
|
103347
|
-
pickedElementRef.current = next;
|
|
103348
|
-
setPickedElement(next);
|
|
103349
|
-
}
|
|
103372
|
+
if (el) showPicked(toPickedElement(el, activeIframe), activeIframe);
|
|
103350
103373
|
}
|
|
103351
103374
|
if (data.type === "pick-mode-cancelled") {
|
|
103352
103375
|
cancelPick(false);
|
|
@@ -103582,49 +103605,6 @@ function patchByHfId(files, hfId, ownFile, op) {
|
|
|
103582
103605
|
const before = path ? files[path] : void 0;
|
|
103583
103606
|
return path && before ? { path, before, after: applyPatchByTarget(before, { hfId }, op) } : null;
|
|
103584
103607
|
}
|
|
103585
|
-
function readComputedStyles(iframe, selector) {
|
|
103586
|
-
const styles = {};
|
|
103587
|
-
try {
|
|
103588
|
-
const doc = iframe.contentDocument;
|
|
103589
|
-
const el = doc?.querySelector(selector);
|
|
103590
|
-
if (!el) return styles;
|
|
103591
|
-
const computed = iframe.contentWindow?.getComputedStyle(el);
|
|
103592
|
-
if (!computed) return styles;
|
|
103593
|
-
const props = [
|
|
103594
|
-
"position",
|
|
103595
|
-
"top",
|
|
103596
|
-
"left",
|
|
103597
|
-
"right",
|
|
103598
|
-
"bottom",
|
|
103599
|
-
"width",
|
|
103600
|
-
"height",
|
|
103601
|
-
"margin-top",
|
|
103602
|
-
"margin-right",
|
|
103603
|
-
"margin-bottom",
|
|
103604
|
-
"margin-left",
|
|
103605
|
-
"padding-top",
|
|
103606
|
-
"padding-right",
|
|
103607
|
-
"padding-bottom",
|
|
103608
|
-
"padding-left",
|
|
103609
|
-
"font-size",
|
|
103610
|
-
"font-weight",
|
|
103611
|
-
"font-family",
|
|
103612
|
-
"color",
|
|
103613
|
-
"background-color",
|
|
103614
|
-
"background",
|
|
103615
|
-
"opacity",
|
|
103616
|
-
"border-radius",
|
|
103617
|
-
"transform",
|
|
103618
|
-
"z-index"
|
|
103619
|
-
];
|
|
103620
|
-
for (const prop of props) {
|
|
103621
|
-
const val = prop === "opacity" ? getLogicalOpacity(el, computed) : computed.getPropertyValue(prop);
|
|
103622
|
-
if (val) styles[prop] = val;
|
|
103623
|
-
}
|
|
103624
|
-
} catch {
|
|
103625
|
-
}
|
|
103626
|
-
return styles;
|
|
103627
|
-
}
|
|
103628
103608
|
|
|
103629
103609
|
// src/utils/htmlEditor.ts
|
|
103630
103610
|
function parseStyleString(style) {
|