tv-console 1.0.0
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/README.md +254 -0
- package/dist/index.d.ts +114 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/tv-console.d.ts +39 -0
- package/dist/tv-console.d.ts.map +1 -0
- package/dist/types.d.ts +72 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# TV Console
|
|
2
|
+
|
|
3
|
+
A console replacement for TV apps where browser console is not accessible. This package provides an on-screen console overlay that captures and displays console output in real-time.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🖥️ **On-screen console overlay** - View console output directly on your TV app
|
|
8
|
+
- 🔄 **Real-time logging** - Automatically captures all console methods (log, info, warn, error, debug)
|
|
9
|
+
- 🎨 **Customizable styling** - Configure colors, position, size, and appearance
|
|
10
|
+
- 📱 **TV-optimized** - Designed for smart TV applications and set-top boxes
|
|
11
|
+
- 🔧 **Flexible configuration** - Enable/disable, filter log levels, custom formatting
|
|
12
|
+
- 📊 **Log management** - Export logs, clear console, show/hide overlay
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install tv-console
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { TVConsole } from 'tv-console';
|
|
24
|
+
|
|
25
|
+
// Initialize with default settings
|
|
26
|
+
const tvConsole = new TVConsole();
|
|
27
|
+
|
|
28
|
+
// Your existing console calls will now appear on screen
|
|
29
|
+
console.log('Hello TV World!');
|
|
30
|
+
console.error('Something went wrong');
|
|
31
|
+
console.warn('Warning message');
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { TVConsole } from 'tv-console';
|
|
38
|
+
|
|
39
|
+
const tvConsole = new TVConsole({
|
|
40
|
+
enabled: true,
|
|
41
|
+
position: 'bottom-right',
|
|
42
|
+
backgroundColor: 'rgba(0, 0, 0, 0.9)',
|
|
43
|
+
textColor: '#00ff00',
|
|
44
|
+
fontSize: '16px',
|
|
45
|
+
maxEntries: 200,
|
|
46
|
+
showTimestamp: true,
|
|
47
|
+
showLogLevel: true,
|
|
48
|
+
logLevels: ['log', 'error', 'warn'], // Only show these levels
|
|
49
|
+
zIndex: 10000
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## API Reference
|
|
54
|
+
|
|
55
|
+
### Constructor Options
|
|
56
|
+
|
|
57
|
+
| Option | Type | Default | Description |
|
|
58
|
+
|--------|------|---------|-------------|
|
|
59
|
+
| `enabled` | `boolean` | `true` | Enable/disable the TV console |
|
|
60
|
+
| `maxEntries` | `number` | `100` | Maximum number of log entries to keep |
|
|
61
|
+
| `position` | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `'top-right'` | Position of the console overlay |
|
|
62
|
+
| `width` | `string` | `'400px'` | Width of the console overlay |
|
|
63
|
+
| `height` | `string` | `'300px'` | Height of the console overlay |
|
|
64
|
+
| `backgroundColor` | `string` | `'rgba(0, 0, 0, 0.8)'` | Background color of the overlay |
|
|
65
|
+
| `textColor` | `string` | `'#ffffff'` | Text color |
|
|
66
|
+
| `fontSize` | `string` | `'14px'` | Font size |
|
|
67
|
+
| `opacity` | `number` | `0.9` | Opacity of the overlay |
|
|
68
|
+
| `showTimestamp` | `boolean` | `true` | Show timestamp with each log entry |
|
|
69
|
+
| `className` | `string` | `'tv-console'` | CSS class for styling |
|
|
70
|
+
| `zIndex` | `number` | `9999` | Z-index of the overlay |
|
|
71
|
+
| `showLogLevel` | `boolean` | `true` | Show log level indicators |
|
|
72
|
+
| `logLevels` | `LogLevel[]` | `['log', 'info', 'warn', 'error', 'debug']` | Filter which log levels to display |
|
|
73
|
+
| `formatter` | `(entry: LogEntry) => string` | Default formatter | Custom formatter for log messages |
|
|
74
|
+
| `focusKey` | `string` | `'12345'` | Key combination to focus the console |
|
|
75
|
+
| `unfocusKey` | `string` | `'Escape'` | Key to unfocus the console |
|
|
76
|
+
| `onFocus` | `() => void` | `() => {}` | Callback when console gains focus |
|
|
77
|
+
| `onUnfocus` | `() => void` | `() => {}` | Callback when console loses focus |
|
|
78
|
+
| `enableKeyboardNav` | `boolean` | `true` | Enable keyboard navigation for scrolling |
|
|
79
|
+
| `showFocusIndicator` | `boolean` | `true` | Show focus indicator when console is focused |
|
|
80
|
+
|
|
81
|
+
### Instance Methods
|
|
82
|
+
|
|
83
|
+
#### Logging Methods
|
|
84
|
+
- `log(...args: any[])` - Log a message
|
|
85
|
+
- `info(...args: any[])` - Log an info message
|
|
86
|
+
- `warn(...args: any[])` - Log a warning message
|
|
87
|
+
- `error(...args: any[])` - Log an error message
|
|
88
|
+
- `debug(...args: any[])` - Log a debug message
|
|
89
|
+
|
|
90
|
+
#### Console Control
|
|
91
|
+
- `show()` - Show the console overlay
|
|
92
|
+
- `hide()` - Hide the console overlay
|
|
93
|
+
- `toggle()` - Toggle visibility
|
|
94
|
+
- `clear()` - Clear all log entries
|
|
95
|
+
- `destroy()` - Remove the console overlay and restore original console
|
|
96
|
+
|
|
97
|
+
#### Focus Management
|
|
98
|
+
- `focus()` - Focus the console for keyboard navigation
|
|
99
|
+
- `unfocus()` - Unfocus the console
|
|
100
|
+
- `isFocused(): boolean` - Check if console is currently focused
|
|
101
|
+
|
|
102
|
+
#### Data Management
|
|
103
|
+
- `getLogs(): LogEntry[]` - Get all current log entries
|
|
104
|
+
- `setConfig(config: Partial<TVConsoleConfig>)` - Update configuration
|
|
105
|
+
- `exportLogs(): string` - Export logs as formatted text
|
|
106
|
+
|
|
107
|
+
## Usage Examples
|
|
108
|
+
|
|
109
|
+
### Basic Usage
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { TVConsole } from 'tv-console';
|
|
113
|
+
|
|
114
|
+
// Initialize
|
|
115
|
+
const tvConsole = new TVConsole();
|
|
116
|
+
|
|
117
|
+
// Your app code
|
|
118
|
+
function handleUserAction() {
|
|
119
|
+
console.log('User clicked button');
|
|
120
|
+
console.info('Processing request...');
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
// Some operation
|
|
124
|
+
console.log('Operation successful');
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error('Operation failed:', error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Advanced Configuration
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { TVConsole } from 'tv-console';
|
|
135
|
+
|
|
136
|
+
const tvConsole = new TVConsole({
|
|
137
|
+
position: 'bottom-left',
|
|
138
|
+
backgroundColor: 'rgba(0, 20, 40, 0.95)',
|
|
139
|
+
textColor: '#00ff88',
|
|
140
|
+
fontSize: '18px',
|
|
141
|
+
maxEntries: 50,
|
|
142
|
+
logLevels: ['error', 'warn'], // Only show errors and warnings
|
|
143
|
+
formatter: (entry) => {
|
|
144
|
+
return `[${entry.timestamp.toLocaleTimeString()}] ${entry.message}`;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Show console when app starts
|
|
149
|
+
tvConsole.show();
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### TV Remote Control Support
|
|
153
|
+
|
|
154
|
+
The TV Console includes built-in support for TV remote controls and keyboard navigation:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
const tvConsole = new TVConsole({
|
|
158
|
+
focusKey: '12345', // Key combination to focus console
|
|
159
|
+
unfocusKey: 'Escape', // Key to unfocus console
|
|
160
|
+
enableKeyboardNav: true, // Enable arrow key scrolling
|
|
161
|
+
showFocusIndicator: true, // Show green border when focused
|
|
162
|
+
onFocus: () => {
|
|
163
|
+
console.log('Console gained focus - pausing app functionality');
|
|
164
|
+
// Handle focus gain (e.g., pause app, show instructions)
|
|
165
|
+
},
|
|
166
|
+
onUnfocus: () => {
|
|
167
|
+
console.log('Console lost focus - returning to app');
|
|
168
|
+
// Handle focus loss (e.g., resume app functionality)
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Keyboard Navigation (when focused):**
|
|
174
|
+
- `Arrow Up/Down` - Scroll up/down by 20px
|
|
175
|
+
- `Page Up/Down` - Scroll up/down by one page
|
|
176
|
+
- `Home` - Scroll to top
|
|
177
|
+
- `End` - Scroll to bottom
|
|
178
|
+
- `Escape` - Unfocus console
|
|
179
|
+
|
|
180
|
+
**Focus Management:**
|
|
181
|
+
- Type `12345` (or your custom key combination) to focus the console
|
|
182
|
+
- When focused, the console shows a green border indicator
|
|
183
|
+
- Use arrow keys to scroll through log history
|
|
184
|
+
- Press `Escape` to unfocus and return to your app
|
|
185
|
+
|
|
186
|
+
### Conditional Console
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { TVConsole } from 'tv-console';
|
|
190
|
+
|
|
191
|
+
// Only enable in development
|
|
192
|
+
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
193
|
+
const tvConsole = new TVConsole({
|
|
194
|
+
enabled: isDevelopment,
|
|
195
|
+
position: 'top-right'
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Conditionally show console
|
|
199
|
+
if (isDevelopment) {
|
|
200
|
+
tvConsole.show();
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Custom Styling
|
|
205
|
+
|
|
206
|
+
```css
|
|
207
|
+
/* Custom CSS for the console overlay */
|
|
208
|
+
.tv-console {
|
|
209
|
+
border: 2px solid #00ff00;
|
|
210
|
+
border-radius: 8px;
|
|
211
|
+
font-family: 'Courier New', monospace;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.tv-console-error {
|
|
215
|
+
color: #ff4444;
|
|
216
|
+
font-weight: bold;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.tv-console-warn {
|
|
220
|
+
color: #ffaa00;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.tv-console-info {
|
|
224
|
+
color: #44aaff;
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Browser Support
|
|
229
|
+
|
|
230
|
+
This package works in all modern browsers that support:
|
|
231
|
+
- ES2020 features
|
|
232
|
+
- DOM manipulation
|
|
233
|
+
- CSS Grid/Flexbox
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
MIT
|
|
238
|
+
|
|
239
|
+
## Contributing
|
|
240
|
+
|
|
241
|
+
1. Fork the repository
|
|
242
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
243
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
244
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
245
|
+
5. Open a Pull Request
|
|
246
|
+
|
|
247
|
+
## Changelog
|
|
248
|
+
|
|
249
|
+
### 1.0.0
|
|
250
|
+
- Initial release
|
|
251
|
+
- Basic console overlay functionality
|
|
252
|
+
- Configurable styling and positioning
|
|
253
|
+
- Log level filtering
|
|
254
|
+
- Export functionality
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
interface TVConsoleConfig {
|
|
2
|
+
/** Enable/disable the TV console */
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
/** Maximum number of log entries to keep in memory */
|
|
5
|
+
maxEntries?: number;
|
|
6
|
+
/** Position of the console overlay on screen */
|
|
7
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
8
|
+
/** Width of the console overlay */
|
|
9
|
+
width?: string;
|
|
10
|
+
/** Height of the console overlay */
|
|
11
|
+
height?: string;
|
|
12
|
+
/** Background color of the console overlay */
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
/** Text color of the console overlay */
|
|
15
|
+
textColor?: string;
|
|
16
|
+
/** Font size of the console text */
|
|
17
|
+
fontSize?: string;
|
|
18
|
+
/** Opacity of the console overlay */
|
|
19
|
+
opacity?: number;
|
|
20
|
+
/** Show timestamp with each log entry */
|
|
21
|
+
showTimestamp?: boolean;
|
|
22
|
+
/** Custom CSS class for styling */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Z-index of the console overlay */
|
|
25
|
+
zIndex?: number;
|
|
26
|
+
/** Show log level indicators */
|
|
27
|
+
showLogLevel?: boolean;
|
|
28
|
+
/** Filter log levels to display */
|
|
29
|
+
logLevels?: LogLevel[];
|
|
30
|
+
/** Custom formatter for log messages */
|
|
31
|
+
formatter?: (entry: LogEntry) => string;
|
|
32
|
+
/** Key combination to focus the console (default: '12345') */
|
|
33
|
+
focusKey?: string;
|
|
34
|
+
/** Key to unfocus the console (default: 'Escape') */
|
|
35
|
+
unfocusKey?: string;
|
|
36
|
+
/** Callback function called when console gains focus */
|
|
37
|
+
onFocus?: () => void;
|
|
38
|
+
/** Callback function called when console loses focus */
|
|
39
|
+
onUnfocus?: () => void;
|
|
40
|
+
/** Enable keyboard navigation for scrolling */
|
|
41
|
+
enableKeyboardNav?: boolean;
|
|
42
|
+
/** Show focus indicator when console is focused */
|
|
43
|
+
showFocusIndicator?: boolean;
|
|
44
|
+
}
|
|
45
|
+
type LogLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
|
|
46
|
+
interface LogEntry {
|
|
47
|
+
id: string;
|
|
48
|
+
level: LogLevel;
|
|
49
|
+
message: string;
|
|
50
|
+
timestamp: Date;
|
|
51
|
+
data?: any[];
|
|
52
|
+
stack?: string;
|
|
53
|
+
}
|
|
54
|
+
interface TVConsoleInstance {
|
|
55
|
+
log: (...args: any[]) => void;
|
|
56
|
+
info: (...args: any[]) => void;
|
|
57
|
+
warn: (...args: any[]) => void;
|
|
58
|
+
error: (...args: any[]) => void;
|
|
59
|
+
debug: (...args: any[]) => void;
|
|
60
|
+
clear: () => void;
|
|
61
|
+
show: () => void;
|
|
62
|
+
hide: () => void;
|
|
63
|
+
toggle: () => void;
|
|
64
|
+
destroy: () => void;
|
|
65
|
+
getLogs: () => LogEntry[];
|
|
66
|
+
setConfig: (config: Partial<TVConsoleConfig>) => void;
|
|
67
|
+
exportLogs: () => string;
|
|
68
|
+
focus: () => void;
|
|
69
|
+
unfocus: () => void;
|
|
70
|
+
isFocused: () => boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class TVConsole implements TVConsoleInstance {
|
|
74
|
+
private config;
|
|
75
|
+
private logs;
|
|
76
|
+
private container;
|
|
77
|
+
private isVisible;
|
|
78
|
+
private originalConsole;
|
|
79
|
+
private _isFocused;
|
|
80
|
+
private keyBuffer;
|
|
81
|
+
private keyBufferTimeout;
|
|
82
|
+
constructor(config?: TVConsoleConfig);
|
|
83
|
+
private initialize;
|
|
84
|
+
private createContainer;
|
|
85
|
+
private getPositionStyles;
|
|
86
|
+
private interceptConsole;
|
|
87
|
+
private addLog;
|
|
88
|
+
private formatArgument;
|
|
89
|
+
private render;
|
|
90
|
+
private escapeHtml;
|
|
91
|
+
private setupKeyboardListeners;
|
|
92
|
+
private handleKeyDown;
|
|
93
|
+
log(...args: any[]): void;
|
|
94
|
+
info(...args: any[]): void;
|
|
95
|
+
warn(...args: any[]): void;
|
|
96
|
+
error(...args: any[]): void;
|
|
97
|
+
debug(...args: any[]): void;
|
|
98
|
+
clear(): void;
|
|
99
|
+
show(): void;
|
|
100
|
+
hide(): void;
|
|
101
|
+
toggle(): void;
|
|
102
|
+
focus(): void;
|
|
103
|
+
unfocus(): void;
|
|
104
|
+
isFocused(): boolean;
|
|
105
|
+
destroy(): void;
|
|
106
|
+
getLogs(): LogEntry[];
|
|
107
|
+
setConfig(config: Partial<TVConsoleConfig>): void;
|
|
108
|
+
exportLogs(): string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=index.d.ts.map
|
|
112
|
+
|
|
113
|
+
export { TVConsole, TVConsole as default };
|
|
114
|
+
export type { LogEntry, LogLevel, TVConsoleConfig, TVConsoleInstance };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGzF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +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","setConfig","exportLogs","toISOString"],"mappings":"AAEA,MAAMA,EAA4C,CAChDC,SAAS,EACTC,WAAY,IACZC,SAAU,YACVC,MAAO,QACPC,OAAQ,QACRC,gBAAiB,qBACjBC,UAAW,UACXC,SAAU,OACVC,QAAS,GACTC,eAAe,EACfC,UAAW,aACXC,OAAQ,KACRC,cAAc,EACdC,UAAW,CAAC,MAAO,OAAQ,OAAQ,QAAS,SAC5CC,UAAYC,GAIH,GADuC,IAF5BA,EAAMC,UAAUC,2BACU,IAAIF,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AAKH,OAAOH,qBACdM,KAAKQ,UAAUI,MAAMwE,OAAS,GAC9BpF,KAAKQ,UAAUI,MAAMyE,UAAY,iCAI/BrF,KAAKH,OAAOL,WACdQ,KAAKH,OAAOL,YAEf,CAED,SAAA+F,GACE,OAAOvF,KAAKuE,UACb,CAED,OAAAiB,GACMxF,KAAKQ,YACPC,SAASM,KAAK0E,YAAYzF,KAAKQ,WAC/BR,KAAKQ,UAAY,MAInBV,OAAO4F,OAAOxF,QAASF,KAAKC,gBAC7B,CAED,OAAA0F,GACE,MAAO,IAAI3F,KAAKuC,KACjB,CAED,SAAAqD,CAAU/F,GACRG,KAAKH,OAAS,IAAKG,KAAKH,UAAWA,GAE/BG,KAAKQ,YACPR,KAAKQ,UAAUI,MAAMC,QAAU,uCAE3Bb,KAAKc,uCACEd,KAAKH,OAAO3B,2BACX8B,KAAKH,OAAO1B,sCACF6B,KAAKH,OAAOzB,oCACvB4B,KAAKH,OAAOxB,kFAER2B,KAAKH,OAAOvB,+GAId0B,KAAKH,OAAOnB,6BACZsB,KAAKH,OAAOtB,8BACZyB,KAAKiF,UAAY,QAAU,8JAMxCjF,KAAKQ,UAAUG,SAAWX,KAAKH,OAAOJ,kBAAoB,GAAK,GAGjEO,KAAKO,QACN,CAED,UAAAsF,GACE,OAAO7F,KAAKuC,KAAKf,IAAI2B,GAEZ,IADWA,EAAIpE,UAAU+G,mBACN3C,EAAIlE,MAAMC,kBAAkBiE,EAAIhE,WACzDwC,KAAK,KACT"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});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")}}exports.TVConsole=t,exports.default=t;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.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","setConfig","exportLogs","toISOString"],"mappings":"oEAEA,MAAMA,EAA4C,CAChDC,SAAS,EACTC,WAAY,IACZC,SAAU,YACVC,MAAO,QACPC,OAAQ,QACRC,gBAAiB,qBACjBC,UAAW,UACXC,SAAU,OACVC,QAAS,GACTC,eAAe,EACfC,UAAW,aACXC,OAAQ,KACRC,cAAc,EACdC,UAAW,CAAC,MAAO,OAAQ,OAAQ,QAAS,SAC5CC,UAAYC,GAIH,GADuC,IAF5BA,EAAMC,UAAUC,2BACU,IAAIF,EAAMG,MAAMC,oBAE/BJ,EAAMK,UAAUC,OAE/CC,SAAU,QACVC,WAAY,SACZC,QAAS,OACTC,UAAW,OACXC,mBAAmB,EACnBC,oBAAoB,SAGTC,EAUX,WAAAC,CAAYC,EAA0B,IAT9BC,OAAAC,eAAAC,KAAA,SAAA,0DACAF,OAAAC,eAAAC,KAAA,OAAA,iDAAmB,KACnBF,OAAAC,eAAAC,KAAA,YAAA,iDAAmC,OACnCF,OAAAC,eAAAC,KAAA,YAAA,kDAAY,IACZF,OAAAC,eAAAC,KAAA,kBAAA,0DACAF,OAAAC,eAAAC,KAAA,aAAA,kDAAa,IACbF,OAAAC,eAAAC,KAAA,YAAA,iDAAY,KACZF,OAAAC,eAAAC,KAAA,mBAAA,iDAAkC,OAGxCA,KAAKH,OAAS,IAAK/B,KAAmB+B,GACtCG,KAAKC,gBAAkBC,QACvBF,KAAKG,YACN,CAEO,UAAAA,GACDH,KAAKH,OAAO9B,UAEjBiC,KAAKI,kBACLJ,KAAKK,mBACLL,KAAKM,yBACLN,KAAKO,SACN,CAEO,eAAAH,GACNJ,KAAKQ,UAAYC,SAASC,cAAc,OACxCV,KAAKQ,UAAU/B,UA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AKH,OAAOJ,kBAAoB,GAAK,GAGjEO,KAAKO,QACN,CAED,UAAAsF,GACE,OAAO7F,KAAKuC,KAAKf,IAAI2B,GAEZ,IADWA,EAAIpE,UAAU+G,mBACN3C,EAAIlE,MAAMC,kBAAkBiE,EAAIhE,WACzDwC,KAAK,KACT"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TVConsoleConfig, LogEntry, TVConsoleInstance } from './types';
|
|
2
|
+
export declare class TVConsole implements TVConsoleInstance {
|
|
3
|
+
private config;
|
|
4
|
+
private logs;
|
|
5
|
+
private container;
|
|
6
|
+
private isVisible;
|
|
7
|
+
private originalConsole;
|
|
8
|
+
private _isFocused;
|
|
9
|
+
private keyBuffer;
|
|
10
|
+
private keyBufferTimeout;
|
|
11
|
+
constructor(config?: TVConsoleConfig);
|
|
12
|
+
private initialize;
|
|
13
|
+
private createContainer;
|
|
14
|
+
private getPositionStyles;
|
|
15
|
+
private interceptConsole;
|
|
16
|
+
private addLog;
|
|
17
|
+
private formatArgument;
|
|
18
|
+
private render;
|
|
19
|
+
private escapeHtml;
|
|
20
|
+
private setupKeyboardListeners;
|
|
21
|
+
private handleKeyDown;
|
|
22
|
+
log(...args: any[]): void;
|
|
23
|
+
info(...args: any[]): void;
|
|
24
|
+
warn(...args: any[]): void;
|
|
25
|
+
error(...args: any[]): void;
|
|
26
|
+
debug(...args: any[]): void;
|
|
27
|
+
clear(): void;
|
|
28
|
+
show(): void;
|
|
29
|
+
hide(): void;
|
|
30
|
+
toggle(): void;
|
|
31
|
+
focus(): void;
|
|
32
|
+
unfocus(): void;
|
|
33
|
+
isFocused(): boolean;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
getLogs(): LogEntry[];
|
|
36
|
+
setConfig(config: Partial<TVConsoleConfig>): void;
|
|
37
|
+
exportLogs(): string;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=tv-console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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,IAAI,QAAQ,EAAE;IAIrB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IA8BjD,UAAU,IAAI,MAAM;CAMrB"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface TVConsoleConfig {
|
|
2
|
+
/** Enable/disable the TV console */
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
/** Maximum number of log entries to keep in memory */
|
|
5
|
+
maxEntries?: number;
|
|
6
|
+
/** Position of the console overlay on screen */
|
|
7
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
8
|
+
/** Width of the console overlay */
|
|
9
|
+
width?: string;
|
|
10
|
+
/** Height of the console overlay */
|
|
11
|
+
height?: string;
|
|
12
|
+
/** Background color of the console overlay */
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
/** Text color of the console overlay */
|
|
15
|
+
textColor?: string;
|
|
16
|
+
/** Font size of the console text */
|
|
17
|
+
fontSize?: string;
|
|
18
|
+
/** Opacity of the console overlay */
|
|
19
|
+
opacity?: number;
|
|
20
|
+
/** Show timestamp with each log entry */
|
|
21
|
+
showTimestamp?: boolean;
|
|
22
|
+
/** Custom CSS class for styling */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Z-index of the console overlay */
|
|
25
|
+
zIndex?: number;
|
|
26
|
+
/** Show log level indicators */
|
|
27
|
+
showLogLevel?: boolean;
|
|
28
|
+
/** Filter log levels to display */
|
|
29
|
+
logLevels?: LogLevel[];
|
|
30
|
+
/** Custom formatter for log messages */
|
|
31
|
+
formatter?: (entry: LogEntry) => string;
|
|
32
|
+
/** Key combination to focus the console (default: '12345') */
|
|
33
|
+
focusKey?: string;
|
|
34
|
+
/** Key to unfocus the console (default: 'Escape') */
|
|
35
|
+
unfocusKey?: string;
|
|
36
|
+
/** Callback function called when console gains focus */
|
|
37
|
+
onFocus?: () => void;
|
|
38
|
+
/** Callback function called when console loses focus */
|
|
39
|
+
onUnfocus?: () => void;
|
|
40
|
+
/** Enable keyboard navigation for scrolling */
|
|
41
|
+
enableKeyboardNav?: boolean;
|
|
42
|
+
/** Show focus indicator when console is focused */
|
|
43
|
+
showFocusIndicator?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export type LogLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
|
|
46
|
+
export interface LogEntry {
|
|
47
|
+
id: string;
|
|
48
|
+
level: LogLevel;
|
|
49
|
+
message: string;
|
|
50
|
+
timestamp: Date;
|
|
51
|
+
data?: any[];
|
|
52
|
+
stack?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface TVConsoleInstance {
|
|
55
|
+
log: (...args: any[]) => void;
|
|
56
|
+
info: (...args: any[]) => void;
|
|
57
|
+
warn: (...args: any[]) => void;
|
|
58
|
+
error: (...args: any[]) => void;
|
|
59
|
+
debug: (...args: any[]) => void;
|
|
60
|
+
clear: () => void;
|
|
61
|
+
show: () => void;
|
|
62
|
+
hide: () => void;
|
|
63
|
+
toggle: () => void;
|
|
64
|
+
destroy: () => void;
|
|
65
|
+
getLogs: () => LogEntry[];
|
|
66
|
+
setConfig: (config: Partial<TVConsoleConfig>) => void;
|
|
67
|
+
exportLogs: () => string;
|
|
68
|
+
focus: () => void;
|
|
69
|
+
unfocus: () => void;
|
|
70
|
+
isFocused: () => boolean;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACrE,mCAAmC;IACnC,KAAK,CAAC,EA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,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC9B,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC/B,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAChC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAChC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,QAAQ,EAAE,CAAC;IAC1B,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACtD,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,OAAO,CAAC;CAC1B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tv-console",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A console replacement for TV apps where browser console is not accessible",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.esm.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "vite",
|
|
20
|
+
"build": "rollup -c",
|
|
21
|
+
"clean": "rimraf dist",
|
|
22
|
+
"prebuild": "npm run clean",
|
|
23
|
+
"prepublishOnly": "npm run build",
|
|
24
|
+
"test": "jest",
|
|
25
|
+
"lint": "eslint src --ext .ts",
|
|
26
|
+
"type-check": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"console",
|
|
30
|
+
"tv",
|
|
31
|
+
"smart-tv",
|
|
32
|
+
"debugging",
|
|
33
|
+
"logging",
|
|
34
|
+
"typescript"
|
|
35
|
+
],
|
|
36
|
+
"author": "Your Name",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
40
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
41
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
42
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
43
|
+
"@types/jest": "^29.0.0",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
45
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
46
|
+
"eslint": "^8.0.0",
|
|
47
|
+
"jest": "^29.0.0",
|
|
48
|
+
"rimraf": "^5.0.0",
|
|
49
|
+
"rollup": "^3.29.0",
|
|
50
|
+
"rollup-plugin-dts": "^6.0.0",
|
|
51
|
+
"ts-jest": "^29.0.0",
|
|
52
|
+
"typescript": "~5.8.3",
|
|
53
|
+
"vite": "^6.3.5"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/yourusername/tv-console.git"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/yourusername/tv-console/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/yourusername/tv-console#readme",
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"tslib": "^2.8.1"
|
|
65
|
+
}
|
|
66
|
+
}
|