@hyperframes/studio 0.6.74 → 0.6.75
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/index-DcyZuBcU.css +1 -0
- package/dist/assets/index-uB_W2GDl.js +140 -0
- package/dist/index.html +2 -2
- package/package.json +4 -4
- package/src/components/editor/LayersPanel.test.ts +135 -0
- package/src/components/editor/LayersPanel.tsx +151 -15
- package/src/components/editor/useLayerDrag.ts +213 -0
- package/src/contexts/DomEditContext.tsx +3 -0
- package/src/hooks/useDomEditCommits.ts +49 -0
- package/src/hooks/useDomEditSession.ts +2 -2
- package/dist/assets/index-BcJO6Ej5.js +0 -140
- package/dist/assets/index-C2gBZ2km.css +0 -1
|
@@ -529,6 +529,54 @@ export function useDomEditCommits({
|
|
|
529
529
|
],
|
|
530
530
|
);
|
|
531
531
|
|
|
532
|
+
const handleDomZIndexReorderCommit = useCallback(
|
|
533
|
+
(
|
|
534
|
+
entries: Array<{
|
|
535
|
+
element: HTMLElement;
|
|
536
|
+
zIndex: number;
|
|
537
|
+
id?: string;
|
|
538
|
+
selector?: string;
|
|
539
|
+
selectorIndex?: number;
|
|
540
|
+
sourceFile: string;
|
|
541
|
+
}>,
|
|
542
|
+
) => {
|
|
543
|
+
if (entries.length === 0) return;
|
|
544
|
+
const coalesceKey = `z-reorder:${entries.map((e) => e.id ?? e.selector ?? "el").join(":")}`;
|
|
545
|
+
for (let i = 0; i < entries.length; i++) {
|
|
546
|
+
const entry = entries[i];
|
|
547
|
+
entry.element.style.zIndex = String(entry.zIndex);
|
|
548
|
+
const patches: Array<{ type: "inline-style"; property: string; value: string }> = [
|
|
549
|
+
{ type: "inline-style", property: "z-index", value: String(entry.zIndex) },
|
|
550
|
+
];
|
|
551
|
+
try {
|
|
552
|
+
const win = entry.element.ownerDocument?.defaultView;
|
|
553
|
+
if (win && win.getComputedStyle(entry.element).position === "static") {
|
|
554
|
+
entry.element.style.position = "relative";
|
|
555
|
+
patches.push({ type: "inline-style", property: "position", value: "relative" });
|
|
556
|
+
}
|
|
557
|
+
} catch {
|
|
558
|
+
/* cross-origin or detached — skip */
|
|
559
|
+
}
|
|
560
|
+
commitPositionPatchToHtml(
|
|
561
|
+
{
|
|
562
|
+
element: entry.element,
|
|
563
|
+
id: entry.id ?? null,
|
|
564
|
+
selector: entry.selector,
|
|
565
|
+
selectorIndex: entry.selectorIndex,
|
|
566
|
+
sourceFile: entry.sourceFile,
|
|
567
|
+
} as unknown as DomEditSelection,
|
|
568
|
+
patches,
|
|
569
|
+
{
|
|
570
|
+
label: "Reorder layers",
|
|
571
|
+
coalesceKey,
|
|
572
|
+
skipRefresh: i < entries.length - 1,
|
|
573
|
+
},
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
[commitPositionPatchToHtml],
|
|
578
|
+
);
|
|
579
|
+
|
|
532
580
|
return {
|
|
533
581
|
resolveImportedFontAsset,
|
|
534
582
|
handleDomStyleCommit,
|
|
@@ -547,5 +595,6 @@ export function useDomEditCommits({
|
|
|
547
595
|
handleDomMotionCommit,
|
|
548
596
|
handleDomMotionClear,
|
|
549
597
|
handleDomEditElementDelete,
|
|
598
|
+
handleDomZIndexReorderCommit,
|
|
550
599
|
};
|
|
551
600
|
}
|
|
@@ -289,6 +289,7 @@ export function useDomEditSession({
|
|
|
289
289
|
handleDomMotionCommit,
|
|
290
290
|
handleDomMotionClear,
|
|
291
291
|
handleDomEditElementDelete,
|
|
292
|
+
handleDomZIndexReorderCommit,
|
|
292
293
|
} = useDomEditCommits({
|
|
293
294
|
activeCompPath,
|
|
294
295
|
previewIframeRef,
|
|
@@ -537,10 +538,8 @@ export function useDomEditSession({
|
|
|
537
538
|
agentModalAnchorPoint,
|
|
538
539
|
copiedAgentPrompt,
|
|
539
540
|
agentPromptSelectionContext,
|
|
540
|
-
|
|
541
541
|
// Refs
|
|
542
542
|
domEditSelectionRef,
|
|
543
|
-
|
|
544
543
|
// Callbacks
|
|
545
544
|
handleTimelineElementSelect,
|
|
546
545
|
handlePreviewCanvasMouseDown,
|
|
@@ -553,6 +552,7 @@ export function useDomEditSession({
|
|
|
553
552
|
handleDomHtmlAttributeCommit,
|
|
554
553
|
handleDomPathOffsetCommit: handleGsapAwarePathOffsetCommit,
|
|
555
554
|
handleDomGroupPathOffsetCommit,
|
|
555
|
+
handleDomZIndexReorderCommit,
|
|
556
556
|
handleDomBoxSizeCommit: handleGsapAwareBoxSizeCommit,
|
|
557
557
|
handleDomRotationCommit: handleGsapAwareRotationCommit,
|
|
558
558
|
handleDomManualEditsReset,
|