@myop/cli 0.1.4 → 0.1.6

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.
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Generate the management website HTML
3
+ * @param {number} PORT - Main server port
4
+ * @param {number} MGMT_PORT - Management server port
5
+ * @param {string} styles - CSS styles content
6
+ * @param {string} appJs - JavaScript app content
7
+ * @returns {string} Complete HTML for the management dashboard
8
+ */
9
+ export function generateManagementHTML(PORT, MGMT_PORT, styles, appJs) {
10
+
11
+ return `<!DOCTYPE html>
12
+ <html lang="en">
13
+ <head>
14
+ <meta charset="UTF-8">
15
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
16
+ <title>Myop DevTools - localhost:${PORT}</title>
17
+ <style>
18
+ ${styles}
19
+ </style>
20
+ </head>
21
+ <body>
22
+ <div class="devtools-container">
23
+ <div class="toolbar">
24
+ <div class="toolbar-title">Myop DevTools</div>
25
+ <div class="toolbar-info">
26
+ <span><div class="status-dot"></div> localhost:${PORT}</span>
27
+ <span>Management: ${MGMT_PORT}</span>
28
+ </div>
29
+ </div>
30
+
31
+ <div class="tabs">
32
+ <div class="tab active">Network Architecture</div>
33
+ <div class="tab">Performance</div>
34
+ <div class="tab">Console</div>
35
+ </div>
36
+
37
+ <div class="main-content">
38
+ <div class="panel-left">
39
+ <div class="visualization-area">
40
+ <div class="zoom-controls">
41
+ <button class="zoom-btn" id="zoom-in" title="Zoom In">+</button>
42
+ <div class="zoom-level" id="zoom-level">100%</div>
43
+ <button class="zoom-btn" id="zoom-out" title="Zoom Out">−</button>
44
+ <button class="zoom-btn" id="zoom-reset" title="Reset">⟲</button>
45
+ </div>
46
+ <svg id="architecture-svg"></svg>
47
+ </div>
48
+
49
+ <div class="section-header">
50
+ <span>⚡</span> METRICS
51
+ </div>
52
+ <div class="stats-grid">
53
+ <div class="stat-item">
54
+ <div class="stat-value" id="total-requests">0</div>
55
+ <div class="stat-label">Total Requests</div>
56
+ </div>
57
+ <div class="stat-item">
58
+ <div class="stat-value" id="local-requests">0</div>
59
+ <div class="stat-label">Served Local</div>
60
+ </div>
61
+ <div class="stat-item">
62
+ <div class="stat-value" id="proxied-requests">0</div>
63
+ <div class="stat-label">Proxied</div>
64
+ </div>
65
+ <div class="stat-item">
66
+ <div class="stat-value" id="origins-count">0</div>
67
+ <div class="stat-label">Origins</div>
68
+ </div>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="panel-right">
73
+ <div class="section-header">
74
+ <span>📦</span> REGISTERED COMPONENTS
75
+ </div>
76
+ <ul class="component-list" id="components">
77
+ <!-- Populated by JavaScript -->
78
+ </ul>
79
+
80
+ <div class="section-header">
81
+ <span>📊</span> ACTIVITY LOG
82
+ </div>
83
+ <div class="console-log" id="activity-log">
84
+ <!-- Populated by JavaScript -->
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </div>
89
+
90
+ <script>
91
+ // Inject PORT as a global variable for the app to use
92
+ window.PORT = ${PORT};
93
+
94
+ ${appJs}
95
+ </script>
96
+ </body>
97
+ </html>`;
98
+ }
@@ -0,0 +1,346 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
9
+ background: #1e1e1e;
10
+ color: #cccccc;
11
+ height: 100vh;
12
+ overflow: hidden;
13
+ }
14
+
15
+ .devtools-container {
16
+ display: flex;
17
+ flex-direction: column;
18
+ height: 100vh;
19
+ background: #1e1e1e;
20
+ }
21
+
22
+ .toolbar {
23
+ background: #323233;
24
+ border-bottom: 1px solid #181818;
25
+ padding: 8px 12px;
26
+ display: flex;
27
+ align-items: center;
28
+ gap: 20px;
29
+ height: 40px;
30
+ }
31
+
32
+ .toolbar-title {
33
+ font-size: 13px;
34
+ color: #cccccc;
35
+ font-weight: 500;
36
+ letter-spacing: 0.5px;
37
+ }
38
+
39
+ .toolbar-info {
40
+ font-size: 11px;
41
+ color: #858585;
42
+ margin-left: auto;
43
+ display: flex;
44
+ gap: 15px;
45
+ }
46
+
47
+ .toolbar-info span {
48
+ display: flex;
49
+ align-items: center;
50
+ gap: 5px;
51
+ }
52
+
53
+ .status-dot {
54
+ width: 6px;
55
+ height: 6px;
56
+ border-radius: 50%;
57
+ background: #75beff;
58
+ }
59
+
60
+ .tabs {
61
+ background: #252526;
62
+ border-bottom: 1px solid #181818;
63
+ display: flex;
64
+ height: 35px;
65
+ }
66
+
67
+ .tab {
68
+ padding: 0 20px;
69
+ display: flex;
70
+ align-items: center;
71
+ font-size: 12px;
72
+ color: #969696;
73
+ cursor: pointer;
74
+ border-right: 1px solid #181818;
75
+ transition: background 0.1s;
76
+ }
77
+
78
+ .tab:hover {
79
+ background: #2a2a2b;
80
+ }
81
+
82
+ .tab.active {
83
+ color: #ffffff;
84
+ background: #1e1e1e;
85
+ border-bottom: 2px solid #007acc;
86
+ }
87
+
88
+ .main-content {
89
+ display: flex;
90
+ flex: 1;
91
+ overflow: hidden;
92
+ }
93
+
94
+ .panel-left {
95
+ flex: 1;
96
+ background: #252526;
97
+ display: flex;
98
+ flex-direction: column;
99
+ border-right: 1px solid #181818;
100
+ }
101
+
102
+ .panel-right {
103
+ width: 350px;
104
+ background: #1e1e1e;
105
+ display: flex;
106
+ flex-direction: column;
107
+ overflow-y: auto;
108
+ }
109
+
110
+ .section-header {
111
+ background: #323233;
112
+ padding: 8px 12px;
113
+ font-size: 11px;
114
+ color: #cccccc;
115
+ font-weight: 600;
116
+ text-transform: uppercase;
117
+ letter-spacing: 0.5px;
118
+ border-bottom: 1px solid #181818;
119
+ display: flex;
120
+ align-items: center;
121
+ gap: 6px;
122
+ }
123
+
124
+ .section-content {
125
+ flex: 1;
126
+ overflow-y: auto;
127
+ }
128
+
129
+ .visualization-area {
130
+ padding: 20px;
131
+ flex: 1;
132
+ overflow: hidden;
133
+ position: relative;
134
+ }
135
+
136
+ #architecture-svg {
137
+ width: 100%;
138
+ height: 600px;
139
+ background: #1e1e1e;
140
+ cursor: grab;
141
+ }
142
+
143
+ #architecture-svg.panning {
144
+ cursor: grabbing;
145
+ }
146
+
147
+ .zoom-controls {
148
+ position: absolute;
149
+ top: 30px;
150
+ right: 30px;
151
+ display: flex;
152
+ flex-direction: column;
153
+ gap: 8px;
154
+ background: #252526;
155
+ border: 1px solid #3e3e42;
156
+ border-radius: 4px;
157
+ padding: 8px;
158
+ z-index: 10;
159
+ }
160
+
161
+ .zoom-btn {
162
+ width: 32px;
163
+ height: 32px;
164
+ background: #2d2d30;
165
+ border: 1px solid #3e3e42;
166
+ border-radius: 3px;
167
+ color: #cccccc;
168
+ font-size: 16px;
169
+ cursor: pointer;
170
+ display: flex;
171
+ align-items: center;
172
+ justify-content: center;
173
+ transition: all 0.1s;
174
+ }
175
+
176
+ .zoom-btn:hover {
177
+ background: #3e3e42;
178
+ border-color: #007acc;
179
+ }
180
+
181
+ .zoom-btn:active {
182
+ background: #1e1e1e;
183
+ }
184
+
185
+ .zoom-level {
186
+ font-size: 10px;
187
+ color: #858585;
188
+ text-align: center;
189
+ padding: 4px 0;
190
+ }
191
+
192
+ .stats-grid {
193
+ display: grid;
194
+ grid-template-columns: repeat(4, 1fr);
195
+ gap: 1px;
196
+ background: #181818;
197
+ margin: 20px;
198
+ }
199
+
200
+ .stat-item {
201
+ background: #252526;
202
+ padding: 16px;
203
+ text-align: center;
204
+ }
205
+
206
+ .stat-value {
207
+ font-size: 28px;
208
+ font-weight: 600;
209
+ color: #4fc3f7;
210
+ font-family: 'Menlo', monospace;
211
+ }
212
+
213
+ .stat-label {
214
+ font-size: 10px;
215
+ color: #858585;
216
+ margin-top: 6px;
217
+ text-transform: uppercase;
218
+ letter-spacing: 0.5px;
219
+ }
220
+
221
+ .component-list {
222
+ list-style: none;
223
+ }
224
+
225
+ .component-item {
226
+ padding: 8px 12px;
227
+ border-bottom: 1px solid #2d2d30;
228
+ transition: background 0.1s;
229
+ font-size: 11px;
230
+ }
231
+
232
+ .component-item:hover {
233
+ background: #2a2a2b;
234
+ }
235
+
236
+ .component-item a {
237
+ color: #4fc3f7;
238
+ text-decoration: none;
239
+ display: block;
240
+ margin-bottom: 4px;
241
+ font-family: 'Menlo', monospace;
242
+ }
243
+
244
+ .component-item a:hover {
245
+ text-decoration: underline;
246
+ }
247
+
248
+ .component-path {
249
+ font-size: 10px;
250
+ color: #858585;
251
+ word-break: break-all;
252
+ margin-top: 4px;
253
+ line-height: 1.4;
254
+ }
255
+
256
+ .console-log {
257
+ background: #1e1e1e;
258
+ }
259
+
260
+ .log-entry {
261
+ padding: 4px 12px;
262
+ border-bottom: 1px solid #2d2d30;
263
+ font-size: 11px;
264
+ font-family: 'Menlo', monospace;
265
+ display: flex;
266
+ gap: 8px;
267
+ align-items: flex-start;
268
+ }
269
+
270
+ .log-entry:hover {
271
+ background: #2a2a2b;
272
+ }
273
+
274
+ .log-icon {
275
+ color: #858585;
276
+ margin-top: 2px;
277
+ }
278
+
279
+ .log-icon.success {
280
+ color: #4ec9b0;
281
+ }
282
+
283
+ .log-icon.warning {
284
+ color: #dcdcaa;
285
+ }
286
+
287
+ .log-content {
288
+ flex: 1;
289
+ line-height: 1.5;
290
+ }
291
+
292
+ .log-component {
293
+ color: #9cdcfe;
294
+ }
295
+
296
+ .log-status {
297
+ color: #858585;
298
+ margin-top: 2px;
299
+ }
300
+
301
+ .log-origin {
302
+ color: #ce9178;
303
+ }
304
+
305
+ .log-time {
306
+ color: #858585;
307
+ font-size: 10px;
308
+ margin-top: 2px;
309
+ }
310
+
311
+ .empty-state {
312
+ padding: 40px 20px;
313
+ text-align: center;
314
+ color: #858585;
315
+ font-size: 11px;
316
+ }
317
+
318
+ .node {
319
+ cursor: move;
320
+ }
321
+
322
+ .node-rect {
323
+ transition: opacity 0.1s;
324
+ }
325
+
326
+ .node:hover .node-rect {
327
+ opacity: 0.85;
328
+ }
329
+
330
+ ::-webkit-scrollbar {
331
+ width: 10px;
332
+ height: 10px;
333
+ }
334
+
335
+ ::-webkit-scrollbar-track {
336
+ background: #1e1e1e;
337
+ }
338
+
339
+ ::-webkit-scrollbar-thumb {
340
+ background: #424242;
341
+ border-radius: 5px;
342
+ }
343
+
344
+ ::-webkit-scrollbar-thumb:hover {
345
+ background: #4e4e4e;
346
+ }