@almadar/ui 2.6.0 → 2.7.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.
@@ -1,3 +1,106 @@
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
+
1
104
  // lib/verificationRegistry.ts
2
105
  var checks = /* @__PURE__ */ new Map();
3
106
  var transitions = [];
@@ -154,6 +257,22 @@ function bindEventBus(eventBus) {
154
257
  window.__orbitalVerification.sendEvent = (event, payload) => {
155
258
  eventBus.emit(event, payload);
156
259
  };
260
+ const eventLog = [];
261
+ window.__orbitalVerification.eventLog = eventLog;
262
+ window.__orbitalVerification.clearEventLog = () => {
263
+ eventLog.length = 0;
264
+ };
265
+ if (eventBus.onAny) {
266
+ eventBus.onAny((event) => {
267
+ if (eventLog.length < 200) {
268
+ eventLog.push({
269
+ type: event.type,
270
+ payload: event.payload,
271
+ timestamp: Date.now()
272
+ });
273
+ }
274
+ });
275
+ }
157
276
  }
158
277
  }
159
278
  function bindTraitStateGetter(getter) {
@@ -163,6 +282,23 @@ function bindTraitStateGetter(getter) {
163
282
  window.__orbitalVerification.getTraitState = getter;
164
283
  }
165
284
  }
285
+ function bindCanvasCapture(captureFn) {
286
+ if (typeof window === "undefined") return;
287
+ exposeOnWindow();
288
+ if (window.__orbitalVerification) {
289
+ window.__orbitalVerification.captureFrame = captureFn;
290
+ }
291
+ }
292
+ function updateAssetStatus(url, status) {
293
+ if (typeof window === "undefined") return;
294
+ exposeOnWindow();
295
+ if (window.__orbitalVerification) {
296
+ if (!window.__orbitalVerification.assetStatus) {
297
+ window.__orbitalVerification.assetStatus = {};
298
+ }
299
+ window.__orbitalVerification.assetStatus[url] = status;
300
+ }
301
+ }
166
302
  function clearVerification() {
167
303
  checks.clear();
168
304
  transitions.length = 0;
@@ -171,4 +307,4 @@ function clearVerification() {
171
307
  }
172
308
  exposeOnWindow();
173
309
 
174
- export { bindEventBus, bindTraitStateGetter, clearVerification, getAllChecks, getBridgeHealth, getSnapshot, getSummary, getTransitions, getTransitionsForTrait, recordTransition, registerCheck, subscribeToVerification, updateBridgeHealth, updateCheck, waitForTransition };
310
+ 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 };