lynx-console 0.2.0 → 0.2.2
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 -112
- package/dist/index.css +0 -388
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +616 -113
- package/dist/index.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 +159 -29
- package/src/components/Tabs.css +0 -9
- package/src/components/Tabs.tsx +21 -3
- package/src/index.tsx +29 -22
- 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,16 +63,40 @@ 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
101
|
bindtap={() => {
|
|
76
102
|
console.log("[PerformancePanel] performances", performances);
|
|
@@ -79,12 +105,24 @@ export const PerformancePanel = ({
|
|
|
79
105
|
>
|
|
80
106
|
<text>Log</text>
|
|
81
107
|
</view>
|
|
82
|
-
<view
|
|
83
|
-
|
|
108
|
+
<view
|
|
109
|
+
bindtap={clearPerformances}
|
|
110
|
+
className={"pp-clearButton"}
|
|
111
|
+
style={{ backgroundColor: colors.bg.neutralWeak }}
|
|
112
|
+
>
|
|
113
|
+
<text
|
|
114
|
+
className={"pp-clearButtonText"}
|
|
115
|
+
style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
|
|
116
|
+
>
|
|
117
|
+
🗑
|
|
118
|
+
</text>
|
|
84
119
|
</view>
|
|
85
120
|
</view>
|
|
86
121
|
<view className={"pp-placeholder"}>
|
|
87
|
-
<text
|
|
122
|
+
<text
|
|
123
|
+
className={"pp-placeholderText"}
|
|
124
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.disabled }}
|
|
125
|
+
>
|
|
88
126
|
No performance data yet...
|
|
89
127
|
</text>
|
|
90
128
|
</view>
|
|
@@ -94,10 +132,27 @@ export const PerformancePanel = ({
|
|
|
94
132
|
|
|
95
133
|
return (
|
|
96
134
|
<view className={"pp-container"}>
|
|
97
|
-
<view
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
135
|
+
<view
|
|
136
|
+
className={"pp-header"}
|
|
137
|
+
style={{ borderBottomColor: colors.stroke.neutralSubtle }}
|
|
138
|
+
>
|
|
139
|
+
<text
|
|
140
|
+
className={"pp-count"}
|
|
141
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
142
|
+
>
|
|
143
|
+
{performances.length} entries
|
|
144
|
+
</text>
|
|
145
|
+
<view
|
|
146
|
+
bindtap={clearPerformances}
|
|
147
|
+
className={"pp-clearButton"}
|
|
148
|
+
style={{ backgroundColor: colors.bg.neutralWeak }}
|
|
149
|
+
>
|
|
150
|
+
<text
|
|
151
|
+
className={"pp-clearButtonText"}
|
|
152
|
+
style={{ fontWeight: fontWeight.medium, color: colors.fg.neutralMuted }}
|
|
153
|
+
>
|
|
154
|
+
🗑
|
|
155
|
+
</text>
|
|
101
156
|
</view>
|
|
102
157
|
</view>
|
|
103
158
|
|
|
@@ -110,18 +165,35 @@ export const PerformancePanel = ({
|
|
|
110
165
|
|
|
111
166
|
return (
|
|
112
167
|
<list-item key={perf.id} item-key={perf.id}>
|
|
113
|
-
<view
|
|
168
|
+
<view
|
|
169
|
+
className={"pp-item"}
|
|
170
|
+
style={{ borderBottomColor: colors.stroke.neutralWeak }}
|
|
171
|
+
>
|
|
114
172
|
<view
|
|
115
173
|
className={"pp-itemHeader"}
|
|
116
174
|
bindtap={() =>
|
|
117
175
|
setSelectedId(selectedId === perf.id ? null : perf.id)
|
|
118
176
|
}
|
|
119
177
|
>
|
|
120
|
-
<text
|
|
178
|
+
<text
|
|
179
|
+
className={"pp-entryType"}
|
|
180
|
+
style={{
|
|
181
|
+
fontWeight: fontWeight.bold,
|
|
182
|
+
...getEntryTypeColors(colors, perf.entryType),
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
121
185
|
{perf.entryType}
|
|
122
186
|
</text>
|
|
123
|
-
<text
|
|
124
|
-
|
|
187
|
+
<text
|
|
188
|
+
className={"pp-entryName"}
|
|
189
|
+
style={{ fontWeight: fontWeight.medium, color: colors.fg.neutral }}
|
|
190
|
+
>
|
|
191
|
+
{perf.name}
|
|
192
|
+
</text>
|
|
193
|
+
<text
|
|
194
|
+
className={"pp-timestamp"}
|
|
195
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
196
|
+
>
|
|
125
197
|
{new Date(perf.timestamp).toISOString()}
|
|
126
198
|
</text>
|
|
127
199
|
</view>
|
|
@@ -132,7 +204,16 @@ export const PerformancePanel = ({
|
|
|
132
204
|
}
|
|
133
205
|
>
|
|
134
206
|
{isMetricFcp && primaryFcp && (
|
|
135
|
-
<text
|
|
207
|
+
<text
|
|
208
|
+
className={"pp-fcpHighlight"}
|
|
209
|
+
style={{
|
|
210
|
+
fontWeight: fontWeight.bold,
|
|
211
|
+
color: colors.palette.blue600,
|
|
212
|
+
backgroundColor: colors.palette.blue100,
|
|
213
|
+
}}
|
|
214
|
+
>
|
|
215
|
+
{primaryFcp}
|
|
216
|
+
</text>
|
|
136
217
|
)}
|
|
137
218
|
</view>
|
|
138
219
|
|
|
@@ -141,16 +222,28 @@ export const PerformancePanel = ({
|
|
|
141
222
|
{isMetricFcp && fcpMetrics && (
|
|
142
223
|
<view className={"pp-fcpSection"}>
|
|
143
224
|
{totalFcp !== undefined && (
|
|
144
|
-
<view
|
|
225
|
+
<view
|
|
226
|
+
className={"pp-fcpMetric"}
|
|
227
|
+
style={{ backgroundColor: colors.bg.layerDefault }}
|
|
228
|
+
>
|
|
145
229
|
<view className={"pp-fcpMetricHeader"}>
|
|
146
|
-
<text
|
|
230
|
+
<text
|
|
231
|
+
className={"pp-fcpMetricName"}
|
|
232
|
+
style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
|
|
233
|
+
>
|
|
147
234
|
전체 FCP
|
|
148
235
|
</text>
|
|
149
|
-
<text
|
|
236
|
+
<text
|
|
237
|
+
className={"pp-fcpMetricValue"}
|
|
238
|
+
style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
|
|
239
|
+
>
|
|
150
240
|
{formatDuration(totalFcp.duration)}
|
|
151
241
|
</text>
|
|
152
242
|
</view>
|
|
153
|
-
<text
|
|
243
|
+
<text
|
|
244
|
+
className={"pp-fcpMetricDescription"}
|
|
245
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
246
|
+
>
|
|
154
247
|
PrepareTemplate Start부터 Paint End 까지 걸리는
|
|
155
248
|
시간
|
|
156
249
|
</text>
|
|
@@ -158,30 +251,56 @@ export const PerformancePanel = ({
|
|
|
158
251
|
)}
|
|
159
252
|
|
|
160
253
|
{lynxFcp !== undefined && (
|
|
161
|
-
<view
|
|
254
|
+
<view
|
|
255
|
+
className={"pp-fcpMetric"}
|
|
256
|
+
style={{ backgroundColor: colors.bg.layerDefault }}
|
|
257
|
+
>
|
|
162
258
|
<view className={"pp-fcpMetricHeader"}>
|
|
163
|
-
<text
|
|
164
|
-
|
|
259
|
+
<text
|
|
260
|
+
className={"pp-fcpMetricName"}
|
|
261
|
+
style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
|
|
262
|
+
>
|
|
263
|
+
LynxFCP
|
|
264
|
+
</text>
|
|
265
|
+
<text
|
|
266
|
+
className={"pp-fcpMetricValue"}
|
|
267
|
+
style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
|
|
268
|
+
>
|
|
165
269
|
{formatDuration(lynxFcp.duration)}
|
|
166
270
|
</text>
|
|
167
271
|
</view>
|
|
168
|
-
<text
|
|
272
|
+
<text
|
|
273
|
+
className={"pp-fcpMetricDescription"}
|
|
274
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
275
|
+
>
|
|
169
276
|
Bundle Load 시작부터 Paint End 까지 걸리는 시간
|
|
170
277
|
</text>
|
|
171
278
|
</view>
|
|
172
279
|
)}
|
|
173
280
|
|
|
174
281
|
{fcp !== undefined && (
|
|
175
|
-
<view
|
|
282
|
+
<view
|
|
283
|
+
className={"pp-fcpMetric"}
|
|
284
|
+
style={{ backgroundColor: colors.bg.layerDefault }}
|
|
285
|
+
>
|
|
176
286
|
<view className={"pp-fcpMetricHeader"}>
|
|
177
|
-
<text
|
|
287
|
+
<text
|
|
288
|
+
className={"pp-fcpMetricName"}
|
|
289
|
+
style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
|
|
290
|
+
>
|
|
178
291
|
렌더링 FCP
|
|
179
292
|
</text>
|
|
180
|
-
<text
|
|
293
|
+
<text
|
|
294
|
+
className={"pp-fcpMetricValue"}
|
|
295
|
+
style={{ fontWeight: fontWeight.bold, color: colors.palette.blue600 }}
|
|
296
|
+
>
|
|
181
297
|
{formatDuration(fcp.duration)}
|
|
182
298
|
</text>
|
|
183
299
|
</view>
|
|
184
|
-
<text
|
|
300
|
+
<text
|
|
301
|
+
className={"pp-fcpMetricDescription"}
|
|
302
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
303
|
+
>
|
|
185
304
|
TemplateBundle 준비부터 Paint End 까지 걸리는 시간
|
|
186
305
|
</text>
|
|
187
306
|
</view>
|
|
@@ -190,9 +309,20 @@ export const PerformancePanel = ({
|
|
|
190
309
|
)}
|
|
191
310
|
|
|
192
311
|
{!!perf.rawEntry && (
|
|
193
|
-
<view
|
|
194
|
-
|
|
195
|
-
|
|
312
|
+
<view
|
|
313
|
+
className={"pp-rawEntrySection"}
|
|
314
|
+
style={{ backgroundColor: colors.bg.neutralWeak }}
|
|
315
|
+
>
|
|
316
|
+
<text
|
|
317
|
+
className={"pp-detailTitle"}
|
|
318
|
+
style={{ fontWeight: fontWeight.bold, color: colors.fg.neutral }}
|
|
319
|
+
>
|
|
320
|
+
Raw Entry
|
|
321
|
+
</text>
|
|
322
|
+
<text
|
|
323
|
+
className={"pp-rawEntry"}
|
|
324
|
+
style={{ fontWeight: fontWeight.regular, color: colors.fg.neutralSubtle }}
|
|
325
|
+
>
|
|
196
326
|
{String(stringify(perf.rawEntry, null, 2, { references: true }))}
|
|
197
327
|
</text>
|
|
198
328
|
</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,4 +1,3 @@
|
|
|
1
|
-
import "./styles/vars/index.css";
|
|
2
1
|
import {
|
|
3
2
|
type ForwardedRef,
|
|
4
3
|
forwardRef,
|
|
@@ -11,6 +10,8 @@ import { ConsolePanel } from "./components/ConsolePanel.jsx";
|
|
|
11
10
|
import "./components/FloatingButton.css";
|
|
12
11
|
import { FloatingButton } from "./components/FloatingButton.jsx";
|
|
13
12
|
import { usePerformance } from "./hooks/usePerformance";
|
|
13
|
+
import { ThemeProvider } from "./styles/ThemeContext";
|
|
14
|
+
import { getColors } from "./styles/theme";
|
|
14
15
|
import type { CustomTab } from "./types";
|
|
15
16
|
|
|
16
17
|
export interface LynxConsoleHandle {
|
|
@@ -44,6 +45,7 @@ const LynxConsole = forwardRef<LynxConsoleHandle, LynxConsoleProps>(
|
|
|
44
45
|
const [isOpen, setIsOpen] = useState(false);
|
|
45
46
|
const [shouldClose, setShouldClose] = useState(false);
|
|
46
47
|
const { performances } = usePerformance();
|
|
48
|
+
const colors = useMemo(() => getColors(theme), [theme]);
|
|
47
49
|
|
|
48
50
|
const latestFcp = useMemo(() => {
|
|
49
51
|
for (let i = performances.length - 1; i >= 0; i--) {
|
|
@@ -83,28 +85,33 @@ const LynxConsole = forwardRef<LynxConsoleHandle, LynxConsoleProps>(
|
|
|
83
85
|
setShouldClose(false);
|
|
84
86
|
};
|
|
85
87
|
|
|
86
|
-
const themeClass = `data-lynx-console-color-mode__${theme}-only`;
|
|
87
|
-
|
|
88
88
|
return (
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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>
|
|
108
115
|
);
|
|
109
116
|
},
|
|
110
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
|
-
};
|