@articles-media/articles-dev-box 1.4.1 → 1.5.0
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 +1 -0
- package/dist/InfoModal.js +23 -12
- package/dist/PageTemplateLandingPage.js +7 -10
- package/dist/{SettingsModal-Bu7vqrqw.js → SettingsModal-DOJp07_e.js} +24 -1
- package/dist/SettingsModal.js +1 -1
- package/dist/getAssetSource.js +19 -0
- package/dist/index.js +4 -2
- package/dist/useAssetSource.js +13 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -67,6 +67,7 @@ npm run dev
|
|
|
67
67
|
| getSignOutRedirectUrl | Handles signout redirect api logic | Catching Game |
|
|
68
68
|
| GlobalClientModals | Imports all global client modals like FriendsList, CreditsModal, SettingsModal, InfoModal, and so on | USA Tycoon |
|
|
69
69
|
| generateRandomNickname | Reusable way of doing random nicknames from package | USA Tycoon |
|
|
70
|
+
| getAssetSource | Gets an assets source location based on the NEXT_PUBLIC_MODEL_SOURCE env value, allows easier/cheaper open sourcing of games by serving public site assets as CDN and dev/cloned site assets locally | School Run |
|
|
70
71
|
| defaultGameNextConfig | Not usable, for reference | None |
|
|
71
72
|
| defaultGameThemeConfig | Not usable, for reference | None |
|
|
72
73
|
| useModalNavigation | Handles navigating a modal with controller | None |
|
package/dist/InfoModal.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Modal } from "react-bootstrap";
|
|
|
5
5
|
//#region src/components/Games/InfoModal.jsx
|
|
6
6
|
function InfoModal({ show, setShow, useStore, packageInfo, infoModalConfig }) {
|
|
7
7
|
const [showModal, setShowModal] = useState(true);
|
|
8
|
-
|
|
8
|
+
useStore((state) => state.darkMode);
|
|
9
9
|
useRef([]);
|
|
10
10
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Modal, {
|
|
11
11
|
className: "articles-modal games-info-modal",
|
|
@@ -24,21 +24,32 @@ function InfoModal({ show, setShow, useStore, packageInfo, infoModalConfig }) {
|
|
|
24
24
|
closeButton: true,
|
|
25
25
|
children: /* @__PURE__ */ jsxs(Modal.Title, { children: [process.env.NEXT_PUBLIC_GAME_NAME, " Info"] })
|
|
26
26
|
}),
|
|
27
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ jsx(Modal.Body, {
|
|
28
28
|
className: "flex-column p-0",
|
|
29
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
29
|
+
children: infoModalConfig?.contentOverride ? /* @__PURE__ */ jsx(Fragment, { children: infoModalConfig?.contentOverride }) : /* @__PURE__ */ jsxs(Fragment, { children: [!infoModalConfig?.hidePreviewImage && /* @__PURE__ */ jsx("div", {
|
|
30
30
|
className: "ratio ratio-16x9",
|
|
31
|
-
children:
|
|
31
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
32
|
+
src: infoModalConfig?.previewImage,
|
|
33
|
+
alt: "Game Preview",
|
|
34
|
+
style: { objectFit: infoModalConfig?.previewImageObjectFit || "cover" }
|
|
35
|
+
})
|
|
32
36
|
}), /* @__PURE__ */ jsxs("div", {
|
|
33
37
|
className: "p-3",
|
|
34
|
-
children: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
children: [
|
|
39
|
+
infoModalConfig?.prependContent && /* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: "mt-2",
|
|
41
|
+
children: infoModalConfig.prependContent
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: "",
|
|
45
|
+
children: packageInfo?.description
|
|
46
|
+
}),
|
|
47
|
+
infoModalConfig?.appendContent && /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "mt-2",
|
|
49
|
+
children: infoModalConfig.appendContent
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
})] })
|
|
42
53
|
}),
|
|
43
54
|
/* @__PURE__ */ jsxs(Modal.Footer, {
|
|
44
55
|
className: "justify-content-between",
|
|
@@ -119,16 +119,13 @@ function PageTemplateLandingPage({ useStore, useSocketStore, RotatingMascot, Lin
|
|
|
119
119
|
game: process.env.NEXT_PUBLIC_GAME_NAME,
|
|
120
120
|
style: "Default",
|
|
121
121
|
darkMode: darkMode ? true : false,
|
|
122
|
-
prepend: RotatingMascot && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
children: /* @__PURE__ */ jsx(RotatingMascot, {})
|
|
131
|
-
}) }),
|
|
122
|
+
prepend: typeof RotatingMascot === "function" && RotatingMascot ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { style: {
|
|
123
|
+
width: "100%",
|
|
124
|
+
height: "200px",
|
|
125
|
+
display: "flex",
|
|
126
|
+
justifyContent: "center",
|
|
127
|
+
alignItems: "center"
|
|
128
|
+
} }) }) : /* @__PURE__ */ jsx(Fragment, { children: RotatingMascot }),
|
|
132
129
|
...gameScoreboardConfig
|
|
133
130
|
}),
|
|
134
131
|
!disableAd && /* @__PURE__ */ jsx(Ad, {
|
|
@@ -246,7 +246,7 @@ function OtherTab({ useStore, config }) {
|
|
|
246
246
|
var package_default = {
|
|
247
247
|
name: "@articles-media/articles-dev-box",
|
|
248
248
|
description: "Shared code, functions, and components for different Articles Media projects.",
|
|
249
|
-
version: "1.
|
|
249
|
+
version: "1.5.0",
|
|
250
250
|
type: "module",
|
|
251
251
|
sideEffects: false,
|
|
252
252
|
imports: { "#root/src/*": "./src/*" },
|
|
@@ -295,6 +295,8 @@ var package_default = {
|
|
|
295
295
|
"./defaultGameThemeConfig": "./dist/defaultGameThemeConfig.js",
|
|
296
296
|
"./getSignOutRedirectUrl": "./dist/getSignOutRedirectUrl.js",
|
|
297
297
|
"./generateRandomNickname": "./dist/generateRandomNickname.js",
|
|
298
|
+
"./getAssetSource": "./dist/getAssetSource.js",
|
|
299
|
+
"./useAssetSource": "./dist/useAssetSource.js",
|
|
298
300
|
"./dist/style.css": "./dist/articles-dev-box.css",
|
|
299
301
|
"./dist/articles-dev-box.css": "./dist/articles-dev-box.css"
|
|
300
302
|
},
|
|
@@ -331,6 +333,8 @@ var package_default = {
|
|
|
331
333
|
function DebugTab({ useStore, config }) {
|
|
332
334
|
const showStats = useStore((state) => state?.debugConfig?.showStats);
|
|
333
335
|
const setDebugConfigKey = useStore((state) => state?.setDebugConfigKey);
|
|
336
|
+
const modelSource = useStore((state) => state?.modelSource);
|
|
337
|
+
const setModelSource = useStore((state) => state?.setModelSource);
|
|
334
338
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
335
339
|
/* @__PURE__ */ jsxs("div", {
|
|
336
340
|
className: "mb-3",
|
|
@@ -349,6 +353,25 @@ function DebugTab({ useStore, config }) {
|
|
|
349
353
|
}, i))
|
|
350
354
|
})]
|
|
351
355
|
}),
|
|
356
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ jsxs("div", {
|
|
357
|
+
className: "mb-3",
|
|
358
|
+
children: [/* @__PURE__ */ jsx("div", { children: "Override Model Source" }), /* @__PURE__ */ jsxs("div", {
|
|
359
|
+
className: "",
|
|
360
|
+
children: [/* @__PURE__ */ jsx(ArticlesButton, {
|
|
361
|
+
active: modelSource === "CDN",
|
|
362
|
+
onClick: () => {
|
|
363
|
+
setModelSource("CDN");
|
|
364
|
+
},
|
|
365
|
+
children: "CDN"
|
|
366
|
+
}), /* @__PURE__ */ jsx(ArticlesButton, {
|
|
367
|
+
active: modelSource === "Local",
|
|
368
|
+
onClick: () => {
|
|
369
|
+
setModelSource("Local");
|
|
370
|
+
},
|
|
371
|
+
children: "Local"
|
|
372
|
+
})]
|
|
373
|
+
})]
|
|
374
|
+
}),
|
|
352
375
|
config?.tabs?.Debug?.children && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", {}), config?.tabs?.Debug?.children] })
|
|
353
376
|
] });
|
|
354
377
|
}
|
package/dist/SettingsModal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SettingsModal } from "./SettingsModal-
|
|
1
|
+
import { t as SettingsModal } from "./SettingsModal-DOJp07_e.js";
|
|
2
2
|
export { SettingsModal as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/util/getAssetSource.js
|
|
2
|
+
/**
|
|
3
|
+
* Returns the appropriate model source URL based on the environment configuration.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} path - The local path to the model.
|
|
6
|
+
* @returns {string} The full URL to the model.
|
|
7
|
+
*/
|
|
8
|
+
function getAssetSource(path, overrideSource = null) {
|
|
9
|
+
const source = overrideSource || process.env.NEXT_PUBLIC_MODEL_SOURCE;
|
|
10
|
+
switch (source) {
|
|
11
|
+
case "CDN": return `${process.env.NEXT_PUBLIC_CDN}games/${process.env.NEXT_PUBLIC_GAME_NAME}/public/${path}`;
|
|
12
|
+
case "Local": return `${path}`;
|
|
13
|
+
default:
|
|
14
|
+
console.warn(`Unknown model source: ${source} - defaulting to local model.`);
|
|
15
|
+
return `${path}`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getAssetSource as default };
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { t as GameScoreboard } from "./GameScoreboard-BvE_sIDW.js";
|
|
|
16
16
|
import PageTemplateLandingPage from "./PageTemplateLandingPage.js";
|
|
17
17
|
import GlobalHead from "./GlobalHead.js";
|
|
18
18
|
import GlobalBody_default from "./GlobalBody.js";
|
|
19
|
-
import { t as SettingsModal } from "./SettingsModal-
|
|
19
|
+
import { t as SettingsModal } from "./SettingsModal-DOJp07_e.js";
|
|
20
20
|
import CreditsModal from "./CreditsModal.js";
|
|
21
21
|
import InfoModal from "./InfoModal.js";
|
|
22
22
|
import DarkModeHandler from "./DarkModeHandler.js";
|
|
@@ -32,4 +32,6 @@ import defaultGameNextConfig from "./defaultGameNextConfig.js";
|
|
|
32
32
|
import getTheme from "./defaultGameThemeConfig.js";
|
|
33
33
|
import getSignOutRedirectUrl from "./getSignOutRedirectUrl.js";
|
|
34
34
|
import generateRandomNickname from "./generateRandomNickname.js";
|
|
35
|
-
|
|
35
|
+
import getAssetSource from "./getAssetSource.js";
|
|
36
|
+
import useAssetSource from "./useAssetSource.js";
|
|
37
|
+
export { Ad_default as Ad, ArticlesAd, CreditsModal, DarkModeHandler, FriendsList, GameMenu, PrimaryButtonGroup as GameMenuPrimaryButtonGroup, GameScoreboard, GlobalBody_default as GlobalBody, GlobalHead, HasNoMouseHandler, InfoModal, InviteModal, NicknameInput, PageTemplateLandingPage, ReturnToLauncherButton, ReusedSocketLogicHandler, SessionButton, SettingsModal, SignInButton, SocketServerUrlHandler, ToontownModeHandler, ViewUserModal, defaultGameNextConfig, getTheme as defaultGameThemeConfig, generateRandomNickname, getAssetSource, getSignOutRedirectUrl, typicalZustandStoreExcludes, typicalZustandStoreStateSlice, useAssetSource, useFullscreen, useUserDetails, useUserFriends, useUserToken, zustandSocketStoreSlice };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/hooks/useAssetSource.js
|
|
2
|
+
function useAssetSource(path, useStore) {
|
|
3
|
+
const source = useStore((state) => state.modelSource);
|
|
4
|
+
switch (source) {
|
|
5
|
+
case "CDN": return `${process.env.NEXT_PUBLIC_CDN}games/${process.env.NEXT_PUBLIC_GAME_NAME}/public/${path}`;
|
|
6
|
+
case "Local": return `${path}`;
|
|
7
|
+
default:
|
|
8
|
+
console.warn(`Unknown model source: ${source} - defaulting to local model.`);
|
|
9
|
+
return `${path}`;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { useAssetSource as default };
|
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.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"imports": {
|
|
@@ -54,6 +54,8 @@
|
|
|
54
54
|
"./defaultGameThemeConfig": "./dist/defaultGameThemeConfig.js",
|
|
55
55
|
"./getSignOutRedirectUrl": "./dist/getSignOutRedirectUrl.js",
|
|
56
56
|
"./generateRandomNickname": "./dist/generateRandomNickname.js",
|
|
57
|
+
"./getAssetSource": "./dist/getAssetSource.js",
|
|
58
|
+
"./useAssetSource": "./dist/useAssetSource.js",
|
|
57
59
|
"./dist/style.css": "./dist/articles-dev-box.css",
|
|
58
60
|
"./dist/articles-dev-box.css": "./dist/articles-dev-box.css"
|
|
59
61
|
},
|