Skip to content

Commit aa5fb9e

Browse files
authored
feat: created start menu
re #183
1 parent 470a1fa commit aa5fb9e

File tree

4 files changed

+58
-142
lines changed

4 files changed

+58
-142
lines changed

src/assets/style.less

+7-127
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ html {
4949

5050
color: var(--text);
5151
}
52-
.bx {
53-
font-size: 25px;
54-
}
5552

5653
toolbar {
5754
width: 100%;
@@ -64,6 +61,8 @@ toolbar {
6461
border: 1px solid var(--surface-0);
6562
box-shadow: 1px 3px 10px rgba(0, 0, 0, 0.2), 0 0px 10px rgba(0, 0, 0, 0.2);
6663
user-select: none;
64+
position: relvative;
65+
z-index: 1001;
6766

6867
& > div {
6968
&.outlined {
@@ -168,128 +167,9 @@ window-area {
168167
}
169168
}
170169

171-
launcher {
172-
position: absolute;
173-
display: flex;
174-
flex-direction: column;
175-
justify-content: center;
176-
align-items: center;
177-
top: 0;
178-
background: color-mix(in srgb, var(--crust) 20%, transparent);
179-
z-index: 99999999999999999999999;
180-
width: calc(100vw + 20px);
181-
height: calc(100vh + 20px);
182-
gap: 20px;
183-
transition: 0.2s opacity, 0.2s backdrop-filter;
184-
margin: 0;
185-
left: 0;
186-
187-
&[style*="opacity: 1;"] {
188-
apps * {
189-
pointer-events: all;
190-
}
191-
}
192-
193-
apps {
194-
max-height: 70vh;
195-
padding: 20px;
196-
margin: 40px;
197-
justify-content: center;
198-
display: flex;
199-
flex-wrap: wrap;
200-
gap: 40px;
201-
overflow: scroll;
202-
pointer-events: none;
203-
204-
app {
205-
flex: 1 0 21%;
206-
flex-grow: 0;
207-
align-items: center;
208-
justify-content: center;
209-
display: flex;
210-
flex-direction: column;
211-
gap: 10px;
212-
min-width: 125px;
213-
max-width: 125px;
214-
text-align: center;
215-
overflow: visible;
216-
transition: transform 0.1s ease-in-out;
217-
cursor: pointer;
218-
219-
220-
&:hover {
221-
transform: scale(1.1);
222-
223-
div {
224-
background: var(--surface-0);
225-
}
226-
227-
img {
228-
filter: drop-shadow(0px 2px 10px rgba(0, 0, 0, 0.75));
229-
}
230-
}
231-
232-
img {
233-
width: 100%;
234-
border-radius: var(--app-radius);
235-
aspect-ratio: 1 / 1;
236-
}
237-
238-
div {
239-
overflow: hidden;
240-
text-overflow: ellipsis;
241-
width: fit-content;
242-
height: 100%;
243-
white-space: nowrap;
244-
padding: 5px 10px;
245-
border-radius: 5px;
246-
transition: background 0.1s ease-in-out;
247-
}
248-
}
249-
}
250-
251-
input {
252-
background: var(--mantle);
253-
border: 2px solid var(--crust);
254-
border-radius: 10px;
255-
padding: 10px;
256-
width: 300px;
257-
max-width: 100vw;
258-
text-align: center;
259-
transition: border 0.2s;
260-
261-
&:focus {
262-
outline: none;
263-
border: 2px solid var(--text);
264-
}
265-
}
266-
}
267-
268-
preloader {
269-
position: absolute;
270-
z-index: 9999999;
271-
top: 0;
272-
left: 0;
273-
background: var(--crust);
274-
width: 100vw;
275-
height: 100vh;
276-
display: flex;
277-
flex-direction: column;
278-
align-items: center;
279-
justify-content: center;
280-
transition: opacity 1s;
281-
282-
.status, .done {
283-
text-align: center;
284-
}
285-
286-
.done div {
287-
display: flex;
288-
align-items: center;
289-
gap: 2px;
290-
}
291-
}
292-
293-
flex {
294-
flex: 1;
170+
.gradient-blur {
171+
mask: linear-gradient(to bottom, transparent, black 5%), linear-gradient(to top, transparent, black 35%);
172+
mask-size: 100% 50%;
173+
mask-repeat: no-repeat;
174+
mask-position: top, bottom;
295175
}

src/system/Desktop.ts

+31-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,34 @@ const BootLoader: Process = {
1616
const { fs } = process
1717
const wm = await process.loadLibrary('lib/WindowManager')
1818
const launcher = await process.loadLibrary('lib/Launcher')
19+
const { Input } = await process.loadLibrary('lib/Components')
1920

20-
const input = new HTML('input').attr({
21+
const input = Input.new().attr({
2122
type: 'text',
2223
placeholder: 'Search'
24+
}).style({
25+
width: '100%',
26+
'border-radius': '10px',
27+
padding: '5px',
28+
'margin-bottom': '10px',
29+
position: 'sticky',
30+
top: '0'
2331
}).on('keyup', () => {
2432
apps.elm.innerHTML = ''
2533
renderApps().catch(e => console.error(e))
2634
}).appendTo(launcher.element)
27-
const apps = new HTML('apps').appendTo(launcher.element)
35+
36+
const apps = new HTML('div').style({
37+
overflow: 'scroll',
38+
height: 'max-content',
39+
position: 'relative'
40+
})
41+
42+
new HTML('div').style({
43+
height: '100%',
44+
overflow: 'scroll',
45+
'padding-bottom': '30px'
46+
}).append(apps).appendTo(launcher.element).class('gradient-blur')
2847

2948
const renderApps = async (): Promise<void> => {
3049
apps.html('')
@@ -36,13 +55,21 @@ const BootLoader: Process = {
3655
const path = Buffer.from(data).toString()
3756
const executable = await process.kernel.getExecutable(path) as Process
3857

39-
const appElement = new HTML('app').on('click', () => {
58+
const appElement = new HTML('div').style({
59+
display: 'flex',
60+
'align-items': 'center',
61+
padding: '5px',
62+
cursor: 'pointer',
63+
gap: '10px',
64+
'border-bottom': '1px solid var(--surface-0)'
65+
}).on('click', () => {
4066
process.launch(path).catch((e: any) => console.error(e))
4167
launcher.toggle()
4268
}).appendTo(apps)
4369
new HTML('img').attr({
4470
src: executable.config.icon ?? nullIcon,
45-
alt: `${executable.config.name} icon`
71+
alt: `${executable.config.name} icon`,
72+
height: '40px'
4673
}).appendTo(appElement)
4774
new HTML('div').text(executable.config.name).appendTo(appElement)
4875
}).catch((e: any) => console.error(e))

src/system/lib/Launcher.ts

+19-10
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,34 @@ const Launcher: Library = {
99
targetVer: '1.0.0-indev.0'
1010
},
1111
init: (l, k) => {
12-
Launcher.data.element = new l.HTML('launcher').style({
13-
opacity: '0',
14-
'backdrop-filter': 'blur(0px)',
15-
'pointer-events': 'none'
12+
Launcher.data.element = new l.HTML('div').style({
13+
background: `${document.documentElement.style.getPropertyValue('--mantle')}E0`,
14+
width: '350px',
15+
height: '500px',
16+
margin: '20px',
17+
padding: '10px',
18+
overflow: 'hidden',
19+
'border-radius': '20px',
20+
border: '1px solid var(--surface-0)',
21+
position: 'fixed',
22+
bottom: '-500px',
23+
left: '0',
24+
transition: 'bottom 0.5s cubic-bezier(1,0,0,1)',
25+
'z-index': '1000',
26+
'box-shadow': '0 0 10px 0 rgba(0,0,0,0.5)',
27+
'user-select': 'none',
28+
'backdrop-filter': 'blur(10px)'
1629
})
1730
},
1831
data: {
1932
toggle: () => {
2033
if (isLauncherOpen) {
2134
Launcher.data.element.style({
22-
opacity: '0',
23-
'backdrop-filter': 'blur(0px)',
24-
'pointer-events': 'none'
35+
bottom: '-500px'
2536
})
2637
} else {
2738
Launcher.data.element.style({
28-
opacity: '1',
29-
'backdrop-filter': 'blur(10px)',
30-
'pointer-events': 'all'
39+
bottom: '68px'
3140
})
3241
}
3342

src/system/lib/StatusBar.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const StatusBar: Library = {
1414
<div class="outlined" data-toolbar-id="start"><span class="material-symbols-rounded">space_dashboard</span></div>
1515
1616
<div data-toolbar-id="apps"></div>
17-
<flex></flex>
17+
<div style="flex:1;"></div>
1818
<div class="outlined" data-toolbar-id="plugins"><span class="material-symbols-rounded">expand_less</span></div>
1919
<div class="outlined" data-toolbar-id="controls">
2020
<span class="material-symbols-rounded battery">battery_2_bar</span>

0 commit comments

Comments
 (0)