@phreshos/core 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -17
- package/dist/local-window.d.ts +39 -0
- package/dist/local-window.js +0 -0
- package/dist/main.d.ts +3 -1
- package/dist/main.js +2 -0
- package/dist/permissions.d.ts +1 -1
- package/dist/transaction.d.ts +18 -0
- package/dist/transaction.js +0 -0
- package/dist/window.d.ts +10 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -234,23 +234,26 @@ Program and the deliberately narrow `WallpaperLaunch`, containing only `name`,
|
|
|
234
234
|
These contracts describe capability and data shape only — they contain no
|
|
235
235
|
persistence, upload, Process creation, or rendering implementation.
|
|
236
236
|
|
|
237
|
-
##
|
|
238
|
-
|
|
239
|
-
`
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
`set()` without settings creates
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
237
|
+
## Local representation
|
|
238
|
+
|
|
239
|
+
`Window` is the authoritative, subscribable presentation state shared through
|
|
240
|
+
the system. `LocalWindow` is the current desktop's physical representation of
|
|
241
|
+
the current Client only. Its reads and commands are deliberately eventless and
|
|
242
|
+
never change or publish authoritative state. A desktop projects authoritative
|
|
243
|
+
changes onto an ordinary `window` layer; `under` and `over` representations
|
|
244
|
+
receive their initial truth and control their local projection thereafter.
|
|
245
|
+
|
|
246
|
+
`SurfaceSettings` describes optional host-rendered material belonging to one
|
|
247
|
+
live `under` or `over` representation. Calling `set()` without settings creates
|
|
248
|
+
a sharp, fully opaque Surface; `remove()` removes its render node immediately.
|
|
249
|
+
Opacity accepts zero through one, while radius accepts a nonnegative pixel
|
|
250
|
+
number, a scale level, or `"full"`.
|
|
251
|
+
|
|
252
|
+
Geometry commands and Surface replacement may receive a generic `Transaction`.
|
|
253
|
+
It must contain a duration in milliseconds, an easing, or both; `{}` and
|
|
254
|
+
`{ wait: true }` are not transactions. Omitting it preserves the layer's normal
|
|
255
|
+
behavior. `wait: true` makes the command settle with the visual transition,
|
|
256
|
+
while omission or `false` settles when the desktop accepts it.
|
|
254
257
|
|
|
255
258
|
## Window geometry
|
|
256
259
|
|
|
@@ -261,6 +264,15 @@ pixel number or a linear relative expression such as `"1/2"`, `"50% + 10"`, or
|
|
|
261
264
|
offset. The CLI, runtime validation, and desktop layout all consume this one
|
|
262
265
|
Core definition rather than maintaining separate parsers.
|
|
263
266
|
|
|
267
|
+
`move()` and `resize()` change one dimension of authoritative geometry.
|
|
268
|
+
`setGeometry({ position, size })` validates and commits both dimensions as one
|
|
269
|
+
operation, then emits one `geometry` event. Compound interactions such as
|
|
270
|
+
resizing from a top or left edge and snapping must use this atomic form so a
|
|
271
|
+
remote representation never observes a new position with the previous size.
|
|
272
|
+
`move` and `resize` subscribers are also notified after the complete geometry
|
|
273
|
+
has committed; those component notifications never represent partial
|
|
274
|
+
authoritative state.
|
|
275
|
+
|
|
264
276
|
## Process parentage
|
|
265
277
|
|
|
266
278
|
Process parentage belongs to `Process`, not to contextual SDK state. Each
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Position, Size } from "./launch.js";
|
|
2
|
+
import type { ScaleLevel } from "./scale.js";
|
|
3
|
+
import type { Transaction } from "./transaction.js";
|
|
4
|
+
import type { WindowGeometry, WindowLayer } from "./window.js";
|
|
5
|
+
/** A host Surface belonging only to one live Client representation. */
|
|
6
|
+
export type SurfaceSettings = Readonly<{
|
|
7
|
+
/** Whole-Surface opacity from zero through one. Omission means one. */
|
|
8
|
+
opacity?: number;
|
|
9
|
+
/** A Theme level, CSS pixels, or maximum proportional rounding. */
|
|
10
|
+
radius?: ScaleLevel | number | "full";
|
|
11
|
+
}>;
|
|
12
|
+
/** Local Surface commands for the current Client representation. */
|
|
13
|
+
export interface LocalWindowSurface {
|
|
14
|
+
/** Creates or replaces the Surface, optionally as a visual transaction. */
|
|
15
|
+
set(settings?: SurfaceSettings, transaction?: Transaction): Promise<void>;
|
|
16
|
+
/** Removes the Surface immediately. */
|
|
17
|
+
remove(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The current desktop's physical representation of the current Client Window.
|
|
21
|
+
* It has no events: its commands neither change authoritative state nor
|
|
22
|
+
* broadcast anything.
|
|
23
|
+
*/
|
|
24
|
+
export interface LocalWindow {
|
|
25
|
+
readonly surface: LocalWindowSurface;
|
|
26
|
+
title(): Promise<string>;
|
|
27
|
+
position(): Promise<Position>;
|
|
28
|
+
size(): Promise<Size>;
|
|
29
|
+
minimized(): Promise<boolean>;
|
|
30
|
+
front(): Promise<boolean>;
|
|
31
|
+
layer(): Promise<WindowLayer>;
|
|
32
|
+
location(): Promise<string>;
|
|
33
|
+
move(position: Position, transaction?: Transaction): Promise<void>;
|
|
34
|
+
resize(size: Size, transaction?: Transaction): Promise<void>;
|
|
35
|
+
setGeometry(geometry: WindowGeometry, transaction?: Transaction): Promise<void>;
|
|
36
|
+
minimize(minimized?: boolean): Promise<void>;
|
|
37
|
+
changeTitle(title: string): Promise<void>;
|
|
38
|
+
raise(): Promise<void>;
|
|
39
|
+
}
|
|
File without changes
|
package/dist/main.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { Server, type AnswerCapture, type AnswerMessage, type AnswerObserver, ty
|
|
|
19
19
|
export { Client, type ClientTraffic } from "./client.js";
|
|
20
20
|
export { Process, type Exit, type ProcessEvents } from "./process.js";
|
|
21
21
|
export { Program, type ClientDeclaration, type EndpointDeclaration, type ProgramEvents, type ProgramIconSize, type ProgramProcessExit } from "./program.js";
|
|
22
|
-
export { type Window, type WindowEvents, type
|
|
22
|
+
export { type Window, type WindowEvents, type WindowGeometry, type WindowLayer, type WindowState } from "./window.js";
|
|
23
|
+
export { type LocalWindow, type LocalWindowSurface, type SurfaceSettings } from "./local-window.js";
|
|
24
|
+
export { type Easing, type Transaction } from "./transaction.js";
|
|
23
25
|
export { layers, type Launch, type LaunchClient, type Layer, type Position, type Size } from "./launch.js";
|
|
24
26
|
export { defineConfig, type ClientConfig, type ClientDevelopment, type Config, type ServerConfig, type ServerDevelopment } from "./config.js";
|
package/dist/main.js
CHANGED
|
@@ -20,5 +20,7 @@ export { Client } from "./client.js";
|
|
|
20
20
|
export { Process } from "./process.js";
|
|
21
21
|
export { Program } from "./program.js";
|
|
22
22
|
export {} from "./window.js";
|
|
23
|
+
export {} from "./local-window.js";
|
|
24
|
+
export {} from "./transaction.js";
|
|
23
25
|
export { layers } from "./launch.js";
|
|
24
26
|
export { defineConfig } from "./config.js";
|
package/dist/permissions.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface TimedPermissions {
|
|
|
14
14
|
/** Requests one permission, resolving `null` if the deadline expires. */
|
|
15
15
|
request(name: PermissionName): Promise<PermissionDecision>;
|
|
16
16
|
}
|
|
17
|
-
/** Client access to
|
|
17
|
+
/** Client access to one Program's effective permission decisions. */
|
|
18
18
|
export interface Permissions extends Timeoutable<TimedPermissions> {
|
|
19
19
|
/** Reads the effective decision without prompting the user. */
|
|
20
20
|
granted(name: PermissionName): Promise<PermissionDecision>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Stable timing curves accepted by local visual transactions. */
|
|
2
|
+
export type Easing = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | readonly [number, number, number, number];
|
|
3
|
+
type TransactionOptions = Readonly<{
|
|
4
|
+
/** Wait for the visual transition to finish instead of only accepting it. */
|
|
5
|
+
wait?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* An explicit visual transaction. At least one motion value is required, so
|
|
9
|
+
* an empty object cannot silently replace a layer's default behavior.
|
|
10
|
+
*/
|
|
11
|
+
export type Transaction = TransactionOptions & (Readonly<{
|
|
12
|
+
duration: number;
|
|
13
|
+
easing?: Easing;
|
|
14
|
+
}> | Readonly<{
|
|
15
|
+
duration?: number;
|
|
16
|
+
easing: Easing;
|
|
17
|
+
}>);
|
|
18
|
+
export {};
|
|
File without changes
|
package/dist/window.d.ts
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
1
|
import type { Layer, Position, Size } from "./launch.js";
|
|
2
|
-
import type { ScaleLevel } from "./scale.js";
|
|
3
2
|
import type { Subscribable } from "./subscribable.js";
|
|
4
3
|
/** The authoritative runtime layer occupied by a Window. */
|
|
5
4
|
export type WindowLayer = Layer | "wallpaper";
|
|
6
|
-
/**
|
|
7
|
-
export type
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/** Timing curve. Omission uses the system curve. */
|
|
13
|
-
easing?: WindowSurfaceEasing;
|
|
14
|
-
}>;
|
|
15
|
-
/** Authoritative target settings for one Window's optional host Surface. */
|
|
16
|
-
export type WindowSurfaceSettings = Readonly<{
|
|
17
|
-
/** Whole-Surface opacity from zero through one. Omission means one. */
|
|
18
|
-
opacity?: number;
|
|
19
|
-
/** A Theme-derived level, CSS pixels, or maximum proportional rounding. Omission means zero. */
|
|
20
|
-
radius?: ScaleLevel | number | "full";
|
|
21
|
-
/** Optional motion from the currently rendered values to this target. */
|
|
22
|
-
transaction?: WindowSurfaceTransaction;
|
|
5
|
+
/** Position and size committed as one authoritative Window change. */
|
|
6
|
+
export type WindowGeometry = Readonly<{
|
|
7
|
+
/** Complete top-left position. */
|
|
8
|
+
position: Position;
|
|
9
|
+
/** Complete width and height. */
|
|
10
|
+
size: Size;
|
|
23
11
|
}>;
|
|
24
|
-
/** Optional host-rendered material owned by one authoritative Window. */
|
|
25
|
-
export interface WindowSurface {
|
|
26
|
-
/** Creates or replaces the authoritative target. Omission creates the default Surface. */
|
|
27
|
-
set(settings?: WindowSurfaceSettings): Promise<void>;
|
|
28
|
-
/** Immediately removes the authoritative Surface. */
|
|
29
|
-
remove(): Promise<void>;
|
|
30
|
-
}
|
|
31
12
|
/** Events emitted when authoritative Window state changes. */
|
|
32
13
|
export type WindowEvents = {
|
|
33
14
|
/** The authoritative top-left position changed. */
|
|
34
15
|
move: Position;
|
|
35
16
|
/** The authoritative width or height changed. */
|
|
36
17
|
resize: Size;
|
|
18
|
+
/** Position and size changed in one atomic operation. */
|
|
19
|
+
geometry: WindowGeometry;
|
|
37
20
|
/** The authoritative minimized state changed. */
|
|
38
21
|
minimize: boolean;
|
|
39
22
|
/** The authoritative title changed. */
|
|
@@ -60,8 +43,6 @@ export type WindowState = Readonly<{
|
|
|
60
43
|
}>;
|
|
61
44
|
/** Presentation capability owned by one Client handle. */
|
|
62
45
|
export interface Window extends Subscribable<WindowEvents, never> {
|
|
63
|
-
/** Authoritative host-rendered material associated with this Window. */
|
|
64
|
-
readonly surface: WindowSurface;
|
|
65
46
|
/** Returns the current title. */
|
|
66
47
|
title(): Promise<string>;
|
|
67
48
|
/** Returns the current top-left position. */
|
|
@@ -80,6 +61,8 @@ export interface Window extends Subscribable<WindowEvents, never> {
|
|
|
80
61
|
move(position: Position): Promise<void>;
|
|
81
62
|
/** Resizes the authoritative Window. */
|
|
82
63
|
resize(size: Size): Promise<void>;
|
|
64
|
+
/** Changes position and size as one authoritative operation. */
|
|
65
|
+
setGeometry(geometry: WindowGeometry): Promise<void>;
|
|
83
66
|
/** Changes whether the Window is minimized. */
|
|
84
67
|
minimize(minimized?: boolean): Promise<void>;
|
|
85
68
|
/** Changes the Window title. */
|