dirk-cfx-react 1.1.69 → 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.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { AdminPageTitle, AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, TestBed, TestBedItem, TestBedProps, Title, TitleProps, Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
1
+ export { AdminPageTitle, AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, TestBed, TestBedItem, TestBedProps, Title, TitleProps, Vector4DeleteButton, Vector4Display, Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
2
2
  export { FrameworkGrade, FrameworkGroup, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GtaControl, GtaControlGroup, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, getImageShape, getItemImageUrl, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useFrameworkGroups, useItems, useItemsList, useProfanityStore, useSettings } from './utils/index.cjs';
3
3
  export { FormProvider, FormState, NuiHandlerSignature, NuiMessageData, ScriptConfigHistoryChange, ScriptConfigHistoryEntry, ScriptConfigHistoryRequest, ScriptConfigHistoryResponse, ScriptConfigInstance, TornEdgeSVGFilter, ValidationRules, ValidatorFn, createFormStore, createScriptConfig, getScriptConfigInstance, useAudio, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useNuiEvent, useTornEdges } from './hooks/index.cjs';
4
4
  export { DirkProvider, DirkProviderProps } from './providers/index.cjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AdminPageTitle, AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, TestBed, TestBedItem, TestBedProps, Title, TitleProps, Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
1
+ export { AdminPageTitle, AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, TestBed, TestBedItem, TestBedProps, Title, TitleProps, Vector4DeleteButton, Vector4Display, Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
2
2
  export { FrameworkGrade, FrameworkGroup, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GtaControl, GtaControlGroup, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, getImageShape, getItemImageUrl, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useFrameworkGroups, useItems, useItemsList, useProfanityStore, useSettings } from './utils/index.js';
3
3
  export { FormProvider, FormState, NuiHandlerSignature, NuiMessageData, ScriptConfigHistoryChange, ScriptConfigHistoryEntry, ScriptConfigHistoryRequest, ScriptConfigHistoryResponse, ScriptConfigInstance, TornEdgeSVGFilter, ValidationRules, ValidatorFn, createFormStore, createScriptConfig, getScriptConfigInstance, useAudio, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useNuiEvent, useTornEdges } from './hooks/index.js';
4
4
  export { DirkProvider, DirkProviderProps } from './providers/index.js';
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
8
8
  import { Info, X, AlertTriangle, Trash2, MapPin, Crosshair, EyeOff, Eye, RotateCcw, Check, FlaskConical, ChevronUp, ChevronDown, ArrowLeft, Undo2, Redo2, Save, History, XCircle, Code2, Search, Filter, User } from 'lucide-react';
9
9
  import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
10
10
  import hoverSoundUrl from './hover_sound-NBUA222C.mp3';
11
+ import { notifications } from '@mantine/notifications';
11
12
  import { QueryClient, QueryClientProvider, useInfiniteQuery } from '@tanstack/react-query';
12
13
  import '@mantine/core/styles.css';
13
14
  import '@mantine/notifications/styles.css';
@@ -4808,12 +4809,25 @@ function ConfigPanel(props) {
4808
4809
  if (result?.success) {
4809
4810
  form.reinitialize(cloneConfig(form.values));
4810
4811
  configPanelQueryClient.invalidateQueries({ queryKey: ["scriptConfigHistory"] });
4812
+ notifications.show({
4813
+ color: "green",
4814
+ title: locale("ConfigSaveSuccessTitle"),
4815
+ message: locale("ConfigSaveSuccessBody"),
4816
+ autoClose: 3e3
4817
+ });
4811
4818
  return;
4812
4819
  }
4813
4820
  form.reinitialize(cloneConfig(store.getState()));
4814
- if (result?._error) {
4815
- console.warn(`[ConfigPanel] config save failed: ${result._error}`);
4816
- }
4821
+ const err = result?._error || "Unknown";
4822
+ console.warn(`[ConfigPanel] config save failed: ${err}`);
4823
+ const titleKey = err === "NoPermission" ? "ConfigSaveNoPermissionTitle" : err === "VersionConflict" ? "ConfigSaveVersionConflictTitle" : err === "NotReady" ? "ConfigSaveNotReadyTitle" : "ConfigSaveFailedTitle";
4824
+ const bodyKey = err === "NoPermission" ? "ConfigSaveNoPermissionBody" : err === "VersionConflict" ? "ConfigSaveVersionConflictBody" : err === "NotReady" ? "ConfigSaveNotReadyBody" : "ConfigSaveFailedBody";
4825
+ notifications.show({
4826
+ color: "red",
4827
+ title: locale(titleKey),
4828
+ message: locale(bodyKey, err),
4829
+ autoClose: 6e3
4830
+ });
4817
4831
  } finally {
4818
4832
  setIsSaving(false);
4819
4833
  }
@@ -4832,7 +4846,7 @@ function ConfigPanel(props) {
4832
4846
  }
4833
4847
  ) });
4834
4848
  }
4835
- function LazyImage({ src, alt, style }) {
4849
+ function LazyImage({ src, style }) {
4836
4850
  const [visible, setVisible] = useState(false);
4837
4851
  const ref = useRef(null);
4838
4852
  useEffect(() => {
@@ -4845,7 +4859,7 @@ function LazyImage({ src, alt, style }) {
4845
4859
  if (ref.current) observer.observe(ref.current);
4846
4860
  return () => observer.disconnect();
4847
4861
  }, []);
4848
- return /* @__PURE__ */ jsx("div", { ref, style: { width: "4vh", height: "4vh" }, children: visible && /* @__PURE__ */ jsx(Image$1, { src, alt, fit: "contain", style }) });
4862
+ return /* @__PURE__ */ jsx("div", { ref, style: { width: "4vh", height: "4vh" }, children: visible && /* @__PURE__ */ jsx(Image$1, { src, fit: "contain", style }) });
4849
4863
  }
4850
4864
  function SelectItem(props) {
4851
4865
  const invItems = useItems();
@@ -4873,12 +4887,12 @@ function SelectItem(props) {
4873
4887
  searchable: true,
4874
4888
  comboboxProps: { withinPortal: true, zIndex: 2e3 },
4875
4889
  leftSectionWidth: "4vh",
4890
+ leftSectionPointerEvents: "none",
4876
4891
  leftSection: props.value ? /* @__PURE__ */ jsx(
4877
4892
  Image$1,
4878
4893
  {
4879
4894
  fallbackSrc: "/placeholder.png",
4880
4895
  src: invItems[props.value]?.image || "",
4881
- alt: props.value,
4882
4896
  fit: "contain",
4883
4897
  maw: "4vh",
4884
4898
  style: { aspectRatio: "1 / 1" }
@@ -4890,7 +4904,6 @@ function SelectItem(props) {
4890
4904
  LazyImage,
4891
4905
  {
4892
4906
  src: invItems[item.option.value]?.image || "",
4893
- alt: item.option.label,
4894
4907
  style: { aspectRatio: "1 / 1" }
4895
4908
  }
4896
4909
  ),
@@ -5115,6 +5128,148 @@ function PickerButton({
5115
5128
  }
5116
5129
  ) });
5117
5130
  }
5131
+ function fmtV4(n) {
5132
+ return Number.isFinite(n) ? n.toFixed(2) : "0.00";
5133
+ }
5134
+ function Vector4Display({ value }) {
5135
+ const theme2 = useMantineTheme();
5136
+ return /* @__PURE__ */ jsx(
5137
+ Flex,
5138
+ {
5139
+ align: "center",
5140
+ gap: "xs",
5141
+ p: "xs",
5142
+ style: {
5143
+ background: alpha(theme2.colors.dark[5], 0.35),
5144
+ border: "0.1vh solid rgba(255,255,255,0.05)",
5145
+ borderRadius: theme2.radius.xs
5146
+ },
5147
+ children: /* @__PURE__ */ jsxs(
5148
+ Text,
5149
+ {
5150
+ ff: "monospace",
5151
+ size: "xxs",
5152
+ c: "rgba(255,255,255,0.85)",
5153
+ style: { flex: 1, letterSpacing: "0.02em", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" },
5154
+ children: [
5155
+ "vector4(",
5156
+ fmtV4(value.x),
5157
+ ", ",
5158
+ fmtV4(value.y),
5159
+ ", ",
5160
+ fmtV4(value.z),
5161
+ ", ",
5162
+ fmtV4(value.w),
5163
+ ")"
5164
+ ]
5165
+ }
5166
+ )
5167
+ }
5168
+ );
5169
+ }
5170
+ function Vector4ActionButton({
5171
+ icon,
5172
+ label: label2,
5173
+ tooltip,
5174
+ onClick,
5175
+ color,
5176
+ compact
5177
+ }) {
5178
+ const theme2 = useMantineTheme();
5179
+ return /* @__PURE__ */ jsx(Tooltip, { label: tooltip, position: "top", withArrow: true, withinPortal: true, zIndex: 2e3, children: /* @__PURE__ */ jsxs(
5180
+ motion.button,
5181
+ {
5182
+ onClick,
5183
+ whileHover: { background: alpha(color, 0.18) },
5184
+ whileTap: { scale: 0.95 },
5185
+ style: {
5186
+ background: alpha(color, 0.1),
5187
+ border: `0.1vh solid ${alpha(color, 0.35)}`,
5188
+ borderRadius: theme2.radius.xs,
5189
+ padding: compact ? "0.25vh 0.6vh" : "0.5vh 0.8vh",
5190
+ cursor: "pointer",
5191
+ display: "flex",
5192
+ alignItems: "center",
5193
+ gap: compact ? "0.3vh" : "0.4vh"
5194
+ },
5195
+ children: [
5196
+ icon,
5197
+ /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.06em", c: color, children: label2 })
5198
+ ]
5199
+ }
5200
+ ) });
5201
+ }
5202
+ function WorldPositionSetButton({
5203
+ value,
5204
+ onChange,
5205
+ compact
5206
+ }) {
5207
+ const theme2 = useMantineTheme();
5208
+ const color = theme2.colors[theme2.primaryColor][5];
5209
+ const grab = async () => {
5210
+ try {
5211
+ const resp = await fetchNui("GET_POSITION", {}, value);
5212
+ if (!resp || typeof resp !== "object") return;
5213
+ onChange({
5214
+ x: Number(resp.x ?? 0),
5215
+ y: Number(resp.y ?? 0),
5216
+ z: Number(resp.z ?? 0),
5217
+ w: Number(resp.w ?? 0)
5218
+ });
5219
+ } catch {
5220
+ }
5221
+ };
5222
+ return /* @__PURE__ */ jsx(
5223
+ Vector4ActionButton,
5224
+ {
5225
+ icon: /* @__PURE__ */ jsx(Crosshair, { size: compact ? "1.1vh" : "1.3vh", color }),
5226
+ label: locale("Set"),
5227
+ tooltip: locale("SetWorldTooltip"),
5228
+ onClick: grab,
5229
+ color,
5230
+ compact
5231
+ }
5232
+ );
5233
+ }
5234
+ function WorldPositionGotoButton({
5235
+ value,
5236
+ compact
5237
+ }) {
5238
+ const theme2 = useMantineTheme();
5239
+ const color = theme2.colors[theme2.primaryColor][5];
5240
+ const goto = () => {
5241
+ fetchNui("GOTO_POSITION", value).catch(() => {
5242
+ });
5243
+ };
5244
+ return /* @__PURE__ */ jsx(
5245
+ Vector4ActionButton,
5246
+ {
5247
+ icon: /* @__PURE__ */ jsx(MapPin, { size: compact ? "1.1vh" : "1.3vh", color }),
5248
+ label: locale("Goto"),
5249
+ tooltip: locale("GotoWorldTooltip"),
5250
+ onClick: goto,
5251
+ color,
5252
+ compact
5253
+ }
5254
+ );
5255
+ }
5256
+ function Vector4DeleteButton({
5257
+ onClick,
5258
+ compact
5259
+ }) {
5260
+ const color = "#ef4444";
5261
+ return /* @__PURE__ */ jsx(
5262
+ Vector4ActionButton,
5263
+ {
5264
+ icon: /* @__PURE__ */ jsx(Trash2, { size: compact ? "1.1vh" : "1.3vh", color }),
5265
+ label: locale("Delete"),
5266
+ tooltip: locale("Delete"),
5267
+ onClick,
5268
+ color,
5269
+ compact
5270
+ }
5271
+ );
5272
+ }
5118
5273
  var GroupSelectContext = createContext(null);
5119
5274
  function GroupSelect({
5120
5275
  value,
@@ -5871,6 +6026,6 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
5871
6026
  return /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsx(DirkErrorBoundary, { children: content }) });
5872
6027
  }
5873
6028
 
5874
- export { AdminPageTitle, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, ControlMultiSelect, ControlSelect, Counter, DirkProvider, FiveMKeyBindInput, FloatingParticles, FormProvider, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GroupName, GroupRank, GroupSelect, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InfoBox, InputContainer, LevelBanner, LevelPanel, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createFormStore, createScriptConfig, createSkill, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, getImageShape, getItemImageUrl, getScriptConfigInstance, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAudio, useAutoFetcher, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useFrameworkGroups, useItems, useItemsList, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
6029
+ export { AdminPageTitle, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, ControlMultiSelect, ControlSelect, Counter, DirkProvider, FiveMKeyBindInput, FloatingParticles, FormProvider, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GroupName, GroupRank, GroupSelect, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InfoBox, InputContainer, LevelBanner, LevelPanel, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, Title, TornEdgeSVGFilter, Vector4DeleteButton, Vector4Display, WorldPositionGotoButton, WorldPositionSetButton, colorWithAlpha, copyToClipboard, createFormStore, createScriptConfig, createSkill, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, getImageShape, getItemImageUrl, getScriptConfigInstance, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAudio, useAutoFetcher, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useFrameworkGroups, useItems, useItemsList, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
5875
6030
  //# sourceMappingURL=index.js.map
5876
6031
  //# sourceMappingURL=index.js.map