@almadar/ui 2.46.0 → 2.47.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.
@@ -47,6 +47,7 @@ var core = require('@almadar/core');
47
47
  require('@tanstack/react-query');
48
48
  var runtime = require('@almadar/runtime');
49
49
 
50
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
50
51
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
51
52
 
52
53
  function _interopNamespace(e) {
@@ -2864,6 +2865,68 @@ var init_Avl3DLabel = __esm({
2864
2865
  Avl3DLabel.displayName = "Avl3DLabel";
2865
2866
  }
2866
2867
  });
2868
+
2869
+ // lib/logger.ts
2870
+ function getViteEnv(key) {
2871
+ try {
2872
+ const meta = ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) });
2873
+ return meta?.env?.[key];
2874
+ } catch {
2875
+ return void 0;
2876
+ }
2877
+ }
2878
+ function envGet(key, viteKey) {
2879
+ return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
2880
+ }
2881
+ function matchesNamespace(namespace) {
2882
+ if (DEBUG_FILTER.length === 0) return true;
2883
+ return DEBUG_FILTER.some((pattern) => {
2884
+ if (pattern === "*" || pattern === "almadar:*") return true;
2885
+ if (pattern.endsWith(":*")) return namespace.startsWith(pattern.slice(0, -1));
2886
+ return namespace === pattern;
2887
+ });
2888
+ }
2889
+ function createLogger(namespace) {
2890
+ const nsAllowed = matchesNamespace(namespace);
2891
+ const log4 = (level, message, data, correlationId) => {
2892
+ if (LEVEL_PRIORITY[level] < MIN_PRIORITY) return;
2893
+ if (level === "DEBUG" && !nsAllowed) return;
2894
+ const prefix = `[${namespace}]`;
2895
+ const logData = correlationId ? { ...data, cid: correlationId } : data;
2896
+ switch (level) {
2897
+ case "DEBUG":
2898
+ console.debug(prefix, message, logData ?? "");
2899
+ break;
2900
+ case "INFO":
2901
+ console.info(prefix, message, logData ?? "");
2902
+ break;
2903
+ case "WARN":
2904
+ console.warn(prefix, message, logData ?? "");
2905
+ break;
2906
+ case "ERROR":
2907
+ console.error(prefix, message, logData ?? "");
2908
+ break;
2909
+ }
2910
+ };
2911
+ return {
2912
+ debug: (msg, data, cid) => log4("DEBUG", msg, data, cid),
2913
+ info: (msg, data, cid) => log4("INFO", msg, data, cid),
2914
+ warn: (msg, data, cid) => log4("WARN", msg, data, cid),
2915
+ error: (msg, data, cid) => log4("ERROR", msg, data, cid)
2916
+ };
2917
+ }
2918
+ var LEVEL_PRIORITY, ENV, VITE_ENV, NODE_ENV, CONFIGURED_LEVEL, MIN_PRIORITY, DEBUG_FILTER;
2919
+ var init_logger = __esm({
2920
+ "lib/logger.ts"() {
2921
+ LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
2922
+ ENV = typeof process !== "undefined" && process.env ? process.env : {};
2923
+ VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
2924
+ NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
2925
+ CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
2926
+ MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
2927
+ DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
2928
+ }
2929
+ });
2867
2930
  function EventBusProvider({ children, debug: debug2 = false }) {
2868
2931
  const listenersRef = React125.useRef(/* @__PURE__ */ new Map());
2869
2932
  const anyListenersRef = React125.useRef(/* @__PURE__ */ new Set());
@@ -2892,7 +2955,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2892
2955
  timestamp: Date.now()
2893
2956
  };
2894
2957
  const listeners6 = listenersRef.current.get(type);
2895
- const listenerCount = listeners6?.size ?? 0;
2958
+ const listenerCount = (listeners6?.size ?? 0) + anyListenersRef.current.size;
2959
+ busLog.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount });
2896
2960
  if (debug2) {
2897
2961
  if (listenerCount > 0) {
2898
2962
  console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
@@ -2925,6 +2989,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2925
2989
  }
2926
2990
  const listeners6 = listenersRef.current.get(type);
2927
2991
  listeners6.add(listener);
2992
+ subLog.debug("subscribe", { type, totalListeners: listeners6.size });
2928
2993
  if (debug2) {
2929
2994
  console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
2930
2995
  }
@@ -2951,6 +3016,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2951
3016
  }, []);
2952
3017
  const onAny = React125.useCallback((listener) => {
2953
3018
  anyListenersRef.current.add(listener);
3019
+ subLog.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size });
2954
3020
  if (debug2) {
2955
3021
  console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
2956
3022
  }
@@ -2981,11 +3047,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2981
3047
  }, [contextValue2]);
2982
3048
  return /* @__PURE__ */ jsxRuntime.jsx(EventBusContext.Provider, { value: contextValue2, children });
2983
3049
  }
2984
- var EventBusContext;
3050
+ var busLog, subLog, EventBusContext;
2985
3051
  var init_EventBusProvider = __esm({
2986
3052
  "providers/EventBusProvider.tsx"() {
2987
3053
  "use client";
2988
3054
  init_useEventBus();
3055
+ init_logger();
3056
+ busLog = createLogger("almadar:eventbus");
3057
+ subLog = createLogger("almadar:eventbus:subscribe");
2989
3058
  EventBusContext = React125.createContext(null);
2990
3059
  }
2991
3060
  });
@@ -3027,11 +3096,14 @@ function useEmitEvent() {
3027
3096
  [eventBus]
3028
3097
  );
3029
3098
  }
3030
- var fallbackListeners, fallbackAnyListeners, fallbackEventBus;
3099
+ var log, subLog2, fallbackListeners, fallbackAnyListeners, fallbackEventBus;
3031
3100
  var init_useEventBus = __esm({
3032
3101
  "hooks/useEventBus.ts"() {
3033
3102
  "use client";
3034
3103
  init_EventBusProvider();
3104
+ init_logger();
3105
+ log = createLogger("almadar:eventbus");
3106
+ subLog2 = createLogger("almadar:eventbus:subscribe");
3035
3107
  fallbackListeners = /* @__PURE__ */ new Map();
3036
3108
  fallbackAnyListeners = /* @__PURE__ */ new Set();
3037
3109
  fallbackEventBus = {
@@ -3042,6 +3114,7 @@ var init_useEventBus = __esm({
3042
3114
  timestamp: Date.now()
3043
3115
  };
3044
3116
  const handlers = fallbackListeners.get(type);
3117
+ log.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount: (handlers?.size ?? 0) + fallbackAnyListeners.size });
3045
3118
  if (handlers) {
3046
3119
  handlers.forEach((handler) => {
3047
3120
  try {
@@ -3064,6 +3137,7 @@ var init_useEventBus = __esm({
3064
3137
  fallbackListeners.set(type, /* @__PURE__ */ new Set());
3065
3138
  }
3066
3139
  fallbackListeners.get(type).add(listener);
3140
+ subLog2.debug("subscribe", { type, totalListeners: fallbackListeners.get(type).size });
3067
3141
  return () => {
3068
3142
  const handlers = fallbackListeners.get(type);
3069
3143
  if (handlers) {
@@ -3087,6 +3161,7 @@ var init_useEventBus = __esm({
3087
3161
  },
3088
3162
  onAny: (listener) => {
3089
3163
  fallbackAnyListeners.add(listener);
3164
+ subLog2.debug("subscribe:any", { totalAnyListeners: fallbackAnyListeners.size });
3090
3165
  return () => {
3091
3166
  fallbackAnyListeners.delete(listener);
3092
3167
  };
@@ -3225,6 +3300,7 @@ var init_Box = __esm({
3225
3300
  action,
3226
3301
  actionPayload,
3227
3302
  hoverEvent,
3303
+ maxWidth,
3228
3304
  onClick,
3229
3305
  onMouseEnter,
3230
3306
  onMouseLeave,
@@ -3289,6 +3365,7 @@ var init_Box = __esm({
3289
3365
  onClick: isClickable ? handleClick : void 0,
3290
3366
  onMouseEnter: hoverEvent || onMouseEnter ? handleMouseEnter : void 0,
3291
3367
  onMouseLeave: hoverEvent || onMouseLeave ? handleMouseLeave : void 0,
3368
+ style: maxWidth ? { maxWidth, ...rest.style } : rest.style,
3292
3369
  ...rest,
3293
3370
  children
3294
3371
  }
@@ -13336,6 +13413,10 @@ function useTheme() {
13336
13413
  }
13337
13414
  return context;
13338
13415
  }
13416
+
13417
+ // providers/EntityStoreProvider.tsx
13418
+ init_logger();
13419
+ var storeLog = createLogger("almadar:entity:store");
13339
13420
  var store = /* @__PURE__ */ new Map();
13340
13421
  var storeListeners = /* @__PURE__ */ new Set();
13341
13422
  var watchCallbacks = /* @__PURE__ */ new Map();
@@ -13375,7 +13456,9 @@ function setAll(entityType, records) {
13375
13456
  }
13376
13457
  }
13377
13458
  const prev = store.get(entityType);
13378
- store.set(entityType, { entities, ids, version: (prev?.version ?? 0) + 1 });
13459
+ const newVersion = (prev?.version ?? 0) + 1;
13460
+ store.set(entityType, { entities, ids, version: newVersion });
13461
+ storeLog.debug("setAll", { entityType, recordCount: records.length, version: newVersion });
13379
13462
  notifyListeners(entityType, prev);
13380
13463
  }
13381
13464
  function upsertOne(entityType, record) {
@@ -13387,6 +13470,7 @@ function upsertOne(entityType, record) {
13387
13470
  if (!snapshot.ids.includes(id)) snapshot.ids.push(id);
13388
13471
  snapshot.version++;
13389
13472
  store.set(entityType, snapshot);
13473
+ storeLog.debug("upsertOne", { entityType, id, version: snapshot.version });
13390
13474
  notifyListeners(entityType, prev);
13391
13475
  }
13392
13476
  function addOne(entityType, record) {
@@ -13403,6 +13487,7 @@ function updateOne(entityType, id, changes) {
13403
13487
  snapshot.entities.set(id, { ...snapshot.entities.get(id), ...changes });
13404
13488
  snapshot.version++;
13405
13489
  store.set(entityType, snapshot);
13490
+ storeLog.debug("updateOne", { entityType, id, changedFields: Object.keys(changes), version: snapshot.version });
13406
13491
  notifyListeners(entityType, prev);
13407
13492
  }
13408
13493
  function removeOne(entityType, id) {
@@ -13416,6 +13501,7 @@ function removeOne(entityType, id) {
13416
13501
  snapshot.entities.delete(id);
13417
13502
  snapshot.version++;
13418
13503
  store.set(entityType, snapshot);
13504
+ storeLog.debug("removeOne", { entityType, id, remainingCount: snapshot.ids.length, version: snapshot.version });
13419
13505
  notifyListeners(entityType, prev);
13420
13506
  }
13421
13507
  function getSnapshot(entityType) {
@@ -20211,6 +20297,8 @@ var LoadingState = ({
20211
20297
  LoadingState.displayName = "LoadingState";
20212
20298
 
20213
20299
  // lib/verificationRegistry.ts
20300
+ init_logger();
20301
+ var log2 = createLogger("almadar:bridge");
20214
20302
  var MAX_TRANSITIONS = 500;
20215
20303
  function getState() {
20216
20304
  if (typeof window !== "undefined") {
@@ -20243,6 +20331,7 @@ function recordTransition(trace) {
20243
20331
  ...trace,
20244
20332
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
20245
20333
  };
20334
+ log2.info("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
20246
20335
  getState().transitions.push(entry);
20247
20336
  if (getState().transitions.length > MAX_TRANSITIONS) {
20248
20337
  getState().transitions.shift();
@@ -20374,10 +20463,12 @@ function waitForTransition(event, timeoutMs = 1e4) {
20374
20463
  }
20375
20464
  function bindEventBus(eventBus) {
20376
20465
  if (typeof window === "undefined") return;
20466
+ log2.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
20377
20467
  exposeOnWindow();
20378
20468
  if (window.__orbitalVerification) {
20379
20469
  window.__orbitalVerification.sendEvent = (event, payload) => {
20380
20470
  const prefixed = event.startsWith("UI:") ? event : `UI:${event}`;
20471
+ log2.debug("sendEvent", { event: prefixed, payloadKeys: payload ? Object.keys(payload) : [] });
20381
20472
  eventBus.emit(prefixed, payload);
20382
20473
  };
20383
20474
  const eventLog = [];
@@ -41427,7 +41518,7 @@ function getAllEvents(traits2) {
41427
41518
  }
41428
41519
  function EventDispatcherTab({ traits: traits2, schema }) {
41429
41520
  const eventBus = useEventBus();
41430
- const [log, setLog] = React125__namespace.useState([]);
41521
+ const [log4, setLog] = React125__namespace.useState([]);
41431
41522
  const prevStatesRef = React125__namespace.useRef(/* @__PURE__ */ new Map());
41432
41523
  React125__namespace.useEffect(() => {
41433
41524
  for (const trait of traits2) {
@@ -41491,9 +41582,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
41491
41582
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
41492
41583
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
41493
41584
  ] }),
41494
- log.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
41585
+ log4.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
41495
41586
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
41496
- /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
41587
+ /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log4.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
41497
41588
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
41498
41589
  " ",
41499
41590
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -46119,6 +46210,8 @@ UISlotRenderer.displayName = "UISlotRenderer";
46119
46210
 
46120
46211
  // providers/VerificationProvider.tsx
46121
46212
  init_useEventBus();
46213
+ init_logger();
46214
+ var log3 = createLogger("almadar:verify");
46122
46215
  var DISPATCH_SUFFIX = ":DISPATCH";
46123
46216
  var SUCCESS_SUFFIX = ":SUCCESS";
46124
46217
  var ERROR_SUFFIX = ":ERROR";
@@ -46164,6 +46257,7 @@ function VerificationProvider({
46164
46257
  const unsub = eventBus.onAny((evt) => {
46165
46258
  const parsed = parseLifecycleEvent(evt.type);
46166
46259
  if (!parsed) return;
46260
+ log3.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
46167
46261
  const payload = evt.payload ?? {};
46168
46262
  if (parsed.kind === "dispatch") {
46169
46263
  const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
@@ -46216,6 +46310,7 @@ function VerificationProvider({
46216
46310
  },
46217
46311
  timestamp: Date.now()
46218
46312
  });
46313
+ log3.info("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
46219
46314
  } else if (parsed.kind === "error" && parsed.event) {
46220
46315
  const key = `${parsed.traitName}:${parsed.event}`;
46221
46316
  const pending = pendingRef.current.get(key);
@@ -46245,6 +46340,7 @@ function VerificationProvider({
46245
46340
  },
46246
46341
  timestamp: Date.now()
46247
46342
  });
46343
+ log3.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
46248
46344
  }
46249
46345
  });
46250
46346
  registerCheck(
package/dist/avl/index.js CHANGED
@@ -2817,6 +2817,68 @@ var init_Avl3DLabel = __esm({
2817
2817
  Avl3DLabel.displayName = "Avl3DLabel";
2818
2818
  }
2819
2819
  });
2820
+
2821
+ // lib/logger.ts
2822
+ function getViteEnv(key) {
2823
+ try {
2824
+ const meta = import.meta;
2825
+ return meta?.env?.[key];
2826
+ } catch {
2827
+ return void 0;
2828
+ }
2829
+ }
2830
+ function envGet(key, viteKey) {
2831
+ return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
2832
+ }
2833
+ function matchesNamespace(namespace) {
2834
+ if (DEBUG_FILTER.length === 0) return true;
2835
+ return DEBUG_FILTER.some((pattern) => {
2836
+ if (pattern === "*" || pattern === "almadar:*") return true;
2837
+ if (pattern.endsWith(":*")) return namespace.startsWith(pattern.slice(0, -1));
2838
+ return namespace === pattern;
2839
+ });
2840
+ }
2841
+ function createLogger(namespace) {
2842
+ const nsAllowed = matchesNamespace(namespace);
2843
+ const log4 = (level, message, data, correlationId) => {
2844
+ if (LEVEL_PRIORITY[level] < MIN_PRIORITY) return;
2845
+ if (level === "DEBUG" && !nsAllowed) return;
2846
+ const prefix = `[${namespace}]`;
2847
+ const logData = correlationId ? { ...data, cid: correlationId } : data;
2848
+ switch (level) {
2849
+ case "DEBUG":
2850
+ console.debug(prefix, message, logData ?? "");
2851
+ break;
2852
+ case "INFO":
2853
+ console.info(prefix, message, logData ?? "");
2854
+ break;
2855
+ case "WARN":
2856
+ console.warn(prefix, message, logData ?? "");
2857
+ break;
2858
+ case "ERROR":
2859
+ console.error(prefix, message, logData ?? "");
2860
+ break;
2861
+ }
2862
+ };
2863
+ return {
2864
+ debug: (msg, data, cid) => log4("DEBUG", msg, data, cid),
2865
+ info: (msg, data, cid) => log4("INFO", msg, data, cid),
2866
+ warn: (msg, data, cid) => log4("WARN", msg, data, cid),
2867
+ error: (msg, data, cid) => log4("ERROR", msg, data, cid)
2868
+ };
2869
+ }
2870
+ var LEVEL_PRIORITY, ENV, VITE_ENV, NODE_ENV, CONFIGURED_LEVEL, MIN_PRIORITY, DEBUG_FILTER;
2871
+ var init_logger = __esm({
2872
+ "lib/logger.ts"() {
2873
+ LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
2874
+ ENV = typeof process !== "undefined" && process.env ? process.env : {};
2875
+ VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
2876
+ NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
2877
+ CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
2878
+ MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
2879
+ DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
2880
+ }
2881
+ });
2820
2882
  function EventBusProvider({ children, debug: debug2 = false }) {
2821
2883
  const listenersRef = useRef(/* @__PURE__ */ new Map());
2822
2884
  const anyListenersRef = useRef(/* @__PURE__ */ new Set());
@@ -2845,7 +2907,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2845
2907
  timestamp: Date.now()
2846
2908
  };
2847
2909
  const listeners6 = listenersRef.current.get(type);
2848
- const listenerCount = listeners6?.size ?? 0;
2910
+ const listenerCount = (listeners6?.size ?? 0) + anyListenersRef.current.size;
2911
+ busLog.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount });
2849
2912
  if (debug2) {
2850
2913
  if (listenerCount > 0) {
2851
2914
  console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
@@ -2878,6 +2941,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2878
2941
  }
2879
2942
  const listeners6 = listenersRef.current.get(type);
2880
2943
  listeners6.add(listener);
2944
+ subLog.debug("subscribe", { type, totalListeners: listeners6.size });
2881
2945
  if (debug2) {
2882
2946
  console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
2883
2947
  }
@@ -2904,6 +2968,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2904
2968
  }, []);
2905
2969
  const onAny = useCallback((listener) => {
2906
2970
  anyListenersRef.current.add(listener);
2971
+ subLog.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size });
2907
2972
  if (debug2) {
2908
2973
  console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
2909
2974
  }
@@ -2934,11 +2999,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2934
2999
  }, [contextValue2]);
2935
3000
  return /* @__PURE__ */ jsx(EventBusContext.Provider, { value: contextValue2, children });
2936
3001
  }
2937
- var EventBusContext;
3002
+ var busLog, subLog, EventBusContext;
2938
3003
  var init_EventBusProvider = __esm({
2939
3004
  "providers/EventBusProvider.tsx"() {
2940
3005
  "use client";
2941
3006
  init_useEventBus();
3007
+ init_logger();
3008
+ busLog = createLogger("almadar:eventbus");
3009
+ subLog = createLogger("almadar:eventbus:subscribe");
2942
3010
  EventBusContext = createContext(null);
2943
3011
  }
2944
3012
  });
@@ -2980,11 +3048,14 @@ function useEmitEvent() {
2980
3048
  [eventBus]
2981
3049
  );
2982
3050
  }
2983
- var fallbackListeners, fallbackAnyListeners, fallbackEventBus;
3051
+ var log, subLog2, fallbackListeners, fallbackAnyListeners, fallbackEventBus;
2984
3052
  var init_useEventBus = __esm({
2985
3053
  "hooks/useEventBus.ts"() {
2986
3054
  "use client";
2987
3055
  init_EventBusProvider();
3056
+ init_logger();
3057
+ log = createLogger("almadar:eventbus");
3058
+ subLog2 = createLogger("almadar:eventbus:subscribe");
2988
3059
  fallbackListeners = /* @__PURE__ */ new Map();
2989
3060
  fallbackAnyListeners = /* @__PURE__ */ new Set();
2990
3061
  fallbackEventBus = {
@@ -2995,6 +3066,7 @@ var init_useEventBus = __esm({
2995
3066
  timestamp: Date.now()
2996
3067
  };
2997
3068
  const handlers = fallbackListeners.get(type);
3069
+ log.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount: (handlers?.size ?? 0) + fallbackAnyListeners.size });
2998
3070
  if (handlers) {
2999
3071
  handlers.forEach((handler) => {
3000
3072
  try {
@@ -3017,6 +3089,7 @@ var init_useEventBus = __esm({
3017
3089
  fallbackListeners.set(type, /* @__PURE__ */ new Set());
3018
3090
  }
3019
3091
  fallbackListeners.get(type).add(listener);
3092
+ subLog2.debug("subscribe", { type, totalListeners: fallbackListeners.get(type).size });
3020
3093
  return () => {
3021
3094
  const handlers = fallbackListeners.get(type);
3022
3095
  if (handlers) {
@@ -3040,6 +3113,7 @@ var init_useEventBus = __esm({
3040
3113
  },
3041
3114
  onAny: (listener) => {
3042
3115
  fallbackAnyListeners.add(listener);
3116
+ subLog2.debug("subscribe:any", { totalAnyListeners: fallbackAnyListeners.size });
3043
3117
  return () => {
3044
3118
  fallbackAnyListeners.delete(listener);
3045
3119
  };
@@ -3178,6 +3252,7 @@ var init_Box = __esm({
3178
3252
  action,
3179
3253
  actionPayload,
3180
3254
  hoverEvent,
3255
+ maxWidth,
3181
3256
  onClick,
3182
3257
  onMouseEnter,
3183
3258
  onMouseLeave,
@@ -3242,6 +3317,7 @@ var init_Box = __esm({
3242
3317
  onClick: isClickable ? handleClick : void 0,
3243
3318
  onMouseEnter: hoverEvent || onMouseEnter ? handleMouseEnter : void 0,
3244
3319
  onMouseLeave: hoverEvent || onMouseLeave ? handleMouseLeave : void 0,
3320
+ style: maxWidth ? { maxWidth, ...rest.style } : rest.style,
3245
3321
  ...rest,
3246
3322
  children
3247
3323
  }
@@ -13289,6 +13365,10 @@ function useTheme() {
13289
13365
  }
13290
13366
  return context;
13291
13367
  }
13368
+
13369
+ // providers/EntityStoreProvider.tsx
13370
+ init_logger();
13371
+ var storeLog = createLogger("almadar:entity:store");
13292
13372
  var store = /* @__PURE__ */ new Map();
13293
13373
  var storeListeners = /* @__PURE__ */ new Set();
13294
13374
  var watchCallbacks = /* @__PURE__ */ new Map();
@@ -13328,7 +13408,9 @@ function setAll(entityType, records) {
13328
13408
  }
13329
13409
  }
13330
13410
  const prev = store.get(entityType);
13331
- store.set(entityType, { entities, ids, version: (prev?.version ?? 0) + 1 });
13411
+ const newVersion = (prev?.version ?? 0) + 1;
13412
+ store.set(entityType, { entities, ids, version: newVersion });
13413
+ storeLog.debug("setAll", { entityType, recordCount: records.length, version: newVersion });
13332
13414
  notifyListeners(entityType, prev);
13333
13415
  }
13334
13416
  function upsertOne(entityType, record) {
@@ -13340,6 +13422,7 @@ function upsertOne(entityType, record) {
13340
13422
  if (!snapshot.ids.includes(id)) snapshot.ids.push(id);
13341
13423
  snapshot.version++;
13342
13424
  store.set(entityType, snapshot);
13425
+ storeLog.debug("upsertOne", { entityType, id, version: snapshot.version });
13343
13426
  notifyListeners(entityType, prev);
13344
13427
  }
13345
13428
  function addOne(entityType, record) {
@@ -13356,6 +13439,7 @@ function updateOne(entityType, id, changes) {
13356
13439
  snapshot.entities.set(id, { ...snapshot.entities.get(id), ...changes });
13357
13440
  snapshot.version++;
13358
13441
  store.set(entityType, snapshot);
13442
+ storeLog.debug("updateOne", { entityType, id, changedFields: Object.keys(changes), version: snapshot.version });
13359
13443
  notifyListeners(entityType, prev);
13360
13444
  }
13361
13445
  function removeOne(entityType, id) {
@@ -13369,6 +13453,7 @@ function removeOne(entityType, id) {
13369
13453
  snapshot.entities.delete(id);
13370
13454
  snapshot.version++;
13371
13455
  store.set(entityType, snapshot);
13456
+ storeLog.debug("removeOne", { entityType, id, remainingCount: snapshot.ids.length, version: snapshot.version });
13372
13457
  notifyListeners(entityType, prev);
13373
13458
  }
13374
13459
  function getSnapshot(entityType) {
@@ -20164,6 +20249,8 @@ var LoadingState = ({
20164
20249
  LoadingState.displayName = "LoadingState";
20165
20250
 
20166
20251
  // lib/verificationRegistry.ts
20252
+ init_logger();
20253
+ var log2 = createLogger("almadar:bridge");
20167
20254
  var MAX_TRANSITIONS = 500;
20168
20255
  function getState() {
20169
20256
  if (typeof window !== "undefined") {
@@ -20196,6 +20283,7 @@ function recordTransition(trace) {
20196
20283
  ...trace,
20197
20284
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
20198
20285
  };
20286
+ log2.info("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
20199
20287
  getState().transitions.push(entry);
20200
20288
  if (getState().transitions.length > MAX_TRANSITIONS) {
20201
20289
  getState().transitions.shift();
@@ -20327,10 +20415,12 @@ function waitForTransition(event, timeoutMs = 1e4) {
20327
20415
  }
20328
20416
  function bindEventBus(eventBus) {
20329
20417
  if (typeof window === "undefined") return;
20418
+ log2.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
20330
20419
  exposeOnWindow();
20331
20420
  if (window.__orbitalVerification) {
20332
20421
  window.__orbitalVerification.sendEvent = (event, payload) => {
20333
20422
  const prefixed = event.startsWith("UI:") ? event : `UI:${event}`;
20423
+ log2.debug("sendEvent", { event: prefixed, payloadKeys: payload ? Object.keys(payload) : [] });
20334
20424
  eventBus.emit(prefixed, payload);
20335
20425
  };
20336
20426
  const eventLog = [];
@@ -41380,7 +41470,7 @@ function getAllEvents(traits2) {
41380
41470
  }
41381
41471
  function EventDispatcherTab({ traits: traits2, schema }) {
41382
41472
  const eventBus = useEventBus();
41383
- const [log, setLog] = React125.useState([]);
41473
+ const [log4, setLog] = React125.useState([]);
41384
41474
  const prevStatesRef = React125.useRef(/* @__PURE__ */ new Map());
41385
41475
  React125.useEffect(() => {
41386
41476
  for (const trait of traits2) {
@@ -41444,9 +41534,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
41444
41534
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
41445
41535
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
41446
41536
  ] }),
41447
- log.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
41537
+ log4.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
41448
41538
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
41449
- /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
41539
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log4.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
41450
41540
  /* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
41451
41541
  " ",
41452
41542
  /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -46072,6 +46162,8 @@ UISlotRenderer.displayName = "UISlotRenderer";
46072
46162
 
46073
46163
  // providers/VerificationProvider.tsx
46074
46164
  init_useEventBus();
46165
+ init_logger();
46166
+ var log3 = createLogger("almadar:verify");
46075
46167
  var DISPATCH_SUFFIX = ":DISPATCH";
46076
46168
  var SUCCESS_SUFFIX = ":SUCCESS";
46077
46169
  var ERROR_SUFFIX = ":ERROR";
@@ -46117,6 +46209,7 @@ function VerificationProvider({
46117
46209
  const unsub = eventBus.onAny((evt) => {
46118
46210
  const parsed = parseLifecycleEvent(evt.type);
46119
46211
  if (!parsed) return;
46212
+ log3.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
46120
46213
  const payload = evt.payload ?? {};
46121
46214
  if (parsed.kind === "dispatch") {
46122
46215
  const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
@@ -46169,6 +46262,7 @@ function VerificationProvider({
46169
46262
  },
46170
46263
  timestamp: Date.now()
46171
46264
  });
46265
+ log3.info("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
46172
46266
  } else if (parsed.kind === "error" && parsed.event) {
46173
46267
  const key = `${parsed.traitName}:${parsed.event}`;
46174
46268
  const pending = pendingRef.current.get(key);
@@ -46198,6 +46292,7 @@ function VerificationProvider({
46198
46292
  },
46199
46293
  timestamp: Date.now()
46200
46294
  });
46295
+ log3.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
46201
46296
  }
46202
46297
  });
46203
46298
  registerCheck(
@@ -49,6 +49,10 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
49
49
  actionPayload?: Record<string, unknown>;
50
50
  /** Declarative hover event — emits UI:{hoverEvent} with { hovered: true/false } on mouseEnter/mouseLeave */
51
51
  hoverEvent?: string;
52
+ /** Maximum width (CSS value, e.g., "550px", "80rem") */
53
+ maxWidth?: string;
54
+ /** Children elements */
55
+ children?: React.ReactNode;
52
56
  }
53
57
  /**
54
58
  * Box - Versatile container component with design tokens