lynx-console 0.2.2 → 0.3.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.
@@ -2,10 +2,9 @@ import { useEffect, useMemo, useRef, useState } from "@lynx-js/react";
2
2
  import type { BaseEvent, InputInputEvent, NodesRef } from "@lynx-js/types";
3
3
  import { stringify } from "javascript-stringify";
4
4
  import { useThemeColors } from "../styles/ThemeContext";
5
- import { type ThemeColors, fontWeight } from "../styles/theme";
5
+ import { fontWeight, type ThemeColors } from "../styles/theme";
6
6
  import type { LogEntry, LogLevel } from "../types";
7
7
  import "./ConsolePanel.css";
8
- import { FadeList } from "./FadeList";
9
8
 
10
9
  const LOG_LEVELS: LogLevel[] = ["log", "info", "warn", "error"];
11
10
 
@@ -114,7 +113,9 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
114
113
 
115
114
  useEffect(() => {
116
115
  closeFilterDropdown = () => setFilterOpen(false);
117
- return () => { closeFilterDropdown = null; };
116
+ return () => {
117
+ closeFilterDropdown = null;
118
+ };
118
119
  }, []);
119
120
 
120
121
  const filteredLogs = useMemo(
@@ -123,7 +124,9 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
123
124
  if (!enabledLevels.has(log.level)) return false;
124
125
  if (searchQuery) {
125
126
  const query = searchQuery.toLowerCase();
126
- return log.args.some((arg) => String(arg).toLowerCase().includes(query));
127
+ return log.args.some((arg) =>
128
+ String(arg).toLowerCase().includes(query),
129
+ );
127
130
  }
128
131
  return true;
129
132
  }),
@@ -192,7 +195,12 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
192
195
 
193
196
  if (arg === null) {
194
197
  return (
195
- <text style={{ color: colors.fg.neutralSubtle, fontWeight: fontWeight.regular }}>
198
+ <text
199
+ style={{
200
+ color: colors.fg.neutralSubtle,
201
+ fontWeight: fontWeight.regular,
202
+ }}
203
+ >
196
204
  null
197
205
  </text>
198
206
  );
@@ -200,7 +208,12 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
200
208
 
201
209
  if (arg === undefined) {
202
210
  return (
203
- <text style={{ color: colors.fg.neutralSubtle, fontWeight: fontWeight.regular }}>
211
+ <text
212
+ style={{
213
+ color: colors.fg.neutralSubtle,
214
+ fontWeight: fontWeight.regular,
215
+ }}
216
+ >
204
217
  undefined
205
218
  </text>
206
219
  );
@@ -214,7 +227,7 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
214
227
  if (!shouldTruncate) {
215
228
  return (
216
229
  <text
217
- className={"cp-argString"}
230
+ className={"cp-argString t3"}
218
231
  style={{ color: strColor, fontWeight: fontWeight.regular }}
219
232
  >
220
233
  {arg}
@@ -226,13 +239,16 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
226
239
  <view className={"cp-argObject"}>
227
240
  <view className={"cp-argObjectHeader"} bindtap={() => toggleArg(key)}>
228
241
  <text
229
- className={"cp-toggleIndicator"}
230
- style={{ color: colors.fg.neutralSubtle, fontWeight: fontWeight.regular }}
242
+ className={"cp-toggleIndicator t2"}
243
+ style={{
244
+ color: colors.fg.neutralSubtle,
245
+ fontWeight: fontWeight.regular,
246
+ }}
231
247
  >
232
248
  {isExpanded ? "▼" : "▶"}
233
249
  </text>
234
250
  <text
235
- className={"cp-argString"}
251
+ className={"cp-argString t3"}
236
252
  style={{ color: strColor, fontWeight: fontWeight.regular }}
237
253
  >
238
254
  {isExpanded ? arg : `${arg.slice(0, MAX_LENGTH)}...`}
@@ -245,8 +261,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
245
261
  if (typeof arg === "number" || typeof arg === "boolean") {
246
262
  return (
247
263
  <text
248
- className={"cp-argPrimitive"}
249
- style={{ color: getPrimitiveColor(colors, level), fontWeight: fontWeight.regular }}
264
+ className={"cp-argPrimitive t3"}
265
+ style={{
266
+ color: getPrimitiveColor(colors, level),
267
+ fontWeight: fontWeight.regular,
268
+ }}
250
269
  >
251
270
  {String(arg)}
252
271
  </text>
@@ -289,14 +308,20 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
289
308
  <view className={"cp-argObject"}>
290
309
  <view className={"cp-argObjectHeader"} bindtap={() => toggleArg(key)}>
291
310
  <text
292
- className={"cp-toggleIndicator"}
293
- style={{ color: colors.fg.neutralSubtle, fontWeight: fontWeight.regular }}
311
+ className={"cp-toggleIndicator t2"}
312
+ style={{
313
+ color: colors.fg.neutralSubtle,
314
+ fontWeight: fontWeight.regular,
315
+ }}
294
316
  >
295
317
  {isExpanded ? "▼" : "▶"}
296
318
  </text>
297
319
  <text
298
- className={"cp-argObjectPreview"}
299
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutral }}
320
+ className={"cp-argObjectPreview t3"}
321
+ style={{
322
+ fontWeight: fontWeight.medium,
323
+ color: colors.fg.neutral,
324
+ }}
300
325
  >
301
326
  {preview}
302
327
  </text>
@@ -304,8 +329,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
304
329
  {isExpanded && (
305
330
  <view className={"cp-argObjectContent"}>
306
331
  <text
307
- className={"cp-argObjectJson"}
308
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutral }}
332
+ className={"cp-argObjectJson t3"}
333
+ style={{
334
+ fontWeight: fontWeight.regular,
335
+ color: colors.fg.neutral,
336
+ }}
309
337
  >
310
338
  {jsonString}
311
339
  </text>
@@ -317,8 +345,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
317
345
 
318
346
  return (
319
347
  <text
320
- className={"cp-argPrimitive"}
321
- style={{ color: getPrimitiveColor(colors, level), fontWeight: fontWeight.regular }}
348
+ className={"cp-argPrimitive t3"}
349
+ style={{
350
+ color: getPrimitiveColor(colors, level),
351
+ fontWeight: fontWeight.regular,
352
+ }}
322
353
  >
323
354
  {String(arg)}
324
355
  </text>
@@ -328,7 +359,9 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
328
359
  return (
329
360
  <view
330
361
  className={"cp-logContainer"}
331
- bindtap={() => { if (filterOpen) setFilterOpen(false); }}
362
+ bindtap={() => {
363
+ if (filterOpen) setFilterOpen(false);
364
+ }}
332
365
  >
333
366
  <view className={"cp-logHeader"}>
334
367
  <view className={"cp-filterWrapper"}>
@@ -338,10 +371,13 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
338
371
  catchtap={() => setFilterOpen((v) => !v)}
339
372
  >
340
373
  <text
341
- className={"cp-filterButtonText"}
342
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
374
+ className={"cp-filterButtonText t3"}
375
+ style={{
376
+ fontWeight: fontWeight.medium,
377
+ color: colors.fg.neutralMuted,
378
+ }}
343
379
  >
344
- Filter
380
+ Filter
345
381
  </text>
346
382
  </view>
347
383
  {filterOpen && (
@@ -360,14 +396,20 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
360
396
  bindtap={() => toggleLevel(level)}
361
397
  >
362
398
  <text
363
- className={"cp-filterCheckbox"}
364
- style={{ fontWeight: fontWeight.medium, color: getLevelColor(colors, level) }}
399
+ className={"cp-filterCheckbox t3"}
400
+ style={{
401
+ fontWeight: fontWeight.medium,
402
+ color: getLevelColor(colors, level),
403
+ }}
365
404
  >
366
405
  {enabledLevels.has(level) ? "✅" : "⬜"}
367
406
  </text>
368
407
  <text
369
- className={"cp-filterLabel"}
370
- style={{ fontWeight: fontWeight.medium, color: getLevelColor(colors, level) }}
408
+ className={"cp-filterLabel t3"}
409
+ style={{
410
+ fontWeight: fontWeight.medium,
411
+ color: getLevelColor(colors, level),
412
+ }}
371
413
  >
372
414
  {level.toUpperCase()}
373
415
  </text>
@@ -381,14 +423,17 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
381
423
  style={{ borderBottomColor: colors.stroke.neutralSubtle }}
382
424
  >
383
425
  <text
384
- className={"cp-searchPrompt"}
385
- style={{ fontWeight: fontWeight.medium, color: colors.fg.placeholder }}
426
+ className={"cp-searchPrompt t6"}
427
+ style={{
428
+ fontWeight: fontWeight.medium,
429
+ color: colors.fg.placeholder,
430
+ }}
386
431
  >
387
432
  {"›"}
388
433
  </text>
389
434
  <input
390
435
  ref={searchInputRef}
391
- className={"cp-searchInput"}
436
+ className={"cp-searchInput t3"}
392
437
  style={{
393
438
  fontWeight: fontWeight.regular,
394
439
  color: colors.fg.neutral,
@@ -410,8 +455,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
410
455
  }}
411
456
  >
412
457
  <text
413
- className={"cp-searchClearText"}
414
- style={{ fontWeight: fontWeight.medium, color: colors.fg.placeholder }}
458
+ className={"cp-searchClearText t3"}
459
+ style={{
460
+ fontWeight: fontWeight.medium,
461
+ color: colors.fg.placeholder,
462
+ }}
415
463
  >
416
464
 
417
465
  </text>
@@ -425,16 +473,20 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
425
473
  bindtap={clearLogs}
426
474
  >
427
475
  <text
428
- className={"cp-clearButtonText"}
429
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
476
+ className={"cp-clearButtonText t3"}
477
+ style={{
478
+ fontWeight: fontWeight.medium,
479
+ color: colors.fg.neutralMuted,
480
+ }}
430
481
  >
431
482
  🗑
432
483
  </text>
433
484
  </view>
434
485
  </view>
435
486
  </view>
436
- <FadeList
437
- listRef={listRef}
487
+ <list
488
+ ref={listRef}
489
+ scroll-orientation="vertical"
438
490
  className={"cp-logList"}
439
491
  preload-buffer-count={10}
440
492
  initial-scroll-index={Math.max(0, filteredLogs.length - 1)}
@@ -443,8 +495,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
443
495
  <list-item item-key="empty-state">
444
496
  <view className={"cp-placeholder"}>
445
497
  <text
446
- className={"cp-placeholderText"}
447
- style={{ fontWeight: fontWeight.regular, color: colors.fg.disabled }}
498
+ className={"cp-placeholderText t4"}
499
+ style={{
500
+ fontWeight: fontWeight.regular,
501
+ color: colors.fg.disabled,
502
+ }}
448
503
  >
449
504
  No logs yet. Try console.log("Hello!")
450
505
  </text>
@@ -463,7 +518,7 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
463
518
  >
464
519
  <view className={"cp-logItemHeader"}>
465
520
  <text
466
- className={"cp-logLevel"}
521
+ className={"cp-logLevel t2"}
467
522
  style={{
468
523
  fontWeight: fontWeight.bold,
469
524
  color: getLevelColor(colors, log.level),
@@ -472,7 +527,7 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
472
527
  {log.level.toUpperCase()}
473
528
  </text>
474
529
  <text
475
- className={"cp-logTime"}
530
+ className={"cp-logTime t2"}
476
531
  style={{
477
532
  fontWeight: fontWeight.regular,
478
533
  color: colors.fg.neutralSubtle,
@@ -501,17 +556,20 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
501
556
  );
502
557
  })
503
558
  )}
504
- </FadeList>
559
+ </list>
505
560
  <view className={"cp-replInputRow"}>
506
561
  <text
507
- className={"cp-replPrompt"}
508
- style={{ fontWeight: fontWeight.medium, color: colors.fg.placeholder }}
562
+ className={"cp-replPrompt t10"}
563
+ style={{
564
+ fontWeight: fontWeight.medium,
565
+ color: colors.fg.placeholder,
566
+ }}
509
567
  >
510
568
  {"›"}
511
569
  </text>
512
570
  <input
513
571
  ref={inputRef}
514
- className={"cp-replInput"}
572
+ className={"cp-replInput t5"}
515
573
  style={{
516
574
  fontWeight: fontWeight.regular,
517
575
  color: colors.fg.neutral,
@@ -529,8 +587,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
529
587
  bindtap={handleRun}
530
588
  >
531
589
  <text
532
- className={"cp-replRunButtonText"}
533
- style={{ fontWeight: fontWeight.medium, color: colors.palette.green600 }}
590
+ className={"cp-replRunButtonText t3"}
591
+ style={{
592
+ fontWeight: fontWeight.medium,
593
+ color: colors.palette.green600,
594
+ }}
534
595
  >
535
596
  Run
536
597
  </text>
@@ -20,7 +20,7 @@ export const NetworkDetailSection = ({
20
20
  {/* Headers */}
21
21
  <view className={"np-detailSection"}>
22
22
  <text
23
- className={"np-detailSectionTitle"}
23
+ className={"np-detailSectionTitle t3"}
24
24
  style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
25
25
  >
26
26
  Headers
@@ -34,14 +34,20 @@ export const NetworkDetailSection = ({
34
34
  style={{ backgroundColor: colors.bg.neutralWeak }}
35
35
  >
36
36
  <text
37
- className={"np-tableKey"}
38
- style={{ fontWeight: fontWeight.bold, color: colors.fg.neutralSubtle }}
37
+ className={"np-tableKey t3"}
38
+ style={{
39
+ fontWeight: fontWeight.bold,
40
+ color: colors.fg.neutralSubtle,
41
+ }}
39
42
  >
40
43
  {key}
41
44
  </text>
42
45
  <text
43
- className={"np-tableValue"}
44
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutral }}
46
+ className={"np-tableValue t3"}
47
+ style={{
48
+ fontWeight: fontWeight.regular,
49
+ color: colors.fg.neutral,
50
+ }}
45
51
  >
46
52
  {value}
47
53
  </text>
@@ -50,8 +56,11 @@ export const NetworkDetailSection = ({
50
56
  </view>
51
57
  ) : (
52
58
  <text
53
- className={"np-emptyText"}
54
- style={{ fontWeight: fontWeight.regular, color: colors.fg.disabled }}
59
+ className={"np-emptyText t3"}
60
+ style={{
61
+ fontWeight: fontWeight.regular,
62
+ color: colors.fg.disabled,
63
+ }}
55
64
  >
56
65
  No headers
57
66
  </text>
@@ -61,14 +70,14 @@ export const NetworkDetailSection = ({
61
70
  {/* Body */}
62
71
  <view className={"np-detailSection"}>
63
72
  <text
64
- className={"np-detailSectionTitle"}
73
+ className={"np-detailSectionTitle t3"}
65
74
  style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
66
75
  >
67
76
  Body
68
77
  </text>
69
78
  {error && (
70
79
  <text
71
- className={"np-errorText"}
80
+ className={"np-errorText t3"}
72
81
  style={{
73
82
  fontWeight: fontWeight.regular,
74
83
  color: colors.palette.red600,
@@ -80,7 +89,7 @@ export const NetworkDetailSection = ({
80
89
  )}
81
90
  {body && (
82
91
  <text
83
- className={"np-bodyText"}
92
+ className={"np-bodyText t3"}
84
93
  style={{
85
94
  fontWeight: fontWeight.regular,
86
95
  color: colors.fg.neutral,
@@ -92,8 +101,11 @@ export const NetworkDetailSection = ({
92
101
  )}
93
102
  {!error && !body && (
94
103
  <text
95
- className={"np-emptyText"}
96
- style={{ fontWeight: fontWeight.regular, color: colors.fg.disabled }}
104
+ className={"np-emptyText t3"}
105
+ style={{
106
+ fontWeight: fontWeight.regular,
107
+ color: colors.fg.disabled,
108
+ }}
97
109
  >
98
110
  No body
99
111
  </text>
@@ -14,21 +14,11 @@
14
14
  padding-bottom: 4px;
15
15
  }
16
16
 
17
- .np-count {
18
- font-size: 0.8125rem;
19
- line-height: 1.125rem;
20
- }
21
-
22
17
  .np-clearButton {
23
18
  padding: 3px 6px;
24
19
  border-radius: 4px;
25
20
  }
26
21
 
27
- .np-clearButtonText {
28
- font-size: 0.8125rem;
29
- line-height: 1.125rem;
30
- }
31
-
32
22
  .np-list {
33
23
  flex: 1;
34
24
  }
@@ -40,11 +30,6 @@
40
30
  height: 100%;
41
31
  }
42
32
 
43
- .np-placeholderText {
44
- font-size: 0.875rem;
45
- line-height: 1.1875rem;
46
- }
47
-
48
33
  .np-item {
49
34
  padding: 8px;
50
35
  border-bottom-width: 1px;
@@ -60,43 +45,22 @@
60
45
  }
61
46
 
62
47
  .np-method {
63
- font-size: 0.75rem;
64
- line-height: 1rem;
65
48
  padding: 0 4px;
66
49
  border-radius: 2px;
67
50
  }
68
51
 
69
- .np-statusCode {
70
- font-size: 0.75rem;
71
- line-height: 1rem;
72
- }
73
-
74
- .np-time {
75
- font-size: 0.75rem;
76
- line-height: 1rem;
77
- }
78
-
79
52
  .np-url {
80
- font-size: 0.8125rem;
81
- line-height: 1.125rem;
82
53
  word-break: break-all;
83
54
  margin-bottom: 4px;
84
55
  }
85
56
 
86
57
  .np-path {
87
- font-size: 0.8125rem;
88
- line-height: 1.125rem;
89
58
  word-break: break-all;
90
59
  white-space: pre-wrap;
91
60
  overflow: visible;
92
61
  margin-bottom: 4px;
93
62
  }
94
63
 
95
- .np-details {
96
- font-size: 0.8125rem;
97
- line-height: 1.125rem;
98
- }
99
-
100
64
  .np-detailsContainer {
101
65
  margin-top: 12px;
102
66
  padding-top: 12px;
@@ -117,11 +81,6 @@
117
81
  cursor: pointer;
118
82
  }
119
83
 
120
- .np-tabText {
121
- font-size: 0.875rem;
122
- line-height: 1.1875rem;
123
- }
124
-
125
84
  .np-tabContent {
126
85
  padding-top: 8px;
127
86
  }
@@ -131,8 +90,6 @@
131
90
  }
132
91
 
133
92
  .np-detailSectionTitle {
134
- font-size: 0.8125rem;
135
- line-height: 1.125rem;
136
93
  margin-bottom: 8px;
137
94
  }
138
95
 
@@ -151,22 +108,16 @@
151
108
  }
152
109
 
153
110
  .np-tableKey {
154
- font-size: 0.8125rem;
155
- line-height: 1.125rem;
156
111
  min-width: 70px;
157
112
  flex-shrink: 0;
158
113
  }
159
114
 
160
115
  .np-tableValue {
161
- font-size: 0.8125rem;
162
- line-height: 1.125rem;
163
116
  word-break: break-all;
164
117
  flex: 1;
165
118
  }
166
119
 
167
120
  .np-bodyText {
168
- font-size: 0.8125rem;
169
- line-height: 1.125rem;
170
121
  padding: 8px;
171
122
  border-radius: 4px;
172
123
  word-break: break-all;
@@ -174,16 +125,12 @@
174
125
  }
175
126
 
176
127
  .np-errorText {
177
- font-size: 0.8125rem;
178
- line-height: 1.125rem;
179
128
  padding: 8px;
180
129
  border-radius: 4px;
181
130
  word-break: break-all;
182
131
  }
183
132
 
184
133
  .np-emptyText {
185
- font-size: 0.8125rem;
186
- line-height: 1.125rem;
187
134
  text-align: center;
188
135
  padding: 16px 0;
189
136
  }