@articles-media/articles-dev-box 1.0.26 → 1.0.28

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
@@ -37,6 +37,8 @@ npm run dev
37
37
 
38
38
  - ReturnToLauncherButton
39
39
  - For bringing users back to their state in the games showcase/launcher
40
+ - SignInButton
41
+ - For bringing users to the accounts service to login at and redirecting back
40
42
  - GameScoreboard
41
43
  - Scoreboard for registered games that links with a user's Articles Media account.
42
44
  - Ad
@@ -53,6 +55,10 @@ npm run dev
53
55
  - All in one component to handle game credits UI across multiple games.
54
56
  - DarkModeHandler
55
57
  - Consumes a Zustand store, detects prefers-color-scheme, sets data-bs-theme on body element.
58
+ - ToontownModeHandler
59
+ - Handles setting zustand state from url params if toontownMode is passed.
60
+ - SocketServerUrlHandler
61
+ - Handles setting socket server state from url params if socketServerUrl is passed.
56
62
  - useUserToken
57
63
  - Hook for getting the subdomain auth token.
58
64
  - useUserDetails
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./Button-C8R7Qxqb.js";
2
- import { t } from "./ViewUserModal-BbphE2vW.js";
2
+ import { t } from "./ViewUserModal-CrGeXxWG.js";
3
3
  import { useEffect as n, useState as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  import o from "swr";
@@ -1,2 +1,2 @@
1
- import { t as e } from "./GameScoreboard-DID7b4kw.js";
1
+ import { t as e } from "./GameScoreboard-pTQKozrD.js";
2
2
  export { e as default };
@@ -4,7 +4,7 @@ import { n, t as r } from "./useAuthSiteStatus-Cj9IjMj7.js";
4
4
  import { Suspense as i, lazy as a, memo as o, useState as s } from "react";
5
5
  import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
6
  //#region src/components/Global/GlobalBody.jsx
7
- var d = /* @__PURE__ */ e(t(), 1), f = a(() => import("./StatusModal-BrBJnAXD.js"));
7
+ var d = /* @__PURE__ */ e(t(), 1), f = a(() => import("./StatusModal-CM9gjtT8.js"));
8
8
  function p(e) {
9
9
  let [t, a] = s(!1), { data: o, error: p, isLoading: m, mutate: h } = n({ disable: process.env.NODE_ENV !== "development" }), { data: g, error: _, isLoading: v, mutate: y } = r({ disable: process.env.NODE_ENV !== "development" });
10
10
  return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("link", {
@@ -95,33 +95,42 @@ function c({ useAudioStore: t, config: o }) {
95
95
  }
96
96
  //#endregion
97
97
  //#region src/components/Games/Settings/MultiplayerTab.jsx
98
- function l({ useStore: t }) {
99
- let n = t((e) => e.socketServerHost), o = t((e) => e.setSocketServerHost);
98
+ function l({ useStore: t, config: n }) {
99
+ let o = t((e) => e.serverUrl), s = t((e) => e.setServerUrl), c = t((e) => e.connected), l = t((e) => e.connectSocket), u = t((e) => e.disconnectSocket);
100
100
  return /* @__PURE__ */ i("div", {
101
- className: "p-2",
101
+ className: "",
102
102
  children: [
103
- /* @__PURE__ */ r(a.Label, {
103
+ /* @__PURE__ */ i(a.Label, {
104
104
  className: "mb-0",
105
- children: "Socket Server Host"
105
+ children: [/* @__PURE__ */ i("div", { children: ["Status: ", /* @__PURE__ */ r("span", {
106
+ className: `badge ${c ? "bg-success" : "bg-danger"}`,
107
+ children: c ? "Online" : "Offline"
108
+ })] }), "Socket Server Host"]
106
109
  }),
107
110
  /* @__PURE__ */ r(a.Control, {
108
111
  type: "text",
109
- value: n,
110
- onChange: (e) => o(e.target.value)
112
+ value: o,
113
+ onChange: (e) => s(e.target.value)
111
114
  }),
112
115
  /* @__PURE__ */ r(a.Label, {
113
116
  className: "mb-0",
114
117
  children: "Edit this to connect to a different multiplayer host!"
115
118
  }),
116
- /* @__PURE__ */ i("div", {
119
+ /* @__PURE__ */ r("div", {
117
120
  className: "mt-3",
118
- children: [/* @__PURE__ */ r(e, {
119
- className: "mb-1",
120
- children: "Retry"
121
- }), /* @__PURE__ */ i("div", { children: ["Status: ", /* @__PURE__ */ r("span", {
122
- className: "badge bg-danger",
123
- children: "Offline"
124
- })] })]
121
+ children: c ? /* @__PURE__ */ r(e, {
122
+ className: "",
123
+ onClick: () => {
124
+ u();
125
+ },
126
+ children: "Disconnect"
127
+ }) : /* @__PURE__ */ r(e, {
128
+ className: "",
129
+ onClick: () => {
130
+ l();
131
+ },
132
+ children: "Connect"
133
+ })
125
134
  })
126
135
  ]
127
136
  });
@@ -129,53 +138,82 @@ function l({ useStore: t }) {
129
138
  //#endregion
130
139
  //#region src/components/Games/Settings/ControlsTab.jsx
131
140
  function u({ useTouchControlsStore: e }) {
132
- return /* @__PURE__ */ i("div", {
133
- className: "p-3",
134
- children: [/* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("h5", { children: "Control Settings" }), /* @__PURE__ */ r("p", { children: "Configure your key bindings and control preferences here." })] }), e && /* @__PURE__ */ r(d, { useTouchControlsStore: e })]
141
+ return /* @__PURE__ */ r("div", {
142
+ className: "",
143
+ children: e && /* @__PURE__ */ r(d, { useTouchControlsStore: e })
135
144
  });
136
145
  }
137
- function d({ useTouchControlsStore: e }) {
138
- let t = e((e) => e.touchControls), n = e((e) => e.setTouchControls);
139
- return /* @__PURE__ */ r("div", {
146
+ function d({ useTouchControlsStore: t }) {
147
+ let n = t((e) => e?.enabled), a = t((e) => e?.setEnabled);
148
+ return /* @__PURE__ */ i("div", {
140
149
  className: "mb-3",
141
- children: [!1, !0].map((e, i) => /* @__PURE__ */ r(ArticlesButton, {
142
- active: t === e,
143
- onClick: () => {
144
- n(e);
145
- },
146
- children: e ? "On" : "Off"
147
- }, i))
150
+ children: [
151
+ /* @__PURE__ */ r("div", { children: "Touch Controls" }),
152
+ /* @__PURE__ */ r("div", {
153
+ className: "small mb-1",
154
+ children: "Adds on screen controls for touch devices."
155
+ }),
156
+ /* @__PURE__ */ r("div", {
157
+ className: "mb-3",
158
+ children: [!1, !0].map((t, i) => /* @__PURE__ */ r(e, {
159
+ active: n === t,
160
+ onClick: () => {
161
+ a(t);
162
+ },
163
+ children: t ? "On" : "Off"
164
+ }, i))
165
+ })
166
+ ]
148
167
  });
149
168
  }
150
169
  //#endregion
151
170
  //#region src/components/Games/Settings/OtherTab.jsx
152
- function f({ useStore: t, children: a }) {
153
- let o = t((e) => e?.debug), s = t((e) => e?.setDebug);
171
+ function f({ useStore: t, config: a, children: o }) {
172
+ let s = t((e) => e?.debug), c = t((e) => e?.setDebug), l = t((e) => e?.toontownMode), u = t((e) => e?.setToontownMode);
154
173
  return /* @__PURE__ */ i(n, { children: [
155
174
  /* @__PURE__ */ r("div", { children: "Debug Mode" }),
156
175
  /* @__PURE__ */ r("div", {
157
176
  className: "mb-3",
158
177
  children: [!1, !0].map((t, n) => /* @__PURE__ */ r(e, {
159
- active: o === t,
178
+ active: s === t,
160
179
  onClick: () => {
161
- s(t);
180
+ c(t);
162
181
  },
163
182
  children: t ? "On" : "Off"
164
183
  }, n))
165
184
  }),
166
- a && /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("div", {
185
+ a?.tabs?.Other?.toontownMode && /* @__PURE__ */ i(n, { children: [
186
+ /* @__PURE__ */ r("div", { children: "Toontown Mode" }),
187
+ /* @__PURE__ */ r("div", {
188
+ className: "small mb-1",
189
+ children: "Mimics Toontown Online graphics."
190
+ }),
191
+ /* @__PURE__ */ r("div", {
192
+ className: "mb-3",
193
+ children: [!1, !0].map((t, n) => /* @__PURE__ */ r(e, {
194
+ active: l === t,
195
+ onClick: () => {
196
+ u(t);
197
+ },
198
+ children: t ? "On" : "Off"
199
+ }, n))
200
+ })
201
+ ] }),
202
+ o && /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("div", {
167
203
  className: "mb-3",
168
204
  children: "Other Settings"
169
205
  }), /* @__PURE__ */ r("div", {
170
206
  className: "mb-3",
171
- children: a
207
+ children: o
172
208
  })] })
173
209
  ] });
174
210
  }
175
211
  //#endregion
176
212
  //#region src/components/Games/Settings/SettingsModal.jsx
177
- function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsStore: m, config: h }) {
178
- let [g, _] = t(!1), [v, y] = t("Graphics");
213
+ function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsStore: m, useSocketStore: h, config: g }) {
214
+ let [_, v] = t(!1), [y, b] = t(localStorage.getItem("articles_settings_tab") || "Graphics"), x = (e) => {
215
+ b(e), localStorage.setItem("articles_settings_tab", e);
216
+ };
179
217
  return d((e) => e.darkMode), d((e) => e.setDarkMode), d((e) => e.arcadeMode), d((e) => e.setArcadeMode), /* @__PURE__ */ i(o, {
180
218
  className: "articles-modal",
181
219
  size: "md",
@@ -203,35 +241,38 @@ function p({ show: n, setShow: a, store: d, useAudioStore: p, useTouchControlsSt
203
241
  "Multiplayer",
204
242
  "Other"
205
243
  ].map((t) => /* @__PURE__ */ r(e, {
206
- active: v == t,
244
+ active: y == t,
207
245
  onClick: () => {
208
- y(t);
246
+ x(t);
209
247
  },
210
248
  children: t
211
249
  }, t))
212
250
  }),
213
251
  /* @__PURE__ */ r("hr", { className: "my-0" }),
214
252
  /* @__PURE__ */ i("div", {
215
- className: "p-2",
253
+ className: "p-3",
216
254
  children: [
217
- v == "Controls" && /* @__PURE__ */ r(u, {
255
+ y == "Controls" && /* @__PURE__ */ r(u, {
218
256
  useStore: d,
219
257
  useTouchControlsStore: m,
220
- config: h
258
+ config: g
221
259
  }),
222
- v == "Graphics" && /* @__PURE__ */ r(s, {
260
+ y == "Graphics" && /* @__PURE__ */ r(s, {
223
261
  useStore: d,
224
- config: h
262
+ config: g
225
263
  }),
226
- v == "Audio" && /* @__PURE__ */ r(c, {
264
+ y == "Audio" && /* @__PURE__ */ r(c, {
227
265
  useAudioStore: p,
228
- config: h
266
+ config: g
229
267
  }),
230
- v == "Multiplayer" && /* @__PURE__ */ r(l, {
231
- useStore: d,
232
- config: h
268
+ y == "Multiplayer" && /* @__PURE__ */ r(l, {
269
+ useStore: h,
270
+ config: g
233
271
  }),
234
- v == "Other" && /* @__PURE__ */ r(f, { useStore: d })
272
+ y == "Other" && /* @__PURE__ */ r(f, {
273
+ useStore: d,
274
+ config: g
275
+ })
235
276
  ]
236
277
  })
237
278
  ]
@@ -1,2 +1,2 @@
1
- import { t as e } from "./SettingsModal-DYcHm28E.js";
1
+ import { t as e } from "./SettingsModal-DZmAGhAO.js";
2
2
  export { e as default };
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { t as e } from "./Button-C8R7Qxqb.js";
3
+ import { useEffect as t, useState as n } from "react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/components/User/SignInButton.jsx
6
+ function a({ className: a, id: o, text: s }) {
7
+ let [c, l] = n(!1), u = process.env.NODE_ENV === "development" ? "http://localhost:3012" : "https://accounts.articles.media", [d, f] = n(`${u}/login`);
8
+ return t(() => {
9
+ l(!0);
10
+ let e = window.location.pathname, t = window.location.search;
11
+ f(`${u}/login?redirect=${encodeURIComponent(window.location.origin + e + t)}&type=subdomain`);
12
+ }, [u]), /* @__PURE__ */ r("a", {
13
+ href: d,
14
+ rel: "noopener noreferrer",
15
+ children: /* @__PURE__ */ i(e, {
16
+ className: `${a} w-100`,
17
+ id: o,
18
+ small: !0,
19
+ style: {
20
+ zIndex: 10,
21
+ position: "relative"
22
+ },
23
+ onClick: () => {},
24
+ children: [/* @__PURE__ */ r("i", { className: "fad fa-user" }), s || "Sign In"]
25
+ })
26
+ });
27
+ }
28
+ //#endregion
29
+ export { a as default };
@@ -0,0 +1,14 @@
1
+ import { useEffect as e } from "react";
2
+ //#region src/components/Games/SocketServerUrlHandler.jsx
3
+ function t({ useStore: t }) {
4
+ return e(() => {
5
+ let e = t.getState()?.setSocketServerUrl, n = new URLSearchParams(window.location.search), r = n.get("socketServerUrl");
6
+ if (r) {
7
+ e(r), n.delete("socketServerUrl");
8
+ let t = window.location.pathname + (n.toString() ? `?${n.toString()}` : "") + window.location.hash;
9
+ window.history.replaceState({}, "", t);
10
+ }
11
+ }, []), null;
12
+ }
13
+ //#endregion
14
+ export { t as default };
@@ -19,7 +19,10 @@ function s({ show: s, setShow: c }) {
19
19
  className: "d-flex align-items-center mb-2",
20
20
  children: [/* @__PURE__ */ a("h5", {
21
21
  className: "mb-0 me-2",
22
- children: ["Main Site Status: ", p(m, h, g)]
22
+ children: ["Main Site Status: ", /* @__PURE__ */ i("span", {
23
+ className: `badge ${m ? "bg-success" : "bg-danger"}`,
24
+ children: p(m, h, g)
25
+ })]
23
26
  }), /* @__PURE__ */ a(e, {
24
27
  variant: "link",
25
28
  size: "sm",
@@ -37,7 +40,10 @@ function s({ show: s, setShow: c }) {
37
40
  className: "d-flex align-items-center mb-2",
38
41
  children: [/* @__PURE__ */ a("h5", {
39
42
  className: "mb-0 me-2",
40
- children: ["Auth Site Status: ", p(v, y, b)]
43
+ children: ["Auth Site Status: ", /* @__PURE__ */ i("span", {
44
+ className: `badge ${v ? "bg-success" : "bg-danger"}`,
45
+ children: p(v, y, b)
46
+ })]
41
47
  }), /* @__PURE__ */ a(e, {
42
48
  variant: "link",
43
49
  size: "sm",
@@ -0,0 +1,14 @@
1
+ import { useEffect as e } from "react";
2
+ //#region src/components/Games/ToontownModeHandler.jsx
3
+ function t({ useStore: t }) {
4
+ return e(() => {
5
+ let e = t.getState()?.setToontownMode, n = new URLSearchParams(window.location.search);
6
+ if (n.get("toontownMode")) {
7
+ e(!0), n.delete("toontownMode");
8
+ let t = window.location.pathname + (n.toString() ? `?${n.toString()}` : "") + window.location.hash;
9
+ window.history.replaceState({}, "", t);
10
+ }
11
+ }, []), null;
12
+ }
13
+ //#endregion
14
+ export { t as default };
@@ -984,10 +984,11 @@ function R(e) {
984
984
  ]
985
985
  });
986
986
  };
987
- function Oe(e) {
988
- switch (e) {
987
+ function Oe(t) {
988
+ switch (t) {
989
989
  case "Link": return /* @__PURE__ */ p("span", {
990
990
  type: "button",
991
+ className: e.className,
991
992
  onClick: () => {
992
993
  T(!0);
993
994
  },
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { t as e } from "./ViewUserModal-BbphE2vW.js";
2
+ import { t as e } from "./ViewUserModal-CrGeXxWG.js";
3
3
  export { e as default };
package/dist/index.js CHANGED
@@ -1,16 +1,19 @@
1
1
  import e from "./ReturnToLauncherButton.js";
2
- import t from "./ArticlesAd.js";
3
- import { t as n } from "./Ad-DW52TMZ4.js";
4
- import { t as r } from "./ViewUserModal-BbphE2vW.js";
5
- import { t as i } from "./GameScoreboard-DID7b4kw.js";
6
- import a from "./GlobalHead.js";
7
- import o from "./GlobalBody.js";
8
- import { t as s } from "./SettingsModal-DYcHm28E.js";
9
- import c from "./CreditsModal.js";
10
- import l from "./DarkModeHandler.js";
11
- import u from "./useUserFriends.js";
12
- import d from "./FriendsList.js";
13
- import f from "./useUserDetails.js";
14
- import p from "./useUserToken.js";
15
- import m from "./useFullscreen.js";
16
- export { n as Ad, t as ArticlesAd, c as CreditsModal, l as DarkModeHandler, d as FriendsList, i as GameScoreboard, o as GlobalBody, a as GlobalHead, e as ReturnToLauncherButton, s as SettingsModal, r as ViewUserModal, m as useFullscreen, f as useUserDetails, u as useUserFriends, p as useUserToken };
2
+ import t from "./SignInButton.js";
3
+ import n from "./ArticlesAd.js";
4
+ import { t as r } from "./Ad-DW52TMZ4.js";
5
+ import { t as i } from "./ViewUserModal-CrGeXxWG.js";
6
+ import { t as a } from "./GameScoreboard-pTQKozrD.js";
7
+ import o from "./GlobalHead.js";
8
+ import s from "./GlobalBody.js";
9
+ import { t as c } from "./SettingsModal-DZmAGhAO.js";
10
+ import l from "./CreditsModal.js";
11
+ import u from "./DarkModeHandler.js";
12
+ import d from "./ToontownModeHandler.js";
13
+ import f from "./SocketServerUrlHandler.js";
14
+ import p from "./useUserFriends.js";
15
+ import m from "./FriendsList.js";
16
+ import h from "./useUserDetails.js";
17
+ import g from "./useUserToken.js";
18
+ import _ from "./useFullscreen.js";
19
+ export { r as Ad, n as ArticlesAd, l as CreditsModal, u as DarkModeHandler, m as FriendsList, a as GameScoreboard, s as GlobalBody, o as GlobalHead, e as ReturnToLauncherButton, c as SettingsModal, t as SignInButton, f as SocketServerUrlHandler, d as ToontownModeHandler, i as ViewUserModal, _ as useFullscreen, h as useUserDetails, p as useUserFriends, g as useUserToken };
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.26",
4
+ "version": "1.0.28",
5
5
  "type": "module",
6
6
  "imports": {
7
7
  "#root/src/*": "./src/*"
@@ -21,12 +21,15 @@
21
21
  "./ArticlesAd": "./dist/ArticlesAd.js",
22
22
  "./GameScoreboard": "./dist/GameScoreboard.js",
23
23
  "./ReturnToLauncherButton": "./dist/ReturnToLauncherButton.js",
24
+ "./SignInButton": "./dist/SignInButton.js",
24
25
  "./GlobalHead": "./dist/GlobalHead.js",
25
26
  "./GlobalBody": "./dist/GlobalBody.js",
26
27
  "./ViewUserModal": "./dist/ViewUserModal.js",
27
28
  "./SettingsModal": "./dist/SettingsModal.js",
28
29
  "./CreditsModal": "./dist/CreditsModal.js",
29
30
  "./DarkModeHandler": "./dist/DarkModeHandler.js",
31
+ "./ToontownModeHandler": "./dist/ToontownModeHandler.js",
32
+ "./SocketServerUrlHandler": "./dist/SocketServerUrlHandler.js",
30
33
  "./FriendsList": "./dist/FriendsList.js",
31
34
  "./useUserDetails": "./dist/useUserDetails.js",
32
35
  "./useUserToken": "./dist/useUserToken.js",