dirk-cfx-react 1.1.65 → 1.1.67
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 +106 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +39 -1
- package/dist/components/index.d.ts +39 -1
- package/dist/components/index.js +104 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +179 -68
- 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 +109 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/index.cjs +19 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +29 -1
- package/dist/utils/index.d.ts +29 -1
- package/dist/utils/index.js +18 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@mantine/core');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
5
|
+
var React6 = require('react');
|
|
6
6
|
var zustand = require('zustand');
|
|
7
7
|
var axios = require('axios');
|
|
8
8
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
@@ -24,7 +24,7 @@ var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
|
24
24
|
|
|
25
25
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var React6__default = /*#__PURE__*/_interopDefault(React6);
|
|
28
28
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
29
29
|
var clickSoundUrl__default = /*#__PURE__*/_interopDefault(clickSoundUrl);
|
|
30
30
|
var hoverSoundUrl__default = /*#__PURE__*/_interopDefault(hoverSoundUrl);
|
|
@@ -1362,7 +1362,7 @@ async function runFetches() {
|
|
|
1362
1362
|
);
|
|
1363
1363
|
}
|
|
1364
1364
|
var useAutoFetcher = () => {
|
|
1365
|
-
|
|
1365
|
+
React6.useEffect(() => {
|
|
1366
1366
|
if (isEnvBrowser()) return;
|
|
1367
1367
|
runFetches().catch(() => {
|
|
1368
1368
|
});
|
|
@@ -1858,7 +1858,7 @@ function createSkill(defaultSettings) {
|
|
|
1858
1858
|
}));
|
|
1859
1859
|
const useSkill = (xp) => {
|
|
1860
1860
|
const { settings, levelMap } = useStore4();
|
|
1861
|
-
return
|
|
1861
|
+
return React6.useMemo(() => {
|
|
1862
1862
|
const currentLevel = getLevelFromXP(xp, levelMap, settings);
|
|
1863
1863
|
const nextLevel = Math.min(currentLevel + 1, settings.maxLevel);
|
|
1864
1864
|
const currentLevelXP = levelMap[currentLevel.toString()] || 0;
|
|
@@ -1946,6 +1946,23 @@ registerInitialFetch("FETCH_ALL_ITEMS", null, {
|
|
|
1946
1946
|
useItems.setState(fetchedItems);
|
|
1947
1947
|
}).catch(() => {
|
|
1948
1948
|
});
|
|
1949
|
+
var useFrameworkGroups = zustand.create(() => ({
|
|
1950
|
+
jobs: [],
|
|
1951
|
+
gangs: [],
|
|
1952
|
+
loaded: false
|
|
1953
|
+
}));
|
|
1954
|
+
registerInitialFetch("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
|
|
1955
|
+
useFrameworkGroups.setState({
|
|
1956
|
+
jobs: Array.isArray(data?.jobs) ? data.jobs : [],
|
|
1957
|
+
gangs: Array.isArray(data?.gangs) ? data.gangs : [],
|
|
1958
|
+
loaded: true
|
|
1959
|
+
});
|
|
1960
|
+
}).catch(() => {
|
|
1961
|
+
useFrameworkGroups.setState({ loaded: true });
|
|
1962
|
+
});
|
|
1963
|
+
function selectAllGroups(state) {
|
|
1964
|
+
return [...state.jobs, ...state.gangs];
|
|
1965
|
+
}
|
|
1949
1966
|
|
|
1950
1967
|
// src/utils/inputMapper.ts
|
|
1951
1968
|
var INPUT_MAPPER_PRIMARY_OPTIONS = [
|
|
@@ -2315,8 +2332,8 @@ var FloatingParticles = ({
|
|
|
2315
2332
|
mouseRepelStrength = 50,
|
|
2316
2333
|
backgroundColor = "transparent"
|
|
2317
2334
|
}) => {
|
|
2318
|
-
const containerRef =
|
|
2319
|
-
const [particles, setParticles] =
|
|
2335
|
+
const containerRef = React6.useRef(null);
|
|
2336
|
+
const [particles, setParticles] = React6.useState([]);
|
|
2320
2337
|
const mouseX = framerMotion.useMotionValue(0);
|
|
2321
2338
|
const mouseY = framerMotion.useMotionValue(0);
|
|
2322
2339
|
const durationMap = {
|
|
@@ -2329,7 +2346,7 @@ var FloatingParticles = ({
|
|
|
2329
2346
|
const x = Math.sin(seed) * 1e4;
|
|
2330
2347
|
return x - Math.floor(x);
|
|
2331
2348
|
};
|
|
2332
|
-
|
|
2349
|
+
React6.useEffect(() => {
|
|
2333
2350
|
if (!containerRef.current) return;
|
|
2334
2351
|
const bounds = containerRef.current.getBoundingClientRect();
|
|
2335
2352
|
const newParticles = [...Array(particleCount)].map((_, i) => {
|
|
@@ -2350,7 +2367,7 @@ var FloatingParticles = ({
|
|
|
2350
2367
|
});
|
|
2351
2368
|
setParticles(newParticles);
|
|
2352
2369
|
}, [particleCount, icons.length, duration.base, duration.variance]);
|
|
2353
|
-
|
|
2370
|
+
React6.useEffect(() => {
|
|
2354
2371
|
if (!containerRef.current) return;
|
|
2355
2372
|
const handleMouseMove = (e) => {
|
|
2356
2373
|
const bounds = containerRef.current.getBoundingClientRect();
|
|
@@ -2399,7 +2416,7 @@ var FloatingParticles = ({
|
|
|
2399
2416
|
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
2400
2417
|
};
|
|
2401
2418
|
}, [mouseX, mouseY, mouseRepelDistance, mouseRepelStrength]);
|
|
2402
|
-
|
|
2419
|
+
React6.useEffect(() => {
|
|
2403
2420
|
const handleResize = () => {
|
|
2404
2421
|
if (!containerRef.current) return;
|
|
2405
2422
|
const bounds = containerRef.current.getBoundingClientRect();
|
|
@@ -2835,23 +2852,23 @@ function Segment(props) {
|
|
|
2835
2852
|
}
|
|
2836
2853
|
);
|
|
2837
2854
|
}
|
|
2838
|
-
var NavigationContext =
|
|
2855
|
+
var NavigationContext = React6.createContext(null);
|
|
2839
2856
|
function useNavigation(selector) {
|
|
2840
|
-
const navigation =
|
|
2857
|
+
const navigation = React6.useContext(NavigationContext);
|
|
2841
2858
|
if (!navigation) {
|
|
2842
2859
|
throw new Error("useNavigation must be used within a NavigationProvider");
|
|
2843
2860
|
}
|
|
2844
2861
|
return zustand.useStore(navigation, selector);
|
|
2845
2862
|
}
|
|
2846
2863
|
function useNavigationStore() {
|
|
2847
|
-
const navigation =
|
|
2864
|
+
const navigation = React6.useContext(NavigationContext);
|
|
2848
2865
|
if (!navigation) {
|
|
2849
2866
|
throw new Error("useNavigationStore must be used within a NavigationProvider");
|
|
2850
2867
|
}
|
|
2851
2868
|
return navigation;
|
|
2852
2869
|
}
|
|
2853
2870
|
function NavigationProvider({ children, defaultPage }) {
|
|
2854
|
-
const storeRef =
|
|
2871
|
+
const storeRef = React6.useRef(
|
|
2855
2872
|
zustand.create(() => ({
|
|
2856
2873
|
pageId: defaultPage || "home"
|
|
2857
2874
|
}))
|
|
@@ -3208,7 +3225,7 @@ function Modal({
|
|
|
3208
3225
|
children
|
|
3209
3226
|
}) {
|
|
3210
3227
|
const theme2 = core.useMantineTheme();
|
|
3211
|
-
const pointerDownOnOverlay =
|
|
3228
|
+
const pointerDownOnOverlay = React6.useRef(false);
|
|
3212
3229
|
return /* @__PURE__ */ jsxRuntime.jsx(core.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3213
3230
|
framerMotion.motion.div,
|
|
3214
3231
|
{
|
|
@@ -3389,9 +3406,9 @@ function PromptModal(props) {
|
|
|
3389
3406
|
}
|
|
3390
3407
|
);
|
|
3391
3408
|
}
|
|
3392
|
-
var ModalContext =
|
|
3409
|
+
var ModalContext = React6.createContext(null);
|
|
3393
3410
|
function useModal(selector) {
|
|
3394
|
-
const modal =
|
|
3411
|
+
const modal = React6.useContext(ModalContext);
|
|
3395
3412
|
if (!modal) {
|
|
3396
3413
|
throw new Error("useModal must be used within a ModalProvider");
|
|
3397
3414
|
}
|
|
@@ -3419,7 +3436,7 @@ function StoreModal() {
|
|
|
3419
3436
|
) });
|
|
3420
3437
|
}
|
|
3421
3438
|
function ModalProvider({ children }) {
|
|
3422
|
-
const storeRef =
|
|
3439
|
+
const storeRef = React6.useRef(
|
|
3423
3440
|
zustand.create(() => ({
|
|
3424
3441
|
active: null
|
|
3425
3442
|
}))
|
|
@@ -3430,7 +3447,7 @@ function ModalProvider({ children }) {
|
|
|
3430
3447
|
] });
|
|
3431
3448
|
}
|
|
3432
3449
|
function useModalActions() {
|
|
3433
|
-
const modal =
|
|
3450
|
+
const modal = React6.useContext(ModalContext);
|
|
3434
3451
|
if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
|
|
3435
3452
|
const showModal = (openModal) => {
|
|
3436
3453
|
modal.setState({ active: openModal });
|
|
@@ -3450,7 +3467,7 @@ function ConfirmModal({
|
|
|
3450
3467
|
zIndex = 200
|
|
3451
3468
|
}) {
|
|
3452
3469
|
const theme2 = core.useMantineTheme();
|
|
3453
|
-
const [typed, setTyped] =
|
|
3470
|
+
const [typed, setTyped] = React6.useState("");
|
|
3454
3471
|
const canConfirm = !confirmText || typed === confirmText;
|
|
3455
3472
|
return /* @__PURE__ */ jsxRuntime.jsx(core.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3456
3473
|
framerMotion.motion.div,
|
|
@@ -3928,38 +3945,38 @@ function createFormStore(initialValues, validationRules, onSubmit) {
|
|
|
3928
3945
|
}
|
|
3929
3946
|
}));
|
|
3930
3947
|
}
|
|
3931
|
-
var FormContext =
|
|
3948
|
+
var FormContext = React6.createContext(null);
|
|
3932
3949
|
function FormProvider({
|
|
3933
3950
|
initialValues,
|
|
3934
3951
|
validate,
|
|
3935
3952
|
onSubmit,
|
|
3936
3953
|
children
|
|
3937
3954
|
}) {
|
|
3938
|
-
const storeRef =
|
|
3955
|
+
const storeRef = React6.useRef(
|
|
3939
3956
|
createFormStore(initialValues, validate, onSubmit)
|
|
3940
3957
|
);
|
|
3941
3958
|
return /* @__PURE__ */ jsxRuntime.jsx(FormContext.Provider, { value: storeRef.current, children });
|
|
3942
3959
|
}
|
|
3943
3960
|
function useForm() {
|
|
3944
|
-
const store =
|
|
3961
|
+
const store = React6.useContext(FormContext);
|
|
3945
3962
|
if (!store) {
|
|
3946
3963
|
throw new Error("useForm must be used inside <FormProvider>");
|
|
3947
3964
|
}
|
|
3948
3965
|
const state = zustand.useStore(store);
|
|
3949
|
-
const changedFields =
|
|
3966
|
+
const changedFields = React6.useMemo(() => {
|
|
3950
3967
|
return collectChangedPaths(state.values, state.initialValues);
|
|
3951
3968
|
}, [state.values, state.initialValues]);
|
|
3952
3969
|
return { ...state, changedFields, changedCount: changedFields.length };
|
|
3953
3970
|
}
|
|
3954
3971
|
function useFormField(path) {
|
|
3955
|
-
const store =
|
|
3972
|
+
const store = React6.useContext(FormContext);
|
|
3956
3973
|
if (!store) {
|
|
3957
3974
|
throw new Error("useFormField must be used inside <FormProvider>");
|
|
3958
3975
|
}
|
|
3959
3976
|
return zustand.useStore(store, (s) => getNested(s.values, path));
|
|
3960
3977
|
}
|
|
3961
3978
|
function useFormFields(...paths) {
|
|
3962
|
-
const store =
|
|
3979
|
+
const store = React6.useContext(FormContext);
|
|
3963
3980
|
if (!store) {
|
|
3964
3981
|
throw new Error("useFormFields must be used inside <FormProvider>");
|
|
3965
3982
|
}
|
|
@@ -3972,14 +3989,14 @@ function useFormFields(...paths) {
|
|
|
3972
3989
|
});
|
|
3973
3990
|
}
|
|
3974
3991
|
function useFormError(path) {
|
|
3975
|
-
const store =
|
|
3992
|
+
const store = React6.useContext(FormContext);
|
|
3976
3993
|
if (!store) {
|
|
3977
3994
|
throw new Error("useFormError must be used inside <FormProvider>");
|
|
3978
3995
|
}
|
|
3979
3996
|
return zustand.useStore(store, (s) => s.errors[path]);
|
|
3980
3997
|
}
|
|
3981
3998
|
function useFormErrors(...paths) {
|
|
3982
|
-
const store =
|
|
3999
|
+
const store = React6.useContext(FormContext);
|
|
3983
4000
|
if (!store) {
|
|
3984
4001
|
throw new Error("useFormErrors must be used inside <FormProvider>");
|
|
3985
4002
|
}
|
|
@@ -3992,18 +4009,18 @@ function useFormErrors(...paths) {
|
|
|
3992
4009
|
});
|
|
3993
4010
|
}
|
|
3994
4011
|
function useFormActions() {
|
|
3995
|
-
const store =
|
|
4012
|
+
const store = React6.useContext(FormContext);
|
|
3996
4013
|
if (!store) {
|
|
3997
4014
|
throw new Error("useFormActions must be used inside <FormProvider>");
|
|
3998
4015
|
}
|
|
3999
4016
|
return store.getState();
|
|
4000
4017
|
}
|
|
4001
4018
|
var useNuiEvent = (action, handler) => {
|
|
4002
|
-
const savedHandler =
|
|
4003
|
-
|
|
4019
|
+
const savedHandler = React6.useRef(noop);
|
|
4020
|
+
React6.useEffect(() => {
|
|
4004
4021
|
savedHandler.current = handler;
|
|
4005
4022
|
}, [handler]);
|
|
4006
|
-
|
|
4023
|
+
React6.useEffect(() => {
|
|
4007
4024
|
const eventListener = (event) => {
|
|
4008
4025
|
const { action: eventAction, data } = event.data;
|
|
4009
4026
|
if (savedHandler.current) {
|
|
@@ -4136,8 +4153,8 @@ function ConfigJsonModal({
|
|
|
4136
4153
|
const theme2 = core.useMantineTheme();
|
|
4137
4154
|
const color = theme2.colors[theme2.primaryColor][5];
|
|
4138
4155
|
const form = useForm();
|
|
4139
|
-
const [json, setJson] =
|
|
4140
|
-
const [error2, setError] =
|
|
4156
|
+
const [json, setJson] = React6.useState(() => JSON.stringify(form.values, null, 2));
|
|
4157
|
+
const [error2, setError] = React6.useState(null);
|
|
4141
4158
|
const handleSave = () => {
|
|
4142
4159
|
try {
|
|
4143
4160
|
const parsed = JSON.parse(json);
|
|
@@ -4314,14 +4331,14 @@ function ConfigHistoryModal({
|
|
|
4314
4331
|
const { getHistory } = getScriptConfigInstance();
|
|
4315
4332
|
const theme2 = core.useMantineTheme();
|
|
4316
4333
|
const color = theme2.colors[theme2.primaryColor][5];
|
|
4317
|
-
const [queryInput, setQueryInput] =
|
|
4318
|
-
const [pathInput, setPathInput] =
|
|
4319
|
-
const [adminInput, setAdminInput] =
|
|
4320
|
-
const [query, setQuery] =
|
|
4321
|
-
const [path, setPath] =
|
|
4322
|
-
const [admin, setAdmin] =
|
|
4323
|
-
const [expandedKey, setExpandedKey] =
|
|
4324
|
-
const filters =
|
|
4334
|
+
const [queryInput, setQueryInput] = React6.useState("");
|
|
4335
|
+
const [pathInput, setPathInput] = React6.useState("");
|
|
4336
|
+
const [adminInput, setAdminInput] = React6.useState("");
|
|
4337
|
+
const [query, setQuery] = React6.useState("");
|
|
4338
|
+
const [path, setPath] = React6.useState("");
|
|
4339
|
+
const [admin, setAdmin] = React6.useState("");
|
|
4340
|
+
const [expandedKey, setExpandedKey] = React6.useState(null);
|
|
4341
|
+
const filters = React6.useMemo(() => ({ query, path, admin }), [query, path, admin]);
|
|
4325
4342
|
const historyQuery = reactQuery.useInfiniteQuery({
|
|
4326
4343
|
queryKey: ["scriptConfigHistory", filters],
|
|
4327
4344
|
initialPageParam: 0,
|
|
@@ -4415,12 +4432,12 @@ function ConfigPanelInner({
|
|
|
4415
4432
|
const theme2 = core.useMantineTheme();
|
|
4416
4433
|
const color = theme2.colors[theme2.primaryColor][5];
|
|
4417
4434
|
const version = useSettings((s) => s.resourceVersion);
|
|
4418
|
-
const [activeTab, setActiveTab] =
|
|
4419
|
-
const firstMountRef =
|
|
4420
|
-
const [jsonOpen, setJsonOpen] =
|
|
4421
|
-
const [historyOpen, setHistoryOpen] =
|
|
4422
|
-
const [resetOpen, setResetOpen] =
|
|
4423
|
-
const [pendingAction, setPendingAction] =
|
|
4435
|
+
const [activeTab, setActiveTab] = React6.useState(navItems[0]?.id ?? "");
|
|
4436
|
+
const firstMountRef = React6.useRef(true);
|
|
4437
|
+
const [jsonOpen, setJsonOpen] = React6.useState(false);
|
|
4438
|
+
const [historyOpen, setHistoryOpen] = React6.useState(false);
|
|
4439
|
+
const [resetOpen, setResetOpen] = React6.useState(false);
|
|
4440
|
+
const [pendingAction, setPendingAction] = React6.useState(null);
|
|
4424
4441
|
const changedCount = form.changedCount ?? 0;
|
|
4425
4442
|
const isDirty = changedCount > 0;
|
|
4426
4443
|
const goBack = () => fetchNui("CONFIG_PANEL_BACK");
|
|
@@ -4431,7 +4448,7 @@ function ConfigPanelInner({
|
|
|
4431
4448
|
}
|
|
4432
4449
|
goBack();
|
|
4433
4450
|
};
|
|
4434
|
-
|
|
4451
|
+
React6.useEffect(() => {
|
|
4435
4452
|
function handleKeyDown(e) {
|
|
4436
4453
|
if (e.key !== "Escape") return;
|
|
4437
4454
|
if (isDirty) {
|
|
@@ -4654,7 +4671,7 @@ function cloneConfig(value) {
|
|
|
4654
4671
|
function ServerOnlyFetcher() {
|
|
4655
4672
|
const { fetchConfig } = getScriptConfigInstance();
|
|
4656
4673
|
const { reinitialize } = useFormActions();
|
|
4657
|
-
|
|
4674
|
+
React6.useEffect(() => {
|
|
4658
4675
|
let cancelled = false;
|
|
4659
4676
|
fetchConfig().then((full) => {
|
|
4660
4677
|
if (!cancelled && full) reinitialize(full);
|
|
@@ -4670,7 +4687,7 @@ var defaultOnClose = () => fetchNui("CLOSE_ADMIN_SECTION");
|
|
|
4670
4687
|
function ConfigPanel(props) {
|
|
4671
4688
|
const { open, onClose = defaultOnClose } = props;
|
|
4672
4689
|
const { store, updateConfig } = getScriptConfigInstance();
|
|
4673
|
-
const [isSaving, setIsSaving] =
|
|
4690
|
+
const [isSaving, setIsSaving] = React6.useState(false);
|
|
4674
4691
|
if (!open) return null;
|
|
4675
4692
|
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: configPanelQueryClient, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4676
4693
|
FormProvider,
|
|
@@ -4709,9 +4726,9 @@ function ConfigPanel(props) {
|
|
|
4709
4726
|
) });
|
|
4710
4727
|
}
|
|
4711
4728
|
function LazyImage({ src, alt, style }) {
|
|
4712
|
-
const [visible, setVisible] =
|
|
4713
|
-
const ref =
|
|
4714
|
-
|
|
4729
|
+
const [visible, setVisible] = React6.useState(false);
|
|
4730
|
+
const ref = React6.useRef(null);
|
|
4731
|
+
React6.useEffect(() => {
|
|
4715
4732
|
const observer = new IntersectionObserver(([entry]) => {
|
|
4716
4733
|
if (entry.isIntersecting) {
|
|
4717
4734
|
setVisible(true);
|
|
@@ -4725,7 +4742,7 @@ function LazyImage({ src, alt, style }) {
|
|
|
4725
4742
|
}
|
|
4726
4743
|
function SelectItem(props) {
|
|
4727
4744
|
const invItems = useItems();
|
|
4728
|
-
const formattedItems =
|
|
4745
|
+
const formattedItems = React6.useMemo(() => {
|
|
4729
4746
|
const seen = /* @__PURE__ */ new Set();
|
|
4730
4747
|
return useItemsList(props.excludeItemNames ?? []).filter((item) => {
|
|
4731
4748
|
if (seen.has(item.name)) return false;
|
|
@@ -4747,6 +4764,7 @@ function SelectItem(props) {
|
|
|
4747
4764
|
data: formattedItems,
|
|
4748
4765
|
allowDeselect: false,
|
|
4749
4766
|
searchable: true,
|
|
4767
|
+
comboboxProps: { withinPortal: true, zIndex: 2e3 },
|
|
4750
4768
|
leftSectionWidth: "4vh",
|
|
4751
4769
|
leftSection: props.value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4752
4770
|
core.Image,
|
|
@@ -4792,9 +4810,9 @@ function PositionPicker(props) {
|
|
|
4792
4810
|
} = props;
|
|
4793
4811
|
const theme2 = core.useMantineTheme();
|
|
4794
4812
|
const color = theme2.colors[theme2.primaryColor][5];
|
|
4795
|
-
const [previewing, setPreviewing] =
|
|
4796
|
-
const previewingRef =
|
|
4797
|
-
|
|
4813
|
+
const [previewing, setPreviewing] = React6.useState(false);
|
|
4814
|
+
const previewingRef = React6.useRef(false);
|
|
4815
|
+
React6.useEffect(() => {
|
|
4798
4816
|
return () => {
|
|
4799
4817
|
if (previewingRef.current) {
|
|
4800
4818
|
fetchNui(stopPreviewEvent, { relativeTo }).catch(() => {
|
|
@@ -4990,9 +5008,97 @@ function PickerButton({
|
|
|
4990
5008
|
}
|
|
4991
5009
|
) });
|
|
4992
5010
|
}
|
|
4993
|
-
var
|
|
5011
|
+
var GroupSelectContext = React6.createContext(null);
|
|
5012
|
+
function GroupSelect({
|
|
5013
|
+
value,
|
|
5014
|
+
onChange,
|
|
5015
|
+
type,
|
|
5016
|
+
children,
|
|
5017
|
+
style
|
|
5018
|
+
}) {
|
|
5019
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GroupSelectContext.Provider, { value: { value, onChange, type }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.4vh", ...style }, children }) });
|
|
5020
|
+
}
|
|
5021
|
+
function filterByType(jobs, gangs, type) {
|
|
5022
|
+
if (type === "job") return jobs;
|
|
5023
|
+
if (type === "gang") return gangs;
|
|
5024
|
+
return [...jobs, ...gangs];
|
|
5025
|
+
}
|
|
5026
|
+
function GroupName(props) {
|
|
5027
|
+
const ctx = React6.useContext(GroupSelectContext);
|
|
5028
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
5029
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
5030
|
+
const inCompound = ctx !== null;
|
|
5031
|
+
const currentValue = inCompound ? ctx.value.name : props.value;
|
|
5032
|
+
const filterType = inCompound ? ctx.type : props.type;
|
|
5033
|
+
const list = filterByType(jobs, gangs, filterType);
|
|
5034
|
+
const data = filterType === void 0 ? [
|
|
5035
|
+
{ group: locale("Jobs") || "Jobs", items: jobs.map((g) => ({ value: g.name, label: g.label })) },
|
|
5036
|
+
{ group: locale("Gangs") || "Gangs", items: gangs.map((g) => ({ value: g.name, label: g.label })) }
|
|
5037
|
+
] : list.map((g) => ({ value: g.name, label: g.label }));
|
|
5038
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5039
|
+
core.Select,
|
|
5040
|
+
{
|
|
5041
|
+
label: props.label,
|
|
5042
|
+
description: props.description,
|
|
5043
|
+
placeholder: props.placeholder ?? (locale("SelectGroup") || "Select\u2026"),
|
|
5044
|
+
size: props.size ?? "xs",
|
|
5045
|
+
disabled: props.disabled,
|
|
5046
|
+
style: props.style,
|
|
5047
|
+
data,
|
|
5048
|
+
value: currentValue ?? null,
|
|
5049
|
+
searchable: true,
|
|
5050
|
+
onChange: (v) => {
|
|
5051
|
+
const name = v ?? "";
|
|
5052
|
+
if (inCompound) {
|
|
5053
|
+
ctx.onChange({ name: name || void 0, grade: void 0 });
|
|
5054
|
+
} else if (props.onChange) {
|
|
5055
|
+
props.onChange(name);
|
|
5056
|
+
}
|
|
5057
|
+
},
|
|
5058
|
+
allowDeselect: false
|
|
5059
|
+
}
|
|
5060
|
+
);
|
|
5061
|
+
}
|
|
5062
|
+
function GroupRank(props) {
|
|
5063
|
+
const ctx = React6.useContext(GroupSelectContext);
|
|
5064
|
+
if (ctx === null) {
|
|
5065
|
+
throw new Error("<GroupRank> must be a child of <GroupSelect>");
|
|
5066
|
+
}
|
|
5067
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
5068
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
5069
|
+
const all = [...jobs, ...gangs];
|
|
5070
|
+
const selectedGroup = all.find((g) => g.name === ctx.value.name) ?? null;
|
|
5071
|
+
const grades = selectedGroup?.grades ?? [];
|
|
5072
|
+
const data = grades.map((g) => ({
|
|
5073
|
+
value: String(g.grade),
|
|
5074
|
+
label: `${g.grade} \u2014 ${g.label || g.name}${g.isBoss ? " (boss)" : ""}`
|
|
5075
|
+
}));
|
|
5076
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5077
|
+
core.Select,
|
|
5078
|
+
{
|
|
5079
|
+
label: props.label,
|
|
5080
|
+
description: props.description,
|
|
5081
|
+
placeholder: props.placeholder ?? (locale("SelectGrade") || "Select grade\u2026"),
|
|
5082
|
+
size: props.size ?? "xs",
|
|
5083
|
+
style: props.style,
|
|
5084
|
+
data,
|
|
5085
|
+
value: ctx.value.grade != null ? String(ctx.value.grade) : null,
|
|
5086
|
+
onChange: (v) => {
|
|
5087
|
+
ctx.onChange({
|
|
5088
|
+
...ctx.value,
|
|
5089
|
+
grade: v != null ? Number(v) : void 0
|
|
5090
|
+
});
|
|
5091
|
+
},
|
|
5092
|
+
disabled: !selectedGroup || grades.length === 0,
|
|
5093
|
+
allowDeselect: false
|
|
5094
|
+
}
|
|
5095
|
+
);
|
|
5096
|
+
}
|
|
5097
|
+
GroupSelect.Name = GroupName;
|
|
5098
|
+
GroupSelect.Rank = GroupRank;
|
|
5099
|
+
var KeyBindContext = React6.createContext(null);
|
|
4994
5100
|
function useKeyBindContext() {
|
|
4995
|
-
const ctx =
|
|
5101
|
+
const ctx = React6.useContext(KeyBindContext);
|
|
4996
5102
|
if (!ctx) {
|
|
4997
5103
|
throw new Error("FiveMKeyBindInput.* must be used inside <FiveMKeyBindInput>");
|
|
4998
5104
|
}
|
|
@@ -5071,7 +5177,7 @@ function AsyncSaveButton({
|
|
|
5071
5177
|
style
|
|
5072
5178
|
}) {
|
|
5073
5179
|
const theme2 = core.useMantineTheme();
|
|
5074
|
-
const [state, setState] =
|
|
5180
|
+
const [state, setState] = React6.useState("idle");
|
|
5075
5181
|
const handleClick = async () => {
|
|
5076
5182
|
if (state === "pending") return;
|
|
5077
5183
|
setState("pending");
|
|
@@ -5138,10 +5244,10 @@ function TestBed({
|
|
|
5138
5244
|
disablePersistence = false,
|
|
5139
5245
|
title = "TestBed"
|
|
5140
5246
|
}) {
|
|
5141
|
-
const [open, setOpen] =
|
|
5142
|
-
const itemsRef =
|
|
5247
|
+
const [open, setOpen] = React6.useState(false);
|
|
5248
|
+
const itemsRef = React6.useRef(items);
|
|
5143
5249
|
itemsRef.current = items;
|
|
5144
|
-
|
|
5250
|
+
React6.useEffect(() => {
|
|
5145
5251
|
if (!isEnvBrowser() || disablePersistence) return;
|
|
5146
5252
|
const persisted = loadPersistedState(storageKey);
|
|
5147
5253
|
itemsRef.current.forEach((item) => {
|
|
@@ -5467,7 +5573,7 @@ function mergeMantineThemeSafe(base, custom, override) {
|
|
|
5467
5573
|
}
|
|
5468
5574
|
};
|
|
5469
5575
|
}
|
|
5470
|
-
var DirkErrorBoundary = class extends
|
|
5576
|
+
var DirkErrorBoundary = class extends React6__default.default.Component {
|
|
5471
5577
|
constructor() {
|
|
5472
5578
|
super(...arguments);
|
|
5473
5579
|
__publicField(this, "state", { error: null, stack: void 0 });
|
|
@@ -5531,12 +5637,12 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
5531
5637
|
game
|
|
5532
5638
|
} = useSettings();
|
|
5533
5639
|
localeStore((s) => s.locales);
|
|
5534
|
-
|
|
5640
|
+
React6.useLayoutEffect(() => {
|
|
5535
5641
|
useSettings.setState({
|
|
5536
5642
|
overideResourceName
|
|
5537
5643
|
});
|
|
5538
5644
|
}, [overideResourceName]);
|
|
5539
|
-
|
|
5645
|
+
React6.useEffect(() => {
|
|
5540
5646
|
fetchNui("NUI_READY").catch(() => {
|
|
5541
5647
|
});
|
|
5542
5648
|
Promise.all([
|
|
@@ -5555,7 +5661,7 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
5555
5661
|
if (!data || typeof data !== "object") return;
|
|
5556
5662
|
useSettings.setState(data);
|
|
5557
5663
|
});
|
|
5558
|
-
const mergedTheme =
|
|
5664
|
+
const mergedTheme = React6.useMemo(
|
|
5559
5665
|
() => mergeMantineThemeSafe(
|
|
5560
5666
|
{ ...theme_default, primaryColor, primaryShade },
|
|
5561
5667
|
customTheme,
|
|
@@ -5563,7 +5669,7 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
5563
5669
|
),
|
|
5564
5670
|
[primaryColor, primaryShade, customTheme, themeOverride]
|
|
5565
5671
|
);
|
|
5566
|
-
|
|
5672
|
+
React6.useEffect(() => {
|
|
5567
5673
|
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : '"Akrobat Regular", sans-serif';
|
|
5568
5674
|
}, [game]);
|
|
5569
5675
|
const content = isEnvBrowser() ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5591,6 +5697,9 @@ exports.DirkProvider = DirkProvider;
|
|
|
5591
5697
|
exports.FiveMKeyBindInput = FiveMKeyBindInput;
|
|
5592
5698
|
exports.FloatingParticles = FloatingParticles;
|
|
5593
5699
|
exports.FormProvider = FormProvider;
|
|
5700
|
+
exports.GroupName = GroupName;
|
|
5701
|
+
exports.GroupRank = GroupRank;
|
|
5702
|
+
exports.GroupSelect = GroupSelect;
|
|
5594
5703
|
exports.INPUT_MAPPER_KEYS_BY_PRIMARY = INPUT_MAPPER_KEYS_BY_PRIMARY;
|
|
5595
5704
|
exports.INPUT_MAPPER_PRIMARY_OPTIONS = INPUT_MAPPER_PRIMARY_OPTIONS;
|
|
5596
5705
|
exports.InfoBox = InfoBox;
|
|
@@ -5642,6 +5751,7 @@ exports.openLink = openLink;
|
|
|
5642
5751
|
exports.registerInitialFetch = registerInitialFetch;
|
|
5643
5752
|
exports.registerInitialLuaTableFetch = registerInitialLuaTableFetch;
|
|
5644
5753
|
exports.runFetches = runFetches;
|
|
5754
|
+
exports.selectAllGroups = selectAllGroups;
|
|
5645
5755
|
exports.splitFAString = splitFAString;
|
|
5646
5756
|
exports.updatePresignedURL = updatePresignedURL;
|
|
5647
5757
|
exports.uploadImage = uploadImage;
|
|
@@ -5653,6 +5763,7 @@ exports.useFormError = useFormError;
|
|
|
5653
5763
|
exports.useFormErrors = useFormErrors;
|
|
5654
5764
|
exports.useFormField = useFormField;
|
|
5655
5765
|
exports.useFormFields = useFormFields;
|
|
5766
|
+
exports.useFrameworkGroups = useFrameworkGroups;
|
|
5656
5767
|
exports.useItems = useItems;
|
|
5657
5768
|
exports.useItemsList = useItemsList;
|
|
5658
5769
|
exports.useModal = useModal;
|