@almadar/ui 4.44.0 → 4.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +193 -164
- package/dist/avl/index.js +194 -165
- package/dist/components/index.cjs +104 -63
- package/dist/components/index.js +105 -64
- package/dist/components/organisms/game/three/index.cjs +18 -15
- package/dist/components/organisms/game/three/index.js +18 -15
- package/dist/context/index.cjs +17 -12
- package/dist/context/index.js +17 -12
- package/dist/docs/index.cjs +2 -2
- package/dist/docs/index.js +2 -2
- package/dist/hooks/index.cjs +52 -40
- package/dist/hooks/index.js +52 -40
- package/dist/lib/debug.d.ts +15 -22
- package/dist/lib/index.cjs +61 -47
- package/dist/lib/index.js +62 -48
- package/dist/marketing/index.cjs +2 -2
- package/dist/marketing/index.js +2 -2
- package/dist/providers/EventBusProvider.d.ts +6 -2
- package/dist/providers/index.cjs +112 -89
- package/dist/providers/index.js +112 -89
- package/dist/renderer/index.cjs +57 -56
- package/dist/renderer/index.js +57 -56
- package/dist/runtime/index.cjs +122 -94
- package/dist/runtime/index.js +123 -95
- package/package.json +3 -3
package/dist/providers/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React136 from 'react';
|
|
2
2
|
import React136__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
|
|
3
|
+
import { createLogger, isLogLevelEnabled } from '@almadar/logger';
|
|
3
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
5
|
import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
|
|
5
|
-
import { createLogger } from '@almadar/logger';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
8
|
import * as LucideIcons from 'lucide-react';
|
|
@@ -90,10 +90,11 @@ function useTheme() {
|
|
|
90
90
|
}
|
|
91
91
|
return context;
|
|
92
92
|
}
|
|
93
|
-
var BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
|
|
93
|
+
var log, BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
|
|
94
94
|
var init_ThemeContext = __esm({
|
|
95
95
|
"context/ThemeContext.tsx"() {
|
|
96
96
|
"use client";
|
|
97
|
+
log = createLogger("almadar:ui:theme");
|
|
97
98
|
BUILT_IN_THEMES = [
|
|
98
99
|
{
|
|
99
100
|
name: "wireframe",
|
|
@@ -273,9 +274,10 @@ var init_ThemeContext = __esm({
|
|
|
273
274
|
localStorage.setItem(THEME_STORAGE_KEY, newTheme);
|
|
274
275
|
}
|
|
275
276
|
} else {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
log.warn("Theme not found", {
|
|
278
|
+
theme: newTheme,
|
|
279
|
+
available: availableThemes.map((t) => t.name)
|
|
280
|
+
});
|
|
279
281
|
}
|
|
280
282
|
},
|
|
281
283
|
[availableThemes]
|
|
@@ -400,11 +402,11 @@ function useEmitEvent() {
|
|
|
400
402
|
[eventBus]
|
|
401
403
|
);
|
|
402
404
|
}
|
|
403
|
-
var
|
|
405
|
+
var log2, subLog, scopeLog, fallbackListeners, fallbackAnyListeners, fallbackEventBus, useEventSubscription, useEventBus_default;
|
|
404
406
|
var init_useEventBus = __esm({
|
|
405
407
|
"hooks/useEventBus.ts"() {
|
|
406
408
|
"use client";
|
|
407
|
-
|
|
409
|
+
log2 = createLogger("almadar:eventbus");
|
|
408
410
|
subLog = createLogger("almadar:eventbus:subscribe");
|
|
409
411
|
scopeLog = createLogger("almadar:ui:trait-scope");
|
|
410
412
|
fallbackListeners = /* @__PURE__ */ new Map();
|
|
@@ -418,13 +420,13 @@ var init_useEventBus = __esm({
|
|
|
418
420
|
source
|
|
419
421
|
};
|
|
420
422
|
const handlers = fallbackListeners.get(type);
|
|
421
|
-
|
|
423
|
+
log2.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount: (handlers?.size ?? 0) + fallbackAnyListeners.size });
|
|
422
424
|
if (handlers) {
|
|
423
425
|
handlers.forEach((handler) => {
|
|
424
426
|
try {
|
|
425
427
|
handler(event);
|
|
426
428
|
} catch (error) {
|
|
427
|
-
|
|
429
|
+
log2.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
|
|
428
430
|
}
|
|
429
431
|
});
|
|
430
432
|
}
|
|
@@ -432,7 +434,7 @@ var init_useEventBus = __esm({
|
|
|
432
434
|
try {
|
|
433
435
|
handler(event);
|
|
434
436
|
} catch (error) {
|
|
435
|
-
|
|
437
|
+
log2.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
|
|
436
438
|
}
|
|
437
439
|
});
|
|
438
440
|
},
|
|
@@ -7338,8 +7340,6 @@ var init_Skeleton = __esm({
|
|
|
7338
7340
|
Skeleton.displayName = "Skeleton";
|
|
7339
7341
|
}
|
|
7340
7342
|
});
|
|
7341
|
-
|
|
7342
|
-
// renderer/client-effect-executor.ts
|
|
7343
7343
|
function executeClientEffects(effects, config) {
|
|
7344
7344
|
if (!effects || effects.length === 0) {
|
|
7345
7345
|
return;
|
|
@@ -7348,11 +7348,10 @@ function executeClientEffects(effects, config) {
|
|
|
7348
7348
|
try {
|
|
7349
7349
|
executeEffect(effect, config);
|
|
7350
7350
|
} catch (error) {
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
);
|
|
7351
|
+
log4.error("Error executing effect", () => ({
|
|
7352
|
+
effect: JSON.stringify(effect),
|
|
7353
|
+
error: error instanceof Error ? error : String(error)
|
|
7354
|
+
}));
|
|
7356
7355
|
}
|
|
7357
7356
|
}
|
|
7358
7357
|
config.onComplete?.();
|
|
@@ -7381,7 +7380,7 @@ function executeEffect(effect, config) {
|
|
|
7381
7380
|
break;
|
|
7382
7381
|
}
|
|
7383
7382
|
default:
|
|
7384
|
-
|
|
7383
|
+
log4.warn("Unknown effect type", { effectType: String(effectType) });
|
|
7385
7384
|
}
|
|
7386
7385
|
}
|
|
7387
7386
|
function executeRenderUI(slot, patternConfig, config) {
|
|
@@ -7396,8 +7395,10 @@ function executeNotify(message, options, config) {
|
|
|
7396
7395
|
function executeEmit(event, payload, config) {
|
|
7397
7396
|
config.eventBus.emit(event, payload);
|
|
7398
7397
|
}
|
|
7398
|
+
var log4;
|
|
7399
7399
|
var init_client_effect_executor = __esm({
|
|
7400
7400
|
"renderer/client-effect-executor.ts"() {
|
|
7401
|
+
log4 = createLogger("almadar:ui:effects:client");
|
|
7401
7402
|
}
|
|
7402
7403
|
});
|
|
7403
7404
|
|
|
@@ -7558,11 +7559,12 @@ function useOfflineExecutor(options) {
|
|
|
7558
7559
|
clearQueue
|
|
7559
7560
|
};
|
|
7560
7561
|
}
|
|
7561
|
-
var effectIdCounter, OfflineExecutor;
|
|
7562
|
+
var log5, effectIdCounter, OfflineExecutor;
|
|
7562
7563
|
var init_offline_executor = __esm({
|
|
7563
7564
|
"renderer/offline-executor.ts"() {
|
|
7564
7565
|
"use client";
|
|
7565
7566
|
init_client_effect_executor();
|
|
7567
|
+
log5 = createLogger("almadar:ui:effects:offline");
|
|
7566
7568
|
effectIdCounter = 0;
|
|
7567
7569
|
OfflineExecutor = class {
|
|
7568
7570
|
constructor(config) {
|
|
@@ -7616,7 +7618,7 @@ var init_offline_executor = __esm({
|
|
|
7616
7618
|
this.state.syncQueue = JSON.parse(stored);
|
|
7617
7619
|
}
|
|
7618
7620
|
} catch (error) {
|
|
7619
|
-
|
|
7621
|
+
log5.warn("Failed to load sync queue", { error: error instanceof Error ? error : String(error) });
|
|
7620
7622
|
}
|
|
7621
7623
|
}
|
|
7622
7624
|
/**
|
|
@@ -7627,7 +7629,7 @@ var init_offline_executor = __esm({
|
|
|
7627
7629
|
try {
|
|
7628
7630
|
this.storage.setItem("orbital-offline-queue", JSON.stringify(this.state.syncQueue));
|
|
7629
7631
|
} catch (error) {
|
|
7630
|
-
|
|
7632
|
+
log5.warn("Failed to save sync queue", { error: error instanceof Error ? error : String(error) });
|
|
7631
7633
|
}
|
|
7632
7634
|
}
|
|
7633
7635
|
/**
|
|
@@ -7697,7 +7699,7 @@ var init_offline_executor = __esm({
|
|
|
7697
7699
|
this.queueForSync(type, { args, event, payload });
|
|
7698
7700
|
break;
|
|
7699
7701
|
default:
|
|
7700
|
-
|
|
7702
|
+
log5.warn("Unknown effect type", { type });
|
|
7701
7703
|
}
|
|
7702
7704
|
}
|
|
7703
7705
|
}
|
|
@@ -10272,7 +10274,7 @@ function recordTransition(trace) {
|
|
|
10272
10274
|
...trace,
|
|
10273
10275
|
id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
|
|
10274
10276
|
};
|
|
10275
|
-
|
|
10277
|
+
log6.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
|
|
10276
10278
|
getState().transitions.push(entry);
|
|
10277
10279
|
if (getState().transitions.length > MAX_TRANSITIONS) {
|
|
10278
10280
|
getState().transitions.shift();
|
|
@@ -10341,7 +10343,7 @@ function getTraitSnapshots() {
|
|
|
10341
10343
|
try {
|
|
10342
10344
|
snapshots.push(getter());
|
|
10343
10345
|
} catch (err) {
|
|
10344
|
-
|
|
10346
|
+
log6.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
|
|
10345
10347
|
}
|
|
10346
10348
|
}
|
|
10347
10349
|
return snapshots;
|
|
@@ -10389,12 +10391,12 @@ function waitForTransition(event, timeoutMs = 1e4) {
|
|
|
10389
10391
|
}
|
|
10390
10392
|
function bindEventBus(eventBus) {
|
|
10391
10393
|
if (typeof window === "undefined") return;
|
|
10392
|
-
|
|
10394
|
+
log6.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
|
|
10393
10395
|
exposeOnWindow();
|
|
10394
10396
|
if (window.__orbitalVerification) {
|
|
10395
10397
|
window.__orbitalVerification.sendEvent = (event, payload, traitScope) => {
|
|
10396
10398
|
const prefixed = event.startsWith("UI:") ? event : traitScope ? `UI:${traitScope}.${event}` : `UI:${event}`;
|
|
10397
|
-
|
|
10399
|
+
log6.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
|
|
10398
10400
|
eventBus.emit(prefixed, payload);
|
|
10399
10401
|
};
|
|
10400
10402
|
const eventLog = [];
|
|
@@ -10443,10 +10445,10 @@ function updateAssetStatus(url, status) {
|
|
|
10443
10445
|
window.__orbitalVerification.assetStatus[url] = status;
|
|
10444
10446
|
}
|
|
10445
10447
|
}
|
|
10446
|
-
var
|
|
10448
|
+
var log6, MAX_TRANSITIONS;
|
|
10447
10449
|
var init_verificationRegistry = __esm({
|
|
10448
10450
|
"lib/verificationRegistry.ts"() {
|
|
10449
|
-
|
|
10451
|
+
log6 = createLogger("almadar:bridge");
|
|
10450
10452
|
MAX_TRANSITIONS = 500;
|
|
10451
10453
|
exposeOnWindow();
|
|
10452
10454
|
}
|
|
@@ -12474,7 +12476,7 @@ var init_avl_elk_layout = __esm({
|
|
|
12474
12476
|
elk = new ELK();
|
|
12475
12477
|
}
|
|
12476
12478
|
});
|
|
12477
|
-
var SWIM_GUTTER, CENTER_W, BehaviorView;
|
|
12479
|
+
var log7, SWIM_GUTTER, CENTER_W, BehaviorView;
|
|
12478
12480
|
var init_BehaviorView = __esm({
|
|
12479
12481
|
"components/molecules/avl/BehaviorView.tsx"() {
|
|
12480
12482
|
"use client";
|
|
@@ -12483,6 +12485,7 @@ var init_BehaviorView = __esm({
|
|
|
12483
12485
|
init_AvlSwimLane();
|
|
12484
12486
|
init_types();
|
|
12485
12487
|
init_avl_elk_layout();
|
|
12488
|
+
log7 = createLogger("almadar:ui:avl:behavior-view");
|
|
12486
12489
|
SWIM_GUTTER = 120;
|
|
12487
12490
|
CENTER_W = 360;
|
|
12488
12491
|
BehaviorView = ({ data }) => {
|
|
@@ -12492,7 +12495,7 @@ var init_BehaviorView = __esm({
|
|
|
12492
12495
|
const dataKey = useMemo(() => JSON.stringify(traitData), [traitData]);
|
|
12493
12496
|
useEffect(() => {
|
|
12494
12497
|
if (!traitData) return;
|
|
12495
|
-
computeTraitLayout(traitData).then(setLayout).catch(
|
|
12498
|
+
computeTraitLayout(traitData).then(setLayout).catch((err) => log7.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
|
|
12496
12499
|
}, [dataKey]);
|
|
12497
12500
|
if (!traitData) {
|
|
12498
12501
|
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" });
|
|
@@ -12837,7 +12840,7 @@ function computeFoldRegions(code) {
|
|
|
12837
12840
|
}
|
|
12838
12841
|
return regions.sort((a, b) => a.start - b.start);
|
|
12839
12842
|
}
|
|
12840
|
-
var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
|
|
12843
|
+
var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log8, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
|
|
12841
12844
|
var init_CodeBlock = __esm({
|
|
12842
12845
|
"components/molecules/markdown/CodeBlock.tsx"() {
|
|
12843
12846
|
init_Box();
|
|
@@ -12914,6 +12917,7 @@ var init_CodeBlock = __esm({
|
|
|
12914
12917
|
"lolo-op-async": { color: ORB_COLORS.dark.async }
|
|
12915
12918
|
};
|
|
12916
12919
|
loloStyle = { ...dark, ...loloStyleOverrides };
|
|
12920
|
+
log8 = createLogger("almadar:ui:markdown-code");
|
|
12917
12921
|
LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
12918
12922
|
HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
12919
12923
|
CodeBlock = React136__default.memo(
|
|
@@ -13112,7 +13116,7 @@ var init_CodeBlock = __esm({
|
|
|
13112
13116
|
eventBus.emit("UI:COPY_CODE", { language, success: true });
|
|
13113
13117
|
setTimeout(() => setCopied(false), 2e3);
|
|
13114
13118
|
} catch (err) {
|
|
13115
|
-
|
|
13119
|
+
log8.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
|
|
13116
13120
|
eventBus.emit("UI:COPY_CODE", { language, success: false });
|
|
13117
13121
|
}
|
|
13118
13122
|
};
|
|
@@ -16674,13 +16678,14 @@ function useSafeEventBus2() {
|
|
|
16674
16678
|
} };
|
|
16675
16679
|
}
|
|
16676
16680
|
}
|
|
16677
|
-
var ButtonGroup;
|
|
16681
|
+
var log9, ButtonGroup;
|
|
16678
16682
|
var init_ButtonGroup = __esm({
|
|
16679
16683
|
"components/molecules/ButtonGroup.tsx"() {
|
|
16680
16684
|
"use client";
|
|
16681
16685
|
init_cn();
|
|
16682
16686
|
init_atoms();
|
|
16683
16687
|
init_useEventBus();
|
|
16688
|
+
log9 = createLogger("almadar:ui:button-group");
|
|
16684
16689
|
ButtonGroup = ({
|
|
16685
16690
|
children,
|
|
16686
16691
|
primary,
|
|
@@ -16753,7 +16758,7 @@ var init_ButtonGroup = __esm({
|
|
|
16753
16758
|
{
|
|
16754
16759
|
variant: "ghost",
|
|
16755
16760
|
onClick: () => {
|
|
16756
|
-
|
|
16761
|
+
log9.debug("Filter clicked", { field: filter.field });
|
|
16757
16762
|
},
|
|
16758
16763
|
children: filter.label
|
|
16759
16764
|
},
|
|
@@ -22770,31 +22775,56 @@ var init_InputGroup = __esm({
|
|
|
22770
22775
|
InputGroup.displayName = "InputGroup";
|
|
22771
22776
|
}
|
|
22772
22777
|
});
|
|
22773
|
-
|
|
22774
|
-
|
|
22778
|
+
function gateEnabled(level, ns = NAMESPACE) {
|
|
22779
|
+
return isLogLevelEnabled(level, ns);
|
|
22780
|
+
}
|
|
22775
22781
|
function isDebugEnabled() {
|
|
22776
|
-
|
|
22777
|
-
return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
|
|
22782
|
+
return gateEnabled("DEBUG");
|
|
22778
22783
|
}
|
|
22779
22784
|
function debug(...args) {
|
|
22780
|
-
if (
|
|
22781
|
-
|
|
22785
|
+
if (!gateEnabled("DEBUG")) return;
|
|
22786
|
+
const [first, ...rest] = args;
|
|
22787
|
+
const message = typeof first === "string" ? first : "<debug>";
|
|
22788
|
+
if (rest.length === 0 && typeof first === "string") {
|
|
22789
|
+
log10.debug(message);
|
|
22790
|
+
} else {
|
|
22791
|
+
log10.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
|
|
22782
22792
|
}
|
|
22783
22793
|
}
|
|
22784
22794
|
function debugGroup(label) {
|
|
22785
|
-
if (
|
|
22786
|
-
console.group(`[DEBUG] ${label}`);
|
|
22787
|
-
}
|
|
22795
|
+
if (gateEnabled("DEBUG")) console.group(`[${NAMESPACE}] ${label}`);
|
|
22788
22796
|
}
|
|
22789
22797
|
function debugGroupEnd() {
|
|
22790
|
-
if (
|
|
22791
|
-
|
|
22798
|
+
if (gateEnabled("DEBUG")) console.groupEnd();
|
|
22799
|
+
}
|
|
22800
|
+
function formatArgs(values) {
|
|
22801
|
+
if (values.length === 1) return toLogMetaValue(values[0]);
|
|
22802
|
+
return values.map(toLogMetaValue);
|
|
22803
|
+
}
|
|
22804
|
+
function toLogMetaValue(v) {
|
|
22805
|
+
if (v === null || v === void 0) return v;
|
|
22806
|
+
if (v instanceof Error) return v;
|
|
22807
|
+
const t = typeof v;
|
|
22808
|
+
if (t === "string" || t === "number" || t === "boolean") return v;
|
|
22809
|
+
if (Array.isArray(v)) return v.map(toLogMetaValue);
|
|
22810
|
+
if (t === "object") {
|
|
22811
|
+
const out = {};
|
|
22812
|
+
for (const [k, val] of Object.entries(v)) {
|
|
22813
|
+
out[k] = toLogMetaValue(val);
|
|
22814
|
+
}
|
|
22815
|
+
return out;
|
|
22792
22816
|
}
|
|
22817
|
+
return String(v);
|
|
22793
22818
|
}
|
|
22794
|
-
var
|
|
22819
|
+
var NAMESPACE, log10;
|
|
22795
22820
|
var init_debug = __esm({
|
|
22796
22821
|
"lib/debug.ts"() {
|
|
22797
|
-
|
|
22822
|
+
NAMESPACE = "almadar:ui:debug";
|
|
22823
|
+
log10 = createLogger(NAMESPACE);
|
|
22824
|
+
createLogger("almadar:ui:debug:input");
|
|
22825
|
+
createLogger("almadar:ui:debug:collision");
|
|
22826
|
+
createLogger("almadar:ui:debug:physics");
|
|
22827
|
+
createLogger("almadar:ui:debug:game-state");
|
|
22798
22828
|
}
|
|
22799
22829
|
});
|
|
22800
22830
|
var isRelationsDebugEnabled, RelationSelect;
|
|
@@ -39151,7 +39181,7 @@ function getAllEvents(traits2) {
|
|
|
39151
39181
|
}
|
|
39152
39182
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
39153
39183
|
const eventBus = useEventBus();
|
|
39154
|
-
const [
|
|
39184
|
+
const [log12, setLog] = React136.useState([]);
|
|
39155
39185
|
const prevStatesRef = React136.useRef(/* @__PURE__ */ new Map());
|
|
39156
39186
|
React136.useEffect(() => {
|
|
39157
39187
|
for (const trait of traits2) {
|
|
@@ -39215,9 +39245,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
|
|
|
39215
39245
|
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
|
|
39216
39246
|
/* @__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)) })
|
|
39217
39247
|
] }),
|
|
39218
|
-
|
|
39248
|
+
log12.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
39219
39249
|
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
|
|
39220
|
-
/* @__PURE__ */ jsx(Stack, { gap: "xs", children:
|
|
39250
|
+
/* @__PURE__ */ jsx(Stack, { gap: "xs", children: log12.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
|
|
39221
39251
|
/* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
|
|
39222
39252
|
" ",
|
|
39223
39253
|
/* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
|
|
@@ -44144,7 +44174,7 @@ function MaybeTraitScope({
|
|
|
44144
44174
|
const schemaCtx = useEntitySchemaOptional();
|
|
44145
44175
|
const orbital = sourceTrait !== void 0 && schemaCtx !== null ? schemaCtx.orbitalsByTrait.get(sourceTrait) : void 0;
|
|
44146
44176
|
const wrap = sourceTrait !== void 0 && orbital !== void 0;
|
|
44147
|
-
scopeWrapLog.
|
|
44177
|
+
scopeWrapLog.debug("decide", {
|
|
44148
44178
|
sourceTrait,
|
|
44149
44179
|
schemaCtxPresent: schemaCtx !== null,
|
|
44150
44180
|
orbitalsByTraitSize: schemaCtx?.orbitalsByTrait.size ?? 0,
|
|
@@ -44790,24 +44820,24 @@ function captureSubscriberTag(listener) {
|
|
|
44790
44820
|
}
|
|
44791
44821
|
return "unknown";
|
|
44792
44822
|
}
|
|
44793
|
-
function EventBusProvider({ children
|
|
44823
|
+
function EventBusProvider({ children }) {
|
|
44794
44824
|
const listenersRef = useRef(/* @__PURE__ */ new Map());
|
|
44795
44825
|
const anyListenersRef = useRef(/* @__PURE__ */ new Set());
|
|
44796
44826
|
const deprecationWarningShown = useRef(false);
|
|
44797
44827
|
const getSelectedEntity = useCallback(() => {
|
|
44798
44828
|
if (!deprecationWarningShown.current) {
|
|
44799
|
-
|
|
44800
|
-
"
|
|
44801
|
-
);
|
|
44829
|
+
busLog.warn("deprecated:getSelectedEntity", {
|
|
44830
|
+
migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
|
|
44831
|
+
});
|
|
44802
44832
|
deprecationWarningShown.current = true;
|
|
44803
44833
|
}
|
|
44804
44834
|
return null;
|
|
44805
44835
|
}, []);
|
|
44806
44836
|
const clearSelectedEntity = useCallback(() => {
|
|
44807
44837
|
if (!deprecationWarningShown.current) {
|
|
44808
|
-
|
|
44809
|
-
"
|
|
44810
|
-
);
|
|
44838
|
+
busLog.warn("deprecated:clearSelectedEntity", {
|
|
44839
|
+
migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
|
|
44840
|
+
});
|
|
44811
44841
|
deprecationWarningShown.current = true;
|
|
44812
44842
|
}
|
|
44813
44843
|
}, []);
|
|
@@ -44821,12 +44851,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
44821
44851
|
const listeners6 = listenersRef.current.get(type);
|
|
44822
44852
|
const listenerCount = (listeners6?.size ?? 0) + anyListenersRef.current.size;
|
|
44823
44853
|
busLog.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount });
|
|
44824
|
-
if (
|
|
44825
|
-
|
|
44826
|
-
console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
|
|
44827
|
-
} else {
|
|
44828
|
-
console.warn(`[EventBus] Emit: ${type} (NO LISTENERS - event may be lost!)`, payload);
|
|
44829
|
-
}
|
|
44854
|
+
if (listenerCount === 0) {
|
|
44855
|
+
busLog.warn("emit:no-listeners", { type });
|
|
44830
44856
|
}
|
|
44831
44857
|
if (listeners6) {
|
|
44832
44858
|
const listenersCopy = Array.from(listeners6);
|
|
@@ -44841,7 +44867,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
44841
44867
|
try {
|
|
44842
44868
|
listener(event);
|
|
44843
44869
|
} catch (error) {
|
|
44844
|
-
|
|
44870
|
+
busLog.error("listener-threw", { type, error: error instanceof Error ? error : String(error) });
|
|
44845
44871
|
}
|
|
44846
44872
|
}
|
|
44847
44873
|
}
|
|
@@ -44857,10 +44883,10 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
44857
44883
|
try {
|
|
44858
44884
|
listener(event);
|
|
44859
44885
|
} catch (error) {
|
|
44860
|
-
|
|
44886
|
+
busLog.error("onAny-listener-threw", { type, error: error instanceof Error ? error : String(error) });
|
|
44861
44887
|
}
|
|
44862
44888
|
}
|
|
44863
|
-
}, [
|
|
44889
|
+
}, []);
|
|
44864
44890
|
const on = useCallback((type, listener) => {
|
|
44865
44891
|
if (!listenersRef.current.has(type)) {
|
|
44866
44892
|
listenersRef.current.set(type, /* @__PURE__ */ new Set());
|
|
@@ -44869,19 +44895,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
44869
44895
|
listeners6.add(listener);
|
|
44870
44896
|
if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
|
|
44871
44897
|
subLog2.debug("subscribe", { type, totalListeners: listeners6.size, tag: listenerTags.get(listener) });
|
|
44872
|
-
if (debug2) {
|
|
44873
|
-
console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
|
|
44874
|
-
}
|
|
44875
44898
|
return () => {
|
|
44876
44899
|
listeners6.delete(listener);
|
|
44877
|
-
|
|
44878
|
-
console.log(`[EventBus] Unsubscribed from '${type}', remaining: ${listeners6.size}`);
|
|
44879
|
-
}
|
|
44900
|
+
subLog2.debug("unsubscribe", { type, remaining: listeners6.size });
|
|
44880
44901
|
if (listeners6.size === 0) {
|
|
44881
44902
|
listenersRef.current.delete(type);
|
|
44882
44903
|
}
|
|
44883
44904
|
};
|
|
44884
|
-
}, [
|
|
44905
|
+
}, []);
|
|
44885
44906
|
const once = useCallback((type, listener) => {
|
|
44886
44907
|
const wrappedListener = (event) => {
|
|
44887
44908
|
listenersRef.current.get(type)?.delete(wrappedListener);
|
|
@@ -44897,16 +44918,11 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
44897
44918
|
anyListenersRef.current.add(listener);
|
|
44898
44919
|
if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
|
|
44899
44920
|
subLog2.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size, tag: listenerTags.get(listener) });
|
|
44900
|
-
if (debug2) {
|
|
44901
|
-
console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
|
|
44902
|
-
}
|
|
44903
44921
|
return () => {
|
|
44904
44922
|
anyListenersRef.current.delete(listener);
|
|
44905
|
-
|
|
44906
|
-
console.log(`[EventBus] onAny unsubscribed, remaining: ${anyListenersRef.current.size}`);
|
|
44907
|
-
}
|
|
44923
|
+
subLog2.debug("unsubscribe:any", { remaining: anyListenersRef.current.size });
|
|
44908
44924
|
};
|
|
44909
|
-
}, [
|
|
44925
|
+
}, []);
|
|
44910
44926
|
const contextValue = useMemo(
|
|
44911
44927
|
() => ({
|
|
44912
44928
|
emit,
|
|
@@ -44930,6 +44946,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
44930
44946
|
|
|
44931
44947
|
// providers/SelectionProvider.tsx
|
|
44932
44948
|
init_useEventBus();
|
|
44949
|
+
var log3 = createLogger("almadar:ui:selection");
|
|
44933
44950
|
var SelectionContext = createContext(null);
|
|
44934
44951
|
var defaultCompareEntities = (a, b) => {
|
|
44935
44952
|
if (a === b) return true;
|
|
@@ -44952,7 +44969,10 @@ function SelectionProvider({
|
|
|
44952
44969
|
(entity) => {
|
|
44953
44970
|
setSelectedState(entity);
|
|
44954
44971
|
if (debug2) {
|
|
44955
|
-
|
|
44972
|
+
log3.debug("Selection set", () => ({
|
|
44973
|
+
hasEntity: entity !== null && entity !== void 0,
|
|
44974
|
+
entityId: entity && typeof entity === "object" ? String(entity.id ?? "") : ""
|
|
44975
|
+
}));
|
|
44956
44976
|
}
|
|
44957
44977
|
},
|
|
44958
44978
|
[debug2]
|
|
@@ -44960,7 +44980,7 @@ function SelectionProvider({
|
|
|
44960
44980
|
const clearSelection = useCallback(() => {
|
|
44961
44981
|
setSelectedState(null);
|
|
44962
44982
|
if (debug2) {
|
|
44963
|
-
|
|
44983
|
+
log3.debug("Selection cleared");
|
|
44964
44984
|
}
|
|
44965
44985
|
}, [debug2]);
|
|
44966
44986
|
const isSelected = useCallback(
|
|
@@ -44975,14 +44995,17 @@ function SelectionProvider({
|
|
|
44975
44995
|
if (row) {
|
|
44976
44996
|
setSelected(row);
|
|
44977
44997
|
if (debug2) {
|
|
44978
|
-
|
|
44998
|
+
log3.debug("event received", () => ({
|
|
44999
|
+
type: event.type,
|
|
45000
|
+
rowId: row && typeof row === "object" ? String(row.id ?? "") : ""
|
|
45001
|
+
}));
|
|
44979
45002
|
}
|
|
44980
45003
|
}
|
|
44981
45004
|
};
|
|
44982
45005
|
const handleDeselect = (event) => {
|
|
44983
45006
|
clearSelection();
|
|
44984
45007
|
if (debug2) {
|
|
44985
|
-
|
|
45008
|
+
log3.debug("event received - clearing selection", { type: event.type });
|
|
44986
45009
|
}
|
|
44987
45010
|
};
|
|
44988
45011
|
const unsubView = eventBus.on("UI:VIEW", handleSelect);
|
|
@@ -45024,7 +45047,7 @@ init_UISlotRenderer();
|
|
|
45024
45047
|
// providers/VerificationProvider.tsx
|
|
45025
45048
|
init_useEventBus();
|
|
45026
45049
|
init_verificationRegistry();
|
|
45027
|
-
var
|
|
45050
|
+
var log11 = createLogger("almadar:verify");
|
|
45028
45051
|
var DISPATCH_SUFFIX = ":DISPATCH";
|
|
45029
45052
|
var SUCCESS_SUFFIX = ":SUCCESS";
|
|
45030
45053
|
var ERROR_SUFFIX = ":ERROR";
|
|
@@ -45070,7 +45093,7 @@ function VerificationProvider({
|
|
|
45070
45093
|
const verificationProviderLifecycleListener = (evt) => {
|
|
45071
45094
|
const parsed = parseLifecycleEvent(evt.type);
|
|
45072
45095
|
if (!parsed) return;
|
|
45073
|
-
|
|
45096
|
+
log11.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
|
|
45074
45097
|
const payload = evt.payload ?? {};
|
|
45075
45098
|
if (parsed.kind === "dispatch") {
|
|
45076
45099
|
const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
|
|
@@ -45125,7 +45148,7 @@ function VerificationProvider({
|
|
|
45125
45148
|
},
|
|
45126
45149
|
timestamp: Date.now()
|
|
45127
45150
|
});
|
|
45128
|
-
|
|
45151
|
+
log11.debug("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
|
|
45129
45152
|
} else if (parsed.kind === "error" && parsed.event) {
|
|
45130
45153
|
const key = `${parsed.traitName}:${parsed.event}`;
|
|
45131
45154
|
const pending = pendingRef.current.get(key);
|
|
@@ -45155,7 +45178,7 @@ function VerificationProvider({
|
|
|
45155
45178
|
},
|
|
45156
45179
|
timestamp: Date.now()
|
|
45157
45180
|
});
|
|
45158
|
-
|
|
45181
|
+
log11.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
|
|
45159
45182
|
}
|
|
45160
45183
|
};
|
|
45161
45184
|
Object.defineProperty(verificationProviderLifecycleListener, "name", {
|