@vylos/core 0.4.5 → 0.5.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@vylos/core",
3
- "version": "0.4.5",
3
+ "version": "0.5.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/DevOpsBenjamin/Vylos"
@@ -10,20 +10,23 @@
10
10
  <template v-if="!engineState.uiHidden">
11
11
  <!-- z-15–25: HUD (hidden during dialogue/choices) -->
12
12
  <template v-if="!hideHud">
13
- <DrawableOverlay />
14
- <LocationOverlay />
15
- <ActionOverlay />
16
- <TopBar />
13
+ <component :is="drawableOverlayComponent" />
14
+ <component :is="locationOverlayComponent" />
15
+ <component :is="actionOverlayComponent" />
16
+ <component :is="topBarComponent" />
17
17
  </template>
18
18
 
19
19
  <!-- z-30: Dialogue box -->
20
- <DialogueBox />
20
+ <component :is="dialogueBoxComponent" />
21
21
 
22
22
  <!-- z-35: Choice panel (inside DialogueBox z-range) -->
23
- <ChoicePanel />
23
+ <component :is="choicePanelComponent" />
24
24
 
25
25
  <!-- z-40: Custom overlay -->
26
26
  <CustomOverlay />
27
+
28
+ <!-- z-45: Project HUD (always visible when UI is shown) -->
29
+ <slot name="hud" />
27
30
  </template>
28
31
  </div>
29
32
  </template>
@@ -31,16 +34,24 @@
31
34
  <script setup lang="ts">
32
35
  import { computed } from 'vue';
33
36
  import { useEngineStateStore } from '../../stores/engineState';
37
+ import { getComponentOverride } from '../../engine/core/EngineFactory';
34
38
  import BackgroundLayer from '../core/BackgroundLayer.vue';
35
39
  import ForegroundLayer from '../core/ForegroundLayer.vue';
36
- import DrawableOverlay from '../core/DrawableOverlay.vue';
37
- import DialogueBox from '../core/DialogueBox.vue';
38
- import ChoicePanel from '../core/ChoicePanel.vue';
40
+ import DefaultDrawableOverlay from '../core/DrawableOverlay.vue';
41
+ import DefaultDialogueBox from '../core/DialogueBox.vue';
42
+ import DefaultChoicePanel from '../core/ChoicePanel.vue';
39
43
  import CustomOverlay from '../core/CustomOverlay.vue';
40
- import ActionOverlay from '../menu/ActionOverlay.vue';
41
- import LocationOverlay from '../menu/LocationOverlay.vue';
42
- import TopBar from '../menu/TopBar.vue';
44
+ import DefaultActionOverlay from '../menu/ActionOverlay.vue';
45
+ import DefaultLocationOverlay from '../menu/LocationOverlay.vue';
46
+ import DefaultTopBar from '../menu/TopBar.vue';
43
47
 
44
48
  const engineState = useEngineStateStore();
45
49
  const hideHud = computed(() => !!engineState.dialogue || !!engineState.choices);
50
+
51
+ const topBarComponent = computed(() => getComponentOverride('TopBar') ?? DefaultTopBar);
52
+ const actionOverlayComponent = computed(() => getComponentOverride('ActionOverlay') ?? DefaultActionOverlay);
53
+ const locationOverlayComponent = computed(() => getComponentOverride('LocationOverlay') ?? DefaultLocationOverlay);
54
+ const dialogueBoxComponent = computed(() => getComponentOverride('DialogueBox') ?? DefaultDialogueBox);
55
+ const choicePanelComponent = computed(() => getComponentOverride('ChoicePanel') ?? DefaultChoicePanel);
56
+ const drawableOverlayComponent = computed(() => getComponentOverride('DrawableOverlay') ?? DefaultDrawableOverlay);
46
57
  </script>
@@ -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 { Component } from 'vue';
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 (separate from DI) */
30
- const componentOverrides = new Map<string, Component>();
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.set(id, component);
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.get(id);
103
+ return componentOverrides[id];
102
104
  }
103
105
 
104
106
  /** Clear all component overrides (for testing) */
105
107
  export function clearComponentOverrides(): void {
106
- componentOverrides.clear();
108
+ for (const key of Object.keys(componentOverrides)) {
109
+ delete componentOverrides[key];
110
+ }
107
111
  }