ywana-core8 0.2.8 → 0.2.10
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 +295 -58
- package/dist/index.js +215 -114
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +215 -114
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +215 -114
- 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 +295 -55
- package/src/desktop/ApplicationMenu.js +55 -15
- package/src/desktop/Desktop.stories.jsx +148 -584
- package/src/desktop/desktop-windows.css +0 -3
- package/src/desktop/desktop.js +43 -23
- 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
- package/src/examples/ApplicationMenuExample.js +0 -361
@@ -1,611 +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" desktopSize={{ width: 1200, height: 600 }}>
|
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' }}>🚀 New Layout: Workspace + Menu</h3>
|
242
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
243
|
-
Click <strong>"Start"</strong> to open the Application Menu.
|
244
|
-
The new architecture has a <strong>dedicated Workspace</strong> that contains windows,
|
245
|
-
and the <strong>ApplicationMenu overlays only the workspace</strong> (never the taskbar).
|
246
|
-
</p>
|
247
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
248
|
-
<p><strong>New Architecture:</strong></p>
|
249
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
250
|
-
<li>✅ <strong>Workspace container</strong> with proper boundaries</li>
|
251
|
-
<li>✅ <strong>Windows constrained</strong> to workspace area</li>
|
252
|
-
<li>✅ <strong>ApplicationMenu over workspace</strong> only</li>
|
253
|
-
<li>✅ <strong>Taskbar always accessible</strong> and separate</li>
|
254
|
-
<li>✅ Categories sidebar with independent scrolling</li>
|
255
|
-
<li>✅ Responsive grid layout</li>
|
256
|
-
</ul>
|
257
|
-
</div>
|
258
|
-
</div>
|
259
|
-
</Desktop>
|
260
|
-
</div>
|
261
|
-
)
|
262
|
-
|
263
|
-
/**
|
264
|
-
* Windows Theme Desktop
|
265
|
-
*/
|
266
|
-
export const WindowsTheme = () => (
|
267
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
268
|
-
<Desktop theme="windows" desktopSize={{ width: 1200, height: 600 }}>
|
269
|
-
<div style={{
|
270
|
-
position: 'absolute',
|
271
|
-
top: '20px',
|
272
|
-
left: '20px',
|
273
|
-
background: 'rgba(255,255,255,0.9)',
|
274
|
-
padding: '20px',
|
275
|
-
borderRadius: '8px',
|
276
|
-
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
277
|
-
maxWidth: '400px'
|
278
|
-
}}>
|
279
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🪟 Windows Theme</h3>
|
280
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
281
|
-
Windows-inspired desktop theme with Segoe UI font, blue gradient background,
|
282
|
-
and Windows-style window controls and taskbar.
|
283
|
-
</p>
|
284
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
285
|
-
<p><strong>Features:</strong></p>
|
286
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
287
|
-
<li>Windows 11 inspired design</li>
|
288
|
-
<li>Segoe UI font family</li>
|
289
|
-
<li>Blue gradient background</li>
|
290
|
-
<li>Windows-style window controls</li>
|
291
|
-
</ul>
|
292
|
-
</div>
|
293
|
-
</div>
|
294
|
-
</Desktop>
|
295
|
-
</div>
|
296
|
-
)
|
297
|
-
|
298
|
-
/**
|
299
|
-
* macOS Theme Desktop
|
300
|
-
*/
|
301
|
-
export const MacOSTheme = () => (
|
302
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
303
|
-
<Desktop theme="macos" desktopSize={{ width: 1200, height: 600 }}>
|
304
|
-
<div style={{
|
305
|
-
position: 'absolute',
|
306
|
-
top: '20px',
|
307
|
-
left: '20px',
|
308
|
-
background: 'rgba(255,255,255,0.9)',
|
309
|
-
padding: '20px',
|
310
|
-
borderRadius: '16px',
|
311
|
-
boxShadow: '0 8px 25px rgba(0,0,0,0.15)',
|
312
|
-
maxWidth: '400px',
|
313
|
-
backdropFilter: 'blur(20px)'
|
314
|
-
}}>
|
315
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🍎 macOS Theme</h3>
|
316
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
317
|
-
macOS-inspired desktop theme with SF Pro Display font, purple gradient background,
|
318
|
-
and signature traffic light window controls.
|
319
|
-
</p>
|
320
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
321
|
-
<p><strong>Features:</strong></p>
|
322
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
323
|
-
<li>macOS Big Sur/Monterey design</li>
|
324
|
-
<li>SF Pro Display font family</li>
|
325
|
-
<li>Purple gradient background</li>
|
326
|
-
<li>Traffic light window controls</li>
|
327
|
-
</ul>
|
328
|
-
</div>
|
329
|
-
</div>
|
330
|
-
</Desktop>
|
331
|
-
</div>
|
332
|
-
)
|
333
|
-
|
334
|
-
/**
|
335
|
-
* Linux Theme Desktop
|
336
|
-
*/
|
337
|
-
export const LinuxTheme = () => (
|
338
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
339
|
-
<Desktop theme="linux" desktopSize={{ width: 1200, height: 600 }}>
|
340
|
-
<div style={{
|
341
|
-
position: 'absolute',
|
342
|
-
top: '20px',
|
343
|
-
left: '20px',
|
344
|
-
background: 'rgba(255,255,255,0.9)',
|
345
|
-
padding: '20px',
|
346
|
-
borderRadius: '12px',
|
347
|
-
boxShadow: '0 4px 16px rgba(0,0,0,0.3)',
|
348
|
-
maxWidth: '400px'
|
349
|
-
}}>
|
350
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🐧 Linux Theme</h3>
|
351
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
352
|
-
Linux GNOME-inspired desktop theme with Ubuntu font, dark gradient background,
|
353
|
-
and colorful circular window controls.
|
354
|
-
</p>
|
355
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
356
|
-
<p><strong>Features:</strong></p>
|
357
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
358
|
-
<li>GNOME/Ubuntu inspired design</li>
|
359
|
-
<li>Ubuntu/Cantarell font family</li>
|
360
|
-
<li>Dark gradient background</li>
|
361
|
-
<li>Colorful circular controls</li>
|
362
|
-
</ul>
|
363
|
-
</div>
|
364
|
-
</div>
|
365
|
-
</Desktop>
|
366
|
-
</div>
|
367
|
-
)
|
368
|
-
|
369
|
-
/**
|
370
|
-
* Theme Comparison - All three themes side by side
|
371
|
-
*/
|
372
|
-
export const ThemeComparison = () => (
|
91
|
+
// Theme selector component
|
92
|
+
const ThemeSelector = ({ currentTheme, onThemeChange }) => (
|
373
93
|
<div style={{
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
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'
|
379
106
|
}}>
|
380
|
-
<
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
background: 'rgba(
|
386
|
-
color: 'white',
|
387
|
-
padding: '4px 8px',
|
388
|
-
borderRadius: '4px',
|
389
|
-
fontSize: '12px',
|
390
|
-
zIndex: 1000
|
391
|
-
}}>
|
392
|
-
Windows
|
393
|
-
</div>
|
394
|
-
<Desktop theme="windows" desktopSize={{ width: 400, height: 560 }} />
|
395
|
-
</div>
|
396
|
-
|
397
|
-
<div style={{ position: 'relative', overflow: 'hidden', border: '2px solid #ccc', borderRadius: '8px' }}>
|
398
|
-
<div style={{
|
399
|
-
position: 'absolute',
|
400
|
-
top: '5px',
|
401
|
-
left: '5px',
|
402
|
-
background: 'rgba(0,0,0,0.7)',
|
403
|
-
color: 'white',
|
404
|
-
padding: '4px 8px',
|
405
|
-
borderRadius: '4px',
|
406
|
-
fontSize: '12px',
|
407
|
-
zIndex: 1000
|
408
|
-
}}>
|
409
|
-
macOS
|
410
|
-
</div>
|
411
|
-
<Desktop theme="macos" desktopSize={{ width: 400, height: 560 }} />
|
412
|
-
</div>
|
413
|
-
|
414
|
-
<div style={{ position: 'relative', overflow: 'hidden', border: '2px solid #ccc', borderRadius: '8px' }}>
|
415
|
-
<div style={{
|
416
|
-
position: 'absolute',
|
417
|
-
top: '5px',
|
418
|
-
left: '5px',
|
419
|
-
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)',
|
420
113
|
color: 'white',
|
421
|
-
|
114
|
+
border: '1px solid rgba(255,255,255,0.3)',
|
422
115
|
borderRadius: '4px',
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
</
|
428
|
-
<
|
429
|
-
|
430
|
-
|
431
|
-
)
|
432
|
-
|
433
|
-
/**
|
434
|
-
* Resizable Windows Demo
|
435
|
-
*/
|
436
|
-
export const ResizableWindows = () => (
|
437
|
-
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
438
|
-
<Desktop desktopSize={{ width: 1200, height: 600 }}>
|
439
|
-
<div style={{
|
440
|
-
position: 'absolute',
|
441
|
-
top: '20px',
|
442
|
-
left: '20px',
|
443
|
-
background: 'rgba(255,255,255,0.9)',
|
444
|
-
padding: '20px',
|
445
|
-
borderRadius: '8px',
|
446
|
-
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
447
|
-
maxWidth: '400px'
|
448
|
-
}}>
|
449
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🔄 Resizable Windows</h3>
|
450
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
451
|
-
Create windows and try resizing them by dragging the edges and corners.
|
452
|
-
The WindowManager gets notified of size changes when you finish resizing.
|
453
|
-
</p>
|
454
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
455
|
-
<p><strong>Resize Features:</strong></p>
|
456
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
457
|
-
<li>Drag edges to resize horizontally/vertically</li>
|
458
|
-
<li>Drag corners to resize diagonally</li>
|
459
|
-
<li>Minimum size constraints (200x150)</li>
|
460
|
-
<li>WindowManager updates on resize end</li>
|
461
|
-
<li>Visual feedback with hover effects</li>
|
462
|
-
</ul>
|
463
|
-
</div>
|
464
|
-
</div>
|
465
|
-
</Desktop>
|
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>
|
466
124
|
</div>
|
467
125
|
)
|
468
126
|
|
469
127
|
/**
|
470
|
-
*
|
128
|
+
* Complete Desktop Demo - All Features
|
471
129
|
*/
|
472
|
-
export const
|
473
|
-
|
474
|
-
<Desktop theme="macos" desktopSize={{ width: 1200, height: 600 }}>
|
475
|
-
<div style={{
|
476
|
-
position: 'absolute',
|
477
|
-
top: '20px',
|
478
|
-
left: '20px',
|
479
|
-
background: 'rgba(255,255,255,0.9)',
|
480
|
-
padding: '20px',
|
481
|
-
borderRadius: '16px',
|
482
|
-
boxShadow: '0 8px 25px rgba(0,0,0,0.15)',
|
483
|
-
maxWidth: '400px',
|
484
|
-
backdropFilter: 'blur(20px)'
|
485
|
-
}}>
|
486
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🍎 macOS Resizable Windows</h3>
|
487
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
488
|
-
Experience window resizing with the beautiful macOS theme.
|
489
|
-
Notice the traffic light controls and smooth animations.
|
490
|
-
</p>
|
491
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
492
|
-
<p><strong>macOS Features:</strong></p>
|
493
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
494
|
-
<li>Traffic light window controls</li>
|
495
|
-
<li>Smooth resize animations</li>
|
496
|
-
<li>macOS-style blur effects</li>
|
497
|
-
<li>SF Pro Display typography</li>
|
498
|
-
</ul>
|
499
|
-
</div>
|
500
|
-
</div>
|
501
|
-
</Desktop>
|
502
|
-
</div>
|
503
|
-
)
|
504
|
-
|
505
|
-
/**
|
506
|
-
* Desktop with ApplicationMenu - Workspace Boundaries Demo
|
507
|
-
*/
|
508
|
-
export const ApplicationMenuAdvanced = () => {
|
509
|
-
// Setup custom apps
|
510
|
-
React.useEffect(() => {
|
511
|
-
// Register some custom applications
|
512
|
-
defaultAppManager.registerApp({
|
513
|
-
id: 'advanced-calculator',
|
514
|
-
name: 'Advanced Calculator',
|
515
|
-
description: 'Scientific calculator with advanced functions',
|
516
|
-
icon: '🧮',
|
517
|
-
category: 'Utilities',
|
518
|
-
component: React.createElement('div', {
|
519
|
-
style: { padding: '20px', textAlign: 'center' }
|
520
|
-
}, [
|
521
|
-
React.createElement('h2', { key: 'title' }, '🧮 Advanced Calculator'),
|
522
|
-
React.createElement('p', { key: 'desc' }, 'A powerful calculator with scientific functions.'),
|
523
|
-
React.createElement('div', {
|
524
|
-
key: 'buttons',
|
525
|
-
style: { display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '8px', marginTop: '20px' }
|
526
|
-
}, [
|
527
|
-
...['7', '8', '9', '/', '4', '5', '6', '*', '1', '2', '3', '-', '0', '.', '=', '+'].map((btn, i) =>
|
528
|
-
React.createElement('button', {
|
529
|
-
key: i,
|
530
|
-
style: {
|
531
|
-
padding: '12px',
|
532
|
-
background: '#f0f0f0',
|
533
|
-
border: '1px solid #ccc',
|
534
|
-
borderRadius: '4px',
|
535
|
-
cursor: 'pointer'
|
536
|
-
}
|
537
|
-
}, btn)
|
538
|
-
)
|
539
|
-
])
|
540
|
-
]),
|
541
|
-
size: { width: 300, height: 400 }
|
542
|
-
})
|
543
|
-
|
544
|
-
defaultAppManager.registerApp({
|
545
|
-
id: 'text-editor-pro',
|
546
|
-
name: 'Text Editor Pro',
|
547
|
-
description: 'Professional text editor with syntax highlighting',
|
548
|
-
icon: '📝',
|
549
|
-
category: 'Productivity',
|
550
|
-
component: React.createElement('div', {
|
551
|
-
style: { padding: '20px', height: '100%', display: 'flex', flexDirection: 'column' }
|
552
|
-
}, [
|
553
|
-
React.createElement('div', {
|
554
|
-
key: 'toolbar',
|
555
|
-
style: { marginBottom: '10px', display: 'flex', gap: '10px' }
|
556
|
-
}, [
|
557
|
-
React.createElement('button', { key: 'new', style: { padding: '5px 10px', fontSize: '12px' } }, 'New'),
|
558
|
-
React.createElement('button', { key: 'open', style: { padding: '5px 10px', fontSize: '12px' } }, 'Open'),
|
559
|
-
React.createElement('button', { key: 'save', style: { padding: '5px 10px', fontSize: '12px' } }, 'Save')
|
560
|
-
]),
|
561
|
-
React.createElement('textarea', {
|
562
|
-
key: 'editor',
|
563
|
-
style: {
|
564
|
-
flex: 1,
|
565
|
-
border: '1px solid #ccc',
|
566
|
-
padding: '10px',
|
567
|
-
fontFamily: 'monospace',
|
568
|
-
fontSize: '14px',
|
569
|
-
resize: 'none'
|
570
|
-
},
|
571
|
-
placeholder: 'Start typing your code here...',
|
572
|
-
defaultValue: '// Welcome to Text Editor Pro!\nfunction hello() {\n console.log("Hello, World!");\n}'
|
573
|
-
})
|
574
|
-
]),
|
575
|
-
size: { width: 600, height: 400 }
|
576
|
-
})
|
577
|
-
}, [])
|
130
|
+
export const CompleteDesktop = () => {
|
131
|
+
const [theme, setTheme] = useState('default')
|
578
132
|
|
579
133
|
return (
|
580
134
|
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
581
|
-
<
|
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
|
+
>
|
582
142
|
<div style={{
|
583
143
|
position: 'absolute',
|
584
|
-
top: '
|
585
|
-
left: '
|
144
|
+
top: '50%',
|
145
|
+
left: '50%',
|
146
|
+
transform: 'translate(-50%, -50%)',
|
586
147
|
background: 'rgba(255,255,255,0.9)',
|
587
148
|
padding: '20px',
|
588
149
|
borderRadius: '8px',
|
589
|
-
|
590
|
-
maxWidth: '
|
150
|
+
textAlign: 'center',
|
151
|
+
maxWidth: '500px',
|
152
|
+
pointerEvents: 'none',
|
153
|
+
boxShadow: '0 4px 20px rgba(0,0,0,0.1)'
|
591
154
|
}}>
|
592
|
-
<h3
|
593
|
-
<p
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
<li>
|
601
|
-
<li>
|
602
|
-
<li>
|
603
|
-
<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>
|
604
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>
|
605
171
|
</div>
|
606
172
|
</div>
|
607
|
-
|
608
|
-
<DemoControls />
|
609
173
|
</Desktop>
|
610
174
|
</div>
|
611
175
|
)
|