dirk-cfx-react 1.0.37 → 1.0.40
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 +154 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +24 -1
- package/dist/components/index.d.ts +24 -1
- package/dist/components/index.js +151 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +159 -5
- 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 +156 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BorderedIcon, BorderedIconProps, ButtonProps, Counter, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, NavigationStore, ParticleState, ProgressProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, Title, TitleProps, useNavigation, useNavigationStore } from './components/index.cjs';
|
|
1
|
+
export { BorderedIcon, BorderedIconProps, ButtonProps, Counter, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, NavigationStore, ParticleState, ProgressProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, Title, TitleProps, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
|
|
2
2
|
export { InitialFetch, InternalEvent, SkillSettings, colorWithAlpha, copyToClipboard, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useProfanityStore } from './utils/index.cjs';
|
|
3
3
|
export { TornEdgeSVGFilter, useNuiEvent, useTornEdges } from './hooks/index.cjs';
|
|
4
4
|
export { DirkProvider, DirkProviderProps, useSettings } from './providers/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BorderedIcon, BorderedIconProps, ButtonProps, Counter, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, NavigationStore, ParticleState, ProgressProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, Title, TitleProps, useNavigation, useNavigationStore } from './components/index.js';
|
|
1
|
+
export { BorderedIcon, BorderedIconProps, ButtonProps, Counter, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, NavigationStore, ParticleState, ProgressProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, Title, TitleProps, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
|
|
2
2
|
export { InitialFetch, InternalEvent, SkillSettings, colorWithAlpha, copyToClipboard, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useProfanityStore } from './utils/index.js';
|
|
3
3
|
export { TornEdgeSVGFilter, useNuiEvent, useTornEdges } from './hooks/index.js';
|
|
4
4
|
export { DirkProvider, DirkProviderProps, useSettings } from './providers/index.js';
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
15
15
|
import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
|
|
16
16
|
import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
|
|
17
17
|
import hoverSoundUrl from './hover_sound-NBUA222C.mp3';
|
|
18
|
+
import { useClickOutside } from '@mantine/hooks';
|
|
18
19
|
|
|
19
20
|
// src/components/BorderedIcon.tsx
|
|
20
21
|
|
|
@@ -714,7 +715,7 @@ function getLevelFromXP(xp, levelMap, settings) {
|
|
|
714
715
|
return settings.maxLevel;
|
|
715
716
|
}
|
|
716
717
|
function createSkill(defaultSettings) {
|
|
717
|
-
const
|
|
718
|
+
const useStore3 = create((set) => ({
|
|
718
719
|
settings: defaultSettings,
|
|
719
720
|
levelMap: generateLevelMap(defaultSettings),
|
|
720
721
|
setSettings: (updater) => set((state) => {
|
|
@@ -726,7 +727,7 @@ function createSkill(defaultSettings) {
|
|
|
726
727
|
})
|
|
727
728
|
}));
|
|
728
729
|
const useSkill = (xp) => {
|
|
729
|
-
const { settings, levelMap } =
|
|
730
|
+
const { settings, levelMap } = useStore3();
|
|
730
731
|
return useMemo(() => {
|
|
731
732
|
const currentLevel = getLevelFromXP(xp, levelMap, settings);
|
|
732
733
|
const nextLevel = Math.min(currentLevel + 1, settings.maxLevel);
|
|
@@ -748,12 +749,12 @@ function createSkill(defaultSettings) {
|
|
|
748
749
|
};
|
|
749
750
|
const skill = {
|
|
750
751
|
get settings() {
|
|
751
|
-
return
|
|
752
|
+
return useStore3.getState().settings;
|
|
752
753
|
},
|
|
753
754
|
setSettings: (updater) => {
|
|
754
|
-
|
|
755
|
+
useStore3.getState().setSettings(updater);
|
|
755
756
|
},
|
|
756
|
-
useSettings: () =>
|
|
757
|
+
useSettings: () => useStore3((state) => state.settings)
|
|
757
758
|
};
|
|
758
759
|
return {
|
|
759
760
|
skill,
|
|
@@ -1749,7 +1750,156 @@ function Title(props) {
|
|
|
1749
1750
|
}
|
|
1750
1751
|
);
|
|
1751
1752
|
}
|
|
1753
|
+
var ModalContext = createContext(null);
|
|
1754
|
+
function useModal(selector) {
|
|
1755
|
+
const modal = useContext(ModalContext);
|
|
1756
|
+
if (!modal) {
|
|
1757
|
+
throw new Error("useModal must be used within a ModalProvider");
|
|
1758
|
+
}
|
|
1759
|
+
return useStore(modal, selector);
|
|
1760
|
+
}
|
|
1761
|
+
function ModalProvider({ children, defaultPage }) {
|
|
1762
|
+
const storeRef = useRef(
|
|
1763
|
+
create(() => ({
|
|
1764
|
+
active: null
|
|
1765
|
+
}))
|
|
1766
|
+
);
|
|
1767
|
+
return /* @__PURE__ */ jsxs(ModalContext.Provider, { value: storeRef.current, children: [
|
|
1768
|
+
/* @__PURE__ */ jsx(Modal, {}),
|
|
1769
|
+
children
|
|
1770
|
+
] });
|
|
1771
|
+
}
|
|
1772
|
+
function useModalActions() {
|
|
1773
|
+
const modal = useContext(ModalContext);
|
|
1774
|
+
if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
|
|
1775
|
+
const showModal = (openModal) => {
|
|
1776
|
+
modal.setState({ active: openModal });
|
|
1777
|
+
};
|
|
1778
|
+
const hideModal = () => {
|
|
1779
|
+
modal.setState({ active: null });
|
|
1780
|
+
};
|
|
1781
|
+
return { showModal, hideModal };
|
|
1782
|
+
}
|
|
1783
|
+
function Modal() {
|
|
1784
|
+
const active = useModal((state) => state.active);
|
|
1785
|
+
const { hideModal } = useModalActions();
|
|
1786
|
+
const ref = useClickOutside(() => {
|
|
1787
|
+
if (!active) return;
|
|
1788
|
+
if (active.clickOutside == false) return;
|
|
1789
|
+
if (active) {
|
|
1790
|
+
hideModal();
|
|
1791
|
+
}
|
|
1792
|
+
});
|
|
1793
|
+
const theme2 = useMantineTheme();
|
|
1794
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: active && /* @__PURE__ */ jsx(
|
|
1795
|
+
MotionFlex,
|
|
1796
|
+
{
|
|
1797
|
+
h: "100%",
|
|
1798
|
+
w: "100%",
|
|
1799
|
+
bg: "rgba(0, 0, 0, 0.3)",
|
|
1800
|
+
pos: "absolute",
|
|
1801
|
+
style: {
|
|
1802
|
+
zIndex: 2e3,
|
|
1803
|
+
filter: "drop-shadow(0 0 2vh black)"
|
|
1804
|
+
},
|
|
1805
|
+
initial: { opacity: 0 },
|
|
1806
|
+
animate: { opacity: 1 },
|
|
1807
|
+
exit: { opacity: 0 },
|
|
1808
|
+
align: "center",
|
|
1809
|
+
justify: "center",
|
|
1810
|
+
children: /* @__PURE__ */ jsxs(
|
|
1811
|
+
MotionFlex,
|
|
1812
|
+
{
|
|
1813
|
+
pos: "absolute",
|
|
1814
|
+
top: "50%",
|
|
1815
|
+
left: "50%",
|
|
1816
|
+
ref,
|
|
1817
|
+
w: active.width || "40%",
|
|
1818
|
+
style: {
|
|
1819
|
+
transform: "translate(-50%, -50%)",
|
|
1820
|
+
borderRadius: theme2.radius.xs,
|
|
1821
|
+
boxShadow: theme2.shadows.xl,
|
|
1822
|
+
zIndex: 2100
|
|
1823
|
+
},
|
|
1824
|
+
bg: "rgba(48, 48, 48, 0.84)",
|
|
1825
|
+
initial: { scale: 0.8, opacity: 0, transform: "translate(-50%, -50%)" },
|
|
1826
|
+
animate: { scale: 1, opacity: 1, transform: "translate(-50%, -50%)" },
|
|
1827
|
+
exit: { scale: 0.8, opacity: 0, transform: "translate(-50%, -50%)" },
|
|
1828
|
+
p: "sm",
|
|
1829
|
+
direction: "column",
|
|
1830
|
+
maw: "70%",
|
|
1831
|
+
gap: "xs",
|
|
1832
|
+
children: [
|
|
1833
|
+
/* @__PURE__ */ jsxs(
|
|
1834
|
+
Flex,
|
|
1835
|
+
{
|
|
1836
|
+
direction: "column",
|
|
1837
|
+
w: "100%",
|
|
1838
|
+
children: [
|
|
1839
|
+
/* @__PURE__ */ jsxs(
|
|
1840
|
+
Flex,
|
|
1841
|
+
{
|
|
1842
|
+
w: "100%",
|
|
1843
|
+
align: "center",
|
|
1844
|
+
gap: "xs",
|
|
1845
|
+
children: [
|
|
1846
|
+
active.icon && /* @__PURE__ */ jsx(
|
|
1847
|
+
FontAwesomeIcon,
|
|
1848
|
+
{
|
|
1849
|
+
icon: active.icon,
|
|
1850
|
+
style: {
|
|
1851
|
+
fontSize: theme2.fontSizes.xs
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
),
|
|
1855
|
+
/* @__PURE__ */ jsx(
|
|
1856
|
+
Text,
|
|
1857
|
+
{
|
|
1858
|
+
size: "sm",
|
|
1859
|
+
children: active.title
|
|
1860
|
+
}
|
|
1861
|
+
),
|
|
1862
|
+
/* @__PURE__ */ jsx(
|
|
1863
|
+
MotionIcon,
|
|
1864
|
+
{
|
|
1865
|
+
icon: "times",
|
|
1866
|
+
color: "rgba(255, 255, 255, 0.7)",
|
|
1867
|
+
whileHover: {
|
|
1868
|
+
scale: 1.1,
|
|
1869
|
+
filter: "brightness(1.2)"
|
|
1870
|
+
},
|
|
1871
|
+
style: {
|
|
1872
|
+
marginLeft: "auto",
|
|
1873
|
+
cursor: "pointer",
|
|
1874
|
+
fontSize: theme2.fontSizes.sm
|
|
1875
|
+
},
|
|
1876
|
+
onClick: () => {
|
|
1877
|
+
hideModal();
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
)
|
|
1881
|
+
]
|
|
1882
|
+
}
|
|
1883
|
+
),
|
|
1884
|
+
active.description && /* @__PURE__ */ jsx(
|
|
1885
|
+
Text,
|
|
1886
|
+
{
|
|
1887
|
+
size: "xs",
|
|
1888
|
+
c: "rgba(255, 255, 255, 0.7)",
|
|
1889
|
+
children: active.description
|
|
1890
|
+
}
|
|
1891
|
+
)
|
|
1892
|
+
]
|
|
1893
|
+
}
|
|
1894
|
+
),
|
|
1895
|
+
active.children
|
|
1896
|
+
]
|
|
1897
|
+
}
|
|
1898
|
+
)
|
|
1899
|
+
}
|
|
1900
|
+
) });
|
|
1901
|
+
}
|
|
1752
1902
|
|
|
1753
|
-
export { BorderedIcon, Counter, DirkProvider, FloatingParticles, InfoBox, InputContainer, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
|
|
1903
|
+
export { BorderedIcon, Counter, DirkProvider, FloatingParticles, InfoBox, InputContainer, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
|
|
1754
1904
|
//# sourceMappingURL=index.js.map
|
|
1755
1905
|
//# sourceMappingURL=index.js.map
|