tokensafe-ui 0.1.7 → 0.1.8
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/dist/index.d-BAn7lh_a.d.cts +71 -0
- package/dist/index.d-BAn7lh_a.d.ts +71 -0
- package/dist/index.d.cts +481 -5
- package/dist/index.d.ts +481 -5
- package/dist/mcp.d.cts +91 -2
- package/dist/mcp.d.ts +91 -2
- package/dist/observer.d.cts +186 -1
- package/dist/observer.d.ts +186 -1
- package/dist/oumv.d.cts +114 -1
- package/dist/oumv.d.ts +114 -1
- package/dist/patcher.d.cts +68 -1
- package/dist/patcher.d.ts +68 -1
- package/dist/react.d.cts +280 -1
- package/dist/react.d.ts +280 -1
- package/dist/testing.d.cts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/vite.d.cts +24 -2
- package/dist/vite.d.ts +24 -2
- package/dist/vue.d.cts +180 -1
- package/dist/vue.d.ts +180 -1
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
type AgentChild = string | number | boolean | null | undefined | ((...args: any[]) => any) | AgentVNode;
|
|
2
|
+
interface AgentVNodeProps {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
class?: string | (() => string);
|
|
5
|
+
className?: string | (() => string);
|
|
6
|
+
style?: string | Record<string, string>;
|
|
7
|
+
children?: any;
|
|
8
|
+
'data-agent-id'?: string;
|
|
9
|
+
onClick?: (e: any) => void;
|
|
10
|
+
onChange?: (e: any) => void;
|
|
11
|
+
onInput?: (e: any) => void;
|
|
12
|
+
onSubmit?: (e: any) => void;
|
|
13
|
+
}
|
|
14
|
+
interface AgentVNode {
|
|
15
|
+
type: string | ((props: any) => any);
|
|
16
|
+
props: AgentVNodeProps;
|
|
17
|
+
children: AgentChild[];
|
|
18
|
+
agentId?: string;
|
|
19
|
+
isControlFlow?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
namespace JSX {
|
|
23
|
+
interface Element extends AgentVNode {
|
|
24
|
+
}
|
|
25
|
+
interface ElementClass {
|
|
26
|
+
render(): any;
|
|
27
|
+
}
|
|
28
|
+
interface IntrinsicElements {
|
|
29
|
+
[elemName: string]: any;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
interface StateDiff {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
before: any;
|
|
36
|
+
after: any;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface SurfaceDiffItem {
|
|
40
|
+
op: 'attr' | 'text' | 'visibility';
|
|
41
|
+
target: string;
|
|
42
|
+
attr?: string;
|
|
43
|
+
before?: any;
|
|
44
|
+
after?: any;
|
|
45
|
+
}
|
|
46
|
+
interface VerificationTimings {
|
|
47
|
+
t_action_ms: number;
|
|
48
|
+
t_schema_ms: number;
|
|
49
|
+
t_propagation_ms: number;
|
|
50
|
+
t_dom_ms: number;
|
|
51
|
+
t_total_ms: number;
|
|
52
|
+
}
|
|
53
|
+
interface AssertionMismatch {
|
|
54
|
+
key: string;
|
|
55
|
+
expected: any;
|
|
56
|
+
received: any;
|
|
57
|
+
message: string;
|
|
58
|
+
}
|
|
59
|
+
interface TestActionResult {
|
|
60
|
+
status: 'passed' | 'failed';
|
|
61
|
+
componentId: string;
|
|
62
|
+
action: string;
|
|
63
|
+
diff: StateDiff;
|
|
64
|
+
surfaceDiff?: SurfaceDiffItem[];
|
|
65
|
+
timings: VerificationTimings;
|
|
66
|
+
durationMs: number;
|
|
67
|
+
assertionMismatch?: AssertionMismatch;
|
|
68
|
+
error?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type { TestActionResult as T };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
type AgentChild = string | number | boolean | null | undefined | ((...args: any[]) => any) | AgentVNode;
|
|
2
|
+
interface AgentVNodeProps {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
class?: string | (() => string);
|
|
5
|
+
className?: string | (() => string);
|
|
6
|
+
style?: string | Record<string, string>;
|
|
7
|
+
children?: any;
|
|
8
|
+
'data-agent-id'?: string;
|
|
9
|
+
onClick?: (e: any) => void;
|
|
10
|
+
onChange?: (e: any) => void;
|
|
11
|
+
onInput?: (e: any) => void;
|
|
12
|
+
onSubmit?: (e: any) => void;
|
|
13
|
+
}
|
|
14
|
+
interface AgentVNode {
|
|
15
|
+
type: string | ((props: any) => any);
|
|
16
|
+
props: AgentVNodeProps;
|
|
17
|
+
children: AgentChild[];
|
|
18
|
+
agentId?: string;
|
|
19
|
+
isControlFlow?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
namespace JSX {
|
|
23
|
+
interface Element extends AgentVNode {
|
|
24
|
+
}
|
|
25
|
+
interface ElementClass {
|
|
26
|
+
render(): any;
|
|
27
|
+
}
|
|
28
|
+
interface IntrinsicElements {
|
|
29
|
+
[elemName: string]: any;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
interface StateDiff {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
before: any;
|
|
36
|
+
after: any;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface SurfaceDiffItem {
|
|
40
|
+
op: 'attr' | 'text' | 'visibility';
|
|
41
|
+
target: string;
|
|
42
|
+
attr?: string;
|
|
43
|
+
before?: any;
|
|
44
|
+
after?: any;
|
|
45
|
+
}
|
|
46
|
+
interface VerificationTimings {
|
|
47
|
+
t_action_ms: number;
|
|
48
|
+
t_schema_ms: number;
|
|
49
|
+
t_propagation_ms: number;
|
|
50
|
+
t_dom_ms: number;
|
|
51
|
+
t_total_ms: number;
|
|
52
|
+
}
|
|
53
|
+
interface AssertionMismatch {
|
|
54
|
+
key: string;
|
|
55
|
+
expected: any;
|
|
56
|
+
received: any;
|
|
57
|
+
message: string;
|
|
58
|
+
}
|
|
59
|
+
interface TestActionResult {
|
|
60
|
+
status: 'passed' | 'failed';
|
|
61
|
+
componentId: string;
|
|
62
|
+
action: string;
|
|
63
|
+
diff: StateDiff;
|
|
64
|
+
surfaceDiff?: SurfaceDiffItem[];
|
|
65
|
+
timings: VerificationTimings;
|
|
66
|
+
durationMs: number;
|
|
67
|
+
assertionMismatch?: AssertionMismatch;
|
|
68
|
+
error?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type { TestActionResult as T };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,481 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const GLOBAL_KEYS: {
|
|
5
|
+
readonly ACTIVE_INSTANCES: symbol;
|
|
6
|
+
readonly RUNTIME_SIGNALS: symbol;
|
|
7
|
+
readonly CAUSALITY_GRAPH: symbol;
|
|
8
|
+
readonly TELEMETRY_LOG: symbol;
|
|
9
|
+
readonly RUNTIME_VERSION: symbol;
|
|
10
|
+
readonly HEADLESS_DOM_INITIALIZED: symbol;
|
|
11
|
+
};
|
|
12
|
+
declare function getGlobalRegistry<T>(key: symbol, factory: () => T): T;
|
|
13
|
+
declare function checkMultiInstanceGuard(moduleVersion: string): void;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @tokensafe-ui/core - Fine-Grained Reactive Signals
|
|
17
|
+
* Zero-dependency, zero-closure-trap reactive primitives with dynamic dependency graph,
|
|
18
|
+
* topological glitch-free scheduling, and reactive ownership scopes.
|
|
19
|
+
*/
|
|
20
|
+
type CleanupFn = () => void;
|
|
21
|
+
type EffectFn = () => void | CleanupFn;
|
|
22
|
+
interface Subscriber {
|
|
23
|
+
id: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
kind: 'effect' | 'computed' | 'dom_binding';
|
|
26
|
+
level: number;
|
|
27
|
+
getDependencies(): Set<Signal<any>>;
|
|
28
|
+
}
|
|
29
|
+
interface Signal<T> {
|
|
30
|
+
id: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
level: number;
|
|
33
|
+
value: T;
|
|
34
|
+
peek(): T;
|
|
35
|
+
subscribe(fn: (val: T) => void): CleanupFn;
|
|
36
|
+
getSubscribers(): Set<Subscriber>;
|
|
37
|
+
}
|
|
38
|
+
interface ReadonlySignal<T> {
|
|
39
|
+
id: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
level: number;
|
|
42
|
+
readonly value: T;
|
|
43
|
+
peek(): T;
|
|
44
|
+
subscribe(fn: (val: T) => void): CleanupFn;
|
|
45
|
+
getSubscribers(): Set<Subscriber>;
|
|
46
|
+
getDependencies(): Set<Signal<any>>;
|
|
47
|
+
}
|
|
48
|
+
interface Computed<T> extends ReadonlySignal<T> {
|
|
49
|
+
dispose(): void;
|
|
50
|
+
readonly isDisposed: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface ReactiveScope {
|
|
53
|
+
id: string;
|
|
54
|
+
parent: ReactiveScope | null;
|
|
55
|
+
children: Set<ReactiveScope>;
|
|
56
|
+
cleanups: Set<CleanupFn>;
|
|
57
|
+
disposables: Set<{
|
|
58
|
+
dispose(): void;
|
|
59
|
+
}>;
|
|
60
|
+
dispose(): void;
|
|
61
|
+
run<T>(fn: () => T): T;
|
|
62
|
+
readonly isDisposed: boolean;
|
|
63
|
+
}
|
|
64
|
+
declare function getActiveScope(): ReactiveScope | null;
|
|
65
|
+
declare class ReactiveScopeImpl implements ReactiveScope {
|
|
66
|
+
id: string;
|
|
67
|
+
parent: ReactiveScope | null;
|
|
68
|
+
children: Set<ReactiveScope>;
|
|
69
|
+
cleanups: Set<CleanupFn>;
|
|
70
|
+
disposables: Set<{
|
|
71
|
+
dispose(): void;
|
|
72
|
+
}>;
|
|
73
|
+
isDisposed: boolean;
|
|
74
|
+
constructor(parent?: ReactiveScope | null, namePrefix?: string);
|
|
75
|
+
run<T>(fn: () => T): T;
|
|
76
|
+
dispose(): void;
|
|
77
|
+
}
|
|
78
|
+
declare function createRoot<T>(fn: (dispose: () => void) => T): T;
|
|
79
|
+
declare function createScope<T>(fn: (dispose: () => void) => T): {
|
|
80
|
+
result: T;
|
|
81
|
+
dispose: () => void;
|
|
82
|
+
scope: ReactiveScope;
|
|
83
|
+
};
|
|
84
|
+
declare function onCleanup(fn: CleanupFn): void;
|
|
85
|
+
declare function untrack<T>(fn: () => T): T;
|
|
86
|
+
interface EffectOptions {
|
|
87
|
+
id?: string;
|
|
88
|
+
name?: string;
|
|
89
|
+
kind?: 'effect' | 'computed' | 'dom_binding';
|
|
90
|
+
}
|
|
91
|
+
interface SignalOptions {
|
|
92
|
+
id?: string;
|
|
93
|
+
name?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Priority Topological Reactive Scheduler.
|
|
97
|
+
* Coordinates execution phases:
|
|
98
|
+
* Phase 1: Computeds (ordered by topological level ascending -> glitch-free)
|
|
99
|
+
* Phase 2: User Effects
|
|
100
|
+
* Phase 3: DOM Bindings
|
|
101
|
+
*/
|
|
102
|
+
declare class Scheduler {
|
|
103
|
+
private isBatching;
|
|
104
|
+
private isFlushing;
|
|
105
|
+
private computedBuckets;
|
|
106
|
+
private effectsQueue;
|
|
107
|
+
private domQueue;
|
|
108
|
+
private static MAX_FLUSH_CYCLES;
|
|
109
|
+
schedule(sub: EffectRunner): void;
|
|
110
|
+
batch<T>(fn: () => T): T;
|
|
111
|
+
private hasPending;
|
|
112
|
+
private clearAll;
|
|
113
|
+
flush(): void;
|
|
114
|
+
}
|
|
115
|
+
declare const scheduler: Scheduler;
|
|
116
|
+
declare class EffectRunner implements Subscriber {
|
|
117
|
+
id: string;
|
|
118
|
+
name?: string;
|
|
119
|
+
kind: 'effect' | 'computed' | 'dom_binding';
|
|
120
|
+
level: number;
|
|
121
|
+
ownerScope: ReactiveScope | null;
|
|
122
|
+
private fn;
|
|
123
|
+
private cleanups;
|
|
124
|
+
dependencies: Set<SignalImpl<any>>;
|
|
125
|
+
isDisposed: boolean;
|
|
126
|
+
isRunning: boolean;
|
|
127
|
+
private runCount;
|
|
128
|
+
private scheduledSelf;
|
|
129
|
+
private static MAX_RECURSION;
|
|
130
|
+
constructor(fn: EffectFn, options?: EffectOptions);
|
|
131
|
+
getDependencies(): Set<Signal<any>>;
|
|
132
|
+
registerCleanup(cleanup: CleanupFn): void;
|
|
133
|
+
recordSelfSchedule(): void;
|
|
134
|
+
run(): void;
|
|
135
|
+
cleanupPrev(): void;
|
|
136
|
+
dispose(): void;
|
|
137
|
+
}
|
|
138
|
+
declare class SignalImpl<T> implements Signal<T> {
|
|
139
|
+
id: string;
|
|
140
|
+
name?: string;
|
|
141
|
+
level: number;
|
|
142
|
+
private _val;
|
|
143
|
+
private subscribers;
|
|
144
|
+
constructor(initialVal: T, options?: SignalOptions);
|
|
145
|
+
get value(): T;
|
|
146
|
+
set value(newVal: T);
|
|
147
|
+
peek(): T;
|
|
148
|
+
subscribe(fn: (val: T) => void): CleanupFn;
|
|
149
|
+
getSubscribers(): Set<Subscriber>;
|
|
150
|
+
removeSubscriber(sub: EffectRunner): void;
|
|
151
|
+
private notify;
|
|
152
|
+
}
|
|
153
|
+
declare function signal<T>(initialValue: T, options?: SignalOptions): Signal<T>;
|
|
154
|
+
declare function computed<T>(fn: () => T, options?: SignalOptions): Computed<T>;
|
|
155
|
+
declare function effect(fn: EffectFn, options?: EffectOptions): CleanupFn;
|
|
156
|
+
declare function batch<T>(fn: () => T): T;
|
|
157
|
+
|
|
158
|
+
type AgentChild = string | number | boolean | null | undefined | ((...args: any[]) => any) | AgentVNode;
|
|
159
|
+
type AgentNode = AgentChild | AgentChild[];
|
|
160
|
+
interface AgentVNodeProps {
|
|
161
|
+
[key: string]: any;
|
|
162
|
+
class?: string | (() => string);
|
|
163
|
+
className?: string | (() => string);
|
|
164
|
+
style?: string | Record<string, string>;
|
|
165
|
+
children?: any;
|
|
166
|
+
'data-agent-id'?: string;
|
|
167
|
+
onClick?: (e: any) => void;
|
|
168
|
+
onChange?: (e: any) => void;
|
|
169
|
+
onInput?: (e: any) => void;
|
|
170
|
+
onSubmit?: (e: any) => void;
|
|
171
|
+
}
|
|
172
|
+
interface AgentVNode {
|
|
173
|
+
type: string | ((props: any) => any);
|
|
174
|
+
props: AgentVNodeProps;
|
|
175
|
+
children: AgentChild[];
|
|
176
|
+
agentId?: string;
|
|
177
|
+
isControlFlow?: boolean;
|
|
178
|
+
}
|
|
179
|
+
type StateSchema = Record<string, z.ZodTypeAny>;
|
|
180
|
+
type InferState<T extends StateSchema> = {
|
|
181
|
+
[K in keyof T]: z.infer<T[K]>;
|
|
182
|
+
};
|
|
183
|
+
type ActionReducer<TState, TPayload = any> = (state: TState, payload: TPayload) => TState;
|
|
184
|
+
interface LegacyActionContext<TState> {
|
|
185
|
+
state: TState;
|
|
186
|
+
signal: AbortSignal;
|
|
187
|
+
}
|
|
188
|
+
type ActionHandler<TState, TPayload = any> = ActionReducer<TState, TPayload> | ((ctx: LegacyActionContext<TState>, payload: TPayload) => Promise<void | TState> | void | TState);
|
|
189
|
+
type ActionMap<TState> = Record<string, ActionHandler<TState, any>>;
|
|
190
|
+
type ConcurrencyPolicy = 'latest-wins' | 'take-leading' | 'queue' | 'parallel';
|
|
191
|
+
interface EffectContext<TState> {
|
|
192
|
+
dispatch: (actionName: string, payload?: any) => TState;
|
|
193
|
+
signal: AbortSignal;
|
|
194
|
+
state: Readonly<TState>;
|
|
195
|
+
}
|
|
196
|
+
type EffectHandler<TState, TPayload = any> = (ctx: EffectContext<TState>, payload: TPayload) => Promise<void> | void;
|
|
197
|
+
interface EffectConfig<TState, TPayload = any> {
|
|
198
|
+
concurrency?: ConcurrencyPolicy;
|
|
199
|
+
handler: EffectHandler<TState, TPayload>;
|
|
200
|
+
}
|
|
201
|
+
type EffectItem<TState, TPayload = any> = EffectHandler<TState, TPayload> | EffectConfig<TState, TPayload>;
|
|
202
|
+
type EffectMap<TState> = Record<string, EffectItem<TState, any>>;
|
|
203
|
+
type ActionEmitters<TActions extends ActionMap<any> = Record<string, any>, TEffects extends EffectMap<any> = Record<string, any>> = {
|
|
204
|
+
[K in keyof TActions]: Parameters<TActions[K]>[1] extends undefined ? () => any : (payload: Parameters<TActions[K]>[1]) => any;
|
|
205
|
+
} & {
|
|
206
|
+
[K in keyof TEffects]: TEffects[K] extends EffectConfig<any, infer TPayload> ? (payload?: TPayload) => Promise<void> : TEffects[K] extends (ctx: any, payload: infer TPayload) => any ? (payload?: TPayload) => Promise<void> : (payload?: any) => Promise<void>;
|
|
207
|
+
};
|
|
208
|
+
interface RuntimeTelemetryEvent {
|
|
209
|
+
timestamp: number;
|
|
210
|
+
type: 'action_start' | 'action_end' | 'signal_mutation' | 'error';
|
|
211
|
+
actionName?: string;
|
|
212
|
+
signalKey?: string;
|
|
213
|
+
oldValue?: any;
|
|
214
|
+
newValue?: any;
|
|
215
|
+
error?: string;
|
|
216
|
+
durationMs?: number;
|
|
217
|
+
}
|
|
218
|
+
interface ComponentConfig<TSchema extends StateSchema, TActions extends ActionMap<InferState<TSchema>>, TEffects extends EffectMap<InferState<TSchema>> = {}, TProps = Record<string, any>> {
|
|
219
|
+
id: string;
|
|
220
|
+
state: TSchema;
|
|
221
|
+
actions: TActions;
|
|
222
|
+
effects?: TEffects;
|
|
223
|
+
filePath?: string;
|
|
224
|
+
initialState?: Partial<InferState<TSchema>>;
|
|
225
|
+
onMount?: (ctx: {
|
|
226
|
+
state: InferState<TSchema>;
|
|
227
|
+
emit: ActionEmitters<TActions, TEffects>;
|
|
228
|
+
dispatch: (actionName: keyof TActions, payload?: any) => InferState<TSchema>;
|
|
229
|
+
}) => void | (() => void);
|
|
230
|
+
onUnmount?: () => void;
|
|
231
|
+
render: (ctx: {
|
|
232
|
+
state: InferState<TSchema>;
|
|
233
|
+
signals: {
|
|
234
|
+
[K in keyof InferState<TSchema>]: Signal<InferState<TSchema>[K]>;
|
|
235
|
+
};
|
|
236
|
+
emit: ActionEmitters<TActions, TEffects>;
|
|
237
|
+
dispatch: (actionName: keyof TActions, payload?: any) => InferState<TSchema>;
|
|
238
|
+
props: TProps;
|
|
239
|
+
}) => AgentVNode;
|
|
240
|
+
}
|
|
241
|
+
interface ComponentInstance<TSchema extends StateSchema, TActions extends ActionMap<InferState<TSchema>>, TEffects extends EffectMap<InferState<TSchema>> = {}, TProps = any> {
|
|
242
|
+
id: string;
|
|
243
|
+
config: ComponentConfig<TSchema, TActions, TEffects, TProps>;
|
|
244
|
+
signals: {
|
|
245
|
+
[K in keyof InferState<TSchema>]: Signal<InferState<TSchema>[K]>;
|
|
246
|
+
};
|
|
247
|
+
state: InferState<TSchema>;
|
|
248
|
+
emit: ActionEmitters<TActions, TEffects>;
|
|
249
|
+
dispatch: (actionName: keyof TActions, payload?: any) => InferState<TSchema>;
|
|
250
|
+
props: TProps;
|
|
251
|
+
vnode: AgentVNode;
|
|
252
|
+
rootElement?: HTMLElement;
|
|
253
|
+
runtimeLog: RuntimeTelemetryEvent[];
|
|
254
|
+
abortAll: () => void;
|
|
255
|
+
unmount: () => void;
|
|
256
|
+
isMounted: boolean;
|
|
257
|
+
scope?: ReactiveScope;
|
|
258
|
+
}
|
|
259
|
+
declare global {
|
|
260
|
+
namespace JSX {
|
|
261
|
+
interface Element extends AgentVNode {
|
|
262
|
+
}
|
|
263
|
+
interface ElementClass {
|
|
264
|
+
render(): any;
|
|
265
|
+
}
|
|
266
|
+
interface IntrinsicElements {
|
|
267
|
+
[elemName: string]: any;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
declare const activeInstances: Map<string, ComponentInstance<any, any, any, any>>;
|
|
273
|
+
declare function defineComponent<TSchema extends StateSchema, TActions extends ActionMap<InferState<TSchema>>, TEffects extends EffectMap<InferState<TSchema>> = {}, TProps = Record<string, any>>(config: ComponentConfig<TSchema, TActions, TEffects, TProps>): (props?: TProps) => ComponentInstance<TSchema, TActions, TEffects, TProps>;
|
|
274
|
+
/**
|
|
275
|
+
* Hot-reloads an active component instance in memory while preserving its active state signals.
|
|
276
|
+
* Replaces actions, effects, and render function with the new configuration.
|
|
277
|
+
*/
|
|
278
|
+
declare function hotReloadComponent(id: string, newConfigOrFactory: ComponentConfig<any, any, any, any> | ((...args: any[]) => any)): ComponentInstance<any, any, any, any> | null;
|
|
279
|
+
|
|
280
|
+
declare function h(type: any, props: Record<string, any> | null, ...children: any[]): AgentVNode;
|
|
281
|
+
declare function Fragment(props: any): any;
|
|
282
|
+
declare function mount(instanceOrVNode: ComponentInstance<any, any, any> | AgentChild, container?: HTMLElement): HTMLElement;
|
|
283
|
+
declare function unmount(target: ComponentInstance<any, any, any> | HTMLElement): void;
|
|
284
|
+
interface FormBindingProps {
|
|
285
|
+
value?: any;
|
|
286
|
+
checked?: boolean;
|
|
287
|
+
onInput?: (e: any) => void;
|
|
288
|
+
onChange?: (e: any) => void;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Two-way form binding helper for inputs, checkboxes, and select elements.
|
|
292
|
+
* Supports:
|
|
293
|
+
* - bind(emit.setTitle, state.title)
|
|
294
|
+
* - bind(emit, 'title', state)
|
|
295
|
+
* - bind(signal)
|
|
296
|
+
*/
|
|
297
|
+
declare function bind<T = any>(target: any, valueOrKey?: any, stateObj?: any): FormBindingProps;
|
|
298
|
+
/**
|
|
299
|
+
* Isomorphic Client-Side Hydration Engine.
|
|
300
|
+
* Attaches event listeners and reactive signal bindings to server-rendered HTML nodes
|
|
301
|
+
* without wiping the container or recreating DOM elements.
|
|
302
|
+
*/
|
|
303
|
+
declare function hydrate(instance: ComponentInstance<any, any, any>, container: HTMLElement): HTMLElement;
|
|
304
|
+
declare function renderToString(instanceOrVNode: ComponentInstance<any, any, any> | AgentChild): string;
|
|
305
|
+
|
|
306
|
+
interface ShowProps<T = any> {
|
|
307
|
+
when: T | (() => T);
|
|
308
|
+
fallback?: AgentNode;
|
|
309
|
+
children: AgentNode | ((item: NonNullable<T>) => AgentNode);
|
|
310
|
+
}
|
|
311
|
+
declare function Show<T>(props: ShowProps<T>): any;
|
|
312
|
+
interface ForProps<T = any> {
|
|
313
|
+
each: T[] | (() => T[]);
|
|
314
|
+
key?: keyof T | ((item: T, index: number) => any);
|
|
315
|
+
children: (item: T, index: () => number) => AgentNode;
|
|
316
|
+
}
|
|
317
|
+
declare function For<T>(props: ForProps<T>): any;
|
|
318
|
+
interface ErrorBoundaryProps {
|
|
319
|
+
fallback: (error: Error) => AgentNode;
|
|
320
|
+
children?: AgentNode;
|
|
321
|
+
}
|
|
322
|
+
declare function ErrorBoundary(props: ErrorBoundaryProps): any;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Auto-initializes a headless DOM environment (happy-dom) if running inside bare Node.js
|
|
326
|
+
* where document and window are undefined.
|
|
327
|
+
*/
|
|
328
|
+
declare function ensureHeadlessDom(): Promise<void>;
|
|
329
|
+
interface StateDiff {
|
|
330
|
+
[key: string]: {
|
|
331
|
+
before: any;
|
|
332
|
+
after: any;
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
interface SurfaceDiffItem {
|
|
336
|
+
op: 'attr' | 'text' | 'visibility';
|
|
337
|
+
target: string;
|
|
338
|
+
attr?: string;
|
|
339
|
+
before?: any;
|
|
340
|
+
after?: any;
|
|
341
|
+
}
|
|
342
|
+
interface VerificationTimings {
|
|
343
|
+
t_action_ms: number;
|
|
344
|
+
t_schema_ms: number;
|
|
345
|
+
t_propagation_ms: number;
|
|
346
|
+
t_dom_ms: number;
|
|
347
|
+
t_total_ms: number;
|
|
348
|
+
}
|
|
349
|
+
interface AssertionMismatch {
|
|
350
|
+
key: string;
|
|
351
|
+
expected: any;
|
|
352
|
+
received: any;
|
|
353
|
+
message: string;
|
|
354
|
+
}
|
|
355
|
+
interface TestActionOptions {
|
|
356
|
+
expect?: Record<string, any>;
|
|
357
|
+
assert?: (state: any, diff: StateDiff) => boolean | string;
|
|
358
|
+
}
|
|
359
|
+
interface TestActionResult {
|
|
360
|
+
status: 'passed' | 'failed';
|
|
361
|
+
componentId: string;
|
|
362
|
+
action: string;
|
|
363
|
+
diff: StateDiff;
|
|
364
|
+
surfaceDiff?: SurfaceDiffItem[];
|
|
365
|
+
timings: VerificationTimings;
|
|
366
|
+
durationMs: number;
|
|
367
|
+
assertionMismatch?: AssertionMismatch;
|
|
368
|
+
error?: string;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Low-Millisecond Local Action Verification API.
|
|
372
|
+
* Allows AI agents to test state transitions and actions in memory
|
|
373
|
+
* and receive structured before/after state diffs and A11y surface diffs
|
|
374
|
+
* without launching heavy browser automation.
|
|
375
|
+
*/
|
|
376
|
+
declare function testAction(target: ComponentInstance<any, any, any, any> | string, actionName: string, payload?: any, options?: TestActionOptions): Promise<TestActionResult>;
|
|
377
|
+
interface DispatchedActionTelemetry {
|
|
378
|
+
action: string;
|
|
379
|
+
payload?: any;
|
|
380
|
+
timestamp: number;
|
|
381
|
+
}
|
|
382
|
+
interface TestEffectOptions {
|
|
383
|
+
payload?: any;
|
|
384
|
+
timeoutMs?: number;
|
|
385
|
+
expectDispatched?: Array<{
|
|
386
|
+
action: string;
|
|
387
|
+
payload?: any;
|
|
388
|
+
}>;
|
|
389
|
+
expect?: Record<string, any>;
|
|
390
|
+
}
|
|
391
|
+
interface TestEffectResult {
|
|
392
|
+
status: 'passed' | 'failed';
|
|
393
|
+
componentId: string;
|
|
394
|
+
effect: string;
|
|
395
|
+
durationMs: number;
|
|
396
|
+
dispatchedActions: DispatchedActionTelemetry[];
|
|
397
|
+
aborted: boolean;
|
|
398
|
+
diff: StateDiff;
|
|
399
|
+
assertionMismatch?: AssertionMismatch;
|
|
400
|
+
error?: string;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Async Effect Verification API with Concurrency & Dispatch Telemetry.
|
|
404
|
+
* Allows AI agents to test async workflows, monitor dispatched actions,
|
|
405
|
+
* and verify concurrency policies (latest-wins, take-leading, queue, parallel).
|
|
406
|
+
*/
|
|
407
|
+
declare function testEffect(target: ComponentInstance<any, any, any, any> | string, effectName: string, options?: TestEffectOptions): Promise<TestEffectResult>;
|
|
408
|
+
|
|
409
|
+
interface AsyncCrudEntity {
|
|
410
|
+
id: string;
|
|
411
|
+
status?: string;
|
|
412
|
+
priority?: string;
|
|
413
|
+
title?: string;
|
|
414
|
+
[key: string]: any;
|
|
415
|
+
}
|
|
416
|
+
interface AsyncCrudBackend<T extends AsyncCrudEntity> {
|
|
417
|
+
fetchItems?: () => Promise<T[]>;
|
|
418
|
+
saveItems?: (items: T[]) => Promise<any>;
|
|
419
|
+
syncItem?: (item: T) => Promise<T>;
|
|
420
|
+
}
|
|
421
|
+
interface AsyncCrudOptions<T extends AsyncCrudEntity> {
|
|
422
|
+
id: string;
|
|
423
|
+
entityName?: string;
|
|
424
|
+
itemSchema: z.ZodType<T>;
|
|
425
|
+
initialItems?: T[];
|
|
426
|
+
backend?: AsyncCrudBackend<T>;
|
|
427
|
+
customActions?: Record<string, (state: any, payload: any) => any>;
|
|
428
|
+
render: (ctx: {
|
|
429
|
+
state: any;
|
|
430
|
+
emit: any;
|
|
431
|
+
dispatch: any;
|
|
432
|
+
}) => any;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* High-velocity Async CRUD Component Macro.
|
|
436
|
+
* Eliminates repetitive boilerplate by pre-generating standard reactive state
|
|
437
|
+
* and action reducers for async persistence, loading spinners, network errors,
|
|
438
|
+
* retry recovery, and optimistic rollbacks.
|
|
439
|
+
*/
|
|
440
|
+
declare function defineAsyncCrudComponent<T extends AsyncCrudEntity>(options: AsyncCrudOptions<T>): (props?: Record<string, any>) => ComponentInstance<{
|
|
441
|
+
items: z.ZodDefault<z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">>;
|
|
442
|
+
isSaving: z.ZodDefault<z.ZodBoolean>;
|
|
443
|
+
errorMessage: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
444
|
+
successMessage: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
445
|
+
searchQuery: z.ZodDefault<z.ZodString>;
|
|
446
|
+
filterStatus: z.ZodDefault<z.ZodString>;
|
|
447
|
+
filterPriority: z.ZodDefault<z.ZodString>;
|
|
448
|
+
}, {
|
|
449
|
+
addItem: (s: any, payload: Partial<T> & {
|
|
450
|
+
title: string;
|
|
451
|
+
}) => any;
|
|
452
|
+
toggleItem: (s: any, payload: {
|
|
453
|
+
id: string;
|
|
454
|
+
}) => any;
|
|
455
|
+
deleteItem: (s: any, payload: {
|
|
456
|
+
id: string;
|
|
457
|
+
}) => any;
|
|
458
|
+
setSearchQuery: (s: any, payload: {
|
|
459
|
+
query: string;
|
|
460
|
+
}) => any;
|
|
461
|
+
setFilterStatus: (s: any, payload: {
|
|
462
|
+
status: string;
|
|
463
|
+
}) => any;
|
|
464
|
+
setFilterPriority: (s: any, payload: {
|
|
465
|
+
priority: string;
|
|
466
|
+
}) => any;
|
|
467
|
+
startSaving: (s: any) => any;
|
|
468
|
+
saveSuccess: (s: any) => any;
|
|
469
|
+
saveFailure: (s: any, payload: {
|
|
470
|
+
error: string;
|
|
471
|
+
}) => any;
|
|
472
|
+
rollbackToggle: (s: any, payload: {
|
|
473
|
+
id: string;
|
|
474
|
+
prevStatus: string;
|
|
475
|
+
error: string;
|
|
476
|
+
}) => any;
|
|
477
|
+
}, {}, Record<string, any>>;
|
|
478
|
+
|
|
479
|
+
declare const VERSION = "0.2.0";
|
|
480
|
+
|
|
481
|
+
export { type ActionEmitters, type ActionHandler, type ActionMap, type ActionReducer, type AgentChild, type AgentNode, type AgentVNode, type AgentVNodeProps, type AssertionMismatch, type AsyncCrudBackend, type AsyncCrudEntity, type AsyncCrudOptions, type CleanupFn, type ComponentConfig, type ComponentInstance, type Computed, type ConcurrencyPolicy, type DispatchedActionTelemetry, type EffectConfig, type EffectContext, type EffectFn, type EffectHandler, type EffectItem, type EffectMap, type EffectOptions, EffectRunner, ErrorBoundary, type ErrorBoundaryProps, For, type ForProps, type FormBindingProps, Fragment, GLOBAL_KEYS, type InferState, type LegacyActionContext, type ReactiveScope, ReactiveScopeImpl, type ReadonlySignal, type RuntimeTelemetryEvent, Show, type ShowProps, type Signal, SignalImpl, type SignalOptions, type StateDiff, type StateSchema, type Subscriber, type SurfaceDiffItem, type TestActionOptions, type TestActionResult, type TestEffectOptions, type TestEffectResult, VERSION, type VerificationTimings, activeInstances, batch, bind, checkMultiInstanceGuard, computed, createRoot, createScope, defineAsyncCrudComponent, defineComponent, effect, ensureHeadlessDom, getActiveScope, getGlobalRegistry, h, hotReloadComponent, hydrate, mount, onCleanup, renderToString, scheduler, signal, testAction, testEffect, unmount, untrack };
|