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.
@@ -1350,11 +1350,35 @@ function reportMissingLocale(key) {
1350
1350
  fetchNui("REPORT_MISSING_LOCALE", { key }).catch(() => {
1351
1351
  });
1352
1352
  }
1353
+ var PACKAGE_DEFAULTS = {
1354
+ "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.",
1355
+ "cfgpanel_discard": "Discard",
1356
+ "cfgpanel_manual_edit": "Manual Edit",
1357
+ "cfgpanel_reset_defaults": "Reset Defaults",
1358
+ "cfgpanel_version": "Version",
1359
+ "cfgpanel_back_title": "Back to script list",
1360
+ "cfgpanel_undo": "Undo",
1361
+ "cfgpanel_redo": "Redo",
1362
+ "cfgpanel_save": "Save",
1363
+ "cfgpanel_saving": "Saving...",
1364
+ "cfgpanel_history": "History",
1365
+ "cfgpanel_reset_title": "Reset to Defaults",
1366
+ "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.",
1367
+ "cfgpanel_reset_confirm": "Reset Config",
1368
+ "cfgpanel_discard_title": "Discard Unsaved Changes?",
1369
+ "cfgpanel_discard_desc_back": "You have unsaved changes. Going back now will discard them.",
1370
+ "cfgpanel_discard_desc_close": "You have unsaved changes. Closing now will discard them.",
1371
+ "cfgpanel_discard_confirm_back": "Go Back Without Saving",
1372
+ "cfgpanel_discard_confirm_close": "Close Without Saving",
1373
+ "cfgpanel_json_title": "Config JSON",
1374
+ "cfgpanel_cancel": "Cancel",
1375
+ "cfgpanel_apply": "Apply",
1376
+ "cfgpanel_history_title": "Config History",
1377
+ "cfgpanel_close": "Close"
1378
+ };
1353
1379
  var localeStore = zustand.create((set, get) => {
1354
1380
  return {
1355
- locales: {
1356
- "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."
1357
- },
1381
+ locales: { ...PACKAGE_DEFAULTS },
1358
1382
  locale: (key, ...args) => {
1359
1383
  const exists = get().locales[key];
1360
1384
  if (!exists) reportMissingLocale(key);
@@ -1368,7 +1392,7 @@ var localeStore = zustand.create((set, get) => {
1368
1392
  });
1369
1393
  var locale = localeStore.getState().locale;
1370
1394
  registerInitialFetch("GET_LOCALES", void 0).then((data) => {
1371
- localeStore.setState({ locales: data });
1395
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...data } });
1372
1396
  }).catch(() => {
1373
1397
  });
1374
1398
  if (typeof window !== "undefined") {
@@ -1377,7 +1401,7 @@ if (typeof window !== "undefined") {
1377
1401
  if (!msg || msg.action !== "UPDATE_DIRK_LIB_LOCALES") return;
1378
1402
  if (!msg.data || typeof msg.data !== "object") return;
1379
1403
  if (Object.keys(msg.data).length === 0) return;
1380
- localeStore.setState({ locales: msg.data });
1404
+ localeStore.setState({ locales: { ...PACKAGE_DEFAULTS, ...msg.data } });
1381
1405
  });
1382
1406
  }
1383
1407
 
@@ -3906,7 +3930,7 @@ function ConfigJsonModal({
3906
3930
  setError(e.message);
3907
3931
  }
3908
3932
  };
3909
- return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { title: "Config JSON", icon: lucideReact.Code2, iconColor: color, onClose, width: "60vh", maxHeight: "80vh", zIndex: 200, children: [
3933
+ return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { title: locale("cfgpanel_json_title"), icon: lucideReact.Code2, iconColor: color, onClose, width: "60vh", maxHeight: "80vh", zIndex: 200, children: [
3910
3934
  /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { flex: 1, p: "0.8vh", style: { overflowY: "auto" }, children: [
3911
3935
  /* @__PURE__ */ jsxRuntime.jsx(
3912
3936
  core.JsonInput,
@@ -3934,7 +3958,7 @@ function ConfigJsonModal({
3934
3958
  style: { background: "transparent", border: `0.1vh solid ${theme.colors.dark[6]}`, borderRadius: theme.radius.xs, padding: `${theme.spacing.xxs} ${theme.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme.spacing.xxs },
3935
3959
  children: [
3936
3960
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { color: "rgba(255,255,255,0.4)" }),
3937
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: "Cancel" })
3961
+ /* @__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") })
3938
3962
  ]
3939
3963
  }
3940
3964
  ),
@@ -3947,7 +3971,7 @@ function ConfigJsonModal({
3947
3971
  style: { background: core.alpha(color, 0.14), border: `0.1vh solid ${core.alpha(color, 0.4)}`, borderRadius: theme.radius.xs, padding: `${theme.spacing.xxs} ${theme.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme.spacing.xxs },
3948
3972
  children: [
3949
3973
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { color }),
3950
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: color, children: "Apply" })
3974
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: color, children: locale("cfgpanel_apply") })
3951
3975
  ]
3952
3976
  }
3953
3977
  )
@@ -4088,7 +4112,7 @@ function ConfigHistoryModal({
4088
4112
  historyQuery.fetchNextPage();
4089
4113
  }
4090
4114
  };
4091
- return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { title: "Config History", icon: lucideReact.History, iconColor: color, onClose, width: "88vh", maxHeight: "82vh", zIndex: 260, children: [
4115
+ return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { title: locale("cfgpanel_history_title"), icon: lucideReact.History, iconColor: color, onClose, width: "88vh", maxHeight: "82vh", zIndex: 260, children: [
4092
4116
  /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", style: { flex: 1, minHeight: 0 }, children: [
4093
4117
  /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { gap: "xs", p: "sm", style: { borderBottom: `0.1vh solid ${core.alpha(theme.colors.dark[7], 0.8)}` }, children: [
4094
4118
  /* @__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 } }),
@@ -4131,7 +4155,7 @@ function ConfigHistoryModal({
4131
4155
  style: { background: "transparent", border: `0.1vh solid ${theme.colors.dark[6]}`, borderRadius: theme.radius.xs, padding: `${theme.spacing.xxs} ${theme.spacing.xs}`, cursor: "pointer", display: "flex", alignItems: "center", gap: theme.spacing.xxs },
4132
4156
  children: [
4133
4157
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { color: "rgba(255,255,255,0.4)", size: "1.5vh" }),
4134
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.4)", children: "Close" })
4158
+ /* @__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") })
4135
4159
  ]
4136
4160
  }
4137
4161
  ) })
@@ -4191,9 +4215,9 @@ function ConfigPanelInner({
4191
4215
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: resetOpen && /* @__PURE__ */ jsxRuntime.jsx(
4192
4216
  ConfirmModal,
4193
4217
  {
4194
- title: "Reset to Defaults",
4195
- description: "This will permanently reset ALL config back to the defaults. Every value you have configured will be overwritten. This cannot be undone.",
4196
- confirmLabel: "Reset Config",
4218
+ title: locale("cfgpanel_reset_title"),
4219
+ description: locale("cfgpanel_reset_desc"),
4220
+ confirmLabel: locale("cfgpanel_reset_confirm"),
4197
4221
  confirmText: resetConfirmText,
4198
4222
  onConfirm: async () => {
4199
4223
  setResetOpen(false);
@@ -4225,9 +4249,9 @@ function ConfigPanelInner({
4225
4249
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: pendingAction !== null && /* @__PURE__ */ jsxRuntime.jsx(
4226
4250
  ConfirmModal,
4227
4251
  {
4228
- title: "Discard Unsaved Changes?",
4229
- description: pendingAction === "back" ? "You have unsaved changes. Going back now will discard them." : "You have unsaved changes. Closing now will discard them.",
4230
- confirmLabel: pendingAction === "back" ? "Go Back Without Saving" : "Close Without Saving",
4252
+ title: locale("cfgpanel_discard_title"),
4253
+ description: pendingAction === "back" ? locale("cfgpanel_discard_desc_back") : locale("cfgpanel_discard_desc_close"),
4254
+ confirmLabel: pendingAction === "back" ? locale("cfgpanel_discard_confirm_back") : locale("cfgpanel_discard_confirm_close"),
4231
4255
  onConfirm: () => {
4232
4256
  const action = pendingAction;
4233
4257
  setPendingAction(null);
@@ -4265,7 +4289,7 @@ function ConfigPanelInner({
4265
4289
  /* @__PURE__ */ jsxRuntime.jsx(
4266
4290
  framerMotion.motion.button,
4267
4291
  {
4268
- title: "Back to script list",
4292
+ title: locale("cfgpanel_back_title"),
4269
4293
  onClick: handleBack,
4270
4294
  whileHover: { background: core.alpha(color, 0.16), borderColor: core.alpha(color, 0.45) },
4271
4295
  whileTap: { scale: 0.95 },
@@ -4293,7 +4317,7 @@ function ConfigPanelInner({
4293
4317
  /* @__PURE__ */ jsxRuntime.jsx(
4294
4318
  framerMotion.motion.button,
4295
4319
  {
4296
- title: "Undo",
4320
+ title: locale("cfgpanel_undo"),
4297
4321
  onClick: () => form.canBack && form.back(),
4298
4322
  disabled: !form.canBack,
4299
4323
  whileHover: form.canBack ? { background: "rgba(255,255,255,0.07)" } : void 0,
@@ -4305,7 +4329,7 @@ function ConfigPanelInner({
4305
4329
  /* @__PURE__ */ jsxRuntime.jsx(
4306
4330
  framerMotion.motion.button,
4307
4331
  {
4308
- title: "Redo",
4332
+ title: locale("cfgpanel_redo"),
4309
4333
  onClick: () => form.canForward && form.forward(),
4310
4334
  disabled: !form.canForward,
4311
4335
  whileHover: form.canForward ? { background: "rgba(255,255,255,0.07)" } : void 0,
@@ -4317,7 +4341,7 @@ function ConfigPanelInner({
4317
4341
  /* @__PURE__ */ jsxRuntime.jsx(
4318
4342
  framerMotion.motion.button,
4319
4343
  {
4320
- title: isSaving ? "Saving..." : isDirty ? `Save (${changedCount})` : "Save",
4344
+ title: isSaving ? locale("cfgpanel_saving") : isDirty ? `${locale("cfgpanel_save")} (${changedCount})` : locale("cfgpanel_save"),
4321
4345
  onClick: () => isDirty && !isSaving && form.submit(),
4322
4346
  disabled: !isDirty || isSaving,
4323
4347
  whileHover: isDirty && !isSaving ? { background: core.alpha(color, 0.25), borderColor: core.alpha(color, 0.5) } : void 0,
@@ -4329,7 +4353,7 @@ function ConfigPanelInner({
4329
4353
  /* @__PURE__ */ jsxRuntime.jsx(
4330
4354
  framerMotion.motion.button,
4331
4355
  {
4332
- title: "History",
4356
+ title: locale("cfgpanel_history"),
4333
4357
  onClick: () => setHistoryOpen(true),
4334
4358
  whileHover: { background: core.alpha("#22d3ee", 0.16), borderColor: core.alpha("#22d3ee", 0.5) },
4335
4359
  whileTap: { scale: 0.97 },
@@ -4350,7 +4374,7 @@ function ConfigPanelInner({
4350
4374
  style: { width: "100%", background: "transparent", border: `0.1vh solid ${isDirty ? core.alpha("#f97316", 0.35) : core.alpha(theme.colors.dark[5], 0.3)}`, borderRadius: theme.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" },
4351
4375
  children: [
4352
4376
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { color: isDirty ? "#f97316" : "rgba(255,255,255,0.35)", size: "1.6vh" }),
4353
- /* @__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" })
4377
+ /* @__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") })
4354
4378
  ]
4355
4379
  }
4356
4380
  ),
@@ -4364,7 +4388,7 @@ function ConfigPanelInner({
4364
4388
  style: { width: "100%", background: core.alpha(color, 0.07), border: `0.1vh solid ${core.alpha(color, 0.28)}`, borderRadius: theme.radius.xs, padding: "0.65vh 0.8vh", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.55vh" },
4365
4389
  children: [
4366
4390
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code2, { color, size: "1.6vh" }),
4367
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: "Manual Edit" })
4391
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: locale("cfgpanel_manual_edit") })
4368
4392
  ]
4369
4393
  }
4370
4394
  ),
@@ -4377,12 +4401,13 @@ function ConfigPanelInner({
4377
4401
  style: { width: "100%", background: core.alpha("#ef4444", 0.07), border: `0.1vh solid ${core.alpha("#ef4444", 0.25)}`, borderRadius: theme.radius.xs, padding: "0.65vh 0.8vh", cursor: "pointer", display: "flex", alignItems: "center", gap: "0.55vh" },
4378
4402
  children: [
4379
4403
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { color: "#ef4444", size: "1.6vh" }),
4380
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: "#ef4444", children: "Reset Defaults" })
4404
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: "#ef4444", children: locale("cfgpanel_reset_defaults") })
4381
4405
  ]
4382
4406
  }
4383
4407
  ),
4384
4408
  version && /* @__PURE__ */ jsxRuntime.jsxs(core.Text, { size: "0.95vh", c: "dimmed", ta: "center", style: { letterSpacing: "0.04em", opacity: 0.8 }, children: [
4385
- "Version ",
4409
+ locale("cfgpanel_version"),
4410
+ " ",
4386
4411
  version
4387
4412
  ] })
4388
4413
  ] })