react-os-shell 2.0.1 → 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.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/dist/Browser-WBWTTZ3W.js +7 -0
  3. package/dist/{Browser-HGX2YS22.js.map → Browser-WBWTTZ3W.js.map} +1 -1
  4. package/dist/{Calculator-JJZMCBIN.js → Calculator-BQBC6VT5.js} +4 -4
  5. package/dist/{Calculator-JJZMCBIN.js.map → Calculator-BQBC6VT5.js.map} +1 -1
  6. package/dist/{CurrencyConverter-VCZGTULI.js → CurrencyConverter-DTPURMT4.js} +4 -4
  7. package/dist/{CurrencyConverter-VCZGTULI.js.map → CurrencyConverter-DTPURMT4.js.map} +1 -1
  8. package/dist/{Documents-W6JNKYE3.js → Documents-VLN4MNK5.js} +4 -4
  9. package/dist/{Documents-W6JNKYE3.js.map → Documents-VLN4MNK5.js.map} +1 -1
  10. package/dist/Files-VOQ36BX5.js +13 -0
  11. package/dist/{Files-232FHLMO.js.map → Files-VOQ36BX5.js.map} +1 -1
  12. package/dist/{Notepad-G2UOOZOU.js → Notepad-4AHOPIU7.js} +4 -4
  13. package/dist/{Notepad-G2UOOZOU.js.map → Notepad-4AHOPIU7.js.map} +1 -1
  14. package/dist/{PomodoroTimer-TEZJH7E6.js → PomodoroTimer-LIWIBVWC.js} +4 -4
  15. package/dist/{PomodoroTimer-TEZJH7E6.js.map → PomodoroTimer-LIWIBVWC.js.map} +1 -1
  16. package/dist/Preview-ZYVXFIWX.js +9 -0
  17. package/dist/{Preview-QXM6YE7A.js.map → Preview-ZYVXFIWX.js.map} +1 -1
  18. package/dist/Spreadsheet-53RD3BXS.js +7 -0
  19. package/dist/{Spreadsheet-7V6GLIIW.js.map → Spreadsheet-53RD3BXS.js.map} +1 -1
  20. package/dist/{Stock-QVTMAGIU.js → Stock-EHJCICH5.js} +4 -4
  21. package/dist/{Stock-QVTMAGIU.js.map → Stock-EHJCICH5.js.map} +1 -1
  22. package/dist/{Weather-PXUZW22T.js → Weather-3ILCQFSO.js} +4 -4
  23. package/dist/{Weather-PXUZW22T.js.map → Weather-3ILCQFSO.js.map} +1 -1
  24. package/dist/{WorldClock-CRESQVKE.js → WorldClock-TEG2A2UV.js} +4 -4
  25. package/dist/{WorldClock-CRESQVKE.js.map → WorldClock-TEG2A2UV.js.map} +1 -1
  26. package/dist/apps/index.js +19 -19
  27. package/dist/{chunk-XF7JN5E5.js → chunk-34X5YPQT.js} +4 -4
  28. package/dist/{chunk-XF7JN5E5.js.map → chunk-34X5YPQT.js.map} +1 -1
  29. package/dist/{chunk-LXCTOIXP.js → chunk-4F6XJIY3.js} +4 -4
  30. package/dist/{chunk-LXCTOIXP.js.map → chunk-4F6XJIY3.js.map} +1 -1
  31. package/dist/{chunk-5FEW4QE5.js → chunk-BN7GXKEZ.js} +55 -14
  32. package/dist/chunk-BN7GXKEZ.js.map +1 -0
  33. package/dist/{chunk-QESYOYZS.js → chunk-DGPKTNFZ.js} +5 -5
  34. package/dist/{chunk-QESYOYZS.js.map → chunk-DGPKTNFZ.js.map} +1 -1
  35. package/dist/{chunk-JZS5427T.js → chunk-EK4U6LPM.js} +4 -4
  36. package/dist/{chunk-JZS5427T.js.map → chunk-EK4U6LPM.js.map} +1 -1
  37. package/dist/{chunk-Q4EH3NFS.js → chunk-H72L23PH.js} +4 -4
  38. package/dist/{chunk-Q4EH3NFS.js.map → chunk-H72L23PH.js.map} +1 -1
  39. package/dist/{chunk-XO4ZJAUB.js → chunk-IEHKOV3M.js} +4 -4
  40. package/dist/{chunk-XO4ZJAUB.js.map → chunk-IEHKOV3M.js.map} +1 -1
  41. package/dist/{chunk-AYTCQLZ4.js → chunk-YHRVUXLJ.js} +3 -3
  42. package/dist/{chunk-AYTCQLZ4.js.map → chunk-YHRVUXLJ.js.map} +1 -1
  43. package/dist/index.d.ts +80 -2
  44. package/dist/index.js +212 -22
  45. package/dist/index.js.map +1 -1
  46. package/package.json +1 -1
  47. package/dist/Browser-HGX2YS22.js +0 -7
  48. package/dist/Files-232FHLMO.js +0 -13
  49. package/dist/Preview-QXM6YE7A.js +0 -9
  50. package/dist/Spreadsheet-7V6GLIIW.js +0 -7
  51. 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 Component = entry.component;
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(Component, {}) })
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) => item.type === "page" ? /* @__PURE__ */ jsx(PageWindow, { item, onClose: () => closeEntity(item.id) }, item.id) : /* @__PURE__ */ jsx(
2389
- RestoredRegistryModal,
2423
+ !isAuthPage && openWindows.map((item) => /* @__PURE__ */ jsx(
2424
+ WindowErrorBoundary,
2390
2425
  {
2391
- item,
2392
- onClose: () => closeEntity(item.id),
2393
- onMinimize: () => {
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-5FEW4QE5.js.map
2403
- //# sourceMappingURL=chunk-5FEW4QE5.js.map
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