reqct-gamehub-module 0.1.2 → 0.1.4

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.js CHANGED
@@ -2491,6 +2491,26 @@ var GAME_NODE_SIZES = {
2491
2491
  pong: { width: 760, height: 780 },
2492
2492
  platformer: { width: 980, height: 750 }
2493
2493
  };
2494
+ var HandleErrorBoundary = class extends import_react7.default.Component {
2495
+ constructor(props) {
2496
+ super(props);
2497
+ this.state = { hasError: false };
2498
+ }
2499
+ static getDerivedStateFromError() {
2500
+ return { hasError: true };
2501
+ }
2502
+ componentDidCatch(err) {
2503
+ console.warn(
2504
+ "[reqct-gamehub-module] <Handle> crashed: React Flow store/provider not found for this render tree. This usually happens when the node is rendered outside <ReactFlow /> (palette/preview/portal) or when provider comes from a different React tree.",
2505
+ err
2506
+ );
2507
+ }
2508
+ render() {
2509
+ if (this.state.hasError) return null;
2510
+ return this.props.children;
2511
+ }
2512
+ };
2513
+ var SafeHandle = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HandleErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react8.Handle, { ...props }) });
2494
2514
  var STATS_API_BASE = typeof import_meta !== "undefined" && import_meta.env && import_meta.env.VITE_STATS_API_URL || typeof process !== "undefined" && process.env && process.env.REACT_APP_STATS_API_URL || "http://localhost:4000";
2495
2515
  function getAuthFromStorage() {
2496
2516
  const token = localStorage.getItem("jwt") || localStorage.getItem("token") || localStorage.getItem("access_token") || localStorage.getItem("accessToken") || "";
@@ -2730,8 +2750,8 @@ var GameHubNode = (0, import_react7.memo)(({ id, data, selected, overlayMode = f
2730
2750
  }
2731
2751
  const subtitleText = view === "menu" ? menuTab === "stats" ? "\u041B\u0438\u0434\u0435\u0440\u0431\u043E\u0440\u0434\u044B: \u0442\u043E\u043F-10 \u043F\u043E \u0438\u0433\u0440\u0430\u043C" : "\u0412\u044B\u0431\u0435\u0440\u0438 \u0438\u0433\u0440\u0443" : `\u0422\u0435\u043A\u0443\u0449\u0430\u044F: ${active?.title || ""} \u2022 \u0421\u0447\u0451\u0442: ${currentScore}${currentGameStat ? ` \u2022 Best: ${currentGameStat.best} \u2022 Last: ${currentGameStat.last} \u2022 Plays: ${currentGameStat.plays}` : ""}`;
2732
2752
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `gamehub-node ${selected ? "selected" : ""}`, children: [
2733
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react8.Handle, { type: "target", position: import_react8.Position.Top }),
2734
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gamehub-drag-handle", children: [
2753
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SafeHandle, { type: "target", position: import_react8.Position.Top }),
2754
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gamehub-drag-handle dragHandle__custom", children: [
2735
2755
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "gamehub-title", children: data?.label ?? "\u{1F3AE} \u0418\u0433\u0440\u043E\u0432\u043E\u0439 \u0445\u0430\u0431" }),
2736
2756
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "gamehub-subtitle", children: subtitleText })
2737
2757
  ] }),
@@ -2870,7 +2890,7 @@ var GameHubNode = (0, import_react7.memo)(({ id, data, selected, overlayMode = f
2870
2890
  ] }),
2871
2891
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "gamehub-game-wrap nodrag", children: active?.component })
2872
2892
  ] }) }),
2873
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react8.Handle, { type: "source", position: import_react8.Position.Bottom })
2893
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SafeHandle, { type: "source", position: import_react8.Position.Bottom })
2874
2894
  ] });
2875
2895
  });
2876
2896
  var GameHubNode_default = GameHubNode;
package/dist/index.mjs CHANGED
@@ -2455,6 +2455,26 @@ var GAME_NODE_SIZES = {
2455
2455
  pong: { width: 760, height: 780 },
2456
2456
  platformer: { width: 980, height: 750 }
2457
2457
  };
2458
+ var HandleErrorBoundary = class extends React7.Component {
2459
+ constructor(props) {
2460
+ super(props);
2461
+ this.state = { hasError: false };
2462
+ }
2463
+ static getDerivedStateFromError() {
2464
+ return { hasError: true };
2465
+ }
2466
+ componentDidCatch(err) {
2467
+ console.warn(
2468
+ "[reqct-gamehub-module] <Handle> crashed: React Flow store/provider not found for this render tree. This usually happens when the node is rendered outside <ReactFlow /> (palette/preview/portal) or when provider comes from a different React tree.",
2469
+ err
2470
+ );
2471
+ }
2472
+ render() {
2473
+ if (this.state.hasError) return null;
2474
+ return this.props.children;
2475
+ }
2476
+ };
2477
+ var SafeHandle = (props) => /* @__PURE__ */ jsx7(HandleErrorBoundary, { children: /* @__PURE__ */ jsx7(Handle, { ...props }) });
2458
2478
  var STATS_API_BASE = typeof import.meta !== "undefined" && import.meta.env && import.meta.env.VITE_STATS_API_URL || typeof process !== "undefined" && process.env && process.env.REACT_APP_STATS_API_URL || "http://localhost:4000";
2459
2479
  function getAuthFromStorage() {
2460
2480
  const token = localStorage.getItem("jwt") || localStorage.getItem("token") || localStorage.getItem("access_token") || localStorage.getItem("accessToken") || "";
@@ -2694,8 +2714,8 @@ var GameHubNode = memo(({ id, data, selected, overlayMode = false, overlayGameId
2694
2714
  }
2695
2715
  const subtitleText = view === "menu" ? menuTab === "stats" ? "\u041B\u0438\u0434\u0435\u0440\u0431\u043E\u0440\u0434\u044B: \u0442\u043E\u043F-10 \u043F\u043E \u0438\u0433\u0440\u0430\u043C" : "\u0412\u044B\u0431\u0435\u0440\u0438 \u0438\u0433\u0440\u0443" : `\u0422\u0435\u043A\u0443\u0449\u0430\u044F: ${active?.title || ""} \u2022 \u0421\u0447\u0451\u0442: ${currentScore}${currentGameStat ? ` \u2022 Best: ${currentGameStat.best} \u2022 Last: ${currentGameStat.last} \u2022 Plays: ${currentGameStat.plays}` : ""}`;
2696
2716
  return /* @__PURE__ */ jsxs7("div", { className: `gamehub-node ${selected ? "selected" : ""}`, children: [
2697
- /* @__PURE__ */ jsx7(Handle, { type: "target", position: Position.Top }),
2698
- /* @__PURE__ */ jsxs7("div", { className: "gamehub-drag-handle", children: [
2717
+ /* @__PURE__ */ jsx7(SafeHandle, { type: "target", position: Position.Top }),
2718
+ /* @__PURE__ */ jsxs7("div", { className: "gamehub-drag-handle dragHandle__custom", children: [
2699
2719
  /* @__PURE__ */ jsx7("div", { className: "gamehub-title", children: data?.label ?? "\u{1F3AE} \u0418\u0433\u0440\u043E\u0432\u043E\u0439 \u0445\u0430\u0431" }),
2700
2720
  /* @__PURE__ */ jsx7("div", { className: "gamehub-subtitle", children: subtitleText })
2701
2721
  ] }),
@@ -2834,7 +2854,7 @@ var GameHubNode = memo(({ id, data, selected, overlayMode = false, overlayGameId
2834
2854
  ] }),
2835
2855
  /* @__PURE__ */ jsx7("div", { className: "gamehub-game-wrap nodrag", children: active?.component })
2836
2856
  ] }) }),
2837
- /* @__PURE__ */ jsx7(Handle, { type: "source", position: Position.Bottom })
2857
+ /* @__PURE__ */ jsx7(SafeHandle, { type: "source", position: Position.Bottom })
2838
2858
  ] });
2839
2859
  });
2840
2860
  var GameHubNode_default = GameHubNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reqct-gamehub-module",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "GameHubNode for React Flow with mini-games + leaderboard UI",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",