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.
@@ -1,9 +1,8 @@
1
1
  import { useState } from "@lynx-js/react";
2
2
  import { stringify } from "javascript-stringify";
3
3
  import { useThemeColors } from "../styles/ThemeContext";
4
- import { type ThemeColors, fontWeight } from "../styles/theme";
4
+ import { fontWeight, type ThemeColors } from "../styles/theme";
5
5
  import type { PerformanceEntryData } from "../types";
6
- import { FadeList } from "./FadeList";
7
6
  import "./PerformancePanel.css";
8
7
 
9
8
  interface PerformancePanelProps {
@@ -66,15 +65,30 @@ const getPrimaryFcpLabel = (entry: PerformanceEntryData): string => {
66
65
  function getEntryTypeColors(colors: ThemeColors, entryType: string) {
67
66
  switch (entryType) {
68
67
  case "init":
69
- return { color: colors.palette.blue600, backgroundColor: colors.palette.blue100 };
68
+ return {
69
+ color: colors.palette.blue600,
70
+ backgroundColor: colors.palette.blue100,
71
+ };
70
72
  case "metric":
71
- return { color: colors.palette.green600, backgroundColor: colors.palette.green100 };
73
+ return {
74
+ color: colors.palette.green600,
75
+ backgroundColor: colors.palette.green100,
76
+ };
72
77
  case "pipeline":
73
- return { color: colors.palette.purple600, backgroundColor: colors.palette.purple100 };
78
+ return {
79
+ color: colors.palette.purple600,
80
+ backgroundColor: colors.palette.purple100,
81
+ };
74
82
  case "resource":
75
- return { color: colors.palette.yellow600, backgroundColor: colors.palette.yellow100 };
83
+ return {
84
+ color: colors.palette.yellow600,
85
+ backgroundColor: colors.palette.yellow100,
86
+ };
76
87
  default:
77
- return { color: colors.fg.neutral, backgroundColor: colors.bg.neutralWeak };
88
+ return {
89
+ color: colors.fg.neutral,
90
+ backgroundColor: colors.bg.neutralWeak,
91
+ };
78
92
  }
79
93
  }
80
94
 
@@ -92,27 +106,25 @@ export const PerformancePanel = ({
92
106
  style={{ borderBottomColor: colors.stroke.neutralSubtle }}
93
107
  >
94
108
  <text
95
- className={"pp-count"}
96
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
109
+ className={"pp-count t3"}
110
+ style={{
111
+ fontWeight: fontWeight.regular,
112
+ color: colors.fg.neutralSubtle,
113
+ }}
97
114
  >
98
115
  0 entries
99
116
  </text>
100
- <view
101
- bindtap={() => {
102
- console.log("[PerformancePanel] performances", performances);
103
- }}
104
- style={{ padding: "10px", backgroundColor: "red" }}
105
- >
106
- <text>Log</text>
107
- </view>
108
117
  <view
109
118
  bindtap={clearPerformances}
110
119
  className={"pp-clearButton"}
111
120
  style={{ backgroundColor: colors.bg.neutralWeak }}
112
121
  >
113
122
  <text
114
- className={"pp-clearButtonText"}
115
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
123
+ className={"pp-clearButtonText t3"}
124
+ style={{
125
+ fontWeight: fontWeight.medium,
126
+ color: colors.fg.neutralMuted,
127
+ }}
116
128
  >
117
129
  🗑
118
130
  </text>
@@ -120,8 +132,11 @@ export const PerformancePanel = ({
120
132
  </view>
121
133
  <view className={"pp-placeholder"}>
122
134
  <text
123
- className={"pp-placeholderText"}
124
- style={{ fontWeight: fontWeight.regular, color: colors.fg.disabled }}
135
+ className={"pp-placeholderText t4"}
136
+ style={{
137
+ fontWeight: fontWeight.regular,
138
+ color: colors.fg.disabled,
139
+ }}
125
140
  >
126
141
  No performance data yet...
127
142
  </text>
@@ -137,8 +152,11 @@ export const PerformancePanel = ({
137
152
  style={{ borderBottomColor: colors.stroke.neutralSubtle }}
138
153
  >
139
154
  <text
140
- className={"pp-count"}
141
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
155
+ className={"pp-count t3"}
156
+ style={{
157
+ fontWeight: fontWeight.regular,
158
+ color: colors.fg.neutralSubtle,
159
+ }}
142
160
  >
143
161
  {performances.length} entries
144
162
  </text>
@@ -148,15 +166,18 @@ export const PerformancePanel = ({
148
166
  style={{ backgroundColor: colors.bg.neutralWeak }}
149
167
  >
150
168
  <text
151
- className={"pp-clearButtonText"}
152
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
169
+ className={"pp-clearButtonText t3"}
170
+ style={{
171
+ fontWeight: fontWeight.medium,
172
+ color: colors.fg.neutralMuted,
173
+ }}
153
174
  >
154
175
  🗑
155
176
  </text>
156
177
  </view>
157
178
  </view>
158
179
 
159
- <FadeList className={"pp-list"}>
180
+ <list scroll-orientation="vertical" className={"pp-list"}>
160
181
  {performances.map((perf) => {
161
182
  const isMetricFcp = isMetricFcpEntry(perf);
162
183
  const fcpMetrics = extractFcpMetrics(perf);
@@ -176,7 +197,7 @@ export const PerformancePanel = ({
176
197
  }
177
198
  >
178
199
  <text
179
- className={"pp-entryType"}
200
+ className={"pp-entryType t2"}
180
201
  style={{
181
202
  fontWeight: fontWeight.bold,
182
203
  ...getEntryTypeColors(colors, perf.entryType),
@@ -185,14 +206,20 @@ export const PerformancePanel = ({
185
206
  {perf.entryType}
186
207
  </text>
187
208
  <text
188
- className={"pp-entryName"}
189
- style={{ fontWeight: fontWeight.medium, color: colors.fg.neutral }}
209
+ className={"pp-entryName t2"}
210
+ style={{
211
+ fontWeight: fontWeight.medium,
212
+ color: colors.fg.neutral,
213
+ }}
190
214
  >
191
215
  {perf.name}
192
216
  </text>
193
217
  <text
194
- className={"pp-timestamp"}
195
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
218
+ className={"pp-timestamp t2"}
219
+ style={{
220
+ fontWeight: fontWeight.regular,
221
+ color: colors.fg.neutralSubtle,
222
+ }}
196
223
  >
197
224
  {new Date(perf.timestamp).toISOString()}
198
225
  </text>
@@ -205,7 +232,7 @@ export const PerformancePanel = ({
205
232
  >
206
233
  {isMetricFcp && primaryFcp && (
207
234
  <text
208
- className={"pp-fcpHighlight"}
235
+ className={"pp-fcpHighlight t3"}
209
236
  style={{
210
237
  fontWeight: fontWeight.bold,
211
238
  color: colors.palette.blue600,
@@ -228,21 +255,30 @@ export const PerformancePanel = ({
228
255
  >
229
256
  <view className={"pp-fcpMetricHeader"}>
230
257
  <text
231
- className={"pp-fcpMetricName"}
232
- style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
258
+ className={"pp-fcpMetricName t2"}
259
+ style={{
260
+ fontWeight: fontWeight.bold,
261
+ color: colors.fg.neutral,
262
+ }}
233
263
  >
234
264
  전체 FCP
235
265
  </text>
236
266
  <text
237
- className={"pp-fcpMetricValue"}
238
- style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
267
+ className={"pp-fcpMetricValue t1"}
268
+ style={{
269
+ fontWeight: fontWeight.bold,
270
+ color: colors.palette.blue600,
271
+ }}
239
272
  >
240
273
  {formatDuration(totalFcp.duration)}
241
274
  </text>
242
275
  </view>
243
276
  <text
244
- className={"pp-fcpMetricDescription"}
245
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
277
+ className={"pp-fcpMetricDescription t3"}
278
+ style={{
279
+ fontWeight: fontWeight.regular,
280
+ color: colors.fg.neutralSubtle,
281
+ }}
246
282
  >
247
283
  PrepareTemplate Start부터 Paint End 까지 걸리는
248
284
  시간
@@ -257,21 +293,30 @@ export const PerformancePanel = ({
257
293
  >
258
294
  <view className={"pp-fcpMetricHeader"}>
259
295
  <text
260
- className={"pp-fcpMetricName"}
261
- style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
296
+ className={"pp-fcpMetricName t2"}
297
+ style={{
298
+ fontWeight: fontWeight.bold,
299
+ color: colors.fg.neutral,
300
+ }}
262
301
  >
263
302
  LynxFCP
264
303
  </text>
265
304
  <text
266
- className={"pp-fcpMetricValue"}
267
- style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
305
+ className={"pp-fcpMetricValue t1"}
306
+ style={{
307
+ fontWeight: fontWeight.bold,
308
+ color: colors.palette.blue600,
309
+ }}
268
310
  >
269
311
  {formatDuration(lynxFcp.duration)}
270
312
  </text>
271
313
  </view>
272
314
  <text
273
- className={"pp-fcpMetricDescription"}
274
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
315
+ className={"pp-fcpMetricDescription t3"}
316
+ style={{
317
+ fontWeight: fontWeight.regular,
318
+ color: colors.fg.neutralSubtle,
319
+ }}
275
320
  >
276
321
  Bundle Load 시작부터 Paint End 까지 걸리는 시간
277
322
  </text>
@@ -285,21 +330,30 @@ export const PerformancePanel = ({
285
330
  >
286
331
  <view className={"pp-fcpMetricHeader"}>
287
332
  <text
288
- className={"pp-fcpMetricName"}
289
- style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
333
+ className={"pp-fcpMetricName t2"}
334
+ style={{
335
+ fontWeight: fontWeight.bold,
336
+ color: colors.fg.neutral,
337
+ }}
290
338
  >
291
339
  렌더링 FCP
292
340
  </text>
293
341
  <text
294
- className={"pp-fcpMetricValue"}
295
- style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
342
+ className={"pp-fcpMetricValue t1"}
343
+ style={{
344
+ fontWeight: fontWeight.bold,
345
+ color: colors.palette.blue600,
346
+ }}
296
347
  >
297
348
  {formatDuration(fcp.duration)}
298
349
  </text>
299
350
  </view>
300
351
  <text
301
- className={"pp-fcpMetricDescription"}
302
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
352
+ className={"pp-fcpMetricDescription t3"}
353
+ style={{
354
+ fontWeight: fontWeight.regular,
355
+ color: colors.fg.neutralSubtle,
356
+ }}
303
357
  >
304
358
  TemplateBundle 준비부터 Paint End 까지 걸리는 시간
305
359
  </text>
@@ -314,16 +368,26 @@ export const PerformancePanel = ({
314
368
  style={{ backgroundColor: colors.bg.neutralWeak }}
315
369
  >
316
370
  <text
317
- className={"pp-detailTitle"}
318
- style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
371
+ className={"pp-detailTitle t3"}
372
+ style={{
373
+ fontWeight: fontWeight.bold,
374
+ color: colors.fg.neutral,
375
+ }}
319
376
  >
320
377
  Raw Entry
321
378
  </text>
322
379
  <text
323
- className={"pp-rawEntry"}
324
- style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
380
+ className={"pp-rawEntry t3"}
381
+ style={{
382
+ fontWeight: fontWeight.regular,
383
+ color: colors.fg.neutralSubtle,
384
+ }}
325
385
  >
326
- {String(stringify(perf.rawEntry, null, 2, { references: true }))}
386
+ {String(
387
+ stringify(perf.rawEntry, null, 2, {
388
+ references: true,
389
+ }),
390
+ )}
327
391
  </text>
328
392
  </view>
329
393
  )}
@@ -333,7 +397,7 @@ export const PerformancePanel = ({
333
397
  </list-item>
334
398
  );
335
399
  })}
336
- </FadeList>
400
+ </list>
337
401
  </view>
338
402
  );
339
403
  };
@@ -22,26 +22,6 @@
22
22
  line-height: 1.375rem;
23
23
  }
24
24
 
25
- .tabs-triggerButtonText--t4 {
26
- font-size: 0.875rem;
27
- line-height: 1.1875rem;
28
- }
29
-
30
- .tabs-triggerButtonText--t3 {
31
- font-size: 0.8125rem;
32
- line-height: 1.125rem;
33
- }
34
-
35
- .tabs-triggerButtonText--t2 {
36
- font-size: 0.75rem;
37
- line-height: 1rem;
38
- }
39
-
40
- .tabs-triggerButtonText--t1 {
41
- font-size: 0.6875rem;
42
- line-height: 0.9375rem;
43
- }
44
-
45
25
  .tabs-triggerIndicator {
46
26
  position: absolute;
47
27
  bottom: 0;
@@ -49,7 +29,7 @@
49
29
  padding: 0 16px;
50
30
  width: 100%;
51
31
  transition: 200ms;
52
- transition-timing-function: cubic-bezier(.35, 0, .35, 1);
32
+ transition-timing-function: cubic-bezier(0.35, 0, 0.35, 1);
53
33
  }
54
34
 
55
35
  .tabs-triggerIndicatorLine {
@@ -20,7 +20,7 @@ export default function Tabs(props: TabsProps) {
20
20
  const tabSize =
21
21
  props.items.length < 4
22
22
  ? undefined
23
- : (`t${Math.max(1, 5 - (props.items.length - 3))}`);
23
+ : `t${Math.max(1, 5 - (props.items.length - 3))}`;
24
24
 
25
25
  return (
26
26
  <view className={"tabs-root"}>
@@ -50,7 +50,7 @@ export default function Tabs(props: TabsProps) {
50
50
  }}
51
51
  >
52
52
  <text
53
- className={`tabs-triggerButtonText${tabSize ? ` tabs-triggerButtonText--${tabSize}` : ""}`}
53
+ className={`tabs-triggerButtonText${tabSize ? ` ${tabSize}` : ""}`}
54
54
  style={{
55
55
  fontWeight: fontWeight.bold,
56
56
  color:
package/src/index.tsx CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  import BottomSheet from "./components/BottomSheet.jsx";
9
9
  import { ConsolePanel } from "./components/ConsolePanel.jsx";
10
10
  import "./components/FloatingButton.css";
11
+ import "./styles/tokens.css";
11
12
  import { FloatingButton } from "./components/FloatingButton.jsx";
12
13
  import { usePerformance } from "./hooks/usePerformance";
13
14
  import { ThemeProvider } from "./styles/ThemeContext";
@@ -94,8 +95,16 @@ const LynxConsole = forwardRef<LynxConsoleHandle, LynxConsoleProps>(
94
95
  }}
95
96
  >
96
97
  <FloatingButton bindtap={handleOpenBottomSheet}>
97
- <text className="fb-title" style={{ fontWeight: "400", color: colors.palette.staticWhite }}>LynxConsole</text>
98
- <text className="fb-subtitle" style={{ fontWeight: "400", color: colors.palette.staticWhite }}>
98
+ <text
99
+ className="fb-title t4"
100
+ style={{ fontWeight: "400", color: colors.palette.staticWhite }}
101
+ >
102
+ LynxConsole
103
+ </text>
104
+ <text
105
+ className="fb-subtitle t3"
106
+ style={{ fontWeight: "400", color: colors.palette.staticWhite }}
107
+ >
99
108
  {`${latestFcp?.name ?? "FCP"}: ${latestFcp?.duration ? latestFcp.duration.toFixed(2) : "--"}ms`}
100
109
  </text>
101
110
  </FloatingButton>
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext } from "@lynx-js/react";
2
- import { type ThemeColors, getColors } from "./theme";
2
+ import { getColors, type ThemeColors } from "./theme";
3
3
 
4
4
  const ThemeContext = createContext<ThemeColors>(getColors("light"));
5
5
 
@@ -90,20 +90,6 @@ export const duration = {
90
90
  d6: "300ms",
91
91
  } as const;
92
92
 
93
- export const dimension = {
94
- x2: "8px",
95
- x3: "12px",
96
- x4: "16px",
97
- x6: "24px",
98
- spacingX: {
99
- globalGutter: "16px",
100
- },
101
- } as const;
102
-
103
- export const radius = {
104
- r6: "24px",
105
- } as const;
106
-
107
93
  export function getColors(theme: Theme) {
108
94
  return colorMap[theme];
109
95
  }
@@ -0,0 +1,40 @@
1
+ .t1 {
2
+ font-size: 0.6875rem;
3
+ line-height: 0.9375rem;
4
+ }
5
+ .t2 {
6
+ font-size: 0.75rem;
7
+ line-height: 1rem;
8
+ }
9
+ .t3 {
10
+ font-size: 0.8125rem;
11
+ line-height: 1.125rem;
12
+ }
13
+ .t4 {
14
+ font-size: 0.875rem;
15
+ line-height: 1.1875rem;
16
+ }
17
+ .t5 {
18
+ font-size: 1rem;
19
+ line-height: 1.375rem;
20
+ }
21
+ .t6 {
22
+ font-size: 1.125rem;
23
+ line-height: 1.5rem;
24
+ }
25
+ .t7 {
26
+ font-size: 1.25rem;
27
+ line-height: 1.6875rem;
28
+ }
29
+ .t8 {
30
+ font-size: 1.375rem;
31
+ line-height: 1.875rem;
32
+ }
33
+ .t9 {
34
+ font-size: 1.5rem;
35
+ line-height: 2rem;
36
+ }
37
+ .t10 {
38
+ font-size: 1.625rem;
39
+ line-height: 2.1875rem;
40
+ }
@@ -1,31 +0,0 @@
1
- import { useRef } from "@lynx-js/react";
2
- import type { NodesRef } from "@lynx-js/types";
3
-
4
- interface FadeListProps {
5
- className?: string;
6
- listRef?: React.RefObject<NodesRef>;
7
- children: React.ReactNode;
8
- "preload-buffer-count"?: number;
9
- "initial-scroll-index"?: number;
10
- }
11
-
12
- export const FadeList = ({
13
- className,
14
- listRef: externalListRef,
15
- children,
16
- ...listProps
17
- }: FadeListProps) => {
18
- const internalListRef = useRef<NodesRef>(null);
19
- const listRef = externalListRef ?? internalListRef;
20
-
21
- return (
22
- <list
23
- ref={listRef}
24
- scroll-orientation="vertical"
25
- className={className}
26
- {...listProps}
27
- >
28
- {children}
29
- </list>
30
- );
31
- };
@@ -1,7 +0,0 @@
1
- import { dimensions } from "./tokens.json";
2
-
3
- export type DimensionTokenId = keyof typeof dimensions;
4
-
5
- export function getDimensionValue(tokenId: DimensionTokenId) {
6
- return dimensions[tokenId];
7
- }