lynx-console 0.2.3 → 0.3.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.
@@ -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
  }),
@@ -179,7 +182,6 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
179
182
  ?.invoke({ method: "setValue", params: { value: "" } })
180
183
  .exec();
181
184
  runCode(trimmed);
182
- setTimeout(() => scrollToBottom(false), 100);
183
185
  };
184
186
 
185
187
  const renderArg = (
@@ -192,7 +194,12 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
192
194
 
193
195
  if (arg === null) {
194
196
  return (
195
- <text style={{ color: colors.fg.neutralSubtle, fontWeight: fontWeight.regular }}>
197
+ <text
198
+ style={{
199
+ color: colors.fg.neutralSubtle,
200
+ fontWeight: fontWeight.regular,
201
+ }}
202
+ >
196
203
  null
197
204
  </text>
198
205
  );
@@ -200,7 +207,12 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
200
207
 
201
208
  if (arg === undefined) {
202
209
  return (
203
- <text style={{ color: colors.fg.neutralSubtle, fontWeight: fontWeight.regular }}>
210
+ <text
211
+ style={{
212
+ color: colors.fg.neutralSubtle,
213
+ fontWeight: fontWeight.regular,
214
+ }}
215
+ >
204
216
  undefined
205
217
  </text>
206
218
  );
@@ -214,7 +226,7 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
214
226
  if (!shouldTruncate) {
215
227
  return (
216
228
  <text
217
- className={"cp-argString"}
229
+ className={"cp-argString t3"}
218
230
  style={{ color: strColor, fontWeight: fontWeight.regular }}
219
231
  >
220
232
  {arg}
@@ -226,13 +238,16 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
226
238
  <view className={"cp-argObject"}>
227
239
  <view className={"cp-argObjectHeader"} bindtap={() => toggleArg(key)}>
228
240
  <text
229
- className={"cp-toggleIndicator"}
230
- style={{ color: colors.fg.neutralSubtle, fontWeight: fontWeight.regular }}
241
+ className={"cp-toggleIndicator t2"}
242
+ style={{
243
+ color: colors.fg.neutralSubtle,
244
+ fontWeight: fontWeight.regular,
245
+ }}
231
246
  >
232
247
  {isExpanded ? "▼" : "▶"}
233
248
  </text>
234
249
  <text
235
- className={"cp-argString"}
250
+ className={"cp-argString t3"}
236
251
  style={{ color: strColor, fontWeight: fontWeight.regular }}
237
252
  >
238
253
  {isExpanded ? arg : `${arg.slice(0, MAX_LENGTH)}...`}
@@ -245,8 +260,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
245
260
  if (typeof arg === "number" || typeof arg === "boolean") {
246
261
  return (
247
262
  <text
248
- className={"cp-argPrimitive"}
249
- style={{ color: getPrimitiveColor(colors, level), fontWeight: fontWeight.regular }}
263
+ className={"cp-argPrimitive t3"}
264
+ style={{
265
+ color: getPrimitiveColor(colors, level),
266
+ fontWeight: fontWeight.regular,
267
+ }}
250
268
  >
251
269
  {String(arg)}
252
270
  </text>
@@ -289,14 +307,20 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
289
307
  <view className={"cp-argObject"}>
290
308
  <view className={"cp-argObjectHeader"} bindtap={() => toggleArg(key)}>
291
309
  <text
292
- className={"cp-toggleIndicator"}
293
- style={{ color: colors.fg.neutralSubtle, fontWeight: fontWeight.regular }}
310
+ className={"cp-toggleIndicator t2"}
311
+ style={{
312
+ color: colors.fg.neutralSubtle,
313
+ fontWeight: fontWeight.regular,
314
+ }}
294
315
  >
295
316
  {isExpanded ? "▼" : "▶"}
296
317
  </text>
297
318
  <text
298
- className={"cp-argObjectPreview"}
299
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutral }}
319
+ className={"cp-argObjectPreview t3"}
320
+ style={{
321
+ fontWeight: fontWeight.medium,
322
+ color: colors.fg.neutral,
323
+ }}
300
324
  >
301
325
  {preview}
302
326
  </text>
@@ -304,8 +328,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
304
328
  {isExpanded && (
305
329
  <view className={"cp-argObjectContent"}>
306
330
  <text
307
- className={"cp-argObjectJson"}
308
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutral }}
331
+ className={"cp-argObjectJson t3"}
332
+ style={{
333
+ fontWeight: fontWeight.regular,
334
+ color: colors.fg.neutral,
335
+ }}
309
336
  >
310
337
  {jsonString}
311
338
  </text>
@@ -317,8 +344,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
317
344
 
318
345
  return (
319
346
  <text
320
- className={"cp-argPrimitive"}
321
- style={{ color: getPrimitiveColor(colors, level), fontWeight: fontWeight.regular }}
347
+ className={"cp-argPrimitive t3"}
348
+ style={{
349
+ color: getPrimitiveColor(colors, level),
350
+ fontWeight: fontWeight.regular,
351
+ }}
322
352
  >
323
353
  {String(arg)}
324
354
  </text>
@@ -328,7 +358,9 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
328
358
  return (
329
359
  <view
330
360
  className={"cp-logContainer"}
331
- bindtap={() => { if (filterOpen) setFilterOpen(false); }}
361
+ bindtap={() => {
362
+ if (filterOpen) setFilterOpen(false);
363
+ }}
332
364
  >
333
365
  <view className={"cp-logHeader"}>
334
366
  <view className={"cp-filterWrapper"}>
@@ -338,10 +370,13 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
338
370
  catchtap={() => setFilterOpen((v) => !v)}
339
371
  >
340
372
  <text
341
- className={"cp-filterButtonText"}
342
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
373
+ className={"cp-filterButtonText t3"}
374
+ style={{
375
+ fontWeight: fontWeight.medium,
376
+ color: colors.fg.neutralMuted,
377
+ }}
343
378
  >
344
- Filter
379
+ Filter
345
380
  </text>
346
381
  </view>
347
382
  {filterOpen && (
@@ -360,14 +395,20 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
360
395
  bindtap={() => toggleLevel(level)}
361
396
  >
362
397
  <text
363
- className={"cp-filterCheckbox"}
364
- style={{ fontWeight: fontWeight.medium, color: getLevelColor(colors, level) }}
398
+ className={"cp-filterCheckbox t3"}
399
+ style={{
400
+ fontWeight: fontWeight.medium,
401
+ color: getLevelColor(colors, level),
402
+ }}
365
403
  >
366
404
  {enabledLevels.has(level) ? "✅" : "⬜"}
367
405
  </text>
368
406
  <text
369
- className={"cp-filterLabel"}
370
- style={{ fontWeight: fontWeight.medium, color: getLevelColor(colors, level) }}
407
+ className={"cp-filterLabel t3"}
408
+ style={{
409
+ fontWeight: fontWeight.medium,
410
+ color: getLevelColor(colors, level),
411
+ }}
371
412
  >
372
413
  {level.toUpperCase()}
373
414
  </text>
@@ -381,14 +422,17 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
381
422
  style={{ borderBottomColor: colors.stroke.neutralSubtle }}
382
423
  >
383
424
  <text
384
- className={"cp-searchPrompt"}
385
- style={{ fontWeight: fontWeight.medium, color: colors.fg.placeholder }}
425
+ className={"cp-searchPrompt t6"}
426
+ style={{
427
+ fontWeight: fontWeight.medium,
428
+ color: colors.fg.placeholder,
429
+ }}
386
430
  >
387
431
  {"›"}
388
432
  </text>
389
433
  <input
390
434
  ref={searchInputRef}
391
- className={"cp-searchInput"}
435
+ className={"cp-searchInput t3"}
392
436
  style={{
393
437
  fontWeight: fontWeight.regular,
394
438
  color: colors.fg.neutral,
@@ -410,8 +454,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
410
454
  }}
411
455
  >
412
456
  <text
413
- className={"cp-searchClearText"}
414
- style={{ fontWeight: fontWeight.medium, color: colors.fg.placeholder }}
457
+ className={"cp-searchClearText t3"}
458
+ style={{
459
+ fontWeight: fontWeight.medium,
460
+ color: colors.fg.placeholder,
461
+ }}
415
462
  >
416
463
 
417
464
  </text>
@@ -425,16 +472,20 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
425
472
  bindtap={clearLogs}
426
473
  >
427
474
  <text
428
- className={"cp-clearButtonText"}
429
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
475
+ className={"cp-clearButtonText t3"}
476
+ style={{
477
+ fontWeight: fontWeight.medium,
478
+ color: colors.fg.neutralMuted,
479
+ }}
430
480
  >
431
481
  🗑
432
482
  </text>
433
483
  </view>
434
484
  </view>
435
485
  </view>
436
- <FadeList
437
- listRef={listRef}
486
+ <list
487
+ ref={listRef}
488
+ scroll-orientation="vertical"
438
489
  className={"cp-logList"}
439
490
  preload-buffer-count={10}
440
491
  initial-scroll-index={Math.max(0, filteredLogs.length - 1)}
@@ -443,8 +494,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
443
494
  <list-item item-key="empty-state">
444
495
  <view className={"cp-placeholder"}>
445
496
  <text
446
- className={"cp-placeholderText"}
447
- style={{ fontWeight: fontWeight.regular, color: colors.fg.disabled }}
497
+ className={"cp-placeholderText t4"}
498
+ style={{
499
+ fontWeight: fontWeight.regular,
500
+ color: colors.fg.disabled,
501
+ }}
448
502
  >
449
503
  No logs yet. Try console.log("Hello!")
450
504
  </text>
@@ -463,7 +517,7 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
463
517
  >
464
518
  <view className={"cp-logItemHeader"}>
465
519
  <text
466
- className={"cp-logLevel"}
520
+ className={"cp-logLevel t2"}
467
521
  style={{
468
522
  fontWeight: fontWeight.bold,
469
523
  color: getLevelColor(colors, log.level),
@@ -472,7 +526,7 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
472
526
  {log.level.toUpperCase()}
473
527
  </text>
474
528
  <text
475
- className={"cp-logTime"}
529
+ className={"cp-logTime t2"}
476
530
  style={{
477
531
  fontWeight: fontWeight.regular,
478
532
  color: colors.fg.neutralSubtle,
@@ -501,17 +555,20 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
501
555
  );
502
556
  })
503
557
  )}
504
- </FadeList>
558
+ </list>
505
559
  <view className={"cp-replInputRow"}>
506
560
  <text
507
- className={"cp-replPrompt"}
508
- style={{ fontWeight: fontWeight.medium, color: colors.fg.placeholder }}
561
+ className={"cp-replPrompt t10"}
562
+ style={{
563
+ fontWeight: fontWeight.medium,
564
+ color: colors.fg.placeholder,
565
+ }}
509
566
  >
510
567
  {"›"}
511
568
  </text>
512
569
  <input
513
570
  ref={inputRef}
514
- className={"cp-replInput"}
571
+ className={"cp-replInput t5"}
515
572
  style={{
516
573
  fontWeight: fontWeight.regular,
517
574
  color: colors.fg.neutral,
@@ -529,8 +586,11 @@ export const LogPanel = ({ logs, clearLogs }: LogPanelProps) => {
529
586
  bindtap={handleRun}
530
587
  >
531
588
  <text
532
- className={"cp-replRunButtonText"}
533
- style={{ fontWeight: fontWeight.medium, color: colors.palette.green600 }}
589
+ className={"cp-replRunButtonText t3"}
590
+ style={{
591
+ fontWeight: fontWeight.medium,
592
+ color: colors.palette.green600,
593
+ }}
534
594
  >
535
595
  Run
536
596
  </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
  }