tv-console 1.0.0 → 1.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.
package/dist/index.esm.js CHANGED
@@ -1,2 +1,397 @@
1
- const e={enabled:!0,maxEntries:100,position:"top-right",width:"400px",height:"300px",backgroundColor:"rgba(0, 0, 0, 0.8)",textColor:"#ffffff",fontSize:"14px",opacity:.9,showTimestamp:!0,className:"tv-console",zIndex:9999,showLogLevel:!0,logLevels:["log","info","warn","error","debug"],formatter:e=>`${`[${e.timestamp.toLocaleTimeString()}]`} ${`[${e.level.toUpperCase()}]`} ${e.message}`.trim(),focusKey:"12345",unfocusKey:"Escape",onFocus:()=>{},onUnfocus:()=>{},enableKeyboardNav:!0,showFocusIndicator:!0};class t{constructor(t={}){Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isVisible",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"originalConsole",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isFocused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyBuffer",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"keyBufferTimeout",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.config={...e,...t},this.originalConsole=console,this.initialize()}initialize(){this.config.enabled&&(this.createContainer(),this.interceptConsole(),this.setupKeyboardListeners(),this.render())}createContainer(){this.container=document.createElement("div"),this.container.className=this.config.className,this.container.tabIndex=this.config.enableKeyboardNav?0:-1,this.container.style.cssText=`\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: none;\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `,document.body.appendChild(this.container)}getPositionStyles(){switch(this.config.position){case"top-left":return"top: 10px; left: 10px;";case"top-right":default:return"top: 10px; right: 10px;";case"bottom-left":return"bottom: 10px; left: 10px;";case"bottom-right":return"bottom: 10px; right: 10px;"}}interceptConsole(){["log","info","warn","error","debug"].forEach(e=>{const t=this.originalConsole[e];this.originalConsole[e]=(...i)=>{t.apply(this.originalConsole,i),this.addLog(e,...i)}})}addLog(e,...t){if(!this.config.enabled||!this.config.logLevels.includes(e))return;const i=t.map(e=>this.formatArgument(e)).join(" "),o={id:Date.now().toString()+Math.random().toString(36).substr(2,9),level:e,message:i,timestamp:new Date,data:t,stack:"error"===e?(new Error).stack:void 0};this.logs.push(o),this.logs.length>this.config.maxEntries&&(this.logs=this.logs.slice(-this.config.maxEntries)),this.render()}formatArgument(e){if(null===e)return"null";if(void 0===e)return"undefined";if(e instanceof Error)return`Error: ${e.message}\nStack: ${e.stack||"No stack trace available"}`;if("object"==typeof e)try{return JSON.stringify(e,null,2)}catch{if(e.toString&&e.toString!==Object.prototype.toString)return e.toString();const t=Object.keys(e);return t.length>0?`[Object with keys: ${t.join(", ")}]`:"[Empty Object]"}return"function"==typeof e?`[Function: ${e.name||"anonymous"}]`:String(e)}render(){if(!this.container)return;const e=this.logs.filter(e=>this.config.logLevels.includes(e.level)).map(e=>{const t=this.config.formatter(e);return`<div class="${`tv-console-${e.level}`}">${this.escapeHtml(t)}</div>`});this.container.innerHTML=e.join(""),this.container.scrollTop=this.container.scrollHeight}escapeHtml(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}setupKeyboardListeners(){document.addEventListener("keydown",e=>{this.handleKeyDown(e)})}handleKeyDown(e){if(this.config.focusKey&&(this.keyBuffer+=e.key,this.keyBufferTimeout&&clearTimeout(this.keyBufferTimeout),this.keyBufferTimeout=window.setTimeout(()=>{this.keyBuffer=""},2e3),this.keyBuffer.includes(this.config.focusKey)))return this.focus(),this.keyBuffer="",void e.preventDefault();if(this.config.unfocusKey&&e.key===this.config.unfocusKey&&this._isFocused)return this.unfocus(),void e.preventDefault();if(this._isFocused&&this.config.enableKeyboardNav&&this.container)switch(e.key){case"ArrowUp":this.container.scrollTop-=20,e.preventDefault();break;case"ArrowDown":this.container.scrollTop+=20,e.preventDefault();break;case"PageUp":this.container.scrollTop-=this.container.clientHeight,e.preventDefault();break;case"PageDown":this.container.scrollTop+=this.container.clientHeight,e.preventDefault();break;case"Home":this.container.scrollTop=0,e.preventDefault();break;case"End":this.container.scrollTop=this.container.scrollHeight,e.preventDefault()}}log(...e){this.addLog("log",...e)}info(...e){this.addLog("info",...e)}warn(...e){this.addLog("warn",...e)}error(...e){this.addLog("error",...e)}debug(...e){this.addLog("debug",...e)}clear(){this.logs=[],this.render()}show(){this.container&&(this.container.style.display="block",this.isVisible=!0)}hide(){this.container&&(this.container.style.display="none",this.isVisible=!1)}toggle(){this.isVisible?this.hide():this.show()}focus(){this.container&&!this._isFocused&&(this._isFocused=!0,this.container.focus(),this.config.showFocusIndicator&&(this.container.style.border="2px solid #00ff00",this.container.style.boxShadow="0 0 10px rgba(0, 255, 0, 0.5)"),this.config.onFocus&&this.config.onFocus(),console.log("TV Console focused - Use arrow keys to scroll, Escape to unfocus"))}unfocus(){this.container&&this._isFocused&&(this._isFocused=!1,this.container.blur(),this.config.showFocusIndicator&&(this.container.style.border="",this.container.style.boxShadow="0 2px 10px rgba(0, 0, 0, 0.3)"),this.config.onUnfocus&&this.config.onUnfocus())}isFocused(){return this._isFocused}destroy(){this.container&&(document.body.removeChild(this.container),this.container=null),Object.assign(console,this.originalConsole)}getLogs(){return[...this.logs]}setConfig(e){this.config={...this.config,...e},this.container&&(this.container.style.cssText=`\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: ${this.isVisible?"block":"none"};\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `,this.container.tabIndex=this.config.enableKeyboardNav?0:-1),this.render()}exportLogs(){return this.logs.map(e=>`[${e.timestamp.toISOString()}] [${e.level.toUpperCase()}] ${e.message}`).join("\n")}}export{t as TVConsole,t as default};
1
+ const DEFAULT_CONFIG = {
2
+ enabled: true,
3
+ maxEntries: 100,
4
+ position: 'top-right',
5
+ width: '400px',
6
+ height: '300px',
7
+ backgroundColor: 'rgba(0, 0, 0, 0.8)',
8
+ textColor: '#ffffff',
9
+ fontSize: '14px',
10
+ opacity: 0.9,
11
+ showTimestamp: true,
12
+ className: 'tv-console',
13
+ zIndex: 9999,
14
+ showLogLevel: true,
15
+ logLevels: ['log', 'info', 'warn', 'error', 'debug'],
16
+ formatter: (entry) => {
17
+ const timestamp = entry.timestamp.toLocaleTimeString();
18
+ const level = `[${entry.level.toUpperCase()}]` ;
19
+ const prefix = `[${timestamp}]` ;
20
+ return `${prefix} ${level} ${entry.message}`.trim();
21
+ },
22
+ focusKey: '12345',
23
+ unfocusKey: 'Escape',
24
+ onFocus: () => { },
25
+ onUnfocus: () => { },
26
+ enableKeyboardNav: true,
27
+ showFocusIndicator: true
28
+ };
29
+ class TVConsole {
30
+ constructor(config = {}) {
31
+ Object.defineProperty(this, "config", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: void 0
36
+ });
37
+ Object.defineProperty(this, "logs", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: []
42
+ });
43
+ Object.defineProperty(this, "container", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: null
48
+ });
49
+ Object.defineProperty(this, "isVisible", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: false
54
+ });
55
+ Object.defineProperty(this, "originalConsole", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: void 0
60
+ });
61
+ Object.defineProperty(this, "_isFocused", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: false
66
+ });
67
+ Object.defineProperty(this, "keyBuffer", {
68
+ enumerable: true,
69
+ configurable: true,
70
+ writable: true,
71
+ value: ''
72
+ });
73
+ Object.defineProperty(this, "keyBufferTimeout", {
74
+ enumerable: true,
75
+ configurable: true,
76
+ writable: true,
77
+ value: null
78
+ });
79
+ this.config = { ...DEFAULT_CONFIG, ...config };
80
+ this.originalConsole = console;
81
+ this.initialize();
82
+ }
83
+ initialize() {
84
+ if (!this.config.enabled)
85
+ return;
86
+ this.createContainer();
87
+ this.interceptConsole();
88
+ this.setupKeyboardListeners();
89
+ this.render();
90
+ }
91
+ createContainer() {
92
+ this.container = document.createElement('div');
93
+ this.container.className = this.config.className;
94
+ this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;
95
+ this.container.style.cssText = `
96
+ position: fixed;
97
+ ${this.getPositionStyles()}
98
+ width: ${this.config.width};
99
+ height: ${this.config.height};
100
+ background-color: ${this.config.backgroundColor};
101
+ color: ${this.config.textColor};
102
+ font-family: 'Courier New', monospace;
103
+ font-size: ${this.config.fontSize};
104
+ padding: 10px;
105
+ border-radius: 5px;
106
+ overflow-y: auto;
107
+ z-index: ${this.config.zIndex};
108
+ opacity: ${this.config.opacity};
109
+ display: none;
110
+ word-wrap: break-word;
111
+ white-space: pre-wrap;
112
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
113
+ outline: none;
114
+ `;
115
+ document.body.appendChild(this.container);
116
+ }
117
+ getPositionStyles() {
118
+ switch (this.config.position) {
119
+ case 'top-left':
120
+ return 'top: 10px; left: 10px;';
121
+ case 'top-right':
122
+ return 'top: 10px; right: 10px;';
123
+ case 'bottom-left':
124
+ return 'bottom: 10px; left: 10px;';
125
+ case 'bottom-right':
126
+ return 'bottom: 10px; right: 10px;';
127
+ default:
128
+ return 'top: 10px; right: 10px;';
129
+ }
130
+ }
131
+ interceptConsole() {
132
+ const methods = ['log', 'info', 'warn', 'error', 'debug'];
133
+ methods.forEach(method => {
134
+ const original = this.originalConsole[method];
135
+ this.originalConsole[method] = (...args) => {
136
+ // Call original console method
137
+ original.apply(this.originalConsole, args);
138
+ // Add to TV console
139
+ this.addLog(method, ...args);
140
+ };
141
+ });
142
+ }
143
+ addLog(level, ...args) {
144
+ if (!this.config.enabled || !this.config.logLevels.includes(level)) {
145
+ return;
146
+ }
147
+ const message = args.map(arg => this.formatArgument(arg)).join(' ');
148
+ const entry = {
149
+ id: Date.now().toString() + Math.random().toString(36).substr(2, 9),
150
+ level,
151
+ message,
152
+ timestamp: new Date(),
153
+ data: args,
154
+ stack: level === 'error' ? new Error().stack : undefined
155
+ };
156
+ this.logs.push(entry);
157
+ // Keep only the latest entries
158
+ if (this.logs.length > this.config.maxEntries) {
159
+ this.logs = this.logs.slice(-this.config.maxEntries);
160
+ }
161
+ this.render();
162
+ }
163
+ formatArgument(arg) {
164
+ if (arg === null)
165
+ return 'null';
166
+ if (arg === undefined)
167
+ return 'undefined';
168
+ // Handle Error objects specifically
169
+ if (arg instanceof Error) {
170
+ return `Error: ${arg.message}\nStack: ${arg.stack || 'No stack trace available'}`;
171
+ }
172
+ // Handle other objects
173
+ if (typeof arg === 'object') {
174
+ try {
175
+ // Try JSON.stringify first
176
+ return JSON.stringify(arg, null, 2);
177
+ }
178
+ catch {
179
+ // If JSON.stringify fails, try to get a meaningful string representation
180
+ if (arg.toString && arg.toString !== Object.prototype.toString) {
181
+ return arg.toString();
182
+ }
183
+ // For objects that don't have a custom toString, show their keys
184
+ const keys = Object.keys(arg);
185
+ if (keys.length > 0) {
186
+ return `[Object with keys: ${keys.join(', ')}]`;
187
+ }
188
+ else {
189
+ return '[Empty Object]';
190
+ }
191
+ }
192
+ }
193
+ // Handle functions
194
+ if (typeof arg === 'function') {
195
+ return `[Function: ${arg.name || 'anonymous'}]`;
196
+ }
197
+ // Handle other primitive types
198
+ return String(arg);
199
+ }
200
+ render() {
201
+ if (!this.container)
202
+ return;
203
+ const filteredLogs = this.logs.filter(log => this.config.logLevels.includes(log.level));
204
+ const formattedLogs = filteredLogs.map(log => {
205
+ const formatted = this.config.formatter(log);
206
+ const levelClass = `tv-console-${log.level}`;
207
+ return `<div class="${levelClass}">${this.escapeHtml(formatted)}</div>`;
208
+ });
209
+ this.container.innerHTML = formattedLogs.join('');
210
+ // Auto-scroll to the bottom to show the most recent logs
211
+ this.container.scrollTop = this.container.scrollHeight;
212
+ }
213
+ escapeHtml(text) {
214
+ const div = document.createElement('div');
215
+ div.textContent = text;
216
+ return div.innerHTML;
217
+ }
218
+ setupKeyboardListeners() {
219
+ document.addEventListener('keydown', (event) => {
220
+ this.handleKeyDown(event);
221
+ });
222
+ }
223
+ handleKeyDown(event) {
224
+ // Handle focus key combination
225
+ if (this.config.focusKey) {
226
+ this.keyBuffer += event.key;
227
+ // Clear buffer after 2 seconds of inactivity
228
+ if (this.keyBufferTimeout) {
229
+ clearTimeout(this.keyBufferTimeout);
230
+ }
231
+ this.keyBufferTimeout = window.setTimeout(() => {
232
+ this.keyBuffer = '';
233
+ }, 2000);
234
+ // Check if key combination matches
235
+ if (this.keyBuffer.includes(this.config.focusKey)) {
236
+ this.focus();
237
+ this.keyBuffer = '';
238
+ event.preventDefault();
239
+ return;
240
+ }
241
+ }
242
+ // Handle unfocus key
243
+ if (this.config.unfocusKey && event.key === this.config.unfocusKey && this._isFocused) {
244
+ this.unfocus();
245
+ event.preventDefault();
246
+ return;
247
+ }
248
+ // Handle keyboard navigation when focused
249
+ if (this._isFocused && this.config.enableKeyboardNav && this.container) {
250
+ switch (event.key) {
251
+ case 'ArrowUp':
252
+ this.container.scrollTop -= 20;
253
+ event.preventDefault();
254
+ break;
255
+ case 'ArrowDown':
256
+ this.container.scrollTop += 20;
257
+ event.preventDefault();
258
+ break;
259
+ case 'PageUp':
260
+ this.container.scrollTop -= this.container.clientHeight;
261
+ event.preventDefault();
262
+ break;
263
+ case 'PageDown':
264
+ this.container.scrollTop += this.container.clientHeight;
265
+ event.preventDefault();
266
+ break;
267
+ case 'Home':
268
+ this.container.scrollTop = 0;
269
+ event.preventDefault();
270
+ break;
271
+ case 'End':
272
+ this.container.scrollTop = this.container.scrollHeight;
273
+ event.preventDefault();
274
+ break;
275
+ }
276
+ }
277
+ }
278
+ // Public API methods
279
+ log(...args) {
280
+ this.addLog('log', ...args);
281
+ }
282
+ info(...args) {
283
+ this.addLog('info', ...args);
284
+ }
285
+ warn(...args) {
286
+ this.addLog('warn', ...args);
287
+ }
288
+ error(...args) {
289
+ this.addLog('error', ...args);
290
+ }
291
+ debug(...args) {
292
+ this.addLog('debug', ...args);
293
+ }
294
+ clear() {
295
+ this.logs = [];
296
+ this.render();
297
+ }
298
+ show() {
299
+ if (this.container) {
300
+ this.container.style.display = 'block';
301
+ this.isVisible = true;
302
+ }
303
+ }
304
+ hide() {
305
+ if (this.container) {
306
+ this.container.style.display = 'none';
307
+ this.isVisible = false;
308
+ }
309
+ }
310
+ toggle() {
311
+ if (this.isVisible) {
312
+ this.hide();
313
+ }
314
+ else {
315
+ this.show();
316
+ }
317
+ }
318
+ focus() {
319
+ if (!this.container || this._isFocused)
320
+ return;
321
+ this._isFocused = true;
322
+ this.container.focus();
323
+ if (this.config.showFocusIndicator) {
324
+ this.container.style.border = '2px solid #00ff00';
325
+ this.container.style.boxShadow = '0 0 10px rgba(0, 255, 0, 0.5)';
326
+ }
327
+ // Call onFocus callback if provided
328
+ if (this.config.onFocus) {
329
+ this.config.onFocus();
330
+ }
331
+ console.log('TV Console focused - Use arrow keys to scroll, Escape to unfocus');
332
+ }
333
+ unfocus() {
334
+ if (!this.container || !this._isFocused)
335
+ return;
336
+ this._isFocused = false;
337
+ this.container.blur();
338
+ if (this.config.showFocusIndicator) {
339
+ this.container.style.border = '';
340
+ this.container.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.3)';
341
+ }
342
+ // Call onUnfocus callback if provided
343
+ if (this.config.onUnfocus) {
344
+ this.config.onUnfocus();
345
+ }
346
+ }
347
+ isFocused() {
348
+ return this._isFocused;
349
+ }
350
+ destroy() {
351
+ if (this.container) {
352
+ document.body.removeChild(this.container);
353
+ this.container = null;
354
+ }
355
+ // Restore original console methods
356
+ Object.assign(console, this.originalConsole);
357
+ }
358
+ getLogs() {
359
+ return [...this.logs];
360
+ }
361
+ setConfig(config) {
362
+ this.config = { ...this.config, ...config };
363
+ if (this.container) {
364
+ this.container.style.cssText = `
365
+ position: fixed;
366
+ ${this.getPositionStyles()}
367
+ width: ${this.config.width};
368
+ height: ${this.config.height};
369
+ background-color: ${this.config.backgroundColor};
370
+ color: ${this.config.textColor};
371
+ font-family: 'Courier New', monospace;
372
+ font-size: ${this.config.fontSize};
373
+ padding: 10px;
374
+ border-radius: 5px;
375
+ overflow-y: auto;
376
+ z-index: ${this.config.zIndex};
377
+ opacity: ${this.config.opacity};
378
+ display: ${this.isVisible ? 'block' : 'none'};
379
+ word-wrap: break-word;
380
+ white-space: pre-wrap;
381
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
382
+ outline: none;
383
+ `;
384
+ this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;
385
+ }
386
+ this.render();
387
+ }
388
+ exportLogs() {
389
+ return this.logs.map(log => {
390
+ const timestamp = log.timestamp.toISOString();
391
+ return `[${timestamp}] [${log.level.toUpperCase()}] ${log.message}`;
392
+ }).join('\n');
393
+ }
394
+ }
395
+
396
+ export { TVConsole, TVConsole as default };
2
397
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/tv-console.ts"],"sourcesContent":["import type { TVConsoleConfig, LogLevel, LogEntry, TVConsoleInstance } from './types';\n\nconst DEFAULT_CONFIG: Required<TVConsoleConfig> = {\n enabled: true,\n maxEntries: 100,\n position: 'top-right',\n width: '400px',\n height: '300px',\n backgroundColor: 'rgba(0, 0, 0, 0.8)',\n textColor: '#ffffff',\n fontSize: '14px',\n opacity: 0.9,\n showTimestamp: true,\n className: 'tv-console',\n zIndex: 9999,\n showLogLevel: true,\n logLevels: ['log', 'info', 'warn', 'error', 'debug'],\n formatter: (entry: LogEntry) => {\n const timestamp = entry.timestamp.toLocaleTimeString();\n const level = DEFAULT_CONFIG.showLogLevel ? `[${entry.level.toUpperCase()}]` : '';\n const prefix = DEFAULT_CONFIG.showTimestamp ? `[${timestamp}]` : '';\n return `${prefix} ${level} ${entry.message}`.trim();\n },\n focusKey: '12345',\n unfocusKey: 'Escape',\n onFocus: () => {},\n onUnfocus: () => {},\n enableKeyboardNav: true,\n showFocusIndicator: true\n};\n\nexport class TVConsole implements TVConsoleInstance {\n private config: Required<TVConsoleConfig>;\n private logs: LogEntry[] = [];\n private container: HTMLDivElement | null = null;\n private isVisible = false;\n private originalConsole: Console;\n private _isFocused = false;\n private keyBuffer = '';\n private keyBufferTimeout: number | null = null;\n\n constructor(config: TVConsoleConfig = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.originalConsole = console;\n this.initialize();\n }\n\n private initialize(): void {\n if (!this.config.enabled) return;\n\n this.createContainer();\n this.interceptConsole();\n this.setupKeyboardListeners();\n this.render();\n }\n\n private createContainer(): void {\n this.container = document.createElement('div');\n this.container.className = this.config.className;\n this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;\n this.container.style.cssText = `\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: none;\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `;\n\n document.body.appendChild(this.container);\n }\n\n private getPositionStyles(): string {\n switch (this.config.position) {\n case 'top-left':\n return 'top: 10px; left: 10px;';\n case 'top-right':\n return 'top: 10px; right: 10px;';\n case 'bottom-left':\n return 'bottom: 10px; left: 10px;';\n case 'bottom-right':\n return 'bottom: 10px; right: 10px;';\n default:\n return 'top: 10px; right: 10px;';\n }\n }\n\n private interceptConsole(): void {\n const methods: LogLevel[] = ['log', 'info', 'warn', 'error', 'debug'];\n \n methods.forEach(method => {\n const original = this.originalConsole[method];\n this.originalConsole[method] = (...args: any[]) => {\n // Call original console method\n original.apply(this.originalConsole, args);\n \n // Add to TV console\n this.addLog(method, ...args);\n };\n });\n }\n\n private addLog(level: LogLevel, ...args: any[]): void {\n if (!this.config.enabled || !this.config.logLevels.includes(level)) {\n return;\n }\n\n const message = args.map(arg => this.formatArgument(arg)).join(' ');\n const entry: LogEntry = {\n id: Date.now().toString() + Math.random().toString(36).substr(2, 9),\n level,\n message,\n timestamp: new Date(),\n data: args,\n stack: level === 'error' ? new Error().stack : undefined\n };\n\n this.logs.push(entry);\n\n // Keep only the latest entries\n if (this.logs.length > this.config.maxEntries) {\n this.logs = this.logs.slice(-this.config.maxEntries);\n }\n\n this.render();\n }\n\n private formatArgument(arg: any): string {\n if (arg === null) return 'null';\n if (arg === undefined) return 'undefined';\n \n // Handle Error objects specifically\n if (arg instanceof Error) {\n return `Error: ${arg.message}\\nStack: ${arg.stack || 'No stack trace available'}`;\n }\n \n // Handle other objects\n if (typeof arg === 'object') {\n try {\n // Try JSON.stringify first\n return JSON.stringify(arg, null, 2);\n } catch {\n // If JSON.stringify fails, try to get a meaningful string representation\n if (arg.toString && arg.toString !== Object.prototype.toString) {\n return arg.toString();\n }\n \n // For objects that don't have a custom toString, show their keys\n const keys = Object.keys(arg);\n if (keys.length > 0) {\n return `[Object with keys: ${keys.join(', ')}]`;\n } else {\n return '[Empty Object]';\n }\n }\n }\n \n // Handle functions\n if (typeof arg === 'function') {\n return `[Function: ${arg.name || 'anonymous'}]`;\n }\n \n // Handle other primitive types\n return String(arg);\n }\n\n private render(): void {\n if (!this.container) return;\n\n const filteredLogs = this.logs.filter(log => \n this.config.logLevels.includes(log.level)\n );\n\n const formattedLogs = filteredLogs.map(log => {\n const formatted = this.config.formatter(log);\n const levelClass = `tv-console-${log.level}`;\n return `<div class=\"${levelClass}\">${this.escapeHtml(formatted)}</div>`;\n });\n\n this.container.innerHTML = formattedLogs.join('');\n \n // Auto-scroll to the bottom to show the most recent logs\n this.container.scrollTop = this.container.scrollHeight;\n }\n\n private escapeHtml(text: string): string {\n const div = document.createElement('div');\n div.textContent = text;\n return div.innerHTML;\n }\n\n private setupKeyboardListeners(): void {\n document.addEventListener('keydown', (event) => {\n this.handleKeyDown(event);\n });\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n // Handle focus key combination\n if (this.config.focusKey) {\n this.keyBuffer += event.key;\n \n // Clear buffer after 2 seconds of inactivity\n if (this.keyBufferTimeout) {\n clearTimeout(this.keyBufferTimeout);\n }\n this.keyBufferTimeout = window.setTimeout(() => {\n this.keyBuffer = '';\n }, 2000);\n\n // Check if key combination matches\n if (this.keyBuffer.includes(this.config.focusKey)) {\n this.focus();\n this.keyBuffer = '';\n event.preventDefault();\n return;\n }\n }\n\n // Handle unfocus key\n if (this.config.unfocusKey && event.key === this.config.unfocusKey && this._isFocused) {\n this.unfocus();\n event.preventDefault();\n return;\n }\n\n // Handle keyboard navigation when focused\n if (this._isFocused && this.config.enableKeyboardNav && this.container) {\n switch (event.key) {\n case 'ArrowUp':\n this.container.scrollTop -= 20;\n event.preventDefault();\n break;\n case 'ArrowDown':\n this.container.scrollTop += 20;\n event.preventDefault();\n break;\n case 'PageUp':\n this.container.scrollTop -= this.container.clientHeight;\n event.preventDefault();\n break;\n case 'PageDown':\n this.container.scrollTop += this.container.clientHeight;\n event.preventDefault();\n break;\n case 'Home':\n this.container.scrollTop = 0;\n event.preventDefault();\n break;\n case 'End':\n this.container.scrollTop = this.container.scrollHeight;\n event.preventDefault();\n break;\n }\n }\n }\n\n // Public API methods\n log(...args: any[]): void {\n this.addLog('log', ...args);\n }\n\n info(...args: any[]): void {\n this.addLog('info', ...args);\n }\n\n warn(...args: any[]): void {\n this.addLog('warn', ...args);\n }\n\n error(...args: any[]): void {\n this.addLog('error', ...args);\n }\n\n debug(...args: any[]): void {\n this.addLog('debug', ...args);\n }\n\n clear(): void {\n this.logs = [];\n this.render();\n }\n\n show(): void {\n if (this.container) {\n this.container.style.display = 'block';\n this.isVisible = true;\n }\n }\n\n hide(): void {\n if (this.container) {\n this.container.style.display = 'none';\n this.isVisible = false;\n }\n }\n\n toggle(): void {\n if (this.isVisible) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n focus(): void {\n if (!this.container || this._isFocused) return;\n \n this._isFocused = true;\n this.container.focus();\n \n if (this.config.showFocusIndicator) {\n this.container.style.border = '2px solid #00ff00';\n this.container.style.boxShadow = '0 0 10px rgba(0, 255, 0, 0.5)';\n }\n \n // Call onFocus callback if provided\n if (this.config.onFocus) {\n this.config.onFocus();\n }\n \n console.log('TV Console focused - Use arrow keys to scroll, Escape to unfocus');\n }\n\n unfocus(): void {\n if (!this.container || !this._isFocused) return;\n \n this._isFocused = false;\n this.container.blur();\n \n if (this.config.showFocusIndicator) {\n this.container.style.border = '';\n this.container.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.3)';\n }\n \n // Call onUnfocus callback if provided\n if (this.config.onUnfocus) {\n this.config.onUnfocus();\n }\n }\n\n isFocused(): boolean {\n return this._isFocused;\n }\n\n destroy(): void {\n if (this.container) {\n document.body.removeChild(this.container);\n this.container = null;\n }\n \n // Restore original console methods\n Object.assign(console, this.originalConsole);\n }\n\n getLogs(): LogEntry[] {\n return [...this.logs];\n }\n\n setConfig(config: Partial<TVConsoleConfig>): void {\n this.config = { ...this.config, ...config };\n \n if (this.container) {\n this.container.style.cssText = `\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: ${this.isVisible ? 'block' : 'none'};\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `;\n this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;\n }\n \n this.render();\n }\n\n exportLogs(): string {\n return this.logs.map(log => {\n const timestamp = log.timestamp.toISOString();\n return `[${timestamp}] [${log.level.toUpperCase()}] ${log.message}`;\n }).join('\\n');\n }\n} "],"names":["DEFAULT_CONFIG","enabled","maxEntries","position","width","height","backgroundColor","textColor","fontSize","opacity","showTimestamp","className","zIndex","showLogLevel","logLevels","formatter","entry","timestamp","toLocaleTimeString","level","toUpperCase","message","trim","focusKey","unfocusKey","onFocus","onUnfocus","enableKeyboardNav","showFocusIndicator","TVConsole","constructor","config","Object","defineProperty","this","originalConsole","console","initialize","createContainer","interceptConsole","setupKeyboardListeners","render","container","document","createElement","tabIndex","style","cssText","getPositionStyles","body","appendChild","forEach","method","original","args","apply","addLog","includes","map","arg","formatArgument","join","id","Date","now","toString","Math","random","substr","data","stack","Error","undefined","logs","push","length","slice","JSON","stringify","prototype","keys","name","String","formattedLogs","filter","log","formatted","escapeHtml","innerHTML","scrollTop","scrollHeight","text","div","textContent","addEventListener","event","handleKeyDown","keyBuffer","key","keyBufferTimeout","clearTimeout","window","setTimeout","focus","preventDefault","_isFocused","unfocus","clientHeight","info","warn","error","debug","clear","show","display","isVisible","hide","toggle","border","boxShadow","blur","isFocused","destroy","removeChild","assign","getLogs","set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AAK,KACT"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/tv-console.ts"],"sourcesContent":["import type { TVConsoleConfig, LogLevel, LogEntry, TVConsoleInstance } from './types';\n\nconst DEFAULT_CONFIG: Required<TVConsoleConfig> = {\n enabled: true,\n maxEntries: 100,\n position: 'top-right',\n width: '400px',\n height: '300px',\n backgroundColor: 'rgba(0, 0, 0, 0.8)',\n textColor: '#ffffff',\n fontSize: '14px',\n opacity: 0.9,\n showTimestamp: true,\n className: 'tv-console',\n zIndex: 9999,\n showLogLevel: true,\n logLevels: ['log', 'info', 'warn', 'error', 'debug'],\n formatter: (entry: LogEntry) => {\n const timestamp = entry.timestamp.toLocaleTimeString();\n const level = DEFAULT_CONFIG.showLogLevel ? `[${entry.level.toUpperCase()}]` : '';\n const prefix = DEFAULT_CONFIG.showTimestamp ? `[${timestamp}]` : '';\n return `${prefix} ${level} ${entry.message}`.trim();\n },\n focusKey: '12345',\n unfocusKey: 'Escape',\n onFocus: () => {},\n onUnfocus: () => {},\n enableKeyboardNav: true,\n showFocusIndicator: true\n};\n\nexport class TVConsole implements TVConsoleInstance {\n private config: Required<TVConsoleConfig>;\n private logs: LogEntry[] = [];\n private container: HTMLDivElement | null = null;\n private isVisible = false;\n private originalConsole: Console;\n private _isFocused = false;\n private keyBuffer = '';\n private keyBufferTimeout: number | null = null;\n\n constructor(config: TVConsoleConfig = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.originalConsole = console;\n this.initialize();\n }\n\n private initialize(): void {\n if (!this.config.enabled) return;\n\n this.createContainer();\n this.interceptConsole();\n this.setupKeyboardListeners();\n this.render();\n }\n\n private createContainer(): void {\n this.container = document.createElement('div');\n this.container.className = this.config.className;\n this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;\n this.container.style.cssText = `\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: none;\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `;\n\n document.body.appendChild(this.container);\n }\n\n private getPositionStyles(): string {\n switch (this.config.position) {\n case 'top-left':\n return 'top: 10px; left: 10px;';\n case 'top-right':\n return 'top: 10px; right: 10px;';\n case 'bottom-left':\n return 'bottom: 10px; left: 10px;';\n case 'bottom-right':\n return 'bottom: 10px; right: 10px;';\n default:\n return 'top: 10px; right: 10px;';\n }\n }\n\n private interceptConsole(): void {\n const methods: LogLevel[] = ['log', 'info', 'warn', 'error', 'debug'];\n \n methods.forEach(method => {\n const original = this.originalConsole[method];\n this.originalConsole[method] = (...args: any[]) => {\n // Call original console method\n original.apply(this.originalConsole, args);\n \n // Add to TV console\n this.addLog(method, ...args);\n };\n });\n }\n\n private addLog(level: LogLevel, ...args: any[]): void {\n if (!this.config.enabled || !this.config.logLevels.includes(level)) {\n return;\n }\n\n const message = args.map(arg => this.formatArgument(arg)).join(' ');\n const entry: LogEntry = {\n id: Date.now().toString() + Math.random().toString(36).substr(2, 9),\n level,\n message,\n timestamp: new Date(),\n data: args,\n stack: level === 'error' ? new Error().stack : undefined\n };\n\n this.logs.push(entry);\n\n // Keep only the latest entries\n if (this.logs.length > this.config.maxEntries) {\n this.logs = this.logs.slice(-this.config.maxEntries);\n }\n\n this.render();\n }\n\n private formatArgument(arg: any): string {\n if (arg === null) return 'null';\n if (arg === undefined) return 'undefined';\n \n // Handle Error objects specifically\n if (arg instanceof Error) {\n return `Error: ${arg.message}\\nStack: ${arg.stack || 'No stack trace available'}`;\n }\n \n // Handle other objects\n if (typeof arg === 'object') {\n try {\n // Try JSON.stringify first\n return JSON.stringify(arg, null, 2);\n } catch {\n // If JSON.stringify fails, try to get a meaningful string representation\n if (arg.toString && arg.toString !== Object.prototype.toString) {\n return arg.toString();\n }\n \n // For objects that don't have a custom toString, show their keys\n const keys = Object.keys(arg);\n if (keys.length > 0) {\n return `[Object with keys: ${keys.join(', ')}]`;\n } else {\n return '[Empty Object]';\n }\n }\n }\n \n // Handle functions\n if (typeof arg === 'function') {\n return `[Function: ${arg.name || 'anonymous'}]`;\n }\n \n // Handle other primitive types\n return String(arg);\n }\n\n private render(): void {\n if (!this.container) return;\n\n const filteredLogs = this.logs.filter(log => \n this.config.logLevels.includes(log.level)\n );\n\n const formattedLogs = filteredLogs.map(log => {\n const formatted = this.config.formatter(log);\n const levelClass = `tv-console-${log.level}`;\n return `<div class=\"${levelClass}\">${this.escapeHtml(formatted)}</div>`;\n });\n\n this.container.innerHTML = formattedLogs.join('');\n \n // Auto-scroll to the bottom to show the most recent logs\n this.container.scrollTop = this.container.scrollHeight;\n }\n\n private escapeHtml(text: string): string {\n const div = document.createElement('div');\n div.textContent = text;\n return div.innerHTML;\n }\n\n private setupKeyboardListeners(): void {\n document.addEventListener('keydown', (event) => {\n this.handleKeyDown(event);\n });\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n // Handle focus key combination\n if (this.config.focusKey) {\n this.keyBuffer += event.key;\n \n // Clear buffer after 2 seconds of inactivity\n if (this.keyBufferTimeout) {\n clearTimeout(this.keyBufferTimeout);\n }\n this.keyBufferTimeout = window.setTimeout(() => {\n this.keyBuffer = '';\n }, 2000);\n\n // Check if key combination matches\n if (this.keyBuffer.includes(this.config.focusKey)) {\n this.focus();\n this.keyBuffer = '';\n event.preventDefault();\n return;\n }\n }\n\n // Handle unfocus key\n if (this.config.unfocusKey && event.key === this.config.unfocusKey && this._isFocused) {\n this.unfocus();\n event.preventDefault();\n return;\n }\n\n // Handle keyboard navigation when focused\n if (this._isFocused && this.config.enableKeyboardNav && this.container) {\n switch (event.key) {\n case 'ArrowUp':\n this.container.scrollTop -= 20;\n event.preventDefault();\n break;\n case 'ArrowDown':\n this.container.scrollTop += 20;\n event.preventDefault();\n break;\n case 'PageUp':\n this.container.scrollTop -= this.container.clientHeight;\n event.preventDefault();\n break;\n case 'PageDown':\n this.container.scrollTop += this.container.clientHeight;\n event.preventDefault();\n break;\n case 'Home':\n this.container.scrollTop = 0;\n event.preventDefault();\n break;\n case 'End':\n this.container.scrollTop = this.container.scrollHeight;\n event.preventDefault();\n break;\n }\n }\n }\n\n // Public API methods\n log(...args: any[]): void {\n this.addLog('log', ...args);\n }\n\n info(...args: any[]): void {\n this.addLog('info', ...args);\n }\n\n warn(...args: any[]): void {\n this.addLog('warn', ...args);\n }\n\n error(...args: any[]): void {\n this.addLog('error', ...args);\n }\n\n debug(...args: any[]): void {\n this.addLog('debug', ...args);\n }\n\n clear(): void {\n this.logs = [];\n this.render();\n }\n\n show(): void {\n if (this.container) {\n this.container.style.display = 'block';\n this.isVisible = true;\n }\n }\n\n hide(): void {\n if (this.container) {\n this.container.style.display = 'none';\n this.isVisible = false;\n }\n }\n\n toggle(): void {\n if (this.isVisible) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n focus(): void {\n if (!this.container || this._isFocused) return;\n \n this._isFocused = true;\n this.container.focus();\n \n if (this.config.showFocusIndicator) {\n this.container.style.border = '2px solid #00ff00';\n this.container.style.boxShadow = '0 0 10px rgba(0, 255, 0, 0.5)';\n }\n \n // Call onFocus callback if provided\n if (this.config.onFocus) {\n this.config.onFocus();\n }\n \n console.log('TV Console focused - Use arrow keys to scroll, Escape to unfocus');\n }\n\n unfocus(): void {\n if (!this.container || !this._isFocused) return;\n \n this._isFocused = false;\n this.container.blur();\n \n if (this.config.showFocusIndicator) {\n this.container.style.border = '';\n this.container.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.3)';\n }\n \n // Call onUnfocus callback if provided\n if (this.config.onUnfocus) {\n this.config.onUnfocus();\n }\n }\n\n isFocused(): boolean {\n return this._isFocused;\n }\n\n destroy(): void {\n if (this.container) {\n document.body.removeChild(this.container);\n this.container = null;\n }\n \n // Restore original console methods\n Object.assign(console, this.originalConsole);\n }\n\n getLogs(): LogEntry[] {\n return [...this.logs];\n }\n\n setConfig(config: Partial<TVConsoleConfig>): void {\n this.config = { ...this.config, ...config };\n \n if (this.container) {\n this.container.style.cssText = `\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: ${this.isVisible ? 'block' : 'none'};\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `;\n this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;\n }\n \n this.render();\n }\n\n exportLogs(): string {\n return this.logs.map(log => {\n const timestamp = log.timestamp.toISOString();\n return `[${timestamp}] [${log.level.toUpperCase()}] ${log.message}`;\n }).join('\\n');\n }\n} "],"names":[],"mappings":"AAEA,MAAM,cAAc,GAA8B;AAChD,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,QAAQ,EAAE,WAAW;AACrB,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,eAAe,EAAE,oBAAoB;AACrC,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,QAAQ,EAAE,MAAM;AAChB,IAAA,OAAO,EAAE,GAAG;AACZ,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;AACpD,IAAA,SAAS,EAAE,CAAC,KAAe,KAAI;QAC7B,MAAM,SAAS,GAAG,KAAK,CAAC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