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