dirk-cfx-react 1.0.0 → 1.0.1

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.
@@ -1,11 +1,9 @@
1
- 'use strict';
2
-
3
- var reactFontawesome = require('@fortawesome/react-fontawesome');
4
- var core = require('@mantine/core');
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var framerMotion = require('framer-motion');
7
- var react = require('react');
8
- var zustand = require('zustand');
1
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
+ import { Flex, Text, Image, useMantineTheme } from '@mantine/core';
3
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
+ import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
5
+ import { createContext, useRef, useState, useEffect, useContext } from 'react';
6
+ import { create, useStore } from 'zustand';
9
7
 
10
8
  // src/components/BorderedIcon.tsx
11
9
 
@@ -177,9 +175,9 @@ function colorWithAlpha(color, alpha) {
177
175
  return color;
178
176
  }
179
177
  function BorderedIcon(props) {
180
- const theme = core.useMantineTheme();
181
- return /* @__PURE__ */ jsxRuntime.jsx(
182
- reactFontawesome.FontAwesomeIcon,
178
+ const theme = useMantineTheme();
179
+ return /* @__PURE__ */ jsx(
180
+ FontAwesomeIcon,
183
181
  {
184
182
  icon: props.icon,
185
183
  color: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][theme.primaryShade], props.hovered ? 0.9 : 0.9),
@@ -198,12 +196,12 @@ function BorderedIcon(props) {
198
196
  }
199
197
  );
200
198
  }
201
- var MotionFlex = framerMotion.motion(core.Flex);
202
- var MotionText = framerMotion.motion(core.Text);
203
- var MotionIcon = framerMotion.motion(reactFontawesome.FontAwesomeIcon);
204
- var MotionImage = framerMotion.motion(core.Image);
199
+ var MotionFlex = motion(Flex);
200
+ var MotionText = motion(Text);
201
+ var MotionIcon = motion(FontAwesomeIcon);
202
+ var MotionImage = motion(Image);
205
203
  function Counter(props) {
206
- return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsxRuntime.jsx(
204
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsx(
207
205
  MotionFlex,
208
206
  {
209
207
  initial: { opacity: 0 },
@@ -238,10 +236,10 @@ var FloatingParticles = ({
238
236
  mouseRepelStrength = 50,
239
237
  backgroundColor = "transparent"
240
238
  }) => {
241
- const containerRef = react.useRef(null);
242
- const [particles, setParticles] = react.useState([]);
243
- const mouseX = framerMotion.useMotionValue(0);
244
- const mouseY = framerMotion.useMotionValue(0);
239
+ const containerRef = useRef(null);
240
+ const [particles, setParticles] = useState([]);
241
+ const mouseX = useMotionValue(0);
242
+ const mouseY = useMotionValue(0);
245
243
  const durationMap = {
246
244
  slow: { base: 10, variance: 10 },
247
245
  medium: { base: 2, variance: 2 },
@@ -252,7 +250,7 @@ var FloatingParticles = ({
252
250
  const x = Math.sin(seed) * 1e4;
253
251
  return x - Math.floor(x);
254
252
  };
255
- react.useEffect(() => {
253
+ useEffect(() => {
256
254
  if (!containerRef.current) return;
257
255
  const bounds = containerRef.current.getBoundingClientRect();
258
256
  const newParticles = [...Array(particleCount)].map((_, i) => {
@@ -273,7 +271,7 @@ var FloatingParticles = ({
273
271
  });
274
272
  setParticles(newParticles);
275
273
  }, [particleCount, icons.length, duration.base, duration.variance]);
276
- react.useEffect(() => {
274
+ useEffect(() => {
277
275
  if (!containerRef.current) return;
278
276
  const handleMouseMove = (e) => {
279
277
  const bounds = containerRef.current.getBoundingClientRect();
@@ -322,7 +320,7 @@ var FloatingParticles = ({
322
320
  container.removeEventListener("mouseleave", handleMouseLeave);
323
321
  };
324
322
  }, [mouseX, mouseY, mouseRepelDistance, mouseRepelStrength]);
325
- react.useEffect(() => {
323
+ useEffect(() => {
326
324
  const handleResize = () => {
327
325
  if (!containerRef.current) return;
328
326
  const bounds = containerRef.current.getBoundingClientRect();
@@ -345,7 +343,7 @@ var FloatingParticles = ({
345
343
  window.addEventListener("resize", handleResize);
346
344
  return () => window.removeEventListener("resize", handleResize);
347
345
  }, []);
348
- return /* @__PURE__ */ jsxRuntime.jsx(
346
+ return /* @__PURE__ */ jsx(
349
347
  "div",
350
348
  {
351
349
  ref: containerRef,
@@ -358,8 +356,8 @@ var FloatingParticles = ({
358
356
  backgroundColor,
359
357
  ...style
360
358
  },
361
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: particles.map((particle) => /* @__PURE__ */ jsxRuntime.jsx(
362
- framerMotion.motion.div,
359
+ children: /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: particles.map((particle) => /* @__PURE__ */ jsx(
360
+ motion.div,
363
361
  {
364
362
  style: {
365
363
  position: "absolute",
@@ -399,7 +397,7 @@ var FloatingParticles = ({
399
397
  ease: "easeInOut"
400
398
  }
401
399
  },
402
- children: particle.icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: particle.icon, style: { width: "70%", height: "70%" } }) }) : /* @__PURE__ */ jsxRuntime.jsx(
400
+ children: particle.icon ? /* @__PURE__ */ jsx("div", { style: { width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: particle.icon, style: { width: "70%", height: "70%" } }) }) : /* @__PURE__ */ jsx(
403
401
  "div",
404
402
  {
405
403
  style: {
@@ -417,12 +415,12 @@ var FloatingParticles = ({
417
415
  );
418
416
  };
419
417
  function Icon(props) {
420
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
418
+ return /* @__PURE__ */ jsx(Fragment, {});
421
419
  }
422
420
  function InfoBox(props) {
423
- const theme = core.useMantineTheme();
424
- return /* @__PURE__ */ jsxRuntime.jsxs(
425
- core.Flex,
421
+ const theme = useMantineTheme();
422
+ return /* @__PURE__ */ jsxs(
423
+ Flex,
426
424
  {
427
425
  w: "fit-content",
428
426
  h: "fit-content",
@@ -433,8 +431,8 @@ function InfoBox(props) {
433
431
  },
434
432
  align: "center",
435
433
  children: [
436
- /* @__PURE__ */ jsxRuntime.jsx(
437
- core.Flex,
434
+ /* @__PURE__ */ jsx(
435
+ Flex,
438
436
  {
439
437
  miw: "4vh",
440
438
  p: "xxs",
@@ -442,8 +440,8 @@ function InfoBox(props) {
442
440
  direction: "column",
443
441
  justify: "center",
444
442
  align: "center",
445
- children: /* @__PURE__ */ jsxRuntime.jsx(
446
- core.Text,
443
+ children: /* @__PURE__ */ jsx(
444
+ Text,
447
445
  {
448
446
  c: "lightgrey",
449
447
  size: "xxs",
@@ -457,8 +455,8 @@ function InfoBox(props) {
457
455
  )
458
456
  }
459
457
  ),
460
- /* @__PURE__ */ jsxRuntime.jsx(
461
- core.Flex,
458
+ /* @__PURE__ */ jsx(
459
+ Flex,
462
460
  {
463
461
  p: "xxs",
464
462
  flex: 1,
@@ -467,8 +465,8 @@ function InfoBox(props) {
467
465
  direction: "column",
468
466
  align: "center",
469
467
  justify: "center",
470
- children: /* @__PURE__ */ jsxRuntime.jsx(
471
- core.Text,
468
+ children: /* @__PURE__ */ jsx(
469
+ Text,
472
470
  {
473
471
  c: "lightgrey",
474
472
  size: "xxs",
@@ -487,8 +485,8 @@ function InfoBox(props) {
487
485
  );
488
486
  }
489
487
  function InputContainer(props) {
490
- const theme = core.useMantineTheme();
491
- return /* @__PURE__ */ jsxRuntime.jsxs(
488
+ const theme = useMantineTheme();
489
+ return /* @__PURE__ */ jsxs(
492
490
  MotionFlex,
493
491
  {
494
492
  w: props.w || "100%",
@@ -506,20 +504,20 @@ function InputContainer(props) {
506
504
  },
507
505
  variants: props.variants,
508
506
  children: [
509
- /* @__PURE__ */ jsxRuntime.jsxs(
510
- core.Flex,
507
+ /* @__PURE__ */ jsxs(
508
+ Flex,
511
509
  {
512
510
  align: "center",
513
511
  gap: "xs",
514
512
  children: [
515
- /* @__PURE__ */ jsxRuntime.jsxs(
516
- core.Flex,
513
+ /* @__PURE__ */ jsxs(
514
+ Flex,
517
515
  {
518
516
  direction: "column",
519
517
  gap: "xxs",
520
518
  children: [
521
- props.title && /* @__PURE__ */ jsxRuntime.jsx(
522
- core.Text,
519
+ props.title && /* @__PURE__ */ jsx(
520
+ Text,
523
521
  {
524
522
  size: "sm",
525
523
  style: {
@@ -531,8 +529,8 @@ function InputContainer(props) {
531
529
  children: props.title
532
530
  }
533
531
  ),
534
- props.description && /* @__PURE__ */ jsxRuntime.jsx(
535
- core.Text,
532
+ props.description && /* @__PURE__ */ jsx(
533
+ Text,
536
534
  {
537
535
  size: "xs",
538
536
  c: "rgba(255, 255, 255, 0.8)",
@@ -543,8 +541,8 @@ function InputContainer(props) {
543
541
  ]
544
542
  }
545
543
  ),
546
- props.error && /* @__PURE__ */ jsxRuntime.jsx(
547
- core.Text,
544
+ props.error && /* @__PURE__ */ jsx(
545
+ Text,
548
546
  {
549
547
  size: "xs",
550
548
  c: theme.colors.red[9],
@@ -554,8 +552,8 @@ function InputContainer(props) {
554
552
  children: props.error
555
553
  }
556
554
  ),
557
- /* @__PURE__ */ jsxRuntime.jsx(
558
- core.Flex,
555
+ /* @__PURE__ */ jsx(
556
+ Flex,
559
557
  {
560
558
  ml: "auto",
561
559
  children: props.rightSection
@@ -577,7 +575,7 @@ var click_sound_default = "../click_sound-PNCRRTM4.mp3";
577
575
  var hover_sound_default = "../hover_sound-NBUA222C.mp3";
578
576
 
579
577
  // src/hooks/useAudio/store.ts
580
- var useAudio = zustand.create(() => {
578
+ var useAudio = create(() => {
581
579
  const audioRefs = {};
582
580
  const sounds = {
583
581
  click: click_sound_default,
@@ -628,7 +626,7 @@ function fetchOnLoad(eventName, data, mockData) {
628
626
  throw err;
629
627
  });
630
628
  }
631
- var localeStore = zustand.create((set, get) => {
629
+ var localeStore = create((set, get) => {
632
630
  return {
633
631
  locales: {
634
632
  "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."
@@ -648,7 +646,7 @@ fetchOnLoad("GET_LOCALES").then((data) => {
648
646
  localeStore.setState({ locales: data });
649
647
  });
650
648
  function SegmentedControl(props) {
651
- const theme = core.useMantineTheme();
649
+ const theme = useMantineTheme();
652
650
  const play = useAudio((state) => state.play);
653
651
  const handleChange = (newValue) => {
654
652
  if (props.sounds) play("click");
@@ -656,8 +654,8 @@ function SegmentedControl(props) {
656
654
  props.onChange(newValue);
657
655
  }
658
656
  };
659
- return /* @__PURE__ */ jsxRuntime.jsx(
660
- core.Flex,
657
+ return /* @__PURE__ */ jsx(
658
+ Flex,
661
659
  {
662
660
  bg: "rgba(33, 33, 33, 0.6)",
663
661
  w: props.w || "fit-content",
@@ -666,8 +664,8 @@ function SegmentedControl(props) {
666
664
  overflow: "hidden"
667
665
  },
668
666
  ...props,
669
- children: props.items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
670
- framerMotion.motion.div,
667
+ children: props.items.map((item, index) => /* @__PURE__ */ jsx(
668
+ motion.div,
671
669
  {
672
670
  initial: { x: -100, opacity: 0 },
673
671
  animate: { x: 0, opacity: 1 },
@@ -678,7 +676,7 @@ function SegmentedControl(props) {
678
676
  alignItems: "center",
679
677
  flex: 1
680
678
  },
681
- children: /* @__PURE__ */ jsxRuntime.jsx(
679
+ children: /* @__PURE__ */ jsx(
682
680
  Segment,
683
681
  {
684
682
  label: item.label,
@@ -705,8 +703,8 @@ function SegmentedControl(props) {
705
703
  );
706
704
  }
707
705
  function Segment(props) {
708
- const theme = core.useMantineTheme();
709
- return /* @__PURE__ */ jsxRuntime.jsxs(
706
+ const theme = useMantineTheme();
707
+ return /* @__PURE__ */ jsxs(
710
708
  MotionFlex,
711
709
  {
712
710
  onClick: props.onClick,
@@ -724,14 +722,14 @@ function Segment(props) {
724
722
  whileHover: { scale: 1.05 },
725
723
  whileTap: { scale: 0.95 },
726
724
  children: [
727
- /* @__PURE__ */ jsxRuntime.jsxs(
728
- core.Flex,
725
+ /* @__PURE__ */ jsxs(
726
+ Flex,
729
727
  {
730
728
  align: "center",
731
729
  gap: "xs",
732
730
  p: "xs",
733
731
  children: [
734
- props.icon && /* @__PURE__ */ jsxRuntime.jsx(
732
+ props.icon && /* @__PURE__ */ jsx(
735
733
  MotionIcon,
736
734
  {
737
735
  icon: props.icon,
@@ -750,7 +748,7 @@ function Segment(props) {
750
748
  }
751
749
  }
752
750
  ),
753
- /* @__PURE__ */ jsxRuntime.jsx(
751
+ /* @__PURE__ */ jsx(
754
752
  MotionText,
755
753
  {
756
754
  size: props.fz || "xs",
@@ -775,8 +773,8 @@ function Segment(props) {
775
773
  ]
776
774
  }
777
775
  ),
778
- /* @__PURE__ */ jsxRuntime.jsx(
779
- framerMotion.motion.div,
776
+ /* @__PURE__ */ jsx(
777
+ motion.div,
780
778
  {
781
779
  initial: false,
782
780
  animate: {
@@ -803,33 +801,33 @@ function Segment(props) {
803
801
  }
804
802
  );
805
803
  }
806
- var NavigationContext = react.createContext(null);
804
+ var NavigationContext = createContext(null);
807
805
  function useNavigation(selector) {
808
- const navigation = react.useContext(NavigationContext);
806
+ const navigation = useContext(NavigationContext);
809
807
  if (!navigation) {
810
808
  throw new Error("useNavigation must be used within a NavigationProvider");
811
809
  }
812
- return zustand.useStore(navigation, selector);
810
+ return useStore(navigation, selector);
813
811
  }
814
812
  function useNavigationStore() {
815
- const navigation = react.useContext(NavigationContext);
813
+ const navigation = useContext(NavigationContext);
816
814
  if (!navigation) {
817
815
  throw new Error("useNavigationStore must be used within a NavigationProvider");
818
816
  }
819
817
  return navigation;
820
818
  }
821
819
  function NavigationProvider({ children, defaultPage }) {
822
- const storeRef = react.useRef(
823
- zustand.create(() => ({
820
+ const storeRef = useRef(
821
+ create(() => ({
824
822
  pageId: defaultPage || "home"
825
823
  }))
826
824
  );
827
- return /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value: storeRef.current, children });
825
+ return /* @__PURE__ */ jsx(NavigationContext.Provider, { value: storeRef.current, children });
828
826
  }
829
827
  function NavBar(props) {
830
828
  const pageId = useNavigation((state) => state.pageId);
831
829
  const store = useNavigationStore();
832
- return /* @__PURE__ */ jsxRuntime.jsx(
830
+ return /* @__PURE__ */ jsx(
833
831
  SegmentedControl,
834
832
  {
835
833
  sounds: true,
@@ -888,7 +886,7 @@ function SegmentedProgress(props) {
888
886
  const progressPerSegment = 100 / props.segments;
889
887
  const filledSegments = Math.floor(props.progress / progressPerSegment);
890
888
  const partialFill = props.progress % progressPerSegment / progressPerSegment;
891
- return /* @__PURE__ */ jsxRuntime.jsx(
889
+ return /* @__PURE__ */ jsx(
892
890
  MotionFlex,
893
891
  {
894
892
  w: "100%",
@@ -900,8 +898,8 @@ function SegmentedProgress(props) {
900
898
  children: [...Array(props.segments)].map((_, index) => {
901
899
  const isFilled = index < filledSegments;
902
900
  const isPartial = index === filledSegments;
903
- return /* @__PURE__ */ jsxRuntime.jsx(
904
- framerMotion.motion.div,
901
+ return /* @__PURE__ */ jsx(
902
+ motion.div,
905
903
  {
906
904
  variants: itemVariants,
907
905
  style: {
@@ -919,9 +917,9 @@ function SegmentedProgress(props) {
919
917
  );
920
918
  }
921
919
  function Title(props) {
922
- const theme = core.useMantineTheme();
923
- return /* @__PURE__ */ jsxRuntime.jsx(
924
- core.Flex,
920
+ const theme = useMantineTheme();
921
+ return /* @__PURE__ */ jsx(
922
+ Flex,
925
923
  {
926
924
  mt: props.mt,
927
925
  direction: "column",
@@ -933,20 +931,20 @@ function Title(props) {
933
931
  userSelect: "none",
934
932
  borderBottom: props.removeBorder ? "none" : `0.2vh solid ${props.borderColor || colorWithAlpha(theme.colors[theme.primaryColor][9], 0.5)}`
935
933
  },
936
- children: /* @__PURE__ */ jsxRuntime.jsxs(
937
- core.Flex,
934
+ children: /* @__PURE__ */ jsxs(
935
+ Flex,
938
936
  {
939
937
  align: "center",
940
938
  justify: "center",
941
939
  children: [
942
- /* @__PURE__ */ jsxRuntime.jsxs(
943
- core.Flex,
940
+ /* @__PURE__ */ jsxs(
941
+ Flex,
944
942
  {
945
943
  align: "center",
946
944
  gap: "sm",
947
945
  pr: "xs",
948
946
  children: [
949
- /* @__PURE__ */ jsxRuntime.jsx(
947
+ /* @__PURE__ */ jsx(
950
948
  BorderedIcon,
951
949
  {
952
950
  icon: props.icon,
@@ -954,20 +952,20 @@ function Title(props) {
954
952
  color: props.iconColor
955
953
  }
956
954
  ),
957
- /* @__PURE__ */ jsxRuntime.jsxs(
958
- core.Flex,
955
+ /* @__PURE__ */ jsxs(
956
+ Flex,
959
957
  {
960
958
  direction: "column",
961
959
  gap: "0.25vh",
962
960
  children: [
963
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { p: "0", size: "sm", style: {
961
+ /* @__PURE__ */ jsx(Text, { p: "0", size: "sm", style: {
964
962
  lineHeight: theme.fontSizes.md,
965
963
  fontFamily: "Akrobat Bold",
966
964
  letterSpacing: "0.05em",
967
965
  textTransform: "uppercase"
968
966
  }, children: props.title }),
969
- /* @__PURE__ */ jsxRuntime.jsx(
970
- core.Text,
967
+ /* @__PURE__ */ jsx(
968
+ Text,
971
969
  {
972
970
  size: "xs",
973
971
  c: "grey",
@@ -981,8 +979,8 @@ function Title(props) {
981
979
  ]
982
980
  }
983
981
  ),
984
- /* @__PURE__ */ jsxRuntime.jsx(
985
- core.Flex,
982
+ /* @__PURE__ */ jsx(
983
+ Flex,
986
984
  {
987
985
  ml: "auto",
988
986
  align: "center",
@@ -997,24 +995,6 @@ function Title(props) {
997
995
  );
998
996
  }
999
997
 
1000
- exports.BorderedIcon = BorderedIcon;
1001
- exports.Counter = Counter;
1002
- exports.FloatingParticles = FloatingParticles;
1003
- exports.Icon = Icon;
1004
- exports.InfoBox = InfoBox;
1005
- exports.InputContainer = InputContainer;
1006
- exports.MotionFlex = MotionFlex;
1007
- exports.MotionIcon = MotionIcon;
1008
- exports.MotionImage = MotionImage;
1009
- exports.MotionText = MotionText;
1010
- exports.NavBar = NavBar;
1011
- exports.NavigationContext = NavigationContext;
1012
- exports.NavigationProvider = NavigationProvider;
1013
- exports.Segment = Segment;
1014
- exports.SegmentedControl = SegmentedControl;
1015
- exports.SegmentedProgress = SegmentedProgress;
1016
- exports.Title = Title;
1017
- exports.useNavigation = useNavigation;
1018
- exports.useNavigationStore = useNavigationStore;
998
+ export { BorderedIcon, Counter, FloatingParticles, Icon, InfoBox, InputContainer, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, Segment, SegmentedControl, SegmentedProgress, Title, useNavigation, useNavigationStore };
1019
999
  //# sourceMappingURL=index.js.map
1020
1000
  //# sourceMappingURL=index.js.map