react-os-shell 2.1.0 → 2.2.0
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/Browser-WBWTTZ3W.js +7 -0
- package/dist/{Browser-AGOIAPRE.js.map → Browser-WBWTTZ3W.js.map} +1 -1
- package/dist/{Calculator-JJZMCBIN.js → Calculator-BQBC6VT5.js} +4 -4
- package/dist/{Calculator-JJZMCBIN.js.map → Calculator-BQBC6VT5.js.map} +1 -1
- package/dist/{CurrencyConverter-VCZGTULI.js → CurrencyConverter-DTPURMT4.js} +4 -4
- package/dist/{CurrencyConverter-VCZGTULI.js.map → CurrencyConverter-DTPURMT4.js.map} +1 -1
- package/dist/{Documents-OXJFXHNU.js → Documents-VLN4MNK5.js} +4 -4
- package/dist/{Documents-OXJFXHNU.js.map → Documents-VLN4MNK5.js.map} +1 -1
- package/dist/Files-VOQ36BX5.js +13 -0
- package/dist/{Files-3LLMFTQW.js.map → Files-VOQ36BX5.js.map} +1 -1
- package/dist/{Notepad-WBQ2PFX2.js → Notepad-4AHOPIU7.js} +4 -4
- package/dist/{Notepad-WBQ2PFX2.js.map → Notepad-4AHOPIU7.js.map} +1 -1
- package/dist/{PomodoroTimer-TEZJH7E6.js → PomodoroTimer-LIWIBVWC.js} +4 -4
- package/dist/{PomodoroTimer-TEZJH7E6.js.map → PomodoroTimer-LIWIBVWC.js.map} +1 -1
- package/dist/Preview-ZYVXFIWX.js +9 -0
- package/dist/{Preview-YS4B3LP4.js.map → Preview-ZYVXFIWX.js.map} +1 -1
- package/dist/Spreadsheet-53RD3BXS.js +7 -0
- package/dist/{Spreadsheet-6QZBQKAW.js.map → Spreadsheet-53RD3BXS.js.map} +1 -1
- package/dist/{Stock-QVTMAGIU.js → Stock-EHJCICH5.js} +4 -4
- package/dist/{Stock-QVTMAGIU.js.map → Stock-EHJCICH5.js.map} +1 -1
- package/dist/{Weather-PXUZW22T.js → Weather-3ILCQFSO.js} +4 -4
- package/dist/{Weather-PXUZW22T.js.map → Weather-3ILCQFSO.js.map} +1 -1
- package/dist/{WorldClock-CRESQVKE.js → WorldClock-TEG2A2UV.js} +4 -4
- package/dist/{WorldClock-CRESQVKE.js.map → WorldClock-TEG2A2UV.js.map} +1 -1
- package/dist/apps/index.js +19 -19
- package/dist/{chunk-AAYCPPVK.js → chunk-34X5YPQT.js} +4 -4
- package/dist/{chunk-AAYCPPVK.js.map → chunk-34X5YPQT.js.map} +1 -1
- package/dist/{chunk-JBVKJJEM.js → chunk-4F6XJIY3.js} +4 -4
- package/dist/{chunk-JBVKJJEM.js.map → chunk-4F6XJIY3.js.map} +1 -1
- package/dist/{chunk-5FEW4QE5.js → chunk-BN7GXKEZ.js} +55 -14
- package/dist/chunk-BN7GXKEZ.js.map +1 -0
- package/dist/{chunk-GLIN3PDZ.js → chunk-DGPKTNFZ.js} +5 -5
- package/dist/{chunk-GLIN3PDZ.js.map → chunk-DGPKTNFZ.js.map} +1 -1
- package/dist/{chunk-DRX353B4.js → chunk-EK4U6LPM.js} +4 -4
- package/dist/{chunk-DRX353B4.js.map → chunk-EK4U6LPM.js.map} +1 -1
- package/dist/{chunk-2KV2YWMA.js → chunk-H72L23PH.js} +4 -4
- package/dist/{chunk-2KV2YWMA.js.map → chunk-H72L23PH.js.map} +1 -1
- package/dist/{chunk-P4YWAKEC.js → chunk-IEHKOV3M.js} +4 -4
- package/dist/{chunk-P4YWAKEC.js.map → chunk-IEHKOV3M.js.map} +1 -1
- package/dist/{chunk-AYTCQLZ4.js → chunk-YHRVUXLJ.js} +3 -3
- package/dist/{chunk-AYTCQLZ4.js.map → chunk-YHRVUXLJ.js.map} +1 -1
- package/dist/index.d.ts +38 -2
- package/dist/index.js +35 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/Browser-AGOIAPRE.js +0 -7
- package/dist/Files-3LLMFTQW.js +0 -13
- package/dist/Preview-YS4B3LP4.js +0 -9
- package/dist/Spreadsheet-6QZBQKAW.js +0 -7
- package/dist/chunk-5FEW4QE5.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { confirm } from './chunk-UBN4IUDE.js';
|
|
2
2
|
import { glassStyle, GLASS_DIVIDER, navIcons } from './chunk-ZF6AYO4G.js';
|
|
3
|
-
import { createContext, useRef, useEffect, useSyncExternalStore, useContext, useState, useCallback, isValidElement, cloneElement, useLayoutEffect, Suspense, useMemo } from 'react';
|
|
3
|
+
import { createContext, Component, useRef, useEffect, useSyncExternalStore, useContext, useState, useCallback, isValidElement, cloneElement, useLayoutEffect, Suspense, useMemo } from 'react';
|
|
4
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
5
|
import { useLocation } from 'react-router-dom';
|
|
5
6
|
import { createPortal } from 'react-dom';
|
|
6
7
|
import { useQueryClient, useQuery } from '@tanstack/react-query';
|
|
7
8
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
8
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
// src/windowRegistry/types.ts
|
|
11
11
|
function isPageEntry(entry) {
|
|
@@ -64,6 +64,41 @@ var apiClient = new Proxy({}, {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
var client_default = apiClient;
|
|
67
|
+
function WindowCrashedFallback({ error, onReload }) {
|
|
68
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col items-center justify-center gap-3 px-6 py-12 text-center", children: [
|
|
69
|
+
/* @__PURE__ */ jsx("svg", { className: "h-8 w-8 text-amber-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 1.5, children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" }) }),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
71
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700", children: "This window crashed" }),
|
|
72
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-gray-400 max-w-sm break-words", children: error.message || String(error) })
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
type: "button",
|
|
78
|
+
onClick: onReload,
|
|
79
|
+
className: "bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg",
|
|
80
|
+
children: "Reload window"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
var WindowErrorBoundary = class extends Component {
|
|
86
|
+
state = { error: null };
|
|
87
|
+
static getDerivedStateFromError(error) {
|
|
88
|
+
return { error: error instanceof Error ? error : new Error(String(error)) };
|
|
89
|
+
}
|
|
90
|
+
componentDidCatch(error, info) {
|
|
91
|
+
console.error("[react-os-shell] window content crashed:", error, info.componentStack);
|
|
92
|
+
}
|
|
93
|
+
reset = () => this.setState({ error: null });
|
|
94
|
+
render() {
|
|
95
|
+
const { error } = this.state;
|
|
96
|
+
if (error) {
|
|
97
|
+
return this.props.fallback ? this.props.fallback(error, this.reset) : /* @__PURE__ */ jsx(WindowCrashedFallback, { error, onReload: this.reset });
|
|
98
|
+
}
|
|
99
|
+
return this.props.children;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
67
102
|
function getDensity() {
|
|
68
103
|
return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim() || "normal";
|
|
69
104
|
}
|
|
@@ -1620,7 +1655,7 @@ function Modal({ open, onClose, title, icon, copyText, size = "lg", dirty = fals
|
|
|
1620
1655
|
} } : {},
|
|
1621
1656
|
className: `${autoHeight && !autoHeightResolved ? "flex-none" : "flex-1 min-h-0"} flex flex-col ${widget ? "p-0 cursor-move" : appStyle ? "p-0" : flushBody ? "p-0" : compact ? "p-2" : "p-4"} ${widget ? "" : "backdrop-blur-sm"} ${autoHeight && !autoHeightResolved ? "overflow-visible" : bodyScroll === false || appStyle || flushBody ? "overflow-hidden" : "overflow-y-auto overscroll-contain"} ${widget ? "rounded-2xl select-none" : ""}`,
|
|
1622
1657
|
style: { ...widget ? { touchAction: "none" } : {}, backgroundColor: widget ? "transparent" : isActive ? `rgb(var(--window-content-rgb) / var(--active-content-opacity, 0.9))` : `rgb(var(--window-content-rgb) / var(--inactive-content-opacity, 0.8))` },
|
|
1623
|
-
children
|
|
1658
|
+
children: /* @__PURE__ */ jsx(WindowErrorBoundary, { children })
|
|
1624
1659
|
}
|
|
1625
1660
|
) }) }),
|
|
1626
1661
|
widget && ctxMenu && /* @__PURE__ */ jsxs(PopupMenu, { minWidth: 160, style: { left: ctxMenu.x, top: ctxMenu.y }, onClose: () => setCtxMenu(null), children: [
|
|
@@ -1812,10 +1847,10 @@ function PageWindow({ item, onClose }) {
|
|
|
1812
1847
|
const raw = WINDOW_REGISTRY[item.route];
|
|
1813
1848
|
if (!raw || !isPageEntry(raw)) return null;
|
|
1814
1849
|
const entry = raw;
|
|
1815
|
-
const
|
|
1850
|
+
const Component2 = entry.component;
|
|
1816
1851
|
return /* @__PURE__ */ jsxs(Modal, { open: true, onClose, icon: navIcons[item.route], title: entry.label, size: entry.size || "2xl", allowPinOnTop: entry.allowPinOnTop, initialPosition: entry.initialPosition, widget: entry.widget, compact: entry.compact, appStyle: entry.appStyle, flushBody: entry.flushBody, autoHeight: entry.autoHeight, autoMinHeight: entry.autoMinHeight, dimensions: entry.dimensions, windowKey: item.id, openedFromKey: item.openedFrom, children: [
|
|
1817
1852
|
/* @__PURE__ */ jsx(DesktopShortcutMenuItem, { item }),
|
|
1818
|
-
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) }), children: /* @__PURE__ */ jsx(
|
|
1853
|
+
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx(LoadingSpinner, {}) }), children: /* @__PURE__ */ jsx(Component2, {}) })
|
|
1819
1854
|
] });
|
|
1820
1855
|
}
|
|
1821
1856
|
function DocFavStar({ entityType, entityId, label }) {
|
|
@@ -2385,19 +2420,25 @@ function WindowManagerProvider({ children }) {
|
|
|
2385
2420
|
}
|
|
2386
2421
|
),
|
|
2387
2422
|
/* @__PURE__ */ jsx(ExposeBackdrop, {}),
|
|
2388
|
-
!isAuthPage && openWindows.map((item) =>
|
|
2389
|
-
|
|
2423
|
+
!isAuthPage && openWindows.map((item) => /* @__PURE__ */ jsx(
|
|
2424
|
+
WindowErrorBoundary,
|
|
2390
2425
|
{
|
|
2391
|
-
item,
|
|
2392
|
-
onClose: () => closeEntity(item.id)
|
|
2393
|
-
|
|
2394
|
-
|
|
2426
|
+
fallback: (error, reset) => /* @__PURE__ */ jsx(Modal, { open: true, onClose: () => closeEntity(item.id), title: item.label, size: "md", autoHeight: true, windowKey: item.id, children: /* @__PURE__ */ jsx(WindowCrashedFallback, { error, onReload: reset }) }),
|
|
2427
|
+
children: item.type === "page" ? /* @__PURE__ */ jsx(PageWindow, { item, onClose: () => closeEntity(item.id) }) : /* @__PURE__ */ jsx(
|
|
2428
|
+
RestoredRegistryModal,
|
|
2429
|
+
{
|
|
2430
|
+
item,
|
|
2431
|
+
onClose: () => closeEntity(item.id),
|
|
2432
|
+
onMinimize: () => {
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
)
|
|
2395
2436
|
},
|
|
2396
2437
|
item.id
|
|
2397
2438
|
))
|
|
2398
2439
|
] });
|
|
2399
2440
|
}
|
|
2400
2441
|
|
|
2401
|
-
export { CancelButton, CopyButton, DocFavStar, LoadingSpinner, Modal, ModalActions, PopupMenu, PopupMenuDivider, PopupMenuItem, PopupMenuLabel, ThumbCard, WINDOW_REGISTRY, WindowManagerProvider, WindowTitle, activateModal, client_default, commitExposeHighlight, exitExposeMode, getActiveModalId, getActiveWindowRoute, getExposeHighlight, getWindowPosition, isEntityEntry, isPageEntry, setExposeHighlight, setShellApiClient, setShellWindowRegistry, setWindowDefaultPosition, setWindowPosition, subscribeExposeHighlight, toggleExposeMode, useIsMobile, useModalActive, useWidgetSettings, useWindowManager, useWindowMenuItem, useWindowTitle };
|
|
2402
|
-
//# sourceMappingURL=chunk-
|
|
2403
|
-
//# sourceMappingURL=chunk-
|
|
2442
|
+
export { CancelButton, CopyButton, DocFavStar, LoadingSpinner, Modal, ModalActions, PopupMenu, PopupMenuDivider, PopupMenuItem, PopupMenuLabel, ThumbCard, WINDOW_REGISTRY, WindowCrashedFallback, WindowErrorBoundary, WindowManagerProvider, WindowTitle, activateModal, client_default, commitExposeHighlight, exitExposeMode, getActiveModalId, getActiveWindowRoute, getExposeHighlight, getWindowPosition, isEntityEntry, isPageEntry, setExposeHighlight, setShellApiClient, setShellWindowRegistry, setWindowDefaultPosition, setWindowPosition, subscribeExposeHighlight, toggleExposeMode, useIsMobile, useModalActive, useWidgetSettings, useWindowManager, useWindowMenuItem, useWindowTitle };
|
|
2443
|
+
//# sourceMappingURL=chunk-BN7GXKEZ.js.map
|
|
2444
|
+
//# sourceMappingURL=chunk-BN7GXKEZ.js.map
|