@hyperframes/studio 0.9.39 → 0.9.41
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-CY6KnWXa.js → codec-B_mpbc4w.js} +1 -1
- package/dist/assets/{hyperframes-player-B9-CuG_h.js → hyperframes-player-Dvi3I_mv.js} +1 -1
- package/dist/assets/{index-_pkzoYYF.js → index-B5ExwsOp.js} +146 -146
- package/dist/assets/{index-Bjz2UaYv.js → index-BrFm9Y5k.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-Dr7nKUUu.js → pausedVideoDecoder-MHQ57yZ6.js} +1 -1
- package/dist/{chunk-NBULUIWH.js → chunk-4QQMX4BX.js} +17 -8
- package/dist/{chunk-ATDO3YLX.js → chunk-GVW7AU57.js} +190 -254
- package/dist/{chunk-44VRMER6.js → chunk-VHV2ZDKY.js} +17 -97
- package/dist/{domEditingLayers-FRVHP6IB.js → domEditingLayers-SA5KLSSS.js} +4 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.html +1 -1
- package/dist/index.js +898 -551
- package/dist/player.js +2 -2
- package/package.json +8 -8
- package/src/components/editor/DomEditOverlay.tsx +3 -15
- package/src/components/editor/clickAfterPreventedPress.test.tsx +17 -1
- package/src/components/editor/domEditOverlayBasis.ts +7 -2
- package/src/components/editor/domEditOverlayCrop.test.ts +1 -1
- package/src/components/editor/domEditOverlayCrop.ts +17 -3
- package/src/components/editor/domEditOverlayGeometry.ts +64 -139
- package/src/components/editor/domEditSelectionRules.ts +138 -0
- package/src/components/editor/domEditing.test.ts +6 -28
- package/src/components/editor/domEditingDom.preview.test.ts +3 -3
- package/src/components/editor/domEditingDom.ts +24 -165
- package/src/components/editor/domEditingElement.ts +19 -240
- package/src/components/editor/domEditingGroups.ts +0 -31
- package/src/components/editor/domEditingLayers.ts +95 -100
- package/src/components/editor/domEditingRootLayer.ts +35 -30
- package/src/components/editor/domEditingTypes.ts +4 -0
- package/src/components/editor/previewGestureStarts.ts +73 -10
- package/src/components/editor/previewOverlayRects.test.ts +316 -0
- package/src/components/editor/previewOverlayRects.ts +123 -0
- package/src/components/editor/previewPointerTargets.test.ts +260 -0
- package/src/components/editor/previewSelection.test.ts +481 -0
- package/src/components/editor/previewSelection.ts +472 -0
- package/src/components/editor/probeSourceElement.ts +19 -1
- package/src/components/editor/propertyPanelFill.tsx +5 -1
- package/src/components/editor/useDomEditOverlayRects.ts +80 -1
- package/src/components/editor/useInlineTextEditing.tsx +1 -6
- package/src/hooks/domSelectionTestHarness.ts +1 -1
- package/src/hooks/useDomEditSession.test.tsx +23 -1
- package/src/hooks/useDomEditSession.ts +2 -1
- package/src/hooks/useDomSelection.ts +61 -47
- package/src/hooks/useGsapSelectionHandlers.test.tsx +17 -0
- package/src/hooks/useGsapSelectionHandlers.ts +2 -1
- package/src/hooks/usePreviewInteraction.test.ts +10 -2
- package/src/hooks/usePreviewInteraction.ts +5 -4
- package/src/hooks/useStudioSelectionPublisher.test.tsx +50 -0
- package/src/hooks/useStudioSelectionPublisher.ts +9 -7
- package/src/player/lib/previewChannel.ts +26 -10
- package/src/player/lib/previewElements.test.ts +167 -0
- package/src/player/lib/previewElements.ts +226 -0
- package/src/styles/hex-baseline.json +1 -2
- package/src/utils/studioHelpers.ts +0 -13
- package/src/utils/studioPreviewHelpers.test.ts +8 -8
- package/src/utils/studioPreviewHelpers.ts +26 -242
- package/src/components/editor/domEditOverlayTransform.ts +0 -126
package/dist/index.js
CHANGED
|
@@ -59,8 +59,10 @@ import {
|
|
|
59
59
|
postRuntimeControlMessage,
|
|
60
60
|
previewClipManifest,
|
|
61
61
|
previewComputedStyles,
|
|
62
|
+
previewEditingClient,
|
|
62
63
|
previewFrameOpaque,
|
|
63
64
|
previewReloadBegun,
|
|
65
|
+
previewRequest,
|
|
64
66
|
previewSeekPainted,
|
|
65
67
|
previewStageSize,
|
|
66
68
|
readStudioUiPreferences,
|
|
@@ -87,7 +89,7 @@ import {
|
|
|
87
89
|
whileScriptWrites,
|
|
88
90
|
writeStudioUiPreferences,
|
|
89
91
|
zoomToSelectedClips
|
|
90
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-4QQMX4BX.js";
|
|
91
93
|
import {
|
|
92
94
|
Button,
|
|
93
95
|
ContextMenu,
|
|
@@ -136,25 +138,31 @@ import {
|
|
|
136
138
|
buildDomEditStylePatchOperation,
|
|
137
139
|
buildDomEditTextPatchOperation,
|
|
138
140
|
buildTextFieldChildLocator,
|
|
141
|
+
capabilityFacts,
|
|
142
|
+
chainLocked,
|
|
139
143
|
collectDomEditLayerItems,
|
|
144
|
+
coversCompositionRoot,
|
|
140
145
|
createDomEditLayerWalkCache,
|
|
141
146
|
domEditSelectionToFacts,
|
|
142
147
|
drainPendingLayerMutations,
|
|
148
|
+
existsInSourceFile,
|
|
143
149
|
findElementForSelection,
|
|
144
150
|
findElementForTimelineElement,
|
|
145
151
|
findPreviewNode,
|
|
146
152
|
getDomEditLayerKey,
|
|
147
153
|
getDomEditTargetKey,
|
|
148
|
-
getDomLayerPatchTarget,
|
|
149
154
|
isElementComputedVisible,
|
|
150
155
|
isTextEditableSelection,
|
|
151
156
|
liveLayerElement,
|
|
152
157
|
readHfId,
|
|
153
|
-
resolveAllVisualDomEditTargets,
|
|
154
158
|
resolveDomEditSelection,
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
selectionLookups,
|
|
160
|
+
selectionTargetIndex,
|
|
161
|
+
serializeDomEditTextFields,
|
|
162
|
+
timelineElementLookup
|
|
163
|
+
} from "./chunk-GVW7AU57.js";
|
|
157
164
|
import {
|
|
165
|
+
CURATED_STYLE_PROPERTIES,
|
|
158
166
|
LAYER_REVEAL_PRIOR_POSITION_ATTR,
|
|
159
167
|
LAYER_REVEAL_PRIOR_Z_ATTR,
|
|
160
168
|
STUDIO_FLAT_INSPECTOR_ENABLED,
|
|
@@ -162,6 +170,7 @@ import {
|
|
|
162
170
|
STUDIO_SDK_CUTOVER_FAMILIES,
|
|
163
171
|
STUDIO_SDK_RESOLVER_SHADOW_ENABLED,
|
|
164
172
|
applyMediaMetadataFromElement,
|
|
173
|
+
buildElementLabel,
|
|
165
174
|
buildProjectApiPath,
|
|
166
175
|
buildProjectHash,
|
|
167
176
|
buildStableSelector,
|
|
@@ -176,7 +185,9 @@ import {
|
|
|
176
185
|
formatCssColor,
|
|
177
186
|
furthestClipEndFromDocument,
|
|
178
187
|
getAdapterDuration,
|
|
188
|
+
getDataAttributes,
|
|
179
189
|
getDefaultStaticSeekPlaybackClock,
|
|
190
|
+
getInlineStyles,
|
|
180
191
|
getLogicalOpacity,
|
|
181
192
|
getSelectorIndex,
|
|
182
193
|
getSourceFileForElement,
|
|
@@ -206,6 +217,7 @@ import {
|
|
|
206
217
|
readTimelineElementZIndex,
|
|
207
218
|
readTimelineText,
|
|
208
219
|
releaseStaticSeekCache,
|
|
220
|
+
resolveElementSourceFile,
|
|
209
221
|
resolveMediaElement,
|
|
210
222
|
resolvePickerColor,
|
|
211
223
|
resolveStaticSeekFallback,
|
|
@@ -222,7 +234,7 @@ import {
|
|
|
222
234
|
toHexColor,
|
|
223
235
|
withSelectorIndexPass,
|
|
224
236
|
wrapTimeline
|
|
225
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-VHV2ZDKY.js";
|
|
226
238
|
import {
|
|
227
239
|
MediaFetchError,
|
|
228
240
|
mediaUrlSourceOptions,
|
|
@@ -16960,11 +16972,11 @@ function escapeRegex(s) {
|
|
|
16960
16972
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16961
16973
|
}
|
|
16962
16974
|
function tagAttribute(tag, name) {
|
|
16963
|
-
return scanHtmlOpeningTags(tag)[0]?.attributes.find((
|
|
16975
|
+
return scanHtmlOpeningTags(tag)[0]?.attributes.find((attr2) => attr2.name === name.toLowerCase());
|
|
16964
16976
|
}
|
|
16965
16977
|
function patchTagAttribute(tag, name, edit) {
|
|
16966
16978
|
if (edit.kind === "remove") {
|
|
16967
|
-
const attributes = scanHtmlOpeningTags(tag)[0]?.attributes.filter((
|
|
16979
|
+
const attributes = scanHtmlOpeningTags(tag)[0]?.attributes.filter((attr3) => attr3.name === name.toLowerCase()) ?? [];
|
|
16968
16980
|
const parts = [];
|
|
16969
16981
|
let cursor = 0;
|
|
16970
16982
|
for (const attribute of attributes) {
|
|
@@ -16976,9 +16988,9 @@ function patchTagAttribute(tag, name, edit) {
|
|
|
16976
16988
|
parts.push(tag.slice(cursor));
|
|
16977
16989
|
return parts.join("");
|
|
16978
16990
|
}
|
|
16979
|
-
const
|
|
16991
|
+
const attr2 = tagAttribute(tag, name);
|
|
16980
16992
|
const replacement = edit.kind === "boolean" ? name : `${name}="${escapeHtmlAttribute(edit.value)}"`;
|
|
16981
|
-
if (
|
|
16993
|
+
if (attr2) return tag.slice(0, attr2.start) + replacement + tag.slice(attr2.end);
|
|
16982
16994
|
return tag.endsWith("/") ? `${tag.slice(0, -1).trimEnd()} ${replacement} /` : `${tag} ${replacement}`;
|
|
16983
16995
|
}
|
|
16984
16996
|
function escapeStyleAttributeValue(value, quote) {
|
|
@@ -17108,8 +17120,8 @@ function replaceTagAtMatch(html2, match, newTag) {
|
|
|
17108
17120
|
}
|
|
17109
17121
|
function findTagByAttribute(html2, name, value) {
|
|
17110
17122
|
const found = scanHtmlOpeningTags(html2).find((tag) => {
|
|
17111
|
-
const
|
|
17112
|
-
return tag.closed &&
|
|
17123
|
+
const attr2 = tag.attributes.find((attr3) => attr3.name === name);
|
|
17124
|
+
return tag.closed && attr2?.kind === "value" && decodeAuthoredAttribute(attr2.value) === value;
|
|
17113
17125
|
});
|
|
17114
17126
|
return found ? { tag: html2.slice(found.start, found.bodyEnd), start: found.start, end: found.bodyEnd } : null;
|
|
17115
17127
|
}
|
|
@@ -17117,8 +17129,8 @@ function findTagByClass(html2, target) {
|
|
|
17117
17129
|
const classMatch = target.selector?.match(/^\.([a-zA-Z0-9_-]+)$/);
|
|
17118
17130
|
if (!classMatch) return null;
|
|
17119
17131
|
const found = scanHtmlOpeningTags(html2).filter((tag) => {
|
|
17120
|
-
const
|
|
17121
|
-
return tag.closed &&
|
|
17132
|
+
const attr2 = tag.attributes.find((attr3) => attr3.name === "class");
|
|
17133
|
+
return tag.closed && attr2?.kind === "value" && decodeAuthoredAttribute(attr2.value).split(/\s+/).includes(classMatch[1]);
|
|
17122
17134
|
})[target.selectorIndex ?? 0];
|
|
17123
17135
|
return found ? { tag: html2.slice(found.start, found.bodyEnd), start: found.start, end: found.bodyEnd } : null;
|
|
17124
17136
|
}
|
|
@@ -17139,28 +17151,28 @@ function findTagByTarget(html2, target) {
|
|
|
17139
17151
|
}
|
|
17140
17152
|
return findTagByClass(html2, target);
|
|
17141
17153
|
}
|
|
17142
|
-
function readAttributeByTarget(html2, target,
|
|
17154
|
+
function readAttributeByTarget(html2, target, attr2) {
|
|
17143
17155
|
const match = findTagByTarget(html2, target);
|
|
17144
17156
|
if (!match) return void 0;
|
|
17145
|
-
return readTagAttribute(match.tag,
|
|
17157
|
+
return readTagAttribute(match.tag, attr2.startsWith("data-") ? attr2 : `data-${attr2}`);
|
|
17146
17158
|
}
|
|
17147
|
-
function readTagAttribute(tag,
|
|
17148
|
-
const value = tagAttribute(tag,
|
|
17159
|
+
function readTagAttribute(tag, attr2) {
|
|
17160
|
+
const value = tagAttribute(tag, attr2);
|
|
17149
17161
|
return value?.kind === "value" ? decodeAuthoredAttribute(value.value) : void 0;
|
|
17150
17162
|
}
|
|
17151
17163
|
function readTagSnippetByTarget(html2, target) {
|
|
17152
17164
|
const match = findTagByTarget(html2, target);
|
|
17153
17165
|
return match?.tag;
|
|
17154
17166
|
}
|
|
17155
|
-
function patchAttributeByTarget(html2, target,
|
|
17167
|
+
function patchAttributeByTarget(html2, target, attr2, value) {
|
|
17156
17168
|
const match = findTagByTarget(html2, target);
|
|
17157
17169
|
if (!match) return html2;
|
|
17158
|
-
const name =
|
|
17170
|
+
const name = attr2.startsWith("data-") ? attr2 : `data-${attr2}`;
|
|
17159
17171
|
const edit = value === null ? { kind: "remove" } : { kind: "value", value };
|
|
17160
17172
|
return replaceTagAtMatch(html2, match, patchTagAttribute(match.tag, name, edit));
|
|
17161
17173
|
}
|
|
17162
|
-
function patchAttribute(html2, elementId2,
|
|
17163
|
-
return patchAttributeByTarget(html2, { id: elementId2 },
|
|
17174
|
+
function patchAttribute(html2, elementId2, attr2, value) {
|
|
17175
|
+
return patchAttributeByTarget(html2, { id: elementId2 }, attr2, value);
|
|
17164
17176
|
}
|
|
17165
17177
|
function patchTextContent(html2, elementId2, value) {
|
|
17166
17178
|
return patchTextContentByTarget(html2, { id: elementId2 }, value);
|
|
@@ -17198,26 +17210,26 @@ var HTML_BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
17198
17210
|
"reversed",
|
|
17199
17211
|
"selected"
|
|
17200
17212
|
]);
|
|
17201
|
-
function patchHtmlAttributeInTag(tag,
|
|
17213
|
+
function patchHtmlAttributeInTag(tag, attr2, value) {
|
|
17202
17214
|
if (!tag) return tag;
|
|
17203
17215
|
let edit;
|
|
17204
|
-
if (HTML_BOOLEAN_ATTRIBUTES.has(
|
|
17216
|
+
if (HTML_BOOLEAN_ATTRIBUTES.has(attr2)) {
|
|
17205
17217
|
if (value === null || value === "" || value === "false") edit = { kind: "remove" };
|
|
17206
17218
|
else {
|
|
17207
|
-
if (tagAttribute(tag,
|
|
17219
|
+
if (tagAttribute(tag, attr2)) return tag;
|
|
17208
17220
|
edit = { kind: "boolean" };
|
|
17209
17221
|
}
|
|
17210
17222
|
} else edit = value === null ? { kind: "remove" } : { kind: "value", value };
|
|
17211
|
-
const newTag = patchTagAttribute(tag,
|
|
17223
|
+
const newTag = patchTagAttribute(tag, attr2, edit);
|
|
17212
17224
|
return newTag;
|
|
17213
17225
|
}
|
|
17214
|
-
function patchHtmlAttribute(html2, elementId2,
|
|
17215
|
-
return patchHtmlAttributeByTarget(html2, { id: elementId2 },
|
|
17226
|
+
function patchHtmlAttribute(html2, elementId2, attr2, value) {
|
|
17227
|
+
return patchHtmlAttributeByTarget(html2, { id: elementId2 }, attr2, value);
|
|
17216
17228
|
}
|
|
17217
|
-
function patchHtmlAttributeByTarget(html2, target,
|
|
17229
|
+
function patchHtmlAttributeByTarget(html2, target, attr2, value) {
|
|
17218
17230
|
const match = findTagByTarget(html2, target);
|
|
17219
17231
|
if (!match) return html2;
|
|
17220
|
-
const newTag = patchHtmlAttributeInTag(match.tag,
|
|
17232
|
+
const newTag = patchHtmlAttributeInTag(match.tag, attr2, value);
|
|
17221
17233
|
return replaceTagAtMatch(html2, match, newTag);
|
|
17222
17234
|
}
|
|
17223
17235
|
function patchTextContentByTarget(html2, target, value) {
|
|
@@ -17446,7 +17458,7 @@ function toProjectPath(sourceFile, path) {
|
|
|
17446
17458
|
function livePathsOf(live) {
|
|
17447
17459
|
const paths = /* @__PURE__ */ new Set();
|
|
17448
17460
|
for (const el of [live, ...Array.from(live.querySelectorAll("*"))]) {
|
|
17449
|
-
for (const
|
|
17461
|
+
for (const attr2 of PATH_ATTRS) paths.add(el.getAttribute(attr2) ?? "");
|
|
17450
17462
|
for (const match of (el.getAttribute("style") ?? "").matchAll(CSS_URL)) paths.add(match[2]);
|
|
17451
17463
|
}
|
|
17452
17464
|
return paths;
|
|
@@ -17463,9 +17475,9 @@ function authoredMarkup(authored, live, sourceFile) {
|
|
|
17463
17475
|
};
|
|
17464
17476
|
const copy = authored.cloneNode(true);
|
|
17465
17477
|
for (const el of [copy, ...Array.from(copy.querySelectorAll("*"))]) {
|
|
17466
|
-
for (const
|
|
17467
|
-
const value = el.getAttribute(
|
|
17468
|
-
if (value) el.setAttribute(
|
|
17478
|
+
for (const attr2 of PATH_ATTRS) {
|
|
17479
|
+
const value = el.getAttribute(attr2);
|
|
17480
|
+
if (value) el.setAttribute(attr2, rebase(value.trim()));
|
|
17469
17481
|
}
|
|
17470
17482
|
const style = el.getAttribute("style");
|
|
17471
17483
|
if (style) {
|
|
@@ -17485,7 +17497,7 @@ function liveMarkupWithoutPreviewMarks(live) {
|
|
|
17485
17497
|
for (const canvas of copy.querySelectorAll(`[${PREVIEW_VIDEO_CANVAS_ATTR}]`)) canvas.remove();
|
|
17486
17498
|
for (const el of [copy, ...Array.from(copy.querySelectorAll("*"))]) {
|
|
17487
17499
|
if (el.hasAttribute(STUDIO_PREVIEW_LAZY_ATTR)) el.removeAttribute("loading");
|
|
17488
|
-
for (const
|
|
17500
|
+
for (const attr2 of PREVIEW_ONLY_ATTRS) el.removeAttribute(attr2);
|
|
17489
17501
|
}
|
|
17490
17502
|
return copy.outerHTML;
|
|
17491
17503
|
}
|
|
@@ -18832,24 +18844,24 @@ async function persistTimelineBatchEdit(input) {
|
|
|
18832
18844
|
recordEdit: input.recordEdit
|
|
18833
18845
|
});
|
|
18834
18846
|
}
|
|
18835
|
-
async function readSavedAttribute(projectId, targetPath, patchTarget,
|
|
18847
|
+
async function readSavedAttribute(projectId, targetPath, patchTarget, attr2, writeFile) {
|
|
18836
18848
|
if (!projectId || !patchTarget) return void 0;
|
|
18837
18849
|
const html2 = await serializeStudioFileMutations(
|
|
18838
18850
|
writeFile,
|
|
18839
18851
|
[targetPath],
|
|
18840
18852
|
() => readFileContent(projectId, targetPath)
|
|
18841
18853
|
).catch(() => null);
|
|
18842
|
-
return html2 === null ? void 0 : readTargetAttribute(html2, patchTarget,
|
|
18854
|
+
return html2 === null ? void 0 : readTargetAttribute(html2, patchTarget, attr2);
|
|
18843
18855
|
}
|
|
18844
|
-
function readTargetAttribute(html2, patchTarget,
|
|
18856
|
+
function readTargetAttribute(html2, patchTarget, attr2) {
|
|
18845
18857
|
if (readTagSnippetByTarget(html2, patchTarget) === void 0) return void 0;
|
|
18846
|
-
return readAttributeByTarget(html2, patchTarget,
|
|
18858
|
+
return readAttributeByTarget(html2, patchTarget, attr2) ?? null;
|
|
18847
18859
|
}
|
|
18848
18860
|
async function persistElementAttribute({
|
|
18849
18861
|
projectId,
|
|
18850
18862
|
targetPath,
|
|
18851
18863
|
patchTarget,
|
|
18852
|
-
attr,
|
|
18864
|
+
attr: attr2,
|
|
18853
18865
|
value,
|
|
18854
18866
|
label,
|
|
18855
18867
|
writeProjectFile,
|
|
@@ -18863,10 +18875,10 @@ async function persistElementAttribute({
|
|
|
18863
18875
|
if (readTagSnippetByTarget(before, patchTarget) === void 0) {
|
|
18864
18876
|
throw new Error(`Unable to patch element in ${targetPath}`);
|
|
18865
18877
|
}
|
|
18866
|
-
const previousValue = readAttributeByTarget(before, patchTarget,
|
|
18878
|
+
const previousValue = readAttributeByTarget(before, patchTarget, attr2) ?? null;
|
|
18867
18879
|
onFileRead(previousValue);
|
|
18868
18880
|
patchLive2(value);
|
|
18869
|
-
const operation = { type: "attribute", property:
|
|
18881
|
+
const operation = { type: "attribute", property: attr2, value };
|
|
18870
18882
|
const patched = applyPatchByTarget(before, patchTarget, operation);
|
|
18871
18883
|
pendingTimelineEditPathRef.current.add(targetPath);
|
|
18872
18884
|
try {
|
|
@@ -21654,15 +21666,6 @@ function cssPropertyName(property) {
|
|
|
21654
21666
|
function isManualGeometryStyleProperty(property) {
|
|
21655
21667
|
return property === "left" || property === "top" || property === "width" || property === "height";
|
|
21656
21668
|
}
|
|
21657
|
-
function getEventTargetElement(target) {
|
|
21658
|
-
if (!target || typeof target !== "object") return null;
|
|
21659
|
-
const maybeNode = target;
|
|
21660
|
-
if (maybeNode.nodeType === 1) return target;
|
|
21661
|
-
if (maybeNode.nodeType === 3 && maybeNode.parentElement) {
|
|
21662
|
-
return maybeNode.parentElement;
|
|
21663
|
-
}
|
|
21664
|
-
return null;
|
|
21665
|
-
}
|
|
21666
21669
|
function shouldIgnoreHistoryShortcut(target) {
|
|
21667
21670
|
return isTypingTarget(target);
|
|
21668
21671
|
}
|
|
@@ -21801,8 +21804,8 @@ async function resolveAssetHasAudio(projectId, assetPath) {
|
|
|
21801
21804
|
if (!response.ok) return null;
|
|
21802
21805
|
const data = await response.json();
|
|
21803
21806
|
const metadata = isPlainRecord(data) ? data.metadata : void 0;
|
|
21804
|
-
const
|
|
21805
|
-
return typeof
|
|
21807
|
+
const hasAudio2 = isPlainRecord(metadata) ? metadata.hasAudio : void 0;
|
|
21808
|
+
return typeof hasAudio2 === "boolean" ? hasAudio2 : null;
|
|
21806
21809
|
} catch {
|
|
21807
21810
|
return null;
|
|
21808
21811
|
}
|
|
@@ -26102,8 +26105,8 @@ function ClipMenuAttributeItems({ group, element, onClose }) {
|
|
|
26102
26105
|
const state = useClipToolState(element);
|
|
26103
26106
|
const openCropBar = useCropPresetBarStore((s) => s.open);
|
|
26104
26107
|
if (!onSetElementAttributeQuiet) return null;
|
|
26105
|
-
const write = (
|
|
26106
|
-
void onSetElementAttributeQuiet(element,
|
|
26108
|
+
const write = (attr2, value, label) => {
|
|
26109
|
+
void onSetElementAttributeQuiet(element, attr2, value, label);
|
|
26107
26110
|
onClose();
|
|
26108
26111
|
};
|
|
26109
26112
|
if (group === "sound") {
|
|
@@ -26453,9 +26456,9 @@ function ClipMenuAudioItems({
|
|
|
26453
26456
|
doc,
|
|
26454
26457
|
bed,
|
|
26455
26458
|
!ducked,
|
|
26456
|
-
async (
|
|
26459
|
+
async (attr2, value) => {
|
|
26457
26460
|
throwUnlessSaved(
|
|
26458
|
-
await onSetElementAttributeQuiet(element,
|
|
26461
|
+
await onSetElementAttributeQuiet(element, attr2, value, "Duck under voice")
|
|
26459
26462
|
);
|
|
26460
26463
|
},
|
|
26461
26464
|
onGroupClips ? (ids, groupId) => onGroupClips(ids, groupId, "Voice") : void 0
|
|
@@ -26706,8 +26709,8 @@ function probedHasAudioValue(probedHasAudio) {
|
|
|
26706
26709
|
function mutedToggleOps(input) {
|
|
26707
26710
|
const muted = htmlAttr("muted", input.nextMuted ? "true" : null);
|
|
26708
26711
|
if (!input.isVideo) return [muted];
|
|
26709
|
-
const
|
|
26710
|
-
return [muted, dataAttr("has-audio",
|
|
26712
|
+
const hasAudio2 = input.nextMuted ? null : probedHasAudioValue(input.probedHasAudio);
|
|
26713
|
+
return [muted, dataAttr("has-audio", hasAudio2)];
|
|
26711
26714
|
}
|
|
26712
26715
|
function hasAudioToggleOps(next) {
|
|
26713
26716
|
return next ? [dataAttr("has-audio", "true"), htmlAttr("muted", null)] : [dataAttr("has-audio", null), htmlAttr("muted", "true")];
|
|
@@ -30832,9 +30835,9 @@ function collectInlineStyleOps(element, properties, ops) {
|
|
|
30832
30835
|
}
|
|
30833
30836
|
}
|
|
30834
30837
|
function collectAttributeOps(element, attrNames, ops) {
|
|
30835
|
-
for (const
|
|
30836
|
-
const val = element.getAttribute(
|
|
30837
|
-
if (val !== null) ops.push({ type: "attribute", property:
|
|
30838
|
+
for (const attr2 of attrNames) {
|
|
30839
|
+
const val = element.getAttribute(attr2);
|
|
30840
|
+
if (val !== null) ops.push({ type: "attribute", property: attr2, value: val });
|
|
30838
30841
|
}
|
|
30839
30842
|
}
|
|
30840
30843
|
function appendTransformDisplayOps(element, ops) {
|
|
@@ -30899,7 +30902,7 @@ function buildBoxSizePatches(element) {
|
|
|
30899
30902
|
ops.push({ type: "attribute", property: STUDIO_BOX_SIZE_ATTR, value: "true" });
|
|
30900
30903
|
collectAttributeOps(
|
|
30901
30904
|
element,
|
|
30902
|
-
BOX_SIZE_ORIG_ATTRS.map(([
|
|
30905
|
+
BOX_SIZE_ORIG_ATTRS.map(([attr2]) => attr2),
|
|
30903
30906
|
ops
|
|
30904
30907
|
);
|
|
30905
30908
|
return ops;
|
|
@@ -37630,167 +37633,35 @@ function trackPreviewEditResult(feature, method, result) {
|
|
|
37630
37633
|
import { useCallback as useCallback58, useEffect as useEffect50, useRef as useRef67, useState as useState50 } from "react";
|
|
37631
37634
|
|
|
37632
37635
|
// src/utils/studioPreviewHelpers.ts
|
|
37633
|
-
|
|
37634
|
-
|
|
37635
|
-
|
|
37636
|
-
|
|
37637
|
-
|
|
37638
|
-
}
|
|
37639
|
-
function
|
|
37640
|
-
|
|
37641
|
-
return
|
|
37642
|
-
}
|
|
37643
|
-
function
|
|
37644
|
-
const
|
|
37645
|
-
|
|
37646
|
-
|
|
37647
|
-
|
|
37648
|
-
const
|
|
37649
|
-
|
|
37650
|
-
|
|
37651
|
-
|
|
37652
|
-
return {
|
|
37653
|
-
x: (clientX - iframeRect.left) / scaleX,
|
|
37654
|
-
y: (clientY - iframeRect.top) / scaleY,
|
|
37655
|
-
viewport: { width: rootWidth, height: rootHeight }
|
|
37656
|
-
};
|
|
37657
|
-
}
|
|
37658
|
-
var pointerEventsInheritanceFallbackByDocument = /* @__PURE__ */ new WeakMap();
|
|
37659
|
-
function needsPointerEventsInheritanceFallback(doc, win) {
|
|
37660
|
-
const cached5 = pointerEventsInheritanceFallbackByDocument.get(doc);
|
|
37661
|
-
if (cached5 !== void 0) return cached5;
|
|
37662
|
-
const parent = doc.createElement("div");
|
|
37663
|
-
const child = doc.createElement("div");
|
|
37664
|
-
parent.style.pointerEvents = "none";
|
|
37665
|
-
parent.appendChild(child);
|
|
37666
|
-
const host = doc.body ?? doc.documentElement;
|
|
37667
|
-
if (!host) return false;
|
|
37668
|
-
host.appendChild(parent);
|
|
37669
|
-
const needsFallback = win.getComputedStyle(child).pointerEvents !== "none";
|
|
37670
|
-
parent.remove();
|
|
37671
|
-
pointerEventsInheritanceFallbackByDocument.set(doc, needsFallback);
|
|
37672
|
-
return needsFallback;
|
|
37673
|
-
}
|
|
37674
|
-
function hasOwnPointerEventsOverride(el, win) {
|
|
37675
|
-
const value = win.getComputedStyle(el).pointerEvents;
|
|
37676
|
-
return value !== "" && value !== "inherit" && value !== "unset";
|
|
37677
|
-
}
|
|
37678
|
-
function inheritsPointerEventsNoneFromAncestor(el, win) {
|
|
37679
|
-
let current2 = el.parentElement;
|
|
37680
|
-
while (current2) {
|
|
37681
|
-
if (win.getComputedStyle(current2).pointerEvents === "none") {
|
|
37682
|
-
let descendant = el;
|
|
37683
|
-
while (descendant && descendant !== current2) {
|
|
37684
|
-
if (hasOwnPointerEventsOverride(descendant, win)) {
|
|
37685
|
-
return win.getComputedStyle(descendant).pointerEvents === "none";
|
|
37686
|
-
}
|
|
37687
|
-
descendant = descendant.parentElement;
|
|
37688
|
-
}
|
|
37689
|
-
return true;
|
|
37690
|
-
}
|
|
37691
|
-
current2 = current2.parentElement;
|
|
37692
|
-
}
|
|
37693
|
-
return false;
|
|
37694
|
-
}
|
|
37695
|
-
function hasAuthorPointerEventsNone(el) {
|
|
37696
|
-
const win = el.ownerDocument.defaultView;
|
|
37697
|
-
if (!win) return false;
|
|
37698
|
-
if (win.getComputedStyle(el).pointerEvents === "none") return true;
|
|
37699
|
-
if (!needsPointerEventsInheritanceFallback(el.ownerDocument, win)) return false;
|
|
37700
|
-
return inheritsPointerEventsNoneFromAncestor(el, win);
|
|
37701
|
-
}
|
|
37702
|
-
function collectPointerEventsNoneTargets(elements) {
|
|
37703
|
-
const disabled = /* @__PURE__ */ new WeakSet();
|
|
37704
|
-
for (const entry3 of elements) {
|
|
37705
|
-
if (isHtmlElement(entry3) && hasAuthorPointerEventsNone(entry3)) {
|
|
37706
|
-
disabled.add(entry3);
|
|
37707
|
-
}
|
|
37708
|
-
}
|
|
37709
|
-
return disabled;
|
|
37710
|
-
}
|
|
37711
|
-
function filterAuthorInteractiveTargets(elements, activeCompositionPath) {
|
|
37712
|
-
const pointerEventsNoneTargets = collectPointerEventsNoneTargets(elements);
|
|
37713
|
-
return resolveAllVisualDomEditTargets(elements, { activeCompositionPath }).filter(
|
|
37714
|
-
(el) => !pointerEventsNoneTargets.has(el)
|
|
37715
|
-
);
|
|
37716
|
-
}
|
|
37717
|
-
function findGroupAtPoint(doc, x, y) {
|
|
37718
|
-
let best = null;
|
|
37719
|
-
let bestArea = Infinity;
|
|
37720
|
-
for (const group of Array.from(doc.querySelectorAll("[data-hf-group]"))) {
|
|
37721
|
-
let left = Infinity;
|
|
37722
|
-
let top = Infinity;
|
|
37723
|
-
let right = -Infinity;
|
|
37724
|
-
let bottom = -Infinity;
|
|
37725
|
-
for (const member of Array.from(group.children)) {
|
|
37726
|
-
const r = member.getBoundingClientRect();
|
|
37727
|
-
if (r.width === 0 && r.height === 0) continue;
|
|
37728
|
-
left = Math.min(left, r.left);
|
|
37729
|
-
top = Math.min(top, r.top);
|
|
37730
|
-
right = Math.max(right, r.right);
|
|
37731
|
-
bottom = Math.max(bottom, r.bottom);
|
|
37732
|
-
}
|
|
37733
|
-
if (right < left || x < left || x > right || y < top || y > bottom) continue;
|
|
37734
|
-
const area = (right - left) * (bottom - top);
|
|
37735
|
-
if (area < bestArea) {
|
|
37736
|
-
bestArea = area;
|
|
37737
|
-
best = group;
|
|
37738
|
-
}
|
|
37739
|
-
}
|
|
37740
|
-
return best;
|
|
37741
|
-
}
|
|
37742
|
-
function getPreviewTargetFromPointer(iframe, clientX, clientY, activeCompositionPath) {
|
|
37636
|
+
import {
|
|
37637
|
+
compositionPoint,
|
|
37638
|
+
coversComposition,
|
|
37639
|
+
pointerTarget,
|
|
37640
|
+
pointerTargets
|
|
37641
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
37642
|
+
function getPreviewTargetFromPointer(iframe, clientX, clientY) {
|
|
37643
|
+
const local = framePointer(iframe, clientX, clientY);
|
|
37644
|
+
return local && pointerTarget(local.doc, local.point);
|
|
37645
|
+
}
|
|
37646
|
+
function getAllPreviewTargetsFromPointer(iframe, clientX, clientY) {
|
|
37647
|
+
const local = framePointer(iframe, clientX, clientY);
|
|
37648
|
+
return local ? pointerTargets(local.doc, local.point) : [];
|
|
37649
|
+
}
|
|
37650
|
+
function framePointFraction(iframe, clientX, clientY) {
|
|
37651
|
+
const rect = iframe.getBoundingClientRect();
|
|
37652
|
+
return { x: (clientX - rect.left) / rect.width, y: (clientY - rect.top) / rect.height };
|
|
37653
|
+
}
|
|
37654
|
+
function framePointer(iframe, clientX, clientY) {
|
|
37743
37655
|
let doc = null;
|
|
37744
|
-
let win = null;
|
|
37745
37656
|
try {
|
|
37746
37657
|
doc = iframe.contentDocument;
|
|
37747
|
-
win = iframe.contentWindow;
|
|
37748
37658
|
} catch {
|
|
37749
37659
|
return null;
|
|
37750
37660
|
}
|
|
37751
|
-
if (!doc
|
|
37752
|
-
const
|
|
37753
|
-
|
|
37754
|
-
|
|
37755
|
-
const elements = doc.elementsFromPoint(localPointer.x, localPointer.y);
|
|
37756
|
-
const candidates = filterAuthorInteractiveTargets(elements, activeCompositionPath);
|
|
37757
|
-
const visualTarget = candidates.find((el) => !isFullBleedTarget(el, localPointer.viewport)) ?? null;
|
|
37758
|
-
if (visualTarget) return visualTarget;
|
|
37759
|
-
}
|
|
37760
|
-
const groupHit = findGroupAtPoint(doc, localPointer.x, localPointer.y);
|
|
37761
|
-
if (groupHit && !hasAuthorPointerEventsNone(groupHit) && getDomLayerPatchTarget(groupHit, activeCompositionPath))
|
|
37762
|
-
return groupHit;
|
|
37763
|
-
const fallback = getEventTargetElement(doc.elementFromPoint(localPointer.x, localPointer.y));
|
|
37764
|
-
if (!fallback || !getDomLayerPatchTarget(fallback, activeCompositionPath)) return null;
|
|
37765
|
-
if (hasAuthorPointerEventsNone(fallback)) return null;
|
|
37766
|
-
if (!isElementComputedVisible(fallback)) return null;
|
|
37767
|
-
if (isFullBleedTarget(fallback, localPointer.viewport)) return null;
|
|
37768
|
-
return fallback;
|
|
37769
|
-
}
|
|
37770
|
-
function getAllPreviewTargetsFromPointer(iframe, clientX, clientY, activeCompositionPath) {
|
|
37771
|
-
let doc = null;
|
|
37772
|
-
let win = null;
|
|
37773
|
-
try {
|
|
37774
|
-
doc = iframe.contentDocument;
|
|
37775
|
-
win = iframe.contentWindow;
|
|
37776
|
-
} catch {
|
|
37777
|
-
return [];
|
|
37778
|
-
}
|
|
37779
|
-
if (!doc || !win) return [];
|
|
37780
|
-
const localPointer = resolvePreviewLocalPointer(iframe, doc, win, clientX, clientY);
|
|
37781
|
-
if (!localPointer) return [];
|
|
37782
|
-
if (typeof doc.elementsFromPoint === "function") {
|
|
37783
|
-
const elements = doc.elementsFromPoint(localPointer.x, localPointer.y);
|
|
37784
|
-
return filterAuthorInteractiveTargets(elements, activeCompositionPath).filter(
|
|
37785
|
-
(el) => !isFullBleedTarget(el, localPointer.viewport)
|
|
37786
|
-
);
|
|
37787
|
-
}
|
|
37788
|
-
const fallback = getEventTargetElement(doc.elementFromPoint(localPointer.x, localPointer.y));
|
|
37789
|
-
if (!fallback || !getDomLayerPatchTarget(fallback, activeCompositionPath)) return [];
|
|
37790
|
-
if (hasAuthorPointerEventsNone(fallback)) return [];
|
|
37791
|
-
if (!isElementComputedVisible(fallback)) return [];
|
|
37792
|
-
if (isFullBleedTarget(fallback, localPointer.viewport)) return [];
|
|
37793
|
-
return [fallback];
|
|
37661
|
+
if (!doc?.defaultView) return null;
|
|
37662
|
+
const { x, y } = framePointFraction(iframe, clientX, clientY);
|
|
37663
|
+
const point = compositionPoint(doc, x, y);
|
|
37664
|
+
return point && { doc, point };
|
|
37794
37665
|
}
|
|
37795
37666
|
function objectLike(value) {
|
|
37796
37667
|
return value && (typeof value === "object" || typeof value === "function") ? value : null;
|
|
@@ -37862,7 +37733,7 @@ function resolveRootDimensions(root) {
|
|
|
37862
37733
|
function computeOverlayRootScale(overlayEl, iframe, doc) {
|
|
37863
37734
|
const iframeRect = iframe.getBoundingClientRect();
|
|
37864
37735
|
const overlayRect = overlayEl.getBoundingClientRect();
|
|
37865
|
-
const dims = resolveRootDimensions(findOverlayRootElement(doc));
|
|
37736
|
+
const dims = previewFrameOpaque(iframe) ? previewStageSize(iframe) : resolveRootDimensions(findOverlayRootElement(doc));
|
|
37866
37737
|
if (!dims) return null;
|
|
37867
37738
|
return {
|
|
37868
37739
|
iframeRect,
|
|
@@ -37872,52 +37743,10 @@ function computeOverlayRootScale(overlayEl, iframe, doc) {
|
|
|
37872
37743
|
};
|
|
37873
37744
|
}
|
|
37874
37745
|
|
|
37875
|
-
// src/components/editor/
|
|
37876
|
-
|
|
37877
|
-
|
|
37878
|
-
|
|
37879
|
-
const parts = value.trim().split(/\s+/);
|
|
37880
|
-
const angle = parts.at(-1);
|
|
37881
|
-
if (!angle?.endsWith("deg")) return 0;
|
|
37882
|
-
if (parts.length === 4) {
|
|
37883
|
-
const [x, y, z] = parts;
|
|
37884
|
-
if (Number(x) !== 0 || Number(y) !== 0 || Math.abs(Number(z)) !== 1) return 0;
|
|
37885
|
-
const deg2 = Number.parseFloat(angle);
|
|
37886
|
-
return Number.isFinite(deg2) ? deg2 * Math.sign(Number(z)) : 0;
|
|
37887
|
-
}
|
|
37888
|
-
if (parts.length !== 1) return 0;
|
|
37889
|
-
const deg = Number.parseFloat(angle);
|
|
37890
|
-
return Number.isFinite(deg) ? deg : 0;
|
|
37891
|
-
}
|
|
37892
|
-
function ownNodeTransform(node, ops, getStyle) {
|
|
37893
|
-
const style = getStyle(node);
|
|
37894
|
-
if (!style) return null;
|
|
37895
|
-
const transform = style.transform;
|
|
37896
|
-
const own = transform && transform !== "none" ? ops.fromTransform(transform) : ops.identity();
|
|
37897
|
-
if (!own) return null;
|
|
37898
|
-
const spin = individualRotateDegrees(style.rotate);
|
|
37899
|
-
return spin === 0 ? own : ops.compose(ops.fromRotate(spin), own);
|
|
37900
|
-
}
|
|
37901
|
-
function composeElementTransform(element, ops, getStyle, memo64) {
|
|
37902
|
-
const pending2 = [];
|
|
37903
|
-
let above;
|
|
37904
|
-
for (let node = element; node; node = node.parentElement) {
|
|
37905
|
-
above = memo64?.get(node);
|
|
37906
|
-
if (above !== void 0) break;
|
|
37907
|
-
pending2.push(node);
|
|
37908
|
-
if (node.hasAttribute(COMPOSITION_ROOT_ATTR)) break;
|
|
37909
|
-
}
|
|
37910
|
-
let acc = above === void 0 ? ops.identity() : above;
|
|
37911
|
-
for (let i = pending2.length - 1; i >= 0; i -= 1) {
|
|
37912
|
-
const node = pending2[i];
|
|
37913
|
-
if (acc !== null) {
|
|
37914
|
-
const own = ownNodeTransform(node, ops, getStyle);
|
|
37915
|
-
acc = own === null ? null : ops.compose(acc, own);
|
|
37916
|
-
}
|
|
37917
|
-
memo64?.set(node, acc);
|
|
37918
|
-
}
|
|
37919
|
-
return acc;
|
|
37920
|
-
}
|
|
37746
|
+
// src/components/editor/domEditOverlayCrop.ts
|
|
37747
|
+
import {
|
|
37748
|
+
composeElementTransform
|
|
37749
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
37921
37750
|
|
|
37922
37751
|
// src/components/editor/clipPathHelpers.ts
|
|
37923
37752
|
function formatClipNumber(value) {
|
|
@@ -38095,7 +37924,10 @@ function resolveCropInsetFromMoveDrag(input) {
|
|
|
38095
37924
|
return { left, right: totalX - left, top, bottom: totalY - top };
|
|
38096
37925
|
}
|
|
38097
37926
|
function hugRectForElement(rect, element) {
|
|
38098
|
-
|
|
37927
|
+
return isElementCropLifted(element) ? rect : hugRectForClipPath(rect, readElementClipPath(element));
|
|
37928
|
+
}
|
|
37929
|
+
function hugRectForClipPath(rect, clipPath) {
|
|
37930
|
+
const insets = clipPath === null ? null : parseCropClipPath(clipPath);
|
|
38099
37931
|
if (!insets || insets.top <= 0 && insets.right <= 0 && insets.bottom <= 0 && insets.left <= 0)
|
|
38100
37932
|
return rect;
|
|
38101
37933
|
return cropRectFromInsets(rect, insets, rect.editScaleX, rect.editScaleY);
|
|
@@ -38188,6 +38020,14 @@ function rotateDeltaIntoFrame(deltaX, deltaY, angleDeg) {
|
|
|
38188
38020
|
return { deltaX: deltaX * cos - deltaY * sin, deltaY: deltaX * sin + deltaY * cos };
|
|
38189
38021
|
}
|
|
38190
38022
|
|
|
38023
|
+
// src/components/editor/domEditOverlayGeometry.ts
|
|
38024
|
+
import {
|
|
38025
|
+
elementCornerPoints,
|
|
38026
|
+
readElementTransformSnapshot,
|
|
38027
|
+
rotationDegreesFromMatrix,
|
|
38028
|
+
ROTATION_GATE_EPSILON_DEG
|
|
38029
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
38030
|
+
|
|
38191
38031
|
// src/components/editor/domEditOverlayMeasurePass.ts
|
|
38192
38032
|
function createOverlayMeasurePass() {
|
|
38193
38033
|
return {
|
|
@@ -38255,44 +38095,9 @@ function toVisibleOverlayRects(overlayEl, iframe, elements) {
|
|
|
38255
38095
|
return rect ? { ...rect, ...hugRectForElement(rect, element) } : null;
|
|
38256
38096
|
});
|
|
38257
38097
|
}
|
|
38258
|
-
function readElementTransformSnapshot(win, element, pass) {
|
|
38259
|
-
const DOMMatrixCtor = win.DOMMatrix;
|
|
38260
|
-
if (!DOMMatrixCtor) return null;
|
|
38261
|
-
const cs = win.getComputedStyle(element);
|
|
38262
|
-
const ops = {
|
|
38263
|
-
identity: () => new DOMMatrixCtor(),
|
|
38264
|
-
fromTransform: (value) => new DOMMatrixCtor(value),
|
|
38265
|
-
fromRotate: (degrees2) => new DOMMatrixCtor().rotateSelf(degrees2),
|
|
38266
|
-
compose: (outer, inner) => outer.multiply(inner)
|
|
38267
|
-
};
|
|
38268
|
-
try {
|
|
38269
|
-
const matrix = composeElementTransform(
|
|
38270
|
-
element,
|
|
38271
|
-
ops,
|
|
38272
|
-
(node) => node === element ? cs : win.getComputedStyle(node),
|
|
38273
|
-
pass?.transform
|
|
38274
|
-
);
|
|
38275
|
-
return matrix ? { matrix, cs } : null;
|
|
38276
|
-
} catch {
|
|
38277
|
-
return null;
|
|
38278
|
-
}
|
|
38279
|
-
}
|
|
38280
|
-
function rotationDegreesFromMatrix(matrix) {
|
|
38281
|
-
const a = Number.isFinite(matrix.a) ? matrix.a : 1;
|
|
38282
|
-
const b = Number.isFinite(matrix.b) ? matrix.b : 0;
|
|
38283
|
-
const c = Number.isFinite(matrix.c) ? matrix.c : 0;
|
|
38284
|
-
const d = Number.isFinite(matrix.d) ? matrix.d : 1;
|
|
38285
|
-
const fromX = Math.atan2(b, a) * 180 / Math.PI;
|
|
38286
|
-
const determinant = a * d - b * c;
|
|
38287
|
-
const fromY = Math.atan2(-c, d) * 180 / Math.PI;
|
|
38288
|
-
const deg = determinant < 0 && Math.abs(fromY) < Math.abs(fromX) ? fromY : fromX;
|
|
38289
|
-
return Number.isFinite(deg) ? deg : 0;
|
|
38290
|
-
}
|
|
38291
|
-
var ROTATION_GATE_EPSILON_DEG = 1e-4;
|
|
38292
38098
|
function toOverlayRect(overlayEl, iframe, element, precomputedScale, pass) {
|
|
38293
38099
|
const scale = precomputedScale ?? computeOverlayRootScale(overlayEl, iframe, iframe.contentDocument);
|
|
38294
38100
|
if (!scale) return null;
|
|
38295
|
-
const { iframeRect, overlayRect, rootScaleX, rootScaleY } = scale;
|
|
38296
38101
|
const elementRect = element.getBoundingClientRect();
|
|
38297
38102
|
const sourceBoundary = findSourceBoundary(element, pass);
|
|
38298
38103
|
const sourceBoundaryRect = sourceBoundary && pass ? readThroughPass(
|
|
@@ -38300,13 +38105,22 @@ function toOverlayRect(overlayEl, iframe, element, precomputedScale, pass) {
|
|
|
38300
38105
|
sourceBoundary,
|
|
38301
38106
|
() => sourceBoundary.getBoundingClientRect()
|
|
38302
38107
|
) : sourceBoundary?.getBoundingClientRect();
|
|
38108
|
+
return frameRectToOverlay(scale, elementRect, {
|
|
38109
|
+
width: sourceBoundaryRect?.width,
|
|
38110
|
+
height: sourceBoundaryRect?.height,
|
|
38111
|
+
declaredWidth: readPositiveDimension(sourceBoundary?.getAttribute("data-width") ?? null),
|
|
38112
|
+
declaredHeight: readPositiveDimension(sourceBoundary?.getAttribute("data-height") ?? null)
|
|
38113
|
+
});
|
|
38114
|
+
}
|
|
38115
|
+
function frameRectToOverlay(scale, elementRect, source) {
|
|
38116
|
+
const { iframeRect, overlayRect, rootScaleX, rootScaleY } = scale;
|
|
38303
38117
|
const editScale = resolveDomEditCoordinateScale({
|
|
38304
38118
|
rootScaleX,
|
|
38305
38119
|
rootScaleY,
|
|
38306
|
-
sourceRectWidth:
|
|
38307
|
-
sourceRectHeight:
|
|
38308
|
-
sourceWidth:
|
|
38309
|
-
sourceHeight:
|
|
38120
|
+
sourceRectWidth: source?.width,
|
|
38121
|
+
sourceRectHeight: source?.height,
|
|
38122
|
+
sourceWidth: source?.declaredWidth,
|
|
38123
|
+
sourceHeight: source?.declaredHeight
|
|
38310
38124
|
});
|
|
38311
38125
|
return {
|
|
38312
38126
|
left: iframeRect.left - overlayRect.left + elementRect.left * rootScaleX,
|
|
@@ -38317,6 +38131,18 @@ function toOverlayRect(overlayEl, iframe, element, precomputedScale, pass) {
|
|
|
38317
38131
|
editScaleY: editScale.scaleY
|
|
38318
38132
|
};
|
|
38319
38133
|
}
|
|
38134
|
+
function frameCornersToOverlay({ iframeRect, overlayRect, rootScaleX, rootScaleY }, corners) {
|
|
38135
|
+
const toOverlay = (pt) => ({
|
|
38136
|
+
x: iframeRect.left - overlayRect.left + pt.x * rootScaleX,
|
|
38137
|
+
y: iframeRect.top - overlayRect.top + pt.y * rootScaleY
|
|
38138
|
+
});
|
|
38139
|
+
return {
|
|
38140
|
+
nw: toOverlay(corners.nw),
|
|
38141
|
+
ne: toOverlay(corners.ne),
|
|
38142
|
+
se: toOverlay(corners.se),
|
|
38143
|
+
sw: toOverlay(corners.sw)
|
|
38144
|
+
};
|
|
38145
|
+
}
|
|
38320
38146
|
function cornerEdgeLength(a, b) {
|
|
38321
38147
|
return Math.hypot(b.x - a.x, b.y - a.y);
|
|
38322
38148
|
}
|
|
@@ -38330,44 +38156,13 @@ function elementCornerOverlayPoints(overlayEl, iframe, element, precomputedScale
|
|
|
38330
38156
|
const win = iframe.contentWindow;
|
|
38331
38157
|
const doc = iframe.contentDocument;
|
|
38332
38158
|
if (!win || !doc) return null;
|
|
38333
|
-
|
|
38334
|
-
if (!DOMPointCtor) return null;
|
|
38159
|
+
if (!win.DOMPoint) return null;
|
|
38335
38160
|
const scale = precomputedScale ?? computeOverlayRootScale(overlayEl, iframe, doc);
|
|
38336
38161
|
if (!scale) return null;
|
|
38337
|
-
const { iframeRect, overlayRect, rootScaleX, rootScaleY } = scale;
|
|
38338
38162
|
const transform = precomputedTransform ?? readElementTransformSnapshot(win, element);
|
|
38339
38163
|
if (!transform) return null;
|
|
38340
|
-
const
|
|
38341
|
-
|
|
38342
|
-
const h = element.offsetHeight;
|
|
38343
|
-
const originParts = cs.transformOrigin.split(" ").map((p) => Number.parseFloat(p));
|
|
38344
|
-
const ox = Number.isFinite(originParts[0]) ? originParts[0] : w / 2;
|
|
38345
|
-
const oy = Number.isFinite(originParts[1]) ? originParts[1] : h / 2;
|
|
38346
|
-
const rel = (lx, ly) => {
|
|
38347
|
-
const p = matrix.transformPoint(new DOMPointCtor(lx - ox, ly - oy));
|
|
38348
|
-
return { x: p.x, y: p.y };
|
|
38349
|
-
};
|
|
38350
|
-
const relCorners = {
|
|
38351
|
-
nw: rel(0, 0),
|
|
38352
|
-
ne: rel(w, 0),
|
|
38353
|
-
se: rel(w, h),
|
|
38354
|
-
sw: rel(0, h)
|
|
38355
|
-
};
|
|
38356
|
-
const xs = [relCorners.nw.x, relCorners.ne.x, relCorners.se.x, relCorners.sw.x];
|
|
38357
|
-
const ys = [relCorners.nw.y, relCorners.ne.y, relCorners.se.y, relCorners.sw.y];
|
|
38358
|
-
const bcr = element.getBoundingClientRect();
|
|
38359
|
-
const dx = bcr.left - Math.min(...xs);
|
|
38360
|
-
const dy = bcr.top - Math.min(...ys);
|
|
38361
|
-
const toOverlay = (pt) => ({
|
|
38362
|
-
x: iframeRect.left - overlayRect.left + (pt.x + dx) * rootScaleX,
|
|
38363
|
-
y: iframeRect.top - overlayRect.top + (pt.y + dy) * rootScaleY
|
|
38364
|
-
});
|
|
38365
|
-
return {
|
|
38366
|
-
nw: toOverlay(relCorners.nw),
|
|
38367
|
-
ne: toOverlay(relCorners.ne),
|
|
38368
|
-
se: toOverlay(relCorners.se),
|
|
38369
|
-
sw: toOverlay(relCorners.sw)
|
|
38370
|
-
};
|
|
38164
|
+
const corners = elementCornerPoints(win, element, transform);
|
|
38165
|
+
return corners && frameCornersToOverlay(scale, corners);
|
|
38371
38166
|
}
|
|
38372
38167
|
function orientedOverlayRect(overlayEl, iframe, element, precomputedScale, pass) {
|
|
38373
38168
|
const scale = precomputedScale ?? computeOverlayRootScale(overlayEl, iframe, iframe.contentDocument);
|
|
@@ -38375,10 +38170,13 @@ function orientedOverlayRect(overlayEl, iframe, element, precomputedScale, pass)
|
|
|
38375
38170
|
const base2 = toOverlayRect(overlayEl, iframe, element, scale, pass);
|
|
38376
38171
|
if (!base2) return null;
|
|
38377
38172
|
const win = iframe.contentWindow;
|
|
38378
|
-
const transform = win ? readElementTransformSnapshot(win, element, pass) : null;
|
|
38173
|
+
const transform = win ? readElementTransformSnapshot(win, element, pass?.transform) : null;
|
|
38379
38174
|
const angle = transform ? rotationDegreesFromMatrix(transform.matrix) : 0;
|
|
38380
38175
|
if (Math.abs(angle) < ROTATION_GATE_EPSILON_DEG) return base2;
|
|
38381
38176
|
const corners = elementCornerOverlayPoints(overlayEl, iframe, element, scale, transform);
|
|
38177
|
+
return orientOverlayRect(base2, angle, corners);
|
|
38178
|
+
}
|
|
38179
|
+
function orientOverlayRect(base2, angle, corners) {
|
|
38382
38180
|
if (!corners) return base2;
|
|
38383
38181
|
const width = cornerEdgeLength(corners.nw, corners.ne);
|
|
38384
38182
|
const height = cornerEdgeLength(corners.nw, corners.sw);
|
|
@@ -38892,6 +38690,171 @@ function useCanvasContextMenuState({
|
|
|
38892
38690
|
|
|
38893
38691
|
// src/components/editor/useDomEditOverlayRects.ts
|
|
38894
38692
|
import { useRef as useRef69, useState as useState53 } from "react";
|
|
38693
|
+
|
|
38694
|
+
// src/components/editor/previewOverlayRects.ts
|
|
38695
|
+
import {
|
|
38696
|
+
ROTATION_GATE_EPSILON_DEG as ROTATION_GATE_EPSILON_DEG2
|
|
38697
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
38698
|
+
|
|
38699
|
+
// src/player/lib/previewElements.ts
|
|
38700
|
+
import {
|
|
38701
|
+
EDITING_ELEMENT_HANDLE,
|
|
38702
|
+
MAX_DESCRIBE_HANDLES,
|
|
38703
|
+
MAX_ELEMENT_ENTRIES,
|
|
38704
|
+
MAX_ELEMENT_VALUE,
|
|
38705
|
+
MAX_GEOMETRY_CHILDREN
|
|
38706
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
38707
|
+
var isFields = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
38708
|
+
var isHandle = (value) => typeof value === "string" && EDITING_ELEMENT_HANDLE.test(value);
|
|
38709
|
+
var isText = (value) => typeof value === "string";
|
|
38710
|
+
var isTextOrNull = (value) => value === null || typeof value === "string";
|
|
38711
|
+
var isCount = (value) => Number.isSafeInteger(value) && value >= 0;
|
|
38712
|
+
var isSource = (value) => isFields(value) && isTextOrNull(value.file) && isTextOrNull(value.compositionId) && isTextOrNull(value.originalCompositionId);
|
|
38713
|
+
var isTextRecord = (value) => isFields(value) && Object.values(value).every(isText);
|
|
38714
|
+
function hasPlainFields(value) {
|
|
38715
|
+
const { matchesBefore, attributes, children } = value;
|
|
38716
|
+
const groupsOk = matchesBefore === null || Array.isArray(matchesBefore) && matchesBefore.every((g) => isFields(g) && isSource(g.source) && isCount(g.count));
|
|
38717
|
+
const attributesOk = Array.isArray(attributes) && attributes.every((a) => Array.isArray(a) && a.length === 2 && a.every(isText));
|
|
38718
|
+
const childrenOk = Array.isArray(children) && children.every((c) => isFields(c) && (isHandle(c.handle) || isText(c.text)));
|
|
38719
|
+
return groupsOk && attributesOk && childrenOk && typeof value.truncated === "boolean";
|
|
38720
|
+
}
|
|
38721
|
+
var isRect = (value) => isFields(value) && [value.x, value.y, value.width, value.height].every(Number.isFinite);
|
|
38722
|
+
function readHit(value) {
|
|
38723
|
+
if (!isFields(value) || !isHandle(value.handle) || !isText(value.tag)) return null;
|
|
38724
|
+
return isRect(value.rect) ? value : null;
|
|
38725
|
+
}
|
|
38726
|
+
function readPreviewElement(value) {
|
|
38727
|
+
if (!readHit(value) || !isFields(value)) return null;
|
|
38728
|
+
if (value.parent !== null && !isHandle(value.parent)) return null;
|
|
38729
|
+
if (!isTextOrNull(value.id) || !isTextOrNull(value.selector)) return null;
|
|
38730
|
+
if (!isSource(value.source) || typeof value.locked !== "boolean") return null;
|
|
38731
|
+
if (!isTextRecord(value.inlineStyles) || !isText(value.text)) return null;
|
|
38732
|
+
return hasPlainFields(value) ? value : null;
|
|
38733
|
+
}
|
|
38734
|
+
async function previewPointerTargets(iframe, rootFractionX, rootFractionY) {
|
|
38735
|
+
const params = { x: rootFractionX, y: rootFractionY };
|
|
38736
|
+
const reply = await previewRequest(iframe, "pointer-targets", params);
|
|
38737
|
+
const stack = reply?.stack;
|
|
38738
|
+
if (!reply || !Array.isArray(stack)) return null;
|
|
38739
|
+
return { target: readHit(reply.target), stack: stack.map(readHit).filter((hit) => hit !== null) };
|
|
38740
|
+
}
|
|
38741
|
+
async function describePreviewElements(iframe, handles) {
|
|
38742
|
+
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES) return null;
|
|
38743
|
+
const reply = await previewRequest(iframe, "describe", { handles: [...handles] });
|
|
38744
|
+
const elements = reply?.elements;
|
|
38745
|
+
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
38746
|
+
return elements.map((entry3, index2) => {
|
|
38747
|
+
const element = readPreviewElement(entry3);
|
|
38748
|
+
return element?.handle === handles[index2] ? element : null;
|
|
38749
|
+
});
|
|
38750
|
+
}
|
|
38751
|
+
async function previewAncestors(iframe, handles) {
|
|
38752
|
+
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES) return null;
|
|
38753
|
+
const reply = await previewRequest(iframe, "ancestors", { handles: [...handles] });
|
|
38754
|
+
const chains = reply?.ancestors;
|
|
38755
|
+
if (!Array.isArray(chains) || chains.length !== handles.length) return null;
|
|
38756
|
+
return chains.map(
|
|
38757
|
+
(chain) => Array.isArray(chain) && chain.every(isHandle) ? chain : null
|
|
38758
|
+
);
|
|
38759
|
+
}
|
|
38760
|
+
async function queryPreviewElements(iframe, selector) {
|
|
38761
|
+
const reply = await previewRequest(iframe, "query", { selector });
|
|
38762
|
+
const matches = reply?.matches;
|
|
38763
|
+
if (!Array.isArray(matches) || typeof reply?.truncated !== "boolean") return null;
|
|
38764
|
+
const ok = matches.every((m) => isFields(m) && isHandle(m.handle) && isSource(m.source));
|
|
38765
|
+
return ok ? { matches, truncated: reply.truncated } : null;
|
|
38766
|
+
}
|
|
38767
|
+
function previewElementSourceFile(element, activeCompositionPath) {
|
|
38768
|
+
return resolveElementSourceFile(element.source, activeCompositionPath);
|
|
38769
|
+
}
|
|
38770
|
+
function previewElementSelectorIndex(element, activeCompositionPath) {
|
|
38771
|
+
if (!element.selector?.startsWith(".") || !element.matchesBefore) return void 0;
|
|
38772
|
+
const file = previewElementSourceFile(element, activeCompositionPath);
|
|
38773
|
+
return element.matchesBefore.filter((group) => resolveElementSourceFile(group.source, activeCompositionPath) === file).reduce((sum, group) => sum + group.count, 0);
|
|
38774
|
+
}
|
|
38775
|
+
var isPoint = (value) => isFields(value) && Number.isFinite(value.x) && Number.isFinite(value.y);
|
|
38776
|
+
var isSizeOrNull = (value) => value === null || Number.isFinite(value) && value > 0;
|
|
38777
|
+
var CORNERS = ["nw", "ne", "se", "sw"];
|
|
38778
|
+
var isCorners = (value) => value === null || isFields(value) && CORNERS.every((corner) => isPoint(value[corner]));
|
|
38779
|
+
var isSourceBox = (value) => value === null || isFields(value) && Number.isFinite(value.width) && Number.isFinite(value.height) && isSizeOrNull(value.declaredWidth) && isSizeOrNull(value.declaredHeight);
|
|
38780
|
+
var isClipPath = (value) => value === null || isText(value) && value.length <= MAX_ELEMENT_VALUE;
|
|
38781
|
+
var isBox = (value) => isFields(value) && isRect(value.rect) && Number.isFinite(value.angle) && isCorners(value.corners) && isSourceBox(value.source) && isClipPath(value.clipPath);
|
|
38782
|
+
var readGeometry = (value) => {
|
|
38783
|
+
if (!isBox(value) || !isFields(value) || typeof value.visible !== "boolean") return null;
|
|
38784
|
+
const { members } = value;
|
|
38785
|
+
const membersOk = members === null || Array.isArray(members) && members.length <= MAX_ELEMENT_ENTRIES && members.every(isRect);
|
|
38786
|
+
return membersOk ? value : null;
|
|
38787
|
+
};
|
|
38788
|
+
async function previewGeometry(iframe, handles, children) {
|
|
38789
|
+
if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES) return null;
|
|
38790
|
+
const params = { handles: [...handles], ...children ? { children } : {} };
|
|
38791
|
+
const reply = await previewRequest(iframe, "geometry", params);
|
|
38792
|
+
const elements = reply?.elements;
|
|
38793
|
+
if (!Array.isArray(elements) || elements.length !== handles.length) return null;
|
|
38794
|
+
const boxes = reply?.children;
|
|
38795
|
+
const childrenOk = Array.isArray(boxes) && boxes.length <= MAX_GEOMETRY_CHILDREN && boxes.every(isBox);
|
|
38796
|
+
return {
|
|
38797
|
+
elements: elements.map(readGeometry),
|
|
38798
|
+
children: children && childrenOk ? boxes : null
|
|
38799
|
+
};
|
|
38800
|
+
}
|
|
38801
|
+
|
|
38802
|
+
// src/components/editor/previewOverlayRects.ts
|
|
38803
|
+
var clientRect = ({ x, y, width, height }) => ({ left: x, top: y, width, height });
|
|
38804
|
+
var baseRect = (scale, box) => frameRectToOverlay(scale, clientRect(box.rect), box.source);
|
|
38805
|
+
function orientedRect(scale, box) {
|
|
38806
|
+
const base2 = baseRect(scale, box);
|
|
38807
|
+
if (Math.abs(box.angle) < ROTATION_GATE_EPSILON_DEG2) return base2;
|
|
38808
|
+
return orientOverlayRect(
|
|
38809
|
+
base2,
|
|
38810
|
+
box.angle,
|
|
38811
|
+
box.corners && frameCornersToOverlay(scale, box.corners)
|
|
38812
|
+
);
|
|
38813
|
+
}
|
|
38814
|
+
function groupAwareRect(scale, geometry, oriented) {
|
|
38815
|
+
if (!geometry.members)
|
|
38816
|
+
return oriented ? orientedRect(scale, geometry) : baseRect(scale, geometry);
|
|
38817
|
+
const rect = baseRect(scale, geometry);
|
|
38818
|
+
const members = geometry.members.map(
|
|
38819
|
+
(member) => frameRectToOverlay(scale, clientRect(member), null)
|
|
38820
|
+
);
|
|
38821
|
+
const union = resolveDomEditGroupOverlayRect(members);
|
|
38822
|
+
return union ? { ...union, editScaleX: rect.editScaleX, editScaleY: rect.editScaleY } : rect;
|
|
38823
|
+
}
|
|
38824
|
+
function visibleRect(scale, box) {
|
|
38825
|
+
const rect = orientedRect(scale, box);
|
|
38826
|
+
return { ...rect, ...hugRectForClipPath(rect, box.clipPath) };
|
|
38827
|
+
}
|
|
38828
|
+
async function measurePreviewOverlay(iframe, overlayEl, targets) {
|
|
38829
|
+
const handles = [.../* @__PURE__ */ new Set([targets.selection, targets.hover, ...targets.group])].filter(
|
|
38830
|
+
(handle) => Boolean(handle)
|
|
38831
|
+
);
|
|
38832
|
+
const reply = handles.length ? await previewGeometry(iframe, handles, targets.selection ?? void 0) : { elements: [], children: null };
|
|
38833
|
+
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
38834
|
+
if (!reply || !scale) return null;
|
|
38835
|
+
const read2 = (handle) => handle ? reply.elements[handles.indexOf(handle)] ?? null : null;
|
|
38836
|
+
const selected = read2(targets.selection);
|
|
38837
|
+
const shown3 = selected?.visible ? selected : null;
|
|
38838
|
+
const hovered = read2(targets.hover);
|
|
38839
|
+
return {
|
|
38840
|
+
selection: shown3 && groupAwareRect(scale, shown3, true),
|
|
38841
|
+
children: shown3 ? (reply.children ?? []).map((box) => visibleRect(scale, box)).filter((rect) => rect.width > 2 && rect.height > 2) : [],
|
|
38842
|
+
group: targets.group.map((handle) => {
|
|
38843
|
+
const member = read2(handle);
|
|
38844
|
+
const rect = member && groupAwareRect(scale, member, false);
|
|
38845
|
+
return rect && { ...rect, ...hugRectForClipPath(rect, member.clipPath) };
|
|
38846
|
+
}),
|
|
38847
|
+
hover: hovered && groupAwareRect(scale, hovered, true)
|
|
38848
|
+
};
|
|
38849
|
+
}
|
|
38850
|
+
async function measurePreviewRects(iframe, overlayEl, handles) {
|
|
38851
|
+
const reply = await previewGeometry(iframe, handles);
|
|
38852
|
+
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
38853
|
+
if (!reply || !scale) return null;
|
|
38854
|
+
return reply.elements.map((geometry) => geometry && groupAwareRect(scale, geometry, true));
|
|
38855
|
+
}
|
|
38856
|
+
|
|
38857
|
+
// src/components/editor/useDomEditOverlayRects.ts
|
|
38895
38858
|
function childRectsEqual(a, b) {
|
|
38896
38859
|
if (a.length !== b.length) return false;
|
|
38897
38860
|
for (let i = 0; i < a.length; i++) {
|
|
@@ -38919,6 +38882,7 @@ function useDomEditOverlayRects({
|
|
|
38919
38882
|
const resolvedHoverElementRef = useRef69(null);
|
|
38920
38883
|
const resolvedGroupElementRef = useRef69(/* @__PURE__ */ new Map());
|
|
38921
38884
|
const childRectsRef = useRef69([]);
|
|
38885
|
+
const channelReadRef = useRef69(false);
|
|
38922
38886
|
const setOverlayRect = (next) => {
|
|
38923
38887
|
if (rectsEqual(overlayRectRef.current, next)) return;
|
|
38924
38888
|
overlayRectRef.current = next;
|
|
@@ -38946,6 +38910,61 @@ function useDomEditOverlayRects({
|
|
|
38946
38910
|
}
|
|
38947
38911
|
return next;
|
|
38948
38912
|
};
|
|
38913
|
+
const setChildRects = (next) => {
|
|
38914
|
+
if (childRectsEqual(childRectsRef.current, next)) return;
|
|
38915
|
+
childRectsRef.current = next;
|
|
38916
|
+
setChildRectsState(next);
|
|
38917
|
+
};
|
|
38918
|
+
const distinctGroup = (group) => {
|
|
38919
|
+
const keys = /* @__PURE__ */ new Set();
|
|
38920
|
+
return group.flatMap((selection) => {
|
|
38921
|
+
const key2 = selectionCacheKey(selection);
|
|
38922
|
+
if (keys.has(key2)) return [];
|
|
38923
|
+
keys.add(key2);
|
|
38924
|
+
return [{ key: key2, selection }];
|
|
38925
|
+
});
|
|
38926
|
+
};
|
|
38927
|
+
const hoverShown = (sel, group) => {
|
|
38928
|
+
const hoverSel = hoverSelectionRef.current;
|
|
38929
|
+
const key2 = hoverSel && selectionCacheKey(hoverSel);
|
|
38930
|
+
const covered = sel && selectionCacheKey(sel) === key2 || group.some((entry3) => selectionCacheKey(entry3) === key2);
|
|
38931
|
+
return covered ? null : hoverSel;
|
|
38932
|
+
};
|
|
38933
|
+
const updateOverChannel = (iframe, overlayEl) => {
|
|
38934
|
+
if (channelReadRef.current) return;
|
|
38935
|
+
const sel = selectionRef.current;
|
|
38936
|
+
const group = groupSelectionsRef.current;
|
|
38937
|
+
const members = distinctGroup(group);
|
|
38938
|
+
const hover = hoverShown(sel, group);
|
|
38939
|
+
const targets = {
|
|
38940
|
+
selection: sel?.handle ?? null,
|
|
38941
|
+
group: members.map(({ selection }) => selection.handle ?? null),
|
|
38942
|
+
hover: hover?.handle ?? null
|
|
38943
|
+
};
|
|
38944
|
+
if (!sel && !members.length && !hover) {
|
|
38945
|
+
setOverlayRect(null);
|
|
38946
|
+
setChildRects([]);
|
|
38947
|
+
setGroupOverlayItems([]);
|
|
38948
|
+
setHoverRect(null);
|
|
38949
|
+
return;
|
|
38950
|
+
}
|
|
38951
|
+
channelReadRef.current = true;
|
|
38952
|
+
void measurePreviewOverlay(iframe, overlayEl, targets).then((rects) => {
|
|
38953
|
+
const current2 = selectionRef.current === sel && groupSelectionsRef.current === group && hoverShown(sel, group) === hover;
|
|
38954
|
+
if (!rects || !current2 || rafPausedRef.current || iframeRef.current !== iframe) return;
|
|
38955
|
+
setOverlayRect(rects.selection);
|
|
38956
|
+
setChildRects(rects.children);
|
|
38957
|
+
setGroupOverlayItems(
|
|
38958
|
+
members.flatMap(({ key: key2, selection }, index2) => {
|
|
38959
|
+
const rect = rects.group[index2];
|
|
38960
|
+
return rect ? [{ key: key2, selection, element: selection.element, rect }] : [];
|
|
38961
|
+
})
|
|
38962
|
+
);
|
|
38963
|
+
setHoverRect(rects.hover);
|
|
38964
|
+
}).finally(() => {
|
|
38965
|
+
channelReadRef.current = false;
|
|
38966
|
+
});
|
|
38967
|
+
};
|
|
38949
38968
|
useMountEffect(() => {
|
|
38950
38969
|
const clearAll = () => {
|
|
38951
38970
|
setOverlayRect(null);
|
|
@@ -39067,7 +39086,14 @@ function useDomEditOverlayRects({
|
|
|
39067
39086
|
}
|
|
39068
39087
|
setHoverRect(orientedGroupAwareOverlayRect(overlayEl, iframe, hoverEl, scale));
|
|
39069
39088
|
};
|
|
39070
|
-
|
|
39089
|
+
const frame3 = () => {
|
|
39090
|
+
const iframe = iframeRef.current;
|
|
39091
|
+
const overlayEl = overlayRef.current;
|
|
39092
|
+
const channel = !rafPausedRef.current && iframe && overlayEl && !iframe.contentDocument;
|
|
39093
|
+
if (channel && previewFrameOpaque(iframe)) updateOverChannel(iframe, overlayEl);
|
|
39094
|
+
else update();
|
|
39095
|
+
};
|
|
39096
|
+
return subscribeOverlayFrame(frame3);
|
|
39071
39097
|
});
|
|
39072
39098
|
return {
|
|
39073
39099
|
overlayRect,
|
|
@@ -39145,7 +39171,7 @@ function OffCanvasIndicators({
|
|
|
39145
39171
|
const selectOffCanvas = async () => {
|
|
39146
39172
|
const el = elements.current.get(r.key);
|
|
39147
39173
|
if (!el) return;
|
|
39148
|
-
const { resolveDomEditSelection: resolveDomEditSelection2 } = await import("./domEditingLayers-
|
|
39174
|
+
const { resolveDomEditSelection: resolveDomEditSelection2 } = await import("./domEditingLayers-SA5KLSSS.js");
|
|
39149
39175
|
const acp = activeCompositionPathRef.current ?? "index.html";
|
|
39150
39176
|
const sel = await resolveDomEditSelection2(el, {
|
|
39151
39177
|
activeCompositionPath: acp,
|
|
@@ -39352,12 +39378,12 @@ function mergeFileChangePayloads(waiting, incoming) {
|
|
|
39352
39378
|
|
|
39353
39379
|
// src/components/editor/manualEditsSeekReapply.ts
|
|
39354
39380
|
import { isHtmlElement as isHtmlElement5 } from "@hyperframes/core/runtime/dom-realm";
|
|
39355
|
-
function queryStudioElements(doc,
|
|
39356
|
-
const elements = Array.from(doc.querySelectorAll(`[${
|
|
39357
|
-
const legacyAttr = `data-${
|
|
39381
|
+
function queryStudioElements(doc, attr2) {
|
|
39382
|
+
const elements = Array.from(doc.querySelectorAll(`[${attr2}="true"]`)).filter(isHtmlElement5);
|
|
39383
|
+
const legacyAttr = `data-${attr2}`;
|
|
39358
39384
|
for (const el of doc.querySelectorAll(`[${legacyAttr}="true"]`)) {
|
|
39359
|
-
if (isHtmlElement5(el) && !el.hasAttribute(
|
|
39360
|
-
el.setAttribute(
|
|
39385
|
+
if (isHtmlElement5(el) && !el.hasAttribute(attr2)) {
|
|
39386
|
+
el.setAttribute(attr2, "true");
|
|
39361
39387
|
el.removeAttribute(legacyAttr);
|
|
39362
39388
|
elements.push(el);
|
|
39363
39389
|
}
|
|
@@ -39395,9 +39421,9 @@ var STUDIO_EDIT_ATTRS = [
|
|
|
39395
39421
|
STUDIO_PATH_OFFSET_ATTR,
|
|
39396
39422
|
STUDIO_BOX_SIZE_ATTR,
|
|
39397
39423
|
STUDIO_ROTATION_ATTR
|
|
39398
|
-
].flatMap((
|
|
39424
|
+
].flatMap((attr2) => [attr2, `data-${attr2}`]).concat(STUDIO_MOTION_ATTR);
|
|
39399
39425
|
var STUDIO_EDIT_SELECTORS = STUDIO_EDIT_ATTRS.map(
|
|
39400
|
-
(
|
|
39426
|
+
(attr2) => attr2 === STUDIO_MOTION_ATTR ? `[${attr2}]` : `[${attr2}="true"]`
|
|
39401
39427
|
);
|
|
39402
39428
|
var editMarkCaches = /* @__PURE__ */ new WeakMap();
|
|
39403
39429
|
function scanForEditMarks(doc) {
|
|
@@ -41265,6 +41291,295 @@ function editMoment(stamp) {
|
|
|
41265
41291
|
return stamp?.at ?? playheadMoment();
|
|
41266
41292
|
}
|
|
41267
41293
|
|
|
41294
|
+
// src/components/editor/previewSelection.ts
|
|
41295
|
+
import { resolveEditingAffordances } from "@hyperframes/core/editing";
|
|
41296
|
+
import {
|
|
41297
|
+
MAX_ELEMENT_ENTRIES as MAX_ELEMENT_ENTRIES2,
|
|
41298
|
+
MAX_ELEMENT_VALUE as MAX_ELEMENT_VALUE2
|
|
41299
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
41300
|
+
var inertDocument;
|
|
41301
|
+
var inert = () => inertDocument ??= document.implementation.createHTMLDocument("");
|
|
41302
|
+
function inertElement(tag) {
|
|
41303
|
+
try {
|
|
41304
|
+
return inert().createElement(tag);
|
|
41305
|
+
} catch {
|
|
41306
|
+
return inert().createElement("div");
|
|
41307
|
+
}
|
|
41308
|
+
}
|
|
41309
|
+
var standIns = /* @__PURE__ */ new WeakMap();
|
|
41310
|
+
var standInHandles = /* @__PURE__ */ new WeakMap();
|
|
41311
|
+
var standInAncestors = /* @__PURE__ */ new WeakMap();
|
|
41312
|
+
function standInFor(iframe, element) {
|
|
41313
|
+
const client = previewEditingClient(iframe);
|
|
41314
|
+
const byHandle = standIns.get(client) ?? /* @__PURE__ */ new Map();
|
|
41315
|
+
standIns.set(client, byHandle);
|
|
41316
|
+
let standIn = byHandle.get(element.handle);
|
|
41317
|
+
if (!standIn) {
|
|
41318
|
+
standIn = inertElement(element.tag);
|
|
41319
|
+
byHandle.set(element.handle, standIn);
|
|
41320
|
+
standInHandles.set(standIn, element.handle);
|
|
41321
|
+
}
|
|
41322
|
+
return standIn;
|
|
41323
|
+
}
|
|
41324
|
+
function readable(element) {
|
|
41325
|
+
const probe2 = inertElement(element.tag);
|
|
41326
|
+
for (const [name, value] of element.attributes) {
|
|
41327
|
+
if (name !== "id" && name !== "class" && !name.startsWith("data-")) continue;
|
|
41328
|
+
try {
|
|
41329
|
+
probe2.setAttribute(name, value);
|
|
41330
|
+
} catch {
|
|
41331
|
+
}
|
|
41332
|
+
}
|
|
41333
|
+
for (const [name, value] of Object.entries(element.inlineStyles)) {
|
|
41334
|
+
probe2.style.setProperty(name, value);
|
|
41335
|
+
}
|
|
41336
|
+
probe2.textContent = element.text;
|
|
41337
|
+
return probe2;
|
|
41338
|
+
}
|
|
41339
|
+
var attr = (element, name) => element.attributes.find(([key2]) => key2 === name)?.[1] ?? null;
|
|
41340
|
+
var mayBeCut = (value) => value.length >= MAX_ELEMENT_VALUE2 || value.startsWith("data:") && value.endsWith(",");
|
|
41341
|
+
function valuesWhole(element) {
|
|
41342
|
+
if (!element.truncated) return true;
|
|
41343
|
+
const styles = Object.values(element.inlineStyles);
|
|
41344
|
+
if (element.attributes.length >= MAX_ELEMENT_ENTRIES2 || styles.length >= MAX_ELEMENT_ENTRIES2)
|
|
41345
|
+
return false;
|
|
41346
|
+
return ![...element.attributes.map(([, value]) => value), ...styles].some(mayBeCut);
|
|
41347
|
+
}
|
|
41348
|
+
var hasAudio = (element) => element.tag === "video" && attr(element, "muted") === null && isVideoAudible({ tag: "video", hasAudioAttr: attr(element, "data-has-audio"), muted: false });
|
|
41349
|
+
var validSelector = (selector) => {
|
|
41350
|
+
try {
|
|
41351
|
+
inert().querySelector(selector);
|
|
41352
|
+
return true;
|
|
41353
|
+
} catch {
|
|
41354
|
+
return false;
|
|
41355
|
+
}
|
|
41356
|
+
};
|
|
41357
|
+
async function findPreviewElementForSelection(iframe, selection, activeCompositionPath) {
|
|
41358
|
+
for (const { selector, index: index2 } of selectionLookups(selection)) {
|
|
41359
|
+
if (!validSelector(selector)) continue;
|
|
41360
|
+
const reply = await queryPreviewElements(iframe, selector);
|
|
41361
|
+
if (!reply) return void 0;
|
|
41362
|
+
const fromFile = reply.matches.filter(
|
|
41363
|
+
({ source }) => !selection.sourceFile || resolveElementSourceFile(source, activeCompositionPath) === selection.sourceFile
|
|
41364
|
+
);
|
|
41365
|
+
const match = fromFile[index2];
|
|
41366
|
+
if (!match) {
|
|
41367
|
+
if (reply.truncated) return void 0;
|
|
41368
|
+
continue;
|
|
41369
|
+
}
|
|
41370
|
+
const [element] = await describePreviewElements(iframe, [match.handle]) ?? [];
|
|
41371
|
+
return element ?? void 0;
|
|
41372
|
+
}
|
|
41373
|
+
return null;
|
|
41374
|
+
}
|
|
41375
|
+
async function findByClipId(iframe, element, sourceFile, path) {
|
|
41376
|
+
if (!element.id || element.domId || element.selector || element.compositionSrc) return null;
|
|
41377
|
+
const byId = await findPreviewElementForSelection(iframe, { id: element.id, sourceFile }, path);
|
|
41378
|
+
if (byId !== null) return byId;
|
|
41379
|
+
return findPreviewElementForSelection(iframe, { hfId: element.id, sourceFile }, path);
|
|
41380
|
+
}
|
|
41381
|
+
async function findPreviewElementForTimelineElement(iframe, element, options) {
|
|
41382
|
+
const { target, sourceFile, rootFallback } = timelineElementLookup(element, options);
|
|
41383
|
+
const path = options.activeCompositionPath;
|
|
41384
|
+
const found = target && await findPreviewElementForSelection(iframe, target, path);
|
|
41385
|
+
if (found !== null) return found;
|
|
41386
|
+
const byClipId = await findByClipId(iframe, element, sourceFile, path);
|
|
41387
|
+
if (byClipId !== null) return byClipId;
|
|
41388
|
+
if (!rootFallback) return null;
|
|
41389
|
+
const reply = await queryPreviewElements(iframe, "[data-composition-id]");
|
|
41390
|
+
if (!reply) return void 0;
|
|
41391
|
+
const root = reply.matches[0];
|
|
41392
|
+
if (!root || resolveElementSourceFile(root.source, path) !== sourceFile) return null;
|
|
41393
|
+
const [described] = await describePreviewElements(iframe, [root.handle]) ?? [];
|
|
41394
|
+
return described ?? void 0;
|
|
41395
|
+
}
|
|
41396
|
+
async function previewChain(iframe, target) {
|
|
41397
|
+
const [lineage] = await previewAncestors(iframe, [target.handle]) ?? [];
|
|
41398
|
+
if (!lineage) return null;
|
|
41399
|
+
const ancestors = lineage.length ? await describePreviewElements(iframe, lineage) : [];
|
|
41400
|
+
if (!ancestors || ancestors.some((entry3) => entry3 === null)) return null;
|
|
41401
|
+
const chain = [target, ...ancestors];
|
|
41402
|
+
const linked = chain.every((node, i) => node.parent === (chain[i + 1]?.handle ?? null));
|
|
41403
|
+
return linked ? chain : null;
|
|
41404
|
+
}
|
|
41405
|
+
function chainReader(chain) {
|
|
41406
|
+
const root = chain.at(-1);
|
|
41407
|
+
const body = chain.at(-2);
|
|
41408
|
+
return {
|
|
41409
|
+
attr,
|
|
41410
|
+
selector: (node) => node.selector ?? void 0,
|
|
41411
|
+
isDocumentRoot: (node) => node === root || node === body && node.tag === "body"
|
|
41412
|
+
};
|
|
41413
|
+
}
|
|
41414
|
+
async function compositionRoot2(iframe, documentElement) {
|
|
41415
|
+
const reply = await queryPreviewElements(iframe, "[data-composition-id]");
|
|
41416
|
+
if (!reply) return null;
|
|
41417
|
+
const first = reply.matches[0];
|
|
41418
|
+
const [root] = first ? await describePreviewElements(iframe, [first.handle]) ?? [null] : [];
|
|
41419
|
+
if (root === null) return null;
|
|
41420
|
+
const element = root ?? documentElement;
|
|
41421
|
+
const { x, y, width, height } = element.rect;
|
|
41422
|
+
return {
|
|
41423
|
+
rect: { left: x, top: y, width, height },
|
|
41424
|
+
width: attr(element, "data-width"),
|
|
41425
|
+
height: attr(element, "data-height")
|
|
41426
|
+
};
|
|
41427
|
+
}
|
|
41428
|
+
function chainIndex(chain, read2, options) {
|
|
41429
|
+
const active = options.activeGroupElement;
|
|
41430
|
+
const activeHandle = active ? standInHandles.get(active) : void 0;
|
|
41431
|
+
return selectionTargetIndex(chain, read2, {
|
|
41432
|
+
exactTarget: options.exactTarget,
|
|
41433
|
+
preferClipAncestor: options.preferClipAncestor,
|
|
41434
|
+
activeGroupIndex: active ? chain.findIndex((node) => node.handle === activeHandle) : null
|
|
41435
|
+
});
|
|
41436
|
+
}
|
|
41437
|
+
function previewIdentity(current2, path) {
|
|
41438
|
+
const selector = current2.selector ?? void 0;
|
|
41439
|
+
return {
|
|
41440
|
+
id: current2.id || void 0,
|
|
41441
|
+
hfId: attr(current2, "data-hf-id")?.trim() || void 0,
|
|
41442
|
+
selector,
|
|
41443
|
+
selectorIndex: selector ? previewElementSelectorIndex(current2, path) : void 0,
|
|
41444
|
+
sourceFile: previewElementSourceFile(current2, path)
|
|
41445
|
+
};
|
|
41446
|
+
}
|
|
41447
|
+
async function isPreviewCompositionRoot(iframe, chain, index2, computedStyles) {
|
|
41448
|
+
const current2 = chain[index2];
|
|
41449
|
+
if (attr(current2, "data-composition-id") !== null && !compositionSourceOf(current2)) return true;
|
|
41450
|
+
const parent = chain[index2 + 1];
|
|
41451
|
+
const underBody = parent?.tag === "body" && chainReader(chain).isDocumentRoot(parent);
|
|
41452
|
+
if (!underBody || attr(current2, "data-hf-allow-root-edit") !== null) return false;
|
|
41453
|
+
const { x, y, width, height } = current2.rect;
|
|
41454
|
+
const rect = { left: x, top: y, width, height };
|
|
41455
|
+
const root = await compositionRoot2(iframe, chain.at(-1));
|
|
41456
|
+
return root && coversCompositionRoot({ rect, computedStyles }, root);
|
|
41457
|
+
}
|
|
41458
|
+
var compositionSourceOf = (element) => attr(element, "data-composition-src") ?? attr(element, "data-composition-file") ?? void 0;
|
|
41459
|
+
async function resolvePreviewSelection(iframe, target, options) {
|
|
41460
|
+
const chain = await previewChain(iframe, target);
|
|
41461
|
+
const index2 = chain && chainIndex(chain, chainReader(chain), options);
|
|
41462
|
+
if (!chain || index2 === null) return null;
|
|
41463
|
+
const current2 = chain[index2];
|
|
41464
|
+
if (!valuesWhole(current2)) return null;
|
|
41465
|
+
const element = standInFor(iframe, current2);
|
|
41466
|
+
standInAncestors.set(
|
|
41467
|
+
element,
|
|
41468
|
+
chain.slice(index2 + 1).map((node) => node.handle)
|
|
41469
|
+
);
|
|
41470
|
+
const identity = previewIdentity(current2, options.activeCompositionPath);
|
|
41471
|
+
const compositionSrc = compositionSourceOf(current2);
|
|
41472
|
+
const probe2 = readable(current2);
|
|
41473
|
+
const inlineStyles = getInlineStyles(probe2);
|
|
41474
|
+
const computedStyles = await previewComputedStyles(iframe, current2, [
|
|
41475
|
+
...CURATED_STYLE_PROPERTIES
|
|
41476
|
+
]);
|
|
41477
|
+
if (!computedStyles) return null;
|
|
41478
|
+
const isCompositionRoot = await isPreviewCompositionRoot(iframe, chain, index2, computedStyles);
|
|
41479
|
+
if (isCompositionRoot === null) return null;
|
|
41480
|
+
const isInsideLocked = chainLocked(chain, chainReader(chain), index2);
|
|
41481
|
+
const { sourceFile } = identity;
|
|
41482
|
+
const existsInSource = await existsInSourceFile(
|
|
41483
|
+
options.previous,
|
|
41484
|
+
element,
|
|
41485
|
+
sourceFile,
|
|
41486
|
+
identity,
|
|
41487
|
+
options
|
|
41488
|
+
);
|
|
41489
|
+
const capabilities = resolveEditingAffordances(
|
|
41490
|
+
capabilityFacts({
|
|
41491
|
+
hasStableTarget: Boolean(identity.selector || identity.hfId),
|
|
41492
|
+
tag: current2.tag,
|
|
41493
|
+
inlineStyles,
|
|
41494
|
+
computedStyles,
|
|
41495
|
+
isCompositionHost: Boolean(compositionSrc),
|
|
41496
|
+
isCompositionRoot,
|
|
41497
|
+
isInsideLockedComposition: isInsideLocked,
|
|
41498
|
+
isMasterView: options.isMasterView,
|
|
41499
|
+
existsInSource: existsInSource ?? true
|
|
41500
|
+
})
|
|
41501
|
+
).capabilities;
|
|
41502
|
+
const { x, y, width, height } = current2.rect;
|
|
41503
|
+
return {
|
|
41504
|
+
element,
|
|
41505
|
+
handle: current2.handle,
|
|
41506
|
+
hasAudio: hasAudio(current2),
|
|
41507
|
+
src: attr(current2, "src"),
|
|
41508
|
+
...identity,
|
|
41509
|
+
compositionPath: sourceFile,
|
|
41510
|
+
compositionSrc,
|
|
41511
|
+
isCompositionHost: Boolean(compositionSrc),
|
|
41512
|
+
isInsideLockedComposition: isInsideLocked,
|
|
41513
|
+
label: buildElementLabel(probe2),
|
|
41514
|
+
tagName: current2.tag,
|
|
41515
|
+
boundingBox: { x, y, width, height },
|
|
41516
|
+
textContent: current2.text.trim() || null,
|
|
41517
|
+
dataAttributes: getDataAttributes(probe2),
|
|
41518
|
+
inlineStyles,
|
|
41519
|
+
computedStyles,
|
|
41520
|
+
textFields: [],
|
|
41521
|
+
capabilities,
|
|
41522
|
+
existsInSource
|
|
41523
|
+
};
|
|
41524
|
+
}
|
|
41525
|
+
function liveElementForSelection(iframe, selection, activeCompositionPath) {
|
|
41526
|
+
let doc = null;
|
|
41527
|
+
try {
|
|
41528
|
+
doc = iframe?.contentDocument ?? null;
|
|
41529
|
+
} catch {
|
|
41530
|
+
return void 0;
|
|
41531
|
+
}
|
|
41532
|
+
return doc ? findElementForSelection(doc, selection, activeCompositionPath) : void 0;
|
|
41533
|
+
}
|
|
41534
|
+
async function findSelectionElement(iframe, selection, activeCompositionPath) {
|
|
41535
|
+
return iframe && previewFrameOpaque(iframe) ? findPreviewElementForSelection(iframe, selection, activeCompositionPath) : liveElementForSelection(iframe, selection, activeCompositionPath);
|
|
41536
|
+
}
|
|
41537
|
+
async function resolveFoundSelection(iframe, found, options) {
|
|
41538
|
+
if (isHtmlElement(found)) return resolveDomEditSelection(found, options);
|
|
41539
|
+
return iframe ? resolvePreviewSelection(iframe, found, options) : null;
|
|
41540
|
+
}
|
|
41541
|
+
async function findOpaqueTimelineElement(iframe, element, lookup2) {
|
|
41542
|
+
if (!iframe || !previewFrameOpaque(iframe)) return null;
|
|
41543
|
+
return await findPreviewElementForTimelineElement(iframe, element, lookup2) ?? null;
|
|
41544
|
+
}
|
|
41545
|
+
function elementWithin(container, element) {
|
|
41546
|
+
const handle = standInHandles.get(container);
|
|
41547
|
+
if (handle === void 0) return container.contains(element);
|
|
41548
|
+
return element === container || (standInAncestors.get(element)?.includes(handle) ?? false);
|
|
41549
|
+
}
|
|
41550
|
+
function selectionDataAttribute(selection, name) {
|
|
41551
|
+
if (!selection.handle) return selection.element.getAttribute(name);
|
|
41552
|
+
return selection.dataAttributes[name.slice("data-".length)] ?? null;
|
|
41553
|
+
}
|
|
41554
|
+
var pointerAnswers = /* @__PURE__ */ new WeakMap();
|
|
41555
|
+
async function previewPointerTarget(iframe, clientX, clientY) {
|
|
41556
|
+
const { x, y } = framePointFraction(iframe, clientX, clientY);
|
|
41557
|
+
const reply = await previewPointerTargets(iframe, x, y);
|
|
41558
|
+
if (reply) pointerAnswers.set(iframe, { x: clientX, y: clientY, found: reply.target !== null });
|
|
41559
|
+
return reply;
|
|
41560
|
+
}
|
|
41561
|
+
function pointerMayHitElement(iframe, clientX, clientY) {
|
|
41562
|
+
if (!previewFrameOpaque(iframe))
|
|
41563
|
+
return Boolean(getPreviewTargetFromPointer(iframe, clientX, clientY));
|
|
41564
|
+
const answer = pointerAnswers.get(iframe);
|
|
41565
|
+
return answer?.x === clientX && answer.y === clientY ? answer.found : true;
|
|
41566
|
+
}
|
|
41567
|
+
async function findPointerTarget(iframe, clientX, clientY) {
|
|
41568
|
+
if (!previewFrameOpaque(iframe)) return getPreviewTargetFromPointer(iframe, clientX, clientY);
|
|
41569
|
+
const reply = await previewPointerTarget(iframe, clientX, clientY);
|
|
41570
|
+
if (!reply?.target) return reply ? null : void 0;
|
|
41571
|
+
const [described] = await describePreviewElements(iframe, [reply.target.handle]) ?? [];
|
|
41572
|
+
return described ?? void 0;
|
|
41573
|
+
}
|
|
41574
|
+
async function findPointerTargets(iframe, clientX, clientY) {
|
|
41575
|
+
if (!previewFrameOpaque(iframe)) return getAllPreviewTargetsFromPointer(iframe, clientX, clientY);
|
|
41576
|
+
const reply = await previewPointerTarget(iframe, clientX, clientY);
|
|
41577
|
+
const handles = reply?.stack.map((hit) => hit.handle) ?? [];
|
|
41578
|
+
const described = handles.length ? await describePreviewElements(iframe, handles) : [];
|
|
41579
|
+
return (described ?? []).filter((element) => element !== null);
|
|
41580
|
+
}
|
|
41581
|
+
var selectionElementLive = (selection) => selection.handle !== void 0 || selection.element.isConnected;
|
|
41582
|
+
|
|
41268
41583
|
// src/components/editor/previewGestureStarts.ts
|
|
41269
41584
|
var MAX_SETTLED_WAIT_FRAMES = 60;
|
|
41270
41585
|
var PRESS_WAIT_MAX_MS = 1e4;
|
|
@@ -41345,7 +41660,22 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
41345
41660
|
});
|
|
41346
41661
|
};
|
|
41347
41662
|
};
|
|
41348
|
-
const
|
|
41663
|
+
const shownOverChannel = async (iframe, selections) => {
|
|
41664
|
+
const overlay = opts.overlayRef.current;
|
|
41665
|
+
const path = opts.activeCompositionPathRef.current;
|
|
41666
|
+
const found = await Promise.all(
|
|
41667
|
+
selections.map((selection) => findPreviewElementForSelection(iframe, selection, path))
|
|
41668
|
+
);
|
|
41669
|
+
const handles = found.map((element) => element?.handle);
|
|
41670
|
+
if (!overlay || !handles.length || !handles.every(Boolean)) return null;
|
|
41671
|
+
const rects = await measurePreviewRects(iframe, overlay, handles);
|
|
41672
|
+
const shown3 = selections.flatMap((selection, i) => {
|
|
41673
|
+
const rect = rects?.[i];
|
|
41674
|
+
return rect ? [{ selection: { ...selection, handle: handles[i] }, rect }] : [];
|
|
41675
|
+
});
|
|
41676
|
+
return shown3.length === selections.length ? shown3 : null;
|
|
41677
|
+
};
|
|
41678
|
+
const startOnShownPreview = (e, pressed, start, draw = null, targets = () => []) => {
|
|
41349
41679
|
const at = playheadMoment();
|
|
41350
41680
|
if (!isPreviewChanging() && !opts.waitingPressRef.current) return start(e, at, false);
|
|
41351
41681
|
e.preventDefault();
|
|
@@ -41382,8 +41712,24 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
41382
41712
|
settledFrames = settled ? settledFrames + 1 : 0;
|
|
41383
41713
|
return elements.length;
|
|
41384
41714
|
};
|
|
41715
|
+
const iframe = opts.iframeRef.current;
|
|
41716
|
+
const channel = iframe && previewFrameOpaque(iframe) ? iframe : null;
|
|
41717
|
+
let overChannel;
|
|
41718
|
+
let asked = false;
|
|
41719
|
+
const channelStep = (frame3) => {
|
|
41720
|
+
const overdue = performance.now() - since > PRESS_WAIT_MAX_MS;
|
|
41721
|
+
if (overdue) giveUpOnPreviewChange();
|
|
41722
|
+
if (isPreviewChanging() && !overdue) return "wait";
|
|
41723
|
+
if (!asked) {
|
|
41724
|
+
asked = true;
|
|
41725
|
+
void shownOverChannel(frame3, targets()).then((shown3) => overChannel = shown3);
|
|
41726
|
+
}
|
|
41727
|
+
if (overChannel === void 0) return "wait";
|
|
41728
|
+
return overChannel ? "run" : "lost";
|
|
41729
|
+
};
|
|
41385
41730
|
const waitStep = () => {
|
|
41386
41731
|
if (press.after && !press.after.ended) return "wait";
|
|
41732
|
+
if (channel) return channelStep(channel);
|
|
41387
41733
|
const found = countFrame();
|
|
41388
41734
|
const overdue = performance.now() - since > PRESS_WAIT_MAX_MS;
|
|
41389
41735
|
if (overdue) giveUpOnPreviewChange();
|
|
@@ -41398,8 +41744,8 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
41398
41744
|
return;
|
|
41399
41745
|
}
|
|
41400
41746
|
endWaitingPress(press);
|
|
41401
|
-
|
|
41402
|
-
|
|
41747
|
+
const pointerDown = down;
|
|
41748
|
+
if (step === "lost" || !start(pointerDown, at, true, overChannel ?? void 0)) return;
|
|
41403
41749
|
if (press.moved) moveActiveGesture(press.moved);
|
|
41404
41750
|
if (press.released) releaseActiveGesture(press.released);
|
|
41405
41751
|
};
|
|
@@ -41417,6 +41763,11 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
41417
41763
|
const iframe = opts.iframeRef.current;
|
|
41418
41764
|
return overlay && iframe && orientedGroupAwareOverlayRect(overlay, iframe, element);
|
|
41419
41765
|
};
|
|
41766
|
+
const shownOnPage = (target) => {
|
|
41767
|
+
const selection = target && shownSelection(target);
|
|
41768
|
+
const rect = selection && shownRect(selection.element);
|
|
41769
|
+
return selection && rect ? { selection, rect } : null;
|
|
41770
|
+
};
|
|
41420
41771
|
const startGroupDrag2 = (e) => {
|
|
41421
41772
|
const items = opts.groupOverlayItemsRef.current;
|
|
41422
41773
|
return startOnShownPreview(
|
|
@@ -41425,8 +41776,16 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
41425
41776
|
const selection = shownSelection(item.selection);
|
|
41426
41777
|
return selection ? [selection.element] : [];
|
|
41427
41778
|
}),
|
|
41428
|
-
(pressed, at, waited) => {
|
|
41779
|
+
(pressed, at, waited, overChannel) => {
|
|
41429
41780
|
if (!waited) return startGroupDrag(pressed, opts, at);
|
|
41781
|
+
if (overChannel) {
|
|
41782
|
+
const measured2 = items.map((item, i) => ({ ...item, ...overChannel[i] }));
|
|
41783
|
+
return startGroupDrag(
|
|
41784
|
+
pressed,
|
|
41785
|
+
{ ...opts, groupOverlayItemsRef: { current: measured2 } },
|
|
41786
|
+
at
|
|
41787
|
+
);
|
|
41788
|
+
}
|
|
41430
41789
|
const overlay = opts.overlayRef.current;
|
|
41431
41790
|
const iframe = opts.iframeRef.current;
|
|
41432
41791
|
if (!overlay || !iframe) return false;
|
|
@@ -41445,7 +41804,8 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
41445
41804
|
},
|
|
41446
41805
|
(dx, dy) => opts.setGroupOverlayItems(
|
|
41447
41806
|
items.map((item) => ({ ...item, rect: shiftedOverlayRect(item.rect, dx, dy) }))
|
|
41448
|
-
)
|
|
41807
|
+
),
|
|
41808
|
+
() => items.map((item) => item.selection)
|
|
41449
41809
|
);
|
|
41450
41810
|
};
|
|
41451
41811
|
const startGesture2 = (kind, e, options) => {
|
|
@@ -41463,19 +41823,19 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
|
|
|
41463
41823
|
const shown3 = target && shownSelection(target);
|
|
41464
41824
|
return shown3 ? [shown3.element] : [];
|
|
41465
41825
|
},
|
|
41466
|
-
(pressed, at, waited) => {
|
|
41826
|
+
(pressed, at, waited, overChannel) => {
|
|
41467
41827
|
if (!waited) return startGesture(kind, pressed, opts, { ...options, at });
|
|
41468
|
-
const
|
|
41469
|
-
|
|
41470
|
-
|
|
41471
|
-
|
|
41472
|
-
rect,
|
|
41828
|
+
const shown3 = overChannel ? overChannel[0] : shownOnPage(target);
|
|
41829
|
+
return !!shown3 && startGesture(kind, pressed, opts, {
|
|
41830
|
+
selection: shown3.selection,
|
|
41831
|
+
rect: shown3.rect,
|
|
41473
41832
|
resizeHandle: options?.resizeHandle,
|
|
41474
41833
|
resizeCorner: options?.resizeCorner,
|
|
41475
41834
|
at
|
|
41476
41835
|
});
|
|
41477
41836
|
},
|
|
41478
|
-
draw
|
|
41837
|
+
draw,
|
|
41838
|
+
() => target ? [target] : []
|
|
41479
41839
|
);
|
|
41480
41840
|
};
|
|
41481
41841
|
return { startGesture: startGesture2, startGroupDrag: startGroupDrag2, endWaitingPress, endHeldPress, releaseWaitingPress };
|
|
@@ -44290,14 +44650,9 @@ function useInlineTextEditing(selectionRef, { enterFromWindow = false } = {}) {
|
|
|
44290
44650
|
const elementUnderPress = (event) => {
|
|
44291
44651
|
const iframe = actions?.previewIframeRef?.current;
|
|
44292
44652
|
if (!iframe) return null;
|
|
44293
|
-
return getPreviewTargetFromPointer(
|
|
44294
|
-
iframe,
|
|
44295
|
-
event.clientX,
|
|
44296
|
-
event.clientY,
|
|
44297
|
-
selectionRef.current?.compositionPath ?? null
|
|
44298
|
-
);
|
|
44653
|
+
return getPreviewTargetFromPointer(iframe, event.clientX, event.clientY);
|
|
44299
44654
|
};
|
|
44300
|
-
const
|
|
44655
|
+
const compositionPoint2 = (event) => {
|
|
44301
44656
|
const iframe = actions?.previewIframeRef?.current;
|
|
44302
44657
|
const view = iframe?.contentWindow;
|
|
44303
44658
|
if (!iframe || !view?.innerWidth) return void 0;
|
|
@@ -44352,7 +44707,7 @@ function useInlineTextEditing(selectionRef, { enterFromWindow = false } = {}) {
|
|
|
44352
44707
|
lastPressRef.current = press;
|
|
44353
44708
|
if (!paired) return false;
|
|
44354
44709
|
if (!element || !canEditElementTextInline(element)) return false;
|
|
44355
|
-
return inlineText.start(element,
|
|
44710
|
+
return inlineText.start(element, compositionPoint2(event));
|
|
44356
44711
|
}
|
|
44357
44712
|
};
|
|
44358
44713
|
}
|
|
@@ -44916,12 +45271,7 @@ var DomEditOverlay = memo30(function DomEditOverlay2({
|
|
|
44916
45271
|
const shiftIframe = iframeRef.current;
|
|
44917
45272
|
const candidate = resolveShiftClickCandidate({
|
|
44918
45273
|
cached: hoverSelectionRef.current,
|
|
44919
|
-
elementAtPoint: shiftIframe ? getPreviewTargetFromPointer(
|
|
44920
|
-
shiftIframe,
|
|
44921
|
-
event.clientX,
|
|
44922
|
-
event.clientY,
|
|
44923
|
-
activeCompositionPathRef.current
|
|
44924
|
-
) : null
|
|
45274
|
+
elementAtPoint: shiftIframe ? getPreviewTargetFromPointer(shiftIframe, event.clientX, event.clientY) : null
|
|
44925
45275
|
});
|
|
44926
45276
|
if (!candidate) return;
|
|
44927
45277
|
event.preventDefault();
|
|
@@ -44939,13 +45289,7 @@ var DomEditOverlay = memo30(function DomEditOverlay2({
|
|
|
44939
45289
|
if (target?.closest('[data-dom-edit-selection-box="true"]')) return;
|
|
44940
45290
|
if (!hoverSelectionRef.current && onMarqueeSelectRef.current && compRect.width > 0) {
|
|
44941
45291
|
const iframe = iframeRef.current;
|
|
44942
|
-
|
|
44943
|
-
iframe,
|
|
44944
|
-
event.clientX,
|
|
44945
|
-
event.clientY,
|
|
44946
|
-
activeCompositionPathRef.current
|
|
44947
|
-
) : null;
|
|
44948
|
-
if (freshTarget) return;
|
|
45292
|
+
if (iframe && pointerMayHitElement(iframe, event.clientX, event.clientY)) return;
|
|
44949
45293
|
if (overlayRef.current) {
|
|
44950
45294
|
event.preventDefault();
|
|
44951
45295
|
event.stopPropagation();
|
|
@@ -56403,7 +56747,7 @@ import {
|
|
|
56403
56747
|
|
|
56404
56748
|
// src/components/editor/linkedSpeedEdits.ts
|
|
56405
56749
|
var keyOf14 = (el) => el.key ?? el.id;
|
|
56406
|
-
var dataProperty = (
|
|
56750
|
+
var dataProperty = (attr2) => attr2.startsWith("data-") ? attr2.slice(5) : attr2;
|
|
56407
56751
|
function isSelected(el, selection) {
|
|
56408
56752
|
if (selection.hfId && el.hfId) return el.hfId === selection.hfId;
|
|
56409
56753
|
return selection.id != null && (el.domId ?? el.id) === selection.id;
|
|
@@ -56415,13 +56759,13 @@ function linkedPartnerTargets(selection, elements) {
|
|
|
56415
56759
|
members.delete(keyOf14(self));
|
|
56416
56760
|
return elements.filter((el) => members.has(keyOf14(el))).map(buildPatchTarget).filter((target) => target !== null);
|
|
56417
56761
|
}
|
|
56418
|
-
function fanOutAttributeInSource(source, targets,
|
|
56419
|
-
const property = dataProperty(
|
|
56762
|
+
function fanOutAttributeInSource(source, targets, attr2, valueFor) {
|
|
56763
|
+
const property = dataProperty(attr2);
|
|
56420
56764
|
return targets.reduce(
|
|
56421
56765
|
(html2, target) => applyPatchByTarget(html2, target, {
|
|
56422
56766
|
type: "attribute",
|
|
56423
56767
|
property,
|
|
56424
|
-
value: valueFor(readAttributeByTarget(html2, target,
|
|
56768
|
+
value: valueFor(readAttributeByTarget(html2, target, attr2))
|
|
56425
56769
|
}),
|
|
56426
56770
|
source
|
|
56427
56771
|
);
|
|
@@ -56432,14 +56776,14 @@ function useLinkedSpeedCommit(selection, commit2) {
|
|
|
56432
56776
|
const partners = linkedPartnerTargets(selection, elements);
|
|
56433
56777
|
if (partners.length === 0) return null;
|
|
56434
56778
|
return {
|
|
56435
|
-
commitAttribute: (
|
|
56436
|
-
const property = dataProperty(
|
|
56779
|
+
commitAttribute: (attr2, valueFor, label) => {
|
|
56780
|
+
const property = dataProperty(attr2);
|
|
56437
56781
|
return commit2(
|
|
56438
56782
|
selection,
|
|
56439
56783
|
[{ type: "attribute", property, value: valueFor(selection.dataAttributes[property]) }],
|
|
56440
56784
|
{
|
|
56441
56785
|
label,
|
|
56442
|
-
prepareContent: (html2) => fanOutAttributeInSource(html2, partners,
|
|
56786
|
+
prepareContent: (html2) => fanOutAttributeInSource(html2, partners, attr2, valueFor)
|
|
56443
56787
|
}
|
|
56444
56788
|
);
|
|
56445
56789
|
}
|
|
@@ -56447,8 +56791,8 @@ function useLinkedSpeedCommit(selection, commit2) {
|
|
|
56447
56791
|
}
|
|
56448
56792
|
function withLinkedPlaybackRate(onSetAttribute, linked) {
|
|
56449
56793
|
if (!linked) return onSetAttribute;
|
|
56450
|
-
return async (
|
|
56451
|
-
if (
|
|
56794
|
+
return async (attr2, value) => {
|
|
56795
|
+
if (attr2 !== "playback-rate") return onSetAttribute(attr2, value);
|
|
56452
56796
|
await linked.commitAttribute("data-playback-rate", () => value, "Edit speed");
|
|
56453
56797
|
};
|
|
56454
56798
|
}
|
|
@@ -56481,7 +56825,7 @@ function MediaSection({
|
|
|
56481
56825
|
const { mediaStart, mediaStartAttr } = readClipInPoint(element.dataAttributes);
|
|
56482
56826
|
const hasLoop = el.hasAttribute("loop");
|
|
56483
56827
|
const hasMuted = el.hasAttribute("muted");
|
|
56484
|
-
const
|
|
56828
|
+
const hasAudio2 = isVideoAudible({
|
|
56485
56829
|
tag: el.tagName,
|
|
56486
56830
|
hasAudioAttr: element.dataAttributes["has-audio"],
|
|
56487
56831
|
muted: el.hasAttribute("muted")
|
|
@@ -56517,7 +56861,7 @@ function MediaSection({
|
|
|
56517
56861
|
quality,
|
|
56518
56862
|
onProgress: setRemoveProgress
|
|
56519
56863
|
});
|
|
56520
|
-
const stage = await commitCutout(mediaEdit, result.outputPath,
|
|
56864
|
+
const stage = await commitCutout(mediaEdit, result.outputPath, hasAudio2);
|
|
56521
56865
|
setRemoveProgress({ status: "complete", progress: 100, stage, ...result });
|
|
56522
56866
|
} catch (error) {
|
|
56523
56867
|
setRemoveProgress({
|
|
@@ -56738,7 +57082,7 @@ function MediaSection({
|
|
|
56738
57082
|
SegmentedControl,
|
|
56739
57083
|
{
|
|
56740
57084
|
trackName: "Has audio track",
|
|
56741
|
-
value:
|
|
57085
|
+
value: hasAudio2 ? "yes" : "no",
|
|
56742
57086
|
onChange: (next) => void commitHasAudioToggle(mediaEdit, next === "yes"),
|
|
56743
57087
|
options: [
|
|
56744
57088
|
{ label: "Yes", value: "yes" },
|
|
@@ -60351,7 +60695,7 @@ function ImageFillField({
|
|
|
60351
60695
|
const track2 = useTrackDesignInput();
|
|
60352
60696
|
const sourceFile = element.sourceFile;
|
|
60353
60697
|
const isImage = element.tagName === "img";
|
|
60354
|
-
const imageUrl = isImage ? element
|
|
60698
|
+
const imageUrl = isImage ? selectionSrc(element) ?? "" : value;
|
|
60355
60699
|
const commitImage = (next, projectAsset = false) => {
|
|
60356
60700
|
if (isImage) {
|
|
60357
60701
|
if (next)
|
|
@@ -60751,6 +61095,9 @@ function GradientField({
|
|
|
60751
61095
|
] })
|
|
60752
61096
|
] });
|
|
60753
61097
|
}
|
|
61098
|
+
function selectionSrc(selection) {
|
|
61099
|
+
return selection.src === void 0 ? selection.element.getAttribute("src") : selection.src;
|
|
61100
|
+
}
|
|
60754
61101
|
|
|
60755
61102
|
// src/components/editor/BorderRadiusEditor.tsx
|
|
60756
61103
|
import { useCallback as useCallback88, useState as useState81 } from "react";
|
|
@@ -62993,7 +63340,7 @@ function rotate(v, rx, ry, rz) {
|
|
|
62993
63340
|
[x, y] = [x * cz - y * sz, x * sz + y * cz];
|
|
62994
63341
|
return { x, y, z };
|
|
62995
63342
|
}
|
|
62996
|
-
var
|
|
63343
|
+
var CORNERS2 = [
|
|
62997
63344
|
{ x: -1, y: -1, z: -1 },
|
|
62998
63345
|
{ x: 1, y: -1, z: -1 },
|
|
62999
63346
|
{ x: 1, y: 1, z: -1 },
|
|
@@ -63024,7 +63371,7 @@ function projectCubeFaces(rx, ry, rz, opts) {
|
|
|
63024
63371
|
const { cx, cy, r } = opts;
|
|
63025
63372
|
const persp = opts.persp ?? 4;
|
|
63026
63373
|
const view = (v) => rotate(v, rx, ry, rz);
|
|
63027
|
-
const rotated =
|
|
63374
|
+
const rotated = CORNERS2.map(view);
|
|
63028
63375
|
const faces = [];
|
|
63029
63376
|
for (const f of FACES) {
|
|
63030
63377
|
const n = view(f.normal);
|
|
@@ -68161,9 +68508,9 @@ import { classifyAudioName as classifyAudioName3 } from "@hyperframes/core/audio
|
|
|
68161
68508
|
function useFxChainObserved(element, chain, carve, automation, onSetAttributeQuietRaw) {
|
|
68162
68509
|
const lastShape = useRef107(null);
|
|
68163
68510
|
const panelEdits = useRef107(0);
|
|
68164
|
-
const onSetAttributeQuiet = (
|
|
68511
|
+
const onSetAttributeQuiet = (attr2, value) => {
|
|
68165
68512
|
panelEdits.current += 1;
|
|
68166
|
-
return onSetAttributeQuietRaw(
|
|
68513
|
+
return onSetAttributeQuietRaw(attr2, value);
|
|
68167
68514
|
};
|
|
68168
68515
|
useEffect97(() => {
|
|
68169
68516
|
const shape = JSON.stringify([
|
|
@@ -68873,7 +69220,7 @@ function FlatMediaSection({
|
|
|
68873
69220
|
const fadeMax = clipDuration2 > 0 ? clipDuration2 : 10;
|
|
68874
69221
|
const hasLoop = el.hasAttribute("loop");
|
|
68875
69222
|
const hasMuted = el.hasAttribute("muted");
|
|
68876
|
-
const
|
|
69223
|
+
const hasAudio2 = isVideoAudible({
|
|
68877
69224
|
tag: el.tagName,
|
|
68878
69225
|
hasAudioAttr: element.dataAttributes["has-audio"],
|
|
68879
69226
|
muted: el.hasAttribute("muted")
|
|
@@ -68905,7 +69252,7 @@ function FlatMediaSection({
|
|
|
68905
69252
|
quality,
|
|
68906
69253
|
onProgress: setRemoveProgress
|
|
68907
69254
|
});
|
|
68908
|
-
const stage = await commitCutout(mediaEdit, result.outputPath,
|
|
69255
|
+
const stage = await commitCutout(mediaEdit, result.outputPath, hasAudio2);
|
|
68909
69256
|
setRemoveProgress({ status: "complete", progress: 100, stage, ...result });
|
|
68910
69257
|
} catch (error) {
|
|
68911
69258
|
setRemoveProgress({
|
|
@@ -69099,7 +69446,7 @@ function FlatMediaSection({
|
|
|
69099
69446
|
}
|
|
69100
69447
|
}
|
|
69101
69448
|
),
|
|
69102
|
-
(isAudio ||
|
|
69449
|
+
(isAudio || hasAudio2) && /* @__PURE__ */ jsx184(
|
|
69103
69450
|
MediaFadeSliders,
|
|
69104
69451
|
{
|
|
69105
69452
|
fadeIn,
|
|
@@ -69128,7 +69475,7 @@ function FlatMediaSection({
|
|
|
69128
69475
|
FlatToggle,
|
|
69129
69476
|
{
|
|
69130
69477
|
label: "Has audio track",
|
|
69131
|
-
checked:
|
|
69478
|
+
checked: hasAudio2,
|
|
69132
69479
|
onChange: (next) => void commitHasAudioToggle(mediaEdit, next)
|
|
69133
69480
|
}
|
|
69134
69481
|
)
|
|
@@ -73174,7 +73521,7 @@ function FlatMultiSelectState({
|
|
|
73174
73521
|
onHideAllSelected,
|
|
73175
73522
|
onClearSelection
|
|
73176
73523
|
}) {
|
|
73177
|
-
const
|
|
73524
|
+
const hasAudio2 = !canHideSelections(multiSelectedElements);
|
|
73178
73525
|
const trackInput = useTrackDesignInput();
|
|
73179
73526
|
return /* @__PURE__ */ jsxs152("div", { className: "flex flex-col gap-3 px-4 py-3", children: [
|
|
73180
73527
|
/* @__PURE__ */ jsxs152("div", { className: "flex items-center gap-3 rounded-xl border border-panel-border bg-panel-surface p-3", children: [
|
|
@@ -73230,7 +73577,7 @@ function FlatMultiSelectState({
|
|
|
73230
73577
|
`${element.id ?? element.selector ?? ""}:${element.selectorIndex ?? 0}`
|
|
73231
73578
|
);
|
|
73232
73579
|
}) }),
|
|
73233
|
-
!
|
|
73580
|
+
!hasAudio2 && /* @__PURE__ */ jsxs152("div", { className: "flex gap-2", children: [
|
|
73234
73581
|
/* @__PURE__ */ jsxs152(
|
|
73235
73582
|
"button",
|
|
73236
73583
|
{
|
|
@@ -77751,7 +78098,7 @@ function keepDrawnStyle(live, base2, merged, draws) {
|
|
|
77751
78098
|
}
|
|
77752
78099
|
function syncStaleEditMarks(doc, file) {
|
|
77753
78100
|
const [restoredDoc, previousDoc] = [file.restored, file.previous].map(parseSavedSource);
|
|
77754
|
-
for (const live of doc.querySelectorAll(STUDIO_EDIT_ATTRS.map((
|
|
78101
|
+
for (const live of doc.querySelectorAll(STUDIO_EDIT_ATTRS.map((attr2) => `[${attr2}]`).join())) {
|
|
77755
78102
|
const source = findAuthoredElement(restoredDoc, live);
|
|
77756
78103
|
if (source && STUDIO_EDIT_ATTRS.some((a) => live.getAttribute(a) !== source.getAttribute(a))) {
|
|
77757
78104
|
syncElementAttributes(live, source, findAuthoredElement(previousDoc, live) ?? void 0);
|
|
@@ -77952,8 +78299,8 @@ var STORED_FIELD = {
|
|
|
77952
78299
|
// A quick volume save writes no other field the store keeps: without this, a clip read its last load's volume.
|
|
77953
78300
|
"data-volume": (value) => ({ volume: parseStoredVolume(value) })
|
|
77954
78301
|
};
|
|
77955
|
-
function syncStoredElementAttribute(target,
|
|
77956
|
-
const fields = STORED_FIELD[
|
|
78302
|
+
function syncStoredElementAttribute(target, attr2, value) {
|
|
78303
|
+
const fields = STORED_FIELD[attr2]?.(value);
|
|
77957
78304
|
if (!fields) return;
|
|
77958
78305
|
const key2 = getTimelineElementIdentity(target);
|
|
77959
78306
|
const same2 = (element) => Object.keys(fields).every((k) => element[k] === fields[k]);
|
|
@@ -78713,7 +79060,7 @@ function useTimelineAssetDropOps({
|
|
|
78713
79060
|
const normalizedStart = Number(formatTimelineAttributeNumber(placement.start));
|
|
78714
79061
|
const duration = Number.isFinite(durationOverride) && durationOverride != null && durationOverride > 0 ? durationOverride : await resolveDroppedAssetDuration(pid, assetPath, kind);
|
|
78715
79062
|
const normalizedDuration = Number(formatTimelineAttributeNumber(duration));
|
|
78716
|
-
const
|
|
79063
|
+
const hasAudio2 = await resolveDroppedAssetHasAudio(pid, assetPath, kind);
|
|
78717
79064
|
const resolvedAssetSrc = resolveTimelineAssetSrc(targetPath, assetPath);
|
|
78718
79065
|
const resolvedTargetPath = targetPath || "index.html";
|
|
78719
79066
|
const fileElements = timelineElements.filter((te) => (te.sourceFile || activeCompPath || "index.html") === resolvedTargetPath).map((te) => ({ ...te, sourceFile: resolvedTargetPath }));
|
|
@@ -78751,7 +79098,7 @@ function useTimelineAssetDropOps({
|
|
|
78751
79098
|
duration: normalizedDuration,
|
|
78752
79099
|
track: track2,
|
|
78753
79100
|
zIndex: newElementZIndex,
|
|
78754
|
-
hasAudio,
|
|
79101
|
+
hasAudio: hasAudio2,
|
|
78755
79102
|
geometry: fitTimelineAssetGeometry(
|
|
78756
79103
|
null,
|
|
78757
79104
|
resolveTimelineAssetCompositionSize(originalContent)
|
|
@@ -79052,9 +79399,9 @@ ${laneKey}`;
|
|
|
79052
79399
|
}
|
|
79053
79400
|
};
|
|
79054
79401
|
}
|
|
79055
|
-
function restoredValue({ path, target, attr }, files) {
|
|
79402
|
+
function restoredValue({ path, target, attr: attr2 }, files) {
|
|
79056
79403
|
const html2 = files?.[path]?.restored;
|
|
79057
|
-
return html2 === void 0 || !target ? void 0 : readTargetAttribute(html2, target,
|
|
79404
|
+
return html2 === void 0 || !target ? void 0 : readTargetAttribute(html2, target, attr2);
|
|
79058
79405
|
}
|
|
79059
79406
|
function useLiveLanes(projectIdRef, activeCompPath) {
|
|
79060
79407
|
const compositionRef = useRef141(activeCompPath);
|
|
@@ -79069,15 +79416,15 @@ function useLiveLanes(projectIdRef, activeCompPath) {
|
|
|
79069
79416
|
}
|
|
79070
79417
|
|
|
79071
79418
|
// src/hooks/timelineAudioGroupVolume.ts
|
|
79072
|
-
function patchLiveGroupAttribute(iframe, groupId,
|
|
79419
|
+
function patchLiveGroupAttribute(iframe, groupId, attr2, value) {
|
|
79073
79420
|
const target = iframe?.contentDocument?.getElementById(groupId);
|
|
79074
79421
|
if (!target) return;
|
|
79075
|
-
if (value === null) target.removeAttribute(
|
|
79076
|
-
else target.setAttribute(
|
|
79422
|
+
if (value === null) target.removeAttribute(attr2);
|
|
79423
|
+
else target.setAttribute(attr2, value);
|
|
79077
79424
|
invalidateGroupInfoCache(iframe?.contentDocument);
|
|
79078
79425
|
}
|
|
79079
|
-
function audioGroupAttributeLiveKey(groupId,
|
|
79080
|
-
return `${groupId}\0${
|
|
79426
|
+
function audioGroupAttributeLiveKey(groupId, attr2) {
|
|
79427
|
+
return `${groupId}\0${attr2}`;
|
|
79081
79428
|
}
|
|
79082
79429
|
function mirroredGroupVolume(value) {
|
|
79083
79430
|
if (!value) return 1;
|
|
@@ -79091,8 +79438,8 @@ var GROUP_ATTR_TO_MIRROR = {
|
|
|
79091
79438
|
[HF_AUDIO_FX_ATTR13]: (value) => ({ audioGroupFxChain: value ?? void 0 }),
|
|
79092
79439
|
[HF_AUDIO_AUTOMATION_ATTR8]: (value) => ({ audioGroupAutomation: value ?? void 0 })
|
|
79093
79440
|
};
|
|
79094
|
-
function syncStoredGroupAttribute(groupId,
|
|
79095
|
-
const toPatch = GROUP_ATTR_TO_MIRROR[
|
|
79441
|
+
function syncStoredGroupAttribute(groupId, attr2, value) {
|
|
79442
|
+
const toPatch = GROUP_ATTR_TO_MIRROR[attr2];
|
|
79096
79443
|
if (!toPatch) return;
|
|
79097
79444
|
const patch = toPatch(value, groupId);
|
|
79098
79445
|
usePlayerStore.setState((state) => {
|
|
@@ -79125,15 +79472,15 @@ function groupSaveTarget(previewIframe, groupId, activeCompPath) {
|
|
|
79125
79472
|
patchTarget: buildPatchTarget({ domId: groupId })
|
|
79126
79473
|
};
|
|
79127
79474
|
}
|
|
79128
|
-
function groupLiveSource(previewIframe, groupId, activeCompPath,
|
|
79475
|
+
function groupLiveSource(previewIframe, groupId, activeCompPath, attr2) {
|
|
79129
79476
|
const { targetPath, patchTarget } = groupSaveTarget(previewIframe, groupId, activeCompPath);
|
|
79130
|
-
return { path: targetPath, target: patchTarget, attr };
|
|
79477
|
+
return { path: targetPath, target: patchTarget, attr: attr2 };
|
|
79131
79478
|
}
|
|
79132
79479
|
async function setAudioGroupAttribute({
|
|
79133
79480
|
projectId,
|
|
79134
79481
|
activeCompPath,
|
|
79135
79482
|
groupId,
|
|
79136
|
-
attr,
|
|
79483
|
+
attr: attr2,
|
|
79137
79484
|
value,
|
|
79138
79485
|
label,
|
|
79139
79486
|
previewIframe,
|
|
@@ -79149,7 +79496,7 @@ async function setAudioGroupAttribute({
|
|
|
79149
79496
|
projectId,
|
|
79150
79497
|
targetPath,
|
|
79151
79498
|
patchTarget,
|
|
79152
|
-
attr,
|
|
79499
|
+
attr: attr2,
|
|
79153
79500
|
value,
|
|
79154
79501
|
label,
|
|
79155
79502
|
writeProjectFile,
|
|
@@ -79171,43 +79518,43 @@ function useSetAudioGroupAttribute({
|
|
|
79171
79518
|
}) {
|
|
79172
79519
|
const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
|
|
79173
79520
|
const setLive = useCallback115(
|
|
79174
|
-
(groupId,
|
|
79175
|
-
const key2 = audioGroupAttributeLiveKey(groupId,
|
|
79521
|
+
(groupId, attr2, value) => {
|
|
79522
|
+
const key2 = audioGroupAttributeLiveKey(groupId, attr2);
|
|
79176
79523
|
const target = previewIframeRef.current?.contentDocument?.getElementById(groupId);
|
|
79177
79524
|
liveLanes.preview(
|
|
79178
79525
|
key2,
|
|
79179
|
-
() => target?.getAttribute(
|
|
79180
|
-
groupLiveSource(previewIframeRef.current, groupId, activeCompPath,
|
|
79526
|
+
() => target?.getAttribute(attr2) ?? null,
|
|
79527
|
+
groupLiveSource(previewIframeRef.current, groupId, activeCompPath, attr2)
|
|
79181
79528
|
);
|
|
79182
|
-
patchLiveGroupAttribute(previewIframeRef.current, groupId,
|
|
79183
|
-
syncStoredGroupAttribute(groupId,
|
|
79529
|
+
patchLiveGroupAttribute(previewIframeRef.current, groupId, attr2, value);
|
|
79530
|
+
syncStoredGroupAttribute(groupId, attr2, value);
|
|
79184
79531
|
},
|
|
79185
79532
|
[liveLanes, previewIframeRef, activeCompPath]
|
|
79186
79533
|
);
|
|
79187
79534
|
const laneApply = useCallback115(
|
|
79188
|
-
(groupId,
|
|
79189
|
-
preview: (value) => patchLiveGroupAttribute(previewIframeRef.current, groupId,
|
|
79190
|
-
store: (value) => syncStoredGroupAttribute(groupId,
|
|
79535
|
+
(groupId, attr2) => ({
|
|
79536
|
+
preview: (value) => patchLiveGroupAttribute(previewIframeRef.current, groupId, attr2, value),
|
|
79537
|
+
store: (value) => syncStoredGroupAttribute(groupId, attr2, value)
|
|
79191
79538
|
}),
|
|
79192
79539
|
[previewIframeRef]
|
|
79193
79540
|
);
|
|
79194
79541
|
const claimLive = useCallback115(
|
|
79195
|
-
(groupId,
|
|
79542
|
+
(groupId, attr2, source) => liveLanes.claim(audioGroupAttributeLiveKey(groupId, attr2), laneApply(groupId, attr2), source),
|
|
79196
79543
|
[liveLanes, laneApply]
|
|
79197
79544
|
);
|
|
79198
79545
|
const revertLive = useCallback115(
|
|
79199
|
-
(groupId,
|
|
79546
|
+
(groupId, attr2) => liveLanes.revert(audioGroupAttributeLiveKey(groupId, attr2), laneApply(groupId, attr2)),
|
|
79200
79547
|
[liveLanes, laneApply]
|
|
79201
79548
|
);
|
|
79202
79549
|
const setQuiet = useCallback115(
|
|
79203
|
-
async (groupId,
|
|
79550
|
+
async (groupId, attr2, value, label) => {
|
|
79204
79551
|
const project = projectIdRef.current;
|
|
79205
79552
|
const pid = projectForTimelineSave(isRecordingRef?.current, project, showToast);
|
|
79206
|
-
const source = groupLiveSource(previewIframeRef.current, groupId, activeCompPath,
|
|
79207
|
-
const live = claimLive(groupId,
|
|
79553
|
+
const source = groupLiveSource(previewIframeRef.current, groupId, activeCompPath, attr2);
|
|
79554
|
+
const live = claimLive(groupId, attr2, source);
|
|
79208
79555
|
const unsaved = async (outcome) => {
|
|
79209
79556
|
live.settle(
|
|
79210
|
-
await readSavedAttribute(project, source.path, source.target,
|
|
79557
|
+
await readSavedAttribute(project, source.path, source.target, attr2, writeProjectFile)
|
|
79211
79558
|
);
|
|
79212
79559
|
return outcome;
|
|
79213
79560
|
};
|
|
@@ -79217,7 +79564,7 @@ function useSetAudioGroupAttribute({
|
|
|
79217
79564
|
projectId: pid,
|
|
79218
79565
|
activeCompPath,
|
|
79219
79566
|
groupId,
|
|
79220
|
-
attr,
|
|
79567
|
+
attr: attr2,
|
|
79221
79568
|
value,
|
|
79222
79569
|
label,
|
|
79223
79570
|
previewIframe: previewIframeRef.current,
|
|
@@ -79254,14 +79601,14 @@ function useSetAudioGroupAttribute({
|
|
|
79254
79601
|
|
|
79255
79602
|
// src/hooks/timelineElementFxAttribute.ts
|
|
79256
79603
|
import { useCallback as useCallback116 } from "react";
|
|
79257
|
-
function patchLiveElementAttribute(iframe, element,
|
|
79604
|
+
function patchLiveElementAttribute(iframe, element, attr2, value, activeCompPath) {
|
|
79258
79605
|
const target = findTimelineElementInIframe(iframe, element, activeCompPath);
|
|
79259
79606
|
if (!target) return;
|
|
79260
|
-
if (value === null) target.removeAttribute(
|
|
79261
|
-
else target.setAttribute(
|
|
79607
|
+
if (value === null) target.removeAttribute(attr2);
|
|
79608
|
+
else target.setAttribute(attr2, value);
|
|
79262
79609
|
}
|
|
79263
|
-
function elementAttributeLiveKey(element, activeCompPath,
|
|
79264
|
-
return `${element.sourceFile || activeCompPath || "index.html"}\0${element.key ?? element.domId ?? element.id}\0${
|
|
79610
|
+
function elementAttributeLiveKey(element, activeCompPath, attr2) {
|
|
79611
|
+
return `${element.sourceFile || activeCompPath || "index.html"}\0${element.key ?? element.domId ?? element.id}\0${attr2}`;
|
|
79265
79612
|
}
|
|
79266
79613
|
function elementSaveTarget(element, activeCompPath) {
|
|
79267
79614
|
return {
|
|
@@ -79269,15 +79616,15 @@ function elementSaveTarget(element, activeCompPath) {
|
|
|
79269
79616
|
patchTarget: buildPatchTarget(element)
|
|
79270
79617
|
};
|
|
79271
79618
|
}
|
|
79272
|
-
function elementLiveSource(element, activeCompPath,
|
|
79619
|
+
function elementLiveSource(element, activeCompPath, attr2) {
|
|
79273
79620
|
const { targetPath, patchTarget } = elementSaveTarget(element, activeCompPath);
|
|
79274
|
-
return { path: targetPath, target: patchTarget, attr };
|
|
79621
|
+
return { path: targetPath, target: patchTarget, attr: attr2 };
|
|
79275
79622
|
}
|
|
79276
79623
|
async function setElementAttribute({
|
|
79277
79624
|
projectId,
|
|
79278
79625
|
activeCompPath,
|
|
79279
79626
|
element,
|
|
79280
|
-
attr,
|
|
79627
|
+
attr: attr2,
|
|
79281
79628
|
value,
|
|
79282
79629
|
label,
|
|
79283
79630
|
patchLive: patchLive2,
|
|
@@ -79292,7 +79639,7 @@ async function setElementAttribute({
|
|
|
79292
79639
|
projectId,
|
|
79293
79640
|
targetPath,
|
|
79294
79641
|
patchTarget,
|
|
79295
|
-
attr,
|
|
79642
|
+
attr: attr2,
|
|
79296
79643
|
value,
|
|
79297
79644
|
label,
|
|
79298
79645
|
writeProjectFile,
|
|
@@ -79314,49 +79661,49 @@ function useSetElementAttribute({
|
|
|
79314
79661
|
}) {
|
|
79315
79662
|
const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
|
|
79316
79663
|
const setLive = useCallback116(
|
|
79317
|
-
(element,
|
|
79318
|
-
const key2 = elementAttributeLiveKey(element, activeCompPath,
|
|
79664
|
+
(element, attr2, value) => {
|
|
79665
|
+
const key2 = elementAttributeLiveKey(element, activeCompPath, attr2);
|
|
79319
79666
|
const target = findTimelineElementInIframe(previewIframeRef.current, element, activeCompPath);
|
|
79320
79667
|
liveLanes.preview(
|
|
79321
79668
|
key2,
|
|
79322
|
-
() => target?.getAttribute(
|
|
79323
|
-
elementLiveSource(element, activeCompPath,
|
|
79669
|
+
() => target?.getAttribute(attr2) ?? null,
|
|
79670
|
+
elementLiveSource(element, activeCompPath, attr2)
|
|
79324
79671
|
);
|
|
79325
|
-
patchLiveElementAttribute(previewIframeRef.current, element,
|
|
79672
|
+
patchLiveElementAttribute(previewIframeRef.current, element, attr2, value, activeCompPath);
|
|
79326
79673
|
},
|
|
79327
79674
|
[liveLanes, previewIframeRef, activeCompPath]
|
|
79328
79675
|
);
|
|
79329
79676
|
const laneApply = useCallback116(
|
|
79330
|
-
(element,
|
|
79331
|
-
preview: (value) => patchLiveElementAttribute(previewIframeRef.current, element,
|
|
79332
|
-
store: (value) => syncStoredElementAttribute(element,
|
|
79677
|
+
(element, attr2) => ({
|
|
79678
|
+
preview: (value) => patchLiveElementAttribute(previewIframeRef.current, element, attr2, value, activeCompPath),
|
|
79679
|
+
store: (value) => syncStoredElementAttribute(element, attr2, value)
|
|
79333
79680
|
}),
|
|
79334
79681
|
[previewIframeRef, activeCompPath]
|
|
79335
79682
|
);
|
|
79336
79683
|
const claimLive = useCallback116(
|
|
79337
|
-
(element,
|
|
79338
|
-
elementAttributeLiveKey(element, activeCompPath,
|
|
79339
|
-
laneApply(element,
|
|
79340
|
-
elementLiveSource(element, activeCompPath,
|
|
79684
|
+
(element, attr2) => liveLanes.claim(
|
|
79685
|
+
elementAttributeLiveKey(element, activeCompPath, attr2),
|
|
79686
|
+
laneApply(element, attr2),
|
|
79687
|
+
elementLiveSource(element, activeCompPath, attr2)
|
|
79341
79688
|
),
|
|
79342
79689
|
[liveLanes, laneApply, activeCompPath]
|
|
79343
79690
|
);
|
|
79344
79691
|
const revertLive = useCallback116(
|
|
79345
|
-
(element,
|
|
79346
|
-
elementAttributeLiveKey(element, activeCompPath,
|
|
79347
|
-
laneApply(element,
|
|
79692
|
+
(element, attr2) => liveLanes.revert(
|
|
79693
|
+
elementAttributeLiveKey(element, activeCompPath, attr2),
|
|
79694
|
+
laneApply(element, attr2)
|
|
79348
79695
|
),
|
|
79349
79696
|
[liveLanes, laneApply, activeCompPath]
|
|
79350
79697
|
);
|
|
79351
79698
|
const setQuiet = useCallback116(
|
|
79352
|
-
async (element,
|
|
79699
|
+
async (element, attr2, value, label) => {
|
|
79353
79700
|
const project = projectIdRef.current;
|
|
79354
79701
|
const pid = projectForTimelineSave(isRecordingRef?.current, project, showToast);
|
|
79355
|
-
const live = claimLive(element,
|
|
79702
|
+
const live = claimLive(element, attr2);
|
|
79356
79703
|
const unsaved = async (outcome) => {
|
|
79357
79704
|
const { targetPath, patchTarget } = elementSaveTarget(element, activeCompPath);
|
|
79358
79705
|
live.settle(
|
|
79359
|
-
await readSavedAttribute(project, targetPath, patchTarget,
|
|
79706
|
+
await readSavedAttribute(project, targetPath, patchTarget, attr2, writeProjectFile)
|
|
79360
79707
|
);
|
|
79361
79708
|
return outcome;
|
|
79362
79709
|
};
|
|
@@ -79366,7 +79713,7 @@ function useSetElementAttribute({
|
|
|
79366
79713
|
projectId: pid,
|
|
79367
79714
|
activeCompPath,
|
|
79368
79715
|
element,
|
|
79369
|
-
attr,
|
|
79716
|
+
attr: attr2,
|
|
79370
79717
|
value,
|
|
79371
79718
|
label,
|
|
79372
79719
|
patchLive: live.preview,
|
|
@@ -79411,12 +79758,12 @@ function editsByFile(edits, activeCompPath) {
|
|
|
79411
79758
|
}
|
|
79412
79759
|
return byFile;
|
|
79413
79760
|
}
|
|
79414
|
-
function patchLive(iframe, edits,
|
|
79761
|
+
function patchLive(iframe, edits, attr2, activeCompPath) {
|
|
79415
79762
|
for (const { element, value } of edits) {
|
|
79416
79763
|
const node = findTimelineElementInIframe(iframe, element, activeCompPath);
|
|
79417
|
-
if (value === null) node?.removeAttribute(
|
|
79418
|
-
else node?.setAttribute(
|
|
79419
|
-
syncStoredElementAttribute(element,
|
|
79764
|
+
if (value === null) node?.removeAttribute(attr2);
|
|
79765
|
+
else node?.setAttribute(attr2, value);
|
|
79766
|
+
syncStoredElementAttribute(element, attr2, value);
|
|
79420
79767
|
}
|
|
79421
79768
|
}
|
|
79422
79769
|
function useSetElementsAttribute({
|
|
@@ -79430,7 +79777,7 @@ function useSetElementsAttribute({
|
|
|
79430
79777
|
isRecordingRef
|
|
79431
79778
|
}) {
|
|
79432
79779
|
return useCallback117(
|
|
79433
|
-
async (edits,
|
|
79780
|
+
async (edits, attr2, label) => {
|
|
79434
79781
|
const projectId = projectForTimelineSave(
|
|
79435
79782
|
isRecordingRef?.current,
|
|
79436
79783
|
projectIdRef.current,
|
|
@@ -79444,7 +79791,7 @@ function useSetElementsAttribute({
|
|
|
79444
79791
|
[...byFile].map(([path, patches]) => [
|
|
79445
79792
|
path,
|
|
79446
79793
|
(before) => patches.reduce(
|
|
79447
|
-
(html2, { target, value }) => applyPatchByTarget(html2, target, { type: "attribute", property:
|
|
79794
|
+
(html2, { target, value }) => applyPatchByTarget(html2, target, { type: "attribute", property: attr2, value }),
|
|
79448
79795
|
before
|
|
79449
79796
|
)
|
|
79450
79797
|
])
|
|
@@ -79458,7 +79805,7 @@ function useSetElementsAttribute({
|
|
|
79458
79805
|
writeFile: writeProjectFile,
|
|
79459
79806
|
recordEdit
|
|
79460
79807
|
});
|
|
79461
|
-
patchLive(previewIframeRef.current, edits,
|
|
79808
|
+
patchLive(previewIframeRef.current, edits, attr2, activeCompPath);
|
|
79462
79809
|
return { status: "saved" };
|
|
79463
79810
|
} catch (error) {
|
|
79464
79811
|
const reason = error instanceof Error ? error.message : "Could not save the clips";
|
|
@@ -81128,8 +81475,8 @@ function useTimelineEditing({
|
|
|
81128
81475
|
// (timelineAudioGroupVolume.ts): a sub-composition's group members have
|
|
81129
81476
|
// no flat twin, only a domClipChildren entry, so both are checked.
|
|
81130
81477
|
setQuiet: track2(
|
|
81131
|
-
guard(audioGroupMembers, setAudioGroupAttribute2.setQuiet, (reason, groupId,
|
|
81132
|
-
setAudioGroupAttribute2.revertLive(groupId,
|
|
81478
|
+
guard(audioGroupMembers, setAudioGroupAttribute2.setQuiet, (reason, groupId, attr2) => {
|
|
81479
|
+
setAudioGroupAttribute2.revertLive(groupId, attr2);
|
|
81133
81480
|
return refused(reason);
|
|
81134
81481
|
})
|
|
81135
81482
|
)
|
|
@@ -81142,8 +81489,8 @@ function useTimelineEditing({
|
|
|
81142
81489
|
guard(
|
|
81143
81490
|
(element) => [element],
|
|
81144
81491
|
setElementFxAttribute.setQuiet,
|
|
81145
|
-
(reason, element,
|
|
81146
|
-
setElementFxAttribute.revertLive(element,
|
|
81492
|
+
(reason, element, attr2) => {
|
|
81493
|
+
setElementFxAttribute.revertLive(element, attr2);
|
|
81147
81494
|
return refused(reason);
|
|
81148
81495
|
}
|
|
81149
81496
|
)
|
|
@@ -81575,6 +81922,9 @@ function announceTimelineSelection(deps, group, primary, replaceSet = false) {
|
|
|
81575
81922
|
}
|
|
81576
81923
|
|
|
81577
81924
|
// src/hooks/useDomSelection.ts
|
|
81925
|
+
function groupStillLive(live, refreshed, next) {
|
|
81926
|
+
return next.length > 0 && live.current === refreshed;
|
|
81927
|
+
}
|
|
81578
81928
|
function useDomSelection({
|
|
81579
81929
|
projectId,
|
|
81580
81930
|
activeCompPath,
|
|
@@ -81668,7 +82018,7 @@ function useDomSelection({
|
|
|
81668
82018
|
setDomEditSelection(nextSelection);
|
|
81669
82019
|
setDomEditGroupSelections(nextGroup);
|
|
81670
82020
|
const activeGroup = activeGroupElementRef.current;
|
|
81671
|
-
if (activeGroup && nextSelection && !activeGroup
|
|
82021
|
+
if (activeGroup && nextSelection && !elementWithin(activeGroup, nextSelection.element)) {
|
|
81672
82022
|
activeGroupElementRef.current = null;
|
|
81673
82023
|
setActiveGroupElementState(null);
|
|
81674
82024
|
}
|
|
@@ -81699,8 +82049,8 @@ function useDomSelection({
|
|
|
81699
82049
|
[applyDomSelection]
|
|
81700
82050
|
);
|
|
81701
82051
|
const buildDomSelectionFromTarget = useCallback129(
|
|
81702
|
-
(target, options) => {
|
|
81703
|
-
return
|
|
82052
|
+
(target, options, iframe = previewIframeRef.current) => {
|
|
82053
|
+
return resolveFoundSelection(iframe, target, {
|
|
81704
82054
|
activeCompositionPath: activeCompPath,
|
|
81705
82055
|
isMasterView,
|
|
81706
82056
|
preferClipAncestor: options?.preferClipAncestor,
|
|
@@ -81711,7 +82061,7 @@ function useDomSelection({
|
|
|
81711
82061
|
projectId
|
|
81712
82062
|
});
|
|
81713
82063
|
},
|
|
81714
|
-
[activeCompPath, isMasterView, projectId]
|
|
82064
|
+
[activeCompPath, isMasterView, previewIframeRef, projectId]
|
|
81715
82065
|
);
|
|
81716
82066
|
const resolveDomSelectionFromPreviewPoint = useCallback129(
|
|
81717
82067
|
// fallow-ignore-next-line complexity
|
|
@@ -81722,7 +82072,7 @@ function useDomSelection({
|
|
|
81722
82072
|
if (iframe.contentDocument) reapplyPositionEditsAfterSeek(iframe.contentDocument);
|
|
81723
82073
|
} catch {
|
|
81724
82074
|
}
|
|
81725
|
-
const target =
|
|
82075
|
+
const target = await findPointerTarget(iframe, clientX, clientY);
|
|
81726
82076
|
if (!target) return null;
|
|
81727
82077
|
return buildDomSelectionFromTarget(
|
|
81728
82078
|
target,
|
|
@@ -81736,7 +82086,7 @@ function useDomSelection({
|
|
|
81736
82086
|
}
|
|
81737
82087
|
);
|
|
81738
82088
|
},
|
|
81739
|
-
[
|
|
82089
|
+
[buildDomSelectionFromTarget, captionEditMode, previewIframeRef]
|
|
81740
82090
|
);
|
|
81741
82091
|
const resolveAllDomSelectionsFromPreviewPoint = useCallback129(
|
|
81742
82092
|
// fallow-ignore-next-line complexity
|
|
@@ -81747,7 +82097,7 @@ function useDomSelection({
|
|
|
81747
82097
|
if (iframe.contentDocument) reapplyPositionEditsAfterSeek(iframe.contentDocument);
|
|
81748
82098
|
} catch {
|
|
81749
82099
|
}
|
|
81750
|
-
const targets =
|
|
82100
|
+
const targets = await findPointerTargets(iframe, clientX, clientY);
|
|
81751
82101
|
const results = [];
|
|
81752
82102
|
for (const target of targets) {
|
|
81753
82103
|
const sel = await buildDomSelectionFromTarget(target, { skipSourceProbe: true });
|
|
@@ -81755,10 +82105,12 @@ function useDomSelection({
|
|
|
81755
82105
|
}
|
|
81756
82106
|
return results;
|
|
81757
82107
|
},
|
|
81758
|
-
[
|
|
82108
|
+
[buildDomSelectionFromTarget, captionEditMode, previewIframeRef]
|
|
81759
82109
|
);
|
|
81760
82110
|
const updateDomEditHoverSelection = useCallback129((selection) => {
|
|
81761
|
-
|
|
82111
|
+
const current2 = domEditHoverSelectionRef.current;
|
|
82112
|
+
const sameHandle = current2?.handle === selection?.handle;
|
|
82113
|
+
if (domEditSelectionsTargetSame(current2, selection) && sameHandle) return;
|
|
81762
82114
|
domEditHoverSelectionRef.current = selection;
|
|
81763
82115
|
setDomEditHoverSelection(selection);
|
|
81764
82116
|
}, []);
|
|
@@ -81766,21 +82118,21 @@ function useDomSelection({
|
|
|
81766
82118
|
// fallow-ignore-next-line complexity
|
|
81767
82119
|
async (element) => {
|
|
81768
82120
|
const iframe = previewIframeRef.current;
|
|
82121
|
+
const lookup2 = { activeCompositionPath: activeCompPath, compIdToSrc, isMasterView };
|
|
81769
82122
|
let doc = null;
|
|
81770
82123
|
try {
|
|
81771
82124
|
doc = iframe?.contentDocument ?? null;
|
|
81772
82125
|
} catch {
|
|
81773
82126
|
return null;
|
|
81774
82127
|
}
|
|
81775
|
-
if (!doc)
|
|
82128
|
+
if (!doc) {
|
|
82129
|
+
const found = await findOpaqueTimelineElement(iframe, element, lookup2);
|
|
82130
|
+
return found ? buildDomSelectionFromTarget(found, { preferClipAncestor: false }, iframe) : null;
|
|
82131
|
+
}
|
|
81776
82132
|
const held = holdScenesOf(iframe, element);
|
|
81777
82133
|
if (held) await held;
|
|
81778
82134
|
reapplyPositionEditsAfterSeek(doc);
|
|
81779
|
-
const targetElement = findElementForTimelineElement(doc, element,
|
|
81780
|
-
activeCompositionPath: activeCompPath,
|
|
81781
|
-
compIdToSrc,
|
|
81782
|
-
isMasterView
|
|
81783
|
-
});
|
|
82135
|
+
const targetElement = findElementForTimelineElement(doc, element, lookup2);
|
|
81784
82136
|
return targetElement ? buildDomSelectionFromTarget(targetElement, {
|
|
81785
82137
|
preferClipAncestor: false
|
|
81786
82138
|
}) : null;
|
|
@@ -81812,14 +82164,8 @@ function useDomSelection({
|
|
|
81812
82164
|
async (selection, iframe = previewIframeRef.current) => {
|
|
81813
82165
|
const stillSelected = () => domEditSelectionsTargetSame(domEditSelectionRef.current, selection);
|
|
81814
82166
|
if (!stillSelected()) return;
|
|
81815
|
-
|
|
81816
|
-
|
|
81817
|
-
doc = iframe?.contentDocument ?? null;
|
|
81818
|
-
} catch {
|
|
81819
|
-
return;
|
|
81820
|
-
}
|
|
81821
|
-
if (!doc) return;
|
|
81822
|
-
const element = findElementForSelection(doc, selection, activeCompPath);
|
|
82167
|
+
const element = await findSelectionElement(iframe, selection, activeCompPath);
|
|
82168
|
+
if (element === void 0 || !stillSelected()) return;
|
|
81823
82169
|
if (!element) {
|
|
81824
82170
|
const group = domEditGroupSelectionsRef.current;
|
|
81825
82171
|
logSelect("refresh-lost", {
|
|
@@ -81827,13 +82173,17 @@ function useDomSelection({
|
|
|
81827
82173
|
group: group.length
|
|
81828
82174
|
});
|
|
81829
82175
|
if (group.length > 1) {
|
|
81830
|
-
await refreshDomEditGroupSelectionsFromPreviewRef.current(group);
|
|
82176
|
+
await refreshDomEditGroupSelectionsFromPreviewRef.current(group, iframe);
|
|
81831
82177
|
return;
|
|
81832
82178
|
}
|
|
81833
82179
|
applyDomSelection(null, { revealPanel: false });
|
|
81834
82180
|
return;
|
|
81835
82181
|
}
|
|
81836
|
-
const nextSelection = await buildDomSelectionFromTarget(
|
|
82182
|
+
const nextSelection = await buildDomSelectionFromTarget(
|
|
82183
|
+
element,
|
|
82184
|
+
{ previous: selection },
|
|
82185
|
+
iframe
|
|
82186
|
+
);
|
|
81837
82187
|
if (nextSelection && stillSelected()) {
|
|
81838
82188
|
applyDomSelection(nextSelection, {
|
|
81839
82189
|
revealPanel: false,
|
|
@@ -81845,23 +82195,20 @@ function useDomSelection({
|
|
|
81845
82195
|
);
|
|
81846
82196
|
const refreshDomEditGroupSelectionsFromPreview = useCallback129(
|
|
81847
82197
|
// fallow-ignore-next-line complexity
|
|
81848
|
-
async (selections) => {
|
|
81849
|
-
const iframe = previewIframeRef.current;
|
|
81850
|
-
let doc = null;
|
|
81851
|
-
try {
|
|
81852
|
-
doc = iframe?.contentDocument ?? null;
|
|
81853
|
-
} catch {
|
|
81854
|
-
return;
|
|
81855
|
-
}
|
|
81856
|
-
if (!doc) return;
|
|
82198
|
+
async (selections, iframe = previewIframeRef.current) => {
|
|
81857
82199
|
const nextGroup = [];
|
|
81858
82200
|
for (const selection of selections) {
|
|
81859
|
-
const element =
|
|
82201
|
+
const element = await findSelectionElement(iframe, selection, activeCompPath);
|
|
82202
|
+
if (element === void 0) return;
|
|
81860
82203
|
if (!element) continue;
|
|
81861
|
-
const nextSelection2 = await buildDomSelectionFromTarget(
|
|
82204
|
+
const nextSelection2 = await buildDomSelectionFromTarget(
|
|
82205
|
+
element,
|
|
82206
|
+
{ previous: selection },
|
|
82207
|
+
iframe
|
|
82208
|
+
);
|
|
81862
82209
|
if (nextSelection2) nextGroup.push(nextSelection2);
|
|
81863
82210
|
}
|
|
81864
|
-
if (
|
|
82211
|
+
if (!groupStillLive(domEditGroupSelectionsRef, selections, nextGroup)) return;
|
|
81865
82212
|
const currentSelection = domEditSelectionRef.current;
|
|
81866
82213
|
const nextSelection = nextGroup.find((selection) => domEditSelectionsTargetSame(selection, currentSelection)) ?? nextGroup[0] ?? null;
|
|
81867
82214
|
domEditSelectionRef.current = nextSelection;
|
|
@@ -81888,7 +82235,7 @@ function useDomSelection({
|
|
|
81888
82235
|
}, [activeCompPath, projectId, applyDomSelection]);
|
|
81889
82236
|
useEffect123(() => {
|
|
81890
82237
|
if (!domEditHoverSelection) return;
|
|
81891
|
-
const shouldClear = captionEditMode || domEditSelectionsTargetSame(domEditHoverSelection, domEditSelection) || domEditSelectionInGroup(domEditGroupSelections, domEditHoverSelection) || !domEditHoverSelection
|
|
82238
|
+
const shouldClear = captionEditMode || domEditSelectionsTargetSame(domEditHoverSelection, domEditSelection) || domEditSelectionInGroup(domEditGroupSelections, domEditHoverSelection) || !selectionElementLive(domEditHoverSelection);
|
|
81892
82239
|
if (shouldClear) updateDomEditHoverSelection(null);
|
|
81893
82240
|
}, [
|
|
81894
82241
|
captionEditMode,
|
|
@@ -82021,7 +82368,7 @@ function usePreviewInteraction({
|
|
|
82021
82368
|
const hit = await resolveDomSelectionFromPreviewPoint(e.clientX, e.clientY);
|
|
82022
82369
|
const cycle = cycleRef.current;
|
|
82023
82370
|
const hasStackCycleAtSpot = cycle !== null && cycle.candidates.length > 1 && Math.hypot(e.clientX - cycle.x, e.clientY - cycle.y) < CYCLE_RADIUS_PX && downTs - cycle.at < CYCLE_WINDOW_MS;
|
|
82024
|
-
if (hit
|
|
82371
|
+
if (hit && selectionDataAttribute(hit, "data-hf-group") !== null) {
|
|
82025
82372
|
e.preventDefault();
|
|
82026
82373
|
e.stopPropagation();
|
|
82027
82374
|
cycleRef.current = null;
|
|
@@ -82033,7 +82380,7 @@ function usePreviewInteraction({
|
|
|
82033
82380
|
applyDomSelection(child ?? hit);
|
|
82034
82381
|
return;
|
|
82035
82382
|
}
|
|
82036
|
-
if (hit && !hasStackCycleAtSpot &&
|
|
82383
|
+
if (hit && !hasStackCycleAtSpot && selectionDataAttribute(hit, "data-composition-src") === null && selectionDataAttribute(hit, "data-composition-file") === null) {
|
|
82037
82384
|
e.preventDefault();
|
|
82038
82385
|
e.stopPropagation();
|
|
82039
82386
|
cycleRef.current = null;
|
|
@@ -82764,12 +83111,12 @@ async function commitDomStyles(context, selection, stylesInEitherCase) {
|
|
|
82764
83111
|
// src/hooks/useDomEditAttributeCommits.ts
|
|
82765
83112
|
import { useCallback as useCallback133, useRef as useRef151 } from "react";
|
|
82766
83113
|
import { HF_AUDIO_GROUP_ATTR as HF_AUDIO_GROUP_ATTR6, HF_AUDIO_GROUP_TAG as HF_AUDIO_GROUP_TAG8 } from "@hyperframes/core/audio-groups";
|
|
82767
|
-
function resolveFullAttrName(
|
|
82768
|
-
return prefixData && !
|
|
83114
|
+
function resolveFullAttrName(attr2, prefixData) {
|
|
83115
|
+
return prefixData && !attr2.startsWith("data-") ? `data-${attr2}` : attr2;
|
|
82769
83116
|
}
|
|
82770
|
-
function resolveOptimisticAttributeValue(
|
|
83117
|
+
function resolveOptimisticAttributeValue(attr2, value) {
|
|
82771
83118
|
if (value === null) return null;
|
|
82772
|
-
return value === "false" && HTML_BOOLEAN_ATTRIBUTES.has(
|
|
83119
|
+
return value === "false" && HTML_BOOLEAN_ATTRIBUTES.has(attr2) ? null : value;
|
|
82773
83120
|
}
|
|
82774
83121
|
function previewAttributeName(op) {
|
|
82775
83122
|
return op.type === "attribute" ? resolveFullAttrName(op.property, true) : op.property;
|
|
@@ -82815,16 +83162,16 @@ function useDomEditAttributeCommits({
|
|
|
82815
83162
|
}) {
|
|
82816
83163
|
const domAttributeCommitVersionRef = useRef151(/* @__PURE__ */ new Map());
|
|
82817
83164
|
const commitDataAttribute = useCallback133(
|
|
82818
|
-
async (
|
|
83165
|
+
async (attr2, value, options) => {
|
|
82819
83166
|
if (!domEditSelection) return;
|
|
82820
83167
|
const iframe = previewIframeRef.current;
|
|
82821
|
-
const fullAttr = resolveFullAttrName(
|
|
82822
|
-
const commitKey = `${options.coalescePrefix}:${
|
|
83168
|
+
const fullAttr = resolveFullAttrName(attr2, true);
|
|
83169
|
+
const commitKey = `${options.coalescePrefix}:${attr2}:${getDomEditTargetKey(domEditSelection)}`;
|
|
82823
83170
|
const isLatestCommit = bumpDomEditCommitMapVersion(
|
|
82824
83171
|
domAttributeCommitVersionRef.current,
|
|
82825
83172
|
commitKey
|
|
82826
83173
|
);
|
|
82827
|
-
const op = { type: "attribute", property:
|
|
83174
|
+
const op = { type: "attribute", property: attr2, value };
|
|
82828
83175
|
let editedElement = null;
|
|
82829
83176
|
let previousValue = null;
|
|
82830
83177
|
await runDomEditCommit({
|
|
@@ -82975,9 +83322,9 @@ function useDomEditAttributeCommits({
|
|
|
82975
83322
|
[commitAttributeOps]
|
|
82976
83323
|
);
|
|
82977
83324
|
const handleDomAttributeCommit = useCallback133(
|
|
82978
|
-
async (
|
|
82979
|
-
await commitDataAttribute(
|
|
82980
|
-
label: `Edit ${
|
|
83325
|
+
async (attr2, value) => {
|
|
83326
|
+
await commitDataAttribute(attr2, value, {
|
|
83327
|
+
label: `Edit ${attr2.replace(/-/g, " ")}`,
|
|
82981
83328
|
coalescePrefix: "attr",
|
|
82982
83329
|
skipRefresh: false,
|
|
82983
83330
|
refreshAfter: true
|
|
@@ -82986,9 +83333,9 @@ function useDomEditAttributeCommits({
|
|
|
82986
83333
|
[commitDataAttribute]
|
|
82987
83334
|
);
|
|
82988
83335
|
const handleDomAttributeLiveCommit = useCallback133(
|
|
82989
|
-
async (
|
|
82990
|
-
await commitDataAttribute(
|
|
82991
|
-
label: `Edit ${
|
|
83336
|
+
async (attr2, value, onSettled, live) => {
|
|
83337
|
+
await commitDataAttribute(attr2, value, {
|
|
83338
|
+
label: `Edit ${attr2.replace(/^(data-)?/, "").replace(/-/g, " ")}`,
|
|
82992
83339
|
coalescePrefix: "attr-live",
|
|
82993
83340
|
skipRefresh: true,
|
|
82994
83341
|
onSettled,
|
|
@@ -82998,9 +83345,9 @@ function useDomEditAttributeCommits({
|
|
|
82998
83345
|
[commitDataAttribute]
|
|
82999
83346
|
);
|
|
83000
83347
|
const handleDomAttributeQuietCommit = useCallback133(
|
|
83001
|
-
async (
|
|
83002
|
-
await commitDataAttribute(
|
|
83003
|
-
label: `Edit ${
|
|
83348
|
+
async (attr2, value) => {
|
|
83349
|
+
await commitDataAttribute(attr2, value, {
|
|
83350
|
+
label: `Edit ${attr2.replace(/^(data-)?/, "").replace(/-/g, " ")}`,
|
|
83004
83351
|
coalescePrefix: "attr-quiet",
|
|
83005
83352
|
skipRefresh: true,
|
|
83006
83353
|
refreshAfter: true
|
|
@@ -83009,15 +83356,15 @@ function useDomEditAttributeCommits({
|
|
|
83009
83356
|
[commitDataAttribute]
|
|
83010
83357
|
);
|
|
83011
83358
|
const handleDomHtmlAttributeCommit = useCallback133(
|
|
83012
|
-
async (
|
|
83359
|
+
async (attr2, value) => {
|
|
83013
83360
|
if (!domEditSelection) return;
|
|
83014
83361
|
const iframe = previewIframeRef.current;
|
|
83015
|
-
const commitKey = `html-attr:${
|
|
83362
|
+
const commitKey = `html-attr:${attr2}:${getDomEditTargetKey(domEditSelection)}`;
|
|
83016
83363
|
const isLatestCommit = bumpDomEditCommitMapVersion(
|
|
83017
83364
|
domAttributeCommitVersionRef.current,
|
|
83018
83365
|
commitKey
|
|
83019
83366
|
);
|
|
83020
|
-
const op = { type: "html-attribute", property:
|
|
83367
|
+
const op = { type: "html-attribute", property: attr2, value };
|
|
83021
83368
|
let editedElement = null;
|
|
83022
83369
|
let previousValue = null;
|
|
83023
83370
|
await runDomEditCommit({
|
|
@@ -83026,7 +83373,7 @@ function useDomEditAttributeCommits({
|
|
|
83026
83373
|
iframe?.contentDocument,
|
|
83027
83374
|
domEditSelection,
|
|
83028
83375
|
activeCompPath,
|
|
83029
|
-
|
|
83376
|
+
attr2
|
|
83030
83377
|
);
|
|
83031
83378
|
if (!captured) return;
|
|
83032
83379
|
editedElement = captured.element;
|
|
@@ -83036,19 +83383,19 @@ function useDomEditAttributeCommits({
|
|
|
83036
83383
|
if (!editedElement) return;
|
|
83037
83384
|
setOrRemovePreviewAttribute(
|
|
83038
83385
|
editedElement,
|
|
83039
|
-
|
|
83040
|
-
resolveOptimisticAttributeValue(
|
|
83386
|
+
attr2,
|
|
83387
|
+
resolveOptimisticAttributeValue(attr2, value)
|
|
83041
83388
|
);
|
|
83042
83389
|
},
|
|
83043
83390
|
persist: () => persistDomEditOperations(domEditSelection, [op], {
|
|
83044
|
-
label: `Edit ${
|
|
83391
|
+
label: `Edit ${attr2}`,
|
|
83045
83392
|
coalesceKey: commitKey,
|
|
83046
83393
|
skipRefresh: false
|
|
83047
83394
|
}),
|
|
83048
83395
|
shouldRevert: () => isLatestCommit(),
|
|
83049
83396
|
revert: () => {
|
|
83050
83397
|
if (!editedElement) return;
|
|
83051
|
-
setOrRemovePreviewAttribute(editedElement,
|
|
83398
|
+
setOrRemovePreviewAttribute(editedElement, attr2, previousValue);
|
|
83052
83399
|
},
|
|
83053
83400
|
onError: (error) => reportDomEditPersistFailure(domEditSelection, [op], error, showToast),
|
|
83054
83401
|
shouldResync: () => isLatestCommit(),
|
|
@@ -85740,7 +86087,7 @@ function useGsapSelectionHandlers({
|
|
|
85740
86087
|
"add",
|
|
85741
86088
|
`Add GSAP ${method} animation`
|
|
85742
86089
|
);
|
|
85743
|
-
if (selection
|
|
86090
|
+
if (selectionDataAttribute(selection, "data-hf-studio-path-offset") !== null) {
|
|
85744
86091
|
void landed.then((didLand) => {
|
|
85745
86092
|
if (didLand) void handleDomManualEditsReset(selection).catch(() => void 0);
|
|
85746
86093
|
});
|
|
@@ -87697,7 +88044,7 @@ function useStudioSelectionPublisher({
|
|
|
87697
88044
|
const pendingSelectionRefreshKeyRef = useRef158(null);
|
|
87698
88045
|
useEffect127(() => {
|
|
87699
88046
|
if (!projectId) return;
|
|
87700
|
-
const selection = domEditSelection
|
|
88047
|
+
const selection = domEditSelection && selectionElementLive(domEditSelection) ? buildStudioSelectionSnapshot({
|
|
87701
88048
|
projectId,
|
|
87702
88049
|
selection: domEditSelection,
|
|
87703
88050
|
currentTime: usePlayerStore.getState().currentTime
|
|
@@ -88252,7 +88599,7 @@ function useDomEditSession({
|
|
|
88252
88599
|
}, [domEditGroupSelectionsRef, domEditSelectionRef, groupSelection, showToast]);
|
|
88253
88600
|
const handleUngroupSelection = useCallback152(() => {
|
|
88254
88601
|
const sel = domEditSelectionRef.current;
|
|
88255
|
-
if (!sel
|
|
88602
|
+
if (!sel || selectionDataAttribute(sel, "data-hf-group") === null) {
|
|
88256
88603
|
showToast("Select a group to ungroup", "info");
|
|
88257
88604
|
return;
|
|
88258
88605
|
}
|
|
@@ -101428,7 +101775,7 @@ var StudioRightPanels = memo62(function StudioRightPanels2({
|
|
|
101428
101775
|
const handleApplyColorGradingScope = useApplyColorGradingScope(recordEdit, reloadPreview);
|
|
101429
101776
|
const handleRemoveBackground = useRemoveBackground(projectId, refreshFileTree, showToast);
|
|
101430
101777
|
const setAttributeWhileDragging = useCallback192(
|
|
101431
|
-
(
|
|
101778
|
+
(attr2, value) => handleDomAttributeLiveCommit(attr2, value, void 0, { previewOnly: true }),
|
|
101432
101779
|
[handleDomAttributeLiveCommit]
|
|
101433
101780
|
);
|
|
101434
101781
|
const handleHideAllSelected = useCallback192(() => {
|
|
@@ -103453,23 +103800,23 @@ function useElementPicker(iframeRef, options) {
|
|
|
103453
103800
|
[pickedElement, getActiveIframe, setPickedElement, syncToSource]
|
|
103454
103801
|
);
|
|
103455
103802
|
const setDataAttr = useCallback198(
|
|
103456
|
-
(
|
|
103803
|
+
(attr2, value) => {
|
|
103457
103804
|
const activeIframe = getActiveIframe();
|
|
103458
103805
|
if (!pickedElement?.selector || !activeIframe) return;
|
|
103459
103806
|
try {
|
|
103460
103807
|
const doc = activeIframe.contentDocument;
|
|
103461
103808
|
const el = doc?.querySelector(pickedElement.selector);
|
|
103462
103809
|
if (el) {
|
|
103463
|
-
el.setAttribute(`data-${
|
|
103810
|
+
el.setAttribute(`data-${attr2}`, value);
|
|
103464
103811
|
setPickedElement(
|
|
103465
103812
|
(prev) => prev ? {
|
|
103466
103813
|
...prev,
|
|
103467
|
-
dataAttributes: { ...prev.dataAttributes, [
|
|
103814
|
+
dataAttributes: { ...prev.dataAttributes, [attr2]: value }
|
|
103468
103815
|
} : null
|
|
103469
103816
|
);
|
|
103470
103817
|
syncToSource(pickedElement, el, activeIframe, {
|
|
103471
103818
|
type: "attribute",
|
|
103472
|
-
property:
|
|
103819
|
+
property: attr2,
|
|
103473
103820
|
value
|
|
103474
103821
|
});
|
|
103475
103822
|
}
|