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
package/dist/components/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Flex, Text, Image, TextInput, Select, Box, useMantineTheme, alpha, Progress, RingProgress, Portal, Button, Loader, ActionIcon, Stack, Group, JsonInput } from '@mantine/core';
|
|
1
|
+
import { Flex, Text, Image, TextInput, Select, Box, useMantineTheme, Tooltip, alpha, Progress, RingProgress, Portal, Button, Loader, ActionIcon, Stack, Group, JsonInput } from '@mantine/core';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, useContext, useRef, useState, useEffect, useMemo } from 'react';
|
|
4
4
|
import { create, useStore, createStore } from 'zustand';
|
|
5
5
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
6
6
|
import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
|
|
7
|
+
import { Info, X, AlertTriangle, Trash2, Check, FlaskConical, ChevronUp, ChevronDown, ArrowLeft, Undo2, Redo2, Save, History, XCircle, Code2, RotateCcw, Search, Filter, User } from 'lucide-react';
|
|
7
8
|
import clickSoundUrl from '../click_sound-PNCRRTM4.mp3';
|
|
8
9
|
import hoverSoundUrl from '../hover_sound-NBUA222C.mp3';
|
|
9
|
-
import { X, AlertTriangle, Trash2, Check, FlaskConical, ChevronUp, ChevronDown, ArrowLeft, Undo2, Redo2, Save, History, XCircle, Code2, RotateCcw, Search, Filter, User } from 'lucide-react';
|
|
10
10
|
import { QueryClient, QueryClientProvider, useInfiniteQuery } from '@tanstack/react-query';
|
|
11
11
|
|
|
12
12
|
// src/components/BlipSelect.tsx
|
|
@@ -1267,13 +1267,24 @@ async function fetchNui(eventName, data, mockData) {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
const overrideResourceName = useSettings.getState().overideResourceName;
|
|
1269
1269
|
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : overrideResourceName ? overrideResourceName : "dirk-cfx-react";
|
|
1270
|
-
|
|
1271
|
-
|
|
1270
|
+
try {
|
|
1271
|
+
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
1272
|
+
return await resp.json();
|
|
1273
|
+
} catch {
|
|
1274
|
+
return mockData ?? {};
|
|
1275
|
+
}
|
|
1272
1276
|
}
|
|
1273
1277
|
async function registerInitialFetch(eventName, data, mockData) {
|
|
1274
1278
|
const fetcher = () => fetchNui(eventName, data, mockData);
|
|
1275
1279
|
return fetcher();
|
|
1276
1280
|
}
|
|
1281
|
+
var reportedMissing = /* @__PURE__ */ new Set();
|
|
1282
|
+
function reportMissingLocale(key) {
|
|
1283
|
+
if (!key || reportedMissing.has(key)) return;
|
|
1284
|
+
reportedMissing.add(key);
|
|
1285
|
+
fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1277
1288
|
var localeStore = create((set, get) => {
|
|
1278
1289
|
return {
|
|
1279
1290
|
locales: {
|
|
@@ -1281,6 +1292,7 @@ var localeStore = create((set, get) => {
|
|
|
1281
1292
|
},
|
|
1282
1293
|
locale: (key, ...args) => {
|
|
1283
1294
|
const exists = get().locales[key];
|
|
1295
|
+
if (!exists) reportMissingLocale(key);
|
|
1284
1296
|
let translation = exists || key;
|
|
1285
1297
|
if (args.length) {
|
|
1286
1298
|
translation = translation.replace(/%s/g, () => String(args.shift() || ""));
|
|
@@ -1294,6 +1306,14 @@ registerInitialFetch("GET_LOCALES", void 0).then((data) => {
|
|
|
1294
1306
|
localeStore.setState({ locales: data });
|
|
1295
1307
|
}).catch(() => {
|
|
1296
1308
|
});
|
|
1309
|
+
if (typeof window !== "undefined") {
|
|
1310
|
+
window.addEventListener("message", (event) => {
|
|
1311
|
+
const msg = event.data;
|
|
1312
|
+
if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
|
|
1313
|
+
if (!msg.data || typeof msg.data !== "object") return;
|
|
1314
|
+
localeStore.setState({ locales: msg.data });
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1297
1317
|
var useItems = create(() => ({}));
|
|
1298
1318
|
var useItemsList = (excludeItemNames = []) => {
|
|
1299
1319
|
const excludeSet = new Set(excludeItemNames);
|
|
@@ -1933,8 +1953,8 @@ function InputContainer(props) {
|
|
|
1933
1953
|
(props.title || props.description) && /* @__PURE__ */ jsxs(
|
|
1934
1954
|
Flex,
|
|
1935
1955
|
{
|
|
1936
|
-
|
|
1937
|
-
|
|
1956
|
+
align: "center",
|
|
1957
|
+
flex: 1,
|
|
1938
1958
|
p: props.p == "0" ? "sm" : 0,
|
|
1939
1959
|
children: [
|
|
1940
1960
|
props.title && /* @__PURE__ */ jsx(
|
|
@@ -1951,12 +1971,26 @@ function InputContainer(props) {
|
|
|
1951
1971
|
}
|
|
1952
1972
|
),
|
|
1953
1973
|
props.description && /* @__PURE__ */ jsx(
|
|
1954
|
-
|
|
1974
|
+
Tooltip,
|
|
1955
1975
|
{
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1976
|
+
label: props.description,
|
|
1977
|
+
position: "top-end",
|
|
1978
|
+
withArrow: true,
|
|
1979
|
+
multiline: true,
|
|
1980
|
+
maw: "22vh",
|
|
1981
|
+
styles: {
|
|
1982
|
+
tooltip: {
|
|
1983
|
+
background: alpha(theme.colors.dark[7], 0.95),
|
|
1984
|
+
border: `0.1vh solid rgba(255,255,255,0.1)`,
|
|
1985
|
+
color: "rgba(255,255,255,0.75)",
|
|
1986
|
+
fontFamily: "Akrobat Bold",
|
|
1987
|
+
fontSize: "1.3vh",
|
|
1988
|
+
lineHeight: 1.3,
|
|
1989
|
+
padding: "0.6vh 0.8vh",
|
|
1990
|
+
letterSpacing: "0.03em"
|
|
1991
|
+
}
|
|
1992
|
+
},
|
|
1993
|
+
children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", style: { marginLeft: "auto", cursor: "help" }, children: /* @__PURE__ */ jsx(Info, { size: "1.6vh", color: alpha(theme.colors[theme.primaryColor][5], 0.45) }) })
|
|
1960
1994
|
}
|
|
1961
1995
|
)
|
|
1962
1996
|
]
|
|
@@ -1973,13 +2007,7 @@ function InputContainer(props) {
|
|
|
1973
2007
|
children: props.error
|
|
1974
2008
|
}
|
|
1975
2009
|
),
|
|
1976
|
-
/* @__PURE__ */ jsx(
|
|
1977
|
-
Flex,
|
|
1978
|
-
{
|
|
1979
|
-
ml: "auto",
|
|
1980
|
-
children: props.rightSection
|
|
1981
|
-
}
|
|
1982
|
-
)
|
|
2010
|
+
props.rightSection && /* @__PURE__ */ jsx(Flex, { children: props.rightSection })
|
|
1983
2011
|
]
|
|
1984
2012
|
}
|
|
1985
2013
|
),
|