@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.
@@ -217,7 +217,7 @@ var init_useEventBus = __esm({
217
217
  try {
218
218
  handler(event);
219
219
  } catch (error) {
220
- console.error(`[EventBus] Error in listener for '${type}':`, error);
220
+ log.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
221
221
  }
222
222
  });
223
223
  }
@@ -225,7 +225,7 @@ var init_useEventBus = __esm({
225
225
  try {
226
226
  handler(event);
227
227
  } catch (error) {
228
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
228
+ log.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
229
229
  }
230
230
  });
231
231
  },
@@ -4228,6 +4228,7 @@ var BUILT_IN_THEMES, ThemeContext;
4228
4228
  var init_ThemeContext = __esm({
4229
4229
  "context/ThemeContext.tsx"() {
4230
4230
  "use client";
4231
+ logger.createLogger("almadar:ui:theme");
4231
4232
  BUILT_IN_THEMES = [
4232
4233
  {
4233
4234
  name: "wireframe",
@@ -6431,12 +6432,15 @@ function ControlButton({
6431
6432
  sizeMap3[size] ?? sizeMap3.md,
6432
6433
  shapeMap[shape] ?? shapeMap.circle,
6433
6434
  variantMap[variant] ?? variantMap.secondary,
6434
- actualPressed && "scale-95 brightness-110 border-white",
6435
+ actualPressed && "scale-95 brightness-110 border-foreground",
6435
6436
  disabled && "opacity-50 cursor-not-allowed",
6436
6437
  className
6437
6438
  ),
6438
6439
  children: [
6439
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-2xl", children: icon }),
6440
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-2xl", children: typeof icon === "string" ? (() => {
6441
+ const I = resolveIcon(icon);
6442
+ return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-6 h-6" }) : null;
6443
+ })() : icon }),
6440
6444
  label && !icon && /* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
6441
6445
  ]
6442
6446
  }
@@ -6448,6 +6452,7 @@ var init_ControlButton = __esm({
6448
6452
  "use client";
6449
6453
  init_cn();
6450
6454
  init_useEventBus();
6455
+ init_Icon();
6451
6456
  sizeMap3 = {
6452
6457
  sm: "w-10 h-10 text-sm",
6453
6458
  md: "w-14 h-14 text-base",
@@ -6460,9 +6465,9 @@ var init_ControlButton = __esm({
6460
6465
  square: "rounded-md"
6461
6466
  };
6462
6467
  variantMap = {
6463
- primary: "bg-blue-600 text-[var(--color-foreground)] border-blue-400 hover:bg-blue-500",
6464
- secondary: "bg-[var(--color-surface,#374151)] text-[var(--color-foreground)] border-gray-500 hover:bg-gray-600",
6465
- ghost: "bg-transparent text-[var(--color-foreground)] border-white/30 hover:bg-white/10"
6468
+ primary: "bg-primary text-primary-foreground border-primary hover:bg-primary-hover",
6469
+ secondary: "bg-secondary text-secondary-foreground border-border hover:bg-secondary-hover",
6470
+ ghost: "bg-transparent text-foreground border-border hover:bg-muted"
6466
6471
  };
6467
6472
  ControlButton.displayName = "ControlButton";
6468
6473
  }
@@ -7190,8 +7195,8 @@ function ChoiceButton({
7190
7195
  className: cn(
7191
7196
  "w-full text-left px-4 py-2.5 rounded-md border transition-all duration-150",
7192
7197
  "flex items-center gap-2",
7193
- 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",
7194
- disabled && "opacity-40 cursor-not-allowed hover:bg-white/5 hover:border-white/10",
7198
+ selected ? "bg-accent/15 border-accent text-foreground" : "bg-muted/40 border-border text-foreground hover:bg-muted hover:border-border",
7199
+ disabled && "opacity-40 cursor-not-allowed hover:bg-muted/40 hover:border-border",
7195
7200
  className
7196
7201
  ),
7197
7202
  children: [
@@ -7200,7 +7205,7 @@ function ChoiceButton({
7200
7205
  {
7201
7206
  className: cn(
7202
7207
  "flex-shrink-0 font-mono font-bold text-sm",
7203
- selected ? "text-yellow-400" : "text-gray-500"
7208
+ selected ? "text-accent" : "text-muted-foreground"
7204
7209
  ),
7205
7210
  children: [
7206
7211
  index,
@@ -7241,7 +7246,7 @@ function ActionButton({
7241
7246
  disabled: isDisabled,
7242
7247
  onClick,
7243
7248
  className: cn(
7244
- "relative inline-flex items-center gap-1.5 rounded-md border font-medium text-[var(--color-foreground)] overflow-hidden transition-colors duration-150",
7249
+ "relative inline-flex items-center gap-1.5 rounded-md border font-medium overflow-hidden transition-colors duration-150",
7245
7250
  sizes.button,
7246
7251
  variantStyles8[variant],
7247
7252
  isDisabled && "opacity-60 cursor-not-allowed",
@@ -7251,7 +7256,7 @@ function ActionButton({
7251
7256
  onCooldown && /* @__PURE__ */ jsxRuntime.jsx(
7252
7257
  "div",
7253
7258
  {
7254
- className: "absolute inset-0 bg-black/60 pointer-events-none",
7259
+ className: "absolute inset-0 bg-foreground/40 pointer-events-none",
7255
7260
  style: {
7256
7261
  clipPath: `conic-gradient(from 0deg, transparent ${360 - cooldownDeg}deg, black ${360 - cooldownDeg}deg)`,
7257
7262
  WebkitClipPath: `conic-gradient(from 0deg, transparent ${360 - cooldownDeg}deg, black ${360 - cooldownDeg}deg)`,
@@ -7259,13 +7264,16 @@ function ActionButton({
7259
7264
  }
7260
7265
  }
7261
7266
  ),
7262
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon }),
7267
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: typeof icon === "string" ? (() => {
7268
+ const I = resolveIcon(icon);
7269
+ return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-4 h-4" }) : null;
7270
+ })() : icon }),
7263
7271
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10", children: label }),
7264
7272
  hotkey && /* @__PURE__ */ jsxRuntime.jsx(
7265
7273
  "span",
7266
7274
  {
7267
7275
  className: cn(
7268
- "absolute top-0.5 right-0.5 bg-black/50 text-gray-300 rounded font-mono leading-tight",
7276
+ "absolute top-0.5 right-0.5 bg-foreground/30 text-primary-foreground rounded font-mono leading-tight",
7269
7277
  sizes.hotkey
7270
7278
  ),
7271
7279
  children: hotkey
@@ -7279,15 +7287,16 @@ var sizeMap13, variantStyles8;
7279
7287
  var init_ActionButton = __esm({
7280
7288
  "components/atoms/game/ActionButton.tsx"() {
7281
7289
  init_cn();
7290
+ init_Icon();
7282
7291
  sizeMap13 = {
7283
7292
  sm: { button: "px-3 py-1.5 text-xs", hotkey: "text-[9px] px-1", icon: "text-xs" },
7284
7293
  md: { button: "px-4 py-2 text-sm", hotkey: "text-[10px] px-1.5", icon: "text-sm" },
7285
7294
  lg: { button: "px-5 py-2.5 text-base", hotkey: "text-xs px-2", icon: "text-base" }
7286
7295
  };
7287
7296
  variantStyles8 = {
7288
- primary: "bg-blue-600 hover:bg-blue-500 border-blue-400/40",
7289
- secondary: "bg-gray-700 hover:bg-gray-600 border-gray-500/40",
7290
- danger: "bg-red-700 hover:bg-red-600 border-red-400/40"
7297
+ primary: "bg-primary text-primary-foreground hover:bg-primary-hover border-primary",
7298
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-hover border-border",
7299
+ danger: "bg-error text-error-foreground hover:bg-error/90 border-error"
7291
7300
  };
7292
7301
  ActionButton.displayName = "ActionButton";
7293
7302
  }
@@ -7729,6 +7738,7 @@ function getAllPages(schema) {
7729
7738
  var init_navigation = __esm({
7730
7739
  "renderer/navigation.tsx"() {
7731
7740
  "use client";
7741
+ logger.createLogger("almadar:ui:navigation");
7732
7742
  React135.createContext(null);
7733
7743
  }
7734
7744
  });
@@ -10206,7 +10216,7 @@ function recordTransition(trace) {
10206
10216
  ...trace,
10207
10217
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
10208
10218
  };
10209
- log2.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10219
+ log5.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10210
10220
  getState().transitions.push(entry);
10211
10221
  if (getState().transitions.length > MAX_TRANSITIONS) {
10212
10222
  getState().transitions.shift();
@@ -10305,7 +10315,7 @@ function getTraitSnapshots() {
10305
10315
  try {
10306
10316
  snapshots.push(getter());
10307
10317
  } catch (err) {
10308
- log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10318
+ log5.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10309
10319
  }
10310
10320
  }
10311
10321
  return snapshots;
@@ -10389,10 +10399,10 @@ function updateAssetStatus(url, status) {
10389
10399
  window.__orbitalVerification.assetStatus[url] = status;
10390
10400
  }
10391
10401
  }
10392
- var log2, MAX_TRANSITIONS;
10402
+ var log5, MAX_TRANSITIONS;
10393
10403
  var init_verificationRegistry = __esm({
10394
10404
  "lib/verificationRegistry.ts"() {
10395
- log2 = logger.createLogger("almadar:bridge");
10405
+ log5 = logger.createLogger("almadar:bridge");
10396
10406
  MAX_TRANSITIONS = 500;
10397
10407
  exposeOnWindow();
10398
10408
  }
@@ -12420,7 +12430,7 @@ var init_avl_elk_layout = __esm({
12420
12430
  elk = new ELK__default.default();
12421
12431
  }
12422
12432
  });
12423
- var SWIM_GUTTER, CENTER_W, BehaviorView;
12433
+ var log6, SWIM_GUTTER, CENTER_W, BehaviorView;
12424
12434
  var init_BehaviorView = __esm({
12425
12435
  "components/molecules/avl/BehaviorView.tsx"() {
12426
12436
  "use client";
@@ -12429,6 +12439,7 @@ var init_BehaviorView = __esm({
12429
12439
  init_AvlSwimLane();
12430
12440
  init_types();
12431
12441
  init_avl_elk_layout();
12442
+ log6 = logger.createLogger("almadar:ui:avl:behavior-view");
12432
12443
  SWIM_GUTTER = 120;
12433
12444
  CENTER_W = 360;
12434
12445
  BehaviorView = ({ data }) => {
@@ -12438,7 +12449,7 @@ var init_BehaviorView = __esm({
12438
12449
  const dataKey = React135.useMemo(() => JSON.stringify(traitData), [traitData]);
12439
12450
  React135.useEffect(() => {
12440
12451
  if (!traitData) return;
12441
- computeTraitLayout(traitData).then(setLayout).catch(console.error);
12452
+ computeTraitLayout(traitData).then(setLayout).catch((err) => log6.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
12442
12453
  }, [dataKey]);
12443
12454
  if (!traitData) {
12444
12455
  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" });
@@ -12783,7 +12794,7 @@ function computeFoldRegions(code) {
12783
12794
  }
12784
12795
  return regions.sort((a, b) => a.start - b.start);
12785
12796
  }
12786
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12797
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12787
12798
  var init_CodeBlock = __esm({
12788
12799
  "components/molecules/markdown/CodeBlock.tsx"() {
12789
12800
  init_Box();
@@ -12860,6 +12871,7 @@ var init_CodeBlock = __esm({
12860
12871
  "lolo-op-async": { color: syntax.ORB_COLORS.dark.async }
12861
12872
  };
12862
12873
  loloStyle = { ...dark__default.default, ...loloStyleOverrides };
12874
+ log7 = logger.createLogger("almadar:ui:markdown-code");
12863
12875
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12864
12876
  HIDDEN_LINE_NUMBERS = { display: "none" };
12865
12877
  CodeBlock = React135__namespace.default.memo(
@@ -13058,7 +13070,7 @@ var init_CodeBlock = __esm({
13058
13070
  eventBus.emit("UI:COPY_CODE", { language, success: true });
13059
13071
  setTimeout(() => setCopied(false), 2e3);
13060
13072
  } catch (err) {
13061
- console.error("Failed to copy code:", err);
13073
+ log7.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
13062
13074
  eventBus.emit("UI:COPY_CODE", { language, success: false });
13063
13075
  }
13064
13076
  };
@@ -16570,13 +16582,14 @@ function useSafeEventBus2() {
16570
16582
  } };
16571
16583
  }
16572
16584
  }
16573
- var ButtonGroup;
16585
+ var log8, ButtonGroup;
16574
16586
  var init_ButtonGroup = __esm({
16575
16587
  "components/molecules/ButtonGroup.tsx"() {
16576
16588
  "use client";
16577
16589
  init_cn();
16578
16590
  init_atoms();
16579
16591
  init_useEventBus();
16592
+ log8 = logger.createLogger("almadar:ui:button-group");
16580
16593
  ButtonGroup = ({
16581
16594
  children,
16582
16595
  primary,
@@ -16649,7 +16662,7 @@ var init_ButtonGroup = __esm({
16649
16662
  {
16650
16663
  variant: "ghost",
16651
16664
  onClick: () => {
16652
- console.log(`Filter clicked: ${filter.field}`);
16665
+ log8.debug("Filter clicked", { field: filter.field });
16653
16666
  },
16654
16667
  children: filter.label
16655
16668
  },
@@ -21329,7 +21342,7 @@ function DataGrid({
21329
21342
  onClick: handleActionClick(action, itemData),
21330
21343
  "data-testid": `action-${action.event}`,
21331
21344
  "data-row-id": String(itemData.id),
21332
- className: "text-error hover:bg-error/10 px-2",
21345
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
21333
21346
  children: [
21334
21347
  action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs" }),
21335
21348
  action.label
@@ -22521,31 +22534,56 @@ var init_InputGroup = __esm({
22521
22534
  InputGroup.displayName = "InputGroup";
22522
22535
  }
22523
22536
  });
22524
-
22525
- // lib/debug.ts
22537
+ function gateEnabled(level, ns = NAMESPACE) {
22538
+ return logger.isLogLevelEnabled(level, ns);
22539
+ }
22526
22540
  function isDebugEnabled() {
22527
- if (DEBUG_ENABLED) return true;
22528
- return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
22541
+ return gateEnabled("DEBUG");
22529
22542
  }
22530
22543
  function debug(...args) {
22531
- if (isDebugEnabled()) {
22532
- console.log("[DEBUG]", ...args);
22544
+ if (!gateEnabled("DEBUG")) return;
22545
+ const [first, ...rest] = args;
22546
+ const message = typeof first === "string" ? first : "<debug>";
22547
+ if (rest.length === 0 && typeof first === "string") {
22548
+ log9.debug(message);
22549
+ } else {
22550
+ log9.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
22533
22551
  }
22534
22552
  }
22535
22553
  function debugGroup(label) {
22536
- if (isDebugEnabled()) {
22537
- console.group(`[DEBUG] ${label}`);
22538
- }
22554
+ if (gateEnabled("DEBUG")) console.group(`[${NAMESPACE}] ${label}`);
22539
22555
  }
22540
22556
  function debugGroupEnd() {
22541
- if (isDebugEnabled()) {
22542
- console.groupEnd();
22557
+ if (gateEnabled("DEBUG")) console.groupEnd();
22558
+ }
22559
+ function formatArgs(values) {
22560
+ if (values.length === 1) return toLogMetaValue(values[0]);
22561
+ return values.map(toLogMetaValue);
22562
+ }
22563
+ function toLogMetaValue(v) {
22564
+ if (v === null || v === void 0) return v;
22565
+ if (v instanceof Error) return v;
22566
+ const t = typeof v;
22567
+ if (t === "string" || t === "number" || t === "boolean") return v;
22568
+ if (Array.isArray(v)) return v.map(toLogMetaValue);
22569
+ if (t === "object") {
22570
+ const out = {};
22571
+ for (const [k, val] of Object.entries(v)) {
22572
+ out[k] = toLogMetaValue(val);
22573
+ }
22574
+ return out;
22543
22575
  }
22576
+ return String(v);
22544
22577
  }
22545
- var DEBUG_ENABLED;
22578
+ var NAMESPACE, log9;
22546
22579
  var init_debug = __esm({
22547
22580
  "lib/debug.ts"() {
22548
- DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
22581
+ NAMESPACE = "almadar:ui:debug";
22582
+ log9 = logger.createLogger(NAMESPACE);
22583
+ logger.createLogger("almadar:ui:debug:input");
22584
+ logger.createLogger("almadar:ui:debug:collision");
22585
+ logger.createLogger("almadar:ui:debug:physics");
22586
+ logger.createLogger("almadar:ui:debug:game-state");
22549
22587
  }
22550
22588
  });
22551
22589
  var isRelationsDebugEnabled, RelationSelect;
@@ -23833,7 +23871,7 @@ function StatBadge({
23833
23871
  const I = resolveIcon(icon);
23834
23872
  return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-4 h-4" }) : icon;
23835
23873
  })() : icon }),
23836
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 font-medium", children: label }),
23874
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground font-medium", children: label }),
23837
23875
  format === "hearts" && max && /* @__PURE__ */ jsxRuntime.jsx(
23838
23876
  HealthBar,
23839
23877
  {
@@ -23860,7 +23898,7 @@ function StatBadge({
23860
23898
  animated: true
23861
23899
  }
23862
23900
  ),
23863
- format === "text" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-[var(--color-foreground)]", children: value })
23901
+ format === "text" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-foreground", children: value })
23864
23902
  ]
23865
23903
  }
23866
23904
  );
@@ -23878,11 +23916,11 @@ var init_StatBadge = __esm({
23878
23916
  lg: "text-base px-4 py-2"
23879
23917
  };
23880
23918
  variantMap2 = {
23881
- default: "bg-[var(--color-card)]/80 border-gray-700",
23882
- primary: "bg-blue-900/80 border-blue-700",
23883
- success: "bg-green-900/80 border-green-700",
23884
- warning: "bg-yellow-900/80 border-yellow-700",
23885
- danger: "bg-red-900/80 border-red-700"
23919
+ default: "bg-card/80 border-border text-foreground",
23920
+ primary: "bg-primary/15 border-primary/40 text-foreground",
23921
+ success: "bg-success/15 border-success/40 text-foreground",
23922
+ warning: "bg-warning/15 border-warning/40 text-foreground",
23923
+ danger: "bg-error/15 border-error/40 text-foreground"
23886
23924
  };
23887
23925
  StatBadge.displayName = "StatBadge";
23888
23926
  }
@@ -36317,9 +36355,45 @@ var init_List = __esm({
36317
36355
  List3.displayName = "List";
36318
36356
  }
36319
36357
  });
36320
- var DefaultEmptyDetail, MasterDetail;
36358
+ function MasterDetail({
36359
+ entity,
36360
+ masterFields,
36361
+ detailFields: _detailFields,
36362
+ // Captured but not used here - detail handled separately
36363
+ loading: externalLoading,
36364
+ isLoading: externalIsLoading,
36365
+ error: externalError,
36366
+ className,
36367
+ ...rest
36368
+ }) {
36369
+ const loading = externalLoading ?? false;
36370
+ const isLoading = externalIsLoading ?? false;
36371
+ const error = externalError ?? null;
36372
+ return /* @__PURE__ */ jsxRuntime.jsx(
36373
+ DataTable,
36374
+ {
36375
+ fields: masterFields,
36376
+ columns: masterFields,
36377
+ entity,
36378
+ isLoading: loading || isLoading,
36379
+ error,
36380
+ className,
36381
+ emptyTitle: "No items found",
36382
+ emptyDescription: "Create your first item to get started.",
36383
+ ...rest
36384
+ }
36385
+ );
36386
+ }
36321
36387
  var init_MasterDetail = __esm({
36322
- "components/organisms/layout/MasterDetail.tsx"() {
36388
+ "components/organisms/MasterDetail.tsx"() {
36389
+ "use client";
36390
+ init_DataTable();
36391
+ MasterDetail.displayName = "MasterDetail";
36392
+ }
36393
+ });
36394
+ var DefaultEmptyDetail, MasterDetailLayout;
36395
+ var init_MasterDetailLayout = __esm({
36396
+ "components/organisms/layout/MasterDetailLayout.tsx"() {
36323
36397
  init_cn();
36324
36398
  init_Typography();
36325
36399
  DefaultEmptyDetail = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full border-2 border-dashed border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -36330,7 +36404,7 @@ var init_MasterDetail = __esm({
36330
36404
  children: "Select an item to view details"
36331
36405
  }
36332
36406
  ) });
36333
- MasterDetail = ({
36407
+ MasterDetailLayout = ({
36334
36408
  master,
36335
36409
  detail,
36336
36410
  emptyDetail,
@@ -36365,7 +36439,7 @@ var init_MasterDetail = __esm({
36365
36439
  }
36366
36440
  );
36367
36441
  };
36368
- MasterDetail.displayName = "MasterDetail";
36442
+ MasterDetailLayout.displayName = "MasterDetailLayout";
36369
36443
  }
36370
36444
  });
36371
36445
  var COLUMN_CLASSES, ASPECT_CLASSES, MediaGallery;
@@ -38783,7 +38857,7 @@ function getAllEvents(traits2) {
38783
38857
  }
38784
38858
  function EventDispatcherTab({ traits: traits2, schema }) {
38785
38859
  const eventBus = useEventBus();
38786
- const [log3, setLog] = React135__namespace.useState([]);
38860
+ const [log11, setLog] = React135__namespace.useState([]);
38787
38861
  const prevStatesRef = React135__namespace.useRef(/* @__PURE__ */ new Map());
38788
38862
  React135__namespace.useEffect(() => {
38789
38863
  for (const trait of traits2) {
@@ -38847,9 +38921,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
38847
38921
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
38848
38922
  /* @__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)) })
38849
38923
  ] }),
38850
- log3.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
38924
+ log11.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
38851
38925
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
38852
- /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log3.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
38926
+ /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log11.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
38853
38927
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
38854
38928
  " ",
38855
38929
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -43120,6 +43194,7 @@ var init_component_registry_generated = __esm({
43120
43194
  init_LoadingState();
43121
43195
  init_MarkdownContent();
43122
43196
  init_MasterDetail();
43197
+ init_MasterDetailLayout();
43123
43198
  init_MatrixQuestion();
43124
43199
  init_MediaGallery();
43125
43200
  init_Meter();
@@ -43414,6 +43489,7 @@ var init_component_registry_generated = __esm({
43414
43489
  "MapViewPattern": MapViewPattern,
43415
43490
  "MarkdownContent": MarkdownContent,
43416
43491
  "MasterDetail": MasterDetail,
43492
+ "MasterDetailLayout": MasterDetailLayout,
43417
43493
  "MatrixQuestion": MatrixQuestion,
43418
43494
  "MediaGallery": MediaGallery,
43419
43495
  "Menu": MenuPattern,
@@ -44397,8 +44473,7 @@ var init_UISlotRenderer = __esm({
44397
44473
 
44398
44474
  // hooks/index.ts
44399
44475
  init_useEventBus();
44400
-
44401
- // runtime/createClientEffectHandlers.ts
44476
+ var log2 = logger.createLogger("almadar:ui:effects:client-handlers");
44402
44477
  function createClientEffectHandlers(options) {
44403
44478
  const { eventBus, slotSetter, navigate, notify, callService } = options;
44404
44479
  return {
@@ -44407,10 +44482,10 @@ function createClientEffectHandlers(options) {
44407
44482
  eventBus.emit(prefixedEvent, payload);
44408
44483
  },
44409
44484
  persist: async () => {
44410
- console.warn("[ClientEffectHandlers] persist is server-side only, ignored on client");
44485
+ log2.warn("persist is server-side only, ignored on client");
44411
44486
  },
44412
44487
  set: () => {
44413
- console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
44488
+ log2.warn("set is server-side only, ignored on client");
44414
44489
  },
44415
44490
  callService: async (service, action, params) => {
44416
44491
  if (callService) return callService(service, action, params);
@@ -44439,10 +44514,10 @@ function createClientEffectHandlers(options) {
44439
44514
  slotSetter.addPattern(slot, pattern, props);
44440
44515
  },
44441
44516
  navigate: navigate ?? ((path) => {
44442
- console.warn("[ClientEffectHandlers] No navigate handler, ignoring:", path);
44517
+ log2.warn("No navigate handler, ignoring", { path });
44443
44518
  }),
44444
44519
  notify: notify ?? ((msg, type) => {
44445
- console.log(`[ClientEffectHandlers] notify (${type}):`, msg);
44520
+ log2.debug("notify", { type, message: msg });
44446
44521
  })
44447
44522
  };
44448
44523
  }
@@ -44745,10 +44820,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44745
44820
  });
44746
44821
  snapshotUnregs.push(unreg);
44747
44822
  }
44748
- console.log(
44749
- "[TraitStateMachine] Reset states for page navigation:",
44750
- Array.from(newManager.getAllStates().keys()).join(", ")
44751
- );
44823
+ stateLog.debug("reset-states-for-nav", () => ({
44824
+ traits: Array.from(newManager.getAllStates().keys()).join(", ")
44825
+ }));
44752
44826
  return () => {
44753
44827
  for (const unreg of snapshotUnregs) unreg();
44754
44828
  };
@@ -44835,9 +44909,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44835
44909
  const normalizedEvent = normalizeEventKey(eventKey);
44836
44910
  const bindings = traitBindingsRef.current;
44837
44911
  const currentManager = managerRef.current;
44838
- console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
44839
44912
  crossTraitLog.debug("processEvent:enter", () => ({
44840
44913
  event: normalizedEvent,
44914
+ payload: JSON.stringify(payload ?? null),
44841
44915
  traitCount: bindings.length,
44842
44916
  traitNames: bindings.map((b) => b.trait.name).join(","),
44843
44917
  orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
@@ -44896,18 +44970,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44896
44970
  }
44897
44971
  }
44898
44972
  if (result.executed && result.effects.length > 0) {
44899
- console.log(
44900
- "[TraitStateMachine] Executing",
44901
- result.effects.length,
44902
- "effects for",
44973
+ stateLog.debug("executing-effects", () => ({
44974
+ effectCount: result.effects.length,
44903
44975
  traitName,
44904
- "| linkedEntity:",
44905
- binding.linkedEntity,
44906
- "| transition:",
44907
- `${result.previousState} -> ${result.newState}`,
44908
- "| effects:",
44909
- JSON.stringify(result.effects)
44910
- );
44976
+ linkedEntity: binding.linkedEntity,
44977
+ transition: `${result.previousState} -> ${result.newState}`,
44978
+ effects: JSON.stringify(result.effects)
44979
+ }));
44911
44980
  const linkedEntity = binding.linkedEntity || "";
44912
44981
  const entityId = payload?.entityId;
44913
44982
  const pendingSlots = /* @__PURE__ */ new Map();
@@ -45053,30 +45122,25 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45053
45122
  }
45054
45123
  } else if (!result.executed) {
45055
45124
  if (result.guardResult === false) {
45056
- console.log(
45057
- "[TraitStateMachine] Guard blocked transition:",
45125
+ stateLog.debug("guard-blocked-transition", {
45058
45126
  traitName,
45059
- result.previousState,
45060
- "->",
45061
- result.transition?.to
45062
- );
45127
+ from: result.previousState,
45128
+ to: result.transition?.to
45129
+ });
45063
45130
  } else if (!result.transition) {
45064
45131
  if (core.isCircuitEvent(normalizedEvent)) {
45065
- console.warn(
45066
- `[CLOSED CIRCUIT VIOLATION] Trait "${traitName}" in state "${traitState.currentState}" received event "${normalizedEvent}" but has no transition to handle it.
45067
- This is likely a schema issue. To fix, add a transition:
45068
- { from: "${traitState.currentState}", to: "<target_state>", event: "${normalizedEvent}", effects: [...] }
45069
- Or ensure the previous action (that opened this UI) properly transitions back before emitting this event.`
45070
- );
45132
+ stateLog.warn("closed-circuit-violation", {
45133
+ traitName,
45134
+ currentState: traitState.currentState,
45135
+ event: normalizedEvent,
45136
+ 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.`
45137
+ });
45071
45138
  } else {
45072
- console.log(
45073
- "[TraitStateMachine] No transition for",
45139
+ stateLog.debug("no-transition", {
45074
45140
  traitName,
45075
- "from state:",
45076
- traitState.currentState,
45077
- "on event:",
45078
- normalizedEvent
45079
- );
45141
+ from: traitState.currentState,
45142
+ event: normalizedEvent
45143
+ });
45080
45144
  }
45081
45145
  }
45082
45146
  }
@@ -45184,7 +45248,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45184
45248
  allEvents.add(transition.event);
45185
45249
  }
45186
45250
  }
45187
- console.log("[TraitStateMachine] Subscribing to events:", Array.from(allEvents));
45251
+ stateLog.debug("subscribing-to-events", () => ({ events: Array.from(allEvents) }));
45188
45252
  const unsubscribes = [];
45189
45253
  const subscribedBusKeys = /* @__PURE__ */ new Set();
45190
45254
  for (const binding of traitBindings) {
@@ -45319,7 +45383,11 @@ function useResolvedSchema(schema, pageName) {
45319
45383
  };
45320
45384
  }
45321
45385
  const page = core.getPage(ir, pageName);
45322
- console.log("[useResolvedSchema] Resolved page:", page?.name, "| path:", page?.path, "| traits:", page?.traits.length);
45386
+ resolvedSchemaLog.debug("Resolved page", () => ({
45387
+ name: page?.name,
45388
+ path: page?.path,
45389
+ traits: page?.traits.length
45390
+ }));
45323
45391
  const traits2 = page?.traits || [];
45324
45392
  const entities = /* @__PURE__ */ new Map();
45325
45393
  if (page) {
@@ -45346,6 +45414,7 @@ function clearSchemaCache() {
45346
45414
 
45347
45415
  // runtime/index.ts
45348
45416
  init_EntitySchemaContext();
45417
+ var log10 = logger.createLogger("almadar:ui:trait-provider");
45349
45418
  var TraitContext = React135.createContext(null);
45350
45419
  function TraitProvider({
45351
45420
  traits: traitBindings,
@@ -45362,7 +45431,11 @@ function TraitProvider({
45362
45431
  currentState: stateName,
45363
45432
  availableEvents: trait.transitions.filter((t) => t.from === stateName).map((t) => t.event),
45364
45433
  dispatch: (eventKey, payload) => {
45365
- console.log(`[TraitProvider] Dispatch to ${trait.name}: ${eventKey}`, payload);
45434
+ log10.debug("Dispatch", () => ({
45435
+ trait: trait.name,
45436
+ event: eventKey,
45437
+ payloadKeys: payload ? Object.keys(payload) : []
45438
+ }));
45366
45439
  },
45367
45440
  canDispatch: (eventKey) => {
45368
45441
  return trait.transitions.some(
@@ -45490,6 +45563,7 @@ init_EntitySchemaContext();
45490
45563
  // runtime/ServerBridge.tsx
45491
45564
  init_useEventBus();
45492
45565
  var xOrbitalLog = logger.createLogger("almadar:runtime:cross-orbital");
45566
+ var serverBridgeLog = logger.createLogger("almadar:ui:server-bridge");
45493
45567
  function createHttpTransport(serverUrl) {
45494
45568
  return {
45495
45569
  register: async (schema) => {
@@ -45502,7 +45576,7 @@ function createHttpTransport(serverUrl) {
45502
45576
  const result = await res.json();
45503
45577
  return !!result.success;
45504
45578
  } catch (err) {
45505
- console.error("[ServerBridge] Registration failed:", err);
45579
+ serverBridgeLog.error("Registration failed", { error: err instanceof Error ? err : String(err) });
45506
45580
  return false;
45507
45581
  }
45508
45582
  },