x-shell.js 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui/styles.js CHANGED
@@ -5,121 +5,121 @@ import { css } from 'lit';
5
5
  /**
6
6
  * Theme styles - sets CSS custom properties based on theme attribute
7
7
  */
8
- export const themeStyles = css `
9
- /* Light theme */
10
- :host([theme='light']) {
11
- --xs-bg: #ffffff;
12
- --xs-bg-header: #f5f5f5;
13
- --xs-text: #1f2937;
14
- --xs-text-muted: #6b7280;
15
- --xs-border: #e5e7eb;
16
- --xs-terminal-bg: #ffffff;
17
- --xs-terminal-fg: #1f2937;
18
- --xs-terminal-cursor: #1f2937;
19
- --xs-terminal-selection: #b4d5fe;
20
- --xs-btn-bg: #e5e7eb;
21
- --xs-btn-text: #374151;
22
- --xs-btn-hover: #d1d5db;
23
- --xs-status-connected: #22c55e;
24
- --xs-status-disconnected: #ef4444;
25
- }
26
-
27
- /* Dark theme (default) */
28
- :host,
29
- :host([theme='dark']) {
30
- --xs-bg: #1e1e1e;
31
- --xs-bg-header: #2d2d2d;
32
- --xs-text: #cccccc;
33
- --xs-text-muted: #808080;
34
- --xs-border: #3e3e3e;
35
- --xs-terminal-bg: #1e1e1e;
36
- --xs-terminal-fg: #cccccc;
37
- --xs-terminal-cursor: #ffffff;
38
- --xs-terminal-selection: #264f78;
39
- --xs-btn-bg: #3c3c3c;
40
- --xs-btn-text: #cccccc;
41
- --xs-btn-hover: #4a4a4a;
42
- --xs-status-connected: #22c55e;
43
- --xs-status-disconnected: #ef4444;
44
- }
45
-
46
- /* Auto theme - follows system preference */
47
- :host([theme='auto']) {
48
- --xs-bg: #1e1e1e;
49
- --xs-bg-header: #2d2d2d;
50
- --xs-text: #cccccc;
51
- --xs-text-muted: #808080;
52
- --xs-border: #3e3e3e;
53
- --xs-terminal-bg: #1e1e1e;
54
- --xs-terminal-fg: #cccccc;
55
- --xs-terminal-cursor: #ffffff;
56
- --xs-terminal-selection: #264f78;
57
- --xs-btn-bg: #3c3c3c;
58
- --xs-btn-text: #cccccc;
59
- --xs-btn-hover: #4a4a4a;
60
- --xs-status-connected: #22c55e;
61
- --xs-status-disconnected: #ef4444;
62
- }
63
-
64
- @media (prefers-color-scheme: light) {
65
- :host([theme='auto']) {
66
- --xs-bg: #ffffff;
67
- --xs-bg-header: #f5f5f5;
68
- --xs-text: #1f2937;
69
- --xs-text-muted: #6b7280;
70
- --xs-border: #e5e7eb;
71
- --xs-terminal-bg: #ffffff;
72
- --xs-terminal-fg: #1f2937;
73
- --xs-terminal-cursor: #1f2937;
74
- --xs-terminal-selection: #b4d5fe;
75
- --xs-btn-bg: #e5e7eb;
76
- --xs-btn-text: #374151;
77
- --xs-btn-hover: #d1d5db;
78
- }
79
- }
8
+ export const themeStyles = css `
9
+ /* Light theme */
10
+ :host([theme='light']) {
11
+ --xs-bg: #ffffff;
12
+ --xs-bg-header: #f5f5f5;
13
+ --xs-text: #1f2937;
14
+ --xs-text-muted: #6b7280;
15
+ --xs-border: #e5e7eb;
16
+ --xs-terminal-bg: #ffffff;
17
+ --xs-terminal-fg: #1f2937;
18
+ --xs-terminal-cursor: #1f2937;
19
+ --xs-terminal-selection: #b4d5fe;
20
+ --xs-btn-bg: #e5e7eb;
21
+ --xs-btn-text: #374151;
22
+ --xs-btn-hover: #d1d5db;
23
+ --xs-status-connected: #22c55e;
24
+ --xs-status-disconnected: #ef4444;
25
+ }
26
+
27
+ /* Dark theme (default) */
28
+ :host,
29
+ :host([theme='dark']) {
30
+ --xs-bg: #1e1e1e;
31
+ --xs-bg-header: #2d2d2d;
32
+ --xs-text: #cccccc;
33
+ --xs-text-muted: #808080;
34
+ --xs-border: #3e3e3e;
35
+ --xs-terminal-bg: #1e1e1e;
36
+ --xs-terminal-fg: #cccccc;
37
+ --xs-terminal-cursor: #ffffff;
38
+ --xs-terminal-selection: #264f78;
39
+ --xs-btn-bg: #3c3c3c;
40
+ --xs-btn-text: #cccccc;
41
+ --xs-btn-hover: #4a4a4a;
42
+ --xs-status-connected: #22c55e;
43
+ --xs-status-disconnected: #ef4444;
44
+ }
45
+
46
+ /* Auto theme - follows system preference */
47
+ :host([theme='auto']) {
48
+ --xs-bg: #1e1e1e;
49
+ --xs-bg-header: #2d2d2d;
50
+ --xs-text: #cccccc;
51
+ --xs-text-muted: #808080;
52
+ --xs-border: #3e3e3e;
53
+ --xs-terminal-bg: #1e1e1e;
54
+ --xs-terminal-fg: #cccccc;
55
+ --xs-terminal-cursor: #ffffff;
56
+ --xs-terminal-selection: #264f78;
57
+ --xs-btn-bg: #3c3c3c;
58
+ --xs-btn-text: #cccccc;
59
+ --xs-btn-hover: #4a4a4a;
60
+ --xs-status-connected: #22c55e;
61
+ --xs-status-disconnected: #ef4444;
62
+ }
63
+
64
+ @media (prefers-color-scheme: light) {
65
+ :host([theme='auto']) {
66
+ --xs-bg: #ffffff;
67
+ --xs-bg-header: #f5f5f5;
68
+ --xs-text: #1f2937;
69
+ --xs-text-muted: #6b7280;
70
+ --xs-border: #e5e7eb;
71
+ --xs-terminal-bg: #ffffff;
72
+ --xs-terminal-fg: #1f2937;
73
+ --xs-terminal-cursor: #1f2937;
74
+ --xs-terminal-selection: #b4d5fe;
75
+ --xs-btn-bg: #e5e7eb;
76
+ --xs-btn-text: #374151;
77
+ --xs-btn-hover: #d1d5db;
78
+ }
79
+ }
80
80
  `;
81
81
  /**
82
82
  * Shared base styles
83
83
  */
84
- export const sharedStyles = css `
85
- :host {
86
- display: block;
87
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
88
- Ubuntu, Cantarell, sans-serif;
89
- font-size: 14px;
90
- color: var(--xs-text);
91
- background: var(--xs-bg);
92
- }
93
-
94
- * {
95
- box-sizing: border-box;
96
- }
84
+ export const sharedStyles = css `
85
+ :host {
86
+ display: block;
87
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
88
+ Ubuntu, Cantarell, sans-serif;
89
+ font-size: 14px;
90
+ color: var(--xs-text);
91
+ background: var(--xs-bg);
92
+ }
93
+
94
+ * {
95
+ box-sizing: border-box;
96
+ }
97
97
  `;
98
98
  /**
99
99
  * Button styles
100
100
  */
101
- export const buttonStyles = css `
102
- button {
103
- display: inline-flex;
104
- align-items: center;
105
- gap: 4px;
106
- padding: 6px 12px;
107
- border: none;
108
- border-radius: 4px;
109
- background: var(--xs-btn-bg);
110
- color: var(--xs-btn-text);
111
- font-size: 13px;
112
- cursor: pointer;
113
- transition: background-color 0.15s;
114
- }
115
-
116
- button:hover {
117
- background: var(--xs-btn-hover);
118
- }
119
-
120
- button:disabled {
121
- opacity: 0.5;
122
- cursor: not-allowed;
123
- }
101
+ export const buttonStyles = css `
102
+ button {
103
+ display: inline-flex;
104
+ align-items: center;
105
+ gap: 4px;
106
+ padding: 6px 12px;
107
+ border: none;
108
+ border-radius: 4px;
109
+ background: var(--xs-btn-bg);
110
+ color: var(--xs-btn-text);
111
+ font-size: 13px;
112
+ cursor: pointer;
113
+ transition: background-color 0.15s;
114
+ }
115
+
116
+ button:hover {
117
+ background: var(--xs-btn-hover);
118
+ }
119
+
120
+ button:disabled {
121
+ opacity: 0.5;
122
+ cursor: not-allowed;
123
+ }
124
124
  `;
125
125
  //# sourceMappingURL=styles.js.map
@@ -329,45 +329,45 @@ let XShellTerminal = class XShellTerminal extends LitElement {
329
329
  this.fitAddon = null;
330
330
  }
331
331
  render() {
332
- return html `
332
+ return html `
333
333
  ${this.noHeader
334
334
  ? nothing
335
- : html `
336
- <div class="header">
337
- <div class="header-title">
338
- <span>Terminal</span>
335
+ : html `
336
+ <div class="header">
337
+ <div class="header-title">
338
+ <span>Terminal</span>
339
339
  ${this.sessionInfo
340
- ? html `<span style="font-weight: normal; font-size: 12px; color: var(--xs-text-muted)">
341
- ${this.sessionInfo.shell}
340
+ ? html `<span style="font-weight: normal; font-size: 12px; color: var(--xs-text-muted)">
341
+ ${this.sessionInfo.shell}
342
342
  </span>`
343
- : nothing}
344
- </div>
345
- <div class="header-actions">
343
+ : nothing}
344
+ </div>
345
+ <div class="header-actions">
346
346
  ${!this.connected
347
- ? html `<button @click=${this.connect} ?disabled=${this.loading}>
348
- ${this.loading ? 'Connecting...' : 'Connect'}
347
+ ? html `<button @click=${this.connect} ?disabled=${this.loading}>
348
+ ${this.loading ? 'Connecting...' : 'Connect'}
349
349
  </button>`
350
350
  : !this.sessionActive
351
- ? html `<button @click=${() => this.spawn()} ?disabled=${this.loading}>
352
- ${this.loading ? 'Spawning...' : 'Start'}
351
+ ? html `<button @click=${() => this.spawn()} ?disabled=${this.loading}>
352
+ ${this.loading ? 'Spawning...' : 'Start'}
353
353
  </button>`
354
- : html `<button @click=${this.kill}>Stop</button>`}
355
- <button @click=${this.clear} ?disabled=${!this.sessionActive}>Clear</button>
356
- <div class="status">
357
- <span class="status-dot ${this.connected ? 'connected' : ''}"></span>
358
- <span>${this.connected ? 'Connected' : 'Disconnected'}</span>
359
- </div>
360
- </div>
361
- </div>
362
- `}
363
-
364
- <div class="terminal-container">
354
+ : html `<button @click=${this.kill}>Stop</button>`}
355
+ <button @click=${this.clear} ?disabled=${!this.sessionActive}>Clear</button>
356
+ <div class="status">
357
+ <span class="status-dot ${this.connected ? 'connected' : ''}"></span>
358
+ <span>${this.connected ? 'Connected' : 'Disconnected'}</span>
359
+ </div>
360
+ </div>
361
+ </div>
362
+ `}
363
+
364
+ <div class="terminal-container">
365
365
  ${this.loading && !this.terminal
366
366
  ? html `<div class="loading"><span class="loading-spinner">⏳</span> Loading...</div>`
367
367
  : this.error && !this.terminal
368
368
  ? html `<div class="error">❌ ${this.error}</div>`
369
- : nothing}
370
- </div>
369
+ : nothing}
370
+ </div>
371
371
  `;
372
372
  }
373
373
  };
@@ -375,105 +375,105 @@ XShellTerminal.styles = [
375
375
  sharedStyles,
376
376
  themeStyles,
377
377
  buttonStyles,
378
- css `
379
- :host {
380
- display: flex;
381
- flex-direction: column;
382
- height: 100%;
383
- min-height: 200px;
384
- border: 1px solid var(--xs-border);
385
- border-radius: 4px;
386
- overflow: hidden;
387
- }
388
-
389
- .header {
390
- display: flex;
391
- align-items: center;
392
- justify-content: space-between;
393
- padding: 8px 12px;
394
- background: var(--xs-bg-header);
395
- border-bottom: 1px solid var(--xs-border);
396
- }
397
-
398
- .header-title {
399
- display: flex;
400
- align-items: center;
401
- gap: 8px;
402
- font-weight: 600;
403
- }
404
-
405
- .header-actions {
406
- display: flex;
407
- gap: 8px;
408
- }
409
-
410
- .status {
411
- display: flex;
412
- align-items: center;
413
- gap: 6px;
414
- font-size: 12px;
415
- color: var(--xs-text-muted);
416
- }
417
-
418
- .status-dot {
419
- width: 8px;
420
- height: 8px;
421
- border-radius: 50%;
422
- background: var(--xs-status-disconnected);
423
- }
424
-
425
- .status-dot.connected {
426
- background: var(--xs-status-connected);
427
- }
428
-
429
- .terminal-container {
430
- flex: 1;
431
- padding: 4px;
432
- background: var(--xs-terminal-bg);
433
- overflow: hidden;
434
- }
435
-
436
- .terminal-container .xterm {
437
- height: 100%;
438
- }
439
-
440
- .terminal-container .xterm-viewport {
441
- overflow-y: auto;
442
- }
443
-
444
- .loading,
445
- .error {
446
- display: flex;
447
- align-items: center;
448
- justify-content: center;
449
- height: 100%;
450
- padding: 20px;
451
- text-align: center;
452
- color: var(--xs-text-muted);
453
- }
454
-
455
- .error {
456
- color: #ef4444;
457
- }
458
-
459
- .loading-spinner {
460
- animation: spin 1s linear infinite;
461
- margin-right: 8px;
462
- }
463
-
464
- @keyframes spin {
465
- from {
466
- transform: rotate(0deg);
467
- }
468
- to {
469
- transform: rotate(360deg);
470
- }
471
- }
472
-
473
- /* Hide header if requested */
474
- :host([no-header]) .header {
475
- display: none;
476
- }
378
+ css `
379
+ :host {
380
+ display: flex;
381
+ flex-direction: column;
382
+ height: 100%;
383
+ min-height: 200px;
384
+ border: 1px solid var(--xs-border);
385
+ border-radius: 4px;
386
+ overflow: hidden;
387
+ }
388
+
389
+ .header {
390
+ display: flex;
391
+ align-items: center;
392
+ justify-content: space-between;
393
+ padding: 8px 12px;
394
+ background: var(--xs-bg-header);
395
+ border-bottom: 1px solid var(--xs-border);
396
+ }
397
+
398
+ .header-title {
399
+ display: flex;
400
+ align-items: center;
401
+ gap: 8px;
402
+ font-weight: 600;
403
+ }
404
+
405
+ .header-actions {
406
+ display: flex;
407
+ gap: 8px;
408
+ }
409
+
410
+ .status {
411
+ display: flex;
412
+ align-items: center;
413
+ gap: 6px;
414
+ font-size: 12px;
415
+ color: var(--xs-text-muted);
416
+ }
417
+
418
+ .status-dot {
419
+ width: 8px;
420
+ height: 8px;
421
+ border-radius: 50%;
422
+ background: var(--xs-status-disconnected);
423
+ }
424
+
425
+ .status-dot.connected {
426
+ background: var(--xs-status-connected);
427
+ }
428
+
429
+ .terminal-container {
430
+ flex: 1;
431
+ padding: 4px;
432
+ background: var(--xs-terminal-bg);
433
+ overflow: hidden;
434
+ }
435
+
436
+ .terminal-container .xterm {
437
+ height: 100%;
438
+ }
439
+
440
+ .terminal-container .xterm-viewport {
441
+ overflow-y: auto;
442
+ }
443
+
444
+ .loading,
445
+ .error {
446
+ display: flex;
447
+ align-items: center;
448
+ justify-content: center;
449
+ height: 100%;
450
+ padding: 20px;
451
+ text-align: center;
452
+ color: var(--xs-text-muted);
453
+ }
454
+
455
+ .error {
456
+ color: #ef4444;
457
+ }
458
+
459
+ .loading-spinner {
460
+ animation: spin 1s linear infinite;
461
+ margin-right: 8px;
462
+ }
463
+
464
+ @keyframes spin {
465
+ from {
466
+ transform: rotate(0deg);
467
+ }
468
+ to {
469
+ transform: rotate(360deg);
470
+ }
471
+ }
472
+
473
+ /* Hide header if requested */
474
+ :host([no-header]) .header {
475
+ display: none;
476
+ }
477
477
  `,
478
478
  ];
479
479
  __decorate([