@adia-ai/web-components 0.5.4 → 0.5.6

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.
Files changed (46) hide show
  1. package/components/accordion/accordion-item.a2ui.json +50 -0
  2. package/components/accordion/accordion-item.yaml +27 -0
  3. package/components/action-list/action-item.a2ui.json +63 -0
  4. package/components/action-list/action-item.yaml +37 -0
  5. package/components/agent-feedback-bar/class.js +9 -3
  6. package/components/avatar/avatar-group.a2ui.json +50 -0
  7. package/components/avatar/avatar-group.yaml +26 -0
  8. package/components/avatar/avatar.a2ui.json +4 -1
  9. package/components/avatar/avatar.yaml +7 -0
  10. package/components/button/class.js +39 -0
  11. package/components/chart/chart.a2ui.json +4 -2
  12. package/components/list/list-item.a2ui.json +53 -0
  13. package/components/list/list-item.yaml +29 -0
  14. package/components/segmented/segmented.d.ts +3 -3
  15. package/components/select/class.js +14 -0
  16. package/components/select/select.a2ui.json +5 -0
  17. package/components/select/select.css +10 -0
  18. package/components/select/select.d.ts +3 -3
  19. package/components/select/select.yaml +5 -0
  20. package/components/slider/class.js +58 -0
  21. package/components/slider/slider.a2ui.json +10 -0
  22. package/components/slider/slider.css +13 -0
  23. package/components/slider/slider.yaml +10 -0
  24. package/components/switch/class.js +18 -4
  25. package/components/switch/switch.css +10 -0
  26. package/components/switch/switch.d.ts +3 -3
  27. package/components/tabs/tab.a2ui.json +58 -0
  28. package/components/tabs/tab.yaml +33 -0
  29. package/components/timeline/timeline-item.a2ui.json +76 -0
  30. package/components/timeline/timeline-item.yaml +47 -0
  31. package/components/toast/toast.d.ts +35 -0
  32. package/components/tree/class.js +91 -0
  33. package/components/tree/tree-item.a2ui.json +65 -0
  34. package/components/tree/tree-item.yaml +41 -0
  35. package/components/tree/tree.a2ui.json +15 -0
  36. package/components/tree/tree.css +18 -0
  37. package/components/tree/tree.yaml +10 -0
  38. package/core/anchor.d.ts +71 -0
  39. package/core/controller.d.ts +171 -0
  40. package/core/markdown.d.ts +26 -0
  41. package/core/polyfills.d.ts +31 -0
  42. package/core/provider.d.ts +82 -0
  43. package/core/streams-bridge.d.ts +78 -0
  44. package/core/template.js +21 -3
  45. package/core/transport.d.ts +78 -0
  46. package/package.json +2 -2
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Transport — `fetch` wrapper with timeout, exponential-backoff
3
+ * retries, and a normalized {@link TransportError} for predictable
4
+ * downstream handling.
5
+ *
6
+ * Zero dependencies. Vanilla-JS-friendly — drop into CodePen,
7
+ * StackBlitz, or any vanilla project.
8
+ *
9
+ * Runtime exports mirror `core/transport.js`. `.d.ts` authored in
10
+ * v0.5.6 §191 to close the §178 audit-script baseline missing-sibling
11
+ * gap.
12
+ *
13
+ * @see ./transport.js (runtime SoT)
14
+ */
15
+
16
+ /**
17
+ * Discriminator for {@link TransportError} kinds. Lets consumers
18
+ * branch on user-cancellation (`abort`) vs network errors (`network`)
19
+ * vs HTTP-level non-2xx (`http`) vs timeout exhaustion (`timeout`).
20
+ */
21
+ export type TransportErrorKind = 'abort' | 'timeout' | 'network' | 'http';
22
+
23
+ /**
24
+ * Options for {@link request} and {@link json}.
25
+ */
26
+ export interface TransportOptions {
27
+ /** Standard `fetch` init forwarded as-is (method, headers, body, …). */
28
+ init?: RequestInit;
29
+ /** Per-request timeout in ms. Default: 30 000. Aborts the underlying fetch. */
30
+ timeout?: number;
31
+ /** Retry attempts on 5xx + network failures. Default: 0. */
32
+ retries?: number;
33
+ /** Base retry delay in ms; exponential backoff applies. Default: 1000. */
34
+ retryDelay?: number;
35
+ /** External `AbortSignal` — aborts the request + skips retries. */
36
+ signal?: AbortSignal;
37
+ }
38
+
39
+ /**
40
+ * Resilient `fetch` with timeout + retries. Returns the raw `Response`
41
+ * — consumers handle status codes (the `request()` path does NOT throw
42
+ * on non-2xx responses; use {@link json} when 2xx-only is desired).
43
+ *
44
+ * Throws {@link TransportError} on:
45
+ * - Caller-driven abort (`kind: 'abort'`)
46
+ * - Timeout exhaustion (`kind: 'timeout'`)
47
+ * - Network failure after retries exhausted (`kind: 'network'`)
48
+ */
49
+ export function request(url: string, options?: TransportOptions): Promise<Response>;
50
+
51
+ /**
52
+ * JSON-typed variant of {@link request}. On 2xx responses, returns the
53
+ * parsed JSON body. On non-2xx responses, throws {@link TransportError}
54
+ * with `kind: 'http'` + the status code + the body (parsed as JSON if
55
+ * possible, else raw text).
56
+ */
57
+ export function json<T = unknown>(url: string, options?: TransportOptions): Promise<T>;
58
+
59
+ /**
60
+ * Normalized error thrown by {@link request} and {@link json}. The
61
+ * `kind` discriminator lets consumers branch on user-cancellation vs
62
+ * timeout vs network vs HTTP-level failures.
63
+ *
64
+ * Inherits `message` + `cause` from `Error`.
65
+ */
66
+ export class TransportError extends Error {
67
+ /** Error category — see {@link TransportErrorKind}. */
68
+ kind: TransportErrorKind;
69
+ /** HTTP status code on `kind: 'http'`; `undefined` otherwise. */
70
+ status?: number;
71
+ /** Response body on `kind: 'http'` (parsed JSON or raw text). */
72
+ body?: unknown;
73
+
74
+ constructor(
75
+ message: string,
76
+ options?: { kind?: TransportErrorKind; status?: number; body?: unknown; cause?: unknown },
77
+ );
78
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adia-ai/web-components",
3
- "version": "0.5.4",
4
- "description": "AdiaUI web components vanilla custom elements. A2UI runtime (renderer, registry, streams, wiring) lives in @adia-ai/a2ui-runtime.",
3
+ "version": "0.5.6",
4
+ "description": "AdiaUI web components \u2014 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",
7
7
  "exports": {