dirk-cfx-react 1.1.70 → 1.1.71

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.
@@ -9,6 +9,7 @@ var framerMotion = require('framer-motion');
9
9
  var lucideReact = require('lucide-react');
10
10
  var clickSoundUrl = require('../click_sound-PNCRRTM4.mp3');
11
11
  var hoverSoundUrl = require('../hover_sound-NBUA222C.mp3');
12
+ var notifications = require('@mantine/notifications');
12
13
  var reactQuery = require('@tanstack/react-query');
13
14
 
14
15
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -4082,12 +4083,25 @@ function ConfigPanel(props) {
4082
4083
  if (result?.success) {
4083
4084
  form.reinitialize(cloneConfig(form.values));
4084
4085
  configPanelQueryClient.invalidateQueries({ queryKey: ["scriptConfigHistory"] });
4086
+ notifications.notifications.show({
4087
+ color: "green",
4088
+ title: locale("ConfigSaveSuccessTitle"),
4089
+ message: locale("ConfigSaveSuccessBody"),
4090
+ autoClose: 3e3
4091
+ });
4085
4092
  return;
4086
4093
  }
4087
4094
  form.reinitialize(cloneConfig(store.getState()));
4088
- if (result?._error) {
4089
- console.warn(`[ConfigPanel] config save failed: ${result._error}`);
4090
- }
4095
+ const err = result?._error || "Unknown";
4096
+ console.warn(`[ConfigPanel] config save failed: ${err}`);
4097
+ const titleKey = err === "NoPermission" ? "ConfigSaveNoPermissionTitle" : err === "VersionConflict" ? "ConfigSaveVersionConflictTitle" : err === "NotReady" ? "ConfigSaveNotReadyTitle" : "ConfigSaveFailedTitle";
4098
+ const bodyKey = err === "NoPermission" ? "ConfigSaveNoPermissionBody" : err === "VersionConflict" ? "ConfigSaveVersionConflictBody" : err === "NotReady" ? "ConfigSaveNotReadyBody" : "ConfigSaveFailedBody";
4099
+ notifications.notifications.show({
4100
+ color: "red",
4101
+ title: locale(titleKey),
4102
+ message: locale(bodyKey, err),
4103
+ autoClose: 6e3
4104
+ });
4091
4105
  } finally {
4092
4106
  setIsSaving(false);
4093
4107
  }
@@ -4388,6 +4402,148 @@ function PickerButton({
4388
4402
  }
4389
4403
  ) });
4390
4404
  }
4405
+ function fmtV4(n) {
4406
+ return Number.isFinite(n) ? n.toFixed(2) : "0.00";
4407
+ }
4408
+ function Vector4Display({ value }) {
4409
+ const theme = core.useMantineTheme();
4410
+ return /* @__PURE__ */ jsxRuntime.jsx(
4411
+ core.Flex,
4412
+ {
4413
+ align: "center",
4414
+ gap: "xs",
4415
+ p: "xs",
4416
+ style: {
4417
+ background: core.alpha(theme.colors.dark[5], 0.35),
4418
+ border: "0.1vh solid rgba(255,255,255,0.05)",
4419
+ borderRadius: theme.radius.xs
4420
+ },
4421
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
4422
+ core.Text,
4423
+ {
4424
+ ff: "monospace",
4425
+ size: "xxs",
4426
+ c: "rgba(255,255,255,0.85)",
4427
+ style: { flex: 1, letterSpacing: "0.02em", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" },
4428
+ children: [
4429
+ "vector4(",
4430
+ fmtV4(value.x),
4431
+ ", ",
4432
+ fmtV4(value.y),
4433
+ ", ",
4434
+ fmtV4(value.z),
4435
+ ", ",
4436
+ fmtV4(value.w),
4437
+ ")"
4438
+ ]
4439
+ }
4440
+ )
4441
+ }
4442
+ );
4443
+ }
4444
+ function Vector4ActionButton({
4445
+ icon,
4446
+ label,
4447
+ tooltip,
4448
+ onClick,
4449
+ color,
4450
+ compact
4451
+ }) {
4452
+ const theme = core.useMantineTheme();
4453
+ return /* @__PURE__ */ jsxRuntime.jsx(core.Tooltip, { label: tooltip, position: "top", withArrow: true, withinPortal: true, zIndex: 2e3, children: /* @__PURE__ */ jsxRuntime.jsxs(
4454
+ framerMotion.motion.button,
4455
+ {
4456
+ onClick,
4457
+ whileHover: { background: core.alpha(color, 0.18) },
4458
+ whileTap: { scale: 0.95 },
4459
+ style: {
4460
+ background: core.alpha(color, 0.1),
4461
+ border: `0.1vh solid ${core.alpha(color, 0.35)}`,
4462
+ borderRadius: theme.radius.xs,
4463
+ padding: compact ? "0.25vh 0.6vh" : "0.5vh 0.8vh",
4464
+ cursor: "pointer",
4465
+ display: "flex",
4466
+ alignItems: "center",
4467
+ gap: compact ? "0.3vh" : "0.4vh"
4468
+ },
4469
+ children: [
4470
+ icon,
4471
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: label })
4472
+ ]
4473
+ }
4474
+ ) });
4475
+ }
4476
+ function WorldPositionSetButton({
4477
+ value,
4478
+ onChange,
4479
+ compact
4480
+ }) {
4481
+ const theme = core.useMantineTheme();
4482
+ const color = theme.colors[theme.primaryColor][5];
4483
+ const grab = async () => {
4484
+ try {
4485
+ const resp = await fetchNui("GET_POSITION", {}, value);
4486
+ if (!resp || typeof resp !== "object") return;
4487
+ onChange({
4488
+ x: Number(resp.x ?? 0),
4489
+ y: Number(resp.y ?? 0),
4490
+ z: Number(resp.z ?? 0),
4491
+ w: Number(resp.w ?? 0)
4492
+ });
4493
+ } catch {
4494
+ }
4495
+ };
4496
+ return /* @__PURE__ */ jsxRuntime.jsx(
4497
+ Vector4ActionButton,
4498
+ {
4499
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Crosshair, { size: compact ? "1.1vh" : "1.3vh", color }),
4500
+ label: locale("Set"),
4501
+ tooltip: locale("SetWorldTooltip"),
4502
+ onClick: grab,
4503
+ color,
4504
+ compact
4505
+ }
4506
+ );
4507
+ }
4508
+ function WorldPositionGotoButton({
4509
+ value,
4510
+ compact
4511
+ }) {
4512
+ const theme = core.useMantineTheme();
4513
+ const color = theme.colors[theme.primaryColor][5];
4514
+ const goto = () => {
4515
+ fetchNui("GOTO_POSITION", value).catch(() => {
4516
+ });
4517
+ };
4518
+ return /* @__PURE__ */ jsxRuntime.jsx(
4519
+ Vector4ActionButton,
4520
+ {
4521
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MapPin, { size: compact ? "1.1vh" : "1.3vh", color }),
4522
+ label: locale("Goto"),
4523
+ tooltip: locale("GotoWorldTooltip"),
4524
+ onClick: goto,
4525
+ color,
4526
+ compact
4527
+ }
4528
+ );
4529
+ }
4530
+ function Vector4DeleteButton({
4531
+ onClick,
4532
+ compact
4533
+ }) {
4534
+ const color = "#ef4444";
4535
+ return /* @__PURE__ */ jsxRuntime.jsx(
4536
+ Vector4ActionButton,
4537
+ {
4538
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { size: compact ? "1.1vh" : "1.3vh", color }),
4539
+ label: locale("Delete"),
4540
+ tooltip: locale("Delete"),
4541
+ onClick,
4542
+ color,
4543
+ compact
4544
+ }
4545
+ );
4546
+ }
4391
4547
  var GroupSelectContext = react.createContext(null);
4392
4548
  function GroupSelect({
4393
4549
  value,
@@ -4876,6 +5032,10 @@ exports.SegmentedProgress = SegmentedProgress;
4876
5032
  exports.SelectItem = SelectItem;
4877
5033
  exports.TestBed = TestBed;
4878
5034
  exports.Title = Title;
5035
+ exports.Vector4DeleteButton = Vector4DeleteButton;
5036
+ exports.Vector4Display = Vector4Display;
5037
+ exports.WorldPositionGotoButton = WorldPositionGotoButton;
5038
+ exports.WorldPositionSetButton = WorldPositionSetButton;
4879
5039
  exports.useModal = useModal;
4880
5040
  exports.useModalActions = useModalActions;
4881
5041
  exports.useNavigation = useNavigation;