@almadar/ui 3.2.2 → 3.3.0

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.
@@ -9,117 +9,8 @@
9
9
  *
10
10
  * @packageDocumentation
11
11
  */
12
- import type { BusEvent, BusEventSource, EntityRow, EventPayload } from '@almadar/core';
13
- export type CheckStatus = "pass" | "fail" | "pending" | "warn";
14
- export interface VerificationCheck {
15
- id: string;
16
- label: string;
17
- status: CheckStatus;
18
- details?: string;
19
- /** Timestamp when status last changed */
20
- updatedAt: number;
21
- }
22
- export interface EffectTrace {
23
- type: string;
24
- args: unknown[];
25
- status: "executed" | "failed" | "skipped";
26
- error?: string;
27
- durationMs?: number;
28
- }
29
- /** Captures what the server returned for a given event */
30
- export interface ServerResponseTrace {
31
- orbitalName: string;
32
- success: boolean;
33
- clientEffects: number;
34
- dataEntities: Record<string, number>;
35
- emittedEvents: string[];
36
- error?: string;
37
- timestamp: number;
38
- }
39
- export interface TransitionTrace {
40
- id: string;
41
- traitName: string;
42
- from: string;
43
- to: string;
44
- event: string;
45
- guardExpression?: string;
46
- guardResult?: boolean;
47
- effects: EffectTrace[];
48
- /** Server response data when event was forwarded to server bridge */
49
- serverResponse?: ServerResponseTrace;
50
- timestamp: number;
51
- }
52
- export interface BridgeHealth {
53
- connected: boolean;
54
- eventsForwarded: number;
55
- eventsReceived: number;
56
- lastError?: string;
57
- lastHeartbeat: number;
58
- }
59
- export interface VerificationSummary {
60
- totalChecks: number;
61
- passed: number;
62
- failed: number;
63
- warnings: number;
64
- pending: number;
65
- }
66
- /**
67
- * Per-trait state snapshot exposed to the verifier so it can assert that
68
- * reducer data (populated by fetch/persist transitions) and the last
69
- * dispatched payload land in the DOM correctly (VG4/VG6/VG11a/b/c).
70
- *
71
- * Mirrors what `useTraitStateMachine` / generated trait logic hooks keep
72
- * internally, without the verifier having to parse rendered text.
73
- */
74
- export interface TraitStateSnapshot {
75
- /** Trait name as declared in the schema. */
76
- traitName: string;
77
- /** Current state machine state. */
78
- currentState: string;
79
- /** Declared state names for this trait (non-empty for healthy trait refs). */
80
- states: string[];
81
- /** Declared event keys for this trait (non-empty for healthy trait refs). */
82
- events: string[];
83
- /**
84
- * Entity data keyed by entity name. Uses `EntityRow` from `@almadar/core`
85
- * — the canonical persisted-entity shape the server returns and the
86
- * trait reducer stores. Consumers that need full field-level types can
87
- * cast down to the generated entity (e.g. `data['CartItem'] as CartItem[]`).
88
- * Snapshot-on-read; mutating the returned arrays does not affect the
89
- * live reducer.
90
- */
91
- data: Record<string, EntityRow[]>;
92
- /** Payload of the last event the state machine processed, if any. */
93
- lastPayload?: EventPayload;
94
- /**
95
- * Last event the walker (or a UI click) dispatched into this trait.
96
- * Used by VG11a to resolve `@payload.X` expected values.
97
- */
98
- lastEventDispatched?: {
99
- event: string;
100
- payload?: EventPayload;
101
- source?: BusEventSource;
102
- timestamp: number;
103
- };
104
- /**
105
- * Bus events received from the server's `emittedEvents` cascade since the
106
- * last user dispatch. VG4 compares the length against the number of
107
- * `emit: { success/failure: ... }` entries on the triggering transition.
108
- */
109
- cascadeReceived: Array<{
110
- event: string;
111
- payload?: EventPayload;
112
- timestamp: number;
113
- }>;
114
- }
115
- export interface VerificationSnapshot {
116
- checks: VerificationCheck[];
117
- transitions: TransitionTrace[];
118
- bridge: BridgeHealth | null;
119
- summary: VerificationSummary;
120
- /** Per-trait reducer snapshot (populated once `bindTraitSnapshotGetter` runs). */
121
- traits: TraitStateSnapshot[];
122
- }
12
+ import type { AssetLoadStatus, BridgeHealth, BusEvent, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary } from '@almadar/core';
13
+ export type { AssetLoadStatus, BridgeHealth, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary, };
123
14
  type ChangeListener = () => void;
124
15
  /**
125
16
  * Per-trait snapshot getter. Each generated trait logic hook (or
@@ -153,38 +44,6 @@ export declare function getSnapshot(): VerificationSnapshot;
153
44
  */
154
45
  export declare function getTraitSnapshots(): TraitStateSnapshot[];
155
46
  export declare function subscribeToVerification(listener: ChangeListener): () => void;
156
- /** Asset load status for canvas verification */
157
- export type AssetLoadStatus = "loaded" | "failed" | "pending";
158
- /** Event bus log entry for verification */
159
- export interface EventLogEntry {
160
- type: string;
161
- payload?: EventPayload;
162
- timestamp: number;
163
- }
164
- /** Exposed on window for Playwright to query */
165
- interface OrbitalVerificationAPI {
166
- getSnapshot: () => VerificationSnapshot;
167
- getChecks: () => VerificationCheck[];
168
- getTransitions: () => TransitionTrace[];
169
- getBridge: () => BridgeHealth | null;
170
- getSummary: () => VerificationSummary;
171
- /** Wait for a specific event to be processed */
172
- waitForTransition: (event: string, timeoutMs?: number) => Promise<TransitionTrace | null>;
173
- /** Send an event into the runtime (requires eventBus binding) */
174
- sendEvent?: (event: string, payload?: Record<string, unknown>) => void;
175
- /** Get current trait state */
176
- getTraitState?: (traitName: string) => string | undefined;
177
- /** Per-trait reducer snapshots (VG4/VG6/VG11a/b/c). */
178
- getTraitSnapshots?: () => TraitStateSnapshot[];
179
- /** Capture a canvas frame as PNG data URL. Registered by game organisms. */
180
- captureFrame?: () => string | null;
181
- /** Asset load status map. Registered by game organisms. */
182
- assetStatus?: Record<string, AssetLoadStatus>;
183
- /** Event bus log. Records all emit() calls for verification. */
184
- eventLog?: EventLogEntry[];
185
- /** Clear the event log. */
186
- clearEventLog?: () => void;
187
- }
188
47
  declare global {
189
48
  interface Window {
190
49
  __orbitalVerification?: OrbitalVerificationAPI;
@@ -230,4 +89,3 @@ export declare function bindCanvasCapture(captureFn: () => string | null): void;
230
89
  */
231
90
  export declare function updateAssetStatus(url: string, status: AssetLoadStatus): void;
232
91
  export declare function clearVerification(): void;
233
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "3.2.2",
3
+ "version": "3.3.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",
@@ -118,7 +118,7 @@
118
118
  "access": "public"
119
119
  },
120
120
  "dependencies": {
121
- "@almadar/core": ">=5.3.1",
121
+ "@almadar/core": ">=5.5.0",
122
122
  "@almadar/evaluator": ">=2.9.2",
123
123
  "@almadar/patterns": ">=2.14.1",
124
124
  "@almadar/runtime": ">=4.3.0",