dirk-cfx-react 1.0.33 → 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.
Files changed (47) hide show
  1. package/dist/components/index.cjs +41 -9
  2. package/dist/components/index.cjs.map +1 -1
  3. package/dist/components/index.d.cts +274 -274
  4. package/dist/components/index.d.ts +274 -274
  5. package/dist/components/index.js +41 -9
  6. package/dist/components/index.js.map +1 -1
  7. package/dist/hooks/index.cjs +72 -0
  8. package/dist/hooks/index.cjs.map +1 -1
  9. package/dist/hooks/index.d.cts +6 -1
  10. package/dist/hooks/index.d.ts +6 -1
  11. package/dist/hooks/index.js +71 -1
  12. package/dist/hooks/index.js.map +1 -1
  13. package/dist/index.cjs +409 -393
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +410 -395
  18. package/dist/index.js.map +1 -1
  19. package/dist/providers/index.cjs +2 -53
  20. package/dist/providers/index.cjs.map +1 -1
  21. package/dist/providers/index.js +2 -52
  22. package/dist/providers/index.js.map +1 -1
  23. package/dist/styles/fonts.css +62 -0
  24. package/dist/styles/tornEdge.css +30 -0
  25. package/package.json +2 -3
  26. package/src/styles/fonts.css +62 -0
  27. package/src/styles/tornEdge.css +30 -0
  28. package/dist/Akrobat-Black-ZNQ3X2DR.woff +0 -0
  29. package/dist/Akrobat-Bold-WHODCGVH.woff +0 -0
  30. package/dist/Akrobat-ExtraLight-EEU4O7A5.woff +0 -0
  31. package/dist/Akrobat-Light-G27NBZ3I.woff +0 -0
  32. package/dist/Akrobat-Regular-BWHYS34M.woff +0 -0
  33. package/dist/Akrobat-SemiBold-W7XR4FV7.woff +0 -0
  34. package/dist/RedDead-6PKXYEUH.otf +0 -0
  35. package/dist/akrobat-extrabold-webfont-T2DLCOEC.woff +0 -0
  36. package/dist/styles/fonts.ts +0 -46
  37. package/src/styles/fonts.ts +0 -46
  38. /package/dist/{Akrobat-Black.woff → fonts/Akrobat-Black.woff} +0 -0
  39. /package/dist/{Akrobat-Bold.woff → fonts/Akrobat-Bold.woff} +0 -0
  40. /package/dist/{Akrobat-ExtraLight.woff → fonts/Akrobat-ExtraLight.woff} +0 -0
  41. /package/dist/{Akrobat-Light.woff → fonts/Akrobat-Light.woff} +0 -0
  42. /package/dist/{Akrobat-Regular.woff → fonts/Akrobat-Regular.woff} +0 -0
  43. /package/dist/{Akrobat-SemiBold.woff → fonts/Akrobat-SemiBold.woff} +0 -0
  44. /package/dist/{CREDC___.otf → fonts/CREDC___.otf} +0 -0
  45. /package/dist/{CREDC___.ttf → fonts/CREDC___.ttf} +0 -0
  46. /package/dist/{RedDead.otf → fonts/RedDead.otf} +0 -0
  47. /package/dist/{akrobat-extrabold-webfont.woff → fonts/akrobat-extrabold-webfont.woff} +0 -0
package/dist/index.js CHANGED
@@ -1,18 +1,20 @@
1
1
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
- import { Flex, Text, Image, createTheme, useMantineTheme, MantineProvider, BackgroundImage } from '@mantine/core';
3
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
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';
6
+ import './styles/fonts.css';
11
7
  import './styles/scrollBar.css';
8
+ import './styles/tornEdge.css';
12
9
  import { library } from '@fortawesome/fontawesome-svg-core';
13
10
  import { fab } from '@fortawesome/free-brands-svg-icons';
14
11
  import { far } from '@fortawesome/free-regular-svg-icons';
15
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';
16
18
 
17
19
  // src/components/BorderedIcon.tsx
18
20
 
@@ -183,15 +185,347 @@ function colorWithAlpha(color, alpha) {
183
185
  }
184
186
  return color;
185
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
+ }
186
519
  function BorderedIcon(props) {
187
520
  const theme2 = useMantineTheme();
521
+ const tornEdgeCSS = useTornEdges();
188
522
  return /* @__PURE__ */ jsx(
189
- FontAwesomeIcon,
523
+ Flex,
190
524
  {
191
- icon: props.icon,
192
- color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
525
+ className: tornEdgeCSS,
526
+ justify: "center",
527
+ align: "center",
193
528
  style: {
194
- // backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
195
529
  backgroundColor: "rgba(0, 0, 0, 0.5)",
196
530
  padding: props.p || theme2.spacing.xs,
197
531
  transition: "all 0.2s ease-in-out",
@@ -199,9 +533,19 @@ function BorderedIcon(props) {
199
533
  fontSize: props.fontSize ? props.fontSize : "2.5vh",
200
534
  borderRadius: theme2.radius.xs,
201
535
  // border: `2px solid var(--mantine-primary-color-9)`,
202
- outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][9], 0.8)}`,
536
+ // outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][9], 0.8)}`,
203
537
  boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][7], 0.5)}`
204
- }
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
+ )
205
549
  }
206
550
  );
207
551
  }
@@ -541,163 +885,63 @@ function InputContainer(props) {
541
885
  size: "xs",
542
886
  c: "rgba(255, 255, 255, 0.8)",
543
887
  fw: 400,
544
- children: props.description
545
- }
546
- )
547
- ]
548
- }
549
- ),
550
- props.error && /* @__PURE__ */ jsx(
551
- Text,
552
- {
553
- size: "xs",
554
- c: theme2.colors.red[9],
555
- fw: 600,
556
- mb: "auto",
557
- lh: "0.8",
558
- children: props.error
559
- }
560
- ),
561
- /* @__PURE__ */ jsx(
562
- Flex,
563
- {
564
- ml: "auto",
565
- children: props.rightSection
566
- }
567
- )
568
- ]
569
- }
570
- ),
571
- props.children
572
- ]
573
- }
574
- );
575
- }
576
- var useAudio = create(() => {
577
- const audioRefs = {};
578
- const sounds = {
579
- click: clickSoundUrl,
580
- hover: hoverSoundUrl
581
- };
582
- for (const [key, src] of Object.entries(sounds)) {
583
- audioRefs[key] = new Audio(src);
584
- }
585
- return {
586
- play: (sound) => {
587
- const audio = audioRefs[sound];
588
- if (!audio) return console.warn(`Sound '${sound}' not found.`);
589
- audio.currentTime = 0;
590
- audio.volume = 0.1;
591
- audio.play();
592
- },
593
- stop: (sound) => {
594
- const audio = audioRefs[sound];
595
- if (!audio) return console.warn(`Sound '${sound}' not found.`);
596
- audio.pause();
597
- audio.currentTime = 0;
598
- }
599
- };
600
- });
601
-
602
- // src/utils/misc.ts
603
- var isEnvBrowser = () => !window.invokeNative;
604
- var noop = () => {
605
- };
606
- var splitFAString = (faString) => {
607
- const [prefix, newIcon] = faString.split("-");
608
- if (!prefix || !newIcon) return { prefix: "fas", newIcon: "question" };
609
- return { prefix, newIcon };
610
- };
611
- var numberToRoman = (num) => {
612
- const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX"];
613
- return romanNumerals[num];
614
- };
615
- var copyToClipboard = (text) => {
616
- const el = document.createElement("textarea");
617
- el.value = text;
618
- document.body.appendChild(el);
619
- el.select();
620
- document.execCommand("copy");
621
- document.body.removeChild(el);
622
- };
623
- var openLink = (url) => {
624
- if (isEnvBrowser()) {
625
- window.open(url, "_blank");
626
- } else {
627
- window.invokeNative("openLink", url);
628
- }
629
- };
630
-
631
- // src/utils/fetchNui.ts
632
- async function fetchNui(eventName, data, mockData) {
633
- const options = {
634
- method: "post",
635
- headers: {
636
- "Content-Type": "application/json; charset=UTF-8"
637
- },
638
- body: JSON.stringify(data)
639
- };
640
- if (isEnvBrowser() && mockData !== void 0) return mockData;
641
- if (isEnvBrowser()) {
642
- console.warn(
643
- `[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
644
- );
645
- return {};
646
- }
647
- const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
648
- const resp = await fetch(`https://${resourceName}/${eventName}`, options);
649
- const respFormatted = await resp.json();
650
- return respFormatted;
651
- }
652
- function fetchOnLoad(eventName, data, mockData) {
653
- return fetchNui(eventName, data, mockData).catch((err) => {
654
- console.error(`[fetchOnLoad] Failed for ${eventName}:`, err);
655
- throw err;
656
- });
657
- }
658
- var fetchLuaTable = (tableName) => () => {
659
- if (isEnvBrowser()) {
660
- return Promise.resolve({});
661
- }
662
- return fetchNui("GET_LUA_TABLE", { tableName });
663
- };
664
-
665
- // src/utils/internalEvent.ts
666
- var internalEvent = (events, timer = 1e3) => {
667
- if (isEnvBrowser()) {
668
- for (const event of events) {
669
- setTimeout(() => {
670
- window.dispatchEvent(
671
- new MessageEvent("message", {
672
- data: {
673
- action: event.action,
674
- data: event.data
675
- }
676
- })
677
- );
678
- }, timer);
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
+ ]
679
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);
680
928
  }
681
- };
682
- var localeStore = create((set, get) => {
683
929
  return {
684
- locales: {
685
- "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."
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();
686
936
  },
687
- locale: (key, ...args) => {
688
- const exists = get().locales[key];
689
- let translation = exists || key;
690
- if (args.length) {
691
- translation = translation.replace(/%s/g, () => String(args.shift() || ""));
692
- }
693
- 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;
694
942
  }
695
943
  };
696
944
  });
697
- var locale = localeStore.getState().locale;
698
- fetchOnLoad("GET_LOCALES").then((data) => {
699
- localeStore.setState({ locales: data });
700
- });
701
945
  function SegmentedControl(props) {
702
946
  const theme2 = useMantineTheme();
703
947
  const play = useAudio((state) => state.play);
@@ -970,6 +1214,7 @@ function SegmentedProgress(props) {
970
1214
  );
971
1215
  }
972
1216
  function Title(props) {
1217
+ const game = useSettings((state) => state.game);
973
1218
  const theme2 = useMantineTheme();
974
1219
  return /* @__PURE__ */ jsx(
975
1220
  Flex,
@@ -1013,7 +1258,7 @@ function Title(props) {
1013
1258
  children: [
1014
1259
  /* @__PURE__ */ jsx(Text, { p: "0", size: "sm", style: {
1015
1260
  lineHeight: theme2.fontSizes.md,
1016
- fontFamily: "Akrobat Bold",
1261
+ fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
1017
1262
  letterSpacing: "0.05em",
1018
1263
  textTransform: "uppercase"
1019
1264
  }, children: props.title }),
@@ -1047,237 +1292,7 @@ function Title(props) {
1047
1292
  }
1048
1293
  );
1049
1294
  }
1050
- var useNuiEvent = (action, handler) => {
1051
- const savedHandler = useRef(noop);
1052
- useEffect(() => {
1053
- savedHandler.current = handler;
1054
- }, [handler]);
1055
- useEffect(() => {
1056
- const eventListener = (event) => {
1057
- const { action: eventAction, data } = event.data;
1058
- if (savedHandler.current) {
1059
- if (eventAction === action) {
1060
- savedHandler.current(data);
1061
- }
1062
- }
1063
- };
1064
- window.addEventListener("message", eventListener);
1065
- return () => window.removeEventListener("message", eventListener);
1066
- }, [action]);
1067
- };
1068
-
1069
- // src/fonts/Akrobat-Regular.woff
1070
- var Akrobat_Regular_default = "./Akrobat-Regular-BWHYS34M.woff";
1071
-
1072
- // src/fonts/Akrobat-Light.woff
1073
- var Akrobat_Light_default = "./Akrobat-Light-G27NBZ3I.woff";
1074
-
1075
- // src/fonts/Akrobat-ExtraLight.woff
1076
- var Akrobat_ExtraLight_default = "./Akrobat-ExtraLight-EEU4O7A5.woff";
1077
-
1078
- // src/fonts/Akrobat-SemiBold.woff
1079
- var Akrobat_SemiBold_default = "./Akrobat-SemiBold-W7XR4FV7.woff";
1080
-
1081
- // src/fonts/Akrobat-Bold.woff
1082
- var Akrobat_Bold_default = "./Akrobat-Bold-WHODCGVH.woff";
1083
-
1084
- // src/fonts/akrobat-extrabold-webfont.woff
1085
- var akrobat_extrabold_webfont_default = "./akrobat-extrabold-webfont-T2DLCOEC.woff";
1086
-
1087
- // src/fonts/Akrobat-Black.woff
1088
- var Akrobat_Black_default = "./Akrobat-Black-ZNQ3X2DR.woff";
1089
-
1090
- // src/fonts/RedDead.otf
1091
- var RedDead_default = "./RedDead-6PKXYEUH.otf";
1092
-
1093
- // src/styles/fonts.ts
1094
- function resolveFontUrl(fontPath) {
1095
- try {
1096
- return new URL(fontPath, import.meta.url).href;
1097
- } catch {
1098
- return fontPath;
1099
- }
1100
- }
1101
- var fontDefs = [
1102
- { name: "Akrobat Regular", src: Akrobat_Regular_default },
1103
- { name: "Akrobat Light", src: Akrobat_Light_default },
1104
- { name: "Akrobat ExtraLight", src: Akrobat_ExtraLight_default },
1105
- { name: "Akrobat SemiBold", src: Akrobat_SemiBold_default },
1106
- { name: "Akrobat Bold", src: Akrobat_Bold_default },
1107
- { name: "Akrobat ExtraBold Regular", src: akrobat_extrabold_webfont_default },
1108
- { name: "Akrobat Black", src: Akrobat_Black_default },
1109
- { name: "Red Dead", src: RedDead_default }
1110
- ];
1111
- for (const f of fontDefs) {
1112
- const url = resolveFontUrl(f.src);
1113
- console.log(`Loading font: ${f.name} from ${url}`);
1114
- const font = new FontFace(f.name, `url(${url})`);
1115
- font.load().then(() => {
1116
- document.fonts.add(font);
1117
- console.log(`\u2705 Loaded: ${f.name}`);
1118
- }).catch((err) => console.error(`\u274C Failed: ${f.name}`, err));
1119
- }
1120
- var theme = createTheme({
1121
- primaryColor: "dirk",
1122
- primaryShade: 9,
1123
- defaultRadius: "xxs",
1124
- fontFamily: "Akrobat Regular, sans-serif",
1125
- radius: {
1126
- xxs: "0.2vh",
1127
- xs: "0.4vh",
1128
- sm: "0.75vh",
1129
- md: "1vh",
1130
- lg: "1.5vh",
1131
- xl: "2vh",
1132
- xxl: "3vh"
1133
- },
1134
- fontSizes: {
1135
- xxs: "1.2vh",
1136
- xs: "1.5vh",
1137
- sm: "1.8vh",
1138
- md: "2.2vh",
1139
- lg: "2.8vh",
1140
- xl: "3.3vh",
1141
- xxl: "3.8vh"
1142
- },
1143
- spacing: {
1144
- xxs: "0.5vh",
1145
- xs: "0.75vh",
1146
- sm: "1.5vh",
1147
- md: "2vh",
1148
- lg: "3vh",
1149
- xl: "4vh",
1150
- xxl: "5vh"
1151
- },
1152
- components: {
1153
- Progress: {
1154
- styles: {
1155
- root: {
1156
- backgroundColor: "rgba(77, 77, 77, 0.4)"
1157
- }
1158
- }
1159
- },
1160
- Select: {
1161
- styles: {
1162
- dropdown: {
1163
- borderRadius: "var(--mantine-radius-xxs)"
1164
- },
1165
- input: {
1166
- padding: "var(--mantine-spacing-sm)"
1167
- },
1168
- item: {
1169
- borderRadius: "var(--mantine-radius-xxs)"
1170
- },
1171
- wrapper: {
1172
- borderRadius: "var(--mantine-radius-xxs)"
1173
- },
1174
- option: {
1175
- borderRadius: "var(--mantine-radius-xxs)"
1176
- }
1177
- }
1178
- },
1179
- MultiSelect: {
1180
- styles: {
1181
- dropdown: {
1182
- borderRadius: "var(--mantine-radius-xxs)"
1183
- },
1184
- pill: {
1185
- borderRadius: "var(--mantine-radius-xxs)"
1186
- },
1187
- item: {
1188
- borderRadius: "var(--mantine-radius-xxs)"
1189
- },
1190
- wrapper: {
1191
- borderRadius: "var(--mantine-radius-xxs)"
1192
- },
1193
- option: {
1194
- borderRadius: "var(--mantine-radius-xxs)"
1195
- }
1196
- }
1197
- },
1198
- TextInput: {
1199
- styles: {
1200
- section: {
1201
- marginRight: "0.2vh"
1202
- },
1203
- input: {
1204
- padding: "var(--mantine-spacing-sm)"
1205
- }
1206
- }
1207
- }
1208
- },
1209
- colors: {
1210
- dark: [
1211
- "#ffffff",
1212
- "#e2e2e2",
1213
- "#c6c6c6",
1214
- "#aaaaaa",
1215
- "#8d8d8d",
1216
- "#717171",
1217
- "#555555",
1218
- "#393939",
1219
- "#1c1c1c",
1220
- "#000000"
1221
- ],
1222
- dirk: [
1223
- "#ffffff",
1224
- "#f3fce9",
1225
- "#dbf5bd",
1226
- "#c3ee91",
1227
- "#ace765",
1228
- "#94e039",
1229
- "#7ac61f",
1230
- "#5f9a18",
1231
- "#29420a",
1232
- "#446e11"
1233
- ]
1234
- }
1235
- });
1236
- var theme_default = theme;
1237
- library.add(fas, far, fab);
1238
- var useSettings = create((set) => ({
1239
- game: "rdr3",
1240
- primaryColor: "teal",
1241
- primaryShade: 6,
1242
- customTheme: {}
1243
- }));
1244
- function DirkProvider(props) {
1245
- const primaryColor = useSettings((data) => data.primaryColor);
1246
- const primaryShade = useSettings((data) => data.primaryShade);
1247
- const customTheme = useSettings((data) => data.customTheme);
1248
- const game = useSettings((data) => data.game);
1249
- const mergedTheme = useMemo(() => ({
1250
- ...theme_default,
1251
- primaryColor,
1252
- primaryShade,
1253
- colors: {
1254
- ...theme_default.colors,
1255
- ...customTheme
1256
- // Custom theme colors will override/extend base colors
1257
- }
1258
- }), [primaryColor, primaryShade, customTheme]);
1259
- useEffect(() => {
1260
- document.fonts.ready.then(() => {
1261
- document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
1262
- console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
1263
- });
1264
- }, [game]);
1265
- return /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsx(Wrapper, { children: props.children }) });
1266
- }
1267
- function Wrapper({ children }) {
1268
- const game = useSettings((data) => data.game);
1269
- return isEnvBrowser() ? /* @__PURE__ */ jsx(
1270
- BackgroundImage,
1271
- {
1272
- w: "100vw",
1273
- h: "100vh",
1274
- style: { overflow: "hidden" },
1275
- 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",
1276
- children
1277
- }
1278
- ) : /* @__PURE__ */ jsx(Fragment, { children });
1279
- }
1280
1295
 
1281
- 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 };
1282
1297
  //# sourceMappingURL=index.js.map
1283
1298
  //# sourceMappingURL=index.js.map