An open-source, self-hosted system for apps built with web technologies.
Remove what no Desktop path reaches and comments from earlier designs
zohayrslilehd3d12f52d455
diff --git a/source/client/view/appearance/surface-presence.ts b/source/client/view/appearance/surface-presence.tsindex a0f9dca..05ba2ce 100644--- a/source/client/view/appearance/surface-presence.ts+++ b/source/client/view/appearance/surface-presence.ts@@ -2,11 +2,6 @@ import { type Transaction } from "@phreshos/core"import { type DOMKeyframesDefinition, type Transition } from "motion/react"import { motionTransition } from "./motion"-export const surfacePresencePose = Object.freeze({- entered: { scale: 1, y: 0, opacity: 1 },- entering: { scale: 0.96, y: 8, opacity: 0 }-}) satisfies Record<string, DOMKeyframesDefinition>-/** Shared appearance and disappearance of one complete interactive surface. */export const surfaceLifecyclePose = Object.freeze({visible: { scale: 1, y: 0, opacity: 1 },diff --git a/source/client/view/components/window-manager/window-geometry.ts b/source/client/view/components/window-manager/window-geometry.tsindex cd84738..bab4ed0 100644--- a/source/client/view/components/window-manager/window-geometry.ts+++ b/source/client/view/components/window-manager/window-geometry.ts@@ -117,7 +117,7 @@ export function boundedGeometry(position: Position, size: Size, surface: ViewSizreturn bounded}-/** How far this Desktop's view is moved across the plane, in pixels or in whole views as the context says. */+/** How far this Desktop's view is moved across the plane: in pixels, or in views, as the name holding it says. */export interface ViewportOffset {x: number@@ -207,14 +207,6 @@ export interface PaintMargins {export const noPaintMargins: PaintMargins = Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 })-/**- * The window's box is its geometry; what is painted of it is drawn inside. An- * edge between two Windows is drawn `inset` inside, so neighbors keep a gap- * between them; an edge on the Desktop's own edge is drawn that side's margin- * inside, clear of the screen's edge and the Taskbar. Gaps and margins are- * paint, never geometry. Snap previews use this same function, so preview and- * final paint cannot disagree.- *//*** The space painted around a standard Window: the margins where it meets an edge of its view, the* inset elsewhere. The edges are those of the view the Window lives in on the plane, which isdiff --git a/source/client/view/structure/desktop/desktop-focus.ts b/source/client/view/structure/desktop/desktop-focus.tsindex 4e39028..7dc1886 100644--- a/source/client/view/structure/desktop/desktop-focus.ts+++ b/source/client/view/structure/desktop/desktop-focus.ts@@ -66,12 +66,12 @@ export default function useDesktopFocus(desktop: RefObject<HTMLDivElement | null}, [focusAfter, focusTaskbar])+ // Focus needs nothing here: a Window minimized from its own header hands focus on once it becomes+ // unavailable, and a press in the Taskbar already holds focus where it belongs.const minimize = useCallback(function (record: Process, minimized: boolean) {- windows.minimize(record, minimized)+ windows.minimize(record, minimized).catch(() => undefined)- // If the request came from Window chrome, its later unavailable event- // transfers focus. A Taskbar-origin request already owns correct focus.}, [windows.minimize])const close = useCallback(function (record: Process) {diff --git a/source/client/view/structure/desktop/layers/shell/taskbar/map/map-control.tsx b/source/client/view/structure/desktop/layers/shell/taskbar/map/map-control.tsxindex c58f086..a8aa2c7 100644--- a/source/client/view/structure/desktop/layers/shell/taskbar/map/map-control.tsx+++ b/source/client/view/structure/desktop/layers/shell/taskbar/map/map-control.tsx@@ -297,7 +297,6 @@ export default function MapControl({ viewport, windows, taskbar, spacing, onOpenshown={edge.shown}visible={edge.zone !== null}blocked={edge.blocked}- bare={false}paintSurfaceSize={{ width: edge.layer.clientWidth, height: edge.layer.clientHeight }}paintInset={spacing / 2}paintMargins={desktopMargins(spacing, taskbar)}diff --git a/source/client/view/structure/desktop/windows/process-window.tsx b/source/client/view/structure/desktop/windows/process-window.tsxindex bb4cd6f..e9a5bd0 100644--- a/source/client/view/structure/desktop/windows/process-window.tsx+++ b/source/client/view/structure/desktop/windows/process-window.tsx@@ -1,7 +1,6 @@-import { type WindowRegion } from "@client/view/components/window-manager/window-geometry"import Process from "@client/core/link-manager/auth-manager/process-manager/process"import ClientState from "@client/core/link-manager/auth-manager/process-manager/client-state"-import { type PaintMargins, type ViewSize } from "@client/view/components/window-manager/window-geometry"+import { type PaintMargins, type ViewSize, type WindowRegion } from "@client/view/components/window-manager/window-geometry"import { type PresentationAnimation, type DesktopMoveGestureController } from "@client/view/components/desktop-host/presentation"import { type PresentationGeometryRepresentation } from "@client/view/components/window-manager/presentations"import { type Position, type Size, type TaskbarPosition, type Theme, type PresentationSurface, type WindowLayer } from "@phreshos/core"diff --git a/source/client/view/structure/desktop/windows/snap-preview.tsx b/source/client/view/structure/desktop/windows/snap-preview.tsxindex 2eac0f4..6f134f1 100644--- a/source/client/view/structure/desktop/windows/snap-preview.tsx+++ b/source/client/view/structure/desktop/windows/snap-preview.tsx@@ -7,7 +7,7 @@ import { motionTransition } from "@client/view/appearance/motion"import useWindowGeometryMotion from "./window-geometry-motion"/** Preview of the placement currently offered by a drag. */-export default function SnapPreview({ shown, visible, blocked = false, bare, minimumSize, paintSurfaceSize, paintInset, paintMargins, reducedMotion, zIndex }: SnapPreviewProps) {+export default function SnapPreview({ shown, visible, blocked = false, minimumSize, paintSurfaceSize, paintInset, paintMargins, reducedMotion, zIndex }: SnapPreviewProps) {const transaction = useTiming()("change")@@ -36,10 +36,7 @@ export default function SnapPreview({ shown, visible, blocked = false, bare, min// Held where the plane goes no further, the same surface in a soft danger.color={blocked ? "danger:soft" : undefined}material={{ opacity: "small" }}- style={{- position: "absolute",- ...(bare ? { inset: 0 } : windowPaintInsets(shown.position, shown.size, paintSurfaceSize, paintInset, paintMargins))- }}+ style={{ position: "absolute", ...windowPaintInsets(shown.position, shown.size, paintSurfaceSize, paintInset, paintMargins) }}/></motion.div></motion.div>@@ -55,7 +52,6 @@ interface SnapPreviewProps {visible: boolean/** The hand holds the Window against the plane's end. */blocked?: boolean- bare: booleanminimumSize?: ViewSizepaintSurfaceSize: ViewSizepaintInset: numberdiff --git a/source/client/view/structure/desktop/windows/window-header.tsx b/source/client/view/structure/desktop/windows/window-header.tsxindex 0953a0c..5fff802 100644--- a/source/client/view/structure/desktop/windows/window-header.tsx+++ b/source/client/view/structure/desktop/windows/window-header.tsx@@ -3,8 +3,8 @@ import type { BeginPresentationMoveGesture } from "@phreshos/core"import { Window } from "@phreshos/react-ui"/** Connects Desktop Window behavior to React UI's shared header. */-export default function WindowHeader({ title, icon, active, whole, stopping, beginMoveGesture, onMinimize, onMaximize, onClose }: WindowHeaderProps) {- return <Window.Header active={active} beginMoveGesture={beginMoveGesture} maximized={whole} onMaximize={onMaximize}>+export default function WindowHeader({ title, icon, active, maximized, stopping, beginMoveGesture, onMinimize, onMaximize, onClose }: WindowHeaderProps) {+ return <Window.Header active={active} beginMoveGesture={beginMoveGesture} maximized={maximized} onMaximize={onMaximize}><Window.Header.Identity icon={icon} title={title} /><Window.Header.Actions>{/* The Desktop transfers focus before either operation makes the@@ -21,7 +21,7 @@ interface WindowHeaderProps {title?: ReactNodeicon: stringactive: boolean- whole: boolean+ maximized: booleanstopping: booleanbeginMoveGesture: BeginPresentationMoveGestureonMinimize?: () => voiddiff --git a/source/client/view/structure/desktop/windows/window.tsx b/source/client/view/structure/desktop/windows/window.tsxindex 8609995..7f33453 100644--- a/source/client/view/structure/desktop/windows/window.tsx+++ b/source/client/view/structure/desktop/windows/window.tsx@@ -1,6 +1,6 @@import { ComponentProps, PointerEvent as ReactPointerEvent, ReactNode, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react"import { useReducedMotion } from "@libs/react-motion"-import { surfaceLifecyclePose, surfacePresencePose, surfacePresenceTransition } from "@client/view/appearance/surface-presence"+import { surfaceLifecyclePose, surfacePresenceTransition } from "@client/view/appearance/surface-presence"import WindowPanel from "./window-panel"import { absoluteWindowGeometry, constrainWindowGeometry, minimumWindowSize, noPaintMargins, planeGeometry, resolveWindowGeometry, windowPaintInsets, type PaintMargins, type WindowRegion, type ViewSize } from "@client/view/components/window-manager/window-geometry"import { type BeginPresentationMoveGesture, type Position, type Size, type TaskbarPosition, type PresentationSurface as WindowSurfaceDefinition, type WindowLayer } from "@phreshos/core"@@ -20,24 +20,12 @@ import { physicalToDesktopPixels, useDesktopScale } from "../desktop-scale"import { createPortal } from "react-dom"/**- * A window: a pure function of the record it is given. Every render- * declares the whole target geometry from props — a float as left/top- * pixels, a tile as its relative form. Motion interpolates only the Desktop- * presentation between targets; the record remains the truth and a- * refreshed page renders that truth directly.- *- * One set of Motion values owns the visible pixel geometry from rest,- * through a gesture, and into the next target. Release reports the outcome- * (onMove or onResize with resting pixels —- * a resize carrying an origin only when the edge dragged moved one —- * onSnap with the shares a zone names). The gesture retains the visible- * result until those ordered authoritative mutations settle, then yields.- *- * Motion owns every local interpolation, never the authoritative record.- *- * The chrome uses the shared system material. Content currently uses the- * plain WindowPanel test. The close control requests — the window leaves only when the truth- * drops its process.+ * One drawing on the Desktop: a standard Window, which the Desktop designs, or a Program's own drawing+ * in another layer. Every render declares the whole target geometry from props; Motion values own the+ * visible pixels from rest, through a gesture, and into the next target, while the System's record+ * stays the truth. A gesture's release reports its outcome (onMove, onResize with an origin only when+ * the dragged edge moved one, or onSnap with the shares a zone names) and keeps the visible result+ * until those requests settle.*/const edges: { edge: WindowEdge, className: string }[] = [@@ -70,7 +58,7 @@ export function windowMinimizePose(position: TaskbarPosition) {const wholeView: Position = Object.freeze({ x: "-1/2", y: "-1/2" })-export default function ({ title, header = true, surface, layer, icon, children, onClose, onClosed, onMinimize, onMaximize, onActivate, onUnavailable, onMove, onResize, onSnap, onPresentationAnimationComplete, onPresentationRepresentation, onPresentationMoveGesture, onFocusCapture, onEdgeHold, neighbours, active = false, closing = false, stopping = false, minimized = false, maximized = false, maximizedPosition = wholeView, interactive = true, entering = false, position = { x: 0, y: 0 }, size = { width: 0, height: 0 }, taskbarPosition = "bottom", surfaceAnimation, geometryAnimation, minimizeAnimation, paintSurfaceSize = { width: 0, height: 0 }, paintMargins = noPaintMargins, spacing = 0, minWidth = minimumWindowSize.width, minHeight = minimumWindowSize.height, className, style, ...props }: WindowProps) {+export default function ({ title, header = true, surface, layer, icon, children, onClose, onClosed, onMinimize, onMaximize, onActivate, onUnavailable, onMove, onResize, onSnap, onPresentationAnimationComplete, onPresentationRepresentation, onPresentationMoveGesture, onFocusCapture, onEdgeHold, neighbours, active = false, closing = false, stopping = false, minimized = false, maximized = false, maximizedPosition = wholeView, interactive = true, entering = false, position = { x: 0, y: 0 }, size = { width: 0, height: 0 }, taskbarPosition = "bottom", surfaceAnimation, geometryAnimation, minimizeAnimation, paintSurfaceSize = { width: 0, height: 0 }, paintMargins = noPaintMargins, spacing = 0, className, style, ...props }: WindowProps) {const reducedMotion = useReducedMotion()const appearance = useAppearance()@@ -78,7 +66,8 @@ export default function ({ title, header = true, surface, layer, icon, children,const standard = layer === "window"const surfaceDefinition = surface ?? (standard ? true : false)const surfaceRadius = surfaceDefinition === false ? undefined : windowSurfaceRadius(surfaceDefinition, appearance)- const presentationMinimum = standard ? { width: minWidth, height: minHeight } : undefined+ const presentationMinimum = standard ? minimumWindowSize : undefined+ const { width: minWidth, height: minHeight } = minimumWindowSizefunction resolvePresentedGeometry(selectedPosition: Position, selectedSize: Size, surface: ViewSize) {@@ -226,8 +215,6 @@ export default function ({ title, header = true, surface, layer, icon, children,// A window is absolute when none of its expressions depends on the surface.const absolute = absoluteWindowGeometry(presented.current.position, presented.current.size)- const whole = maximized-const [presenceHidden, setPresenceHidden] = useState(minimized)useLayoutEffect(function () {@@ -282,7 +269,8 @@ export default function ({ title, header = true, surface, layer, icon, children,const presencePose = closing && standard? windowSurfaceLifecyclePose.hidden: minimized- ? standard ? windowMinimizePose(taskbarPosition) : surfacePresencePose.entering+ // Only a standard Window is ever minimized.+ ? windowMinimizePose(taskbarPosition): standard ? windowSurfaceLifecyclePose.visible : surfaceLifecyclePose.visibleconst presenceTransition = reducedMotion@@ -397,9 +385,8 @@ export default function ({ title, header = true, surface, layer, icon, children,? event as DesktopMovePoint: { x: (event as ReactPointerEvent<HTMLElement>).clientX, y: (event as ReactPointerEvent<HTMLElement>).clientY }- // A cancelled pointerdown suppresses double-click synthesis, and- // a shared window restores by double-click; absolute ones keep- // it to block native drags.+ // A Window placed in pixels blocks the browser's native drag; one placed by shares of the view+ // keeps the pointerdown, so a double press can still reach it.if (absolute && !external) (event as ReactPointerEvent<HTMLElement>).preventDefault()const handle = external ? null : (event as ReactPointerEvent<HTMLElement>).currentTarget@@ -422,10 +409,9 @@ export default function ({ title, header = true, surface, layer, icon, children,if (geometryAnimation) onPresentationAnimationComplete?.("geometry", geometryAnimation.revision)- // Pulling a shared window out of its placement belongs to the- // header alone. An edge is not a hand asking to float — it is a- // hand asking for a different size, and a window keeps whatever- // of its placement that edge does not touch.+ // Pulling a Window placed by shares of the view (maximized or snapped) out of its place belongs+ // to dragging it alone. An edge is a hand asking for a different size, and the Window keeps+ // whatever of its place that edge does not touch.let restoring = !absolute && edge === nulllet moved = false@@ -741,7 +727,6 @@ export default function ({ title, header = true, surface, layer, icon, children,shown={gesture.shown}visible={gesture.zone !== null}blocked={gesture.blocked === true}- bare={!standard}minimumSize={presentationMinimum}paintSurfaceSize={paintSurfaceSize}paintInset={paintInset}@@ -840,7 +825,7 @@ export default function ({ title, header = true, surface, layer, icon, children,active={active}- whole={whole}+ maximized={maximized}beginMoveGesture={beginWindowMoveGesture}@@ -972,10 +957,6 @@ interface WindowProps extends Omit<ComponentProps<"div">, "onAnimationStart" | "/** Appearance spacing shared by the layer boundary and tiled gaps. */spacing?: number- minWidth?: number-- minHeight?: number-}interface Gesture {