dirk-cfx-react 1.1.65 → 1.1.66
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 +105 -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 +103 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +178 -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 +108 -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;
|
|
@@ -4792,9 +4809,9 @@ function PositionPicker(props) {
|
|
|
4792
4809
|
} = props;
|
|
4793
4810
|
const theme2 = core.useMantineTheme();
|
|
4794
4811
|
const color = theme2.colors[theme2.primaryColor][5];
|
|
4795
|
-
const [previewing, setPreviewing] =
|
|
4796
|
-
const previewingRef =
|
|
4797
|
-
|
|
4812
|
+
const [previewing, setPreviewing] = React6.useState(false);
|
|
4813
|
+
const previewingRef = React6.useRef(false);
|
|
4814
|
+
React6.useEffect(() => {
|
|
4798
4815
|
return () => {
|
|
4799
4816
|
if (previewingRef.current) {
|
|
4800
4817
|
fetchNui(stopPreviewEvent, { relativeTo }).catch(() => {
|
|
@@ -4990,9 +5007,97 @@ function PickerButton({
|
|
|
4990
5007
|
}
|
|
4991
5008
|
) });
|
|
4992
5009
|
}
|
|
4993
|
-
var
|
|
5010
|
+
var GroupSelectContext = React6.createContext(null);
|
|
5011
|
+
function GroupSelect({
|
|
5012
|
+
value,
|
|
5013
|
+
onChange,
|
|
5014
|
+
type,
|
|
5015
|
+
children,
|
|
5016
|
+
style
|
|
5017
|
+
}) {
|
|
5018
|
+
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 }) });
|
|
5019
|
+
}
|
|
5020
|
+
function filterByType(jobs, gangs, type) {
|
|
5021
|
+
if (type === "job") return jobs;
|
|
5022
|
+
if (type === "gang") return gangs;
|
|
5023
|
+
return [...jobs, ...gangs];
|
|
5024
|
+
}
|
|
5025
|
+
function GroupName(props) {
|
|
5026
|
+
const ctx = React6.useContext(GroupSelectContext);
|
|
5027
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
5028
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
5029
|
+
const inCompound = ctx !== null;
|
|
5030
|
+
const currentValue = inCompound ? ctx.value.name : props.value;
|
|
5031
|
+
const filterType = inCompound ? ctx.type : props.type;
|
|
5032
|
+
const list = filterByType(jobs, gangs, filterType);
|
|
5033
|
+
const data = filterType === void 0 ? [
|
|
5034
|
+
{ group: locale("Jobs") || "Jobs", items: jobs.map((g) => ({ value: g.name, label: g.label })) },
|
|
5035
|
+
{ group: locale("Gangs") || "Gangs", items: gangs.map((g) => ({ value: g.name, label: g.label })) }
|
|
5036
|
+
] : list.map((g) => ({ value: g.name, label: g.label }));
|
|
5037
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5038
|
+
core.Select,
|
|
5039
|
+
{
|
|
5040
|
+
label: props.label,
|
|
5041
|
+
description: props.description,
|
|
5042
|
+
placeholder: props.placeholder ?? (locale("SelectGroup") || "Select\u2026"),
|
|
5043
|
+
size: props.size ?? "xs",
|
|
5044
|
+
disabled: props.disabled,
|
|
5045
|
+
style: props.style,
|
|
5046
|
+
data,
|
|
5047
|
+
value: currentValue ?? null,
|
|
5048
|
+
searchable: true,
|
|
5049
|
+
onChange: (v) => {
|
|
5050
|
+
const name = v ?? "";
|
|
5051
|
+
if (inCompound) {
|
|
5052
|
+
ctx.onChange({ name: name || void 0, grade: void 0 });
|
|
5053
|
+
} else if (props.onChange) {
|
|
5054
|
+
props.onChange(name);
|
|
5055
|
+
}
|
|
5056
|
+
},
|
|
5057
|
+
allowDeselect: false
|
|
5058
|
+
}
|
|
5059
|
+
);
|
|
5060
|
+
}
|
|
5061
|
+
function GroupRank(props) {
|
|
5062
|
+
const ctx = React6.useContext(GroupSelectContext);
|
|
5063
|
+
if (ctx === null) {
|
|
5064
|
+
throw new Error("<GroupRank> must be a child of <GroupSelect>");
|
|
5065
|
+
}
|
|
5066
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
5067
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
5068
|
+
const all = [...jobs, ...gangs];
|
|
5069
|
+
const selectedGroup = all.find((g) => g.name === ctx.value.name) ?? null;
|
|
5070
|
+
const grades = selectedGroup?.grades ?? [];
|
|
5071
|
+
const data = grades.map((g) => ({
|
|
5072
|
+
value: String(g.grade),
|
|
5073
|
+
label: `${g.grade} \u2014 ${g.label || g.name}${g.isBoss ? " (boss)" : ""}`
|
|
5074
|
+
}));
|
|
5075
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5076
|
+
core.Select,
|
|
5077
|
+
{
|
|
5078
|
+
label: props.label,
|
|
5079
|
+
description: props.description,
|
|
5080
|
+
placeholder: props.placeholder ?? (locale("SelectGrade") || "Select grade\u2026"),
|
|
5081
|
+
size: props.size ?? "xs",
|
|
5082
|
+
style: props.style,
|
|
5083
|
+
data,
|
|
5084
|
+
value: ctx.value.grade != null ? String(ctx.value.grade) : null,
|
|
5085
|
+
onChange: (v) => {
|
|
5086
|
+
ctx.onChange({
|
|
5087
|
+
...ctx.value,
|
|
5088
|
+
grade: v != null ? Number(v) : void 0
|
|
5089
|
+
});
|
|
5090
|
+
},
|
|
5091
|
+
disabled: !selectedGroup || grades.length === 0,
|
|
5092
|
+
allowDeselect: false
|
|
5093
|
+
}
|
|
5094
|
+
);
|
|
5095
|
+
}
|
|
5096
|
+
GroupSelect.Name = GroupName;
|
|
5097
|
+
GroupSelect.Rank = GroupRank;
|
|
5098
|
+
var KeyBindContext = React6.createContext(null);
|
|
4994
5099
|
function useKeyBindContext() {
|
|
4995
|
-
const ctx =
|
|
5100
|
+
const ctx = React6.useContext(KeyBindContext);
|
|
4996
5101
|
if (!ctx) {
|
|
4997
5102
|
throw new Error("FiveMKeyBindInput.* must be used inside <FiveMKeyBindInput>");
|
|
4998
5103
|
}
|
|
@@ -5071,7 +5176,7 @@ function AsyncSaveButton({
|
|
|
5071
5176
|
style
|
|
5072
5177
|
}) {
|
|
5073
5178
|
const theme2 = core.useMantineTheme();
|
|
5074
|
-
const [state, setState] =
|
|
5179
|
+
const [state, setState] = React6.useState("idle");
|
|
5075
5180
|
const handleClick = async () => {
|
|
5076
5181
|
if (state === "pending") return;
|
|
5077
5182
|
setState("pending");
|
|
@@ -5138,10 +5243,10 @@ function TestBed({
|
|
|
5138
5243
|
disablePersistence = false,
|
|
5139
5244
|
title = "TestBed"
|
|
5140
5245
|
}) {
|
|
5141
|
-
const [open, setOpen] =
|
|
5142
|
-
const itemsRef =
|
|
5246
|
+
const [open, setOpen] = React6.useState(false);
|
|
5247
|
+
const itemsRef = React6.useRef(items);
|
|
5143
5248
|
itemsRef.current = items;
|
|
5144
|
-
|
|
5249
|
+
React6.useEffect(() => {
|
|
5145
5250
|
if (!isEnvBrowser() || disablePersistence) return;
|
|
5146
5251
|
const persisted = loadPersistedState(storageKey);
|
|
5147
5252
|
itemsRef.current.forEach((item) => {
|
|
@@ -5467,7 +5572,7 @@ function mergeMantineThemeSafe(base, custom, override) {
|
|
|
5467
5572
|
}
|
|
5468
5573
|
};
|
|
5469
5574
|
}
|
|
5470
|
-
var DirkErrorBoundary = class extends
|
|
5575
|
+
var DirkErrorBoundary = class extends React6__default.default.Component {
|
|
5471
5576
|
constructor() {
|
|
5472
5577
|
super(...arguments);
|
|
5473
5578
|
__publicField(this, "state", { error: null, stack: void 0 });
|
|
@@ -5531,12 +5636,12 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
5531
5636
|
game
|
|
5532
5637
|
} = useSettings();
|
|
5533
5638
|
localeStore((s) => s.locales);
|
|
5534
|
-
|
|
5639
|
+
React6.useLayoutEffect(() => {
|
|
5535
5640
|
useSettings.setState({
|
|
5536
5641
|
overideResourceName
|
|
5537
5642
|
});
|
|
5538
5643
|
}, [overideResourceName]);
|
|
5539
|
-
|
|
5644
|
+
React6.useEffect(() => {
|
|
5540
5645
|
fetchNui("NUI_READY").catch(() => {
|
|
5541
5646
|
});
|
|
5542
5647
|
Promise.all([
|
|
@@ -5555,7 +5660,7 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
5555
5660
|
if (!data || typeof data !== "object") return;
|
|
5556
5661
|
useSettings.setState(data);
|
|
5557
5662
|
});
|
|
5558
|
-
const mergedTheme =
|
|
5663
|
+
const mergedTheme = React6.useMemo(
|
|
5559
5664
|
() => mergeMantineThemeSafe(
|
|
5560
5665
|
{ ...theme_default, primaryColor, primaryShade },
|
|
5561
5666
|
customTheme,
|
|
@@ -5563,7 +5668,7 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
5563
5668
|
),
|
|
5564
5669
|
[primaryColor, primaryShade, customTheme, themeOverride]
|
|
5565
5670
|
);
|
|
5566
|
-
|
|
5671
|
+
React6.useEffect(() => {
|
|
5567
5672
|
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : '"Akrobat Regular", sans-serif';
|
|
5568
5673
|
}, [game]);
|
|
5569
5674
|
const content = isEnvBrowser() ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5591,6 +5696,9 @@ exports.DirkProvider = DirkProvider;
|
|
|
5591
5696
|
exports.FiveMKeyBindInput = FiveMKeyBindInput;
|
|
5592
5697
|
exports.FloatingParticles = FloatingParticles;
|
|
5593
5698
|
exports.FormProvider = FormProvider;
|
|
5699
|
+
exports.GroupName = GroupName;
|
|
5700
|
+
exports.GroupRank = GroupRank;
|
|
5701
|
+
exports.GroupSelect = GroupSelect;
|
|
5594
5702
|
exports.INPUT_MAPPER_KEYS_BY_PRIMARY = INPUT_MAPPER_KEYS_BY_PRIMARY;
|
|
5595
5703
|
exports.INPUT_MAPPER_PRIMARY_OPTIONS = INPUT_MAPPER_PRIMARY_OPTIONS;
|
|
5596
5704
|
exports.InfoBox = InfoBox;
|
|
@@ -5642,6 +5750,7 @@ exports.openLink = openLink;
|
|
|
5642
5750
|
exports.registerInitialFetch = registerInitialFetch;
|
|
5643
5751
|
exports.registerInitialLuaTableFetch = registerInitialLuaTableFetch;
|
|
5644
5752
|
exports.runFetches = runFetches;
|
|
5753
|
+
exports.selectAllGroups = selectAllGroups;
|
|
5645
5754
|
exports.splitFAString = splitFAString;
|
|
5646
5755
|
exports.updatePresignedURL = updatePresignedURL;
|
|
5647
5756
|
exports.uploadImage = uploadImage;
|
|
@@ -5653,6 +5762,7 @@ exports.useFormError = useFormError;
|
|
|
5653
5762
|
exports.useFormErrors = useFormErrors;
|
|
5654
5763
|
exports.useFormField = useFormField;
|
|
5655
5764
|
exports.useFormFields = useFormFields;
|
|
5765
|
+
exports.useFrameworkGroups = useFrameworkGroups;
|
|
5656
5766
|
exports.useItems = useItems;
|
|
5657
5767
|
exports.useItemsList = useItemsList;
|
|
5658
5768
|
exports.useModal = useModal;
|