@almadar/ui 4.44.0 → 4.45.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,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var React136 = require('react');
4
+ var logger = require('@almadar/logger');
4
5
  var jsxRuntime = require('react/jsx-runtime');
5
6
  var providers = require('@almadar/ui/providers');
6
- var logger = require('@almadar/logger');
7
7
  var clsx = require('clsx');
8
8
  var tailwindMerge = require('tailwind-merge');
9
9
  var LucideIcons = require('lucide-react');
@@ -136,10 +136,11 @@ function useTheme() {
136
136
  }
137
137
  return context;
138
138
  }
139
- var BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
139
+ var log, BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
140
140
  var init_ThemeContext = __esm({
141
141
  "context/ThemeContext.tsx"() {
142
142
  "use client";
143
+ log = logger.createLogger("almadar:ui:theme");
143
144
  BUILT_IN_THEMES = [
144
145
  {
145
146
  name: "wireframe",
@@ -319,9 +320,10 @@ var init_ThemeContext = __esm({
319
320
  localStorage.setItem(THEME_STORAGE_KEY, newTheme);
320
321
  }
321
322
  } else {
322
- console.warn(
323
- `Theme "${newTheme}" not found. Available: ${availableThemes.map((t) => t.name).join(", ")}`
324
- );
323
+ log.warn("Theme not found", {
324
+ theme: newTheme,
325
+ available: availableThemes.map((t) => t.name)
326
+ });
325
327
  }
326
328
  },
327
329
  [availableThemes]
@@ -446,11 +448,11 @@ function useEmitEvent() {
446
448
  [eventBus]
447
449
  );
448
450
  }
449
- var log, subLog, scopeLog, fallbackListeners, fallbackAnyListeners, fallbackEventBus, useEventSubscription, useEventBus_default;
451
+ var log2, subLog, scopeLog, fallbackListeners, fallbackAnyListeners, fallbackEventBus, useEventSubscription, useEventBus_default;
450
452
  var init_useEventBus = __esm({
451
453
  "hooks/useEventBus.ts"() {
452
454
  "use client";
453
- log = logger.createLogger("almadar:eventbus");
455
+ log2 = logger.createLogger("almadar:eventbus");
454
456
  subLog = logger.createLogger("almadar:eventbus:subscribe");
455
457
  scopeLog = logger.createLogger("almadar:ui:trait-scope");
456
458
  fallbackListeners = /* @__PURE__ */ new Map();
@@ -464,13 +466,13 @@ var init_useEventBus = __esm({
464
466
  source
465
467
  };
466
468
  const handlers = fallbackListeners.get(type);
467
- log.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount: (handlers?.size ?? 0) + fallbackAnyListeners.size });
469
+ log2.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount: (handlers?.size ?? 0) + fallbackAnyListeners.size });
468
470
  if (handlers) {
469
471
  handlers.forEach((handler) => {
470
472
  try {
471
473
  handler(event);
472
474
  } catch (error) {
473
- console.error(`[EventBus] Error in listener for '${type}':`, error);
475
+ log2.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
474
476
  }
475
477
  });
476
478
  }
@@ -478,7 +480,7 @@ var init_useEventBus = __esm({
478
480
  try {
479
481
  handler(event);
480
482
  } catch (error) {
481
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
483
+ log2.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
482
484
  }
483
485
  });
484
486
  },
@@ -7384,8 +7386,6 @@ var init_Skeleton = __esm({
7384
7386
  Skeleton.displayName = "Skeleton";
7385
7387
  }
7386
7388
  });
7387
-
7388
- // renderer/client-effect-executor.ts
7389
7389
  function executeClientEffects(effects, config) {
7390
7390
  if (!effects || effects.length === 0) {
7391
7391
  return;
@@ -7394,11 +7394,10 @@ function executeClientEffects(effects, config) {
7394
7394
  try {
7395
7395
  executeEffect(effect, config);
7396
7396
  } catch (error) {
7397
- console.error(
7398
- `[ClientEffectExecutor] Error executing effect:`,
7399
- effect,
7400
- error
7401
- );
7397
+ log4.error("Error executing effect", () => ({
7398
+ effect: JSON.stringify(effect),
7399
+ error: error instanceof Error ? error : String(error)
7400
+ }));
7402
7401
  }
7403
7402
  }
7404
7403
  config.onComplete?.();
@@ -7427,7 +7426,7 @@ function executeEffect(effect, config) {
7427
7426
  break;
7428
7427
  }
7429
7428
  default:
7430
- console.warn(`[ClientEffectExecutor] Unknown effect type: ${effectType}`);
7429
+ log4.warn("Unknown effect type", { effectType: String(effectType) });
7431
7430
  }
7432
7431
  }
7433
7432
  function executeRenderUI(slot, patternConfig, config) {
@@ -7442,8 +7441,10 @@ function executeNotify(message, options, config) {
7442
7441
  function executeEmit(event, payload, config) {
7443
7442
  config.eventBus.emit(event, payload);
7444
7443
  }
7444
+ var log4;
7445
7445
  var init_client_effect_executor = __esm({
7446
7446
  "renderer/client-effect-executor.ts"() {
7447
+ log4 = logger.createLogger("almadar:ui:effects:client");
7447
7448
  }
7448
7449
  });
7449
7450
 
@@ -7604,11 +7605,12 @@ function useOfflineExecutor(options) {
7604
7605
  clearQueue
7605
7606
  };
7606
7607
  }
7607
- var effectIdCounter, OfflineExecutor;
7608
+ var log5, effectIdCounter, OfflineExecutor;
7608
7609
  var init_offline_executor = __esm({
7609
7610
  "renderer/offline-executor.ts"() {
7610
7611
  "use client";
7611
7612
  init_client_effect_executor();
7613
+ log5 = logger.createLogger("almadar:ui:effects:offline");
7612
7614
  effectIdCounter = 0;
7613
7615
  OfflineExecutor = class {
7614
7616
  constructor(config) {
@@ -7662,7 +7664,7 @@ var init_offline_executor = __esm({
7662
7664
  this.state.syncQueue = JSON.parse(stored);
7663
7665
  }
7664
7666
  } catch (error) {
7665
- console.warn("[OfflineExecutor] Failed to load sync queue:", error);
7667
+ log5.warn("Failed to load sync queue", { error: error instanceof Error ? error : String(error) });
7666
7668
  }
7667
7669
  }
7668
7670
  /**
@@ -7673,7 +7675,7 @@ var init_offline_executor = __esm({
7673
7675
  try {
7674
7676
  this.storage.setItem("orbital-offline-queue", JSON.stringify(this.state.syncQueue));
7675
7677
  } catch (error) {
7676
- console.warn("[OfflineExecutor] Failed to save sync queue:", error);
7678
+ log5.warn("Failed to save sync queue", { error: error instanceof Error ? error : String(error) });
7677
7679
  }
7678
7680
  }
7679
7681
  /**
@@ -7743,7 +7745,7 @@ var init_offline_executor = __esm({
7743
7745
  this.queueForSync(type, { args, event, payload });
7744
7746
  break;
7745
7747
  default:
7746
- console.warn(`[OfflineExecutor] Unknown effect type: ${type}`);
7748
+ log5.warn("Unknown effect type", { type });
7747
7749
  }
7748
7750
  }
7749
7751
  }
@@ -10318,7 +10320,7 @@ function recordTransition(trace) {
10318
10320
  ...trace,
10319
10321
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
10320
10322
  };
10321
- log2.info("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10323
+ log6.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10322
10324
  getState().transitions.push(entry);
10323
10325
  if (getState().transitions.length > MAX_TRANSITIONS) {
10324
10326
  getState().transitions.shift();
@@ -10387,7 +10389,7 @@ function getTraitSnapshots() {
10387
10389
  try {
10388
10390
  snapshots.push(getter());
10389
10391
  } catch (err) {
10390
- log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10392
+ log6.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10391
10393
  }
10392
10394
  }
10393
10395
  return snapshots;
@@ -10435,12 +10437,12 @@ function waitForTransition(event, timeoutMs = 1e4) {
10435
10437
  }
10436
10438
  function bindEventBus(eventBus) {
10437
10439
  if (typeof window === "undefined") return;
10438
- log2.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
10440
+ log6.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
10439
10441
  exposeOnWindow();
10440
10442
  if (window.__orbitalVerification) {
10441
10443
  window.__orbitalVerification.sendEvent = (event, payload, traitScope) => {
10442
10444
  const prefixed = event.startsWith("UI:") ? event : traitScope ? `UI:${traitScope}.${event}` : `UI:${event}`;
10443
- log2.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
10445
+ log6.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
10444
10446
  eventBus.emit(prefixed, payload);
10445
10447
  };
10446
10448
  const eventLog = [];
@@ -10489,10 +10491,10 @@ function updateAssetStatus(url, status) {
10489
10491
  window.__orbitalVerification.assetStatus[url] = status;
10490
10492
  }
10491
10493
  }
10492
- var log2, MAX_TRANSITIONS;
10494
+ var log6, MAX_TRANSITIONS;
10493
10495
  var init_verificationRegistry = __esm({
10494
10496
  "lib/verificationRegistry.ts"() {
10495
- log2 = logger.createLogger("almadar:bridge");
10497
+ log6 = logger.createLogger("almadar:bridge");
10496
10498
  MAX_TRANSITIONS = 500;
10497
10499
  exposeOnWindow();
10498
10500
  }
@@ -12520,7 +12522,7 @@ var init_avl_elk_layout = __esm({
12520
12522
  elk = new ELK__default.default();
12521
12523
  }
12522
12524
  });
12523
- var SWIM_GUTTER, CENTER_W, BehaviorView;
12525
+ var log7, SWIM_GUTTER, CENTER_W, BehaviorView;
12524
12526
  var init_BehaviorView = __esm({
12525
12527
  "components/molecules/avl/BehaviorView.tsx"() {
12526
12528
  "use client";
@@ -12529,6 +12531,7 @@ var init_BehaviorView = __esm({
12529
12531
  init_AvlSwimLane();
12530
12532
  init_types();
12531
12533
  init_avl_elk_layout();
12534
+ log7 = logger.createLogger("almadar:ui:avl:behavior-view");
12532
12535
  SWIM_GUTTER = 120;
12533
12536
  CENTER_W = 360;
12534
12537
  BehaviorView = ({ data }) => {
@@ -12538,7 +12541,7 @@ var init_BehaviorView = __esm({
12538
12541
  const dataKey = React136.useMemo(() => JSON.stringify(traitData), [traitData]);
12539
12542
  React136.useEffect(() => {
12540
12543
  if (!traitData) return;
12541
- computeTraitLayout(traitData).then(setLayout).catch(console.error);
12544
+ computeTraitLayout(traitData).then(setLayout).catch((err) => log7.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
12542
12545
  }, [dataKey]);
12543
12546
  if (!traitData) {
12544
12547
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-[var(--color-border)] bg-[var(--color-card)] p-4 text-center text-[var(--color-muted-foreground)] text-sm", children: "No trait data" });
@@ -12883,7 +12886,7 @@ function computeFoldRegions(code) {
12883
12886
  }
12884
12887
  return regions.sort((a, b) => a.start - b.start);
12885
12888
  }
12886
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12889
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log8, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12887
12890
  var init_CodeBlock = __esm({
12888
12891
  "components/molecules/markdown/CodeBlock.tsx"() {
12889
12892
  init_Box();
@@ -12960,6 +12963,7 @@ var init_CodeBlock = __esm({
12960
12963
  "lolo-op-async": { color: syntax.ORB_COLORS.dark.async }
12961
12964
  };
12962
12965
  loloStyle = { ...dark__default.default, ...loloStyleOverrides };
12966
+ log8 = logger.createLogger("almadar:ui:markdown-code");
12963
12967
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12964
12968
  HIDDEN_LINE_NUMBERS = { display: "none" };
12965
12969
  CodeBlock = React136__namespace.default.memo(
@@ -13158,7 +13162,7 @@ var init_CodeBlock = __esm({
13158
13162
  eventBus.emit("UI:COPY_CODE", { language, success: true });
13159
13163
  setTimeout(() => setCopied(false), 2e3);
13160
13164
  } catch (err) {
13161
- console.error("Failed to copy code:", err);
13165
+ log8.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
13162
13166
  eventBus.emit("UI:COPY_CODE", { language, success: false });
13163
13167
  }
13164
13168
  };
@@ -16720,13 +16724,14 @@ function useSafeEventBus2() {
16720
16724
  } };
16721
16725
  }
16722
16726
  }
16723
- var ButtonGroup;
16727
+ var log9, ButtonGroup;
16724
16728
  var init_ButtonGroup = __esm({
16725
16729
  "components/molecules/ButtonGroup.tsx"() {
16726
16730
  "use client";
16727
16731
  init_cn();
16728
16732
  init_atoms();
16729
16733
  init_useEventBus();
16734
+ log9 = logger.createLogger("almadar:ui:button-group");
16730
16735
  ButtonGroup = ({
16731
16736
  children,
16732
16737
  primary,
@@ -16799,7 +16804,7 @@ var init_ButtonGroup = __esm({
16799
16804
  {
16800
16805
  variant: "ghost",
16801
16806
  onClick: () => {
16802
- console.log(`Filter clicked: ${filter.field}`);
16807
+ log9.debug("Filter clicked", { field: filter.field });
16803
16808
  },
16804
16809
  children: filter.label
16805
16810
  },
@@ -22816,31 +22821,56 @@ var init_InputGroup = __esm({
22816
22821
  InputGroup.displayName = "InputGroup";
22817
22822
  }
22818
22823
  });
22819
-
22820
- // lib/debug.ts
22824
+ function gateEnabled(level, ns = NAMESPACE) {
22825
+ return logger.isLogLevelEnabled(level, ns);
22826
+ }
22821
22827
  function isDebugEnabled() {
22822
- if (DEBUG_ENABLED) return true;
22823
- return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
22828
+ return gateEnabled("DEBUG");
22824
22829
  }
22825
22830
  function debug(...args) {
22826
- if (isDebugEnabled()) {
22827
- console.log("[DEBUG]", ...args);
22831
+ if (!gateEnabled("DEBUG")) return;
22832
+ const [first, ...rest] = args;
22833
+ const message = typeof first === "string" ? first : "<debug>";
22834
+ if (rest.length === 0 && typeof first === "string") {
22835
+ log10.debug(message);
22836
+ } else {
22837
+ log10.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
22828
22838
  }
22829
22839
  }
22830
22840
  function debugGroup(label) {
22831
- if (isDebugEnabled()) {
22832
- console.group(`[DEBUG] ${label}`);
22833
- }
22841
+ if (gateEnabled("DEBUG")) console.group(`[${NAMESPACE}] ${label}`);
22834
22842
  }
22835
22843
  function debugGroupEnd() {
22836
- if (isDebugEnabled()) {
22837
- console.groupEnd();
22844
+ if (gateEnabled("DEBUG")) console.groupEnd();
22845
+ }
22846
+ function formatArgs(values) {
22847
+ if (values.length === 1) return toLogMetaValue(values[0]);
22848
+ return values.map(toLogMetaValue);
22849
+ }
22850
+ function toLogMetaValue(v) {
22851
+ if (v === null || v === void 0) return v;
22852
+ if (v instanceof Error) return v;
22853
+ const t = typeof v;
22854
+ if (t === "string" || t === "number" || t === "boolean") return v;
22855
+ if (Array.isArray(v)) return v.map(toLogMetaValue);
22856
+ if (t === "object") {
22857
+ const out = {};
22858
+ for (const [k, val] of Object.entries(v)) {
22859
+ out[k] = toLogMetaValue(val);
22860
+ }
22861
+ return out;
22838
22862
  }
22863
+ return String(v);
22839
22864
  }
22840
- var DEBUG_ENABLED;
22865
+ var NAMESPACE, log10;
22841
22866
  var init_debug = __esm({
22842
22867
  "lib/debug.ts"() {
22843
- DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
22868
+ NAMESPACE = "almadar:ui:debug";
22869
+ log10 = logger.createLogger(NAMESPACE);
22870
+ logger.createLogger("almadar:ui:debug:input");
22871
+ logger.createLogger("almadar:ui:debug:collision");
22872
+ logger.createLogger("almadar:ui:debug:physics");
22873
+ logger.createLogger("almadar:ui:debug:game-state");
22844
22874
  }
22845
22875
  });
22846
22876
  var isRelationsDebugEnabled, RelationSelect;
@@ -39197,7 +39227,7 @@ function getAllEvents(traits2) {
39197
39227
  }
39198
39228
  function EventDispatcherTab({ traits: traits2, schema }) {
39199
39229
  const eventBus = useEventBus();
39200
- const [log4, setLog] = React136__namespace.useState([]);
39230
+ const [log12, setLog] = React136__namespace.useState([]);
39201
39231
  const prevStatesRef = React136__namespace.useRef(/* @__PURE__ */ new Map());
39202
39232
  React136__namespace.useEffect(() => {
39203
39233
  for (const trait of traits2) {
@@ -39261,9 +39291,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
39261
39291
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
39262
39292
  /* @__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)) })
39263
39293
  ] }),
39264
- log4.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
39294
+ log12.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
39265
39295
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
39266
- /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log4.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
39296
+ /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log12.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
39267
39297
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
39268
39298
  " ",
39269
39299
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -44190,7 +44220,7 @@ function MaybeTraitScope({
44190
44220
  const schemaCtx = useEntitySchemaOptional();
44191
44221
  const orbital = sourceTrait !== void 0 && schemaCtx !== null ? schemaCtx.orbitalsByTrait.get(sourceTrait) : void 0;
44192
44222
  const wrap = sourceTrait !== void 0 && orbital !== void 0;
44193
- scopeWrapLog.info("decide", {
44223
+ scopeWrapLog.debug("decide", {
44194
44224
  sourceTrait,
44195
44225
  schemaCtxPresent: schemaCtx !== null,
44196
44226
  orbitalsByTraitSize: schemaCtx?.orbitalsByTrait.size ?? 0,
@@ -44836,24 +44866,24 @@ function captureSubscriberTag(listener) {
44836
44866
  }
44837
44867
  return "unknown";
44838
44868
  }
44839
- function EventBusProvider({ children, debug: debug2 = false }) {
44869
+ function EventBusProvider({ children }) {
44840
44870
  const listenersRef = React136.useRef(/* @__PURE__ */ new Map());
44841
44871
  const anyListenersRef = React136.useRef(/* @__PURE__ */ new Set());
44842
44872
  const deprecationWarningShown = React136.useRef(false);
44843
44873
  const getSelectedEntity = React136.useCallback(() => {
44844
44874
  if (!deprecationWarningShown.current) {
44845
- console.warn(
44846
- "[EventBus] getSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
44847
- );
44875
+ busLog.warn("deprecated:getSelectedEntity", {
44876
+ migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
44877
+ });
44848
44878
  deprecationWarningShown.current = true;
44849
44879
  }
44850
44880
  return null;
44851
44881
  }, []);
44852
44882
  const clearSelectedEntity = React136.useCallback(() => {
44853
44883
  if (!deprecationWarningShown.current) {
44854
- console.warn(
44855
- "[EventBus] clearSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
44856
- );
44884
+ busLog.warn("deprecated:clearSelectedEntity", {
44885
+ migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
44886
+ });
44857
44887
  deprecationWarningShown.current = true;
44858
44888
  }
44859
44889
  }, []);
@@ -44867,12 +44897,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
44867
44897
  const listeners6 = listenersRef.current.get(type);
44868
44898
  const listenerCount = (listeners6?.size ?? 0) + anyListenersRef.current.size;
44869
44899
  busLog.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount });
44870
- if (debug2) {
44871
- if (listenerCount > 0) {
44872
- console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
44873
- } else {
44874
- console.warn(`[EventBus] Emit: ${type} (NO LISTENERS - event may be lost!)`, payload);
44875
- }
44900
+ if (listenerCount === 0) {
44901
+ busLog.warn("emit:no-listeners", { type });
44876
44902
  }
44877
44903
  if (listeners6) {
44878
44904
  const listenersCopy = Array.from(listeners6);
@@ -44887,7 +44913,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
44887
44913
  try {
44888
44914
  listener(event);
44889
44915
  } catch (error) {
44890
- console.error(`[EventBus] Error in listener for '${type}':`, error);
44916
+ busLog.error("listener-threw", { type, error: error instanceof Error ? error : String(error) });
44891
44917
  }
44892
44918
  }
44893
44919
  }
@@ -44903,10 +44929,10 @@ function EventBusProvider({ children, debug: debug2 = false }) {
44903
44929
  try {
44904
44930
  listener(event);
44905
44931
  } catch (error) {
44906
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
44932
+ busLog.error("onAny-listener-threw", { type, error: error instanceof Error ? error : String(error) });
44907
44933
  }
44908
44934
  }
44909
- }, [debug2]);
44935
+ }, []);
44910
44936
  const on = React136.useCallback((type, listener) => {
44911
44937
  if (!listenersRef.current.has(type)) {
44912
44938
  listenersRef.current.set(type, /* @__PURE__ */ new Set());
@@ -44915,19 +44941,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
44915
44941
  listeners6.add(listener);
44916
44942
  if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
44917
44943
  subLog2.debug("subscribe", { type, totalListeners: listeners6.size, tag: listenerTags.get(listener) });
44918
- if (debug2) {
44919
- console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
44920
- }
44921
44944
  return () => {
44922
44945
  listeners6.delete(listener);
44923
- if (debug2) {
44924
- console.log(`[EventBus] Unsubscribed from '${type}', remaining: ${listeners6.size}`);
44925
- }
44946
+ subLog2.debug("unsubscribe", { type, remaining: listeners6.size });
44926
44947
  if (listeners6.size === 0) {
44927
44948
  listenersRef.current.delete(type);
44928
44949
  }
44929
44950
  };
44930
- }, [debug2]);
44951
+ }, []);
44931
44952
  const once = React136.useCallback((type, listener) => {
44932
44953
  const wrappedListener = (event) => {
44933
44954
  listenersRef.current.get(type)?.delete(wrappedListener);
@@ -44943,16 +44964,11 @@ function EventBusProvider({ children, debug: debug2 = false }) {
44943
44964
  anyListenersRef.current.add(listener);
44944
44965
  if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
44945
44966
  subLog2.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size, tag: listenerTags.get(listener) });
44946
- if (debug2) {
44947
- console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
44948
- }
44949
44967
  return () => {
44950
44968
  anyListenersRef.current.delete(listener);
44951
- if (debug2) {
44952
- console.log(`[EventBus] onAny unsubscribed, remaining: ${anyListenersRef.current.size}`);
44953
- }
44969
+ subLog2.debug("unsubscribe:any", { remaining: anyListenersRef.current.size });
44954
44970
  };
44955
- }, [debug2]);
44971
+ }, []);
44956
44972
  const contextValue = React136.useMemo(
44957
44973
  () => ({
44958
44974
  emit,
@@ -44976,6 +44992,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
44976
44992
 
44977
44993
  // providers/SelectionProvider.tsx
44978
44994
  init_useEventBus();
44995
+ var log3 = logger.createLogger("almadar:ui:selection");
44979
44996
  var SelectionContext = React136.createContext(null);
44980
44997
  var defaultCompareEntities = (a, b) => {
44981
44998
  if (a === b) return true;
@@ -44998,7 +45015,10 @@ function SelectionProvider({
44998
45015
  (entity) => {
44999
45016
  setSelectedState(entity);
45000
45017
  if (debug2) {
45001
- console.log("[SelectionProvider] Selection set:", entity);
45018
+ log3.debug("Selection set", () => ({
45019
+ hasEntity: entity !== null && entity !== void 0,
45020
+ entityId: entity && typeof entity === "object" ? String(entity.id ?? "") : ""
45021
+ }));
45002
45022
  }
45003
45023
  },
45004
45024
  [debug2]
@@ -45006,7 +45026,7 @@ function SelectionProvider({
45006
45026
  const clearSelection = React136.useCallback(() => {
45007
45027
  setSelectedState(null);
45008
45028
  if (debug2) {
45009
- console.log("[SelectionProvider] Selection cleared");
45029
+ log3.debug("Selection cleared");
45010
45030
  }
45011
45031
  }, [debug2]);
45012
45032
  const isSelected = React136.useCallback(
@@ -45021,14 +45041,17 @@ function SelectionProvider({
45021
45041
  if (row) {
45022
45042
  setSelected(row);
45023
45043
  if (debug2) {
45024
- console.log(`[SelectionProvider] ${event.type} received:`, row);
45044
+ log3.debug("event received", () => ({
45045
+ type: event.type,
45046
+ rowId: row && typeof row === "object" ? String(row.id ?? "") : ""
45047
+ }));
45025
45048
  }
45026
45049
  }
45027
45050
  };
45028
45051
  const handleDeselect = (event) => {
45029
45052
  clearSelection();
45030
45053
  if (debug2) {
45031
- console.log(`[SelectionProvider] ${event.type} received - clearing selection`);
45054
+ log3.debug("event received - clearing selection", { type: event.type });
45032
45055
  }
45033
45056
  };
45034
45057
  const unsubView = eventBus.on("UI:VIEW", handleSelect);
@@ -45070,7 +45093,7 @@ init_UISlotRenderer();
45070
45093
  // providers/VerificationProvider.tsx
45071
45094
  init_useEventBus();
45072
45095
  init_verificationRegistry();
45073
- var log3 = logger.createLogger("almadar:verify");
45096
+ var log11 = logger.createLogger("almadar:verify");
45074
45097
  var DISPATCH_SUFFIX = ":DISPATCH";
45075
45098
  var SUCCESS_SUFFIX = ":SUCCESS";
45076
45099
  var ERROR_SUFFIX = ":ERROR";
@@ -45116,7 +45139,7 @@ function VerificationProvider({
45116
45139
  const verificationProviderLifecycleListener = (evt) => {
45117
45140
  const parsed = parseLifecycleEvent(evt.type);
45118
45141
  if (!parsed) return;
45119
- log3.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
45142
+ log11.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
45120
45143
  const payload = evt.payload ?? {};
45121
45144
  if (parsed.kind === "dispatch") {
45122
45145
  const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
@@ -45171,7 +45194,7 @@ function VerificationProvider({
45171
45194
  },
45172
45195
  timestamp: Date.now()
45173
45196
  });
45174
- log3.info("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
45197
+ log11.debug("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
45175
45198
  } else if (parsed.kind === "error" && parsed.event) {
45176
45199
  const key = `${parsed.traitName}:${parsed.event}`;
45177
45200
  const pending = pendingRef.current.get(key);
@@ -45201,7 +45224,7 @@ function VerificationProvider({
45201
45224
  },
45202
45225
  timestamp: Date.now()
45203
45226
  });
45204
- log3.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
45227
+ log11.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
45205
45228
  }
45206
45229
  };
45207
45230
  Object.defineProperty(verificationProviderLifecycleListener, "name", {