dirk-cfx-react 1.0.49 → 1.0.50
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/components/index.cjs +132 -6
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +10 -1
- package/dist/components/index.d.ts +10 -1
- package/dist/components/index.js +133 -8
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +85 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +86 -6
- package/dist/index.js.map +1 -1
- package/dist/utils/index.cjs +2 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var zustand = require('zustand');
|
|
3
5
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
4
6
|
var core = require('@mantine/core');
|
|
5
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
8
|
var framerMotion = require('framer-motion');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
var zustand = require('zustand');
|
|
9
9
|
var clickSoundUrl = require('../click_sound-PNCRRTM4.mp3');
|
|
10
10
|
var hoverSoundUrl = require('../hover_sound-NBUA222C.mp3');
|
|
11
11
|
require('@mantine/core/styles.css');
|
|
@@ -170,11 +170,11 @@ var colorNames = {
|
|
|
170
170
|
Yellow: { r: 255, g: 255, b: 0 },
|
|
171
171
|
YellowGreen: { r: 154, g: 205, b: 50 }
|
|
172
172
|
};
|
|
173
|
-
function colorWithAlpha(color,
|
|
173
|
+
function colorWithAlpha(color, alpha3) {
|
|
174
174
|
const lowerCasedColor = color.toLowerCase();
|
|
175
175
|
if (colorNames[lowerCasedColor]) {
|
|
176
176
|
const rgb = colorNames[lowerCasedColor];
|
|
177
|
-
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${
|
|
177
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha3})`;
|
|
178
178
|
}
|
|
179
179
|
if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
|
|
180
180
|
const hex = color.slice(1);
|
|
@@ -182,16 +182,63 @@ function colorWithAlpha(color, alpha2) {
|
|
|
182
182
|
const r = bigint >> 16 & 255;
|
|
183
183
|
const g = bigint >> 8 & 255;
|
|
184
184
|
const b = bigint & 255;
|
|
185
|
-
return `rgba(${r}, ${g}, ${b}, ${
|
|
185
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha3})`;
|
|
186
186
|
}
|
|
187
187
|
if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
|
|
188
188
|
const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
|
|
189
189
|
if (result) {
|
|
190
|
-
return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${
|
|
190
|
+
return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha3})`;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
return color;
|
|
194
194
|
}
|
|
195
|
+
|
|
196
|
+
// src/utils/misc.ts
|
|
197
|
+
var isEnvBrowser = () => !window.invokeNative;
|
|
198
|
+
|
|
199
|
+
// src/utils/fetchNui.ts
|
|
200
|
+
async function fetchNui(eventName, data, mockData) {
|
|
201
|
+
const options = {
|
|
202
|
+
method: "post",
|
|
203
|
+
headers: {
|
|
204
|
+
"Content-Type": "application/json; charset=UTF-8"
|
|
205
|
+
},
|
|
206
|
+
body: JSON.stringify(data)
|
|
207
|
+
};
|
|
208
|
+
console.log(mockData);
|
|
209
|
+
if (isEnvBrowser() && mockData === void 0) {
|
|
210
|
+
console.warn(
|
|
211
|
+
`[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
|
|
212
|
+
);
|
|
213
|
+
return {};
|
|
214
|
+
}
|
|
215
|
+
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
|
|
216
|
+
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
217
|
+
return await resp.json();
|
|
218
|
+
}
|
|
219
|
+
async function registerInitialFetch(eventName, data, mockData) {
|
|
220
|
+
const fetcher = () => fetchNui(eventName, data, mockData);
|
|
221
|
+
return fetcher();
|
|
222
|
+
}
|
|
223
|
+
var localeStore = zustand.create((set, get) => {
|
|
224
|
+
return {
|
|
225
|
+
locales: {
|
|
226
|
+
"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."
|
|
227
|
+
},
|
|
228
|
+
locale: (key, ...args) => {
|
|
229
|
+
const exists = get().locales[key];
|
|
230
|
+
let translation = exists || key;
|
|
231
|
+
if (args.length) {
|
|
232
|
+
translation = translation.replace(/%s/g, () => String(args.shift() || ""));
|
|
233
|
+
}
|
|
234
|
+
return translation;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
var locale = localeStore.getState().locale;
|
|
239
|
+
registerInitialFetch("GET_LOCALES", void 0).then((data) => {
|
|
240
|
+
localeStore.setState({ locales: data });
|
|
241
|
+
});
|
|
195
242
|
function BorderedIcon(props) {
|
|
196
243
|
const theme = core.useMantineTheme();
|
|
197
244
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1054,6 +1101,84 @@ function LevelBanner(props) {
|
|
|
1054
1101
|
}
|
|
1055
1102
|
);
|
|
1056
1103
|
}
|
|
1104
|
+
function LevelPanel(props) {
|
|
1105
|
+
const theme = core.useMantineTheme();
|
|
1106
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1107
|
+
core.Flex,
|
|
1108
|
+
{
|
|
1109
|
+
w: "fit-content",
|
|
1110
|
+
pr: "8vh",
|
|
1111
|
+
pl: "8vh",
|
|
1112
|
+
bg: "linear-gradient(180deg, rgba(30, 30, 30, 0.82) 0%, rgba(30, 30, 30, 0.3) 50%, rgba(30, 30, 30, 0.6) 100%)",
|
|
1113
|
+
style: {
|
|
1114
|
+
borderRadius: theme.radius.xs,
|
|
1115
|
+
boxShadow: theme.shadows.sm,
|
|
1116
|
+
outline: "0.2vh solid rgba(255,255,255,0.1)"
|
|
1117
|
+
},
|
|
1118
|
+
justify: "center",
|
|
1119
|
+
align: "center",
|
|
1120
|
+
direction: "column",
|
|
1121
|
+
p: "sm",
|
|
1122
|
+
children: [
|
|
1123
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1124
|
+
core.RingProgress,
|
|
1125
|
+
{
|
|
1126
|
+
size: 190,
|
|
1127
|
+
roundCaps: true,
|
|
1128
|
+
thickness: 10,
|
|
1129
|
+
sections: [{ value: props.progressToLevel, color: core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.9) }],
|
|
1130
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1131
|
+
core.Flex,
|
|
1132
|
+
{
|
|
1133
|
+
justify: "center",
|
|
1134
|
+
align: "center",
|
|
1135
|
+
direction: "column",
|
|
1136
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1137
|
+
core.Text,
|
|
1138
|
+
{
|
|
1139
|
+
size: "6vh",
|
|
1140
|
+
c: core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.9),
|
|
1141
|
+
style: {
|
|
1142
|
+
fontFamily: "Akrobat Black",
|
|
1143
|
+
textShadow: `0 0 10px ${core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.7)}`
|
|
1144
|
+
},
|
|
1145
|
+
children: props.level
|
|
1146
|
+
}
|
|
1147
|
+
)
|
|
1148
|
+
}
|
|
1149
|
+
)
|
|
1150
|
+
}
|
|
1151
|
+
),
|
|
1152
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1153
|
+
core.Text,
|
|
1154
|
+
{
|
|
1155
|
+
size: "sm",
|
|
1156
|
+
style: {
|
|
1157
|
+
fontFamily: "Akrobat Black",
|
|
1158
|
+
letterSpacing: "0.05em",
|
|
1159
|
+
textTransform: "uppercase"
|
|
1160
|
+
},
|
|
1161
|
+
children: props.text || locale("Level")
|
|
1162
|
+
}
|
|
1163
|
+
),
|
|
1164
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1165
|
+
core.Text,
|
|
1166
|
+
{
|
|
1167
|
+
size: "xs",
|
|
1168
|
+
c: "rgba(255,255,255,0.6)",
|
|
1169
|
+
children: [
|
|
1170
|
+
props.exp,
|
|
1171
|
+
"/",
|
|
1172
|
+
props.nextLevelXP,
|
|
1173
|
+
" ",
|
|
1174
|
+
locale("EXP")
|
|
1175
|
+
]
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
1178
|
+
]
|
|
1179
|
+
}
|
|
1180
|
+
);
|
|
1181
|
+
}
|
|
1057
1182
|
var ModalContext = react.createContext(null);
|
|
1058
1183
|
function useModal(selector) {
|
|
1059
1184
|
const modal = react.useContext(ModalContext);
|
|
@@ -1210,6 +1335,7 @@ exports.FloatingParticles = FloatingParticles;
|
|
|
1210
1335
|
exports.InfoBox = InfoBox;
|
|
1211
1336
|
exports.InputContainer = InputContainer;
|
|
1212
1337
|
exports.LevelBanner = LevelBanner;
|
|
1338
|
+
exports.LevelPanel = LevelPanel;
|
|
1213
1339
|
exports.ModalContext = ModalContext;
|
|
1214
1340
|
exports.ModalProvider = ModalProvider;
|
|
1215
1341
|
exports.MotionFlex = MotionFlex;
|