@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,158 +0,0 @@
|
|
|
1
|
-
import { stateEditContext, setStateEditContext } from './state.js';
|
|
2
|
-
import { formatValue, parseValue } from './utils.js';
|
|
3
|
-
// ===================================================================
|
|
4
|
-
// Renderizado del Árbol de Estado
|
|
5
|
-
// ===================================================================
|
|
6
|
-
/**
|
|
7
|
-
* Función principal y recursiva que construye el árbol de estado en el DOM.
|
|
8
|
-
* Ya no depende de `DebugPanel`, recibe las dependencias que necesita.
|
|
9
|
-
*/
|
|
10
|
-
export function renderStateTree(data, container, settings, onStateChange, path = []) {
|
|
11
|
-
container.innerHTML = '';
|
|
12
|
-
if (typeof data !== 'object' || data === null) {
|
|
13
|
-
const valueEl = createEditableValue(data, path, settings, onStateChange);
|
|
14
|
-
container.appendChild(valueEl);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
Object.entries(data).forEach(([key, value]) => {
|
|
18
|
-
if (key.startsWith('_'))
|
|
19
|
-
return;
|
|
20
|
-
const currentPath = [...path, key];
|
|
21
|
-
const node = document.createElement('div');
|
|
22
|
-
node.className = 'tree-node';
|
|
23
|
-
const content = document.createElement('div');
|
|
24
|
-
content.className = 'tree-node-content';
|
|
25
|
-
const keySpan = document.createElement('span');
|
|
26
|
-
keySpan.className = 'tree-key';
|
|
27
|
-
keySpan.textContent = `${key}: `;
|
|
28
|
-
content.appendChild(keySpan);
|
|
29
|
-
const isObject = typeof value === 'object' && value !== null;
|
|
30
|
-
if (isObject && Object.keys(value).length > 0) {
|
|
31
|
-
node.classList.add('collapsible');
|
|
32
|
-
const childContainer = document.createElement('div');
|
|
33
|
-
childContainer.className = 'tree-child-container hidden';
|
|
34
|
-
const toggleBtn = document.createElement('button');
|
|
35
|
-
toggleBtn.className = 'tree-toggle-btn';
|
|
36
|
-
toggleBtn.innerHTML = '<i class="fas fa-chevron-right"></i>';
|
|
37
|
-
toggleBtn.addEventListener('click', (e) => {
|
|
38
|
-
e.stopPropagation();
|
|
39
|
-
const isExpanded = node.classList.toggle('expanded');
|
|
40
|
-
childContainer.classList.toggle('hidden');
|
|
41
|
-
toggleBtn.innerHTML = isExpanded ? '<i class="fas fa-chevron-down"></i>' : '<i class="fas fa-chevron-right"></i>';
|
|
42
|
-
// Lazy-rendering: renderiza los hijos solo al expandir por primera vez
|
|
43
|
-
if (isExpanded && !childContainer.hasChildNodes()) {
|
|
44
|
-
renderStateTree(value, childContainer, settings, onStateChange, currentPath);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
content.insertBefore(toggleBtn, keySpan);
|
|
48
|
-
const valueSpan = document.createElement('span');
|
|
49
|
-
valueSpan.className = 'tree-value-object';
|
|
50
|
-
valueSpan.textContent = Array.isArray(value) ? `[${value.length} items]` : `{${Object.keys(value).length} properties}`;
|
|
51
|
-
content.appendChild(valueSpan);
|
|
52
|
-
node.appendChild(content);
|
|
53
|
-
node.appendChild(childContainer);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
const valueEl = createEditableValue(value, currentPath, settings, onStateChange);
|
|
57
|
-
content.appendChild(valueEl);
|
|
58
|
-
node.appendChild(content);
|
|
59
|
-
}
|
|
60
|
-
container.appendChild(node);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
// ===================================================================
|
|
64
|
-
// Lógica de Edición de Valores (Conectada a Señales)
|
|
65
|
-
// ===================================================================
|
|
66
|
-
function createEditableValue(value, path, settings, onStateChange) {
|
|
67
|
-
const valueSpan = document.createElement('span');
|
|
68
|
-
valueSpan.className = `tree-value tree-value-${typeof value}`;
|
|
69
|
-
valueSpan.textContent = formatValue(value);
|
|
70
|
-
if (settings.enableStateEditing) {
|
|
71
|
-
valueSpan.classList.add('editable');
|
|
72
|
-
const editBtn = document.createElement('button');
|
|
73
|
-
editBtn.className = 'edit-value-btn';
|
|
74
|
-
editBtn.innerHTML = '<i class="fas fa-edit"></i>';
|
|
75
|
-
editBtn.title = 'Editar valor';
|
|
76
|
-
editBtn.addEventListener('click', (e) => {
|
|
77
|
-
e.stopPropagation();
|
|
78
|
-
startEditing(valueSpan, value, path, onStateChange, settings);
|
|
79
|
-
});
|
|
80
|
-
const wrapper = document.createElement('div');
|
|
81
|
-
wrapper.className = 'editable-value-wrapper';
|
|
82
|
-
wrapper.appendChild(valueSpan);
|
|
83
|
-
wrapper.appendChild(editBtn);
|
|
84
|
-
return wrapper;
|
|
85
|
-
}
|
|
86
|
-
return valueSpan;
|
|
87
|
-
}
|
|
88
|
-
function startEditing(element, originalValue, path, onStateChange, settings) {
|
|
89
|
-
if (stateEditContext()?.isEditing) {
|
|
90
|
-
cancelEditing();
|
|
91
|
-
}
|
|
92
|
-
setStateEditContext({ path, originalValue, isEditing: true, element });
|
|
93
|
-
element.contentEditable = 'true';
|
|
94
|
-
element.classList.add('editing');
|
|
95
|
-
element.focus();
|
|
96
|
-
document.execCommand('selectAll', false, undefined); // Seleccionar texto
|
|
97
|
-
const controls = document.createElement('div');
|
|
98
|
-
controls.className = 'edit-controls';
|
|
99
|
-
controls.innerHTML = `<button class="save-edit-btn">✔️</button><button class="cancel-edit-btn">❌</button>`;
|
|
100
|
-
element.parentElement?.appendChild(controls);
|
|
101
|
-
controls.querySelector('.save-edit-btn')?.addEventListener('click', () => saveEdit(onStateChange, settings));
|
|
102
|
-
controls.querySelector('.cancel-edit-btn')?.addEventListener('click', cancelEditing);
|
|
103
|
-
element.addEventListener('keydown', (e) => handleEditKeydown(e, onStateChange, settings));
|
|
104
|
-
element.addEventListener('blur', () => setTimeout(() => {
|
|
105
|
-
// Solo guardar si todavía estamos en modo de edición para este elemento
|
|
106
|
-
if (stateEditContext()?.element === element)
|
|
107
|
-
saveEdit(onStateChange, settings);
|
|
108
|
-
}, 100));
|
|
109
|
-
}
|
|
110
|
-
function handleEditKeydown(e, onStateChange, settings) {
|
|
111
|
-
if (e.key === 'Enter' && !e.shiftKey) {
|
|
112
|
-
e.preventDefault();
|
|
113
|
-
saveEdit(onStateChange, settings);
|
|
114
|
-
}
|
|
115
|
-
else if (e.key === 'Escape') {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
cancelEditing();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function saveEdit(onStateChange, _settings) {
|
|
121
|
-
const context = stateEditContext();
|
|
122
|
-
if (!context?.isEditing || !context.element)
|
|
123
|
-
return;
|
|
124
|
-
try {
|
|
125
|
-
const newValue = parseValue(context.element.textContent || '', context.originalValue);
|
|
126
|
-
onStateChange(context.path, newValue); // Usa el callback para actualizar el estado de la app
|
|
127
|
-
context.element.textContent = formatValue(newValue);
|
|
128
|
-
context.element.classList.add('edit-success');
|
|
129
|
-
setTimeout(() => context.element?.classList.remove('edit-success'), 1000);
|
|
130
|
-
finishEditing();
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
context.element.classList.add('edit-error');
|
|
134
|
-
context.element.title = `Error: ${error.message}`;
|
|
135
|
-
setTimeout(() => {
|
|
136
|
-
if (context.element) {
|
|
137
|
-
context.element.classList.remove('edit-error');
|
|
138
|
-
context.element.title = '';
|
|
139
|
-
}
|
|
140
|
-
}, 3000);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
export function cancelEditing() {
|
|
144
|
-
const context = stateEditContext();
|
|
145
|
-
if (!context?.isEditing || !context.element)
|
|
146
|
-
return;
|
|
147
|
-
context.element.textContent = formatValue(context.originalValue);
|
|
148
|
-
finishEditing();
|
|
149
|
-
}
|
|
150
|
-
function finishEditing() {
|
|
151
|
-
const context = stateEditContext();
|
|
152
|
-
if (!context?.element)
|
|
153
|
-
return;
|
|
154
|
-
context.element.contentEditable = 'false';
|
|
155
|
-
context.element.classList.remove('editing');
|
|
156
|
-
context.element.parentElement?.querySelector('.edit-controls')?.remove();
|
|
157
|
-
setStateEditContext(null); // Resetea la señal de estado de edición
|
|
158
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export type LogLevel = 'log' | 'info' | 'warn' | 'error';
|
|
2
|
-
export type DockPosition = 'left' | 'bottom' | 'right' | 'floating';
|
|
3
|
-
export type TabId = 'state' | 'history' | 'events' | 'console' | 'network' | 'performance';
|
|
4
|
-
export type PanelLayout = 'single' | 'split-horizontal' | 'split-vertical' | 'grid';
|
|
5
|
-
export interface ConsoleLog {
|
|
6
|
-
id: string;
|
|
7
|
-
type: LogLevel;
|
|
8
|
-
timestamp: Date;
|
|
9
|
-
message: any[];
|
|
10
|
-
stack?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface NetworkLog {
|
|
13
|
-
id: string;
|
|
14
|
-
url: string;
|
|
15
|
-
method: string;
|
|
16
|
-
status: number;
|
|
17
|
-
timestamp: Date;
|
|
18
|
-
duration: number;
|
|
19
|
-
size?: number;
|
|
20
|
-
error?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface PerformanceLog {
|
|
23
|
-
id: string;
|
|
24
|
-
name: string;
|
|
25
|
-
duration: number;
|
|
26
|
-
timestamp: Date;
|
|
27
|
-
type: 'navigation' | 'resource' | 'measure' | 'mark';
|
|
28
|
-
}
|
|
29
|
-
export interface EventLog {
|
|
30
|
-
id: string;
|
|
31
|
-
name: string;
|
|
32
|
-
data: any;
|
|
33
|
-
timestamp: Date;
|
|
34
|
-
direction: 'emitted' | 'received';
|
|
35
|
-
}
|
|
36
|
-
export interface PanelInstance {
|
|
37
|
-
id: string;
|
|
38
|
-
activeTab: TabId;
|
|
39
|
-
position: {
|
|
40
|
-
x: number;
|
|
41
|
-
y: number;
|
|
42
|
-
};
|
|
43
|
-
size: {
|
|
44
|
-
width: number;
|
|
45
|
-
height: number;
|
|
46
|
-
};
|
|
47
|
-
isMinimized: boolean;
|
|
48
|
-
zIndex: number;
|
|
49
|
-
}
|
|
50
|
-
export interface DebugSettings {
|
|
51
|
-
maxLogs: number;
|
|
52
|
-
autoScroll: boolean;
|
|
53
|
-
showTimestamps: boolean;
|
|
54
|
-
position: DockPosition;
|
|
55
|
-
isMinimized: boolean;
|
|
56
|
-
layout: PanelLayout;
|
|
57
|
-
panels: PanelInstance[];
|
|
58
|
-
enableStateEditing: boolean;
|
|
59
|
-
autoSaveState: boolean;
|
|
60
|
-
theme: 'dark' | 'light';
|
|
61
|
-
}
|
|
62
|
-
export interface StateEditContext {
|
|
63
|
-
path: string[];
|
|
64
|
-
originalValue: any;
|
|
65
|
-
isEditing: boolean;
|
|
66
|
-
element?: HTMLElement;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ui/debug-panel/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AACpE,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;AAC3F,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAEpF,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;CACxD;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACrC;AAED,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,KAAK,CAAC;IACjB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,EAAE,GAAG,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,WAAW,CAAC;CACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PanelInstance, DebugSettings } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Genera el esqueleto HTML completo para un panel, incluyendo el contenido estático de cada pestaña.
|
|
4
|
-
* Esta función es pura: recibe configuración y devuelve una cadena HTML.
|
|
5
|
-
* Ya no se necesita `initializePanelContent` porque todo se genera de una vez.
|
|
6
|
-
* @param config La configuración específica de este panel.
|
|
7
|
-
* @param settings La configuración general de la aplicación.
|
|
8
|
-
*/
|
|
9
|
-
export declare function generatePanelHTML(config: PanelInstance, settings: DebugSettings): string;
|
|
10
|
-
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/ui/debug-panel/ui.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAmB,MAAM,YAAY,CAAC;AAG3E;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,GAAG,MAAM,CA2DxF"}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { html } from '../../utils.js';
|
|
2
|
-
import { consoleFilter } from './state.js';
|
|
3
|
-
/**
|
|
4
|
-
* Genera el esqueleto HTML completo para un panel, incluyendo el contenido estático de cada pestaña.
|
|
5
|
-
* Esta función es pura: recibe configuración y devuelve una cadena HTML.
|
|
6
|
-
* Ya no se necesita `initializePanelContent` porque todo se genera de una vez.
|
|
7
|
-
* @param config La configuración específica de este panel.
|
|
8
|
-
* @param settings La configuración general de la aplicación.
|
|
9
|
-
*/
|
|
10
|
-
export function generatePanelHTML(config, settings) {
|
|
11
|
-
const tabs = [
|
|
12
|
-
{ id: 'state', label: 'Estado', icon: 'fas fa-sitemap' },
|
|
13
|
-
{ id: 'history', label: 'Historial', icon: 'fas fa-history' },
|
|
14
|
-
{ id: 'events', label: 'Eventos', icon: 'fas fa-bolt' },
|
|
15
|
-
{ id: 'console', label: 'Consola', icon: 'fas fa-terminal' },
|
|
16
|
-
{ id: 'network', label: 'Red', icon: 'fas fa-globe' },
|
|
17
|
-
{ id: 'performance', label: 'Perf', icon: 'fas fa-tachometer-alt' }
|
|
18
|
-
];
|
|
19
|
-
return html `
|
|
20
|
-
<div class="debug-header" data-panel-id="${config.id}">
|
|
21
|
-
<div class="debug-header-title">
|
|
22
|
-
<span class="debug-logo">🐞</span>
|
|
23
|
-
<span>DevTools</span>
|
|
24
|
-
<span class="debug-version">v2.0</span>
|
|
25
|
-
<span class="panel-id">#${config.id}</span>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="debug-controls">
|
|
28
|
-
<button class="control-btn" title="Layout" data-action="toggle-layout"><i class="fas fa-th"></i></button>
|
|
29
|
-
<button class="control-btn" title="Clonar Panel" data-action="clone-panel"><i class="fas fa-clone"></i></button>
|
|
30
|
-
<button class="control-btn" title="Configuración" data-action="toggle-settings"><i class="fas fa-cog"></i></button>
|
|
31
|
-
<button class="control-btn" title="Limpiar logs de la pestaña" data-action="clear-tab-logs"><i class="fas fa-trash"></i></button>
|
|
32
|
-
<button class="control-btn" title="Minimizar/Maximizar" data-action="toggle-minimized"><i class="fas ${config.isMinimized ? 'fa-window-maximize' : 'fa-window-minimize'}"></i></button>
|
|
33
|
-
<button class="control-btn" title="Cerrar" data-action="close-panel"><i class="fas fa-times"></i></button>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<div class="debug-tabs">
|
|
38
|
-
${tabs.map(tab => `
|
|
39
|
-
<button class="debug-tab ${tab.id === config.activeTab ? 'active' : ''}" data-action="activate-tab" data-tab="${tab.id}" title="${tab.label}">
|
|
40
|
-
<i class="${tab.icon}"></i>
|
|
41
|
-
<span>${tab.label}</span>
|
|
42
|
-
</button>
|
|
43
|
-
`).join('')}
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
<div class="debug-content-wrapper">
|
|
47
|
-
${tabs.map(tab => `
|
|
48
|
-
<div id="debug-panel-${config.id}-${tab.id}" class="debug-panel-content ${tab.id === config.activeTab ? 'active' : ''}">
|
|
49
|
-
${generateTabContentHTML(tab.id, config.id, settings)}
|
|
50
|
-
</div>
|
|
51
|
-
`).join('')}
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<div class="resize-handles">
|
|
55
|
-
<div class="resize-handle resize-handle-n" data-direction="n"></div>
|
|
56
|
-
<div class="resize-handle resize-handle-s" data-direction="s"></div>
|
|
57
|
-
<div class="resize-handle resize-handle-e" data-direction="e"></div>
|
|
58
|
-
<div class="resize-handle resize-handle-w" data-direction="w"></div>
|
|
59
|
-
<div class="resize-handle resize-handle-ne" data-direction="ne"></div>
|
|
60
|
-
<div class="resize-handle resize-handle-nw" data-direction="nw"></div>
|
|
61
|
-
<div class="resize-handle resize-handle-se" data-direction="se"></div>
|
|
62
|
-
<div class="resize-handle resize-handle-sw" data-direction="sw"></div>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<div class="settings-panel hidden">${generateSettingsHTML(settings)}</div>
|
|
66
|
-
<div class="layout-panel hidden">${generateLayoutHTML()}</div>
|
|
67
|
-
`;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Función de ayuda que devuelve el HTML interno para una pestaña específica.
|
|
71
|
-
* Esto reemplaza la necesidad de la función `initializePanelContent` de V1.
|
|
72
|
-
*/
|
|
73
|
-
function generateTabContentHTML(tabId, panelId, settings) {
|
|
74
|
-
switch (tabId) {
|
|
75
|
-
case 'state':
|
|
76
|
-
return html `
|
|
77
|
-
<div class="panel-header">
|
|
78
|
-
<h4>🏗️ Estado de la Aplicación</h4>
|
|
79
|
-
</div>
|
|
80
|
-
<div class="state-tree-container">
|
|
81
|
-
<div class="state-tree"></div>
|
|
82
|
-
</div>`;
|
|
83
|
-
case 'history':
|
|
84
|
-
return html `
|
|
85
|
-
<div class="panel-header">
|
|
86
|
-
<h4>📜 Historial de Cambios</h4>
|
|
87
|
-
</div>
|
|
88
|
-
<div class="scroll-content history-list"></div>`;
|
|
89
|
-
case 'console':
|
|
90
|
-
// Leemos el estado inicial del filtro para renderizar los checkboxes correctamente
|
|
91
|
-
const activeFilters = consoleFilter();
|
|
92
|
-
return html `
|
|
93
|
-
<div class="panel-header">
|
|
94
|
-
<h4>📝 Consola</h4>
|
|
95
|
-
<div class="console-filters">
|
|
96
|
-
${['log', 'info', 'warn', 'error'].map(level => `
|
|
97
|
-
<label class="filter-label ${activeFilters.has(level) ? 'active' : ''}">
|
|
98
|
-
<input type="checkbox" data-level="${level}" ${activeFilters.has(level) ? 'checked' : ''}>
|
|
99
|
-
<span class="log-level-${level}">${level.toUpperCase()}</span>
|
|
100
|
-
</label>
|
|
101
|
-
`).join('')}
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
<div class="scroll-content console-logs"></div>`;
|
|
105
|
-
case 'network':
|
|
106
|
-
return html `
|
|
107
|
-
<div class="panel-header">
|
|
108
|
-
<h4>🌐 Requests de Red</h4>
|
|
109
|
-
<div class="network-filters">
|
|
110
|
-
<input type="text" class="network-filter-input" placeholder="Filtrar por URL...">
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="scroll-content network-logs"></div>`;
|
|
114
|
-
case 'events':
|
|
115
|
-
return html `
|
|
116
|
-
<div class="panel-header">
|
|
117
|
-
<h4>⚡ Sistema de Eventos</h4>
|
|
118
|
-
</div>
|
|
119
|
-
<div class="event-emitter">
|
|
120
|
-
<form id="debug-event-form-${panelId}" class="event-form">
|
|
121
|
-
<input name="eventName" placeholder="Nombre del evento" class="event-input" required>
|
|
122
|
-
<textarea name="eventData" placeholder='Payload JSON (opcional)' class="event-input"></textarea>
|
|
123
|
-
<button type="submit" class="btn btn-primary">
|
|
124
|
-
<i class="fas fa-paper-plane"></i> Emitir
|
|
125
|
-
</button>
|
|
126
|
-
</form>
|
|
127
|
-
</div>
|
|
128
|
-
<div class="scroll-content events-log"></div>`;
|
|
129
|
-
case 'performance':
|
|
130
|
-
return html `
|
|
131
|
-
<div class="panel-header">
|
|
132
|
-
<h4>⚡ Performance</h4>
|
|
133
|
-
</div>
|
|
134
|
-
<div class="performance-stats">
|
|
135
|
-
<div class="stat-card">
|
|
136
|
-
<div class="stat-value" id="memory-usage-${panelId}">--</div>
|
|
137
|
-
<div class="stat-label">Memoria (MB)</div>
|
|
138
|
-
</div>
|
|
139
|
-
<div class="stat-card">
|
|
140
|
-
<div class="stat-value" id="dom-nodes-${panelId}">--</div>
|
|
141
|
-
<div class="stat-label">Nodos DOM</div>
|
|
142
|
-
</div>
|
|
143
|
-
<div class="stat-card">
|
|
144
|
-
<div class="stat-value" id="fps-${panelId}">--</div>
|
|
145
|
-
<div class="stat-label">FPS</div>
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
<div class="scroll-content performance-logs"></div>`;
|
|
149
|
-
default:
|
|
150
|
-
return '';
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function generateLayoutHTML() {
|
|
154
|
-
return html `
|
|
155
|
-
<div class="layout-header">
|
|
156
|
-
<h3>📐 Layout</h3>
|
|
157
|
-
<button class="control-btn" data-action="toggle-layout"><i class="fas fa-times"></i></button>
|
|
158
|
-
</div>
|
|
159
|
-
<div class="layout-content">
|
|
160
|
-
<div class="layout-presets">
|
|
161
|
-
<button class="preset-btn" data-action="apply-layout" data-layout="single"><div class="preset-visual single"></div><span>Single</span></button>
|
|
162
|
-
<button class="preset-btn" data-action="apply-layout" data-layout="split-horizontal"><div class="preset-visual split-h"></div><span>Split H</span></button>
|
|
163
|
-
<button class="preset-btn" data-action="apply-layout" data-layout="split-vertical"><div class="preset-visual split-v"></div><span>Split V</span></button>
|
|
164
|
-
<button class="preset-btn" data-action="apply-layout" data-layout="grid"><div class="preset-visual grid"></div><span>Grid</span></button>
|
|
165
|
-
</div>
|
|
166
|
-
<div class="panel-actions">
|
|
167
|
-
<button class="btn btn-primary" data-action="new-panel"><i class="fas fa-plus"></i> Nuevo Panel</button>
|
|
168
|
-
<button class="btn btn-secondary" data-action="auto-arrange"><i class="fas fa-object-group"></i> Auto Organizar</button>
|
|
169
|
-
<button class="btn btn-secondary" data-action="reset-layout"><i class="fas fa-undo"></i> Reset Layout</button>
|
|
170
|
-
</div>
|
|
171
|
-
</div>`;
|
|
172
|
-
}
|
|
173
|
-
function generateSettingsHTML(settings) {
|
|
174
|
-
return html `
|
|
175
|
-
<div class="settings-header">
|
|
176
|
-
<h3>⚙️ Configuración</h3>
|
|
177
|
-
<button class="control-btn" data-action="toggle-settings"><i class="fas fa-times"></i></button>
|
|
178
|
-
</div>
|
|
179
|
-
<div class="settings-content">
|
|
180
|
-
<label><input type="checkbox" data-setting="autoScroll" ${settings.autoScroll ? 'checked' : ''}> Auto-scroll en logs</label>
|
|
181
|
-
<label><input type="checkbox" data-setting="showTimestamps" ${settings.showTimestamps ? 'checked' : ''}> Mostrar Timestamps</label>
|
|
182
|
-
<label><input type="checkbox" data-setting="enableStateEditing" ${settings.enableStateEditing ? 'checked' : ''}> Habilitar edición de estado</label>
|
|
183
|
-
<label>
|
|
184
|
-
<span>Tema:</span>
|
|
185
|
-
<select data-setting="theme">
|
|
186
|
-
<option value="dark" ${settings.theme === 'dark' ? 'selected' : ''}>Oscuro</option>
|
|
187
|
-
<option value="light" ${settings.theme === 'light' ? 'selected' : ''}>Claro</option>
|
|
188
|
-
</select>
|
|
189
|
-
</label>
|
|
190
|
-
<label>
|
|
191
|
-
<span>Max Logs:</span>
|
|
192
|
-
<input type="number" data-setting="maxLogs" value="${settings.maxLogs}" min="100" max="10000" step="100">
|
|
193
|
-
</label>
|
|
194
|
-
<div class="panel-actions">
|
|
195
|
-
<button class="btn-secondary" data-action="export-logs">Exportar Logs</button>
|
|
196
|
-
<button class="btn-secondary" data-action="export-state">Exportar Estado</button>
|
|
197
|
-
</div>
|
|
198
|
-
</div>`;
|
|
199
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { LogLevel } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Exporta todos los logs actuales a un archivo JSON.
|
|
4
|
-
* Ahora es una función autónoma que lee directamente de las señales de estado.
|
|
5
|
-
*/
|
|
6
|
-
export declare function exportLogs(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Exporta el estado actual de la aplicación a un archivo JSON.
|
|
9
|
-
* Función autónoma que lee el estado de la aplicación.
|
|
10
|
-
*/
|
|
11
|
-
export declare function exportState(): void;
|
|
12
|
-
export declare function formatValue(value: any): string;
|
|
13
|
-
export declare function parseValue(valueStr: string, originalValue: any): any;
|
|
14
|
-
export declare function getLogIcon(level: LogLevel): string;
|
|
15
|
-
export declare function formatLogMessage(message: any[]): string;
|
|
16
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/ui/debug-panel/utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAyBjC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAoBlC;AAOD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAK9C;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,GAAG,CAyBpE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAGlD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,CAOvD"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { consoleLogs, networkLogs, performanceLogs, eventLogs } from './state.js';
|
|
2
|
-
import { settings } from './main.js';
|
|
3
|
-
import * as appState from '../../appState.js';
|
|
4
|
-
import * as uiState from '../../core/uiState.js';
|
|
5
|
-
/**
|
|
6
|
-
* Exporta todos los logs actuales a un archivo JSON.
|
|
7
|
-
* Ahora es una función autónoma que lee directamente de las señales de estado.
|
|
8
|
-
*/
|
|
9
|
-
export function exportLogs() {
|
|
10
|
-
// 1. Obtiene los datos más recientes directamente de las señales.
|
|
11
|
-
const allLogs = {
|
|
12
|
-
console: consoleLogs(),
|
|
13
|
-
network: networkLogs(),
|
|
14
|
-
performance: performanceLogs(),
|
|
15
|
-
events: eventLogs(),
|
|
16
|
-
};
|
|
17
|
-
const exportData = {
|
|
18
|
-
timestamp: new Date().toISOString(),
|
|
19
|
-
logs: allLogs,
|
|
20
|
-
settings: settings() // Obtiene la configuración de su propia señal
|
|
21
|
-
};
|
|
22
|
-
// 2. El resto de la lógica para crear y descargar el archivo es la misma.
|
|
23
|
-
const blob = new Blob([JSON.stringify(exportData, null, 2)], {
|
|
24
|
-
type: 'application/json'
|
|
25
|
-
});
|
|
26
|
-
const url = URL.createObjectURL(blob);
|
|
27
|
-
const a = document.createElement('a');
|
|
28
|
-
a.href = url;
|
|
29
|
-
a.download = `debug-logs-${new Date().toISOString().slice(0, 19)}.json`;
|
|
30
|
-
a.click();
|
|
31
|
-
URL.revokeObjectURL(url);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Exporta el estado actual de la aplicación a un archivo JSON.
|
|
35
|
-
* Función autónoma que lee el estado de la aplicación.
|
|
36
|
-
*/
|
|
37
|
-
export function exportState() {
|
|
38
|
-
try {
|
|
39
|
-
const stateData = {
|
|
40
|
-
app: { ...appState }, // Ajusta esto según cómo expongas tu appState
|
|
41
|
-
ui: { ...uiState }, // Ajusta esto según cómo expongas tu uiState
|
|
42
|
-
timestamp: new Date().toISOString()
|
|
43
|
-
};
|
|
44
|
-
const blob = new Blob([JSON.stringify(stateData, null, 2)], {
|
|
45
|
-
type: 'application/json'
|
|
46
|
-
});
|
|
47
|
-
const url = URL.createObjectURL(blob);
|
|
48
|
-
const a = document.createElement('a');
|
|
49
|
-
a.href = url;
|
|
50
|
-
a.download = `app-state-${new Date().toISOString().slice(0, 19)}.json`;
|
|
51
|
-
a.click();
|
|
52
|
-
URL.revokeObjectURL(url);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
console.error('Error exporting state:', error);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// ===================================================================
|
|
59
|
-
// Funciones de Utilidad Puras (No necesitan cambios)
|
|
60
|
-
// ===================================================================
|
|
61
|
-
export function formatValue(value) {
|
|
62
|
-
if (typeof value === 'string') {
|
|
63
|
-
return `"${value}"`;
|
|
64
|
-
}
|
|
65
|
-
return JSON.stringify(value);
|
|
66
|
-
}
|
|
67
|
-
export function parseValue(valueStr, originalValue) {
|
|
68
|
-
const trimmed = valueStr.trim();
|
|
69
|
-
if (trimmed === 'true')
|
|
70
|
-
return true;
|
|
71
|
-
if (trimmed === 'false')
|
|
72
|
-
return false;
|
|
73
|
-
if (trimmed === 'null')
|
|
74
|
-
return null;
|
|
75
|
-
if (trimmed === 'undefined')
|
|
76
|
-
return undefined;
|
|
77
|
-
if (typeof originalValue === 'number') {
|
|
78
|
-
const num = Number(trimmed);
|
|
79
|
-
if (isNaN(num))
|
|
80
|
-
throw new Error('Invalid number');
|
|
81
|
-
return num;
|
|
82
|
-
}
|
|
83
|
-
if ((trimmed.startsWith('{') && trimmed.endsWith('}')) ||
|
|
84
|
-
(trimmed.startsWith('[') && trimmed.endsWith(']'))) {
|
|
85
|
-
return JSON.parse(trimmed);
|
|
86
|
-
}
|
|
87
|
-
if ((trimmed.startsWith('"') && trimmed.endsWith('"')) ||
|
|
88
|
-
(trimmed.startsWith("'") && trimmed.endsWith("'"))) {
|
|
89
|
-
return trimmed.slice(1, -1);
|
|
90
|
-
}
|
|
91
|
-
return trimmed;
|
|
92
|
-
}
|
|
93
|
-
export function getLogIcon(level) {
|
|
94
|
-
const icons = { log: '📝', info: 'ℹ️', warn: '⚠️', error: '❌' };
|
|
95
|
-
return icons[level];
|
|
96
|
-
}
|
|
97
|
-
export function formatLogMessage(message) {
|
|
98
|
-
return message.map(item => {
|
|
99
|
-
if (typeof item === 'object') {
|
|
100
|
-
return `<pre class="log-object">${JSON.stringify(item, null, 2)}</pre>`;
|
|
101
|
-
}
|
|
102
|
-
return String(item);
|
|
103
|
-
}).join(' ');
|
|
104
|
-
}
|
package/dist/utils.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formatea una cadena de fecha (ej: "2025-06-20") a un formato legible.
|
|
3
|
-
* @param {string} dateString - La fecha en formato YYYY-MM-DD.
|
|
4
|
-
* @returns {string} La fecha formateada (ej: "20 jun. 2025").
|
|
5
|
-
*/
|
|
6
|
-
export declare function formatDate(dateString?: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Función ficticia (dummy) para activar el resaltado de sintaxis de HTML
|
|
9
|
-
* en las plantillas de texto de VS Code. Simplemente reconstruye y devuelve
|
|
10
|
-
* la cadena de texto original.
|
|
11
|
-
* @param {TemplateStringsArray} strings
|
|
12
|
-
* @param {...any} values
|
|
13
|
-
* @returns {string}
|
|
14
|
-
*/
|
|
15
|
-
export declare function html(strings: any, ...values: any[]): string;
|
|
16
|
-
/**
|
|
17
|
-
* Hace que un elemento del DOM sea arrastrable usando un manejador.
|
|
18
|
-
* @param {HTMLElement} _element - El elemento a mover.
|
|
19
|
-
* @param {HTMLElement} _handle - El elemento que activa el arrastre.
|
|
20
|
-
*/
|
|
21
|
-
export declare function makeDraggable(_element: any, _handle: any): void;
|
|
22
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAStD;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,UAGlD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,QA0BxD"}
|
package/dist/utils.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// js/utils.js
|
|
2
|
-
/**
|
|
3
|
-
* Formatea una cadena de fecha (ej: "2025-06-20") a un formato legible.
|
|
4
|
-
* @param {string} dateString - La fecha en formato YYYY-MM-DD.
|
|
5
|
-
* @returns {string} La fecha formateada (ej: "20 jun. 2025").
|
|
6
|
-
*/
|
|
7
|
-
export function formatDate(dateString) {
|
|
8
|
-
if (!dateString)
|
|
9
|
-
return 'Sin fecha';
|
|
10
|
-
const date = new Date(dateString);
|
|
11
|
-
const userTimezoneOffset = date.getTimezoneOffset() * 60000;
|
|
12
|
-
return new Date(date.getTime() + userTimezoneOffset).toLocaleDateString('es-ES', {
|
|
13
|
-
year: 'numeric',
|
|
14
|
-
month: 'short',
|
|
15
|
-
day: 'numeric'
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Función ficticia (dummy) para activar el resaltado de sintaxis de HTML
|
|
20
|
-
* en las plantillas de texto de VS Code. Simplemente reconstruye y devuelve
|
|
21
|
-
* la cadena de texto original.
|
|
22
|
-
* @param {TemplateStringsArray} strings
|
|
23
|
-
* @param {...any} values
|
|
24
|
-
* @returns {string}
|
|
25
|
-
*/
|
|
26
|
-
export function html(strings, ...values) {
|
|
27
|
-
// String.raw es una forma segura y nativa de reconstruir la plantilla
|
|
28
|
-
return String.raw({ raw: strings }, ...values);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Hace que un elemento del DOM sea arrastrable usando un manejador.
|
|
32
|
-
* @param {HTMLElement} _element - El elemento a mover.
|
|
33
|
-
* @param {HTMLElement} _handle - El elemento que activa el arrastre.
|
|
34
|
-
*/
|
|
35
|
-
export function makeDraggable(_element, _handle) {
|
|
36
|
-
// let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
|
37
|
-
// handle.onmousedown = dragMouseDown;
|
|
38
|
-
// function dragMouseDown(e) {
|
|
39
|
-
// e.preventDefault();
|
|
40
|
-
// pos3 = e.clientX;
|
|
41
|
-
// pos4 = e.clientY;
|
|
42
|
-
// document.onmouseup = closeDragElement;
|
|
43
|
-
// document.onmousemove = elementDrag;
|
|
44
|
-
// }
|
|
45
|
-
// function elementDrag(e) {
|
|
46
|
-
// e.preventDefault();
|
|
47
|
-
// pos1 = pos3 - e.clientX;
|
|
48
|
-
// pos2 = pos4 - e.clientY;
|
|
49
|
-
// pos3 = e.clientX;
|
|
50
|
-
// pos4 = e.clientY;
|
|
51
|
-
// element.style.top = (element.offsetTop - pos2) + "px";
|
|
52
|
-
// element.style.left = (element.offsetLeft - pos1) + "px";
|
|
53
|
-
// }
|
|
54
|
-
// function closeDragElement() {
|
|
55
|
-
// document.onmouseup = null;
|
|
56
|
-
// document.onmousemove = null;
|
|
57
|
-
// }
|
|
58
|
-
}
|