@almadar/ui 4.44.1 → 4.46.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.
@@ -3348,24 +3348,24 @@ function captureSubscriberTag(listener) {
3348
3348
  }
3349
3349
  return "unknown";
3350
3350
  }
3351
- function EventBusProvider({ children, debug: debug2 = false }) {
3351
+ function EventBusProvider({ children }) {
3352
3352
  const listenersRef = React147.useRef(/* @__PURE__ */ new Map());
3353
3353
  const anyListenersRef = React147.useRef(/* @__PURE__ */ new Set());
3354
3354
  const deprecationWarningShown = React147.useRef(false);
3355
3355
  const getSelectedEntity = React147.useCallback(() => {
3356
3356
  if (!deprecationWarningShown.current) {
3357
- console.warn(
3358
- "[EventBus] getSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3359
- );
3357
+ busLog.warn("deprecated:getSelectedEntity", {
3358
+ migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3359
+ });
3360
3360
  deprecationWarningShown.current = true;
3361
3361
  }
3362
3362
  return null;
3363
3363
  }, []);
3364
3364
  const clearSelectedEntity = React147.useCallback(() => {
3365
3365
  if (!deprecationWarningShown.current) {
3366
- console.warn(
3367
- "[EventBus] clearSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3368
- );
3366
+ busLog.warn("deprecated:clearSelectedEntity", {
3367
+ migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3368
+ });
3369
3369
  deprecationWarningShown.current = true;
3370
3370
  }
3371
3371
  }, []);
@@ -3379,12 +3379,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3379
3379
  const listeners6 = listenersRef.current.get(type);
3380
3380
  const listenerCount = (listeners6?.size ?? 0) + anyListenersRef.current.size;
3381
3381
  busLog.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount });
3382
- if (debug2) {
3383
- if (listenerCount > 0) {
3384
- console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
3385
- } else {
3386
- console.warn(`[EventBus] Emit: ${type} (NO LISTENERS - event may be lost!)`, payload);
3387
- }
3382
+ if (listenerCount === 0) {
3383
+ busLog.warn("emit:no-listeners", { type });
3388
3384
  }
3389
3385
  if (listeners6) {
3390
3386
  const listenersCopy = Array.from(listeners6);
@@ -3399,7 +3395,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3399
3395
  try {
3400
3396
  listener(event);
3401
3397
  } catch (error) {
3402
- console.error(`[EventBus] Error in listener for '${type}':`, error);
3398
+ busLog.error("listener-threw", { type, error: error instanceof Error ? error : String(error) });
3403
3399
  }
3404
3400
  }
3405
3401
  }
@@ -3415,10 +3411,10 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3415
3411
  try {
3416
3412
  listener(event);
3417
3413
  } catch (error) {
3418
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
3414
+ busLog.error("onAny-listener-threw", { type, error: error instanceof Error ? error : String(error) });
3419
3415
  }
3420
3416
  }
3421
- }, [debug2]);
3417
+ }, []);
3422
3418
  const on = React147.useCallback((type, listener) => {
3423
3419
  if (!listenersRef.current.has(type)) {
3424
3420
  listenersRef.current.set(type, /* @__PURE__ */ new Set());
@@ -3427,19 +3423,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3427
3423
  listeners6.add(listener);
3428
3424
  if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
3429
3425
  subLog.debug("subscribe", { type, totalListeners: listeners6.size, tag: listenerTags.get(listener) });
3430
- if (debug2) {
3431
- console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
3432
- }
3433
3426
  return () => {
3434
3427
  listeners6.delete(listener);
3435
- if (debug2) {
3436
- console.log(`[EventBus] Unsubscribed from '${type}', remaining: ${listeners6.size}`);
3437
- }
3428
+ subLog.debug("unsubscribe", { type, remaining: listeners6.size });
3438
3429
  if (listeners6.size === 0) {
3439
3430
  listenersRef.current.delete(type);
3440
3431
  }
3441
3432
  };
3442
- }, [debug2]);
3433
+ }, []);
3443
3434
  const once = React147.useCallback((type, listener) => {
3444
3435
  const wrappedListener = (event) => {
3445
3436
  listenersRef.current.get(type)?.delete(wrappedListener);
@@ -3455,16 +3446,11 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3455
3446
  anyListenersRef.current.add(listener);
3456
3447
  if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
3457
3448
  subLog.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size, tag: listenerTags.get(listener) });
3458
- if (debug2) {
3459
- console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
3460
- }
3461
3449
  return () => {
3462
3450
  anyListenersRef.current.delete(listener);
3463
- if (debug2) {
3464
- console.log(`[EventBus] onAny unsubscribed, remaining: ${anyListenersRef.current.size}`);
3465
- }
3451
+ subLog.debug("unsubscribe:any", { remaining: anyListenersRef.current.size });
3466
3452
  };
3467
- }, [debug2]);
3453
+ }, []);
3468
3454
  const contextValue = React147.useMemo(
3469
3455
  () => ({
3470
3456
  emit,
@@ -3624,7 +3610,7 @@ var init_useEventBus = __esm({
3624
3610
  try {
3625
3611
  handler(event);
3626
3612
  } catch (error) {
3627
- console.error(`[EventBus] Error in listener for '${type}':`, error);
3613
+ log.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
3628
3614
  }
3629
3615
  });
3630
3616
  }
@@ -3632,7 +3618,7 @@ var init_useEventBus = __esm({
3632
3618
  try {
3633
3619
  handler(event);
3634
3620
  } catch (error) {
3635
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
3621
+ log.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
3636
3622
  }
3637
3623
  });
3638
3624
  },
@@ -4944,7 +4930,7 @@ var init_ModuleCard = __esm({
4944
4930
  exports.ModuleCard.displayName = "ModuleCard";
4945
4931
  }
4946
4932
  });
4947
- var SWIM_GUTTER, CENTER_W; exports.BehaviorView = void 0;
4933
+ var log2, SWIM_GUTTER, CENTER_W; exports.BehaviorView = void 0;
4948
4934
  var init_BehaviorView = __esm({
4949
4935
  "components/molecules/avl/BehaviorView.tsx"() {
4950
4936
  "use client";
@@ -4953,6 +4939,7 @@ var init_BehaviorView = __esm({
4953
4939
  init_AvlSwimLane();
4954
4940
  init_types();
4955
4941
  init_avl_elk_layout();
4942
+ log2 = logger.createLogger("almadar:ui:avl:behavior-view");
4956
4943
  SWIM_GUTTER = 120;
4957
4944
  CENTER_W = 360;
4958
4945
  exports.BehaviorView = ({ data }) => {
@@ -4962,7 +4949,7 @@ var init_BehaviorView = __esm({
4962
4949
  const dataKey = React147.useMemo(() => JSON.stringify(traitData), [traitData]);
4963
4950
  React147.useEffect(() => {
4964
4951
  if (!traitData) return;
4965
- computeTraitLayout(traitData).then(setLayout).catch(console.error);
4952
+ computeTraitLayout(traitData).then(setLayout).catch((err) => log2.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
4966
4953
  }, [dataKey]);
4967
4954
  if (!traitData) {
4968
4955
  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" });
@@ -5088,10 +5075,11 @@ function useTheme() {
5088
5075
  }
5089
5076
  return context;
5090
5077
  }
5091
- var BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
5078
+ var log3, BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
5092
5079
  var init_ThemeContext = __esm({
5093
5080
  "context/ThemeContext.tsx"() {
5094
5081
  "use client";
5082
+ log3 = logger.createLogger("almadar:ui:theme");
5095
5083
  BUILT_IN_THEMES = [
5096
5084
  {
5097
5085
  name: "wireframe",
@@ -5271,9 +5259,10 @@ var init_ThemeContext = __esm({
5271
5259
  localStorage.setItem(THEME_STORAGE_KEY, newTheme);
5272
5260
  }
5273
5261
  } else {
5274
- console.warn(
5275
- `Theme "${newTheme}" not found. Available: ${availableThemes.map((t) => t.name).join(", ")}`
5276
- );
5262
+ log3.warn("Theme not found", {
5263
+ theme: newTheme,
5264
+ available: availableThemes.map((t) => t.name)
5265
+ });
5277
5266
  }
5278
5267
  },
5279
5268
  [availableThemes]
@@ -5409,7 +5398,7 @@ function useUISlotManager() {
5409
5398
  try {
5410
5399
  callback(slot, content);
5411
5400
  } catch (error) {
5412
- console.error("[UISlots] Subscriber error:", error);
5401
+ log5.error("Subscriber error", { error: error instanceof Error ? error : String(error) });
5413
5402
  }
5414
5403
  });
5415
5404
  }, []);
@@ -5421,7 +5410,7 @@ function useUISlotManager() {
5421
5410
  try {
5422
5411
  callback(content);
5423
5412
  } catch (error) {
5424
- console.error(`[UISlots] Trait subscriber error (${traitName}):`, error);
5413
+ log5.error("Trait subscriber error", { traitName, error: error instanceof Error ? error : String(error) });
5425
5414
  }
5426
5415
  });
5427
5416
  },
@@ -5472,9 +5461,12 @@ function useUISlotManager() {
5472
5461
  const slotSources = prev[config.target] ?? {};
5473
5462
  const existing = slotSources[sourceKey];
5474
5463
  if (existing && existing.priority > content.priority) {
5475
- console.warn(
5476
- `[UISlots] Slot "${config.target}" source "${sourceKey}" already has higher priority content (${existing.priority} > ${content.priority})`
5477
- );
5464
+ log5.warn("Slot already has higher priority content", {
5465
+ slot: config.target,
5466
+ sourceKey,
5467
+ existingPriority: existing.priority,
5468
+ newPriority: content.priority
5469
+ });
5478
5470
  return prev;
5479
5471
  }
5480
5472
  const nextSources = {
@@ -5486,7 +5478,7 @@ function useUISlotManager() {
5486
5478
  indexTraitRender(content.sourceTrait, content);
5487
5479
  notifyTraitSubscribers(content.sourceTrait, content);
5488
5480
  }
5489
- slotLog.info("slot:written", {
5481
+ log5.info("slot:written", {
5490
5482
  slot: config.target,
5491
5483
  sourceKey,
5492
5484
  sourceTrait: content.sourceTrait,
@@ -5531,7 +5523,7 @@ function useUISlotManager() {
5531
5523
  setSources((prev) => {
5532
5524
  const slotSources = prev[slot];
5533
5525
  if (!slotSources || !(sourceKey in slotSources)) {
5534
- slotLog.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
5526
+ log5.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
5535
5527
  return prev;
5536
5528
  }
5537
5529
  const content = slotSources[sourceKey];
@@ -5547,7 +5539,7 @@ function useUISlotManager() {
5547
5539
  }
5548
5540
  const nextSources = { ...slotSources };
5549
5541
  delete nextSources[sourceKey];
5550
- slotLog.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
5542
+ log5.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
5551
5543
  notifySubscribers(slot, aggregateSlot(nextSources));
5552
5544
  return { ...prev, [slot]: nextSources };
5553
5545
  });
@@ -5666,11 +5658,11 @@ function useUISlotManager() {
5666
5658
  updateTraitContent
5667
5659
  };
5668
5660
  }
5669
- var slotLog, DEFAULT_SOURCE_KEY, MULTI_SOURCE_STACK_TRAIT, ALL_SLOTS, DEFAULT_SLOTS, DEFAULT_SOURCES, idCounter;
5661
+ var log5, DEFAULT_SOURCE_KEY, MULTI_SOURCE_STACK_TRAIT, ALL_SLOTS, DEFAULT_SLOTS, DEFAULT_SOURCES, idCounter;
5670
5662
  var init_useUISlots = __esm({
5671
5663
  "hooks/useUISlots.ts"() {
5672
5664
  "use client";
5673
- slotLog = logger.createLogger("almadar:ui:useUISlots");
5665
+ log5 = logger.createLogger("almadar:ui:ui-slots");
5674
5666
  DEFAULT_SOURCE_KEY = "__default__";
5675
5667
  MULTI_SOURCE_STACK_TRAIT = "__multi_source_stack__";
5676
5668
  ALL_SLOTS = [
@@ -6574,10 +6566,10 @@ function refId(obj) {
6574
6566
  refIds.set(obj, id);
6575
6567
  return id;
6576
6568
  }
6577
- var slotLog2, refIds, nextRefId;
6569
+ var slotLog, refIds, nextRefId;
6578
6570
  var init_slot_types = __esm({
6579
6571
  "runtime/ui/slot-types.ts"() {
6580
- slotLog2 = logger.createLogger("almadar:ui:slot-render");
6572
+ slotLog = logger.createLogger("almadar:ui:slot-render");
6581
6573
  refIds = /* @__PURE__ */ new WeakMap();
6582
6574
  nextRefId = 1;
6583
6575
  }
@@ -10793,12 +10785,15 @@ function ControlButton({
10793
10785
  sizeMap3[size] ?? sizeMap3.md,
10794
10786
  shapeMap[shape] ?? shapeMap.circle,
10795
10787
  variantMap[variant] ?? variantMap.secondary,
10796
- actualPressed && "scale-95 brightness-110 border-white",
10788
+ actualPressed && "scale-95 brightness-110 border-foreground",
10797
10789
  disabled && "opacity-50 cursor-not-allowed",
10798
10790
  className
10799
10791
  ),
10800
10792
  children: [
10801
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-2xl", children: icon }),
10793
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-2xl", children: typeof icon === "string" ? (() => {
10794
+ const I = resolveIcon(icon);
10795
+ return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-6 h-6" }) : null;
10796
+ })() : icon }),
10802
10797
  label && !icon && /* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
10803
10798
  ]
10804
10799
  }
@@ -10810,6 +10805,7 @@ var init_ControlButton = __esm({
10810
10805
  "use client";
10811
10806
  init_cn();
10812
10807
  init_useEventBus();
10808
+ init_Icon();
10813
10809
  sizeMap3 = {
10814
10810
  sm: "w-10 h-10 text-sm",
10815
10811
  md: "w-14 h-14 text-base",
@@ -10822,9 +10818,9 @@ var init_ControlButton = __esm({
10822
10818
  square: "rounded-md"
10823
10819
  };
10824
10820
  variantMap = {
10825
- primary: "bg-blue-600 text-[var(--color-foreground)] border-blue-400 hover:bg-blue-500",
10826
- secondary: "bg-[var(--color-surface,#374151)] text-[var(--color-foreground)] border-gray-500 hover:bg-gray-600",
10827
- ghost: "bg-transparent text-[var(--color-foreground)] border-white/30 hover:bg-white/10"
10821
+ primary: "bg-primary text-primary-foreground border-primary hover:bg-primary-hover",
10822
+ secondary: "bg-secondary text-secondary-foreground border-border hover:bg-secondary-hover",
10823
+ ghost: "bg-transparent text-foreground border-border hover:bg-muted"
10828
10824
  };
10829
10825
  ControlButton.displayName = "ControlButton";
10830
10826
  }
@@ -11552,8 +11548,8 @@ function ChoiceButton({
11552
11548
  className: cn(
11553
11549
  "w-full text-left px-4 py-2.5 rounded-md border transition-all duration-150",
11554
11550
  "flex items-center gap-2",
11555
- selected ? "bg-yellow-500/20 border-yellow-400 text-yellow-300" : "bg-white/5 border-white/10 text-[var(--color-foreground)] hover:bg-white/10 hover:border-white/30",
11556
- disabled && "opacity-40 cursor-not-allowed hover:bg-white/5 hover:border-white/10",
11551
+ selected ? "bg-accent/15 border-accent text-foreground" : "bg-muted/40 border-border text-foreground hover:bg-muted hover:border-border",
11552
+ disabled && "opacity-40 cursor-not-allowed hover:bg-muted/40 hover:border-border",
11557
11553
  className
11558
11554
  ),
11559
11555
  children: [
@@ -11562,7 +11558,7 @@ function ChoiceButton({
11562
11558
  {
11563
11559
  className: cn(
11564
11560
  "flex-shrink-0 font-mono font-bold text-sm",
11565
- selected ? "text-yellow-400" : "text-gray-500"
11561
+ selected ? "text-accent" : "text-muted-foreground"
11566
11562
  ),
11567
11563
  children: [
11568
11564
  index,
@@ -11603,7 +11599,7 @@ function ActionButton({
11603
11599
  disabled: isDisabled,
11604
11600
  onClick,
11605
11601
  className: cn(
11606
- "relative inline-flex items-center gap-1.5 rounded-md border font-medium text-[var(--color-foreground)] overflow-hidden transition-colors duration-150",
11602
+ "relative inline-flex items-center gap-1.5 rounded-md border font-medium overflow-hidden transition-colors duration-150",
11607
11603
  sizes.button,
11608
11604
  variantStyles8[variant],
11609
11605
  isDisabled && "opacity-60 cursor-not-allowed",
@@ -11613,7 +11609,7 @@ function ActionButton({
11613
11609
  onCooldown && /* @__PURE__ */ jsxRuntime.jsx(
11614
11610
  "div",
11615
11611
  {
11616
- className: "absolute inset-0 bg-black/60 pointer-events-none",
11612
+ className: "absolute inset-0 bg-foreground/40 pointer-events-none",
11617
11613
  style: {
11618
11614
  clipPath: `conic-gradient(from 0deg, transparent ${360 - cooldownDeg}deg, black ${360 - cooldownDeg}deg)`,
11619
11615
  WebkitClipPath: `conic-gradient(from 0deg, transparent ${360 - cooldownDeg}deg, black ${360 - cooldownDeg}deg)`,
@@ -11621,13 +11617,16 @@ function ActionButton({
11621
11617
  }
11622
11618
  }
11623
11619
  ),
11624
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon }),
11620
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: typeof icon === "string" ? (() => {
11621
+ const I = resolveIcon(icon);
11622
+ return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-4 h-4" }) : null;
11623
+ })() : icon }),
11625
11624
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10", children: label }),
11626
11625
  hotkey && /* @__PURE__ */ jsxRuntime.jsx(
11627
11626
  "span",
11628
11627
  {
11629
11628
  className: cn(
11630
- "absolute top-0.5 right-0.5 bg-black/50 text-gray-300 rounded font-mono leading-tight",
11629
+ "absolute top-0.5 right-0.5 bg-foreground/30 text-primary-foreground rounded font-mono leading-tight",
11631
11630
  sizes.hotkey
11632
11631
  ),
11633
11632
  children: hotkey
@@ -11641,15 +11640,16 @@ var sizeMap13, variantStyles8;
11641
11640
  var init_ActionButton = __esm({
11642
11641
  "components/atoms/game/ActionButton.tsx"() {
11643
11642
  init_cn();
11643
+ init_Icon();
11644
11644
  sizeMap13 = {
11645
11645
  sm: { button: "px-3 py-1.5 text-xs", hotkey: "text-[9px] px-1", icon: "text-xs" },
11646
11646
  md: { button: "px-4 py-2 text-sm", hotkey: "text-[10px] px-1.5", icon: "text-sm" },
11647
11647
  lg: { button: "px-5 py-2.5 text-base", hotkey: "text-xs px-2", icon: "text-base" }
11648
11648
  };
11649
11649
  variantStyles8 = {
11650
- primary: "bg-blue-600 hover:bg-blue-500 border-blue-400/40",
11651
- secondary: "bg-gray-700 hover:bg-gray-600 border-gray-500/40",
11652
- danger: "bg-red-700 hover:bg-red-600 border-red-400/40"
11650
+ primary: "bg-primary text-primary-foreground hover:bg-primary-hover border-primary",
11651
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-hover border-border",
11652
+ danger: "bg-error text-error-foreground hover:bg-error/90 border-error"
11653
11653
  };
11654
11654
  ActionButton.displayName = "ActionButton";
11655
11655
  }
@@ -12222,6 +12222,7 @@ function getAllPages(schema) {
12222
12222
  var init_navigation = __esm({
12223
12223
  "renderer/navigation.tsx"() {
12224
12224
  "use client";
12225
+ logger.createLogger("almadar:ui:navigation");
12225
12226
  React147.createContext(null);
12226
12227
  }
12227
12228
  });
@@ -14699,7 +14700,7 @@ function recordTransition(trace) {
14699
14700
  ...trace,
14700
14701
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
14701
14702
  };
14702
- log2.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
14703
+ log7.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
14703
14704
  getState().transitions.push(entry);
14704
14705
  if (getState().transitions.length > MAX_TRANSITIONS) {
14705
14706
  getState().transitions.shift();
@@ -14798,7 +14799,7 @@ function getTraitSnapshots() {
14798
14799
  try {
14799
14800
  snapshots.push(getter());
14800
14801
  } catch (err) {
14801
- log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
14802
+ log7.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
14802
14803
  }
14803
14804
  }
14804
14805
  return snapshots;
@@ -14846,12 +14847,12 @@ function waitForTransition(event, timeoutMs = 1e4) {
14846
14847
  }
14847
14848
  function bindEventBus(eventBus) {
14848
14849
  if (typeof window === "undefined") return;
14849
- log2.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
14850
+ log7.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
14850
14851
  exposeOnWindow();
14851
14852
  if (window.__orbitalVerification) {
14852
14853
  window.__orbitalVerification.sendEvent = (event, payload, traitScope) => {
14853
14854
  const prefixed = event.startsWith("UI:") ? event : traitScope ? `UI:${traitScope}.${event}` : `UI:${event}`;
14854
- log2.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
14855
+ log7.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
14855
14856
  eventBus.emit(prefixed, payload);
14856
14857
  };
14857
14858
  const eventLog = [];
@@ -14914,10 +14915,10 @@ function updateAssetStatus(url, status) {
14914
14915
  window.__orbitalVerification.assetStatus[url] = status;
14915
14916
  }
14916
14917
  }
14917
- var log2, MAX_TRANSITIONS;
14918
+ var log7, MAX_TRANSITIONS;
14918
14919
  var init_verificationRegistry = __esm({
14919
14920
  "lib/verificationRegistry.ts"() {
14920
- log2 = logger.createLogger("almadar:bridge");
14921
+ log7 = logger.createLogger("almadar:bridge");
14921
14922
  MAX_TRANSITIONS = 500;
14922
14923
  exposeOnWindow();
14923
14924
  }
@@ -16478,7 +16479,7 @@ function computeFoldRegions(code) {
16478
16479
  }
16479
16480
  return regions.sort((a, b) => a.start - b.start);
16480
16481
  }
16481
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
16482
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log8, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
16482
16483
  var init_CodeBlock = __esm({
16483
16484
  "components/molecules/markdown/CodeBlock.tsx"() {
16484
16485
  init_Box();
@@ -16555,6 +16556,7 @@ var init_CodeBlock = __esm({
16555
16556
  "lolo-op-async": { color: syntax.ORB_COLORS.dark.async }
16556
16557
  };
16557
16558
  loloStyle = { ...dark__default.default, ...loloStyleOverrides };
16559
+ log8 = logger.createLogger("almadar:ui:markdown-code");
16558
16560
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
16559
16561
  HIDDEN_LINE_NUMBERS = { display: "none" };
16560
16562
  CodeBlock = React147__namespace.default.memo(
@@ -16753,7 +16755,7 @@ var init_CodeBlock = __esm({
16753
16755
  eventBus.emit("UI:COPY_CODE", { language, success: true });
16754
16756
  setTimeout(() => setCopied(false), 2e3);
16755
16757
  } catch (err) {
16756
- console.error("Failed to copy code:", err);
16758
+ log8.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
16757
16759
  eventBus.emit("UI:COPY_CODE", { language, success: false });
16758
16760
  }
16759
16761
  };
@@ -20315,13 +20317,14 @@ function useSafeEventBus2() {
20315
20317
  } };
20316
20318
  }
20317
20319
  }
20318
- var ButtonGroup;
20320
+ var log9, ButtonGroup;
20319
20321
  var init_ButtonGroup = __esm({
20320
20322
  "components/molecules/ButtonGroup.tsx"() {
20321
20323
  "use client";
20322
20324
  init_cn();
20323
20325
  init_atoms();
20324
20326
  init_useEventBus();
20327
+ log9 = logger.createLogger("almadar:ui:button-group");
20325
20328
  ButtonGroup = ({
20326
20329
  children,
20327
20330
  primary,
@@ -20394,7 +20397,7 @@ var init_ButtonGroup = __esm({
20394
20397
  {
20395
20398
  variant: "ghost",
20396
20399
  onClick: () => {
20397
- console.log(`Filter clicked: ${filter.field}`);
20400
+ log9.debug("Filter clicked", { field: filter.field });
20398
20401
  },
20399
20402
  children: filter.label
20400
20403
  },
@@ -25155,7 +25158,7 @@ function DataGrid({
25155
25158
  onClick: handleActionClick(action, itemData),
25156
25159
  "data-testid": `action-${action.event}`,
25157
25160
  "data-row-id": String(itemData.id),
25158
- className: "text-error hover:bg-error/10 px-2",
25161
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
25159
25162
  children: [
25160
25163
  action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs" }),
25161
25164
  action.label
@@ -26411,31 +26414,56 @@ var init_InputGroup = __esm({
26411
26414
  InputGroup.displayName = "InputGroup";
26412
26415
  }
26413
26416
  });
26414
-
26415
- // lib/debug.ts
26417
+ function gateEnabled(level, ns = NAMESPACE) {
26418
+ return logger.isLogLevelEnabled(level, ns);
26419
+ }
26416
26420
  function isDebugEnabled() {
26417
- if (DEBUG_ENABLED) return true;
26418
- return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
26421
+ return gateEnabled("DEBUG");
26419
26422
  }
26420
26423
  function debug(...args) {
26421
- if (isDebugEnabled()) {
26422
- console.log("[DEBUG]", ...args);
26424
+ if (!gateEnabled("DEBUG")) return;
26425
+ const [first, ...rest] = args;
26426
+ const message = typeof first === "string" ? first : "<debug>";
26427
+ if (rest.length === 0 && typeof first === "string") {
26428
+ log10.debug(message);
26429
+ } else {
26430
+ log10.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
26423
26431
  }
26424
26432
  }
26425
26433
  function debugGroup(label) {
26426
- if (isDebugEnabled()) {
26427
- console.group(`[DEBUG] ${label}`);
26428
- }
26434
+ if (gateEnabled("DEBUG")) console.group(`[${NAMESPACE}] ${label}`);
26429
26435
  }
26430
26436
  function debugGroupEnd() {
26431
- if (isDebugEnabled()) {
26432
- console.groupEnd();
26437
+ if (gateEnabled("DEBUG")) console.groupEnd();
26438
+ }
26439
+ function formatArgs(values) {
26440
+ if (values.length === 1) return toLogMetaValue(values[0]);
26441
+ return values.map(toLogMetaValue);
26442
+ }
26443
+ function toLogMetaValue(v) {
26444
+ if (v === null || v === void 0) return v;
26445
+ if (v instanceof Error) return v;
26446
+ const t = typeof v;
26447
+ if (t === "string" || t === "number" || t === "boolean") return v;
26448
+ if (Array.isArray(v)) return v.map(toLogMetaValue);
26449
+ if (t === "object") {
26450
+ const out = {};
26451
+ for (const [k, val] of Object.entries(v)) {
26452
+ out[k] = toLogMetaValue(val);
26453
+ }
26454
+ return out;
26433
26455
  }
26456
+ return String(v);
26434
26457
  }
26435
- var DEBUG_ENABLED;
26458
+ var NAMESPACE, log10;
26436
26459
  var init_debug = __esm({
26437
26460
  "lib/debug.ts"() {
26438
- DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
26461
+ NAMESPACE = "almadar:ui:debug";
26462
+ log10 = logger.createLogger(NAMESPACE);
26463
+ logger.createLogger("almadar:ui:debug:input");
26464
+ logger.createLogger("almadar:ui:debug:collision");
26465
+ logger.createLogger("almadar:ui:debug:physics");
26466
+ logger.createLogger("almadar:ui:debug:game-state");
26439
26467
  }
26440
26468
  });
26441
26469
  var isRelationsDebugEnabled, RelationSelect;
@@ -27723,7 +27751,7 @@ function StatBadge({
27723
27751
  const I = resolveIcon(icon);
27724
27752
  return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-4 h-4" }) : icon;
27725
27753
  })() : icon }),
27726
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 font-medium", children: label }),
27754
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground font-medium", children: label }),
27727
27755
  format === "hearts" && max && /* @__PURE__ */ jsxRuntime.jsx(
27728
27756
  HealthBar,
27729
27757
  {
@@ -27750,7 +27778,7 @@ function StatBadge({
27750
27778
  animated: true
27751
27779
  }
27752
27780
  ),
27753
- format === "text" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-[var(--color-foreground)]", children: value })
27781
+ format === "text" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-foreground", children: value })
27754
27782
  ]
27755
27783
  }
27756
27784
  );
@@ -27768,11 +27796,11 @@ var init_StatBadge = __esm({
27768
27796
  lg: "text-base px-4 py-2"
27769
27797
  };
27770
27798
  variantMap2 = {
27771
- default: "bg-[var(--color-card)]/80 border-gray-700",
27772
- primary: "bg-blue-900/80 border-blue-700",
27773
- success: "bg-green-900/80 border-green-700",
27774
- warning: "bg-yellow-900/80 border-yellow-700",
27775
- danger: "bg-red-900/80 border-red-700"
27799
+ default: "bg-card/80 border-border text-foreground",
27800
+ primary: "bg-primary/15 border-primary/40 text-foreground",
27801
+ success: "bg-success/15 border-success/40 text-foreground",
27802
+ warning: "bg-warning/15 border-warning/40 text-foreground",
27803
+ danger: "bg-error/15 border-error/40 text-foreground"
27776
27804
  };
27777
27805
  StatBadge.displayName = "StatBadge";
27778
27806
  }
@@ -39942,9 +39970,45 @@ var init_List = __esm({
39942
39970
  List3.displayName = "List";
39943
39971
  }
39944
39972
  });
39945
- var DefaultEmptyDetail, MasterDetail;
39973
+ function MasterDetail({
39974
+ entity,
39975
+ masterFields,
39976
+ detailFields: _detailFields,
39977
+ // Captured but not used here - detail handled separately
39978
+ loading: externalLoading,
39979
+ isLoading: externalIsLoading,
39980
+ error: externalError,
39981
+ className,
39982
+ ...rest
39983
+ }) {
39984
+ const loading = externalLoading ?? false;
39985
+ const isLoading = externalIsLoading ?? false;
39986
+ const error = externalError ?? null;
39987
+ return /* @__PURE__ */ jsxRuntime.jsx(
39988
+ DataTable,
39989
+ {
39990
+ fields: masterFields,
39991
+ columns: masterFields,
39992
+ entity,
39993
+ isLoading: loading || isLoading,
39994
+ error,
39995
+ className,
39996
+ emptyTitle: "No items found",
39997
+ emptyDescription: "Create your first item to get started.",
39998
+ ...rest
39999
+ }
40000
+ );
40001
+ }
39946
40002
  var init_MasterDetail = __esm({
39947
- "components/organisms/layout/MasterDetail.tsx"() {
40003
+ "components/organisms/MasterDetail.tsx"() {
40004
+ "use client";
40005
+ init_DataTable();
40006
+ MasterDetail.displayName = "MasterDetail";
40007
+ }
40008
+ });
40009
+ var DefaultEmptyDetail, MasterDetailLayout;
40010
+ var init_MasterDetailLayout = __esm({
40011
+ "components/organisms/layout/MasterDetailLayout.tsx"() {
39948
40012
  init_cn();
39949
40013
  init_Typography();
39950
40014
  DefaultEmptyDetail = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full border-2 border-dashed border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -39955,7 +40019,7 @@ var init_MasterDetail = __esm({
39955
40019
  children: "Select an item to view details"
39956
40020
  }
39957
40021
  ) });
39958
- MasterDetail = ({
40022
+ MasterDetailLayout = ({
39959
40023
  master,
39960
40024
  detail,
39961
40025
  emptyDetail,
@@ -39990,7 +40054,7 @@ var init_MasterDetail = __esm({
39990
40054
  }
39991
40055
  );
39992
40056
  };
39993
- MasterDetail.displayName = "MasterDetail";
40057
+ MasterDetailLayout.displayName = "MasterDetailLayout";
39994
40058
  }
39995
40059
  });
39996
40060
  var COLUMN_CLASSES, ASPECT_CLASSES, MediaGallery;
@@ -42408,7 +42472,7 @@ function getAllEvents(traits2) {
42408
42472
  }
42409
42473
  function EventDispatcherTab({ traits: traits2, schema }) {
42410
42474
  const eventBus = useEventBus();
42411
- const [log4, setLog] = React147__namespace.useState([]);
42475
+ const [log18, setLog] = React147__namespace.useState([]);
42412
42476
  const prevStatesRef = React147__namespace.useRef(/* @__PURE__ */ new Map());
42413
42477
  React147__namespace.useEffect(() => {
42414
42478
  for (const trait of traits2) {
@@ -42472,9 +42536,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
42472
42536
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
42473
42537
  /* @__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)) })
42474
42538
  ] }),
42475
- log4.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
42539
+ log18.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
42476
42540
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
42477
- /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log4.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
42541
+ /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log18.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
42478
42542
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
42479
42543
  " ",
42480
42544
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -46844,10 +46908,11 @@ var init_Canvas3DErrorBoundary = __esm({
46844
46908
  "components/organisms/game/three/components/Canvas3DErrorBoundary.css"() {
46845
46909
  }
46846
46910
  });
46847
- var Canvas3DErrorBoundary;
46911
+ var log11, Canvas3DErrorBoundary;
46848
46912
  var init_Canvas3DErrorBoundary2 = __esm({
46849
46913
  "components/organisms/game/three/components/Canvas3DErrorBoundary.tsx"() {
46850
46914
  init_Canvas3DErrorBoundary();
46915
+ log11 = logger.createLogger("almadar:ui:game:canvas3d:error-boundary");
46851
46916
  Canvas3DErrorBoundary = class extends React147.Component {
46852
46917
  constructor(props) {
46853
46918
  super(props);
@@ -46875,8 +46940,8 @@ var init_Canvas3DErrorBoundary2 = __esm({
46875
46940
  componentDidCatch(error, errorInfo) {
46876
46941
  this.setState({ errorInfo });
46877
46942
  this.props.onError?.(error, errorInfo);
46878
- console.error("[Canvas3DErrorBoundary] Error caught:", error);
46879
- console.error("[Canvas3DErrorBoundary] Component stack:", errorInfo.componentStack);
46943
+ log11.error("Error caught", { error });
46944
+ log11.error("Component stack", { componentStack: errorInfo.componentStack ?? "<none>" });
46880
46945
  }
46881
46946
  render() {
46882
46947
  if (this.state.hasError) {
@@ -46939,7 +47004,7 @@ function useGLTFModel(url, resourceBasePath) {
46939
47004
  setState({ model: null, isLoading: false, error: null });
46940
47005
  return;
46941
47006
  }
46942
- console.log("[ModelLoader] Loading:", url);
47007
+ log12.debug("Loading", { url });
46943
47008
  setState((prev) => ({ ...prev, isLoading: true, error: null }));
46944
47009
  const assetRoot = resourceBasePath || detectAssetRoot(url);
46945
47010
  const loader = new GLTFLoader.GLTFLoader();
@@ -46947,7 +47012,7 @@ function useGLTFModel(url, resourceBasePath) {
46947
47012
  loader.load(
46948
47013
  url,
46949
47014
  (gltf) => {
46950
- console.log("[ModelLoader] Loaded:", url);
47015
+ log12.debug("Loaded", { url });
46951
47016
  setState({
46952
47017
  model: gltf.scene,
46953
47018
  isLoading: false,
@@ -46956,8 +47021,7 @@ function useGLTFModel(url, resourceBasePath) {
46956
47021
  },
46957
47022
  void 0,
46958
47023
  (err) => {
46959
- const errorMsg = err instanceof Error ? err.message : String(err);
46960
- console.warn("[ModelLoader] Failed:", url, errorMsg);
47024
+ log12.warn("Failed", { url, error: err instanceof Error ? err : String(err) });
46961
47025
  setState({
46962
47026
  model: null,
46963
47027
  isLoading: false,
@@ -47073,9 +47137,11 @@ function ModelLoader({
47073
47137
  }
47074
47138
  );
47075
47139
  }
47140
+ var log12;
47076
47141
  var init_ModelLoader = __esm({
47077
47142
  "components/organisms/game/three/components/ModelLoader.tsx"() {
47078
47143
  "use client";
47144
+ log12 = logger.createLogger("almadar:ui:game:model-loader");
47079
47145
  }
47080
47146
  });
47081
47147
  function PhysicsObject3D({
@@ -47166,13 +47232,13 @@ function PhysicsObject3D({
47166
47232
  }
47167
47233
  function usePhysics3DController(entityId) {
47168
47234
  const applyForce = (fx, fy, fz) => {
47169
- console.log(`Apply force to ${entityId}:`, { fx, fy, fz });
47235
+ log13.debug("apply force", { entityId, fx, fy, fz });
47170
47236
  };
47171
47237
  const setVelocity = (vx, vy, vz) => {
47172
- console.log(`Set velocity for ${entityId}:`, { vx, vy, vz });
47238
+ log13.debug("set velocity", { entityId, vx, vy, vz });
47173
47239
  };
47174
47240
  const setPosition = (x, y, z) => {
47175
- console.log(`Set position for ${entityId}:`, { x, y, z });
47241
+ log13.debug("set position", { entityId, x, y, z });
47176
47242
  };
47177
47243
  const jump = (force = 10) => {
47178
47244
  applyForce(0, force, 0);
@@ -47184,10 +47250,12 @@ function usePhysics3DController(entityId) {
47184
47250
  jump
47185
47251
  };
47186
47252
  }
47253
+ var log13;
47187
47254
  var init_PhysicsObject3D = __esm({
47188
47255
  "components/organisms/game/three/components/PhysicsObject3D.tsx"() {
47189
47256
  "use client";
47190
47257
  init_ModelLoader();
47258
+ log13 = logger.createLogger("almadar:ui:game:physics");
47191
47259
  }
47192
47260
  });
47193
47261
  function detectAssetRoot2(modelUrl) {
@@ -48773,14 +48841,16 @@ function preloadFeatures(urls) {
48773
48841
  const loader = new GLTFLoader.GLTFLoader();
48774
48842
  loader.setResourcePath(detectAssetRoot3(url));
48775
48843
  loader.load(url, () => {
48776
- console.log("[FeatureRenderer3D] Preloaded:", url);
48844
+ log14.debug("Preloaded", { url });
48777
48845
  });
48778
48846
  }
48779
48847
  });
48780
48848
  }
48849
+ var log14;
48781
48850
  var init_FeatureRenderer3D = __esm({
48782
48851
  "components/organisms/game/three/renderers/FeatureRenderer3D.tsx"() {
48783
48852
  "use client";
48853
+ log14 = logger.createLogger("almadar:ui:game:feature-renderer");
48784
48854
  }
48785
48855
  });
48786
48856
 
@@ -52211,6 +52281,7 @@ var init_component_registry_generated = __esm({
52211
52281
  init_LoadingState();
52212
52282
  init_MarkdownContent();
52213
52283
  init_MasterDetail();
52284
+ init_MasterDetailLayout();
52214
52285
  init_MatrixQuestion();
52215
52286
  init_MediaGallery();
52216
52287
  init_Meter();
@@ -52505,6 +52576,7 @@ var init_component_registry_generated = __esm({
52505
52576
  "MapViewPattern": MapViewPattern,
52506
52577
  "MarkdownContent": MarkdownContent,
52507
52578
  "MasterDetail": MasterDetail,
52579
+ "MasterDetailLayout": MasterDetailLayout,
52508
52580
  "MatrixQuestion": MatrixQuestion,
52509
52581
  "MediaGallery": MediaGallery,
52510
52582
  "Menu": MenuPattern,
@@ -53262,7 +53334,7 @@ function SlotContentRenderer({
53262
53334
  }) {
53263
53335
  const entityProp = content.props.entity;
53264
53336
  if (content.pattern === "form-section") {
53265
- slotLog2.debug("SlotContentRenderer:form-section-render", {
53337
+ slotLog.debug("SlotContentRenderer:form-section-render", {
53266
53338
  contentId: content.id,
53267
53339
  sourceTrait: content.sourceTrait,
53268
53340
  entityRefId: refId(entityProp),
@@ -56308,6 +56380,7 @@ init_EventBusProvider();
56308
56380
 
56309
56381
  // providers/SelectionProvider.tsx
56310
56382
  init_useEventBus();
56383
+ var log4 = logger.createLogger("almadar:ui:selection");
56311
56384
  var SelectionContext = React147.createContext(null);
56312
56385
  var defaultCompareEntities = (a, b) => {
56313
56386
  if (a === b) return true;
@@ -56330,7 +56403,10 @@ function SelectionProvider({
56330
56403
  (entity) => {
56331
56404
  setSelectedState(entity);
56332
56405
  if (debug2) {
56333
- console.log("[SelectionProvider] Selection set:", entity);
56406
+ log4.debug("Selection set", () => ({
56407
+ hasEntity: entity !== null && entity !== void 0,
56408
+ entityId: entity && typeof entity === "object" ? String(entity.id ?? "") : ""
56409
+ }));
56334
56410
  }
56335
56411
  },
56336
56412
  [debug2]
@@ -56338,7 +56414,7 @@ function SelectionProvider({
56338
56414
  const clearSelection = React147.useCallback(() => {
56339
56415
  setSelectedState(null);
56340
56416
  if (debug2) {
56341
- console.log("[SelectionProvider] Selection cleared");
56417
+ log4.debug("Selection cleared");
56342
56418
  }
56343
56419
  }, [debug2]);
56344
56420
  const isSelected = React147.useCallback(
@@ -56353,14 +56429,17 @@ function SelectionProvider({
56353
56429
  if (row) {
56354
56430
  setSelected(row);
56355
56431
  if (debug2) {
56356
- console.log(`[SelectionProvider] ${event.type} received:`, row);
56432
+ log4.debug("event received", () => ({
56433
+ type: event.type,
56434
+ rowId: row && typeof row === "object" ? String(row.id ?? "") : ""
56435
+ }));
56357
56436
  }
56358
56437
  }
56359
56438
  };
56360
56439
  const handleDeselect = (event) => {
56361
56440
  clearSelection();
56362
56441
  if (debug2) {
56363
- console.log(`[SelectionProvider] ${event.type} received - clearing selection`);
56442
+ log4.debug("event received - clearing selection", { type: event.type });
56364
56443
  }
56365
56444
  };
56366
56445
  const unsubView = eventBus.on("UI:VIEW", handleSelect);
@@ -56391,7 +56470,7 @@ init_UISlotRenderer();
56391
56470
  // providers/VerificationProvider.tsx
56392
56471
  init_useEventBus();
56393
56472
  init_verificationRegistry();
56394
- var log3 = logger.createLogger("almadar:verify");
56473
+ var log15 = logger.createLogger("almadar:verify");
56395
56474
  var DISPATCH_SUFFIX = ":DISPATCH";
56396
56475
  var SUCCESS_SUFFIX = ":SUCCESS";
56397
56476
  var ERROR_SUFFIX = ":ERROR";
@@ -56437,7 +56516,7 @@ function VerificationProvider({
56437
56516
  const verificationProviderLifecycleListener = (evt) => {
56438
56517
  const parsed = parseLifecycleEvent(evt.type);
56439
56518
  if (!parsed) return;
56440
- log3.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
56519
+ log15.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
56441
56520
  const payload = evt.payload ?? {};
56442
56521
  if (parsed.kind === "dispatch") {
56443
56522
  const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
@@ -56492,7 +56571,7 @@ function VerificationProvider({
56492
56571
  },
56493
56572
  timestamp: Date.now()
56494
56573
  });
56495
- log3.debug("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
56574
+ log15.debug("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
56496
56575
  } else if (parsed.kind === "error" && parsed.event) {
56497
56576
  const key = `${parsed.traitName}:${parsed.event}`;
56498
56577
  const pending = pendingRef.current.get(key);
@@ -56522,7 +56601,7 @@ function VerificationProvider({
56522
56601
  },
56523
56602
  timestamp: Date.now()
56524
56603
  });
56525
- log3.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
56604
+ log15.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
56526
56605
  }
56527
56606
  };
56528
56607
  Object.defineProperty(verificationProviderLifecycleListener, "name", {
@@ -56675,7 +56754,11 @@ function useResolvedSchema(schema, pageName) {
56675
56754
  };
56676
56755
  }
56677
56756
  const page = core.getPage(ir, pageName);
56678
- console.log("[useResolvedSchema] Resolved page:", page?.name, "| path:", page?.path, "| traits:", page?.traits.length);
56757
+ resolvedSchemaLog.debug("Resolved page", () => ({
56758
+ name: page?.name,
56759
+ path: page?.path,
56760
+ traits: page?.traits.length
56761
+ }));
56679
56762
  const traits2 = page?.traits || [];
56680
56763
  const entities = /* @__PURE__ */ new Map();
56681
56764
  if (page) {
@@ -56878,8 +56961,7 @@ function convertFnFormLambdasInProps(props) {
56878
56961
  // hooks/index.ts
56879
56962
  init_useEventBus();
56880
56963
  var ALMADAR_DND_MIME = "application/x-almadar-dnd";
56881
-
56882
- // runtime/createClientEffectHandlers.ts
56964
+ var log16 = logger.createLogger("almadar:ui:effects:client-handlers");
56883
56965
  function createClientEffectHandlers(options) {
56884
56966
  const { eventBus, slotSetter, navigate, notify, callService } = options;
56885
56967
  return {
@@ -56888,10 +56970,10 @@ function createClientEffectHandlers(options) {
56888
56970
  eventBus.emit(prefixedEvent, payload);
56889
56971
  },
56890
56972
  persist: async () => {
56891
- console.warn("[ClientEffectHandlers] persist is server-side only, ignored on client");
56973
+ log16.warn("persist is server-side only, ignored on client");
56892
56974
  },
56893
56975
  set: () => {
56894
- console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
56976
+ log16.warn("set is server-side only, ignored on client");
56895
56977
  },
56896
56978
  callService: async (service, action, params) => {
56897
56979
  if (callService) return callService(service, action, params);
@@ -56920,10 +57002,10 @@ function createClientEffectHandlers(options) {
56920
57002
  slotSetter.addPattern(slot, pattern, props);
56921
57003
  },
56922
57004
  navigate: navigate ?? ((path) => {
56923
- console.warn("[ClientEffectHandlers] No navigate handler, ignoring:", path);
57005
+ log16.warn("No navigate handler, ignoring", { path });
56924
57006
  }),
56925
57007
  notify: notify ?? ((msg, type) => {
56926
- console.log(`[ClientEffectHandlers] notify (${type}):`, msg);
57008
+ log16.debug("notify", { type, message: msg });
56927
57009
  })
56928
57010
  };
56929
57011
  }
@@ -57118,10 +57200,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57118
57200
  });
57119
57201
  snapshotUnregs.push(unreg);
57120
57202
  }
57121
- console.log(
57122
- "[TraitStateMachine] Reset states for page navigation:",
57123
- Array.from(newManager.getAllStates().keys()).join(", ")
57124
- );
57203
+ stateLog.debug("reset-states-for-nav", () => ({
57204
+ traits: Array.from(newManager.getAllStates().keys()).join(", ")
57205
+ }));
57125
57206
  return () => {
57126
57207
  for (const unreg of snapshotUnregs) unreg();
57127
57208
  };
@@ -57208,9 +57289,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57208
57289
  const normalizedEvent = normalizeEventKey(eventKey);
57209
57290
  const bindings = traitBindingsRef.current;
57210
57291
  const currentManager = managerRef.current;
57211
- console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
57212
57292
  crossTraitLog.debug("processEvent:enter", () => ({
57213
57293
  event: normalizedEvent,
57294
+ payload: JSON.stringify(payload ?? null),
57214
57295
  traitCount: bindings.length,
57215
57296
  traitNames: bindings.map((b) => b.trait.name).join(","),
57216
57297
  orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
@@ -57269,18 +57350,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57269
57350
  }
57270
57351
  }
57271
57352
  if (result.executed && result.effects.length > 0) {
57272
- console.log(
57273
- "[TraitStateMachine] Executing",
57274
- result.effects.length,
57275
- "effects for",
57353
+ stateLog.debug("executing-effects", () => ({
57354
+ effectCount: result.effects.length,
57276
57355
  traitName,
57277
- "| linkedEntity:",
57278
- binding.linkedEntity,
57279
- "| transition:",
57280
- `${result.previousState} -> ${result.newState}`,
57281
- "| effects:",
57282
- JSON.stringify(result.effects)
57283
- );
57356
+ linkedEntity: binding.linkedEntity,
57357
+ transition: `${result.previousState} -> ${result.newState}`,
57358
+ effects: JSON.stringify(result.effects)
57359
+ }));
57284
57360
  const linkedEntity = binding.linkedEntity || "";
57285
57361
  const entityId = payload?.entityId;
57286
57362
  const pendingSlots = /* @__PURE__ */ new Map();
@@ -57426,30 +57502,25 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57426
57502
  }
57427
57503
  } else if (!result.executed) {
57428
57504
  if (result.guardResult === false) {
57429
- console.log(
57430
- "[TraitStateMachine] Guard blocked transition:",
57505
+ stateLog.debug("guard-blocked-transition", {
57431
57506
  traitName,
57432
- result.previousState,
57433
- "->",
57434
- result.transition?.to
57435
- );
57507
+ from: result.previousState,
57508
+ to: result.transition?.to
57509
+ });
57436
57510
  } else if (!result.transition) {
57437
57511
  if (core.isCircuitEvent(normalizedEvent)) {
57438
- console.warn(
57439
- `[CLOSED CIRCUIT VIOLATION] Trait "${traitName}" in state "${traitState.currentState}" received event "${normalizedEvent}" but has no transition to handle it.
57440
- This is likely a schema issue. To fix, add a transition:
57441
- { from: "${traitState.currentState}", to: "<target_state>", event: "${normalizedEvent}", effects: [...] }
57442
- Or ensure the previous action (that opened this UI) properly transitions back before emitting this event.`
57443
- );
57512
+ stateLog.warn("closed-circuit-violation", {
57513
+ traitName,
57514
+ currentState: traitState.currentState,
57515
+ event: normalizedEvent,
57516
+ remediation: `Add transition { from: "${traitState.currentState}", to: "<target_state>", event: "${normalizedEvent}", effects: [...] } \u2014 or ensure the previous action (that opened this UI) transitions back before emitting.`
57517
+ });
57444
57518
  } else {
57445
- console.log(
57446
- "[TraitStateMachine] No transition for",
57519
+ stateLog.debug("no-transition", {
57447
57520
  traitName,
57448
- "from state:",
57449
- traitState.currentState,
57450
- "on event:",
57451
- normalizedEvent
57452
- );
57521
+ from: traitState.currentState,
57522
+ event: normalizedEvent
57523
+ });
57453
57524
  }
57454
57525
  }
57455
57526
  }
@@ -57557,7 +57628,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57557
57628
  allEvents.add(transition.event);
57558
57629
  }
57559
57630
  }
57560
- console.log("[TraitStateMachine] Subscribing to events:", Array.from(allEvents));
57631
+ stateLog.debug("subscribing-to-events", () => ({ events: Array.from(allEvents) }));
57561
57632
  const unsubscribes = [];
57562
57633
  const subscribedBusKeys = /* @__PURE__ */ new Set();
57563
57634
  for (const binding of traitBindings) {
@@ -57635,6 +57706,7 @@ init_EntitySchemaContext();
57635
57706
  // runtime/ServerBridge.tsx
57636
57707
  init_useEventBus();
57637
57708
  var xOrbitalLog = logger.createLogger("almadar:runtime:cross-orbital");
57709
+ var serverBridgeLog = logger.createLogger("almadar:ui:server-bridge");
57638
57710
  function createHttpTransport(serverUrl) {
57639
57711
  return {
57640
57712
  register: async (schema) => {
@@ -57647,7 +57719,7 @@ function createHttpTransport(serverUrl) {
57647
57719
  const result = await res.json();
57648
57720
  return !!result.success;
57649
57721
  } catch (err) {
57650
- console.error("[ServerBridge] Registration failed:", err);
57722
+ serverBridgeLog.error("Registration failed", { error: err instanceof Error ? err : String(err) });
57651
57723
  return false;
57652
57724
  }
57653
57725
  },
@@ -58395,7 +58467,7 @@ function entityNameOf(ref) {
58395
58467
  }
58396
58468
  var eventHandleLog = logger.createLogger("almadar:ui:nan-coord");
58397
58469
  var orbPreviewLog = logger.createLogger("almadar:ui:orb-preview-node");
58398
- orbPreviewLog.info("module-init", { browserPlayground: typeof BrowserPlayground });
58470
+ orbPreviewLog.debug("module-init", () => ({ browserPlayground: typeof BrowserPlayground }));
58399
58471
  var ScreenSizeContext = React147.createContext("tablet");
58400
58472
  var PatternSelectionContext = React147.createContext({ selected: null, select: () => {
58401
58473
  } });
@@ -58852,11 +58924,11 @@ var OrbPreviewNodeInner = (props) => {
58852
58924
  };
58853
58925
  var OrbPreviewNode = React147__namespace.default.memo(OrbPreviewNodeInner);
58854
58926
  OrbPreviewNode.displayName = "OrbPreviewNode";
58855
- orbPreviewLog.info("export-resolved", {
58927
+ orbPreviewLog.debug("export-resolved", () => ({
58856
58928
  type: typeof OrbPreviewNode,
58857
- displayName: OrbPreviewNode.displayName,
58929
+ displayName: OrbPreviewNode.displayName ?? null,
58858
58930
  innerDefined: typeof OrbPreviewNodeInner === "function"
58859
- });
58931
+ }));
58860
58932
  var edgeLog = logger.createLogger("almadar:ui:nan-coord");
58861
58933
  var EventFlowEdgeInner = (props) => {
58862
58934
  const {
@@ -59688,12 +59760,12 @@ var NODE_TYPES = {
59688
59760
  preview: OrbPreviewNode,
59689
59761
  behaviorCompose: BehaviorComposeNode
59690
59762
  };
59691
- flowCanvasLog.info("node-type-registry", {
59763
+ flowCanvasLog.debug("node-type-registry", () => ({
59692
59764
  registered: Object.keys(NODE_TYPES),
59693
59765
  preview: typeof OrbPreviewNode,
59694
59766
  previewIsValid: typeof OrbPreviewNode === "function" || typeof OrbPreviewNode === "object" && OrbPreviewNode !== null,
59695
59767
  behaviorCompose: typeof BehaviorComposeNode
59696
- });
59768
+ }));
59697
59769
  var DEFAULT_EDGE_OPTIONS = {
59698
59770
  markerEnd: { type: react.MarkerType.ArrowClosed, width: 12, height: 12 }
59699
59771
  };
@@ -60151,6 +60223,7 @@ init_AvlTransitionLane();
60151
60223
  init_AvlSwimLane();
60152
60224
  init_types();
60153
60225
  init_avl_elk_layout();
60226
+ var log17 = logger.createLogger("almadar:ui:avl:trait-scene");
60154
60227
  var SWIM_GUTTER2 = 120;
60155
60228
  var CENTER_W2 = 360;
60156
60229
  var AvlTraitScene = ({
@@ -60161,7 +60234,9 @@ var AvlTraitScene = ({
60161
60234
  const [layout, setLayout] = React147.useState(null);
60162
60235
  const dataKey = React147.useMemo(() => JSON.stringify(data), [data]);
60163
60236
  React147.useEffect(() => {
60164
- computeTraitLayout(data).then(setLayout).catch(console.error);
60237
+ computeTraitLayout(data).then(setLayout).catch((error) => {
60238
+ log17.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
60239
+ });
60165
60240
  }, [dataKey]);
60166
60241
  if (!layout) {
60167
60242
  return /* @__PURE__ */ jsxRuntime.jsx("g", { children: /* @__PURE__ */ jsxRuntime.jsx("text", { x: 300, y: 200, textAnchor: "middle", fill: color, fontSize: 12, opacity: 0.5, children: "Computing layout..." }) });