@almadar/ui 2.6.0 → 2.8.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.
@@ -353,6 +353,14 @@ declare function getBridgeHealth(): BridgeHealth | null;
353
353
  declare function getSummary(): VerificationSummary;
354
354
  declare function getSnapshot(): VerificationSnapshot;
355
355
  declare function subscribeToVerification(listener: ChangeListener): () => void;
356
+ /** Asset load status for canvas verification */
357
+ type AssetLoadStatus = "loaded" | "failed" | "pending";
358
+ /** Event bus log entry for verification */
359
+ interface EventLogEntry {
360
+ type: string;
361
+ payload?: Record<string, unknown>;
362
+ timestamp: number;
363
+ }
356
364
  /** Exposed on window for Playwright to query */
357
365
  interface OrbitalVerificationAPI {
358
366
  getSnapshot: () => VerificationSnapshot;
@@ -366,6 +374,14 @@ interface OrbitalVerificationAPI {
366
374
  sendEvent?: (event: string, payload?: Record<string, unknown>) => void;
367
375
  /** Get current trait state */
368
376
  getTraitState?: (traitName: string) => string | undefined;
377
+ /** Capture a canvas frame as PNG data URL. Registered by game organisms. */
378
+ captureFrame?: () => string | null;
379
+ /** Asset load status map. Registered by game organisms. */
380
+ assetStatus?: Record<string, AssetLoadStatus>;
381
+ /** Event bus log. Records all emit() calls for verification. */
382
+ eventLog?: EventLogEntry[];
383
+ /** Clear the event log. */
384
+ clearEventLog?: () => void;
369
385
  }
370
386
  declare global {
371
387
  interface Window {
@@ -378,16 +394,31 @@ declare global {
378
394
  */
379
395
  declare function waitForTransition(event: string, timeoutMs?: number): Promise<TransitionTrace | null>;
380
396
  /**
381
- * Bind the EventBus so automation can send events.
397
+ * Bind the EventBus so automation can send events and log emissions.
382
398
  * Call this during app initialization.
383
399
  */
384
400
  declare function bindEventBus(eventBus: {
385
401
  emit: (type: string, payload?: Record<string, unknown>) => void;
402
+ onAny?: (listener: (event: {
403
+ type: string;
404
+ payload?: Record<string, unknown>;
405
+ }) => void) => () => void;
386
406
  }): void;
387
407
  /**
388
408
  * Bind a trait state getter so automation can query current states.
389
409
  */
390
410
  declare function bindTraitStateGetter(getter: (traitName: string) => string | undefined): void;
411
+ /**
412
+ * Register a canvas frame capture function.
413
+ * Called by game organisms (IsometricCanvas, PlatformerCanvas, SimulationCanvas)
414
+ * so the verifier can snapshot canvas content at checkpoints.
415
+ */
416
+ declare function bindCanvasCapture(captureFn: () => string | null): void;
417
+ /**
418
+ * Update asset load status for canvas verification.
419
+ * Game organisms call this when images load or fail.
420
+ */
421
+ declare function updateAssetStatus(url: string, status: AssetLoadStatus): void;
391
422
  declare function clearVerification(): void;
392
423
 
393
424
  /**
@@ -424,4 +455,4 @@ declare function getNestedValue(obj: Record<string, unknown> | null | undefined,
424
455
  */
425
456
  declare function formatNestedFieldLabel(path: string): string;
426
457
 
427
- export { ApiError, type BridgeHealth, type CheckStatus, type DebugEvent, type DebugEventType, type EffectTrace, type EntitySnapshot, type EntityState, type GuardContext, type GuardEvaluation, type PersistentEntityInfo, type RuntimeEntity, type TickExecution, type TraitDebugInfo, type TraitGuard, type TraitTransition, type TransitionTrace, type VerificationCheck, type VerificationSnapshot, type VerificationSummary, apiClient, bindEventBus, bindTraitStateGetter, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, clearVerification, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getAllChecks, getAllTicks, getAllTraits, getBridgeHealth, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getNestedValue, getRecentEvents, getRecentGuardEvaluations, getSnapshot, getSummary, getTick, getTrait, getTransitions, getTransitionsForTrait, initDebugShortcut, isDebugEnabled, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, onDebugToggle, recordGuardEvaluation, recordTransition, registerCheck, registerTick, registerTrait, setDebugEnabled, setEntityProvider, setTickActive, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, subscribeToVerification, toggleDebug, unregisterTick, unregisterTrait, updateBridgeHealth, updateCheck, updateGuardResult, updateTickExecution, updateTraitState, waitForTransition };
458
+ export { ApiError, type AssetLoadStatus, type BridgeHealth, type CheckStatus, type DebugEvent, type DebugEventType, type EffectTrace, type EntitySnapshot, type EntityState, type EventLogEntry, type GuardContext, type GuardEvaluation, type PersistentEntityInfo, type RuntimeEntity, type TickExecution, type TraitDebugInfo, type TraitGuard, type TraitTransition, type TransitionTrace, type VerificationCheck, type VerificationSnapshot, type VerificationSummary, apiClient, bindCanvasCapture, bindEventBus, bindTraitStateGetter, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, clearVerification, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getAllChecks, getAllTicks, getAllTraits, getBridgeHealth, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getNestedValue, getRecentEvents, getRecentGuardEvaluations, getSnapshot, getSummary, getTick, getTrait, getTransitions, getTransitionsForTrait, initDebugShortcut, isDebugEnabled, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, onDebugToggle, recordGuardEvaluation, recordTransition, registerCheck, registerTick, registerTrait, setDebugEnabled, setEntityProvider, setTickActive, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, subscribeToVerification, toggleDebug, unregisterTick, unregisterTrait, updateAssetStatus, updateBridgeHealth, updateCheck, updateGuardResult, updateTickExecution, updateTraitState, waitForTransition };
package/dist/lib/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  export { DEFAULT_CONFIG, extractOutputsFromTransitions, extractStateMachine, formatGuard, getEffectSummary, parseContentSegments, parseMarkdownWithCodeBlocks, renderStateMachineToDomData, renderStateMachineToSvg } from '../chunk-N6DJVKZ6.js';
2
2
  export { ApiError, apiClient } from '../chunk-3HJHHULT.js';
3
- export { bindEventBus, bindTraitStateGetter, clearVerification, getAllChecks, getBridgeHealth, getSnapshot, getSummary, getTransitions, getTransitionsForTrait, recordTransition, registerCheck, subscribeToVerification, updateBridgeHealth, updateCheck, waitForTransition } from '../chunk-45CTDYBT.js';
4
- export { cn, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getNestedValue, isDebugEnabled } from '../chunk-KKCVDUK7.js';
3
+ export { bindCanvasCapture, bindEventBus, bindTraitStateGetter, clearVerification, cn, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getAllChecks, getBridgeHealth, getNestedValue, getSnapshot, getSummary, getTransitions, getTransitionsForTrait, isDebugEnabled, recordTransition, registerCheck, subscribeToVerification, updateAssetStatus, updateBridgeHealth, updateCheck, waitForTransition } from '../chunk-A5J5CNCU.js';
5
4
  import '../chunk-PKBMQBKP.js';
6
5
 
7
6
  // lib/debugUtils.ts
@@ -1,12 +1,11 @@
1
- import { SuspenseConfigProvider } from '../chunk-LEWQP2UP.js';
1
+ import { SuspenseConfigProvider } from '../chunk-NES4SBB7.js';
2
2
  import { ThemeProvider } from '../chunk-DKQN5FVU.js';
3
3
  import { SelectionProvider, EntityDataProvider } from '../chunk-WGJIL4YR.js';
4
4
  export { SelectionContext, SelectionProvider, useSelection, useSelectionOptional } from '../chunk-WGJIL4YR.js';
5
5
  import { useEventBus, EventBusProvider } from '../chunk-YXZM3WCF.js';
6
6
  export { EventBusContext, EventBusProvider } from '../chunk-YXZM3WCF.js';
7
7
  import '../chunk-3JGAROCW.js';
8
- import { recordTransition, registerCheck, bindEventBus, bindTraitStateGetter } from '../chunk-45CTDYBT.js';
9
- import '../chunk-KKCVDUK7.js';
8
+ import { recordTransition, registerCheck, bindEventBus, bindTraitStateGetter } from '../chunk-A5J5CNCU.js';
10
9
  import '../chunk-TSETXL2E.js';
11
10
  import { useOfflineExecutor } from '../chunk-K2D5D3WK.js';
12
11
  import '../chunk-PKBMQBKP.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "2.6.0",
3
+ "version": "2.8.1",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",
@@ -1,104 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
-
4
- // lib/cn.ts
5
- function cn(...inputs) {
6
- return twMerge(clsx(inputs));
7
- }
8
-
9
- // lib/debug.ts
10
- var DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
11
- function isDebugEnabled() {
12
- return DEBUG_ENABLED;
13
- }
14
- function debug(...args) {
15
- if (DEBUG_ENABLED) {
16
- console.log("[DEBUG]", ...args);
17
- }
18
- }
19
- function debugGroup(label) {
20
- if (DEBUG_ENABLED) {
21
- console.group(`[DEBUG] ${label}`);
22
- }
23
- }
24
- function debugGroupEnd() {
25
- if (DEBUG_ENABLED) {
26
- console.groupEnd();
27
- }
28
- }
29
- function debugWarn(...args) {
30
- if (DEBUG_ENABLED) {
31
- console.warn("[DEBUG]", ...args);
32
- }
33
- }
34
- function debugError(...args) {
35
- if (DEBUG_ENABLED) {
36
- console.error("[DEBUG]", ...args);
37
- }
38
- }
39
- function debugTable(data) {
40
- if (DEBUG_ENABLED) {
41
- console.table(data);
42
- }
43
- }
44
- function debugTime(label) {
45
- if (DEBUG_ENABLED) {
46
- console.time(`[DEBUG] ${label}`);
47
- }
48
- }
49
- function debugTimeEnd(label) {
50
- if (DEBUG_ENABLED) {
51
- console.timeEnd(`[DEBUG] ${label}`);
52
- }
53
- }
54
- function debugInput(inputType, data) {
55
- if (DEBUG_ENABLED) {
56
- console.log(`[DEBUG:INPUT] ${inputType}:`, data);
57
- }
58
- }
59
- function debugCollision(entityA, entityB, details) {
60
- if (DEBUG_ENABLED) {
61
- console.log(
62
- `[DEBUG:COLLISION] ${entityA.type || entityA.id} <-> ${entityB.type || entityB.id}`,
63
- details ?? ""
64
- );
65
- }
66
- }
67
- function debugPhysics(entityId, physics) {
68
- if (DEBUG_ENABLED) {
69
- console.log(`[DEBUG:PHYSICS] ${entityId}:`, physics);
70
- }
71
- }
72
- function debugGameState(stateName, value) {
73
- if (DEBUG_ENABLED) {
74
- console.log(`[DEBUG:GAME_STATE] ${stateName}:`, value);
75
- }
76
- }
77
-
78
- // lib/getNestedValue.ts
79
- function getNestedValue(obj, path) {
80
- if (obj === null || obj === void 0) {
81
- return void 0;
82
- }
83
- if (!path.includes(".")) {
84
- return obj[path];
85
- }
86
- const parts = path.split(".");
87
- let value = obj;
88
- for (const part of parts) {
89
- if (value === null || value === void 0) {
90
- return void 0;
91
- }
92
- if (typeof value !== "object") {
93
- return void 0;
94
- }
95
- value = value[part];
96
- }
97
- return value;
98
- }
99
- function formatNestedFieldLabel(path) {
100
- const lastPart = path.includes(".") ? path.split(".").pop() : path;
101
- return lastPart.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).replace(/Id$/, "").trim();
102
- }
103
-
104
- export { cn, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getNestedValue, isDebugEnabled };