@phreshos/core 0.1.5 → 0.1.7

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 CHANGED
@@ -59,23 +59,23 @@ explicit, asynchronous read of one complete, immutable value. `Theme` extends
59
59
  the ordinary `Subscribable` capability with a `change` event; it has no
60
60
  dedicated subscription shape of its own.
61
61
 
62
- Theme properties are expressed as concrete default values. `themeLimits`
63
- declares the system-owned customization bounds for spacing, corner radius, and
64
- glass-material properties; implementing authorities validate replacements
65
- against those bounds. Core defines one fixed numeric scale around any explicit
66
- number and one fixed color scale around any explicit CSS color it does not
67
- prescribe which value an interface ultimately chooses to derive. Background,
68
- foreground, and accent are independent CSS color sources, with standard values
69
- of `#edf8fc`, `#183447`, and `#4c9cff` the established pale surface, primary
70
- ink, and original system blue, respectively. Core stores only those source
71
- colors, never their derived treatments. The declared glass-opacity range ends
72
- at `0.3`.
73
-
74
- `standardTheme` is the single, complete initial value shared by every
75
- environment; the running system remains the authority for its current value.
76
- `createThemeSnapshot()` copies and freezes a complete replacement at the
77
- contract boundary; validation remains the implementing authority's
78
- responsibility.
62
+ Theme properties are expressed as concrete values. `themeLimits` declares the
63
+ contractual customization bounds for spacing, corner radius, glass-material,
64
+ and Surface properties; implementing authorities validate replacements against those
65
+ bounds. Core defines one fixed numeric scale around any explicit number and one
66
+ fixed color scale around any explicit CSS color. `standardTheme` is the
67
+ canonical reusable default value for that contract, shared by systems,
68
+ interfaces, websites, and Programs that need the same baseline. It is not an
69
+ authoritative environment's mutable Theme state. Background, foreground, and
70
+ accent remain independent CSS color sources. Surface adds a concrete color,
71
+ grain intensity, animation rate, optional backdrop blur, and material opacity;
72
+ its standard backdrop is zero, so blur is opt-in. The declared glass-opacity
73
+ range ends at `0.3`.
74
+
75
+ `createThemeSnapshot()` copies and freezes one complete value at the contract
76
+ boundary. An implementing authority remains responsible for validation,
77
+ persistence, and the current value; its own schema may derive its defaults from
78
+ `standardTheme` rather than duplicating them.
79
79
 
80
80
  Derived variants are calculations, not persisted `Theme` state. `numericScale()`
81
81
  produces `xsmall`, `small`, `medium`, `large`, and `xlarge`, preserving the
@@ -86,9 +86,9 @@ supplied value exactly at `medium`. `color()` produces `subtle`, `soft`, `base`,
86
86
  after that registration exists. It never supplies an initial snapshot and
87
87
  never replays a change published earlier; Programs request the current
88
88
  snapshot explicitly when they need one. `WritableTheme` adds asynchronous
89
- authority to replace the value a read-only environment exposes `Theme`,
90
- while an authorized environment may expose `WritableTheme` without altering
91
- the shared lifecycle.
89
+ authority to replace the value. A read-only environment exposes `Theme`, while
90
+ an authorized environment may expose `WritableTheme` without altering the
91
+ shared lifecycle.
92
92
 
93
93
  `Colorable`, `Sizable`, `Shapeable`, `Variantable`, and `Elevatable` are
94
94
  independent element capabilities whose concrete value vocabularies are defined
@@ -234,18 +234,28 @@ 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
- ## Client Surface values
238
-
239
- `ClientSurfaceSettings` describes optional host-rendered material requested by
240
- one live Client representation. It is a value contract, not Window state and
241
- not server authority. Calling the Client capability without settings creates a
242
- sharp, fully opaque Surface. Settings may select opacity from zero to one, a
243
- nonnegative pixel radius, a scale level, or `"full"`, and an optional
244
- transaction containing a duration from zero through 60,000 milliseconds and a
245
- stable named or cubic Bézier easing. Zero opacity
246
- retains the Surface node; the Client capability's separate `remove()` command
247
- removes it immediately. The receiving desktop validates settings and animates
248
- from the rendered values to each new target.
237
+ ## Local representation
238
+
239
+ `Window` is the authoritative, subscribable presentation state shared through
240
+ the system. `LocalWindow` describes one Client Window's physical representation
241
+ on the current desktop. Its reads and commands are deliberately eventless and
242
+ never change or publish authoritative state. Client SDKs may attach this
243
+ capability to their Window handles; Server SDKs must not. A desktop projects
244
+ authoritative changes onto an ordinary `window` layer, while `under` and `over`
245
+ representations receive their initial truth and control their local projection
246
+ thereafter.
247
+
248
+ `SurfaceSettings` describes optional host-rendered material belonging to one
249
+ live `under` or `over` representation. Calling `set()` without settings creates
250
+ a sharp, fully opaque Surface; `remove()` removes its render node immediately.
251
+ Opacity accepts zero through one, while radius accepts a nonnegative pixel
252
+ number, a scale level, or `"full"`.
253
+
254
+ Geometry commands and Surface replacement may receive a generic `Transaction`.
255
+ It must contain a duration in milliseconds, an easing, or both; `{}` and
256
+ `{ wait: true }` are not transactions. Omitting it preserves the layer's normal
257
+ behavior. `wait: true` makes the command settle with the visual transition,
258
+ while omission or `false` settles when the desktop accepts it.
249
259
 
250
260
  ## Window geometry
251
261
 
@@ -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 one Client Window 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
+ * One Client Window's physical representation on the current desktop. It has
21
+ * no events: its commands neither change authoritative state nor broadcast
22
+ * 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
+ }
package/dist/main.d.ts CHANGED
@@ -10,7 +10,7 @@ export { type DesktopWallpaper, type FileWallpaper, type WallpaperLaunch } from
10
10
  export { isRelativeValue, parseRelativeValue, type RelativeValue, type Value } from "./value.js";
11
11
  export { color, type ColorLevel, type ColorScale } from "./color.js";
12
12
  export { isScaleLevel, numericScale, scale, scaleMultiplier, type NumericScale, type ScaleLevel } from "./scale.js";
13
- 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";
13
+ export { createThemeSnapshot, standardTheme, themeLimits, type Colorable, type Elevatable, type Shapeable, type Sizable, type Theme, type ThemeEvents, type ThemeGlass, type ThemeProperties, type ThemeRange, type ThemeSurface, type Variantable, type WritableTheme } from "./theme.js";
14
14
  export { type DirectoryStat, type EntryStat, type FileStat, type OtherStat, type ProgramArea, type ProgramStore } from "./storage.js";
15
15
  export { type LogKind, type LogRecord, type LogSource, type ProgramSql } from "./sql.js";
16
16
  export { Endpoint, type AskCapture, type AskMessage, type AskObserver, type EndpointTraffic, type TrafficCapture, type TrafficEvents, type TrafficMessage } from "./endpoint.js";
@@ -20,6 +20,7 @@ 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
22
  export { type Window, type WindowEvents, type WindowGeometry, type WindowLayer, type WindowState } from "./window.js";
23
- export { type ClientSurfaceEasing, type ClientSurfaceSettings, type ClientSurfaceTransaction } from "./client-surface.js";
23
+ export { type LocalWindow, type LocalWindowSurface, type SurfaceSettings } from "./local-window.js";
24
+ export { type Easing, type Transaction } from "./transaction.js";
24
25
  export { layers, type Launch, type LaunchClient, type Layer, type Position, type Size } from "./launch.js";
25
26
  export { defineConfig, type ClientConfig, type ClientDevelopment, type Config, type ServerConfig, type ServerDevelopment } from "./config.js";
package/dist/main.js CHANGED
@@ -20,6 +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 "./client-surface.js";
23
+ export {} from "./local-window.js";
24
+ export {} from "./transaction.js";
24
25
  export { layers } from "./launch.js";
25
26
  export { defineConfig } from "./config.js";
package/dist/theme.d.ts CHANGED
@@ -19,9 +19,20 @@ export type ThemeGlass = Readonly<{
19
19
  /** Default material opacity from zero to the system's glass cap. */
20
20
  opacity: number;
21
21
  }>;
22
+ /** Concrete defaults for the shared opaque Surface material. */
23
+ export type ThemeSurface = Readonly<{
24
+ /** Grain intensity from zero to one. */
25
+ grain: number;
26
+ /** Grain texture changes per second. */
27
+ animation: number;
28
+ /** Optional backdrop blur in CSS pixels. */
29
+ backdrop: number;
30
+ /** Material opacity from zero to one. */
31
+ opacity: number;
32
+ }>;
22
33
  /** The complete set of system-defined Theme properties. */
23
34
  export type ThemeProperties = Readonly<{
24
- /** CSS color underlying shared interface surfaces and materials. */
35
+ /** CSS color underlying interfaces and painted by Surface materials. */
25
36
  background: string;
26
37
  /** CSS color used for shared interface content. */
27
38
  foreground: string;
@@ -33,6 +44,8 @@ export type ThemeProperties = Readonly<{
33
44
  radius: number;
34
45
  /** Default values for the shared glass material. */
35
46
  glass: ThemeGlass;
47
+ /** Default values for the shared opaque Surface material. */
48
+ surface: ThemeSurface;
36
49
  }>;
37
50
  /** System-owned bounds for Theme customization. */
38
51
  export declare const themeLimits: Readonly<{
@@ -66,10 +79,28 @@ export declare const themeLimits: Readonly<{
66
79
  maximum: 0.3;
67
80
  }>;
68
81
  }>;
82
+ surface: Readonly<{
83
+ grain: Readonly<{
84
+ minimum: 0;
85
+ maximum: 1;
86
+ }>;
87
+ animation: Readonly<{
88
+ minimum: 0;
89
+ maximum: 16;
90
+ }>;
91
+ backdrop: Readonly<{
92
+ minimum: 0;
93
+ maximum: 24;
94
+ }>;
95
+ opacity: Readonly<{
96
+ minimum: 0;
97
+ maximum: 1;
98
+ }>;
99
+ }>;
69
100
  }>;
70
101
  /** Complete standard Theme available to every environment. */
71
102
  export declare const standardTheme: Readonly<{
72
- /** CSS color underlying shared interface surfaces and materials. */
103
+ /** CSS color underlying interfaces and painted by Surface materials. */
73
104
  background: string;
74
105
  /** CSS color used for shared interface content. */
75
106
  foreground: string;
@@ -81,6 +112,8 @@ export declare const standardTheme: Readonly<{
81
112
  radius: number;
82
113
  /** Default values for the shared glass material. */
83
114
  glass: ThemeGlass;
115
+ /** Default values for the shared opaque Surface material. */
116
+ surface: ThemeSurface;
84
117
  }>;
85
118
  /** Creates a complete immutable Theme snapshot at the contract boundary. */
86
119
  export declare function createThemeSnapshot(theme: ThemeProperties): ThemeProperties;
package/dist/theme.js CHANGED
@@ -8,11 +8,17 @@ export const themeLimits = Object.freeze({
8
8
  saturation: Object.freeze({ minimum: 1.25, maximum: 1.8 }),
9
9
  brightness: Object.freeze({ minimum: 1.02, maximum: 1.1 }),
10
10
  opacity: Object.freeze({ minimum: 0, maximum: 0.3 })
11
+ }),
12
+ surface: Object.freeze({
13
+ grain: Object.freeze({ minimum: 0, maximum: 1 }),
14
+ animation: Object.freeze({ minimum: 0, maximum: 16 }),
15
+ backdrop: Object.freeze({ minimum: 0, maximum: 24 }),
16
+ opacity: Object.freeze({ minimum: 0, maximum: 1 })
11
17
  })
12
18
  });
13
19
  /** Complete standard Theme available to every environment. */
14
20
  export const standardTheme = createThemeSnapshot({
15
- background: "#edf8fc",
21
+ background: "#f5f4ee",
16
22
  foreground: "#183447",
17
23
  accent: "#4c9cff",
18
24
  spacing: 12,
@@ -23,12 +29,19 @@ export const standardTheme = createThemeSnapshot({
23
29
  saturation: 1.8,
24
30
  brightness: 1.06,
25
31
  opacity: 0.12
32
+ },
33
+ surface: {
34
+ grain: 0.04,
35
+ animation: 0,
36
+ backdrop: 0,
37
+ opacity: 1
26
38
  }
27
39
  });
28
40
  /** Creates a complete immutable Theme snapshot at the contract boundary. */
29
41
  export function createThemeSnapshot(theme) {
30
42
  return Object.freeze({
31
43
  ...theme,
32
- glass: Object.freeze({ ...theme.glass })
44
+ glass: Object.freeze({ ...theme.glass }),
45
+ surface: Object.freeze({ ...theme.surface })
33
46
  });
34
47
  }
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phreshos/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Environment-neutral contracts and domain objects for PhreshOS Programs.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,19 +0,0 @@
1
- import type { ScaleLevel } from "./scale.js";
2
- /** Stable easing accepted by one Client representation's Surface transaction. */
3
- export type ClientSurfaceEasing = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | readonly [number, number, number, number];
4
- /** Motion applied locally when one Client representation replaces its Surface target. */
5
- export type ClientSurfaceTransaction = Readonly<{
6
- /** Duration in milliseconds. Omission uses the desktop duration. */
7
- duration?: number;
8
- /** Timing curve. Omission uses the desktop curve. */
9
- easing?: ClientSurfaceEasing;
10
- }>;
11
- /** Local host Surface requested by one live Client representation. */
12
- export type ClientSurfaceSettings = Readonly<{
13
- /** Whole-Surface opacity from zero through one. Omission means one. */
14
- opacity?: number;
15
- /** A Theme-derived level, CSS pixels, or maximum proportional rounding. Omission means zero. */
16
- radius?: ScaleLevel | number | "full";
17
- /** Optional motion from the currently rendered values to this target. */
18
- transaction?: ClientSurfaceTransaction;
19
- }>;
File without changes