@phreshos/core 0.1.0 → 0.1.2
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/LICENSE +19 -0
- package/README.md +252 -75
- package/dist/askable.d.ts +5 -1
- package/dist/channel.d.ts +3 -2
- package/dist/client.d.ts +5 -5
- package/dist/color.d.ts +10 -0
- package/dist/color.js +14 -0
- package/dist/config.d.ts +22 -11
- package/dist/config.js +0 -6
- package/dist/endpoint.d.ts +6 -5
- package/dist/launch.d.ts +12 -2
- package/dist/main.d.ts +11 -4
- package/dist/main.js +8 -1
- package/dist/outcome.d.ts +4 -0
- package/dist/permissions.d.ts +34 -0
- package/dist/permissions.js +6 -0
- package/dist/process.d.ts +5 -9
- package/dist/program.d.ts +24 -14
- package/dist/publishable.d.ts +5 -1
- package/dist/scale.d.ts +12 -0
- package/dist/scale.js +29 -0
- package/dist/server.d.ts +4 -4
- package/dist/sql.d.ts +7 -0
- package/dist/storage.d.ts +10 -0
- package/dist/subscribable.d.ts +32 -3
- package/dist/theme.d.ts +132 -0
- package/dist/theme.js +34 -0
- package/dist/timeout.d.ts +5 -0
- package/dist/timeout.js +0 -0
- package/dist/value.d.ts +17 -0
- package/dist/value.js +118 -0
- package/dist/wallpaper.d.ts +30 -0
- package/dist/wallpaper.js +0 -0
- package/dist/window.d.ts +41 -12
- package/dist/window.js +0 -4
- package/package.json +35 -9
- package/source/askable.ts +0 -26
- package/source/channel.ts +0 -28
- package/source/client.ts +0 -29
- package/source/config.ts +0 -104
- package/source/endpoint.ts +0 -95
- package/source/launch.ts +0 -43
- package/source/main.ts +0 -65
- package/source/outcome.ts +0 -4
- package/source/process.ts +0 -77
- package/source/program.ts +0 -130
- package/source/publishable.ts +0 -33
- package/source/served-file.ts +0 -14
- package/source/server.ts +0 -58
- package/source/sql.ts +0 -36
- package/source/storage.ts +0 -66
- package/source/subscribable.ts +0 -94
- package/source/window.ts +0 -82
package/dist/main.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
export { type Message, type Cleanup, type Capture, type Captures, type EventMessage, type EventName, type EventObserver, type EventOptions, type EventSubscriber, type Subscribable } from "./subscribable.js";
|
|
1
|
+
export { type Message, type Cleanup, type Capture, type Captures, type EventMessage, type EventName, type EventObserver, type EventOptions, type EventSubscriber, type Subscribable, type SubscribableEvents, type SubscribableFallback } from "./subscribable.js";
|
|
2
2
|
export { type Publishable } from "./publishable.js";
|
|
3
|
+
export { type Timeoutable } from "./timeout.js";
|
|
3
4
|
export { type Askable, type TimedAskable } from "./askable.js";
|
|
5
|
+
export { isPermissionName, permissionNames, type PermissionDecision, type PermissionDecisions, type PermissionName, type Permissions, type ProgramPermissions, type TimedPermissions } from "./permissions.js";
|
|
4
6
|
export { type Outcome } from "./outcome.js";
|
|
5
7
|
export { type ServedFile } from "./served-file.js";
|
|
8
|
+
export { type DesktopWallpaper, type FileWallpaper, type WallpaperLaunch } from "./wallpaper.js";
|
|
9
|
+
export { isRelativeValue, parseRelativeValue, type RelativeValue, type Value } from "./value.js";
|
|
10
|
+
export { color, type ColorLevel, type ColorScale } from "./color.js";
|
|
11
|
+
export { isScaleLevel, numericScale, scale, scaleMultiplier, type NumericScale, type ScaleLevel } from "./scale.js";
|
|
12
|
+
export { createThemeSnapshot, standardTheme, themeLimits, type Colorable, type Elevatable, type Shapeable, type Sizable, type Theme, type ThemeEvents, type ThemeGlass, type ThemeProperties, type ThemeRange, type Variantable, type WritableTheme } from "./theme.js";
|
|
6
13
|
export { type DirectoryStat, type EntryStat, type FileStat, type OtherStat, type ProgramArea, type ProgramStore } from "./storage.js";
|
|
7
14
|
export { type LogKind, type LogRecord, type LogSource, type ProgramSql } from "./sql.js";
|
|
8
15
|
export { Endpoint, type AskCapture, type AskMessage, type AskObserver, type EndpointTraffic, type TrafficCapture, type TrafficEvents, type TrafficMessage } from "./endpoint.js";
|
|
@@ -10,7 +17,7 @@ export { type Channel, type ChannelCapture, type ChannelEvents, type ChannelMess
|
|
|
10
17
|
export { Server, type AnswerCapture, type AnswerMessage, type AnswerObserver, type ServerTraffic } from "./server.js";
|
|
11
18
|
export { Client, type ClientTraffic } from "./client.js";
|
|
12
19
|
export { Process, type Exit, type ProcessEvents } from "./process.js";
|
|
13
|
-
export { Program, type ClientDeclaration, type EndpointDeclaration, type ProgramEvents, type
|
|
14
|
-
export { Window, type WindowEvents, type WindowState } from "./window.js";
|
|
15
|
-
export { layers, type Launch, type LaunchClient, type Layer, type Position, type Size
|
|
20
|
+
export { Program, type ClientDeclaration, type EndpointDeclaration, type ProgramEvents, type ProgramIconSize, type ProgramProcessExit } from "./program.js";
|
|
21
|
+
export { type Window, type WindowEvents, type WindowLayer, type WindowState, type WindowSurface, type WindowSurfaceEasing, type WindowSurfaceSettings, type WindowSurfaceTransaction } from "./window.js";
|
|
22
|
+
export { layers, type Launch, type LaunchClient, type Layer, type Position, type Size } from "./launch.js";
|
|
16
23
|
export { defineConfig, type ClientConfig, type ClientDevelopment, type Config, type ServerConfig, type ServerDevelopment } from "./config.js";
|
package/dist/main.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export {} from "./subscribable.js";
|
|
2
2
|
export {} from "./publishable.js";
|
|
3
|
+
export {} from "./timeout.js";
|
|
3
4
|
export {} from "./askable.js";
|
|
5
|
+
export { isPermissionName, permissionNames } from "./permissions.js";
|
|
4
6
|
export {} from "./outcome.js";
|
|
5
7
|
export {} from "./served-file.js";
|
|
8
|
+
export {} from "./wallpaper.js";
|
|
9
|
+
export { isRelativeValue, parseRelativeValue } from "./value.js";
|
|
10
|
+
export { color } from "./color.js";
|
|
11
|
+
export { isScaleLevel, numericScale, scale, scaleMultiplier } from "./scale.js";
|
|
12
|
+
export { createThemeSnapshot, standardTheme, themeLimits } from "./theme.js";
|
|
6
13
|
export {} from "./storage.js";
|
|
7
14
|
export {} from "./sql.js";
|
|
8
15
|
export { Endpoint } from "./endpoint.js";
|
|
@@ -11,6 +18,6 @@ export { Server } from "./server.js";
|
|
|
11
18
|
export { Client } from "./client.js";
|
|
12
19
|
export { Process } from "./process.js";
|
|
13
20
|
export { Program } from "./program.js";
|
|
14
|
-
export {
|
|
21
|
+
export {} from "./window.js";
|
|
15
22
|
export { layers } from "./launch.js";
|
|
16
23
|
export { defineConfig } from "./config.js";
|
package/dist/outcome.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/** The transport-neutral result of an operation that may fail. */
|
|
2
2
|
export type Outcome<Result = unknown> = Readonly<{
|
|
3
|
+
/** Indicates that the operation completed successfully. */
|
|
3
4
|
success: true;
|
|
5
|
+
/** Value returned by the successful operation. */
|
|
4
6
|
result: Result;
|
|
5
7
|
}> | Readonly<{
|
|
8
|
+
/** Indicates that the operation failed. */
|
|
6
9
|
success: false;
|
|
10
|
+
/** Transport-safe description of the failure. */
|
|
7
11
|
error: string;
|
|
8
12
|
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Timeoutable } from "./timeout.js";
|
|
2
|
+
/** Every permission recognized by this system release. */
|
|
3
|
+
export declare const permissionNames: readonly ["pointer"];
|
|
4
|
+
/** The finite system-wide name of one permission. */
|
|
5
|
+
export type PermissionName = typeof permissionNames[number];
|
|
6
|
+
/** Persistent decisions may exist for any subset of system permissions. */
|
|
7
|
+
export type PermissionDecisions = Partial<Record<PermissionName, boolean>>;
|
|
8
|
+
/** Validates an unknown value against the authoritative permission registry. */
|
|
9
|
+
export declare function isPermissionName(value: unknown): value is PermissionName;
|
|
10
|
+
/** The effective decision for one permission, or `null` when none is known. */
|
|
11
|
+
export type PermissionDecision = boolean | null;
|
|
12
|
+
/** Permission requests using one caller-selected deadline. */
|
|
13
|
+
export interface TimedPermissions {
|
|
14
|
+
/** Requests one permission, resolving `null` if the deadline expires. */
|
|
15
|
+
request(name: PermissionName): Promise<PermissionDecision>;
|
|
16
|
+
}
|
|
17
|
+
/** Client access to the current Process's permissions. */
|
|
18
|
+
export interface Permissions extends Timeoutable<TimedPermissions> {
|
|
19
|
+
/** Reads the effective decision without prompting the user. */
|
|
20
|
+
granted(name: PermissionName): Promise<PermissionDecision>;
|
|
21
|
+
/** Requests a decision from the user. The default deadline is 30 seconds. */
|
|
22
|
+
request(name: PermissionName): Promise<PermissionDecision>;
|
|
23
|
+
}
|
|
24
|
+
/** Server-side management of one Program's persistent permission decisions. */
|
|
25
|
+
export interface ProgramPermissions {
|
|
26
|
+
/** Reads one persistent decision, or `undefined` when none is stored. */
|
|
27
|
+
get(name: PermissionName): Promise<boolean | undefined>;
|
|
28
|
+
/** Returns an independent snapshot of every persistent decision. */
|
|
29
|
+
getAll(): Promise<PermissionDecisions>;
|
|
30
|
+
/** Stores one persistent decision. */
|
|
31
|
+
set(name: PermissionName, value: boolean): Promise<void>;
|
|
32
|
+
/** Removes one persistent decision. */
|
|
33
|
+
delete(name: PermissionName): Promise<void>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Every permission recognized by this system release. */
|
|
2
|
+
export const permissionNames = ["pointer"];
|
|
3
|
+
/** Validates an unknown value against the authoritative permission registry. */
|
|
4
|
+
export function isPermissionName(value) {
|
|
5
|
+
return permissionNames.some(name => name === value);
|
|
6
|
+
}
|
package/dist/process.d.ts
CHANGED
|
@@ -13,20 +13,16 @@ export type Exit = Readonly<{
|
|
|
13
13
|
}>;
|
|
14
14
|
/** Lifecycle events emitted by one Process. */
|
|
15
15
|
export type ProcessEvents = {
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/** The authoritative Client state was created. */
|
|
21
|
-
clientStart: undefined;
|
|
22
|
-
/** The authoritative Client state ended. */
|
|
23
|
-
clientStop: undefined;
|
|
16
|
+
/** One declared Endpoint entered a new live incarnation. */
|
|
17
|
+
endpointStart: Server | Client;
|
|
18
|
+
/** One live Endpoint incarnation ended. */
|
|
19
|
+
endpointStop: Server | Client;
|
|
24
20
|
/** The complete Process ended. */
|
|
25
21
|
exit: Exit;
|
|
26
22
|
};
|
|
27
23
|
/** One live execution of a Program. */
|
|
28
24
|
export declare class Process<Events extends object = {}> {
|
|
29
|
-
constructor();
|
|
25
|
+
protected constructor();
|
|
30
26
|
}
|
|
31
27
|
export interface Process<Events extends object = {}> extends Subscribable<ProcessEvents & Events, never> {
|
|
32
28
|
/** Immutable runtime identity. */
|
package/dist/program.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { Exit, Process } from "./process.js";
|
|
|
3
3
|
import type { ProgramSql } from "./sql.js";
|
|
4
4
|
import type { ProgramArea, ProgramStore } from "./storage.js";
|
|
5
5
|
import type { Subscribable } from "./subscribable.js";
|
|
6
|
+
/** Standard rendered sizes available for every Program icon. */
|
|
7
|
+
export type ProgramIconSize = "small" | "medium" | "large";
|
|
6
8
|
/** Resolved declaration shared by Server and Client endpoint kinds. */
|
|
7
9
|
export type EndpointDeclaration = Readonly<{
|
|
8
10
|
/** Whether a default Process starts this declared Endpoint. */
|
|
@@ -21,24 +23,17 @@ export type ClientDeclaration = EndpointDeclaration & Readonly<{
|
|
|
21
23
|
/** Default minimized state, or `null` for the system default. */
|
|
22
24
|
minimize: boolean | null;
|
|
23
25
|
}>;
|
|
26
|
+
/** A Process exit scoped to its owning Program. */
|
|
24
27
|
export type ProgramProcessExit = Exit & Readonly<{
|
|
25
28
|
/** Process that ended. */
|
|
26
29
|
process: Process;
|
|
27
30
|
}>;
|
|
28
|
-
export type ProgramServerStop = Omit<Exit, "status"> & Readonly<{
|
|
29
|
-
/** Process whose Server incarnation ended. */
|
|
30
|
-
process: Process;
|
|
31
|
-
}>;
|
|
32
31
|
/** Lifecycle events scoped to one Program. */
|
|
33
32
|
export type ProgramEvents = {
|
|
34
|
-
/** One Process
|
|
35
|
-
|
|
36
|
-
/** One Process
|
|
37
|
-
|
|
38
|
-
/** One Process's Client state was created. */
|
|
39
|
-
clientStart: Process;
|
|
40
|
-
/** One Process's Client state ended. */
|
|
41
|
-
clientStop: Process;
|
|
33
|
+
/** One Process Endpoint entered a new live incarnation. */
|
|
34
|
+
endpointStart: Process["server"] | Process["client"];
|
|
35
|
+
/** One Process Endpoint incarnation ended. */
|
|
36
|
+
endpointStop: Process["server"] | Process["client"];
|
|
42
37
|
/** A Process entered this Program's runtime set. */
|
|
43
38
|
processCreate: Process;
|
|
44
39
|
/** A Process left this Program's runtime set. */
|
|
@@ -47,12 +42,13 @@ export type ProgramEvents = {
|
|
|
47
42
|
forget: undefined;
|
|
48
43
|
/** This Program left the installed state. */
|
|
49
44
|
uninstall: Readonly<{
|
|
45
|
+
/** Whether every installed resource, including storage, was removed. */
|
|
50
46
|
everythingRemoved: boolean;
|
|
51
47
|
}>;
|
|
52
48
|
};
|
|
53
49
|
/** The stable domain root from which Processes are created. */
|
|
54
50
|
export declare class Program<Events extends object = {}> {
|
|
55
|
-
constructor();
|
|
51
|
+
protected constructor();
|
|
56
52
|
}
|
|
57
53
|
export interface Program<Events extends object = {}> extends Subscribable<ProgramEvents & Events, never> {
|
|
58
54
|
/** Stable public identity. */
|
|
@@ -79,12 +75,26 @@ export interface Program<Events extends object = {}> extends Subscribable<Progra
|
|
|
79
75
|
readonly database: ProgramSql;
|
|
80
76
|
/** Returns every live Process of this Program available to this SDK. */
|
|
81
77
|
processes(): Promise<Process[]>;
|
|
78
|
+
/** Returns the earliest-started live Process, or `null` when none exist. */
|
|
79
|
+
firstProcess(): Promise<Process | null>;
|
|
80
|
+
/** Returns the latest-started live Process, or `null` when none exist. */
|
|
81
|
+
lastProcess(): Promise<Process | null>;
|
|
82
82
|
/** Finds a live Process by identity or Program-local name. */
|
|
83
83
|
getProcess(identityOrName: string): Promise<Process | null>;
|
|
84
84
|
/** Creates one Process of this Program. */
|
|
85
85
|
createProcess(launch?: Launch): Promise<Process>;
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Returns the Program-authored API entry point, or `null`.
|
|
88
|
+
* The document describes the Program's contract, not system mechanics.
|
|
89
|
+
*/
|
|
87
90
|
apiDocs(): Promise<string | null>;
|
|
91
|
+
/**
|
|
92
|
+
* Returns one standard PNG representation of this Program's icon.
|
|
93
|
+
* Programs without an authored icon receive the system default.
|
|
94
|
+
*
|
|
95
|
+
* @param size Rendered size. Omission selects `medium`.
|
|
96
|
+
*/
|
|
97
|
+
icon(size?: ProgramIconSize): Promise<Blob>;
|
|
88
98
|
/** Returns whether this Program currently has an installed form. */
|
|
89
99
|
installed(): Promise<boolean>;
|
|
90
100
|
/** Removes this Program's installed form. */
|
package/dist/publishable.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ type CompatibleEvent<Events extends object, Fallback, Payload> = {
|
|
|
5
5
|
[Event in EventName<Events>]: Payload extends Events[Event] ? Event : never;
|
|
6
6
|
}[EventName<Events>] | ([Fallback] extends [never] ? never : Payload extends Fallback ? OpenEvent : never);
|
|
7
7
|
interface Publish<Events extends object, Fallback> {
|
|
8
|
+
/** Publishes `undefined` to one named event on this target. */
|
|
9
|
+
<Event extends CompatibleEvent<Events, Fallback, undefined>>(event: Event): void;
|
|
10
|
+
/** Publishes one payload to one named event on this target. */
|
|
8
11
|
<Payload, Event extends CompatibleEvent<Events, Fallback, Payload> = CompatibleEvent<Events, Fallback, Payload>>(event: Event, payload: Payload): void;
|
|
12
|
+
/** Publishes one payload to one named event on this target. */
|
|
9
13
|
<Event extends AvailableEvent<Events, Fallback>>(event: Event, payload: EventMessage<Events, Fallback, Event>): void;
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
@@ -15,7 +19,7 @@ interface Publish<Events extends object, Fallback> {
|
|
|
15
19
|
* silently drops the publication; no delivery result is produced.
|
|
16
20
|
*/
|
|
17
21
|
export interface Publishable<Events extends object = {}, Fallback = unknown> {
|
|
18
|
-
/** Publishes one payload to one named event
|
|
22
|
+
/** Publishes one payload, or `undefined` when omitted, to one named event. */
|
|
19
23
|
publish: Publish<Events, Fallback>;
|
|
20
24
|
}
|
|
21
25
|
export {};
|
package/dist/scale.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A visual level derived around one concrete default value. */
|
|
2
|
+
export type ScaleLevel = "xsmall" | "small" | "medium" | "large" | "xlarge";
|
|
3
|
+
/** Every numeric level derived around one concrete default value. */
|
|
4
|
+
export type NumericScale = Readonly<Record<ScaleLevel, number>>;
|
|
5
|
+
/** Returns whether a value names one of the system's derived visual levels. */
|
|
6
|
+
export declare function isScaleLevel(value: unknown): value is ScaleLevel;
|
|
7
|
+
/** Derives one visual level around a concrete default value. */
|
|
8
|
+
export declare function scale(value: number, level: ScaleLevel): number;
|
|
9
|
+
/** Derives the complete visual scale around one concrete default value. */
|
|
10
|
+
export declare function numericScale(value: number): NumericScale;
|
|
11
|
+
/** Derives a multiplier while preserving its neutral value of one. */
|
|
12
|
+
export declare function scaleMultiplier(value: number, level: ScaleLevel): number;
|
package/dist/scale.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const factors = Object.freeze({
|
|
2
|
+
xsmall: 0.25,
|
|
3
|
+
small: 0.5,
|
|
4
|
+
medium: 1,
|
|
5
|
+
large: 1.5,
|
|
6
|
+
xlarge: 2
|
|
7
|
+
});
|
|
8
|
+
/** Returns whether a value names one of the system's derived visual levels. */
|
|
9
|
+
export function isScaleLevel(value) {
|
|
10
|
+
return value === "xsmall" || value === "small" || value === "medium" || value === "large" || value === "xlarge";
|
|
11
|
+
}
|
|
12
|
+
/** Derives one visual level around a concrete default value. */
|
|
13
|
+
export function scale(value, level) {
|
|
14
|
+
return value * factors[level];
|
|
15
|
+
}
|
|
16
|
+
/** Derives the complete visual scale around one concrete default value. */
|
|
17
|
+
export function numericScale(value) {
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
xsmall: scale(value, "xsmall"),
|
|
20
|
+
small: scale(value, "small"),
|
|
21
|
+
medium: scale(value, "medium"),
|
|
22
|
+
large: scale(value, "large"),
|
|
23
|
+
xlarge: scale(value, "xlarge")
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Derives a multiplier while preserving its neutral value of one. */
|
|
27
|
+
export function scaleMultiplier(value, level) {
|
|
28
|
+
return 1 + (value - 1) * factors[level];
|
|
29
|
+
}
|
package/dist/server.d.ts
CHANGED
|
@@ -20,23 +20,23 @@ export type AnswerCapture<Result = unknown, To = Endpoint> = Readonly<{
|
|
|
20
20
|
}>;
|
|
21
21
|
/** A callback that observes answers sent by this Server. */
|
|
22
22
|
export type AnswerObserver<Result = unknown, To = Endpoint> = (capture: AnswerCapture<Result, To>) => unknown;
|
|
23
|
-
/**
|
|
23
|
+
/** Directed communication originating from one Server, including its answers. */
|
|
24
24
|
export interface ServerTraffic<Events extends object = {}, To = Endpoint, AskTo = Server> extends EndpointTraffic<Events, To, AskTo> {
|
|
25
25
|
/** Observes answers originating from this Server. */
|
|
26
26
|
observeAnswers<Result = unknown>(observer: AnswerObserver<Result, To>): Cleanup;
|
|
27
27
|
}
|
|
28
28
|
/** The server Endpoint of a Process. */
|
|
29
29
|
export declare class Server<Events extends object = {}> extends Endpoint<Events> {
|
|
30
|
-
constructor();
|
|
30
|
+
protected constructor();
|
|
31
31
|
}
|
|
32
32
|
export interface Server<Events extends object = {}> extends Askable {
|
|
33
|
-
/**
|
|
33
|
+
/** Directed communication originating from this Server. */
|
|
34
34
|
readonly traffic: ServerTraffic<Events>;
|
|
35
35
|
/**
|
|
36
36
|
* Waits until a Server incarnation is ready.
|
|
37
37
|
*
|
|
38
38
|
* Temporary absence remains waitable when the Program declares a Server.
|
|
39
39
|
* The SDK uses its ten-second deadline unless one is supplied.
|
|
40
|
-
|
|
40
|
+
*/
|
|
41
41
|
waitReady(timeout?: number): Promise<void>;
|
|
42
42
|
}
|
package/dist/sql.d.ts
CHANGED
|
@@ -7,11 +7,18 @@ export interface ProgramSql {
|
|
|
7
7
|
}
|
|
8
8
|
/** One captured line from a Program endpoint. */
|
|
9
9
|
export type LogRecord = Readonly<{
|
|
10
|
+
/** Capture time as Unix milliseconds. */
|
|
10
11
|
createdAt: number;
|
|
12
|
+
/** Runtime identity of the Process that produced the line. */
|
|
11
13
|
process: string;
|
|
14
|
+
/** Endpoint kind that produced the line. */
|
|
12
15
|
source: LogSource;
|
|
16
|
+
/** Logging method or stream represented by the line. */
|
|
13
17
|
kind: LogKind;
|
|
18
|
+
/** Text captured from the Endpoint. */
|
|
14
19
|
content: string;
|
|
15
20
|
}>;
|
|
21
|
+
/** Endpoint kind capable of producing a captured log line. */
|
|
16
22
|
export type LogSource = "client" | "server";
|
|
23
|
+
/** Standard and application-defined kinds of captured output. */
|
|
17
24
|
export type LogKind = "debug" | "log" | "info" | "warn" | "error" | "stdout" | "stderr" | "exit" | (string & {});
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
/** Metadata returned for an entry in Program-owned filesystem storage. */
|
|
2
2
|
export type EntryStat = FileStat | DirectoryStat | OtherStat;
|
|
3
|
+
/** Metadata for one file. */
|
|
3
4
|
export type FileStat = Readonly<{
|
|
5
|
+
/** Discriminator for file metadata. */
|
|
4
6
|
kind: "file";
|
|
7
|
+
/** File size in bytes. */
|
|
5
8
|
size: number;
|
|
9
|
+
/** Last modification time as Unix milliseconds. */
|
|
6
10
|
modifiedAt: number;
|
|
7
11
|
}>;
|
|
12
|
+
/** Metadata for one directory. */
|
|
8
13
|
export type DirectoryStat = Readonly<{
|
|
14
|
+
/** Discriminator for directory metadata. */
|
|
9
15
|
kind: "directory";
|
|
16
|
+
/** Last modification time as Unix milliseconds. */
|
|
10
17
|
modifiedAt: number;
|
|
11
18
|
}>;
|
|
19
|
+
/** Metadata for a filesystem entry that is neither a file nor a directory. */
|
|
12
20
|
export type OtherStat = Readonly<{
|
|
21
|
+
/** Discriminator for other filesystem metadata. */
|
|
13
22
|
kind: "other";
|
|
23
|
+
/** Last modification time as Unix milliseconds. */
|
|
14
24
|
modifiedAt: number;
|
|
15
25
|
}>;
|
|
16
26
|
/** Filesystem-like storage owned by one Program. */
|
package/dist/subscribable.d.ts
CHANGED
|
@@ -21,6 +21,19 @@ export type EventSubscriber<Message> = (message: Message) => unknown;
|
|
|
21
21
|
export type EventObserver<Events extends object, Fallback = never> = (capture: Captures<Events, Fallback>) => unknown;
|
|
22
22
|
/** Removes exactly one persistent registration. Safe to call more than once. */
|
|
23
23
|
export type Cleanup = () => void;
|
|
24
|
+
declare const definition: unique symbol;
|
|
25
|
+
type Definition<Events extends object, Fallback> = Readonly<{
|
|
26
|
+
events: Events;
|
|
27
|
+
fallback: Fallback;
|
|
28
|
+
}>;
|
|
29
|
+
/** Extracts the declared event map from a Subscribable type. */
|
|
30
|
+
export type SubscribableEvents<Target> = Target extends {
|
|
31
|
+
readonly [definition]?: Definition<infer Events, unknown>;
|
|
32
|
+
} ? Events : never;
|
|
33
|
+
/** Extracts the fallback message from a Subscribable type. */
|
|
34
|
+
export type SubscribableFallback<Target> = Target extends {
|
|
35
|
+
readonly [definition]?: Definition<object, infer Fallback>;
|
|
36
|
+
} ? Fallback : never;
|
|
24
37
|
/** Options controlling one asynchronous event iterator. */
|
|
25
38
|
export type EventOptions = Readonly<{
|
|
26
39
|
/** Maximum queued messages. Defaults to `64`; `Infinity` removes the bound. */
|
|
@@ -30,22 +43,36 @@ export type EventOptions = Readonly<{
|
|
|
30
43
|
}>;
|
|
31
44
|
type OpenEvent = string & {};
|
|
32
45
|
type AvailableEvent<Events extends object, Fallback> = EventName<Events> | ([Fallback] extends [never] ? never : OpenEvent);
|
|
46
|
+
type InferredEvent<Event extends string> = string extends Event ? never : Event;
|
|
33
47
|
type CompatibleEvent<Events extends object, Fallback, Narrowed> = {
|
|
34
48
|
[Event in EventName<Events>]: Narrowed extends Events[Event] ? Event : never;
|
|
35
49
|
}[EventName<Events>] | ([Fallback] extends [never] ? never : Narrowed extends Fallback ? OpenEvent : never);
|
|
36
50
|
interface Subscribe<Events extends object, Fallback> {
|
|
51
|
+
/** Registers one persistent named-event subscription and returns its cleanup. */
|
|
52
|
+
<Event extends AvailableEvent<Events, Fallback>>(event: InferredEvent<Event>, subscriber: EventSubscriber<EventMessage<Events, Fallback, Event>>): Cleanup;
|
|
53
|
+
/** Registers one persistent named-event subscription and returns its cleanup. */
|
|
37
54
|
<Narrowed>(event: CompatibleEvent<Events, Fallback, Narrowed>, subscriber: EventSubscriber<Narrowed>): Cleanup;
|
|
38
|
-
|
|
55
|
+
/** Registers one persistent named-event subscription and returns its cleanup. */
|
|
56
|
+
(event: [Fallback] extends [never] ? never : OpenEvent, subscriber: EventSubscriber<Fallback>): Cleanup;
|
|
39
57
|
}
|
|
40
58
|
interface WaitFor<Events extends object, Fallback> {
|
|
59
|
+
/** Waits for the next matching message. */
|
|
41
60
|
<Narrowed>(event: CompatibleEvent<Events, Fallback, Narrowed>, timeout?: number): Promise<Narrowed>;
|
|
42
|
-
|
|
61
|
+
/** Waits for the next matching message. */
|
|
62
|
+
<Event extends AvailableEvent<Events, Fallback>>(event: InferredEvent<Event>, timeout?: number): Promise<EventMessage<Events, Fallback, Event>>;
|
|
63
|
+
/** Waits for the next matching message. */
|
|
64
|
+
(event: [Fallback] extends [never] ? never : OpenEvent, timeout?: number): Promise<Fallback>;
|
|
43
65
|
}
|
|
44
66
|
interface EventStream<Events extends object, Fallback> {
|
|
67
|
+
/** Iterates matching messages until closed, aborted, or impossible. */
|
|
45
68
|
<Narrowed>(event: CompatibleEvent<Events, Fallback, Narrowed>, options?: EventOptions): AsyncIterableIterator<Narrowed>;
|
|
46
|
-
|
|
69
|
+
/** Iterates matching messages until closed, aborted, or impossible. */
|
|
70
|
+
<Event extends AvailableEvent<Events, Fallback>>(event: InferredEvent<Event>, options?: EventOptions): AsyncIterableIterator<EventMessage<Events, Fallback, Event>>;
|
|
71
|
+
/** Iterates matching messages until closed, aborted, or impossible. */
|
|
72
|
+
(event: [Fallback] extends [never] ? never : OpenEvent, options?: EventOptions): AsyncIterableIterator<Fallback>;
|
|
47
73
|
}
|
|
48
74
|
interface Observe<Events extends object, Fallback> {
|
|
75
|
+
/** Registers one persistent observer across every event and returns its cleanup. */
|
|
49
76
|
(observer: EventObserver<Events, Fallback>): Cleanup;
|
|
50
77
|
}
|
|
51
78
|
/**
|
|
@@ -60,6 +87,8 @@ interface Observe<Events extends object, Fallback> {
|
|
|
60
87
|
* signal aborts, or the boundary proves that future delivery is impossible.
|
|
61
88
|
*/
|
|
62
89
|
export interface Subscribable<Events extends object = {}, Fallback = unknown> {
|
|
90
|
+
/** @internal Preserves this contract's declared types for SDK adapters. */
|
|
91
|
+
readonly [definition]?: Definition<Events, Fallback>;
|
|
63
92
|
/** Registers one persistent named-event subscription. */
|
|
64
93
|
subscribe: Subscribe<Events, Fallback>;
|
|
65
94
|
/** Waits for the next matching message. */
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Subscribable } from "./subscribable.js";
|
|
2
|
+
/** Inclusive limits for one customizable Theme value. */
|
|
3
|
+
export type ThemeRange = Readonly<{
|
|
4
|
+
/** Smallest accepted value. */
|
|
5
|
+
minimum: number;
|
|
6
|
+
/** Largest accepted value. */
|
|
7
|
+
maximum: number;
|
|
8
|
+
}>;
|
|
9
|
+
/** Bounded controls for the shared glass material. */
|
|
10
|
+
export type ThemeGlass = Readonly<{
|
|
11
|
+
/** Default strength of the refracted backdrop. */
|
|
12
|
+
distortion: number;
|
|
13
|
+
/** Default backdrop blur in CSS pixels. */
|
|
14
|
+
blur: number;
|
|
15
|
+
/** Default backdrop saturation multiplier. */
|
|
16
|
+
saturation: number;
|
|
17
|
+
/** Default backdrop brightness multiplier. */
|
|
18
|
+
brightness: number;
|
|
19
|
+
/** Default material opacity from zero to the system's glass cap. */
|
|
20
|
+
opacity: number;
|
|
21
|
+
}>;
|
|
22
|
+
/** The complete set of system-defined Theme properties. */
|
|
23
|
+
export type ThemeProperties = Readonly<{
|
|
24
|
+
/** CSS color underlying shared interface surfaces and materials. */
|
|
25
|
+
background: string;
|
|
26
|
+
/** CSS color used for shared interface content. */
|
|
27
|
+
foreground: string;
|
|
28
|
+
/** CSS color used for shared interface emphasis and interaction. */
|
|
29
|
+
accent: string;
|
|
30
|
+
/** Default component spacing expressed in CSS pixels. */
|
|
31
|
+
spacing: number;
|
|
32
|
+
/** Default component corner radius expressed in CSS pixels. */
|
|
33
|
+
radius: number;
|
|
34
|
+
/** Default values for the shared glass material. */
|
|
35
|
+
glass: ThemeGlass;
|
|
36
|
+
}>;
|
|
37
|
+
/** System-owned bounds for Theme customization. */
|
|
38
|
+
export declare const themeLimits: Readonly<{
|
|
39
|
+
spacing: Readonly<{
|
|
40
|
+
minimum: 6;
|
|
41
|
+
maximum: 18;
|
|
42
|
+
}>;
|
|
43
|
+
radius: Readonly<{
|
|
44
|
+
minimum: 6;
|
|
45
|
+
maximum: 18;
|
|
46
|
+
}>;
|
|
47
|
+
glass: Readonly<{
|
|
48
|
+
distortion: Readonly<{
|
|
49
|
+
minimum: 48;
|
|
50
|
+
maximum: 92;
|
|
51
|
+
}>;
|
|
52
|
+
blur: Readonly<{
|
|
53
|
+
minimum: 2;
|
|
54
|
+
maximum: 8;
|
|
55
|
+
}>;
|
|
56
|
+
saturation: Readonly<{
|
|
57
|
+
minimum: 1.25;
|
|
58
|
+
maximum: 1.8;
|
|
59
|
+
}>;
|
|
60
|
+
brightness: Readonly<{
|
|
61
|
+
minimum: 1.02;
|
|
62
|
+
maximum: 1.1;
|
|
63
|
+
}>;
|
|
64
|
+
opacity: Readonly<{
|
|
65
|
+
minimum: 0;
|
|
66
|
+
maximum: 0.3;
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
69
|
+
}>;
|
|
70
|
+
/** Complete standard Theme available to every environment. */
|
|
71
|
+
export declare const standardTheme: Readonly<{
|
|
72
|
+
/** CSS color underlying shared interface surfaces and materials. */
|
|
73
|
+
background: string;
|
|
74
|
+
/** CSS color used for shared interface content. */
|
|
75
|
+
foreground: string;
|
|
76
|
+
/** CSS color used for shared interface emphasis and interaction. */
|
|
77
|
+
accent: string;
|
|
78
|
+
/** Default component spacing expressed in CSS pixels. */
|
|
79
|
+
spacing: number;
|
|
80
|
+
/** Default component corner radius expressed in CSS pixels. */
|
|
81
|
+
radius: number;
|
|
82
|
+
/** Default values for the shared glass material. */
|
|
83
|
+
glass: ThemeGlass;
|
|
84
|
+
}>;
|
|
85
|
+
/** Creates a complete immutable Theme snapshot at the contract boundary. */
|
|
86
|
+
export declare function createThemeSnapshot(theme: ThemeProperties): ThemeProperties;
|
|
87
|
+
/** Live events published by a Theme after a subscription exists. */
|
|
88
|
+
export type ThemeEvents<Properties extends object = ThemeProperties> = {
|
|
89
|
+
/** A complete replacement Theme snapshot published after registration. */
|
|
90
|
+
change: Readonly<Properties>;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* A read-only source of Theme properties.
|
|
94
|
+
*
|
|
95
|
+
* Reading and observing are distinct, explicit operations. `snapshot()` asks
|
|
96
|
+
* the host for its current value. The inherited subscription surface observes
|
|
97
|
+
* only changes published after registration; it does not replay a snapshot.
|
|
98
|
+
*/
|
|
99
|
+
export interface Theme<Properties extends object = ThemeProperties> extends Subscribable<ThemeEvents<Properties>, never> {
|
|
100
|
+
/** Explicitly requests the complete current Theme snapshot from the host. */
|
|
101
|
+
readonly snapshot: () => Promise<Readonly<Properties>>;
|
|
102
|
+
}
|
|
103
|
+
/** A Theme authority that can validate and replace the current snapshot. */
|
|
104
|
+
export interface WritableTheme<Properties extends object = ThemeProperties> extends Theme<Properties> {
|
|
105
|
+
/** Replaces the complete Theme and resolves after the authority accepts it. */
|
|
106
|
+
readonly update: (theme: Properties) => Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
/** An element whose semantic color may be selected. */
|
|
109
|
+
export interface Colorable<Color = unknown> {
|
|
110
|
+
/** Semantic role from which the element derives its colors. */
|
|
111
|
+
readonly color?: Color;
|
|
112
|
+
}
|
|
113
|
+
/** An element whose supported size may be selected. */
|
|
114
|
+
export interface Sizable<Size = unknown> {
|
|
115
|
+
/** Semantic element size. */
|
|
116
|
+
readonly size?: Size;
|
|
117
|
+
}
|
|
118
|
+
/** An element whose supported corner shape may be selected. */
|
|
119
|
+
export interface Shapeable<Radius = unknown> {
|
|
120
|
+
/** Semantic corner-radius level. */
|
|
121
|
+
readonly radius?: Radius;
|
|
122
|
+
}
|
|
123
|
+
/** An element whose component-specific visual treatment may be selected. */
|
|
124
|
+
export interface Variantable<Variant extends string> {
|
|
125
|
+
/** Visual treatment defined by the element implementing this capability. */
|
|
126
|
+
readonly variant?: Variant;
|
|
127
|
+
}
|
|
128
|
+
/** An element whose surface depth may be selected. */
|
|
129
|
+
export interface Elevatable<Elevation = unknown> {
|
|
130
|
+
/** Semantic surface-depth level. */
|
|
131
|
+
readonly elevation?: Elevation;
|
|
132
|
+
}
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** System-owned bounds for Theme customization. */
|
|
2
|
+
export const themeLimits = Object.freeze({
|
|
3
|
+
spacing: Object.freeze({ minimum: 6, maximum: 18 }),
|
|
4
|
+
radius: Object.freeze({ minimum: 6, maximum: 18 }),
|
|
5
|
+
glass: Object.freeze({
|
|
6
|
+
distortion: Object.freeze({ minimum: 48, maximum: 92 }),
|
|
7
|
+
blur: Object.freeze({ minimum: 2, maximum: 8 }),
|
|
8
|
+
saturation: Object.freeze({ minimum: 1.25, maximum: 1.8 }),
|
|
9
|
+
brightness: Object.freeze({ minimum: 1.02, maximum: 1.1 }),
|
|
10
|
+
opacity: Object.freeze({ minimum: 0, maximum: 0.3 })
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
/** Complete standard Theme available to every environment. */
|
|
14
|
+
export const standardTheme = createThemeSnapshot({
|
|
15
|
+
background: "#edf8fc",
|
|
16
|
+
foreground: "#183447",
|
|
17
|
+
accent: "#4c9cff",
|
|
18
|
+
spacing: 12,
|
|
19
|
+
radius: 10,
|
|
20
|
+
glass: {
|
|
21
|
+
distortion: 70,
|
|
22
|
+
blur: 4,
|
|
23
|
+
saturation: 1.8,
|
|
24
|
+
brightness: 1.06,
|
|
25
|
+
opacity: 0.12
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/** Creates a complete immutable Theme snapshot at the contract boundary. */
|
|
29
|
+
export function createThemeSnapshot(theme) {
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
...theme,
|
|
32
|
+
glass: Object.freeze({ ...theme.glass })
|
|
33
|
+
});
|
|
34
|
+
}
|
package/dist/timeout.js
ADDED
|
File without changes
|
package/dist/value.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** A pixel count or a relative linear expression. */
|
|
2
|
+
export type Value = number | string;
|
|
3
|
+
/** A value reduced to one relative coefficient and one absolute offset. */
|
|
4
|
+
export interface RelativeValue {
|
|
5
|
+
relative: number;
|
|
6
|
+
pixels: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reduces a strict linear expression into `span * relative + pixels`.
|
|
10
|
+
*
|
|
11
|
+
* Numbers are absolute values. Percentages and `n/d` fractions are relative
|
|
12
|
+
* values. Addition and subtraction combine terms; multiplication and division
|
|
13
|
+
* scale the preceding term by a number. No arbitrary code or CSS is accepted.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseRelativeValue(input: unknown): RelativeValue | null;
|
|
16
|
+
/** Returns whether a value belongs to the linear relative-value grammar. */
|
|
17
|
+
export declare function isRelativeValue(value: unknown): value is Value;
|