react-os-shell 0.2.21 → 0.2.22

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.
@@ -1,7 +1,7 @@
1
- export { Files as default, openFilesInTrashMode } from './chunk-6RDJWAMU.js';
2
- import './chunk-YLXY6AZK.js';
1
+ export { Files as default, openFilesInTrashMode } from './chunk-XYCLLD46.js';
2
+ import './chunk-4DW5YQ7Y.js';
3
3
  import './chunk-WIJ45SYD.js';
4
4
  import './chunk-QXY6ZHRX.js';
5
5
  import './chunk-PLGHQ7QW.js';
6
- //# sourceMappingURL=Files-DUBYUPH3.js.map
7
- //# sourceMappingURL=Files-DUBYUPH3.js.map
6
+ //# sourceMappingURL=Files-XKNHOT5T.js.map
7
+ //# sourceMappingURL=Files-XKNHOT5T.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"Files-DUBYUPH3.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"Files-XKNHOT5T.js"}
@@ -0,0 +1,6 @@
1
+ export { Preview as default, setPdfPreview } from './chunk-4DW5YQ7Y.js';
2
+ import './chunk-WIJ45SYD.js';
3
+ import './chunk-QXY6ZHRX.js';
4
+ import './chunk-PLGHQ7QW.js';
5
+ //# sourceMappingURL=Preview-MIILWJVE.js.map
6
+ //# sourceMappingURL=Preview-MIILWJVE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"Preview-IJNSVRUN.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"Preview-MIILWJVE.js"}
@@ -1,5 +1,5 @@
1
- export { openFilesInTrashMode } from '../chunk-6RDJWAMU.js';
2
- export { setPdfPreview } from '../chunk-YLXY6AZK.js';
1
+ export { openFilesInTrashMode } from '../chunk-XYCLLD46.js';
2
+ export { setPdfPreview } from '../chunk-4DW5YQ7Y.js';
3
3
  import '../chunk-WIJ45SYD.js';
4
4
  import '../chunk-QXY6ZHRX.js';
5
5
  import '../chunk-PLGHQ7QW.js';
@@ -20,9 +20,9 @@ var Minesweeper = lazy(() => import('../Minesweeper-YPAR6SPJ.js'));
20
20
  var Email = lazy(() => import('../Email-XTFUEIE5.js'));
21
21
  var GeminiChat = lazy(() => import('../GeminiChat-ITU46EH4.js'));
22
22
  var Calendar = lazy(() => import('../Calendar-24TAKCAJ.js'));
23
- var Preview = lazy(() => import('../Preview-IJNSVRUN.js'));
23
+ var Preview = lazy(() => import('../Preview-MIILWJVE.js'));
24
24
  var Documents = lazy(() => import('../Documents-QMP6QN3C.js'));
25
- var Files = lazy(() => import('../Files-DUBYUPH3.js'));
25
+ var Files = lazy(() => import('../Files-XKNHOT5T.js'));
26
26
  var Browser = lazy(() => import('../Browser-RJZLTAJQ.js'));
27
27
  var utilityApps = {
28
28
  "/calculator": { component: Calculator, label: "Calculator", size: "sm", allowPinOnTop: true, utility: true, widget: true, autoHeight: true, dimensions: [280, 420] },
@@ -20,6 +20,7 @@ function ImageAnnotator({ src, filename, onClose }) {
20
20
  const [imageReady, setImageReady] = useState(false);
21
21
  const [pendingText, setPendingText] = useState(null);
22
22
  const [pendingCrop, setPendingCrop] = useState(null);
23
+ const [displaySize, setDisplaySize] = useState(null);
23
24
  const [displayScale, setDisplayScale] = useState(1);
24
25
  useEffect(() => {
25
26
  const img = new Image();
@@ -45,9 +46,25 @@ function ImageAnnotator({ src, filename, onClose }) {
45
46
  if (!imageReady) return;
46
47
  const update = () => {
47
48
  const c = canvasRef.current;
48
- if (!c) return;
49
- const rect = c.getBoundingClientRect();
50
- if (rect.width > 0) setDisplayScale(c.width / rect.width);
49
+ const wrap = wrapRef.current;
50
+ if (!c || !wrap) return;
51
+ const wrapRect = wrap.getBoundingClientRect();
52
+ const availW = Math.max(0, wrapRect.width - 32);
53
+ const availH = Math.max(0, wrapRect.height - 32);
54
+ if (availW === 0 || availH === 0) return;
55
+ const ratio = c.width / c.height;
56
+ let w = c.width;
57
+ let h = c.height;
58
+ if (w > availW) {
59
+ w = availW;
60
+ h = w / ratio;
61
+ }
62
+ if (h > availH) {
63
+ h = availH;
64
+ w = h * ratio;
65
+ }
66
+ setDisplaySize({ w, h });
67
+ setDisplayScale(c.width / w);
51
68
  };
52
69
  update();
53
70
  const ro = new ResizeObserver(update);
@@ -284,71 +301,77 @@ function ImageAnnotator({ src, filename, onClose }) {
284
301
  /* @__PURE__ */ jsx("button", { onClick: onClose, className: "px-2 py-1 text-xs rounded hover:bg-gray-200 text-gray-700", children: "Exit" })
285
302
  ] })
286
303
  ] }),
287
- /* @__PURE__ */ jsx("div", { ref: wrapRef, className: "flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative", children: /* @__PURE__ */ jsxs("div", { className: "relative inline-block max-w-full max-h-full", children: [
288
- /* @__PURE__ */ jsx(
289
- "canvas",
290
- {
291
- ref: canvasRef,
292
- onPointerDown,
293
- onPointerMove,
294
- onPointerUp,
295
- onPointerCancel: () => {
296
- dragRef.current = null;
297
- clearOverlay();
298
- },
299
- style: { touchAction: "none", maxWidth: "100%", maxHeight: "100%", display: "block", cursor: tool === "text" ? "text" : "crosshair" },
300
- className: "shadow-lg rounded bg-white"
301
- }
302
- ),
303
- /* @__PURE__ */ jsx(
304
- "canvas",
305
- {
306
- ref: overlayRef,
307
- style: {
308
- position: "absolute",
309
- inset: 0,
310
- pointerEvents: "none",
311
- maxWidth: "100%",
312
- maxHeight: "100%",
313
- width: "100%",
314
- height: "100%"
315
- }
316
- }
317
- ),
318
- pendingText && /* @__PURE__ */ jsx(
319
- "div",
320
- {
321
- style: {
322
- position: "absolute",
323
- left: `${pendingText.x / displayScale}px`,
324
- top: `${pendingText.y / displayScale}px`,
325
- transform: "translateY(-2px)"
326
- },
327
- className: "z-10",
328
- children: /* @__PURE__ */ jsx(
329
- "textarea",
304
+ /* @__PURE__ */ jsx("div", { ref: wrapRef, className: "flex-1 overflow-hidden bg-gray-200 flex items-center justify-center p-4 relative", children: /* @__PURE__ */ jsxs(
305
+ "div",
306
+ {
307
+ className: "relative shadow-lg rounded overflow-hidden",
308
+ style: displaySize ? { width: displaySize.w, height: displaySize.h } : void 0,
309
+ children: [
310
+ /* @__PURE__ */ jsx(
311
+ "canvas",
330
312
  {
331
- autoFocus: true,
332
- value: pendingText.value,
333
- onChange: (e) => setPendingText({ ...pendingText, value: e.target.value }),
334
- onBlur: commitText,
335
- onKeyDown: (e) => {
336
- if (e.key === "Escape") {
337
- setPendingText(null);
338
- } else if (e.key === "Enter" && !e.shiftKey) {
339
- e.preventDefault();
340
- commitText();
341
- }
313
+ ref: canvasRef,
314
+ onPointerDown,
315
+ onPointerMove,
316
+ onPointerUp,
317
+ onPointerCancel: () => {
318
+ dragRef.current = null;
319
+ clearOverlay();
320
+ },
321
+ style: { touchAction: "none", display: "block", width: "100%", height: "100%", cursor: tool === "text" ? "text" : "crosshair", background: "#fff" }
322
+ }
323
+ ),
324
+ /* @__PURE__ */ jsx(
325
+ "canvas",
326
+ {
327
+ ref: overlayRef,
328
+ style: {
329
+ position: "absolute",
330
+ top: 0,
331
+ left: 0,
332
+ width: "100%",
333
+ height: "100%",
334
+ pointerEvents: "none",
335
+ display: "block"
336
+ }
337
+ }
338
+ ),
339
+ pendingText && /* @__PURE__ */ jsx(
340
+ "div",
341
+ {
342
+ style: {
343
+ position: "absolute",
344
+ left: `${pendingText.x / displayScale}px`,
345
+ top: `${pendingText.y / displayScale}px`,
346
+ transform: "translateY(-2px)"
342
347
  },
343
- placeholder: "Type then Enter\u2026",
344
- rows: 1,
345
- className: "bg-white/95 border border-blue-400 rounded px-1 py-0.5 text-sm outline-none resize-none shadow-md",
346
- style: { color, fontWeight: 600, minWidth: 80 }
348
+ className: "z-10",
349
+ children: /* @__PURE__ */ jsx(
350
+ "textarea",
351
+ {
352
+ autoFocus: true,
353
+ value: pendingText.value,
354
+ onChange: (e) => setPendingText({ ...pendingText, value: e.target.value }),
355
+ onBlur: commitText,
356
+ onKeyDown: (e) => {
357
+ if (e.key === "Escape") {
358
+ setPendingText(null);
359
+ } else if (e.key === "Enter" && !e.shiftKey) {
360
+ e.preventDefault();
361
+ commitText();
362
+ }
363
+ },
364
+ placeholder: "Type then Enter\u2026",
365
+ rows: 1,
366
+ className: "bg-white/95 border border-blue-400 rounded px-1 py-0.5 text-sm outline-none resize-none shadow-md",
367
+ style: { color, fontWeight: 600, minWidth: 80 }
368
+ }
369
+ )
347
370
  }
348
371
  )
349
- }
350
- )
351
- ] }) })
372
+ ]
373
+ }
374
+ ) })
352
375
  ] });
353
376
  }
354
377
  function normalizeRect(a, b) {
@@ -1863,5 +1886,5 @@ function ImagePanel({ url, filename, onDownload, onEmail }) {
1863
1886
  }
1864
1887
 
1865
1888
  export { Preview, setPdfPreview };
1866
- //# sourceMappingURL=chunk-YLXY6AZK.js.map
1867
- //# sourceMappingURL=chunk-YLXY6AZK.js.map
1889
+ //# sourceMappingURL=chunk-4DW5YQ7Y.js.map
1890
+ //# sourceMappingURL=chunk-4DW5YQ7Y.js.map