lynx-console 0.2.3 → 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.
@@ -11,11 +11,6 @@
11
11
  height: 100%;
12
12
  }
13
13
 
14
- .cp-placeholderText {
15
- font-size: 0.875rem;
16
- line-height: 1.1875rem;
17
- }
18
-
19
14
  .cp-logContainer {
20
15
  display: flex;
21
16
  flex-direction: column;
@@ -43,11 +38,6 @@
43
38
  border-radius: 4px;
44
39
  }
45
40
 
46
- .cp-filterButtonText {
47
- font-size: 0.8125rem;
48
- line-height: 1.125rem;
49
- }
50
-
51
41
  .cp-filterDropdown {
52
42
  position: absolute;
53
43
  top: 100%;
@@ -70,16 +60,9 @@
70
60
  }
71
61
 
72
62
  .cp-filterCheckbox {
73
- font-size: 0.8125rem;
74
- line-height: 1.125rem;
75
63
  width: 16px;
76
64
  }
77
65
 
78
- .cp-filterLabel {
79
- font-size: 0.8125rem;
80
- line-height: 1.125rem;
81
- }
82
-
83
66
  .cp-searchWrapper {
84
67
  display: flex;
85
68
  flex-direction: row;
@@ -92,36 +75,19 @@
92
75
  gap: 8px;
93
76
  }
94
77
 
95
- .cp-searchPrompt {
96
- font-size: 1.125rem;
97
- line-height: 1.5rem;
98
- }
99
-
100
78
  .cp-searchInput {
101
79
  flex: 1;
102
- font-size: 0.8125rem;
103
- line-height: 1.125rem;
104
80
  }
105
81
 
106
82
  .cp-searchClear {
107
83
  padding: 2px 4px;
108
84
  }
109
85
 
110
- .cp-searchClearText {
111
- font-size: 0.8125rem;
112
- line-height: 1.125rem;
113
- }
114
-
115
86
  .cp-clearButton {
116
87
  padding: 3px 6px;
117
88
  border-radius: 4px;
118
89
  }
119
90
 
120
- .cp-clearButtonText {
121
- font-size: 0.8125rem;
122
- line-height: 1.125rem;
123
- }
124
-
125
91
  .cp-logList {
126
92
  flex: 1;
127
93
  padding-top: 0;
@@ -142,26 +108,15 @@
142
108
  }
143
109
 
144
110
  .cp-logLevel {
145
- font-size: 0.75rem;
146
- line-height: 1rem;
147
111
  margin-right: 8px;
148
112
  }
149
113
 
150
- .cp-logTime {
151
- font-size: 0.75rem;
152
- line-height: 1rem;
153
- }
154
-
155
114
  .cp-toggleIndicator {
156
- font-size: 0.75rem;
157
- line-height: 1rem;
158
115
  margin-left: 4px;
159
116
  align-self: flex-start;
160
117
  }
161
118
 
162
119
  .cp-logMessage {
163
- font-size: 0.8125rem;
164
- line-height: 1.125rem;
165
120
  word-break: break-all;
166
121
  }
167
122
 
@@ -172,21 +127,6 @@
172
127
  gap: 8px;
173
128
  }
174
129
 
175
- .cp-logArgItem {
176
- font-size: 0.8125rem;
177
- line-height: 1.125rem;
178
- }
179
-
180
- .cp-argString {
181
- font-size: 0.8125rem;
182
- line-height: 1.125rem;
183
- }
184
-
185
- .cp-argPrimitive {
186
- font-size: 0.8125rem;
187
- line-height: 1.125rem;
188
- }
189
-
190
130
  .cp-argObject {
191
131
  display: flex;
192
132
  flex-direction: column;
@@ -199,11 +139,6 @@
199
139
  gap: 4px;
200
140
  }
201
141
 
202
- .cp-argObjectPreview {
203
- font-size: 0.8125rem;
204
- line-height: 1.125rem;
205
- }
206
-
207
142
  .cp-argObjectContent {
208
143
  margin-top: 4px;
209
144
  display: flex;
@@ -217,16 +152,6 @@
217
152
  align-items: flex-start;
218
153
  }
219
154
 
220
- .cp-argObjectKey {
221
- font-size: 0.8125rem;
222
- line-height: 1.125rem;
223
- }
224
-
225
- .cp-argObjectJson {
226
- font-size: 0.8125rem;
227
- line-height: 1.125rem;
228
- }
229
-
230
155
  .cp-replInputRow {
231
156
  display: flex;
232
157
  flex-direction: row;
@@ -237,15 +162,11 @@
237
162
  }
238
163
 
239
164
  .cp-replPrompt {
240
- font-size: 1.625rem;
241
- line-height: 2.1875rem;
242
165
  padding-bottom: 8px;
243
166
  }
244
167
 
245
168
  .cp-replInput {
246
169
  flex: 1;
247
- font-size: 1rem;
248
- line-height: 1.375rem;
249
170
  padding-bottom: 8px;
250
171
  }
251
172
 
@@ -254,8 +175,3 @@
254
175
  border-radius: 4px;
255
176
  margin-bottom: 8px;
256
177
  }
257
-
258
- .cp-replRunButtonText {
259
- font-size: 0.8125rem;
260
- line-height: 1.125rem;
261
- }
@@ -1,7 +1,8 @@
1
+ import type { ReactNode } from "@lynx-js/react";
1
2
  import { useConsole, useNetwork, usePerformance } from "../hooks";
2
3
  import type { CustomTab } from "../types";
3
4
  import "./ConsolePanel.css";
4
- import { LogPanel, dismissFilterDropdown } from "./LogPanel";
5
+ import { dismissFilterDropdown, LogPanel } from "./LogPanel";
5
6
  import { NetworkPanel } from "./NetworkPanel";
6
7
  import { PerformancePanel } from "./PerformancePanel";
7
8
  import Tabs from "./Tabs";
@@ -20,7 +21,7 @@ export const ConsolePanel = ({ customTabs }: ConsolePanelProps) => {
20
21
  const items: Array<{
21
22
  key: string;
22
23
  label: string;
23
- renderContent: () => ReturnType<typeof LogPanel>;
24
+ renderContent: () => ReactNode;
24
25
  }> = [];
25
26
 
26
27
  if (state?.logs) {
@@ -11,10 +11,7 @@
11
11
  .fb-button {
12
12
  position: relative;
13
13
  overflow: hidden;
14
- padding-left: 8px;
15
- padding-right: 8px;
16
- padding-top: 4px;
17
- padding-bottom: 4px;
14
+ padding: 4px 8px;
18
15
  border-radius: 12px;
19
16
  display: flex;
20
17
  flex-direction: column;
@@ -35,14 +32,10 @@
35
32
  }
36
33
 
37
34
  .fb-title {
38
- font-size: 0.875rem;
39
- line-height: 1.1875rem;
40
35
  text-align: center;
41
36
  }
42
37
 
43
38
  .fb-subtitle {
44
- font-size: 0.8125rem;
45
- line-height: 1.125rem;
46
39
  text-align: center;
47
40
  }
48
41
 
@@ -26,15 +26,11 @@ const SHINE_STYLES = {
26
26
  },
27
27
  } as const;
28
28
 
29
- export const FloatingButton = ({
30
- bindtap,
31
- children,
32
- }: FloatingButtonProps) => {
29
+ export const FloatingButton = ({ bindtap, children }: FloatingButtonProps) => {
33
30
  const colors = useThemeColors();
34
31
  const { phase, right, bottom, clearTimer, handlers } =
35
32
  useLongPressDrag(bindtap);
36
33
 
37
-
38
34
  const handleReload = () => {
39
35
  try {
40
36
  lynx.reload({}, () => {
@@ -48,39 +44,37 @@ export const FloatingButton = ({
48
44
  const isDragging = phase === "dragging";
49
45
 
50
46
  return (
51
- <>
47
+ <view
48
+ className={"fb-wrapper"}
49
+ consume-slide-event={[[-180, 180]]}
50
+ style={{
51
+ right: `${right}px`,
52
+ bottom: `${bottom}px`,
53
+ transform: isDragging ? "scale(1.05)" : "scale(1)",
54
+ transition: `transform ${duration.d4} cubic-bezier(0.4, 0, 0.2, 1)`,
55
+ }}
56
+ {...handlers}
57
+ >
52
58
  <view
53
- className={"fb-wrapper"}
54
- consume-slide-event={[[-180, 180]]}
55
- style={{
56
- right: `${right}px`,
57
- bottom: `${bottom}px`,
58
- transform: isDragging ? "scale(1.05)" : "scale(1)",
59
- transition: `transform ${duration.d4} cubic-bezier(0.4, 0, 0.2, 1)`,
60
- }}
61
- {...handlers}
59
+ className={"fb-button"}
60
+ style={{ backgroundColor: colors.palette.green600 }}
62
61
  >
63
- <view
64
- className={"fb-button"}
65
- style={{ backgroundColor: colors.palette.green600 }}
66
- >
67
- {children}
68
- <view className={"fb-shineOverlay"} style={SHINE_STYLES[phase]} />
69
- </view>
70
- <view
71
- className={"fb-reloadButton"}
72
- style={{ backgroundColor: colors.palette.green600 }}
73
- catchtouchstart={() => clearTimer()}
74
- bindtap={handleReload}
62
+ {children}
63
+ <view className={"fb-shineOverlay"} style={SHINE_STYLES[phase]} />
64
+ </view>
65
+ <view
66
+ className={"fb-reloadButton"}
67
+ style={{ backgroundColor: colors.palette.green600 }}
68
+ catchtouchstart={() => clearTimer()}
69
+ bindtap={handleReload}
70
+ >
71
+ <text
72
+ className={"fb-reloadIcon"}
73
+ style={{ color: colors.palette.staticWhite }}
75
74
  >
76
- <text
77
- className={"fb-reloadIcon"}
78
- style={{ color: colors.palette.staticWhite }}
79
- >
80
- {"\u21BB"}
81
- </text>
82
- </view>
75
+ {"\u21BB"}
76
+ </text>
83
77
  </view>
84
- </>
78
+ </view>
85
79
  );
86
80
  };
@@ -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>