An open-source, self-hosted system for apps built with web technologies.
Every Desktop motion is derived from the tempo through React UI; the theme changes as a slow crossfade; the view follows a visible Window that is maximized into another view, or when the view rests between two; the Desktop selects no text; the Taskbar sections stand a little closer; Start menu cards are primary:subtle
zohayrslilehb61e3fa684f2
diff --git a/source/client/view/appearance/appearance.css b/source/client/view/appearance/appearance.cssindex 5c26b71..099e79d 100644--- a/source/client/view/appearance/appearance.css+++ b/source/client/view/appearance/appearance.css@@ -3,6 +3,22 @@@import "@fontsource/roboto";+/* Nothing on the Desktop is selected as text by a drag across it, the Program frames least of all,+ since a selected frame is tinted whole. What is written into stays selectable. */+[data-desktop] {++ user-select: none;+ -webkit-user-select: none;++}++[data-desktop] :is(input, textarea, [contenteditable="true"], [contenteditable=""]) {++ user-select: text;+ -webkit-user-select: text;++}+/* Pseudo-elements carry Surface paint, so they settle instantly too. */html[data-phreshos-theme-capture] *,html[data-phreshos-theme-capture] *::before,@@ -14,46 +30,24 @@ html[data-phreshos-theme-capture] *::after {}+/* A theme turns the whole screen at once, so it changes as a slow crossfade: the old view stays as+ it was and the new one comes up over it, with nothing moving and no dip in light between them. */html[data-phreshos-theme-transition]::view-transition-old(root),html[data-phreshos-theme-transition]::view-transition-new(root) {- animation-duration: var(--phreshos-theme-transition-duration);-- animation-fill-mode: both;-- animation-timing-function: var(--phreshos-theme-transition-easing);+ mix-blend-mode: normal;}html[data-phreshos-theme-transition]::view-transition-old(root) {- animation-name: phreshos-theme-leave;+ animation: none;}html[data-phreshos-theme-transition]::view-transition-new(root) {- animation-name: phreshos-theme-enter;--}--@keyframes phreshos-theme-leave {-- from {-- opacity: 1;-- scale: 1;-- }-- to {-- opacity: 0;-- scale: 1.05;-- }+ animation: phreshos-theme-enter var(--phreshos-theme-transition-duration) var(--phreshos-theme-transition-easing) both;}@@ -63,16 +57,12 @@ html[data-phreshos-theme-transition]::view-transition-new(root) {opacity: 0;- scale: 1.05;-}to {opacity: 1;- scale: 1;-}}diff --git a/source/client/view/appearance/appearance.tsx b/source/client/view/appearance/appearance.tsxindex 171e78d..1fa25fa 100644--- a/source/client/view/appearance/appearance.tsx+++ b/source/client/view/appearance/appearance.tsx@@ -1,8 +1,8 @@import DesktopPreferencesProvider, { useDesktopPreferences, useDesktopThemeTransaction } from "./desktop-preferences"-import { applyAppearanceUpdate, defaultAppearance, type Appearance } from "@phreshos/core"-import { UIProvider } from "@phreshos/react-ui"+import { applyAppearanceUpdate, defaultAppearance, type Appearance, type Transaction } from "@phreshos/core"+import { timing, UIProvider } from "@phreshos/react-ui"import ReducedMotion from "@libs/react-motion"-import { createContext, type PropsWithChildren, useCallback, useContext, useLayoutEffect, useState } from "react"+import { createContext, type PropsWithChildren, useCallback, useContext, useLayoutEffect, useMemo, useState } from "react"import { DesktopScaleProvider } from "../structure/desktop/desktop-scale"import "./appearance.css"@@ -28,7 +28,11 @@ function AppearanceRoot({ children }: PropsWithChildren) {}, [])const background = appearance.colors[preferences.theme].background- useDesktopThemeTransaction(appearance.transaction)+ // A theme turns the whole screen: it fades five times as long as a change in place, softly at+ // both ends, so the eye follows it instead of being struck by it.+ const change = timing("change", { tempo: appearance.tempo })+ const themeChange = useMemo<Transaction>(() => ({ duration: change.duration * 5, easing: "ease-in-out" }), [change])+ useDesktopThemeTransaction(themeChange)return <RememberAppearanceContext.Provider value={remember}>diff --git a/source/client/view/appearance/desktop-preferences.tsx b/source/client/view/appearance/desktop-preferences.tsxindex a0742d4..5bc4a7c 100644--- a/source/client/view/appearance/desktop-preferences.tsx+++ b/source/client/view/appearance/desktop-preferences.tsx@@ -2,12 +2,12 @@ import useStorage from "@libs/storage-hook"import {desktopPreferencesLimits,defaultDesktopScale,- defaultAppearance,- type AppearanceTransaction,+ type Transaction,type DesktopPreferences,type DesktopPreferencesUpdate,type Theme} from "@phreshos/core"+import { timing } from "@phreshos/react-ui"import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react"import { transitionTheme } from "./theme-transition"@@ -34,7 +34,7 @@ export default function DesktopPreferencesProvider({ children }: Readonly<{ chilconst current = useRef(preferences)const pending = useRef<PendingCommit | null>(null)const revision = useRef(0)- const transaction = useRef<AppearanceTransaction>(defaultAppearance.transaction)+ const transaction = useRef<Transaction>(timing("change"))const update = useCallback(function (change: DesktopPreferencesUpdate) {if (change.theme !== undefined) {@@ -50,7 +50,7 @@ export default function DesktopPreferencesProvider({ children }: Readonly<{ chilif (change.scale !== undefined) storedScale.update(String(change.scale))}, [storedAnimations.remove, storedAnimations.update, storedScale.update, storedTheme.remove, storedTheme.update])- const setTransaction = useCallback(function (value: AppearanceTransaction) {+ const setTransaction = useCallback(function (value: Transaction) {transaction.current = value}, [])@@ -112,8 +112,8 @@ export function useDesktopPreferences() {return owner}-/** Supplies the active Appearance timing to the Desktop-owned theme transition. */-export function useDesktopThemeTransaction(transaction: AppearanceTransaction) {+/** Supplies the motion of a change in place to the Desktop-owned theme transition. */+export function useDesktopThemeTransaction(transaction: Transaction) {const owner = useDesktopPreferences()useLayoutEffect(() => {@@ -153,7 +153,7 @@ function useMediaPreference(query: string) {interface DesktopPreferencesOwner {readonly preferences: DesktopPreferencesreadonly update: (change: DesktopPreferencesUpdate) => void- readonly setTransaction: (transaction: AppearanceTransaction) => void+ readonly setTransaction: (transaction: Transaction) => void}interface PendingCommit {diff --git a/source/client/view/appearance/motion.ts b/source/client/view/appearance/motion.tsindex 9f3a95e..b27093c 100644--- a/source/client/view/appearance/motion.ts+++ b/source/client/view/appearance/motion.ts@@ -1,4 +1,4 @@-import { progressAt, type AppearanceTransaction, type Easing, type PresentationTransaction } from "@phreshos/core"+import { progressAt, type Transaction, type Easing, type PresentationTransaction } from "@phreshos/core"import { type Transition } from "motion/react"const easings: Record<Extract<Easing, string>, Transition["ease"]> = {@@ -9,8 +9,8 @@ const easings: Record<Extract<Easing, string>, Transition["ease"]> = {"ease-in-out": "easeInOut"}-/** Translates the public Appearance timing contract into Motion's units. */-export function motionTransition(transaction: AppearanceTransaction, reduced = false): Transition {+/** Translates one transaction into Motion's units. */+export function motionTransition(transaction: Transaction, reduced = false): Transition {return {type: "tween",@@ -22,32 +22,20 @@ export function motionTransition(transaction: AppearanceTransaction, reduced = f}}-/** Resolves an optional presentation timing against the current Appearance. */-export function resolveWindowTransaction(transaction: PresentationTransaction | undefined, appearance: AppearanceTransaction): AppearanceTransaction {+/**+ * The motion a presentation write moves on: the one derived for the change, that one made a+ * number of times as long, or the exact one the Program chose. Stretching a derived motion keeps its+ * shape: even a spring's stiffness follows its duration.+ */+export function resolvePresentationTransaction(transaction: PresentationTransaction | null | undefined, derived: Transaction): Transaction {- if (transaction === undefined) return appearance+ if (transaction === undefined || transaction === null) return derived- if (typeof transaction === "number") return { duration: transaction, easing: appearance.easing }+ if (typeof transaction === "number") return Object.freeze({ duration: Math.round(derived.duration * transaction), easing: derived.easing })return transaction}-/** Translates the public easing vocabulary into a CSS timing function. */-export function cssEasing(easing: Easing) {-- if (typeof easing === "string") return easing-- if (!isCurve(easing)) {-- // A spring in CSS: its path sampled as a linear() curve over a nominal duration.- const samples = Array.from({ length: 41 }, (_, index) => progressAt({ duration: 1000, easing }, index * 25).toFixed(4))-- return "linear(" + samples.join(", ") + ")"- }-- return "cubic-bezier(" + (easing as readonly number[]).join(", ") + ")"-}-type Curve = Extract<Easing, string> | readonly [number, number, number, number]/** Whether an easing is a curve, not a spring. */diff --git a/source/client/view/appearance/surface-presence.ts b/source/client/view/appearance/surface-presence.tsindex 0423bfa..a0f9dca 100644--- a/source/client/view/appearance/surface-presence.ts+++ b/source/client/view/appearance/surface-presence.ts@@ -1,4 +1,4 @@-import { type AppearanceTransaction } from "@phreshos/core"+import { type Transaction } from "@phreshos/core"import { type DOMKeyframesDefinition, type Transition } from "motion/react"import { motionTransition } from "./motion"@@ -14,7 +14,7 @@ export const surfaceLifecyclePose = Object.freeze({}) satisfies Record<string, DOMKeyframesDefinition>/** One shared presence transition owned by Appearance. */-export function surfacePresenceTransition(reducedMotion: boolean, transaction: AppearanceTransaction): Transition {+export function surfacePresenceTransition(reducedMotion: boolean, transaction: Transaction): Transition {return motionTransition(transaction, reducedMotion)}diff --git a/source/client/view/appearance/theme-transition.ts b/source/client/view/appearance/theme-transition.tsindex 89072fa..44f7580 100644--- a/source/client/view/appearance/theme-transition.ts+++ b/source/client/view/appearance/theme-transition.ts@@ -1,5 +1,5 @@-import type { AppearanceTransaction } from "@phreshos/core"-import { cssEasing } from "./motion"+import type { Transaction } from "@phreshos/core"+import { cssEasing } from "@phreshos/core"const durationProperty = "--phreshos-theme-transition-duration"const easingProperty = "--phreshos-theme-transition-easing"@@ -25,7 +25,7 @@ const revisions = new WeakMap<Document, number>()/** Applies one theme state change through the document's old and new rendered views. */export function transitionTheme(document: Document,- transaction: AppearanceTransaction,+ transaction: Transaction,animated: boolean,update: () => Promise<void>) {diff --git a/source/client/view/structure/authentication/credentials-form.tsx b/source/client/view/structure/authentication/credentials-form.tsxindex bf07dd8..c27ac80 100644--- a/source/client/view/structure/authentication/credentials-form.tsx+++ b/source/client/view/structure/authentication/credentials-form.tsx@@ -2,7 +2,7 @@ import { type AuthenticationState } from "@server/core/authentication/authenticaimport { surfaceLifecyclePose, surfacePresenceTransition } from "../../appearance/surface-presence"import { useReducedMotion } from "@libs/react-motion"import { motion } from "motion/react"-import { Button, Heading, Input, resolveSpacing, Surface, Text, useAppearance } from "@phreshos/react-ui"+import { Button, Heading, Input, resolveSpacing, Surface, Text, useAppearance, useTiming } from "@phreshos/react-ui"import Alert from "../../components/alert"import { useId, useState, type SyntheticEvent } from "react"import logo from "@/assets/logo.png"@@ -12,7 +12,8 @@ import { name, version } from "@/source/identity"export default function CredentialsForm({ title, description, submitLabel, passwordAutocomplete, requirements, error, pending, onEdit, onSubmit }: CredentialsFormProps) {const reducedMotion = useReducedMotion()- const { transaction, spacing } = useAppearance()+ const { spacing } = useAppearance()+ const transaction = useTiming()("change")const [password, setPassword] = useState("")const titleId = useId()const passwordReady = requirements === undefined || [...password].length >= requirements.password.minimumLengthdiff --git a/source/client/view/structure/desktop/desktop.tsx b/source/client/view/structure/desktop/desktop.tsxindex b1a6167..5f5a63a 100644--- a/source/client/view/structure/desktop/desktop.tsx+++ b/source/client/view/structure/desktop/desktop.tsx@@ -421,6 +421,35 @@ export default function Workspace() {const launchPlacement = useMemo<LaunchPlacement>(() => ({ place, reveal }), [place, reveal])+ // A Window the person can see, maximized, fills the whole view it is in: unless the view rests on+ // exactly that view, the view goes with it there, so the Window fills the screen. One out of sight,+ // maximized, leaves the view where the person is.+ const wasMaximized = useRef(new Map<string, boolean>())++ useLayoutEffect(function () {++ const before = wasMaximized.current+ const now = new Map<string, boolean>()++ for (const window of mappedWindows) {++ now.set(window.identity, window.maximized)++ if (!window.maximized || before.get(window.identity) !== false || window.minimized) continue++ const { region } = window+ const seen = region.x < offset.x + windowSurfaceSize.width / 2 && region.x + region.width > offset.x - windowSurfaceSize.width / 2+ && region.y < offset.y + windowSurfaceSize.height / 2 && region.y + region.height > offset.y - windowSurfaceSize.height / 2+ const view = { x: Math.round((region.x + region.width / 2) / windowSurfaceSize.width), y: Math.round((region.y + region.height / 2) / windowSurfaceSize.height) }++ // Against where the view exactly is, not the view nearest to it: a view resting between two+ // would show the maximized Window cut at the edges of its own view.+ if (seen && (view.x !== views.x || view.y !== views.y)) viewport.moveTo(view)+ }++ wasMaximized.current = now+ })+// Going to a Window brings the view to the view it is in, whether it was minimized or only out of// view, and brings it to the front.const show = useCallback(function (record: Process) {@@ -524,7 +553,9 @@ export default function Workspace() {<DefaultShell spacing={appearance.spacing} taskbar={appearance.taskbar} viewport={viewport} mappedWindows={mappedWindows}>{taskbarItems}</DefaultShell></LaunchPlacementContext.Provider>- return <div ref={desktop} tabIndex={-1} aria-label="Desktop" onFocusCapture={focus.remember} className="relative isolate h-full min-h-0 w-full overflow-hidden outline-none" style={{ color: foreground }}>+ // The Desktop is a place to arrange things, not text to select: a drag across it would otherwise+ // select the Program frames it passes as if they were words, and tint them blue.+ return <div ref={desktop} tabIndex={-1} aria-label="Desktop" data-desktop="" onFocusCapture={focus.remember} className="relative isolate h-full min-h-0 w-full overflow-hidden outline-none" style={{ color: foreground }}><ProgramAccessProbe door={application.doors.program} setAccess={setProgramAccess} />diff --git a/source/client/view/structure/desktop/edge-hold.ts b/source/client/view/structure/desktop/edge-hold.tsindex 7702866..224001c 100644--- a/source/client/view/structure/desktop/edge-hold.ts+++ b/source/client/view/structure/desktop/edge-hold.ts@@ -1,7 +1,7 @@import { useCallback } from "react"import { useReducedMotion } from "@libs/react-motion"import { planeReach } from "@client/view/components/window-manager/window-geometry"-import motionAcross from "./motion-across"+import { timing, useAppearance } from "@phreshos/react-ui"import { type ViewportControl } from "./viewport-offset"export type Direction = Readonly<{ x: number, y: number }>@@ -15,6 +15,8 @@ export function useViewTravel(viewport: ViewportControl) {const reducedMotion = useReducedMotion()+ const tempo = useAppearance().tempo+const { view, moveTo, surface } = viewportreturn useCallback(function (direction: Direction) {@@ -25,9 +27,9 @@ export function useViewTravel(viewport: ViewportControl) {moveTo(next)- return reducedMotion ? 0 : motionAcross(Math.hypot(direction.x * surface.width, direction.y * surface.height)).duration+ return reducedMotion ? 0 : timing("view", { distance: Math.hypot(direction.x * surface.width, direction.y * surface.height), tempo }).duration- }, [view.x, view.y, moveTo, reducedMotion, surface.width, surface.height])+ }, [view.x, view.y, moveTo, reducedMotion, tempo, surface.width, surface.height])}/** Which edges of a box a point is held against, within 16 pixels: -1, 0 or 1 in each direction. */diff --git a/source/client/view/structure/desktop/layers/shell/dialogs/open-requests.tsx b/source/client/view/structure/desktop/layers/shell/dialogs/open-requests.tsxindex 906e601..d7bb04b 100644--- a/source/client/view/structure/desktop/layers/shell/dialogs/open-requests.tsx+++ b/source/client/view/structure/desktop/layers/shell/dialogs/open-requests.tsx@@ -10,7 +10,7 @@ import usePromise from "@libs/react-promise"import Alert from "@client/view/components/alert"import usePrograms from "@client/view/structure/desktop/programs/programs"import programIcon from "@client/view/structure/desktop/programs/program-icon"-import { Button, Checkbox, Text, useAppearance, useScale } from "@phreshos/react-ui"+import { Button, Checkbox, Text, useAppearance, useScale, useTiming } from "@phreshos/react-ui"/** The default Shell's choice of a Program for something that has no default one. */export default function OpenRequests() {@@ -22,7 +22,7 @@ export default function OpenRequests() {const surface = useRef<HTMLDialogElement>(null)const title = useId()const reducedMotion = useReducedMotion()- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")useEffect(() => {diff --git a/source/client/view/structure/desktop/layers/shell/dialogs/permission-requests.tsx b/source/client/view/structure/desktop/layers/shell/dialogs/permission-requests.tsxindex c6312f9..449cc91 100644--- a/source/client/view/structure/desktop/layers/shell/dialogs/permission-requests.tsx+++ b/source/client/view/structure/desktop/layers/shell/dialogs/permission-requests.tsx@@ -8,7 +8,7 @@ import { AuthManagerContext } from "@client/view/contexts"import ShellSurface, { shellSurfaceClassName } from "../shell-surface"import usePromise from "@libs/react-promise"import Alert from "@client/view/components/alert"-import { Button, useAppearance } from "@phreshos/react-ui"+import { Button, useTiming } from "@phreshos/react-ui"/** Default Shell representation of raw pending permission requests. */export default function PermissionRequests() {@@ -21,7 +21,7 @@ export default function PermissionRequests() {const title = useId()const description = useId()const reducedMotion = useReducedMotion()- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")useEffect(() => {diff --git a/source/client/view/structure/desktop/layers/shell/dialogs/system-errors.tsx b/source/client/view/structure/desktop/layers/shell/dialogs/system-errors.tsxindex 3238116..bfad011 100644--- a/source/client/view/structure/desktop/layers/shell/dialogs/system-errors.tsx+++ b/source/client/view/structure/desktop/layers/shell/dialogs/system-errors.tsx@@ -6,7 +6,7 @@ import { motion } from "motion/react"import { useCallback, useEffect, useId, useRef, useState } from "react"import { AuthManagerContext } from "@client/view/contexts"import ShellSurface, { shellSurfaceClassName } from "../shell-surface"-import { Button, useAppearance } from "@phreshos/react-ui"+import { Button, useTiming } from "@phreshos/react-ui"/** Shell-owned real-time presentation of new System errors. */export default function SystemErrors() {@@ -32,7 +32,7 @@ export default function SystemErrors() {const reducedMotion = useReducedMotion()- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")const visible = record !== nulldiff --git a/source/client/view/structure/desktop/layers/shell/start-menu/programs/programs.tsx b/source/client/view/structure/desktop/layers/shell/start-menu/programs/programs.tsxindex f99f372..17c05dd 100644--- a/source/client/view/structure/desktop/layers/shell/start-menu/programs/programs.tsx+++ b/source/client/view/structure/desktop/layers/shell/start-menu/programs/programs.tsx@@ -30,7 +30,7 @@ export default function Programs({ programs, layout, running, empty, onLaunch }:const icon = (program: Program) => programIcon(application.doors.program, program.assetId)- if (layout === "grid") return <GridList aria-label="Programs" selectionMode="none" itemWidth={space.xlarge * 3.5} style={{ alignContent: "start", outline: "none" }} onAction={key => launch(String(key))}>+ if (layout === "grid") return <GridList aria-label="Programs" selectionMode="none" restColor="primary:subtle" itemWidth={space.xlarge * 3.5} style={{ alignContent: "start", outline: "none" }} onAction={key => launch(String(key))}>{programs.map(program => <GridList.Item key={program.identity} id={program.identity} textValue={program.name}>diff --git a/source/client/view/structure/desktop/layers/shell/start-menu/start-menu.tsx b/source/client/view/structure/desktop/layers/shell/start-menu/start-menu.tsxindex da861f1..05b9505 100644--- a/source/client/view/structure/desktop/layers/shell/start-menu/start-menu.tsx+++ b/source/client/view/structure/desktop/layers/shell/start-menu/start-menu.tsx@@ -7,8 +7,8 @@ import { useReducedMotion } from "@libs/react-motion"import { motion } from "motion/react"import { shellSurfaceClassName } from "../shell-surface"import TaskbarButton from "../taskbar/taskbar-button"-import { useAppearance } from "@phreshos/react-ui"-import { cssEasing } from "@client/view/appearance/motion"+import { useTiming } from "@phreshos/react-ui"+import { cssEasing } from "@phreshos/core"import { surfaceLifecyclePose, surfacePresenceTransition } from "@client/view/appearance/surface-presence"import { usePortrait } from "../../../orientation"@@ -108,7 +108,7 @@ export default memo(function StartMenu() {const reducedMotion = useReducedMotion()- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")const portrait = usePortrait()diff --git a/source/client/view/structure/desktop/layers/shell/taskbar/taskbar.tsx b/source/client/view/structure/desktop/layers/shell/taskbar/taskbar.tsxindex 7a8d25d..fc700b6 100644--- a/source/client/view/structure/desktop/layers/shell/taskbar/taskbar.tsx+++ b/source/client/view/structure/desktop/layers/shell/taskbar/taskbar.tsx@@ -1,8 +1,8 @@import { useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from "react"-import { Surface, Toolbar, useAppearance, type SurfaceProps } from "@phreshos/react-ui"+import { Surface, Toolbar, type SurfaceProps, useTiming } from "@phreshos/react-ui"import { type AppearanceTaskbar, type TaskbarPosition } from "@phreshos/core"import { useReducedMotion } from "@libs/react-motion"-import { cssEasing } from "@client/view/appearance/motion"+import { cssEasing } from "@phreshos/core"/*** The Desktop's Taskbar is a Shell entity; React UI's Toolbar supplies the@@ -13,7 +13,7 @@ export default function Taskbar({ leading, navigation, trailing, taskbar, spacinconst horizontal = taskbar.position === "top" || taskbar.position === "bottom"const orientation = horizontal ? "horizontal" : "vertical"// Every section stands the same distance from the separators beside it, and across a vertical Taskbar its buttons share one width.- const room = spacing / 4+ const room = spacing / 8const section = (before: boolean, after: boolean): CSSProperties => ({flexShrink: 0,minWidth: 0,@@ -22,7 +22,7 @@ export default function Taskbar({ leading, navigation, trailing, taskbar, spacin[horizontal ? "paddingInlineStart" : "paddingBlockStart"]: before ? room : 0,[horizontal ? "paddingInlineEnd" : "paddingBlockEnd"]: after ? room : 0})- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")const reducedMotion = useReducedMotion()const [revealed, setRevealed] = useState(false)const configuration = { position: taskbar.position, overlay: taskbar.overlay }@@ -99,7 +99,7 @@ export default function Taskbar({ leading, navigation, trailing, taskbar, spacin</>}{/* Clipped only along the Taskbar, and a little past its ends, so the items' shadows and focus show whole. */}- <Toolbar.Group style={{ ...section(true, true), flex: "1 1 0", alignSelf: "stretch", minHeight: 0, overflowClipMargin: room, ...(horizontal ? { overflowX: "clip" } : { overflowY: "clip" }) }}>+ <Toolbar.Group style={{ ...section(true, true), flex: "1 1 0", alignSelf: "stretch", minHeight: 0, overflowClipMargin: spacing / 4, ...(horizontal ? { overflowX: "clip" } : { overflowY: "clip" }) }}>{children}diff --git a/source/client/view/structure/desktop/layers/shell/taskbar/viewport/viewport-control.tsx b/source/client/view/structure/desktop/layers/shell/taskbar/viewport/viewport-control.tsxindex e909e26..ddf71c9 100644--- a/source/client/view/structure/desktop/layers/shell/taskbar/viewport/viewport-control.tsx+++ b/source/client/view/structure/desktop/layers/shell/taskbar/viewport/viewport-control.tsx@@ -1,4 +1,5 @@-import { Button, ContextMenu, Panel, Surface, Text, Tooltip, useAppearance, useColor, useScale } from "@phreshos/react-ui"+import { cssEasing } from "@phreshos/core"+import { Button, ContextMenu, Panel, Surface, Text, Tooltip, useAppearance, useColor, useScale, useTiming } from "@phreshos/react-ui"import { Map as MapIcon, Maximize2 } from "@phreshos/react-ui/icons"import WindowMenu from "../../window-menu"import TaskbarTooltip from "../taskbar-tooltip"@@ -7,8 +8,7 @@ import { planeReach, type WindowRegion } from "@client/view/components/window-maimport { type AppearanceTaskbar } from "@phreshos/core"import { useReducedMotion } from "@libs/react-motion"import { motion } from "motion/react"-import { cssEasing, motionTransition } from "@client/view/appearance/motion"-import motionAcross from "../../../../motion-across"+import { motionTransition } from "@client/view/appearance/motion"import { EdgeHold, against, useViewTravel } from "../../../../edge-hold"import { createPortal } from "react-dom"import SnapPreview, { type SnapTarget } from "../../../../windows/snap-preview"@@ -96,7 +96,7 @@ export default function ViewportControl({ viewport, windows, taskbar, spacing, oconst reducedMotion = useReducedMotion()- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")const vertical = taskbar.position === "left" || taskbar.position === "right"@@ -456,7 +456,7 @@ function ViewMap({ labelId, viewport, windows, centered, menus, room }: Readonlyconst reducedMotion = useReducedMotion()- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")// The map is small and the view is large, so every pixel the hand moves is many on the// screen. The frame therefore does not jump to the pointer: it follows it, smoothed each@@ -653,7 +653,8 @@ function MapWindow({ window, viewport, menus, mapX, mapY, cell }: Readonly<{const last = useRef(center)const distance = Math.hypot(center.x - last.current.x, center.y - last.current.y)useEffect(() => { last.current = center }, [center.x, center.y])- const cardMotion = dragged || reducedMotion ? { duration: 0 } : motionTransition(motionAcross(distance, "window"))+ const motionOf = useTiming()+ const cardMotion = dragged || reducedMotion ? { duration: 0 } : motionTransition(motionOf("window", { distance }))const icon = space.medium + space.xsmalldiff --git a/source/client/view/structure/desktop/layers/wallpaper/wallpaper.tsx b/source/client/view/structure/desktop/layers/wallpaper/wallpaper.tsxindex 72fab45..0a59ff8 100644--- a/source/client/view/structure/desktop/layers/wallpaper/wallpaper.tsx+++ b/source/client/view/structure/desktop/layers/wallpaper/wallpaper.tsx@@ -7,9 +7,9 @@ import { useEffect, useEffectEvent, useRef, useState, type ReactNode, type Transimport Loading from "@client/view/components/loading"import { useReady } from "@libs/readiness"import { wallpaperRequirement } from "../../../readiness-requirements"-import { useAppearance, usePreferences } from "@phreshos/react-ui"+import { usePreferences, useTiming } from "@phreshos/react-ui"import { useReducedMotion } from "@libs/react-motion"-import { cssEasing } from "@client/view/appearance/motion"+import { cssEasing } from "@phreshos/core"import { wallpaperKind, type WallpaperKind } from "@shared/wallpaper"/** Where a wallpaper is shown. */@@ -141,7 +141,7 @@ function WallpaperLayer({ source, visible, onLoad, onError, onTransitionEnd }: RonError?: () => voidonTransitionEnd?: (event: TransitionEvent<HTMLDivElement>) => void}>) {- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")const reducedMotion = useReducedMotion()const interactive = source.kind === "html" && visiblediff --git a/source/client/view/structure/desktop/motion-across.ts b/source/client/view/structure/desktop/motion-across.tsdeleted file mode 100644index e84ba04..0000000--- a/source/client/view/structure/desktop/motion-across.ts+++ /dev/null@@ -1,50 +0,0 @@-import { type AppearanceTransaction, type Easing } from "@phreshos/core"--/**- * The motion of anything the Desktop carries across a distance: the view over the plane, and a- * standard Window moving, resizing, filling the view, or leaving for the Taskbar. It is chosen for- * each move from how far it goes, not taken from the Appearance timing: a fixed short time would- * cross a far distance so fast that frames show as jumps. So the time grows with the distance,- * gently, as the square root, within bounds, on a curve that starts and ends softly.- */-export default function motionAcross(distance: number, body: MovingBody = "view", departing = false): AppearanceTransaction {-- const pace = paces[body]-- // Near, the time grows as the square root; a long crossing adds a little more for each pixel- // past a first stretch, so a far journey is not crossed at a rush.- const duration = Math.round(Math.min(pace.maximum, Math.max(pace.minimum, pace.base + pace.growth * Math.sqrt(distance) + pace.far * Math.max(0, distance - 1000))))-- // What arrives slows as it lands; what departs, seen only as it sets off, must start softly, or- // it is gone in the first frames.- return Object.freeze({ duration, easing: departing ? departure : pace.easing })-}--/**- * What is moving. The view is a camera crossing a whole scene: it sets off softly and travels- * slowly. A Window is a light body answering a hand: it sets off at once and settles softly, and- * the same distance takes it less time.- */-export type MovingBody = "view" | "window"--/** The curve of something leaving the view: soft to start, gathering speed as it goes. */-const departure = [0.65, 0, 0.35, 1] as const--type Pace = Readonly<{ base: number, growth: number, far: number, minimum: number, maximum: number, easing: Easing }>--const paces: Record<MovingBody, Pace> = {- // The view moves as a body on a spring: it arrives without passing its place, and a new move- // taken on the way carries on from how fast it is already going.- view: { base: 220, growth: 10, far: 0, minimum: 300, maximum: 1000, easing: Object.freeze({ spring: Object.freeze({ bounce: 0 }) }) },- window: { base: 85, growth: 4, far: 0.05, minimum: 130, maximum: 650, easing: [0.22, 1, 0.36, 1] }-}--/** How far a box travels between two places: its center's path, and half of how much its size changes. */-export function travel(from: Box, to: Box) {-- const moved = Math.hypot(to.x + to.width / 2 - from.x - from.width / 2, to.y + to.height / 2 - from.y - from.height / 2)-- return moved + Math.hypot(to.width - from.width, to.height - from.height) / 2-}--type Box = Readonly<{ x: number, y: number, width: number, height: number }>diff --git a/source/client/view/structure/desktop/plane-slide.tsx b/source/client/view/structure/desktop/plane-slide.tsxindex 80a5fd4..433b4a2 100644--- a/source/client/view/structure/desktop/plane-slide.tsx+++ b/source/client/view/structure/desktop/plane-slide.tsx@@ -1,6 +1,6 @@import { createContext, useLayoutEffect, useRef, type ReactNode } from "react"import { animate, motion, useMotionValue, type MotionValue } from "motion/react"-import { type AppearanceTransaction } from "@phreshos/core"+import { type Transaction } from "@phreshos/core"import { useReducedMotion } from "@libs/react-motion"import { motionTransition } from "@client/view/appearance/motion"import { type ViewportOffset, type WindowSurfaceSize } from "@client/view/components/window-manager/window-geometry"@@ -54,7 +54,7 @@ export const PlaneSlideContext = createContext<PlaneSlideValue | null>(null)* transform moves the whole plane. A resize changes the pixels of the view, not where it looks,* so it does not glide, and neither does a view placed under a hand that drags it.*/-export function usePlaneSlide(views: ViewportOffset, transaction: AppearanceTransaction | null, surface: WindowSurfaceSize): PlaneSlideValue {+export function usePlaneSlide(views: ViewportOffset, transaction: Transaction | null, surface: WindowSurfaceSize): PlaneSlideValue {const x = useMotionValue(0)diff --git a/source/client/view/structure/desktop/viewport-offset.ts b/source/client/view/structure/desktop/viewport-offset.tsindex 45840aa..7ddaf53 100644--- a/source/client/view/structure/desktop/viewport-offset.ts+++ b/source/client/view/structure/desktop/viewport-offset.ts@@ -1,6 +1,6 @@import { useCallback, useMemo, useRef, useState } from "react"-import { progressAt, type AppearanceTransaction } from "@phreshos/core"-import motionAcross from "./motion-across"+import { progressAt, type Transaction } from "@phreshos/core"+import { timing, useAppearance } from "@phreshos/react-ui"import { planeReach, type ViewportOffset, type WindowSurfaceSize } from "@client/view/components/window-manager/window-geometry"/**@@ -24,6 +24,10 @@ export default function useViewportOffset(surface: WindowSurfaceSize) {size.current = surface+ const tempo = useRef(1)++ tempo.current = useAppearance().tempo+const setViews = useCallback((next: ViewportOffset, glides = true) => setState(current => {if (!glides) return { views: next, transaction: null, journey: null }@@ -60,12 +64,12 @@ export default function useViewportOffset(surface: WindowSurfaceSize) {if (distance === 0) return { views: next, transaction: null, journey: null }- const motion = motionAcross(distance)+ const motion = timing("view", { distance, tempo: tempo.current })// The speed it already has, in lengths of the new journey a second.const velocity = (speed.x * path.x + speed.y * path.y) / (distance * distance)- const transaction: AppearanceTransaction = typeof motion.easing === "object" && "spring" in motion.easing+ const transaction: Transaction = typeof motion.easing === "object" && "spring" in motion.easing? Object.freeze({ duration: motion.duration, easing: Object.freeze({ spring: Object.freeze({ ...motion.easing.spring, velocity }) }) }): motion@@ -100,9 +104,9 @@ export type ViewportControl = ReturnType<typeof useViewportOffset>type ViewportState = Readonly<{views: ViewportOffset- transaction: AppearanceTransaction | null+ transaction: Transaction | null/** The glide on its way, in pixels of the plane, and when it set off. */- journey: Readonly<{ from: ViewportOffset, to: ViewportOffset, transaction: AppearanceTransaction, start: number }> | null+ journey: Readonly<{ from: ViewportOffset, to: ViewportOffset, transaction: Transaction, start: number }> | null}>function within(value: number) {diff --git a/source/client/view/structure/desktop/windows/snap-preview.tsx b/source/client/view/structure/desktop/windows/snap-preview.tsxindex b8c26ed..32e0fe1 100644--- a/source/client/view/structure/desktop/windows/snap-preview.tsx+++ b/source/client/view/structure/desktop/windows/snap-preview.tsx@@ -2,14 +2,14 @@ import { type CSSProperties } from "react"import { motion } from "motion/react"import { windowPaintInsets, type PaintMargins, type WindowSurfaceSize } from "@client/view/components/window-manager/window-geometry"import { type Position, type Size } from "@phreshos/core"-import { Surface, useAppearance } from "@phreshos/react-ui"+import { Surface, useTiming } from "@phreshos/react-ui"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) {- const transaction = useAppearance().transaction+ const transaction = useTiming()("change")const geometry = useWindowGeometryMotion({position: shown.position,diff --git a/source/client/view/structure/desktop/windows/window-geometry-animation.ts b/source/client/view/structure/desktop/windows/window-geometry-animation.tsindex 072b49f..3492985 100644--- a/source/client/view/structure/desktop/windows/window-geometry-animation.ts+++ b/source/client/view/structure/desktop/windows/window-geometry-animation.ts@@ -1,5 +1,5 @@import type { WindowRegion } from "@client/view/components/window-manager/window-geometry"-import type { AppearanceTransaction } from "@phreshos/core"+import type { Transaction } from "@phreshos/core"import { animate, type AnimationPlaybackControls, type MotionValue } from "motion/react"import { motionTransition } from "@client/view/appearance/motion"@@ -40,7 +40,7 @@ export class WindowGeometryAnimation {this.settleLayout()}- transition(region: WindowRegion, transaction: AppearanceTransaction, complete?: () => void) {+ transition(region: WindowRegion, transaction: Transaction, complete?: () => void) {this.animate(region, transaction, axes, complete)}@@ -59,7 +59,7 @@ export class WindowGeometryAnimation {}/** Starts from the visible size while the pointer immediately owns position. */- transitionSize(region: WindowRegion, transaction: AppearanceTransaction, complete?: () => void) {+ transitionSize(region: WindowRegion, transaction: Transaction, complete?: () => void) {this.stop()this.values.x.set(region.x)@@ -67,7 +67,7 @@ export class WindowGeometryAnimation {this.animate(region, transaction, sizeAxes, complete)}- private animate(region: WindowRegion, transaction: AppearanceTransaction, animatedAxes: readonly Axis[], complete?: () => void) {+ private animate(region: WindowRegion, transaction: Transaction, animatedAxes: readonly Axis[], complete?: () => void) {if (transaction.duration === 0) {this.set(region)diff --git a/source/client/view/structure/desktop/windows/window-geometry-motion.ts b/source/client/view/structure/desktop/windows/window-geometry-motion.tsindex 65242bb..a09aae7 100644--- a/source/client/view/structure/desktop/windows/window-geometry-motion.ts+++ b/source/client/view/structure/desktop/windows/window-geometry-motion.ts@@ -1,12 +1,11 @@import { constrainWindowGeometry, resolveWindowGeometry, type WindowRegion, type WindowSurfaceSize } from "@client/view/components/window-manager/window-geometry"import { type PresentationAnimation } from "@client/view/components/desktop-host/presentation"-import { resolveWindowTransaction } from "@client/view/appearance/motion"-import { type AppearanceTransaction, type Position, type Size, type PresentationTransaction } from "@phreshos/core"+import { resolvePresentationTransaction } from "@client/view/appearance/motion"+import { type Transaction, type Position, type Size, type PresentationTransaction } from "@phreshos/core"import { useMotionValue, useTransform, type MotionStyle } from "motion/react"import { useLayoutEffect, useRef } from "react"import { WindowGeometryAnimation } from "./window-geometry-animation"-import motionAcross, { travel } from "../motion-across"-import { useAppearance } from "@phreshos/react-ui"+import { timing, useAppearance } from "@phreshos/react-ui"interface WindowGeometryMotionOptions {position: Position@@ -14,11 +13,6 @@ interface WindowGeometryMotionOptions {animation?: PresentationAnimation | nulltransaction?: PresentationTransaction | nullimmediate: boolean- /**- * A standard Window, which the Desktop moves itself: its motions are chosen from how far it- * goes, not taken from the Appearance timing. A raw drawing keeps the timing its Program asked.- */- standard?: boolean/** Moves visibly only when the person can see where it starts or where it ends; otherwise it is simply there. */seenOnly?: booleanminimumSize?: WindowSurfaceSize@@ -32,9 +26,8 @@ interface WindowGeometryMotionOptions {* visible pixels, including during a pointer gesture, so releasing a drag* cannot hand the transform to another renderer before snapping begins.*/-export default function useWindowGeometryMotion({ position, size, animation, transaction, immediate, standard = false, seenOnly = false, minimumSize, onComplete }: WindowGeometryMotionOptions) {+export default function useWindowGeometryMotion({ position, size, animation, transaction, immediate, seenOnly = false, minimumSize, onComplete }: WindowGeometryMotionOptions) {- const appearanceTransaction = useAppearance().transactionconst frame = useRef<HTMLDivElement>(null)const x = useMotionValue(typeof position.x === "number" ? position.x : 0)const y = useMotionValue(typeof position.y === "number" ? position.y : 0)@@ -51,9 +44,10 @@ export default function useWindowGeometryMotion({ position, size, animation, traconst gestureRevision = useRef(0)const restoringGesture = useRef(false)const initialized = useRef(false)- const values = useRef({ position, size, animation, transaction, immediate, standard, seenOnly, minimumSize, onComplete })+ const tempo = useAppearance().tempo+ const values = useRef({ position, size, animation, transaction, immediate, tempo, seenOnly, minimumSize, onComplete })- values.current = { position, size, animation, transaction, immediate, standard, seenOnly, minimumSize, onComplete }+ values.current = { position, size, animation, transaction, immediate, tempo, seenOnly, minimumSize, onComplete }function read(): WindowRegion {@@ -97,19 +91,17 @@ export default function useWindowGeometryMotion({ position, size, animation, tra}/**- * The motion to a place when none was asked for: a standard Window's comes from how far it goes,- * and from whether it leaves the person's sight on the way.+ * The motion to a place when none was asked for: it comes from how far the box goes, and from+ * whether it leaves the person's sight on the way.*/function timingTo(region: WindowRegion) {- if (!values.current.standard) return appearanceTransaction-const from = read()- return motionAcross(travel(from, region), "window", seen(from) && !seen(region))+ return timing("window", { distance: travel(from, region), leaving: seen(from) && !seen(region), tempo: values.current.tempo })}- function transition(region: WindowRegion, transaction: AppearanceTransaction = timingTo(region), complete?: () => void) {+ function transition(region: WindowRegion, transaction: Transaction = timingTo(region), complete?: () => void) {if (immediate) {@@ -174,10 +166,10 @@ export default function useWindowGeometryMotion({ position, size, animation, tra}const selected = animation- ? animation.transaction === undefined ? timingTo(region) : resolveWindowTransaction(animation.transaction, appearanceTransaction)+ ? resolvePresentationTransaction(animation.transaction, timingTo(region)): transaction === undefined || transaction === null? null- : resolveWindowTransaction(transaction, appearanceTransaction)+ : resolvePresentationTransaction(transaction, timingTo(region))// A motion shows where something went or where it came from; between two places the person// does not see, there is nothing to show, and a path across the screen would only distract.@@ -317,7 +309,7 @@ export default function useWindowGeometryMotion({ position, size, animation, trarestoringGesture.current = truetransformOrigin.set(`${originX}px ${originY}px`)- animator.current!.transitionSize(region, values.current.standard ? motionAcross(Math.hypot(region.width - shown.width, region.height - shown.height), "window") : appearanceTransaction, () => {+ animator.current!.transitionSize(region, timing("window", { distance: Math.hypot(region.width - shown.width, region.height - shown.height), tempo: values.current.tempo }), () => {completeGestureRestore()})@@ -404,3 +396,11 @@ export default function useWindowGeometryMotion({ position, size, animation, trafunction logicalSize(element: HTMLElement) {return { width: element.clientWidth, height: element.clientHeight }}++/** How far a box travels between two places: its center's path, and half of how much its size changes. */+function travel(from: WindowRegion, to: WindowRegion) {++ const moved = Math.hypot(to.x + to.width / 2 - from.x - from.width / 2, to.y + to.height / 2 - from.y - from.height / 2)++ return moved + Math.hypot(to.width - from.width, to.height - from.height) / 2+}diff --git a/source/client/view/structure/desktop/windows/window-surface.tsx b/source/client/view/structure/desktop/windows/window-surface.tsxindex 8169bcd..0d6d857 100644--- a/source/client/view/structure/desktop/windows/window-surface.tsx+++ b/source/client/view/structure/desktop/windows/window-surface.tsx@@ -5,18 +5,18 @@ import { motion } from "motion/react"import { type PresentationAnimation } from "@client/view/components/desktop-host/presentation"import { type AppearanceColor, type PresentationSurface as WindowSurfaceDefinition } from "@phreshos/core"import { surfaceLifecyclePose, surfacePresenceTransition } from "@client/view/appearance/surface-presence"-import { resolveWindowTransaction } from "@client/view/appearance/motion"+import { resolvePresentationTransaction } from "@client/view/appearance/motion"import { floatingShadow } from "@client/view/appearance/floating-shadow"-import { useAppearance } from "@phreshos/react-ui"+import { useAppearance, useTiming } from "@phreshos/react-ui"/** Paints the optional Desktop-owned backing surface for a supported presentation. */export default function WindowSurface({ surface, active = true, floating = false, animation, onComplete }: WindowSurfaceProps) {const reducedMotion = useReducedMotion()const appearance = useAppearance()- const appearanceTransaction = appearance.transaction+ const change = useTiming()("change")const revision = animation?.revision- const transaction = animation ? resolveWindowTransaction(animation.transaction, appearanceTransaction) : null+ const transaction = animation ? resolvePresentationTransaction(animation.transaction, change) : nullconst visible = surface !== falseconst animated = revision !== undefined && transaction !== nullconst [hidden, setHidden] = useState(!visible)diff --git a/source/client/view/structure/desktop/windows/window.tsx b/source/client/view/structure/desktop/windows/window.tsxindex 3e2e90b..b051d96 100644--- a/source/client/view/structure/desktop/windows/window.tsx+++ b/source/client/view/structure/desktop/windows/window.tsx@@ -11,11 +11,10 @@ import { type PresentationGeometryRepresentation } from "@client/view/componentsimport { motion, useMotionValue, type MotionValue } from "motion/react"import { PlaneSlideContext, ViewCellShift } from "../plane-slide"import { EdgeHold, against } from "../edge-hold"-import { motionTransition, resolveWindowTransaction } from "@client/view/appearance/motion"-import { useAppearance, Window as UIWindow } from "@phreshos/react-ui"+import { motionTransition, resolvePresentationTransaction } from "@client/view/appearance/motion"+import { useAppearance, Window as UIWindow, timing } from "@phreshos/react-ui"import SnapPreview, { type SnapTarget } from "./snap-preview"import useWindowGeometryMotion from "./window-geometry-motion"-import motionAcross from "../motion-across"import WindowGestureCommit from "./window-gesture-commit"import { physicalToDesktopPixels, useDesktopScale } from "../desktop-scale"import { createPortal } from "react-dom"@@ -75,7 +74,6 @@ export default function ({ title, header = true, surface, layer, icon, children,const reducedMotion = useReducedMotion()const appearance = useAppearance()- const appearanceTransaction = appearance.transactionconst desktopScale = useDesktopScale()const standard = layer === "window"const surfaceDefinition = surface ?? (standard ? true : false)@@ -100,7 +98,6 @@ export default function ({ title, header = true, surface, layer, icon, children,size: presented.current.size,animation: geometryAnimation,immediate: reducedMotion,- standard,// The Desktop moves its own Windows visibly only when the person sees one end or both; a// raw drawing moves the way its Program asked.seenOnly: standard,@@ -271,14 +268,12 @@ export default function ({ title, header = true, surface, layer, icon, children,// happen in place, so they cover little of it; leaving for the Taskbar crosses more.const shownBox = geometryMotion.read()const reach = Math.hypot(shownBox.width, shownBox.height)- const presenceMotion = motionAcross(reach * 0.35, "window")+ const presenceMotion = timing("window", { distance: reach * 0.35, tempo: appearance.tempo })const entryTransaction = standard ? presenceMotion : nullconst opening = entering && !reducedMotion ? entryTransaction : nullconst [opened, setOpened] = useState(opening === null)const minimizeTransaction = minimizeAnimation- ? standard && minimizeAnimation.transaction === undefined- ? motionAcross(reach * 0.75, "window")- : resolveWindowTransaction(minimizeAnimation.transaction, appearanceTransaction)+ ? resolvePresentationTransaction(minimizeAnimation.transaction, timing("window", { distance: reach * 0.75, tempo: appearance.tempo })): nullconst initialPresence = standard? opening ? windowSurfaceLifecyclePose.hidden : windowSurfaceLifecyclePose.visiblediff --git a/source/client/view/structure/structure.tsx b/source/client/view/structure/structure.tsxindex ede3c9d..a9788e3 100644--- a/source/client/view/structure/structure.tsx+++ b/source/client/view/structure/structure.tsx@@ -2,7 +2,7 @@ import { ReactTunnel } from "@the-link/react"import { useProperty } from "@the-link/react"import { LinkManagerSnapshot } from "@server/core/link-manager/link-manager"import LinkManager from "@client/core/link-manager/link-manager"-import { useAppearance } from "@phreshos/react-ui"+import { timing, useAppearance } from "@phreshos/react-ui"import Loading from "../components/loading"import Alert from "../components/alert"import { ApplicationContext, LinkManagerContext } from "../contexts"@@ -13,7 +13,7 @@ import Authentication from "./authentication/authentication"import { useCallback, useEffect, useState } from "react"import Readiness, { useReadiness, useReady } from "@libs/readiness"import { type DesktopPreferencesUpdate } from "@phreshos/core"-import { cssEasing } from "../appearance/motion"+import { cssEasing } from "@phreshos/core"import {connectionRequirement,sessionRequirement,@@ -40,7 +40,9 @@ function DesktopReadiness({ appearance }: { appearance: ReturnType<typeof useAppconst covering = pending.length > 0- const duration = appearance.transaction.duration+ const change = timing("change", { tempo: appearance.tempo })++ const duration = change.duration// Once faded out, the cover leaves the tree. Kept at zero opacity, it// stayed a full-screen layer over the Desktop that repainted with every@@ -63,7 +65,7 @@ function DesktopReadiness({ appearance }: { appearance: ReturnType<typeof useApp// New pending work must cover the next representation// immediately; only completed readiness fades away.transitionDuration: covering ? "0ms" : String(duration) + "ms",- transitionTimingFunction: cssEasing(appearance.transaction.easing),+ transitionTimingFunction: cssEasing(change.easing),transitionProperty: "opacity"}}diff --git a/tests/appearance.test.ts b/tests/appearance.test.tsindex a21ef1a..dcdf186 100644--- a/tests/appearance.test.ts+++ b/tests/appearance.test.ts@@ -28,7 +28,7 @@ test("appearance contract", async () => {}))assert.throws(() => parseAppearance({...defaultAppearance,- transaction: { duration: 120 }+ tempo: 5}))const store = new Keyv()@@ -110,7 +110,7 @@ test("appearance contract", async () => {const updated = {...manager.value,- transaction: { duration: 180, easing: [0.25, 0.1, 0.25, 1] as const }+ tempo: 1.5}await manager.update(updated)diff --git a/tests/motion-across.test.ts b/tests/motion-across.test.tsdeleted file mode 100644index cbba9eb..0000000--- a/tests/motion-across.test.ts+++ /dev/null@@ -1,38 +0,0 @@-import { expect, test } from "vitest"-import motionAcross from "@client/view/structure/desktop/motion-across"--test("the motion across a distance grows with the distance it crosses, gently and within bounds", () => {- const near = motionAcross(120)- const oneView = motionAcross(1440)- const twoViews = motionAcross(2880)- const across = motionAcross(20_000)-- expect(near.duration).toBe(330)- expect(oneView.duration).toBeGreaterThan(near.duration)- expect(twoViews.duration).toBeGreaterThan(oneView.duration)- // Twice as far does not take twice as long.- expect(twoViews.duration).toBeLessThan(oneView.duration * 1.5)- expect(across.duration).toBe(1000)- expect(motionAcross(1).duration).toBe(300)- // The view moves as a body on a spring that arrives without passing its place.- expect(oneView.easing).toEqual({ spring: { bounce: 0 } })-})--test("a Window is a lighter body than the view, so the same distance takes it less time", () => {- for (const distance of [40, 400, 1440, 5000]) {- expect(motionAcross(distance, "window").duration).toBeLessThan(motionAcross(distance).duration)- }- expect(motionAcross(1, "window").duration).toBe(130)- expect(motionAcross(20_000, "window").duration).toBe(650)- // A long crossing takes a little more, so it is not crossed at a rush.- expect(motionAcross(4000, "window").duration).toBeGreaterThan(450)- expect(motionAcross(300, "window").duration).toBe(Math.round(85 + 4 * Math.sqrt(300)))- // A Window answers a hand: it sets off at once.- expect(motionAcross(400, "window").easing).toEqual([0.22, 1, 0.36, 1])-})--test("what leaves the view starts softly, and what arrives lands softly", () => {- expect(motionAcross(4000, "window", true).easing).toEqual([0.65, 0, 0.35, 1])- expect(motionAcross(4000, "window").easing).toEqual([0.22, 1, 0.36, 1])- expect(motionAcross(4000, "window", true).duration).toBe(motionAcross(4000, "window").duration)-})diff --git a/tests/presentation.test.ts b/tests/presentation.test.tsindex cfbfc6b..886daa9 100644--- a/tests/presentation.test.ts+++ b/tests/presentation.test.ts@@ -1,3 +1,4 @@+import { resolvePresentationTransaction } from "@client/view/appearance/motion"import assert from "node:assert/strict"import ClientProcessBoundary from "@client/view/components/desktop-host/client-process-boundary"import { presentationTransaction } from "@client/view/components/desktop-host/presentation"@@ -7,7 +8,9 @@ import { test } from "vitest"test("presentation transaction selection has no boolean compatibility values", () => {assert.deepEqual(presentationTransaction({ wait: false }), { wait: false })- assert.deepEqual(presentationTransaction({ transaction: 120_000, wait: true }), { transaction: 120_000, wait: true })+ assert.deepEqual(presentationTransaction({ transaction: 2, wait: true }), { transaction: 2, wait: true })+ // A number is a multiplier of the derived motion, never milliseconds.+ assert.throws(() => presentationTransaction({ transaction: 120_000, wait: true }), /multiplier/)assert.deepEqual(presentationTransaction({ transaction: { duration: 240, easing: "ease-out" }, wait: false }), {transaction: { duration: 240, easing: "ease-out" }, wait: false})@@ -212,3 +215,10 @@ test("a drawing's box is heard at every step it moves, not only when it settles"presentations.reconcile(new Map())assert.equal(stopped, true)})++test("a presentation write moves on the derived motion, that motion stretched, or an exact one", () => {+ const derived = { duration: 300, easing: [0.22, 1, 0.36, 1] as const }+ assert.equal(resolvePresentationTransaction(undefined, derived), derived)+ assert.deepEqual(resolvePresentationTransaction(2, derived), { duration: 600, easing: derived.easing })+ assert.deepEqual(resolvePresentationTransaction({ duration: 90, easing: "linear" }, derived), { duration: 90, easing: "linear" })+})diff --git a/tests/theme-transition.test.ts b/tests/theme-transition.test.tsindex 14384e2..5d65d1d 100644--- a/tests/theme-transition.test.ts+++ b/tests/theme-transition.test.ts@@ -1,9 +1,9 @@import assert from "node:assert/strict"-import type { AppearanceTransaction } from "@phreshos/core"+import type { Transaction } from "@phreshos/core"import { transitionTheme } from "@client/view/appearance/theme-transition"import { test } from "vitest"-const transaction = { duration: 180, easing: [0.2, 0.4, 0.6, 0.8] } satisfies AppearanceTransaction+const transaction = { duration: 180, easing: [0.2, 0.4, 0.6, 0.8] } satisfies Transactiontest("theme transitions capture one complete old and new document state", async () => {const ready = deferred()