@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/renderer/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var logger = require('@almadar/logger');
|
|
3
4
|
var react = require('react');
|
|
4
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var patterns = require('@almadar/patterns');
|
|
@@ -7,8 +8,7 @@ var patterns = require('@almadar/patterns');
|
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
8
9
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
10
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
10
|
-
|
|
11
|
-
// renderer/pattern-resolver.ts
|
|
11
|
+
var log = logger.createLogger("almadar:ui:pattern-resolver");
|
|
12
12
|
var componentMapping = {};
|
|
13
13
|
var patternRegistry = {};
|
|
14
14
|
function initializePatternResolver(config) {
|
|
@@ -26,16 +26,15 @@ function resolvePattern(config) {
|
|
|
26
26
|
const mapping = componentMapping[type];
|
|
27
27
|
if (!mapping) {
|
|
28
28
|
if (Object.keys(componentMapping).length === 0) {
|
|
29
|
-
|
|
30
|
-
"[PatternResolver] Component mapping not initialized. Call initializePatternResolver() at app startup."
|
|
31
|
-
);
|
|
29
|
+
log.warn("Component mapping not initialized. Call initializePatternResolver() at app startup.");
|
|
32
30
|
}
|
|
33
31
|
throw new Error(`Unknown pattern type: ${type}`);
|
|
34
32
|
}
|
|
35
33
|
if (mapping.deprecated) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
log.warn("Pattern is deprecated", {
|
|
35
|
+
type,
|
|
36
|
+
replacedBy: mapping.replacedBy
|
|
37
|
+
});
|
|
39
38
|
}
|
|
40
39
|
const validatedProps = validatePatternProps(type, props);
|
|
41
40
|
return {
|
|
@@ -54,9 +53,7 @@ function validatePatternProps(patternType, props) {
|
|
|
54
53
|
const schema = definition.propsSchema;
|
|
55
54
|
for (const [propName, propDef] of Object.entries(schema)) {
|
|
56
55
|
if (propDef.required && !(propName in validated)) {
|
|
57
|
-
|
|
58
|
-
`[PatternResolver] Missing required prop "${propName}" for pattern "${patternType}"`
|
|
59
|
-
);
|
|
56
|
+
log.warn("Missing required prop", { propName, patternType });
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
return validated;
|
|
@@ -76,8 +73,7 @@ function getPatternMapping(type) {
|
|
|
76
73
|
function getPatternDefinition(type) {
|
|
77
74
|
return patternRegistry[type];
|
|
78
75
|
}
|
|
79
|
-
|
|
80
|
-
// renderer/client-effect-executor.ts
|
|
76
|
+
var log2 = logger.createLogger("almadar:ui:effects:client");
|
|
81
77
|
function executeClientEffects(effects, config) {
|
|
82
78
|
if (!effects || effects.length === 0) {
|
|
83
79
|
return;
|
|
@@ -86,11 +82,10 @@ function executeClientEffects(effects, config) {
|
|
|
86
82
|
try {
|
|
87
83
|
executeEffect(effect, config);
|
|
88
84
|
} catch (error) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
);
|
|
85
|
+
log2.error("Error executing effect", () => ({
|
|
86
|
+
effect: JSON.stringify(effect),
|
|
87
|
+
error: error instanceof Error ? error : String(error)
|
|
88
|
+
}));
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
91
|
config.onComplete?.();
|
|
@@ -119,7 +114,7 @@ function executeEffect(effect, config) {
|
|
|
119
114
|
break;
|
|
120
115
|
}
|
|
121
116
|
default:
|
|
122
|
-
|
|
117
|
+
log2.warn("Unknown effect type", { effectType: String(effectType) });
|
|
123
118
|
}
|
|
124
119
|
}
|
|
125
120
|
function executeRenderUI(slot, patternConfig, config) {
|
|
@@ -136,12 +131,12 @@ function executeEmit(event, payload, config) {
|
|
|
136
131
|
}
|
|
137
132
|
function parseClientEffect(raw) {
|
|
138
133
|
if (!Array.isArray(raw) || raw.length < 1) {
|
|
139
|
-
|
|
134
|
+
log2.warn("Invalid effect format", () => ({ raw: JSON.stringify(raw) }));
|
|
140
135
|
return null;
|
|
141
136
|
}
|
|
142
137
|
const [type, ...args] = raw;
|
|
143
138
|
if (typeof type !== "string") {
|
|
144
|
-
|
|
139
|
+
log2.warn("Effect type must be string", () => ({ raw: JSON.stringify(raw) }));
|
|
145
140
|
return null;
|
|
146
141
|
}
|
|
147
142
|
switch (type) {
|
|
@@ -154,7 +149,7 @@ function parseClientEffect(raw) {
|
|
|
154
149
|
case "emit":
|
|
155
150
|
return ["emit", args[0], args[1]];
|
|
156
151
|
default:
|
|
157
|
-
|
|
152
|
+
log2.warn("Unknown effect type", { type });
|
|
158
153
|
return null;
|
|
159
154
|
}
|
|
160
155
|
}
|
|
@@ -181,6 +176,7 @@ function getNotifyEffects(effects) {
|
|
|
181
176
|
function getEmitEffects(effects) {
|
|
182
177
|
return filterEffectsByType(effects, "emit");
|
|
183
178
|
}
|
|
179
|
+
var log3 = logger.createLogger("almadar:ui:effects:client-hook");
|
|
184
180
|
function useClientEffects(effects, options) {
|
|
185
181
|
const {
|
|
186
182
|
enabled = true,
|
|
@@ -203,7 +199,7 @@ function useClientEffects(effects, options) {
|
|
|
203
199
|
const key = getEffectKey(effect);
|
|
204
200
|
if (executedRef.current.has(key)) {
|
|
205
201
|
if (debug) {
|
|
206
|
-
|
|
202
|
+
log3.debug("Skipping duplicate effect", () => ({ effect: JSON.stringify(effect) }));
|
|
207
203
|
}
|
|
208
204
|
return false;
|
|
209
205
|
}
|
|
@@ -214,7 +210,7 @@ function useClientEffects(effects, options) {
|
|
|
214
210
|
return;
|
|
215
211
|
}
|
|
216
212
|
if (debug) {
|
|
217
|
-
|
|
213
|
+
log3.debug("Executing effects", () => ({ effects: JSON.stringify(newEffects), count: newEffects.length }));
|
|
218
214
|
}
|
|
219
215
|
newEffects.forEach((effect) => {
|
|
220
216
|
executedRef.current.add(getEffectKey(effect));
|
|
@@ -260,8 +256,7 @@ function useClientEffectConfig() {
|
|
|
260
256
|
function useClientEffectConfigOptional() {
|
|
261
257
|
return react.useContext(ClientEffectConfigContext);
|
|
262
258
|
}
|
|
263
|
-
|
|
264
|
-
// renderer/data-resolver.ts
|
|
259
|
+
var log4 = logger.createLogger("almadar:ui:data-resolver");
|
|
265
260
|
function resolveEntityData(entityName, context) {
|
|
266
261
|
if (context.fetchedData && entityName in context.fetchedData) {
|
|
267
262
|
const data = context.fetchedData[entityName];
|
|
@@ -278,10 +273,10 @@ function resolveEntityData(entityName, context) {
|
|
|
278
273
|
loading: false
|
|
279
274
|
};
|
|
280
275
|
} catch (error) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
error
|
|
284
|
-
);
|
|
276
|
+
log4.warn("Error getting records from entity store", {
|
|
277
|
+
entityName,
|
|
278
|
+
error: error instanceof Error ? error : String(error)
|
|
279
|
+
});
|
|
285
280
|
}
|
|
286
281
|
}
|
|
287
282
|
const hasAnySources = context.fetchedData || context.entityStore;
|
|
@@ -304,10 +299,10 @@ function resolveEntityDataWithQuery(entityName, queryRef, context) {
|
|
|
304
299
|
data: filteredData
|
|
305
300
|
};
|
|
306
301
|
} catch (error) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
error
|
|
310
|
-
);
|
|
302
|
+
log4.warn("Error applying query filters", {
|
|
303
|
+
queryRef,
|
|
304
|
+
error: error instanceof Error ? error : String(error)
|
|
305
|
+
});
|
|
311
306
|
return resolution;
|
|
312
307
|
}
|
|
313
308
|
}
|
|
@@ -468,6 +463,7 @@ function getPortalSlots() {
|
|
|
468
463
|
return getSlotsByType("portal");
|
|
469
464
|
}
|
|
470
465
|
var ALL_SLOTS = Object.keys(SLOT_DEFINITIONS);
|
|
466
|
+
var log5 = logger.createLogger("almadar:ui:effects:offline");
|
|
471
467
|
var effectIdCounter = 0;
|
|
472
468
|
function generateEffectId() {
|
|
473
469
|
return `offline-effect-${++effectIdCounter}-${Date.now()}`;
|
|
@@ -524,7 +520,7 @@ var OfflineExecutor = class {
|
|
|
524
520
|
this.state.syncQueue = JSON.parse(stored);
|
|
525
521
|
}
|
|
526
522
|
} catch (error) {
|
|
527
|
-
|
|
523
|
+
log5.warn("Failed to load sync queue", { error: error instanceof Error ? error : String(error) });
|
|
528
524
|
}
|
|
529
525
|
}
|
|
530
526
|
/**
|
|
@@ -535,7 +531,7 @@ var OfflineExecutor = class {
|
|
|
535
531
|
try {
|
|
536
532
|
this.storage.setItem("orbital-offline-queue", JSON.stringify(this.state.syncQueue));
|
|
537
533
|
} catch (error) {
|
|
538
|
-
|
|
534
|
+
log5.warn("Failed to save sync queue", { error: error instanceof Error ? error : String(error) });
|
|
539
535
|
}
|
|
540
536
|
}
|
|
541
537
|
/**
|
|
@@ -605,7 +601,7 @@ var OfflineExecutor = class {
|
|
|
605
601
|
this.queueForSync(type, { args, event, payload });
|
|
606
602
|
break;
|
|
607
603
|
default:
|
|
608
|
-
|
|
604
|
+
log5.warn("Unknown effect type", { type });
|
|
609
605
|
}
|
|
610
606
|
}
|
|
611
607
|
}
|
|
@@ -785,6 +781,7 @@ function useOfflineExecutor(options) {
|
|
|
785
781
|
clearQueue
|
|
786
782
|
};
|
|
787
783
|
}
|
|
784
|
+
var log6 = logger.createLogger("almadar:ui:navigation");
|
|
788
785
|
function matchPath(pattern, path) {
|
|
789
786
|
const normalizeSegment = (p) => {
|
|
790
787
|
let normalized = p.trim();
|
|
@@ -922,18 +919,18 @@ function NavigationProvider({
|
|
|
922
919
|
const navigateTo = react.useCallback((path, payload) => {
|
|
923
920
|
const result = findPageByPath(schema, path);
|
|
924
921
|
if (!result) {
|
|
925
|
-
|
|
922
|
+
log6.error("No page found for path", { path });
|
|
926
923
|
return;
|
|
927
924
|
}
|
|
928
925
|
const { page, params } = result;
|
|
929
926
|
const finalPayload = { ...params, ...payload };
|
|
930
|
-
|
|
927
|
+
log6.debug("Navigating to", () => ({
|
|
931
928
|
path,
|
|
932
929
|
page: page.name,
|
|
933
930
|
params,
|
|
934
|
-
payload,
|
|
935
|
-
finalPayload
|
|
936
|
-
});
|
|
931
|
+
payload: JSON.stringify(payload),
|
|
932
|
+
finalPayload: JSON.stringify(finalPayload)
|
|
933
|
+
}));
|
|
937
934
|
setState((prev) => ({
|
|
938
935
|
activePage: page.name,
|
|
939
936
|
currentPath: path,
|
|
@@ -944,7 +941,7 @@ function NavigationProvider({
|
|
|
944
941
|
try {
|
|
945
942
|
window.history.pushState(finalPayload, "", path);
|
|
946
943
|
} catch (e) {
|
|
947
|
-
|
|
944
|
+
log6.warn("Could not update URL", { error: e instanceof Error ? e : String(e) });
|
|
948
945
|
}
|
|
949
946
|
}
|
|
950
947
|
if (onNavigate) {
|
|
@@ -954,16 +951,16 @@ function NavigationProvider({
|
|
|
954
951
|
const navigateToPage = react.useCallback((pageName, payload) => {
|
|
955
952
|
const result = findPageByName(schema, pageName);
|
|
956
953
|
if (!result) {
|
|
957
|
-
|
|
954
|
+
log6.error("No page found with name", { pageName });
|
|
958
955
|
return;
|
|
959
956
|
}
|
|
960
957
|
const { page } = result;
|
|
961
958
|
const path = page.path || `/${pageName.toLowerCase()}`;
|
|
962
|
-
|
|
959
|
+
log6.debug("Navigating to page", () => ({
|
|
963
960
|
pageName,
|
|
964
961
|
path,
|
|
965
|
-
payload
|
|
966
|
-
});
|
|
962
|
+
payload: JSON.stringify(payload)
|
|
963
|
+
}));
|
|
967
964
|
setState((prev) => ({
|
|
968
965
|
activePage: page.name,
|
|
969
966
|
currentPath: path,
|
|
@@ -974,7 +971,7 @@ function NavigationProvider({
|
|
|
974
971
|
try {
|
|
975
972
|
window.history.pushState(payload || {}, "", path);
|
|
976
973
|
} catch (e) {
|
|
977
|
-
|
|
974
|
+
log6.warn("Could not update URL", { error: e instanceof Error ? e : String(e) });
|
|
978
975
|
}
|
|
979
976
|
}
|
|
980
977
|
if (onNavigate) {
|
|
@@ -996,7 +993,7 @@ function useNavigation() {
|
|
|
996
993
|
function useNavigateTo() {
|
|
997
994
|
const context = react.useContext(NavigationContext);
|
|
998
995
|
const noOp = react.useCallback((path, _payload) => {
|
|
999
|
-
|
|
996
|
+
log6.warn("navigateTo called outside NavigationProvider", { path });
|
|
1000
997
|
}, []);
|
|
1001
998
|
return context?.navigateTo || noOp;
|
|
1002
999
|
}
|
|
@@ -1016,22 +1013,26 @@ function useNavigationId() {
|
|
|
1016
1013
|
const context = react.useContext(NavigationContext);
|
|
1017
1014
|
return context?.state.navigationId || 0;
|
|
1018
1015
|
}
|
|
1016
|
+
var log7 = logger.createLogger("almadar:ui:pattern-resolver");
|
|
1019
1017
|
function initializePatterns() {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1018
|
+
log7.debug("initializePatterns called");
|
|
1019
|
+
log7.debug("componentMappingJson loaded", () => ({ json: JSON.stringify(patterns.componentMapping) }));
|
|
1020
|
+
log7.debug("registryJson keys", { keys: Object.keys(patterns.patternsRegistry) });
|
|
1023
1021
|
const componentMappingData = patterns.componentMapping;
|
|
1024
1022
|
const componentMapping2 = componentMappingData.mappings || {};
|
|
1025
|
-
|
|
1026
|
-
|
|
1023
|
+
log7.debug("Extracted mappings count", { count: Object.keys(componentMapping2).length });
|
|
1024
|
+
log7.debug("Sample mappings", { samples: Object.keys(componentMapping2).slice(0, 5) });
|
|
1027
1025
|
const registryData = patterns.patternsRegistry;
|
|
1028
1026
|
const patternRegistry2 = registryData.patterns || {};
|
|
1029
|
-
|
|
1027
|
+
log7.debug("Extracted patterns count", { count: Object.keys(patternRegistry2).length });
|
|
1030
1028
|
initializePatternResolver({
|
|
1031
1029
|
componentMapping: componentMapping2,
|
|
1032
1030
|
patternRegistry: patternRegistry2
|
|
1033
1031
|
});
|
|
1034
|
-
|
|
1032
|
+
log7.info("Initialized", {
|
|
1033
|
+
componentMappings: Object.keys(componentMapping2).length,
|
|
1034
|
+
patternDefinitions: Object.keys(patternRegistry2).length
|
|
1035
|
+
});
|
|
1035
1036
|
return Object.keys(componentMapping2).length;
|
|
1036
1037
|
}
|
|
1037
1038
|
|
package/dist/renderer/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createLogger } from '@almadar/logger';
|
|
1
2
|
import { createContext, useRef, useCallback, useEffect, useContext, useState, useMemo } from 'react';
|
|
2
3
|
import { jsx } from 'react/jsx-runtime';
|
|
3
4
|
import { componentMapping as componentMapping$1, patternsRegistry } from '@almadar/patterns';
|
|
@@ -5,8 +6,7 @@ import { componentMapping as componentMapping$1, patternsRegistry } from '@almad
|
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
6
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
8
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
-
|
|
9
|
-
// renderer/pattern-resolver.ts
|
|
9
|
+
var log = createLogger("almadar:ui:pattern-resolver");
|
|
10
10
|
var componentMapping = {};
|
|
11
11
|
var patternRegistry = {};
|
|
12
12
|
function initializePatternResolver(config) {
|
|
@@ -24,16 +24,15 @@ function resolvePattern(config) {
|
|
|
24
24
|
const mapping = componentMapping[type];
|
|
25
25
|
if (!mapping) {
|
|
26
26
|
if (Object.keys(componentMapping).length === 0) {
|
|
27
|
-
|
|
28
|
-
"[PatternResolver] Component mapping not initialized. Call initializePatternResolver() at app startup."
|
|
29
|
-
);
|
|
27
|
+
log.warn("Component mapping not initialized. Call initializePatternResolver() at app startup.");
|
|
30
28
|
}
|
|
31
29
|
throw new Error(`Unknown pattern type: ${type}`);
|
|
32
30
|
}
|
|
33
31
|
if (mapping.deprecated) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
log.warn("Pattern is deprecated", {
|
|
33
|
+
type,
|
|
34
|
+
replacedBy: mapping.replacedBy
|
|
35
|
+
});
|
|
37
36
|
}
|
|
38
37
|
const validatedProps = validatePatternProps(type, props);
|
|
39
38
|
return {
|
|
@@ -52,9 +51,7 @@ function validatePatternProps(patternType, props) {
|
|
|
52
51
|
const schema = definition.propsSchema;
|
|
53
52
|
for (const [propName, propDef] of Object.entries(schema)) {
|
|
54
53
|
if (propDef.required && !(propName in validated)) {
|
|
55
|
-
|
|
56
|
-
`[PatternResolver] Missing required prop "${propName}" for pattern "${patternType}"`
|
|
57
|
-
);
|
|
54
|
+
log.warn("Missing required prop", { propName, patternType });
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
return validated;
|
|
@@ -74,8 +71,7 @@ function getPatternMapping(type) {
|
|
|
74
71
|
function getPatternDefinition(type) {
|
|
75
72
|
return patternRegistry[type];
|
|
76
73
|
}
|
|
77
|
-
|
|
78
|
-
// renderer/client-effect-executor.ts
|
|
74
|
+
var log2 = createLogger("almadar:ui:effects:client");
|
|
79
75
|
function executeClientEffects(effects, config) {
|
|
80
76
|
if (!effects || effects.length === 0) {
|
|
81
77
|
return;
|
|
@@ -84,11 +80,10 @@ function executeClientEffects(effects, config) {
|
|
|
84
80
|
try {
|
|
85
81
|
executeEffect(effect, config);
|
|
86
82
|
} catch (error) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
);
|
|
83
|
+
log2.error("Error executing effect", () => ({
|
|
84
|
+
effect: JSON.stringify(effect),
|
|
85
|
+
error: error instanceof Error ? error : String(error)
|
|
86
|
+
}));
|
|
92
87
|
}
|
|
93
88
|
}
|
|
94
89
|
config.onComplete?.();
|
|
@@ -117,7 +112,7 @@ function executeEffect(effect, config) {
|
|
|
117
112
|
break;
|
|
118
113
|
}
|
|
119
114
|
default:
|
|
120
|
-
|
|
115
|
+
log2.warn("Unknown effect type", { effectType: String(effectType) });
|
|
121
116
|
}
|
|
122
117
|
}
|
|
123
118
|
function executeRenderUI(slot, patternConfig, config) {
|
|
@@ -134,12 +129,12 @@ function executeEmit(event, payload, config) {
|
|
|
134
129
|
}
|
|
135
130
|
function parseClientEffect(raw) {
|
|
136
131
|
if (!Array.isArray(raw) || raw.length < 1) {
|
|
137
|
-
|
|
132
|
+
log2.warn("Invalid effect format", () => ({ raw: JSON.stringify(raw) }));
|
|
138
133
|
return null;
|
|
139
134
|
}
|
|
140
135
|
const [type, ...args] = raw;
|
|
141
136
|
if (typeof type !== "string") {
|
|
142
|
-
|
|
137
|
+
log2.warn("Effect type must be string", () => ({ raw: JSON.stringify(raw) }));
|
|
143
138
|
return null;
|
|
144
139
|
}
|
|
145
140
|
switch (type) {
|
|
@@ -152,7 +147,7 @@ function parseClientEffect(raw) {
|
|
|
152
147
|
case "emit":
|
|
153
148
|
return ["emit", args[0], args[1]];
|
|
154
149
|
default:
|
|
155
|
-
|
|
150
|
+
log2.warn("Unknown effect type", { type });
|
|
156
151
|
return null;
|
|
157
152
|
}
|
|
158
153
|
}
|
|
@@ -179,6 +174,7 @@ function getNotifyEffects(effects) {
|
|
|
179
174
|
function getEmitEffects(effects) {
|
|
180
175
|
return filterEffectsByType(effects, "emit");
|
|
181
176
|
}
|
|
177
|
+
var log3 = createLogger("almadar:ui:effects:client-hook");
|
|
182
178
|
function useClientEffects(effects, options) {
|
|
183
179
|
const {
|
|
184
180
|
enabled = true,
|
|
@@ -201,7 +197,7 @@ function useClientEffects(effects, options) {
|
|
|
201
197
|
const key = getEffectKey(effect);
|
|
202
198
|
if (executedRef.current.has(key)) {
|
|
203
199
|
if (debug) {
|
|
204
|
-
|
|
200
|
+
log3.debug("Skipping duplicate effect", () => ({ effect: JSON.stringify(effect) }));
|
|
205
201
|
}
|
|
206
202
|
return false;
|
|
207
203
|
}
|
|
@@ -212,7 +208,7 @@ function useClientEffects(effects, options) {
|
|
|
212
208
|
return;
|
|
213
209
|
}
|
|
214
210
|
if (debug) {
|
|
215
|
-
|
|
211
|
+
log3.debug("Executing effects", () => ({ effects: JSON.stringify(newEffects), count: newEffects.length }));
|
|
216
212
|
}
|
|
217
213
|
newEffects.forEach((effect) => {
|
|
218
214
|
executedRef.current.add(getEffectKey(effect));
|
|
@@ -258,8 +254,7 @@ function useClientEffectConfig() {
|
|
|
258
254
|
function useClientEffectConfigOptional() {
|
|
259
255
|
return useContext(ClientEffectConfigContext);
|
|
260
256
|
}
|
|
261
|
-
|
|
262
|
-
// renderer/data-resolver.ts
|
|
257
|
+
var log4 = createLogger("almadar:ui:data-resolver");
|
|
263
258
|
function resolveEntityData(entityName, context) {
|
|
264
259
|
if (context.fetchedData && entityName in context.fetchedData) {
|
|
265
260
|
const data = context.fetchedData[entityName];
|
|
@@ -276,10 +271,10 @@ function resolveEntityData(entityName, context) {
|
|
|
276
271
|
loading: false
|
|
277
272
|
};
|
|
278
273
|
} catch (error) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
error
|
|
282
|
-
);
|
|
274
|
+
log4.warn("Error getting records from entity store", {
|
|
275
|
+
entityName,
|
|
276
|
+
error: error instanceof Error ? error : String(error)
|
|
277
|
+
});
|
|
283
278
|
}
|
|
284
279
|
}
|
|
285
280
|
const hasAnySources = context.fetchedData || context.entityStore;
|
|
@@ -302,10 +297,10 @@ function resolveEntityDataWithQuery(entityName, queryRef, context) {
|
|
|
302
297
|
data: filteredData
|
|
303
298
|
};
|
|
304
299
|
} catch (error) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
error
|
|
308
|
-
);
|
|
300
|
+
log4.warn("Error applying query filters", {
|
|
301
|
+
queryRef,
|
|
302
|
+
error: error instanceof Error ? error : String(error)
|
|
303
|
+
});
|
|
309
304
|
return resolution;
|
|
310
305
|
}
|
|
311
306
|
}
|
|
@@ -466,6 +461,7 @@ function getPortalSlots() {
|
|
|
466
461
|
return getSlotsByType("portal");
|
|
467
462
|
}
|
|
468
463
|
var ALL_SLOTS = Object.keys(SLOT_DEFINITIONS);
|
|
464
|
+
var log5 = createLogger("almadar:ui:effects:offline");
|
|
469
465
|
var effectIdCounter = 0;
|
|
470
466
|
function generateEffectId() {
|
|
471
467
|
return `offline-effect-${++effectIdCounter}-${Date.now()}`;
|
|
@@ -522,7 +518,7 @@ var OfflineExecutor = class {
|
|
|
522
518
|
this.state.syncQueue = JSON.parse(stored);
|
|
523
519
|
}
|
|
524
520
|
} catch (error) {
|
|
525
|
-
|
|
521
|
+
log5.warn("Failed to load sync queue", { error: error instanceof Error ? error : String(error) });
|
|
526
522
|
}
|
|
527
523
|
}
|
|
528
524
|
/**
|
|
@@ -533,7 +529,7 @@ var OfflineExecutor = class {
|
|
|
533
529
|
try {
|
|
534
530
|
this.storage.setItem("orbital-offline-queue", JSON.stringify(this.state.syncQueue));
|
|
535
531
|
} catch (error) {
|
|
536
|
-
|
|
532
|
+
log5.warn("Failed to save sync queue", { error: error instanceof Error ? error : String(error) });
|
|
537
533
|
}
|
|
538
534
|
}
|
|
539
535
|
/**
|
|
@@ -603,7 +599,7 @@ var OfflineExecutor = class {
|
|
|
603
599
|
this.queueForSync(type, { args, event, payload });
|
|
604
600
|
break;
|
|
605
601
|
default:
|
|
606
|
-
|
|
602
|
+
log5.warn("Unknown effect type", { type });
|
|
607
603
|
}
|
|
608
604
|
}
|
|
609
605
|
}
|
|
@@ -783,6 +779,7 @@ function useOfflineExecutor(options) {
|
|
|
783
779
|
clearQueue
|
|
784
780
|
};
|
|
785
781
|
}
|
|
782
|
+
var log6 = createLogger("almadar:ui:navigation");
|
|
786
783
|
function matchPath(pattern, path) {
|
|
787
784
|
const normalizeSegment = (p) => {
|
|
788
785
|
let normalized = p.trim();
|
|
@@ -920,18 +917,18 @@ function NavigationProvider({
|
|
|
920
917
|
const navigateTo = useCallback((path, payload) => {
|
|
921
918
|
const result = findPageByPath(schema, path);
|
|
922
919
|
if (!result) {
|
|
923
|
-
|
|
920
|
+
log6.error("No page found for path", { path });
|
|
924
921
|
return;
|
|
925
922
|
}
|
|
926
923
|
const { page, params } = result;
|
|
927
924
|
const finalPayload = { ...params, ...payload };
|
|
928
|
-
|
|
925
|
+
log6.debug("Navigating to", () => ({
|
|
929
926
|
path,
|
|
930
927
|
page: page.name,
|
|
931
928
|
params,
|
|
932
|
-
payload,
|
|
933
|
-
finalPayload
|
|
934
|
-
});
|
|
929
|
+
payload: JSON.stringify(payload),
|
|
930
|
+
finalPayload: JSON.stringify(finalPayload)
|
|
931
|
+
}));
|
|
935
932
|
setState((prev) => ({
|
|
936
933
|
activePage: page.name,
|
|
937
934
|
currentPath: path,
|
|
@@ -942,7 +939,7 @@ function NavigationProvider({
|
|
|
942
939
|
try {
|
|
943
940
|
window.history.pushState(finalPayload, "", path);
|
|
944
941
|
} catch (e) {
|
|
945
|
-
|
|
942
|
+
log6.warn("Could not update URL", { error: e instanceof Error ? e : String(e) });
|
|
946
943
|
}
|
|
947
944
|
}
|
|
948
945
|
if (onNavigate) {
|
|
@@ -952,16 +949,16 @@ function NavigationProvider({
|
|
|
952
949
|
const navigateToPage = useCallback((pageName, payload) => {
|
|
953
950
|
const result = findPageByName(schema, pageName);
|
|
954
951
|
if (!result) {
|
|
955
|
-
|
|
952
|
+
log6.error("No page found with name", { pageName });
|
|
956
953
|
return;
|
|
957
954
|
}
|
|
958
955
|
const { page } = result;
|
|
959
956
|
const path = page.path || `/${pageName.toLowerCase()}`;
|
|
960
|
-
|
|
957
|
+
log6.debug("Navigating to page", () => ({
|
|
961
958
|
pageName,
|
|
962
959
|
path,
|
|
963
|
-
payload
|
|
964
|
-
});
|
|
960
|
+
payload: JSON.stringify(payload)
|
|
961
|
+
}));
|
|
965
962
|
setState((prev) => ({
|
|
966
963
|
activePage: page.name,
|
|
967
964
|
currentPath: path,
|
|
@@ -972,7 +969,7 @@ function NavigationProvider({
|
|
|
972
969
|
try {
|
|
973
970
|
window.history.pushState(payload || {}, "", path);
|
|
974
971
|
} catch (e) {
|
|
975
|
-
|
|
972
|
+
log6.warn("Could not update URL", { error: e instanceof Error ? e : String(e) });
|
|
976
973
|
}
|
|
977
974
|
}
|
|
978
975
|
if (onNavigate) {
|
|
@@ -994,7 +991,7 @@ function useNavigation() {
|
|
|
994
991
|
function useNavigateTo() {
|
|
995
992
|
const context = useContext(NavigationContext);
|
|
996
993
|
const noOp = useCallback((path, _payload) => {
|
|
997
|
-
|
|
994
|
+
log6.warn("navigateTo called outside NavigationProvider", { path });
|
|
998
995
|
}, []);
|
|
999
996
|
return context?.navigateTo || noOp;
|
|
1000
997
|
}
|
|
@@ -1014,22 +1011,26 @@ function useNavigationId() {
|
|
|
1014
1011
|
const context = useContext(NavigationContext);
|
|
1015
1012
|
return context?.state.navigationId || 0;
|
|
1016
1013
|
}
|
|
1014
|
+
var log7 = createLogger("almadar:ui:pattern-resolver");
|
|
1017
1015
|
function initializePatterns() {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1016
|
+
log7.debug("initializePatterns called");
|
|
1017
|
+
log7.debug("componentMappingJson loaded", () => ({ json: JSON.stringify(componentMapping$1) }));
|
|
1018
|
+
log7.debug("registryJson keys", { keys: Object.keys(patternsRegistry) });
|
|
1021
1019
|
const componentMappingData = componentMapping$1;
|
|
1022
1020
|
const componentMapping2 = componentMappingData.mappings || {};
|
|
1023
|
-
|
|
1024
|
-
|
|
1021
|
+
log7.debug("Extracted mappings count", { count: Object.keys(componentMapping2).length });
|
|
1022
|
+
log7.debug("Sample mappings", { samples: Object.keys(componentMapping2).slice(0, 5) });
|
|
1025
1023
|
const registryData = patternsRegistry;
|
|
1026
1024
|
const patternRegistry2 = registryData.patterns || {};
|
|
1027
|
-
|
|
1025
|
+
log7.debug("Extracted patterns count", { count: Object.keys(patternRegistry2).length });
|
|
1028
1026
|
initializePatternResolver({
|
|
1029
1027
|
componentMapping: componentMapping2,
|
|
1030
1028
|
patternRegistry: patternRegistry2
|
|
1031
1029
|
});
|
|
1032
|
-
|
|
1030
|
+
log7.info("Initialized", {
|
|
1031
|
+
componentMappings: Object.keys(componentMapping2).length,
|
|
1032
|
+
patternDefinitions: Object.keys(patternRegistry2).length
|
|
1033
|
+
});
|
|
1033
1034
|
return Object.keys(componentMapping2).length;
|
|
1034
1035
|
}
|
|
1035
1036
|
|