dirk-cfx-react 1.1.62 → 1.1.64
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 +45 -17
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +46 -18
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +6 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +6 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +55 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -18
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +78 -2
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +79 -3
- package/dist/providers/index.js.map +1 -1
- package/dist/utils/index.cjs +22 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +3 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +22 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +113 -112
|
@@ -6,9 +6,9 @@ var react = require('react');
|
|
|
6
6
|
var zustand = require('zustand');
|
|
7
7
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
8
8
|
var framerMotion = require('framer-motion');
|
|
9
|
+
var lucideReact = require('lucide-react');
|
|
9
10
|
var clickSoundUrl = require('../click_sound-PNCRRTM4.mp3');
|
|
10
11
|
var hoverSoundUrl = require('../hover_sound-NBUA222C.mp3');
|
|
11
|
-
var lucideReact = require('lucide-react');
|
|
12
12
|
var reactQuery = require('@tanstack/react-query');
|
|
13
13
|
|
|
14
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1274,13 +1274,24 @@ async function fetchNui(eventName, data, mockData) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
const overrideResourceName = useSettings.getState().overideResourceName;
|
|
1276
1276
|
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : overrideResourceName ? overrideResourceName : "dirk-cfx-react";
|
|
1277
|
-
|
|
1278
|
-
|
|
1277
|
+
try {
|
|
1278
|
+
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
1279
|
+
return await resp.json();
|
|
1280
|
+
} catch {
|
|
1281
|
+
return mockData ?? {};
|
|
1282
|
+
}
|
|
1279
1283
|
}
|
|
1280
1284
|
async function registerInitialFetch(eventName, data, mockData) {
|
|
1281
1285
|
const fetcher = () => fetchNui(eventName, data, mockData);
|
|
1282
1286
|
return fetcher();
|
|
1283
1287
|
}
|
|
1288
|
+
var reportedMissing = /* @__PURE__ */ new Set();
|
|
1289
|
+
function reportMissingLocale(key) {
|
|
1290
|
+
if (!key || reportedMissing.has(key)) return;
|
|
1291
|
+
reportedMissing.add(key);
|
|
1292
|
+
fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1284
1295
|
var localeStore = zustand.create((set, get) => {
|
|
1285
1296
|
return {
|
|
1286
1297
|
locales: {
|
|
@@ -1288,6 +1299,7 @@ var localeStore = zustand.create((set, get) => {
|
|
|
1288
1299
|
},
|
|
1289
1300
|
locale: (key, ...args) => {
|
|
1290
1301
|
const exists = get().locales[key];
|
|
1302
|
+
if (!exists) reportMissingLocale(key);
|
|
1291
1303
|
let translation = exists || key;
|
|
1292
1304
|
if (args.length) {
|
|
1293
1305
|
translation = translation.replace(/%s/g, () => String(args.shift() || ""));
|
|
@@ -1301,6 +1313,14 @@ registerInitialFetch("GET_LOCALES", void 0).then((data) => {
|
|
|
1301
1313
|
localeStore.setState({ locales: data });
|
|
1302
1314
|
}).catch(() => {
|
|
1303
1315
|
});
|
|
1316
|
+
if (typeof window !== "undefined") {
|
|
1317
|
+
window.addEventListener("message", (event) => {
|
|
1318
|
+
const msg = event.data;
|
|
1319
|
+
if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
|
|
1320
|
+
if (!msg.data || typeof msg.data !== "object") return;
|
|
1321
|
+
localeStore.setState({ locales: msg.data });
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1304
1324
|
var useItems = zustand.create(() => ({}));
|
|
1305
1325
|
var useItemsList = (excludeItemNames = []) => {
|
|
1306
1326
|
const excludeSet = new Set(excludeItemNames);
|
|
@@ -1940,8 +1960,8 @@ function InputContainer(props) {
|
|
|
1940
1960
|
(props.title || props.description) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1941
1961
|
core.Flex,
|
|
1942
1962
|
{
|
|
1943
|
-
|
|
1944
|
-
|
|
1963
|
+
align: "center",
|
|
1964
|
+
flex: 1,
|
|
1945
1965
|
p: props.p == "0" ? "sm" : 0,
|
|
1946
1966
|
children: [
|
|
1947
1967
|
props.title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1958,12 +1978,26 @@ function InputContainer(props) {
|
|
|
1958
1978
|
}
|
|
1959
1979
|
),
|
|
1960
1980
|
props.description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1961
|
-
core.
|
|
1981
|
+
core.Tooltip,
|
|
1962
1982
|
{
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1983
|
+
label: props.description,
|
|
1984
|
+
position: "top-end",
|
|
1985
|
+
withArrow: true,
|
|
1986
|
+
multiline: true,
|
|
1987
|
+
maw: "22vh",
|
|
1988
|
+
styles: {
|
|
1989
|
+
tooltip: {
|
|
1990
|
+
background: core.alpha(theme.colors.dark[7], 0.95),
|
|
1991
|
+
border: `0.1vh solid rgba(255,255,255,0.1)`,
|
|
1992
|
+
color: "rgba(255,255,255,0.75)",
|
|
1993
|
+
fontFamily: "Akrobat Bold",
|
|
1994
|
+
fontSize: "1.3vh",
|
|
1995
|
+
lineHeight: 1.3,
|
|
1996
|
+
padding: "0.6vh 0.8vh",
|
|
1997
|
+
letterSpacing: "0.03em"
|
|
1998
|
+
}
|
|
1999
|
+
},
|
|
2000
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { align: "center", justify: "center", style: { marginLeft: "auto", cursor: "help" }, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { size: "1.6vh", color: core.alpha(theme.colors[theme.primaryColor][5], 0.45) }) })
|
|
1967
2001
|
}
|
|
1968
2002
|
)
|
|
1969
2003
|
]
|
|
@@ -1980,13 +2014,7 @@ function InputContainer(props) {
|
|
|
1980
2014
|
children: props.error
|
|
1981
2015
|
}
|
|
1982
2016
|
),
|
|
1983
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1984
|
-
core.Flex,
|
|
1985
|
-
{
|
|
1986
|
-
ml: "auto",
|
|
1987
|
-
children: props.rightSection
|
|
1988
|
-
}
|
|
1989
|
-
)
|
|
2017
|
+
props.rightSection && /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { children: props.rightSection })
|
|
1990
2018
|
]
|
|
1991
2019
|
}
|
|
1992
2020
|
),
|