@articles-media/articles-dev-box 1.0.35 → 1.0.37

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.
@@ -279,8 +279,8 @@ var useAds = (params) => {
279
279
  //#endregion
280
280
  //#region src/components/Ads/Ad.jsx
281
281
  var import_classnames = /* @__PURE__ */ __toESM(require_classnames(), 1);
282
- var AdDetailsModal = lazy(() => import("./AdDetailsModal-D2-4lh9e.js"));
283
- var AdConfirmExitModal = lazy(() => import("./AdConfirmExitModal-heFPJNdX.js"));
282
+ var AdDetailsModal = lazy(() => import("./AdDetailsModal-DNDxC0AS.js"));
283
+ var AdConfirmExitModal = lazy(() => import("./AdConfirmExitModal-C4PR4e_i.js"));
284
284
  function generateRandomInteger(min, max) {
285
285
  return Math.floor(Math.random() * (max - min + 1)) + min;
286
286
  }
package/dist/Ad.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as Ad_default } from "./Ad-BsG4C_lR.js";
1
+ import { t as Ad_default } from "./Ad-DluWOnz3.js";
2
2
  export { Ad_default as default };
@@ -20,12 +20,15 @@ function MobileMenu({ useStore, LeftPanelContent, menuBarConfig }) {
20
20
  })]
21
21
  });
22
22
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
23
- className: (0, import_classnames.default)("menu-bar", {
23
+ className: (0, import_classnames.default)(`menu-bar ${menuBarConfig.menuBarClassName || ""}`, {
24
24
  "card card-articles p-1 justify-content-center": menuBarConfig.style == "Bar",
25
25
  [menuBarConfig.style.replaceAll(" ", "_")]: menuBarConfig.style,
26
26
  [menuBarConfig.menuBarButtonPosition]: menuBarConfig.menuBarButtonPosition
27
27
  }),
28
- style: { ...menuBarConfig.style == "Bar" && { borderRadius: "0px" } },
28
+ style: {
29
+ ...menuBarConfig.menuBarCssStyle,
30
+ ...menuBarConfig.style == "Bar" && { borderRadius: "0px" }
31
+ },
29
32
  children: /* @__PURE__ */ jsxs("div", {
30
33
  className: "flex-header align-items-center",
31
34
  children: [
@@ -65,20 +68,30 @@ function MobileMenu({ useStore, LeftPanelContent, menuBarConfig }) {
65
68
  //#endregion
66
69
  //#region src/components/Games/GameMenu/GameMenu.jsx
67
70
  /**
68
- * @param {Object} props
69
- * @param {Function} props.useStore
70
- * @param {React.ComponentType} props.LeftPanelContent
71
- * @param {"Bar" | "Corner Button"} props.menuBarStyle
72
- * @param {"Static Panel" | "Floating Panel"} [props.sidebarStyle]
71
+ * @param {Object} props - The component props.
72
+ * @param {Function} props.useStore - The Zustand store hook used for state management.
73
+ * @param {React.ComponentType} props.LeftPanelContent - Component to render inside the sidebar and mobile-menu panel.
74
+ * @param {Object} props.sidebarConfig - Configuration for the sidebar appearance and behavior.
75
+ * @param {"Static Panel" | "Floating Panel"} props.sidebarConfig.style - Defines if the panel is static or floats over content.
76
+ * @param {string} [props.sidebarConfig.className] - Additional CSS class for the sidebar container.
77
+ * @param {Object} [props.sidebarConfig.cssStyle] - Inline styles to apply to the sidebar.
78
+ * @param {Object} props.menuBarConfig - Configuration for the navigation menu bar.
79
+ * @param {"Bar" | "Corner Button"} props.menuBarConfig.style - Visual style of the menu trigger (a full bar or a small corner button).
80
+ * @param {"left" | "right"} [props.menuBarConfig.menuBarButtonPosition] - Position of the menu button when using "Corner Button" style.
81
+ * @param {string} [props.menuBarConfig.menuBarClassName] - Additional CSS class for the menu bar.
82
+ * @param {Object} [props.menuBarConfig.menuBarCssStyle] - Inline styles to apply to the menu bar.
83
+ * @param {React.ComponentType} [props.menuBarConfig.leftSlotChildren] - Content to render in the left slot of the menu bar.
84
+ * @param {React.ComponentType} [props.menuBarConfig.centerSlotChildren] - Content to render in the center slot of the menu bar.
85
+ * @param {React.ComponentType} [props.menuBarConfig.rightSlotChildren] - Content to render in the right slot of the menu bar.
73
86
  */
74
87
  function GameMenu(props) {
75
- const { useStore, LeftPanelContent, sidebarStyleConfig, sidebarStyle, menuBarConfig, menuBarStyle, menuBarButtonPosition } = props;
88
+ const { useStore, LeftPanelContent, sidebarConfig, menuBarConfig } = props;
76
89
  const sidebar = useStore((state) => state.sidebar);
77
90
  const setShowMenu = useStore((state) => state.setShowMenu);
78
91
  useEffect(() => {
79
92
  if (sidebar == true) setShowMenu(false);
80
93
  }, [sidebar]);
81
- const convertedSidebarStyle = sidebarStyle.replaceAll(" ", "_");
94
+ const convertedSidebarStyle = (sidebarConfig?.style).replaceAll(" ", "_");
82
95
  if (!useStore) {
83
96
  console.error("GameMenu: useStore is required");
84
97
  return null;
@@ -86,21 +99,20 @@ function GameMenu(props) {
86
99
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MobileMenu, {
87
100
  useStore,
88
101
  LeftPanelContent,
89
- menuBarConfig: {
90
- ...menuBarConfig,
91
- style: menuBarConfig.style || menuBarStyle,
92
- menuBarButtonPosition: menuBarConfig.menuBarButtonPosition || menuBarButtonPosition
93
- }
102
+ menuBarConfig: { ...menuBarConfig }
94
103
  }), /* @__PURE__ */ jsx("div", {
95
- className: `panel-left card rounded-0 ${convertedSidebarStyle}`,
96
- style: { ...convertedSidebarStyle == "Floating_Panel" && {
97
- position: "absolute",
98
- top: "0.5rem",
99
- left: "0.5rem",
100
- zIndex: 1,
101
- height: "calc(100vh - 1rem)",
102
- backgroundColor: "color-mix(in srgb, var(--bs-card-bg) 50%, transparent)"
103
- } },
104
+ className: `panel-left card rounded-0 ${convertedSidebarStyle} ${sidebarConfig?.className || ""}`,
105
+ style: {
106
+ ...sidebarConfig?.cssStyle,
107
+ ...convertedSidebarStyle == "Floating_Panel" && {
108
+ position: "absolute",
109
+ top: "0.5rem",
110
+ left: "0.5rem",
111
+ zIndex: 1,
112
+ height: "calc(100vh - 1rem)",
113
+ backgroundColor: "color-mix(in srgb, var(--bs-card-bg) 50%, transparent)"
114
+ }
115
+ },
104
116
  children: /* @__PURE__ */ jsx(LeftPanelContent, {})
105
117
  })] });
106
118
  }
package/dist/GameMenu.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as GameMenu } from "./GameMenu-lHVT8MdJ.js";
1
+ import { t as GameMenu } from "./GameMenu-CyW1MF3Y.js";
2
2
  export { GameMenu as default };
@@ -1,2 +1,2 @@
1
- import { t as GameScoreboard } from "./GameScoreboard-DVoXXDnM.js";
1
+ import { t as GameScoreboard } from "./GameScoreboard-CYuTBE_E.js";
2
2
  export { GameScoreboard as default };
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { n as __toESM, t as require_classnames } from "./classnames-No-mjhw1.js";
3
- import { n as useMainSiteStatus, t as useAuthSiteStatus } from "./useAuthSiteStatus-ZK1GbPBV.js";
3
+ import { n as useMainSiteStatus, t as useAuthSiteStatus } from "./useAuthSiteStatus-D-D-KwEN.js";
4
4
  import { Suspense, lazy, memo, useState } from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/components/Global/GlobalBody.jsx
7
7
  var import_classnames = /* @__PURE__ */ __toESM(require_classnames(), 1);
8
- var StatusModal = lazy(() => import("./StatusModal-BXRbJQ10.js"));
8
+ var StatusModal = lazy(() => import("./StatusModal-DkHAimHp.js"));
9
9
  function GlobalBody(props) {
10
10
  const [statusModal, setStatusModal] = useState(false);
11
11
  const { data: mainSiteStatus, error: mainSiteStatusError, isLoading: mainSiteStatusLoading, mutate: mainSiteStatusMutate } = useMainSiteStatus({ disable: process.env.NODE_ENV !== "development" });
@@ -0,0 +1,102 @@
1
+ import { t as ArticlesButton } from "./Button-DvEZjsVV.js";
2
+ import SignInButton from "./SignInButton.js";
3
+ import useUserDetails from "./useUserDetails.js";
4
+ import useUserToken from "./useUserToken.js";
5
+ import { t as ViewUserModal } from "./ViewUserModal-Dgo1C4sR.js";
6
+ import FriendsList from "./FriendsList.js";
7
+ import { useState } from "react";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Modal } from "react-bootstrap";
10
+ //#region src/components/User/SignOutModal.jsx
11
+ function SignOutModal({ show, setShow, action }) {
12
+ return /* @__PURE__ */ jsxs(Modal, {
13
+ show,
14
+ size: "md",
15
+ className: `articles-modal`,
16
+ centered: true,
17
+ onHide: () => setShow(false),
18
+ children: [
19
+ /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: "Confirm Sign Out" }) }),
20
+ /* @__PURE__ */ jsx(Modal.Body, { children: "Are you sure you want to sign out? This will also sign you out on https://articles.media and other Articles Media services." }),
21
+ /* @__PURE__ */ jsxs(Modal.Footer, {
22
+ className: "justify-content-between",
23
+ children: [/* @__PURE__ */ jsxs(ArticlesButton, {
24
+ variant: "articles",
25
+ onClick: () => {
26
+ setShow(false);
27
+ },
28
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-redo me-2" }), /* @__PURE__ */ jsx("span", { children: "Cancel" })]
29
+ }), /* @__PURE__ */ jsxs(ArticlesButton, {
30
+ variant: "articles",
31
+ onClick: () => {
32
+ action();
33
+ setShow(false);
34
+ },
35
+ children: [/* @__PURE__ */ jsx("i", { className: "fad fa-times me-2" }), "Confirm"]
36
+ })]
37
+ })
38
+ ]
39
+ });
40
+ }
41
+ //#endregion
42
+ //#region src/components/User/SessionButton.jsx
43
+ function SessionButton({ port, friendsButton }) {
44
+ const { data: userToken, error: userTokenError, isLoading: userTokenLoading, mutate: userTokenMutate } = useUserToken(port);
45
+ const { data: userDetails, error: userDetailsError, isLoading: userDetailsLoading, mutate: userDetailsMutate } = useUserDetails({ token: userToken });
46
+ const [showFriendsModal, setShowFriendsModal] = useState(false);
47
+ const [confirmSignOut, setConfirmSignOut] = useState(false);
48
+ return /* @__PURE__ */ jsx(Fragment, { children: !userDetails ? /* @__PURE__ */ jsx(SignInButton, { className: "mb-2" }) : /* @__PURE__ */ jsxs("div", {
49
+ className: "w-100 d-flex align-items-stretch mb-2",
50
+ children: [
51
+ /* @__PURE__ */ jsx(ViewUserModal, {
52
+ buttonType: "Link",
53
+ className: "w-100",
54
+ children: /* @__PURE__ */ jsxs(ArticlesButton, {
55
+ className: "w-100",
56
+ small: true,
57
+ onClick: () => {
58
+ console.log("userDetails", userDetails);
59
+ },
60
+ children: [
61
+ /* @__PURE__ */ jsx("i", { className: "fad fa-sign-out" }),
62
+ "Logged in as ",
63
+ userDetails?.display_name || "Unknown User"
64
+ ]
65
+ })
66
+ }),
67
+ confirmSignOut && /* @__PURE__ */ jsx(SignOutModal, {
68
+ show: confirmSignOut,
69
+ setShow: setConfirmSignOut,
70
+ action: () => {
71
+ const logoutLink = `/api/signout?redirect=${encodeURIComponent(window.location.href)}`;
72
+ window.location.assign(logoutLink);
73
+ }
74
+ }),
75
+ showFriendsModal && /* @__PURE__ */ jsx(FriendsList, {
76
+ show: showFriendsModal,
77
+ setShow: setShowFriendsModal,
78
+ componentType: "modal"
79
+ }),
80
+ friendsButton && /* @__PURE__ */ jsx(ArticlesButton, {
81
+ className: "",
82
+ small: true,
83
+ title: "My Friends",
84
+ onClick: () => {
85
+ setShowFriendsModal(true);
86
+ },
87
+ children: /* @__PURE__ */ jsx("i", { className: "fad fa-users" })
88
+ }),
89
+ /* @__PURE__ */ jsx(ArticlesButton, {
90
+ className: "",
91
+ small: true,
92
+ title: "Sign out",
93
+ onClick: () => {
94
+ setConfirmSignOut(true);
95
+ },
96
+ children: /* @__PURE__ */ jsx("i", { className: "fad fa-sign-out" })
97
+ })
98
+ ]
99
+ }) });
100
+ }
101
+ //#endregion
102
+ export { SessionButton as t };
@@ -1,70 +1,7 @@
1
- import { t as ArticlesButton } from "./Button-DvEZjsVV.js";
2
- import SignInButton from "./SignInButton.js";
3
- import useUserDetails from "./useUserDetails.js";
4
- import useUserToken from "./useUserToken.js";
5
- import { t as ViewUserModal } from "./ViewUserModal-Dgo1C4sR.js";
6
- import FriendsList from "./FriendsList.js";
7
- import { useState } from "react";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
- //#region src/components/User/SessionButton.jsx
10
- function SessionButton({ port, friendsButton }) {
11
- const { data: userToken, error: userTokenError, isLoading: userTokenLoading, mutate: userTokenMutate } = useUserToken(port);
12
- const { data: userDetails, error: userDetailsError, isLoading: userDetailsLoading, mutate: userDetailsMutate } = useUserDetails({ token: userToken });
13
- const logoutLink = `/api/signout`;
14
- const [showFriendsModal, setShowFriendsModal] = useState(false);
15
- return /* @__PURE__ */ jsx(Fragment, { children: !userDetails ? /* @__PURE__ */ jsx(SignInButton, { className: "mb-2" }) : /* @__PURE__ */ jsxs("div", {
16
- className: "w-100 d-flex align-items-stretch mb-2",
17
- children: [
18
- /* @__PURE__ */ jsx(ViewUserModal, {
19
- buttonType: "Link",
20
- className: "w-100",
21
- children: /* @__PURE__ */ jsxs(ArticlesButton, {
22
- className: "w-100",
23
- small: true,
24
- onClick: () => {
25
- console.log("userDetails", userDetails);
26
- },
27
- children: [
28
- /* @__PURE__ */ jsx("i", { className: "fad fa-sign-out" }),
29
- "Logged in as ",
30
- userDetails?.display_name || "Unknown User"
31
- ]
32
- })
33
- }),
34
- showFriendsModal && /* @__PURE__ */ jsx(FriendsList, {
35
- show: showFriendsModal,
36
- setShow: setShowFriendsModal,
37
- componentType: "modal"
38
- }),
39
- friendsButton && /* @__PURE__ */ jsx(ArticlesButton, {
40
- className: "",
41
- small: true,
42
- title: "My Friends",
43
- onClick: () => {
44
- setShowFriendsModal(true);
45
- },
46
- children: /* @__PURE__ */ jsx("i", { className: "fad fa-users" })
47
- }),
48
- /* @__PURE__ */ jsx(ArticlesButton, {
49
- className: "",
50
- small: true,
51
- title: "Sign out",
52
- onClick: () => {
53
- fetch(logoutLink, {
54
- method: "GET",
55
- headers: {}
56
- }).then((response) => response.json()).then((data) => {
57
- console.log("Logout successful:", data);
58
- userTokenMutate(null);
59
- userDetailsMutate(null);
60
- }).catch((error) => {
61
- console.error("Logout error:", error);
62
- });
63
- },
64
- children: /* @__PURE__ */ jsx("i", { className: "fad fa-sign-out" })
65
- })
66
- ]
67
- }) });
68
- }
69
- //#endregion
1
+ "use client";
2
+ import "./SignInButton.js";
3
+ import "./useUserDetails.js";
4
+ import "./useUserToken.js";
5
+ import "./FriendsList.js";
6
+ import { t as SessionButton } from "./SessionButton-D3cupnzD.js";
70
7
  export { SessionButton as default };
@@ -232,7 +232,7 @@ function OtherTab({ useStore, config }) {
232
232
  var package_default = {
233
233
  name: "@articles-media/articles-dev-box",
234
234
  description: "Shared code, functions, and components for different Articles Media projects.",
235
- version: "1.0.35",
235
+ version: "1.0.37",
236
236
  type: "module",
237
237
  imports: { "#root/src/*": "./src/*" },
238
238
  main: "./dist/index.js",
@@ -300,25 +300,10 @@ var package_default = {
300
300
  //#endregion
301
301
  //#region src/components/Games/Settings/DebugTab.jsx
302
302
  function DebugTab({ useStore, config }) {
303
- useStore((state) => state?.debug);
304
- useStore((state) => state?.setDebug);
305
- useStore((state) => state?.toontownMode);
306
- useStore((state) => state?.setToontownMode);
307
- return /* @__PURE__ */ jsxs(Fragment, { children: [
308
- /* @__PURE__ */ jsxs("div", {
309
- className: "mb-3",
310
- children: ["dev-box version: ", package_default.version]
311
- }),
312
- /* @__PURE__ */ jsx("div", { children: "Future Thing" }),
313
- /* @__PURE__ */ jsx("div", {
314
- className: "mb-3",
315
- children: [false, true].map((level, i) => /* @__PURE__ */ jsx(ArticlesButton, {
316
- onClick: () => {},
317
- children: "Placeholder"
318
- }, i))
319
- }),
320
- config?.tabs?.Debug?.children
321
- ] });
303
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
304
+ className: "mb-3",
305
+ children: ["dev-box version: ", package_default.version]
306
+ }), config?.tabs?.Debug?.children && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", {}), config?.tabs?.Debug?.children] })] });
322
307
  }
323
308
  //#endregion
324
309
  //#region src/components/Games/Settings/SettingsModal.jsx
@@ -1,2 +1,2 @@
1
- import { t as SettingsModal } from "./SettingsModal-yJTqjsyc.js";
1
+ import { t as SettingsModal } from "./SettingsModal-DJ5jCjVW.js";
2
2
  export { SettingsModal as default };
@@ -1,5 +1,5 @@
1
1
  import { t as ArticlesButton } from "./Button-DvEZjsVV.js";
2
- import { n as useMainSiteStatus, t as useAuthSiteStatus } from "./useAuthSiteStatus-ZK1GbPBV.js";
2
+ import { n as useMainSiteStatus, t as useAuthSiteStatus } from "./useAuthSiteStatus-D-D-KwEN.js";
3
3
  import { useState } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { Modal } from "react-bootstrap";
package/dist/index.js CHANGED
@@ -3,16 +3,16 @@ 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-BsG4C_lR.js";
6
+ import { t as Ad_default } from "./Ad-DluWOnz3.js";
7
7
  import useUserFriends from "./useUserFriends.js";
8
8
  import FriendsList from "./FriendsList.js";
9
- import SessionButton from "./SessionButton.js";
9
+ import { t as SessionButton } from "./SessionButton-D3cupnzD.js";
10
10
  import ArticlesAd from "./ArticlesAd.js";
11
- import { t as GameMenu } from "./GameMenu-lHVT8MdJ.js";
12
- import { t as GameScoreboard } from "./GameScoreboard-DVoXXDnM.js";
11
+ import { t as GameMenu } from "./GameMenu-CyW1MF3Y.js";
12
+ import { t as GameScoreboard } from "./GameScoreboard-CYuTBE_E.js";
13
13
  import GlobalHead from "./GlobalHead.js";
14
14
  import GlobalBody_default from "./GlobalBody.js";
15
- import { t as SettingsModal } from "./SettingsModal-yJTqjsyc.js";
15
+ import { t as SettingsModal } from "./SettingsModal-DJ5jCjVW.js";
16
16
  import CreditsModal from "./CreditsModal.js";
17
17
  import DarkModeHandler from "./DarkModeHandler.js";
18
18
  import ToontownModeHandler from "./ToontownModeHandler.js";
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.35",
4
+ "version": "1.0.37",
5
5
  "type": "module",
6
6
  "imports": {
7
7
  "#root/src/*": "./src/*"