lynx-console 0.2.1 → 0.2.3
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.
- package/dist/index.cjs +615 -120
- package/dist/index.css +0 -397
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +616 -121
- package/dist/index.mjs.map +1 -1
- package/dist/setup.cjs +0 -1
- package/dist/setup.d.cts +0 -1
- package/dist/setup.d.cts.map +1 -1
- package/dist/setup.d.mts +0 -1
- package/dist/setup.d.mts.map +1 -1
- package/dist/setup.mjs +0 -1
- package/dist/setup.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/BottomSheet.css +0 -7
- package/src/components/BottomSheet.tsx +24 -3
- package/src/components/ConsolePanel.css +0 -141
- package/src/components/FloatingButton.css +0 -8
- package/src/components/FloatingButton.tsx +15 -2
- package/src/components/LogPanel.tsx +214 -26
- package/src/components/NetworkDetailSection.tsx +71 -9
- package/src/components/NetworkPanel.css +0 -91
- package/src/components/NetworkPanel.tsx +168 -20
- package/src/components/PerformancePanel.css +0 -60
- package/src/components/PerformancePanel.tsx +157 -35
- package/src/components/Tabs.css +0 -9
- package/src/components/Tabs.tsx +21 -3
- package/src/index.tsx +29 -23
- package/src/styles/ThemeContext.ts +10 -0
- package/src/styles/theme.ts +111 -0
- package/src/styles/global.css +0 -8
- package/src/styles/vars/color.ts +0 -41
- package/src/styles/vars/dimension.ts +0 -10
- package/src/styles/vars/index.css +0 -71
- package/src/styles/vars/index.ts +0 -18
- package/src/styles/vars/radius.ts +0 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useState } from "@lynx-js/react";
|
|
2
2
|
import { stringify } from "javascript-stringify";
|
|
3
|
+
import { useThemeColors } from "../styles/ThemeContext";
|
|
4
|
+
import { type ThemeColors, fontWeight } from "../styles/theme";
|
|
3
5
|
import type { PerformanceEntryData } from "../types";
|
|
4
6
|
import { FadeList } from "./FadeList";
|
|
5
7
|
import "./PerformancePanel.css";
|
|
@@ -61,30 +63,58 @@ const getPrimaryFcpLabel = (entry: PerformanceEntryData): string => {
|
|
|
61
63
|
return "";
|
|
62
64
|
};
|
|
63
65
|
|
|
66
|
+
function getEntryTypeColors(colors: ThemeColors, entryType: string) {
|
|
67
|
+
switch (entryType) {
|
|
68
|
+
case "init":
|
|
69
|
+
return { color: colors.palette.blue600, backgroundColor: colors.palette.blue100 };
|
|
70
|
+
case "metric":
|
|
71
|
+
return { color: colors.palette.green600, backgroundColor: colors.palette.green100 };
|
|
72
|
+
case "pipeline":
|
|
73
|
+
return { color: colors.palette.purple600, backgroundColor: colors.palette.purple100 };
|
|
74
|
+
case "resource":
|
|
75
|
+
return { color: colors.palette.yellow600, backgroundColor: colors.palette.yellow100 };
|
|
76
|
+
default:
|
|
77
|
+
return { color: colors.fg.neutral, backgroundColor: colors.bg.neutralWeak };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
64
81
|
export const PerformancePanel = ({
|
|
65
82
|
performances,
|
|
66
83
|
clearPerformances,
|
|
67
84
|
}: PerformancePanelProps) => {
|
|
85
|
+
const colors = useThemeColors();
|
|
68
86
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
69
87
|
if (performances.length === 0) {
|
|
70
88
|
return (
|
|
71
89
|
<view className={"pp-container"}>
|
|
72
|
-
<view
|
|
73
|
-
|
|
90
|
+
<view
|
|
91
|
+
className={"pp-header"}
|
|
92
|
+
style={{ borderBottomColor: colors.stroke.neutralSubtle }}
|
|
93
|
+
>
|
|
94
|
+
<text
|
|
95
|
+
className={"pp-count"}
|
|
96
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
97
|
+
>
|
|
98
|
+
0 entries
|
|
99
|
+
</text>
|
|
74
100
|
<view
|
|
75
|
-
bindtap={
|
|
76
|
-
|
|
77
|
-
}}
|
|
78
|
-
style={{ padding: "10px", backgroundColor: "red" }}
|
|
101
|
+
bindtap={clearPerformances}
|
|
102
|
+
className={"pp-clearButton"}
|
|
103
|
+
style={{ backgroundColor: colors.bg.neutralWeak }}
|
|
79
104
|
>
|
|
80
|
-
<text
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
105
|
+
<text
|
|
106
|
+
className={"pp-clearButtonText"}
|
|
107
|
+
style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
|
|
108
|
+
>
|
|
109
|
+
🗑
|
|
110
|
+
</text>
|
|
84
111
|
</view>
|
|
85
112
|
</view>
|
|
86
113
|
<view className={"pp-placeholder"}>
|
|
87
|
-
<text
|
|
114
|
+
<text
|
|
115
|
+
className={"pp-placeholderText"}
|
|
116
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.disabled }}
|
|
117
|
+
>
|
|
88
118
|
No performance data yet...
|
|
89
119
|
</text>
|
|
90
120
|
</view>
|
|
@@ -94,10 +124,27 @@ export const PerformancePanel = ({
|
|
|
94
124
|
|
|
95
125
|
return (
|
|
96
126
|
<view className={"pp-container"}>
|
|
97
|
-
<view
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
127
|
+
<view
|
|
128
|
+
className={"pp-header"}
|
|
129
|
+
style={{ borderBottomColor: colors.stroke.neutralSubtle }}
|
|
130
|
+
>
|
|
131
|
+
<text
|
|
132
|
+
className={"pp-count"}
|
|
133
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
134
|
+
>
|
|
135
|
+
{performances.length} entries
|
|
136
|
+
</text>
|
|
137
|
+
<view
|
|
138
|
+
bindtap={clearPerformances}
|
|
139
|
+
className={"pp-clearButton"}
|
|
140
|
+
style={{ backgroundColor: colors.bg.neutralWeak }}
|
|
141
|
+
>
|
|
142
|
+
<text
|
|
143
|
+
className={"pp-clearButtonText"}
|
|
144
|
+
style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
|
|
145
|
+
>
|
|
146
|
+
🗑
|
|
147
|
+
</text>
|
|
101
148
|
</view>
|
|
102
149
|
</view>
|
|
103
150
|
|
|
@@ -110,18 +157,35 @@ export const PerformancePanel = ({
|
|
|
110
157
|
|
|
111
158
|
return (
|
|
112
159
|
<list-item key={perf.id} item-key={perf.id}>
|
|
113
|
-
<view
|
|
160
|
+
<view
|
|
161
|
+
className={"pp-item"}
|
|
162
|
+
style={{ borderBottomColor: colors.stroke.neutralWeak }}
|
|
163
|
+
>
|
|
114
164
|
<view
|
|
115
165
|
className={"pp-itemHeader"}
|
|
116
166
|
bindtap={() =>
|
|
117
167
|
setSelectedId(selectedId === perf.id ? null : perf.id)
|
|
118
168
|
}
|
|
119
169
|
>
|
|
120
|
-
<text
|
|
170
|
+
<text
|
|
171
|
+
className={"pp-entryType"}
|
|
172
|
+
style={{
|
|
173
|
+
fontWeight: fontWeight.bold,
|
|
174
|
+
...getEntryTypeColors(colors, perf.entryType),
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
121
177
|
{perf.entryType}
|
|
122
178
|
</text>
|
|
123
|
-
<text
|
|
124
|
-
|
|
179
|
+
<text
|
|
180
|
+
className={"pp-entryName"}
|
|
181
|
+
style={{ fontWeight: fontWeight.medium, color: colors.fg.neutral }}
|
|
182
|
+
>
|
|
183
|
+
{perf.name}
|
|
184
|
+
</text>
|
|
185
|
+
<text
|
|
186
|
+
className={"pp-timestamp"}
|
|
187
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
188
|
+
>
|
|
125
189
|
{new Date(perf.timestamp).toISOString()}
|
|
126
190
|
</text>
|
|
127
191
|
</view>
|
|
@@ -132,7 +196,16 @@ export const PerformancePanel = ({
|
|
|
132
196
|
}
|
|
133
197
|
>
|
|
134
198
|
{isMetricFcp && primaryFcp && (
|
|
135
|
-
<text
|
|
199
|
+
<text
|
|
200
|
+
className={"pp-fcpHighlight"}
|
|
201
|
+
style={{
|
|
202
|
+
fontWeight: fontWeight.bold,
|
|
203
|
+
color: colors.palette.blue600,
|
|
204
|
+
backgroundColor: colors.palette.blue100,
|
|
205
|
+
}}
|
|
206
|
+
>
|
|
207
|
+
{primaryFcp}
|
|
208
|
+
</text>
|
|
136
209
|
)}
|
|
137
210
|
</view>
|
|
138
211
|
|
|
@@ -141,16 +214,28 @@ export const PerformancePanel = ({
|
|
|
141
214
|
{isMetricFcp && fcpMetrics && (
|
|
142
215
|
<view className={"pp-fcpSection"}>
|
|
143
216
|
{totalFcp !== undefined && (
|
|
144
|
-
<view
|
|
217
|
+
<view
|
|
218
|
+
className={"pp-fcpMetric"}
|
|
219
|
+
style={{ backgroundColor: colors.bg.layerDefault }}
|
|
220
|
+
>
|
|
145
221
|
<view className={"pp-fcpMetricHeader"}>
|
|
146
|
-
<text
|
|
222
|
+
<text
|
|
223
|
+
className={"pp-fcpMetricName"}
|
|
224
|
+
style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
|
|
225
|
+
>
|
|
147
226
|
전체 FCP
|
|
148
227
|
</text>
|
|
149
|
-
<text
|
|
228
|
+
<text
|
|
229
|
+
className={"pp-fcpMetricValue"}
|
|
230
|
+
style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
|
|
231
|
+
>
|
|
150
232
|
{formatDuration(totalFcp.duration)}
|
|
151
233
|
</text>
|
|
152
234
|
</view>
|
|
153
|
-
<text
|
|
235
|
+
<text
|
|
236
|
+
className={"pp-fcpMetricDescription"}
|
|
237
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
238
|
+
>
|
|
154
239
|
PrepareTemplate Start부터 Paint End 까지 걸리는
|
|
155
240
|
시간
|
|
156
241
|
</text>
|
|
@@ -158,30 +243,56 @@ export const PerformancePanel = ({
|
|
|
158
243
|
)}
|
|
159
244
|
|
|
160
245
|
{lynxFcp !== undefined && (
|
|
161
|
-
<view
|
|
246
|
+
<view
|
|
247
|
+
className={"pp-fcpMetric"}
|
|
248
|
+
style={{ backgroundColor: colors.bg.layerDefault }}
|
|
249
|
+
>
|
|
162
250
|
<view className={"pp-fcpMetricHeader"}>
|
|
163
|
-
<text
|
|
164
|
-
|
|
251
|
+
<text
|
|
252
|
+
className={"pp-fcpMetricName"}
|
|
253
|
+
style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
|
|
254
|
+
>
|
|
255
|
+
LynxFCP
|
|
256
|
+
</text>
|
|
257
|
+
<text
|
|
258
|
+
className={"pp-fcpMetricValue"}
|
|
259
|
+
style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
|
|
260
|
+
>
|
|
165
261
|
{formatDuration(lynxFcp.duration)}
|
|
166
262
|
</text>
|
|
167
263
|
</view>
|
|
168
|
-
<text
|
|
264
|
+
<text
|
|
265
|
+
className={"pp-fcpMetricDescription"}
|
|
266
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
267
|
+
>
|
|
169
268
|
Bundle Load 시작부터 Paint End 까지 걸리는 시간
|
|
170
269
|
</text>
|
|
171
270
|
</view>
|
|
172
271
|
)}
|
|
173
272
|
|
|
174
273
|
{fcp !== undefined && (
|
|
175
|
-
<view
|
|
274
|
+
<view
|
|
275
|
+
className={"pp-fcpMetric"}
|
|
276
|
+
style={{ backgroundColor: colors.bg.layerDefault }}
|
|
277
|
+
>
|
|
176
278
|
<view className={"pp-fcpMetricHeader"}>
|
|
177
|
-
<text
|
|
279
|
+
<text
|
|
280
|
+
className={"pp-fcpMetricName"}
|
|
281
|
+
style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
|
|
282
|
+
>
|
|
178
283
|
렌더링 FCP
|
|
179
284
|
</text>
|
|
180
|
-
<text
|
|
285
|
+
<text
|
|
286
|
+
className={"pp-fcpMetricValue"}
|
|
287
|
+
style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
|
|
288
|
+
>
|
|
181
289
|
{formatDuration(fcp.duration)}
|
|
182
290
|
</text>
|
|
183
291
|
</view>
|
|
184
|
-
<text
|
|
292
|
+
<text
|
|
293
|
+
className={"pp-fcpMetricDescription"}
|
|
294
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
295
|
+
>
|
|
185
296
|
TemplateBundle 준비부터 Paint End 까지 걸리는 시간
|
|
186
297
|
</text>
|
|
187
298
|
</view>
|
|
@@ -190,9 +301,20 @@ export const PerformancePanel = ({
|
|
|
190
301
|
)}
|
|
191
302
|
|
|
192
303
|
{!!perf.rawEntry && (
|
|
193
|
-
<view
|
|
194
|
-
|
|
195
|
-
|
|
304
|
+
<view
|
|
305
|
+
className={"pp-rawEntrySection"}
|
|
306
|
+
style={{ backgroundColor: colors.bg.neutralWeak }}
|
|
307
|
+
>
|
|
308
|
+
<text
|
|
309
|
+
className={"pp-detailTitle"}
|
|
310
|
+
style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
|
|
311
|
+
>
|
|
312
|
+
Raw Entry
|
|
313
|
+
</text>
|
|
314
|
+
<text
|
|
315
|
+
className={"pp-rawEntry"}
|
|
316
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
317
|
+
>
|
|
196
318
|
{String(stringify(perf.rawEntry, null, 2, { references: true }))}
|
|
197
319
|
</text>
|
|
198
320
|
</view>
|
package/src/components/Tabs.css
CHANGED
|
@@ -6,12 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
.tabs-header {
|
|
8
8
|
display: flex;
|
|
9
|
-
box-shadow: inset 0 -1px 0 0 var(--lynx-console-color-stroke-neutral-subtle);
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
.tabs-triggerButton {
|
|
13
12
|
flex: 1;
|
|
14
|
-
color: var(--lynx-console-color-fg-neutral-subtle);
|
|
15
13
|
display: flex;
|
|
16
14
|
justify-content: center;
|
|
17
15
|
align-items: center;
|
|
@@ -22,12 +20,6 @@
|
|
|
22
20
|
.tabs-triggerButtonText {
|
|
23
21
|
font-size: 1rem;
|
|
24
22
|
line-height: 1.375rem;
|
|
25
|
-
font-weight: var(--lynx-console-font-weight-bold);
|
|
26
|
-
color: var(--lynx-console-color-fg-neutral-subtle);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.tabs-triggerButtonText--active {
|
|
30
|
-
color: var(--lynx-console-color-fg-neutral);
|
|
31
23
|
}
|
|
32
24
|
|
|
33
25
|
.tabs-triggerButtonText--t4 {
|
|
@@ -61,7 +53,6 @@
|
|
|
61
53
|
}
|
|
62
54
|
|
|
63
55
|
.tabs-triggerIndicatorLine {
|
|
64
|
-
background-color: var(--lynx-console-color-fg-neutral);
|
|
65
56
|
width: 100%;
|
|
66
57
|
height: 2px;
|
|
67
58
|
}
|
package/src/components/Tabs.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ReactNode, useRef, useState } from "@lynx-js/react";
|
|
2
2
|
import type { ListSnapEvent, NodesRef } from "@lynx-js/types";
|
|
3
|
+
import { useThemeColors } from "../styles/ThemeContext";
|
|
4
|
+
import { fontWeight } from "../styles/theme";
|
|
3
5
|
import "./Tabs.css";
|
|
4
6
|
|
|
5
7
|
type TabsProps = {
|
|
@@ -12,6 +14,7 @@ type TabsProps = {
|
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
export default function Tabs(props: TabsProps) {
|
|
17
|
+
const colors = useThemeColors();
|
|
15
18
|
const tabContentsRef = useRef<NodesRef>(null);
|
|
16
19
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
17
20
|
const tabSize =
|
|
@@ -21,7 +24,12 @@ export default function Tabs(props: TabsProps) {
|
|
|
21
24
|
|
|
22
25
|
return (
|
|
23
26
|
<view className={"tabs-root"}>
|
|
24
|
-
<view
|
|
27
|
+
<view
|
|
28
|
+
className={"tabs-header"}
|
|
29
|
+
style={{
|
|
30
|
+
boxShadow: `inset 0 -1px 0 0 ${colors.stroke.neutralSubtle}`,
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
25
33
|
{props.items.map((item, i) => (
|
|
26
34
|
<view
|
|
27
35
|
key={item.key}
|
|
@@ -42,7 +50,14 @@ export default function Tabs(props: TabsProps) {
|
|
|
42
50
|
}}
|
|
43
51
|
>
|
|
44
52
|
<text
|
|
45
|
-
className={`tabs-triggerButtonText${
|
|
53
|
+
className={`tabs-triggerButtonText${tabSize ? ` tabs-triggerButtonText--${tabSize}` : ""}`}
|
|
54
|
+
style={{
|
|
55
|
+
fontWeight: fontWeight.bold,
|
|
56
|
+
color:
|
|
57
|
+
i === activeIndex
|
|
58
|
+
? colors.fg.neutral
|
|
59
|
+
: colors.fg.neutralSubtle,
|
|
60
|
+
}}
|
|
46
61
|
>
|
|
47
62
|
{item.label}
|
|
48
63
|
</text>
|
|
@@ -51,7 +66,10 @@ export default function Tabs(props: TabsProps) {
|
|
|
51
66
|
className={"tabs-triggerIndicator"}
|
|
52
67
|
style={{ transform: `translateX(${activeIndex * 100}%)` }}
|
|
53
68
|
>
|
|
54
|
-
<view
|
|
69
|
+
<view
|
|
70
|
+
className={"tabs-triggerIndicatorLine"}
|
|
71
|
+
style={{ backgroundColor: colors.fg.neutral }}
|
|
72
|
+
/>
|
|
55
73
|
</view>
|
|
56
74
|
)}
|
|
57
75
|
</view>
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import "./styles/vars/index.css";
|
|
2
|
-
import "./styles/global.css";
|
|
3
1
|
import {
|
|
4
2
|
type ForwardedRef,
|
|
5
3
|
forwardRef,
|
|
@@ -12,6 +10,8 @@ import { ConsolePanel } from "./components/ConsolePanel.jsx";
|
|
|
12
10
|
import "./components/FloatingButton.css";
|
|
13
11
|
import { FloatingButton } from "./components/FloatingButton.jsx";
|
|
14
12
|
import { usePerformance } from "./hooks/usePerformance";
|
|
13
|
+
import { ThemeProvider } from "./styles/ThemeContext";
|
|
14
|
+
import { getColors } from "./styles/theme";
|
|
15
15
|
import type { CustomTab } from "./types";
|
|
16
16
|
|
|
17
17
|
export interface LynxConsoleHandle {
|
|
@@ -45,6 +45,7 @@ const LynxConsole = forwardRef<LynxConsoleHandle, LynxConsoleProps>(
|
|
|
45
45
|
const [isOpen, setIsOpen] = useState(false);
|
|
46
46
|
const [shouldClose, setShouldClose] = useState(false);
|
|
47
47
|
const { performances } = usePerformance();
|
|
48
|
+
const colors = useMemo(() => getColors(theme), [theme]);
|
|
48
49
|
|
|
49
50
|
const latestFcp = useMemo(() => {
|
|
50
51
|
for (let i = performances.length - 1; i >= 0; i--) {
|
|
@@ -84,28 +85,33 @@ const LynxConsole = forwardRef<LynxConsoleHandle, LynxConsoleProps>(
|
|
|
84
85
|
setShouldClose(false);
|
|
85
86
|
};
|
|
86
87
|
|
|
87
|
-
const themeClass = `data-lynx-console-color-mode__${theme}-only`;
|
|
88
|
-
|
|
89
88
|
return (
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
89
|
+
<ThemeProvider value={colors}>
|
|
90
|
+
<view
|
|
91
|
+
style={{
|
|
92
|
+
backgroundColor: colors.bg.layerDefault,
|
|
93
|
+
color: colors.fg.neutral,
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<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 }}>
|
|
99
|
+
{`${latestFcp?.name ?? "FCP"}: ${latestFcp?.duration ? latestFcp.duration.toFixed(2) : "--"}ms`}
|
|
100
|
+
</text>
|
|
101
|
+
</FloatingButton>
|
|
102
|
+
{isOpen && (
|
|
103
|
+
<BottomSheet
|
|
104
|
+
isOpen={isOpen}
|
|
105
|
+
shouldClose={shouldClose}
|
|
106
|
+
onClose={handleCloseBottomSheet}
|
|
107
|
+
title="Lynx Console"
|
|
108
|
+
safeAreaInsetBottom={safeAreaInsetBottom}
|
|
109
|
+
>
|
|
110
|
+
<ConsolePanel customTabs={customTabs} />
|
|
111
|
+
</BottomSheet>
|
|
112
|
+
)}
|
|
113
|
+
</view>
|
|
114
|
+
</ThemeProvider>
|
|
109
115
|
);
|
|
110
116
|
},
|
|
111
117
|
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "@lynx-js/react";
|
|
2
|
+
import { type ThemeColors, getColors } from "./theme";
|
|
3
|
+
|
|
4
|
+
const ThemeContext = createContext<ThemeColors>(getColors("light"));
|
|
5
|
+
|
|
6
|
+
export const ThemeProvider = ThemeContext.Provider;
|
|
7
|
+
|
|
8
|
+
export function useThemeColors(): ThemeColors {
|
|
9
|
+
return useContext(ThemeContext);
|
|
10
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export type Theme = "light" | "dark";
|
|
2
|
+
|
|
3
|
+
const lightColors = {
|
|
4
|
+
palette: {
|
|
5
|
+
blue100: "#eff6ff",
|
|
6
|
+
blue600: "#5e98fe",
|
|
7
|
+
gray100: "#f7f8f9",
|
|
8
|
+
gray400: "#dcdee3",
|
|
9
|
+
green100: "#edfaf6",
|
|
10
|
+
green600: "#10ab7d",
|
|
11
|
+
purple100: "#f5f3fe",
|
|
12
|
+
purple600: "#9f84fb",
|
|
13
|
+
red100: "#fdf0f0",
|
|
14
|
+
red600: "#fc6a66",
|
|
15
|
+
red900: "#921708",
|
|
16
|
+
staticWhite: "#ffffff",
|
|
17
|
+
yellow100: "#fff7de",
|
|
18
|
+
yellow600: "#c49725",
|
|
19
|
+
yellow900: "#4f3e1f",
|
|
20
|
+
},
|
|
21
|
+
fg: {
|
|
22
|
+
neutral: "#1a1c20",
|
|
23
|
+
placeholder: "#b0b3ba",
|
|
24
|
+
disabled: "#d1d3d8",
|
|
25
|
+
neutralMuted: "#555d6d",
|
|
26
|
+
neutralSubtle: "#868b94",
|
|
27
|
+
},
|
|
28
|
+
bg: {
|
|
29
|
+
overlay: "#00000074",
|
|
30
|
+
layerDefault: "#ffffff",
|
|
31
|
+
layerFloating: "#ffffff",
|
|
32
|
+
neutralWeak: "#f3f4f5",
|
|
33
|
+
},
|
|
34
|
+
stroke: {
|
|
35
|
+
neutralSubtle: "#0000000c",
|
|
36
|
+
neutralWeak: "#dcdee3",
|
|
37
|
+
},
|
|
38
|
+
} as const;
|
|
39
|
+
|
|
40
|
+
const darkColors = {
|
|
41
|
+
palette: {
|
|
42
|
+
blue100: "#202742",
|
|
43
|
+
blue600: "#1e82eb",
|
|
44
|
+
gray100: "#16171b",
|
|
45
|
+
gray400: "#393d46",
|
|
46
|
+
green100: "#202926",
|
|
47
|
+
green600: "#1b946d",
|
|
48
|
+
purple100: "#28213b",
|
|
49
|
+
purple600: "#8e6bee",
|
|
50
|
+
red100: "#322323",
|
|
51
|
+
red600: "#f73526",
|
|
52
|
+
red900: "#f8c5c3",
|
|
53
|
+
staticWhite: "#ffffff",
|
|
54
|
+
yellow100: "#302819",
|
|
55
|
+
yellow600: "#b6720d",
|
|
56
|
+
yellow900: "#e5d49b",
|
|
57
|
+
},
|
|
58
|
+
fg: {
|
|
59
|
+
neutral: "#f3f4f5",
|
|
60
|
+
placeholder: "#868b94",
|
|
61
|
+
disabled: "#5b606a",
|
|
62
|
+
neutralMuted: "#dcdee3",
|
|
63
|
+
neutralSubtle: "#b0b3ba",
|
|
64
|
+
},
|
|
65
|
+
bg: {
|
|
66
|
+
overlay: "#00000074",
|
|
67
|
+
layerDefault: "#16171b",
|
|
68
|
+
layerFloating: "#1d2025",
|
|
69
|
+
neutralWeak: "#2b2e35",
|
|
70
|
+
},
|
|
71
|
+
stroke: {
|
|
72
|
+
neutralSubtle: "#ffffff0d",
|
|
73
|
+
neutralWeak: "#393d46",
|
|
74
|
+
},
|
|
75
|
+
} as const;
|
|
76
|
+
|
|
77
|
+
const colorMap = {
|
|
78
|
+
light: lightColors,
|
|
79
|
+
dark: darkColors,
|
|
80
|
+
} as const;
|
|
81
|
+
|
|
82
|
+
export const fontWeight = {
|
|
83
|
+
regular: "400",
|
|
84
|
+
medium: "500",
|
|
85
|
+
bold: "700",
|
|
86
|
+
} as const;
|
|
87
|
+
|
|
88
|
+
export const duration = {
|
|
89
|
+
d4: "200ms",
|
|
90
|
+
d6: "300ms",
|
|
91
|
+
} as const;
|
|
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
|
+
export function getColors(theme: Theme) {
|
|
108
|
+
return colorMap[theme];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type ThemeColors = ReturnType<typeof getColors>;
|
package/src/styles/global.css
DELETED
package/src/styles/vars/color.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Color Palette
|
|
2
|
-
export const palette = {
|
|
3
|
-
blue100: "var(--lynx-console-color-palette-blue-100)",
|
|
4
|
-
blue600: "var(--lynx-console-color-palette-blue-600)",
|
|
5
|
-
gray100: "var(--lynx-console-color-palette-gray-100)",
|
|
6
|
-
gray400: "var(--lynx-console-color-palette-gray-400)",
|
|
7
|
-
green100: "var(--lynx-console-color-palette-green-100)",
|
|
8
|
-
green600: "var(--lynx-console-color-palette-green-600)",
|
|
9
|
-
purple100: "var(--lynx-console-color-palette-purple-100)",
|
|
10
|
-
purple600: "var(--lynx-console-color-palette-purple-600)",
|
|
11
|
-
red100: "var(--lynx-console-color-palette-red-100)",
|
|
12
|
-
red600: "var(--lynx-console-color-palette-red-600)",
|
|
13
|
-
red900: "var(--lynx-console-color-palette-red-900)",
|
|
14
|
-
staticWhite: "var(--lynx-console-color-palette-static-white)",
|
|
15
|
-
yellow100: "var(--lynx-console-color-palette-yellow-100)",
|
|
16
|
-
yellow600: "var(--lynx-console-color-palette-yellow-600)",
|
|
17
|
-
yellow900: "var(--lynx-console-color-palette-yellow-900)",
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// Foreground Colors
|
|
21
|
-
export const fg = {
|
|
22
|
-
neutral: "var(--lynx-console-color-fg-neutral)",
|
|
23
|
-
placeholder: "var(--lynx-console-color-fg-placeholder)",
|
|
24
|
-
disabled: "var(--lynx-console-color-fg-disabled)",
|
|
25
|
-
neutralMuted: "var(--lynx-console-color-fg-neutral-muted)",
|
|
26
|
-
neutralSubtle: "var(--lynx-console-color-fg-neutral-subtle)",
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// Background Colors
|
|
30
|
-
export const bg = {
|
|
31
|
-
overlay: "var(--lynx-console-color-bg-overlay)",
|
|
32
|
-
layerDefault: "var(--lynx-console-color-bg-layer-default)",
|
|
33
|
-
layerFloating: "var(--lynx-console-color-bg-layer-floating)",
|
|
34
|
-
neutralWeak: "var(--lynx-console-color-bg-neutral-weak)",
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Stroke Colors
|
|
38
|
-
export const stroke = {
|
|
39
|
-
neutralSubtle: "var(--lynx-console-color-stroke-neutral-subtle)",
|
|
40
|
-
neutralWeak: "var(--lynx-console-color-stroke-neutral-weak)",
|
|
41
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Dimensions
|
|
2
|
-
export const x2 = "var(--lynx-console-dimension-x2)";
|
|
3
|
-
export const x3 = "var(--lynx-console-dimension-x3)";
|
|
4
|
-
export const x4 = "var(--lynx-console-dimension-x4)";
|
|
5
|
-
export const x6 = "var(--lynx-console-dimension-x6)";
|
|
6
|
-
|
|
7
|
-
// Spacing
|
|
8
|
-
export const spacingX = {
|
|
9
|
-
globalGutter: "var(--lynx-console-dimension-spacing-x-global-gutter)",
|
|
10
|
-
};
|