@vylos/core 0.5.0 → 0.5.2
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { container as globalContainer, type DependencyContainer } from 'tsyringe';
|
|
3
3
|
import type { VylosPlugin } from '../types';
|
|
4
|
-
import type
|
|
4
|
+
import { type Component, shallowReactive } from 'vue';
|
|
5
5
|
import { EventManager } from '../managers/EventManager';
|
|
6
6
|
import { HistoryManager } from '../managers/HistoryManager';
|
|
7
7
|
import { NavigationManager } from '../managers/NavigationManager';
|
|
@@ -13,6 +13,7 @@ import { CheckpointManager } from './CheckpointManager';
|
|
|
13
13
|
import { InventoryManager } from '../managers/InventoryManager';
|
|
14
14
|
import { VylosStorage } from '../storage/VylosStorage';
|
|
15
15
|
import { Engine } from './Engine';
|
|
16
|
+
import { logger } from '../utils/logger';
|
|
16
17
|
|
|
17
18
|
/** Tokens used for DI registration */
|
|
18
19
|
export const DI_TOKENS = {
|
|
@@ -26,8 +27,8 @@ export const DI_TOKENS = {
|
|
|
26
27
|
Engine: 'Engine',
|
|
27
28
|
} as const;
|
|
28
29
|
|
|
29
|
-
/** Component override map
|
|
30
|
-
const componentOverrides =
|
|
30
|
+
/** Component override map — shallowReactive so Vue computeds track changes */
|
|
31
|
+
const componentOverrides = shallowReactive<Record<string, Component>>({});
|
|
31
32
|
|
|
32
33
|
/** Register all default managers in a DI container */
|
|
33
34
|
function registerDefaults(c: DependencyContainer): void {
|
|
@@ -67,7 +68,8 @@ export function createEngine(options: CreateEngineOptions): Engine {
|
|
|
67
68
|
// Register component overrides
|
|
68
69
|
if (options.plugin?.components) {
|
|
69
70
|
for (const [id, component] of Object.entries(options.plugin.components)) {
|
|
70
|
-
componentOverrides
|
|
71
|
+
componentOverrides[id] = component;
|
|
72
|
+
logger.debug(`Component override registered: ${id}`);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -98,10 +100,12 @@ export function createEngine(options: CreateEngineOptions): Engine {
|
|
|
98
100
|
|
|
99
101
|
/** Get a component override by ID (returns undefined if no override) */
|
|
100
102
|
export function getComponentOverride(id: string): Component | undefined {
|
|
101
|
-
return componentOverrides
|
|
103
|
+
return componentOverrides[id];
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
/** Clear all component overrides (for testing) */
|
|
105
107
|
export function clearComponentOverrides(): void {
|
|
106
|
-
|
|
108
|
+
for (const key of Object.keys(componentOverrides)) {
|
|
109
|
+
delete componentOverrides[key];
|
|
110
|
+
}
|
|
107
111
|
}
|