ywana-core8 0.2.4 → 0.2.6
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 +961 -0
- package/dist/index.js +450 -6
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +450 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +450 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/desktop/AppManager.js +270 -0
- package/src/desktop/ApplicationMenu.css +279 -0
- package/src/desktop/ApplicationMenu.js +214 -0
- package/src/desktop/Desktop.stories.jsx +432 -5
- package/src/desktop/WindowContext.js +1 -0
- package/src/desktop/WindowManager.js +23 -0
- package/src/desktop/desktop-linux.css +232 -0
- package/src/desktop/desktop-macos.css +260 -0
- package/src/desktop/desktop-windows.css +190 -0
- package/src/desktop/desktop.js +131 -33
- package/src/desktop/index.js +5 -1
- package/src/desktop/window.js +9 -2
- package/src/examples/ApplicationMenuExample.js +361 -0
package/dist/index.js
CHANGED
@@ -31869,6 +31869,24 @@ class WindowManager {
|
|
31869
31869
|
this.notifyListeners();
|
31870
31870
|
return true;
|
31871
31871
|
}
|
31872
|
+
/**
|
31873
|
+
* Update window size
|
31874
|
+
*/
|
31875
|
+
updateWindowSize(windowId, size) {
|
31876
|
+
const window2 = this.windows.get(windowId);
|
31877
|
+
if (!window2) return false;
|
31878
|
+
const minWidth = 200;
|
31879
|
+
const minHeight = 150;
|
31880
|
+
const maxWidth = this.desktopSize.width;
|
31881
|
+
const maxHeight = this.desktopSize.height - 50;
|
31882
|
+
const constrainedSize = {
|
31883
|
+
width: Math.max(minWidth, Math.min(size.width || window2.size.width, maxWidth)),
|
31884
|
+
height: Math.max(minHeight, Math.min(size.height || window2.size.height, maxHeight))
|
31885
|
+
};
|
31886
|
+
window2.size = { ...window2.size, ...constrainedSize };
|
31887
|
+
this.notifyListeners();
|
31888
|
+
return true;
|
31889
|
+
}
|
31872
31890
|
/**
|
31873
31891
|
* Get all windows
|
31874
31892
|
*/
|
@@ -32031,6 +32049,7 @@ const WindowProvider = ({ children, desktopSize }) => {
|
|
32031
32049
|
minimizeWindow: (id, minimize) => windowManagerRef.current.minimizeWindow(id, minimize),
|
32032
32050
|
maximizeWindow: (id, maximize) => windowManagerRef.current.maximizeWindow(id, maximize),
|
32033
32051
|
updateWindowPosition: (id, position) => windowManagerRef.current.updateWindowPosition(id, position),
|
32052
|
+
updateWindowSize: (id, size) => windowManagerRef.current.updateWindowSize(id, size),
|
32034
32053
|
// Window queries
|
32035
32054
|
getWindow: (id) => windowManagerRef.current.getWindow(id),
|
32036
32055
|
getAllWindows: () => windowManagerRef.current.getAllWindows(),
|
@@ -32093,11 +32112,16 @@ const Window = ({
|
|
32093
32112
|
}) => {
|
32094
32113
|
const windowRef = React.useRef(null);
|
32095
32114
|
const headerRef = React.useRef(null);
|
32096
|
-
const { getWindow, updateWindowPosition, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
|
32115
|
+
const { getWindow, updateWindowPosition, updateWindowSize, closeWindow, minimizeWindow, maximizeWindow, focusWindow } = useWindows();
|
32097
32116
|
const windowData = getWindow(id);
|
32098
32117
|
const [isDragging, setIsDragging] = React.useState(false);
|
32099
32118
|
const [dragOffset, setDragOffset] = React.useState({ x: 0, y: 0 });
|
32100
32119
|
const [dragStartPosition, setDragStartPosition] = React.useState({ x: 0, y: 0 });
|
32120
|
+
const [isResizing, setIsResizing] = React.useState(false);
|
32121
|
+
const [resizeDirection, setResizeDirection] = React.useState("");
|
32122
|
+
const [resizeStartSize, setResizeStartSize] = React.useState({ width: 0, height: 0 });
|
32123
|
+
const [resizeStartPosition, setResizeStartPosition] = React.useState({ x: 0, y: 0 });
|
32124
|
+
const [resizeStartMouse, setResizeStartMouse] = React.useState({ x: 0, y: 0 });
|
32101
32125
|
if (!windowData) {
|
32102
32126
|
return null;
|
32103
32127
|
}
|
@@ -32252,7 +32276,387 @@ const Window = ({
|
|
32252
32276
|
statusBar && /* @__PURE__ */ React.createElement("div", { className: "window__status-bar" }, statusBar)
|
32253
32277
|
);
|
32254
32278
|
};
|
32255
|
-
const
|
32279
|
+
const ApplicationMenu = ({ isOpen, onClose }) => {
|
32280
|
+
const appManager = useAppManager();
|
32281
|
+
const [searchTerm, setSearchTerm] = React.useState("");
|
32282
|
+
const [selectedCategory, setSelectedCategory] = React.useState("all");
|
32283
|
+
const [apps, setApps] = React.useState([]);
|
32284
|
+
const [categories, setCategories] = React.useState([]);
|
32285
|
+
const searchInputRef = React.useRef(null);
|
32286
|
+
const { createWindow } = useWindows();
|
32287
|
+
React.useEffect(() => {
|
32288
|
+
const loadData = () => {
|
32289
|
+
setApps(appManager.getAllApps());
|
32290
|
+
setCategories(appManager.getAllCategories());
|
32291
|
+
};
|
32292
|
+
loadData();
|
32293
|
+
appManager.addListener(loadData);
|
32294
|
+
return () => {
|
32295
|
+
appManager.removeListener(loadData);
|
32296
|
+
};
|
32297
|
+
}, [appManager]);
|
32298
|
+
React.useEffect(() => {
|
32299
|
+
if (isOpen && searchInputRef.current) {
|
32300
|
+
setTimeout(() => {
|
32301
|
+
searchInputRef.current.focus();
|
32302
|
+
}, 100);
|
32303
|
+
}
|
32304
|
+
}, [isOpen]);
|
32305
|
+
React.useEffect(() => {
|
32306
|
+
const handleKeyDown = (e) => {
|
32307
|
+
if (e.key === "Escape" && isOpen) {
|
32308
|
+
onClose();
|
32309
|
+
}
|
32310
|
+
};
|
32311
|
+
if (isOpen) {
|
32312
|
+
document.addEventListener("keydown", handleKeyDown);
|
32313
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
32314
|
+
}
|
32315
|
+
}, [isOpen, onClose]);
|
32316
|
+
const filteredApps = apps.filter((app) => {
|
32317
|
+
const matchesSearch = searchTerm === "" || app.name.toLowerCase().includes(searchTerm.toLowerCase()) || app.description.toLowerCase().includes(searchTerm.toLowerCase());
|
32318
|
+
const matchesCategory = selectedCategory === "all" || app.category.toLowerCase() === selectedCategory.toLowerCase();
|
32319
|
+
return matchesSearch && matchesCategory;
|
32320
|
+
});
|
32321
|
+
const groupedApps = filteredApps.reduce((groups, app) => {
|
32322
|
+
const category = app.category;
|
32323
|
+
if (!groups[category]) {
|
32324
|
+
groups[category] = [];
|
32325
|
+
}
|
32326
|
+
groups[category].push(app);
|
32327
|
+
return groups;
|
32328
|
+
}, {});
|
32329
|
+
const handleLaunchApp = (app) => {
|
32330
|
+
createWindow({
|
32331
|
+
id: `${app.id}-${Date.now()}`,
|
32332
|
+
title: app.name,
|
32333
|
+
icon: app.icon,
|
32334
|
+
size: app.size,
|
32335
|
+
toolbar: app.toolbar,
|
32336
|
+
statusBar: app.statusBar,
|
32337
|
+
content: app.component || /* @__PURE__ */ React.createElement("div", { style: { padding: "20px", textAlign: "center" } }, /* @__PURE__ */ React.createElement("div", { style: { fontSize: "48px", marginBottom: "16px" } }, app.icon), /* @__PURE__ */ React.createElement("h2", null, app.name), /* @__PURE__ */ React.createElement("p", { style: { color: "#666", marginBottom: "20px" } }, app.description), /* @__PURE__ */ React.createElement("p", { style: { fontSize: "14px", color: "#999" } }, "This is a placeholder for the ", app.name, " application."))
|
32338
|
+
});
|
32339
|
+
onClose();
|
32340
|
+
};
|
32341
|
+
const handleCategorySelect = (categoryId) => {
|
32342
|
+
setSelectedCategory(categoryId);
|
32343
|
+
setSearchTerm("");
|
32344
|
+
};
|
32345
|
+
if (!isOpen) return null;
|
32346
|
+
return /* @__PURE__ */ React.createElement("div", { className: "application-menu-overlay", onClick: onClose }, /* @__PURE__ */ React.createElement("div", { className: "application-menu", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React.createElement("div", { className: "application-menu__header" }, /* @__PURE__ */ React.createElement("h2", null, "Applications"), /* @__PURE__ */ React.createElement(
|
32347
|
+
"button",
|
32348
|
+
{
|
32349
|
+
className: "application-menu__close",
|
32350
|
+
onClick: onClose,
|
32351
|
+
title: "Close menu"
|
32352
|
+
},
|
32353
|
+
"×"
|
32354
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "application-menu__search" }, /* @__PURE__ */ React.createElement(
|
32355
|
+
"input",
|
32356
|
+
{
|
32357
|
+
ref: searchInputRef,
|
32358
|
+
type: "text",
|
32359
|
+
placeholder: "Search applications...",
|
32360
|
+
value: searchTerm,
|
32361
|
+
onChange: (e) => setSearchTerm(e.target.value),
|
32362
|
+
className: "application-menu__search-input"
|
32363
|
+
}
|
32364
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "application-menu__categories" }, /* @__PURE__ */ React.createElement(
|
32365
|
+
"button",
|
32366
|
+
{
|
32367
|
+
className: `application-menu__category ${selectedCategory === "all" ? "active" : ""}`,
|
32368
|
+
onClick: () => handleCategorySelect("all")
|
32369
|
+
},
|
32370
|
+
/* @__PURE__ */ React.createElement("span", { className: "category-icon" }, "📱"),
|
32371
|
+
"All Apps"
|
32372
|
+
), categories.map((category) => /* @__PURE__ */ React.createElement(
|
32373
|
+
"button",
|
32374
|
+
{
|
32375
|
+
key: category.id,
|
32376
|
+
className: `application-menu__category ${selectedCategory === category.id ? "active" : ""}`,
|
32377
|
+
onClick: () => handleCategorySelect(category.id)
|
32378
|
+
},
|
32379
|
+
/* @__PURE__ */ React.createElement("span", { className: "category-icon" }, category.icon),
|
32380
|
+
category.name
|
32381
|
+
))), /* @__PURE__ */ React.createElement("div", { className: "application-menu__content" }, searchTerm && /* @__PURE__ */ React.createElement("div", { className: "application-menu__search-results" }, /* @__PURE__ */ React.createElement("h3", null, "Search Results (", filteredApps.length, ")"), /* @__PURE__ */ React.createElement("div", { className: "application-menu__apps-grid" }, filteredApps.map((app) => /* @__PURE__ */ React.createElement(
|
32382
|
+
"div",
|
32383
|
+
{
|
32384
|
+
key: app.id,
|
32385
|
+
className: "application-menu__app",
|
32386
|
+
onClick: () => handleLaunchApp(app),
|
32387
|
+
title: app.description
|
32388
|
+
},
|
32389
|
+
/* @__PURE__ */ React.createElement("div", { className: "app-icon" }, app.icon),
|
32390
|
+
/* @__PURE__ */ React.createElement("div", { className: "app-name" }, app.name)
|
32391
|
+
)))), !searchTerm && /* @__PURE__ */ React.createElement("div", { className: "application-menu__categories-content" }, Object.entries(groupedApps).map(([categoryName, categoryApps]) => /* @__PURE__ */ React.createElement("div", { key: categoryName, className: "application-menu__category-section" }, /* @__PURE__ */ React.createElement("h3", { className: "category-title" }, categoryName), /* @__PURE__ */ React.createElement("div", { className: "application-menu__apps-grid" }, categoryApps.map((app) => /* @__PURE__ */ React.createElement(
|
32392
|
+
"div",
|
32393
|
+
{
|
32394
|
+
key: app.id,
|
32395
|
+
className: "application-menu__app",
|
32396
|
+
onClick: () => handleLaunchApp(app),
|
32397
|
+
title: app.description
|
32398
|
+
},
|
32399
|
+
/* @__PURE__ */ React.createElement("div", { className: "app-icon" }, app.icon),
|
32400
|
+
/* @__PURE__ */ React.createElement("div", { className: "app-name" }, app.name)
|
32401
|
+
)))))), filteredApps.length === 0 && /* @__PURE__ */ React.createElement("div", { className: "application-menu__no-results" }, /* @__PURE__ */ React.createElement("div", { style: { fontSize: "48px", marginBottom: "16px" } }, "🔍"), /* @__PURE__ */ React.createElement("h3", null, "No applications found"), /* @__PURE__ */ React.createElement("p", null, "Try adjusting your search or category filter.")))));
|
32402
|
+
};
|
32403
|
+
class AppManager {
|
32404
|
+
constructor() {
|
32405
|
+
this.applications = /* @__PURE__ */ new Map();
|
32406
|
+
this.categories = /* @__PURE__ */ new Map();
|
32407
|
+
this.listeners = /* @__PURE__ */ new Set();
|
32408
|
+
this.initializeDefaultApps();
|
32409
|
+
}
|
32410
|
+
/**
|
32411
|
+
* Initialize default applications
|
32412
|
+
*/
|
32413
|
+
initializeDefaultApps() {
|
32414
|
+
this.registerApp({
|
32415
|
+
id: "file-explorer",
|
32416
|
+
name: "File Explorer",
|
32417
|
+
description: "Browse and manage files",
|
32418
|
+
icon: "📁",
|
32419
|
+
category: "System",
|
32420
|
+
component: null,
|
32421
|
+
// Will be set when registering actual components
|
32422
|
+
size: { width: 600, height: 400 },
|
32423
|
+
toolbar: null,
|
32424
|
+
statusBar: null
|
32425
|
+
});
|
32426
|
+
this.registerApp({
|
32427
|
+
id: "text-editor",
|
32428
|
+
name: "Text Editor",
|
32429
|
+
description: "Edit text files",
|
32430
|
+
icon: "📝",
|
32431
|
+
category: "Productivity",
|
32432
|
+
component: null,
|
32433
|
+
size: { width: 500, height: 350 },
|
32434
|
+
toolbar: null,
|
32435
|
+
statusBar: null
|
32436
|
+
});
|
32437
|
+
this.registerApp({
|
32438
|
+
id: "calculator",
|
32439
|
+
name: "Calculator",
|
32440
|
+
description: "Perform calculations",
|
32441
|
+
icon: "🧮",
|
32442
|
+
category: "Utilities",
|
32443
|
+
component: null,
|
32444
|
+
size: { width: 300, height: 400 }
|
32445
|
+
});
|
32446
|
+
this.registerApp({
|
32447
|
+
id: "settings",
|
32448
|
+
name: "Settings",
|
32449
|
+
description: "System configuration",
|
32450
|
+
icon: "⚙️",
|
32451
|
+
category: "System",
|
32452
|
+
component: null,
|
32453
|
+
size: { width: 450, height: 300 }
|
32454
|
+
});
|
32455
|
+
this.registerApp({
|
32456
|
+
id: "browser",
|
32457
|
+
name: "Web Browser",
|
32458
|
+
description: "Browse the internet",
|
32459
|
+
icon: "🌐",
|
32460
|
+
category: "Internet",
|
32461
|
+
component: null,
|
32462
|
+
size: { width: 800, height: 500 }
|
32463
|
+
});
|
32464
|
+
this.registerApp({
|
32465
|
+
id: "terminal",
|
32466
|
+
name: "Terminal",
|
32467
|
+
description: "Command line interface",
|
32468
|
+
icon: "💻",
|
32469
|
+
category: "Development",
|
32470
|
+
component: null,
|
32471
|
+
size: { width: 700, height: 400 }
|
32472
|
+
});
|
32473
|
+
this.registerApp({
|
32474
|
+
id: "image-viewer",
|
32475
|
+
name: "Image Viewer",
|
32476
|
+
description: "View and edit images",
|
32477
|
+
icon: "🖼️",
|
32478
|
+
category: "Media",
|
32479
|
+
component: null,
|
32480
|
+
size: { width: 600, height: 500 }
|
32481
|
+
});
|
32482
|
+
this.registerApp({
|
32483
|
+
id: "music-player",
|
32484
|
+
name: "Music Player",
|
32485
|
+
description: "Play audio files",
|
32486
|
+
icon: "🎵",
|
32487
|
+
category: "Media",
|
32488
|
+
component: null,
|
32489
|
+
size: { width: 400, height: 300 }
|
32490
|
+
});
|
32491
|
+
this.initializeCategories();
|
32492
|
+
}
|
32493
|
+
/**
|
32494
|
+
* Initialize application categories
|
32495
|
+
*/
|
32496
|
+
initializeCategories() {
|
32497
|
+
const categoryData = [
|
32498
|
+
{ id: "system", name: "System", icon: "⚙️", color: "#607d8b" },
|
32499
|
+
{ id: "productivity", name: "Productivity", icon: "📊", color: "#2196f3" },
|
32500
|
+
{ id: "utilities", name: "Utilities", icon: "🔧", color: "#ff9800" },
|
32501
|
+
{ id: "internet", name: "Internet", icon: "🌐", color: "#4caf50" },
|
32502
|
+
{ id: "development", name: "Development", icon: "💻", color: "#9c27b0" },
|
32503
|
+
{ id: "media", name: "Media", icon: "🎬", color: "#e91e63" },
|
32504
|
+
{ id: "games", name: "Games", icon: "🎮", color: "#f44336" }
|
32505
|
+
];
|
32506
|
+
categoryData.forEach((category) => {
|
32507
|
+
this.categories.set(category.id, category);
|
32508
|
+
});
|
32509
|
+
}
|
32510
|
+
/**
|
32511
|
+
* Register a new application
|
32512
|
+
*/
|
32513
|
+
registerApp(appConfig) {
|
32514
|
+
const app = {
|
32515
|
+
id: appConfig.id,
|
32516
|
+
name: appConfig.name,
|
32517
|
+
description: appConfig.description || "",
|
32518
|
+
icon: appConfig.icon || "📄",
|
32519
|
+
category: appConfig.category || "Utilities",
|
32520
|
+
component: appConfig.component || null,
|
32521
|
+
size: appConfig.size || { width: 600, height: 400 },
|
32522
|
+
toolbar: appConfig.toolbar || null,
|
32523
|
+
statusBar: appConfig.statusBar || null,
|
32524
|
+
...appConfig
|
32525
|
+
};
|
32526
|
+
this.applications.set(app.id, app);
|
32527
|
+
this.notifyListeners();
|
32528
|
+
return app.id;
|
32529
|
+
}
|
32530
|
+
/**
|
32531
|
+
* Unregister an application
|
32532
|
+
*/
|
32533
|
+
unregisterApp(appId) {
|
32534
|
+
const removed = this.applications.delete(appId);
|
32535
|
+
if (removed) {
|
32536
|
+
this.notifyListeners();
|
32537
|
+
}
|
32538
|
+
return removed;
|
32539
|
+
}
|
32540
|
+
/**
|
32541
|
+
* Get an application by ID
|
32542
|
+
*/
|
32543
|
+
getApp(appId) {
|
32544
|
+
return this.applications.get(appId);
|
32545
|
+
}
|
32546
|
+
/**
|
32547
|
+
* Get all applications
|
32548
|
+
*/
|
32549
|
+
getAllApps() {
|
32550
|
+
return Array.from(this.applications.values());
|
32551
|
+
}
|
32552
|
+
/**
|
32553
|
+
* Get applications by category
|
32554
|
+
*/
|
32555
|
+
getAppsByCategory(categoryId) {
|
32556
|
+
return Array.from(this.applications.values()).filter((app) => app.category.toLowerCase() === categoryId.toLowerCase());
|
32557
|
+
}
|
32558
|
+
/**
|
32559
|
+
* Get all categories
|
32560
|
+
*/
|
32561
|
+
getAllCategories() {
|
32562
|
+
return Array.from(this.categories.values());
|
32563
|
+
}
|
32564
|
+
/**
|
32565
|
+
* Get category by ID
|
32566
|
+
*/
|
32567
|
+
getCategory(categoryId) {
|
32568
|
+
return this.categories.get(categoryId.toLowerCase());
|
32569
|
+
}
|
32570
|
+
/**
|
32571
|
+
* Search applications
|
32572
|
+
*/
|
32573
|
+
searchApps(query) {
|
32574
|
+
const searchTerm = query.toLowerCase();
|
32575
|
+
return Array.from(this.applications.values()).filter(
|
32576
|
+
(app) => app.name.toLowerCase().includes(searchTerm) || app.description.toLowerCase().includes(searchTerm) || app.category.toLowerCase().includes(searchTerm)
|
32577
|
+
);
|
32578
|
+
}
|
32579
|
+
/**
|
32580
|
+
* Add listener for changes
|
32581
|
+
*/
|
32582
|
+
addListener(listener) {
|
32583
|
+
this.listeners.add(listener);
|
32584
|
+
}
|
32585
|
+
/**
|
32586
|
+
* Remove listener
|
32587
|
+
*/
|
32588
|
+
removeListener(listener) {
|
32589
|
+
this.listeners.delete(listener);
|
32590
|
+
}
|
32591
|
+
/**
|
32592
|
+
* Notify all listeners about changes
|
32593
|
+
*/
|
32594
|
+
notifyListeners() {
|
32595
|
+
this.listeners.forEach((listener) => listener(this.getAllApps()));
|
32596
|
+
}
|
32597
|
+
/**
|
32598
|
+
* Get applications grouped by category
|
32599
|
+
*/
|
32600
|
+
getAppsGroupedByCategory() {
|
32601
|
+
const grouped = {};
|
32602
|
+
const categories = this.getAllCategories();
|
32603
|
+
categories.forEach((category) => {
|
32604
|
+
grouped[category.id] = {
|
32605
|
+
category,
|
32606
|
+
apps: []
|
32607
|
+
};
|
32608
|
+
});
|
32609
|
+
this.getAllApps().forEach((app) => {
|
32610
|
+
const categoryId = app.category.toLowerCase();
|
32611
|
+
if (grouped[categoryId]) {
|
32612
|
+
grouped[categoryId].apps.push(app);
|
32613
|
+
} else {
|
32614
|
+
grouped[categoryId] = {
|
32615
|
+
category: { id: categoryId, name: app.category, icon: "📁", color: "#757575" },
|
32616
|
+
apps: [app]
|
32617
|
+
};
|
32618
|
+
}
|
32619
|
+
});
|
32620
|
+
Object.keys(grouped).forEach((key) => {
|
32621
|
+
if (grouped[key].apps.length === 0) {
|
32622
|
+
delete grouped[key];
|
32623
|
+
}
|
32624
|
+
});
|
32625
|
+
return grouped;
|
32626
|
+
}
|
32627
|
+
}
|
32628
|
+
const defaultAppManager = new AppManager();
|
32629
|
+
const AppContext = React.createContext();
|
32630
|
+
const useApplicationMenu = () => {
|
32631
|
+
const context = React.useContext(AppContext);
|
32632
|
+
if (!context) {
|
32633
|
+
throw new Error("useApplicationMenu must be used within AppProvider");
|
32634
|
+
}
|
32635
|
+
return context.applicationMenu;
|
32636
|
+
};
|
32637
|
+
const useAppManager = () => {
|
32638
|
+
const context = React.useContext(AppContext);
|
32639
|
+
if (!context) {
|
32640
|
+
throw new Error("useAppManager must be used within AppProvider");
|
32641
|
+
}
|
32642
|
+
return context.appManager;
|
32643
|
+
};
|
32644
|
+
const AppProvider = ({ children, appManager = defaultAppManager }) => {
|
32645
|
+
const [isApplicationMenuOpen, setIsApplicationMenuOpen] = React.useState(false);
|
32646
|
+
const value = {
|
32647
|
+
// Application Menu state
|
32648
|
+
applicationMenu: {
|
32649
|
+
isOpen: isApplicationMenuOpen,
|
32650
|
+
open: () => setIsApplicationMenuOpen(true),
|
32651
|
+
close: () => setIsApplicationMenuOpen(false),
|
32652
|
+
toggle: () => setIsApplicationMenuOpen(!isApplicationMenuOpen)
|
32653
|
+
},
|
32654
|
+
// App Manager instance
|
32655
|
+
appManager
|
32656
|
+
};
|
32657
|
+
return /* @__PURE__ */ React.createElement(AppContext.Provider, { value }, children);
|
32658
|
+
};
|
32659
|
+
const DesktopLayout = ({ children, className = "", theme = "windows", ...props }) => {
|
32256
32660
|
const desktopRef = React.useRef(null);
|
32257
32661
|
const { windowManager } = useWindows();
|
32258
32662
|
React.useEffect(() => {
|
@@ -32283,11 +32687,12 @@ const DesktopLayout = ({ children, className = "", ...props }) => {
|
|
32283
32687
|
e.preventDefault();
|
32284
32688
|
console.log("Desktop context menu at:", e.clientX, e.clientY);
|
32285
32689
|
};
|
32690
|
+
const themeClass = `desktop--${theme}`;
|
32286
32691
|
return /* @__PURE__ */ React.createElement(
|
32287
32692
|
"div",
|
32288
32693
|
{
|
32289
32694
|
ref: desktopRef,
|
32290
|
-
className: `desktop ${className}`,
|
32695
|
+
className: `desktop ${themeClass} ${className}`,
|
32291
32696
|
onContextMenu: handleContextMenu,
|
32292
32697
|
...props
|
32293
32698
|
},
|
@@ -32320,6 +32725,7 @@ const DesktopTaskbar = () => {
|
|
32320
32725
|
minimizeWindow,
|
32321
32726
|
closeWindow
|
32322
32727
|
} = useWindows();
|
32728
|
+
const { open: openApplicationMenu } = useApplicationMenu();
|
32323
32729
|
const handleCreateWindow = () => {
|
32324
32730
|
const windowTypes = [
|
32325
32731
|
{ title: "File Explorer", icon: "📁", size: { width: 600, height: 400 } },
|
@@ -32371,12 +32777,34 @@ const DesktopTaskbar = () => {
|
|
32371
32777
|
padding: "0 16px",
|
32372
32778
|
gap: "8px"
|
32373
32779
|
} }, /* @__PURE__ */ React.createElement(
|
32780
|
+
"button",
|
32781
|
+
{
|
32782
|
+
onClick: openApplicationMenu,
|
32783
|
+
style: {
|
32784
|
+
padding: "8px 16px",
|
32785
|
+
background: "#1976d2",
|
32786
|
+
color: "white",
|
32787
|
+
border: "none",
|
32788
|
+
borderRadius: "4px",
|
32789
|
+
cursor: "pointer",
|
32790
|
+
fontSize: "14px",
|
32791
|
+
fontWeight: "bold",
|
32792
|
+
flexShrink: 0,
|
32793
|
+
display: "flex",
|
32794
|
+
alignItems: "center",
|
32795
|
+
gap: "6px"
|
32796
|
+
},
|
32797
|
+
title: "Open application menu"
|
32798
|
+
},
|
32799
|
+
/* @__PURE__ */ React.createElement("span", { style: { fontSize: "16px" } }, "🚀"),
|
32800
|
+
"Start"
|
32801
|
+
), /* @__PURE__ */ React.createElement(
|
32374
32802
|
"button",
|
32375
32803
|
{
|
32376
32804
|
onClick: handleCreateWindow,
|
32377
32805
|
style: {
|
32378
32806
|
padding: "8px 12px",
|
32379
|
-
background: "#
|
32807
|
+
background: "#666",
|
32380
32808
|
color: "white",
|
32381
32809
|
border: "none",
|
32382
32810
|
borderRadius: "4px",
|
@@ -32384,7 +32812,7 @@ const DesktopTaskbar = () => {
|
|
32384
32812
|
fontSize: "12px",
|
32385
32813
|
flexShrink: 0
|
32386
32814
|
},
|
32387
|
-
title: "Create
|
32815
|
+
title: "Create random window (for testing)"
|
32388
32816
|
},
|
32389
32817
|
"+"
|
32390
32818
|
), /* @__PURE__ */ React.createElement("div", { style: {
|
@@ -32454,8 +32882,18 @@ Middle click: Close`
|
|
32454
32882
|
textAlign: "right"
|
32455
32883
|
} }, desktopSize.width, "×", desktopSize.height));
|
32456
32884
|
};
|
32885
|
+
const DesktopInternal = ({ desktopSize, children, ...props }) => {
|
32886
|
+
const { isOpen, close } = useApplicationMenu();
|
32887
|
+
return /* @__PURE__ */ React.createElement(WindowProvider, { desktopSize }, /* @__PURE__ */ React.createElement(DesktopLayout, { ...props }, /* @__PURE__ */ React.createElement(Workspace, null, children), /* @__PURE__ */ React.createElement(DesktopTaskbar, null), /* @__PURE__ */ React.createElement(
|
32888
|
+
ApplicationMenu,
|
32889
|
+
{
|
32890
|
+
isOpen,
|
32891
|
+
onClose: close
|
32892
|
+
}
|
32893
|
+
)));
|
32894
|
+
};
|
32457
32895
|
const Desktop = ({ desktopSize, children, ...props }) => {
|
32458
|
-
return /* @__PURE__ */ React.createElement(
|
32896
|
+
return /* @__PURE__ */ React.createElement(AppProvider, null, /* @__PURE__ */ React.createElement(DesktopInternal, { desktopSize, ...props }, children));
|
32459
32897
|
};
|
32460
32898
|
const ContentForm = ({ content, columns = 1, filter: filter2, rules, onChange }) => {
|
32461
32899
|
const form = content.form();
|
@@ -42175,6 +42613,9 @@ exports.Accordion = Accordion;
|
|
42175
42613
|
exports.AccordionExamples = AccordionExamples;
|
42176
42614
|
exports.ActionButton = ActionButton;
|
42177
42615
|
exports.ActionsCell = ActionsCell;
|
42616
|
+
exports.AppManager = AppManager;
|
42617
|
+
exports.AppProvider = AppProvider;
|
42618
|
+
exports.ApplicationMenu = ApplicationMenu;
|
42178
42619
|
exports.Avatar = Avatar;
|
42179
42620
|
exports.Button = Button;
|
42180
42621
|
exports.ButtonExamples = ButtonExamples;
|
@@ -42328,8 +42769,11 @@ exports.WindowProvider = WindowProvider;
|
|
42328
42769
|
exports.Wizard = Wizard;
|
42329
42770
|
exports.WizardContext = WizardContext;
|
42330
42771
|
exports.Workspace = Workspace;
|
42772
|
+
exports.defaultAppManager = defaultAppManager;
|
42331
42773
|
exports.isEmpty = isEmpty;
|
42332
42774
|
exports.isFunction = isFunction;
|
42775
|
+
exports.useAppManager = useAppManager;
|
42776
|
+
exports.useApplicationMenu = useApplicationMenu;
|
42333
42777
|
exports.useCreateWindow = useCreateWindow;
|
42334
42778
|
exports.useHashPage = useHashPage;
|
42335
42779
|
exports.useWindow = useWindow;
|