@articles-media/articles-dev-box 1.0.40 → 1.0.42

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/README.md CHANGED
@@ -67,6 +67,8 @@ npm run dev
67
67
  - Handles setting zustand state from url params if toontownMode is passed.
68
68
  - SocketServerUrlHandler
69
69
  - Handles setting socket server state from url params if socketServerUrl is passed.
70
+ - HasNoMouseHandler
71
+ - Sets hasNoMouse and isTouchCapable on first load
70
72
  - useUserToken
71
73
  - Hook for getting the subdomain auth token.
72
74
  - useUserDetails
@@ -438,7 +438,7 @@ function Ad(props) {
438
438
  className: "icon d-none",
439
439
  children: /* @__PURE__ */ jsx("i", { className: "fas fa-mug-hot" })
440
440
  }),
441
- /* @__PURE__ */ jsx("img", {
441
+ (ad?.background?.key || previewData?.background?.key) && /* @__PURE__ */ jsx("img", {
442
442
  className: "photo",
443
443
  src: previewData?.background?.key ? `${process.env.NEXT_PUBLIC_CDN}${previewData.background?.key}` : `${process.env.NEXT_PUBLIC_CDN}${ad?.background?.key}`,
444
444
  alt: ""
package/dist/Ad.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as Ad_default } from "./Ad-DluWOnz3.js";
1
+ import { t as Ad_default } from "./Ad-bic8syS1.js";
2
2
  export { Ad_default as default };
@@ -69,9 +69,12 @@ function CreditsModal({ show, setShow, useStore, owner, repo, developers, publis
69
69
  children: [/* @__PURE__ */ jsx("i", { className: "fad fa-browser me-2" }), /* @__PURE__ */ jsx("span", { children: "View Website" })]
70
70
  })
71
71
  })] }),
72
- owner && repo && /* @__PURE__ */ jsxs("div", {
72
+ (owner && repo || process.env.NEXT_PUBLIC_OWNER && process.env.NEXT_PUBLIC_REPO) && /* @__PURE__ */ jsxs("div", {
73
73
  className: "mb-3",
74
- children: [/* @__PURE__ */ jsx("div", { children: "Attributions:" }), /* @__PURE__ */ jsx("a", {
74
+ children: [/* @__PURE__ */ jsx("h6", {
75
+ className: "mb-2",
76
+ children: "Attributions:"
77
+ }), /* @__PURE__ */ jsx("a", {
75
78
  href: `https://github.com/${owner || process.env.NEXT_PUBLIC_OWNER}/${repo || process.env.NEXT_PUBLIC_REPO}/blob/main/README.md#attributions`,
76
79
  target: "_blank",
77
80
  rel: "noopener noreferrer",
@@ -7,18 +7,6 @@ var import_classnames = /* @__PURE__ */ __toESM(require_classnames(), 1);
7
7
  function MobileMenu({ useStore, LeftPanelContent, menuBarConfig }) {
8
8
  const showMenu = useStore((state) => state.showMenu);
9
9
  const setShowMenu = useStore((state) => state.setShowMenu);
10
- const MenuButton = () => /* @__PURE__ */ jsxs(ArticlesButton, {
11
- small: true,
12
- active: showMenu,
13
- onClick: () => {
14
- setShowMenu(!showMenu);
15
- },
16
- className: "d-flex",
17
- children: [/* @__PURE__ */ jsx("i", { className: "fad fa-bars" }), /* @__PURE__ */ jsx("span", {
18
- className: "text",
19
- children: "Menu"
20
- })]
21
- });
22
10
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
23
11
  className: (0, import_classnames.default)(`menu-bar ${menuBarConfig.menuBarClassName || ""}`, {
24
12
  "card card-articles p-1 justify-content-center": menuBarConfig.style == "Bar",
@@ -30,19 +18,28 @@ function MobileMenu({ useStore, LeftPanelContent, menuBarConfig }) {
30
18
  ...menuBarConfig.style == "Bar" && { borderRadius: "0px" }
31
19
  },
32
20
  children: /* @__PURE__ */ jsxs("div", {
33
- className: "flex-header align-items-center",
21
+ className: "menu-bar-container flex-header align-items-center",
34
22
  children: [
35
23
  /* @__PURE__ */ jsxs("div", {
36
24
  className: "Left d-flex align-items-center",
37
- children: [(menuBarConfig.menuBarButtonPosition == "Left" || !menuBarConfig.menuBarButtonPosition) && /* @__PURE__ */ jsx(MenuButton, {}), menuBarConfig.leftSlotChildren && menuBarConfig.leftSlotChildren]
25
+ children: [(menuBarConfig.menuBarButtonPosition == "Left" || !menuBarConfig.menuBarButtonPosition) && /* @__PURE__ */ jsx(MenuButton, {
26
+ useStore,
27
+ menuBarConfig
28
+ }), menuBarConfig.leftSlotChildren && menuBarConfig.leftSlotChildren]
38
29
  }),
39
30
  /* @__PURE__ */ jsxs("div", {
40
31
  className: "Center d-flex align-items-center",
41
- children: [menuBarConfig.menuBarButtonPosition == "Center" && /* @__PURE__ */ jsx(MenuButton, {}), menuBarConfig.centerSlotChildren && menuBarConfig.centerSlotChildren]
32
+ children: [menuBarConfig.menuBarButtonPosition == "Center" && /* @__PURE__ */ jsx(MenuButton, {
33
+ useStore,
34
+ menuBarConfig
35
+ }), menuBarConfig.centerSlotChildren && menuBarConfig.centerSlotChildren]
42
36
  }),
43
37
  /* @__PURE__ */ jsxs("div", {
44
38
  className: "Right d-flex align-items-center",
45
- children: [menuBarConfig.menuBarButtonPosition == "Right" && /* @__PURE__ */ jsx(MenuButton, {}), menuBarConfig.rightSlotChildren && menuBarConfig.rightSlotChildren]
39
+ children: [menuBarConfig.menuBarButtonPosition == "Right" && /* @__PURE__ */ jsx(MenuButton, {
40
+ useStore,
41
+ menuBarConfig
42
+ }), menuBarConfig.rightSlotChildren && menuBarConfig.rightSlotChildren]
46
43
  })
47
44
  ]
48
45
  })
@@ -65,6 +62,29 @@ function MobileMenu({ useStore, LeftPanelContent, menuBarConfig }) {
65
62
  })
66
63
  })] });
67
64
  }
65
+ function MenuButton({ useStore, menuBarConfig }) {
66
+ const showMenu = useStore((state) => state.showMenu);
67
+ const setShowMenu = useStore((state) => state.setShowMenu);
68
+ const setShowSettingsModal = useStore((state) => state.setShowSettingsModal);
69
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(ArticlesButton, {
70
+ small: true,
71
+ active: showMenu,
72
+ onClick: () => {
73
+ console.log("Menu button clicked, toggling menu visibility");
74
+ setShowMenu(!showMenu);
75
+ },
76
+ className: "d-flex",
77
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-bars" }), /* @__PURE__ */ jsx("span", {
78
+ className: "text",
79
+ children: "Menu"
80
+ })]
81
+ }), menuBarConfig?.settingsWithMenuButton && /* @__PURE__ */ jsx(ArticlesButton, {
82
+ onClick: () => {
83
+ setShowSettingsModal(true);
84
+ },
85
+ children: /* @__PURE__ */ jsx("i", { className: "fad fa-cog" })
86
+ })] });
87
+ }
68
88
  //#endregion
69
89
  //#region src/components/Games/GameMenu/GameMenu.jsx
70
90
  /**
package/dist/GameMenu.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as GameMenu } from "./GameMenu-CyW1MF3Y.js";
1
+ import { t as GameMenu } from "./GameMenu-DeFdYvvR.js";
2
2
  export { GameMenu as default };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ import { Fragment, jsx } from "react/jsx-runtime";
4
+ //#region src/components/Handlers/HasNoMouseHandler.jsx
5
+ function HasNoMouseHandler({ useStore }) {
6
+ const hasHydrated = useStore((state) => state._hasHydrated);
7
+ const hasNoMouse = useStore((state) => state.hasNoMouse);
8
+ const setHasNoMouse = useStore((state) => state.setHasNoMouse);
9
+ const isTouchCapable = useStore((state) => state.isTouchCapable);
10
+ const setIsTouchCapable = useStore((state) => state.setIsTouchCapable);
11
+ useEffect(() => {
12
+ if (!hasHydrated) return;
13
+ if (hasNoMouse === null) {
14
+ const hasMouse = window.matchMedia("(pointer: fine)").matches;
15
+ setHasNoMouse(!hasMouse);
16
+ }
17
+ if (isTouchCapable === null) setIsTouchCapable("ontouchstart" in window || navigator.maxTouchPoints > 0);
18
+ }, [
19
+ hasHydrated,
20
+ hasNoMouse,
21
+ isTouchCapable,
22
+ setHasNoMouse,
23
+ setIsTouchCapable
24
+ ]);
25
+ return /* @__PURE__ */ jsx(Fragment, {});
26
+ }
27
+ //#endregion
28
+ export { HasNoMouseHandler as default };
@@ -89,9 +89,12 @@ function AudioTab({ useAudioStore, config }) {
89
89
  /* @__PURE__ */ jsx("div", {
90
90
  className: "border mb-3 p-2",
91
91
  children: config?.tabs?.Audio?.sliders?.map((slider_obj) => {
92
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Form.Label, {
92
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs(Form.Label, {
93
93
  className: "mb-0",
94
- children: slider_obj.label
94
+ children: [/* @__PURE__ */ jsx("span", { children: slider_obj.label }), audioSettings?.[slider_obj.key] && /* @__PURE__ */ jsxs("span", {
95
+ className: "ms-2 text-muted",
96
+ children: [audioSettings[slider_obj.key], "%"]
97
+ })]
95
98
  }), /* @__PURE__ */ jsx(Form.Range, {
96
99
  value: audioSettings?.[slider_obj.key],
97
100
  onChange: (value) => {
@@ -103,7 +106,7 @@ function AudioTab({ useAudioStore, config }) {
103
106
  })] }, slider_obj.key);
104
107
  })
105
108
  }),
106
- config?.tabs?.Controls?.children
109
+ config?.tabs?.Audio?.children
107
110
  ] });
108
111
  }
109
112
  //#endregion
@@ -163,7 +166,7 @@ function SocketSettings({ useStore }) {
163
166
  function ControlsTab({ useTouchControlsStore, config }) {
164
167
  return /* @__PURE__ */ jsxs("div", {
165
168
  className: "",
166
- children: [useTouchControlsStore && /* @__PURE__ */ jsx(TouchControls, { useTouchControlsStore }), config?.tabs?.Controls?.children]
169
+ children: [useTouchControlsStore && config?.tabs?.Controls?.touchControls && /* @__PURE__ */ jsx(TouchControls, { useTouchControlsStore }), config?.tabs?.Controls?.children]
167
170
  });
168
171
  }
169
172
  function TouchControls({ useTouchControlsStore }) {
@@ -232,7 +235,7 @@ function OtherTab({ useStore, config }) {
232
235
  var package_default = {
233
236
  name: "@articles-media/articles-dev-box",
234
237
  description: "Shared code, functions, and components for different Articles Media projects.",
235
- version: "1.0.40",
238
+ version: "1.0.42",
236
239
  type: "module",
237
240
  imports: { "#root/src/*": "./src/*" },
238
241
  main: "./dist/index.js",
@@ -261,6 +264,7 @@ var package_default = {
261
264
  "./DarkModeHandler": "./dist/DarkModeHandler.js",
262
265
  "./ToontownModeHandler": "./dist/ToontownModeHandler.js",
263
266
  "./SocketServerUrlHandler": "./dist/SocketServerUrlHandler.js",
267
+ "./HasNoMouseHandler": "./dist/HasNoMouseHandler.js",
264
268
  "./FriendsList": "./dist/FriendsList.js",
265
269
  "./useUserDetails": "./dist/useUserDetails.js",
266
270
  "./useUserToken": "./dist/useUserToken.js",
@@ -303,10 +307,26 @@ var package_default = {
303
307
  //#endregion
304
308
  //#region src/components/Games/Settings/DebugTab.jsx
305
309
  function DebugTab({ useStore, config }) {
306
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
307
- className: "mb-3",
308
- children: ["dev-box version: ", package_default.version]
309
- }), config?.tabs?.Debug?.children && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", {}), config?.tabs?.Debug?.children] })] });
310
+ const showStats = useStore((state) => state?.debugConfig?.showStats);
311
+ const setDebugConfigKey = useStore((state) => state?.setDebugConfigKey);
312
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
313
+ /* @__PURE__ */ jsxs("div", {
314
+ className: "mb-3",
315
+ children: ["dev-box version: ", package_default.version]
316
+ }),
317
+ /* @__PURE__ */ jsx("div", { children: "Show Debug Stats" }),
318
+ /* @__PURE__ */ jsx("div", {
319
+ className: "mb-3",
320
+ children: [false, true].map((level, i) => /* @__PURE__ */ jsx(ArticlesButton, {
321
+ active: showStats === level,
322
+ onClick: () => {
323
+ setDebugConfigKey("showStats", level);
324
+ },
325
+ children: level ? "Enabled" : "Disabled"
326
+ }, i))
327
+ }),
328
+ config?.tabs?.Debug?.children && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", {}), config?.tabs?.Debug?.children] })
329
+ ] });
310
330
  }
311
331
  //#endregion
312
332
  //#region src/components/Games/Settings/SettingsModal.jsx
@@ -1,2 +1,2 @@
1
- import { t as SettingsModal } from "./SettingsModal-D60ZKYrb.js";
1
+ import { t as SettingsModal } from "./SettingsModal-B7EJA7mn.js";
2
2
  export { SettingsModal as default };
@@ -303,6 +303,14 @@
303
303
  margin-right: 0;
304
304
  font-size: 1.25rem;
305
305
  }
306
+ @media (min-width: 992px) {
307
+ .menu-bar .menu-bar-container .Center {
308
+ position: absolute;
309
+ top: 50%;
310
+ left: 50%;
311
+ transform: translate(-50%, -50%);
312
+ }
313
+ }
306
314
 
307
315
  .mobile-menu {
308
316
  position: fixed;
package/dist/index.js CHANGED
@@ -3,24 +3,25 @@ import SignInButton from "./SignInButton.js";
3
3
  import useUserDetails from "./useUserDetails.js";
4
4
  import useUserToken from "./useUserToken.js";
5
5
  import { t as ViewUserModal } from "./ViewUserModal-Dgo1C4sR.js";
6
- import { t as Ad_default } from "./Ad-DluWOnz3.js";
6
+ import { t as Ad_default } from "./Ad-bic8syS1.js";
7
7
  import useUserFriends from "./useUserFriends.js";
8
8
  import FriendsList from "./FriendsList.js";
9
9
  import { t as SessionButton } from "./SessionButton-D3cupnzD.js";
10
10
  import ArticlesAd from "./ArticlesAd.js";
11
- import { t as GameMenu } from "./GameMenu-CyW1MF3Y.js";
11
+ import { t as GameMenu } from "./GameMenu-DeFdYvvR.js";
12
12
  import useFullscreen from "./useFullscreen.js";
13
13
  import PrimaryButtonGroup from "./GameMenuPrimaryButtonGroup.js";
14
14
  import NicknameInput from "./NicknameInput.js";
15
15
  import { t as GameScoreboard } from "./GameScoreboard-CYuTBE_E.js";
16
16
  import GlobalHead from "./GlobalHead.js";
17
17
  import GlobalBody_default from "./GlobalBody.js";
18
- import { t as SettingsModal } from "./SettingsModal-D60ZKYrb.js";
18
+ import { t as SettingsModal } from "./SettingsModal-B7EJA7mn.js";
19
19
  import CreditsModal from "./CreditsModal.js";
20
20
  import DarkModeHandler from "./DarkModeHandler.js";
21
21
  import ToontownModeHandler from "./ToontownModeHandler.js";
22
22
  import SocketServerUrlHandler from "./SocketServerUrlHandler.js";
23
+ import HasNoMouseHandler from "./HasNoMouseHandler.js";
23
24
  import typicalZustandStoreExcludes from "./typicalZustandStoreExcludes.js";
24
25
  import typicalZustandStoreStateSlice from "./typicalZustandStoreStateSlice.js";
25
26
  import getSignOutRedirectUrl from "./getSignOutRedirectUrl.js";
26
- export { Ad_default as Ad, ArticlesAd, CreditsModal, DarkModeHandler, FriendsList, GameMenu, PrimaryButtonGroup as GameMenuPrimaryButtonGroup, GameScoreboard, GlobalBody_default as GlobalBody, GlobalHead, NicknameInput, ReturnToLauncherButton, SessionButton, SettingsModal, SignInButton, SocketServerUrlHandler, ToontownModeHandler, ViewUserModal, getSignOutRedirectUrl, typicalZustandStoreExcludes, typicalZustandStoreStateSlice, useFullscreen, useUserDetails, useUserFriends, useUserToken };
27
+ export { Ad_default as Ad, ArticlesAd, CreditsModal, DarkModeHandler, FriendsList, GameMenu, PrimaryButtonGroup as GameMenuPrimaryButtonGroup, GameScoreboard, GlobalBody_default as GlobalBody, GlobalHead, HasNoMouseHandler, NicknameInput, ReturnToLauncherButton, SessionButton, SettingsModal, SignInButton, SocketServerUrlHandler, ToontownModeHandler, ViewUserModal, getSignOutRedirectUrl, typicalZustandStoreExcludes, typicalZustandStoreStateSlice, useFullscreen, useUserDetails, useUserFriends, useUserToken };
@@ -25,6 +25,16 @@ var typicalZustandStoreStateSlice = (set, get, generateRandomNickname) => ({
25
25
  setDebug: (newValue) => {
26
26
  set((prev) => ({ debug: newValue }));
27
27
  },
28
+ debugConfig: { showStats: false },
29
+ setDebugConfig: (newValue) => {
30
+ set((prev) => ({ debugConfig: { ...newValue } }));
31
+ },
32
+ setDebugConfigKey: (key, value) => {
33
+ set((prev) => ({ debugConfig: {
34
+ ...prev.debugConfig,
35
+ [key]: value
36
+ } }));
37
+ },
28
38
  sidebar: true,
29
39
  toggleSidebar: () => {
30
40
  set((prev) => ({ sidebar: !prev.sidebar }));
@@ -77,7 +87,11 @@ var typicalZustandStoreStateSlice = (set, get, generateRandomNickname) => ({
77
87
  },
78
88
  reloadScene: () => {
79
89
  set((prev) => ({ sceneKey: prev.sceneKey + 1 }));
80
- }
90
+ },
91
+ hasNoMouse: null,
92
+ setHasNoMouse: (value) => set({ hasNoMouse: value }),
93
+ isTouchCapable: null,
94
+ setIsTouchCapable: (value) => set({ isTouchCapable: value })
81
95
  });
82
96
  //#endregion
83
97
  export { typicalZustandStoreStateSlice as default };
@@ -1,6 +1,9 @@
1
1
  import useSWR from "swr";
2
2
  //#region src/hooks/User/useUserToken.js
3
- var fetcher = (url) => fetch(url).then((res) => res.json());
3
+ var fetcher = (url) => fetch(url).then((res) => {
4
+ if (res.status !== 200) return false;
5
+ return res.json();
6
+ });
4
7
  var useUserToken = (port) => {
5
8
  const { data, error, isLoading, mutate } = useSWR(process.env.NODE_ENV === "development" ? `http://localhost:${port}/api/token` : "/api/token", fetcher, {
6
9
  revalidateOnFocus: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@articles-media/articles-dev-box",
3
3
  "description": "Shared code, functions, and components for different Articles Media projects.",
4
- "version": "1.0.40",
4
+ "version": "1.0.42",
5
5
  "type": "module",
6
6
  "imports": {
7
7
  "#root/src/*": "./src/*"
@@ -34,6 +34,7 @@
34
34
  "./DarkModeHandler": "./dist/DarkModeHandler.js",
35
35
  "./ToontownModeHandler": "./dist/ToontownModeHandler.js",
36
36
  "./SocketServerUrlHandler": "./dist/SocketServerUrlHandler.js",
37
+ "./HasNoMouseHandler": "./dist/HasNoMouseHandler.js",
37
38
  "./FriendsList": "./dist/FriendsList.js",
38
39
  "./useUserDetails": "./dist/useUserDetails.js",
39
40
  "./useUserToken": "./dist/useUserToken.js",