ywana-core8 0.2.6 → 0.2.9
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.css +726 -92
- package/dist/index.js +481 -202
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +481 -202
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +481 -202
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/desktop/AppManager.js +179 -115
- package/src/desktop/ApplicationMenu.css +425 -87
- package/src/desktop/ApplicationMenu.js +122 -76
- package/src/desktop/Desktop.stories.jsx +148 -509
- package/src/desktop/WindowContext.js +3 -0
- package/src/desktop/WindowManager.js +32 -10
- package/src/desktop/desktop-linux.css +55 -0
- package/src/desktop/desktop-macos.css +57 -0
- package/src/desktop/desktop-windows.css +54 -3
- package/src/desktop/desktop.css +30 -0
- package/src/desktop/desktop.js +135 -81
- package/src/desktop/window.css +98 -0
- package/src/desktop/window.js +163 -2
- package/src/html/button.css +5 -0
- package/src/html/button.js +2 -1
- package/src/desktop.backup/desktop.css +0 -6
- package/src/desktop.backup/desktop.js +0 -13
- package/src/desktop.backup/window.css +0 -58
- package/src/desktop.backup/window.js +0 -27
@@ -1,536 +1,175 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { Desktop
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Light theme desktop
|
88
|
-
*/
|
89
|
-
export const LightDesktop = () => (
|
90
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
91
|
-
<Desktop className="desktop--light">
|
92
|
-
<div style={{
|
93
|
-
position: 'absolute',
|
94
|
-
top: '50%',
|
95
|
-
left: '50%',
|
96
|
-
transform: 'translate(-50%, -50%)',
|
97
|
-
background: 'rgba(255,255,255,0.9)',
|
98
|
-
color: '#333',
|
99
|
-
padding: '20px',
|
100
|
-
borderRadius: '8px',
|
101
|
-
textAlign: 'center',
|
102
|
-
maxWidth: '400px',
|
103
|
-
pointerEvents: 'none'
|
104
|
-
}}>
|
105
|
-
<h3>☀️ Light Desktop</h3>
|
106
|
-
<p>Desktop with light theme variant.</p>
|
107
|
-
<p>Clean and minimal appearance.</p>
|
108
|
-
</div>
|
109
|
-
</Desktop>
|
110
|
-
</div>
|
111
|
-
)
|
112
|
-
|
113
|
-
// Component that demonstrates using both AppProvider hooks
|
114
|
-
const DemoControls = () => {
|
115
|
-
const { isOpen, open, close, toggle } = useApplicationMenu()
|
116
|
-
const appManager = useAppManager()
|
117
|
-
const [appCount, setAppCount] = React.useState(0)
|
118
|
-
|
119
|
-
React.useEffect(() => {
|
120
|
-
const updateCount = () => setAppCount(appManager.getAllApps().length)
|
121
|
-
updateCount()
|
122
|
-
appManager.addListener(updateCount)
|
123
|
-
return () => appManager.removeListener(updateCount)
|
124
|
-
}, [appManager])
|
125
|
-
|
126
|
-
const addCustomApp = () => {
|
127
|
-
const randomId = `custom-app-${Date.now()}`
|
128
|
-
appManager.registerApp({
|
129
|
-
id: randomId,
|
130
|
-
name: `Custom App ${Math.floor(Math.random() * 100)}`,
|
131
|
-
description: 'Dynamically added application',
|
132
|
-
icon: ['🎨', '🎯', '🎪', '🎭', '🎨'][Math.floor(Math.random() * 5)],
|
133
|
-
category: 'Custom',
|
134
|
-
component: React.createElement('div', {
|
135
|
-
style: { padding: '20px', textAlign: 'center' }
|
136
|
-
}, [
|
137
|
-
React.createElement('h2', { key: 'title' }, 'Dynamic App'),
|
138
|
-
React.createElement('p', { key: 'desc' }, 'This app was added dynamically using AppManager!'),
|
139
|
-
React.createElement('p', { key: 'id' }, `ID: ${randomId}`)
|
140
|
-
]),
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Desktop } from './desktop.js'
|
3
|
+
|
4
|
+
// Complete desktop configuration
|
5
|
+
const desktopConfig = {
|
6
|
+
categories: [
|
7
|
+
{ id: 'system', name: 'System', icon: '⚙️', color: '#607d8b' },
|
8
|
+
{ id: 'productivity', name: 'Productivity', icon: '📊', color: '#2196f3' },
|
9
|
+
{ id: 'utilities', name: 'Utilities', icon: '🔧', color: '#ff9800' },
|
10
|
+
{ id: 'internet', name: 'Internet', icon: '🌐', color: '#4caf50' },
|
11
|
+
{ id: 'development', name: 'Development', icon: '💻', color: '#9c27b0' },
|
12
|
+
{ id: 'media', name: 'Media', icon: '🎬', color: '#e91e63' },
|
13
|
+
{ id: 'games', name: 'Games', icon: '🎮', color: '#f44336' }
|
14
|
+
],
|
15
|
+
applications: [
|
16
|
+
{
|
17
|
+
id: 'file-explorer',
|
18
|
+
name: 'File Explorer',
|
19
|
+
description: 'Browse and manage files',
|
20
|
+
icon: '📁',
|
21
|
+
category: 'System',
|
22
|
+
component: null,
|
23
|
+
size: { width: 600, height: 400 }
|
24
|
+
},
|
25
|
+
{
|
26
|
+
id: 'text-editor',
|
27
|
+
name: 'Text Editor',
|
28
|
+
description: 'Edit text files',
|
29
|
+
icon: '📝',
|
30
|
+
category: 'Productivity',
|
31
|
+
component: null,
|
32
|
+
size: { width: 500, height: 350 }
|
33
|
+
},
|
34
|
+
{
|
35
|
+
id: 'calculator',
|
36
|
+
name: 'Calculator',
|
37
|
+
description: 'Perform calculations',
|
38
|
+
icon: '🧮',
|
39
|
+
category: 'Utilities',
|
40
|
+
component: null,
|
41
|
+
size: { width: 300, height: 400 }
|
42
|
+
},
|
43
|
+
{
|
44
|
+
id: 'settings',
|
45
|
+
name: 'Settings',
|
46
|
+
description: 'System configuration',
|
47
|
+
icon: '⚙️',
|
48
|
+
category: 'System',
|
49
|
+
component: null,
|
50
|
+
size: { width: 450, height: 300 }
|
51
|
+
},
|
52
|
+
{
|
53
|
+
id: 'browser',
|
54
|
+
name: 'Web Browser',
|
55
|
+
description: 'Browse the internet',
|
56
|
+
icon: '🌐',
|
57
|
+
category: 'Internet',
|
58
|
+
component: null,
|
59
|
+
size: { width: 800, height: 500 }
|
60
|
+
},
|
61
|
+
{
|
62
|
+
id: 'terminal',
|
63
|
+
name: 'Terminal',
|
64
|
+
description: 'Command line interface',
|
65
|
+
icon: '💻',
|
66
|
+
category: 'Development',
|
67
|
+
component: null,
|
68
|
+
size: { width: 700, height: 400 }
|
69
|
+
},
|
70
|
+
{
|
71
|
+
id: 'image-viewer',
|
72
|
+
name: 'Image Viewer',
|
73
|
+
description: 'View and edit images',
|
74
|
+
icon: '🖼️',
|
75
|
+
category: 'Media',
|
76
|
+
component: null,
|
77
|
+
size: { width: 600, height: 500 }
|
78
|
+
},
|
79
|
+
{
|
80
|
+
id: 'music-player',
|
81
|
+
name: 'Music Player',
|
82
|
+
description: 'Play audio files',
|
83
|
+
icon: '🎵',
|
84
|
+
category: 'Media',
|
85
|
+
component: null,
|
141
86
|
size: { width: 400, height: 300 }
|
142
|
-
}
|
143
|
-
|
144
|
-
|
145
|
-
return (
|
146
|
-
<div style={{
|
147
|
-
position: 'absolute',
|
148
|
-
top: '20px',
|
149
|
-
right: '20px',
|
150
|
-
background: 'rgba(255,255,255,0.9)',
|
151
|
-
padding: '20px',
|
152
|
-
borderRadius: '8px',
|
153
|
-
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
154
|
-
maxWidth: '300px'
|
155
|
-
}}>
|
156
|
-
<h4 style={{ margin: '0 0 15px 0' }}>🎮 App Controls</h4>
|
157
|
-
<p style={{ margin: '0 0 10px 0', fontSize: '14px', color: '#666' }}>
|
158
|
-
Menu: <strong>{isOpen ? 'Open' : 'Closed'}</strong><br/>
|
159
|
-
Apps: <strong>{appCount}</strong>
|
160
|
-
</p>
|
161
|
-
|
162
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
163
|
-
<button
|
164
|
-
onClick={open}
|
165
|
-
style={{
|
166
|
-
padding: '8px 12px',
|
167
|
-
background: '#4caf50',
|
168
|
-
color: 'white',
|
169
|
-
border: 'none',
|
170
|
-
borderRadius: '4px',
|
171
|
-
cursor: 'pointer',
|
172
|
-
fontSize: '12px'
|
173
|
-
}}
|
174
|
-
>
|
175
|
-
Open Menu
|
176
|
-
</button>
|
177
|
-
<button
|
178
|
-
onClick={close}
|
179
|
-
style={{
|
180
|
-
padding: '8px 12px',
|
181
|
-
background: '#f44336',
|
182
|
-
color: 'white',
|
183
|
-
border: 'none',
|
184
|
-
borderRadius: '4px',
|
185
|
-
cursor: 'pointer',
|
186
|
-
fontSize: '12px'
|
187
|
-
}}
|
188
|
-
>
|
189
|
-
Close Menu
|
190
|
-
</button>
|
191
|
-
<button
|
192
|
-
onClick={toggle}
|
193
|
-
style={{
|
194
|
-
padding: '8px 12px',
|
195
|
-
background: '#2196f3',
|
196
|
-
color: 'white',
|
197
|
-
border: 'none',
|
198
|
-
borderRadius: '4px',
|
199
|
-
cursor: 'pointer',
|
200
|
-
fontSize: '12px'
|
201
|
-
}}
|
202
|
-
>
|
203
|
-
Toggle Menu
|
204
|
-
</button>
|
205
|
-
<hr style={{ margin: '10px 0', border: 'none', borderTop: '1px solid #eee' }} />
|
206
|
-
<button
|
207
|
-
onClick={addCustomApp}
|
208
|
-
style={{
|
209
|
-
padding: '8px 12px',
|
210
|
-
background: '#ff9800',
|
211
|
-
color: 'white',
|
212
|
-
border: 'none',
|
213
|
-
borderRadius: '4px',
|
214
|
-
cursor: 'pointer',
|
215
|
-
fontSize: '12px'
|
216
|
-
}}
|
217
|
-
>
|
218
|
-
Add Custom App
|
219
|
-
</button>
|
220
|
-
</div>
|
221
|
-
</div>
|
222
|
-
)
|
87
|
+
}
|
88
|
+
]
|
223
89
|
}
|
224
90
|
|
225
|
-
|
226
|
-
|
227
|
-
*/
|
228
|
-
export const ApplicationMenuBasic = () => (
|
229
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
230
|
-
<Desktop desktopSize={{ width: 1200, height: 600 }}>
|
231
|
-
<div style={{
|
232
|
-
position: 'absolute',
|
233
|
-
top: '20px',
|
234
|
-
left: '20px',
|
235
|
-
background: 'rgba(255,255,255,0.9)',
|
236
|
-
padding: '20px',
|
237
|
-
borderRadius: '8px',
|
238
|
-
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
239
|
-
maxWidth: '400px'
|
240
|
-
}}>
|
241
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🚀 Application Menu Demo</h3>
|
242
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
243
|
-
Click the <strong>"Start"</strong> button in the taskbar to open the Application Menu.
|
244
|
-
Browse applications by category and launch them to create windows.
|
245
|
-
</p>
|
246
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
247
|
-
<p><strong>Features:</strong></p>
|
248
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
249
|
-
<li>Browse apps by category</li>
|
250
|
-
<li>Search functionality</li>
|
251
|
-
<li>Launch applications as windows</li>
|
252
|
-
<li>Full-screen overlay menu</li>
|
253
|
-
</ul>
|
254
|
-
</div>
|
255
|
-
</div>
|
256
|
-
</Desktop>
|
257
|
-
</div>
|
258
|
-
)
|
259
|
-
|
260
|
-
/**
|
261
|
-
* Windows Theme Desktop
|
262
|
-
*/
|
263
|
-
export const WindowsTheme = () => (
|
264
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
265
|
-
<Desktop theme="windows" desktopSize={{ width: 1200, height: 600 }}>
|
266
|
-
<div style={{
|
267
|
-
position: 'absolute',
|
268
|
-
top: '20px',
|
269
|
-
left: '20px',
|
270
|
-
background: 'rgba(255,255,255,0.9)',
|
271
|
-
padding: '20px',
|
272
|
-
borderRadius: '8px',
|
273
|
-
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
274
|
-
maxWidth: '400px'
|
275
|
-
}}>
|
276
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🪟 Windows Theme</h3>
|
277
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
278
|
-
Windows-inspired desktop theme with Segoe UI font, blue gradient background,
|
279
|
-
and Windows-style window controls and taskbar.
|
280
|
-
</p>
|
281
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
282
|
-
<p><strong>Features:</strong></p>
|
283
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
284
|
-
<li>Windows 11 inspired design</li>
|
285
|
-
<li>Segoe UI font family</li>
|
286
|
-
<li>Blue gradient background</li>
|
287
|
-
<li>Windows-style window controls</li>
|
288
|
-
</ul>
|
289
|
-
</div>
|
290
|
-
</div>
|
291
|
-
</Desktop>
|
292
|
-
</div>
|
293
|
-
)
|
294
|
-
|
295
|
-
/**
|
296
|
-
* macOS Theme Desktop
|
297
|
-
*/
|
298
|
-
export const MacOSTheme = () => (
|
299
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
300
|
-
<Desktop theme="macos" desktopSize={{ width: 1200, height: 600 }}>
|
301
|
-
<div style={{
|
302
|
-
position: 'absolute',
|
303
|
-
top: '20px',
|
304
|
-
left: '20px',
|
305
|
-
background: 'rgba(255,255,255,0.9)',
|
306
|
-
padding: '20px',
|
307
|
-
borderRadius: '16px',
|
308
|
-
boxShadow: '0 8px 25px rgba(0,0,0,0.15)',
|
309
|
-
maxWidth: '400px',
|
310
|
-
backdropFilter: 'blur(20px)'
|
311
|
-
}}>
|
312
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🍎 macOS Theme</h3>
|
313
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
314
|
-
macOS-inspired desktop theme with SF Pro Display font, purple gradient background,
|
315
|
-
and signature traffic light window controls.
|
316
|
-
</p>
|
317
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
318
|
-
<p><strong>Features:</strong></p>
|
319
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
320
|
-
<li>macOS Big Sur/Monterey design</li>
|
321
|
-
<li>SF Pro Display font family</li>
|
322
|
-
<li>Purple gradient background</li>
|
323
|
-
<li>Traffic light window controls</li>
|
324
|
-
</ul>
|
325
|
-
</div>
|
326
|
-
</div>
|
327
|
-
</Desktop>
|
328
|
-
</div>
|
329
|
-
)
|
330
|
-
|
331
|
-
/**
|
332
|
-
* Linux Theme Desktop
|
333
|
-
*/
|
334
|
-
export const LinuxTheme = () => (
|
335
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
336
|
-
<Desktop theme="linux" desktopSize={{ width: 1200, height: 600 }}>
|
337
|
-
<div style={{
|
338
|
-
position: 'absolute',
|
339
|
-
top: '20px',
|
340
|
-
left: '20px',
|
341
|
-
background: 'rgba(255,255,255,0.9)',
|
342
|
-
padding: '20px',
|
343
|
-
borderRadius: '12px',
|
344
|
-
boxShadow: '0 4px 16px rgba(0,0,0,0.3)',
|
345
|
-
maxWidth: '400px'
|
346
|
-
}}>
|
347
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🐧 Linux Theme</h3>
|
348
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
349
|
-
Linux GNOME-inspired desktop theme with Ubuntu font, dark gradient background,
|
350
|
-
and colorful circular window controls.
|
351
|
-
</p>
|
352
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
353
|
-
<p><strong>Features:</strong></p>
|
354
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
355
|
-
<li>GNOME/Ubuntu inspired design</li>
|
356
|
-
<li>Ubuntu/Cantarell font family</li>
|
357
|
-
<li>Dark gradient background</li>
|
358
|
-
<li>Colorful circular controls</li>
|
359
|
-
</ul>
|
360
|
-
</div>
|
361
|
-
</div>
|
362
|
-
</Desktop>
|
363
|
-
</div>
|
364
|
-
)
|
365
|
-
|
366
|
-
/**
|
367
|
-
* Theme Comparison - All three themes side by side
|
368
|
-
*/
|
369
|
-
export const ThemeComparison = () => (
|
91
|
+
// Theme selector component
|
92
|
+
const ThemeSelector = ({ currentTheme, onThemeChange }) => (
|
370
93
|
<div style={{
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
94
|
+
position: 'absolute',
|
95
|
+
top: '10px',
|
96
|
+
right: '10px',
|
97
|
+
background: 'rgba(0,0,0,0.8)',
|
98
|
+
color: 'white',
|
99
|
+
padding: '8px 12px',
|
100
|
+
borderRadius: '6px',
|
101
|
+
fontSize: '12px',
|
102
|
+
zIndex: 20000,
|
103
|
+
display: 'flex',
|
104
|
+
gap: '8px',
|
105
|
+
alignItems: 'center'
|
376
106
|
}}>
|
377
|
-
<
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
background: 'rgba(
|
383
|
-
color: 'white',
|
384
|
-
padding: '4px 8px',
|
385
|
-
borderRadius: '4px',
|
386
|
-
fontSize: '12px',
|
387
|
-
zIndex: 1000
|
388
|
-
}}>
|
389
|
-
Windows
|
390
|
-
</div>
|
391
|
-
<Desktop theme="windows" desktopSize={{ width: 400, height: 560 }} />
|
392
|
-
</div>
|
393
|
-
|
394
|
-
<div style={{ position: 'relative', overflow: 'hidden', border: '2px solid #ccc', borderRadius: '8px' }}>
|
395
|
-
<div style={{
|
396
|
-
position: 'absolute',
|
397
|
-
top: '5px',
|
398
|
-
left: '5px',
|
399
|
-
background: 'rgba(0,0,0,0.7)',
|
107
|
+
<span>Theme:</span>
|
108
|
+
<select
|
109
|
+
value={currentTheme}
|
110
|
+
onChange={(e) => onThemeChange(e.target.value)}
|
111
|
+
style={{
|
112
|
+
background: 'rgba(255,255,255,0.2)',
|
400
113
|
color: 'white',
|
401
|
-
|
114
|
+
border: '1px solid rgba(255,255,255,0.3)',
|
402
115
|
borderRadius: '4px',
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
</
|
408
|
-
<
|
409
|
-
|
410
|
-
|
411
|
-
<div style={{ position: 'relative', overflow: 'hidden', border: '2px solid #ccc', borderRadius: '8px' }}>
|
412
|
-
<div style={{
|
413
|
-
position: 'absolute',
|
414
|
-
top: '5px',
|
415
|
-
left: '5px',
|
416
|
-
background: 'rgba(0,0,0,0.7)',
|
417
|
-
color: 'white',
|
418
|
-
padding: '4px 8px',
|
419
|
-
borderRadius: '4px',
|
420
|
-
fontSize: '12px',
|
421
|
-
zIndex: 1000
|
422
|
-
}}>
|
423
|
-
Linux
|
424
|
-
</div>
|
425
|
-
<Desktop theme="linux" desktopSize={{ width: 400, height: 560 }} />
|
426
|
-
</div>
|
116
|
+
padding: '2px 6px'
|
117
|
+
}}
|
118
|
+
>
|
119
|
+
<option value="default">Default</option>
|
120
|
+
<option value="windows">Windows</option>
|
121
|
+
<option value="macos">macOS</option>
|
122
|
+
<option value="linux">Linux</option>
|
123
|
+
</select>
|
427
124
|
</div>
|
428
125
|
)
|
429
126
|
|
430
127
|
/**
|
431
|
-
* Desktop
|
128
|
+
* Complete Desktop Demo - All Features
|
432
129
|
*/
|
433
|
-
export const
|
434
|
-
|
435
|
-
React.useEffect(() => {
|
436
|
-
// Register some custom applications
|
437
|
-
defaultAppManager.registerApp({
|
438
|
-
id: 'advanced-calculator',
|
439
|
-
name: 'Advanced Calculator',
|
440
|
-
description: 'Scientific calculator with advanced functions',
|
441
|
-
icon: '🧮',
|
442
|
-
category: 'Utilities',
|
443
|
-
component: React.createElement('div', {
|
444
|
-
style: { padding: '20px', textAlign: 'center' }
|
445
|
-
}, [
|
446
|
-
React.createElement('h2', { key: 'title' }, '🧮 Advanced Calculator'),
|
447
|
-
React.createElement('p', { key: 'desc' }, 'A powerful calculator with scientific functions.'),
|
448
|
-
React.createElement('div', {
|
449
|
-
key: 'buttons',
|
450
|
-
style: { display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '8px', marginTop: '20px' }
|
451
|
-
}, [
|
452
|
-
...['7', '8', '9', '/', '4', '5', '6', '*', '1', '2', '3', '-', '0', '.', '=', '+'].map((btn, i) =>
|
453
|
-
React.createElement('button', {
|
454
|
-
key: i,
|
455
|
-
style: {
|
456
|
-
padding: '12px',
|
457
|
-
background: '#f0f0f0',
|
458
|
-
border: '1px solid #ccc',
|
459
|
-
borderRadius: '4px',
|
460
|
-
cursor: 'pointer'
|
461
|
-
}
|
462
|
-
}, btn)
|
463
|
-
)
|
464
|
-
])
|
465
|
-
]),
|
466
|
-
size: { width: 300, height: 400 }
|
467
|
-
})
|
468
|
-
|
469
|
-
defaultAppManager.registerApp({
|
470
|
-
id: 'text-editor-pro',
|
471
|
-
name: 'Text Editor Pro',
|
472
|
-
description: 'Professional text editor with syntax highlighting',
|
473
|
-
icon: '📝',
|
474
|
-
category: 'Productivity',
|
475
|
-
component: React.createElement('div', {
|
476
|
-
style: { padding: '20px', height: '100%', display: 'flex', flexDirection: 'column' }
|
477
|
-
}, [
|
478
|
-
React.createElement('div', {
|
479
|
-
key: 'toolbar',
|
480
|
-
style: { marginBottom: '10px', display: 'flex', gap: '10px' }
|
481
|
-
}, [
|
482
|
-
React.createElement('button', { key: 'new', style: { padding: '5px 10px', fontSize: '12px' } }, 'New'),
|
483
|
-
React.createElement('button', { key: 'open', style: { padding: '5px 10px', fontSize: '12px' } }, 'Open'),
|
484
|
-
React.createElement('button', { key: 'save', style: { padding: '5px 10px', fontSize: '12px' } }, 'Save')
|
485
|
-
]),
|
486
|
-
React.createElement('textarea', {
|
487
|
-
key: 'editor',
|
488
|
-
style: {
|
489
|
-
flex: 1,
|
490
|
-
border: '1px solid #ccc',
|
491
|
-
padding: '10px',
|
492
|
-
fontFamily: 'monospace',
|
493
|
-
fontSize: '14px',
|
494
|
-
resize: 'none'
|
495
|
-
},
|
496
|
-
placeholder: 'Start typing your code here...',
|
497
|
-
defaultValue: '// Welcome to Text Editor Pro!\nfunction hello() {\n console.log("Hello, World!");\n}'
|
498
|
-
})
|
499
|
-
]),
|
500
|
-
size: { width: 600, height: 400 }
|
501
|
-
})
|
502
|
-
}, [])
|
130
|
+
export const CompleteDesktop = () => {
|
131
|
+
const [theme, setTheme] = useState('default')
|
503
132
|
|
504
133
|
return (
|
505
134
|
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
506
|
-
<
|
135
|
+
<ThemeSelector currentTheme={theme} onThemeChange={setTheme} />
|
136
|
+
|
137
|
+
<Desktop
|
138
|
+
theme={theme === 'default' ? undefined : theme}
|
139
|
+
desktopSize={{ width: 1200, height: 600 }}
|
140
|
+
desktopConfig={desktopConfig}
|
141
|
+
>
|
507
142
|
<div style={{
|
508
143
|
position: 'absolute',
|
509
|
-
top: '
|
510
|
-
left: '
|
144
|
+
top: '50%',
|
145
|
+
left: '50%',
|
146
|
+
transform: 'translate(-50%, -50%)',
|
511
147
|
background: 'rgba(255,255,255,0.9)',
|
512
148
|
padding: '20px',
|
513
149
|
borderRadius: '8px',
|
514
|
-
|
515
|
-
maxWidth: '
|
150
|
+
textAlign: 'center',
|
151
|
+
maxWidth: '500px',
|
152
|
+
pointerEvents: 'none',
|
153
|
+
boxShadow: '0 4px 20px rgba(0,0,0,0.1)'
|
516
154
|
}}>
|
517
|
-
<h3
|
518
|
-
<p
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
<li>
|
526
|
-
<li>
|
527
|
-
<li>
|
528
|
-
<li>
|
155
|
+
<h3>🖥️ Complete Desktop System</h3>
|
156
|
+
<p>This desktop demonstrates all features:</p>
|
157
|
+
|
158
|
+
<div style={{ textAlign: 'left', margin: '16px 0' }}>
|
159
|
+
<h4>🎯 Features to Test:</h4>
|
160
|
+
<ul>
|
161
|
+
<li><strong>Start Menu:</strong> Click "Start" button</li>
|
162
|
+
<li><strong>Applications:</strong> Browse categories and launch apps</li>
|
163
|
+
<li><strong>Window Management:</strong> Create, move, resize windows</li>
|
164
|
+
<li><strong>Layout Controls:</strong> Use Cascade, Tile, Center, Clear buttons</li>
|
165
|
+
<li><strong>Themes:</strong> Switch between Windows, macOS, Linux themes</li>
|
166
|
+
<li><strong>Responsive:</strong> Windows stay within workspace bounds</li>
|
529
167
|
</ul>
|
168
|
+
|
169
|
+
<h4>🎨 Current Theme: <span style={{color: '#2196f3'}}>{theme}</span></h4>
|
170
|
+
<p><em>Change theme using the selector in top-right corner</em></p>
|
530
171
|
</div>
|
531
172
|
</div>
|
532
|
-
|
533
|
-
<DemoControls />
|
534
173
|
</Desktop>
|
535
174
|
</div>
|
536
175
|
)
|