@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.
@@ -1,3 +1,80 @@
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
+
1
78
  // lib/verificationRegistry.ts
2
79
  var checks = /* @__PURE__ */ new Map();
3
80
  var transitions = [];
@@ -154,6 +231,22 @@ function bindEventBus(eventBus) {
154
231
  window.__orbitalVerification.sendEvent = (event, payload) => {
155
232
  eventBus.emit(event, payload);
156
233
  };
234
+ const eventLog = [];
235
+ window.__orbitalVerification.eventLog = eventLog;
236
+ window.__orbitalVerification.clearEventLog = () => {
237
+ eventLog.length = 0;
238
+ };
239
+ if (eventBus.onAny) {
240
+ eventBus.onAny((event) => {
241
+ if (eventLog.length < 200) {
242
+ eventLog.push({
243
+ type: event.type,
244
+ payload: event.payload,
245
+ timestamp: Date.now()
246
+ });
247
+ }
248
+ });
249
+ }
157
250
  }
158
251
  }
159
252
  function bindTraitStateGetter(getter) {
@@ -163,6 +256,23 @@ function bindTraitStateGetter(getter) {
163
256
  window.__orbitalVerification.getTraitState = getter;
164
257
  }
165
258
  }
259
+ function bindCanvasCapture(captureFn) {
260
+ if (typeof window === "undefined") return;
261
+ exposeOnWindow();
262
+ if (window.__orbitalVerification) {
263
+ window.__orbitalVerification.captureFrame = captureFn;
264
+ }
265
+ }
266
+ function updateAssetStatus(url, status) {
267
+ if (typeof window === "undefined") return;
268
+ exposeOnWindow();
269
+ if (window.__orbitalVerification) {
270
+ if (!window.__orbitalVerification.assetStatus) {
271
+ window.__orbitalVerification.assetStatus = {};
272
+ }
273
+ window.__orbitalVerification.assetStatus[url] = status;
274
+ }
275
+ }
166
276
  function clearVerification() {
167
277
  checks.clear();
168
278
  transitions.length = 0;
@@ -171,4 +281,30 @@ function clearVerification() {
171
281
  }
172
282
  exposeOnWindow();
173
283
 
174
- export { bindEventBus, bindTraitStateGetter, clearVerification, getAllChecks, getBridgeHealth, getSnapshot, getSummary, getTransitions, getTransitionsForTrait, recordTransition, registerCheck, subscribeToVerification, updateBridgeHealth, updateCheck, waitForTransition };
284
+ // lib/getNestedValue.ts
285
+ function getNestedValue(obj, path) {
286
+ if (obj === null || obj === void 0) {
287
+ return void 0;
288
+ }
289
+ if (!path.includes(".")) {
290
+ return obj[path];
291
+ }
292
+ const parts = path.split(".");
293
+ let value = obj;
294
+ for (const part of parts) {
295
+ if (value === null || value === void 0) {
296
+ return void 0;
297
+ }
298
+ if (typeof value !== "object") {
299
+ return void 0;
300
+ }
301
+ value = value[part];
302
+ }
303
+ return value;
304
+ }
305
+ function formatNestedFieldLabel(path) {
306
+ const lastPart = path.includes(".") ? path.split(".").pop() : path;
307
+ return lastPart.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).replace(/Id$/, "").trim();
308
+ }
309
+
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 };