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.cjs CHANGED
@@ -1423,11 +1423,35 @@ function reportMissingLocale(key) {
1423
1423
  fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
1424
1424
  });
1425
1425
  }
1426
+ var PACKAGE_DEFAULTS = {
1427
+ "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.",
1428
+ "cfgpanel_discard": "Discard",
1429
+ "cfgpanel_manual_edit": "Manual Edit",
1430
+ "cfgpanel_reset_defaults": "Reset Defaults",
1431
+ "cfgpanel_version": "Version",
1432
+ "cfgpanel_back_title": "Back to script list",
1433
+ "cfgpanel_undo": "Undo",
1434
+ "cfgpanel_redo": "Redo",
1435
+ "cfgpanel_save": "Save",
1436
+ "cfgpanel_saving": "Saving...",
1437
+ "cfgpanel_history": "History",
1438
+ "cfgpanel_reset_title": "Reset to Defaults",
1439
+ "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.",
1440
+ "cfgpanel_reset_confirm": "Reset Config",
1441
+ "cfgpanel_discard_title": "Discard Unsaved Changes?",
1442
+ "cfgpanel_discard_desc_back": "You have unsaved changes. Going back now will discard them.",
1443
+ "cfgpanel_discard_desc_close": "You have unsaved changes. Closing now will discard them.",
1444
+ "cfgpanel_discard_confirm_back": "Go Back Without Saving",
1445
+ "cfgpanel_discard_confirm_close": "Close Without Saving",
1446
+ "cfgpanel_json_title": "Config JSON",
1447
+ "cfgpanel_cancel": "Cancel",
1448
+ "cfgpanel_apply": "Apply",
1449
+ "cfgpanel_history_title": "Config History",
1450
+ "cfgpanel_close": "Close"
1451
+ };
1426
1452
  var localeStore = zustand.create((set, get) => {
1427
1453
  return {
1428
- locales: {
1429
- "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."
1430
- },
1454
+ locales: { ...PACKAGE_DEFAULTS },
1431
1455
  locale: (key, ...args) => {
1432
1456
  const exists = get().locales[key];
1433
1457
  if (!exists) reportMissingLocale(key);
@@ -1441,7 +1465,7 @@ var localeStore = zustand.create((set, get) => {
1441
1465
  });
1442
1466
  var locale = localeStore.getState().locale;
1443
1467
  registerInitialFetch("GET_LOCALES", void 0).then((data) => {
1444
- localeStore.setState({ locales: data });
1468
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...data } });
1445
1469
  }).catch(() => {
1446
1470
  });
1447
1471
  if (typeof window !== "undefined") {
@@ -1450,7 +1474,7 @@ if (typeof window !== "undefined") {
1450
1474
  if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
1451
1475
  if (!msg.data || typeof msg.data !== "object") return;
1452
1476
  if (Object.keys(msg.data).length === 0) return;
1453
- localeStore.setState({ locales: msg.data });
1477
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...msg.data } });
1454
1478
  });
1455
1479
  }
1456
1480
 
@@ -5021,7 +5045,7 @@ function ConfigJsonModal({
5021
5045
  setError(e.message);
5022
5046
  }
5023
5047
  };
5024
- return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { title: "Config JSON", icon: lucideReact.Code2, iconColor: color, onClose, width: "60vh", maxHeight: "80vh", zIndex: 200, children: [
5048
+ return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { title: locale("cfgpanel_json_title"), icon: lucideReact.Code2, iconColor: color, onClose, width: "60vh", maxHeight: "80vh", zIndex: 200, children: [
5025
5049
  /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { flex: 1, p: "0.8vh", style: { overflowY: "auto" }, children: [
5026
5050
  /* @__PURE__ */ jsxRuntime.jsx(
5027
5051
  core.JsonInput,
@@ -5049,7 +5073,7 @@ function ConfigJsonModal({
5049
5073
  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 },
5050
5074
  children: [
5051
5075
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { color: "rgba(255,255,255,0.4)" }),
5052
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: "Cancel" })
5076
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: locale("cfgpanel_cancel") })
5053
5077
  ]
5054
5078
  }
5055
5079
  ),
@@ -5062,7 +5086,7 @@ function ConfigJsonModal({
5062
5086
  style: { background: core.alpha(color, 0.14), border: `0.1vh solid ${core.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 },
5063
5087
  children: [
5064
5088
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { color }),
5065
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: color, children: "Apply" })
5089
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: color, children: locale("cfgpanel_apply") })
5066
5090
  ]
5067
5091
  }
5068
5092
  )
@@ -5203,7 +5227,7 @@ function ConfigHistoryModal({
5203
5227
  historyQuery.fetchNextPage();
5204
5228
  }
5205
5229
  };
5206
- return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { title: "Config History", icon: lucideReact.History, iconColor: color, onClose, width: "88vh", maxHeight: "82vh", zIndex: 260, children: [
5230
+ return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { title: locale("cfgpanel_history_title"), icon: lucideReact.History, iconColor: color, onClose, width: "88vh", maxHeight: "82vh", zIndex: 260, children: [
5207
5231
  /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", style: { flex: 1, minHeight: 0 }, children: [
5208
5232
  /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { gap: "xs", p: "sm", style: { borderBottom: `0.1vh solid ${core.alpha(theme2.colors.dark[7], 0.8)}` }, children: [
5209
5233
  /* @__PURE__ */ jsxRuntime.jsx(core.TextInput, { leftSection: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { size: "1.4vh" }), placeholder: "Search path/admin/value", value: queryInput, onChange: (e) => setQueryInput(e.currentTarget.value), size: "xs", style: { flex: 1 } }),
@@ -5246,7 +5270,7 @@ function ConfigHistoryModal({
5246
5270
  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 },
5247
5271
  children: [
5248
5272
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { color: "rgba(255,255,255,0.4)", size: "1.5vh" }),
5249
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: "Close" })
5273
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: locale("cfgpanel_close") })
5250
5274
  ]
5251
5275
  }
5252
5276
  ) })
@@ -5306,9 +5330,9 @@ function ConfigPanelInner({
5306
5330
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: resetOpen && /* @__PURE__ */ jsxRuntime.jsx(
5307
5331
  ConfirmModal,
5308
5332
  {
5309
- title: "Reset to Defaults",
5310
- description: "This will permanently reset ALL config back to the defaults. Every value you have configured will be overwritten. This cannot be undone.",
5311
- confirmLabel: "Reset Config",
5333
+ title: locale("cfgpanel_reset_title"),
5334
+ description: locale("cfgpanel_reset_desc"),
5335
+ confirmLabel: locale("cfgpanel_reset_confirm"),
5312
5336
  confirmText: resetConfirmText,
5313
5337
  onConfirm: async () => {
5314
5338
  setResetOpen(false);
@@ -5340,9 +5364,9 @@ function ConfigPanelInner({
5340
5364
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: pendingAction !== null && /* @__PURE__ */ jsxRuntime.jsx(
5341
5365
  ConfirmModal,
5342
5366
  {
5343
- title: "Discard Unsaved Changes?",
5344
- description: pendingAction === "back" ? "You have unsaved changes. Going back now will discard them." : "You have unsaved changes. Closing now will discard them.",
5345
- confirmLabel: pendingAction === "back" ? "Go Back Without Saving" : "Close Without Saving",
5367
+ title: locale("cfgpanel_discard_title"),
5368
+ description: pendingAction === "back" ? locale("cfgpanel_discard_desc_back") : locale("cfgpanel_discard_desc_close"),
5369
+ confirmLabel: pendingAction === "back" ? locale("cfgpanel_discard_confirm_back") : locale("cfgpanel_discard_confirm_close"),
5346
5370
  onConfirm: () => {
5347
5371
  const action = pendingAction;
5348
5372
  setPendingAction(null);
@@ -5380,7 +5404,7 @@ function ConfigPanelInner({
5380
5404
  /* @__PURE__ */ jsxRuntime.jsx(
5381
5405
  framerMotion.motion.button,
5382
5406
  {
5383
- title: "Back to script list",
5407
+ title: locale("cfgpanel_back_title"),
5384
5408
  onClick: handleBack,
5385
5409
  whileHover: { background: core.alpha(color, 0.16), borderColor: core.alpha(color, 0.45) },
5386
5410
  whileTap: { scale: 0.95 },
@@ -5408,7 +5432,7 @@ function ConfigPanelInner({
5408
5432
  /* @__PURE__ */ jsxRuntime.jsx(
5409
5433
  framerMotion.motion.button,
5410
5434
  {
5411
- title: "Undo",
5435
+ title: locale("cfgpanel_undo"),
5412
5436
  onClick: () => form.canBack && form.back(),
5413
5437
  disabled: !form.canBack,
5414
5438
  whileHover: form.canBack ? { background: "rgba(255,255,255,0.07)" } : void 0,
@@ -5420,7 +5444,7 @@ function ConfigPanelInner({
5420
5444
  /* @__PURE__ */ jsxRuntime.jsx(
5421
5445
  framerMotion.motion.button,
5422
5446
  {
5423
- title: "Redo",
5447
+ title: locale("cfgpanel_redo"),
5424
5448
  onClick: () => form.canForward && form.forward(),
5425
5449
  disabled: !form.canForward,
5426
5450
  whileHover: form.canForward ? { background: "rgba(255,255,255,0.07)" } : void 0,
@@ -5432,7 +5456,7 @@ function ConfigPanelInner({
5432
5456
  /* @__PURE__ */ jsxRuntime.jsx(
5433
5457
  framerMotion.motion.button,
5434
5458
  {
5435
- title: isSaving ? "Saving..." : isDirty ? `Save (${changedCount})` : "Save",
5459
+ title: isSaving ? locale("cfgpanel_saving") : isDirty ? `${locale("cfgpanel_save")} (${changedCount})` : locale("cfgpanel_save"),
5436
5460
  onClick: () => isDirty && !isSaving && form.submit(),
5437
5461
  disabled: !isDirty || isSaving,
5438
5462
  whileHover: isDirty && !isSaving ? { background: core.alpha(color, 0.25), borderColor: core.alpha(color, 0.5) } : void 0,
@@ -5444,7 +5468,7 @@ function ConfigPanelInner({
5444
5468
  /* @__PURE__ */ jsxRuntime.jsx(
5445
5469
  framerMotion.motion.button,
5446
5470
  {
5447
- title: "History",
5471
+ title: locale("cfgpanel_history"),
5448
5472
  onClick: () => setHistoryOpen(true),
5449
5473
  whileHover: { background: core.alpha("#22d3ee", 0.16), borderColor: core.alpha("#22d3ee", 0.5) },
5450
5474
  whileTap: { scale: 0.97 },
@@ -5465,7 +5489,7 @@ function ConfigPanelInner({
5465
5489
  style: { width: "100%", background: "transparent", border: `0.1vh solid ${isDirty ? core.alpha("#f97316", 0.35) : core.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" },
5466
5490
  children: [
5467
5491
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { color: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", size: "1.6vh" }),
5468
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", children: "Discard" })
5492
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", children: locale("cfgpanel_discard") })
5469
5493
  ]
5470
5494
  }
5471
5495
  ),
@@ -5479,7 +5503,7 @@ function ConfigPanelInner({
5479
5503
  style: { width: "100%", background: core.alpha(color, 0.07), border: `0.1vh solid ${core.alpha(color, 0.28)}`, borderRadius: theme2.radius.xs, padding: "0.65vh 0.8vh", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.55vh" },
5480
5504
  children: [
5481
5505
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code2, { color, size: "1.6vh" }),
5482
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: "Manual Edit" })
5506
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: locale("cfgpanel_manual_edit") })
5483
5507
  ]
5484
5508
  }
5485
5509
  ),
@@ -5492,12 +5516,13 @@ function ConfigPanelInner({
5492
5516
  style: { width: "100%", background: core.alpha("#ef4444", 0.07), border: `0.1vh solid ${core.alpha("#ef4444", 0.25)}`, borderRadius: theme2.radius.xs, padding: "0.65vh 0.8vh", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.55vh" },
5493
5517
  children: [
5494
5518
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { color: "#ef4444", size: "1.6vh" }),
5495
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: "#ef4444", children: "Reset Defaults" })
5519
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: "#ef4444", children: locale("cfgpanel_reset_defaults") })
5496
5520
  ]
5497
5521
  }
5498
5522
  ),
5499
5523
  version && /* @__PURE__ */ jsxRuntime.jsxs(core.Text, { size: "0.95vh", c: "dimmed", ta: "center", style: { letterSpacing: "0.04em", opacity: 0.8 }, children: [
5500
- "Version ",
5524
+ locale("cfgpanel_version"),
5525
+ " ",
5501
5526
  version
5502
5527
  ] })
5503
5528
  ] })