ywana-core8 0.2.9 → 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
CHANGED
@@ -16172,8 +16172,8 @@ li.selected,
|
|
16172
16172
|
left: 0;
|
16173
16173
|
right: 0;
|
16174
16174
|
bottom: 0; /* Covers entire workspace container */
|
16175
|
-
background: rgba(0, 0, 0, 0.
|
16176
|
-
backdrop-filter: blur(
|
16175
|
+
background: rgba(0, 0, 0, 0.16);
|
16176
|
+
backdrop-filter: blur(1px);
|
16177
16177
|
z-index: 10000; /* Always above all windows */
|
16178
16178
|
display: flex;
|
16179
16179
|
align-items: flex-end;
|
@@ -16198,7 +16198,8 @@ li.selected,
|
|
16198
16198
|
box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
|
16199
16199
|
width: 30rem;
|
16200
16200
|
max-width: 1000px;
|
16201
|
-
height:
|
16201
|
+
height: 55vh;
|
16202
|
+
min-height: 30rem;
|
16202
16203
|
max-height: calc(100% - 80px); /* Espacio para taskbar */
|
16203
16204
|
display: grid;
|
16204
16205
|
grid-template-rows: auto auto 1fr;
|
package/package.json
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
left: 0;
|
7
7
|
right: 0;
|
8
8
|
bottom: 0; /* Covers entire workspace container */
|
9
|
-
background: rgba(0, 0, 0, 0.
|
10
|
-
backdrop-filter: blur(
|
9
|
+
background: rgba(0, 0, 0, 0.16);
|
10
|
+
backdrop-filter: blur(1px);
|
11
11
|
z-index: 10000; /* Always above all windows */
|
12
12
|
display: flex;
|
13
13
|
align-items: flex-end;
|
@@ -32,7 +32,8 @@
|
|
32
32
|
box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
|
33
33
|
width: 30rem;
|
34
34
|
max-width: 1000px;
|
35
|
-
height:
|
35
|
+
height: 55vh;
|
36
|
+
min-height: 30rem;
|
36
37
|
max-height: calc(100% - 80px); /* Espacio para taskbar */
|
37
38
|
display: grid;
|
38
39
|
grid-template-rows: auto auto 1fr;
|
@@ -1,361 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { Desktop, AppProvider, AppManager, defaultAppManager, useApplicationMenu, useAppManager } from '../desktop'
|
3
|
-
|
4
|
-
// Example custom components for applications
|
5
|
-
const TextEditorComponent = () => (
|
6
|
-
<div style={{ padding: '20px', height: '100%', display: 'flex', flexDirection: 'column' }}>
|
7
|
-
<div style={{ marginBottom: '10px', display: 'flex', gap: '10px' }}>
|
8
|
-
<button style={{ padding: '5px 10px', fontSize: '12px' }}>New</button>
|
9
|
-
<button style={{ padding: '5px 10px', fontSize: '12px' }}>Open</button>
|
10
|
-
<button style={{ padding: '5px 10px', fontSize: '12px' }}>Save</button>
|
11
|
-
</div>
|
12
|
-
<textarea
|
13
|
-
style={{
|
14
|
-
flex: 1,
|
15
|
-
border: '1px solid #ccc',
|
16
|
-
padding: '10px',
|
17
|
-
fontFamily: 'monospace',
|
18
|
-
fontSize: '14px',
|
19
|
-
resize: 'none'
|
20
|
-
}}
|
21
|
-
placeholder="Start typing your text here..."
|
22
|
-
defaultValue="Welcome to the Text Editor!\n\nThis is a simple text editor application launched from the Application Menu."
|
23
|
-
/>
|
24
|
-
</div>
|
25
|
-
)
|
26
|
-
|
27
|
-
const CalculatorComponent = () => {
|
28
|
-
const [display, setDisplay] = React.useState('0')
|
29
|
-
const [previousValue, setPreviousValue] = React.useState(null)
|
30
|
-
const [operation, setOperation] = React.useState(null)
|
31
|
-
const [waitingForOperand, setWaitingForOperand] = React.useState(false)
|
32
|
-
|
33
|
-
const inputNumber = (num) => {
|
34
|
-
if (waitingForOperand) {
|
35
|
-
setDisplay(String(num))
|
36
|
-
setWaitingForOperand(false)
|
37
|
-
} else {
|
38
|
-
setDisplay(display === '0' ? String(num) : display + num)
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
const inputOperation = (nextOperation) => {
|
43
|
-
const inputValue = parseFloat(display)
|
44
|
-
|
45
|
-
if (previousValue === null) {
|
46
|
-
setPreviousValue(inputValue)
|
47
|
-
} else if (operation) {
|
48
|
-
const currentValue = previousValue || 0
|
49
|
-
const newValue = calculate(currentValue, inputValue, operation)
|
50
|
-
|
51
|
-
setDisplay(String(newValue))
|
52
|
-
setPreviousValue(newValue)
|
53
|
-
}
|
54
|
-
|
55
|
-
setWaitingForOperand(true)
|
56
|
-
setOperation(nextOperation)
|
57
|
-
}
|
58
|
-
|
59
|
-
const calculate = (firstValue, secondValue, operation) => {
|
60
|
-
switch (operation) {
|
61
|
-
case '+': return firstValue + secondValue
|
62
|
-
case '-': return firstValue - secondValue
|
63
|
-
case '×': return firstValue * secondValue
|
64
|
-
case '÷': return firstValue / secondValue
|
65
|
-
case '=': return secondValue
|
66
|
-
default: return secondValue
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
const performCalculation = () => {
|
71
|
-
const inputValue = parseFloat(display)
|
72
|
-
|
73
|
-
if (previousValue !== null && operation) {
|
74
|
-
const newValue = calculate(previousValue, inputValue, operation)
|
75
|
-
setDisplay(String(newValue))
|
76
|
-
setPreviousValue(null)
|
77
|
-
setOperation(null)
|
78
|
-
setWaitingForOperand(true)
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
const clear = () => {
|
83
|
-
setDisplay('0')
|
84
|
-
setPreviousValue(null)
|
85
|
-
setOperation(null)
|
86
|
-
setWaitingForOperand(false)
|
87
|
-
}
|
88
|
-
|
89
|
-
const buttonStyle = {
|
90
|
-
padding: '15px',
|
91
|
-
margin: '2px',
|
92
|
-
border: 'none',
|
93
|
-
borderRadius: '4px',
|
94
|
-
cursor: 'pointer',
|
95
|
-
fontSize: '16px',
|
96
|
-
fontWeight: 'bold'
|
97
|
-
}
|
98
|
-
|
99
|
-
return (
|
100
|
-
<div style={{ padding: '20px', maxWidth: '250px' }}>
|
101
|
-
<div style={{
|
102
|
-
background: '#000',
|
103
|
-
color: '#fff',
|
104
|
-
padding: '15px',
|
105
|
-
textAlign: 'right',
|
106
|
-
fontSize: '24px',
|
107
|
-
marginBottom: '10px',
|
108
|
-
borderRadius: '4px',
|
109
|
-
minHeight: '40px',
|
110
|
-
display: 'flex',
|
111
|
-
alignItems: 'center',
|
112
|
-
justifyContent: 'flex-end'
|
113
|
-
}}>
|
114
|
-
{display}
|
115
|
-
</div>
|
116
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '2px' }}>
|
117
|
-
<button style={{...buttonStyle, background: '#f0f0f0'}} onClick={clear}>C</button>
|
118
|
-
<button style={{...buttonStyle, background: '#f0f0f0'}} onClick={() => {}}>±</button>
|
119
|
-
<button style={{...buttonStyle, background: '#f0f0f0'}} onClick={() => {}}>%</button>
|
120
|
-
<button style={{...buttonStyle, background: '#ff9500', color: 'white'}} onClick={() => inputOperation('÷')}>÷</button>
|
121
|
-
|
122
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(7)}>7</button>
|
123
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(8)}>8</button>
|
124
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(9)}>9</button>
|
125
|
-
<button style={{...buttonStyle, background: '#ff9500', color: 'white'}} onClick={() => inputOperation('×')}>×</button>
|
126
|
-
|
127
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(4)}>4</button>
|
128
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(5)}>5</button>
|
129
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(6)}>6</button>
|
130
|
-
<button style={{...buttonStyle, background: '#ff9500', color: 'white'}} onClick={() => inputOperation('-')}>-</button>
|
131
|
-
|
132
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(1)}>1</button>
|
133
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(2)}>2</button>
|
134
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => inputNumber(3)}>3</button>
|
135
|
-
<button style={{...buttonStyle, background: '#ff9500', color: 'white'}} onClick={() => inputOperation('+')}>+</button>
|
136
|
-
|
137
|
-
<button style={{...buttonStyle, background: '#333', color: 'white', gridColumn: 'span 2'}} onClick={() => inputNumber(0)}>0</button>
|
138
|
-
<button style={{...buttonStyle, background: '#333', color: 'white'}} onClick={() => {}}>.</button>
|
139
|
-
<button style={{...buttonStyle, background: '#ff9500', color: 'white'}} onClick={performCalculation}>=</button>
|
140
|
-
</div>
|
141
|
-
</div>
|
142
|
-
)
|
143
|
-
}
|
144
|
-
|
145
|
-
// Register custom applications with components
|
146
|
-
const setupCustomApps = () => {
|
147
|
-
// Register Text Editor with actual component
|
148
|
-
defaultAppManager.registerApp({
|
149
|
-
id: 'text-editor-custom',
|
150
|
-
name: 'Advanced Text Editor',
|
151
|
-
description: 'Full-featured text editor with toolbar',
|
152
|
-
icon: '📝',
|
153
|
-
category: 'Productivity',
|
154
|
-
component: <TextEditorComponent />,
|
155
|
-
size: { width: 600, height: 400 }
|
156
|
-
})
|
157
|
-
|
158
|
-
// Register Calculator with actual component
|
159
|
-
defaultAppManager.registerApp({
|
160
|
-
id: 'calculator-custom',
|
161
|
-
name: 'Calculator Pro',
|
162
|
-
description: 'Advanced calculator with full functionality',
|
163
|
-
icon: '🧮',
|
164
|
-
category: 'Utilities',
|
165
|
-
component: <CalculatorComponent />,
|
166
|
-
size: { width: 300, height: 450 }
|
167
|
-
})
|
168
|
-
|
169
|
-
// Register a custom dashboard app
|
170
|
-
defaultAppManager.registerApp({
|
171
|
-
id: 'dashboard',
|
172
|
-
name: 'Dashboard',
|
173
|
-
description: 'System monitoring dashboard',
|
174
|
-
icon: '📊',
|
175
|
-
category: 'System',
|
176
|
-
component: (
|
177
|
-
<div style={{ padding: '20px' }}>
|
178
|
-
<h2>System Dashboard</h2>
|
179
|
-
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '20px', marginTop: '20px' }}>
|
180
|
-
<div style={{ padding: '15px', background: '#e3f2fd', borderRadius: '8px' }}>
|
181
|
-
<h4>CPU Usage</h4>
|
182
|
-
<div style={{ fontSize: '24px', fontWeight: 'bold', color: '#1976d2' }}>45%</div>
|
183
|
-
</div>
|
184
|
-
<div style={{ padding: '15px', background: '#e8f5e8', borderRadius: '8px' }}>
|
185
|
-
<h4>Memory</h4>
|
186
|
-
<div style={{ fontSize: '24px', fontWeight: 'bold', color: '#388e3c' }}>2.1GB</div>
|
187
|
-
</div>
|
188
|
-
<div style={{ padding: '15px', background: '#fff3e0', borderRadius: '8px' }}>
|
189
|
-
<h4>Disk Space</h4>
|
190
|
-
<div style={{ fontSize: '24px', fontWeight: 'bold', color: '#f57c00' }}>78%</div>
|
191
|
-
</div>
|
192
|
-
<div style={{ padding: '15px', background: '#fce4ec', borderRadius: '8px' }}>
|
193
|
-
<h4>Network</h4>
|
194
|
-
<div style={{ fontSize: '24px', fontWeight: 'bold', color: '#c2185b' }}>125 MB/s</div>
|
195
|
-
</div>
|
196
|
-
</div>
|
197
|
-
</div>
|
198
|
-
),
|
199
|
-
size: { width: 500, height: 400 }
|
200
|
-
})
|
201
|
-
}
|
202
|
-
|
203
|
-
// Component that demonstrates using both AppProvider hooks
|
204
|
-
const DemoControls = () => {
|
205
|
-
const { isOpen, open, close, toggle } = useApplicationMenu()
|
206
|
-
const appManager = useAppManager()
|
207
|
-
const [appCount, setAppCount] = React.useState(0)
|
208
|
-
|
209
|
-
React.useEffect(() => {
|
210
|
-
const updateCount = () => setAppCount(appManager.getAllApps().length)
|
211
|
-
updateCount()
|
212
|
-
appManager.addListener(updateCount)
|
213
|
-
return () => appManager.removeListener(updateCount)
|
214
|
-
}, [appManager])
|
215
|
-
|
216
|
-
const addCustomApp = () => {
|
217
|
-
const randomId = `custom-app-${Date.now()}`
|
218
|
-
appManager.registerApp({
|
219
|
-
id: randomId,
|
220
|
-
name: `Custom App ${Math.floor(Math.random() * 100)}`,
|
221
|
-
description: 'Dynamically added application',
|
222
|
-
icon: ['🎨', '🎯', '🎪', '🎭', '🎨'][Math.floor(Math.random() * 5)],
|
223
|
-
category: 'Custom',
|
224
|
-
component: (
|
225
|
-
<div style={{ padding: '20px', textAlign: 'center' }}>
|
226
|
-
<h2>Dynamic App</h2>
|
227
|
-
<p>This app was added dynamically using AppManager!</p>
|
228
|
-
<p>ID: {randomId}</p>
|
229
|
-
</div>
|
230
|
-
),
|
231
|
-
size: { width: 400, height: 300 }
|
232
|
-
})
|
233
|
-
}
|
234
|
-
|
235
|
-
return (
|
236
|
-
<div style={{
|
237
|
-
position: 'absolute',
|
238
|
-
top: '20px',
|
239
|
-
right: '20px',
|
240
|
-
background: 'rgba(255,255,255,0.9)',
|
241
|
-
padding: '20px',
|
242
|
-
borderRadius: '8px',
|
243
|
-
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
244
|
-
maxWidth: '300px'
|
245
|
-
}}>
|
246
|
-
<h4 style={{ margin: '0 0 15px 0' }}>🎮 App Controls</h4>
|
247
|
-
<p style={{ margin: '0 0 10px 0', fontSize: '14px', color: '#666' }}>
|
248
|
-
Menu: <strong>{isOpen ? 'Open' : 'Closed'}</strong><br/>
|
249
|
-
Apps: <strong>{appCount}</strong>
|
250
|
-
</p>
|
251
|
-
|
252
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
253
|
-
<button
|
254
|
-
onClick={open}
|
255
|
-
style={{
|
256
|
-
padding: '8px 12px',
|
257
|
-
background: '#4caf50',
|
258
|
-
color: 'white',
|
259
|
-
border: 'none',
|
260
|
-
borderRadius: '4px',
|
261
|
-
cursor: 'pointer',
|
262
|
-
fontSize: '12px'
|
263
|
-
}}
|
264
|
-
>
|
265
|
-
Open Menu
|
266
|
-
</button>
|
267
|
-
<button
|
268
|
-
onClick={close}
|
269
|
-
style={{
|
270
|
-
padding: '8px 12px',
|
271
|
-
background: '#f44336',
|
272
|
-
color: 'white',
|
273
|
-
border: 'none',
|
274
|
-
borderRadius: '4px',
|
275
|
-
cursor: 'pointer',
|
276
|
-
fontSize: '12px'
|
277
|
-
}}
|
278
|
-
>
|
279
|
-
Close Menu
|
280
|
-
</button>
|
281
|
-
<button
|
282
|
-
onClick={toggle}
|
283
|
-
style={{
|
284
|
-
padding: '8px 12px',
|
285
|
-
background: '#2196f3',
|
286
|
-
color: 'white',
|
287
|
-
border: 'none',
|
288
|
-
borderRadius: '4px',
|
289
|
-
cursor: 'pointer',
|
290
|
-
fontSize: '12px'
|
291
|
-
}}
|
292
|
-
>
|
293
|
-
Toggle Menu
|
294
|
-
</button>
|
295
|
-
<hr style={{ margin: '10px 0', border: 'none', borderTop: '1px solid #eee' }} />
|
296
|
-
<button
|
297
|
-
onClick={addCustomApp}
|
298
|
-
style={{
|
299
|
-
padding: '8px 12px',
|
300
|
-
background: '#ff9800',
|
301
|
-
color: 'white',
|
302
|
-
border: 'none',
|
303
|
-
borderRadius: '4px',
|
304
|
-
cursor: 'pointer',
|
305
|
-
fontSize: '12px'
|
306
|
-
}}
|
307
|
-
>
|
308
|
-
Add Custom App
|
309
|
-
</button>
|
310
|
-
</div>
|
311
|
-
</div>
|
312
|
-
)
|
313
|
-
}
|
314
|
-
|
315
|
-
/**
|
316
|
-
* Example component demonstrating the ApplicationMenu system
|
317
|
-
*/
|
318
|
-
export const ApplicationMenuExample = () => {
|
319
|
-
React.useEffect(() => {
|
320
|
-
setupCustomApps()
|
321
|
-
}, [])
|
322
|
-
|
323
|
-
return (
|
324
|
-
<div style={{ height: '100vh', position: 'relative', backgroundColor: '#f0f0f0' }}>
|
325
|
-
<Desktop desktopSize={{ width: 1200, height: 800 }}>
|
326
|
-
{/* Desktop background content */}
|
327
|
-
<div style={{
|
328
|
-
position: 'absolute',
|
329
|
-
top: '20px',
|
330
|
-
left: '20px',
|
331
|
-
background: 'rgba(255,255,255,0.9)',
|
332
|
-
padding: '20px',
|
333
|
-
borderRadius: '8px',
|
334
|
-
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
335
|
-
maxWidth: '400px'
|
336
|
-
}}>
|
337
|
-
<h3 style={{ margin: '0 0 15px 0' }}>🚀 AppProvider + AppManager Demo</h3>
|
338
|
-
<p style={{ margin: '0 0 15px 0', lineHeight: '1.5' }}>
|
339
|
-
AppProvider and AppManager now collaborate seamlessly. The ApplicationMenu gets apps
|
340
|
-
from AppManager through the context. Try adding custom apps dynamically!
|
341
|
-
</p>
|
342
|
-
<div style={{ fontSize: '14px', color: '#666' }}>
|
343
|
-
<p><strong>Collaboration Features:</strong></p>
|
344
|
-
<ul style={{ margin: '5px 0', paddingLeft: '20px' }}>
|
345
|
-
<li>AppProvider provides AppManager via context</li>
|
346
|
-
<li>ApplicationMenu uses useAppManager() hook</li>
|
347
|
-
<li>Dynamic app registration and updates</li>
|
348
|
-
<li>Real-time app count updates</li>
|
349
|
-
<li>Clean separation of concerns</li>
|
350
|
-
</ul>
|
351
|
-
</div>
|
352
|
-
</div>
|
353
|
-
|
354
|
-
{/* Demo controls using the hook */}
|
355
|
-
<DemoControls />
|
356
|
-
</Desktop>
|
357
|
-
</div>
|
358
|
-
)
|
359
|
-
}
|
360
|
-
|
361
|
-
export default ApplicationMenuExample
|