@decido/shell-vscode-core 1.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/README.md +31 -0
  2. package/package.json +14 -13
  3. package/.turbo/turbo-build.log +0 -13
  4. package/dist/appState.d.ts +0 -23
  5. package/dist/appState.d.ts.map +0 -1
  6. package/dist/appState.js +0 -138
  7. package/dist/core/AIService.d.ts +0 -33
  8. package/dist/core/AIService.d.ts.map +0 -1
  9. package/dist/core/AIService.js +0 -73
  10. package/dist/core/ApiService.d.ts +0 -34
  11. package/dist/core/ApiService.d.ts.map +0 -1
  12. package/dist/core/ApiService.js +0 -32
  13. package/dist/core/AuthService.d.ts +0 -31
  14. package/dist/core/AuthService.d.ts.map +0 -1
  15. package/dist/core/AuthService.js +0 -56
  16. package/dist/core/BaseService.d.ts +0 -29
  17. package/dist/core/BaseService.d.ts.map +0 -1
  18. package/dist/core/BaseService.js +0 -33
  19. package/dist/core/CalendarService.d.ts +0 -15
  20. package/dist/core/CalendarService.d.ts.map +0 -1
  21. package/dist/core/CalendarService.js +0 -32
  22. package/dist/core/CommandService.d.ts +0 -25
  23. package/dist/core/CommandService.d.ts.map +0 -1
  24. package/dist/core/CommandService.js +0 -52
  25. package/dist/core/DebugPanelService.d.ts +0 -12
  26. package/dist/core/DebugPanelService.d.ts.map +0 -1
  27. package/dist/core/DebugPanelService.js +0 -29
  28. package/dist/core/DebugService.d.ts +0 -57
  29. package/dist/core/DebugService.d.ts.map +0 -1
  30. package/dist/core/DebugService.js +0 -134
  31. package/dist/core/EventBus.d.ts +0 -32
  32. package/dist/core/EventBus.d.ts.map +0 -1
  33. package/dist/core/EventBus.js +0 -51
  34. package/dist/core/EventHandler.d.ts +0 -3
  35. package/dist/core/EventHandler.d.ts.map +0 -1
  36. package/dist/core/EventHandler.js +0 -82
  37. package/dist/core/GamificationService.d.ts +0 -19
  38. package/dist/core/GamificationService.d.ts.map +0 -1
  39. package/dist/core/GamificationService.js +0 -102
  40. package/dist/core/HookService.d.ts +0 -34
  41. package/dist/core/HookService.d.ts.map +0 -1
  42. package/dist/core/HookService.js +0 -64
  43. package/dist/core/LayoutService.d.ts +0 -61
  44. package/dist/core/LayoutService.d.ts.map +0 -1
  45. package/dist/core/LayoutService.js +0 -223
  46. package/dist/core/ModalService.d.ts +0 -21
  47. package/dist/core/ModalService.d.ts.map +0 -1
  48. package/dist/core/ModalService.js +0 -71
  49. package/dist/core/NotificationService.d.ts +0 -7
  50. package/dist/core/NotificationService.d.ts.map +0 -1
  51. package/dist/core/NotificationService.js +0 -42
  52. package/dist/core/RouterService.d.ts +0 -13
  53. package/dist/core/RouterService.d.ts.map +0 -1
  54. package/dist/core/RouterService.js +0 -54
  55. package/dist/core/ServiceContainer.d.ts +0 -18
  56. package/dist/core/ServiceContainer.d.ts.map +0 -1
  57. package/dist/core/ServiceContainer.js +0 -27
  58. package/dist/core/ShortcutService.d.ts +0 -17
  59. package/dist/core/ShortcutService.d.ts.map +0 -1
  60. package/dist/core/ShortcutService.js +0 -37
  61. package/dist/core/StorageService.d.ts +0 -36
  62. package/dist/core/StorageService.d.ts.map +0 -1
  63. package/dist/core/StorageService.js +0 -101
  64. package/dist/core/ThemeService.d.ts +0 -12
  65. package/dist/core/ThemeService.d.ts.map +0 -1
  66. package/dist/core/ThemeService.js +0 -60
  67. package/dist/core/WebSocketService.d.ts +0 -16
  68. package/dist/core/WebSocketService.d.ts.map +0 -1
  69. package/dist/core/WebSocketService.js +0 -22
  70. package/dist/core/api.d.ts +0 -70
  71. package/dist/core/api.d.ts.map +0 -1
  72. package/dist/core/api.js +0 -1
  73. package/dist/core/app/ModuleManager copy.d.ts +0 -23
  74. package/dist/core/app/ModuleManager copy.js +0 -52
  75. package/dist/core/app/ModuleManager.d.ts +0 -60
  76. package/dist/core/app/ModuleManager.d.ts.map +0 -1
  77. package/dist/core/app/ModuleManager.js +0 -217
  78. package/dist/core/app/apiFactory.d.ts +0 -4
  79. package/dist/core/app/apiFactory.d.ts.map +0 -1
  80. package/dist/core/app/apiFactory.js +0 -120
  81. package/dist/core/app/commandManager.d.ts +0 -3
  82. package/dist/core/app/commandManager.d.ts.map +0 -1
  83. package/dist/core/app/commandManager.js +0 -195
  84. package/dist/core/app/moduleLoader.d.ts +0 -11
  85. package/dist/core/app/moduleLoader.d.ts.map +0 -1
  86. package/dist/core/app/moduleLoader.js +0 -30
  87. package/dist/core/app/routeManager.d.ts +0 -2
  88. package/dist/core/app/routeManager.d.ts.map +0 -1
  89. package/dist/core/app/routeManager.js +0 -7
  90. package/dist/core/index.d.ts +0 -16
  91. package/dist/core/index.d.ts.map +0 -1
  92. package/dist/core/index.js +0 -15
  93. package/dist/core/layout/dragDropManager.d.ts +0 -8
  94. package/dist/core/layout/dragDropManager.d.ts.map +0 -1
  95. package/dist/core/layout/dragDropManager.js +0 -8
  96. package/dist/core/layout/paneManager.d.ts +0 -7
  97. package/dist/core/layout/paneManager.d.ts.map +0 -1
  98. package/dist/core/layout/paneManager.js +0 -7
  99. package/dist/core/layout/renderer.d.ts +0 -8
  100. package/dist/core/layout/renderer.d.ts.map +0 -1
  101. package/dist/core/layout/renderer.js +0 -8
  102. package/dist/core/layout/resizeManager.d.ts +0 -5
  103. package/dist/core/layout/resizeManager.d.ts.map +0 -1
  104. package/dist/core/layout/resizeManager.js +0 -5
  105. package/dist/core/signals.d.ts +0 -20
  106. package/dist/core/signals.d.ts.map +0 -1
  107. package/dist/core/signals.js +0 -66
  108. package/dist/core/uiState.d.ts +0 -9
  109. package/dist/core/uiState.d.ts.map +0 -1
  110. package/dist/core/uiState.js +0 -11
  111. package/dist/index.d.ts +0 -17
  112. package/dist/index.d.ts.map +0 -1
  113. package/dist/index.js +0 -15
  114. package/dist/lib/local-db.d.ts +0 -43
  115. package/dist/lib/local-db.d.ts.map +0 -1
  116. package/dist/lib/local-db.js +0 -23
  117. package/dist/lib/sync-service.d.ts +0 -7
  118. package/dist/lib/sync-service.d.ts.map +0 -1
  119. package/dist/lib/sync-service.js +0 -41
  120. package/dist/platform/ILayoutService.d.ts +0 -63
  121. package/dist/platform/ILayoutService.d.ts.map +0 -1
  122. package/dist/platform/ILayoutService.js +0 -1
  123. package/dist/platform/IRenderer.d.ts +0 -16
  124. package/dist/platform/IRenderer.d.ts.map +0 -1
  125. package/dist/platform/IRenderer.js +0 -1
  126. package/dist/platform/ServiceRegistry.d.ts +0 -43
  127. package/dist/platform/ServiceRegistry.d.ts.map +0 -1
  128. package/dist/platform/ServiceRegistry.js +0 -2
  129. package/dist/platform/extensionPoints.d.ts +0 -70
  130. package/dist/platform/extensionPoints.d.ts.map +0 -1
  131. package/dist/platform/extensionPoints.js +0 -22
  132. package/dist/platform/index.d.ts +0 -5
  133. package/dist/platform/index.d.ts.map +0 -1
  134. package/dist/platform/index.js +0 -4
  135. package/dist/stores/editorStore.d.ts +0 -5
  136. package/dist/stores/editorStore.d.ts.map +0 -1
  137. package/dist/stores/editorStore.js +0 -4
  138. package/dist/stores/gamificationStore.d.ts +0 -3
  139. package/dist/stores/gamificationStore.d.ts.map +0 -1
  140. package/dist/stores/gamificationStore.js +0 -2
  141. package/dist/stores/historyStore.d.ts +0 -12
  142. package/dist/stores/historyStore.d.ts.map +0 -1
  143. package/dist/stores/historyStore.js +0 -6
  144. package/dist/stores/workspaceStore.d.ts +0 -13
  145. package/dist/stores/workspaceStore.d.ts.map +0 -1
  146. package/dist/stores/workspaceStore.js +0 -6
  147. package/dist/types/app.d.ts +0 -31
  148. package/dist/types/app.d.ts.map +0 -1
  149. package/dist/types/app.js +0 -1
  150. package/dist/types/debug.d.ts +0 -68
  151. package/dist/types/debug.d.ts.map +0 -1
  152. package/dist/types/debug.js +0 -1
  153. package/dist/types/entities.d.ts +0 -42
  154. package/dist/types/entities.js +0 -2
  155. package/dist/types/index.d.ts +0 -3
  156. package/dist/types/index.d.ts.map +0 -1
  157. package/dist/types/index.js +0 -3
  158. package/dist/types/modules.d.ts +0 -66
  159. package/dist/types/modules.js +0 -2
  160. package/dist/types/platform.d.ts +0 -95
  161. package/dist/types/platform.d.ts.map +0 -1
  162. package/dist/types/platform.js +0 -2
  163. package/dist/ui/Palette.d.ts +0 -38
  164. package/dist/ui/Palette.d.ts.map +0 -1
  165. package/dist/ui/Palette.js +0 -144
  166. package/dist/ui/debug-panel/dragAndResize.d.ts +0 -6
  167. package/dist/ui/debug-panel/dragAndResize.d.ts.map +0 -1
  168. package/dist/ui/debug-panel/dragAndResize.js +0 -140
  169. package/dist/ui/debug-panel/eventBinder.d.ts +0 -5
  170. package/dist/ui/debug-panel/eventBinder.d.ts.map +0 -1
  171. package/dist/ui/debug-panel/eventBinder.js +0 -120
  172. package/dist/ui/debug-panel/layoutManager.d.ts +0 -16
  173. package/dist/ui/debug-panel/layoutManager.d.ts.map +0 -1
  174. package/dist/ui/debug-panel/layoutManager.js +0 -73
  175. package/dist/ui/debug-panel/main.d.ts +0 -12
  176. package/dist/ui/debug-panel/main.d.ts.map +0 -1
  177. package/dist/ui/debug-panel/main.js +0 -42
  178. package/dist/ui/debug-panel/panelManager.d.ts +0 -17
  179. package/dist/ui/debug-panel/panelManager.d.ts.map +0 -1
  180. package/dist/ui/debug-panel/panelManager.js +0 -123
  181. package/dist/ui/debug-panel/renderer.d.ts +0 -4
  182. package/dist/ui/debug-panel/renderer.d.ts.map +0 -1
  183. package/dist/ui/debug-panel/renderer.js +0 -181
  184. package/dist/ui/debug-panel/services.d.ts +0 -4
  185. package/dist/ui/debug-panel/services.d.ts.map +0 -1
  186. package/dist/ui/debug-panel/services.js +0 -134
  187. package/dist/ui/debug-panel/settings.d.ts +0 -5
  188. package/dist/ui/debug-panel/settings.d.ts.map +0 -1
  189. package/dist/ui/debug-panel/settings.js +0 -35
  190. package/dist/ui/debug-panel/state.d.ts +0 -128
  191. package/dist/ui/debug-panel/state.d.ts.map +0 -1
  192. package/dist/ui/debug-panel/state.js +0 -42
  193. package/dist/ui/debug-panel/stateEditor.d.ts +0 -9
  194. package/dist/ui/debug-panel/stateEditor.d.ts.map +0 -1
  195. package/dist/ui/debug-panel/stateEditor.js +0 -158
  196. package/dist/ui/debug-panel/types.d.ts +0 -68
  197. package/dist/ui/debug-panel/types.d.ts.map +0 -1
  198. package/dist/ui/debug-panel/types.js +0 -1
  199. package/dist/ui/debug-panel/ui.d.ts +0 -10
  200. package/dist/ui/debug-panel/ui.d.ts.map +0 -1
  201. package/dist/ui/debug-panel/ui.js +0 -199
  202. package/dist/ui/debug-panel/utils.d.ts +0 -16
  203. package/dist/ui/debug-panel/utils.d.ts.map +0 -1
  204. package/dist/ui/debug-panel/utils.js +0 -104
  205. package/dist/utils.d.ts +0 -22
  206. package/dist/utils.d.ts.map +0 -1
  207. package/dist/utils.js +0 -58
  208. package/src/appState.ts +0 -167
  209. package/src/core/AIService.ts +0 -109
  210. package/src/core/ApiService.ts +0 -40
  211. package/src/core/AuthService.ts +0 -85
  212. package/src/core/BaseService.ts +0 -47
  213. package/src/core/CalendarService.ts +0 -44
  214. package/src/core/CommandService.ts +0 -69
  215. package/src/core/DebugPanelService.ts +0 -38
  216. package/src/core/DebugService.ts +0 -181
  217. package/src/core/EventBus.ts +0 -60
  218. package/src/core/EventHandler.ts +0 -97
  219. package/src/core/GamificationService.ts +0 -120
  220. package/src/core/HookService.ts +0 -86
  221. package/src/core/ModalService.ts +0 -97
  222. package/src/core/NotificationService.ts +0 -53
  223. package/src/core/RouterService.ts +0 -68
  224. package/src/core/ServiceContainer.ts +0 -31
  225. package/src/core/ShortcutService.ts +0 -49
  226. package/src/core/StorageService.ts +0 -123
  227. package/src/core/ThemeService.ts +0 -71
  228. package/src/core/WebSocketService.ts +0 -32
  229. package/src/core/api.ts +0 -78
  230. package/src/core/app/ModuleManager.ts +0 -273
  231. package/src/core/app/apiFactory.ts +0 -130
  232. package/src/core/app/commandManager.ts +0 -218
  233. package/src/core/app/moduleLoader.ts +0 -39
  234. package/src/core/app/routeManager.ts +0 -8
  235. package/src/core/index.ts +0 -15
  236. package/src/core/signals.ts +0 -84
  237. package/src/core/uiState.ts +0 -13
  238. package/src/index.ts +0 -18
  239. package/src/lib/local-db.ts +0 -65
  240. package/src/lib/sync-service.ts +0 -44
  241. package/src/platform/ILayoutService.ts +0 -77
  242. package/src/platform/IRenderer.ts +0 -16
  243. package/src/platform/ServiceRegistry.ts +0 -53
  244. package/src/platform/extensionPoints.ts +0 -202
  245. package/src/platform/index.ts +0 -4
  246. package/src/stores/editorStore.ts +0 -6
  247. package/src/stores/gamificationStore.ts +0 -4
  248. package/src/stores/historyStore.ts +0 -14
  249. package/src/stores/workspaceStore.ts +0 -8
  250. package/src/types/app.ts +0 -36
  251. package/src/types/debug.ts +0 -69
  252. package/src/types/index.ts +0 -3
  253. package/src/types/platform.ts +0 -112
  254. package/src/ui/Palette.ts +0 -161
  255. package/src/utils.ts +0 -63
  256. package/tsconfig.json +0 -23
package/src/types/app.ts DELETED
@@ -1,36 +0,0 @@
1
- // src/types/app.ts
2
- import { IPlatformAPI } from "../core/api";
3
-
4
- export type RouteAccess = 'public' | 'guestOnly' | 'protected';
5
-
6
- export interface RouteDefinition {
7
- path: string;
8
- componentTag: string;
9
- auth: RouteAccess;
10
- roles?: string[];
11
- title?: string;
12
- isFullscreen?: boolean;
13
- }
14
-
15
- export interface RegisteredComponent {
16
- name: string;
17
- icon: string;
18
- slot: 'sidebar-nav';
19
- order?: number;
20
- render: (container: HTMLElement, appContext: AppContext) => void;
21
- }
22
-
23
- export type AppContext = IPlatformAPI;
24
- export type ViewId = 'dashboard' | 'kanban' | 'goal-architect' | 'projects' | 'calendar' | 'journal' | 'resilience' | 'settings' | 'progress' | 'blueprint' | 'marketplace' | 'upload-module' | 'user-profile' | 'help' | 'about' | 'notifications';
25
-
26
- declare const HTML_RESULT = 1;
27
- declare const SVG_RESULT = 2;
28
- declare const MATHML_RESULT = 3;
29
- type ResultType = typeof HTML_RESULT | typeof SVG_RESULT | typeof MATHML_RESULT;
30
-
31
- export type UncompiledTemplateResult<T extends ResultType = ResultType> = {
32
- ['_$litType$']: T;
33
- strings: TemplateStringsArray;
34
- values: unknown[];
35
- };
36
- export type TemplateResult<T extends ResultType = ResultType> = UncompiledTemplateResult<T>;
@@ -1,69 +0,0 @@
1
- // Types
2
- export type LogLevel = 'log' | 'info' | 'warn' | 'error';
3
- export type DockPosition = 'left' | 'bottom' | 'right' | 'floating';
4
- export type TabId = 'state' | 'history' | 'events' | 'console' | 'network' | 'performance';
5
- export type PanelLayout = 'single' | 'split-horizontal' | 'split-vertical' | 'grid';
6
-
7
- export interface ConsoleLog {
8
- id: string;
9
- type: LogLevel;
10
- timestamp: Date;
11
- message: any[];
12
- stack?: string;
13
- }
14
-
15
- export interface NetworkLog {
16
- id: string;
17
- url: string;
18
- method: string;
19
- status: number;
20
- timestamp: Date;
21
- duration: number;
22
- size?: number;
23
- error?: string;
24
- }
25
-
26
- export interface PerformanceLog {
27
- id: string;
28
- name: string;
29
- duration: number;
30
- timestamp: Date;
31
- type: 'navigation' | 'resource' | 'measure' | 'mark';
32
- }
33
-
34
- export interface EventLog {
35
- id: string;
36
- name: string;
37
- data: any;
38
- timestamp: Date;
39
- direction: 'emitted' | 'received';
40
- }
41
-
42
- export interface PanelInstance {
43
- id: string;
44
- activeTab: TabId;
45
- position: { x: number; y: number };
46
- size: { width: number; height: number };
47
- isMinimized: boolean;
48
- zIndex: number;
49
- }
50
-
51
- export interface DebugSettings {
52
- maxLogs: number;
53
- autoScroll: boolean;
54
- showTimestamps: boolean;
55
- position: DockPosition;
56
- isMinimized: boolean;
57
- layout: PanelLayout;
58
- panels: PanelInstance[];
59
- enableStateEditing: boolean;
60
- autoSaveState: boolean;
61
- theme: 'dark' | 'light';
62
- }
63
-
64
- export interface StateEditContext {
65
- path: string[];
66
- originalValue: any;
67
- isEditing: boolean;
68
- element?: HTMLElement;
69
- }
@@ -1,3 +0,0 @@
1
- // src/types/index.ts
2
- export * from './app';
3
- export * from './platform';
@@ -1,112 +0,0 @@
1
- // --- Tipos de la UI del Workbench ---
2
-
3
- import { IPlatformAPI } from "../core/api";
4
- import { TemplateResult } from "./app";
5
- import React from 'react';
6
-
7
- export interface Pane {
8
- id: string;
9
- tabs: Tab[];
10
- activeTabId: string | null;
11
- }
12
-
13
- export interface Tab {
14
- id: string;
15
- title: string;
16
- componentTag: string;
17
- icon?: string;
18
- }
19
-
20
- // --- Tipos de Puntos de Contribución de la UI ---
21
-
22
- export interface ActivityBarItem {
23
- id: string;
24
- icon: string;
25
- title: string;
26
- viewId: string; // ID de la vista que se mostrará en el sidebar
27
- order?: number;
28
- command?: string; // Comando opcional a ejecutar en lugar del default
29
- commandArg?: any;
30
- }
31
-
32
- export interface SidebarView {
33
- id: string;
34
- title: string;
35
- render?: (container: HTMLElement, api: IPlatformAPI) => void;
36
- component?: React.ComponentType<any>;
37
- }
38
-
39
- export interface SidebarRightView {
40
- id: string;
41
- title: string;
42
- render?: (container: HTMLElement, api: IPlatformAPI) => void;
43
- component?: React.ComponentType<any>;
44
- }
45
-
46
- export interface MainView { // Opcional, si quieres registrar vistas principales
47
- id: string;
48
- render?: (container: HTMLElement, api: IPlatformAPI) => void;
49
- componentTag: string;
50
- component?: React.ComponentType<any>;
51
- }
52
-
53
- export interface PanelView {
54
- id: string;
55
- title: string;
56
- render?: (container: HTMLElement, api: IPlatformAPI) => void;
57
- component?: React.ComponentType<any>;
58
- }
59
-
60
- export interface StatusBarItem {
61
- id: string;
62
- render: (container: HTMLElement, api: IPlatformAPI) => void;
63
- alignment: 'left' | 'right';
64
- order?: number;
65
- }
66
-
67
- export interface TopBarItem {
68
- id: string;
69
- order?: number;
70
- // Para botones simples
71
- icon?: string;
72
- title?: string;
73
- commandId?: string;
74
- commandArg?: any;
75
- // Para componentes complejos
76
- render?: (api: IPlatformAPI) => TemplateResult;
77
- }
78
-
79
- export interface CalendarEvent {
80
- id: number;
81
- title: string;
82
- start: string; // Formato ISO: "2025-07-25T10:00:00"
83
- end: string; // Formato ISO: "2025-07-25T11:30:00"
84
- allDay: boolean;
85
- color: string; // Color del evento, puede heredar de un proyecto
86
- source?: {
87
- type: 'project' | 'task' | 'manual';
88
- id?: number;
89
- };
90
- }
91
-
92
- export interface GamificationAchievement {
93
- id: string;
94
- title: string;
95
- description: string;
96
- icon: string;
97
- conditionType: 'tasks_completed' | 'goals_created' | 'journal_streak' | 'level';
98
- conditionValue: number;
99
- reward_xp: number;
100
- isCustom?: boolean;
101
- isSuggested?: boolean;
102
- unlocked?: boolean;
103
- }
104
-
105
- export interface GamificationState {
106
- xp: number;
107
- level: number;
108
- streak: number;
109
- lastJournalDate: string | null;
110
- unlockedAchievements: string[];
111
- achievements: GamificationAchievement[];
112
- }
package/src/ui/Palette.ts DELETED
@@ -1,161 +0,0 @@
1
- // /src/ui/Palette.ts (VERSIÓN COMPLETA Y FUNCIONAL)
2
-
3
- import { IPlatformAPI } from '../core/api.js';
4
- import { Command } from '../core/CommandService.js';
5
- import { html } from '../utils.js';
6
-
7
- export class Palette {
8
- private api: IPlatformAPI;
9
- private dom: { [key: string]: HTMLElement | null } = {};
10
- private allCommands: Command[] = [];
11
- private filteredCommands: Command[] = [];
12
- private selectedIndex = 0;
13
-
14
- constructor(api: IPlatformAPI) {
15
- this.api = api;
16
- this.init();
17
- }
18
-
19
- /**
20
- * Alterna la visibilidad de la paleta.
21
- */
22
- public toggle() {
23
- const isHidden = this.dom.modal?.classList.contains('hidden');
24
- if (isHidden) this.show();
25
- else this.hide();
26
- }
27
-
28
- /**
29
- * Muestra la paleta, carga los comandos y enfoca el input.
30
- */
31
- private show() {
32
- this.allCommands = this.api.commands.getAll();
33
- this.filteredCommands = this.allCommands;
34
- this.selectedIndex = 0;
35
- this.renderResults();
36
- this.dom.modal?.classList.remove('hidden');
37
- (this.dom.input as HTMLInputElement)?.focus();
38
- }
39
-
40
- /**
41
- * Oculta la paleta y resetea el input.
42
- */
43
- private hide() {
44
- const input = this.dom.input as HTMLInputElement;
45
- if (input) input.value = '';
46
- this.dom.modal?.classList.add('hidden');
47
- }
48
-
49
- /**
50
- * Crea el HTML de la paleta y lo añade al DOM.
51
- */
52
- private init() {
53
- const paletteEl = document.createElement('div');
54
- paletteEl.id = 'command-palette-modal';
55
- paletteEl.className = 'fixed inset-0 bg-darker/80 backdrop-blur-sm flex items-start justify-center hidden pt-24';
56
- paletteEl.style.zIndex = '10000';
57
- paletteEl.style.position = 'fixed';
58
- paletteEl.innerHTML = html`
59
- <div class="glass-premium p-4 rounded-2xl w-full max-w-2xl animate-scale-in flex flex-col max-h-[70vh]">
60
- <input id="palette-search-input" type="text" class="form-input-premium text-lg mb-2" placeholder="Escribe un comando...">
61
- <div id="palette-results-list" class="overflow-y-auto"></div>
62
- </div>
63
- `;
64
- document.body.appendChild(paletteEl);
65
-
66
- this.dom.modal = paletteEl;
67
- this.dom.input = paletteEl.querySelector('#palette-search-input');
68
- this.dom.results = paletteEl.querySelector('#palette-results-list');
69
-
70
- this.attachEventListeners();
71
- }
72
-
73
- /**
74
- * Adjunta todos los listeners necesarios para la interactividad de la paleta.
75
- */
76
- private attachEventListeners() {
77
- // Cerrar al hacer clic fuera del modal
78
- this.dom.modal?.addEventListener('click', (e) => {
79
- if (e.target === this.dom.modal) this.hide();
80
- });
81
-
82
- // Filtrar resultados mientras el usuario escribe
83
- this.dom.input?.addEventListener('input', () => {
84
- const searchTerm = (this.dom.input as HTMLInputElement).value.toLowerCase();
85
- this.filteredCommands = this.allCommands.filter(cmd =>
86
- cmd.title.toLowerCase().includes(searchTerm) ||
87
- cmd.category?.toLowerCase().includes(searchTerm)
88
- );
89
- this.selectedIndex = 0;
90
- this.renderResults();
91
- });
92
-
93
- // Navegación por teclado y ejecución
94
- this.dom.input?.addEventListener('keydown', (e: KeyboardEvent) => {
95
- switch (e.key) {
96
- case 'ArrowDown':
97
- e.preventDefault();
98
- this.selectedIndex = Math.min(this.selectedIndex + 1, this.filteredCommands.length - 1);
99
- this.renderResults();
100
- break;
101
- case 'ArrowUp':
102
- e.preventDefault();
103
- this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
104
- this.renderResults();
105
- break;
106
- case 'Enter':
107
- e.preventDefault();
108
- this.executeSelected();
109
- break;
110
- case 'Escape':
111
- this.hide();
112
- break;
113
- }
114
- });
115
-
116
- // Ejecución por clic
117
- this.dom.results?.addEventListener('click', (e: MouseEvent) => {
118
- const item = (e.target as HTMLElement).closest('.command-palette-item') as HTMLElement;
119
- if (item?.dataset.commandId) {
120
- this.api.commands.execute(item.dataset.commandId);
121
- this.hide();
122
- }
123
- });
124
- }
125
-
126
- /**
127
- * Dibuja la lista de comandos filtrados en el DOM.
128
- */
129
- private renderResults() {
130
- if (!this.dom.results) return;
131
-
132
- if (this.filteredCommands.length === 0) {
133
- this.dom.results.innerHTML = `<div class="p-4 text-center text-muted-foreground">No se encontraron comandos.</div>`;
134
- return;
135
- }
136
-
137
- this.dom.results.innerHTML = this.filteredCommands.map((cmd, index) => html`
138
- <div class="command-palette-item ${index === this.selectedIndex ? 'selected' : ''}" data-command-id="${cmd.id}">
139
- <div class="flex items-center gap-3">
140
- <i class="${cmd.icon || 'fas fa-cogs'}"></i>
141
- <span>${cmd.title}</span>
142
- </div>
143
- ${cmd.category ? `<span class="category">${cmd.category}</span>` : ''}
144
- </div>
145
- `).join('');
146
-
147
- // Asegurarse de que el elemento seleccionado esté visible
148
- this.dom.results.querySelector('.selected')?.scrollIntoView({ block: 'nearest' });
149
- }
150
-
151
- /**
152
- * Ejecuta el comando actualmente seleccionado en la lista.
153
- */
154
- private executeSelected() {
155
- const command = this.filteredCommands[this.selectedIndex];
156
- if (command) {
157
- this.api.commands.execute(command.id);
158
- this.hide();
159
- }
160
- }
161
- }
package/src/utils.ts DELETED
@@ -1,63 +0,0 @@
1
- // js/utils.js
2
-
3
- /**
4
- * Formatea una cadena de fecha (ej: "2025-06-20") a un formato legible.
5
- * @param {string} dateString - La fecha en formato YYYY-MM-DD.
6
- * @returns {string} La fecha formateada (ej: "20 jun. 2025").
7
- */
8
- export function formatDate(dateString?: string): string {
9
- if (!dateString) 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
- /**
20
- * Función ficticia (dummy) para activar el resaltado de sintaxis de HTML
21
- * en las plantillas de texto de VS Code. Simplemente reconstruye y devuelve
22
- * la cadena de texto original.
23
- * @param {TemplateStringsArray} strings
24
- * @param {...any} values
25
- * @returns {string}
26
- */
27
- export function html(strings: any, ...values: any[]) {
28
- // String.raw es una forma segura y nativa de reconstruir la plantilla
29
- return String.raw({ raw: strings }, ...values);
30
- }
31
-
32
- /**
33
- * Hace que un elemento del DOM sea arrastrable usando un manejador.
34
- * @param {HTMLElement} _element - El elemento a mover.
35
- * @param {HTMLElement} _handle - El elemento que activa el arrastre.
36
- */
37
- export function makeDraggable(_element: any, _handle: any) {
38
- // let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
39
- // handle.onmousedown = dragMouseDown;
40
-
41
- // function dragMouseDown(e) {
42
- // e.preventDefault();
43
- // pos3 = e.clientX;
44
- // pos4 = e.clientY;
45
- // document.onmouseup = closeDragElement;
46
- // document.onmousemove = elementDrag;
47
- // }
48
-
49
- // function elementDrag(e) {
50
- // e.preventDefault();
51
- // pos1 = pos3 - e.clientX;
52
- // pos2 = pos4 - e.clientY;
53
- // pos3 = e.clientX;
54
- // pos4 = e.clientY;
55
- // element.style.top = (element.offsetTop - pos2) + "px";
56
- // element.style.left = (element.offsetLeft - pos1) + "px";
57
- // }
58
-
59
- // function closeDragElement() {
60
- // document.onmouseup = null;
61
- // document.onmousemove = null;
62
- // }
63
- }
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "outDir": "dist",
6
- "rootDir": "src",
7
- "strict": true,
8
- "esModuleInterop": true,
9
- "skipLibCheck": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "declaration": true,
12
- "declarationMap": true,
13
- "moduleResolution": "node",
14
- "jsx": "react-jsx"
15
- },
16
- "include": [
17
- "src/**/*.ts"
18
- ],
19
- "exclude": [
20
- "node_modules",
21
- "dist"
22
- ]
23
- }