Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 87bd9d1

Browse files
committed
wip
1 parent 57526e6 commit 87bd9d1

9 files changed

Lines changed: 282 additions & 79 deletions

File tree

src/components/Loading.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
line-height: 1;
2727
font-size: 2em;
2828
}
29+
30+
&:empty {
31+
display: none;
32+
}
2933
}
3034
3135
</style>

src/components/Settings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import { app } from '~store/store.ts';
2+
import { app } from '~store/store.ts';
33
44
import { styleBuilder } from '~utils/styleBuilder';
55
import { debounce } from '@github/mini-throttle';

src/components/ThemeSwitcher.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
</header>
3030
{/if}
3131

32-
<grid>
32+
<grid class='grid'>
3333
<div class='first-col'>
34-
<ThemeSelector></ThemeSelector>
34+
<ThemeSelector />
3535

36-
<Settings></Settings>
36+
<Settings />
3737
</div>
3838

3939
<div class='second-col preview'>
40-
<ThemePreview></ThemePreview>
40+
<ThemePreview />
4141
</div>
4242
</grid>
4343
</div>
@@ -102,7 +102,7 @@
102102
}
103103
}
104104
105-
grid {
105+
.grid {
106106
display: grid;
107107
grid-template-columns: 50% 50%;
108108
grid-column-gap: 20px;

src/devtools.svelte

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import darkStyle from 'data-text:./assets/dark.css';
44
import lightStyle from 'data-text:./assets/light.css';
55
6-
(async function (w, storage, panels, browserAction) {
6+
(async function(w, storage, panels, browserAction) {
77
const SETTINGS = 'devtools-settings';
88
const DEVTOOLS_THEME = 'devtools-theme';
99
const DEVTOOLS_FONT = 'devtools-font';
@@ -62,7 +62,7 @@
6262
cyan,
6363
white,
6464
gray,
65-
error,
65+
error
6666
} = currentTheme.colors;
6767
6868
return this.styles({
@@ -106,7 +106,7 @@
106106
error,
107107
fontFamily: currentFontFamily,
108108
fontSize: currentFontSize,
109-
accentColor: accentColor,
109+
accentColor: accentColor
110110
});
111111
}
112112
},
@@ -197,59 +197,59 @@
197197
error,
198198
fontFamily,
199199
fontSize,
200-
accentColor,
200+
accentColor
201201
}) {
202202
// language=CSS
203203
return `
204-
:root {
205-
--bg: ${background};
206-
--fg: ${foreground};
207-
--text: ${primary};
208-
--selBg: ${selectBg};
209-
--selFg: ${selectFg};
210-
--selFg2: ${selectFg2};
211-
--button: ${button};
212-
--disabled: ${disabled};
213-
--contrast: ${contrast};
214-
--second: ${second};
215-
--active: ${table};
216-
--border: ${border};
217-
--hl: ${highlight};
218-
--tree: ${tree};
219-
--notif: ${notif};
220-
--accent: ${accentColor || accent};
221-
--excluded: ${excluded};
204+
:root {
205+
--bg: ${background};
206+
--fg: ${foreground};
207+
--text: ${primary};
208+
--selBg: ${selectBg};
209+
--selFg: ${selectFg};
210+
--selFg2: ${selectFg2};
211+
--button: ${button};
212+
--disabled: ${disabled};
213+
--contrast: ${contrast};
214+
--second: ${second};
215+
--active: ${table};
216+
--border: ${border};
217+
--hl: ${highlight};
218+
--tree: ${tree};
219+
--notif: ${notif};
220+
--accent: ${accentColor || accent};
221+
--excluded: ${excluded};
222222
223-
--tags: ${tags};
224-
--attributes: ${attributes};
225-
--comments: ${comments};
226-
--keywords: ${keywords};
227-
--errors: ${errors};
228-
--vars: ${vars};
229-
--operators: ${operators};
230-
--functions: ${functions};
231-
--strings: ${strings};
232-
--numbers: ${numbers};
233-
--links: ${links};
234-
--parameters: ${parameters};
235-
--green: ${green};
236-
--red: ${red};
237-
--yellow: ${yellow};
238-
--blue: ${blue};
239-
--purple: ${purple};
240-
--orange: ${orange};
241-
--cyan: ${cyan};
242-
--white: ${white};
243-
--gray: ${gray};
244-
--error: ${error};
223+
--tags: ${tags};
224+
--attributes: ${attributes};
225+
--comments: ${comments};
226+
--keywords: ${keywords};
227+
--errors: ${errors};
228+
--vars: ${vars};
229+
--operators: ${operators};
230+
--functions: ${functions};
231+
--strings: ${strings};
232+
--numbers: ${numbers};
233+
--links: ${links};
234+
--parameters: ${parameters};
235+
--green: ${green};
236+
--red: ${red};
237+
--yellow: ${yellow};
238+
--blue: ${blue};
239+
--purple: ${purple};
240+
--orange: ${orange};
241+
--cyan: ${cyan};
242+
--white: ${white};
243+
--gray: ${gray};
244+
--error: ${error};
245245
246246
247-
--ui-font-family: Roboto, Helvetica Neue, Arial, sans-serif;
248-
--font-family: ${fontFamily}, Menlo, Consolas, "Fira Code", monospace;
249-
--font-size: ${fontSize || 10}px;
250-
}
251-
`;
252-
},
247+
--ui-font-family: Roboto, Helvetica Neue, Arial, sans-serif;
248+
--font-family: ${fontFamily}, Menlo, Consolas, "Fira Code", monospace;
249+
--font-size: ${fontSize || 10}px;
250+
}
251+
`;
252+
}
253253
};
254254
255255
function generateScrollbarsStyle(scrollbars = true) {
@@ -258,29 +258,29 @@
258258
}
259259
// language=CSS
260260
return `
261-
:host ::-webkit-scrollbar,
262-
html ::-webkit-scrollbar,
263-
.-theme-with-dark-background ::-webkit-scrollbar,
264-
:host-context(.-theme-with-dark-background) ::-webkit-scrollbar {
265-
width: 10px !important;
266-
height: 10px !important;
267-
opacity: 0 !important;
268-
transition: opacity 0.4s ease;
269-
}
270-
`;
261+
:host ::-webkit-scrollbar,
262+
html ::-webkit-scrollbar,
263+
.-theme-with-dark-background ::-webkit-scrollbar,
264+
:host-context(.-theme-with-dark-background) ::-webkit-scrollbar {
265+
width: 10px !important;
266+
height: 10px !important;
267+
opacity: 0 !important;
268+
transition: opacity 0.4s ease;
269+
}
270+
`;
271271
}
272272
273273
async function themeSetup() {
274274
storage.get(SETTINGS, async (object) => {
275275
const settings = object[SETTINGS];
276276
if (settings && settings.startsWith('{')) {
277277
const json = JSON.parse(settings);
278-
const size = json[DEVTOOLS_SIZE],
279-
theme = json[DEVTOOLS_THEME] || 'Oceanic',
280-
current = json[DEVTOOLS_CURRENT],
281-
family = json[DEVTOOLS_FONT],
278+
const size = json[DEVTOOLS_SIZE],
279+
theme = json[DEVTOOLS_THEME] || 'Oceanic',
280+
current = json[DEVTOOLS_CURRENT],
281+
family = json[DEVTOOLS_FONT],
282282
scrollbars = json[DEVTOOLS_SCROLLBARS] ?? true,
283-
accent = json[DEVTOOLS_ACCENT_COLOR];
283+
accent = json[DEVTOOLS_ACCENT_COLOR];
284284
285285
// Variables
286286
let style = styleBuilder.generateThemeVars(current, family, size, accent);
@@ -293,18 +293,16 @@
293293
// Apply theme
294294
if (current.dark) {
295295
panels.applyStyleSheet(lightStyle);
296-
} else {
296+
}
297+
else {
297298
panels.applyStyleSheet(darkStyle);
298299
}
299300
// Apply def style
300301
panels.applyStyleSheet(scroll);
301-
} else {
302+
}
303+
else {
302304
// Append scroll manually
303305
const scroll = generateScrollbarsStyle(true);
304-
305-
// css = await fetch('~/assets/default.css').then((res) => res.text());
306-
307-
console.log('applying default theme');
308306
panels.applyStyleSheet(defaultStyle);
309307
panels.applyStyleSheet(scroll);
310308
}

src/popup.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang='ts'>
22
import App from '~App.svelte';
3+
import './styles/app.scss';
34
</script>
45

56
<style global lang='scss'>
@@ -21,8 +22,8 @@
2122
margin: 0;
2223
height: 100%;
2324
width: 100%;
24-
min-width: 1024px;
25-
min-height: 800px;
25+
min-width: 720px;
26+
min-height: 600px;
2627
font-family: Roboto, -apple-system, BlinkMacSystemFont, Segoe UI, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
2728
font-size: 14px;
2829
line-height: 1.5;
@@ -135,6 +136,7 @@
135136
flex-direction: column;
136137
justify-content: flex-start;
137138
align-items: center;
139+
overflow-x: hidden;
138140
}
139141
</style>
140142

src/styles/app.scss

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
@import 'base/variables';
2+
@import 'base/typography';
3+
@import 'base/animations';
4+
5+
:root {
6+
--bg: #263238;
7+
--fg: #b0bec5;
8+
}
9+
10+
.loading {
11+
position: relative;
12+
top: 50%;
13+
transform: translateY(-50%);
14+
text-align: center;
15+
width: 100%;
16+
margin: 0 auto;
17+
padding: 0 2rem;
18+
max-width: 40rem;
19+
min-width: 24rem;
20+
}
21+
22+
select,
23+
input[type='text'],
24+
input[type='range'],
25+
input[type='range']::-webkit-slider-thumb {
26+
-webkit-appearance: none;
27+
background: transparent;
28+
outline: none;
29+
width: 100%;
30+
height: 2.3125rem;
31+
padding: 0.5rem;
32+
margin: 0;
33+
34+
&:focus {
35+
outline: none;
36+
box-shadow: none;
37+
}
38+
}
39+
40+
input[type='text'] {
41+
border: 0.0625rem solid var(--hl);
42+
background: var(--contrast);
43+
}
44+
45+
input[type='range'] {
46+
border: 0 none;
47+
line-height: normal;
48+
font: inherit;
49+
transition: all 0.15s ease;
50+
51+
&:focus {
52+
&::-webkit-slider-thumb {
53+
box-shadow: 0 0 0 0.5rem rgba(0, 0, 0, 0.075);
54+
}
55+
}
56+
}
57+
58+
input[type='range']::-webkit-slider-thumb {
59+
width: 1rem;
60+
height: 1rem;
61+
border: 0.1875rem solid var(--accent);
62+
background-color: var(--accent);
63+
box-shadow: 0 0 0 0.1875rem var(--border);
64+
border-radius: 100%;
65+
margin-top: -0.5rem;
66+
transition: inherit;
67+
}
68+
69+
input[type='range']::-webkit-slider-runnable-track {
70+
width: 100%;
71+
height: 0.125rem;
72+
cursor: pointer;
73+
background: var(--hl);
74+
border-radius: 0.25rem;
75+
}
76+
77+
@for $item from 1 through 40 {
78+
.anim.anim-delayed:nth-child(#{$item}) {
79+
animation-delay: #{$item/12}s !important;
80+
}
81+
}

0 commit comments

Comments
 (0)