8 Commits

Author SHA1 Message Date
github-actions
dec6caa63b chore: bump version to v3.31.0 2025-07-26 17:59:55 +00:00
mikigoalie
967682c449 fix(web/notifications): bottom center position (#33) 2025-07-26 16:07:52 +02:00
Luca
301ff2daf8 feat(interface/input): add size to input dialog options (#32) 2025-07-26 14:34:01 +02:00
ANTOND.
fd8d65166b fix(interface/input): add min and max length props to input type (#31) 2025-07-23 17:10:57 +02:00
ANTOND.
581640c07a feat(web/dialog/textarea): add min and max length (#30) 2025-07-15 21:51:52 +02:00
Mustafa Burak Güneş
9fbf0222ad fix(resource/cache): skip cache updates during ped transitions (#28)
also fixes an issue with cache not being set correctly when weapon hash is a negative number
2025-07-09 18:59:19 +02:00
Laica Lunasys
753d3eb025 chore: use nativewrappers/fivem instead of client (#25) 2025-06-30 15:59:34 +02:00
andreutu
815caddb02 fix(client/interface): add missing warning notify type in npm package (#23) 2025-06-08 15:01:32 +02:00
13 changed files with 48 additions and 36 deletions

View File

@@ -6,7 +6,7 @@ rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aw
name 'ox_lib' name 'ox_lib'
author 'Overextended' author 'Overextended'
version '3.30.10' version '3.31.0'
license 'LGPL-3.0-or-later' license 'LGPL-3.0-or-later'
repository 'https://github.com/communityox/ox_lib' repository 'https://github.com/communityox/ox_lib'
description 'A library of shared functions to utilise in other resources.' description 'A library of shared functions to utilise in other resources.'

View File

@@ -4,7 +4,7 @@
"": { "": {
"name": "@communityox/ox_lib", "name": "@communityox/ox_lib",
"dependencies": { "dependencies": {
"@nativewrappers/client": "^1.7.33", "@nativewrappers/fivem": "^0.0.103",
"csstype": "^3.1.3", "csstype": "^3.1.3",
"fast-printf": "^1.6.9", "fast-printf": "^1.6.9",
"typescript": "^5.4.2", "typescript": "^5.4.2",
@@ -97,7 +97,7 @@
"@mantine/utils": ["@mantine/utils@6.0.22", "", { "peerDependencies": { "react": ">=16.8.0" } }, "sha512-RSKlNZvxhMCkOFZ6slbYvZYbWjHUM+PxDQnupIOxIdsTZQQjx/BFfrfJ7kQFOP+g7MtpOds8weAetEs5obwMOQ=="], "@mantine/utils": ["@mantine/utils@6.0.22", "", { "peerDependencies": { "react": ">=16.8.0" } }, "sha512-RSKlNZvxhMCkOFZ6slbYvZYbWjHUM+PxDQnupIOxIdsTZQQjx/BFfrfJ7kQFOP+g7MtpOds8weAetEs5obwMOQ=="],
"@nativewrappers/client": ["@nativewrappers/client@1.7.33", "", {}, "sha512-phuBBGdDPxZiZyw5CaFs1XWfvllnEtwATMdLaNucwMofVg/O/FjlP1bTUq4SOm4qhSZ4Zdo351ijHzBSIbZs6g=="], "@nativewrappers/fivem": ["@nativewrappers/fivem@0.0.103", "", {}, "sha512-x0W00Mx9ZN/rTS9XZc5Kf1hjahqRmlo9sPiuJP4kCYeQG4LDJyglXCsHcfNfygGq6WEblG1W2FLgm4MGDn/wHA=="],
"@radix-ui/number": ["@radix-ui/number@1.0.0", "", { "dependencies": { "@babel/runtime": "^7.13.10" } }, "sha512-Ofwh/1HX69ZfJRiRBMTy7rgjAzHmwe4kW9C9Y99HTRUcYLUuVT0KESFj15rPjRgKJs20GPq8Bm5aEDJ8DuA3vA=="], "@radix-ui/number": ["@radix-ui/number@1.0.0", "", { "dependencies": { "@babel/runtime": "^7.13.10" } }, "sha512-Ofwh/1HX69ZfJRiRBMTy7rgjAzHmwe4kW9C9Y99HTRUcYLUuVT0KESFj15rPjRgKJs20GPq8Bm5aEDJ8DuA3vA=="],

View File

@@ -10,7 +10,7 @@ type NotificationPosition =
| 'bottom-left' | 'bottom-left'
| 'center-right' | 'center-right'
| 'center-left'; | 'center-left';
type NotificationType = 'inform' | 'error' | 'success'; type NotificationType = 'inform' | 'error' | 'success' | 'warning';
type IconAnimation = 'spin' | 'spinPulse' | 'spinReverse' | 'pulse' | 'beat' | 'fade' | 'beatFade' | 'bounce' | 'shake'; type IconAnimation = 'spin' | 'spinPulse' | 'spinReverse' | 'pulse' | 'beat' | 'fade' | 'beatFade' | 'bounce' | 'shake';
interface NotifyProps { interface NotifyProps {

View File

@@ -1,4 +1,4 @@
import { Vector3 } from '@nativewrappers/client'; import { Vector3 } from '@nativewrappers/fivem';
import { cache } from '../cache'; import { cache } from '../cache';
let points: Point[] = []; let points: Point[] = [];

View File

@@ -1,7 +1,7 @@
{ {
"name": "@communityox/ox_lib", "name": "@communityox/ox_lib",
"author": "Overextended", "author": "Overextended",
"version": "3.30.10", "version": "3.31.0",
"description": "JS/TS wrapper for ox_lib exports", "description": "JS/TS wrapper for ox_lib exports",
"main": "./shared/index.js", "main": "./shared/index.js",
"types": "./shared/index.d.ts", "types": "./shared/index.d.ts",
@@ -28,7 +28,7 @@
}, },
"license": "LGPL-3.0", "license": "LGPL-3.0",
"dependencies": { "dependencies": {
"@nativewrappers/client": "^1.7.33", "@nativewrappers/fivem": "^0.0.103",
"csstype": "^3.1.3", "csstype": "^3.1.3",
"fast-printf": "^1.6.9", "fast-printf": "^1.6.9",
"typescript": "^5.4.2" "typescript": "^5.4.2"

View File

@@ -1,6 +1,6 @@
import { cache } from '../cache/index'; import { cache } from '../cache/index';
import { context } from '../../index'; import { context } from '../../index';
import { Vector3 } from "@nativewrappers/client"; import { Vector3 } from "@nativewrappers/fivem";
interface NearbyVehicle { interface NearbyVehicle {
vehicle: number; vehicle: number;

View File

@@ -29,40 +29,43 @@ local GetCurrentPedWeapon = GetCurrentPedWeapon
CreateThread(function() CreateThread(function()
while true do while true do
local ped = PlayerPedId() local ped = PlayerPedId()
cache:set('ped', ped)
local vehicle = GetVehiclePedIsIn(ped, false) -- If the player's ped is changed, the ped value may return 0 during the transition. If the value is 0, skip all checks.
if ped ~= 0 then
cache:set('ped', ped)
if vehicle > 0 then local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= cache.vehicle then
if vehicle > 0 then
if vehicle ~= cache.vehicle then
cache:set('seat', false)
end
cache:set('vehicle', vehicle)
if not cache.seat or GetPedInVehicleSeat(vehicle, cache.seat) ~= ped then
for i = -1, GetVehicleMaxNumberOfPassengers(vehicle) - 1 do
if GetPedInVehicleSeat(vehicle, i) == ped then
cache:set('seat', i)
break
end
end
end
else
cache:set('vehicle', false)
cache:set('seat', false) cache:set('seat', false)
end end
cache:set('vehicle', vehicle) if cache.game == 'redm' then
local mount = GetMount(ped)
if not cache.seat or GetPedInVehicleSeat(vehicle, cache.seat) ~= ped then local onMount = IsPedOnMount(ped)
for i = -1, GetVehicleMaxNumberOfPassengers(vehicle) - 1 do cache:set('mount', onMount and mount or false)
if GetPedInVehicleSeat(vehicle, i) == ped then
cache:set('seat', i)
break
end
end
end end
else
cache:set('vehicle', false) local hasWeapon, currentWeapon = GetCurrentPedWeapon(ped, true)
cache:set('seat', false) cache:set('weapon', (hasWeapon and currentWeapon ~= 0) and currentWeapon or false)
end end
if cache.game == 'redm' then
local mount = GetMount(ped)
local onMount = IsPedOnMount(ped)
cache:set('mount', onMount and mount or false)
end
local hasWeapon, currentWeapon = GetCurrentPedWeapon(ped, true)
cache:set('weapon', hasWeapon and currentWeapon or false)
Wait(100) Wait(100)
end end
end) end)

View File

@@ -30,9 +30,12 @@ local input
---@field searchable? boolean ---@field searchable? boolean
---@field description? string ---@field description? string
---@field maxSelectedValues? number ---@field maxSelectedValues? number
---@field minLength? number
---@field maxLength? number
---@class InputDialogOptionsProps ---@class InputDialogOptionsProps
---@field allowCancel? boolean ---@field allowCancel? boolean
---@field size? 'xs' | 'sm' | 'md' | 'lg' | 'xl'
---@param heading string ---@param heading string
---@param rows string[] | InputDialogRowProps[] ---@param rows string[] | InputDialogRowProps[]

View File

@@ -26,6 +26,7 @@ export const debugCustomNotification = () => {
title: 'Error', title: 'Error',
description: 'Notification description', description: 'Notification description',
type: 'error', type: 'error',
position: "bottom"
}, },
}, },
]); ]);

View File

@@ -103,7 +103,7 @@ const InputDialog: React.FC = () => {
centered centered
closeOnEscape={fields.options?.allowCancel !== false} closeOnEscape={fields.options?.allowCancel !== false}
closeOnClickOutside={false} closeOnClickOutside={false}
size="xs" size={fields.options?.size || 'xs'}
styles={{ title: { textAlign: 'center', width: '100%', fontSize: 18 } }} styles={{ title: { textAlign: 'center', width: '100%', fontSize: 18 } }}
title={fields.heading} title={fields.heading}
withCloseButton={false} withCloseButton={false}

View File

@@ -24,6 +24,8 @@ const TextareaField: React.FC<Props> = (props) => {
autosize={props.row.autosize} autosize={props.row.autosize}
minRows={props.row.min} minRows={props.row.min}
maxRows={props.row.max} maxRows={props.row.max}
minLength={props.row.minLength}
maxLength={props.row.maxLength}
/> />
); );
}; };

View File

@@ -61,7 +61,7 @@ const getAnimation = (visible: boolean, position: string) => {
animation = { from: 'X(0px)', to: 'X(-100%)' }; animation = { from: 'X(0px)', to: 'X(-100%)' };
} else if (position === 'top-center') { } else if (position === 'top-center') {
animation = { from: 'Y(0px)', to: 'Y(-100%)' }; animation = { from: 'Y(0px)', to: 'Y(-100%)' };
} else if (position === 'bottom') { } else if (position === 'bottom-center') {
animation = { from: 'Y(0px)', to: 'Y(100%)' }; animation = { from: 'Y(0px)', to: 'Y(100%)' };
} else { } else {
animation = { from: 'X(0px)', to: 'X(100%)' }; animation = { from: 'X(0px)', to: 'X(100%)' };

View File

@@ -5,6 +5,7 @@ export interface InputProps {
rows: Array<IInput | ICheckbox | ISelect | INumber | ISlider | IColorInput | IDateInput | ITextarea | ITimeInput>; rows: Array<IInput | ICheckbox | ISelect | INumber | ISlider | IColorInput | IDateInput | ITextarea | ITimeInput>;
options?: { options?: {
allowCancel?: boolean; allowCancel?: boolean;
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
}; };
} }
@@ -76,4 +77,6 @@ export interface ITextarea extends BaseField<'textarea', string> {
autosize?: boolean; autosize?: boolean;
min?: number; min?: number;
max?: number; max?: number;
minLength?: number;
maxLength?: number;
} }