Skip to content

An open-source, self-hosted system for apps built with web technologies.

Use shared Surface defaults throughout Desktop

zohayrslileh206929cc078c
diff --git a/source/client/view/appearance/appearance.css b/source/client/view/appearance/appearance.css
index 957f874..1f9d805 100644
--- a/source/client/view/appearance/appearance.css
+++ b/source/client/view/appearance/appearance.css
@@ -15,8 +15,6 @@
--spacing-taskbar: 2.75rem;
- --shadow-taskbar: 0 20px 40px -16px rgba(12, 30, 60, 0.45);
-
--shadow-taskbar-control: inset 0 1px 0 rgba(255, 255, 255, 0.8);
--shadow-taskbar-item: inset 0 1px 0 rgba(255, 255, 255, 0.7);
@@ -29,14 +27,6 @@
--shadow-launcher-icon: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 14px -8px rgba(12, 46, 88, 0.55);
- --shadow-window-active:
- 0 24px 48px light-dark(rgba(12, 30, 60, 0.2), rgba(12, 30, 60, 0.1)),
- 0 8px 20px -8px light-dark(rgba(56, 189, 248, 0.175), rgba(56, 189, 248, 0.0875));
-
- --shadow-window-inactive:
- 0 14px 28px light-dark(rgba(12, 30, 60, 0.14), rgba(12, 30, 60, 0.07)),
- 0 8px 20px -8px rgba(56, 189, 248, 0);
-
--shadow-window-controls: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(12, 46, 88, 0.15);
--shadow-window-content: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
diff --git a/source/client/view/structure/authentication/credentials-form.tsx b/source/client/view/structure/authentication/credentials-form.tsx
index b0e1cff..7351a9e 100644
--- a/source/client/view/structure/authentication/credentials-form.tsx
+++ b/source/client/view/structure/authentication/credentials-form.tsx
@@ -1,8 +1,7 @@
import { type AuthenticationState } from "@server/core/authentication/authentication"
import { enterSurface, prepareSurfaceEntrance, restSurface } from "../../appearance/surface-presence"
import { useReducedMotion } from "@libs/react-motion"
-import { Surface, useAppearance, useResolveTheme, useScale } from "@phreshos/react-ui"
-import { obscuredBackground } from "../../components/loading"
+import { Surface } from "@phreshos/react-ui"
import Spinner from "../../components/spinner"
import Alert from "../../components/alert"
import { type SyntheticEvent, useLayoutEffect, useRef } from "react"
@@ -14,12 +13,6 @@ export default function CredentialsForm({ title, description, submitLabel, passw
const reducedMotion = useReducedMotion()
- const radius = useScale(useResolveTheme(useAppearance().radius))
-
- const outerRadius = radius.large
-
- const innerRadius = radius.medium
-
useLayoutEffect(function () {
prepareSurfaceEntrance(surface.current, reducedMotion)
@@ -46,15 +39,13 @@ export default function CredentialsForm({ title, description, submitLabel, passw
onSubmit(String(data.get("username") ?? ""), String(data.get("password") ?? ""))
}
- return <div className={`absolute inset-0 grid ${obscuredBackground}`}>
+ return <div className="absolute inset-0 grid backdrop-blur-md">
<form
ref={surface}
- style={{ borderRadius: outerRadius }}
-
- className="relative isolate m-auto grid w-[min(24rem,calc(100%-2rem))] grid-rows-[auto_minmax(0,1fr)] text-slate-800 shadow-window-active"
+ className="relative isolate m-auto grid w-[min(24rem,calc(100%-2rem))] grid-rows-[auto_minmax(0,1fr)] text-slate-800"
aria-busy={pending}
@@ -62,7 +53,7 @@ export default function CredentialsForm({ title, description, submitLabel, passw
>
- <Surface aria-hidden="true" className="pointer-events-none absolute inset-0 rounded-[inherit]" />
+ <Surface aria-hidden="true" className="pointer-events-none absolute inset-0" />
<div className="relative grid gap-1 px-5 py-4">
@@ -72,7 +63,7 @@ export default function CredentialsForm({ title, description, submitLabel, passw
</div>
- <Surface opacity="small" style={{ borderRadius: innerRadius }} className="relative m-1.5 mt-0 grid gap-5 p-5">
+ <Surface className="relative m-1.5 mt-0 grid gap-5 p-5">
<div className="grid gap-4">
diff --git a/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx b/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx
index abd63c9..da8dc5f 100644
--- a/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx
+++ b/source/client/view/structure/desktop/taskbar/launcher/launcher.tsx
@@ -1,7 +1,7 @@
import { ReactNode, useCallback, useEffect, useId, useRef, useState } from "react"
import { enterSurface, prepareSurfaceEntrance, restSurface } from "@client/view/appearance/surface-presence"
import { useReducedMotion } from "@libs/react-motion"
-import { useAppearance, useResolveTheme, useScale, type SurfaceProps } from "@phreshos/react-ui"
+import { type SurfaceProps } from "@phreshos/react-ui"
import TaskbarSurface, { taskbarSurfaceClassName } from "../taskbar-surface"
import TaskbarButton from "../taskbar-button"
@@ -9,7 +9,7 @@ import TaskbarButton from "../taskbar-button"
* A button and the dismissible surface it opens. Placement, contents and
* what selecting an item means belong to the caller.
*/
-export default function ({ label, trigger, children, className, style, ...props }: LauncherProps) {
+export default function ({ label, trigger, children, className, ...props }: LauncherProps) {
const id = useId()
@@ -17,10 +17,6 @@ export default function ({ label, trigger, children, className, style, ...props
const reducedMotion = useReducedMotion()
- const appearance = useAppearance()
-
- const radius = useScale(useResolveTheme(appearance.radius)).large
-
const [open, setOpen] = useState(false)
const close = useCallback(function () {
@@ -94,8 +90,6 @@ export default function ({ label, trigger, children, className, style, ...props
tabIndex={-1}
- style={{ ...style, borderRadius: radius }}
-
className={`${taskbarSurfaceClassName} hidden open:block ${className ?? ""}`}
onBeforeToggle={event => {
diff --git a/source/client/view/structure/desktop/taskbar/system/system-dialogs.tsx b/source/client/view/structure/desktop/taskbar/system/system-dialogs.tsx
index 0678c3e..0ad2be1 100644
--- a/source/client/view/structure/desktop/taskbar/system/system-dialogs.tsx
+++ b/source/client/view/structure/desktop/taskbar/system/system-dialogs.tsx
@@ -2,7 +2,6 @@ import { type PermissionChoice, type PermissionDialog, type ServerCrashDialog }
import { ReactTunnel } from "@the-link/react"
import { enterSurface, prepareSurfaceEntrance, restSurface } from "@client/view/appearance/surface-presence"
import { useReducedMotion } from "@libs/react-motion"
-import { useAppearance, useResolveTheme, useScale } from "@phreshos/react-ui"
import { useEffect, useId, useRef } from "react"
import { AuthManagerContext } from "@client/view/contexts"
import TaskbarSurface, { taskbarSurfaceClassName } from "../taskbar-surface"
@@ -33,8 +32,6 @@ export default function SystemDialogs() {
const reducedMotion = useReducedMotion()
- const radius = useScale(useResolveTheme(useAppearance().radius)).large
-
useEffect(function () {
const element = surface.current
@@ -70,8 +67,6 @@ export default function SystemDialogs() {
aria-describedby={description}
- style={{ borderRadius: radius }}
-
onCancel={event => event.preventDefault()}
className={`${taskbarSurfaceClassName} inset-auto inset-be-[calc(anchor(top)+var(--desktop-gutter))] inset-s-[anchor(center)] w-[min(28rem,calc(100vw-var(--desktop-gutter)*2))] -translate-x-1/2 backdrop:bg-transparent [position-anchor:--desktop-taskbar]`}
diff --git a/source/client/view/structure/desktop/taskbar/taskbar-surface.tsx b/source/client/view/structure/desktop/taskbar/taskbar-surface.tsx
index db8292f..8f0e3f8 100644
--- a/source/client/view/structure/desktop/taskbar/taskbar-surface.tsx
+++ b/source/client/view/structure/desktop/taskbar/taskbar-surface.tsx
@@ -1,18 +1,16 @@
import { forwardRef, ReactNode } from "react"
-import { Surface, useAppearance, useResolveTheme, useScale, type SurfaceProps } from "@phreshos/react-ui"
+import { Surface, type SurfaceProps } from "@phreshos/react-ui"
/** The window-material shell shared by surfaces opened from the taskbar. */
-export const taskbarSurfaceClassName = "m-0 isolate border-0 bg-transparent p-0 shadow-window-active outline-none"
+export const taskbarSurfaceClassName = "m-0 isolate border-0 bg-transparent p-0 outline-none"
export default forwardRef<HTMLDivElement, TaskbarSurfaceProps>(function TaskbarSurface({ label, labelId, contentClassName = "", className, children, ...props }, ref) {
- const contentRadius = useScale(useResolveTheme(useAppearance().radius)).medium
-
return <Surface {...props} ref={ref} className={`grid min-h-0 max-h-[inherit] grid-rows-[auto_minmax(0,1fr)] ${className ?? ""}`}>
<h2 id={labelId} className="relative grid h-10 items-center px-3.5 text-window-title font-medium select-none">{label}</h2>
- <Surface opacity="small" style={{ borderRadius: contentRadius }} className={`relative m-1.5 mt-0 min-h-0 overflow-hidden ${contentClassName}`}>
+ <Surface className={`relative m-1.5 mt-0 min-h-0 overflow-hidden ${contentClassName}`}>
{children}
diff --git a/source/client/view/structure/desktop/taskbar/taskbar.tsx b/source/client/view/structure/desktop/taskbar/taskbar.tsx
index cffddc7..f62f079 100644
--- a/source/client/view/structure/desktop/taskbar/taskbar.tsx
+++ b/source/client/view/structure/desktop/taskbar/taskbar.tsx
@@ -1,20 +1,16 @@
import { ReactNode } from "react"
-import { Surface, useAppearance, useResolveTheme, useScale, type SurfaceProps } from "@phreshos/react-ui"
+import { Surface, type SurfaceProps } from "@phreshos/react-ui"
import TaskbarSeparator from "./taskbar-separator"
/**
* The desktop's persistent control surface. Leading, primary and trailing
* regions are structural; what each region means belongs to the caller.
*/
-export default function Taskbar({ leading, trailing, dialogs, className, style, children, ...props }: TaskbarProps) {
-
- const radius = useScale(useResolveTheme(useAppearance().radius)).large
+export default function Taskbar({ leading, trailing, dialogs, className, children, ...props }: TaskbarProps) {
return <Surface
- className={`relative isolate grid h-taskbar min-w-0 grid-cols-[auto_auto_minmax(0,1fr)_auto_auto] items-center gap-1.5 p-1.5 shadow-taskbar [anchor-name:--desktop-taskbar] ${className ?? ""}`}
-
- style={{ ...style, borderRadius: radius }}
+ className={`relative isolate grid h-taskbar min-w-0 grid-cols-[auto_auto_minmax(0,1fr)_auto_auto] items-center gap-1.5 p-1.5 [anchor-name:--desktop-taskbar] ${className ?? ""}`}
{...props}
diff --git a/source/client/view/structure/desktop/windows/snap-preview.tsx b/source/client/view/structure/desktop/windows/snap-preview.tsx
index 92d0cdd..327cf7f 100644
--- a/source/client/view/structure/desktop/windows/snap-preview.tsx
+++ b/source/client/view/structure/desktop/windows/snap-preview.tsx
@@ -6,7 +6,7 @@ import { type Position, type Size } from "@phreshos/core"
import { Surface } from "@phreshos/react-ui"
/** GSAP-owned preview of the placement currently offered by a drag. */
-export default function SnapPreview({ shown, visible, bare, paintSurfaceSize, radius, reducedMotion, zIndex }: SnapPreviewProps) {
+export default function SnapPreview({ shown, visible, bare, paintSurfaceSize, reducedMotion, zIndex }: SnapPreviewProps) {
const element = useRef<HTMLDivElement>(null)
const firstRender = useRef(true)
@@ -78,9 +78,9 @@ export default function SnapPreview({ shown, visible, bare, paintSurfaceSize, ra
>
<Surface
data-snap-preview-frame
- opacity="xsmall"
+ opacity="small"
className={`absolute ${bare ? "inset-0" : ""}`}
- style={bare ? undefined : { ...windowPaintInsets(shown.position, shown.size, paintSurfaceSize, windowPaintInset), borderRadius: radius }}
+ style={bare ? undefined : windowPaintInsets(shown.position, shown.size, paintSurfaceSize, windowPaintInset)}
/>
</div>
}
@@ -95,7 +95,6 @@ interface SnapPreviewProps {
visible: boolean
bare: boolean
paintSurfaceSize: WindowSurfaceSize
- radius: number
reducedMotion: boolean
zIndex: CSSProperties["zIndex"]
}
diff --git a/source/client/view/structure/desktop/windows/window.tsx b/source/client/view/structure/desktop/windows/window.tsx
index cce3966..9d7a0c9 100644
--- a/source/client/view/structure/desktop/windows/window.tsx
+++ b/source/client/view/structure/desktop/windows/window.tsx
@@ -1,7 +1,7 @@
import { ComponentProps, PointerEvent as ReactPointerEvent, ReactNode, useLayoutEffect, useRef, useState } from "react"
import { useReducedMotion } from "@libs/react-motion"
import { enterSurface, prepareSurfaceEntrance, restSurface } from "@client/view/appearance/surface-presence"
-import { Surface, useAppearance, useResolveTheme, useScale } from "@phreshos/react-ui"
+import { Surface, useAppearance, useResolveTheme } from "@phreshos/react-ui"
import { absoluteWindowGeometry, resolveWindowGeometry, resolveWindowValue, wholeWindowGeometry, windowPaintInsets, type WindowRegion, type WindowSurfaceSize } from "@client/view/components/window-manager/window-geometry"
import { type Position, type Size, type WindowGeometry } from "@phreshos/core"
import WindowHeader from "./window-header"
@@ -62,20 +62,12 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
const appearance = useAppearance()
- const radius = useScale(useResolveTheme(appearance.radius))
-
const foreground = useResolveTheme(appearance.foreground)
- const outerRadius = radius.large
-
- const innerRadius = radius.medium
-
const [gesture, setGesture] = useState<Gesture | null>(null)
const [renderedGeometry, setRenderedGeometry] = useState<WindowGeometry>({ position, size })
- const [renderedActive, setRenderedActive] = useState(active)
-
const morphStart = useRef<WindowRegion | null>(null)
const morphRevision = useRef(0)
@@ -228,37 +220,6 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
}, [gesture?.morph, reducedMotion])
- useLayoutEffect(function () {
-
- const element = surfaceElement.current
-
- if (!element || renderedActive === active) return
-
- const property = active ? "--shadow-window-active" : "--shadow-window-inactive"
- const target = getComputedStyle(element).getPropertyValue(property).trim() || "none"
-
- gsap.killTweensOf(element, "boxShadow")
-
- if (reducedMotion) {
-
- gsap.set(element, { boxShadow: target })
- setRenderedActive(active)
-
- return
- }
-
- const animation = gsap.to(element, {
- boxShadow: target,
- duration: motionDuration(motionDurations.feedback),
- ease: motionEase("ease-out"),
- overwrite: "auto",
- onComplete: () => setRenderedActive(active)
- })
-
- return () => { animation.kill() }
-
- }, [active, reducedMotion, renderedActive])
-
const closureCompleted = useRef(false)
function completeClosure() {
@@ -285,7 +246,7 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
// restored windows look newly opened.
//
// Bare, there is no entrance. Motion is a visual effect like the
- // surface and the shadow, and `under` and `over` are the layers where
+ // surface, and `under` and `over` are the layers where
// the system paints nothing — so what would scale and drift here is
// the program's own content, which reads as the program stumbling
// rather than as a window opening. It showed on every refresh,
@@ -696,12 +657,6 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
transform: "none"
}
- const surface = renderedActive
-
- ? "shadow-window-active"
-
- : "shadow-window-inactive"
-
const paintedInsets = windowPaintInsets(position, size, paintSurfaceSize, windowPaintInset, gesture?.current)
return <>
@@ -712,7 +667,6 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
visible={gesture.zone !== null}
bare={bare}
paintSurfaceSize={paintSurfaceSize}
- radius={outerRadius}
reducedMotion={reducedMotion}
zIndex={style?.zIndex}
/>}
@@ -753,7 +707,7 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
Bare, there is no difference: the frame fills the box, so
the window is exactly as large as it asked to be and its
boundaries are the ones its own content draws. */}
- <div data-window-container ref={surfaceElement} style={bare ? undefined : { ...paintedInsets, borderRadius: outerRadius, color: foreground }} className={`absolute isolate grid ${bare ? "inset-0 grid-rows-1" : `grid-rows-[auto_minmax(0,1fr)] ${surface}`}`}>
+ <div data-window-container ref={surfaceElement} style={bare ? undefined : { ...paintedInsets, color: foreground }} className={`absolute isolate grid ${bare ? "inset-0 grid-rows-1" : "grid-rows-[auto_minmax(0,1fr)]"}`}>
{/* Material is paint, not the interaction container. Keeping
it as a sibling behind the window contents prevents plain
@@ -765,7 +719,7 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
aria-hidden="true"
- className="pointer-events-none absolute inset-0 -z-1 rounded-[inherit]"
+ className="pointer-events-none absolute inset-0 -z-1"
/>}
@@ -808,7 +762,7 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
</div>
- : <Surface data-window-content opacity="small" style={{ borderRadius: innerRadius }} className="relative m-1.5 mt-0 min-h-0 overflow-hidden p-px">
+ : <Surface data-window-content className="relative m-1.5 mt-0 min-h-0 overflow-hidden p-px">
{children}