@hyve-sdk/js 2.10.0-canary.1 → 2.10.0-canary.2

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/react.js CHANGED
@@ -2363,49 +2363,49 @@ function MachineViewDialog({
2363
2363
  dialogWidth,
2364
2364
  viewHeight
2365
2365
  }) {
2366
+ const panelRef = (0, import_react.useRef)(null);
2366
2367
  (0, import_react.useEffect)(() => {
2367
2368
  if (!open) return;
2368
2369
  const onKeyDown = (e) => {
2369
2370
  if (e.key === "Escape") onClose();
2370
2371
  };
2372
+ const onMouseDown = (e) => {
2373
+ if (panelRef.current && !panelRef.current.contains(e.target)) {
2374
+ onClose();
2375
+ }
2376
+ };
2371
2377
  window.addEventListener("keydown", onKeyDown);
2378
+ document.addEventListener("mousedown", onMouseDown);
2372
2379
  return () => {
2373
2380
  window.removeEventListener("keydown", onKeyDown);
2381
+ document.removeEventListener("mousedown", onMouseDown);
2374
2382
  };
2375
2383
  }, [open, onClose]);
2376
2384
  if (!open) return null;
2377
2385
  const panelWidth = typeof dialogWidth === "number" ? `${dialogWidth}px` : dialogWidth;
2378
2386
  const iframeHeight = typeof viewHeight === "number" ? `${viewHeight}px` : viewHeight;
2379
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2387
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: OVERLAY_STYLE, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2380
2388
  "div",
2381
2389
  {
2382
- style: OVERLAY_STYLE,
2383
- onMouseDown: (e) => {
2384
- if (e.target === e.currentTarget) onClose();
2385
- },
2386
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2387
- "div",
2388
- {
2389
- style: { ...PANEL_STYLE, maxWidth: panelWidth },
2390
- children: [
2391
- title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: HEADER_STYLE, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: TITLE_STYLE, children: title }) }),
2392
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2393
- MachineView,
2394
- {
2395
- machineId,
2396
- style: {
2397
- width: "100%",
2398
- height: iframeHeight,
2399
- border: "none",
2400
- display: "block"
2401
- }
2402
- }
2403
- )
2404
- ]
2405
- }
2406
- )
2390
+ ref: panelRef,
2391
+ style: { ...PANEL_STYLE, maxWidth: panelWidth },
2392
+ children: [
2393
+ title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: HEADER_STYLE, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: TITLE_STYLE, children: title }) }),
2394
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2395
+ MachineView,
2396
+ {
2397
+ machineId,
2398
+ style: {
2399
+ width: "100%",
2400
+ height: iframeHeight,
2401
+ border: "none",
2402
+ display: "block"
2403
+ }
2404
+ }
2405
+ )
2406
+ ]
2407
2407
  }
2408
- );
2408
+ ) });
2409
2409
  }
2410
2410
  function MachineViewButton({
2411
2411
  machineId,
package/dist/react.mjs CHANGED
@@ -2341,49 +2341,49 @@ function MachineViewDialog({
2341
2341
  dialogWidth,
2342
2342
  viewHeight
2343
2343
  }) {
2344
+ const panelRef = useRef(null);
2344
2345
  useEffect(() => {
2345
2346
  if (!open) return;
2346
2347
  const onKeyDown = (e) => {
2347
2348
  if (e.key === "Escape") onClose();
2348
2349
  };
2350
+ const onMouseDown = (e) => {
2351
+ if (panelRef.current && !panelRef.current.contains(e.target)) {
2352
+ onClose();
2353
+ }
2354
+ };
2349
2355
  window.addEventListener("keydown", onKeyDown);
2356
+ document.addEventListener("mousedown", onMouseDown);
2350
2357
  return () => {
2351
2358
  window.removeEventListener("keydown", onKeyDown);
2359
+ document.removeEventListener("mousedown", onMouseDown);
2352
2360
  };
2353
2361
  }, [open, onClose]);
2354
2362
  if (!open) return null;
2355
2363
  const panelWidth = typeof dialogWidth === "number" ? `${dialogWidth}px` : dialogWidth;
2356
2364
  const iframeHeight = typeof viewHeight === "number" ? `${viewHeight}px` : viewHeight;
2357
- return /* @__PURE__ */ jsx(
2365
+ return /* @__PURE__ */ jsx("div", { style: OVERLAY_STYLE, children: /* @__PURE__ */ jsxs(
2358
2366
  "div",
2359
2367
  {
2360
- style: OVERLAY_STYLE,
2361
- onMouseDown: (e) => {
2362
- if (e.target === e.currentTarget) onClose();
2363
- },
2364
- children: /* @__PURE__ */ jsxs(
2365
- "div",
2366
- {
2367
- style: { ...PANEL_STYLE, maxWidth: panelWidth },
2368
- children: [
2369
- title && /* @__PURE__ */ jsx("div", { style: HEADER_STYLE, children: /* @__PURE__ */ jsx("p", { style: TITLE_STYLE, children: title }) }),
2370
- /* @__PURE__ */ jsx(
2371
- MachineView,
2372
- {
2373
- machineId,
2374
- style: {
2375
- width: "100%",
2376
- height: iframeHeight,
2377
- border: "none",
2378
- display: "block"
2379
- }
2380
- }
2381
- )
2382
- ]
2383
- }
2384
- )
2368
+ ref: panelRef,
2369
+ style: { ...PANEL_STYLE, maxWidth: panelWidth },
2370
+ children: [
2371
+ title && /* @__PURE__ */ jsx("div", { style: HEADER_STYLE, children: /* @__PURE__ */ jsx("p", { style: TITLE_STYLE, children: title }) }),
2372
+ /* @__PURE__ */ jsx(
2373
+ MachineView,
2374
+ {
2375
+ machineId,
2376
+ style: {
2377
+ width: "100%",
2378
+ height: iframeHeight,
2379
+ border: "none",
2380
+ display: "block"
2381
+ }
2382
+ }
2383
+ )
2384
+ ]
2385
2385
  }
2386
- );
2386
+ ) });
2387
2387
  }
2388
2388
  function MachineViewButton({
2389
2389
  machineId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyve-sdk/js",
3
- "version": "2.10.0-canary.1",
3
+ "version": "2.10.0-canary.2",
4
4
  "description": "Hyve SDK - TypeScript wrapper for Hyve game server integration",
5
5
  "private": false,
6
6
  "publishConfig": {