dirk-cfx-react 1.0.34 → 1.0.35
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/components/index.cjs +41 -9
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +274 -274
- package/dist/components/index.d.ts +274 -274
- package/dist/components/index.js +41 -9
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +72 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +6 -1
- package/dist/hooks/index.d.ts +6 -1
- package/dist/hooks/index.js +71 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +420 -352
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +421 -355
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +1 -0
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +1 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/styles/tornEdge.css +30 -0
- package/package.json +1 -1
- package/src/styles/tornEdge.css +30 -0
package/dist/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
2
|
-
import { Flex, Text, Image,
|
|
3
|
-
import {
|
|
4
|
-
import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
|
|
5
|
-
import { createContext, useRef, useState, useEffect, useContext, useMemo } from 'react';
|
|
6
|
-
import { create, useStore } from 'zustand';
|
|
7
|
-
import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
|
|
8
|
-
import hoverSoundUrl from './hover_sound-NBUA222C.mp3';
|
|
2
|
+
import { createTheme, Flex, Text, Image, MantineProvider, BackgroundImage, useMantineTheme } from '@mantine/core';
|
|
3
|
+
import { createContext, useRef, useEffect, useMemo, useState, useContext } from 'react';
|
|
9
4
|
import '@mantine/core/styles.css';
|
|
10
5
|
import '@mantine/notifications/styles.css';
|
|
11
6
|
import './styles/fonts.css';
|
|
12
7
|
import './styles/scrollBar.css';
|
|
8
|
+
import './styles/tornEdge.css';
|
|
13
9
|
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
14
10
|
import { fab } from '@fortawesome/free-brands-svg-icons';
|
|
15
11
|
import { far } from '@fortawesome/free-regular-svg-icons';
|
|
16
12
|
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
13
|
+
import { create, useStore } from 'zustand';
|
|
14
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
15
|
+
import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
|
|
16
|
+
import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
|
|
17
|
+
import hoverSoundUrl from './hover_sound-NBUA222C.mp3';
|
|
17
18
|
|
|
18
19
|
// src/components/BorderedIcon.tsx
|
|
19
20
|
|
|
@@ -184,15 +185,347 @@ function colorWithAlpha(color, alpha) {
|
|
|
184
185
|
}
|
|
185
186
|
return color;
|
|
186
187
|
}
|
|
188
|
+
|
|
189
|
+
// src/utils/misc.ts
|
|
190
|
+
var isEnvBrowser = () => !window.invokeNative;
|
|
191
|
+
var noop = () => {
|
|
192
|
+
};
|
|
193
|
+
var splitFAString = (faString) => {
|
|
194
|
+
const [prefix, newIcon] = faString.split("-");
|
|
195
|
+
if (!prefix || !newIcon) return { prefix: "fas", newIcon: "question" };
|
|
196
|
+
return { prefix, newIcon };
|
|
197
|
+
};
|
|
198
|
+
var numberToRoman = (num) => {
|
|
199
|
+
const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX"];
|
|
200
|
+
return romanNumerals[num];
|
|
201
|
+
};
|
|
202
|
+
var copyToClipboard = (text) => {
|
|
203
|
+
const el = document.createElement("textarea");
|
|
204
|
+
el.value = text;
|
|
205
|
+
document.body.appendChild(el);
|
|
206
|
+
el.select();
|
|
207
|
+
document.execCommand("copy");
|
|
208
|
+
document.body.removeChild(el);
|
|
209
|
+
};
|
|
210
|
+
var openLink = (url) => {
|
|
211
|
+
if (isEnvBrowser()) {
|
|
212
|
+
window.open(url, "_blank");
|
|
213
|
+
} else {
|
|
214
|
+
window.invokeNative("openLink", url);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// src/hooks/useNuiEvent.ts
|
|
219
|
+
var useNuiEvent = (action, handler) => {
|
|
220
|
+
const savedHandler = useRef(noop);
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
savedHandler.current = handler;
|
|
223
|
+
}, [handler]);
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
const eventListener = (event) => {
|
|
226
|
+
const { action: eventAction, data } = event.data;
|
|
227
|
+
if (savedHandler.current) {
|
|
228
|
+
if (eventAction === action) {
|
|
229
|
+
savedHandler.current(data);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
window.addEventListener("message", eventListener);
|
|
234
|
+
return () => window.removeEventListener("message", eventListener);
|
|
235
|
+
}, [action]);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// src/utils/fetchNui.ts
|
|
239
|
+
async function fetchNui(eventName, data, mockData) {
|
|
240
|
+
const options = {
|
|
241
|
+
method: "post",
|
|
242
|
+
headers: {
|
|
243
|
+
"Content-Type": "application/json; charset=UTF-8"
|
|
244
|
+
},
|
|
245
|
+
body: JSON.stringify(data)
|
|
246
|
+
};
|
|
247
|
+
if (isEnvBrowser() && mockData !== void 0) return mockData;
|
|
248
|
+
if (isEnvBrowser()) {
|
|
249
|
+
console.warn(
|
|
250
|
+
`[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
|
|
251
|
+
);
|
|
252
|
+
return {};
|
|
253
|
+
}
|
|
254
|
+
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
|
|
255
|
+
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
256
|
+
const respFormatted = await resp.json();
|
|
257
|
+
return respFormatted;
|
|
258
|
+
}
|
|
259
|
+
function fetchOnLoad(eventName, data, mockData) {
|
|
260
|
+
return fetchNui(eventName, data, mockData).catch((err) => {
|
|
261
|
+
console.error(`[fetchOnLoad] Failed for ${eventName}:`, err);
|
|
262
|
+
throw err;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
var fetchLuaTable = (tableName) => () => {
|
|
266
|
+
if (isEnvBrowser()) {
|
|
267
|
+
return Promise.resolve({});
|
|
268
|
+
}
|
|
269
|
+
return fetchNui("GET_LUA_TABLE", { tableName });
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
// src/utils/internalEvent.ts
|
|
273
|
+
var internalEvent = (events, timer = 1e3) => {
|
|
274
|
+
if (isEnvBrowser()) {
|
|
275
|
+
for (const event of events) {
|
|
276
|
+
setTimeout(() => {
|
|
277
|
+
window.dispatchEvent(
|
|
278
|
+
new MessageEvent("message", {
|
|
279
|
+
data: {
|
|
280
|
+
action: event.action,
|
|
281
|
+
data: event.data
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
);
|
|
285
|
+
}, timer);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
var localeStore = create((set, get) => {
|
|
290
|
+
return {
|
|
291
|
+
locales: {
|
|
292
|
+
"OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant."
|
|
293
|
+
},
|
|
294
|
+
locale: (key, ...args) => {
|
|
295
|
+
const exists = get().locales[key];
|
|
296
|
+
let translation = exists || key;
|
|
297
|
+
if (args.length) {
|
|
298
|
+
translation = translation.replace(/%s/g, () => String(args.shift() || ""));
|
|
299
|
+
}
|
|
300
|
+
return translation;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
});
|
|
304
|
+
var locale = localeStore.getState().locale;
|
|
305
|
+
fetchOnLoad("GET_LOCALES").then((data) => {
|
|
306
|
+
localeStore.setState({ locales: data });
|
|
307
|
+
});
|
|
308
|
+
var theme = createTheme({
|
|
309
|
+
primaryColor: "dirk",
|
|
310
|
+
primaryShade: 9,
|
|
311
|
+
defaultRadius: "xxs",
|
|
312
|
+
fontFamily: "Akrobat Regular, sans-serif",
|
|
313
|
+
radius: {
|
|
314
|
+
xxs: "0.2vh",
|
|
315
|
+
xs: "0.4vh",
|
|
316
|
+
sm: "0.75vh",
|
|
317
|
+
md: "1vh",
|
|
318
|
+
lg: "1.5vh",
|
|
319
|
+
xl: "2vh",
|
|
320
|
+
xxl: "3vh"
|
|
321
|
+
},
|
|
322
|
+
fontSizes: {
|
|
323
|
+
xxs: "1.2vh",
|
|
324
|
+
xs: "1.5vh",
|
|
325
|
+
sm: "1.8vh",
|
|
326
|
+
md: "2.2vh",
|
|
327
|
+
lg: "2.8vh",
|
|
328
|
+
xl: "3.3vh",
|
|
329
|
+
xxl: "3.8vh"
|
|
330
|
+
},
|
|
331
|
+
spacing: {
|
|
332
|
+
xxs: "0.5vh",
|
|
333
|
+
xs: "0.75vh",
|
|
334
|
+
sm: "1.5vh",
|
|
335
|
+
md: "2vh",
|
|
336
|
+
lg: "3vh",
|
|
337
|
+
xl: "4vh",
|
|
338
|
+
xxl: "5vh"
|
|
339
|
+
},
|
|
340
|
+
components: {
|
|
341
|
+
Progress: {
|
|
342
|
+
styles: {
|
|
343
|
+
root: {
|
|
344
|
+
backgroundColor: "rgba(77, 77, 77, 0.4)"
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
Select: {
|
|
349
|
+
styles: {
|
|
350
|
+
dropdown: {
|
|
351
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
352
|
+
},
|
|
353
|
+
input: {
|
|
354
|
+
padding: "var(--mantine-spacing-sm)"
|
|
355
|
+
},
|
|
356
|
+
item: {
|
|
357
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
358
|
+
},
|
|
359
|
+
wrapper: {
|
|
360
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
361
|
+
},
|
|
362
|
+
option: {
|
|
363
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
MultiSelect: {
|
|
368
|
+
styles: {
|
|
369
|
+
dropdown: {
|
|
370
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
371
|
+
},
|
|
372
|
+
pill: {
|
|
373
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
374
|
+
},
|
|
375
|
+
item: {
|
|
376
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
377
|
+
},
|
|
378
|
+
wrapper: {
|
|
379
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
380
|
+
},
|
|
381
|
+
option: {
|
|
382
|
+
borderRadius: "var(--mantine-radius-xxs)"
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
TextInput: {
|
|
387
|
+
styles: {
|
|
388
|
+
section: {
|
|
389
|
+
marginRight: "0.2vh"
|
|
390
|
+
},
|
|
391
|
+
input: {
|
|
392
|
+
padding: "var(--mantine-spacing-sm)"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
colors: {
|
|
398
|
+
dark: [
|
|
399
|
+
"#ffffff",
|
|
400
|
+
"#e2e2e2",
|
|
401
|
+
"#c6c6c6",
|
|
402
|
+
"#aaaaaa",
|
|
403
|
+
"#8d8d8d",
|
|
404
|
+
"#717171",
|
|
405
|
+
"#555555",
|
|
406
|
+
"#393939",
|
|
407
|
+
"#1c1c1c",
|
|
408
|
+
"#000000"
|
|
409
|
+
],
|
|
410
|
+
dirk: [
|
|
411
|
+
"#ffffff",
|
|
412
|
+
"#f3fce9",
|
|
413
|
+
"#dbf5bd",
|
|
414
|
+
"#c3ee91",
|
|
415
|
+
"#ace765",
|
|
416
|
+
"#94e039",
|
|
417
|
+
"#7ac61f",
|
|
418
|
+
"#5f9a18",
|
|
419
|
+
"#29420a",
|
|
420
|
+
"#446e11"
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
var theme_default = theme;
|
|
425
|
+
library.add(fas, far, fab);
|
|
426
|
+
var useSettings = create((set) => ({
|
|
427
|
+
game: "rdr3",
|
|
428
|
+
primaryColor: "teal",
|
|
429
|
+
primaryShade: 6,
|
|
430
|
+
customTheme: {}
|
|
431
|
+
}));
|
|
432
|
+
function DirkProvider(props) {
|
|
433
|
+
const primaryColor = useSettings((data) => data.primaryColor);
|
|
434
|
+
const primaryShade = useSettings((data) => data.primaryShade);
|
|
435
|
+
const customTheme = useSettings((data) => data.customTheme);
|
|
436
|
+
const game = useSettings((data) => data.game);
|
|
437
|
+
const mergedTheme = useMemo(() => ({
|
|
438
|
+
...theme_default,
|
|
439
|
+
primaryColor,
|
|
440
|
+
primaryShade,
|
|
441
|
+
colors: {
|
|
442
|
+
...theme_default.colors,
|
|
443
|
+
...customTheme
|
|
444
|
+
// Custom theme colors will override/extend base colors
|
|
445
|
+
}
|
|
446
|
+
}), [primaryColor, primaryShade, customTheme]);
|
|
447
|
+
useEffect(() => {
|
|
448
|
+
document.fonts.ready.then(() => {
|
|
449
|
+
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
|
|
450
|
+
console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
|
|
451
|
+
});
|
|
452
|
+
}, [game]);
|
|
453
|
+
return /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsx(Wrapper, { children: props.children }) });
|
|
454
|
+
}
|
|
455
|
+
function Wrapper({ children }) {
|
|
456
|
+
const game = useSettings((data) => data.game);
|
|
457
|
+
return isEnvBrowser() ? /* @__PURE__ */ jsx(
|
|
458
|
+
BackgroundImage,
|
|
459
|
+
{
|
|
460
|
+
w: "100vw",
|
|
461
|
+
h: "100vh",
|
|
462
|
+
style: { overflow: "hidden" },
|
|
463
|
+
src: game === "fivem" ? "https://i.ytimg.com/vi/TOxuNbXrO28/maxresdefault.jpg" : "https://raw.githubusercontent.com/Jump-On-Studios/RedM-jo_libs/refs/heads/main/source-repositories/Menu/public/assets/images/background_dev.jpg",
|
|
464
|
+
children
|
|
465
|
+
}
|
|
466
|
+
) : /* @__PURE__ */ jsx(Fragment, { children });
|
|
467
|
+
}
|
|
468
|
+
function useTornEdges() {
|
|
469
|
+
const game = useSettings((state) => state.game);
|
|
470
|
+
return game === "rdr3" ? "torn-edge-wrapper" : "";
|
|
471
|
+
}
|
|
472
|
+
function TornEdgeSVGFilter() {
|
|
473
|
+
return /* @__PURE__ */ jsx(
|
|
474
|
+
"svg",
|
|
475
|
+
{
|
|
476
|
+
style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" },
|
|
477
|
+
"aria-hidden": "true",
|
|
478
|
+
children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", { id: "torn-edge-filter", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
479
|
+
/* @__PURE__ */ jsx(
|
|
480
|
+
"feTurbulence",
|
|
481
|
+
{
|
|
482
|
+
type: "fractalNoise",
|
|
483
|
+
baseFrequency: "0.018 0.022",
|
|
484
|
+
numOctaves: "5",
|
|
485
|
+
seed: "9",
|
|
486
|
+
result: "noise1"
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ jsx(
|
|
490
|
+
"feTurbulence",
|
|
491
|
+
{
|
|
492
|
+
type: "fractalNoise",
|
|
493
|
+
baseFrequency: "0.08 0.12",
|
|
494
|
+
numOctaves: "2",
|
|
495
|
+
seed: "3",
|
|
496
|
+
result: "noise2"
|
|
497
|
+
}
|
|
498
|
+
),
|
|
499
|
+
/* @__PURE__ */ jsx("feBlend", { in: "noise1", in2: "noise2", mode: "multiply", result: "combinedNoise" }),
|
|
500
|
+
/* @__PURE__ */ jsx(
|
|
501
|
+
"feDisplacementMap",
|
|
502
|
+
{
|
|
503
|
+
in: "SourceGraphic",
|
|
504
|
+
in2: "combinedNoise",
|
|
505
|
+
scale: "52",
|
|
506
|
+
xChannelSelector: "R",
|
|
507
|
+
yChannelSelector: "G",
|
|
508
|
+
result: "displaced"
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "0.8", in: "displaced", result: "blurred" }),
|
|
512
|
+
/* @__PURE__ */ jsx("feComponentTransfer", { in: "blurred", result: "alphaFade", children: /* @__PURE__ */ jsx("feFuncA", { type: "gamma", amplitude: "1", exponent: "1.3", offset: "-0.05" }) }),
|
|
513
|
+
/* @__PURE__ */ jsx("feMorphology", { operator: "erode", radius: "0.4", in: "alphaFade", result: "eroded" }),
|
|
514
|
+
/* @__PURE__ */ jsx("feMerge", { children: /* @__PURE__ */ jsx("feMergeNode", { in: "eroded" }) })
|
|
515
|
+
] }) })
|
|
516
|
+
}
|
|
517
|
+
);
|
|
518
|
+
}
|
|
187
519
|
function BorderedIcon(props) {
|
|
188
520
|
const theme2 = useMantineTheme();
|
|
521
|
+
const tornEdgeCSS = useTornEdges();
|
|
189
522
|
return /* @__PURE__ */ jsx(
|
|
190
|
-
|
|
523
|
+
Flex,
|
|
191
524
|
{
|
|
192
|
-
|
|
193
|
-
|
|
525
|
+
className: tornEdgeCSS,
|
|
526
|
+
justify: "center",
|
|
527
|
+
align: "center",
|
|
194
528
|
style: {
|
|
195
|
-
// backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
|
|
196
529
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
197
530
|
padding: props.p || theme2.spacing.xs,
|
|
198
531
|
transition: "all 0.2s ease-in-out",
|
|
@@ -200,9 +533,19 @@ function BorderedIcon(props) {
|
|
|
200
533
|
fontSize: props.fontSize ? props.fontSize : "2.5vh",
|
|
201
534
|
borderRadius: theme2.radius.xs,
|
|
202
535
|
// border: `2px solid var(--mantine-primary-color-9)`,
|
|
203
|
-
outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color :
|
|
536
|
+
// outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][9], 0.8)}`,
|
|
204
537
|
boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][7], 0.5)}`
|
|
205
|
-
}
|
|
538
|
+
},
|
|
539
|
+
children: /* @__PURE__ */ jsx(
|
|
540
|
+
FontAwesomeIcon,
|
|
541
|
+
{
|
|
542
|
+
icon: props.icon,
|
|
543
|
+
color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
|
|
544
|
+
style: {
|
|
545
|
+
// backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
)
|
|
206
549
|
}
|
|
207
550
|
);
|
|
208
551
|
}
|
|
@@ -530,175 +873,75 @@ function InputContainer(props) {
|
|
|
530
873
|
style: {
|
|
531
874
|
lineHeight: "1.25vh",
|
|
532
875
|
fontFamily: "Akrobat Bold",
|
|
533
|
-
letterSpacing: "0.05em",
|
|
534
|
-
textTransform: "uppercase"
|
|
535
|
-
},
|
|
536
|
-
children: props.title
|
|
537
|
-
}
|
|
538
|
-
),
|
|
539
|
-
props.description && /* @__PURE__ */ jsx(
|
|
540
|
-
Text,
|
|
541
|
-
{
|
|
542
|
-
size: "xs",
|
|
543
|
-
c: "rgba(255, 255, 255, 0.8)",
|
|
544
|
-
fw: 400,
|
|
545
|
-
children: props.description
|
|
546
|
-
}
|
|
547
|
-
)
|
|
548
|
-
]
|
|
549
|
-
}
|
|
550
|
-
),
|
|
551
|
-
props.error && /* @__PURE__ */ jsx(
|
|
552
|
-
Text,
|
|
553
|
-
{
|
|
554
|
-
size: "xs",
|
|
555
|
-
c: theme2.colors.red[9],
|
|
556
|
-
fw: 600,
|
|
557
|
-
mb: "auto",
|
|
558
|
-
lh: "0.8",
|
|
559
|
-
children: props.error
|
|
560
|
-
}
|
|
561
|
-
),
|
|
562
|
-
/* @__PURE__ */ jsx(
|
|
563
|
-
Flex,
|
|
564
|
-
{
|
|
565
|
-
ml: "auto",
|
|
566
|
-
children: props.rightSection
|
|
567
|
-
}
|
|
568
|
-
)
|
|
569
|
-
]
|
|
570
|
-
}
|
|
571
|
-
),
|
|
572
|
-
props.children
|
|
573
|
-
]
|
|
574
|
-
}
|
|
575
|
-
);
|
|
576
|
-
}
|
|
577
|
-
var useAudio = create(() => {
|
|
578
|
-
const audioRefs = {};
|
|
579
|
-
const sounds = {
|
|
580
|
-
click: clickSoundUrl,
|
|
581
|
-
hover: hoverSoundUrl
|
|
582
|
-
};
|
|
583
|
-
for (const [key, src] of Object.entries(sounds)) {
|
|
584
|
-
audioRefs[key] = new Audio(src);
|
|
585
|
-
}
|
|
586
|
-
return {
|
|
587
|
-
play: (sound) => {
|
|
588
|
-
const audio = audioRefs[sound];
|
|
589
|
-
if (!audio) return console.warn(`Sound '${sound}' not found.`);
|
|
590
|
-
audio.currentTime = 0;
|
|
591
|
-
audio.volume = 0.1;
|
|
592
|
-
audio.play();
|
|
593
|
-
},
|
|
594
|
-
stop: (sound) => {
|
|
595
|
-
const audio = audioRefs[sound];
|
|
596
|
-
if (!audio) return console.warn(`Sound '${sound}' not found.`);
|
|
597
|
-
audio.pause();
|
|
598
|
-
audio.currentTime = 0;
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
|
-
});
|
|
602
|
-
|
|
603
|
-
// src/utils/misc.ts
|
|
604
|
-
var isEnvBrowser = () => !window.invokeNative;
|
|
605
|
-
var noop = () => {
|
|
606
|
-
};
|
|
607
|
-
var splitFAString = (faString) => {
|
|
608
|
-
const [prefix, newIcon] = faString.split("-");
|
|
609
|
-
if (!prefix || !newIcon) return { prefix: "fas", newIcon: "question" };
|
|
610
|
-
return { prefix, newIcon };
|
|
611
|
-
};
|
|
612
|
-
var numberToRoman = (num) => {
|
|
613
|
-
const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX"];
|
|
614
|
-
return romanNumerals[num];
|
|
615
|
-
};
|
|
616
|
-
var copyToClipboard = (text) => {
|
|
617
|
-
const el = document.createElement("textarea");
|
|
618
|
-
el.value = text;
|
|
619
|
-
document.body.appendChild(el);
|
|
620
|
-
el.select();
|
|
621
|
-
document.execCommand("copy");
|
|
622
|
-
document.body.removeChild(el);
|
|
623
|
-
};
|
|
624
|
-
var openLink = (url) => {
|
|
625
|
-
if (isEnvBrowser()) {
|
|
626
|
-
window.open(url, "_blank");
|
|
627
|
-
} else {
|
|
628
|
-
window.invokeNative("openLink", url);
|
|
629
|
-
}
|
|
630
|
-
};
|
|
631
|
-
|
|
632
|
-
// src/utils/fetchNui.ts
|
|
633
|
-
async function fetchNui(eventName, data, mockData) {
|
|
634
|
-
const options = {
|
|
635
|
-
method: "post",
|
|
636
|
-
headers: {
|
|
637
|
-
"Content-Type": "application/json; charset=UTF-8"
|
|
638
|
-
},
|
|
639
|
-
body: JSON.stringify(data)
|
|
640
|
-
};
|
|
641
|
-
if (isEnvBrowser() && mockData !== void 0) return mockData;
|
|
642
|
-
if (isEnvBrowser()) {
|
|
643
|
-
console.warn(
|
|
644
|
-
`[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
|
|
645
|
-
);
|
|
646
|
-
return {};
|
|
647
|
-
}
|
|
648
|
-
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
|
|
649
|
-
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
650
|
-
const respFormatted = await resp.json();
|
|
651
|
-
return respFormatted;
|
|
652
|
-
}
|
|
653
|
-
function fetchOnLoad(eventName, data, mockData) {
|
|
654
|
-
return fetchNui(eventName, data, mockData).catch((err) => {
|
|
655
|
-
console.error(`[fetchOnLoad] Failed for ${eventName}:`, err);
|
|
656
|
-
throw err;
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
var fetchLuaTable = (tableName) => () => {
|
|
660
|
-
if (isEnvBrowser()) {
|
|
661
|
-
return Promise.resolve({});
|
|
662
|
-
}
|
|
663
|
-
return fetchNui("GET_LUA_TABLE", { tableName });
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
// src/utils/internalEvent.ts
|
|
667
|
-
var internalEvent = (events, timer = 1e3) => {
|
|
668
|
-
if (isEnvBrowser()) {
|
|
669
|
-
for (const event of events) {
|
|
670
|
-
setTimeout(() => {
|
|
671
|
-
window.dispatchEvent(
|
|
672
|
-
new MessageEvent("message", {
|
|
673
|
-
data: {
|
|
674
|
-
action: event.action,
|
|
675
|
-
data: event.data
|
|
676
|
-
}
|
|
677
|
-
})
|
|
678
|
-
);
|
|
679
|
-
}, timer);
|
|
876
|
+
letterSpacing: "0.05em",
|
|
877
|
+
textTransform: "uppercase"
|
|
878
|
+
},
|
|
879
|
+
children: props.title
|
|
880
|
+
}
|
|
881
|
+
),
|
|
882
|
+
props.description && /* @__PURE__ */ jsx(
|
|
883
|
+
Text,
|
|
884
|
+
{
|
|
885
|
+
size: "xs",
|
|
886
|
+
c: "rgba(255, 255, 255, 0.8)",
|
|
887
|
+
fw: 400,
|
|
888
|
+
children: props.description
|
|
889
|
+
}
|
|
890
|
+
)
|
|
891
|
+
]
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
props.error && /* @__PURE__ */ jsx(
|
|
895
|
+
Text,
|
|
896
|
+
{
|
|
897
|
+
size: "xs",
|
|
898
|
+
c: theme2.colors.red[9],
|
|
899
|
+
fw: 600,
|
|
900
|
+
mb: "auto",
|
|
901
|
+
lh: "0.8",
|
|
902
|
+
children: props.error
|
|
903
|
+
}
|
|
904
|
+
),
|
|
905
|
+
/* @__PURE__ */ jsx(
|
|
906
|
+
Flex,
|
|
907
|
+
{
|
|
908
|
+
ml: "auto",
|
|
909
|
+
children: props.rightSection
|
|
910
|
+
}
|
|
911
|
+
)
|
|
912
|
+
]
|
|
913
|
+
}
|
|
914
|
+
),
|
|
915
|
+
props.children
|
|
916
|
+
]
|
|
680
917
|
}
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
var useAudio = create(() => {
|
|
921
|
+
const audioRefs = {};
|
|
922
|
+
const sounds = {
|
|
923
|
+
click: clickSoundUrl,
|
|
924
|
+
hover: hoverSoundUrl
|
|
925
|
+
};
|
|
926
|
+
for (const [key, src] of Object.entries(sounds)) {
|
|
927
|
+
audioRefs[key] = new Audio(src);
|
|
681
928
|
}
|
|
682
|
-
};
|
|
683
|
-
var localeStore = create((set, get) => {
|
|
684
929
|
return {
|
|
685
|
-
|
|
686
|
-
|
|
930
|
+
play: (sound) => {
|
|
931
|
+
const audio = audioRefs[sound];
|
|
932
|
+
if (!audio) return console.warn(`Sound '${sound}' not found.`);
|
|
933
|
+
audio.currentTime = 0;
|
|
934
|
+
audio.volume = 0.1;
|
|
935
|
+
audio.play();
|
|
687
936
|
},
|
|
688
|
-
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}
|
|
694
|
-
return translation;
|
|
937
|
+
stop: (sound) => {
|
|
938
|
+
const audio = audioRefs[sound];
|
|
939
|
+
if (!audio) return console.warn(`Sound '${sound}' not found.`);
|
|
940
|
+
audio.pause();
|
|
941
|
+
audio.currentTime = 0;
|
|
695
942
|
}
|
|
696
943
|
};
|
|
697
944
|
});
|
|
698
|
-
var locale = localeStore.getState().locale;
|
|
699
|
-
fetchOnLoad("GET_LOCALES").then((data) => {
|
|
700
|
-
localeStore.setState({ locales: data });
|
|
701
|
-
});
|
|
702
945
|
function SegmentedControl(props) {
|
|
703
946
|
const theme2 = useMantineTheme();
|
|
704
947
|
const play = useAudio((state) => state.play);
|
|
@@ -971,6 +1214,7 @@ function SegmentedProgress(props) {
|
|
|
971
1214
|
);
|
|
972
1215
|
}
|
|
973
1216
|
function Title(props) {
|
|
1217
|
+
const game = useSettings((state) => state.game);
|
|
974
1218
|
const theme2 = useMantineTheme();
|
|
975
1219
|
return /* @__PURE__ */ jsx(
|
|
976
1220
|
Flex,
|
|
@@ -1014,7 +1258,7 @@ function Title(props) {
|
|
|
1014
1258
|
children: [
|
|
1015
1259
|
/* @__PURE__ */ jsx(Text, { p: "0", size: "sm", style: {
|
|
1016
1260
|
lineHeight: theme2.fontSizes.md,
|
|
1017
|
-
fontFamily: "Akrobat Bold",
|
|
1261
|
+
fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
|
|
1018
1262
|
letterSpacing: "0.05em",
|
|
1019
1263
|
textTransform: "uppercase"
|
|
1020
1264
|
}, children: props.title }),
|
|
@@ -1048,185 +1292,7 @@ function Title(props) {
|
|
|
1048
1292
|
}
|
|
1049
1293
|
);
|
|
1050
1294
|
}
|
|
1051
|
-
var useNuiEvent = (action, handler) => {
|
|
1052
|
-
const savedHandler = useRef(noop);
|
|
1053
|
-
useEffect(() => {
|
|
1054
|
-
savedHandler.current = handler;
|
|
1055
|
-
}, [handler]);
|
|
1056
|
-
useEffect(() => {
|
|
1057
|
-
const eventListener = (event) => {
|
|
1058
|
-
const { action: eventAction, data } = event.data;
|
|
1059
|
-
if (savedHandler.current) {
|
|
1060
|
-
if (eventAction === action) {
|
|
1061
|
-
savedHandler.current(data);
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
};
|
|
1065
|
-
window.addEventListener("message", eventListener);
|
|
1066
|
-
return () => window.removeEventListener("message", eventListener);
|
|
1067
|
-
}, [action]);
|
|
1068
|
-
};
|
|
1069
|
-
var theme = createTheme({
|
|
1070
|
-
primaryColor: "dirk",
|
|
1071
|
-
primaryShade: 9,
|
|
1072
|
-
defaultRadius: "xxs",
|
|
1073
|
-
fontFamily: "Akrobat Regular, sans-serif",
|
|
1074
|
-
radius: {
|
|
1075
|
-
xxs: "0.2vh",
|
|
1076
|
-
xs: "0.4vh",
|
|
1077
|
-
sm: "0.75vh",
|
|
1078
|
-
md: "1vh",
|
|
1079
|
-
lg: "1.5vh",
|
|
1080
|
-
xl: "2vh",
|
|
1081
|
-
xxl: "3vh"
|
|
1082
|
-
},
|
|
1083
|
-
fontSizes: {
|
|
1084
|
-
xxs: "1.2vh",
|
|
1085
|
-
xs: "1.5vh",
|
|
1086
|
-
sm: "1.8vh",
|
|
1087
|
-
md: "2.2vh",
|
|
1088
|
-
lg: "2.8vh",
|
|
1089
|
-
xl: "3.3vh",
|
|
1090
|
-
xxl: "3.8vh"
|
|
1091
|
-
},
|
|
1092
|
-
spacing: {
|
|
1093
|
-
xxs: "0.5vh",
|
|
1094
|
-
xs: "0.75vh",
|
|
1095
|
-
sm: "1.5vh",
|
|
1096
|
-
md: "2vh",
|
|
1097
|
-
lg: "3vh",
|
|
1098
|
-
xl: "4vh",
|
|
1099
|
-
xxl: "5vh"
|
|
1100
|
-
},
|
|
1101
|
-
components: {
|
|
1102
|
-
Progress: {
|
|
1103
|
-
styles: {
|
|
1104
|
-
root: {
|
|
1105
|
-
backgroundColor: "rgba(77, 77, 77, 0.4)"
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
},
|
|
1109
|
-
Select: {
|
|
1110
|
-
styles: {
|
|
1111
|
-
dropdown: {
|
|
1112
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1113
|
-
},
|
|
1114
|
-
input: {
|
|
1115
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1116
|
-
},
|
|
1117
|
-
item: {
|
|
1118
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1119
|
-
},
|
|
1120
|
-
wrapper: {
|
|
1121
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1122
|
-
},
|
|
1123
|
-
option: {
|
|
1124
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
},
|
|
1128
|
-
MultiSelect: {
|
|
1129
|
-
styles: {
|
|
1130
|
-
dropdown: {
|
|
1131
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1132
|
-
},
|
|
1133
|
-
pill: {
|
|
1134
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1135
|
-
},
|
|
1136
|
-
item: {
|
|
1137
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1138
|
-
},
|
|
1139
|
-
wrapper: {
|
|
1140
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1141
|
-
},
|
|
1142
|
-
option: {
|
|
1143
|
-
borderRadius: "var(--mantine-radius-xxs)"
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
},
|
|
1147
|
-
TextInput: {
|
|
1148
|
-
styles: {
|
|
1149
|
-
section: {
|
|
1150
|
-
marginRight: "0.2vh"
|
|
1151
|
-
},
|
|
1152
|
-
input: {
|
|
1153
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
},
|
|
1158
|
-
colors: {
|
|
1159
|
-
dark: [
|
|
1160
|
-
"#ffffff",
|
|
1161
|
-
"#e2e2e2",
|
|
1162
|
-
"#c6c6c6",
|
|
1163
|
-
"#aaaaaa",
|
|
1164
|
-
"#8d8d8d",
|
|
1165
|
-
"#717171",
|
|
1166
|
-
"#555555",
|
|
1167
|
-
"#393939",
|
|
1168
|
-
"#1c1c1c",
|
|
1169
|
-
"#000000"
|
|
1170
|
-
],
|
|
1171
|
-
dirk: [
|
|
1172
|
-
"#ffffff",
|
|
1173
|
-
"#f3fce9",
|
|
1174
|
-
"#dbf5bd",
|
|
1175
|
-
"#c3ee91",
|
|
1176
|
-
"#ace765",
|
|
1177
|
-
"#94e039",
|
|
1178
|
-
"#7ac61f",
|
|
1179
|
-
"#5f9a18",
|
|
1180
|
-
"#29420a",
|
|
1181
|
-
"#446e11"
|
|
1182
|
-
]
|
|
1183
|
-
}
|
|
1184
|
-
});
|
|
1185
|
-
var theme_default = theme;
|
|
1186
|
-
library.add(fas, far, fab);
|
|
1187
|
-
var useSettings = create((set) => ({
|
|
1188
|
-
game: "rdr3",
|
|
1189
|
-
primaryColor: "teal",
|
|
1190
|
-
primaryShade: 6,
|
|
1191
|
-
customTheme: {}
|
|
1192
|
-
}));
|
|
1193
|
-
function DirkProvider(props) {
|
|
1194
|
-
const primaryColor = useSettings((data) => data.primaryColor);
|
|
1195
|
-
const primaryShade = useSettings((data) => data.primaryShade);
|
|
1196
|
-
const customTheme = useSettings((data) => data.customTheme);
|
|
1197
|
-
const game = useSettings((data) => data.game);
|
|
1198
|
-
const mergedTheme = useMemo(() => ({
|
|
1199
|
-
...theme_default,
|
|
1200
|
-
primaryColor,
|
|
1201
|
-
primaryShade,
|
|
1202
|
-
colors: {
|
|
1203
|
-
...theme_default.colors,
|
|
1204
|
-
...customTheme
|
|
1205
|
-
// Custom theme colors will override/extend base colors
|
|
1206
|
-
}
|
|
1207
|
-
}), [primaryColor, primaryShade, customTheme]);
|
|
1208
|
-
useEffect(() => {
|
|
1209
|
-
document.fonts.ready.then(() => {
|
|
1210
|
-
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
|
|
1211
|
-
console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
|
|
1212
|
-
});
|
|
1213
|
-
}, [game]);
|
|
1214
|
-
return /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsx(Wrapper, { children: props.children }) });
|
|
1215
|
-
}
|
|
1216
|
-
function Wrapper({ children }) {
|
|
1217
|
-
const game = useSettings((data) => data.game);
|
|
1218
|
-
return isEnvBrowser() ? /* @__PURE__ */ jsx(
|
|
1219
|
-
BackgroundImage,
|
|
1220
|
-
{
|
|
1221
|
-
w: "100vw",
|
|
1222
|
-
h: "100vh",
|
|
1223
|
-
style: { overflow: "hidden" },
|
|
1224
|
-
src: game === "fivem" ? "https://i.ytimg.com/vi/TOxuNbXrO28/maxresdefault.jpg" : "https://raw.githubusercontent.com/Jump-On-Studios/RedM-jo_libs/refs/heads/main/source-repositories/Menu/public/assets/images/background_dev.jpg",
|
|
1225
|
-
children
|
|
1226
|
-
}
|
|
1227
|
-
) : /* @__PURE__ */ jsx(Fragment, { children });
|
|
1228
|
-
}
|
|
1229
1295
|
|
|
1230
|
-
export { BorderedIcon, Counter, DirkProvider, FloatingParticles, InfoBox, InputContainer, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, Segment, SegmentedControl, SegmentedProgress, Title, colorWithAlpha, copyToClipboard, fetchLuaTable, fetchNui, fetchOnLoad, internalEvent, isEnvBrowser, locale, localeStore, noop, numberToRoman, openLink, splitFAString, useNavigation, useNavigationStore, useNuiEvent, useSettings };
|
|
1296
|
+
export { BorderedIcon, Counter, DirkProvider, FloatingParticles, InfoBox, InputContainer, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, Segment, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, fetchLuaTable, fetchNui, fetchOnLoad, internalEvent, isEnvBrowser, locale, localeStore, noop, numberToRoman, openLink, splitFAString, useNavigation, useNavigationStore, useNuiEvent, useSettings, useTornEdges };
|
|
1231
1297
|
//# sourceMappingURL=index.js.map
|
|
1232
1298
|
//# sourceMappingURL=index.js.map
|