diff --git a/.filesize-allowlist b/.filesize-allowlist new file mode 100644 index 000000000..bffcc916b --- /dev/null +++ b/.filesize-allowlist @@ -0,0 +1 @@ +packages/studio/src/player/hooks/useTimelinePlayer.ts diff --git a/packages/studio/src/App.tsx b/packages/studio/src/App.tsx index d0491c98e..e9c436b1c 100644 --- a/packages/studio/src/App.tsx +++ b/packages/studio/src/App.tsx @@ -282,13 +282,15 @@ export function StudioApp() { domEditSession.domEditSelection, ) : null; + const layersPanelActive = + STUDIO_INSPECTOR_PANELS_ENABLED && panelLayout.rightPanelTab === "layers"; const designPanelActive = STUDIO_INSPECTOR_PANELS_ENABLED && panelLayout.rightPanelTab === "design"; const motionPanelActive = STUDIO_INSPECTOR_PANELS_ENABLED && STUDIO_MOTION_PANEL_ENABLED && panelLayout.rightPanelTab === "motion"; - const inspectorPanelActive = designPanelActive || motionPanelActive; + const inspectorPanelActive = layersPanelActive || designPanelActive || motionPanelActive; const shouldShowSelectedDomBounds = inspectorPanelActive && !panelLayout.rightCollapsed && !isPlaying; const inspectorButtonActive = diff --git a/packages/studio/src/components/StudioRightPanel.tsx b/packages/studio/src/components/StudioRightPanel.tsx index a1f8da704..e5ee751ca 100644 --- a/packages/studio/src/components/StudioRightPanel.tsx +++ b/packages/studio/src/components/StudioRightPanel.tsx @@ -1,5 +1,6 @@ import { PropertyPanel } from "./editor/PropertyPanel"; import { MotionPanel } from "./editor/MotionPanel"; +import { LayersPanel } from "./editor/LayersPanel"; import { CaptionPropertyPanel } from "../captions/components/CaptionPropertyPanel"; import { RenderQueue } from "./renders/RenderQueue"; import type { RenderJob } from "./renders/useRenderQueue"; @@ -115,6 +116,17 @@ export function StudioRightPanel({ > Design + {STUDIO_MOTION_PANEL_ENABLED && ( + ) : ( + + )} + + {getTagBadge(layer.tagName)} + + {layer.label} + {hasChildren && ( + {layer.childCount} + )} + + ); + })} + + + ); +}); + +function getVisibleLayers( + layers: DomEditLayerItem[], + collapsed: CollapsedState, +): DomEditLayerItem[] { + if (Object.keys(collapsed).length === 0) return layers; + + const result: DomEditLayerItem[] = []; + let skipDepth = -1; + + for (const layer of layers) { + if (skipDepth >= 0 && layer.depth > skipDepth) continue; + skipDepth = -1; + + result.push(layer); + + if (collapsed[layer.key] && layer.childCount > 0) { + skipDepth = layer.depth; + } + } + + return result; +} diff --git a/packages/studio/src/components/editor/propertyPanelPrimitives.tsx b/packages/studio/src/components/editor/propertyPanelPrimitives.tsx index 436e4c9b8..6b766310a 100644 --- a/packages/studio/src/components/editor/propertyPanelPrimitives.tsx +++ b/packages/studio/src/components/editor/propertyPanelPrimitives.tsx @@ -334,24 +334,43 @@ export function Section({ icon, children, accessory, + defaultCollapsed = false, }: { title: string; icon: ReactNode; children: ReactNode; accessory?: ReactNode; + defaultCollapsed?: boolean; }) { + const [collapsed, setCollapsed] = useState(defaultCollapsed); + return ( -
-
+
+
- {children} +
+ {accessory} + + + +
+ + {!collapsed &&
{children}
}
); } diff --git a/packages/studio/src/components/editor/propertyPanelStyleSections.tsx b/packages/studio/src/components/editor/propertyPanelStyleSections.tsx index ea0d85a4a..5702fe764 100644 --- a/packages/studio/src/components/editor/propertyPanelStyleSections.tsx +++ b/packages/studio/src/components/editor/propertyPanelStyleSections.tsx @@ -109,7 +109,7 @@ export function StyleSections({ return ( <> {isFlex && ( -
}> +
} defaultCollapsed>
}> +
} defaultCollapsed> )} -
}> +
} defaultCollapsed>
-
}> +
} defaultCollapsed>
-
}> +
} defaultCollapsed>
-
}> +
} defaultCollapsed>
+
{/* Resolution must remain the leftmost