Skip to content

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

Release System 0.1.76

zohayrslilehf36603e8492c
diff --git a/bun.lock b/bun.lock
index 62db0a8..3cf7dda 100644
--- a/bun.lock
+++ b/bun.lock
@@ -8,8 +8,8 @@
"@fontsource/roboto": "^5.3.0",
"@hono/node-server": "^2.1.1",
"@jitl/quickjs-ng-wasmfile-release-sync": "^0.32.0",
- "@phreshos/core": "^0.1.53",
- "@phreshos/react-ui": "^0.1.28",
+ "@phreshos/core": "^0.1.54",
+ "@phreshos/react-ui": "^0.1.29",
"@the-link/core": "^0.3.0",
"@the-link/http": "^0.1.1",
"@the-link/ipc": "^0.2.1",
@@ -251,9 +251,9 @@
"@oxc-project/types": ["@oxc-project/[email protected]", "", {}, "sha512-nuhZIOLuI6TFQ32I/WnUx+SCPY7SdSKwgnFHydAuoS1+Z4BRcaP+RRJmGzl9lw+0OFF7UmaESf7KQRXaNLHypg=="],
- "@phreshos/core": ["@phreshos/[email protected]", "", { "dependencies": { "zod": "^4.6.5" } }, "sha512-6PQJA5paERMN2FVl13yDklJFV4xbqbiTFoVwfVSP3QqLniQ2rstqHehdCpV6a4TjOk+yH2u5hYbE18t3IqWWqw=="],
+ "@phreshos/core": ["@phreshos/[email protected]", "", { "dependencies": { "zod": "^4.6.5" } }, "sha512-A0idbkbSkAOXaW0m6LL8VT3YhZUFV1VZkQaDYkSaRZ/cDIME2NdI59gK6RBe08RGOLA+hVZD6DQsMiLC9ehu9A=="],
- "@phreshos/react-ui": ["@phreshos/[email protected]", "", { "dependencies": { "@base-ui/react": "^1.7.0", "@phreshos/core": "^0.1.53", "colorjs.io": "^0.7.1", "motion": "^13.2.0", "react-aria-components": "^1.20.0" }, "peerDependencies": { "react": "^19.2.0", "react-dom": "^19.2.0" } }, "sha512-hOlIWdEDHzvymAhS9FR5Tty0ya+WJBJBBZRgheJoRUWqp1U6K3ChN79NjWr2yS3Iotp4264hXkpZsSNebifTGg=="],
+ "@phreshos/react-ui": ["@phreshos/[email protected]", "", { "dependencies": { "@base-ui/react": "^1.7.0", "@phreshos/core": "^0.1.54", "colorjs.io": "^0.7.1", "motion": "^13.2.0", "react-aria-components": "^1.20.0" }, "peerDependencies": { "react": "^19.2.0", "react-dom": "^19.2.0" } }, "sha512-tx6Qld7NLwqQ4hSArmtIfi66elqRBTIPwe2emSPuezp2x5Udc+twX0KHbHWrzBZeEGjkUnoOw/mKsOYrxt0I4Q=="],
"@react-types/shared": ["@react-types/[email protected]", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" } }, "sha512-AzsuD9OfxTOZMMvTRhlN3oHBwOmFN7tDh27LzqmHt4+uOgPhJT7ZM7/kVs/8/o0WxayMUIk3hBmCFRHv1FUoag=="],
diff --git a/package.json b/package.json
index 0550034..ba53bac 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "phreshos",
"displayName": "PhreshOS",
- "version": "0.1.75",
+ "version": "0.1.76",
"description": "The PhreshOS server, desktop, and authoritative system runtime.",
"type": "module",
"private": true,
@@ -37,8 +37,8 @@
"@fontsource/roboto": "^5.3.0",
"@hono/node-server": "^2.1.1",
"@jitl/quickjs-ng-wasmfile-release-sync": "^0.32.0",
- "@phreshos/core": "^0.1.53",
- "@phreshos/react-ui": "^0.1.28",
+ "@phreshos/core": "^0.1.54",
+ "@phreshos/react-ui": "^0.1.29",
"@the-link/core": "^0.3.0",
"@the-link/http": "^0.1.1",
"@the-link/ipc": "^0.2.1",
diff --git a/source/client/view/components/window-manager/shared-resize.ts b/source/client/view/components/window-manager/shared-resize.ts
index 31fb6de..e87db76 100644
--- a/source/client/view/components/window-manager/shared-resize.ts
+++ b/source/client/view/components/window-manager/shared-resize.ts
@@ -5,6 +5,8 @@ export interface SharedResizeWindow {
identity: string
geometry: WindowRegion
+
+ depth: number
}
export interface SharedResizeBoundary {
@@ -22,6 +24,17 @@ export interface SharedResizeBoundary {
before: readonly string[]
after: readonly string[]
+
+ segments: readonly SharedResizeSegment[]
+}
+
+export interface SharedResizeSegment {
+
+ start: number
+
+ end: number
+
+ depth: number
}
const alignmentTolerance = 1
@@ -133,6 +146,8 @@ interface Contact {
before: string
after: string
+
+ depth: number
}
function verticalContact(contacts: Contact[], before: SharedResizeWindow, after: SharedResizeWindow) {
@@ -147,7 +162,7 @@ function verticalContact(contacts: Contact[], before: SharedResizeWindow, after:
if (end <= start) return
- contacts.push({ orientation: "vertical", position: (edge + after.geometry.x) / 2, start, end, before: before.identity, after: after.identity })
+ contacts.push({ orientation: "vertical", position: (edge + after.geometry.x) / 2, start, end, before: before.identity, after: after.identity, depth: Math.max(before.depth, after.depth) })
}
function horizontalContact(contacts: Contact[], before: SharedResizeWindow, after: SharedResizeWindow) {
@@ -162,7 +177,7 @@ function horizontalContact(contacts: Contact[], before: SharedResizeWindow, afte
if (end <= start) return
- contacts.push({ orientation: "horizontal", position: (edge + after.geometry.y) / 2, start, end, before: before.identity, after: after.identity })
+ contacts.push({ orientation: "horizontal", position: (edge + after.geometry.y) / 2, start, end, before: before.identity, after: after.identity, depth: Math.max(before.depth, after.depth) })
}
function connected(first: Contact, second: Contact) {
@@ -188,10 +203,44 @@ function boundary(contacts: readonly Contact[]): SharedResizeBoundary {
start: Math.min(...contacts.map(contact => contact.start)),
end: Math.max(...contacts.map(contact => contact.end)),
before,
- after
+ after,
+ segments: boundarySegments(contacts)
}
}
+function boundarySegments(contacts: readonly Contact[]): SharedResizeSegment[] {
+
+ const points = [...new Set(contacts.flatMap(contact => [contact.start, contact.end]))].sort((first, second) => first - second)
+
+ const segments: SharedResizeSegment[] = []
+
+ for (let index = 0; index < points.length - 1; index++) {
+
+ const start = points[index]
+
+ const end = points[index + 1]
+
+ const covering = contacts.filter(contact => contact.start < end && contact.end > start)
+
+ if (!covering.length) continue
+
+ const depth = Math.max(...covering.map(contact => contact.depth))
+
+ const previous = segments.at(-1)
+
+ if (previous && previous.end === start && previous.depth === depth) {
+
+ previous.end = end
+
+ continue
+ }
+
+ segments.push({ start, end, depth })
+ }
+
+ return segments
+}
+
function span(geometry: WindowRegion, orientation: SharedResizeBoundary["orientation"]) {
return orientation === "vertical" ? geometry.width : geometry.height
diff --git a/source/client/view/components/window-manager/window-manager.ts b/source/client/view/components/window-manager/window-manager.ts
index eeb9216..aeb2fe7 100644
--- a/source/client/view/components/window-manager/window-manager.ts
+++ b/source/client/view/components/window-manager/window-manager.ts
@@ -345,7 +345,7 @@ export default function useWindows(authManager: AuthManager) {
if (!geometry) return []
- return [{ identity: pane.record.identity, geometry }]
+ return [{ identity: pane.record.identity, geometry, depth: pane.local.depth }]
})
const presentSharedResize = useCallback(function (geometries: ReadonlyMap<string, WindowRegion>) {
diff --git a/source/client/view/structure/desktop/windows/shared-resize-boundaries.tsx b/source/client/view/structure/desktop/windows/shared-resize-boundaries.tsx
index 16bc5c2..68f930a 100644
--- a/source/client/view/structure/desktop/windows/shared-resize-boundaries.tsx
+++ b/source/client/view/structure/desktop/windows/shared-resize-boundaries.tsx
@@ -104,31 +104,33 @@ export default function SharedResizeBoundaries({ windows, begin, present, commit
setActive({ boundary, delta: 0 })
}
- return <div className="pointer-events-none absolute inset-0 z-[2147483647]">
+ return <div className="pointer-events-none absolute inset-0">
- {(active ? [active.boundary] : boundaries).map(boundary => {
+ {(active ? [active.boundary] : boundaries).flatMap(boundary => {
const delta = active?.boundary.identity === boundary.identity ? active.delta : 0
const vertical = boundary.orientation === "vertical"
- return <div
- key={boundary.identity}
+ return boundary.segments.map(segment => <div
+ key={`${boundary.identity}:${segment.start}:${segment.end}`}
data-shared-window-resize={boundary.orientation}
onPointerDown={event => grab(event, boundary)}
className={`pointer-events-auto absolute touch-none ${vertical ? "cursor-col-resize" : "cursor-row-resize"}`}
style={vertical ? {
left: boundary.position + delta - thickness / 2,
- top: boundary.start,
+ top: segment.start,
width: thickness,
- height: boundary.end - boundary.start
+ height: segment.end - segment.start,
+ zIndex: segment.depth
} : {
- left: boundary.start,
+ left: segment.start,
top: boundary.position + delta - thickness / 2,
- width: boundary.end - boundary.start,
- height: thickness
+ width: segment.end - segment.start,
+ height: thickness,
+ zIndex: segment.depth
}}
- />
+ />)
})}
</div>
diff --git a/tests/shared-window-resize.test.ts b/tests/shared-window-resize.test.ts
index 13d275b..56c3239 100644
--- a/tests/shared-window-resize.test.ts
+++ b/tests/shared-window-resize.test.ts
@@ -5,8 +5,8 @@ import { test } from "vitest"
test("a shared boundary resizes the windows on both sides", () => {
const windows: SharedResizeWindow[] = [
- { identity: "left", geometry: { x: 0, y: 0, width: 500, height: 600 } },
- { identity: "right", geometry: { x: 500, y: 0, width: 500, height: 600 } }
+ { identity: "left", geometry: { x: 0, y: 0, width: 500, height: 600 }, depth: 1 },
+ { identity: "right", geometry: { x: 500, y: 0, width: 500, height: 600 }, depth: 2 }
]
const boundaries = sharedResizeBoundaries(windows)
@@ -20,7 +20,8 @@ test("a shared boundary resizes the windows on both sides", () => {
start: 0,
end: 600,
before: ["left"],
- after: ["right"]
+ after: ["right"],
+ segments: [{ start: 0, end: 600, depth: 2 }]
})
const resized = resizeSharedBoundary(boundaries[0], windows, 80)
@@ -35,10 +36,10 @@ test("a shared boundary resizes the windows on both sides", () => {
test("one continuous boundary coordinates every window that shares it", () => {
const windows: SharedResizeWindow[] = [
- { identity: "left-top", geometry: { x: 0, y: 0, width: 500, height: 300 } },
- { identity: "left-bottom", geometry: { x: 0, y: 300, width: 500, height: 300 } },
- { identity: "right-top", geometry: { x: 500, y: 0, width: 500, height: 300 } },
- { identity: "right-bottom", geometry: { x: 500, y: 300, width: 500, height: 300 } }
+ { identity: "left-top", geometry: { x: 0, y: 0, width: 500, height: 300 }, depth: 2 },
+ { identity: "left-bottom", geometry: { x: 0, y: 300, width: 500, height: 300 }, depth: 4 },
+ { identity: "right-top", geometry: { x: 500, y: 0, width: 500, height: 300 }, depth: 3 },
+ { identity: "right-bottom", geometry: { x: 500, y: 300, width: 500, height: 300 }, depth: 7 }
]
const boundary = sharedResizeBoundaries(windows).find(candidate => candidate.orientation === "vertical")
@@ -50,14 +51,19 @@ test("one continuous boundary coordinates every window that shares it", () => {
assert.deepEqual(boundary.after, ["right-bottom", "right-top"])
assert.deepEqual([boundary.start, boundary.end], [0, 600])
+
+ assert.deepEqual(boundary.segments, [
+ { start: 0, end: 300, depth: 3 },
+ { start: 300, end: 600, depth: 7 }
+ ])
})
test("the smallest participating window constrains the whole boundary", () => {
const windows: SharedResizeWindow[] = [
- { identity: "left", geometry: { x: 0, y: 0, width: 500, height: 600 } },
- { identity: "right-small", geometry: { x: 500, y: 0, width: 300, height: 300 } },
- { identity: "right-large", geometry: { x: 500, y: 300, width: 500, height: 300 } }
+ { identity: "left", geometry: { x: 0, y: 0, width: 500, height: 600 }, depth: 1 },
+ { identity: "right-small", geometry: { x: 500, y: 0, width: 300, height: 300 }, depth: 2 },
+ { identity: "right-large", geometry: { x: 500, y: 300, width: 500, height: 300 }, depth: 3 }
]
const boundary = sharedResizeBoundaries(windows).find(candidate => candidate.orientation === "vertical")
@@ -76,8 +82,8 @@ test("the smallest participating window constrains the whole boundary", () => {
test("a horizontal boundary changes heights and the lower origins", () => {
const windows: SharedResizeWindow[] = [
- { identity: "top", geometry: { x: 0, y: 0, width: 700, height: 300 } },
- { identity: "bottom", geometry: { x: 0, y: 300, width: 700, height: 400 } }
+ { identity: "top", geometry: { x: 0, y: 0, width: 700, height: 300 }, depth: 1 },
+ { identity: "bottom", geometry: { x: 0, y: 300, width: 700, height: 400 }, depth: 2 }
]
const boundary = sharedResizeBoundaries(windows).find(candidate => candidate.orientation === "horizontal")
@@ -94,7 +100,7 @@ test("a horizontal boundary changes heights and the lower origins", () => {
test("unaligned and merely overlapping windows have no shared boundary", () => {
assert.deepEqual(sharedResizeBoundaries([
- { identity: "first", geometry: { x: 0, y: 0, width: 400, height: 400 } },
- { identity: "second", geometry: { x: 300, y: 100, width: 400, height: 400 } }
+ { identity: "first", geometry: { x: 0, y: 0, width: 400, height: 400 }, depth: 1 },
+ { identity: "second", geometry: { x: 300, y: 100, width: 400, height: 400 }, depth: 2 }
]), [])
})