dirk-cfx-react 1.0.0 → 1.0.2

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