@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.
- package/components/accordion/accordion-item.a2ui.json +50 -0
- package/components/accordion/accordion-item.yaml +27 -0
- package/components/action-list/action-item.a2ui.json +63 -0
- package/components/action-list/action-item.yaml +37 -0
- package/components/agent-feedback-bar/class.js +9 -3
- package/components/avatar/avatar-group.a2ui.json +50 -0
- package/components/avatar/avatar-group.yaml +26 -0
- package/components/avatar/avatar.a2ui.json +4 -1
- package/components/avatar/avatar.yaml +7 -0
- package/components/button/class.js +39 -0
- package/components/chart/chart.a2ui.json +4 -2
- package/components/list/list-item.a2ui.json +53 -0
- package/components/list/list-item.yaml +29 -0
- package/components/segmented/segmented.d.ts +3 -3
- package/components/select/class.js +14 -0
- package/components/select/select.a2ui.json +5 -0
- package/components/select/select.css +10 -0
- package/components/select/select.d.ts +3 -3
- package/components/select/select.yaml +5 -0
- package/components/slider/class.js +58 -0
- package/components/slider/slider.a2ui.json +10 -0
- package/components/slider/slider.css +13 -0
- package/components/slider/slider.yaml +10 -0
- package/components/switch/class.js +18 -4
- package/components/switch/switch.css +10 -0
- package/components/switch/switch.d.ts +3 -3
- package/components/tabs/tab.a2ui.json +58 -0
- package/components/tabs/tab.yaml +33 -0
- package/components/timeline/timeline-item.a2ui.json +76 -0
- package/components/timeline/timeline-item.yaml +47 -0
- package/components/toast/toast.d.ts +35 -0
- package/components/tree/class.js +91 -0
- package/components/tree/tree-item.a2ui.json +65 -0
- package/components/tree/tree-item.yaml +41 -0
- package/components/tree/tree.a2ui.json +15 -0
- package/components/tree/tree.css +18 -0
- package/components/tree/tree.yaml +10 -0
- package/core/anchor.d.ts +71 -0
- package/core/controller.d.ts +171 -0
- package/core/markdown.d.ts +26 -0
- package/core/polyfills.d.ts +31 -0
- package/core/provider.d.ts +82 -0
- package/core/streams-bridge.d.ts +78 -0
- package/core/template.js +21 -3
- package/core/transport.d.ts +78 -0
- 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
|
-
"description": "AdiaUI web components
|
|
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": {
|