An open-source, self-hosted system for apps built with web technologies.
Keep bare window transitions explicit
zohayrslileh0eea7c34c450
diff --git a/source/client/view/structure/desktop/desktop.tsx b/source/client/view/structure/desktop/desktop.tsxindex 9efc12a..8f32d67 100644--- a/source/client/view/structure/desktop/desktop.tsx+++ b/source/client/view/structure/desktop/desktop.tsx@@ -19,7 +19,6 @@ import Loading from "../../components/loading"import { useRequirement } from "@libs/readiness"import { usePreferences, useThemedValue } from "@phreshos/react-ui"import { useProperty } from "@the-link/react"-import { isDesktopReplacementLayer } from "@shared/desktop-replacement"import SharedResizeBoundaries from "./windows/shared-resize-boundaries"export default function Workspace() {@@ -112,8 +111,6 @@ export default function Workspace() {function renderWindows(layer: Layer) {- const animateLifecycle = !isDesktopReplacementLayer(layer)-return windows.panesByLayer[layer].map(({ identity, record, client, local, closing, entering, stopping }) => <ProcessWindowkey={identity}@@ -154,8 +151,6 @@ export default function Workspace() {bare={layer !== "window"}- animateLifecycle={animateLifecycle}-minimized={local.minimized}maximized={local.maximized}@@ -164,7 +159,7 @@ export default function Workspace() {stopping={stopping}- entering={animateLifecycle && entering}+ entering={layer === "window" && entering}door={application.doors.program}diff --git a/source/client/view/structure/desktop/windows/process-window.tsx b/source/client/view/structure/desktop/windows/process-window.tsxindex ad7d6b2..2f93983 100644--- a/source/client/view/structure/desktop/windows/process-window.tsx+++ b/source/client/view/structure/desktop/windows/process-window.tsx@@ -17,7 +17,7 @@ const settleDelay = 80* props so memoization can see which process actually changed even though* the peer deliberately keeps each Process instance alive and mutates it.*/-export default memo(function ({ identity, record, assetId, client, title, icon, position, size, localSurface, geometryAnimation, minimizeAnimation, onLocalAnimationComplete, onLocalRepresentation, paintSurfaceSize, depth, active, minimized, maximized, closing, stopping, entering, bare, animateLifecycle, door, programAccess, theme, onFrame, onFrameLoad, onReady, onRaise, onMinimize, onFill, onClose, onClosed, onUnavailable, onMove, onResize, onSnap }: ProcessWindowProps) {+export default memo(function ({ identity, record, assetId, client, title, icon, position, size, localSurface, geometryAnimation, minimizeAnimation, onLocalAnimationComplete, onLocalRepresentation, paintSurfaceSize, depth, active, minimized, maximized, closing, stopping, entering, bare, door, programAccess, theme, onFrame, onFrameLoad, onReady, onRaise, onMinimize, onFill, onClose, onClosed, onUnavailable, onMove, onResize, onSnap }: ProcessWindowProps) {const activate = useCallback(() => onRaise(record), [onRaise, record])@@ -114,8 +114,6 @@ export default memo(function ({ identity, record, assetId, client, title, icon,bare={bare}- animateLifecycle={animateLifecycle}-minimized={minimized}maximized={maximized}@@ -152,7 +150,7 @@ export default memo(function ({ identity, record, assetId, client, title, icon,{/* A launch names one of its client half's own pages; joining itto the program asset route remains the view's responsibility. */}- {(!stopping && !closing || bare && animateLifecycle) && <ProgramFrame+ {!stopping && !closing && <ProgramFramerecord={record}@@ -242,8 +240,6 @@ interface ProcessWindowProps {bare: boolean- animateLifecycle: boolean-door: stringprogramAccess: ProgramAccessdiff --git a/source/client/view/structure/desktop/windows/window-surface.tsx b/source/client/view/structure/desktop/windows/window-surface.tsxindex 1dad60a..6944a19 100644--- a/source/client/view/structure/desktop/windows/window-surface.tsx+++ b/source/client/view/structure/desktop/windows/window-surface.tsx@@ -3,7 +3,7 @@ import { Surface } from "@phreshos/react-ui"import { useLayoutEffect, useRef, useState } from "react"import { motion } from "motion/react"import { type LocalSurfaceState } from "@client/view/components/desktop-host/local-window"-import { surfacePresencePose, surfacePresenceTransition } from "@client/view/appearance/surface-presence"+import { surfaceLifecyclePose, surfacePresenceTransition } from "@client/view/appearance/surface-presence"/** Projects one representation-local Surface without animating its material host. */export default function WindowSurface({ state, onComplete }: WindowSurfaceProps) {@@ -36,8 +36,8 @@ export default function WindowSurface({ state, onComplete }: WindowSurfaceProps)}return <motion.div- initial={animated && visible && !reducedMotion ? surfacePresencePose.entering : surfacePresencePose.entered}- animate={visible ? surfacePresencePose.entered : surfacePresencePose.entering}+ initial={animated && visible && !reducedMotion ? surfaceLifecyclePose.hidden : surfaceLifecyclePose.visible}+ animate={visible ? surfaceLifecyclePose.visible : surfaceLifecyclePose.hidden}transition={animated? surfacePresenceTransition(reducedMotion, transaction): { duration: 0 }}diff --git a/source/client/view/structure/desktop/windows/window.tsx b/source/client/view/structure/desktop/windows/window.tsxindex 1bc08eb..de9c88d 100644--- a/source/client/view/structure/desktop/windows/window.tsx+++ b/source/client/view/structure/desktop/windows/window.tsx@@ -50,7 +50,7 @@ const edges: { edge: WindowEdge, className: string }[] = [const minimizedSurfacePose = { scale: 0.86, y: 28, opacity: 0 }-export default function ({ title, icon, children, onClose, onClosed, onMinimize, onMaximize, onActivate, onUnavailable, onMove, onResize, onSnap, onLocalAnimationComplete, onLocalRepresentation, onFocusCapture, active = false, bare = false, closing = false, stopping = false, minimized = false, maximized = false, animateEntrance = true, animateLifecycle = !bare, position = { x: 0, y: 0 }, size = { width: 520, height: 340 }, localSurface, geometryAnimation, minimizeAnimation, paintSurfaceSize = { width: 0, height: 0 }, minWidth = minimumWindowSize.width, minHeight = minimumWindowSize.height, className, style, ...props }: WindowProps) {+export default function ({ title, icon, children, onClose, onClosed, onMinimize, onMaximize, onActivate, onUnavailable, onMove, onResize, onSnap, onLocalAnimationComplete, onLocalRepresentation, onFocusCapture, active = false, bare = false, closing = false, stopping = false, minimized = false, maximized = false, animateEntrance = true, position = { x: 0, y: 0 }, size = { width: 520, height: 340 }, localSurface, geometryAnimation, minimizeAnimation, paintSurfaceSize = { width: 0, height: 0 }, minWidth = minimumWindowSize.width, minHeight = minimumWindowSize.height, className, style, ...props }: WindowProps) {const reducedMotion = useReducedMotion()const appearanceTransaction = useAppearance().transaction@@ -111,10 +111,6 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,const [presenceHidden, setPresenceHidden] = useState(minimized)- const mounting = useRef(true)-- useEffect(() => { mounting.current = false }, [])-const minimizeTransaction = minimizeAnimation?.transactionuseLayoutEffect(function () {@@ -137,9 +133,9 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,onUnavailable?.("close")- if (!animateLifecycle || reducedMotion) completeClosure()+ if (bare || reducedMotion) completeClosure()- }, [closing, animateLifecycle, reducedMotion])+ }, [closing, bare, reducedMotion])useEffect(function () {@@ -151,11 +147,11 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,}, [bare, minimizeAnimation?.revision, reducedMotion])- const initialPresence = !animateLifecycle || reducedMotion || !animateEntrance+ const initialPresence = bare || reducedMotion || !animateEntrance? surfaceLifecyclePose.visible: surfaceLifecyclePose.hidden- const presencePose = closing && animateLifecycle+ const presencePose = closing && !bare? surfaceLifecyclePose.hidden: minimized? bare ? surfacePresencePose.entering : minimizedSurfacePose@@ -163,19 +159,15 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,const presenceTransition = reducedMotion? { duration: 0 }- : closing && animateLifecycle- ? surfacePresenceTransition(false, appearanceTransaction)- : bare+ : bare? minimizeTransaction? surfacePresenceTransition(false, minimizeTransaction)- : animateLifecycle && animateEntrance && mounting.current- ? surfacePresenceTransition(false, appearanceTransaction)- : { duration: 0 }- : motionTransition(minimizeTransaction ?? appearanceTransaction)+ : { duration: 0 }+ : motionTransition(closing ? appearanceTransaction : minimizeTransaction ?? appearanceTransaction)function completePresence() {- if (closing && animateLifecycle) completeClosure()+ if (closing && !bare) completeClosure()if (minimized) setPresenceHidden(true)@@ -600,9 +592,6 @@ interface WindowProps extends Omit<ComponentProps<"div">, "onAnimationStart" | "// Whether mounting this element represents a newly opened window.animateEntrance?: boolean- /** Whether creation and departure animate this complete Window representation. */- animateLifecycle?: boolean-position?: Positionsize?: Sizediff --git a/tests/desktop-replacements.test.tsx b/tests/desktop-replacements.test.tsxindex d078a18..798068f 100644--- a/tests/desktop-replacements.test.tsx+++ b/tests/desktop-replacements.test.tsx@@ -71,7 +71,7 @@ test("Desktop replaces its default wallpaper with the running Client and restoreexpect(running).not.toContain("data-default-wallpaper")expect(fixture.fallback).not.toHaveBeenCalled()expect(fixture.pane.mock.lastCall?.[0]).toMatchObject({- bare: true, animateLifecycle: false, minimized: false, maximized: true, entering: false, localSurface: null,+ bare: true, minimized: false, maximized: true, entering: false, localSurface: null,position: { x: 0, y: 0 }, size: { width: "100%", height: "100%" }, depth: 0})@@ -102,7 +102,7 @@ test("Desktop replaces the built-in Start Menu in its existing host and restoresexpect(running).toContain('title="start-menu Client"')expect(running).not.toContain("data-default-start-menu")expect(fixture.pane.mock.lastCall?.[0]).toMatchObject({- bare: true, animateLifecycle: false, minimized: false, maximized: true, entering: false, localSurface: null,+ bare: true, minimized: false, maximized: true, entering: false, localSurface: null,position: { x: 0, y: 0 }, size: { width: "100%", height: "100%" }, depth: 0})