@phreshos/client 0.1.22 → 0.1.24
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 +8 -7
- package/dist/desktop-preferences.d.ts +11 -0
- package/dist/desktop-preferences.js +21 -0
- package/dist/main.d.ts +2 -2
- package/dist/main.js +1 -1
- package/dist/service.d.ts +7 -7
- package/dist/service.js +3 -3
- package/dist/system.d.ts +6 -6
- package/dist/system.js +2 -2
- package/package.json +3 -3
- package/dist/theme.d.ts +0 -8
- package/dist/theme.js +0 -19
package/README.md
CHANGED
|
@@ -18,14 +18,15 @@ a peer dependency. It does not redefine those objects, own server-side
|
|
|
18
18
|
capabilities, or contain System and transport implementations.
|
|
19
19
|
|
|
20
20
|
Its `System` contract exposes only desktop-session capabilities: read-only
|
|
21
|
-
System Appearance,
|
|
22
|
-
state, flat public uploads, and unrestricted server-side Fetch.
|
|
21
|
+
System Appearance, mutable preferences local to this Desktop, desktop and
|
|
22
|
+
pointer state, flat public uploads, and unrestricted server-side Fetch.
|
|
23
23
|
`system.appearance.snapshot()` reads complete unresolved authoritative state.
|
|
24
|
-
`system.
|
|
25
|
-
`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
`system.desktopPreferences.snapshot()` reads the complete effective
|
|
25
|
+
`{ theme, animations }` state. Its updates may set either preference explicitly
|
|
26
|
+
or use `"default"` to resume following the native environment. Both capabilities
|
|
27
|
+
expose ordinary live-only `change` subscriptions with no initial replay. A
|
|
28
|
+
Client cannot write authoritative Appearance or discover system-wide Programs
|
|
29
|
+
and Processes.
|
|
29
30
|
|
|
30
31
|
`system.uploads` has the same flat contract as the Server SDK. It writes a
|
|
31
32
|
value, then reads or describes it using exactly one opaque generated file key;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type DesktopPreferencesUpdate } from "@phreshos/core";
|
|
2
|
+
import Events from "./events.js";
|
|
3
|
+
/** Mutable effective preferences local to the current Desktop. */
|
|
4
|
+
export default class ClientDesktopPreferences extends Events {
|
|
5
|
+
constructor();
|
|
6
|
+
snapshot(): Promise<Readonly<{
|
|
7
|
+
theme: import("@phreshos/core").Theme;
|
|
8
|
+
animations: boolean;
|
|
9
|
+
}>>;
|
|
10
|
+
update(preferences: DesktopPreferencesUpdate): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {} from "@phreshos/core";
|
|
2
|
+
import Events from "./events.js";
|
|
3
|
+
import wire from "./wire.js";
|
|
4
|
+
/** Mutable effective preferences local to the current Desktop. */
|
|
5
|
+
export default class ClientDesktopPreferences extends Events {
|
|
6
|
+
constructor() {
|
|
7
|
+
super((event, listener, impossible) => wire.on("host-desktop-preferences", event, value => {
|
|
8
|
+
listener(value);
|
|
9
|
+
}, null, impossible), observer => wire.onAll("host-desktop-preferences", (event, value) => {
|
|
10
|
+
if (typeof event === "string")
|
|
11
|
+
observer(event, value);
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
async snapshot() {
|
|
15
|
+
const [preferences] = await wire.request(["desktopPreferences"]);
|
|
16
|
+
return preferences;
|
|
17
|
+
}
|
|
18
|
+
async update(preferences) {
|
|
19
|
+
await wire.request(["updateDesktopPreferences", preferences]);
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/main.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { type SystemPointer, type PointerEvents, type PointerPosition } from "./
|
|
|
3
3
|
export { type DesktopEvents, type DesktopSize, type SystemDesktop } from "./desktop.js";
|
|
4
4
|
export { current, type Current, type CurrentServer } from "./current.js";
|
|
5
5
|
export { type Channel, type ChannelCapture, type ChannelEvents, type ChannelMessage } from "./channel.js";
|
|
6
|
-
export {
|
|
6
|
+
export { ClientService, ServerService, Service, type ClientServiceChannel, type ServerServiceChannel, type ServiceChannel, type ServiceKey, type ServiceLifecycleEvents } from "@phreshos/core";
|
|
7
7
|
export { Client, Endpoint, Process, Program, Server, type Window, type ProgramProcess, type AnswerCapture, type AnswerMessage, type AnswerObserver, type AskCapture, type AskMessage, type AskObserver, type ClientTraffic, type EndpointTraffic, type ServerTraffic, type TrafficCapture, type TrafficEvents, type TrafficMessage } from "./domain.js";
|
|
8
|
-
export type { Askable, Capture, Captures, ClientDeclaration, Cleanup, DirectoryStat, EndpointDeclaration, EntryStat, EventMessage, EventName, EventObserver, EventOptions, EventSubscriber, Exit, FileStat, Launch, LaunchClient, Layer, LogKind, LogRecord, LogSource, Message, OtherStat, Outcome, PermissionDecision, Permission, Position, Storage, ProgramEvents, ProgramProcessEvents, ProgramProcessExit, ProgramSql, ProgramStore, ProcessEvents, Publishable, SystemUploads, Upload, Size, Subscribable, SubscribableEvents, SubscribableFallback, TimedAskable, TimedPermission, Timeoutable, Appearance, AppearanceEvents, AppearanceSource, AppearanceSurface,
|
|
8
|
+
export type { Askable, Capture, Captures, ClientDeclaration, Cleanup, DirectoryStat, EndpointDeclaration, EntryStat, EventMessage, EventName, EventObserver, EventOptions, EventSubscriber, Exit, FileStat, Launch, LaunchClient, Layer, LogKind, LogRecord, LogSource, Message, OtherStat, Outcome, PermissionDecision, Permission, Position, Storage, ProgramEvents, ProgramProcessEvents, ProgramProcessExit, ProgramSql, ProgramStore, ProcessEvents, Publishable, SystemUploads, Upload, Size, Subscribable, SubscribableEvents, SubscribableFallback, TimedAskable, TimedPermission, Timeoutable, Appearance, AppearanceEvents, AppearanceSource, AppearanceSurface, AnimationsPreference, DesktopPreferences, DesktopPreferencesEvents, DesktopPreferencesUpdate, SystemDesktopPreferences, ThemedValue, Theme, ThemePreference, Value, WindowEvents, WindowGeometry, WindowLayer, WindowState, Easing, LocalWindow, LocalWindowSurface, VisibilityTransition, Transaction } from "@phreshos/core";
|
package/dist/main.js
CHANGED
|
@@ -3,5 +3,5 @@ export {} from "./pointer.js";
|
|
|
3
3
|
export {} from "./desktop.js";
|
|
4
4
|
export { current } from "./current.js";
|
|
5
5
|
export {} from "./channel.js";
|
|
6
|
-
export {
|
|
6
|
+
export { ClientService, ServerService, Service } from "@phreshos/core";
|
|
7
7
|
export { Client, Endpoint, Process, Program, Server } from "./domain.js";
|
package/dist/service.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ClientService, type ServerService, type Service, type ServiceKey } from "@phreshos/core";
|
|
2
2
|
import type { HandleAddress } from "./domain.js";
|
|
3
3
|
export declare function prepareService<EventsMap extends object = {}>(key: ServiceKey & {
|
|
4
4
|
endpoint: "server";
|
|
5
|
-
}):
|
|
5
|
+
}): ServerService<EventsMap>;
|
|
6
6
|
export declare function prepareService<EventsMap extends object = {}>(key: ServiceKey & {
|
|
7
7
|
endpoint: "client";
|
|
8
|
-
}):
|
|
9
|
-
export declare function prepareService(key: ServiceKey):
|
|
8
|
+
}): ClientService<EventsMap>;
|
|
9
|
+
export declare function prepareService(key: ServiceKey): Service;
|
|
10
10
|
export declare function enableCurrentService(name: string): Promise<void>;
|
|
11
11
|
export declare function disableCurrentService(): Promise<void>;
|
|
12
|
-
export declare function endpointService<EventsMap extends object = {}>(target: HandleAddress | null, endpoint: "server"): Promise<
|
|
13
|
-
export declare function endpointService<EventsMap extends object = {}>(target: HandleAddress | null, endpoint: "client"): Promise<
|
|
14
|
-
export declare function endpointService(target: HandleAddress | null, endpoint: "server" | "client"): Promise<
|
|
12
|
+
export declare function endpointService<EventsMap extends object = {}>(target: HandleAddress | null, endpoint: "server"): Promise<ServerService<EventsMap> | null>;
|
|
13
|
+
export declare function endpointService<EventsMap extends object = {}>(target: HandleAddress | null, endpoint: "client"): Promise<ClientService<EventsMap> | null>;
|
|
14
|
+
export declare function endpointService(target: HandleAddress | null, endpoint: "server" | "client"): Promise<Service | null>;
|
package/dist/service.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientService as CoreClientService, ServerService as CoreServerService, isServiceKey } from "@phreshos/core";
|
|
2
2
|
import Deadline from "./deadline.js";
|
|
3
3
|
import Events from "./events.js";
|
|
4
4
|
import HandleRegistry from "./handle-registry.js";
|
|
5
5
|
import wire from "./wire.js";
|
|
6
6
|
const handles = new HandleRegistry();
|
|
7
|
-
const ServerServiceBase =
|
|
8
|
-
const ClientServiceBase =
|
|
7
|
+
const ServerServiceBase = CoreServerService;
|
|
8
|
+
const ClientServiceBase = CoreClientService;
|
|
9
9
|
class ServerChannelHandle extends Events {
|
|
10
10
|
key;
|
|
11
11
|
constructor(key) {
|
package/dist/system.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { AppearanceSource,
|
|
1
|
+
import type { AppearanceSource, ClientService, SystemDesktopPreferences, ServerService, ServiceKey, SystemUploads } from "@phreshos/core";
|
|
2
2
|
import { type SystemPointer } from "./pointer.js";
|
|
3
3
|
import { type SystemDesktop } from "./desktop.js";
|
|
4
4
|
type ServiceEndpoint = ServiceKey["endpoint"];
|
|
5
5
|
type ServiceAddress<Endpoint extends ServiceEndpoint> = Omit<ServiceKey, "endpoint"> & Readonly<{
|
|
6
6
|
endpoint: Endpoint;
|
|
7
7
|
}>;
|
|
8
|
-
type ServiceHandle<Endpoint extends ServiceEndpoint, Events extends object> = Endpoint extends "server" ?
|
|
8
|
+
type ServiceHandle<Endpoint extends ServiceEndpoint, Events extends object> = Endpoint extends "server" ? ServerService<Events> : ClientService<Events>;
|
|
9
9
|
/** Desktop capabilities structurally available to a Client endpoint. */
|
|
10
10
|
export interface System {
|
|
11
11
|
/** Complete unresolved Appearance read from the System authority. */
|
|
12
12
|
readonly appearance: AppearanceSource;
|
|
13
|
-
/** Mutable effective
|
|
14
|
-
readonly
|
|
13
|
+
/** Mutable effective preferences local to this Desktop. */
|
|
14
|
+
readonly desktopPreferences: SystemDesktopPreferences;
|
|
15
15
|
/** Layer-independent desktop size reads and live updates. */
|
|
16
16
|
readonly desktop: SystemDesktop;
|
|
17
17
|
/** Permission-guarded desktop pointer reads and live movement. */
|
|
@@ -23,9 +23,9 @@ export interface System {
|
|
|
23
23
|
/** Returns a precisely typed stable handle for either service endpoint. */
|
|
24
24
|
service<Endpoint extends ServiceEndpoint>(key: ServiceAddress<Endpoint>): ServiceHandle<Endpoint, {}>;
|
|
25
25
|
/** Returns a typed stable handle for one exact Server service identity. */
|
|
26
|
-
service<ServiceEvents extends object>(key: ServiceAddress<"server">):
|
|
26
|
+
service<ServiceEvents extends object>(key: ServiceAddress<"server">): ServerService<ServiceEvents>;
|
|
27
27
|
/** Returns a typed stable handle for one exact Client service identity. */
|
|
28
|
-
service<ServiceEvents extends object>(key: ServiceAddress<"client">):
|
|
28
|
+
service<ServiceEvents extends object>(key: ServiceAddress<"client">): ClientService<ServiceEvents>;
|
|
29
29
|
}
|
|
30
30
|
/** Desktop capabilities available to this Client. */
|
|
31
31
|
export declare const system: System;
|
package/dist/system.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ClientAppearance from "./appearance.js";
|
|
2
|
-
import
|
|
2
|
+
import ClientDesktopPreferences from "./desktop-preferences.js";
|
|
3
3
|
import wire from "./wire.js";
|
|
4
4
|
import ClientPointer, {} from "./pointer.js";
|
|
5
5
|
import ClientDesktop, {} from "./desktop.js";
|
|
@@ -8,7 +8,7 @@ import { uploads } from "./uploads.js";
|
|
|
8
8
|
import controlledStream from "./controlled-stream.js";
|
|
9
9
|
class ClientSystem {
|
|
10
10
|
appearance = new ClientAppearance();
|
|
11
|
-
|
|
11
|
+
desktopPreferences = new ClientDesktopPreferences();
|
|
12
12
|
desktop = new ClientDesktop();
|
|
13
13
|
pointer = new ClientPointer();
|
|
14
14
|
uploads = uploads;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "The SDK used by a Program's client endpoint.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"prepack": "node --run build"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@phreshos/core": "^0.1.
|
|
50
|
+
"@phreshos/core": "^0.1.24"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@msgpack/msgpack": "^3.1.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@phreshos/core": "^0.1.
|
|
56
|
+
"@phreshos/core": "^0.1.24",
|
|
57
57
|
"typescript": "^6.0.3"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/dist/theme.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Theme, type ThemePreference } from "@phreshos/core";
|
|
2
|
-
import Events from "./events.js";
|
|
3
|
-
/** Mutable Theme local to the current Desktop. */
|
|
4
|
-
export default class ClientTheme extends Events {
|
|
5
|
-
constructor();
|
|
6
|
-
snapshot(): Promise<Theme>;
|
|
7
|
-
update(theme: ThemePreference): Promise<void>;
|
|
8
|
-
}
|
package/dist/theme.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {} from "@phreshos/core";
|
|
2
|
-
import Events from "./events.js";
|
|
3
|
-
import wire from "./wire.js";
|
|
4
|
-
/** Mutable Theme local to the current Desktop. */
|
|
5
|
-
export default class ClientTheme extends Events {
|
|
6
|
-
constructor() {
|
|
7
|
-
super((event, listener, impossible) => wire.on("host-theme", event, value => listener(value), null, impossible), observer => wire.onAll("host-theme", (event, value) => {
|
|
8
|
-
if (typeof event === "string")
|
|
9
|
-
observer(event, value);
|
|
10
|
-
}));
|
|
11
|
-
}
|
|
12
|
-
async snapshot() {
|
|
13
|
-
const [theme] = await wire.request(["theme"]);
|
|
14
|
-
return theme;
|
|
15
|
-
}
|
|
16
|
-
async update(theme) {
|
|
17
|
-
await wire.request(["update-theme", theme]);
|
|
18
|
-
}
|
|
19
|
-
}
|