lynx-console 0.1.1 → 0.2.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.
Files changed (49) hide show
  1. package/dist/index.cjs +183 -960
  2. package/dist/index.css +1248 -461
  3. package/dist/index.css.map +1 -1
  4. package/dist/index.d.cts +79 -1
  5. package/dist/index.d.cts.map +1 -1
  6. package/dist/index.d.mts +79 -1
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +183 -960
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +1 -4
  11. package/src/components/BottomSheet.css +91 -0
  12. package/src/components/BottomSheet.tsx +10 -10
  13. package/src/components/ConsolePanel.css +402 -0
  14. package/src/components/ConsolePanel.tsx +62 -28
  15. package/src/components/FadeList.tsx +10 -55
  16. package/{dist/assets/src/components/FloatingButton.css.ts.vanilla-BaG0OI6p.css → src/components/FloatingButton.css} +22 -16
  17. package/src/components/FloatingButton.tsx +6 -6
  18. package/src/components/LogPanel.tsx +46 -47
  19. package/src/components/NetworkDetailSection.tsx +13 -13
  20. package/src/components/NetworkPanel.css +280 -0
  21. package/src/components/NetworkPanel.tsx +30 -50
  22. package/src/components/PerformancePanel.css +249 -0
  23. package/src/components/PerformancePanel.tsx +40 -40
  24. package/src/components/Tabs.css +78 -0
  25. package/src/components/Tabs.tsx +13 -11
  26. package/src/globals.d.ts +0 -5
  27. package/src/index.tsx +9 -6
  28. package/src/styles/global.css +8 -0
  29. package/src/styles/vars/color.ts +26 -213
  30. package/src/styles/vars/dimension.ts +5 -74
  31. package/src/styles/vars/index.css +65 -457
  32. package/src/styles/vars/index.ts +5 -9
  33. package/src/styles/vars/radius.ts +1 -11
  34. package/src/types.ts +8 -0
  35. package/dist/assets/src/components/BottomSheet.css.ts.vanilla-CulwSDhG.css +0 -83
  36. package/dist/assets/src/components/ConsolePanel.css.ts.vanilla-DWdhFBJq.css +0 -337
  37. package/dist/assets/src/components/FadeList.css.ts.vanilla-sppTKMZj.css +0 -12
  38. package/dist/assets/src/components/NetworkPanel.css.ts.vanilla-BSE4s40D.css +0 -244
  39. package/dist/assets/src/components/PerformancePanel.css.ts.vanilla-Bb3zG5G8.css +0 -216
  40. package/dist/assets/src/components/Tabs.css.ts.vanilla-DD7L2oXt.css +0 -50
  41. package/src/components/BottomSheet.css.ts +0 -93
  42. package/src/components/ConsolePanel.css.ts +0 -349
  43. package/src/components/FadeList.css.ts +0 -16
  44. package/src/components/FloatingButton.css.ts +0 -73
  45. package/src/components/NetworkPanel.css.ts +0 -277
  46. package/src/components/PerformancePanel.css.ts +0 -224
  47. package/src/components/Tabs.css.ts +0 -66
  48. package/src/styles/global.css.ts +0 -10
  49. package/src/styles/typography.ts +0 -25
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode, useEffect, useState } from "@lynx-js/react";
2
2
  import type { BaseTouchEvent, Target } from "@lynx-js/types";
3
- import * as css from "./BottomSheet.css";
3
+ import "./BottomSheet.css";
4
4
 
5
5
  interface BottomSheetProps {
6
6
  children: ReactNode;
@@ -98,14 +98,14 @@ export default function BottomSheet({
98
98
 
99
99
  return (
100
100
  <scroll-view
101
- className={css.backdrop}
101
+ className="bs-backdrop"
102
102
  style={{
103
103
  opacity: isOpening || isClosing ? 0 : 1,
104
104
  }}
105
105
  >
106
- <view className={css.overlay} bindtap={handleClose}>
106
+ <view className="bs-overlay" bindtap={handleClose}>
107
107
  <view
108
- className={css.content}
108
+ className="bs-content"
109
109
  catchtap={() => {}}
110
110
  style={{
111
111
  height: `${isDragging ? tempHeight : sheetHeight}px`,
@@ -116,25 +116,25 @@ export default function BottomSheet({
116
116
  >
117
117
  {/* catchtap: 이벤트 버블링 차단 */}
118
118
  <view
119
- className={css.handleContainer}
119
+ className="bs-handleContainer"
120
120
  bindtouchstart={handleTouchStart}
121
121
  bindtouchmove={handleTouchMove}
122
122
  bindtouchend={handleTouchEnd}
123
123
  >
124
- <view className={css.handle} />
124
+ <view className="bs-handle" />
125
125
  </view>
126
- <view className={css.header}>
127
- {title && <text className={css.title}>{title}</text>}
126
+ <view className="bs-header">
127
+ {title && <text className="bs-title">{title}</text>}
128
128
  </view>
129
129
  <view
130
- className={css.body}
130
+ className="bs-body"
131
131
  style={{
132
132
  paddingBottom: safeAreaInsetBottom,
133
133
  }}
134
134
  >
135
135
  {children}
136
136
  </view>
137
- {footer && <view className={css.footer}>{footer}</view>}
137
+ {footer && <view className="bs-footer">{footer}</view>}
138
138
  </view>
139
139
  </view>
140
140
  </scroll-view>
@@ -0,0 +1,402 @@
1
+ .cp-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+ }
6
+
7
+ .cp-placeholder {
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ height: 100%;
12
+ }
13
+
14
+ .cp-placeholderText {
15
+ font-size: 0.875rem;
16
+ line-height: 1.1875rem;
17
+ font-weight: var(--lynx-console-font-weight-regular);
18
+ color: var(--lynx-console-color-fg-disabled);
19
+ }
20
+
21
+ .cp-logContainer {
22
+ display: flex;
23
+ flex-direction: column;
24
+ flex: 1;
25
+ padding-top: 4px;
26
+ }
27
+
28
+ .cp-logHeader {
29
+ display: flex;
30
+ flex-direction: row;
31
+ align-items: center;
32
+ justify-content: space-between;
33
+ padding-bottom: 3px;
34
+ }
35
+
36
+ .cp-filterWrapper {
37
+ position: relative;
38
+ }
39
+
40
+ .cp-filterButton {
41
+ display: flex;
42
+ flex-direction: row;
43
+ align-items: center;
44
+ padding: 3px 6px;
45
+ background-color: var(--lynx-console-color-bg-neutral-weak);
46
+ border-radius: 4px;
47
+ }
48
+
49
+ .cp-filterButtonText {
50
+ font-size: 0.8125rem;
51
+ line-height: 1.125rem;
52
+ font-weight: var(--lynx-console-font-weight-medium);
53
+ color: var(--lynx-console-color-fg-neutral-muted);
54
+ }
55
+
56
+ .cp-filterDropdown {
57
+ position: absolute;
58
+ top: 100%;
59
+ left: 0;
60
+ margin-top: 4px;
61
+ background-color: var(--lynx-console-color-bg-layer-floating);
62
+ border-width: 1px;
63
+ border-color: var(--lynx-console-color-stroke-neutral-subtle);
64
+ border-style: solid;
65
+ border-radius: 8px;
66
+ padding: 4px 0;
67
+ z-index: 100;
68
+ min-width: 90px;
69
+ }
70
+
71
+ .cp-filterOption {
72
+ display: flex;
73
+ flex-direction: row;
74
+ align-items: center;
75
+ gap: 4px;
76
+ padding: 8px 12px;
77
+ }
78
+
79
+ .cp-filterCheckbox {
80
+ font-size: 0.8125rem;
81
+ line-height: 1.125rem;
82
+ font-weight: var(--lynx-console-font-weight-medium);
83
+ width: 16px;
84
+ }
85
+
86
+ .cp-filterCheckbox--log {
87
+ color: var(--lynx-console-color-palette-green-600);
88
+ }
89
+
90
+ .cp-filterCheckbox--info {
91
+ color: var(--lynx-console-color-palette-blue-600);
92
+ }
93
+
94
+ .cp-filterCheckbox--warn {
95
+ color: var(--lynx-console-color-palette-yellow-600);
96
+ }
97
+
98
+ .cp-filterCheckbox--error {
99
+ color: var(--lynx-console-color-palette-red-600);
100
+ }
101
+
102
+ .cp-filterLabel {
103
+ font-size: 0.8125rem;
104
+ line-height: 1.125rem;
105
+ font-weight: var(--lynx-console-font-weight-medium);
106
+ }
107
+
108
+ .cp-filterLabel--log {
109
+ color: var(--lynx-console-color-palette-green-600);
110
+ }
111
+
112
+ .cp-filterLabel--info {
113
+ color: var(--lynx-console-color-palette-blue-600);
114
+ }
115
+
116
+ .cp-filterLabel--warn {
117
+ color: var(--lynx-console-color-palette-yellow-600);
118
+ }
119
+
120
+ .cp-filterLabel--error {
121
+ color: var(--lynx-console-color-palette-red-600);
122
+ }
123
+
124
+ .cp-searchWrapper {
125
+ display: flex;
126
+ flex-direction: row;
127
+ align-items: center;
128
+ flex: 1;
129
+ margin-left: 8px;
130
+ margin-right: 8px;
131
+ border-bottom-width: 1px;
132
+ border-bottom-color: var(--lynx-console-color-stroke-neutral-subtle);
133
+ border-bottom-style: solid;
134
+ gap: 8px;
135
+ }
136
+
137
+ .cp-searchPrompt {
138
+ font-size: 1.125rem;
139
+ line-height: 1.5rem;
140
+ font-weight: var(--lynx-console-font-weight-medium);
141
+ color: var(--lynx-console-color-fg-placeholder);
142
+ }
143
+
144
+ .cp-searchInput {
145
+ flex: 1;
146
+ font-size: 0.8125rem;
147
+ line-height: 1.125rem;
148
+ font-weight: var(--lynx-console-font-weight-regular);
149
+ color: var(--lynx-console-color-fg-neutral);
150
+ caret-color: var(--lynx-console-color-palette-green-600);
151
+ }
152
+
153
+ .cp-searchClear {
154
+ padding: 2px 4px;
155
+ }
156
+
157
+ .cp-searchClearText {
158
+ font-size: 0.8125rem;
159
+ line-height: 1.125rem;
160
+ font-weight: var(--lynx-console-font-weight-medium);
161
+ color: var(--lynx-console-color-fg-placeholder);
162
+ }
163
+
164
+ .cp-clearButton {
165
+ padding: 3px 6px;
166
+ background-color: var(--lynx-console-color-bg-neutral-weak);
167
+ border-radius: 4px;
168
+ }
169
+
170
+ .cp-clearButtonText {
171
+ font-size: 0.8125rem;
172
+ line-height: 1.125rem;
173
+ font-weight: var(--lynx-console-font-weight-medium);
174
+ color: var(--lynx-console-color-fg-neutral-muted);
175
+ }
176
+
177
+ .cp-logList {
178
+ flex: 1;
179
+ padding-top: 0;
180
+ padding-bottom: 0;
181
+ }
182
+
183
+ .cp-logItem {
184
+ padding: 8px;
185
+ border-bottom-width: 1px;
186
+ border-bottom-color: var(--lynx-console-color-stroke-neutral-weak);
187
+ border-bottom-style: solid;
188
+ }
189
+
190
+ .cp-logItem--warn {
191
+ background-color: var(--lynx-console-color-palette-yellow-100);
192
+ }
193
+
194
+ .cp-logItem--error {
195
+ background-color: var(--lynx-console-color-palette-red-100);
196
+ }
197
+
198
+ .cp-logItemHeader {
199
+ display: flex;
200
+ flex-direction: row;
201
+ align-items: center;
202
+ margin-bottom: 4px;
203
+ }
204
+
205
+ .cp-logLevel {
206
+ font-size: 0.75rem;
207
+ line-height: 1rem;
208
+ font-weight: var(--lynx-console-font-weight-bold);
209
+ margin-right: 8px;
210
+ }
211
+
212
+ .cp-logLevel--log {
213
+ color: var(--lynx-console-color-palette-green-600);
214
+ }
215
+
216
+ .cp-logLevel--info {
217
+ color: var(--lynx-console-color-palette-blue-600);
218
+ }
219
+
220
+ .cp-logLevel--warn {
221
+ color: var(--lynx-console-color-palette-yellow-600);
222
+ }
223
+
224
+ .cp-logLevel--error {
225
+ color: var(--lynx-console-color-palette-red-600);
226
+ }
227
+
228
+ .cp-logTime {
229
+ font-size: 0.75rem;
230
+ line-height: 1rem;
231
+ font-weight: var(--lynx-console-font-weight-regular);
232
+ color: var(--lynx-console-color-fg-neutral-subtle);
233
+ }
234
+
235
+ .cp-toggleIndicator {
236
+ font-size: 0.75rem;
237
+ line-height: 1rem;
238
+ font-weight: var(--lynx-console-font-weight-regular);
239
+ color: var(--lynx-console-color-fg-neutral-subtle);
240
+ margin-left: 4px;
241
+ align-self: flex-start;
242
+ }
243
+
244
+ .cp-logMessage {
245
+ font-size: 0.8125rem;
246
+ line-height: 1.125rem;
247
+ font-weight: var(--lynx-console-font-weight-regular);
248
+ color: var(--lynx-console-color-fg-neutral);
249
+ word-break: break-all;
250
+ }
251
+
252
+ .cp-logArgsContainer {
253
+ display: flex;
254
+ flex-direction: row;
255
+ flex-wrap: wrap;
256
+ gap: 8px;
257
+ }
258
+
259
+ .cp-logArgItem {
260
+ font-size: 0.8125rem;
261
+ line-height: 1.125rem;
262
+ font-weight: var(--lynx-console-font-weight-regular);
263
+ }
264
+
265
+ .cp-argNull {
266
+ color: var(--lynx-console-color-fg-neutral-subtle);
267
+ }
268
+
269
+ .cp-argUndefined {
270
+ color: var(--lynx-console-color-fg-neutral-subtle);
271
+ }
272
+
273
+ .cp-argString {
274
+ font-size: 0.8125rem;
275
+ line-height: 1.125rem;
276
+ font-weight: var(--lynx-console-font-weight-regular);
277
+ }
278
+
279
+ .cp-argString--log {
280
+ color: var(--lynx-console-color-fg-neutral);
281
+ }
282
+
283
+ .cp-argString--info {
284
+ color: var(--lynx-console-color-fg-neutral);
285
+ }
286
+
287
+ .cp-argString--warn {
288
+ color: var(--lynx-console-color-palette-yellow-900);
289
+ }
290
+
291
+ .cp-argString--error {
292
+ color: var(--lynx-console-color-palette-red-900);
293
+ }
294
+
295
+ .cp-argPrimitive {
296
+ font-size: 0.8125rem;
297
+ line-height: 1.125rem;
298
+ font-weight: var(--lynx-console-font-weight-regular);
299
+ }
300
+
301
+ .cp-argPrimitive--log {
302
+ color: var(--lynx-console-color-palette-blue-600);
303
+ }
304
+
305
+ .cp-argPrimitive--info {
306
+ color: var(--lynx-console-color-palette-blue-600);
307
+ }
308
+
309
+ .cp-argPrimitive--warn {
310
+ color: var(--lynx-console-color-palette-yellow-900);
311
+ }
312
+
313
+ .cp-argPrimitive--error {
314
+ color: var(--lynx-console-color-palette-red-900);
315
+ }
316
+
317
+ .cp-argObject {
318
+ display: flex;
319
+ flex-direction: column;
320
+ }
321
+
322
+ .cp-argObjectHeader {
323
+ display: flex;
324
+ flex-direction: row;
325
+ align-items: center;
326
+ gap: 4px;
327
+ }
328
+
329
+ .cp-argObjectPreview {
330
+ font-size: 0.8125rem;
331
+ line-height: 1.125rem;
332
+ font-weight: var(--lynx-console-font-weight-medium);
333
+ color: var(--lynx-console-color-fg-neutral);
334
+ }
335
+
336
+ .cp-argObjectContent {
337
+ margin-top: 4px;
338
+ display: flex;
339
+ flex-direction: column;
340
+ gap: 4px;
341
+ }
342
+
343
+ .cp-argObjectProperty {
344
+ display: flex;
345
+ flex-direction: row;
346
+ align-items: flex-start;
347
+ }
348
+
349
+ .cp-argObjectKey {
350
+ font-size: 0.8125rem;
351
+ line-height: 1.125rem;
352
+ font-weight: var(--lynx-console-font-weight-medium);
353
+ color: var(--lynx-console-color-palette-purple-600);
354
+ }
355
+
356
+ .cp-argObjectJson {
357
+ font-size: 0.8125rem;
358
+ line-height: 1.125rem;
359
+ font-weight: var(--lynx-console-font-weight-regular);
360
+ color: var(--lynx-console-color-fg-neutral);
361
+ }
362
+
363
+ .cp-replInputRow {
364
+ display: flex;
365
+ flex-direction: row;
366
+ align-items: center;
367
+ gap: 8px;
368
+ padding-top: 0;
369
+ padding-bottom: 8px;
370
+ }
371
+
372
+ .cp-replPrompt {
373
+ font-size: 1.625rem;
374
+ line-height: 2.1875rem;
375
+ font-weight: var(--lynx-console-font-weight-medium);
376
+ color: var(--lynx-console-color-fg-placeholder);
377
+ padding-bottom: 8px;
378
+ }
379
+
380
+ .cp-replInput {
381
+ flex: 1;
382
+ font-size: 1rem;
383
+ line-height: 1.375rem;
384
+ font-weight: var(--lynx-console-font-weight-regular);
385
+ color: var(--lynx-console-color-fg-neutral);
386
+ caret-color: var(--lynx-console-color-palette-green-600);
387
+ padding-bottom: 8px;
388
+ }
389
+
390
+ .cp-replRunButton {
391
+ padding: 4px 10px;
392
+ background-color: var(--lynx-console-color-palette-green-100);
393
+ border-radius: 4px;
394
+ margin-bottom: 8px;
395
+ }
396
+
397
+ .cp-replRunButtonText {
398
+ font-size: 0.8125rem;
399
+ line-height: 1.125rem;
400
+ font-weight: var(--lynx-console-font-weight-medium);
401
+ color: var(--lynx-console-color-palette-green-600);
402
+ }
@@ -1,42 +1,76 @@
1
1
  import { useConsole, useNetwork, usePerformance } from "../hooks";
2
- import * as css from "./ConsolePanel.css";
2
+ import type { CustomTab } from "../types";
3
+ import "./ConsolePanel.css";
3
4
  import { LogPanel, dismissFilterDropdown } from "./LogPanel";
4
5
  import { NetworkPanel } from "./NetworkPanel";
5
6
  import { PerformancePanel } from "./PerformancePanel";
6
7
  import Tabs from "./Tabs";
7
8
 
8
- export const ConsolePanel = () => {
9
+ interface ConsolePanelProps {
10
+ customTabs?: CustomTab[];
11
+ }
12
+
13
+ export const ConsolePanel = ({ customTabs }: ConsolePanelProps) => {
9
14
  const { logs, clearLogs } = useConsole();
10
15
  const { networks, clearNetworks } = useNetwork();
11
16
  const { performances, clearPerformances } = usePerformance();
12
17
 
18
+ const state = globalThis.__LYNX_CONSOLE__?.state;
19
+
20
+ const items: Array<{
21
+ key: string;
22
+ label: string;
23
+ renderContent: () => ReturnType<typeof LogPanel>;
24
+ }> = [];
25
+
26
+ if (state?.logs) {
27
+ items.push({
28
+ key: "log",
29
+ label: "Log",
30
+ renderContent: () => <LogPanel logs={logs} clearLogs={clearLogs} />,
31
+ });
32
+ }
33
+
34
+ if (state?.networks) {
35
+ items.push({
36
+ key: "network",
37
+ label: "Network",
38
+ renderContent: () => (
39
+ <NetworkPanel networks={networks} clearNetworks={clearNetworks} />
40
+ ),
41
+ });
42
+ }
43
+
44
+ if (state?.performances) {
45
+ items.push({
46
+ key: "performance",
47
+ label: "Perf",
48
+ renderContent: () => (
49
+ <PerformancePanel
50
+ performances={performances}
51
+ clearPerformances={clearPerformances}
52
+ />
53
+ ),
54
+ });
55
+ }
56
+
57
+ if (customTabs) {
58
+ for (const tab of customTabs) {
59
+ items.push({
60
+ key: tab.key,
61
+ label: tab.label,
62
+ renderContent: tab.renderContent,
63
+ });
64
+ }
65
+ }
66
+
67
+ if (items.length === 0) {
68
+ return null;
69
+ }
70
+
13
71
  return (
14
- <view className={css.container}>
15
- <Tabs
16
- onTabChange={dismissFilterDropdown}
17
- items={[
18
- {
19
- key: "log",
20
- label: "Log",
21
- renderContent: () => <LogPanel logs={logs} clearLogs={clearLogs} />,
22
- },
23
- {
24
- key: "network",
25
- label: "Network",
26
- renderContent: () => <NetworkPanel networks={networks} clearNetworks={clearNetworks} />,
27
- },
28
- {
29
- key: "performance",
30
- label: "Performance",
31
- renderContent: () => (
32
- <PerformancePanel
33
- performances={performances}
34
- clearPerformances={clearPerformances}
35
- />
36
- ),
37
- },
38
- ]}
39
- />
72
+ <view className="cp-container">
73
+ <Tabs onTabChange={dismissFilterDropdown} items={items} />
40
74
  </view>
41
75
  );
42
76
  };
@@ -1,7 +1,5 @@
1
- import { useRef, useState } from "@lynx-js/react";
2
- import type { BaseEvent, NodesRef } from "@lynx-js/types";
3
- import { vars } from "../styles/vars";
4
- import * as css from "./FadeList.css";
1
+ import { useRef } from "@lynx-js/react";
2
+ import type { NodesRef } from "@lynx-js/types";
5
3
 
6
4
  interface FadeListProps {
7
5
  className?: string;
@@ -17,60 +15,17 @@ export const FadeList = ({
17
15
  children,
18
16
  ...listProps
19
17
  }: FadeListProps) => {
20
- const [fadeState, setFadeState] = useState({ atTop: true, atBottom: true });
21
- const fadeRef = useRef({ atTop: true, atBottom: true });
22
18
  const internalListRef = useRef<NodesRef>(null);
23
19
  const listRef = externalListRef ?? internalListRef;
24
20
 
25
21
  return (
26
- <>
27
- <view
28
- className={css.fadeTop}
29
- style={{
30
- background: fadeState.atTop
31
- ? "linear-gradient(to bottom, #ffffff00, #ffffff00)"
32
- : `linear-gradient(to bottom, ${vars.$color.bg.layerFloating}, #ffffff00)`,
33
- }}
34
- />
35
- <list
36
- ref={listRef}
37
- scroll-orientation="vertical"
38
- className={className}
39
- scroll-event-throttle={16}
40
- bindscroll={(
41
- e: BaseEvent<
42
- "bindscroll",
43
- {
44
- scrollTop: number;
45
- scrollHeight: number;
46
- listHeight: number;
47
- }
48
- >,
49
- ) => {
50
- const { scrollTop, scrollHeight, listHeight } = e.detail;
51
- const atTop = scrollTop <= 10;
52
- const atBottom = scrollTop + listHeight >= scrollHeight - 10;
53
- if (
54
- atTop !== fadeRef.current.atTop ||
55
- atBottom !== fadeRef.current.atBottom
56
- ) {
57
- fadeRef.current.atTop = atTop;
58
- fadeRef.current.atBottom = atBottom;
59
- setFadeState({ atTop, atBottom });
60
- }
61
- }}
62
- {...listProps}
63
- >
64
- {children}
65
- </list>
66
- <view
67
- className={css.fadeBottom}
68
- style={{
69
- background: fadeState.atBottom
70
- ? "linear-gradient(to top, #ffffff00, #ffffff00)"
71
- : `linear-gradient(to top, ${vars.$color.bg.layerFloating}, #ffffff00)`,
72
- }}
73
- />
74
- </>
22
+ <list
23
+ ref={listRef}
24
+ scroll-orientation="vertical"
25
+ className={className}
26
+ {...listProps}
27
+ >
28
+ {children}
29
+ </list>
75
30
  );
76
31
  };