valence-cli 1.2.8 → 1.3.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/README.md +57 -43
- package/README.original.md +57 -43
- package/dist/README.md +57 -43
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +93 -1
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +115 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/codegen.js +42 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +65 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/features/assets.d.ts +6 -0
- package/dist/commands/features/assets.d.ts.map +1 -0
- package/dist/commands/features/assets.js +113 -0
- package/dist/commands/features/assets.js.map +1 -0
- package/dist/commands/features/audio.d.ts +2 -0
- package/dist/commands/features/audio.d.ts.map +1 -0
- package/dist/commands/features/audio.js +17 -0
- package/dist/commands/features/audio.js.map +1 -0
- package/dist/commands/features/input.d.ts +2 -0
- package/dist/commands/features/input.d.ts.map +1 -0
- package/dist/commands/features/input.js +13 -0
- package/dist/commands/features/input.js.map +1 -0
- package/dist/commands/features/multiplayer.d.ts +2 -0
- package/dist/commands/features/multiplayer.d.ts.map +1 -0
- package/dist/commands/features/multiplayer.js +81 -0
- package/dist/commands/features/multiplayer.js.map +1 -0
- package/dist/commands/features/native.d.ts +2 -0
- package/dist/commands/features/native.d.ts.map +1 -0
- package/dist/commands/features/native.js +83 -0
- package/dist/commands/features/native.js.map +1 -0
- package/dist/commands/features/physics.d.ts +2 -0
- package/dist/commands/features/physics.d.ts.map +1 -0
- package/dist/commands/features/physics.js +44 -0
- package/dist/commands/features/physics.js.map +1 -0
- package/dist/commands/features/pipeline.d.ts +2 -0
- package/dist/commands/features/pipeline.d.ts.map +1 -0
- package/dist/commands/features/pipeline.js +28 -0
- package/dist/commands/features/pipeline.js.map +1 -0
- package/dist/commands/features/settings.d.ts +2 -0
- package/dist/commands/features/settings.d.ts.map +1 -0
- package/dist/commands/features/settings.js +13 -0
- package/dist/commands/features/settings.js.map +1 -0
- package/dist/commands/features/state.d.ts +2 -0
- package/dist/commands/features/state.d.ts.map +1 -0
- package/dist/commands/features/state.js +12 -0
- package/dist/commands/features/state.js.map +1 -0
- package/dist/commands/features/storage.d.ts +2 -0
- package/dist/commands/features/storage.d.ts.map +1 -0
- package/dist/commands/features/storage.js +33 -0
- package/dist/commands/features/storage.js.map +1 -0
- package/dist/commands/features/tailwind.d.ts +2 -0
- package/dist/commands/features/tailwind.d.ts.map +1 -0
- package/dist/commands/features/tailwind.js +46 -0
- package/dist/commands/features/tailwind.js.map +1 -0
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +205 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/lifecycle.d.ts.map +1 -1
- package/dist/commands/lifecycle.js +45 -1
- package/dist/commands/lifecycle.js.map +1 -1
- package/dist/commands/new-helpers.d.ts +12 -0
- package/dist/commands/new-helpers.d.ts.map +1 -0
- package/dist/commands/new-helpers.js +61 -0
- package/dist/commands/new-helpers.js.map +1 -0
- package/dist/commands/new.d.ts +1 -0
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +173 -1
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/publish.js +86 -1
- package/dist/commands/template.d.ts.map +1 -1
- package/dist/commands/template.js +259 -1
- package/dist/commands/template.js.map +1 -1
- package/dist/commands/verify.d.ts +2 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +80 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/constants/versions.d.ts +41 -0
- package/dist/constants/versions.d.ts.map +1 -0
- package/dist/constants/versions.js +41 -0
- package/dist/constants/versions.js.map +1 -0
- package/dist/index.js +107 -1
- package/dist/index.js.map +1 -1
- package/dist/templates/angular.d.ts +2 -2
- package/dist/templates/angular.d.ts.map +1 -1
- package/dist/templates/angular.js +375 -1
- package/dist/templates/angular.js.map +1 -1
- package/dist/templates/audio.d.ts +2 -0
- package/dist/templates/audio.d.ts.map +1 -0
- package/dist/templates/audio.js +95 -0
- package/dist/templates/audio.js.map +1 -0
- package/dist/templates/components.js +54 -1
- package/dist/templates/config.js +26 -1
- package/dist/templates/electron.js +124 -1
- package/dist/templates/index.d.ts +7 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +12 -1
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/input.d.ts +2 -0
- package/dist/templates/input.d.ts.map +1 -0
- package/dist/templates/input.js +159 -0
- package/dist/templates/input.js.map +1 -0
- package/dist/templates/multiplayer.d.ts +7 -0
- package/dist/templates/multiplayer.d.ts.map +1 -0
- package/dist/templates/multiplayer.js +151 -0
- package/dist/templates/multiplayer.js.map +1 -0
- package/dist/templates/native.d.ts +4 -0
- package/dist/templates/native.d.ts.map +1 -0
- package/dist/templates/native.js +40 -0
- package/dist/templates/native.js.map +1 -0
- package/dist/templates/phaser-scene.d.ts +2 -0
- package/dist/templates/phaser-scene.d.ts.map +1 -0
- package/dist/templates/phaser-scene.js +27 -0
- package/dist/templates/phaser-scene.js.map +1 -0
- package/dist/templates/phaser.d.ts +2 -0
- package/dist/templates/phaser.d.ts.map +1 -0
- package/dist/templates/phaser.js +147 -0
- package/dist/templates/phaser.js.map +1 -0
- package/dist/templates/settings.d.ts +2 -0
- package/dist/templates/settings.d.ts.map +1 -0
- package/dist/templates/settings.js +66 -0
- package/dist/templates/settings.js.map +1 -0
- package/dist/templates/state.d.ts +2 -0
- package/dist/templates/state.d.ts.map +1 -0
- package/dist/templates/state.js +35 -0
- package/dist/templates/state.js.map +1 -0
- package/dist/templates/storage.d.ts +4 -0
- package/dist/templates/storage.d.ts.map +1 -0
- package/dist/templates/storage.js +121 -0
- package/dist/templates/storage.js.map +1 -0
- package/dist/templates.d.ts +2 -0
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +4 -1
- package/dist/templates.js.map +1 -1
- package/dist/utils/ast/modify-app-component.d.ts +2 -0
- package/dist/utils/ast/modify-app-component.d.ts.map +1 -0
- package/dist/utils/ast/modify-app-component.js +136 -0
- package/dist/utils/ast/modify-app-component.js.map +1 -0
- package/dist/utils/ast.d.ts +20 -0
- package/dist/utils/ast.d.ts.map +1 -0
- package/dist/utils/ast.js +95 -0
- package/dist/utils/ast.js.map +1 -0
- package/dist/utils/configurators/angular.d.ts +2 -0
- package/dist/utils/configurators/angular.d.ts.map +1 -0
- package/dist/utils/configurators/angular.js +28 -0
- package/dist/utils/configurators/angular.js.map +1 -0
- package/dist/utils/configurators/electron.d.ts +2 -0
- package/dist/utils/configurators/electron.d.ts.map +1 -0
- package/dist/utils/configurators/electron.js +12 -0
- package/dist/utils/configurators/electron.js.map +1 -0
- package/dist/utils/configurators/meta.d.ts +5 -0
- package/dist/utils/configurators/meta.d.ts.map +1 -0
- package/dist/utils/configurators/meta.js +14 -0
- package/dist/utils/configurators/meta.js.map +1 -0
- package/dist/utils/configurators/package.d.ts +5 -0
- package/dist/utils/configurators/package.d.ts.map +1 -0
- package/dist/utils/configurators/package.js +23 -0
- package/dist/utils/configurators/package.js.map +1 -0
- package/dist/utils/engine.d.ts +9 -0
- package/dist/utils/engine.d.ts.map +1 -0
- package/dist/utils/engine.js +43 -0
- package/dist/utils/engine.js.map +1 -0
- package/dist/utils/files.d.ts +17 -0
- package/dist/utils/files.d.ts.map +1 -0
- package/dist/utils/files.js +41 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/logger.js +65 -1
- package/dist/utils/pipeline.d.ts +2 -0
- package/dist/utils/pipeline.d.ts.map +1 -0
- package/dist/utils/pipeline.js +69 -0
- package/dist/utils/pipeline.js.map +1 -0
- package/dist/utils/update.js +33 -1
- package/dist/utils/validation.js +12 -1
- package/package.json +3 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const nativePackageJson = `
|
|
2
|
+
{
|
|
3
|
+
"name": "native",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"main": "index.node",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "neon build --release",
|
|
8
|
+
"debug": "neon build --debug"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
export const nativeCargoToml = `
|
|
14
|
+
[package]
|
|
15
|
+
name = "native"
|
|
16
|
+
version = "0.1.0"
|
|
17
|
+
edition = "2021"
|
|
18
|
+
exclude = ["index.node"]
|
|
19
|
+
|
|
20
|
+
[lib]
|
|
21
|
+
name = "native"
|
|
22
|
+
crate-type = ["cdylib"]
|
|
23
|
+
|
|
24
|
+
[dependencies]
|
|
25
|
+
neon = "0.10"
|
|
26
|
+
`;
|
|
27
|
+
export const nativeLibRs = `
|
|
28
|
+
use neon::prelude::*;
|
|
29
|
+
|
|
30
|
+
fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
|
|
31
|
+
Ok(cx.string("Hello from Rust!"))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#[neon::main]
|
|
35
|
+
fn main(mut cx: ModuleContext) -> NeonResult<()> {
|
|
36
|
+
cx.export_function("hello", hello)?;
|
|
37
|
+
Ok(())
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
//# sourceMappingURL=native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../src/templates/native.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;CAWhC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;CAa9B,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;CAY1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phaser-scene.d.ts","sourceRoot":"","sources":["../../src/templates/phaser-scene.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,WAyBlE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const phaserSceneTemplate = (name, className) => `
|
|
2
|
+
import Phaser from 'phaser';
|
|
3
|
+
|
|
4
|
+
export class ${className} extends Phaser.Scene {
|
|
5
|
+
constructor() {
|
|
6
|
+
super({ key: '${className}' });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
preload() {
|
|
10
|
+
// Load assets
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
create() {
|
|
14
|
+
const { width, height } = this.scale;
|
|
15
|
+
|
|
16
|
+
this.add.text(width / 2, height / 2, 'Scene: ${name}', {
|
|
17
|
+
fontSize: '32px',
|
|
18
|
+
color: '#ffffff'
|
|
19
|
+
}).setOrigin(0.5);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
update(time: number, delta: number) {
|
|
23
|
+
// Game loop
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
//# sourceMappingURL=phaser-scene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phaser-scene.js","sourceRoot":"","sources":["../../src/templates/phaser-scene.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,SAAiB,EAAE,EAAE,CAAC;;;eAGzD,SAAS;;wBAEA,SAAS;;;;;;;;;;uDAUsB,IAAI;;;;;;;;;;CAU1D,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const phaserEngineServiceTemplate = "\nimport { Injectable, NgZone, ElementRef, OnDestroy, signal, WritableSignal } from '@angular/core';\nimport Phaser from 'phaser';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PhaserEngineService implements OnDestroy {\n public game: Phaser.Game | null = null;\n public fps: WritableSignal<string> = signal('0');\n public rotation: WritableSignal<string> = signal('2D Mode');\n \n private canvas: HTMLCanvasElement | null = null;\n\n constructor(private ngZone: NgZone) {}\n\n public initGame(canvas: HTMLCanvasElement) {\n this.canvas = canvas;\n this.ngZone.runOutsideAngular(() => {\n if (!this.game) {\n this.createGame();\n }\n });\n }\n\n private createGame() {\n if (!this.canvas) return;\n\n const config: Phaser.Types.Core.GameConfig = {\n type: Phaser.WEBGL,\n canvas: this.canvas,\n width: window.innerWidth,\n height: window.innerHeight,\n backgroundColor: '#0d0d0d', // Match 3D background\n physics: {\n default: 'arcade',\n arcade: {\n gravity: { x: 0, y: 0 },\n debug: false\n }\n },\n scene: [MainScene],\n scale: {\n mode: Phaser.Scale.RESIZE,\n autoCenter: Phaser.Scale.CENTER_BOTH\n },\n callbacks: {\n postBoot: (game) => {\n // Hook into the loop for stats\n const originalStep = game.loop.step;\n game.loop.step = (time: number, delta: number) => {\n originalStep.call(game.loop, time, delta);\n this.fps.set(game.loop.actualFps.toFixed(0));\n };\n }\n }\n };\n\n this.game = new Phaser.Game(config);\n \n window.addEventListener('resize', this.onResize.bind(this));\n }\n\n private onResize() {\n if (this.game) {\n this.game.scale.resize(window.innerWidth, window.innerHeight);\n }\n }\n\n ngOnDestroy(): void {\n if (this.game) {\n this.game.destroy(true);\n this.game = null;\n }\n window.removeEventListener('resize', this.onResize.bind(this));\n }\n}\n\nclass MainScene extends Phaser.Scene {\n private logoContainer!: Phaser.GameObjects.Container;\n\n constructor() {\n super({ key: 'MainScene' });\n }\n\n create() {\n const centerX = this.scale.width / 2;\n const centerY = this.scale.height / 2;\n\n this.logoContainer = this.add.container(centerX, centerY);\n\n // V Logo Graphics\n const graphics = this.add.graphics();\n \n // Glow effect (simulated with multiple overlapping strokes)\n graphics.lineStyle(4, 0x47848F, 0.3);\n this.drawV(graphics, 6); // Outer glow\n \n graphics.lineStyle(2, 0x47848F, 1);\n this.drawV(graphics, 0); // Main Stroke\n\n // Red Accent\n const accent = this.add.graphics();\n accent.lineStyle(2, 0xDD0031, 1);\n accent.beginPath();\n accent.moveTo(-50, 0);\n accent.lineTo(0, 100);\n accent.strokePath();\n\n this.logoContainer.add([graphics, accent]);\n\n // Text\n const text = this.add.text(0, 140, 'VALENCE 2D', {\n fontFamily: 'Segoe UI',\n fontSize: '32px',\n color: '#ffffff',\n align: 'center'\n }).setOrigin(0.5);\n \n const subtext = this.add.text(0, 180, 'Angular + Electron + Phaser', {\n fontFamily: 'Segoe UI',\n fontSize: '14px',\n color: '#888888',\n align: 'center'\n }).setOrigin(0.5);\n\n this.logoContainer.add([text, subtext]);\n }\n\n private drawV(graphics: Phaser.GameObjects.Graphics, offset: number) {\n // V Shape\n graphics.beginPath();\n graphics.moveTo(-50 - offset, -50 - offset);\n graphics.lineTo(0, 50 + offset);\n graphics.lineTo(50 + offset, -50 - offset);\n graphics.strokePath();\n }\n\n update() {\n if (this.logoContainer) {\n this.logoContainer.rotation = Math.sin(this.time.now / 1000) * 0.05;\n this.logoContainer.scale = 1 + Math.sin(this.time.now / 2000) * 0.02;\n }\n }\n}\n";
|
|
2
|
+
//# sourceMappingURL=phaser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phaser.d.ts","sourceRoot":"","sources":["../../src/templates/phaser.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,8nIAiJvC,CAAC"}
|
|
@@ -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"}
|
package/dist/templates.d.ts
CHANGED
package/dist/templates.d.ts.map
CHANGED
|
@@ -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"}
|