dirk-cfx-react 1.1.89 → 1.1.90

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/index.js CHANGED
@@ -1414,11 +1414,35 @@ function reportMissingLocale(key) {
1414
1414
  fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
1415
1415
  });
1416
1416
  }
1417
+ var PACKAGE_DEFAULTS = {
1418
+ "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.",
1419
+ "cfgpanel_discard": "Discard",
1420
+ "cfgpanel_manual_edit": "Manual Edit",
1421
+ "cfgpanel_reset_defaults": "Reset Defaults",
1422
+ "cfgpanel_version": "Version",
1423
+ "cfgpanel_back_title": "Back to script list",
1424
+ "cfgpanel_undo": "Undo",
1425
+ "cfgpanel_redo": "Redo",
1426
+ "cfgpanel_save": "Save",
1427
+ "cfgpanel_saving": "Saving...",
1428
+ "cfgpanel_history": "History",
1429
+ "cfgpanel_reset_title": "Reset to Defaults",
1430
+ "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.",
1431
+ "cfgpanel_reset_confirm": "Reset Config",
1432
+ "cfgpanel_discard_title": "Discard Unsaved Changes?",
1433
+ "cfgpanel_discard_desc_back": "You have unsaved changes. Going back now will discard them.",
1434
+ "cfgpanel_discard_desc_close": "You have unsaved changes. Closing now will discard them.",
1435
+ "cfgpanel_discard_confirm_back": "Go Back Without Saving",
1436
+ "cfgpanel_discard_confirm_close": "Close Without Saving",
1437
+ "cfgpanel_json_title": "Config JSON",
1438
+ "cfgpanel_cancel": "Cancel",
1439
+ "cfgpanel_apply": "Apply",
1440
+ "cfgpanel_history_title": "Config History",
1441
+ "cfgpanel_close": "Close"
1442
+ };
1417
1443
  var localeStore = create((set, get) => {
1418
1444
  return {
1419
- locales: {
1420
- "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."
1421
- },
1445
+ locales: { ...PACKAGE_DEFAULTS },
1422
1446
  locale: (key, ...args) => {
1423
1447
  const exists = get().locales[key];
1424
1448
  if (!exists) reportMissingLocale(key);
@@ -1432,7 +1456,7 @@ var localeStore = create((set, get) => {
1432
1456
  });
1433
1457
  var locale = localeStore.getState().locale;
1434
1458
  registerInitialFetch("GET_LOCALES", void 0).then((data) => {
1435
- localeStore.setState({ locales: data });
1459
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...data } });
1436
1460
  }).catch(() => {
1437
1461
  });
1438
1462
  if (typeof window !== "undefined") {
@@ -1441,7 +1465,7 @@ if (typeof window !== "undefined") {
1441
1465
  if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
1442
1466
  if (!msg.data || typeof msg.data !== "object") return;
1443
1467
  if (Object.keys(msg.data).length === 0) return;
1444
- localeStore.setState({ locales: msg.data });
1468
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...msg.data } });
1445
1469
  });
1446
1470
  }
1447
1471
 
@@ -5012,7 +5036,7 @@ function ConfigJsonModal({
5012
5036
  setError(e.message);
5013
5037
  }
5014
5038
  };
5015
- return /* @__PURE__ */ jsxs(Modal, { title: "Config JSON", icon: Code2, iconColor: color, onClose, width: "60vh", maxHeight: "80vh", zIndex: 200, children: [
5039
+ return /* @__PURE__ */ jsxs(Modal, { title: locale("cfgpanel_json_title"), icon: Code2, iconColor: color, onClose, width: "60vh", maxHeight: "80vh", zIndex: 200, children: [
5016
5040
  /* @__PURE__ */ jsxs(Box, { flex: 1, p: "0.8vh", style: { overflowY: "auto" }, children: [
5017
5041
  /* @__PURE__ */ jsx(
5018
5042
  JsonInput,
@@ -5040,7 +5064,7 @@ function ConfigJsonModal({
5040
5064
  style: { background: "transparent", border: `0.1vh solid ${theme2.colors.dark[6]}`, borderRadius: theme2.radius.xs, padding: `${theme2.spacing.xxs} ${theme2.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme2.spacing.xxs },
5041
5065
  children: [
5042
5066
  /* @__PURE__ */ jsx(X, { color: "rgba(255,255,255,0.4)" }),
5043
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: "Cancel" })
5067
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: locale("cfgpanel_cancel") })
5044
5068
  ]
5045
5069
  }
5046
5070
  ),
@@ -5053,7 +5077,7 @@ function ConfigJsonModal({
5053
5077
  style: { background: alpha(color, 0.14), border: `0.1vh solid ${alpha(color, 0.4)}`, borderRadius: theme2.radius.xs, padding: `${theme2.spacing.xxs} ${theme2.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme2.spacing.xxs },
5054
5078
  children: [
5055
5079
  /* @__PURE__ */ jsx(Check, { color }),
5056
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: color, children: "Apply" })
5080
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: color, children: locale("cfgpanel_apply") })
5057
5081
  ]
5058
5082
  }
5059
5083
  )
@@ -5194,7 +5218,7 @@ function ConfigHistoryModal({
5194
5218
  historyQuery.fetchNextPage();
5195
5219
  }
5196
5220
  };
5197
- return /* @__PURE__ */ jsxs(Modal, { title: "Config History", icon: History, iconColor: color, onClose, width: "88vh", maxHeight: "82vh", zIndex: 260, children: [
5221
+ return /* @__PURE__ */ jsxs(Modal, { title: locale("cfgpanel_history_title"), icon: History, iconColor: color, onClose, width: "88vh", maxHeight: "82vh", zIndex: 260, children: [
5198
5222
  /* @__PURE__ */ jsxs(Flex, { direction: "column", style: { flex: 1, minHeight: 0 }, children: [
5199
5223
  /* @__PURE__ */ jsxs(Flex, { gap: "xs", p: "sm", style: { borderBottom: `0.1vh solid ${alpha(theme2.colors.dark[7], 0.8)}` }, children: [
5200
5224
  /* @__PURE__ */ jsx(TextInput, { leftSection: /* @__PURE__ */ jsx(Search, { size: "1.4vh" }), placeholder: "Search path/admin/value", value: queryInput, onChange: (e) => setQueryInput(e.currentTarget.value), size: "xs", style: { flex: 1 } }),
@@ -5237,7 +5261,7 @@ function ConfigHistoryModal({
5237
5261
  style: { background: "transparent", border: `0.1vh solid ${theme2.colors.dark[6]}`, borderRadius: theme2.radius.xs, padding: `${theme2.spacing.xxs} ${theme2.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme2.spacing.xxs },
5238
5262
  children: [
5239
5263
  /* @__PURE__ */ jsx(X, { color: "rgba(255,255,255,0.4)", size: "1.5vh" }),
5240
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: "Close" })
5264
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: locale("cfgpanel_close") })
5241
5265
  ]
5242
5266
  }
5243
5267
  ) })
@@ -5297,9 +5321,9 @@ function ConfigPanelInner({
5297
5321
  /* @__PURE__ */ jsx(AnimatePresence, { children: resetOpen && /* @__PURE__ */ jsx(
5298
5322
  ConfirmModal,
5299
5323
  {
5300
- title: "Reset to Defaults",
5301
- description: "This will permanently reset ALL config back to the defaults. Every value you have configured will be overwritten. This cannot be undone.",
5302
- confirmLabel: "Reset Config",
5324
+ title: locale("cfgpanel_reset_title"),
5325
+ description: locale("cfgpanel_reset_desc"),
5326
+ confirmLabel: locale("cfgpanel_reset_confirm"),
5303
5327
  confirmText: resetConfirmText,
5304
5328
  onConfirm: async () => {
5305
5329
  setResetOpen(false);
@@ -5331,9 +5355,9 @@ function ConfigPanelInner({
5331
5355
  /* @__PURE__ */ jsx(AnimatePresence, { children: pendingAction !== null && /* @__PURE__ */ jsx(
5332
5356
  ConfirmModal,
5333
5357
  {
5334
- title: "Discard Unsaved Changes?",
5335
- description: pendingAction === "back" ? "You have unsaved changes. Going back now will discard them." : "You have unsaved changes. Closing now will discard them.",
5336
- confirmLabel: pendingAction === "back" ? "Go Back Without Saving" : "Close Without Saving",
5358
+ title: locale("cfgpanel_discard_title"),
5359
+ description: pendingAction === "back" ? locale("cfgpanel_discard_desc_back") : locale("cfgpanel_discard_desc_close"),
5360
+ confirmLabel: pendingAction === "back" ? locale("cfgpanel_discard_confirm_back") : locale("cfgpanel_discard_confirm_close"),
5337
5361
  onConfirm: () => {
5338
5362
  const action = pendingAction;
5339
5363
  setPendingAction(null);
@@ -5371,7 +5395,7 @@ function ConfigPanelInner({
5371
5395
  /* @__PURE__ */ jsx(
5372
5396
  motion.button,
5373
5397
  {
5374
- title: "Back to script list",
5398
+ title: locale("cfgpanel_back_title"),
5375
5399
  onClick: handleBack,
5376
5400
  whileHover: { background: alpha(color, 0.16), borderColor: alpha(color, 0.45) },
5377
5401
  whileTap: { scale: 0.95 },
@@ -5399,7 +5423,7 @@ function ConfigPanelInner({
5399
5423
  /* @__PURE__ */ jsx(
5400
5424
  motion.button,
5401
5425
  {
5402
- title: "Undo",
5426
+ title: locale("cfgpanel_undo"),
5403
5427
  onClick: () => form.canBack && form.back(),
5404
5428
  disabled: !form.canBack,
5405
5429
  whileHover: form.canBack ? { background: "rgba(255,255,255,0.07)" } : void 0,
@@ -5411,7 +5435,7 @@ function ConfigPanelInner({
5411
5435
  /* @__PURE__ */ jsx(
5412
5436
  motion.button,
5413
5437
  {
5414
- title: "Redo",
5438
+ title: locale("cfgpanel_redo"),
5415
5439
  onClick: () => form.canForward && form.forward(),
5416
5440
  disabled: !form.canForward,
5417
5441
  whileHover: form.canForward ? { background: "rgba(255,255,255,0.07)" } : void 0,
@@ -5423,7 +5447,7 @@ function ConfigPanelInner({
5423
5447
  /* @__PURE__ */ jsx(
5424
5448
  motion.button,
5425
5449
  {
5426
- title: isSaving ? "Saving..." : isDirty ? `Save (${changedCount})` : "Save",
5450
+ title: isSaving ? locale("cfgpanel_saving") : isDirty ? `${locale("cfgpanel_save")} (${changedCount})` : locale("cfgpanel_save"),
5427
5451
  onClick: () => isDirty && !isSaving && form.submit(),
5428
5452
  disabled: !isDirty || isSaving,
5429
5453
  whileHover: isDirty && !isSaving ? { background: alpha(color, 0.25), borderColor: alpha(color, 0.5) } : void 0,
@@ -5435,7 +5459,7 @@ function ConfigPanelInner({
5435
5459
  /* @__PURE__ */ jsx(
5436
5460
  motion.button,
5437
5461
  {
5438
- title: "History",
5462
+ title: locale("cfgpanel_history"),
5439
5463
  onClick: () => setHistoryOpen(true),
5440
5464
  whileHover: { background: alpha("#22d3ee", 0.16), borderColor: alpha("#22d3ee", 0.5) },
5441
5465
  whileTap: { scale: 0.97 },
@@ -5456,7 +5480,7 @@ function ConfigPanelInner({
5456
5480
  style: { width: "100%", background: "transparent", border: `0.1vh solid ${isDirty ? alpha("#f97316", 0.35) : alpha(theme2.colors.dark[5], 0.3)}`, borderRadius: theme2.radius.xs, padding: "0.65vh 0.8vh", cursor: isDirty ? "pointer" : "default", display: "flex", alignItems: "center", gap: "0.55vh", opacity: isDirty ? 1 : 0.35, transition: "opacity 0.2s" },
5457
5481
  children: [
5458
5482
  /* @__PURE__ */ jsx(XCircle, { color: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", size: "1.6vh" }),
5459
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", children: "Discard" })
5483
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", children: locale("cfgpanel_discard") })
5460
5484
  ]
5461
5485
  }
5462
5486
  ),
@@ -5470,7 +5494,7 @@ function ConfigPanelInner({
5470
5494
  style: { width: "100%", background: alpha(color, 0.07), border: `0.1vh solid ${alpha(color, 0.28)}`, borderRadius: theme2.radius.xs, padding: "0.65vh 0.8vh", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.55vh" },
5471
5495
  children: [
5472
5496
  /* @__PURE__ */ jsx(Code2, { color, size: "1.6vh" }),
5473
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: "Manual Edit" })
5497
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: locale("cfgpanel_manual_edit") })
5474
5498
  ]
5475
5499
  }
5476
5500
  ),
@@ -5483,12 +5507,13 @@ function ConfigPanelInner({
5483
5507
  style: { width: "100%", background: alpha("#ef4444", 0.07), border: `0.1vh solid ${alpha("#ef4444", 0.25)}`, borderRadius: theme2.radius.xs, padding: "0.65vh 0.8vh", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.55vh" },
5484
5508
  children: [
5485
5509
  /* @__PURE__ */ jsx(RotateCcw, { color: "#ef4444", size: "1.6vh" }),
5486
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: "#ef4444", children: "Reset Defaults" })
5510
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: "#ef4444", children: locale("cfgpanel_reset_defaults") })
5487
5511
  ]
5488
5512
  }
5489
5513
  ),
5490
5514
  version && /* @__PURE__ */ jsxs(Text, { size: "0.95vh", c: "dimmed", ta: "center", style: { letterSpacing: "0.04em", opacity: 0.8 }, children: [
5491
- "Version ",
5515
+ locale("cfgpanel_version"),
5516
+ " ",
5492
5517
  version
5493
5518
  ] })
5494
5519
  ] })