feat(builder): add project editor

This commit is contained in:
sdarbinyan
2026-07-10 13:43:53 +04:00
parent 7161a81068
commit e2c8747fcc
50 changed files with 1656 additions and 42 deletions

View File

@@ -0,0 +1,13 @@
import { Injectable } from '@angular/core';
import { BootstrapConfig } from '../../../shared/models/config';
@Injectable({ providedIn: 'root' })
export class ProjectEditorIoService {
exportBootstrap(config: BootstrapConfig): string {
return JSON.stringify(config, null, 2);
}
importBootstrap(raw: string): BootstrapConfig {
return JSON.parse(raw) as BootstrapConfig;
}
}

View File

@@ -0,0 +1,20 @@
import { Injectable, inject } from '@angular/core';
import { Router } from '@angular/router';
import { BootstrapConfig } from '../../../shared/models/config';
import { PlatformRuntimeService } from '../../../core/runtime/platform-runtime.service';
import { LanguageService } from '../../../services/language.service';
import { UiRuntimeFacade } from '../../../facades/runtime/ui-runtime.facade';
@Injectable({ providedIn: 'root' })
export class ProjectEditorPreviewService {
private readonly runtime = inject(PlatformRuntimeService);
private readonly router = inject(Router);
private readonly languageService = inject(LanguageService);
private readonly uiRuntime = inject(UiRuntimeFacade);
preview(bootstrap: BootstrapConfig): void {
this.runtime.reloadFromBootstrap(bootstrap);
this.uiRuntime.reloadFromBootstrap(bootstrap);
void this.router.navigate([`/${this.languageService.currentLanguage()}`]);
}
}