@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.
- package/dist/avl/index.cjs +249 -174
- package/dist/avl/index.js +250 -175
- package/dist/components/atoms/index.d.ts +1 -1
- package/dist/components/index.cjs +185 -131
- package/dist/components/index.js +186 -132
- package/dist/components/molecules/game/ResourceBar.d.ts +1 -1
- package/dist/components/organisms/game/three/index.cjs +18 -15
- package/dist/components/organisms/game/three/index.js +18 -15
- package/dist/components/organisms/layout/{MasterDetail.d.ts → MasterDetailLayout.d.ts} +3 -3
- package/dist/components/organisms/layout/index.d.ts +1 -1
- 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 +184 -115
- package/dist/providers/index.js +184 -115
- package/dist/renderer/index.cjs +57 -56
- package/dist/renderer/index.js +57 -56
- package/dist/runtime/index.cjs +174 -100
- package/dist/runtime/index.js +175 -101
- package/package.json +3 -3
- /package/dist/components/atoms/{StatCard.d.ts → MarketingStatCard.d.ts} +0 -0
|
@@ -5,12 +5,12 @@ var fiber = require('@react-three/fiber');
|
|
|
5
5
|
var THREE6 = require('three');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var drei = require('@react-three/drei');
|
|
8
|
+
var logger = require('@almadar/logger');
|
|
8
9
|
var GLTFLoader = require('three/examples/jsm/loaders/GLTFLoader');
|
|
9
10
|
var OrbitControls_js = require('three/examples/jsm/controls/OrbitControls.js');
|
|
10
11
|
var GLTFLoader_js = require('three/examples/jsm/loaders/GLTFLoader.js');
|
|
11
12
|
var OBJLoader_js = require('three/examples/jsm/loaders/OBJLoader.js');
|
|
12
13
|
var providers = require('@almadar/ui/providers');
|
|
13
|
-
var logger = require('@almadar/logger');
|
|
14
14
|
var clsx = require('clsx');
|
|
15
15
|
var tailwindMerge = require('tailwind-merge');
|
|
16
16
|
var postprocessing = require('@react-three/postprocessing');
|
|
@@ -253,6 +253,7 @@ function Canvas3DLoadingState({
|
|
|
253
253
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "canvas-3d-loading__background", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg__grid" }) })
|
|
254
254
|
] });
|
|
255
255
|
}
|
|
256
|
+
var log = logger.createLogger("almadar:ui:game:canvas3d:error-boundary");
|
|
256
257
|
var Canvas3DErrorBoundary = class extends React21.Component {
|
|
257
258
|
constructor(props) {
|
|
258
259
|
super(props);
|
|
@@ -280,8 +281,8 @@ var Canvas3DErrorBoundary = class extends React21.Component {
|
|
|
280
281
|
componentDidCatch(error, errorInfo) {
|
|
281
282
|
this.setState({ errorInfo });
|
|
282
283
|
this.props.onError?.(error, errorInfo);
|
|
283
|
-
|
|
284
|
-
|
|
284
|
+
log.error("Error caught", { error });
|
|
285
|
+
log.error("Component stack", { componentStack: errorInfo.componentStack ?? "<none>" });
|
|
285
286
|
}
|
|
286
287
|
render() {
|
|
287
288
|
if (this.state.hasError) {
|
|
@@ -324,6 +325,7 @@ var Canvas3DErrorBoundary = class extends React21.Component {
|
|
|
324
325
|
return this.props.children;
|
|
325
326
|
}
|
|
326
327
|
};
|
|
328
|
+
var log2 = logger.createLogger("almadar:ui:game:model-loader");
|
|
327
329
|
function detectAssetRoot(modelUrl) {
|
|
328
330
|
const idx = modelUrl.indexOf("/3d/");
|
|
329
331
|
if (idx !== -1) {
|
|
@@ -342,7 +344,7 @@ function useGLTFModel(url, resourceBasePath) {
|
|
|
342
344
|
setState({ model: null, isLoading: false, error: null });
|
|
343
345
|
return;
|
|
344
346
|
}
|
|
345
|
-
|
|
347
|
+
log2.debug("Loading", { url });
|
|
346
348
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
347
349
|
const assetRoot = resourceBasePath || detectAssetRoot(url);
|
|
348
350
|
const loader = new GLTFLoader.GLTFLoader();
|
|
@@ -350,7 +352,7 @@ function useGLTFModel(url, resourceBasePath) {
|
|
|
350
352
|
loader.load(
|
|
351
353
|
url,
|
|
352
354
|
(gltf) => {
|
|
353
|
-
|
|
355
|
+
log2.debug("Loaded", { url });
|
|
354
356
|
setState({
|
|
355
357
|
model: gltf.scene,
|
|
356
358
|
isLoading: false,
|
|
@@ -359,8 +361,7 @@ function useGLTFModel(url, resourceBasePath) {
|
|
|
359
361
|
},
|
|
360
362
|
void 0,
|
|
361
363
|
(err) => {
|
|
362
|
-
|
|
363
|
-
console.warn("[ModelLoader] Failed:", url, errorMsg);
|
|
364
|
+
log2.warn("Failed", { url, error: err instanceof Error ? err : String(err) });
|
|
364
365
|
setState({
|
|
365
366
|
model: null,
|
|
366
367
|
isLoading: false,
|
|
@@ -476,6 +477,7 @@ function ModelLoader({
|
|
|
476
477
|
}
|
|
477
478
|
);
|
|
478
479
|
}
|
|
480
|
+
var log3 = logger.createLogger("almadar:ui:game:physics");
|
|
479
481
|
function PhysicsObject3D({
|
|
480
482
|
entityId,
|
|
481
483
|
modelUrl,
|
|
@@ -564,13 +566,13 @@ function PhysicsObject3D({
|
|
|
564
566
|
}
|
|
565
567
|
function usePhysics3DController(entityId) {
|
|
566
568
|
const applyForce = (fx, fy, fz) => {
|
|
567
|
-
|
|
569
|
+
log3.debug("apply force", { entityId, fx, fy, fz });
|
|
568
570
|
};
|
|
569
571
|
const setVelocity = (vx, vy, vz) => {
|
|
570
|
-
|
|
572
|
+
log3.debug("set velocity", { entityId, vx, vy, vz });
|
|
571
573
|
};
|
|
572
574
|
const setPosition = (x, y, z) => {
|
|
573
|
-
|
|
575
|
+
log3.debug("set position", { entityId, x, y, z });
|
|
574
576
|
};
|
|
575
577
|
const jump = (force = 10) => {
|
|
576
578
|
applyForce(0, force, 0);
|
|
@@ -1376,7 +1378,7 @@ function useRaycaster(options) {
|
|
|
1376
1378
|
isWithinCanvas
|
|
1377
1379
|
};
|
|
1378
1380
|
}
|
|
1379
|
-
var
|
|
1381
|
+
var log4 = logger.createLogger("almadar:eventbus");
|
|
1380
1382
|
var subLog = logger.createLogger("almadar:eventbus:subscribe");
|
|
1381
1383
|
var scopeLog = logger.createLogger("almadar:ui:trait-scope");
|
|
1382
1384
|
function getGlobalEventBus() {
|
|
@@ -1396,13 +1398,13 @@ var fallbackEventBus = {
|
|
|
1396
1398
|
source
|
|
1397
1399
|
};
|
|
1398
1400
|
const handlers = fallbackListeners.get(type);
|
|
1399
|
-
|
|
1401
|
+
log4.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount: (handlers?.size ?? 0) + fallbackAnyListeners.size });
|
|
1400
1402
|
if (handlers) {
|
|
1401
1403
|
handlers.forEach((handler) => {
|
|
1402
1404
|
try {
|
|
1403
1405
|
handler(event);
|
|
1404
1406
|
} catch (error) {
|
|
1405
|
-
|
|
1407
|
+
log4.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
|
|
1406
1408
|
}
|
|
1407
1409
|
});
|
|
1408
1410
|
}
|
|
@@ -1410,7 +1412,7 @@ var fallbackEventBus = {
|
|
|
1410
1412
|
try {
|
|
1411
1413
|
handler(event);
|
|
1412
1414
|
} catch (error) {
|
|
1413
|
-
|
|
1415
|
+
log4.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
|
|
1414
1416
|
}
|
|
1415
1417
|
});
|
|
1416
1418
|
},
|
|
@@ -2089,6 +2091,7 @@ function FeatureRenderer({
|
|
|
2089
2091
|
);
|
|
2090
2092
|
}) });
|
|
2091
2093
|
}
|
|
2094
|
+
var log5 = logger.createLogger("almadar:ui:game:feature-renderer");
|
|
2092
2095
|
function detectAssetRoot3(modelUrl) {
|
|
2093
2096
|
const idx = modelUrl.indexOf("/3d/");
|
|
2094
2097
|
if (idx !== -1) {
|
|
@@ -2238,7 +2241,7 @@ function preloadFeatures(urls) {
|
|
|
2238
2241
|
const loader = new GLTFLoader.GLTFLoader();
|
|
2239
2242
|
loader.setResourcePath(detectAssetRoot3(url));
|
|
2240
2243
|
loader.load(url, () => {
|
|
2241
|
-
|
|
2244
|
+
log5.debug("Preloaded", { url });
|
|
2242
2245
|
});
|
|
2243
2246
|
}
|
|
2244
2247
|
});
|
|
@@ -4,12 +4,12 @@ import * as THREE6 from 'three';
|
|
|
4
4
|
import { Vector3, QuadraticBezierCurve3, MathUtils, Quaternion } from 'three';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import { OrbitControls, Grid, Stars, Sparkles, Html, RoundedBox } from '@react-three/drei';
|
|
7
|
+
import { createLogger } from '@almadar/logger';
|
|
7
8
|
import { GLTFLoader as GLTFLoader$1 } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
8
9
|
import { OrbitControls as OrbitControls$1 } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
9
10
|
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
10
11
|
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js';
|
|
11
12
|
import { EventBusContext, useTraitScope } from '@almadar/ui/providers';
|
|
12
|
-
import { createLogger } from '@almadar/logger';
|
|
13
13
|
import { clsx } from 'clsx';
|
|
14
14
|
import { twMerge } from 'tailwind-merge';
|
|
15
15
|
import { EffectComposer, Bloom, DepthOfField, Vignette } from '@react-three/postprocessing';
|
|
@@ -229,6 +229,7 @@ function Canvas3DLoadingState({
|
|
|
229
229
|
/* @__PURE__ */ jsx("div", { className: "canvas-3d-loading__background", children: /* @__PURE__ */ jsx("div", { className: "bg__grid" }) })
|
|
230
230
|
] });
|
|
231
231
|
}
|
|
232
|
+
var log = createLogger("almadar:ui:game:canvas3d:error-boundary");
|
|
232
233
|
var Canvas3DErrorBoundary = class extends Component {
|
|
233
234
|
constructor(props) {
|
|
234
235
|
super(props);
|
|
@@ -256,8 +257,8 @@ var Canvas3DErrorBoundary = class extends Component {
|
|
|
256
257
|
componentDidCatch(error, errorInfo) {
|
|
257
258
|
this.setState({ errorInfo });
|
|
258
259
|
this.props.onError?.(error, errorInfo);
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
log.error("Error caught", { error });
|
|
261
|
+
log.error("Component stack", { componentStack: errorInfo.componentStack ?? "<none>" });
|
|
261
262
|
}
|
|
262
263
|
render() {
|
|
263
264
|
if (this.state.hasError) {
|
|
@@ -300,6 +301,7 @@ var Canvas3DErrorBoundary = class extends Component {
|
|
|
300
301
|
return this.props.children;
|
|
301
302
|
}
|
|
302
303
|
};
|
|
304
|
+
var log2 = createLogger("almadar:ui:game:model-loader");
|
|
303
305
|
function detectAssetRoot(modelUrl) {
|
|
304
306
|
const idx = modelUrl.indexOf("/3d/");
|
|
305
307
|
if (idx !== -1) {
|
|
@@ -318,7 +320,7 @@ function useGLTFModel(url, resourceBasePath) {
|
|
|
318
320
|
setState({ model: null, isLoading: false, error: null });
|
|
319
321
|
return;
|
|
320
322
|
}
|
|
321
|
-
|
|
323
|
+
log2.debug("Loading", { url });
|
|
322
324
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
323
325
|
const assetRoot = resourceBasePath || detectAssetRoot(url);
|
|
324
326
|
const loader = new GLTFLoader$1();
|
|
@@ -326,7 +328,7 @@ function useGLTFModel(url, resourceBasePath) {
|
|
|
326
328
|
loader.load(
|
|
327
329
|
url,
|
|
328
330
|
(gltf) => {
|
|
329
|
-
|
|
331
|
+
log2.debug("Loaded", { url });
|
|
330
332
|
setState({
|
|
331
333
|
model: gltf.scene,
|
|
332
334
|
isLoading: false,
|
|
@@ -335,8 +337,7 @@ function useGLTFModel(url, resourceBasePath) {
|
|
|
335
337
|
},
|
|
336
338
|
void 0,
|
|
337
339
|
(err) => {
|
|
338
|
-
|
|
339
|
-
console.warn("[ModelLoader] Failed:", url, errorMsg);
|
|
340
|
+
log2.warn("Failed", { url, error: err instanceof Error ? err : String(err) });
|
|
340
341
|
setState({
|
|
341
342
|
model: null,
|
|
342
343
|
isLoading: false,
|
|
@@ -452,6 +453,7 @@ function ModelLoader({
|
|
|
452
453
|
}
|
|
453
454
|
);
|
|
454
455
|
}
|
|
456
|
+
var log3 = createLogger("almadar:ui:game:physics");
|
|
455
457
|
function PhysicsObject3D({
|
|
456
458
|
entityId,
|
|
457
459
|
modelUrl,
|
|
@@ -540,13 +542,13 @@ function PhysicsObject3D({
|
|
|
540
542
|
}
|
|
541
543
|
function usePhysics3DController(entityId) {
|
|
542
544
|
const applyForce = (fx, fy, fz) => {
|
|
543
|
-
|
|
545
|
+
log3.debug("apply force", { entityId, fx, fy, fz });
|
|
544
546
|
};
|
|
545
547
|
const setVelocity = (vx, vy, vz) => {
|
|
546
|
-
|
|
548
|
+
log3.debug("set velocity", { entityId, vx, vy, vz });
|
|
547
549
|
};
|
|
548
550
|
const setPosition = (x, y, z) => {
|
|
549
|
-
|
|
551
|
+
log3.debug("set position", { entityId, x, y, z });
|
|
550
552
|
};
|
|
551
553
|
const jump = (force = 10) => {
|
|
552
554
|
applyForce(0, force, 0);
|
|
@@ -1352,7 +1354,7 @@ function useRaycaster(options) {
|
|
|
1352
1354
|
isWithinCanvas
|
|
1353
1355
|
};
|
|
1354
1356
|
}
|
|
1355
|
-
var
|
|
1357
|
+
var log4 = createLogger("almadar:eventbus");
|
|
1356
1358
|
var subLog = createLogger("almadar:eventbus:subscribe");
|
|
1357
1359
|
var scopeLog = createLogger("almadar:ui:trait-scope");
|
|
1358
1360
|
function getGlobalEventBus() {
|
|
@@ -1372,13 +1374,13 @@ var fallbackEventBus = {
|
|
|
1372
1374
|
source
|
|
1373
1375
|
};
|
|
1374
1376
|
const handlers = fallbackListeners.get(type);
|
|
1375
|
-
|
|
1377
|
+
log4.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount: (handlers?.size ?? 0) + fallbackAnyListeners.size });
|
|
1376
1378
|
if (handlers) {
|
|
1377
1379
|
handlers.forEach((handler) => {
|
|
1378
1380
|
try {
|
|
1379
1381
|
handler(event);
|
|
1380
1382
|
} catch (error) {
|
|
1381
|
-
|
|
1383
|
+
log4.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
|
|
1382
1384
|
}
|
|
1383
1385
|
});
|
|
1384
1386
|
}
|
|
@@ -1386,7 +1388,7 @@ var fallbackEventBus = {
|
|
|
1386
1388
|
try {
|
|
1387
1389
|
handler(event);
|
|
1388
1390
|
} catch (error) {
|
|
1389
|
-
|
|
1391
|
+
log4.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
|
|
1390
1392
|
}
|
|
1391
1393
|
});
|
|
1392
1394
|
},
|
|
@@ -2065,6 +2067,7 @@ function FeatureRenderer({
|
|
|
2065
2067
|
);
|
|
2066
2068
|
}) });
|
|
2067
2069
|
}
|
|
2070
|
+
var log5 = createLogger("almadar:ui:game:feature-renderer");
|
|
2068
2071
|
function detectAssetRoot3(modelUrl) {
|
|
2069
2072
|
const idx = modelUrl.indexOf("/3d/");
|
|
2070
2073
|
if (idx !== -1) {
|
|
@@ -2214,7 +2217,7 @@ function preloadFeatures(urls) {
|
|
|
2214
2217
|
const loader = new GLTFLoader$1();
|
|
2215
2218
|
loader.setResourcePath(detectAssetRoot3(url));
|
|
2216
2219
|
loader.load(url, () => {
|
|
2217
|
-
|
|
2220
|
+
log5.debug("Preloaded", { url });
|
|
2218
2221
|
});
|
|
2219
2222
|
}
|
|
2220
2223
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Uses wireframe theme styling (high contrast, sharp edges).
|
|
8
8
|
*/
|
|
9
9
|
import React from "react";
|
|
10
|
-
export interface
|
|
10
|
+
export interface MasterDetailLayoutProps {
|
|
11
11
|
/** Master panel content (usually a list) */
|
|
12
12
|
master: React.ReactNode;
|
|
13
13
|
/** Detail panel content */
|
|
@@ -28,5 +28,5 @@ export interface MasterDetailProps {
|
|
|
28
28
|
/**
|
|
29
29
|
* MasterDetail - List + detail split layout
|
|
30
30
|
*/
|
|
31
|
-
export declare const
|
|
32
|
-
export default
|
|
31
|
+
export declare const MasterDetailLayout: React.FC<MasterDetailLayoutProps>;
|
|
32
|
+
export default MasterDetailLayout;
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Export layout pattern components for adaptive UI.
|
|
5
5
|
*/
|
|
6
6
|
export { SplitPane, type SplitPaneProps } from './SplitPane';
|
|
7
|
-
export {
|
|
7
|
+
export { MasterDetailLayout, type MasterDetailLayoutProps } from './MasterDetailLayout';
|
|
8
8
|
export { DashboardGrid, type DashboardGridProps, type DashboardGridCell } from './DashboardGrid';
|
|
9
9
|
export { TabbedContainer, type TabbedContainerProps, type TabDefinition } from './TabbedContainer';
|
package/dist/context/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var react = require('react');
|
|
|
4
4
|
var logger = require('@almadar/logger');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var log = logger.createLogger("almadar:ui:ui-slots");
|
|
8
8
|
var DEFAULT_SOURCE_KEY = "__default__";
|
|
9
9
|
var MULTI_SOURCE_STACK_TRAIT = "__multi_source_stack__";
|
|
10
10
|
var ALL_SLOTS = [
|
|
@@ -86,7 +86,7 @@ function useUISlotManager() {
|
|
|
86
86
|
try {
|
|
87
87
|
callback(slot, content);
|
|
88
88
|
} catch (error) {
|
|
89
|
-
|
|
89
|
+
log.error("Subscriber error", { error: error instanceof Error ? error : String(error) });
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
}, []);
|
|
@@ -98,7 +98,7 @@ function useUISlotManager() {
|
|
|
98
98
|
try {
|
|
99
99
|
callback(content);
|
|
100
100
|
} catch (error) {
|
|
101
|
-
|
|
101
|
+
log.error("Trait subscriber error", { traitName, error: error instanceof Error ? error : String(error) });
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
},
|
|
@@ -149,9 +149,12 @@ function useUISlotManager() {
|
|
|
149
149
|
const slotSources = prev[config.target] ?? {};
|
|
150
150
|
const existing = slotSources[sourceKey];
|
|
151
151
|
if (existing && existing.priority > content.priority) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
log.warn("Slot already has higher priority content", {
|
|
153
|
+
slot: config.target,
|
|
154
|
+
sourceKey,
|
|
155
|
+
existingPriority: existing.priority,
|
|
156
|
+
newPriority: content.priority
|
|
157
|
+
});
|
|
155
158
|
return prev;
|
|
156
159
|
}
|
|
157
160
|
const nextSources = {
|
|
@@ -163,7 +166,7 @@ function useUISlotManager() {
|
|
|
163
166
|
indexTraitRender(content.sourceTrait, content);
|
|
164
167
|
notifyTraitSubscribers(content.sourceTrait, content);
|
|
165
168
|
}
|
|
166
|
-
|
|
169
|
+
log.info("slot:written", {
|
|
167
170
|
slot: config.target,
|
|
168
171
|
sourceKey,
|
|
169
172
|
sourceTrait: content.sourceTrait,
|
|
@@ -208,7 +211,7 @@ function useUISlotManager() {
|
|
|
208
211
|
setSources((prev) => {
|
|
209
212
|
const slotSources = prev[slot];
|
|
210
213
|
if (!slotSources || !(sourceKey in slotSources)) {
|
|
211
|
-
|
|
214
|
+
log.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
|
|
212
215
|
return prev;
|
|
213
216
|
}
|
|
214
217
|
const content = slotSources[sourceKey];
|
|
@@ -224,7 +227,7 @@ function useUISlotManager() {
|
|
|
224
227
|
}
|
|
225
228
|
const nextSources = { ...slotSources };
|
|
226
229
|
delete nextSources[sourceKey];
|
|
227
|
-
|
|
230
|
+
log.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
|
|
228
231
|
notifySubscribers(slot, aggregateSlot(nextSources));
|
|
229
232
|
return { ...prev, [slot]: nextSources };
|
|
230
233
|
});
|
|
@@ -366,6 +369,7 @@ function useSlotHasContent(slot) {
|
|
|
366
369
|
const { hasContent } = useUISlots();
|
|
367
370
|
return hasContent(slot);
|
|
368
371
|
}
|
|
372
|
+
var log2 = logger.createLogger("almadar:ui:theme");
|
|
369
373
|
var BUILT_IN_THEMES = [
|
|
370
374
|
{
|
|
371
375
|
name: "wireframe",
|
|
@@ -555,9 +559,10 @@ var ThemeProvider = ({
|
|
|
555
559
|
localStorage.setItem(THEME_STORAGE_KEY, newTheme);
|
|
556
560
|
}
|
|
557
561
|
} else {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
562
|
+
log2.warn("Theme not found", {
|
|
563
|
+
theme: newTheme,
|
|
564
|
+
available: availableThemes.map((t) => t.name)
|
|
565
|
+
});
|
|
561
566
|
}
|
|
562
567
|
},
|
|
563
568
|
[availableThemes]
|
package/dist/context/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createContext, useMemo, useContext, useState, useEffect, useCallback, u
|
|
|
2
2
|
import { createLogger } from '@almadar/logger';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var log = createLogger("almadar:ui:ui-slots");
|
|
6
6
|
var DEFAULT_SOURCE_KEY = "__default__";
|
|
7
7
|
var MULTI_SOURCE_STACK_TRAIT = "__multi_source_stack__";
|
|
8
8
|
var ALL_SLOTS = [
|
|
@@ -84,7 +84,7 @@ function useUISlotManager() {
|
|
|
84
84
|
try {
|
|
85
85
|
callback(slot, content);
|
|
86
86
|
} catch (error) {
|
|
87
|
-
|
|
87
|
+
log.error("Subscriber error", { error: error instanceof Error ? error : String(error) });
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
}, []);
|
|
@@ -96,7 +96,7 @@ function useUISlotManager() {
|
|
|
96
96
|
try {
|
|
97
97
|
callback(content);
|
|
98
98
|
} catch (error) {
|
|
99
|
-
|
|
99
|
+
log.error("Trait subscriber error", { traitName, error: error instanceof Error ? error : String(error) });
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
},
|
|
@@ -147,9 +147,12 @@ function useUISlotManager() {
|
|
|
147
147
|
const slotSources = prev[config.target] ?? {};
|
|
148
148
|
const existing = slotSources[sourceKey];
|
|
149
149
|
if (existing && existing.priority > content.priority) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
log.warn("Slot already has higher priority content", {
|
|
151
|
+
slot: config.target,
|
|
152
|
+
sourceKey,
|
|
153
|
+
existingPriority: existing.priority,
|
|
154
|
+
newPriority: content.priority
|
|
155
|
+
});
|
|
153
156
|
return prev;
|
|
154
157
|
}
|
|
155
158
|
const nextSources = {
|
|
@@ -161,7 +164,7 @@ function useUISlotManager() {
|
|
|
161
164
|
indexTraitRender(content.sourceTrait, content);
|
|
162
165
|
notifyTraitSubscribers(content.sourceTrait, content);
|
|
163
166
|
}
|
|
164
|
-
|
|
167
|
+
log.info("slot:written", {
|
|
165
168
|
slot: config.target,
|
|
166
169
|
sourceKey,
|
|
167
170
|
sourceTrait: content.sourceTrait,
|
|
@@ -206,7 +209,7 @@ function useUISlotManager() {
|
|
|
206
209
|
setSources((prev) => {
|
|
207
210
|
const slotSources = prev[slot];
|
|
208
211
|
if (!slotSources || !(sourceKey in slotSources)) {
|
|
209
|
-
|
|
212
|
+
log.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
|
|
210
213
|
return prev;
|
|
211
214
|
}
|
|
212
215
|
const content = slotSources[sourceKey];
|
|
@@ -222,7 +225,7 @@ function useUISlotManager() {
|
|
|
222
225
|
}
|
|
223
226
|
const nextSources = { ...slotSources };
|
|
224
227
|
delete nextSources[sourceKey];
|
|
225
|
-
|
|
228
|
+
log.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
|
|
226
229
|
notifySubscribers(slot, aggregateSlot(nextSources));
|
|
227
230
|
return { ...prev, [slot]: nextSources };
|
|
228
231
|
});
|
|
@@ -364,6 +367,7 @@ function useSlotHasContent(slot) {
|
|
|
364
367
|
const { hasContent } = useUISlots();
|
|
365
368
|
return hasContent(slot);
|
|
366
369
|
}
|
|
370
|
+
var log2 = createLogger("almadar:ui:theme");
|
|
367
371
|
var BUILT_IN_THEMES = [
|
|
368
372
|
{
|
|
369
373
|
name: "wireframe",
|
|
@@ -553,9 +557,10 @@ var ThemeProvider = ({
|
|
|
553
557
|
localStorage.setItem(THEME_STORAGE_KEY, newTheme);
|
|
554
558
|
}
|
|
555
559
|
} else {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
560
|
+
log2.warn("Theme not found", {
|
|
561
|
+
theme: newTheme,
|
|
562
|
+
available: availableThemes.map((t) => t.name)
|
|
563
|
+
});
|
|
559
564
|
}
|
|
560
565
|
},
|
|
561
566
|
[availableThemes]
|
package/dist/docs/index.cjs
CHANGED
|
@@ -2540,7 +2540,7 @@ var fallbackEventBus = {
|
|
|
2540
2540
|
try {
|
|
2541
2541
|
handler(event);
|
|
2542
2542
|
} catch (error) {
|
|
2543
|
-
|
|
2543
|
+
log.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
|
|
2544
2544
|
}
|
|
2545
2545
|
});
|
|
2546
2546
|
}
|
|
@@ -2548,7 +2548,7 @@ var fallbackEventBus = {
|
|
|
2548
2548
|
try {
|
|
2549
2549
|
handler(event);
|
|
2550
2550
|
} catch (error) {
|
|
2551
|
-
|
|
2551
|
+
log.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
|
|
2552
2552
|
}
|
|
2553
2553
|
});
|
|
2554
2554
|
},
|
package/dist/docs/index.js
CHANGED
|
@@ -2516,7 +2516,7 @@ var fallbackEventBus = {
|
|
|
2516
2516
|
try {
|
|
2517
2517
|
handler(event);
|
|
2518
2518
|
} catch (error) {
|
|
2519
|
-
|
|
2519
|
+
log.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
|
|
2520
2520
|
}
|
|
2521
2521
|
});
|
|
2522
2522
|
}
|
|
@@ -2524,7 +2524,7 @@ var fallbackEventBus = {
|
|
|
2524
2524
|
try {
|
|
2525
2525
|
handler(event);
|
|
2526
2526
|
} catch (error) {
|
|
2527
|
-
|
|
2527
|
+
log.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
|
|
2528
2528
|
}
|
|
2529
2529
|
});
|
|
2530
2530
|
},
|