@snap-rail/protocol 0.0.0-stage → 0.1.3
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 +202 -0
- package/lib/contract.js +54 -0
- package/lib/index.js +182 -0
- package/lib/rpc.js +67 -0
- package/lib/types/client.d.ts +66 -0
- package/lib/types/client.js +93 -0
- package/lib/types/contract.d.ts +99 -0
- package/lib/types/contract.js +45 -0
- package/lib/types/frames.d.ts +26 -0
- package/lib/types/frames.js +20 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/index.js +15 -0
- package/lib/types/methods.d.ts +100 -0
- package/lib/types/methods.js +18 -0
- package/lib/types/rpc.d.ts +132 -0
- package/lib/types/rpc.js +57 -0
- package/lib/types/schemas.d.ts +25 -0
- package/lib/types/schemas.js +43 -0
- package/lib/types/surfaces.d.ts +43 -0
- package/lib/types/surfaces.js +43 -0
- package/package.json +25 -3
- package/README.md +0 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The surface vocabulary: one renderer window role. `main` is the operator
|
|
3
|
+
* window (the app's only always-present surface); `ball` is the auxiliary
|
|
4
|
+
* always-on-top surface a plugin drives through the Shell seam — the floating
|
|
5
|
+
* ball.
|
|
6
|
+
*
|
|
7
|
+
* A surface is an identity, not a layout. Every surface boots the same
|
|
8
|
+
* renderer with its own client entry (`snapRail.client.surfaces`) and its own
|
|
9
|
+
* seed set; a plugin face binds to exactly one surface and reads
|
|
10
|
+
* `ctx.client.surface` to know which. Auxiliary surfaces never subscribe to
|
|
11
|
+
* equipment points directly — they consume host-aggregated frames, because a
|
|
12
|
+
* hidden surface must not keep a data path alive and a shown one must not
|
|
13
|
+
* need a second subscription graph.
|
|
14
|
+
*
|
|
15
|
+
* The whitelist is closed on purpose: a plugin may not name an arbitrary URL
|
|
16
|
+
* or spawn an arbitrary window — the Shell owns every window and only these
|
|
17
|
+
* two roles exist.
|
|
18
|
+
*
|
|
19
|
+
* @module @snap-rail/protocol/surfaces
|
|
20
|
+
*/
|
|
21
|
+
/** Every surface id, in boot order (`main` first). */
|
|
22
|
+
export const SURFACE_IDS = ['main', 'ball'];
|
|
23
|
+
/** The always-on-top auxiliary surfaces: windows the Shell creates lazily. */
|
|
24
|
+
export const AUX_SURFACE_IDS = ['ball'];
|
|
25
|
+
/**
|
|
26
|
+
* Whether a wire value names a surface.
|
|
27
|
+
*
|
|
28
|
+
* @param value - the candidate (any wire value).
|
|
29
|
+
* @returns true when the value is a {@link SurfaceId}.
|
|
30
|
+
*/
|
|
31
|
+
export function isSurfaceId(value) {
|
|
32
|
+
return typeof value === 'string' && SURFACE_IDS.includes(value);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether a wire value names an auxiliary surface.
|
|
36
|
+
*
|
|
37
|
+
* @param value - the candidate (any wire value).
|
|
38
|
+
* @returns true when the value is an {@link AuxSurfaceId}.
|
|
39
|
+
*/
|
|
40
|
+
export function isAuxSurfaceId(value) {
|
|
41
|
+
return typeof value === 'string' && AUX_SURFACE_IDS.includes(value);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=surfaces.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snap-rail/protocol",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Channel-independent four-quadrant RPC contract between host and clients",
|
|
4
|
+
"version": "0.1.3",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./src/*": "./src/*",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"lib/**/*.js",
|
|
18
|
+
"lib/types/**/*.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"zod": "^4.4.3",
|
|
23
|
+
"@snap-rail/util": "^0.1.2"
|
|
24
|
+
},
|
|
25
|
+
"snapRail": {
|
|
26
|
+
"layer": "base"
|
|
27
|
+
}
|
|
6
28
|
}
|
package/README.md
DELETED