@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.
@@ -1,7 +1,7 @@
1
1
  import * as React135 from 'react';
2
2
  import React135__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { EventBusContext, useTraitScope, OrbitalProvider, TraitScopeProvider, VerificationProvider } from '@almadar/ui/providers';
4
- import { createLogger } from '@almadar/logger';
4
+ import { createLogger, isLogLevelEnabled } from '@almadar/logger';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
@@ -171,7 +171,7 @@ var init_useEventBus = __esm({
171
171
  try {
172
172
  handler(event);
173
173
  } catch (error) {
174
- console.error(`[EventBus] Error in listener for '${type}':`, error);
174
+ log.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
175
175
  }
176
176
  });
177
177
  }
@@ -179,7 +179,7 @@ var init_useEventBus = __esm({
179
179
  try {
180
180
  handler(event);
181
181
  } catch (error) {
182
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
182
+ log.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
183
183
  }
184
184
  });
185
185
  },
@@ -4182,6 +4182,7 @@ var BUILT_IN_THEMES, ThemeContext;
4182
4182
  var init_ThemeContext = __esm({
4183
4183
  "context/ThemeContext.tsx"() {
4184
4184
  "use client";
4185
+ createLogger("almadar:ui:theme");
4185
4186
  BUILT_IN_THEMES = [
4186
4187
  {
4187
4188
  name: "wireframe",
@@ -6385,12 +6386,15 @@ function ControlButton({
6385
6386
  sizeMap3[size] ?? sizeMap3.md,
6386
6387
  shapeMap[shape] ?? shapeMap.circle,
6387
6388
  variantMap[variant] ?? variantMap.secondary,
6388
- actualPressed && "scale-95 brightness-110 border-white",
6389
+ actualPressed && "scale-95 brightness-110 border-foreground",
6389
6390
  disabled && "opacity-50 cursor-not-allowed",
6390
6391
  className
6391
6392
  ),
6392
6393
  children: [
6393
- icon && /* @__PURE__ */ jsx("span", { className: "text-2xl", children: icon }),
6394
+ icon && /* @__PURE__ */ jsx("span", { className: "text-2xl", children: typeof icon === "string" ? (() => {
6395
+ const I = resolveIcon(icon);
6396
+ return I ? /* @__PURE__ */ jsx(I, { className: "w-6 h-6" }) : null;
6397
+ })() : icon }),
6394
6398
  label && !icon && /* @__PURE__ */ jsx("span", { children: label })
6395
6399
  ]
6396
6400
  }
@@ -6402,6 +6406,7 @@ var init_ControlButton = __esm({
6402
6406
  "use client";
6403
6407
  init_cn();
6404
6408
  init_useEventBus();
6409
+ init_Icon();
6405
6410
  sizeMap3 = {
6406
6411
  sm: "w-10 h-10 text-sm",
6407
6412
  md: "w-14 h-14 text-base",
@@ -6414,9 +6419,9 @@ var init_ControlButton = __esm({
6414
6419
  square: "rounded-md"
6415
6420
  };
6416
6421
  variantMap = {
6417
- primary: "bg-blue-600 text-[var(--color-foreground)] border-blue-400 hover:bg-blue-500",
6418
- secondary: "bg-[var(--color-surface,#374151)] text-[var(--color-foreground)] border-gray-500 hover:bg-gray-600",
6419
- ghost: "bg-transparent text-[var(--color-foreground)] border-white/30 hover:bg-white/10"
6422
+ primary: "bg-primary text-primary-foreground border-primary hover:bg-primary-hover",
6423
+ secondary: "bg-secondary text-secondary-foreground border-border hover:bg-secondary-hover",
6424
+ ghost: "bg-transparent text-foreground border-border hover:bg-muted"
6420
6425
  };
6421
6426
  ControlButton.displayName = "ControlButton";
6422
6427
  }
@@ -7144,8 +7149,8 @@ function ChoiceButton({
7144
7149
  className: cn(
7145
7150
  "w-full text-left px-4 py-2.5 rounded-md border transition-all duration-150",
7146
7151
  "flex items-center gap-2",
7147
- 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",
7148
- disabled && "opacity-40 cursor-not-allowed hover:bg-white/5 hover:border-white/10",
7152
+ selected ? "bg-accent/15 border-accent text-foreground" : "bg-muted/40 border-border text-foreground hover:bg-muted hover:border-border",
7153
+ disabled && "opacity-40 cursor-not-allowed hover:bg-muted/40 hover:border-border",
7149
7154
  className
7150
7155
  ),
7151
7156
  children: [
@@ -7154,7 +7159,7 @@ function ChoiceButton({
7154
7159
  {
7155
7160
  className: cn(
7156
7161
  "flex-shrink-0 font-mono font-bold text-sm",
7157
- selected ? "text-yellow-400" : "text-gray-500"
7162
+ selected ? "text-accent" : "text-muted-foreground"
7158
7163
  ),
7159
7164
  children: [
7160
7165
  index,
@@ -7195,7 +7200,7 @@ function ActionButton({
7195
7200
  disabled: isDisabled,
7196
7201
  onClick,
7197
7202
  className: cn(
7198
- "relative inline-flex items-center gap-1.5 rounded-md border font-medium text-[var(--color-foreground)] overflow-hidden transition-colors duration-150",
7203
+ "relative inline-flex items-center gap-1.5 rounded-md border font-medium overflow-hidden transition-colors duration-150",
7199
7204
  sizes.button,
7200
7205
  variantStyles8[variant],
7201
7206
  isDisabled && "opacity-60 cursor-not-allowed",
@@ -7205,7 +7210,7 @@ function ActionButton({
7205
7210
  onCooldown && /* @__PURE__ */ jsx(
7206
7211
  "div",
7207
7212
  {
7208
- className: "absolute inset-0 bg-black/60 pointer-events-none",
7213
+ className: "absolute inset-0 bg-foreground/40 pointer-events-none",
7209
7214
  style: {
7210
7215
  clipPath: `conic-gradient(from 0deg, transparent ${360 - cooldownDeg}deg, black ${360 - cooldownDeg}deg)`,
7211
7216
  WebkitClipPath: `conic-gradient(from 0deg, transparent ${360 - cooldownDeg}deg, black ${360 - cooldownDeg}deg)`,
@@ -7213,13 +7218,16 @@ function ActionButton({
7213
7218
  }
7214
7219
  }
7215
7220
  ),
7216
- icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon }),
7221
+ icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: typeof icon === "string" ? (() => {
7222
+ const I = resolveIcon(icon);
7223
+ return I ? /* @__PURE__ */ jsx(I, { className: "w-4 h-4" }) : null;
7224
+ })() : icon }),
7217
7225
  /* @__PURE__ */ jsx("span", { className: "relative z-10", children: label }),
7218
7226
  hotkey && /* @__PURE__ */ jsx(
7219
7227
  "span",
7220
7228
  {
7221
7229
  className: cn(
7222
- "absolute top-0.5 right-0.5 bg-black/50 text-gray-300 rounded font-mono leading-tight",
7230
+ "absolute top-0.5 right-0.5 bg-foreground/30 text-primary-foreground rounded font-mono leading-tight",
7223
7231
  sizes.hotkey
7224
7232
  ),
7225
7233
  children: hotkey
@@ -7233,15 +7241,16 @@ var sizeMap13, variantStyles8;
7233
7241
  var init_ActionButton = __esm({
7234
7242
  "components/atoms/game/ActionButton.tsx"() {
7235
7243
  init_cn();
7244
+ init_Icon();
7236
7245
  sizeMap13 = {
7237
7246
  sm: { button: "px-3 py-1.5 text-xs", hotkey: "text-[9px] px-1", icon: "text-xs" },
7238
7247
  md: { button: "px-4 py-2 text-sm", hotkey: "text-[10px] px-1.5", icon: "text-sm" },
7239
7248
  lg: { button: "px-5 py-2.5 text-base", hotkey: "text-xs px-2", icon: "text-base" }
7240
7249
  };
7241
7250
  variantStyles8 = {
7242
- primary: "bg-blue-600 hover:bg-blue-500 border-blue-400/40",
7243
- secondary: "bg-gray-700 hover:bg-gray-600 border-gray-500/40",
7244
- danger: "bg-red-700 hover:bg-red-600 border-red-400/40"
7251
+ primary: "bg-primary text-primary-foreground hover:bg-primary-hover border-primary",
7252
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-hover border-border",
7253
+ danger: "bg-error text-error-foreground hover:bg-error/90 border-error"
7245
7254
  };
7246
7255
  ActionButton.displayName = "ActionButton";
7247
7256
  }
@@ -7683,6 +7692,7 @@ function getAllPages(schema) {
7683
7692
  var init_navigation = __esm({
7684
7693
  "renderer/navigation.tsx"() {
7685
7694
  "use client";
7695
+ createLogger("almadar:ui:navigation");
7686
7696
  createContext(null);
7687
7697
  }
7688
7698
  });
@@ -10160,7 +10170,7 @@ function recordTransition(trace) {
10160
10170
  ...trace,
10161
10171
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
10162
10172
  };
10163
- log2.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10173
+ log5.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10164
10174
  getState().transitions.push(entry);
10165
10175
  if (getState().transitions.length > MAX_TRANSITIONS) {
10166
10176
  getState().transitions.shift();
@@ -10259,7 +10269,7 @@ function getTraitSnapshots() {
10259
10269
  try {
10260
10270
  snapshots.push(getter());
10261
10271
  } catch (err) {
10262
- log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10272
+ log5.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10263
10273
  }
10264
10274
  }
10265
10275
  return snapshots;
@@ -10343,10 +10353,10 @@ function updateAssetStatus(url, status) {
10343
10353
  window.__orbitalVerification.assetStatus[url] = status;
10344
10354
  }
10345
10355
  }
10346
- var log2, MAX_TRANSITIONS;
10356
+ var log5, MAX_TRANSITIONS;
10347
10357
  var init_verificationRegistry = __esm({
10348
10358
  "lib/verificationRegistry.ts"() {
10349
- log2 = createLogger("almadar:bridge");
10359
+ log5 = createLogger("almadar:bridge");
10350
10360
  MAX_TRANSITIONS = 500;
10351
10361
  exposeOnWindow();
10352
10362
  }
@@ -12374,7 +12384,7 @@ var init_avl_elk_layout = __esm({
12374
12384
  elk = new ELK();
12375
12385
  }
12376
12386
  });
12377
- var SWIM_GUTTER, CENTER_W, BehaviorView;
12387
+ var log6, SWIM_GUTTER, CENTER_W, BehaviorView;
12378
12388
  var init_BehaviorView = __esm({
12379
12389
  "components/molecules/avl/BehaviorView.tsx"() {
12380
12390
  "use client";
@@ -12383,6 +12393,7 @@ var init_BehaviorView = __esm({
12383
12393
  init_AvlSwimLane();
12384
12394
  init_types();
12385
12395
  init_avl_elk_layout();
12396
+ log6 = createLogger("almadar:ui:avl:behavior-view");
12386
12397
  SWIM_GUTTER = 120;
12387
12398
  CENTER_W = 360;
12388
12399
  BehaviorView = ({ data }) => {
@@ -12392,7 +12403,7 @@ var init_BehaviorView = __esm({
12392
12403
  const dataKey = useMemo(() => JSON.stringify(traitData), [traitData]);
12393
12404
  useEffect(() => {
12394
12405
  if (!traitData) return;
12395
- computeTraitLayout(traitData).then(setLayout).catch(console.error);
12406
+ computeTraitLayout(traitData).then(setLayout).catch((err) => log6.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
12396
12407
  }, [dataKey]);
12397
12408
  if (!traitData) {
12398
12409
  return /* @__PURE__ */ 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" });
@@ -12737,7 +12748,7 @@ function computeFoldRegions(code) {
12737
12748
  }
12738
12749
  return regions.sort((a, b) => a.start - b.start);
12739
12750
  }
12740
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12751
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12741
12752
  var init_CodeBlock = __esm({
12742
12753
  "components/molecules/markdown/CodeBlock.tsx"() {
12743
12754
  init_Box();
@@ -12814,6 +12825,7 @@ var init_CodeBlock = __esm({
12814
12825
  "lolo-op-async": { color: ORB_COLORS.dark.async }
12815
12826
  };
12816
12827
  loloStyle = { ...dark, ...loloStyleOverrides };
12828
+ log7 = createLogger("almadar:ui:markdown-code");
12817
12829
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12818
12830
  HIDDEN_LINE_NUMBERS = { display: "none" };
12819
12831
  CodeBlock = React135__default.memo(
@@ -13012,7 +13024,7 @@ var init_CodeBlock = __esm({
13012
13024
  eventBus.emit("UI:COPY_CODE", { language, success: true });
13013
13025
  setTimeout(() => setCopied(false), 2e3);
13014
13026
  } catch (err) {
13015
- console.error("Failed to copy code:", err);
13027
+ log7.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
13016
13028
  eventBus.emit("UI:COPY_CODE", { language, success: false });
13017
13029
  }
13018
13030
  };
@@ -16524,13 +16536,14 @@ function useSafeEventBus2() {
16524
16536
  } };
16525
16537
  }
16526
16538
  }
16527
- var ButtonGroup;
16539
+ var log8, ButtonGroup;
16528
16540
  var init_ButtonGroup = __esm({
16529
16541
  "components/molecules/ButtonGroup.tsx"() {
16530
16542
  "use client";
16531
16543
  init_cn();
16532
16544
  init_atoms();
16533
16545
  init_useEventBus();
16546
+ log8 = createLogger("almadar:ui:button-group");
16534
16547
  ButtonGroup = ({
16535
16548
  children,
16536
16549
  primary,
@@ -16603,7 +16616,7 @@ var init_ButtonGroup = __esm({
16603
16616
  {
16604
16617
  variant: "ghost",
16605
16618
  onClick: () => {
16606
- console.log(`Filter clicked: ${filter.field}`);
16619
+ log8.debug("Filter clicked", { field: filter.field });
16607
16620
  },
16608
16621
  children: filter.label
16609
16622
  },
@@ -21283,7 +21296,7 @@ function DataGrid({
21283
21296
  onClick: handleActionClick(action, itemData),
21284
21297
  "data-testid": `action-${action.event}`,
21285
21298
  "data-row-id": String(itemData.id),
21286
- className: "text-error hover:bg-error/10 px-2",
21299
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
21287
21300
  children: [
21288
21301
  action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21289
21302
  action.label
@@ -22475,31 +22488,56 @@ var init_InputGroup = __esm({
22475
22488
  InputGroup.displayName = "InputGroup";
22476
22489
  }
22477
22490
  });
22478
-
22479
- // lib/debug.ts
22491
+ function gateEnabled(level, ns = NAMESPACE) {
22492
+ return isLogLevelEnabled(level, ns);
22493
+ }
22480
22494
  function isDebugEnabled() {
22481
- if (DEBUG_ENABLED) return true;
22482
- return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
22495
+ return gateEnabled("DEBUG");
22483
22496
  }
22484
22497
  function debug(...args) {
22485
- if (isDebugEnabled()) {
22486
- console.log("[DEBUG]", ...args);
22498
+ if (!gateEnabled("DEBUG")) return;
22499
+ const [first, ...rest] = args;
22500
+ const message = typeof first === "string" ? first : "<debug>";
22501
+ if (rest.length === 0 && typeof first === "string") {
22502
+ log9.debug(message);
22503
+ } else {
22504
+ log9.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
22487
22505
  }
22488
22506
  }
22489
22507
  function debugGroup(label) {
22490
- if (isDebugEnabled()) {
22491
- console.group(`[DEBUG] ${label}`);
22492
- }
22508
+ if (gateEnabled("DEBUG")) console.group(`[${NAMESPACE}] ${label}`);
22493
22509
  }
22494
22510
  function debugGroupEnd() {
22495
- if (isDebugEnabled()) {
22496
- console.groupEnd();
22511
+ if (gateEnabled("DEBUG")) console.groupEnd();
22512
+ }
22513
+ function formatArgs(values) {
22514
+ if (values.length === 1) return toLogMetaValue(values[0]);
22515
+ return values.map(toLogMetaValue);
22516
+ }
22517
+ function toLogMetaValue(v) {
22518
+ if (v === null || v === void 0) return v;
22519
+ if (v instanceof Error) return v;
22520
+ const t = typeof v;
22521
+ if (t === "string" || t === "number" || t === "boolean") return v;
22522
+ if (Array.isArray(v)) return v.map(toLogMetaValue);
22523
+ if (t === "object") {
22524
+ const out = {};
22525
+ for (const [k, val] of Object.entries(v)) {
22526
+ out[k] = toLogMetaValue(val);
22527
+ }
22528
+ return out;
22497
22529
  }
22530
+ return String(v);
22498
22531
  }
22499
- var DEBUG_ENABLED;
22532
+ var NAMESPACE, log9;
22500
22533
  var init_debug = __esm({
22501
22534
  "lib/debug.ts"() {
22502
- DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
22535
+ NAMESPACE = "almadar:ui:debug";
22536
+ log9 = createLogger(NAMESPACE);
22537
+ createLogger("almadar:ui:debug:input");
22538
+ createLogger("almadar:ui:debug:collision");
22539
+ createLogger("almadar:ui:debug:physics");
22540
+ createLogger("almadar:ui:debug:game-state");
22503
22541
  }
22504
22542
  });
22505
22543
  var isRelationsDebugEnabled, RelationSelect;
@@ -23787,7 +23825,7 @@ function StatBadge({
23787
23825
  const I = resolveIcon(icon);
23788
23826
  return I ? /* @__PURE__ */ jsx(I, { className: "w-4 h-4" }) : icon;
23789
23827
  })() : icon }),
23790
- /* @__PURE__ */ jsx("span", { className: "text-gray-400 font-medium", children: label }),
23828
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-medium", children: label }),
23791
23829
  format === "hearts" && max && /* @__PURE__ */ jsx(
23792
23830
  HealthBar,
23793
23831
  {
@@ -23814,7 +23852,7 @@ function StatBadge({
23814
23852
  animated: true
23815
23853
  }
23816
23854
  ),
23817
- format === "text" && /* @__PURE__ */ jsx("span", { className: "font-bold text-[var(--color-foreground)]", children: value })
23855
+ format === "text" && /* @__PURE__ */ jsx("span", { className: "font-bold text-foreground", children: value })
23818
23856
  ]
23819
23857
  }
23820
23858
  );
@@ -23832,11 +23870,11 @@ var init_StatBadge = __esm({
23832
23870
  lg: "text-base px-4 py-2"
23833
23871
  };
23834
23872
  variantMap2 = {
23835
- default: "bg-[var(--color-card)]/80 border-gray-700",
23836
- primary: "bg-blue-900/80 border-blue-700",
23837
- success: "bg-green-900/80 border-green-700",
23838
- warning: "bg-yellow-900/80 border-yellow-700",
23839
- danger: "bg-red-900/80 border-red-700"
23873
+ default: "bg-card/80 border-border text-foreground",
23874
+ primary: "bg-primary/15 border-primary/40 text-foreground",
23875
+ success: "bg-success/15 border-success/40 text-foreground",
23876
+ warning: "bg-warning/15 border-warning/40 text-foreground",
23877
+ danger: "bg-error/15 border-error/40 text-foreground"
23840
23878
  };
23841
23879
  StatBadge.displayName = "StatBadge";
23842
23880
  }
@@ -36271,9 +36309,45 @@ var init_List = __esm({
36271
36309
  List3.displayName = "List";
36272
36310
  }
36273
36311
  });
36274
- var DefaultEmptyDetail, MasterDetail;
36312
+ function MasterDetail({
36313
+ entity,
36314
+ masterFields,
36315
+ detailFields: _detailFields,
36316
+ // Captured but not used here - detail handled separately
36317
+ loading: externalLoading,
36318
+ isLoading: externalIsLoading,
36319
+ error: externalError,
36320
+ className,
36321
+ ...rest
36322
+ }) {
36323
+ const loading = externalLoading ?? false;
36324
+ const isLoading = externalIsLoading ?? false;
36325
+ const error = externalError ?? null;
36326
+ return /* @__PURE__ */ jsx(
36327
+ DataTable,
36328
+ {
36329
+ fields: masterFields,
36330
+ columns: masterFields,
36331
+ entity,
36332
+ isLoading: loading || isLoading,
36333
+ error,
36334
+ className,
36335
+ emptyTitle: "No items found",
36336
+ emptyDescription: "Create your first item to get started.",
36337
+ ...rest
36338
+ }
36339
+ );
36340
+ }
36275
36341
  var init_MasterDetail = __esm({
36276
- "components/organisms/layout/MasterDetail.tsx"() {
36342
+ "components/organisms/MasterDetail.tsx"() {
36343
+ "use client";
36344
+ init_DataTable();
36345
+ MasterDetail.displayName = "MasterDetail";
36346
+ }
36347
+ });
36348
+ var DefaultEmptyDetail, MasterDetailLayout;
36349
+ var init_MasterDetailLayout = __esm({
36350
+ "components/organisms/layout/MasterDetailLayout.tsx"() {
36277
36351
  init_cn();
36278
36352
  init_Typography();
36279
36353
  DefaultEmptyDetail = () => /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full border-2 border-dashed border-border", children: /* @__PURE__ */ jsx(
@@ -36284,7 +36358,7 @@ var init_MasterDetail = __esm({
36284
36358
  children: "Select an item to view details"
36285
36359
  }
36286
36360
  ) });
36287
- MasterDetail = ({
36361
+ MasterDetailLayout = ({
36288
36362
  master,
36289
36363
  detail,
36290
36364
  emptyDetail,
@@ -36319,7 +36393,7 @@ var init_MasterDetail = __esm({
36319
36393
  }
36320
36394
  );
36321
36395
  };
36322
- MasterDetail.displayName = "MasterDetail";
36396
+ MasterDetailLayout.displayName = "MasterDetailLayout";
36323
36397
  }
36324
36398
  });
36325
36399
  var COLUMN_CLASSES, ASPECT_CLASSES, MediaGallery;
@@ -38737,7 +38811,7 @@ function getAllEvents(traits2) {
38737
38811
  }
38738
38812
  function EventDispatcherTab({ traits: traits2, schema }) {
38739
38813
  const eventBus = useEventBus();
38740
- const [log3, setLog] = React135.useState([]);
38814
+ const [log11, setLog] = React135.useState([]);
38741
38815
  const prevStatesRef = React135.useRef(/* @__PURE__ */ new Map());
38742
38816
  React135.useEffect(() => {
38743
38817
  for (const trait of traits2) {
@@ -38801,9 +38875,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
38801
38875
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
38802
38876
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
38803
38877
  ] }),
38804
- log3.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
38878
+ log11.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
38805
38879
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
38806
- /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log3.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
38880
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log11.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
38807
38881
  /* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
38808
38882
  " ",
38809
38883
  /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -43074,6 +43148,7 @@ var init_component_registry_generated = __esm({
43074
43148
  init_LoadingState();
43075
43149
  init_MarkdownContent();
43076
43150
  init_MasterDetail();
43151
+ init_MasterDetailLayout();
43077
43152
  init_MatrixQuestion();
43078
43153
  init_MediaGallery();
43079
43154
  init_Meter();
@@ -43368,6 +43443,7 @@ var init_component_registry_generated = __esm({
43368
43443
  "MapViewPattern": MapViewPattern,
43369
43444
  "MarkdownContent": MarkdownContent,
43370
43445
  "MasterDetail": MasterDetail,
43446
+ "MasterDetailLayout": MasterDetailLayout,
43371
43447
  "MatrixQuestion": MatrixQuestion,
43372
43448
  "MediaGallery": MediaGallery,
43373
43449
  "Menu": MenuPattern,
@@ -44351,8 +44427,7 @@ var init_UISlotRenderer = __esm({
44351
44427
 
44352
44428
  // hooks/index.ts
44353
44429
  init_useEventBus();
44354
-
44355
- // runtime/createClientEffectHandlers.ts
44430
+ var log2 = createLogger("almadar:ui:effects:client-handlers");
44356
44431
  function createClientEffectHandlers(options) {
44357
44432
  const { eventBus, slotSetter, navigate, notify, callService } = options;
44358
44433
  return {
@@ -44361,10 +44436,10 @@ function createClientEffectHandlers(options) {
44361
44436
  eventBus.emit(prefixedEvent, payload);
44362
44437
  },
44363
44438
  persist: async () => {
44364
- console.warn("[ClientEffectHandlers] persist is server-side only, ignored on client");
44439
+ log2.warn("persist is server-side only, ignored on client");
44365
44440
  },
44366
44441
  set: () => {
44367
- console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
44442
+ log2.warn("set is server-side only, ignored on client");
44368
44443
  },
44369
44444
  callService: async (service, action, params) => {
44370
44445
  if (callService) return callService(service, action, params);
@@ -44393,10 +44468,10 @@ function createClientEffectHandlers(options) {
44393
44468
  slotSetter.addPattern(slot, pattern, props);
44394
44469
  },
44395
44470
  navigate: navigate ?? ((path) => {
44396
- console.warn("[ClientEffectHandlers] No navigate handler, ignoring:", path);
44471
+ log2.warn("No navigate handler, ignoring", { path });
44397
44472
  }),
44398
44473
  notify: notify ?? ((msg, type) => {
44399
- console.log(`[ClientEffectHandlers] notify (${type}):`, msg);
44474
+ log2.debug("notify", { type, message: msg });
44400
44475
  })
44401
44476
  };
44402
44477
  }
@@ -44699,10 +44774,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44699
44774
  });
44700
44775
  snapshotUnregs.push(unreg);
44701
44776
  }
44702
- console.log(
44703
- "[TraitStateMachine] Reset states for page navigation:",
44704
- Array.from(newManager.getAllStates().keys()).join(", ")
44705
- );
44777
+ stateLog.debug("reset-states-for-nav", () => ({
44778
+ traits: Array.from(newManager.getAllStates().keys()).join(", ")
44779
+ }));
44706
44780
  return () => {
44707
44781
  for (const unreg of snapshotUnregs) unreg();
44708
44782
  };
@@ -44789,9 +44863,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44789
44863
  const normalizedEvent = normalizeEventKey(eventKey);
44790
44864
  const bindings = traitBindingsRef.current;
44791
44865
  const currentManager = managerRef.current;
44792
- console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
44793
44866
  crossTraitLog.debug("processEvent:enter", () => ({
44794
44867
  event: normalizedEvent,
44868
+ payload: JSON.stringify(payload ?? null),
44795
44869
  traitCount: bindings.length,
44796
44870
  traitNames: bindings.map((b) => b.trait.name).join(","),
44797
44871
  orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
@@ -44850,18 +44924,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44850
44924
  }
44851
44925
  }
44852
44926
  if (result.executed && result.effects.length > 0) {
44853
- console.log(
44854
- "[TraitStateMachine] Executing",
44855
- result.effects.length,
44856
- "effects for",
44927
+ stateLog.debug("executing-effects", () => ({
44928
+ effectCount: result.effects.length,
44857
44929
  traitName,
44858
- "| linkedEntity:",
44859
- binding.linkedEntity,
44860
- "| transition:",
44861
- `${result.previousState} -> ${result.newState}`,
44862
- "| effects:",
44863
- JSON.stringify(result.effects)
44864
- );
44930
+ linkedEntity: binding.linkedEntity,
44931
+ transition: `${result.previousState} -> ${result.newState}`,
44932
+ effects: JSON.stringify(result.effects)
44933
+ }));
44865
44934
  const linkedEntity = binding.linkedEntity || "";
44866
44935
  const entityId = payload?.entityId;
44867
44936
  const pendingSlots = /* @__PURE__ */ new Map();
@@ -45007,30 +45076,25 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45007
45076
  }
45008
45077
  } else if (!result.executed) {
45009
45078
  if (result.guardResult === false) {
45010
- console.log(
45011
- "[TraitStateMachine] Guard blocked transition:",
45079
+ stateLog.debug("guard-blocked-transition", {
45012
45080
  traitName,
45013
- result.previousState,
45014
- "->",
45015
- result.transition?.to
45016
- );
45081
+ from: result.previousState,
45082
+ to: result.transition?.to
45083
+ });
45017
45084
  } else if (!result.transition) {
45018
45085
  if (isCircuitEvent(normalizedEvent)) {
45019
- console.warn(
45020
- `[CLOSED CIRCUIT VIOLATION] Trait "${traitName}" in state "${traitState.currentState}" received event "${normalizedEvent}" but has no transition to handle it.
45021
- This is likely a schema issue. To fix, add a transition:
45022
- { from: "${traitState.currentState}", to: "<target_state>", event: "${normalizedEvent}", effects: [...] }
45023
- Or ensure the previous action (that opened this UI) properly transitions back before emitting this event.`
45024
- );
45086
+ stateLog.warn("closed-circuit-violation", {
45087
+ traitName,
45088
+ currentState: traitState.currentState,
45089
+ event: normalizedEvent,
45090
+ 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.`
45091
+ });
45025
45092
  } else {
45026
- console.log(
45027
- "[TraitStateMachine] No transition for",
45093
+ stateLog.debug("no-transition", {
45028
45094
  traitName,
45029
- "from state:",
45030
- traitState.currentState,
45031
- "on event:",
45032
- normalizedEvent
45033
- );
45095
+ from: traitState.currentState,
45096
+ event: normalizedEvent
45097
+ });
45034
45098
  }
45035
45099
  }
45036
45100
  }
@@ -45138,7 +45202,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45138
45202
  allEvents.add(transition.event);
45139
45203
  }
45140
45204
  }
45141
- console.log("[TraitStateMachine] Subscribing to events:", Array.from(allEvents));
45205
+ stateLog.debug("subscribing-to-events", () => ({ events: Array.from(allEvents) }));
45142
45206
  const unsubscribes = [];
45143
45207
  const subscribedBusKeys = /* @__PURE__ */ new Set();
45144
45208
  for (const binding of traitBindings) {
@@ -45273,7 +45337,11 @@ function useResolvedSchema(schema, pageName) {
45273
45337
  };
45274
45338
  }
45275
45339
  const page = getPage(ir, pageName);
45276
- console.log("[useResolvedSchema] Resolved page:", page?.name, "| path:", page?.path, "| traits:", page?.traits.length);
45340
+ resolvedSchemaLog.debug("Resolved page", () => ({
45341
+ name: page?.name,
45342
+ path: page?.path,
45343
+ traits: page?.traits.length
45344
+ }));
45277
45345
  const traits2 = page?.traits || [];
45278
45346
  const entities = /* @__PURE__ */ new Map();
45279
45347
  if (page) {
@@ -45300,6 +45368,7 @@ function clearSchemaCache() {
45300
45368
 
45301
45369
  // runtime/index.ts
45302
45370
  init_EntitySchemaContext();
45371
+ var log10 = createLogger("almadar:ui:trait-provider");
45303
45372
  var TraitContext = createContext(null);
45304
45373
  function TraitProvider({
45305
45374
  traits: traitBindings,
@@ -45316,7 +45385,11 @@ function TraitProvider({
45316
45385
  currentState: stateName,
45317
45386
  availableEvents: trait.transitions.filter((t) => t.from === stateName).map((t) => t.event),
45318
45387
  dispatch: (eventKey, payload) => {
45319
- console.log(`[TraitProvider] Dispatch to ${trait.name}: ${eventKey}`, payload);
45388
+ log10.debug("Dispatch", () => ({
45389
+ trait: trait.name,
45390
+ event: eventKey,
45391
+ payloadKeys: payload ? Object.keys(payload) : []
45392
+ }));
45320
45393
  },
45321
45394
  canDispatch: (eventKey) => {
45322
45395
  return trait.transitions.some(
@@ -45444,6 +45517,7 @@ init_EntitySchemaContext();
45444
45517
  // runtime/ServerBridge.tsx
45445
45518
  init_useEventBus();
45446
45519
  var xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
45520
+ var serverBridgeLog = createLogger("almadar:ui:server-bridge");
45447
45521
  function createHttpTransport(serverUrl) {
45448
45522
  return {
45449
45523
  register: async (schema) => {
@@ -45456,7 +45530,7 @@ function createHttpTransport(serverUrl) {
45456
45530
  const result = await res.json();
45457
45531
  return !!result.success;
45458
45532
  } catch (err) {
45459
- console.error("[ServerBridge] Registration failed:", err);
45533
+ serverBridgeLog.error("Registration failed", { error: err instanceof Error ? err : String(err) });
45460
45534
  return false;
45461
45535
  }
45462
45536
  },