@adia-ai/web-components 0.4.9 → 0.5.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.
@@ -0,0 +1,56 @@
1
+ /**
2
+ * data-stream — attribute-driven data ingestion, signal-backed.
3
+ *
4
+ * Public API surface: read the shared registry (`streams`) or await a
5
+ * stream's registration (`whenStream`). The internal MutationObserver
6
+ * + transport machinery (HTTP / SSE / WS / JSON / CSV / TSV / JSONL /
7
+ * text) is implementation-only — consumers see the signal + the events
8
+ * (`stream-load`, `stream-error`) on the element.
9
+ *
10
+ * @see ../USAGE.md
11
+ */
12
+
13
+ import type { ReadonlySignal, Signal } from './signals.js';
14
+
15
+ /**
16
+ * One entry in the shared streams registry. `signal.value` carries the
17
+ * parsed payload (shape depends on the transport's `parse` option).
18
+ * `refs` is the active subscriber count; the registry tears the entry
19
+ * down when it returns to 0.
20
+ */
21
+ export interface StreamEntry {
22
+ /** Signal whose `.value` carries the parsed payload. Subscribe with `effect()`. */
23
+ signal: ReadonlySignal<unknown>;
24
+ /** Active subscriber count. */
25
+ refs: number;
26
+ /** Transport metadata — opaque to consumers. */
27
+ transport: unknown;
28
+ /** Resolved options for the stream — opaque to consumers. */
29
+ opts: unknown;
30
+ }
31
+
32
+ /**
33
+ * Read-only public view of the streams registry. App code can do:
34
+ *
35
+ * import { streams } from '@adia-ai/web-components/core/data-stream';
36
+ * streams.get('rev')?.signal.value
37
+ *
38
+ * Subscribe via `effect()` on the entry's `signal`.
39
+ */
40
+ export const streams: {
41
+ get(id: string): StreamEntry | undefined;
42
+ has(id: string): boolean;
43
+ keys(): MapIterator<string>;
44
+ size(): number;
45
+ };
46
+
47
+ /**
48
+ * Resolves with the stream entry once it's registered. If the stream
49
+ * already exists, resolves synchronously on the next microtask; if not,
50
+ * resolves the moment the first DOM consumer (or any caller of
51
+ * acquireStream) creates it. Useful for cross-package adapters
52
+ * (streams-bridge, A2UI surfaces) that may run before the DOM source
53
+ * has connected. The promise never rejects — pair with AbortSignal at
54
+ * the caller if you need cancellation.
55
+ */
56
+ export function whenStream(id: string): Promise<StreamEntry>;
package/core/element.d.ts CHANGED
@@ -13,6 +13,16 @@
13
13
  import type { ReadonlySignal, Signal } from './signals.js';
14
14
  import type { TemplateResult } from './template.js';
15
15
 
16
+ // Mirror the runtime re-exports from element.js so a single import of
17
+ // `@adia-ai/web-components/core/element` resolves both the UIElement
18
+ // class AND the reactive/template helpers — matches the canonical
19
+ // pattern documented in USAGE.md and the `element.js` runtime export
20
+ // surface. Closes FEEDBACK-05 P1 (drift caught post-v0.4.9 upgrade).
21
+ export { signal, computed, effect, batch, untracked, isSignal } from './signals.js';
22
+ export type { ReadonlySignal, Signal, ComputedSignal, EffectOptions, EffectDisposer } from './signals.js';
23
+ export { html, css, repeat } from './template.js';
24
+ export type { TemplateResult } from './template.js';
25
+
16
26
  /** Property declaration in a component's `static properties = { … }` map. */
17
27
  export interface PropertyConfig<T = unknown> {
18
28
  /** Coercion target — `Boolean`, `Number`, `String`, or custom. */
package/core/index.d.ts CHANGED
@@ -9,3 +9,9 @@ export * from './template.js';
9
9
  export * from './element.js';
10
10
  export * from './form.js';
11
11
  export * from './register.js';
12
+ // Mirror the explicit re-export in core/index.js — `streams` + `whenStream`
13
+ // (the public surface of the data-stream attribute-driven ingestion module).
14
+ // `export *` from data-stream.js would also expose internals; keep the
15
+ // explicit form so the type barrel matches the runtime exactly.
16
+ export { streams, whenStream } from './data-stream.js';
17
+ export type { StreamEntry } from './data-stream.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adia-ai/web-components",
3
- "version": "0.4.9",
3
+ "version": "0.5.1",
4
4
  "description": "AdiaUI web components — vanilla custom elements. A2UI runtime (renderer, registry, streams, wiring) lives in @adia-ai/a2ui-runtime.",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",
@@ -58,7 +58,7 @@
58
58
  "./core/icons-phosphor.js"
59
59
  ],
60
60
  "dependencies": {
61
- "@adia-ai/a2ui-runtime": "^0.4.0"
61
+ "@adia-ai/a2ui-runtime": "^0.5.0"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public",