dirk-cfx-react 1.0.36 → 1.0.38
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 +166 -12
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +27 -6
- package/dist/components/index.d.ts +27 -6
- package/dist/components/index.js +164 -13
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +171 -17
- 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 +169 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
17
17
|
var framerMotion = require('framer-motion');
|
|
18
18
|
var clickSoundUrl = require('./click_sound-PNCRRTM4.mp3');
|
|
19
19
|
var hoverSoundUrl = require('./hover_sound-NBUA222C.mp3');
|
|
20
|
+
var hooks = require('@mantine/hooks');
|
|
20
21
|
|
|
21
22
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
23
|
|
|
@@ -170,11 +171,11 @@ var colorNames = {
|
|
|
170
171
|
Yellow: { r: 255, g: 255, b: 0 },
|
|
171
172
|
YellowGreen: { r: 154, g: 205, b: 50 }
|
|
172
173
|
};
|
|
173
|
-
function colorWithAlpha(color,
|
|
174
|
+
function colorWithAlpha(color, alpha2) {
|
|
174
175
|
const lowerCasedColor = color.toLowerCase();
|
|
175
176
|
if (colorNames[lowerCasedColor]) {
|
|
176
177
|
const rgb = colorNames[lowerCasedColor];
|
|
177
|
-
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${
|
|
178
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha2})`;
|
|
178
179
|
}
|
|
179
180
|
if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
|
|
180
181
|
const hex = color.slice(1);
|
|
@@ -182,12 +183,12 @@ function colorWithAlpha(color, alpha) {
|
|
|
182
183
|
const r = bigint >> 16 & 255;
|
|
183
184
|
const g = bigint >> 8 & 255;
|
|
184
185
|
const b = bigint & 255;
|
|
185
|
-
return `rgba(${r}, ${g}, ${b}, ${
|
|
186
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha2})`;
|
|
186
187
|
}
|
|
187
188
|
if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
|
|
188
189
|
const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
|
|
189
190
|
if (result) {
|
|
190
|
-
return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${
|
|
191
|
+
return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha2})`;
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
return color;
|
|
@@ -721,7 +722,7 @@ function getLevelFromXP(xp, levelMap, settings) {
|
|
|
721
722
|
return settings.maxLevel;
|
|
722
723
|
}
|
|
723
724
|
function createSkill(defaultSettings) {
|
|
724
|
-
const
|
|
725
|
+
const useStore3 = zustand.create((set) => ({
|
|
725
726
|
settings: defaultSettings,
|
|
726
727
|
levelMap: generateLevelMap(defaultSettings),
|
|
727
728
|
setSettings: (updater) => set((state) => {
|
|
@@ -733,7 +734,7 @@ function createSkill(defaultSettings) {
|
|
|
733
734
|
})
|
|
734
735
|
}));
|
|
735
736
|
const useSkill = (xp) => {
|
|
736
|
-
const { settings, levelMap } =
|
|
737
|
+
const { settings, levelMap } = useStore3();
|
|
737
738
|
return react.useMemo(() => {
|
|
738
739
|
const currentLevel = getLevelFromXP(xp, levelMap, settings);
|
|
739
740
|
const nextLevel = Math.min(currentLevel + 1, settings.maxLevel);
|
|
@@ -755,12 +756,12 @@ function createSkill(defaultSettings) {
|
|
|
755
756
|
};
|
|
756
757
|
const skill = {
|
|
757
758
|
get settings() {
|
|
758
|
-
return
|
|
759
|
+
return useStore3.getState().settings;
|
|
759
760
|
},
|
|
760
761
|
setSettings: (updater) => {
|
|
761
|
-
|
|
762
|
+
useStore3.getState().setSettings(updater);
|
|
762
763
|
},
|
|
763
|
-
useSettings: () =>
|
|
764
|
+
useSettings: () => useStore3((state) => state.settings)
|
|
764
765
|
};
|
|
765
766
|
return {
|
|
766
767
|
skill,
|
|
@@ -1421,7 +1422,7 @@ function SegmentedControl(props) {
|
|
|
1421
1422
|
bg: "rgba(33, 33, 33, 0.6)",
|
|
1422
1423
|
w: props.w || "fit-content",
|
|
1423
1424
|
style: {
|
|
1424
|
-
borderRadius: theme2.radius.xs,
|
|
1425
|
+
borderRadius: props.enableRadius !== false ? theme2.radius.xs : 0,
|
|
1425
1426
|
overflow: "hidden"
|
|
1426
1427
|
},
|
|
1427
1428
|
...props,
|
|
@@ -1445,6 +1446,7 @@ function SegmentedControl(props) {
|
|
|
1445
1446
|
icon: item.icon,
|
|
1446
1447
|
rightSection: item.rightSection,
|
|
1447
1448
|
fz: props.fz,
|
|
1449
|
+
color: props.color,
|
|
1448
1450
|
selected: !props.multi ? props.value === item.value : Array.isArray(props.value) && props.value.includes(item.value),
|
|
1449
1451
|
onClick: () => {
|
|
1450
1452
|
if (props.multi) {
|
|
@@ -1473,7 +1475,7 @@ function Segment(props) {
|
|
|
1473
1475
|
direction: "column",
|
|
1474
1476
|
align: "center",
|
|
1475
1477
|
h: "100%",
|
|
1476
|
-
bg: props.selected ? colorWithAlpha(theme2.colors[theme2.primaryColor][theme2.primaryShade], 0.2) : "transparent",
|
|
1478
|
+
bg: props.selected ? props.color ? core.alpha(props.color, 0.2) : colorWithAlpha(theme2.colors[theme2.primaryColor][theme2.primaryShade], 0.2) : "transparent",
|
|
1477
1479
|
pos: "relative",
|
|
1478
1480
|
style: {
|
|
1479
1481
|
// position: "relative",
|
|
@@ -1495,10 +1497,10 @@ function Segment(props) {
|
|
|
1495
1497
|
{
|
|
1496
1498
|
icon: props.icon,
|
|
1497
1499
|
initial: {
|
|
1498
|
-
color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1500
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1499
1501
|
},
|
|
1500
1502
|
animate: {
|
|
1501
|
-
color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1503
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1502
1504
|
},
|
|
1503
1505
|
exit: {
|
|
1504
1506
|
color: "inherit"
|
|
@@ -1514,10 +1516,10 @@ function Segment(props) {
|
|
|
1514
1516
|
{
|
|
1515
1517
|
size: props.fz || "xs",
|
|
1516
1518
|
initial: {
|
|
1517
|
-
color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1519
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1518
1520
|
},
|
|
1519
1521
|
animate: {
|
|
1520
|
-
color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1522
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "inherit"
|
|
1521
1523
|
},
|
|
1522
1524
|
exit: {
|
|
1523
1525
|
color: "inherit"
|
|
@@ -1553,7 +1555,7 @@ function Segment(props) {
|
|
|
1553
1555
|
left: 0,
|
|
1554
1556
|
right: 0,
|
|
1555
1557
|
height: "0.2vh",
|
|
1556
|
-
backgroundColor: theme2.colors[theme2.primaryColor][5],
|
|
1558
|
+
backgroundColor: props.color || theme2.colors[theme2.primaryColor][5],
|
|
1557
1559
|
transformOrigin: "center"
|
|
1558
1560
|
}
|
|
1559
1561
|
}
|
|
@@ -1755,6 +1757,155 @@ function Title(props) {
|
|
|
1755
1757
|
}
|
|
1756
1758
|
);
|
|
1757
1759
|
}
|
|
1760
|
+
function Modal() {
|
|
1761
|
+
const active = useModal((state) => state.active);
|
|
1762
|
+
const { hideModal } = useModalActions();
|
|
1763
|
+
const ref = hooks.useClickOutside(() => {
|
|
1764
|
+
if (!active) return;
|
|
1765
|
+
if (active.clickOutside == false) return;
|
|
1766
|
+
if (active) {
|
|
1767
|
+
hideModal();
|
|
1768
|
+
}
|
|
1769
|
+
});
|
|
1770
|
+
const theme2 = core.useMantineTheme();
|
|
1771
|
+
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: active && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1772
|
+
MotionFlex,
|
|
1773
|
+
{
|
|
1774
|
+
h: "100%",
|
|
1775
|
+
w: "100%",
|
|
1776
|
+
bg: "rgba(0, 0, 0, 0.3)",
|
|
1777
|
+
pos: "absolute",
|
|
1778
|
+
style: {
|
|
1779
|
+
zIndex: 2e3,
|
|
1780
|
+
filter: "drop-shadow(0 0 2vh black)"
|
|
1781
|
+
},
|
|
1782
|
+
initial: { opacity: 0 },
|
|
1783
|
+
animate: { opacity: 1 },
|
|
1784
|
+
exit: { opacity: 0 },
|
|
1785
|
+
align: "center",
|
|
1786
|
+
justify: "center",
|
|
1787
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1788
|
+
MotionFlex,
|
|
1789
|
+
{
|
|
1790
|
+
pos: "absolute",
|
|
1791
|
+
top: "50%",
|
|
1792
|
+
left: "50%",
|
|
1793
|
+
ref,
|
|
1794
|
+
w: active.width || "40%",
|
|
1795
|
+
style: {
|
|
1796
|
+
transform: "translate(-50%, -50%)",
|
|
1797
|
+
borderRadius: theme2.radius.xs,
|
|
1798
|
+
boxShadow: theme2.shadows.xl,
|
|
1799
|
+
zIndex: 2100
|
|
1800
|
+
},
|
|
1801
|
+
bg: "rgba(48, 48, 48, 0.84)",
|
|
1802
|
+
initial: { scale: 0.8, opacity: 0, transform: "translate(-50%, -50%)" },
|
|
1803
|
+
animate: { scale: 1, opacity: 1, transform: "translate(-50%, -50%)" },
|
|
1804
|
+
exit: { scale: 0.8, opacity: 0, transform: "translate(-50%, -50%)" },
|
|
1805
|
+
p: "sm",
|
|
1806
|
+
direction: "column",
|
|
1807
|
+
maw: "70%",
|
|
1808
|
+
gap: "xs",
|
|
1809
|
+
children: [
|
|
1810
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1811
|
+
core.Flex,
|
|
1812
|
+
{
|
|
1813
|
+
direction: "column",
|
|
1814
|
+
w: "100%",
|
|
1815
|
+
children: [
|
|
1816
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1817
|
+
core.Flex,
|
|
1818
|
+
{
|
|
1819
|
+
w: "100%",
|
|
1820
|
+
align: "center",
|
|
1821
|
+
gap: "xs",
|
|
1822
|
+
children: [
|
|
1823
|
+
active.icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1824
|
+
reactFontawesome.FontAwesomeIcon,
|
|
1825
|
+
{
|
|
1826
|
+
icon: active.icon,
|
|
1827
|
+
style: {
|
|
1828
|
+
fontSize: theme2.fontSizes.xs
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
),
|
|
1832
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1833
|
+
core.Text,
|
|
1834
|
+
{
|
|
1835
|
+
size: "sm",
|
|
1836
|
+
children: active.title
|
|
1837
|
+
}
|
|
1838
|
+
),
|
|
1839
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1840
|
+
MotionIcon,
|
|
1841
|
+
{
|
|
1842
|
+
icon: "times",
|
|
1843
|
+
color: "rgba(255, 255, 255, 0.7)",
|
|
1844
|
+
whileHover: {
|
|
1845
|
+
scale: 1.1,
|
|
1846
|
+
filter: "brightness(1.2)"
|
|
1847
|
+
},
|
|
1848
|
+
style: {
|
|
1849
|
+
marginLeft: "auto",
|
|
1850
|
+
cursor: "pointer",
|
|
1851
|
+
fontSize: theme2.fontSizes.sm
|
|
1852
|
+
},
|
|
1853
|
+
onClick: () => {
|
|
1854
|
+
hideModal();
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
)
|
|
1858
|
+
]
|
|
1859
|
+
}
|
|
1860
|
+
),
|
|
1861
|
+
active.description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1862
|
+
core.Text,
|
|
1863
|
+
{
|
|
1864
|
+
size: "xs",
|
|
1865
|
+
c: "rgba(255, 255, 255, 0.7)",
|
|
1866
|
+
children: active.description
|
|
1867
|
+
}
|
|
1868
|
+
)
|
|
1869
|
+
]
|
|
1870
|
+
}
|
|
1871
|
+
),
|
|
1872
|
+
active.children
|
|
1873
|
+
]
|
|
1874
|
+
}
|
|
1875
|
+
)
|
|
1876
|
+
}
|
|
1877
|
+
) });
|
|
1878
|
+
}
|
|
1879
|
+
var ModalContext = react.createContext(null);
|
|
1880
|
+
function useModal(selector) {
|
|
1881
|
+
const modal = react.useContext(ModalContext);
|
|
1882
|
+
if (!modal) {
|
|
1883
|
+
throw new Error("useModal must be used within a ModalProvider");
|
|
1884
|
+
}
|
|
1885
|
+
return zustand.useStore(modal, selector);
|
|
1886
|
+
}
|
|
1887
|
+
function ModalProvider({ children, defaultPage }) {
|
|
1888
|
+
const storeRef = react.useRef(
|
|
1889
|
+
zustand.create(() => ({
|
|
1890
|
+
active: null
|
|
1891
|
+
}))
|
|
1892
|
+
);
|
|
1893
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ModalContext.Provider, { value: storeRef.current, children: [
|
|
1894
|
+
/* @__PURE__ */ jsxRuntime.jsx(Modal, {}),
|
|
1895
|
+
children
|
|
1896
|
+
] });
|
|
1897
|
+
}
|
|
1898
|
+
function useModalActions() {
|
|
1899
|
+
const modal = react.useContext(ModalContext);
|
|
1900
|
+
if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
|
|
1901
|
+
const showModal = (openModal) => {
|
|
1902
|
+
modal.setState({ active: openModal });
|
|
1903
|
+
};
|
|
1904
|
+
const hideModal = () => {
|
|
1905
|
+
modal.setState({ active: null });
|
|
1906
|
+
};
|
|
1907
|
+
return { showModal, hideModal };
|
|
1908
|
+
}
|
|
1758
1909
|
|
|
1759
1910
|
exports.BorderedIcon = BorderedIcon;
|
|
1760
1911
|
exports.Counter = Counter;
|
|
@@ -1762,6 +1913,8 @@ exports.DirkProvider = DirkProvider;
|
|
|
1762
1913
|
exports.FloatingParticles = FloatingParticles;
|
|
1763
1914
|
exports.InfoBox = InfoBox;
|
|
1764
1915
|
exports.InputContainer = InputContainer;
|
|
1916
|
+
exports.ModalContext = ModalContext;
|
|
1917
|
+
exports.ModalProvider = ModalProvider;
|
|
1765
1918
|
exports.MotionFlex = MotionFlex;
|
|
1766
1919
|
exports.MotionIcon = MotionIcon;
|
|
1767
1920
|
exports.MotionImage = MotionImage;
|
|
@@ -1769,7 +1922,6 @@ exports.MotionText = MotionText;
|
|
|
1769
1922
|
exports.NavBar = NavBar;
|
|
1770
1923
|
exports.NavigationContext = NavigationContext;
|
|
1771
1924
|
exports.NavigationProvider = NavigationProvider;
|
|
1772
|
-
exports.Segment = Segment;
|
|
1773
1925
|
exports.SegmentedControl = SegmentedControl;
|
|
1774
1926
|
exports.SegmentedProgress = SegmentedProgress;
|
|
1775
1927
|
exports.Title = Title;
|
|
@@ -1791,6 +1943,8 @@ exports.registerInitialFetch = registerInitialFetch;
|
|
|
1791
1943
|
exports.runFetches = runFetches;
|
|
1792
1944
|
exports.splitFAString = splitFAString;
|
|
1793
1945
|
exports.useAutoFetcher = useAutoFetcher;
|
|
1946
|
+
exports.useModal = useModal;
|
|
1947
|
+
exports.useModalActions = useModalActions;
|
|
1794
1948
|
exports.useNavigation = useNavigation;
|
|
1795
1949
|
exports.useNavigationStore = useNavigationStore;
|
|
1796
1950
|
exports.useNuiEvent = useNuiEvent;
|