dirk-cfx-react 1.0.47 → 1.0.49
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 +88 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +10 -2
- package/dist/components/index.d.ts +10 -2
- package/dist/components/index.js +89 -2
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +129 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +127 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/index.cjs +44 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +10 -1
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.js +38 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var zustand = require('zustand');
|
|
5
|
+
var axios = require('axios');
|
|
5
6
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
6
7
|
var core = require('@mantine/core');
|
|
7
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -22,6 +23,7 @@ var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
|
22
23
|
|
|
23
24
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
25
|
|
|
26
|
+
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
25
27
|
var clickSoundUrl__default = /*#__PURE__*/_interopDefault(clickSoundUrl);
|
|
26
28
|
var hoverSoundUrl__default = /*#__PURE__*/_interopDefault(hoverSoundUrl);
|
|
27
29
|
|
|
@@ -749,6 +751,42 @@ function createSkill(defaultSettings) {
|
|
|
749
751
|
useSkill
|
|
750
752
|
};
|
|
751
753
|
}
|
|
754
|
+
var dummyURL = "https://fmapi.net/api/v2/presigned-url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fetchNui("GET_PRESIGNED_URL", void 0, dummyURL);
|
|
757
|
+
}
|
|
758
|
+
async function uploadImage(props) {
|
|
759
|
+
const uploadURL = await updatePresignedURL();
|
|
760
|
+
const response = await fetch(props.fileURL);
|
|
761
|
+
const blob = await response.blob();
|
|
762
|
+
const file = new File([blob], "upload.png", { type: blob.type });
|
|
763
|
+
const formData = new FormData();
|
|
764
|
+
formData.append("file", file);
|
|
765
|
+
formData.append(
|
|
766
|
+
"metadata",
|
|
767
|
+
JSON.stringify({
|
|
768
|
+
name: props.name || file.name,
|
|
769
|
+
description: props.description || "Uploaded via DirkScripts"
|
|
770
|
+
})
|
|
771
|
+
);
|
|
772
|
+
const uploadRes = await axios__default.default.post(uploadURL, formData, {
|
|
773
|
+
headers: { "Content-Type": "multipart/form-data" }
|
|
774
|
+
});
|
|
775
|
+
const finalUrl = uploadRes.data?.data?.url ?? uploadRes.data?.url;
|
|
776
|
+
if (!finalUrl) throw new Error("Upload succeeded but no URL returned");
|
|
777
|
+
return finalUrl;
|
|
778
|
+
}
|
|
779
|
+
async function getImageShape(file) {
|
|
780
|
+
return new Promise((resolve, reject) => {
|
|
781
|
+
const img = new Image();
|
|
782
|
+
img.onload = () => {
|
|
783
|
+
if (img.width > img.height) resolve("wide");
|
|
784
|
+
else resolve("square");
|
|
785
|
+
};
|
|
786
|
+
img.onerror = () => reject(new Error("Failed to load image"));
|
|
787
|
+
img.src = typeof file === "string" ? file : URL.createObjectURL(file);
|
|
788
|
+
});
|
|
789
|
+
}
|
|
752
790
|
function BorderedIcon(props) {
|
|
753
791
|
const theme2 = core.useMantineTheme();
|
|
754
792
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1516,6 +1554,93 @@ function Title(props) {
|
|
|
1516
1554
|
}
|
|
1517
1555
|
);
|
|
1518
1556
|
}
|
|
1557
|
+
function LevelBanner(props) {
|
|
1558
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1559
|
+
MotionFlex,
|
|
1560
|
+
{
|
|
1561
|
+
w: "35vh",
|
|
1562
|
+
pos: "absolute",
|
|
1563
|
+
left: "50%",
|
|
1564
|
+
align: "center",
|
|
1565
|
+
gap: "xs",
|
|
1566
|
+
style: {
|
|
1567
|
+
borderRadius: core.useMantineTheme().radius.xxs
|
|
1568
|
+
},
|
|
1569
|
+
initial: { opacity: 0, y: -10, transform: "translateX(-50%)" },
|
|
1570
|
+
animate: { opacity: 1, y: 0, transform: "translateX(-50%)" },
|
|
1571
|
+
exit: { opacity: 0, y: -10, transform: "translateX(-50%)" },
|
|
1572
|
+
transition: { duration: 0.3 },
|
|
1573
|
+
direction: "column",
|
|
1574
|
+
children: [
|
|
1575
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1576
|
+
core.Flex,
|
|
1577
|
+
{
|
|
1578
|
+
w: "100%",
|
|
1579
|
+
justify: "space-between",
|
|
1580
|
+
children: [
|
|
1581
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1582
|
+
core.Text,
|
|
1583
|
+
{
|
|
1584
|
+
size: "xxs",
|
|
1585
|
+
c: "rgba(255, 255, 255, 0.9)",
|
|
1586
|
+
style: {
|
|
1587
|
+
fontFamily: "Akrobat Bold",
|
|
1588
|
+
letterSpacing: "0.1em"
|
|
1589
|
+
},
|
|
1590
|
+
children: [
|
|
1591
|
+
"LVL ",
|
|
1592
|
+
props.level
|
|
1593
|
+
]
|
|
1594
|
+
}
|
|
1595
|
+
),
|
|
1596
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1597
|
+
core.Text,
|
|
1598
|
+
{
|
|
1599
|
+
size: "xxs",
|
|
1600
|
+
c: "rgba(255, 255, 255, 0.7)",
|
|
1601
|
+
style: {
|
|
1602
|
+
fontFamily: "Akrobat Bold",
|
|
1603
|
+
letterSpacing: "0.1em"
|
|
1604
|
+
},
|
|
1605
|
+
children: [
|
|
1606
|
+
props.exp,
|
|
1607
|
+
"/",
|
|
1608
|
+
props.nextLevelXP,
|
|
1609
|
+
" XP"
|
|
1610
|
+
]
|
|
1611
|
+
}
|
|
1612
|
+
),
|
|
1613
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1614
|
+
core.Text,
|
|
1615
|
+
{
|
|
1616
|
+
size: "xxs",
|
|
1617
|
+
c: "rgba(255, 255, 255, 0.7)",
|
|
1618
|
+
style: {
|
|
1619
|
+
fontFamily: "Akrobat Bold",
|
|
1620
|
+
letterSpacing: "0.1em"
|
|
1621
|
+
},
|
|
1622
|
+
children: [
|
|
1623
|
+
"LVL ",
|
|
1624
|
+
props.level + 1
|
|
1625
|
+
]
|
|
1626
|
+
}
|
|
1627
|
+
)
|
|
1628
|
+
]
|
|
1629
|
+
}
|
|
1630
|
+
),
|
|
1631
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1632
|
+
core.Progress,
|
|
1633
|
+
{
|
|
1634
|
+
color: props.color,
|
|
1635
|
+
w: "100%",
|
|
1636
|
+
size: "sm",
|
|
1637
|
+
value: props.progressToLevel
|
|
1638
|
+
}
|
|
1639
|
+
)
|
|
1640
|
+
]
|
|
1641
|
+
}
|
|
1642
|
+
);
|
|
1643
|
+
}
|
|
1519
1644
|
var ModalContext = react.createContext(null);
|
|
1520
1645
|
function useModal(selector) {
|
|
1521
1646
|
const modal = react.useContext(ModalContext);
|
|
@@ -2139,6 +2264,7 @@ exports.FloatingParticles = FloatingParticles;
|
|
|
2139
2264
|
exports.FormProvider = FormProvider;
|
|
2140
2265
|
exports.InfoBox = InfoBox;
|
|
2141
2266
|
exports.InputContainer = InputContainer;
|
|
2267
|
+
exports.LevelBanner = LevelBanner;
|
|
2142
2268
|
exports.ModalContext = ModalContext;
|
|
2143
2269
|
exports.ModalProvider = ModalProvider;
|
|
2144
2270
|
exports.MotionFlex = MotionFlex;
|
|
@@ -2157,6 +2283,7 @@ exports.copyToClipboard = copyToClipboard;
|
|
|
2157
2283
|
exports.createFormStore = createFormStore;
|
|
2158
2284
|
exports.createSkill = createSkill;
|
|
2159
2285
|
exports.fetchNui = fetchNui;
|
|
2286
|
+
exports.getImageShape = getImageShape;
|
|
2160
2287
|
exports.initialFetches = initialFetches;
|
|
2161
2288
|
exports.internalEvent = internalEvent;
|
|
2162
2289
|
exports.isEnvBrowser = isEnvBrowser;
|
|
@@ -2169,6 +2296,8 @@ exports.openLink = openLink;
|
|
|
2169
2296
|
exports.registerInitialFetch = registerInitialFetch;
|
|
2170
2297
|
exports.runFetches = runFetches;
|
|
2171
2298
|
exports.splitFAString = splitFAString;
|
|
2299
|
+
exports.updatePresignedURL = updatePresignedURL;
|
|
2300
|
+
exports.uploadImage = uploadImage;
|
|
2172
2301
|
exports.useAutoFetcher = useAutoFetcher;
|
|
2173
2302
|
exports.useForm = useForm;
|
|
2174
2303
|
exports.useModal = useModal;
|