dirk-cfx-react 1.1.92 → 1.1.94
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/chunk-3T2CCW5E.cjs +150 -0
- package/dist/chunk-3T2CCW5E.cjs.map +1 -0
- package/dist/chunk-4DE2IREA.cjs +9 -0
- package/dist/chunk-4DE2IREA.cjs.map +1 -0
- package/dist/chunk-E2SFEBBB.cjs +449 -0
- package/dist/chunk-E2SFEBBB.cjs.map +1 -0
- package/dist/chunk-GKSP5RIA.js +3 -0
- package/dist/chunk-GKSP5RIA.js.map +1 -0
- package/dist/chunk-HAB6H274.js +6646 -0
- package/dist/chunk-HAB6H274.js.map +1 -0
- package/dist/chunk-K3GDU6EY.cjs +6717 -0
- package/dist/chunk-K3GDU6EY.cjs.map +1 -0
- package/dist/chunk-KGLO3ZAS.js +431 -0
- package/dist/chunk-KGLO3ZAS.js.map +1 -0
- package/dist/chunk-LRGCBNZ7.cjs +4 -0
- package/dist/chunk-LRGCBNZ7.cjs.map +1 -0
- package/dist/chunk-MYNNCLMA.js +1375 -0
- package/dist/chunk-MYNNCLMA.js.map +1 -0
- package/dist/chunk-NVMOGS7Y.js +437 -0
- package/dist/chunk-NVMOGS7Y.js.map +1 -0
- package/dist/chunk-QOQQ3ERZ.cjs +445 -0
- package/dist/chunk-QOQQ3ERZ.cjs.map +1 -0
- package/dist/chunk-V6TY7KAL.js +7 -0
- package/dist/chunk-V6TY7KAL.js.map +1 -0
- package/dist/chunk-VKYONY7E.cjs +112 -0
- package/dist/chunk-VKYONY7E.cjs.map +1 -0
- package/dist/chunk-YA2PXBP6.cjs +1430 -0
- package/dist/chunk-YA2PXBP6.cjs.map +1 -0
- package/dist/chunk-Z7N5AQJW.js +146 -0
- package/dist/chunk-Z7N5AQJW.js.map +1 -0
- package/dist/chunk-ZPFW7C2A.js +108 -0
- package/dist/chunk-ZPFW7C2A.js.map +1 -0
- package/dist/components/index.cjs +282 -7760
- 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 +6 -7699
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +75 -718
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +11 -1
- package/dist/hooks/index.d.ts +11 -1
- package/dist/hooks/index.js +5 -701
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +572 -9066
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -8928
- package/dist/index.js.map +1 -1
- package/dist/modelNames-QIAIYORH.cjs +53910 -0
- package/dist/modelNames-QIAIYORH.cjs.map +1 -0
- package/dist/modelNames-WAUYJLL3.js +53908 -0
- package/dist/modelNames-WAUYJLL3.js.map +1 -0
- package/dist/providers/index.cjs +11 -596
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +5 -596
- package/dist/providers/index.js.map +1 -1
- package/dist/utils/index.cjs +186 -1361
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +41 -1
- package/dist/utils/index.d.ts +41 -1
- package/dist/utils/index.js +2 -1324
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/providers/index.js
CHANGED
|
@@ -1,598 +1,7 @@
|
|
|
1
|
-
import '
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
import '
|
|
6
|
-
import './styles/tornEdge.css';
|
|
7
|
-
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
8
|
-
import { fab } from '@fortawesome/free-brands-svg-icons';
|
|
9
|
-
import { far } from '@fortawesome/free-regular-svg-icons';
|
|
10
|
-
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
11
|
-
import { createTheme, alpha, Box, Stack, Title, Text, Code, MantineProvider, BackgroundImage } from '@mantine/core';
|
|
12
|
-
import React, { useState, useLayoutEffect, useEffect, useMemo, useRef } from 'react';
|
|
13
|
-
import { create } from 'zustand';
|
|
14
|
-
import { z } from 'zod';
|
|
15
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
16
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
17
|
-
|
|
18
|
-
var __defProp = Object.defineProperty;
|
|
19
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
21
|
-
var label = {
|
|
22
|
-
fontSize: "var(--mantine-font-size-xs)",
|
|
23
|
-
fontFamily: "Akrobat Bold",
|
|
24
|
-
letterSpacing: "0.05em",
|
|
25
|
-
textTransform: "uppercase"
|
|
26
|
-
};
|
|
27
|
-
var error = {
|
|
28
|
-
fontSize: "var(--mantine-font-size-xs)",
|
|
29
|
-
fontFamily: "Akrobat Regular"
|
|
30
|
-
};
|
|
31
|
-
var description = {
|
|
32
|
-
fontSize: "var(--mantine-font-size-xs)"
|
|
33
|
-
};
|
|
34
|
-
var genericInputStyles = {
|
|
35
|
-
styles: {
|
|
36
|
-
label,
|
|
37
|
-
error,
|
|
38
|
-
description,
|
|
39
|
-
input: {
|
|
40
|
-
background: "rgba(255,255,255,0.04)",
|
|
41
|
-
border: "0.1vh solid rgba(255,255,255,0.08)",
|
|
42
|
-
color: "rgba(255,255,255,0.85)",
|
|
43
|
-
minHeight: "4vh"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
var theme = createTheme({
|
|
48
|
-
primaryColor: "dirk",
|
|
49
|
-
primaryShade: 9,
|
|
50
|
-
defaultRadius: "xs",
|
|
51
|
-
fontFamily: "Akrobat Regular, sans-serif",
|
|
52
|
-
radius: {
|
|
53
|
-
xxs: "0.3vh",
|
|
54
|
-
xs: "0.5vh",
|
|
55
|
-
sm: "0.75vh",
|
|
56
|
-
md: "1vh",
|
|
57
|
-
lg: "1.5vh",
|
|
58
|
-
xl: "2vh",
|
|
59
|
-
xxl: "3vh"
|
|
60
|
-
},
|
|
61
|
-
fontSizes: {
|
|
62
|
-
xxs: "1.2vh",
|
|
63
|
-
xs: "1.5vh",
|
|
64
|
-
sm: "1.8vh",
|
|
65
|
-
md: "2.2vh",
|
|
66
|
-
lg: "2.8vh",
|
|
67
|
-
xl: "3.3vh",
|
|
68
|
-
xxl: "3.8vh"
|
|
69
|
-
},
|
|
70
|
-
lineHeights: {
|
|
71
|
-
xxs: "1.4vh",
|
|
72
|
-
xs: "1.8vh",
|
|
73
|
-
sm: "2.2vh",
|
|
74
|
-
md: "2.8vh",
|
|
75
|
-
lg: "3.3vh",
|
|
76
|
-
xl: "3.8vh"
|
|
77
|
-
},
|
|
78
|
-
spacing: {
|
|
79
|
-
xxs: "0.5vh",
|
|
80
|
-
xs: "0.75vh",
|
|
81
|
-
sm: "1.5vh",
|
|
82
|
-
md: "2vh",
|
|
83
|
-
lg: "3vh",
|
|
84
|
-
xl: "4vh",
|
|
85
|
-
xxl: "5vh"
|
|
86
|
-
},
|
|
87
|
-
components: {
|
|
88
|
-
Progress: {
|
|
89
|
-
styles: {
|
|
90
|
-
label: {
|
|
91
|
-
fontFamily: "Akrobat Bold",
|
|
92
|
-
letterSpacing: "0.05em",
|
|
93
|
-
textTransform: "uppercase"
|
|
94
|
-
},
|
|
95
|
-
root: {
|
|
96
|
-
backgroundColor: "rgba(77, 77, 77, 0.4)"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
Input: genericInputStyles,
|
|
101
|
-
TextInput: genericInputStyles,
|
|
102
|
-
NumberInput: genericInputStyles,
|
|
103
|
-
Select: genericInputStyles,
|
|
104
|
-
MultiSelect: genericInputStyles,
|
|
105
|
-
Textarea: genericInputStyles,
|
|
106
|
-
ColorInput: genericInputStyles,
|
|
107
|
-
DateInput: genericInputStyles,
|
|
108
|
-
// Mantine's <Button> defaults to rem-based heights (xs ≈ 1.875rem)
|
|
109
|
-
// which doesn't match this theme's vh-based input min-heights, so
|
|
110
|
-
// `<Button size="xs">` rendered next to `<TextInput size="xs">` ends
|
|
111
|
-
// up visibly shorter. Pin the button heights to the same vh values
|
|
112
|
-
// the inputs use so xs-everything lines up out of the box.
|
|
113
|
-
Button: {
|
|
114
|
-
styles: {
|
|
115
|
-
label: {
|
|
116
|
-
fontFamily: "Akrobat Bold",
|
|
117
|
-
letterSpacing: "0.05em",
|
|
118
|
-
textTransform: "uppercase"
|
|
119
|
-
},
|
|
120
|
-
root: {
|
|
121
|
-
// Mantine maps these to --button-height per size; setting them
|
|
122
|
-
// directly here keeps native Button sizing logic intact.
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
vars: (_theme, props) => {
|
|
126
|
-
const heights = {
|
|
127
|
-
xs: "4vh",
|
|
128
|
-
sm: "4.5vh",
|
|
129
|
-
md: "5vh",
|
|
130
|
-
lg: "5.5vh",
|
|
131
|
-
xl: "6vh"
|
|
132
|
-
};
|
|
133
|
-
const h = heights[props.size ?? "sm"] ?? "4.5vh";
|
|
134
|
-
return {
|
|
135
|
-
root: {
|
|
136
|
-
"--button-height": h
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
Pill: {
|
|
142
|
-
styles: (theme2) => ({
|
|
143
|
-
root: {
|
|
144
|
-
display: "inline-flex",
|
|
145
|
-
alignItems: "center",
|
|
146
|
-
justifyContent: "space-between",
|
|
147
|
-
backgroundColor: "rgba(76, 76, 76, 0.3)",
|
|
148
|
-
height: "fit-content",
|
|
149
|
-
textTransform: "uppercase",
|
|
150
|
-
letterSpacing: "0.05em",
|
|
151
|
-
fontFamily: "Akrobat Bold",
|
|
152
|
-
fontSize: "1.25vh",
|
|
153
|
-
borderRadius: theme2.defaultRadius,
|
|
154
|
-
paddingBottom: "0.5vh",
|
|
155
|
-
paddingTop: "0.5vh"
|
|
156
|
-
}
|
|
157
|
-
})
|
|
158
|
-
},
|
|
159
|
-
// Mantine's <Tooltip> defaults to a white card with black text — looks
|
|
160
|
-
// jarring against every dirk consumer's dark configurator. Every script
|
|
161
|
-
// used to hand-paste this dark style block per Tooltip; centralised here
|
|
162
|
-
// so consumers get the right look automatically and never need to think
|
|
163
|
-
// about it again.
|
|
164
|
-
Tooltip: {
|
|
165
|
-
styles: (theme2) => ({
|
|
166
|
-
tooltip: {
|
|
167
|
-
background: alpha(theme2.colors.dark[7], 0.95),
|
|
168
|
-
border: "0.1vh solid rgba(255,255,255,0.1)",
|
|
169
|
-
color: "rgba(255,255,255,0.75)",
|
|
170
|
-
fontFamily: "Akrobat Bold",
|
|
171
|
-
fontSize: "1.3vh",
|
|
172
|
-
lineHeight: 1.3,
|
|
173
|
-
padding: "0.6vh 0.8vh",
|
|
174
|
-
letterSpacing: "0.03em"
|
|
175
|
-
}
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
colors: {
|
|
180
|
-
dirk: [
|
|
181
|
-
"#ffffff",
|
|
182
|
-
"#f3fce9",
|
|
183
|
-
"#dbf5bd",
|
|
184
|
-
"#c3ee91",
|
|
185
|
-
"#ace765",
|
|
186
|
-
"#94e039",
|
|
187
|
-
"#7ac61f",
|
|
188
|
-
"#5f9a18",
|
|
189
|
-
"#29420a",
|
|
190
|
-
"#446e11"
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
var theme_default = theme;
|
|
195
|
-
|
|
196
|
-
// src/utils/misc.ts
|
|
197
|
-
var isEnvBrowser = () => !window.invokeNative;
|
|
198
|
-
var noop = () => {
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// src/hooks/useNuiEvent.ts
|
|
202
|
-
var useNuiEvent = (action, handler) => {
|
|
203
|
-
const savedHandler = useRef(noop);
|
|
204
|
-
useEffect(() => {
|
|
205
|
-
savedHandler.current = handler;
|
|
206
|
-
}, [handler]);
|
|
207
|
-
useEffect(() => {
|
|
208
|
-
const eventListener = (event) => {
|
|
209
|
-
const { action: eventAction, data } = event.data;
|
|
210
|
-
if (savedHandler.current) {
|
|
211
|
-
if (eventAction === action) {
|
|
212
|
-
savedHandler.current(data);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
window.addEventListener("message", eventListener);
|
|
217
|
-
return () => window.removeEventListener("message", eventListener);
|
|
218
|
-
}, [action]);
|
|
219
|
-
};
|
|
220
|
-
var DEFAULT_PALETTE = [
|
|
221
|
-
"#f0f4ff",
|
|
222
|
-
"#d9e3ff",
|
|
223
|
-
"#bfcfff",
|
|
224
|
-
"#a6bbff",
|
|
225
|
-
"#8ca7ff",
|
|
226
|
-
"#7393ff",
|
|
227
|
-
"#5a7fff",
|
|
228
|
-
"#406bff",
|
|
229
|
-
"#2547ff",
|
|
230
|
-
"#0b33ff"
|
|
231
|
-
];
|
|
232
|
-
z.object({
|
|
233
|
-
useOverride: z.boolean(),
|
|
234
|
-
primaryColor: z.string(),
|
|
235
|
-
primaryShade: z.number(),
|
|
236
|
-
customTheme: z.array(z.string())
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// src/utils/useSettings.ts
|
|
240
|
-
var useSettings = create(() => ({
|
|
241
|
-
currency: "$",
|
|
242
|
-
game: "fivem",
|
|
243
|
-
primaryColor: "dirk",
|
|
244
|
-
primaryShade: 9,
|
|
245
|
-
itemImgPath: "",
|
|
246
|
-
resourceVersion: "dev",
|
|
247
|
-
customTheme: DEFAULT_PALETTE
|
|
248
|
-
}));
|
|
249
|
-
|
|
250
|
-
// src/utils/fetchNui.ts
|
|
251
|
-
async function fetchNui(eventName, data, mockData) {
|
|
252
|
-
const options = {
|
|
253
|
-
method: "post",
|
|
254
|
-
headers: {
|
|
255
|
-
"Content-Type": "application/json; charset=UTF-8"
|
|
256
|
-
},
|
|
257
|
-
body: JSON.stringify(data)
|
|
258
|
-
};
|
|
259
|
-
if (isEnvBrowser() && mockData !== void 0) return mockData;
|
|
260
|
-
if (isEnvBrowser() && mockData === void 0) {
|
|
261
|
-
console.warn(
|
|
262
|
-
`[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
|
|
263
|
-
);
|
|
264
|
-
return {};
|
|
265
|
-
}
|
|
266
|
-
const overrideResourceName = useSettings.getState().overideResourceName;
|
|
267
|
-
const hasResourceContext = typeof window.GetParentResourceName === "function" || !!overrideResourceName;
|
|
268
|
-
if (!hasResourceContext) {
|
|
269
|
-
return mockData ?? {};
|
|
270
|
-
}
|
|
271
|
-
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : overrideResourceName;
|
|
272
|
-
try {
|
|
273
|
-
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
274
|
-
return await resp.json();
|
|
275
|
-
} catch {
|
|
276
|
-
return mockData ?? {};
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
async function registerInitialFetch(eventName, data, mockData) {
|
|
280
|
-
const fetcher = () => fetchNui(eventName, data, mockData);
|
|
281
|
-
return fetcher();
|
|
282
|
-
}
|
|
283
|
-
var reportedMissing = /* @__PURE__ */ new Set();
|
|
284
|
-
function reportMissingLocale(key) {
|
|
285
|
-
if (!key || reportedMissing.has(key)) return;
|
|
286
|
-
reportedMissing.add(key);
|
|
287
|
-
fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
var PACKAGE_DEFAULTS = {
|
|
291
|
-
"OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant.",
|
|
292
|
-
"cfgpanel_discard": "Discard",
|
|
293
|
-
"cfgpanel_manual_edit": "Manual Edit",
|
|
294
|
-
"cfgpanel_reset_defaults": "Reset Defaults",
|
|
295
|
-
"cfgpanel_version": "Version",
|
|
296
|
-
"cfgpanel_back_title": "Back to script list",
|
|
297
|
-
"cfgpanel_undo": "Undo",
|
|
298
|
-
"cfgpanel_redo": "Redo",
|
|
299
|
-
"cfgpanel_save": "Save",
|
|
300
|
-
"cfgpanel_saving": "Saving...",
|
|
301
|
-
"cfgpanel_history": "History",
|
|
302
|
-
"cfgpanel_reset_title": "Reset to Defaults",
|
|
303
|
-
"cfgpanel_reset_desc": "This will permanently reset ALL config back to the defaults. Every value you have configured will be overwritten. This cannot be undone.",
|
|
304
|
-
"cfgpanel_reset_confirm": "Reset Config",
|
|
305
|
-
"cfgpanel_discard_title": "Discard Unsaved Changes?",
|
|
306
|
-
"cfgpanel_discard_desc_back": "You have unsaved changes. Going back now will discard them.",
|
|
307
|
-
"cfgpanel_discard_desc_close": "You have unsaved changes. Closing now will discard them.",
|
|
308
|
-
"cfgpanel_discard_confirm_back": "Go Back Without Saving",
|
|
309
|
-
"cfgpanel_discard_confirm_close": "Close Without Saving",
|
|
310
|
-
"cfgpanel_json_title": "Config JSON",
|
|
311
|
-
"cfgpanel_cancel": "Cancel",
|
|
312
|
-
"cfgpanel_apply": "Apply",
|
|
313
|
-
"cfgpanel_history_title": "Config History",
|
|
314
|
-
"cfgpanel_close": "Close"
|
|
315
|
-
};
|
|
316
|
-
var localeStore = create((set, get) => {
|
|
317
|
-
return {
|
|
318
|
-
locales: { ...PACKAGE_DEFAULTS },
|
|
319
|
-
locale: (key, ...args) => {
|
|
320
|
-
const exists = get().locales[key];
|
|
321
|
-
if (!exists) reportMissingLocale(key);
|
|
322
|
-
let translation = exists || key;
|
|
323
|
-
if (args.length) {
|
|
324
|
-
translation = translation.replace(/%s/g, () => String(args.shift() || ""));
|
|
325
|
-
}
|
|
326
|
-
return translation;
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
});
|
|
330
|
-
localeStore.getState().locale;
|
|
331
|
-
registerInitialFetch("GET_LOCALES", void 0).then((data) => {
|
|
332
|
-
localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...data } });
|
|
333
|
-
}).catch(() => {
|
|
334
|
-
});
|
|
335
|
-
if (typeof window !== "undefined") {
|
|
336
|
-
window.addEventListener("message", (event) => {
|
|
337
|
-
const msg = event.data;
|
|
338
|
-
if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
|
|
339
|
-
if (!msg.data || typeof msg.data !== "object") return;
|
|
340
|
-
if (Object.keys(msg.data).length === 0) return;
|
|
341
|
-
localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...msg.data } });
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// src/utils/mergeMantineTheme.ts
|
|
346
|
-
var isValidColorScale = (v) => Array.isArray(v) && v.length === 10 && v.every((shade) => typeof shade === "string");
|
|
347
|
-
function mergeMantineThemeSafe(base, custom, override) {
|
|
348
|
-
const colors = { ...base.colors };
|
|
349
|
-
if (custom && isValidColorScale(custom)) {
|
|
350
|
-
colors["custom"] = custom;
|
|
351
|
-
} else if (!colors["custom"]) {
|
|
352
|
-
const fallback = base.colors && base.colors.dirk;
|
|
353
|
-
if (fallback && isValidColorScale(fallback)) {
|
|
354
|
-
colors["custom"] = fallback;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return {
|
|
358
|
-
...base,
|
|
359
|
-
...override,
|
|
360
|
-
colors: {
|
|
361
|
-
...colors,
|
|
362
|
-
...override?.colors ?? {}
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
function getScriptConfigInstance() {
|
|
367
|
-
throw new Error("[dirk-cfx-react] createScriptConfig must be called before using ConfigPanel");
|
|
368
|
-
}
|
|
369
|
-
var DirkErrorBoundary = class extends React.Component {
|
|
370
|
-
constructor() {
|
|
371
|
-
super(...arguments);
|
|
372
|
-
__publicField(this, "state", { error: null, stack: void 0 });
|
|
373
|
-
}
|
|
374
|
-
static getDerivedStateFromError(error2) {
|
|
375
|
-
return { error: error2 };
|
|
376
|
-
}
|
|
377
|
-
componentDidCatch(error2, info) {
|
|
378
|
-
console.group("\u{1F525} Dirk UI Crash");
|
|
379
|
-
console.error("Error:", error2);
|
|
380
|
-
console.error("Component Stack:", info.componentStack);
|
|
381
|
-
console.groupEnd();
|
|
382
|
-
}
|
|
383
|
-
render() {
|
|
384
|
-
if (!this.state.error) return this.props.children;
|
|
385
|
-
return /* @__PURE__ */ jsx(
|
|
386
|
-
Box,
|
|
387
|
-
{
|
|
388
|
-
style: {
|
|
389
|
-
position: "fixed",
|
|
390
|
-
inset: 0,
|
|
391
|
-
width: "100vw",
|
|
392
|
-
height: "100vh",
|
|
393
|
-
background: "rgba(10, 10, 12, 0.92)",
|
|
394
|
-
display: "flex",
|
|
395
|
-
alignItems: "center",
|
|
396
|
-
justifyContent: "center",
|
|
397
|
-
padding: "2rem",
|
|
398
|
-
zIndex: 999999
|
|
399
|
-
},
|
|
400
|
-
children: /* @__PURE__ */ jsx(
|
|
401
|
-
Box,
|
|
402
|
-
{
|
|
403
|
-
maw: 900,
|
|
404
|
-
w: "100%",
|
|
405
|
-
p: "lg",
|
|
406
|
-
style: {
|
|
407
|
-
background: "rgba(20,20,24,0.75)",
|
|
408
|
-
border: "1px solid rgba(255,255,255,0.08)",
|
|
409
|
-
borderRadius: "10px",
|
|
410
|
-
boxShadow: "0 10px 40px rgba(0,0,0,0.6)"
|
|
411
|
-
},
|
|
412
|
-
children: /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
|
|
413
|
-
/* @__PURE__ */ jsx(Title, { order: 2, c: "red.5", children: "Dirk UI Crash" }),
|
|
414
|
-
/* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", children: "The interface encountered a fatal error and stopped rendering." }),
|
|
415
|
-
/* @__PURE__ */ jsx(Code, { block: true, style: { maxHeight: 150, overflow: "auto" }, children: this.state.error?.message }),
|
|
416
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "Check console for full stack trace" })
|
|
417
|
-
] })
|
|
418
|
-
}
|
|
419
|
-
)
|
|
420
|
-
}
|
|
421
|
-
);
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
var useAdminToolStore = create((set, get) => ({
|
|
425
|
-
active: null,
|
|
426
|
-
begin: (spec) => new Promise((resolve) => {
|
|
427
|
-
const prev = get().active;
|
|
428
|
-
if (prev) prev.resolve(null);
|
|
429
|
-
set({ active: { ...spec, resolve } });
|
|
430
|
-
}),
|
|
431
|
-
resolveActive: (value) => {
|
|
432
|
-
const cur = get().active;
|
|
433
|
-
if (!cur) return;
|
|
434
|
-
cur.resolve(value);
|
|
435
|
-
set({ active: null });
|
|
436
|
-
},
|
|
437
|
-
cancelActive: () => {
|
|
438
|
-
const cur = get().active;
|
|
439
|
-
if (!cur) return;
|
|
440
|
-
cur.resolve(null);
|
|
441
|
-
set({ active: null });
|
|
442
|
-
}
|
|
443
|
-
}));
|
|
444
|
-
|
|
445
|
-
// src/components/AdminTools/AdminOverlays.tsx
|
|
446
|
-
var listenerInstalled = false;
|
|
447
|
-
function installNuiListener() {
|
|
448
|
-
if (listenerInstalled || typeof window === "undefined") return;
|
|
449
|
-
listenerInstalled = true;
|
|
450
|
-
window.addEventListener("message", (e) => {
|
|
451
|
-
const msg = e?.data;
|
|
452
|
-
if (!msg || typeof msg !== "object" || typeof msg.action !== "string") return;
|
|
453
|
-
const action = msg.action;
|
|
454
|
-
const cur = useAdminToolStore.getState().active;
|
|
455
|
-
if (!cur) return;
|
|
456
|
-
if (action === `${cur.id}_RESULT`) {
|
|
457
|
-
useAdminToolStore.getState().resolveActive(msg.data ?? null);
|
|
458
|
-
} else if (action === `${cur.id}_CANCELLED`) {
|
|
459
|
-
useAdminToolStore.getState().cancelActive();
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
var BODY_HIDE_STYLE_ID = "dirk-instruction-panel-style";
|
|
464
|
-
var BODY_HIDE_ATTR = "data-dirk-instruction-active";
|
|
465
|
-
var OVERLAY_ATTR = "data-dirk-instruction-overlay";
|
|
466
|
-
function ensureBodyHideStyle() {
|
|
467
|
-
if (typeof document === "undefined") return;
|
|
468
|
-
if (document.getElementById(BODY_HIDE_STYLE_ID)) return;
|
|
469
|
-
const el = document.createElement("style");
|
|
470
|
-
el.id = BODY_HIDE_STYLE_ID;
|
|
471
|
-
el.textContent = `
|
|
472
|
-
body[${BODY_HIDE_ATTR}] > *:not([${OVERLAY_ATTR}]) {
|
|
473
|
-
visibility: hidden !important;
|
|
474
|
-
opacity: 0 !important;
|
|
475
|
-
pointer-events: none !important;
|
|
476
|
-
}
|
|
477
|
-
`;
|
|
478
|
-
document.head.appendChild(el);
|
|
479
|
-
}
|
|
480
|
-
function AdminOverlays() {
|
|
481
|
-
const active = useAdminToolStore((s) => s.active);
|
|
482
|
-
useEffect(() => {
|
|
483
|
-
installNuiListener();
|
|
484
|
-
}, []);
|
|
485
|
-
useEffect(() => {
|
|
486
|
-
if (!active || typeof document === "undefined") return;
|
|
487
|
-
ensureBodyHideStyle();
|
|
488
|
-
document.body.setAttribute(BODY_HIDE_ATTR, "");
|
|
489
|
-
return () => {
|
|
490
|
-
document.body.removeAttribute(BODY_HIDE_ATTR);
|
|
491
|
-
};
|
|
492
|
-
}, [active]);
|
|
493
|
-
return null;
|
|
494
|
-
}
|
|
495
|
-
library.add(fas, far, fab);
|
|
496
|
-
var dirkQueryClient = new QueryClient({
|
|
497
|
-
defaultOptions: { queries: { staleTime: 3e4, gcTime: 5 * 6e4 } }
|
|
498
|
-
});
|
|
499
|
-
function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
500
|
-
const {
|
|
501
|
-
primaryColor,
|
|
502
|
-
primaryShade,
|
|
503
|
-
customTheme,
|
|
504
|
-
game
|
|
505
|
-
} = useSettings();
|
|
506
|
-
localeStore((s) => s.locales);
|
|
507
|
-
const [scTheme, setScTheme] = useState(null);
|
|
508
|
-
useLayoutEffect(() => {
|
|
509
|
-
useSettings.setState({
|
|
510
|
-
overideResourceName
|
|
511
|
-
});
|
|
512
|
-
}, [overideResourceName]);
|
|
513
|
-
useEffect(() => {
|
|
514
|
-
fetchNui("NUI_READY").catch(() => {
|
|
515
|
-
});
|
|
516
|
-
Promise.all([
|
|
517
|
-
fetchNui("GET_SETTINGS"),
|
|
518
|
-
fetchNui("GET_RESOURCE_VERSION", void 0, { version: "dev" })
|
|
519
|
-
]).then(([data, resourceInfo]) => {
|
|
520
|
-
useSettings.setState({
|
|
521
|
-
...data,
|
|
522
|
-
resourceVersion: resourceInfo?.version || "dev"
|
|
523
|
-
});
|
|
524
|
-
}).catch((err) => {
|
|
525
|
-
console.error("Failed to fetch initial settings within dirk-cfx-react:", err);
|
|
526
|
-
});
|
|
527
|
-
}, []);
|
|
528
|
-
useNuiEvent("UPDATE_DIRK_LIB_SETTINGS", (data) => {
|
|
529
|
-
if (!data || typeof data !== "object") return;
|
|
530
|
-
useSettings.setState(data);
|
|
531
|
-
});
|
|
532
|
-
useNuiEvent(
|
|
533
|
-
"UPDATE_SCRIPT_CONFIG",
|
|
534
|
-
(data) => {
|
|
535
|
-
if (!data || !data.config || typeof data.config !== "object") return;
|
|
536
|
-
try {
|
|
537
|
-
const inst = getScriptConfigInstance();
|
|
538
|
-
inst.store.setState((prev) => ({ ...prev, ...data.config }));
|
|
539
|
-
} catch {
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
);
|
|
543
|
-
useEffect(() => {
|
|
544
|
-
let unsubscribe;
|
|
545
|
-
try {
|
|
546
|
-
const inst = getScriptConfigInstance();
|
|
547
|
-
setScTheme(inst.store.getState()?.theme ?? null);
|
|
548
|
-
const subscribable = inst.store;
|
|
549
|
-
if (typeof subscribable.subscribe === "function") {
|
|
550
|
-
unsubscribe = subscribable.subscribe((s) => {
|
|
551
|
-
setScTheme(s?.theme ?? null);
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
inst.fetchConfig?.().then((full) => {
|
|
555
|
-
if (full && typeof full === "object") {
|
|
556
|
-
setScTheme(full.theme ?? null);
|
|
557
|
-
}
|
|
558
|
-
}).catch(() => {
|
|
559
|
-
});
|
|
560
|
-
} catch {
|
|
561
|
-
}
|
|
562
|
-
return () => {
|
|
563
|
-
unsubscribe?.();
|
|
564
|
-
};
|
|
565
|
-
}, []);
|
|
566
|
-
const overrideActive = scTheme?.useOverride === true;
|
|
567
|
-
const effectivePrimaryColor = overrideActive ? scTheme.primaryColor ?? primaryColor : primaryColor;
|
|
568
|
-
const effectivePrimaryShade = overrideActive ? scTheme.primaryShade ?? primaryShade : primaryShade;
|
|
569
|
-
const effectiveCustomTheme = overrideActive ? scTheme.customTheme ?? customTheme : customTheme;
|
|
570
|
-
const mergedTheme = useMemo(
|
|
571
|
-
() => mergeMantineThemeSafe(
|
|
572
|
-
{ ...theme_default, primaryColor: effectivePrimaryColor, primaryShade: effectivePrimaryShade },
|
|
573
|
-
effectiveCustomTheme,
|
|
574
|
-
themeOverride
|
|
575
|
-
),
|
|
576
|
-
[effectivePrimaryColor, effectivePrimaryShade, effectiveCustomTheme, themeOverride]
|
|
577
|
-
);
|
|
578
|
-
useEffect(() => {
|
|
579
|
-
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : '"Akrobat Regular", sans-serif';
|
|
580
|
-
}, [game]);
|
|
581
|
-
const content = isEnvBrowser() ? /* @__PURE__ */ jsx(
|
|
582
|
-
BackgroundImage,
|
|
583
|
-
{
|
|
584
|
-
w: "100vw",
|
|
585
|
-
h: "100vh",
|
|
586
|
-
src: game === "fivem" ? "https://i.ytimg.com/vi/TOxuNbXrO28/maxresdefault.jpg" : "https://raw.githubusercontent.com/Jump-On-Studios/RedM-jo_libs/refs/heads/main/source-repositories/Menu/public/assets/images/background_dev.jpg",
|
|
587
|
-
children
|
|
588
|
-
}
|
|
589
|
-
) : children;
|
|
590
|
-
return /* @__PURE__ */ jsx(QueryClientProvider, { client: dirkQueryClient, children: /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsxs(DirkErrorBoundary, { children: [
|
|
591
|
-
content,
|
|
592
|
-
/* @__PURE__ */ jsx(AdminOverlays, {})
|
|
593
|
-
] }) }) });
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
export { DirkProvider, dirkQueryClient };
|
|
1
|
+
import '../chunk-GKSP5RIA.js';
|
|
2
|
+
export { DirkProvider, dirkQueryClient } from '../chunk-NVMOGS7Y.js';
|
|
3
|
+
import '../chunk-Z7N5AQJW.js';
|
|
4
|
+
import '../chunk-MYNNCLMA.js';
|
|
5
|
+
import '../chunk-V6TY7KAL.js';
|
|
597
6
|
//# sourceMappingURL=index.js.map
|
|
598
7
|
//# sourceMappingURL=index.js.map
|