dirk-cfx-react 1.1.89 → 1.1.91
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 +499 -247
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +39 -9
- package/dist/components/index.d.ts +39 -9
- package/dist/components/index.js +500 -249
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +22 -12
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +22 -12
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +502 -248
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -2
- package/dist/index.d.ts +43 -2
- package/dist/index.js +500 -250
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +51 -17
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +51 -17
- package/dist/providers/index.js.map +1 -1
- package/dist/utils/index.cjs +51 -17
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +51 -17
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo } from 'react';
|
|
2
2
|
import { create } from 'zustand';
|
|
3
|
+
import { z } from 'zod';
|
|
3
4
|
import axios from 'axios';
|
|
4
5
|
|
|
5
6
|
// src/utils/colorWithAlpha.ts
|
|
@@ -198,6 +199,26 @@ var openLink = (url) => {
|
|
|
198
199
|
window.invokeNative("openLink", url);
|
|
199
200
|
}
|
|
200
201
|
};
|
|
202
|
+
var DEFAULT_PALETTE = [
|
|
203
|
+
"#f0f4ff",
|
|
204
|
+
"#d9e3ff",
|
|
205
|
+
"#bfcfff",
|
|
206
|
+
"#a6bbff",
|
|
207
|
+
"#8ca7ff",
|
|
208
|
+
"#7393ff",
|
|
209
|
+
"#5a7fff",
|
|
210
|
+
"#406bff",
|
|
211
|
+
"#2547ff",
|
|
212
|
+
"#0b33ff"
|
|
213
|
+
];
|
|
214
|
+
z.object({
|
|
215
|
+
useOverride: z.boolean(),
|
|
216
|
+
primaryColor: z.string(),
|
|
217
|
+
primaryShade: z.number(),
|
|
218
|
+
customTheme: z.array(z.string())
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// src/utils/useSettings.ts
|
|
201
222
|
var useSettings = create(() => ({
|
|
202
223
|
currency: "$",
|
|
203
224
|
game: "fivem",
|
|
@@ -205,18 +226,7 @@ var useSettings = create(() => ({
|
|
|
205
226
|
primaryShade: 9,
|
|
206
227
|
itemImgPath: "",
|
|
207
228
|
resourceVersion: "dev",
|
|
208
|
-
customTheme:
|
|
209
|
-
"#f0f4ff",
|
|
210
|
-
"#d9e3ff",
|
|
211
|
-
"#bfcfff",
|
|
212
|
-
"#a6bbff",
|
|
213
|
-
"#8ca7ff",
|
|
214
|
-
"#7393ff",
|
|
215
|
-
"#5a7fff",
|
|
216
|
-
"#406bff",
|
|
217
|
-
"#2547ff",
|
|
218
|
-
"#0b33ff"
|
|
219
|
-
]
|
|
229
|
+
customTheme: DEFAULT_PALETTE
|
|
220
230
|
}));
|
|
221
231
|
|
|
222
232
|
// src/utils/fetchNui.ts
|
|
@@ -300,11 +310,35 @@ function reportMissingLocale(key) {
|
|
|
300
310
|
fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
|
|
301
311
|
});
|
|
302
312
|
}
|
|
313
|
+
var PACKAGE_DEFAULTS = {
|
|
314
|
+
"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.",
|
|
315
|
+
"cfgpanel_discard": "Discard",
|
|
316
|
+
"cfgpanel_manual_edit": "Manual Edit",
|
|
317
|
+
"cfgpanel_reset_defaults": "Reset Defaults",
|
|
318
|
+
"cfgpanel_version": "Version",
|
|
319
|
+
"cfgpanel_back_title": "Back to script list",
|
|
320
|
+
"cfgpanel_undo": "Undo",
|
|
321
|
+
"cfgpanel_redo": "Redo",
|
|
322
|
+
"cfgpanel_save": "Save",
|
|
323
|
+
"cfgpanel_saving": "Saving...",
|
|
324
|
+
"cfgpanel_history": "History",
|
|
325
|
+
"cfgpanel_reset_title": "Reset to Defaults",
|
|
326
|
+
"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.",
|
|
327
|
+
"cfgpanel_reset_confirm": "Reset Config",
|
|
328
|
+
"cfgpanel_discard_title": "Discard Unsaved Changes?",
|
|
329
|
+
"cfgpanel_discard_desc_back": "You have unsaved changes. Going back now will discard them.",
|
|
330
|
+
"cfgpanel_discard_desc_close": "You have unsaved changes. Closing now will discard them.",
|
|
331
|
+
"cfgpanel_discard_confirm_back": "Go Back Without Saving",
|
|
332
|
+
"cfgpanel_discard_confirm_close": "Close Without Saving",
|
|
333
|
+
"cfgpanel_json_title": "Config JSON",
|
|
334
|
+
"cfgpanel_cancel": "Cancel",
|
|
335
|
+
"cfgpanel_apply": "Apply",
|
|
336
|
+
"cfgpanel_history_title": "Config History",
|
|
337
|
+
"cfgpanel_close": "Close"
|
|
338
|
+
};
|
|
303
339
|
var localeStore = create((set, get) => {
|
|
304
340
|
return {
|
|
305
|
-
locales: {
|
|
306
|
-
"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."
|
|
307
|
-
},
|
|
341
|
+
locales: { ...PACKAGE_DEFAULTS },
|
|
308
342
|
locale: (key, ...args) => {
|
|
309
343
|
const exists = get().locales[key];
|
|
310
344
|
if (!exists) reportMissingLocale(key);
|
|
@@ -318,7 +352,7 @@ var localeStore = create((set, get) => {
|
|
|
318
352
|
});
|
|
319
353
|
var locale = localeStore.getState().locale;
|
|
320
354
|
registerInitialFetch("GET_LOCALES", void 0).then((data) => {
|
|
321
|
-
localeStore.setState({ locales: data });
|
|
355
|
+
localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...data } });
|
|
322
356
|
}).catch(() => {
|
|
323
357
|
});
|
|
324
358
|
if (typeof window !== "undefined") {
|
|
@@ -327,7 +361,7 @@ if (typeof window !== "undefined") {
|
|
|
327
361
|
if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
|
|
328
362
|
if (!msg.data || typeof msg.data !== "object") return;
|
|
329
363
|
if (Object.keys(msg.data).length === 0) return;
|
|
330
|
-
localeStore.setState({ locales: msg.data });
|
|
364
|
+
localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...msg.data } });
|
|
331
365
|
});
|
|
332
366
|
}
|
|
333
367
|
|