@pie-players/pie-context 0.1.1

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 ADDED
@@ -0,0 +1,59 @@
1
+ # @pie-players/pie-context
2
+
3
+ Framework-agnostic Context Protocol helpers for PIE web components.
4
+
5
+ This package implements the Web Components community `context-request` protocol
6
+ so orchestration/runtime dependencies can be shared without prop drilling.
7
+
8
+ ## Included APIs
9
+
10
+ - `createContext<T>(key)` for typed context keys
11
+ - `ContextRequestEvent` and `ContextProviderEvent`
12
+ - `ContextProvider` and `provideContext(...)`
13
+ - `ContextConsumer`, `consumeContext(...)`, and `requestContext(...)`
14
+ - `ContextRoot` for late-provider replay of pending subscribing requests
15
+
16
+ ## Design notes
17
+
18
+ - Events are emitted with `bubbles: true` and `composed: true`.
19
+ - Provider matching uses strict key identity (`===`).
20
+ - `ContextRequestEvent.subscribe` defaults to `false` (one-shot request).
21
+ - Providers call `stopPropagation()` when they satisfy a matching request.
22
+ - Providers re-dispatch existing subscriptions when a nested provider for the
23
+ same context announces itself.
24
+ - Subscriptions are opt-in (`subscribe: true`) and include unsubscribe callbacks.
25
+ - `ContextRoot` only tracks subscribing requests to avoid unnecessary retention.
26
+ - `ContextRoot` dedupes pending replay by `(requestor, callback)` pair.
27
+
28
+ See `LIT_PARITY_CHECKLIST.md` for the parity checklist used to align semantics
29
+ with `../lit/packages/context` core APIs.
30
+
31
+ ## Svelte usage pattern
32
+
33
+ Keep Svelte reactivity for internal state and use this package for ambient
34
+ runtime dependencies between components:
35
+
36
+ ```ts
37
+ import { onMount } from "svelte";
38
+ import { ContextConsumer, createContext } from "@pie-players/pie-context";
39
+
40
+ const toolkitContext = createContext<{ assessmentId: string }>(
41
+ Symbol("toolkit-runtime"),
42
+ );
43
+
44
+ let host: HTMLElement;
45
+ let assessmentId = "";
46
+ let consumer: ContextConsumer<typeof toolkitContext>;
47
+
48
+ onMount(() => {
49
+ consumer = new ContextConsumer(host, {
50
+ context: toolkitContext,
51
+ subscribe: true,
52
+ onValue: (value) => {
53
+ assessmentId = value.assessmentId;
54
+ },
55
+ });
56
+ consumer.connect();
57
+ return () => consumer.disconnect();
58
+ });
59
+ ```
@@ -0,0 +1,24 @@
1
+ import type { ContextType, UnknownContext } from "./types.js";
2
+ export interface ContextConsumerOptions<T extends UnknownContext> {
3
+ context: T;
4
+ subscribe?: boolean;
5
+ onValue?: (value: ContextType<T>) => void;
6
+ }
7
+ export declare class ContextConsumer<T extends UnknownContext> {
8
+ private readonly host;
9
+ private readonly context;
10
+ private readonly subscribe;
11
+ private readonly onValue?;
12
+ private isConnected;
13
+ private unsubscribe?;
14
+ private currentValue?;
15
+ constructor(host: Element, options: ContextConsumerOptions<T>);
16
+ connect(): void;
17
+ disconnect(): void;
18
+ get value(): ContextType<T> | undefined;
19
+ private readonly handleValue;
20
+ requestValue(): void;
21
+ }
22
+ export declare const consumeContext: <T extends UnknownContext>(host: Element, options: ContextConsumerOptions<T>) => ContextConsumer<T>;
23
+ export declare const requestContext: <T extends UnknownContext>(host: Element, context: T) => ContextType<T> | undefined;
24
+ //# sourceMappingURL=consumer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consumer.d.ts","sourceRoot":"","sources":["../src/consumer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,cAAc;IAC/D,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAC1C;AAED,qBAAa,eAAe,CAAC,CAAC,SAAS,cAAc;IACpD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAU;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAI;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAkC;IAC3D,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,YAAY,CAAC,CAAiB;gBAEnB,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAO7D,OAAO,IAAI,IAAI;IAMf,UAAU,IAAI,IAAI;IAOzB,IAAW,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAE7C;IAED,OAAO,CAAC,QAAQ,CAAC,WAAW,CAc1B;IAEK,YAAY,IAAI,IAAI;CAU3B;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,cAAc,EACtD,MAAM,OAAO,EACb,SAAS,sBAAsB,CAAC,CAAC,CAAC,KAChC,eAAe,CAAC,CAAC,CAAuC,CAAC;AAE5D,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,cAAc,EACtD,MAAM,OAAO,EACb,SAAS,CAAC,KACR,WAAW,CAAC,CAAC,CAAC,GAAG,SAanB,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { ContextRequestEvent } from "./events.js";
2
+ export class ContextConsumer {
3
+ host;
4
+ context;
5
+ subscribe;
6
+ onValue;
7
+ isConnected = false;
8
+ unsubscribe;
9
+ currentValue;
10
+ constructor(host, options) {
11
+ this.host = host;
12
+ this.context = options.context;
13
+ this.subscribe = options.subscribe ?? true;
14
+ this.onValue = options.onValue;
15
+ }
16
+ connect() {
17
+ if (this.isConnected)
18
+ return;
19
+ this.isConnected = true;
20
+ this.requestValue();
21
+ }
22
+ disconnect() {
23
+ if (!this.isConnected)
24
+ return;
25
+ this.isConnected = false;
26
+ this.unsubscribe?.();
27
+ this.unsubscribe = undefined;
28
+ }
29
+ get value() {
30
+ return this.currentValue;
31
+ }
32
+ handleValue = (value, unsubscribe) => {
33
+ if (unsubscribe !== this.unsubscribe) {
34
+ this.unsubscribe?.();
35
+ this.unsubscribe = unsubscribe;
36
+ }
37
+ if (!this.subscribe && this.unsubscribe) {
38
+ this.unsubscribe();
39
+ this.unsubscribe = undefined;
40
+ }
41
+ this.currentValue = value;
42
+ this.onValue?.(value);
43
+ };
44
+ requestValue() {
45
+ this.host.dispatchEvent(new ContextRequestEvent(this.context, this.host, this.handleValue, this.subscribe));
46
+ }
47
+ }
48
+ export const consumeContext = (host, options) => new ContextConsumer(host, options);
49
+ export const requestContext = (host, context) => {
50
+ let value;
51
+ host.dispatchEvent(new ContextRequestEvent(context, host, (nextValue) => {
52
+ value = nextValue;
53
+ }, false));
54
+ return value;
55
+ };
56
+ //# sourceMappingURL=consumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consumer.js","sourceRoot":"","sources":["../src/consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AASlD,MAAM,OAAO,eAAe;IACV,IAAI,CAAU;IACd,OAAO,CAAI;IACX,SAAS,CAAU;IACnB,OAAO,CAAmC;IACnD,WAAW,GAAG,KAAK,CAAC;IACpB,WAAW,CAAc;IACzB,YAAY,CAAkB;IAEtC,YAAmB,IAAa,EAAE,OAAkC;QACnE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,CAAC;IAEM,OAAO;QACb,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACrB,CAAC;IAEM,UAAU;QAChB,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,OAAO;QAC9B,IAAI,CAAC,WAAW,G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,CACL,CACD,CAAC;IACF,OAAO,KAAK,CAAC;AACd,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ContextCallback, ContextType, UnknownContext } from "./types.js";
2
+ export declare class ContextRequestEvent<T extends UnknownContext = UnknownContext> extends Event {
3
+ readonly context: T;
4
+ readonly contextTarget: Element;
5
+ readonly callback: ContextCallback<ContextType<T>>;
6
+ readonly subscribe?: boolean;
7
+ constructor(context: T, contextTarget: Element, callback: ContextCallback<ContextType<T>>, subscribe?: boolean);
8
+ }
9
+ export declare class ContextProviderEvent<T extends UnknownContext = UnknownContext> extends Event {
10
+ readonly context: T;
11
+ readonly contextTarget: Element;
12
+ constructor(context: T, contextTarget: Element);
13
+ }
14
+ declare global {
15
+ interface HTMLElementEventMap {
16
+ "context-request": ContextRequestEvent<UnknownContext>;
17
+ "context-provider": ContextProviderEvent<UnknownContext>;
18
+ }
19
+ }
20
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EACf,WAAW,EACX,cAAc,EACd,MAAM,YAAY,CAAC;AAEpB,qBAAa,mBAAmB,CAC/B,CAAC,SAAS,cAAc,GAAG,cAAc,CACxC,SAAQ,KAAK;IACd,SAAgB,OAAO,EAAE,CAAC,CAAC;IAC3B,SAAgB,aAAa,EAAE,OAAO,CAAC;IACvC,SAAgB,QAAQ,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,SAAgB,SAAS,CAAC,EAAE,OAAO,CAAC;gBAGnC,OAAO,EAAE,CAAC,EACV,aAAa,EAAE,OAAO,EACtB,QAAQ,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACzC,SAAS,CAAC,EAAE,OAAO;CAQpB;AAED,qBAAa,oBAAoB,CAChC,CAAC,SAAS,cAAc,GAAG,cAAc,CACxC,SAAQ,KAAK;IACd,SAAgB,OAAO,EAAE,CAAC,CAAC;IAC3B,SAAgB,aAAa,EAAE,OAAO,CAAC;gBAEpB,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,OAAO;CAKrD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,mBAAmB;QAC5B,iBAAiB,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAC;QACvD,kBAAkB,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAC;KACzD;CACD"}
package/dist/events.js ADDED
@@ -0,0 +1,23 @@
1
+ export class ContextRequestEvent extends Event {
2
+ context;
3
+ contextTarget;
4
+ callback;
5
+ subscribe;
6
+ constructor(context, contextTarget, callback, subscribe) {
7
+ super("context-request", { bubbles: true, composed: true });
8
+ this.context = context;
9
+ this.contextTarget = contextTarget;
10
+ this.callback = callback;
11
+ this.subscribe = subscribe ?? false;
12
+ }
13
+ }
14
+ export class ContextProviderEvent extends Event {
15
+ context;
16
+ contextTarget;
17
+ constructor(context, contextTarget) {
18
+ super("context-provider", { bubbles: true, composed: true });
19
+ this.context = context;
20
+ this.contextTarget = contextTarget;
21
+ }
22
+ }
23
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,mBAEX,SAAQ,KAAK;IACE,OAAO,CAAI;IACX,aAAa,CAAU;IACvB,QAAQ,CAAkC;IAC1C,SAAS,CAAW;IAEpC,YACC,OAAU,EACV,aAAsB,EACtB,QAAyC,EACzC,SAAmB;QAEnB,KAAK,CAAC,iBAAiB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,KAAK,CAAC;IACrC,CAAC;CACD;AAED,MAAM,OAAO,oBAEX,SAAQ,KAAK;IACE,OAAO,CAAI;IACX,aAAa,CAAU;IAEvC,YAAmB,OAAU,EAAE,aAAsB;QACpD,KAAK,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,CAAC;CACD"}
@@ -0,0 +1,7 @@
1
+ export { ContextProviderEvent, ContextRequestEvent, } from "./events.js";
2
+ export { consumeContext, ContextConsumer, requestContext, } from "./consumer.js";
3
+ export { provideContext, ContextProvider } from "./provider.js";
4
+ export { ContextRoot } from "./root.js";
5
+ export type { Context, ContextCallback, ContextType, UnknownContext, } from "./types.js";
6
+ export { createContext } from "./types.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,cAAc,EACd,eAAe,EACf,cAAc,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EACX,OAAO,EACP,eAAe,EACf,WAAW,EACX,cAAc,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { ContextProviderEvent, ContextRequestEvent, } from "./events.js";
2
+ export { consumeContext, ContextConsumer, requestContext, } from "./consumer.js";
3
+ export { provideContext, ContextProvider } from "./provider.js";
4
+ export { ContextRoot } from "./root.js";
5
+ export { createContext } from "./types.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,cAAc,EACd,eAAe,EACf,cAAc,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAOxC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ContextType, UnknownContext } from "./types.js";
2
+ export interface ContextProviderOptions<T extends UnknownContext> {
3
+ context: T;
4
+ initialValue: ContextType<T>;
5
+ }
6
+ export declare class ContextProvider<T extends UnknownContext> {
7
+ private readonly host;
8
+ private readonly context;
9
+ private currentValue;
10
+ private readonly subscriptions;
11
+ private isConnected;
12
+ constructor(host: Element, options: ContextProviderOptions<T>);
13
+ connect(): void;
14
+ disconnect(): void;
15
+ setValue(value: ContextType<T>, force?: boolean): void;
16
+ get value(): ContextType<T>;
17
+ private getContextTarget;
18
+ private readonly handleContextRequest;
19
+ private readonly handleContextProvider;
20
+ private notifySubscribers;
21
+ }
22
+ export declare const provideContext: <T extends UnknownContext>(host: Element, options: ContextProviderOptions<T>) => ContextProvider<T>;
23
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ9D,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,cAAc;IAC/D,OAAO,EAAE,CAAC,CAAC;IACX,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CAC7B;AAED,qBAAa,eAAe,CAAC,CAAC,SAAS,cAAc;IACpD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAU;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAI;IAC5B,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG1B;IACJ,OAAO,CAAC,WAAW,CAAS;gBAET,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAM7D,OAAO,IAAI,IAAI;IAcf,UAAU,IAAI,IAAI;IAclB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,UAAQ,GAAG,IAAI;IAM3D,IAAW,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAEjC;IAED,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CA0BnC;IAEF,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAepC;IAEF,OAAO,CAAC,iBAAiB;CAKzB;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,cAAc,EACtD,MAAM,OAAO,EACb,SAAS,sBAAsB,CAAC,CAAC,CAAC,KAChC,eAAe,CAAC,CAAC,CAAuC,CAAC"}
@@ -0,0 +1,93 @@
1
+ import { ContextProviderEvent, ContextRequestEvent } from "./events.js";
2
+ export class ContextProvider {
3
+ host;
4
+ context;
5
+ currentValue;
6
+ subscriptions = new Map();
7
+ isConnected = false;
8
+ constructor(host, options) {
9
+ this.host = host;
10
+ this.context = options.context;
11
+ this.currentValue = options.initialValue;
12
+ }
13
+ connect() {
14
+ if (this.isConnected)
15
+ return;
16
+ this.isConnected = true;
17
+ this.host.addEventListener("context-request", this.handleContextRequest);
18
+ this.host.addEventListener("context-provider", this.handleContextProvider);
19
+ this.host.dispatchEvent(new ContextProviderEvent(this.context, this.host));
20
+ }
21
+ disconnect() {
22
+ if (!this.isConnected)
23
+ return;
24
+ this.isConnected = false;
25
+ this.host.removeEventListener("context-request", this.handleContextRequest);
26
+ this.host.removeEventListener("context-provider", this.handleContextProvider);
27
+ this.subscriptions.clear();
28
+ }
29
+ setValue(value, force = false) {
30
+ if (!force && Object.is(this.currentValue, value))
31
+ return;
32
+ this.currentValue = value;
33
+ this.notifySubscribers();
34
+ }
35
+ get value() {
36
+ return this.currentValue;
37
+ }
38
+ getContextTarget(event, fallback) {
39
+ if ("contextTarget" in event && event.contextTarget) {
40
+ return event.contextTarget;
41
+ }
42
+ const path = typeof event.composedPath === "function" ? event.composedPath() : [];
43
+ const firstPathTarget = path[0];
44
+ return firstPathTarget ? firstPathTarget : fallback;
45
+ }
46
+ handleContextRequest = (event) => {
47
+ if (event.context !== this.context)
48
+ return;
49
+ const consumerHost = this.getContextTarget(event, this.host);
50
+ if (consumerHost === this.host)
51
+ return;
52
+ // Closest provider wins for this context key.
53
+ event.stopPropagation();
54
+ if (!event.subscribe) {
55
+ event.callback(this.currentValue);
56
+ return;
57
+ }
58
+ const existing = this.subscriptions.get(event.callback);
59
+ existing?.unsubscribe();
60
+ const unsubscribe = () => {
61
+ this.subscriptions.delete(event.callback);
62
+ };
63
+ this.subscriptions.set(event.callback, {
64
+ consumerHost,
65
+ callback: event.callback,
66
+ unsubscribe,
67
+ });
68
+ event.callback(this.currentValue, unsubscribe);
69
+ };
70
+ handleContextProvider = (event) => {
71
+ if (event.context !== this.context)
72
+ return;
73
+ const providerHost = this.getContextTarget(event, this.host);
74
+ if (providerHost === this.host)
75
+ return;
76
+ // A newly connected nested provider should take over matching consumers.
77
+ const seen = new Set();
78
+ for (const [callback, { consumerHost }] of this.subscriptions) {
79
+ if (seen.has(callback))
80
+ continue;
81
+ seen.add(callback);
82
+ consumerHost.dispatchEvent(new ContextRequestEvent(this.context, consumerHost, callback, true));
83
+ }
84
+ event.stopPropagation();
85
+ };
86
+ notifySubscribers() {
87
+ for (const subscription of this.subscriptions.values()) {
88
+ subscription.callback(this.currentValue, subscription.unsubscribe);
89
+ }
90
+ }
91
+ }
92
+ export const provideContext = (host, options) => new ContextProvider(host, options);
93
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAcxE,MAAM,OAAO,eAAe;IACV,IAAI,CAAU;IACd,OAAO,CAAI;IACpB,YAAY,CAAiB;IACpB,aAAa,GAAG,IAAI,GAAG,EAGrC,CAAC;IACI,WAAW,GAAG,KAAK,CAAC;IAE5B,YAAmB,IAAa,EAAE,OAAkC;QACnE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAC1C,CAAC;IAEM,OAAO;QACb,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACzB,iBAAiB,EACjB,IAAI,CAAC,oBAAqC,CAC1C,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACzB,kBAAkB,EAClB,IAAI,CAAC,qBAAsC,CAC3C,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5E,CAAC;IAEM,UAAU;QAChB,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,OAAO;QAC9B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAC5B,iBAAiB,EACjB,IAAI,CAAC,oBAAqC,CAC1C,CAAC;QACF,IAAI,CAAC,IAA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nE,CAAC;QACH,CAAC;QACD,KAAK,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC,CAAC;IAEM,iBAAiB;QACxB,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;YACxD,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,IAAa,EACb,OAAkC,EACb,EAAE,CAAC,IAAI,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC"}
package/dist/root.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export declare class ContextRoot {
2
+ private readonly host;
3
+ private readonly pendingByContext;
4
+ private attached;
5
+ constructor(host: Element);
6
+ attach(): void;
7
+ detach(): void;
8
+ private readonly onContextRequest;
9
+ private readonly onContextProvider;
10
+ }
11
+ //# sourceMappingURL=root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../src/root.ts"],"names":[],"mappings":"AA4BA,qBAAa,WAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAU;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA6C;IAC9E,OAAO,CAAC,QAAQ,CAAS;gBAEN,IAAI,EAAE,OAAO;IAIzB,MAAM,IAAI,IAAI;IAad,MAAM,IAAI,IAAI;IAcrB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CA2B/B;IAEF,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAahC;CACF"}
package/dist/root.js ADDED
@@ -0,0 +1,74 @@
1
+ import { ContextRequestEvent, } from "./events.js";
2
+ const getLivePending = (pending) => {
3
+ const requests = [];
4
+ for (const entry of pending) {
5
+ if (entry.requestorRef.deref() && entry.callbackRef.deref()) {
6
+ requests.push(entry);
7
+ }
8
+ }
9
+ return requests;
10
+ };
11
+ export class ContextRoot {
12
+ host;
13
+ pendingByContext = new Map();
14
+ attached = false;
15
+ constructor(host) {
16
+ this.host = host;
17
+ }
18
+ attach() {
19
+ if (this.attached)
20
+ return;
21
+ this.attached = true;
22
+ this.host.addEventListener("context-request", this.onContextRequest);
23
+ this.host.addEventListener("context-provider", this.onContextProvider);
24
+ }
25
+ detach() {
26
+ if (!this.attached)
27
+ return;
28
+ this.attached = false;
29
+ this.host.removeEventListener("context-request", this.onContextRequest);
30
+ this.host.removeEventListener("context-provider", this.onContextProvider);
31
+ this.pendingByContext.clear();
32
+ }
33
+ onContextRequest = (event) => {
34
+ if (!event.subscribe)
35
+ return;
36
+ let pending = this.pendingByContext.get(event.context);
37
+ if (!pending) {
38
+ pending = {
39
+ callbacks: new WeakMap(),
40
+ requests: [],
41
+ };
42
+ this.pendingByContext.set(event.context, pending);
43
+ }
44
+ const requestor = event.contextTarget;
45
+ const callback = event.callback;
46
+ let seenForRequestor = pending.callbacks.get(requestor);
47
+ if (!seenForRequestor) {
48
+ seenForRequestor = new WeakSet();
49
+ pending.callbacks.set(requestor, seenForRequestor);
50
+ }
51
+ if (seenForRequestor.has(callback))
52
+ return;
53
+ seenForRequestor.add(callback);
54
+ pending.requests.push({
55
+ requestorRef: new WeakRef(requestor),
56
+ callbackRef: new WeakRef(callback),
57
+ });
58
+ pending.requests = getLivePending(pending.requests);
59
+ };
60
+ onContextProvider = (event) => {
61
+ const pending = this.pendingByContext.get(event.context);
62
+ if (!pending || pending.requests.length === 0)
63
+ return;
64
+ this.pendingByContext.delete(event.context);
65
+ for (const entry of pending.requests) {
66
+ const requestor = entry.requestorRef.deref();
67
+ const callback = entry.callbackRef.deref();
68
+ if (!requestor || !callback)
69
+ continue;
70
+ requestor.dispatchEvent(new ContextRequestEvent(event.context, requestor, callback, true));
71
+ }
72
+ };
73
+ }
74
+ //# sourceMappingURL=root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.js","sourceRoot":"","sources":["../src/root.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AI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAEtD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5C,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtC,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAC7C,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;YAC3C,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ;gBAAE,SAAS;YACtC,SAAS,CAAC,aAAa,CACtB,IAAI,mBAAmB,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CACjE,CAAC;QACH,CAAC;IACF,CAAC,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ export type Context<KeyType, ValueType> = KeyType & {
2
+ __context__: ValueType;
3
+ };
4
+ export type UnknownContext = Context<unknown, unknown>;
5
+ export type ContextType<T extends UnknownContext> = T extends Context<infer _K, infer V> ? V : never;
6
+ export type ContextCallback<ValueType> = (value: ValueType, unsubscribe?: () => void) => void;
7
+ export declare const createContext: <ValueType, KeyType = unknown>(key: KeyType) => Context<KeyType, ValueType>;
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,OAAO,EAAE,SAAS,IAAI,OAAO,GAAG;IAAE,WAAW,EAAE,SAAS,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAEvD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,cAAc,IAC/C,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAElD,MAAM,MAAM,eAAe,CAAC,SAAS,IAAI,CACxC,KAAK,EAAE,SAAS,EAChB,WAAW,CAAC,EAAE,MAAM,IAAI,KACpB,IAAI,CAAC;AAEV,eAAO,MAAM,aAAa,GAAI,SAAS,EAAE,OAAO,GAAG,OAAO,EAAE,KAAK,OAAO,KAChE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export const createContext = (key) => key;
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,aAAa,GAAG,CAA+B,GAAY,EAAE,EAAE,CAC3E,GAAkC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@pie-players/pie-context",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "description": "Framework-agnostic Context Protocol helpers for PIE web components",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/pie-framework/pie-players.git",
9
+ "directory": "packages/pie-context"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "license": "MIT",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsc -p tsconfig.json",
29
+ "dev": "tsc -p tsconfig.json --watch",
30
+ "typecheck": "tsc -p tsconfig.json --noEmit",
31
+ "lint": "biome check .",
32
+ "test": "bun test"
33
+ },
34
+ "devDependencies": {
35
+ "@biomejs/biome": "^2.3.10",
36
+ "typescript": "^5.9.3"
37
+ },
38
+ "homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/pie-context#readme",
39
+ "bugs": {
40
+ "url": "https://github.com/pie-framework/pie-players/issues"
41
+ },
42
+ "engines": {
43
+ "node": ">=18.0.0"
44
+ },
45
+ "sideEffects": false
46
+ }