@almadar/ui 5.53.0 → 5.55.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.
@@ -8421,6 +8421,16 @@ var init_Skeleton = __esm({
8421
8421
  Skeleton.displayName = "Skeleton";
8422
8422
  }
8423
8423
  });
8424
+ function isKnownPattern(type) {
8425
+ return type in componentMapping;
8426
+ }
8427
+ var componentMapping;
8428
+ var init_pattern_resolver = __esm({
8429
+ "renderer/pattern-resolver.ts"() {
8430
+ createLogger("almadar:ui:pattern-resolver");
8431
+ componentMapping = {};
8432
+ }
8433
+ });
8424
8434
 
8425
8435
  // renderer/slot-definitions.ts
8426
8436
  function isPortalSlot(slot) {
@@ -8529,6 +8539,7 @@ var init_navigation = __esm({
8529
8539
  // renderer/index.ts
8530
8540
  var init_renderer = __esm({
8531
8541
  "renderer/index.ts"() {
8542
+ init_pattern_resolver();
8532
8543
  init_slot_definitions();
8533
8544
  }
8534
8545
  });
@@ -10232,7 +10243,7 @@ function recordTransition(trace) {
10232
10243
  ...trace,
10233
10244
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
10234
10245
  };
10235
- log4.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10246
+ log5.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10236
10247
  getState().transitions.push(entry);
10237
10248
  if (getState().transitions.length > MAX_TRANSITIONS) {
10238
10249
  getState().transitions.shift();
@@ -10331,7 +10342,7 @@ function getTraitSnapshots() {
10331
10342
  try {
10332
10343
  snapshots.push(getter());
10333
10344
  } catch (err) {
10334
- log4.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10345
+ log5.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10335
10346
  }
10336
10347
  }
10337
10348
  return snapshots;
@@ -10430,10 +10441,10 @@ function updateAssetStatus(url, status) {
10430
10441
  window.__orbitalVerification.assetStatus[url] = status;
10431
10442
  }
10432
10443
  }
10433
- var log4, MAX_TRANSITIONS;
10444
+ var log5, MAX_TRANSITIONS;
10434
10445
  var init_verificationRegistry = __esm({
10435
10446
  "lib/verificationRegistry.ts"() {
10436
- log4 = createLogger("almadar:bridge");
10447
+ log5 = createLogger("almadar:bridge");
10437
10448
  MAX_TRANSITIONS = 500;
10438
10449
  exposeOnWindow();
10439
10450
  }
@@ -12727,7 +12738,7 @@ var init_avl_elk_layout = __esm({
12727
12738
  elk = new ELK();
12728
12739
  }
12729
12740
  });
12730
- var log5, SWIM_GUTTER, CENTER_W, BehaviorView;
12741
+ var log6, SWIM_GUTTER, CENTER_W, BehaviorView;
12731
12742
  var init_BehaviorView = __esm({
12732
12743
  "components/avl/molecules/BehaviorView.tsx"() {
12733
12744
  "use client";
@@ -12736,7 +12747,7 @@ var init_BehaviorView = __esm({
12736
12747
  init_AvlSwimLane();
12737
12748
  init_types();
12738
12749
  init_avl_elk_layout();
12739
- log5 = createLogger("almadar:ui:avl:behavior-view");
12750
+ log6 = createLogger("almadar:ui:avl:behavior-view");
12740
12751
  SWIM_GUTTER = 120;
12741
12752
  CENTER_W = 360;
12742
12753
  BehaviorView = ({ data }) => {
@@ -12747,7 +12758,7 @@ var init_BehaviorView = __esm({
12747
12758
  const dataKey = useMemo(() => JSON.stringify(traitData), [traitData]);
12748
12759
  useEffect(() => {
12749
12760
  if (!traitData) return;
12750
- computeTraitLayout(traitData).then(setLayout).catch((err) => log5.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
12761
+ computeTraitLayout(traitData).then(setLayout).catch((err) => log6.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
12751
12762
  }, [dataKey]);
12752
12763
  if (!traitData) {
12753
12764
  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: t("avl.noTraitData") });
@@ -13158,7 +13169,7 @@ function generateDiff(oldVal, newVal) {
13158
13169
  }
13159
13170
  return diff;
13160
13171
  }
13161
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log6, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
13172
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
13162
13173
  var init_CodeBlock = __esm({
13163
13174
  "components/core/molecules/markdown/CodeBlock.tsx"() {
13164
13175
  init_cn();
@@ -13241,7 +13252,7 @@ var init_CodeBlock = __esm({
13241
13252
  "lolo-op-async": { color: ORB_COLORS.dark.async }
13242
13253
  };
13243
13254
  loloStyle = { ...dark, ...loloStyleOverrides };
13244
- log6 = createLogger("almadar:ui:markdown-code");
13255
+ log7 = createLogger("almadar:ui:markdown-code");
13245
13256
  CODE_LANGUAGES = [
13246
13257
  "text",
13247
13258
  "json",
@@ -13505,7 +13516,7 @@ var init_CodeBlock = __esm({
13505
13516
  eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: true });
13506
13517
  setTimeout(() => setCopied(false), 2e3);
13507
13518
  } catch (err) {
13508
- log6.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
13519
+ log7.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
13509
13520
  eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: false });
13510
13521
  }
13511
13522
  };
@@ -17386,14 +17397,14 @@ function useSafeEventBus2() {
17386
17397
  } };
17387
17398
  }
17388
17399
  }
17389
- var log7, lookStyles4, ButtonGroup;
17400
+ var log8, lookStyles4, ButtonGroup;
17390
17401
  var init_ButtonGroup = __esm({
17391
17402
  "components/core/molecules/ButtonGroup.tsx"() {
17392
17403
  "use client";
17393
17404
  init_cn();
17394
17405
  init_atoms2();
17395
17406
  init_useEventBus();
17396
- log7 = createLogger("almadar:ui:button-group");
17407
+ log8 = createLogger("almadar:ui:button-group");
17397
17408
  lookStyles4 = {
17398
17409
  "right-aligned-buttons": "",
17399
17410
  "floating-bar": "fixed bottom-section left-1/2 -translate-x-1/2 shadow-elevation-toast bg-card p-card-sm rounded-container",
@@ -17474,7 +17485,7 @@ var init_ButtonGroup = __esm({
17474
17485
  {
17475
17486
  variant: "ghost",
17476
17487
  onClick: () => {
17477
- log7.debug("Filter clicked", { field: filter.field });
17488
+ log8.debug("Filter clicked", { field: filter.field });
17478
17489
  },
17479
17490
  children: filter.label
17480
17491
  },
@@ -25136,9 +25147,9 @@ function debug(...args) {
25136
25147
  const [first, ...rest] = args;
25137
25148
  const message = typeof first === "string" ? first : "<debug>";
25138
25149
  if (rest.length === 0 && typeof first === "string") {
25139
- log8.debug(message);
25150
+ log9.debug(message);
25140
25151
  } else {
25141
- log8.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
25152
+ log9.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
25142
25153
  }
25143
25154
  }
25144
25155
  function debugGroup(label) {
@@ -25166,11 +25177,11 @@ function toLogMetaValue(v) {
25166
25177
  }
25167
25178
  return String(v);
25168
25179
  }
25169
- var NAMESPACE, log8;
25180
+ var NAMESPACE, log9;
25170
25181
  var init_debug = __esm({
25171
25182
  "lib/debug.ts"() {
25172
25183
  NAMESPACE = "almadar:ui:debug";
25173
- log8 = createLogger(NAMESPACE);
25184
+ log9 = createLogger(NAMESPACE);
25174
25185
  createLogger("almadar:ui:debug:input");
25175
25186
  createLogger("almadar:ui:debug:collision");
25176
25187
  createLogger("almadar:ui:debug:physics");
@@ -28581,12 +28592,18 @@ function PlatformerCanvas({
28581
28592
  camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
28582
28593
  camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
28583
28594
  }
28584
- if (plats.length !== lastPlatCountRef.current) {
28595
+ const shouldDiag = plats.length !== lastPlatCountRef.current;
28596
+ if (shouldDiag) {
28585
28597
  lastPlatCountRef.current = plats.length;
28586
28598
  canvasLog.debug("draw:platforms", {
28587
28599
  platformCount: plats.length,
28588
28600
  camX,
28589
28601
  camY,
28602
+ plat0: JSON.stringify(plats[0]),
28603
+ plat2: JSON.stringify(plats[2]),
28604
+ tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
28605
+ canvasW: canvas.width,
28606
+ canvasH: canvas.height,
28590
28607
  player: { x: px, y: py },
28591
28608
  worldWidth: ww,
28592
28609
  canvasWidth: cw,
@@ -28627,6 +28644,19 @@ function PlatformerCanvas({
28627
28644
  const platType = plat.type ?? "ground";
28628
28645
  const spriteUrl = tSprites?.[platType];
28629
28646
  const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
28647
+ if (shouldDiag) {
28648
+ canvasLog.debug("plat:draw", {
28649
+ platType,
28650
+ platX,
28651
+ platY,
28652
+ w: plat.width,
28653
+ h: plat.height,
28654
+ branch: tileImg ? "tile" : "color",
28655
+ natW: tileImg?.naturalWidth,
28656
+ natH: tileImg?.naturalHeight,
28657
+ spriteUrl: spriteUrl ?? null
28658
+ });
28659
+ }
28630
28660
  if (tileImg) {
28631
28661
  const tileW = tileImg.naturalWidth;
28632
28662
  const tileH = tileImg.naturalHeight;
@@ -41442,11 +41472,11 @@ var init_Canvas3DErrorBoundary = __esm({
41442
41472
  "components/game/molecules/three/components/Canvas3DErrorBoundary.css"() {
41443
41473
  }
41444
41474
  });
41445
- var log9, Canvas3DErrorBoundary;
41475
+ var log10, Canvas3DErrorBoundary;
41446
41476
  var init_Canvas3DErrorBoundary2 = __esm({
41447
41477
  "components/game/molecules/three/components/Canvas3DErrorBoundary.tsx"() {
41448
41478
  init_Canvas3DErrorBoundary();
41449
- log9 = createLogger("almadar:ui:game:canvas3d:error-boundary");
41479
+ log10 = createLogger("almadar:ui:game:canvas3d:error-boundary");
41450
41480
  Canvas3DErrorBoundary = class extends Component {
41451
41481
  constructor(props) {
41452
41482
  super(props);
@@ -41474,8 +41504,8 @@ var init_Canvas3DErrorBoundary2 = __esm({
41474
41504
  componentDidCatch(error, errorInfo) {
41475
41505
  this.setState({ errorInfo });
41476
41506
  this.props.onError?.(error, errorInfo);
41477
- log9.error("Error caught", { error });
41478
- log9.error("Component stack", { componentStack: errorInfo.componentStack ?? "<none>" });
41507
+ log10.error("Error caught", { error });
41508
+ log10.error("Component stack", { componentStack: errorInfo.componentStack ?? "<none>" });
41479
41509
  }
41480
41510
  render() {
41481
41511
  if (this.state.hasError) {
@@ -41538,7 +41568,7 @@ function useGLTFModel(url, resourceBasePath) {
41538
41568
  setState({ model: null, isLoading: false, error: null });
41539
41569
  return;
41540
41570
  }
41541
- log10.debug("Loading", { url });
41571
+ log11.debug("Loading", { url });
41542
41572
  setState((prev) => ({ ...prev, isLoading: true, error: null }));
41543
41573
  const assetRoot = resourceBasePath || detectAssetRoot2(url);
41544
41574
  const loader = new GLTFLoader$1();
@@ -41546,7 +41576,7 @@ function useGLTFModel(url, resourceBasePath) {
41546
41576
  loader.load(
41547
41577
  url,
41548
41578
  (gltf) => {
41549
- log10.debug("Loaded", { url });
41579
+ log11.debug("Loaded", { url });
41550
41580
  setState({
41551
41581
  model: gltf.scene,
41552
41582
  isLoading: false,
@@ -41555,7 +41585,7 @@ function useGLTFModel(url, resourceBasePath) {
41555
41585
  },
41556
41586
  void 0,
41557
41587
  (err) => {
41558
- log10.warn("Failed", { url, error: err instanceof Error ? err : String(err) });
41588
+ log11.warn("Failed", { url, error: err instanceof Error ? err : String(err) });
41559
41589
  setState({
41560
41590
  model: null,
41561
41591
  isLoading: false,
@@ -41671,11 +41701,11 @@ function ModelLoader({
41671
41701
  }
41672
41702
  );
41673
41703
  }
41674
- var log10;
41704
+ var log11;
41675
41705
  var init_ModelLoader = __esm({
41676
41706
  "components/game/molecules/three/components/ModelLoader.tsx"() {
41677
41707
  "use client";
41678
- log10 = createLogger("almadar:ui:game:model-loader");
41708
+ log11 = createLogger("almadar:ui:game:model-loader");
41679
41709
  }
41680
41710
  });
41681
41711
 
@@ -45980,7 +46010,7 @@ function getAllEvents(traits2) {
45980
46010
  function EventDispatcherTab({ traits: traits2, schema }) {
45981
46011
  const eventBus = useEventBus();
45982
46012
  const { t } = useTranslate();
45983
- const [log14, setLog] = React81.useState([]);
46013
+ const [log15, setLog] = React81.useState([]);
45984
46014
  const prevStatesRef = React81.useRef(/* @__PURE__ */ new Map());
45985
46015
  React81.useEffect(() => {
45986
46016
  for (const trait of traits2) {
@@ -46044,9 +46074,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
46044
46074
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.otherEvents") }),
46045
46075
  /* @__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)) })
46046
46076
  ] }),
46047
- log14.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
46077
+ log15.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
46048
46078
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.recentTransitions") }),
46049
- /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log14.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
46079
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log15.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
46050
46080
  /* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
46051
46081
  " ",
46052
46082
  /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -50911,7 +50941,7 @@ function isPatternConfig(value) {
50911
50941
  if (value instanceof Date) return false;
50912
50942
  if (typeof value === "function") return false;
50913
50943
  const record = value;
50914
- return "type" in record && typeof record.type === "string";
50944
+ return "type" in record && typeof record.type === "string" && isKnownPattern(record.type);
50915
50945
  }
50916
50946
  function isPlainConfigObject(value) {
50917
50947
  if (React81__default.isValidElement(value)) return false;
@@ -51658,7 +51688,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51658
51688
  };
51659
51689
  }, [traitBindings]);
51660
51690
  const executeTransitionEffects = useCallback(async (params) => {
51661
- const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log14 } = params;
51691
+ const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log15 } = params;
51662
51692
  const traitName = binding.trait.name;
51663
51693
  const linkedEntity = binding.linkedEntity || "";
51664
51694
  const entityId = payload?.entityId;
@@ -51746,7 +51776,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51746
51776
  ...handlers,
51747
51777
  set: async (targetId, field, value) => {
51748
51778
  if (baseSet) await baseSet(targetId, field, value);
51749
- log14.debug("set:write", {
51779
+ log15.debug("set:write", {
51750
51780
  traitName,
51751
51781
  field,
51752
51782
  value: JSON.stringify(value),
@@ -51786,7 +51816,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51786
51816
  const executor = new EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
51787
51817
  try {
51788
51818
  await executor.executeAll(effects);
51789
- log14.debug("effects:executed", () => ({
51819
+ log15.debug("effects:executed", () => ({
51790
51820
  traitName,
51791
51821
  transition: `${previousState}->${newState}`,
51792
51822
  event: flushEvent,
@@ -51796,7 +51826,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51796
51826
  slotsTouched: Array.from(pendingSlots.keys()).join(",")
51797
51827
  }));
51798
51828
  for (const [slot, patterns] of pendingSlots) {
51799
- log14.debug("flush:slot", {
51829
+ log15.debug("flush:slot", {
51800
51830
  traitName,
51801
51831
  slot,
51802
51832
  patternCount: patterns.length,
@@ -51811,7 +51841,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51811
51841
  });
51812
51842
  }
51813
51843
  } catch (error) {
51814
- log14.error("effects:error", {
51844
+ log15.error("effects:error", {
51815
51845
  traitName,
51816
51846
  transition: `${previousState}->${newState}`,
51817
51847
  event: flushEvent,
@@ -52283,7 +52313,7 @@ function clearSchemaCache() {
52283
52313
 
52284
52314
  // runtime/index.ts
52285
52315
  init_EntitySchemaContext();
52286
- var log11 = createLogger("almadar:ui:trait-provider");
52316
+ var log12 = createLogger("almadar:ui:trait-provider");
52287
52317
  var TraitContext = createContext(null);
52288
52318
  function TraitProvider({
52289
52319
  traits: traitBindings,
@@ -52300,7 +52330,7 @@ function TraitProvider({
52300
52330
  currentState: stateName,
52301
52331
  availableEvents: trait.transitions.filter((t) => t.from === stateName).map((t) => t.event),
52302
52332
  dispatch: (eventKey, payload) => {
52303
- log11.debug("Dispatch", () => ({
52333
+ log12.debug("Dispatch", () => ({
52304
52334
  trait: trait.name,
52305
52335
  event: eventKey,
52306
52336
  payloadKeys: payload ? Object.keys(payload) : []
@@ -53050,7 +53080,7 @@ OrbitalThemeProvider.displayName = "OrbitalThemeProvider";
53050
53080
  init_navigation();
53051
53081
  init_verificationRegistry();
53052
53082
  var PERF_NAMESPACE = "almadar:perf:canvas";
53053
- var log13 = createLogger(PERF_NAMESPACE);
53083
+ var log14 = createLogger(PERF_NAMESPACE);
53054
53084
  var RING_SIZE = 50;
53055
53085
  var ring = [];
53056
53086
  var writeIdx = 0;
@@ -53105,7 +53135,7 @@ function perfEnd(name, startToken, detail) {
53105
53135
  }
53106
53136
  }
53107
53137
  push({ name, durationMs, ts: endTs, detail });
53108
- log13.debug(name, () => ({ durationMs, ...detail ?? {} }));
53138
+ log14.debug(name, () => ({ durationMs, ...detail ?? {} }));
53109
53139
  }
53110
53140
  function perfTime(name, fn, detail) {
53111
53141
  const t = perfStart(name);
@@ -53123,7 +53153,7 @@ var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, com
53123
53153
  ts: commitTime,
53124
53154
  detail: { baseDuration }
53125
53155
  });
53126
- log13.debug(`profiler:${id}:${phase}`, () => ({ actualDuration, baseDuration }));
53156
+ log14.debug(`profiler:${id}:${phase}`, () => ({ actualDuration, baseDuration }));
53127
53157
  };
53128
53158
  function getPerfSnapshot() {
53129
53159
  if (ring.length < RING_SIZE) return ring.slice();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.53.0",
3
+ "version": "5.55.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [