@wc-bindable/composite 0.8.0

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.
@@ -0,0 +1,91 @@
1
+ import type { Logger } from "./logger.js";
2
+ /**
3
+ * The composite profile version this implementation conforms to. This is the
4
+ * `version` field of the tier-claim object and is deliberately separate from
5
+ * the core protocol version on `constructor.wcBindable.version` (COMPOSITE.md
6
+ * § Tier claim must be discoverable out-of-band).
7
+ */
8
+ export declare const COMPOSITE_PROFILE_VERSION = 1;
9
+ /**
10
+ * Well-known symbol carrying a composed shell's per-instance tier claim
11
+ * (COMPOSITE.md § Tier claim must be discoverable out-of-band).
12
+ */
13
+ export declare const COMPOSITE_TIERS_SYMBOL: unique symbol;
14
+ /**
15
+ * The standard, machine-readable tier-claim object exposed at
16
+ * {@link COMPOSITE_TIERS_SYMBOL}. Open shape: consumers MUST ignore unrecognized
17
+ * fields and MUST read `version` before trusting the rest.
18
+ */
19
+ export interface CompositeTierClaim {
20
+ protocol: "wc-bindable.composite";
21
+ /** Integer >= 1. This profile is version 1. */
22
+ version: number;
23
+ /** `true` ⇒ this instance claims T2 (local facade — assignable / callable members). */
24
+ localFacade: boolean;
25
+ /** `true` ⇒ this instance claims T3 (Extension-1 surface). Always `false` here. */
26
+ extension1: boolean;
27
+ /**
28
+ * `true` ⇒ this instance's current declaration may be handed directly to
29
+ * `RemoteShellProxy`. Absent ≡ `false` (COMPOSITE.md § Discovering remote
30
+ * compatibility).
31
+ */
32
+ remoteCompatible?: boolean;
33
+ }
34
+ /**
35
+ * Structured reference to a single member of one source target. String forms
36
+ * like `"s3.progress"` are used only as display names; the mapping is resolved
37
+ * through this structured ref, never by splitting the string (COMPOSITE.md § 3).
38
+ */
39
+ export interface SourceRef {
40
+ /** Source id — a local label chosen by the composition author. */
41
+ source: string;
42
+ /** The property / input / command name inside that source's declaration. */
43
+ name: string;
44
+ }
45
+ /** Explicit expose map: composed public name → the source member it maps to. */
46
+ export interface ExposeMap {
47
+ properties?: Record<string, SourceRef>;
48
+ inputs?: Record<string, SourceRef>;
49
+ commands?: Record<string, SourceRef>;
50
+ }
51
+ /**
52
+ * `"all-prefixed"` auto-exposes every source member under its
53
+ * `<sourceId>.<sourceName>` default composed name (COMPOSITE.md § JavaScript
54
+ * API). Otherwise pass an explicit {@link ExposeMap}.
55
+ */
56
+ export type ExposeConfig = ExposeMap | "all-prefixed";
57
+ export interface CreateCompositeTargetConfig {
58
+ /** Source id → source wc-bindable target. */
59
+ sources: Record<string, EventTarget>;
60
+ /** What the shell exposes. Defaults to `"all-prefixed"`. */
61
+ expose?: ExposeConfig;
62
+ /**
63
+ * When `true`, declared `inputs` / `commands` are materialized as assignable /
64
+ * callable members of the shell (tier T2) and `localFacade` is reported
65
+ * `true`. When `false`, they are declaration-only metadata (tier T1) and
66
+ * assigning / invoking them does nothing. Defaults to `true` whenever any
67
+ * input or command is exposed.
68
+ */
69
+ localFacade?: boolean;
70
+ /**
71
+ * Claim remote compatibility (COMPOSITE.md § Discovering remote
72
+ * compatibility). Reserved names are rejected regardless; this only sets the
73
+ * `remoteCompatible` flag on the tier claim. Defaults to `false`.
74
+ */
75
+ remoteCompatible?: boolean;
76
+ /** Logger for getter-failure / delegation reports. Defaults to the console logger. */
77
+ logger?: Logger;
78
+ }
79
+ /** The shell returned by {@link createCompositeTarget}: an ordinary wc-bindable target. */
80
+ export type CompositeShell = EventTarget & {
81
+ readonly [COMPOSITE_TIERS_SYMBOL]: CompositeTierClaim;
82
+ /**
83
+ * Idempotent terminal teardown. Removes every installed source listener and
84
+ * makes subsequent input / command delegation fail predictably (COMPOSITE.md
85
+ * § 10). Does NOT dispose the source targets (borrow semantics).
86
+ */
87
+ dispose(): void;
88
+ /** Composed members are dynamically keyed, so allow string indexing. */
89
+ [key: string]: unknown;
90
+ };
91
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[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AAM,cAAc,GAAG,WAAW,GAAG;IACzC,QAAQ,CAAC,CAAC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC;IACtD;;;;OAIG;IACH,OAAO,IAAI,IAAI,CAAC;IAChB,wEAAwE;IACxE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The composite profile version this implementation conforms to. This is the
3
+ * `version` field of the tier-claim object and is deliberately separate from
4
+ * the core protocol version on `constructor.wcBindable.version` (COMPOSITE.md
5
+ * § Tier claim must be discoverable out-of-band).
6
+ */
7
+ export const COMPOSITE_PROFILE_VERSION = 1;
8
+ /**
9
+ * Well-known symbol carrying a composed shell's per-instance tier claim
10
+ * (COMPOSITE.md § Tier claim must be discoverable out-of-band).
11
+ */
12
+ export const COMPOSITE_TIERS_SYMBOL = Symbol.for("wc-bindable.composite.tiers");
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@wc-bindable/composite",
3
+ "version": "0.8.0",
4
+ "description": "Composition profile for wc-bindable — expose many wc-bindable targets as one (Extension 4)",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./lit": {
14
+ "types": "./dist/lit.d.ts",
15
+ "default": "./dist/lit.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "dev": "tsc --watch",
25
+ "test": "vitest run tests",
26
+ "test:watch": "vitest tests",
27
+ "test:coverage": "vitest run tests --coverage --coverage.include=src/**/*.ts --coverage.exclude=src/index.ts --coverage.exclude=src/types.ts"
28
+ },
29
+ "dependencies": {
30
+ "@wc-bindable/core": "^0.8.0"
31
+ },
32
+ "peerDependencies": {
33
+ "lit": ">=2"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "lit": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/wc-bindable-protocol/wc-bindable-protocol.git",
43
+ "directory": "packages/composite"
44
+ },
45
+ "license": "MIT"
46
+ }