@decido/shell-vscode-core 1.0.0 → 4.0.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/CHANGELOG.md +31 -0
- package/README.md +31 -0
- package/package.json +2 -2
- package/dist/appState.d.ts +0 -23
- package/dist/appState.d.ts.map +0 -1
- package/dist/appState.js +0 -138
- package/dist/core/AIService.d.ts +0 -33
- package/dist/core/AIService.d.ts.map +0 -1
- package/dist/core/AIService.js +0 -73
- package/dist/core/ApiService.d.ts +0 -34
- package/dist/core/ApiService.d.ts.map +0 -1
- package/dist/core/ApiService.js +0 -32
- package/dist/core/AuthService.d.ts +0 -31
- package/dist/core/AuthService.d.ts.map +0 -1
- package/dist/core/AuthService.js +0 -56
- package/dist/core/BaseService.d.ts +0 -29
- package/dist/core/BaseService.d.ts.map +0 -1
- package/dist/core/BaseService.js +0 -33
- package/dist/core/CalendarService.d.ts +0 -15
- package/dist/core/CalendarService.d.ts.map +0 -1
- package/dist/core/CalendarService.js +0 -32
- package/dist/core/CommandService.d.ts +0 -25
- package/dist/core/CommandService.d.ts.map +0 -1
- package/dist/core/CommandService.js +0 -52
- package/dist/core/DebugPanelService.d.ts +0 -12
- package/dist/core/DebugPanelService.d.ts.map +0 -1
- package/dist/core/DebugPanelService.js +0 -29
- package/dist/core/DebugService.d.ts +0 -57
- package/dist/core/DebugService.d.ts.map +0 -1
- package/dist/core/DebugService.js +0 -134
- package/dist/core/EventBus.d.ts +0 -32
- package/dist/core/EventBus.d.ts.map +0 -1
- package/dist/core/EventBus.js +0 -51
- package/dist/core/EventHandler.d.ts +0 -3
- package/dist/core/EventHandler.d.ts.map +0 -1
- package/dist/core/EventHandler.js +0 -82
- package/dist/core/GamificationService.d.ts +0 -19
- package/dist/core/GamificationService.d.ts.map +0 -1
- package/dist/core/GamificationService.js +0 -102
- package/dist/core/HookService.d.ts +0 -34
- package/dist/core/HookService.d.ts.map +0 -1
- package/dist/core/HookService.js +0 -64
- package/dist/core/LayoutService.d.ts +0 -61
- package/dist/core/LayoutService.d.ts.map +0 -1
- package/dist/core/LayoutService.js +0 -223
- package/dist/core/ModalService.d.ts +0 -21
- package/dist/core/ModalService.d.ts.map +0 -1
- package/dist/core/ModalService.js +0 -71
- package/dist/core/NotificationService.d.ts +0 -7
- package/dist/core/NotificationService.d.ts.map +0 -1
- package/dist/core/NotificationService.js +0 -42
- package/dist/core/RouterService.d.ts +0 -13
- package/dist/core/RouterService.d.ts.map +0 -1
- package/dist/core/RouterService.js +0 -54
- package/dist/core/ServiceContainer.d.ts +0 -18
- package/dist/core/ServiceContainer.d.ts.map +0 -1
- package/dist/core/ServiceContainer.js +0 -27
- package/dist/core/ShortcutService.d.ts +0 -17
- package/dist/core/ShortcutService.d.ts.map +0 -1
- package/dist/core/ShortcutService.js +0 -37
- package/dist/core/StorageService.d.ts +0 -36
- package/dist/core/StorageService.d.ts.map +0 -1
- package/dist/core/StorageService.js +0 -101
- package/dist/core/ThemeService.d.ts +0 -12
- package/dist/core/ThemeService.d.ts.map +0 -1
- package/dist/core/ThemeService.js +0 -60
- package/dist/core/WebSocketService.d.ts +0 -16
- package/dist/core/WebSocketService.d.ts.map +0 -1
- package/dist/core/WebSocketService.js +0 -22
- package/dist/core/api.d.ts +0 -70
- package/dist/core/api.d.ts.map +0 -1
- package/dist/core/api.js +0 -1
- package/dist/core/app/ModuleManager copy.d.ts +0 -23
- package/dist/core/app/ModuleManager copy.js +0 -52
- package/dist/core/app/ModuleManager.d.ts +0 -60
- package/dist/core/app/ModuleManager.d.ts.map +0 -1
- package/dist/core/app/ModuleManager.js +0 -217
- package/dist/core/app/apiFactory.d.ts +0 -4
- package/dist/core/app/apiFactory.d.ts.map +0 -1
- package/dist/core/app/apiFactory.js +0 -120
- package/dist/core/app/commandManager.d.ts +0 -3
- package/dist/core/app/commandManager.d.ts.map +0 -1
- package/dist/core/app/commandManager.js +0 -195
- package/dist/core/app/moduleLoader.d.ts +0 -11
- package/dist/core/app/moduleLoader.d.ts.map +0 -1
- package/dist/core/app/moduleLoader.js +0 -30
- package/dist/core/app/routeManager.d.ts +0 -2
- package/dist/core/app/routeManager.d.ts.map +0 -1
- package/dist/core/app/routeManager.js +0 -7
- package/dist/core/index.d.ts +0 -16
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -15
- package/dist/core/layout/dragDropManager.d.ts +0 -8
- package/dist/core/layout/dragDropManager.d.ts.map +0 -1
- package/dist/core/layout/dragDropManager.js +0 -8
- package/dist/core/layout/paneManager.d.ts +0 -7
- package/dist/core/layout/paneManager.d.ts.map +0 -1
- package/dist/core/layout/paneManager.js +0 -7
- package/dist/core/layout/renderer.d.ts +0 -8
- package/dist/core/layout/renderer.d.ts.map +0 -1
- package/dist/core/layout/renderer.js +0 -8
- package/dist/core/layout/resizeManager.d.ts +0 -5
- package/dist/core/layout/resizeManager.d.ts.map +0 -1
- package/dist/core/layout/resizeManager.js +0 -5
- package/dist/core/signals.d.ts +0 -20
- package/dist/core/signals.d.ts.map +0 -1
- package/dist/core/signals.js +0 -66
- package/dist/core/uiState.d.ts +0 -9
- package/dist/core/uiState.d.ts.map +0 -1
- package/dist/core/uiState.js +0 -11
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -15
- package/dist/lib/local-db.d.ts +0 -43
- package/dist/lib/local-db.d.ts.map +0 -1
- package/dist/lib/local-db.js +0 -23
- package/dist/lib/sync-service.d.ts +0 -7
- package/dist/lib/sync-service.d.ts.map +0 -1
- package/dist/lib/sync-service.js +0 -41
- package/dist/platform/ILayoutService.d.ts +0 -63
- package/dist/platform/ILayoutService.d.ts.map +0 -1
- package/dist/platform/ILayoutService.js +0 -1
- package/dist/platform/IRenderer.d.ts +0 -16
- package/dist/platform/IRenderer.d.ts.map +0 -1
- package/dist/platform/IRenderer.js +0 -1
- package/dist/platform/ServiceRegistry.d.ts +0 -43
- package/dist/platform/ServiceRegistry.d.ts.map +0 -1
- package/dist/platform/ServiceRegistry.js +0 -2
- package/dist/platform/extensionPoints.d.ts +0 -70
- package/dist/platform/extensionPoints.d.ts.map +0 -1
- package/dist/platform/extensionPoints.js +0 -22
- package/dist/platform/index.d.ts +0 -5
- package/dist/platform/index.d.ts.map +0 -1
- package/dist/platform/index.js +0 -4
- package/dist/stores/editorStore.d.ts +0 -5
- package/dist/stores/editorStore.d.ts.map +0 -1
- package/dist/stores/editorStore.js +0 -4
- package/dist/stores/gamificationStore.d.ts +0 -3
- package/dist/stores/gamificationStore.d.ts.map +0 -1
- package/dist/stores/gamificationStore.js +0 -2
- package/dist/stores/historyStore.d.ts +0 -12
- package/dist/stores/historyStore.d.ts.map +0 -1
- package/dist/stores/historyStore.js +0 -6
- package/dist/stores/workspaceStore.d.ts +0 -13
- package/dist/stores/workspaceStore.d.ts.map +0 -1
- package/dist/stores/workspaceStore.js +0 -6
- package/dist/types/app.d.ts +0 -31
- package/dist/types/app.d.ts.map +0 -1
- package/dist/types/app.js +0 -1
- package/dist/types/debug.d.ts +0 -68
- package/dist/types/debug.d.ts.map +0 -1
- package/dist/types/debug.js +0 -1
- package/dist/types/entities.d.ts +0 -42
- package/dist/types/entities.js +0 -2
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/modules.d.ts +0 -66
- package/dist/types/modules.js +0 -2
- package/dist/types/platform.d.ts +0 -95
- package/dist/types/platform.d.ts.map +0 -1
- package/dist/types/platform.js +0 -2
- package/dist/ui/Palette.d.ts +0 -38
- package/dist/ui/Palette.d.ts.map +0 -1
- package/dist/ui/Palette.js +0 -144
- package/dist/ui/debug-panel/dragAndResize.d.ts +0 -6
- package/dist/ui/debug-panel/dragAndResize.d.ts.map +0 -1
- package/dist/ui/debug-panel/dragAndResize.js +0 -140
- package/dist/ui/debug-panel/eventBinder.d.ts +0 -5
- package/dist/ui/debug-panel/eventBinder.d.ts.map +0 -1
- package/dist/ui/debug-panel/eventBinder.js +0 -120
- package/dist/ui/debug-panel/layoutManager.d.ts +0 -16
- package/dist/ui/debug-panel/layoutManager.d.ts.map +0 -1
- package/dist/ui/debug-panel/layoutManager.js +0 -73
- package/dist/ui/debug-panel/main.d.ts +0 -12
- package/dist/ui/debug-panel/main.d.ts.map +0 -1
- package/dist/ui/debug-panel/main.js +0 -42
- package/dist/ui/debug-panel/panelManager.d.ts +0 -17
- package/dist/ui/debug-panel/panelManager.d.ts.map +0 -1
- package/dist/ui/debug-panel/panelManager.js +0 -123
- package/dist/ui/debug-panel/renderer.d.ts +0 -4
- package/dist/ui/debug-panel/renderer.d.ts.map +0 -1
- package/dist/ui/debug-panel/renderer.js +0 -181
- package/dist/ui/debug-panel/services.d.ts +0 -4
- package/dist/ui/debug-panel/services.d.ts.map +0 -1
- package/dist/ui/debug-panel/services.js +0 -134
- package/dist/ui/debug-panel/settings.d.ts +0 -5
- package/dist/ui/debug-panel/settings.d.ts.map +0 -1
- package/dist/ui/debug-panel/settings.js +0 -35
- package/dist/ui/debug-panel/state.d.ts +0 -128
- package/dist/ui/debug-panel/state.d.ts.map +0 -1
- package/dist/ui/debug-panel/state.js +0 -42
- package/dist/ui/debug-panel/stateEditor.d.ts +0 -9
- package/dist/ui/debug-panel/stateEditor.d.ts.map +0 -1
- package/dist/ui/debug-panel/stateEditor.js +0 -158
- package/dist/ui/debug-panel/types.d.ts +0 -68
- package/dist/ui/debug-panel/types.d.ts.map +0 -1
- package/dist/ui/debug-panel/types.js +0 -1
- package/dist/ui/debug-panel/ui.d.ts +0 -10
- package/dist/ui/debug-panel/ui.d.ts.map +0 -1
- package/dist/ui/debug-panel/ui.js +0 -199
- package/dist/ui/debug-panel/utils.d.ts +0 -16
- package/dist/ui/debug-panel/utils.d.ts.map +0 -1
- package/dist/ui/debug-panel/utils.js +0 -104
- package/dist/utils.d.ts +0 -22
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -58
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HookService.d.ts","sourceRoot":"","sources":["../../src/core/HookService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGrE,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzD;;;GAGG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,KAAK,CAA4C;IAEzD;;;;;OAKG;IACI,EAAE,CAAC,CAAC,SAAS,QAAQ,EACxB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACxC,MAAM,IAAI;IAUb;;OAEG;IACI,QAAQ,CAAC,CAAC,SAAS,QAAQ,EAC9B,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACxC,MAAM,IAAI;IAIb;;;;OAIG;IACI,GAAG,CAAC,CAAC,SAAS,QAAQ,EACzB,QAAQ,EAAE,CAAC,EACX,gBAAgB,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAChD,IAAI;IAaP;;;;OAIG;IACU,OAAO,CAAC,CAAC,SAAS,QAAQ,EACnC,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,IAAI,CAAC;CAenB"}
|
package/dist/core/HookService.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gestiona el registro y la ejecución de hooks de ciclo de vida de forma
|
|
3
|
-
* segura, asíncrona y desacoplada.
|
|
4
|
-
*/
|
|
5
|
-
export class HookService {
|
|
6
|
-
hooks = new Map();
|
|
7
|
-
/**
|
|
8
|
-
* Registra un callback para un hook y devuelve una función para desregistrarlo.
|
|
9
|
-
* @param hookName El nombre del hook al que suscribirse.
|
|
10
|
-
* @param callback La función a ejecutar cuando el hook se dispare.
|
|
11
|
-
* @returns Una función que, al llamarla, desuscribe el callback.
|
|
12
|
-
*/
|
|
13
|
-
on(hookName, callback) {
|
|
14
|
-
if (!this.hooks.has(hookName)) {
|
|
15
|
-
this.hooks.set(hookName, []);
|
|
16
|
-
}
|
|
17
|
-
this.hooks.get(hookName).push(callback);
|
|
18
|
-
// Devolvemos una función "disposer" para una fácil limpieza.
|
|
19
|
-
return () => this.off(hookName, callback);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Alias para el método `on`.
|
|
23
|
-
*/
|
|
24
|
-
register(hookName, callback) {
|
|
25
|
-
return this.on(hookName, callback);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Elimina un callback previamente registrado para un hook.
|
|
29
|
-
* @param hookName El nombre del hook.
|
|
30
|
-
* @param callbackToRemove La instancia exacta del callback a eliminar.
|
|
31
|
-
*/
|
|
32
|
-
off(hookName, callbackToRemove) {
|
|
33
|
-
const callbacks = this.hooks.get(hookName);
|
|
34
|
-
if (!callbacks)
|
|
35
|
-
return;
|
|
36
|
-
const updatedCallbacks = callbacks.filter(cb => cb !== callbackToRemove);
|
|
37
|
-
if (updatedCallbacks.length > 0) {
|
|
38
|
-
this.hooks.set(hookName, updatedCallbacks);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
this.hooks.delete(hookName);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Dispara un hook, ejecutando todos los callbacks registrados para él.
|
|
46
|
-
* @param hookName El nombre del hook a disparar.
|
|
47
|
-
* @param data Los datos a pasar a los callbacks.
|
|
48
|
-
*/
|
|
49
|
-
async trigger(hookName, data) {
|
|
50
|
-
const callbacks = this.hooks.get(hookName);
|
|
51
|
-
if (!callbacks || callbacks.length === 0)
|
|
52
|
-
return;
|
|
53
|
-
console.log(`🪝 Disparando hook: ${hookName}`, data);
|
|
54
|
-
// Hacemos una copia para evitar problemas si un callback desregistra a otro
|
|
55
|
-
for (const callback of [...callbacks]) {
|
|
56
|
-
try {
|
|
57
|
-
await Promise.resolve(callback(data));
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
console.error(`Error en un callback del hook '${hookName}':`, error);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { IPlatformAPI } from './api';
|
|
2
|
-
import { ILayoutService } from '../platform/ILayoutService';
|
|
3
|
-
import { Signal } from './signals';
|
|
4
|
-
export declare class LayoutService implements ILayoutService {
|
|
5
|
-
api: IPlatformAPI;
|
|
6
|
-
state: {
|
|
7
|
-
activeActivityId: Signal<string>;
|
|
8
|
-
isSidebarVisible: Signal<boolean>;
|
|
9
|
-
isSidebarRightVisible: Signal<boolean>;
|
|
10
|
-
isPanelVisible: Signal<boolean>;
|
|
11
|
-
activePanelId: Signal<string>;
|
|
12
|
-
activeSidebarRightId: Signal<string>;
|
|
13
|
-
panelHeight: Signal<number>;
|
|
14
|
-
sidebarWidth: Signal<number>;
|
|
15
|
-
sidebarRightWidth: Signal<number>;
|
|
16
|
-
};
|
|
17
|
-
dom: {
|
|
18
|
-
appGrid: HTMLElement | null;
|
|
19
|
-
mainContent: HTMLElement | null;
|
|
20
|
-
activityBar: HTMLElement | null;
|
|
21
|
-
sidebarContainer: HTMLElement | null;
|
|
22
|
-
sidebarRightContainer: HTMLElement | null;
|
|
23
|
-
panelContainer: HTMLElement | null;
|
|
24
|
-
panelResizeHandle: HTMLElement | null;
|
|
25
|
-
sidebarResizeHandle: HTMLElement | null;
|
|
26
|
-
sidebarRightResizeHandle: HTMLElement | null;
|
|
27
|
-
statusBarContainer: HTMLElement | null;
|
|
28
|
-
topBar: HTMLElement | null;
|
|
29
|
-
};
|
|
30
|
-
openTab: () => void;
|
|
31
|
-
closeTab: () => void;
|
|
32
|
-
setActiveTab: () => void;
|
|
33
|
-
setActivePane: () => void;
|
|
34
|
-
splitPane: () => void;
|
|
35
|
-
closePane: () => void;
|
|
36
|
-
renderMainContent: () => void;
|
|
37
|
-
renderActivityBar: () => void;
|
|
38
|
-
renderSidebar: () => void;
|
|
39
|
-
renderSidebarRight: () => void;
|
|
40
|
-
renderPanel: () => void;
|
|
41
|
-
renderStatusBar: () => void;
|
|
42
|
-
renderTopBar: () => void;
|
|
43
|
-
attachVerticalResizeHandler: () => void;
|
|
44
|
-
attachHorizontalResizeHandler: () => void;
|
|
45
|
-
handleResizeMouseMove: () => void;
|
|
46
|
-
handleResizeMouseUp: () => void;
|
|
47
|
-
registerActivityBarItem: (item: any) => void;
|
|
48
|
-
registerSidebarView: (view: any) => void;
|
|
49
|
-
registerSidebarRightView: (view: any) => void;
|
|
50
|
-
registerMainView: (view: any) => void;
|
|
51
|
-
registerPanelView: (view: any) => void;
|
|
52
|
-
registerStatusBarItem: (item: any) => void;
|
|
53
|
-
registerTopBarItem: (item: any) => void;
|
|
54
|
-
listenToEvents(): void;
|
|
55
|
-
initLayout(appContainer: HTMLElement): void;
|
|
56
|
-
activateEffects(): void;
|
|
57
|
-
initCommands(): void;
|
|
58
|
-
renderComponent(tag: string, options?: any): void;
|
|
59
|
-
_toggleUserMenu: (e: Event) => void;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=LayoutService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutService.d.ts","sourceRoot":"","sources":["../../src/core/LayoutService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAA8B,MAAM,EAAE,MAAM,WAAW,CAAC;AAW/D,qBAAa,aAAc,YAAW,cAAc;IAChD,GAAG,EAAG,YAAY,CAAC;IAEnB,KAAK;;;;;;;;;;MAUH;IAEF,GAAG;iBACkB,WAAW,GAAG,IAAI;qBACd,WAAW,GAAG,IAAI;qBAClB,WAAW,GAAG,IAAI;0BACb,WAAW,GAAG,IAAI;+BACb,WAAW,GAAG,IAAI;wBACzB,WAAW,GAAG,IAAI;2BACf,WAAW,GAAG,IAAI;6BAChB,WAAW,GAAG,IAAI;kCACb,WAAW,GAAG,IAAI;4BACxB,WAAW,GAAG,IAAI;gBAC9B,WAAW,GAAG,IAAI;MACpC;IAGF,OAAO,aAAW;IAClB,QAAQ,aAAY;IACpB,YAAY,aAAgB;IAC5B,aAAa,aAAiB;IAC9B,SAAS,aAAa;IACtB,SAAS,aAAa;IAEtB,iBAAiB,aAAgC;IACjD,iBAAiB,aAAgC;IACjD,aAAa,aAA4B;IACzC,kBAAkB,aAAiC;IACnD,WAAW,aAA0B;IACrC,eAAe,aAA8B;IAC7C,YAAY,aAA2B;IAEvC,2BAA2B,aAA+B;IAC1D,6BAA6B,aAAiC;IAC9D,qBAAqB,aAAyB;IAC9C,mBAAmB,aAAuB;IAO1C,uBAAuB,SAAU,GAAG,UAGlC;IACF,mBAAmB,SAAU,GAAG,UAG9B;IACF,wBAAwB,SAAU,GAAG,UAGnC;IACF,gBAAgB,SAAU,GAAG,UAG3B;IACF,iBAAiB,SAAU,GAAG,UAG5B;IACF,qBAAqB,SAAU,GAAG,UAGhC;IACF,kBAAkB,SAAU,GAAG,UAG7B;IAEF,cAAc;IAMd,UAAU,CAAC,YAAY,EAAE,WAAW;IAqCpC,eAAe;IAqBf,YAAY;IAsCZ,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ;IAwB9C,eAAe,MAAO,KAAK,UAQzB;CACL"}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { createSignal, createEffect } from './signals';
|
|
2
|
-
import { html } from '../utils';
|
|
3
|
-
import * as uiState from './uiState';
|
|
4
|
-
// Imports del layout (Managers)
|
|
5
|
-
// Estos archivos deben existir o ser recuperados
|
|
6
|
-
import { renderMainContent, renderActivityBar, renderSidebar, renderSidebarRight, renderPanel, renderStatusBar, renderTopBar } from './layout/renderer';
|
|
7
|
-
import { openTab, closeTab, setActiveTab, setActivePane, splitPane, closePane } from './layout/paneManager';
|
|
8
|
-
import { attachVerticalResizeHandler, attachHorizontalResizeHandler, handleResizeMouseMove, handleResizeMouseUp } from './layout/resizeManager';
|
|
9
|
-
// import { addDragDropListeners, handleDragStart, handleDragOver, handleDragLeave, handleDrop, handleDragEnd, cleanupDropVisuals } from './layout/dragDropManager';
|
|
10
|
-
export class LayoutService {
|
|
11
|
-
api;
|
|
12
|
-
state = {
|
|
13
|
-
activeActivityId: createSignal('dashboard'),
|
|
14
|
-
isSidebarVisible: createSignal(true),
|
|
15
|
-
isSidebarRightVisible: createSignal(false),
|
|
16
|
-
isPanelVisible: createSignal(false),
|
|
17
|
-
activePanelId: createSignal(''),
|
|
18
|
-
activeSidebarRightId: createSignal(''),
|
|
19
|
-
panelHeight: createSignal(250),
|
|
20
|
-
sidebarWidth: createSignal(280),
|
|
21
|
-
sidebarRightWidth: createSignal(350),
|
|
22
|
-
};
|
|
23
|
-
dom = {
|
|
24
|
-
appGrid: null,
|
|
25
|
-
mainContent: null,
|
|
26
|
-
activityBar: null,
|
|
27
|
-
sidebarContainer: null,
|
|
28
|
-
sidebarRightContainer: null,
|
|
29
|
-
panelContainer: null,
|
|
30
|
-
panelResizeHandle: null,
|
|
31
|
-
sidebarResizeHandle: null,
|
|
32
|
-
sidebarRightResizeHandle: null,
|
|
33
|
-
statusBarContainer: null,
|
|
34
|
-
topBar: null,
|
|
35
|
-
};
|
|
36
|
-
// Delegamos a los managers importados
|
|
37
|
-
openTab = openTab;
|
|
38
|
-
closeTab = closeTab;
|
|
39
|
-
setActiveTab = setActiveTab;
|
|
40
|
-
setActivePane = setActivePane;
|
|
41
|
-
splitPane = splitPane;
|
|
42
|
-
closePane = closePane;
|
|
43
|
-
renderMainContent = renderMainContent.bind(this);
|
|
44
|
-
renderActivityBar = renderActivityBar.bind(this);
|
|
45
|
-
renderSidebar = renderSidebar.bind(this);
|
|
46
|
-
renderSidebarRight = renderSidebarRight.bind(this);
|
|
47
|
-
renderPanel = renderPanel.bind(this);
|
|
48
|
-
renderStatusBar = renderStatusBar.bind(this);
|
|
49
|
-
renderTopBar = renderTopBar.bind(this);
|
|
50
|
-
attachVerticalResizeHandler = attachVerticalResizeHandler;
|
|
51
|
-
attachHorizontalResizeHandler = attachHorizontalResizeHandler;
|
|
52
|
-
handleResizeMouseMove = handleResizeMouseMove;
|
|
53
|
-
handleResizeMouseUp = handleResizeMouseUp;
|
|
54
|
-
// Drag and Drop (Comentado en JS original?)
|
|
55
|
-
// handleDragStart = handleDragStart;
|
|
56
|
-
// handleDragOver = handleDragOver;
|
|
57
|
-
// ...
|
|
58
|
-
registerActivityBarItem = (item) => {
|
|
59
|
-
const [get, set] = uiState.registeredActivityBarItems;
|
|
60
|
-
set({ ...get(), [item.id]: item });
|
|
61
|
-
};
|
|
62
|
-
registerSidebarView = (view) => {
|
|
63
|
-
const [get, set] = uiState.registeredSidebarViews;
|
|
64
|
-
set({ ...get(), [view.id]: view });
|
|
65
|
-
};
|
|
66
|
-
registerSidebarRightView = (view) => {
|
|
67
|
-
const [get, set] = uiState.registeredSidebarRightViews;
|
|
68
|
-
set({ ...get(), [view.id]: view });
|
|
69
|
-
};
|
|
70
|
-
registerMainView = (view) => {
|
|
71
|
-
const [get, set] = uiState.registeredMainViews;
|
|
72
|
-
set({ ...get(), [view.id]: view });
|
|
73
|
-
};
|
|
74
|
-
registerPanelView = (view) => {
|
|
75
|
-
const [get, set] = uiState.registeredPanelViews;
|
|
76
|
-
set({ ...get(), [view.id]: view });
|
|
77
|
-
};
|
|
78
|
-
registerStatusBarItem = (item) => {
|
|
79
|
-
const [get, set] = uiState.registeredStatusBarItems;
|
|
80
|
-
set({ ...get(), [item.id]: item });
|
|
81
|
-
};
|
|
82
|
-
registerTopBarItem = (item) => {
|
|
83
|
-
const [get, set] = uiState.registeredTopBarItems;
|
|
84
|
-
set({ ...get(), [item.id]: item });
|
|
85
|
-
};
|
|
86
|
-
listenToEvents() {
|
|
87
|
-
this.api.events.on('layout:toggle-sidebar', () => this.state.isSidebarVisible[1](!this.state.isSidebarVisible[0]()));
|
|
88
|
-
this.api.events.on('layout:toggle-sidebar-right', () => this.state.isSidebarRightVisible[1](!this.state.isSidebarRightVisible[0]()));
|
|
89
|
-
this.api.events.on('layout:toggle-panel', () => this.state.isPanelVisible[1](!this.state.isPanelVisible[0]()));
|
|
90
|
-
}
|
|
91
|
-
initLayout(appContainer) {
|
|
92
|
-
appContainer.innerHTML = html `
|
|
93
|
-
<div id="app-grid-layout">
|
|
94
|
-
<div id="app-top-bar"></div>
|
|
95
|
-
<div id="app-activity-bar"></div>
|
|
96
|
-
<div id="app-sidebar"></div>
|
|
97
|
-
<div id="app-sidebar-resizer" class="sidebar-resizer v-resizer"></div>
|
|
98
|
-
<main id="app-main"></main>
|
|
99
|
-
<div id="app-sidebar-right-resizer" class="sidebar-resizer v-resizer"></div>
|
|
100
|
-
<div id="app-sidebar-right"></div>
|
|
101
|
-
<div id="app-panel-resize-handle" class="h-resizer"></div>
|
|
102
|
-
<div id="app-panel"></div>
|
|
103
|
-
<div id="app-status-bar"></div>
|
|
104
|
-
</div>
|
|
105
|
-
`;
|
|
106
|
-
this.dom.appGrid = document.getElementById('app-grid-layout');
|
|
107
|
-
this.dom.mainContent = document.getElementById('app-main');
|
|
108
|
-
this.dom.activityBar = document.getElementById('app-activity-bar');
|
|
109
|
-
this.dom.sidebarContainer = document.getElementById('app-sidebar');
|
|
110
|
-
this.dom.sidebarRightContainer = document.getElementById('app-sidebar-right');
|
|
111
|
-
this.dom.sidebarResizeHandle = document.getElementById('app-sidebar-resizer');
|
|
112
|
-
this.dom.sidebarRightResizeHandle = document.getElementById('app-sidebar-right-resizer');
|
|
113
|
-
this.dom.panelResizeHandle = document.getElementById('app-panel-resize-handle');
|
|
114
|
-
this.dom.panelContainer = document.getElementById('app-panel');
|
|
115
|
-
this.dom.statusBarContainer = document.getElementById('app-status-bar');
|
|
116
|
-
this.dom.topBar = document.getElementById('app-top-bar');
|
|
117
|
-
this.attachVerticalResizeHandler();
|
|
118
|
-
this.attachHorizontalResizeHandler(this.dom.sidebarResizeHandle, 'left');
|
|
119
|
-
this.attachHorizontalResizeHandler(this.dom.sidebarRightResizeHandle, 'right');
|
|
120
|
-
// Bindings
|
|
121
|
-
this.handleResizeMouseMove = this.handleResizeMouseMove.bind(this);
|
|
122
|
-
this.handleResizeMouseUp = this.handleResizeMouseUp.bind(this);
|
|
123
|
-
}
|
|
124
|
-
activateEffects() {
|
|
125
|
-
createEffect(this.renderMainContent.bind(this));
|
|
126
|
-
createEffect(this.renderActivityBar.bind(this));
|
|
127
|
-
createEffect(this.renderSidebar.bind(this));
|
|
128
|
-
createEffect(this.renderSidebarRight.bind(this));
|
|
129
|
-
createEffect(() => {
|
|
130
|
-
if (!this.dom.appGrid)
|
|
131
|
-
return;
|
|
132
|
-
this.dom.appGrid.classList.toggle('sidebar-hidden', !this.state.isSidebarVisible[0]());
|
|
133
|
-
this.dom.appGrid.classList.toggle('sidebar-right-hidden', !this.state.isSidebarRightVisible[0]());
|
|
134
|
-
this.dom.appGrid.classList.toggle('panel-hidden', !this.state.isPanelVisible[0]());
|
|
135
|
-
});
|
|
136
|
-
createEffect(this.renderPanel.bind(this));
|
|
137
|
-
createEffect(this.renderStatusBar.bind(this));
|
|
138
|
-
createEffect(this.renderTopBar.bind(this));
|
|
139
|
-
createEffect(() => {
|
|
140
|
-
document.documentElement.style.setProperty('--panel-height', `${this.state.panelHeight[0]()}px`);
|
|
141
|
-
document.documentElement.style.setProperty('--sidebar-width', `${this.state.sidebarWidth[0]()}px`);
|
|
142
|
-
document.documentElement.style.setProperty('--sidebar-right-width', `${this.state.sidebarRightWidth[0]()}px`);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
initCommands() {
|
|
146
|
-
this.api.commands.register({ id: 'workbench.closeTab', title: 'Cerrar Pestaña', execute: (_api, args) => this.closeTab(args.tabId, args.paneId) });
|
|
147
|
-
this.api.commands.register({ id: 'workbench.focusTab', title: 'Enfocar Pestaña', execute: (_api, args) => this.setActiveTab(args.tabId, args.paneId) });
|
|
148
|
-
this.api.commands.register({ id: 'workbench.splitEditor', title: 'Dividir Editor', execute: (_api, args) => this.splitPane(args.paneId, args.tab) });
|
|
149
|
-
this.api.commands.register({
|
|
150
|
-
id: 'layout.focusActivity', title: 'Enfocar Actividad', execute: (_api, activityId) => {
|
|
151
|
-
if (activityId)
|
|
152
|
-
this.state.activeActivityId[1](activityId);
|
|
153
|
-
if (!this.state.isSidebarVisible[0]())
|
|
154
|
-
this.state.isSidebarVisible[1](true);
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
this.api.commands.register({
|
|
158
|
-
id: 'layout.focusPanel', title: 'Enfocar Panel', execute: (_api, panelId) => {
|
|
159
|
-
if (panelId)
|
|
160
|
-
this.state.activePanelId[1](panelId);
|
|
161
|
-
if (!this.state.isPanelVisible[0]())
|
|
162
|
-
this.state.isPanelVisible[1](true);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
this.api.commands.register({
|
|
166
|
-
id: 'layout.toggleSidebarRight',
|
|
167
|
-
title: 'Mostrar/Ocultar Panel Derecho',
|
|
168
|
-
execute: () => this.api.events.emit('layout:toggle-sidebar-right')
|
|
169
|
-
});
|
|
170
|
-
this.api.commands.register({
|
|
171
|
-
id: 'layout.focusSidebarRight',
|
|
172
|
-
title: 'Enfocar Panel Derecho',
|
|
173
|
-
execute: (api, viewId) => {
|
|
174
|
-
if (!viewId)
|
|
175
|
-
return;
|
|
176
|
-
const [getVisible, setVisible] = api.layout.state.isSidebarRightVisible;
|
|
177
|
-
const [getActiveId, setActiveId] = api.layout.state.activeSidebarRightId;
|
|
178
|
-
if (getVisible() && getActiveId() === viewId) {
|
|
179
|
-
setVisible(false);
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
setActiveId(viewId);
|
|
183
|
-
setVisible(true);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
renderComponent(tag, options = {}) {
|
|
189
|
-
if (options.isFullscreen) {
|
|
190
|
-
const container = document.getElementById('fullscreen-view-container');
|
|
191
|
-
if (container) {
|
|
192
|
-
container.innerHTML = `<${tag}></${tag}>`;
|
|
193
|
-
}
|
|
194
|
-
const appContainer = document.getElementById('app');
|
|
195
|
-
if (appContainer)
|
|
196
|
-
appContainer.style.display = 'none';
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
const appContainer = document.getElementById('app');
|
|
200
|
-
if (appContainer)
|
|
201
|
-
appContainer.style.display = 'block';
|
|
202
|
-
const fullscreenContainer = document.getElementById('fullscreen-view-container');
|
|
203
|
-
if (fullscreenContainer)
|
|
204
|
-
fullscreenContainer.innerHTML = '';
|
|
205
|
-
const newTab = {
|
|
206
|
-
id: tag,
|
|
207
|
-
title: tag.replace(/-view$/, '').replace(/-/, ' '),
|
|
208
|
-
componentTag: tag,
|
|
209
|
-
icon: 'fas fa-cube'
|
|
210
|
-
};
|
|
211
|
-
this.openTab(newTab);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
_toggleUserMenu = (e) => {
|
|
215
|
-
e.stopPropagation();
|
|
216
|
-
const dropdown = this.dom.topBar?.querySelector('#user-menu-dropdown');
|
|
217
|
-
dropdown?.classList.toggle('hidden');
|
|
218
|
-
const closeMenu = () => dropdown?.classList.add('hidden');
|
|
219
|
-
if (!dropdown?.classList.contains('hidden')) {
|
|
220
|
-
window.addEventListener('click', closeMenu, { once: true });
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { TemplateResult } from "lit-html";
|
|
2
|
-
interface ModalOptions {
|
|
3
|
-
title: string;
|
|
4
|
-
content: string | HTMLElement | TemplateResult;
|
|
5
|
-
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
-
actions?: {
|
|
7
|
-
text: string;
|
|
8
|
-
type: 'primary' | 'secondary';
|
|
9
|
-
onClick: (close: () => void) => void;
|
|
10
|
-
}[];
|
|
11
|
-
}
|
|
12
|
-
export declare class ModalService {
|
|
13
|
-
private container;
|
|
14
|
-
constructor();
|
|
15
|
-
show(options: ModalOptions): {
|
|
16
|
-
close: () => void;
|
|
17
|
-
};
|
|
18
|
-
hide(): void;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=ModalService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalService.d.ts","sourceRoot":"","sources":["../../src/core/ModalService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,UAAU,YAAY;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,cAAc,CAAC;IAC/C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,SAAS,GAAG,WAAW,CAAC;QAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;KACxC,EAAE,CAAC;CACP;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,SAAS,CAAc;;IAQ/B,IAAI,CAAC,OAAO,EAAE,YAAY;;;IAkE1B,IAAI;CAMP"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { html } from "../utils.js";
|
|
2
|
-
export class ModalService {
|
|
3
|
-
container;
|
|
4
|
-
constructor() {
|
|
5
|
-
this.container = document.createElement('div');
|
|
6
|
-
this.container.id = 'modal-container';
|
|
7
|
-
document.body.appendChild(this.container);
|
|
8
|
-
}
|
|
9
|
-
show(options) {
|
|
10
|
-
this.hide(); // Cierra cualquier modal existente antes de mostrar uno nuevo
|
|
11
|
-
const modalId = `modal_${Date.now()}`;
|
|
12
|
-
const sizeClasses = {
|
|
13
|
-
sm: 'max-w-md',
|
|
14
|
-
md: 'max-w-lg',
|
|
15
|
-
lg: 'max-w-2xl',
|
|
16
|
-
xl: 'max-w-4xl',
|
|
17
|
-
};
|
|
18
|
-
const modalWrapper = document.createElement('div');
|
|
19
|
-
modalWrapper.id = modalId;
|
|
20
|
-
modalWrapper.className = 'fixed inset-0 bg-darker/80 backdrop-blur-sm flex items-center justify-center z-50';
|
|
21
|
-
modalWrapper.innerHTML = html `
|
|
22
|
-
<div class="glass-premium p-8 rounded-2xl w-full ${sizeClasses[options.size || 'md']} animate-scale-in">
|
|
23
|
-
<div class="flex justify-between items-center mb-6">
|
|
24
|
-
<h2 class="text-2xl font-bold text-white">${options.title}</h2>
|
|
25
|
-
<button class="text-muted-foreground hover:text-foreground text-2xl close-btn">×</button>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="modal-body"></div>
|
|
28
|
-
${options.actions && options.actions.length > 0 ? `
|
|
29
|
-
<div class="pt-6 border-t border-white/10 mt-6 text-right space-x-4 modal-footer">
|
|
30
|
-
</div>
|
|
31
|
-
` : ''}
|
|
32
|
-
</div>
|
|
33
|
-
`;
|
|
34
|
-
const closeModal = () => modalWrapper.remove();
|
|
35
|
-
// Contenido
|
|
36
|
-
const body = modalWrapper.querySelector('.modal-body');
|
|
37
|
-
if (typeof options.content === 'string') {
|
|
38
|
-
body.innerHTML = options.content;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
body.appendChild(options.content);
|
|
42
|
-
}
|
|
43
|
-
// Acciones (botones)
|
|
44
|
-
const footer = modalWrapper.querySelector('.modal-footer');
|
|
45
|
-
if (footer && options.actions) {
|
|
46
|
-
options.actions.forEach(action => {
|
|
47
|
-
const btn = document.createElement('button');
|
|
48
|
-
btn.textContent = action.text;
|
|
49
|
-
btn.className = action.type === 'primary' ? 'btn-premium' : 'btn-secondary'; // necesitarás .btn-secondary
|
|
50
|
-
btn.onclick = () => action.onClick(closeModal);
|
|
51
|
-
footer.appendChild(btn);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
modalWrapper.querySelector('.close-btn')?.addEventListener('click', closeModal);
|
|
55
|
-
modalWrapper.addEventListener('click', (e) => {
|
|
56
|
-
if (e.target === modalWrapper) {
|
|
57
|
-
closeModal();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
this.container.appendChild(modalWrapper);
|
|
61
|
-
return {
|
|
62
|
-
close: closeModal,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
hide() {
|
|
66
|
-
const modal = this.container.querySelector('.fixed');
|
|
67
|
-
if (modal) {
|
|
68
|
-
modal.remove();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type NotificationType = 'info' | 'success' | 'warning' | 'error' | 'achievement';
|
|
2
|
-
export declare class NotificationService {
|
|
3
|
-
container: HTMLElement;
|
|
4
|
-
constructor();
|
|
5
|
-
show(type: NotificationType, title: string, message: string, duration?: number): void;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=NotificationService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../src/core/NotificationService.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAExF,qBAAa,mBAAmB;IACrB,SAAS,EAAE,WAAW,CAAC;;IASvB,IAAI,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAa;CAoC9F"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// /src/core/NotificationService.ts (REDISENADO)
|
|
2
|
-
import { html } from "../utils.js";
|
|
3
|
-
export class NotificationService {
|
|
4
|
-
container;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.container = document.createElement('div');
|
|
7
|
-
this.container.id = 'notification-container';
|
|
8
|
-
this.container.className = 'fixed top-5 right-5 z-10000 w-96 space-y-3';
|
|
9
|
-
document.body.appendChild(this.container);
|
|
10
|
-
}
|
|
11
|
-
show(type, title, message, duration = 4000) {
|
|
12
|
-
const id = `notif_${Date.now()}`;
|
|
13
|
-
const notificationEl = document.createElement('div');
|
|
14
|
-
notificationEl.id = id;
|
|
15
|
-
const typeStyles = {
|
|
16
|
-
info: { icon: 'fas fa-info-circle', color: 'border-secondary' },
|
|
17
|
-
success: { icon: 'fas fa-check-circle', color: 'border-success' },
|
|
18
|
-
warning: { icon: 'fas fa-exclamation-triangle', color: 'border-accent' },
|
|
19
|
-
error: { icon: 'fas fa-times-circle', color: 'border-danger' },
|
|
20
|
-
achievement: { icon: 'fas fa-trophy', color: 'border-accent' },
|
|
21
|
-
};
|
|
22
|
-
const styles = typeStyles[type];
|
|
23
|
-
// Usamos la estética glass-card con un borde de color distintivo
|
|
24
|
-
notificationEl.innerHTML = html `
|
|
25
|
-
<div class="notification-item glass-card animate-slide-in-right border-l-4 ${styles.color}">
|
|
26
|
-
<i class="notification-icon ${styles.icon}"></i>
|
|
27
|
-
<div class="flex-grow">
|
|
28
|
-
<h4 class="notification-title">${title}</h4>
|
|
29
|
-
<p class="notification-message">${message}</p>
|
|
30
|
-
</div>
|
|
31
|
-
<button class="notification-close-btn" data-close-id="${id}">×</button>
|
|
32
|
-
</div>
|
|
33
|
-
`;
|
|
34
|
-
notificationEl.querySelector('.notification-close-btn')?.addEventListener('click', () => {
|
|
35
|
-
notificationEl.remove();
|
|
36
|
-
});
|
|
37
|
-
this.container.appendChild(notificationEl);
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
document.getElementById(id)?.remove();
|
|
40
|
-
}, duration);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IPlatformAPI } from './api.js';
|
|
2
|
-
import { RouteDefinition } from '../types';
|
|
3
|
-
export declare class RouterService {
|
|
4
|
-
private routes;
|
|
5
|
-
private api;
|
|
6
|
-
init(api: IPlatformAPI): void;
|
|
7
|
-
registerRoute(route: RouteDefinition): void;
|
|
8
|
-
navigate(path: string): void;
|
|
9
|
-
private _getCurrentHash;
|
|
10
|
-
handleRouteChange: () => void;
|
|
11
|
-
}
|
|
12
|
-
export declare const routerService: RouterService;
|
|
13
|
-
//# sourceMappingURL=RouterService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouterService.d.ts","sourceRoot":"","sources":["../../src/core/RouterService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,GAAG,CAAgB;IAEpB,IAAI,CAAC,GAAG,EAAE,YAAY;IAMtB,aAAa,CAAC,KAAK,EAAE,eAAe;IAIpC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAK5B,OAAO,CAAC,eAAe;IAIhB,iBAAiB,aAoCvB;CACJ;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// src/core/RouterService.ts
|
|
2
|
-
import { authService } from './AuthService.js';
|
|
3
|
-
export class RouterService {
|
|
4
|
-
routes = [];
|
|
5
|
-
api;
|
|
6
|
-
init(api) {
|
|
7
|
-
this.api = api;
|
|
8
|
-
window.addEventListener('hashchange', this.handleRouteChange);
|
|
9
|
-
// window.addEventListener('load', this.handleRouteChange);
|
|
10
|
-
}
|
|
11
|
-
registerRoute(route) {
|
|
12
|
-
this.routes.push(route);
|
|
13
|
-
}
|
|
14
|
-
navigate(path) {
|
|
15
|
-
window.location.hash = path;
|
|
16
|
-
}
|
|
17
|
-
// Centraliza la lectura del hash en un solo lugar.
|
|
18
|
-
_getCurrentHash() {
|
|
19
|
-
return window.location.hash.slice(1) || '/';
|
|
20
|
-
}
|
|
21
|
-
handleRouteChange = () => {
|
|
22
|
-
const path = this._getCurrentHash();
|
|
23
|
-
const route = this.routes.find(r => r.path === path);
|
|
24
|
-
const session = authService.session[0](); // Obtenemos el estado actual de la sesión
|
|
25
|
-
if (!route) {
|
|
26
|
-
// Ruta no encontrada, podríamos redirigir a una página 404
|
|
27
|
-
console.error(`Ruta no encontrada: ${path}`);
|
|
28
|
-
this.api.layout.renderComponent('not-found-view');
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
// --- LÓGICA DE GUARDIÁN DE NAVEGACIÓN ---
|
|
32
|
-
const isAuthenticated = session.status === 'authenticated';
|
|
33
|
-
// 1. Si la ruta es protegida y el usuario no está autenticado...
|
|
34
|
-
if (route.auth === 'protected' && !isAuthenticated) {
|
|
35
|
-
this.navigate('/login'); // ...redirige al login.
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
// 2. Si la ruta es solo para invitados (como login) y el usuario ya está autenticado...
|
|
39
|
-
if (route.auth === 'guestOnly' && isAuthenticated) {
|
|
40
|
-
this.navigate('/dashboard'); // ...redirige al dashboard.
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
// 3. (Futuro) Si la ruta requiere roles específicos...
|
|
44
|
-
// if (route.roles && !route.roles.some(role => session.user?.roles.includes(role))) {
|
|
45
|
-
// this.navigate('/forbidden'); // ...redirige a "Acceso Denegado".
|
|
46
|
-
// return;
|
|
47
|
-
// }
|
|
48
|
-
// Si todas las comprobaciones pasan, renderizamos el componente.
|
|
49
|
-
if (route.title)
|
|
50
|
-
document.title = `Decido - ${route.title}`;
|
|
51
|
-
this.api.layout.renderComponent(route.componentTag, { isFullscreen: route.isFullscreen });
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export const routerService = new RouterService();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ServiceKey, ServiceRegistry } from "../platform/ServiceRegistry.js";
|
|
2
|
-
/**
|
|
3
|
-
* Un contenedor de inyección de dependencias tipado y genérico.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ServiceContainer {
|
|
6
|
-
private services;
|
|
7
|
-
/**
|
|
8
|
-
* Registra una instancia de un servicio.
|
|
9
|
-
* El tipo es validado contra el `ServiceRegistry`.
|
|
10
|
-
*/
|
|
11
|
-
register<K extends ServiceKey>(key: K, instance: ServiceRegistry[K]): void;
|
|
12
|
-
/**
|
|
13
|
-
* Obtiene la instancia de un servicio registrado.
|
|
14
|
-
* El tipo de retorno es inferido automáticamente a partir de la clave.
|
|
15
|
-
*/
|
|
16
|
-
get<K extends ServiceKey>(key: K): ServiceRegistry[K];
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=ServiceContainer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceContainer.d.ts","sourceRoot":"","sources":["../../src/core/ServiceContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAE7E;;GAEG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAA8B;IAE9C;;;OAGG;IACI,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI;IAOjF;;;OAGG;IACI,GAAG,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;CAO/D"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Un contenedor de inyección de dependencias tipado y genérico.
|
|
3
|
-
*/
|
|
4
|
-
export class ServiceContainer {
|
|
5
|
-
services = new Map();
|
|
6
|
-
/**
|
|
7
|
-
* Registra una instancia de un servicio.
|
|
8
|
-
* El tipo es validado contra el `ServiceRegistry`.
|
|
9
|
-
*/
|
|
10
|
-
register(key, instance) {
|
|
11
|
-
if (this.services.has(key)) {
|
|
12
|
-
console.warn(`[ServiceContainer] El servicio '${key}' ya está registrado. Se sobrescribirá.`);
|
|
13
|
-
}
|
|
14
|
-
this.services.set(key, instance);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Obtiene la instancia de un servicio registrado.
|
|
18
|
-
* El tipo de retorno es inferido automáticamente a partir de la clave.
|
|
19
|
-
*/
|
|
20
|
-
get(key) {
|
|
21
|
-
const service = this.services.get(key);
|
|
22
|
-
if (!service) {
|
|
23
|
-
throw new Error(`[ServiceContainer] No se encontró servicio registrado con la clave: ${key}`);
|
|
24
|
-
}
|
|
25
|
-
return service;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IPlatformAPI } from "./api.js";
|
|
2
|
-
interface Shortcut {
|
|
3
|
-
id: string;
|
|
4
|
-
keys: string;
|
|
5
|
-
commandId: string;
|
|
6
|
-
commandArg?: any;
|
|
7
|
-
description?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class ShortcutService {
|
|
10
|
-
private api;
|
|
11
|
-
private shortcuts;
|
|
12
|
-
init(api: IPlatformAPI): void;
|
|
13
|
-
register(shortcut: Shortcut): void;
|
|
14
|
-
private handleKeyDown;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=ShortcutService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ShortcutService.d.ts","sourceRoot":"","sources":["../../src/core/ShortcutService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,QAAQ;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,eAAe;IACxB,OAAO,CAAC,GAAG,CAAgB;IAC3B,OAAO,CAAC,SAAS,CAAoC;IAE9C,IAAI,CAAC,GAAG,EAAE,YAAY;IAKtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ;IAMlC,OAAO,CAAC,aAAa;CAqBxB"}
|