valence-cli 1.3.0 → 1.3.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.
Files changed (114) hide show
  1. package/README.md +56 -53
  2. package/README.original.md +56 -53
  3. package/dist/README.md +56 -53
  4. package/dist/commands/add.d.ts.map +1 -1
  5. package/dist/commands/add.js +39 -1
  6. package/dist/commands/add.js.map +1 -1
  7. package/dist/commands/features/audio.d.ts +2 -0
  8. package/dist/commands/features/audio.d.ts.map +1 -0
  9. package/dist/commands/features/audio.js +17 -0
  10. package/dist/commands/features/audio.js.map +1 -0
  11. package/dist/commands/features/input.d.ts +2 -0
  12. package/dist/commands/features/input.d.ts.map +1 -0
  13. package/dist/commands/features/input.js +13 -0
  14. package/dist/commands/features/input.js.map +1 -0
  15. package/dist/commands/features/native.d.ts.map +1 -1
  16. package/dist/commands/features/native.js +0 -8
  17. package/dist/commands/features/native.js.map +1 -1
  18. package/dist/commands/features/settings.d.ts +2 -0
  19. package/dist/commands/features/settings.d.ts.map +1 -0
  20. package/dist/commands/features/settings.js +13 -0
  21. package/dist/commands/features/settings.js.map +1 -0
  22. package/dist/commands/features/state.d.ts +2 -0
  23. package/dist/commands/features/state.d.ts.map +1 -0
  24. package/dist/commands/features/state.js +12 -0
  25. package/dist/commands/features/state.js.map +1 -0
  26. package/dist/commands/features/storage.d.ts +2 -0
  27. package/dist/commands/features/storage.d.ts.map +1 -0
  28. package/dist/commands/features/storage.js +33 -0
  29. package/dist/commands/features/storage.js.map +1 -0
  30. package/dist/commands/features/tailwind.d.ts.map +1 -1
  31. package/dist/commands/features/tailwind.js +8 -8
  32. package/dist/commands/features/tailwind.js.map +1 -1
  33. package/dist/commands/generate.d.ts.map +1 -1
  34. package/dist/commands/generate.js +19 -0
  35. package/dist/commands/generate.js.map +1 -1
  36. package/dist/commands/new-helpers.d.ts +2 -1
  37. package/dist/commands/new-helpers.d.ts.map +1 -1
  38. package/dist/commands/new-helpers.js +28 -76
  39. package/dist/commands/new-helpers.js.map +1 -1
  40. package/dist/commands/new.d.ts +1 -0
  41. package/dist/commands/new.d.ts.map +1 -1
  42. package/dist/commands/new.js +58 -38
  43. package/dist/commands/new.js.map +1 -1
  44. package/dist/constants/versions.d.ts +3 -0
  45. package/dist/constants/versions.d.ts.map +1 -1
  46. package/dist/constants/versions.js +3 -0
  47. package/dist/constants/versions.js.map +1 -1
  48. package/dist/index.js +1 -0
  49. package/dist/index.js.map +1 -1
  50. package/dist/templates/angular.d.ts +2 -2
  51. package/dist/templates/angular.d.ts.map +1 -1
  52. package/dist/templates/angular.js +4 -5
  53. package/dist/templates/angular.js.map +1 -1
  54. package/dist/templates/audio.d.ts +2 -0
  55. package/dist/templates/audio.d.ts.map +1 -0
  56. package/dist/templates/audio.js +95 -0
  57. package/dist/templates/audio.js.map +1 -0
  58. package/dist/templates/index.d.ts +5 -0
  59. package/dist/templates/index.d.ts.map +1 -1
  60. package/dist/templates/index.js +5 -0
  61. package/dist/templates/index.js.map +1 -1
  62. package/dist/templates/input.d.ts +2 -0
  63. package/dist/templates/input.d.ts.map +1 -0
  64. package/dist/templates/input.js +159 -0
  65. package/dist/templates/input.js.map +1 -0
  66. package/dist/templates/phaser-scene.d.ts +2 -0
  67. package/dist/templates/phaser-scene.d.ts.map +1 -0
  68. package/dist/templates/phaser-scene.js +27 -0
  69. package/dist/templates/phaser-scene.js.map +1 -0
  70. package/dist/templates/phaser.d.ts +2 -0
  71. package/dist/templates/phaser.d.ts.map +1 -0
  72. package/dist/templates/phaser.js +147 -0
  73. package/dist/templates/phaser.js.map +1 -0
  74. package/dist/templates/settings.d.ts +2 -0
  75. package/dist/templates/settings.d.ts.map +1 -0
  76. package/dist/templates/settings.js +66 -0
  77. package/dist/templates/settings.js.map +1 -0
  78. package/dist/templates/state.d.ts +2 -0
  79. package/dist/templates/state.d.ts.map +1 -0
  80. package/dist/templates/state.js +35 -0
  81. package/dist/templates/state.js.map +1 -0
  82. package/dist/templates/storage.d.ts +4 -0
  83. package/dist/templates/storage.d.ts.map +1 -0
  84. package/dist/templates/storage.js +121 -0
  85. package/dist/templates/storage.js.map +1 -0
  86. package/dist/templates.d.ts +2 -0
  87. package/dist/templates.d.ts.map +1 -1
  88. package/dist/templates.js +2 -0
  89. package/dist/templates.js.map +1 -1
  90. package/dist/utils/ast/modify-app-component.d.ts +2 -0
  91. package/dist/utils/ast/modify-app-component.d.ts.map +1 -0
  92. package/dist/utils/ast/modify-app-component.js +136 -0
  93. package/dist/utils/ast/modify-app-component.js.map +1 -0
  94. package/dist/utils/configurators/angular.d.ts +2 -0
  95. package/dist/utils/configurators/angular.d.ts.map +1 -0
  96. package/dist/utils/configurators/angular.js +28 -0
  97. package/dist/utils/configurators/angular.js.map +1 -0
  98. package/dist/utils/configurators/electron.d.ts +2 -0
  99. package/dist/utils/configurators/electron.d.ts.map +1 -0
  100. package/dist/utils/configurators/electron.js +12 -0
  101. package/dist/utils/configurators/electron.js.map +1 -0
  102. package/dist/utils/configurators/meta.d.ts +5 -0
  103. package/dist/utils/configurators/meta.d.ts.map +1 -0
  104. package/dist/utils/configurators/meta.js +14 -0
  105. package/dist/utils/configurators/meta.js.map +1 -0
  106. package/dist/utils/configurators/package.d.ts +5 -0
  107. package/dist/utils/configurators/package.d.ts.map +1 -0
  108. package/dist/utils/configurators/package.js +23 -0
  109. package/dist/utils/configurators/package.js.map +1 -0
  110. package/dist/utils/files.d.ts +17 -0
  111. package/dist/utils/files.d.ts.map +1 -0
  112. package/dist/utils/files.js +41 -0
  113. package/dist/utils/files.js.map +1 -0
  114. package/package.json +1 -1
@@ -0,0 +1,147 @@
1
+ export const phaserEngineServiceTemplate = `
2
+ import { Injectable, NgZone, ElementRef, OnDestroy, signal, WritableSignal } from '@angular/core';
3
+ import Phaser from 'phaser';
4
+
5
+ @Injectable({
6
+ providedIn: 'root'
7
+ })
8
+ export class PhaserEngineService implements OnDestroy {
9
+ public game: Phaser.Game | null = null;
10
+ public fps: WritableSignal<string> = signal('0');
11
+ public rotation: WritableSignal<string> = signal('2D Mode');
12
+
13
+ private canvas: HTMLCanvasElement | null = null;
14
+
15
+ constructor(private ngZone: NgZone) {}
16
+
17
+ public initGame(canvas: HTMLCanvasElement) {
18
+ this.canvas = canvas;
19
+ this.ngZone.runOutsideAngular(() => {
20
+ if (!this.game) {
21
+ this.createGame();
22
+ }
23
+ });
24
+ }
25
+
26
+ private createGame() {
27
+ if (!this.canvas) return;
28
+
29
+ const config: Phaser.Types.Core.GameConfig = {
30
+ type: Phaser.WEBGL,
31
+ canvas: this.canvas,
32
+ width: window.innerWidth,
33
+ height: window.innerHeight,
34
+ backgroundColor: '#0d0d0d', // Match 3D background
35
+ physics: {
36
+ default: 'arcade',
37
+ arcade: {
38
+ gravity: { x: 0, y: 0 },
39
+ debug: false
40
+ }
41
+ },
42
+ scene: [MainScene],
43
+ scale: {
44
+ mode: Phaser.Scale.RESIZE,
45
+ autoCenter: Phaser.Scale.CENTER_BOTH
46
+ },
47
+ callbacks: {
48
+ postBoot: (game) => {
49
+ // Hook into the loop for stats
50
+ const originalStep = game.loop.step;
51
+ game.loop.step = (time: number, delta: number) => {
52
+ originalStep.call(game.loop, time, delta);
53
+ this.fps.set(game.loop.actualFps.toFixed(0));
54
+ };
55
+ }
56
+ }
57
+ };
58
+
59
+ this.game = new Phaser.Game(config);
60
+
61
+ window.addEventListener('resize', this.onResize.bind(this));
62
+ }
63
+
64
+ private onResize() {
65
+ if (this.game) {
66
+ this.game.scale.resize(window.innerWidth, window.innerHeight);
67
+ }
68
+ }
69
+
70
+ ngOnDestroy(): void {
71
+ if (this.game) {
72
+ this.game.destroy(true);
73
+ this.game = null;
74
+ }
75
+ window.removeEventListener('resize', this.onResize.bind(this));
76
+ }
77
+ }
78
+
79
+ class MainScene extends Phaser.Scene {
80
+ private logoContainer!: Phaser.GameObjects.Container;
81
+
82
+ constructor() {
83
+ super({ key: 'MainScene' });
84
+ }
85
+
86
+ create() {
87
+ const centerX = this.scale.width / 2;
88
+ const centerY = this.scale.height / 2;
89
+
90
+ this.logoContainer = this.add.container(centerX, centerY);
91
+
92
+ // V Logo Graphics
93
+ const graphics = this.add.graphics();
94
+
95
+ // Glow effect (simulated with multiple overlapping strokes)
96
+ graphics.lineStyle(4, 0x47848F, 0.3);
97
+ this.drawV(graphics, 6); // Outer glow
98
+
99
+ graphics.lineStyle(2, 0x47848F, 1);
100
+ this.drawV(graphics, 0); // Main Stroke
101
+
102
+ // Red Accent
103
+ const accent = this.add.graphics();
104
+ accent.lineStyle(2, 0xDD0031, 1);
105
+ accent.beginPath();
106
+ accent.moveTo(-50, 0);
107
+ accent.lineTo(0, 100);
108
+ accent.strokePath();
109
+
110
+ this.logoContainer.add([graphics, accent]);
111
+
112
+ // Text
113
+ const text = this.add.text(0, 140, 'VALENCE 2D', {
114
+ fontFamily: 'Segoe UI',
115
+ fontSize: '32px',
116
+ color: '#ffffff',
117
+ align: 'center'
118
+ }).setOrigin(0.5);
119
+
120
+ const subtext = this.add.text(0, 180, 'Angular + Electron + Phaser', {
121
+ fontFamily: 'Segoe UI',
122
+ fontSize: '14px',
123
+ color: '#888888',
124
+ align: 'center'
125
+ }).setOrigin(0.5);
126
+
127
+ this.logoContainer.add([text, subtext]);
128
+ }
129
+
130
+ private drawV(graphics: Phaser.GameObjects.Graphics, offset: number) {
131
+ // V Shape
132
+ graphics.beginPath();
133
+ graphics.moveTo(-50 - offset, -50 - offset);
134
+ graphics.lineTo(0, 50 + offset);
135
+ graphics.lineTo(50 + offset, -50 - offset);
136
+ graphics.strokePath();
137
+ }
138
+
139
+ update() {
140
+ if (this.logoContainer) {
141
+ this.logoContainer.rotation = Math.sin(this.time.now / 1000) * 0.05;
142
+ this.logoContainer.scale = 1 + Math.sin(this.time.now / 2000) * 0.02;
143
+ }
144
+ }
145
+ }
146
+ `;
147
+ //# sourceMappingURL=phaser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phaser.js","sourceRoot":"","sources":["../../src/templates/phaser.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiJ1C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const settingsServiceTemplate = "\nimport { Injectable, signal, effect } from '@angular/core';\nimport { StorageService } from '../storage/storage.service';\nimport { AudioService, SoundChannel } from '../audio/audio.service';\n\nexport interface GameSettings {\n audio: {\n master: number;\n music: number;\n sfx: number;\n };\n graphics: {\n resolutionScale: number;\n antialiasing: boolean;\n };\n}\n\nconst DEFAULT_SETTINGS: GameSettings = {\n audio: { master: 1.0, music: 0.8, sfx: 1.0 },\n graphics: { resolutionScale: 1.0, antialiasing: true }\n};\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SettingsService {\n\n public settings = signal<GameSettings>(DEFAULT_SETTINGS);\n\n constructor(\n private storage: StorageService,\n private audio: AudioService\n ) {\n\n // Auto-save on change (debounced effect could be better, but simple for now)\n effect(() => {\n const s = this.settings();\n this.applySettings(s);\n this.storage.save('settings', s);\n });\n }\n\n private async loadSettings() {\n const saved = await this.storage.load<GameSettings>('settings');\n if (saved) {\n this.settings.set({ ...DEFAULT_SETTINGS, ...saved });\n }\n }\n\n private applySettings(s: GameSettings) {\n this.audio.setVolume(SoundChannel.MASTER, s.audio.master);\n this.audio.setVolume(SoundChannel.MUSIC, s.audio.music);\n this.audio.setVolume(SoundChannel.SFX, s.audio.sfx);\n \n // Graphics would typically be pulled by the EngineService from this signal\n }\n\n public updateAudio(channel: keyof GameSettings['audio'], value: number) {\n this.settings.update(s => ({\n ...s,\n audio: { ...s.audio, [channel]: value }\n }));\n }\n}\n";
2
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/templates/settings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,qrDAgEnC,CAAC"}
@@ -0,0 +1,66 @@
1
+ export const settingsServiceTemplate = `
2
+ import { Injectable, signal, effect } from '@angular/core';
3
+ import { StorageService } from '../storage/storage.service';
4
+ import { AudioService, SoundChannel } from '../audio/audio.service';
5
+
6
+ export interface GameSettings {
7
+ audio: {
8
+ master: number;
9
+ music: number;
10
+ sfx: number;
11
+ };
12
+ graphics: {
13
+ resolutionScale: number;
14
+ antialiasing: boolean;
15
+ };
16
+ }
17
+
18
+ const DEFAULT_SETTINGS: GameSettings = {
19
+ audio: { master: 1.0, music: 0.8, sfx: 1.0 },
20
+ graphics: { resolutionScale: 1.0, antialiasing: true }
21
+ };
22
+
23
+ @Injectable({
24
+ providedIn: 'root'
25
+ })
26
+ export class SettingsService {
27
+
28
+ public settings = signal<GameSettings>(DEFAULT_SETTINGS);
29
+
30
+ constructor(
31
+ private storage: StorageService,
32
+ private audio: AudioService
33
+ ) {
34
+
35
+ // Auto-save on change (debounced effect could be better, but simple for now)
36
+ effect(() => {
37
+ const s = this.settings();
38
+ this.applySettings(s);
39
+ this.storage.save('settings', s);
40
+ });
41
+ }
42
+
43
+ private async loadSettings() {
44
+ const saved = await this.storage.load<GameSettings>('settings');
45
+ if (saved) {
46
+ this.settings.set({ ...DEFAULT_SETTINGS, ...saved });
47
+ }
48
+ }
49
+
50
+ private applySettings(s: GameSettings) {
51
+ this.audio.setVolume(SoundChannel.MASTER, s.audio.master);
52
+ this.audio.setVolume(SoundChannel.MUSIC, s.audio.music);
53
+ this.audio.setVolume(SoundChannel.SFX, s.audio.sfx);
54
+
55
+ // Graphics would typically be pulled by the EngineService from this signal
56
+ }
57
+
58
+ public updateAudio(channel: keyof GameSettings['audio'], value: number) {
59
+ this.settings.update(s => ({
60
+ ...s,
61
+ audio: { ...s.audio, [channel]: value }
62
+ }));
63
+ }
64
+ }
65
+ `;
66
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/templates/settings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEtC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const gameStateServiceTemplate = "\nimport { Injectable, signal, computed } from '@angular/core';\n\nexport enum GameState {\n BOOT = 'boot',\n MAIN_MENU = 'main_menu',\n LOADING = 'loading',\n GAMEPLAY = 'gameplay',\n PAUSED = 'paused',\n GAME_OVER = 'game_over'\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GameStateService {\n \n private _state = signal<GameState>(GameState.BOOT);\n public state = this._state.asReadonly();\n\n // Computed checks for UI bindings\n public isMenu = computed(() => this._state() === GameState.MAIN_MENU);\n public isGameplay = computed(() => this._state() === GameState.GAMEPLAY);\n public isPaused = computed(() => this._state() === GameState.PAUSED);\n\n public set(newState: GameState) {\n console.log(`Game State Change: ${this._state()} -> ${newState}`);\n this._state.set(newState);\n \n // Trigger side effects here (e.g. pause engine, show overlay)\n // ValenceEngineService can listen to this signal.\n }\n}\n";
2
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/templates/state.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,y8BAiCpC,CAAC"}
@@ -0,0 +1,35 @@
1
+ export const gameStateServiceTemplate = `
2
+ import { Injectable, signal, computed } from '@angular/core';
3
+
4
+ export enum GameState {
5
+ BOOT = 'boot',
6
+ MAIN_MENU = 'main_menu',
7
+ LOADING = 'loading',
8
+ GAMEPLAY = 'gameplay',
9
+ PAUSED = 'paused',
10
+ GAME_OVER = 'game_over'
11
+ }
12
+
13
+ @Injectable({
14
+ providedIn: 'root'
15
+ })
16
+ export class GameStateService {
17
+
18
+ private _state = signal<GameState>(GameState.BOOT);
19
+ public state = this._state.asReadonly();
20
+
21
+ // Computed checks for UI bindings
22
+ public isMenu = computed(() => this._state() === GameState.MAIN_MENU);
23
+ public isGameplay = computed(() => this._state() === GameState.GAMEPLAY);
24
+ public isPaused = computed(() => this._state() === GameState.PAUSED);
25
+
26
+ public set(newState: GameState) {
27
+ console.log(\`Game State Change: \${this._state()} -> \${newState}\`);
28
+ this._state.set(newState);
29
+
30
+ // Trigger side effects here (e.g. pause engine, show overlay)
31
+ // ValenceEngineService can listen to this signal.
32
+ }
33
+ }
34
+ `;
35
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/templates/state.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCvC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const storageServiceTemplate = "\nimport { Injectable } from '@angular/core';\n\nexport interface StorageBridge {\n save: (key: string, data: string) => Promise<boolean>;\n load: (key: string) => Promise<string | null>;\n exists: (key: string) => Promise<boolean>;\n delete: (key: string) => Promise<boolean>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class StorageService {\n \n private bridge?: StorageBridge;\n\n constructor() {\n const w = window as unknown as { valenceStorage?: StorageBridge };\n if (w.valenceStorage) {\n this.bridge = w.valenceStorage;\n } else {\n console.warn('Valence Storage Bridge not found. Data will be volatile (localStorage fallback).');\n }\n }\n\n public async save(key: string, data: unknown): Promise<boolean> {\n const serialized = JSON.stringify(data);\n if (this.bridge) {\n return await this.bridge.save(key, serialized);\n }\n localStorage.setItem(key, serialized);\n return true;\n }\n\n public async load<T>(key: string): Promise<T | null> {\n if (this.bridge) {\n const raw = await this.bridge.load(key);\n if (!raw) return null;\n try { return JSON.parse(raw); } catch { return null; }\n }\n const raw = localStorage.getItem(key);\n return raw ? JSON.parse(raw) : null;\n }\n\n public async delete(key: string): Promise<boolean> {\n if (this.bridge) {\n return await this.bridge.delete(key);\n }\n localStorage.removeItem(key);\n return true;\n }\n}\n";
2
+ export declare const storageBridgeTemplate = "\n// VALENCE: STORAGE_IPC\n// VALENCE: STORAGE_IPC\n// (Imports handled by injector)\n\n// Store data in User Data directory\nconst STORAGE_PATH = path.join(app.getPath('userData'), 'saves');\n\nif (!fs.existsSync(STORAGE_PATH)) {\n fs.mkdirSync(STORAGE_PATH, { recursive: true });\n}\n\nipcMain.handle('storage:save', async (_, key: string, data: string) => {\n try {\n const target = path.join(STORAGE_PATH, `${key}.json`);\n const temp = `${target}.tmp`;\n await fs.promises.writeFile(temp, data, 'utf8');\n await fs.promises.rename(temp, target); // Atomic write\n return true;\n } catch (e) {\n console.error('Storage Save Error:', e);\n return false;\n }\n});\n\nipcMain.handle('storage:load', async (_, key: string) => {\n try {\n const target = path.join(STORAGE_PATH, `${key}.json`);\n if (fs.existsSync(target)) {\n return await fs.promises.readFile(target, 'utf8');\n }\n return null;\n } catch (e) {\n console.error('Storage Load Error:', e);\n return null;\n }\n});\n\nipcMain.handle('storage:delete', async (_, key: string) => {\n try {\n const target = path.join(STORAGE_PATH, `${key}.json`);\n if (fs.existsSync(target)) {\n await fs.promises.unlink(target);\n }\n return true;\n } catch (e) {\n return false;\n }\n});\n\nipcMain.handle('storage:exists', async (_, key: string) => {\n const target = path.join(STORAGE_PATH, `${key}.json`);\n return fs.existsSync(target);\n});\n";
3
+ export declare const storagePreloadTemplate = "\n// VALENCE: STORAGE_PRELOAD\nimport { contextBridge, ipcRenderer } from 'electron';\n\ncontextBridge.exposeInMainWorld('valenceStorage', {\n save: (key: string, data: string) => ipcRenderer.invoke('storage:save', key, data),\n load: (key: string) => ipcRenderer.invoke('storage:load', key),\n delete: (key: string) => ipcRenderer.invoke('storage:delete', key),\n exists: (key: string) => ipcRenderer.invoke('storage:exists', key),\n});\n";
4
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/templates/storage.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,28CAqDlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,q8CAsDjC,CAAC;AAEF,eAAO,MAAM,sBAAsB,gcAUlC,CAAC"}
@@ -0,0 +1,121 @@
1
+ export const storageServiceTemplate = `
2
+ import { Injectable } from '@angular/core';
3
+
4
+ export interface StorageBridge {
5
+ save: (key: string, data: string) => Promise<boolean>;
6
+ load: (key: string) => Promise<string | null>;
7
+ exists: (key: string) => Promise<boolean>;
8
+ delete: (key: string) => Promise<boolean>;
9
+ }
10
+
11
+ @Injectable({
12
+ providedIn: 'root'
13
+ })
14
+ export class StorageService {
15
+
16
+ private bridge?: StorageBridge;
17
+
18
+ constructor() {
19
+ const w = window as unknown as { valenceStorage?: StorageBridge };
20
+ if (w.valenceStorage) {
21
+ this.bridge = w.valenceStorage;
22
+ } else {
23
+ console.warn('Valence Storage Bridge not found. Data will be volatile (localStorage fallback).');
24
+ }
25
+ }
26
+
27
+ public async save(key: string, data: unknown): Promise<boolean> {
28
+ const serialized = JSON.stringify(data);
29
+ if (this.bridge) {
30
+ return await this.bridge.save(key, serialized);
31
+ }
32
+ localStorage.setItem(key, serialized);
33
+ return true;
34
+ }
35
+
36
+ public async load<T>(key: string): Promise<T | null> {
37
+ if (this.bridge) {
38
+ const raw = await this.bridge.load(key);
39
+ if (!raw) return null;
40
+ try { return JSON.parse(raw); } catch { return null; }
41
+ }
42
+ const raw = localStorage.getItem(key);
43
+ return raw ? JSON.parse(raw) : null;
44
+ }
45
+
46
+ public async delete(key: string): Promise<boolean> {
47
+ if (this.bridge) {
48
+ return await this.bridge.delete(key);
49
+ }
50
+ localStorage.removeItem(key);
51
+ return true;
52
+ }
53
+ }
54
+ `;
55
+ export const storageBridgeTemplate = `
56
+ // VALENCE: STORAGE_IPC
57
+ // VALENCE: STORAGE_IPC
58
+ // (Imports handled by injector)
59
+
60
+ // Store data in User Data directory
61
+ const STORAGE_PATH = path.join(app.getPath('userData'), 'saves');
62
+
63
+ if (!fs.existsSync(STORAGE_PATH)) {
64
+ fs.mkdirSync(STORAGE_PATH, { recursive: true });
65
+ }
66
+
67
+ ipcMain.handle('storage:save', async (_, key: string, data: string) => {
68
+ try {
69
+ const target = path.join(STORAGE_PATH, \`\${key}.json\`);
70
+ const temp = \`\${target}.tmp\`;
71
+ await fs.promises.writeFile(temp, data, 'utf8');
72
+ await fs.promises.rename(temp, target); // Atomic write
73
+ return true;
74
+ } catch (e) {
75
+ console.error('Storage Save Error:', e);
76
+ return false;
77
+ }
78
+ });
79
+
80
+ ipcMain.handle('storage:load', async (_, key: string) => {
81
+ try {
82
+ const target = path.join(STORAGE_PATH, \`\${key}.json\`);
83
+ if (fs.existsSync(target)) {
84
+ return await fs.promises.readFile(target, 'utf8');
85
+ }
86
+ return null;
87
+ } catch (e) {
88
+ console.error('Storage Load Error:', e);
89
+ return null;
90
+ }
91
+ });
92
+
93
+ ipcMain.handle('storage:delete', async (_, key: string) => {
94
+ try {
95
+ const target = path.join(STORAGE_PATH, \`\${key}.json\`);
96
+ if (fs.existsSync(target)) {
97
+ await fs.promises.unlink(target);
98
+ }
99
+ return true;
100
+ } catch (e) {
101
+ return false;
102
+ }
103
+ });
104
+
105
+ ipcMain.handle('storage:exists', async (_, key: string) => {
106
+ const target = path.join(STORAGE_PATH, \`\${key}.json\`);
107
+ return fs.existsSync(target);
108
+ });
109
+ `;
110
+ export const storagePreloadTemplate = `
111
+ // VALENCE: STORAGE_PRELOAD
112
+ import { contextBridge, ipcRenderer } from 'electron';
113
+
114
+ contextBridge.exposeInMainWorld('valenceStorage', {
115
+ save: (key: string, data: string) => ipcRenderer.invoke('storage:save', key, data),
116
+ load: (key: string) => ipcRenderer.invoke('storage:load', key),
117
+ delete: (key: string) => ipcRenderer.invoke('storage:delete', key),
118
+ exists: (key: string) => ipcRenderer.invoke('storage:exists', key),
119
+ });
120
+ `;
121
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/templates/storage.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDrC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDpC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;CAUrC,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export * from './templates/index.js';
2
+ export * from './templates/phaser.js';
3
+ export * from './templates/phaser-scene.js';
2
4
  //# sourceMappingURL=templates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
package/dist/templates.js CHANGED
@@ -1,2 +1,4 @@
1
1
  export * from './templates/index.js';
2
+ export * from './templates/phaser.js';
3
+ export * from './templates/phaser-scene.js';
2
4
  //# sourceMappingURL=templates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const modifyAppComponent: (projectPath: string, engineType: "3D (Babylon.js)" | "2D (Phaser)") => Promise<void>;
2
+ //# sourceMappingURL=modify-app-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify-app-component.d.ts","sourceRoot":"","sources":["../../../src/utils/ast/modify-app-component.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,GAAU,aAAa,MAAM,EAAE,YAAY,iBAAiB,GAAG,aAAa,kBAuI1G,CAAC"}
@@ -0,0 +1,136 @@
1
+ import fs from 'fs-extra';
2
+ import { Project, SyntaxKind } from 'ts-morph';
3
+ import * as path from 'path';
4
+ export const modifyAppComponent = async (projectPath, engineType) => {
5
+ const project = new Project();
6
+ const appInfo = await findAppFile(projectPath);
7
+ if (!appInfo) {
8
+ throw new Error('Could not find app.component.ts');
9
+ }
10
+ const { filePath, className } = appInfo;
11
+ const sourceFile = project.addSourceFileAtPath(filePath);
12
+ if (!className)
13
+ throw new Error('Could not determine AppComponent class name');
14
+ const classDecl = sourceFile.getClass(className);
15
+ if (!classDecl) {
16
+ throw new Error(`Class ${className} not found in ${filePath}`);
17
+ }
18
+ // 1. Add Imports
19
+ const serviceName = engineType === '3D (Babylon.js)' ? 'ValenceEngineService' : 'PhaserEngineService';
20
+ const serviceMethod = engineType === '3D (Babylon.js)' ? 'initEngine' : 'initGame';
21
+ sourceFile.addImportDeclaration({
22
+ namedImports: [serviceName],
23
+ moduleSpecifier: './valence-engine.service'
24
+ });
25
+ // Ensure Core Angular imports
26
+ const angularCoreImport = sourceFile.getImportDeclaration('@angular/core')
27
+ || sourceFile.addImportDeclaration({ moduleSpecifier: '@angular/core' });
28
+ const requiredCoreImports = ['NgZone', 'ElementRef', 'ViewChild', 'AfterViewInit', 'OnDestroy'];
29
+ requiredCoreImports.forEach(imp => {
30
+ if (!angularCoreImport.getNamedImports().some(ni => ni.getName() === imp)) {
31
+ angularCoreImport.addNamedImport(imp);
32
+ }
33
+ });
34
+ // 2. Implement Interfaces
35
+ classDecl.addImplements('AfterViewInit');
36
+ classDecl.addImplements('OnDestroy');
37
+ // 3. Add Properties
38
+ // @ViewChild('renderCanvas', { static: true }) canvasRef!: ElementRef<HTMLCanvasElement>;
39
+ // Check if property exists first to avoid duplicates (idempotency)
40
+ if (!classDecl.getProperty('canvasRef')) {
41
+ classDecl.addProperty({
42
+ name: 'canvasRef',
43
+ type: 'ElementRef<HTMLCanvasElement>',
44
+ decorators: [{
45
+ name: 'ViewChild',
46
+ arguments: ["'renderCanvas'", "{ static: true }"]
47
+ }],
48
+ hasExclamationToken: true
49
+ });
50
+ }
51
+ // 4. Update Constructor
52
+ const ctor = classDecl.getConstructors()[0] || classDecl.addConstructor({});
53
+ if (!ctor.getParameter('engineService')) {
54
+ ctor.addParameter({
55
+ name: 'engineService',
56
+ type: serviceName,
57
+ scope: 'public'
58
+ });
59
+ }
60
+ if (!ctor.getParameter('ngZone')) {
61
+ ctor.addParameter({
62
+ name: 'ngZone',
63
+ type: 'NgZone',
64
+ scope: 'private'
65
+ });
66
+ }
67
+ // 5. Add Lifecycle Methods
68
+ const ngAfterViewInit = classDecl.getMethod('ngAfterViewInit') || classDecl.addMethod({ name: 'ngAfterViewInit' });
69
+ ngAfterViewInit.setBodyText(writer => {
70
+ writer.writeLine(`this.ngZone.runOutsideAngular(() => {`);
71
+ writer.writeLine(` this.engineService.${serviceMethod}(this.canvasRef.nativeElement);`);
72
+ writer.writeLine(`});`);
73
+ });
74
+ const ngOnDestroy = classDecl.getMethod('ngOnDestroy') || classDecl.addMethod({ name: 'ngOnDestroy' });
75
+ ngOnDestroy.setBodyText(writer => {
76
+ // Only Babylon service currently has dispose, but Phaser service has ngOnDestroy which is auto called if provided in root?
77
+ // Actually the service is injected. We might want to manually clean up if needed.
78
+ // The template calls engineService.dispose() or destroy depending on implementation.
79
+ // Let's assume the service handles its own destruction if it's singleton, but for explicit cleanup:
80
+ if (engineType === '3D (Babylon.js)') {
81
+ writer.writeLine(`this.engineService.dispose();`);
82
+ }
83
+ else {
84
+ // Phaser service has ngOnDestroy but we can explicitly null it if we want
85
+ }
86
+ });
87
+ // 6. Update Component Decorator (Standalone Imports)
88
+ const decorator = classDecl.getDecorator('Component');
89
+ if (decorator) {
90
+ const arg = decorator.getArguments()[0];
91
+ if (arg && arg.getKind() === SyntaxKind.ObjectLiteralExpression) {
92
+ const obj = arg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);
93
+ const importsProp = obj.getProperty('imports');
94
+ // Add TopnavComponent if not present
95
+ // We need to import it first
96
+ sourceFile.addImportDeclaration({
97
+ namedImports: ['TopnavComponent'],
98
+ moduleSpecifier: './core/topnav/topnav.component'
99
+ });
100
+ if (importsProp && importsProp.getKind() === SyntaxKind.PropertyAssignment) {
101
+ const arr = importsProp.asKindOrThrow(SyntaxKind.PropertyAssignment).getInitializerIfKind(SyntaxKind.ArrayLiteralExpression);
102
+ if (arr) {
103
+ if (!arr.getElements().some(e => e.getText() === 'TopnavComponent')) {
104
+ arr.addElement('TopnavComponent');
105
+ }
106
+ }
107
+ }
108
+ else {
109
+ // If imports doesn't exist, we add it? Angular 19 might default to standalone: true
110
+ // But for now let's assume if it exists we patch it.
111
+ obj.addPropertyAssignment({
112
+ name: 'imports',
113
+ initializer: '[CommonModule, RouterOutlet, TopnavComponent]'
114
+ });
115
+ // Ensure CommonModule/RouterOutlet imports
116
+ sourceFile.addImportDeclaration({ namedImports: ['CommonModule'], moduleSpecifier: '@angular/common' });
117
+ sourceFile.addImportDeclaration({ namedImports: ['RouterOutlet'], moduleSpecifier: '@angular/router' });
118
+ }
119
+ }
120
+ }
121
+ await sourceFile.save();
122
+ };
123
+ async function findAppFile(projectPath) {
124
+ const appDir = path.join(projectPath, 'src/app');
125
+ const files = await fs.readdir(appDir);
126
+ const tsFile = files.find(f => (f === 'app.ts' || f === 'app.component.ts'));
127
+ if (!tsFile)
128
+ return null;
129
+ const content = await fs.readFile(path.join(appDir, tsFile), 'utf8');
130
+ const match = content.match(/export class (\w+)/);
131
+ return {
132
+ filePath: path.join(appDir, tsFile),
133
+ className: match ? match[1] : 'AppComponent'
134
+ };
135
+ }
136
+ //# sourceMappingURL=modify-app-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify-app-component.js","sourceRoot":"","sources":["../../../src/utils/ast/modify-app-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,WAAmB,EAAE,UAA6C,EAAE,EAAE;IAC3G,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;IAE/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACxC,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAEzD,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAE/E,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEjD,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,SAAS,SAAS,iBAAiB,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,iBAAiB;IACjB,MAAM,WAAW,GAAG,UAAU,KAAK,iBAAiB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,qBAAqB,CAAC;IACtG,MAAM,aAAa,GAAG,UAAU,KAAK,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;IAEnF,UAAU,CA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E,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC,CAAC;gBACxG,UAAU,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAC5G,CAAC;QACL,CAAC;IACL,CAAC;IAED,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF,KAAK,UAAU,WAAW,CAAC,WAAmB;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC;IAE7E,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IACrE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAElD,OAAO;QACH,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;QACnC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc;KAC/C,CAAC;AACN,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const configureAngular: (projectPath: string, projectName: string) => Promise<void>;
2
+ //# sourceMappingURL=angular.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular.d.ts","sourceRoot":"","sources":["../../../src/utils/configurators/angular.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,GAAU,aAAa,MAAM,EAAE,aAAa,MAAM,kBAyB9E,CAAC"}
@@ -0,0 +1,28 @@
1
+ import fs from 'fs-extra';
2
+ import * as path from 'path';
3
+ export const configureAngular = async (projectPath, projectName) => {
4
+ const angularJsonPath = path.join(projectPath, 'angular.json');
5
+ try {
6
+ const angularJson = await fs.readJson(angularJsonPath);
7
+ if (angularJson.projects && angularJson.projects[projectName]?.architect?.build) {
8
+ angularJson.projects[projectName].architect.build.options.outputPath = 'dist';
9
+ angularJson.projects[projectName].architect.build.options.baseHref = './';
10
+ // Remove Budgets
11
+ const productionConfig = angularJson.projects[projectName].architect.build.configurations?.production;
12
+ if (productionConfig?.budgets)
13
+ delete productionConfig.budgets;
14
+ await fs.writeFile(angularJsonPath, JSON.stringify(angularJson, null, 2));
15
+ }
16
+ // Patch index.html
17
+ const indexHtmlPath = path.join(projectPath, 'src/index.html');
18
+ if (await fs.pathExists(indexHtmlPath)) {
19
+ let indexHtml = await fs.readFile(indexHtmlPath, 'utf8');
20
+ indexHtml = indexHtml.replace('<base href="/">', '<base href="./">');
21
+ await fs.writeFile(indexHtmlPath, indexHtml);
22
+ }
23
+ }
24
+ catch (e) {
25
+ console.warn('Failed to configure Angular JSON', e);
26
+ }
27
+ };
28
+ //# sourceMappingURL=angular.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular.js","sourceRoot":"","sources":["../../../src/utils/configurators/angular.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,WAAmB,EAAE,WAAmB,EAAE,EAAE;IAC/E,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAC/D,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,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
@@ -0,0 +1,2 @@
1
+ export declare const configureElectron: (projectPath: string, repoUrl: string) => Promise<void>;
2
+ //# sourceMappingURL=electron.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electron.d.ts","sourceRoot":"","sources":["../../../src/utils/configurators/electron.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB,GAAU,aAAa,MAAM,EAAE,SAAS,MAAM,kBAQ3E,CAAC"}